kubernetes – Zookeeper-shell is Returning null for broker requests

Background

On my Kubernetes cluster, I have installed Zookeeper & Kafka using Confluent Operator. I have confirmed that they are configured properly by creating and publishing to a Kafka topic.

Problem

When I use the zookeeper-shell, the command:
get /brokers/ids returns null, while I’m expecting something like (0, 1, 2)

Details

I am using the zookeeper-shell from within the Kubernetes cluster, and am connecting without difficulty with the following command:
~/bin/zookeeper-shell zookeeper:2181

The following commands output the correct (non-null) response: get /zookeeper/config, get /cluster/id

But the following commands return null: get /brokers/ids, get /brokers/topics

More Info

The fact that I know the brokers are working makes this strange. It could be a security issue, but it seems strange that the other requests would work in that case. Finally, Confluent Control Center is directly telling me that broker.id 1 is the controller, which implies that this data is somehow retrievable. Any help here would be appreciated. Thank you.

rest – POSTing a nested object – returning the created nested object inside the parent

Suppose that we have a Post resource (this is just a dummy example):

GET /api/posts/1

{
  "id": 1,
  "header": null,
  "content": null
}

And now we’d like to create a Header inside the Post#1.

POST /api/posts/1/header

{
  "color": "blue",
  "title": "Some title"
}

Now, is it okay for the POST request above to return the following response?

{
  "id": 1,
  "header": {
    "id": 1,
    "color": "blue",
    "title": "Some title"
  },
  "content": null
}

So, basically, a Header was created inside the Post and returned as part of the Post.

Also, if we need to GET the header for Post#1:

GET api/posts/1/header

 {
   "id": 1,
   "color": "blue",
   "title": "Some title"
}

So here only the Header is returned.

equation solving – Why Mathematica is returning a complicated output rather than a simple one (as in the screenshot)

I am using Nsolve to get output on my thread of equations. I have two screenshots attached here. I was supposed to get the same result as pic#1enter image description here, rather than pic#2. Can someone help me with how can I make my answer according to Pic#1?
Also, I’m getting the warning “Solve::ratnz: Solve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result.”

enter image description here

performance – Function returning a vec with prime factors of number

See code below and my comment with questions:

pub fn factors(n: u64) -> Vec<u64> {
    let mut m = n; // is it possible to convert n to a mutable type without using another variable?
    let mut a:Vec<u64> = Vec::new();
    while m % 2 == 0 {
        a.push(2);
    }
    // in C we can just write for (int i = 3; i <= sqrt(m); i+= 2) ... just saying... and C is not even as fast as python to code... am I really doing it right??
    for i in (3..((m as f64).sqrt() as usize + 1usize)).step_by(2) { 
        while m % i as u64 == 0 { // is there a way to avoid all the casts to u64
            a.push(i as u64);
            m /= i as u64;
        }
    }
    if m > 2 {
        a.push(m);
    }
    return a;
}
  • Is it possible to convert n to a mutable type without using another variable?
  • The C equivalent of the main loop use twice less ink. Is Rust so verbose by design?
  • Is there a way to avoid all the casts to u64
  • any other insight welcome

8 – Any idea why view->field is empty when executing a view returning user emails?

We are using Business Rules to execute a view (users) that returns a list of email addresses. It works fine when rule is triggered by admin, but does not work when triggered by other users. In debugging it I found the following:

  1. as both users the view returns the correct result rows, ie. $view->result is identical for both users.
  2. as admin the view object contains a list of the fields which business_rules uses, ie. $fields = $view->field is an array keyed on ‘mail’;
  3. as any other user $view->field is empty UNLESS I turn on administer users permissions for that user’s role!

I am thinking that in views a permission to view the mail field is being checked when the ‘fields’ are populated into the view object. But, oddly enough that permission does not effect the view result as mentioned in #1.

Any thoughts on how to debug this further?

algorithm – Returning a vector having squared, sorted (ascending) of the argument (vector)

struct Solution {
nums: Vec<i32>,
}

impl Solution {
    pub fn sorted_squares(nums: Vec<i32>) -> Vec<i32> {
        let mut b: Vec<i32> = nums.iter().map(|x| x * x).collect();
        b.sort_unstable()
    }
}

fn main() {
    let a = Solution {
        nums: (12, 1, 2, 3, 4, 6, 9).to_vec(),
    };

    let mut b: Vec<i32> = Solution::sorted_squares(a.nums);

    println!("{:?}", b);
}

What should be done so that .sort_unstable() return value be converted into vector to return to the function.
Please review and make suggestions

Why is my MySQL query returning a value while the same query inside a stored procedure returns null?

I have this procedure that pulls in some percentiles from four views, then returns a “weighted score”. When I run this as a query, replacing the uuids, it works fine, but if I try to pass in the same uuid to the stored procedure containing the same query, it returns null. Any idea why?

CREATE DEFINER=`guymandude`@`%` PROCEDURE `get_weighted_score`(IN inUUID char(36), OUT score double)
BEGIN
SELECT (avgPointsPerGamePercentile + percentageCapsPercentile + percentageWinsPercentile + killToDeathRatioPercentile) as weightedScore FROM (
    SELECT 
        points.percentile as avgPointsPerGamePercentile, 
        caps.percentile as percentageCapsPercentile, 
        wins.percentile as percentageWinsPercentile, 
        kd.percentile as killToDeathRatioPercentile
    FROM (
        (SELECT (percentile * .35) as percentile from avgPointsPerGamePercentile WHERE uuid = inUUID) as points,
        (SELECT (percentile * .25) as percentile from percentageCapsPercentile WHERE uuid = inUUID) as caps,
        (SELECT (percentile * .20) as percentile from percentageWinsPercentile WHERE uuid = inUUID) as wins,
        (SELECT (percentile * .20) as percentile from killToDeathRatioPercentile WHERE uuid = inUUID) as kd
    ) 
) as score;
END

enterprise search – People Result Source in SharePoint 2013 not returning results

I am not sure if you have set up everything for mysite and people search.

could you verify that you did everything of the following:

The process is similar but there are a few things to be aware of. People Search requires you to have the User Profile Service Application up and running as well as My Sites. If you don’t have either of those configured, People Search will not work and you will likely see an error like the following in your crawl log.

http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2013/01/03/how-to-set-up-people-search-in-sharepoint-2013.aspx

And also could you just try to create a mysite site collection for one user and then crawl the mysite and check if that particular user can be found? My feeling (not 100% sure) is, that people can’t be found if the user has not MySite site collection.

Sharepoint 2013 Search not returning results (file share content source)

I’m having a problem with my search that is not returning any results. What I’ve done so far:

  • Created a File Share folder inside the SharePoint Server
  • Created a new Content Source in the Search Service Application pointing to this folder
  • Created a Enterprise Search Center and pointed it as the deafult search center
  • Started a Full Crawl (which resulted with successful for all the files)
  • Reseted the Index, Timer Services, SharePoint Administration, SharePoint Search Host Controller and Search Server 15, did a Full Crawl again, success for all files
  • On ULS Viewer there is no error related to the problem

Did all above and the problem still occurs. I suppose it could be one of the following:

– PoPAuthProvider: This the authentication provider used to authenticate on the webapplication (thats the only one enabled), I guess this could be the problem as on the file share (inside the server) I can only set NTLM users to access that folder

-Search Config: This is my first time setting up a FileShare search thing, so I might have missed some steps

-FileShare config: This is also my first time setting up such a thing, so I could also have missed some steps or made some mistakes

Could anyone give me a help on this issue?

android – Returning Row count in room database

I am trying to display total number of rows stored in roomdatabase in kotlin. Below is what have tried so far:

1. My dao (JobDao)

    @Query("SELECT COUNT(*) FROM Jobs_Table")
    suspend fun getAllJobsCount(): Int

    @Query("SELECT COUNT(*) FROM Jobs_Table WHERE `Completion Status` = :status")
    fun getCompletedJobsCount(status: String = "Completed"): Int

    @Query("SELECT COUNT(*) FROM Jobs_Table WHERE `Completion Status` = :status")
    fun getIncompleteJobsCount(status: String = "Incomplete"): Int

    @Query("SELECT SUM(Price) FROM Jobs_Table")
    fun totalToBePaid(): Int

    @Query("SELECT SUM(Price) FROM Jobs_Table WHERE Payment = :payment")
    fun totalPaid(payment: String = "Paid") : Int

    @Query("SELECT SUM(Price) FROM Jobs_Table WHERE Payment = :payment")
    fun totalPendingPayments(payment: String = "Pending Payment") : Int

2. Repository:

fun getAllJobCount(): Int = runBlocking{
        val count = async { jobDatabase.jobDao().getAllJobsCount()
        }
        count.start()
        count.await()
    }

3. ViewModel:

fun getAllJobCount(): Int{
        val count: Int = repository.getAllJobCount()
        return count
    }

4.Activity

private fun displaySummary() {
        jobTodo.setText(jobViewModel!!.getAllJobCount())
    }

Error am getting:
Process: com.droid.f.advancedjobmanager, PID: 7604
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.droid.f.advancedjobmanager/com.droid.f.advancedjobmanager.ui.SummaryActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3091)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1843)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6758)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:497)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:912)
Caused by: java.lang.NullPointerException
at com.droid.f.advancedjobmanager.ui.SummaryActivity.displaySummary(SummaryActivity.kt:31)
at com.droid.f.advancedjobmanager.ui.SummaryActivity.onCreate(SummaryActivity.kt:27)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2933)