text:
Q: jQuery portlet and dialog box problem I create sortable element and attach an on-click event on every portlet to open dialog box, but when i open (drag more portlet to the main dashboard), and click the setup link (on the header of the portlet) the alert() (i setup for testing purpose) always fire for every portlet on the main dashboard, why is this happen ?
Below is the code i use to setup the sortable wich receive element from another
sortable (you can see the elements on the left side).
You can see some screenshoot on this url : http://wildanm.wordpress.com/2009/03/25/ofc-reloading-problem-on-jquery-sortable-elements/
if you need the HTML markup i will post also later ..
Btw, i'm new in jQuery ..
Thanks!
$(function() {
   var param ; //additional param to the a portlet ; later
   var title = ""; //title for prototyping only

   $("#maincontent .column").sortable({
       connectWith: ['#maincontent .column'],
       opacity: 0.6,
       scroll: false,
       handle : ".portlet-header",
       receive: function(event, ui) {
         var id = $(ui.item).attr('id');
         var chartId = 'chart-'+id ;

         $("#"+id+" > .portlet-content").flash({
             data: '/swf/open-flash-chart.swf',
             id: chartId,
             name: 'chart-'+id,
             expressInstall: true ,
             flashvars: {
               'data-file': '/chart/'+id
             },
         })

         $("#"+id).find("span").removeClass("ui-icon ui-icon-arrow-4-diag");
         $("#"+id).addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
            .find(".portlet-header")
                .addClass("ui-widget-header ui-corner-all")
                .prepend('')
                .prepend('')
                .prepend('')
                .end()
            .find(".portlet-content");

            $("#maincontent .column .portlet-header .ui-icon-plusthick").click(function() {
                $(this).toggleClass("ui-icon-minusthick");
                $(this).parents(".portlet:first").find(".portlet-content").toggle();
            });

            $("#maincontent .column .portlet-header  .ui-icon-wrench").click(function() {
                $("#dialog").css("visibility","visible");
                //dialog
                 alert($(this).parent('div').attr('id'));
                        $("#dialog").dialog({
                            bgiframe: true,
                            autoOpen: false,
                            height: 400,
                            width:300,
                            modal: true,
                            buttons: {
                                'Update Chart': function() {
                                title = $("#title").val();
                                url = "/chart/"+id+"?title="+title+'&id='+id ;
                                  $.getJSON(url,function(data) { jsonData = data ; reloadJsonData() }) ;
                                  function reloadJsonData() {
                                    data = JSON.stringify(jsonData) ;
                                    tmp = findSWF(chartId);
                                    tmp.load(data);
                                  }
                                  $(this).dialog('close');
                                },
                            Cancel: function() {
                                $(this).dialog('close');
                                }
                            },
                            close: function() {
                            //allFields.val('').removeClass('ui-state-error');
                            }
                        });
                $('#dialog').dialog('open');
            });

            $("#maincontent .column .portlet-header  .ui-icon-close").click(function() {
                $(this).parents(".portlet:first").remove();
            });
            //resize();
       },

       start: function(event, ui) {
       },
       stop: function(event, ui) {
         // Here's the trick:

         $("#maincontent .column").each(function() {
           //alert($(this).sortable("toArray"));
           //$(this).resizable();
         })
       }
     })

$("#maincontent .column .portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
.find(".portlet-header")
    .addClass("ui-widget-header ui-corner-all")
    .prepend('')
    .prepend('')
    .end()
.find(".portlet-content");

$("#maincontent .column .portlet-header .ui-icon").click(function() {
    $(this).toggleClass("ui-icon-minusthick");
    $(this).parents(".portlet:first").find(".portlet-content").toggle();
});

$("#maincontent .column .portlet-header  .ui-icon-close").click(function() {
    $(this).parents(".portlet:first").remove();
});

$("#maincontent .column").disableSelection();

});

   function findSWF(movieName) {
        if (navigator.appName.indexOf("Microsoft")!= -1) {
            return window[movieName];
        } else {
            return document[movieName];
        }
    }

Update :
Thanks Kyle for the answer,
After re-examining my code and try the change you propose, i think the main issue is how we can we tell the dialog box his parent element (which portlet his come from). On the code above, after i click the update button, the portlet affected is always the first portlet that i drop to the main area .., i hope my explanation is clear enough for you .., thanks !
Btw, here is the markup of a single portlet :

               SDM yang Terlibat Kegiatan Penelitian dan Pengabdian Masyarakat (Valid)

              <object width="320" height="180" data="/swf/open-flash-chart.swf" type="application/x-shockwave-flash" style="vertical-align: text-top;"
        name="chart-gambarTigaSatu" id="chart-gambarTigaSatu"><param value="data-file=/chart/gambarTigaSatu" name="flashvars"/>
             </object>

The ui-icon-wrench id is added automatically, it's for testing only for now, i try
to traverse the dom, and get the id of the object element from there. The object element
also generated automatically using swfobject, u can see to code above ..
(Btw, the comment on the answer is limited to 300 char, so I post here)
Best Regards,
Wildan

A: I'm not really sure I totally understand your problem, but, what I think you are trying to say is that when you drag a portlet, it's supposed to be binding a click event listener to the 'setup' (wrench) button on your portlet so that when it's clicked a dialog pops up. And, you are saying that when you click on that wrench, a dialog pops up for all your portlets and not just the one you clicked the button inside of.
If that's the case, it may be that you are binding that wrench multiple times so that when its clicked, it will act as if its clicked more than once. The only recommendation I have for you is that instead of using the 'click' method use the 'bind' method.
This is what I mean... Don't do this:
$("#maincontent .column .portlet-header  .ui-icon-wrench").click(function() {
    // do stuff here
});

Do this instead and see if it makes any difference:
$("#maincontent .column .portlet-header  .ui-icon-wrench").unbind('click').bind('click',function() {
    // do stuff here
});

If that doesn't help, let me know and I will see if I can help you further.
UPDATE:
Okay, so I think I might understand your problem now... When that wrench gets clicked, it brings up a dialog and in that dialog you are allowed to make changes to a certain portlet. But, you don't know how to let the dialog box know what portlet it should be affecting on update.
So, on that note, you can do something like this:
 $("#maincontent .column .portlet-header  .ui-icon-wrench").unbind('click').bind('click',function() {
     var portlet_to_edit = $(this).parents('.portlet').attr('id');
 $("#dialog").css("visibility","visible");
 $('#dialog').data('my_app.portlet_to_edit',portlet_to_edit);
 $("#dialog").dialog({
        // some of your stuff here...
        buttons: {
    'Update Chart': function() {
        var portlet_to_edit_id = $(this).data('my_app.portlet_to_edit');
        var portlet_to_edit = $('#'+portlet_to_edit_id);
                    // Do stuff with 'portlet_to_edit', for instance:
                    portlet_to_edit.find('.portlet-content').remove();
                    // ... or whatever you wanted to do...
            },
            // the rest of your buttons and stuff
        }
    });
    $('#dialog').dialog('open');
});

to your

A: well i think the answer is simple, just use the $(this) so that the event handle will only be triggered for that specific portlet..it was my problem in my JQuery experience..


text:
Q: How to shorten code using SQL Command Here is my problem:
I want to make my code short, and a friend of mine told me that I can use DAL.
But I don't know how to use DAL. I also tried to search internet. But It doesn't
give me some simple solution. I'm a newbie using DAL
Note: I know that my select command is very short but imagine that as an
extensive data.
ASPX code

        <asp:Label ID="lbl1" Text="FirstName" runat="server" />

        <asp:TextBox ID="txtFName" runat="server" />

            <asp:Label ID="lbl2" Text="MiddleName" runat="server" />

            <asp:TextBox ID="txtMName" runat="server" />

            <asp:Label ID="lbl3" Text="LastName" runat="server" />

            <asp:TextBox ID="txtLName" runat="server" />

            <asp:Label ID="lbl4" Text="Birthday" runat="server" />

            <asp:TextBox ID="txtBday" runat="server" />

            <asp:Label ID="lbl5" Text="Address" runat="server" />

            <asp:TextBox ID="txtAdd" runat="server" />

ASPX.cs code
protected void Page_Load(object sender, EventArgs e)
{
    SelectCommand();
}

private void SelectCommand()
{
    SqlCommand sqlSelect = new SqlCommand();
    sqlSelect.Connection = conn;
    sqlSelect.CommandText = "select FirstName = @FirstName,MiddleName = @MiddleName,LastName = @LastName,BirthDate = @BirthDate, Address = @Address from User";
    sqlSelect.CommandType = CommandType.Text;
    sqlSelect.Parameters.AddWithValue("@FirstName", txtFName.Text);
    sqlSelect.Parameters.AddWithValue("@MiddleName", txtFName.Text);
    sqlSelect.Parameters.AddWithValue("@LastName", txtFName.Text);
    sqlSelect.Parameters.AddWithValue("@BirthDate", txtBday.Text);
    sqlSelect.Parameters.AddWithValue("@Address", txtAdd.Text);
    conn.Open();
    sqlSelect.ExecuteNonQuery();
    conn.Close();
}

A: Try separating your purposes into separate projects.
Try reading through http://en.wikipedia.org/wiki/SOLID_(object-oriented_design). I know wikipedia is very bland but may help give you some fundamental principles on OO design.
You can always use linq to sql or entity framework and remove a lot of redundant code however it will almost likely be slower than just writing it yourself.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Google Adsense Formatting Issue I would like to put two adsense ads next to each other, side by side. The problem is that google seems to have added a left-margin, and no way to get rid of it. I've looked around and other people have had the same problem but no good solution has been presented.
Does anybody know a good way to macgyver the margin away? I've tried moving it with position:relative inside a div, but it doesn't work well cross-system.

A: I'm not sure how adsense ads work but can you over ride their styling in your css by usinging !important ?
E.g margin-left:100px !important;


text:
Q: .call behavior on iterating DOM node list How does following code works?
var myNodeList = document.querySelectorAll('li'); // grabs some <li>
[].forEach.call(myNodeList, function (item) {
  // :) hooray `item` can be used here
});

Whereas ,
document.querySelectorAll('li').forEach.call(myNodeList, function (item) {
      // throws error
});

Read something - This accesses the created (empty) array's prototype method and using call allows the NodeList to take advantage.
Any help would be appreciated.
Question is
What makes following code access the created (empty) array's prototype method and using call allows the NodeList to take advantage
[].forEach.call(myNodeList, function (item) {
  // :) hooray `item` can be used here
});

https://toddmotto.com/ditch-the-array-foreach-call-nodelist-hack/

A: document.querySelectorAll('li') return array like result to apply foreach you should use Array.apply
Array.apply(null, document.querySelectorAll('li')).forEach(function(item) {
    console.log(item)
  });

fiddle


text:
Q: Back-propagation until the input layer in neural network I have a question regarding neural networks back-propagation. Suppose we have a trained DNN for some data. Then we feed a corrupted data into NN and back-propagate the error not until the first hidden layer, but until the input layer (so to say we calculate deltas for the input neurons).  Does the error term shows us a mismatch between "clean" and "corrupted" vector?

A: If I'm interpreting the question correctly, you have two input vectors i1 = (a, b, ...) and i2 = (c, d, ...). You then have two corresponding output vectors o1 = (v, w, ...) and o2 = (x, y, ...).
i1 is part of your valid training data and is used to teach the NN the model. After this is done, you want to use the NN to detect the delta between the invalid o2 and the valid output given a correct application of the model to i2?
If this is the case, train the NN as normal with all of your valid input cases, then feed your test cases (input vectors which correspond to known corrupted output vectors) and collect the results with backpropagation disabled. That is, once the NN has learned the correct model, stop training and simply compare the "clean" results to the corrupted results yourself.
Note: You could alternatively train a neural network to accept as input a set of values corresponding to the input of some other process and a set of values corresponding to the (possibly corrupted) output of that process and produce as output the difference between the clean values and the corrupted values, but the extra training and framing of the data just to avoid doing the subtraction yourself is probably not worth it.


text:
Q: Swagger/Swashbuckle + IdentityServer4 Implicit Flow: 401 Error after successful login? I am trying to implement OAuth to one of my companies' projects and can't resolve the following problem.
We used IdentityServer4 for implementing our own Authorization Server, which works fine so far. The resource I want to protect with OAuth is a WebApi utilizing Swagger/Swashbuckle.
I followed the IdentityServer4 QuickStartExamples to configure the server and this tutorial [Secure Web APIs with Swagger, Swashbuckle, and OAuth2 (part 2)](http://knowyourtoolset.com/2015/08/secure-web-apis-with-swagger-swashbuckle-and-oauth2-part-2 for configuring Swagger/Swashbuckle).
I have a dummy-action which does nothing else than returning a string, that works as expected.
When I decorate the action with [Authorize], a little red icon appears in swagger-ui, indicating that I have to log in to access this method. The Login process works fine: I am redirected to the Quickstart-UI, can login with the testuser "Bob", and I am redirected to swagger-ui after a successful login.
The problem: After the successful login, I still get an 401 error, stating "Authorization has been denied for this request."
I can see that a bearer token is returned by my IdentityServer in swagger-ui, so I guess this part working fine and the problem seems to be swagger/swashbuckle.
Is there maybe anything else I have to do with the token? In the tutorials I read so far, the swagger config is modified as I did it (see below) and that's it, so I guess swagger/swashbuckle should handle this - but maybe I miss out something?
SwaggerConfig.cs:
c.OAuth2("oauth2")
    .Description("OAuth2 Implicit Grant")
    .Flow("implicit") //also available: password, application (=client credentials?)
    .AuthorizationUrl("http://localhost:5000/connect/authorize")
    .TokenUrl("http://localhost:5000/connect/token")
    .Scopes(scopes =>
    {
        scopes.Add("My.Web.Api", "THE Api");

    });

    // etc. .....

    c.OperationFilter<AssignOAuth2SecurityRequirements>();

    // etc. .....

c.EnableOAuth2Support(
    clientId: "swaggerui",
    clientSecret: "secret",
    realm: "dummyrealm",
    appName: "Swagger UI"

);

Filter for Authorize Attribute in SwaggerConfig.cs:
public class AssignOAuth2SecurityRequirements : IOperationFilter
{
    public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)
    {
        // Determine if the operation has the Authorize attribute
        var authorizeAttributes = apiDescription
            .ActionDescriptor.GetCustomAttributes<AuthorizeAttribute>();

        if (!authorizeAttributes.Any())
            return;

        // Initialize the operation.security property
        if (operation.security == null)
            operation.security = new List<IDictionary<string, IEnumerable<string>>>();

        // Add the appropriate security definition to the operation
        var oAuthRequirements = new Dictionary<string, IEnumerable<string>>
    {
        { "oauth2", new [] { "My.Web.Api" } }
    };

        operation.security.Add(oAuthRequirements);
    }
}

IdentityServer api config:
new ApiResource("My.Web.Api", "THE  Api")

IdentityServer client config:
new Client
{
    ClientId = "swaggerui",
    ClientName = "Swagger UI",

    AllowedGrantTypes = GrantTypes.Implicit,
    AllowAccessTokensViaBrowser = true,
    AllowedCorsOrigins = { "http://localhost:5858" },

    ClientSecrets =
    {
        new Secret("secret".Sha256())
    },

    RedirectUris = { "http://localhost:5858/swagger/ui/o2c-html" },
    PostLogoutRedirectUris = { "http://localhost:5858/swagger/ui/o2c-html" },

    AllowedScopes =
    {
        "My.Web.Api"
    }

Screenshot of redirection after login:

A: When using .NET Core (but it would appear that this question is for .NET Framework) I also encountered this same problem.  It was solved by ensuring that in the Configure method of Startup you have UseAuthentication before UseAuthorization
(source https://learn.microsoft.com/en-us/aspnet/core/grpc/authn-and-authz?view=aspnetcore-3.1)


text:
Q: Storing datas in keychain I am doing game for iphone.In that I want to store game data such as level,score,stars count and etc.Shall I use "KeychainItemWrapper" class instead of NSUserDefaults to store those datas."KeychainItemWrapper" class is only used to store username and password only?

A: I don't see the point in using the keychain for that, it's meant to store passwords/users.
What's the problem in user NSUserDefaults? Your info is going to be perfectly safe there. Or you can even use CoreData if you want something more "complex".
In case you want the data to be stored after the users delete the app, then you need to use the keychain to store pairs of key/value. Check this link.
https://developer.apple.com/library/mac/#documentation/security/Reference/keychainservices/Reference/reference.html


text:
Q: How to synchronize the local DynamoDb and Amazon DynamoDb web service Hello, thanks for your viewing my question first!
I am running the Amazon dynamoDb locally and all databases are saved locally. With the local dynamoDb, I have to show everything with a lot of code, but I feel the interface at web service is much better, in which I can perform operations and see the tables directly and clearly:
So may I ask how can connect them, then I can practice the coding and check the status easily?
Looking forward to your reply and thank you so much!
Sincerely

A: You cannot connect them as they are completely separate databases. However, you can put a simple user interface on top of your local DynamoDB database.
I use the SQLite Browser: http://sqlitebrowser.org/. Once you have it installed, open the .db file located in the folder where you are running DynamoDBLocal.jar. You should be able to see all your tables and the data within them. You won't be able to see DynamoDB specific things like your provisioned capacity, but I think this will give you enough of what you're looking for.
Does this help?


text:
Q: How to ORDER BY in SQL UNION of JOINED tables not showing ordered columns in result I'm trying to get the table where two results of joins will be unioned and ordered by several columns. I've found that columns that are ordered have to be mentioned in each select of union. But I don't want ordered columns appear in result. Is it possible? Maybe there are another ways of getting the result that I want.
Here is my query:
SELECT coupon_id,
       coupon_name,
       real_price,
       discount_price,
       difference_percent,
       discount_percent,
       payment_price,
       photo,
       company_id,
       company_name
FROM
  (SELECT cpn.id AS coupon_id,
          cpn.name_ru AS coupon_name,
          cpn.real_price,
          cpn.discount_price,
          cpn.difference_percent,
          cpn.discount_percent,
          cpn.payment_price,
          cp.photo,
          com.id company_id,
          com.name_ru AS company_name
   FROM coupon cpn
   LEFT JOIN coupon_photo cp ON cpn.id = cp.coupon_id
   LEFT JOIN company com ON cpn.company_id = com.id
   WHERE cpn.id NOT IN
       (SELECT coupon_id AS id
        FROM transaction
        WHERE Date_add(created_time, interval 10 MINUTE) > Now()
          AND status = 'pending')
     AND cpn.exp_date > Now()
     AND cpn.valid_date > Now()
     AND cpn.available > 0
   UNION SELECT cpn.id AS coupon_id,
                cpn.name_ru AS coupon_name,
                cpn.real_price,
                cpn.discount_price,
                cpn.difference_percent,
                cpn.discount_percent,
                cpn.payment_price,
                cp.photo,
                com.id company_id,
                com.name_ru AS company_name
   FROM coupon cpn
   LEFT JOIN coupon_photo cp ON cpn.id = cp.coupon_id
   LEFT JOIN company com ON cpn.company_id = com.id
   LEFT JOIN transaction trans ON cpn.id = trans.coupon_id
   WHERE cpn.exp_date > Now()
     AND cpn.valid_date > Now()
     AND Date_add(trans.created_time, interval 10 MINUTE) > NOW()
     AND trans.status = 'pending'
     AND (cpn.available - trans.amount) > 0 GROUP  BY cpn.id) results
ORDER BY cpn.advertised DESC,
         cpn.sold DESC,
         cpn.views DESC

A: Your results subquery does not contain the column you are trying to order by. You need to add them to both parts of the union. You do not have to add them to your select, but they need to be present in the subquery so you can use them in your ORDER BY.
SELECT coupon_id,
       coupon_name,
       real_price,
       discount_price,
       difference_percent,
       discount_percent,
       payment_price,
       photo,
       company_id,
       company_name
FROM
  (SELECT cpn.id AS coupon_id,
          cpn.name_ru AS coupon_name,
          cpn.real_price,
          cpn.discount_price,
          cpn.difference_percent,
          cpn.discount_percent,
          cpn.payment_price,
          cp.photo,
          cpn.advertised,
          cpn.sold,
          cpn.views,
          com.id company_id,
          com.name_ru AS company_name
   FROM coupon cpn
   LEFT JOIN coupon_photo cp ON cpn.id = cp.coupon_id
   LEFT JOIN company com ON cpn.company_id = com.id
   WHERE cpn.id NOT IN
       (SELECT coupon_id AS id
        FROM transaction
        WHERE Date_add(created_time, interval 10 MINUTE) > Now()
          AND status = 'pending')
     AND cpn.exp_date > Now()
     AND cpn.valid_date > Now()
     AND cpn.available > 0
   UNION SELECT cpn.id AS coupon_id,
                cpn.name_ru AS coupon_name,
                cpn.real_price,
                cpn.discount_price,
                cpn.difference_percent,
                cpn.discount_percent,
                cpn.payment_price,
                cp.photo,
                cpn.advertised,
                cpn.sold,
                cpn.views,
                com.id company_id,
                com.name_ru AS company_name
   FROM coupon cpn
   LEFT JOIN coupon_photo cp ON cpn.id = cp.coupon_id
   LEFT JOIN company com ON cpn.company_id = com.id
   LEFT JOIN transaction trans ON cpn.id = trans.coupon_id
   WHERE cpn.exp_date > Now()
     AND cpn.valid_date > Now()
     AND Date_add(trans.created_time, interval 10 MINUTE) > NOW()
     AND trans.status = 'pending'
     AND (cpn.available - trans.amount) > 0 GROUP  BY cpn.id) results
ORDER BY advertised DESC,
         sold DESC,
         views DESC

As Strawberry has pointed out, it is not exactly best practice o use GROUP BY when you are not aggregating anything. In this case it can lead to unexpected results as MySQL uses ANY_VALUE(). It returns the value of some row in the GROUP BY group. Which row it returns is indeterminate. That means it's entirely up to the MySQL server.
I assume you were using it to avoid duplicate rows. You should find another de-duplication method.
Furthermore, doing a LEFT JOIN but then filtering the elements on the right side of the JOIN is the same as doing an INNER JOIN. Just make sure this is consistent with what you are trying to achieve.


text:
Q: Question on primary assumption in this proof that every multiplicative group of finite field is cyclic. Given in my textbook is the theorem

If $F$ is a finite field of the order $q$ than is group $F^*,\cdot$ a cyclic group of the order $q - 1$. ...

The proof starts with a straightforward assumption that follow from the definition of a field.

... The multiplicative group $F^*$ is thus from the order $q - 1$ ...

What follows then however is a very important assumption that is to make a very important conclusion of this proof at the end and on which it falls or stand. I do however not understand why this assumption is true. The assumption goes as follows:

... such that for any element $f \in F^*$ it is true that $f^{q-1} = 1$. As a consequence the equation $x^{q-1} - 1 = 0$ has exactly $q -1$ roots in $F^*$. ...

I understand that if indeed it is true that if $f^{q-1} = 1$ is true for every element in $F^*$ that there are than those $q-1$ roots in $F*$. Here is my question however: Why is it true that $f^{q-1} = 1$ is true for every element in $F^*$?
The rest of the proof I do understand, and I'll give a summary of it here for the sake of completion.
The theorem is used that "$F^*$ is a cyclic group of order $q-1$" (i) is equivalent with "Let $d$ be a divisor of $n$. There are $d$ solutions in $F^*$ to the equation $x^d = 1$" (ii) for "$f^*$ a finite group".
(ii) is proved as follows:

*

*Using polynomials from $F_{[x]}$, assuming that $q -1  = dk$, than it follows that $x^{q-1} - 1 = (x^d - 1)(x^{d(k - 1)} + x^{d(k - 2)} + \cdots + x^d + 1 = (x^d - 1) \cdot g(x)$;

*$g(x)$ is of degree $d(k-1)$ and has therefore at most $d(k-1)$ roots in $F*$;

*$(x^d - 1)$ is of degree $d$ and has therefore at most $d$ roots in $F*$;

We know however that using the earlier assumptions that $x^{q-1} - 1 = x^{dk} - 1$ has exactly $q-1$ roots. And as $d + d(k -1) = d + dk - d = dk = q - 1$ it follows that $x^d + 1$ has exactly d roots in $F*$.
Now that (ii) is proven it follows that (i) is true as well and therefore it has been proven that the multiplicative group $F^*,\cdot$ of a finite field $F$ of order $q$ is a cyclic group of order $q - 1$.
So to highlight my question:

Why is it true that $f^{q-1} = 1$ is true for every element in $F^*$?

if $q$ is prime, than I know (and I can see) that every element of $\mathbb{Z}_q$ is a primitive root and therefore I can see that $x^{q-1} = 1$ is true for every $x \in \mathbb{Z}_q$, using Fermath's little theorem.

But why is this true for every $q$? Has it something to do with the fact that the order of a finite field $q$ is always in the form $p^h$ with $p$ a prime and $h$ the dimension of the $G$-vector space with $G$ the additive subgroup generated by the 1 and with order $p$?
edit: from my experience with constructing finite fields of order $p^h$ (using polynomials of degree $h$), I have noticed that $f^{q-1} = 1$ holds indeed for all $f \in F_{p^h}^*$ with $q = p^h$. We know that the order is $q$, and if I remember correctly Zech's algorithm relies on the fact that the exponents are modulo the order of the multiplicative group. This makes me think that because we know that $x^s = x^r$ in $F_{p^h}^*$ if and only if $r \equiv s (mod\ q-1)$ and thus we know that $x^{q-1} = x^0 = 1 \leftrightarrow q-1 \equiv 0\ (mod\ q-1)$. Which is always true, no matter the value of $x$. Is this why the assumption is true, or am I on the wrong track?

A: This is Lagrange's theorem.   The order of the group is $q-1$.
The theorem states/implies that the order of any element divides the order of the group.  Just consider the subgroup generated by that element.

A:
Why is it true that $f^{q-1} = 1$ is true for every $f \in F^*$?

Lagrange's theorem states the following.

For every $(H,\cdot)$ is a subgroup of finite group $(G,\cdot)$, $|H|$ is a divisor of $|G|$.

We also know that the order $k$ of an element $f \in F^*$ is the smallest positive integer such that $f^k = 1$. Because Lagrange's theorem it also follows that $k$ divides $q-1$ since the order $k$ of $f$ equals the order of the cyclic subgroup it generates.

Why is it true that $f$ generates a cyclic subgroup of $F^*$ of order $k$?

It is trivial to see that $f^0 = f^k = 1$ is part of $F^*$. We can also see that $f^i$ with $0 <= i < k$ must be in $F^*$ as $F^*$ is a group and therefore multiplication is closed. By contradiction assume that $f^i = f^j$ for $0 <= i < j < k$. Than it follows that this is true if and only if  $i \equiv j\ (mod\ k)$. It must therefore be true that $\langle f \rangle = \{f^{i} \in F^* | 0 <= i < k\}$ is cyclic and $|\langle f \rangle| = k$.

If we bring this all together we get
$$
f^{q-1} = f^{dk} = (f^k)^d = 1^d = 1.
$$
As $f$ was chosen at random, it follows that $f^{q-1} = 1$ is true for every $f \in F^*$.


text:
Q: Group Smaller Slices in Pie Charts to Improve Readability I want to group data thar have under 10% percentage to be grouped to slice of pie named others. Is it possible?
Pie-chart
        series: [{
            type: 'pie',
            name: 'Browser share',
            data: [
                ['Firefox',   45.0],
                ['IE',       26.8],
                {
                    name: 'Chrome',
                    y: 12.8,
                    sliced: true,
                    selected: true
                },
                ['Safari',    8.5],
                ['Opera',     6.2]
            ]
        }]

A: You just need to calculate slightly different data. Iterate over the entries looking for items with < 10%. Add these to an 'other' category.
Something like this:
 var data = [
            ['Firefox',   45.0],
            ['IE',       26.8],
            {
                name: 'Chrome',
                y: 12.8,
                sliced: true,
                selected: true
            },
            ['Safari',    8.5],
            ['Opera',     6.2]
        ];
var newData=[];
var other=0.0;
for (var slice in data) {

    if (data[slice][1] < 10) {
        other += data[slice][1];
    } else {
        newData.push(data[slice]);
    }
}
newData.push(['other',other]);

http://jsfiddle.net/q25u2hyr/


text:
Q: STOMP in Spring WebSocket Lost Connection before connected I try to connect with server by STOMP, but I get Lost Connection message with any specific information.
WebSocket config:
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        registry.enableStompBrokerRelay("/topic", "/queve")
            .setClientLogin("quest")
            .setClientPasscode("quest");
        registry.setApplicationDestinationPrefixes("/app");
    }

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/hello").setAllowedOrigins("*").withSockJS();
    }

}

Controller:
@Controller
public class HelloController {

    @MessageMapping("/hello")
    public void greeting(HelloMessage message){
        System.out.println("Wiadomosc: " + message.getName());
    }

    @SubscribeMapping({"/helloSub"})
    public HelloMessage handleSubscription() {
        HelloMessage outgoing = new HelloMessage();
        System.out.println("SUB");
        outgoing.setName("Jas");
        return outgoing;
    }

}

js script:
 var sock = new SockJS("http://localhost:8080/BuyMyTime/hello");
    var stomp = Stomp.over(sock);
    var payload = JSON.stringify({'name':'Jasiek'});
    stomp.connect('quest', 'quest', function(frame){
        //stomp.send("/hello", {}, payload);
    });

When i send get http://localhost:8080/BuyMyTime/hello i receive: Welcome to SockJS! so Socket is fine but when i try stomp.connect i receive:
Opening Web Socket... stomp.js:134:99
Web Socket Opened... stomp.js:134:99
>>> CONNECT
login:quest
passcode:quest
accept-version:1.1,1.0
heart-beat:10000,10000

"Whoops! Lost connection to http://localhost:8080/BuyMyTime/hello" stomp.js:134:99

Is there any missing config i did not included? How can I get more info about this connection lost? Please for any help.
Update (Aug 28 2016)
I add this dependencies:
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.5.1</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.5.1</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.5.1</version>
</dependency>

and now get:
<<< ERROR
message:Broker not available.
content-length:0
"Whoops! Lost connection to http://localhost:8080/BuyMyTime/greeting"


text:
Q: Clearing class definitions in MATLAB The command clear classes clears all class definitions loaded in memory at that time.
Is it possible to clear only specific class definitions?
EDIT: I'm interesting in removing specific class definitions from memory, not class instances.

A: I ran into this issue myself when I wrote my new HPF class. So I tried a few things, since as I was debugging the new class I had many changes to make, and then test out.
"Clear functions" does not help. I even tried "clear hpf". But clearing all instances does seem to do so. For example:
>> x = hpf(3);
>> x+2
ans =
5

>> whos
  Name      Size            Bytes  Class     Attributes

  ans       1x1               248  hpf
  x         1x1               248  hpf
  y         1x1                 8  double

So now I made a trivial change to the class and saved it.
>> z = hpf(17);
Warning: The class file for 'hpf' has been changed; but the change cannot be applied because objects based on the old class file still exist. If you use
those objects, you might get unexpected results. You can use the 'clear' command to remove those objects. See 'help clear' for information on how to remove
those objects.

>> clear functions
>> clear hpf
>> clear x
>> clear z
>> x = hpf(3);
Warning: The class file for 'hpf' has been changed; but the change cannot be applied because objects based on the old class file still exist. If you use
those objects, you might get unexpected results. You can use the 'clear' command to remove those objects. See 'help clear' for information on how to remove
those objects.

So I still get a warning, telling me that MATLAB still has a problem. However, I still had an HPF instance in memory that is easily forgotten, ans.
>> clear ans
>> clear x
>> whos
  Name      Size            Bytes  Class     Attributes

  y         1x1                 8  double

>> x = hpf(3);
>> x+23
ans =
26

As long as I removed that instance too, MATLAB no longer gives me a warning. Note that I never had to issue a "clear classes" command. The variable y, a double, still exists to prove that fact.

A: This is one way to do it:
% Set ClassName to match the name of the class whose instances you wish to clear.
ClassName = 'MyClass';

% Here's the code:
VarsStruct = whos;
VarsCellArray = cat(3, cellstr(char(VarsStruct(:).name)), cellstr(char(VarsStruct(:).class)));
ClassInstanceIndices = find(ismember(VarsCellArray(:,:,2), ClassName));
ClassInstanceNames = VarsCellArray(ClassInstanceIndices,:,1)';
clear(ClassInstanceNames{:});

A: To clear a class definition, including all Constant property data, it is necessary to do both of the following

*

*clear all instances of the class from memory

*Issue clear classname.

It must be done in the above order. Reversing the order will leave Constant property data stuck in memory (as of R2013b) until clear classes is issued.


text:
Q: Python function loses identity after being decorated (Python 3)
First of all, I feel my title isn't quite what it should be, so if you stick through the question and come up with a better title, please feel free to edit it.
I have recently learned about Python Decorators and Python Annotations, and so I wrote two little functions to test what I have recently learned.
One of them, called wraps is supposed to mimic the behaviour of the functools wraps, while the other, called ensure_types is supposed to check, for a given function and through its annotations, if the arguments passed to some function are the correct ones.
This is the code I have for those functions:
def wraps(original_func):
    """Update the decorated function with some important attributes from the
    one that was decorated so as not to lose good information"""
    def update_attrs(new_func):
        # Update the __annotations__
        for key, value in original_func.__annotations__.items():
            new_func.__annotations__[key] = value
        # Update the __dict__
        for key, value in original_func.__dict__.items():
            new_func.__dict__[key] = value
        # Copy the __name__
        new_func.__name__ = original_func.__name__
        # Copy the docstring (__doc__)
        new_func.__doc__ = original_func.__doc__
        return new_func
    return update_attrs # return the decorator

def ensure_types(f):
    """Uses f.__annotations__ to check the expected types for the function's
    arguments. Raises a TypeError if there is no match.
    If an argument has no annotation, object is returned and so, regardless of
    the argument passed, isinstance(arg, object) evaluates to True"""
    @wraps(f) # say that test_types is wrapping f
    def test_types(*args, **kwargs):
        # Loop through the positional args, get their name and check the type
        for i in range(len(args)):
            # function.__code__.co_varnames is a tuple with the names of the
            ##arguments in the order they are in the function def statement
            var_name = f.__code__.co_varnames[i]
            if not(isinstance(args[i], f.__annotations__.get(var_name, object))):
                raise TypeError("Bad type for function argument named '{}'".format(var_name))
        # Loop through the named args, get their value and check the type
        for key in kwargs.keys():
            if not(isinstance(kwargs[key], f.__annotations__.get(key, object))):
                raise TypeError("Bad type for function argument named '{}'".format(key))
        return f(*args, **kwargs)
    return test_types

Supposedly, everything is alright until now. Both the wraps and the ensure_types are supposed to be used as decorators. The problem comes when I defined a third decorator, debug_dec that is supposed to print to the console when a function is called and its arguments. The function:
def debug_dec(f):
    """Does some annoying printing for debugging purposes"""
    @wraps(f)
    def profiler(*args, **kwargs):
        print("{} function called:".format(f.__name__))
        print("\tArgs: {}".format(args))
        print("\tKwargs: {}".format(kwargs))
        return f(*args, **kwargs)
    return profiler

That also works cooly. The problem comes when I try to use debug_dec and ensure_types at the same time.
@ensure_types
@debug_dec
def testing(x: str, y: str = "lol"):
    print(x)
    print(y)

testing("hahaha", 3) # raises no TypeError as expected

But if I change the order with which the decorators are called, it works just fine.
Can someone please help me understand what is going wrong, and if is there any way of solving the problem besides swapping those two lines?
EDIT
If I add the lines:
print(testing.__annotations__)
print(testing.__code__.co_varnames)

The output is as follows:
#{'y': <class 'str'>, 'x': <class 'str'>}
#('args', 'kwargs', 'i', 'var_name', 'key')

A: Although wraps maintains the annotations, it doesn't maintain the function signature.  You see this when you print out the co_varnames.  Since ensure_types does its checking by comparing the names of the arguments with the names in the annotation dict, it fails to match them up, because the wrapped function has no arguments named x and y (it just accepts generic *args and **kwargs).
You could try using the decorator module, which lets you write decorators that act like functools.wrap but also preserve the function signature (including annotations).
There is probably also a way to make it work "manually", but it would be a bit of a pain.  Basically what you would have to do is have wraps store the original functions argspec (the names of its arguments), then have ensure_dict use this stored argspec instead of the wrapper's argspec in checking the types.  Essentially your decorators would pass the argspec in parallel with the wrapped functions.  However, using decorator is probably easier.


text:
Q: Make appear hypertarget labels in PDF Some time ago (TeX Live 2013), xelatex stored labels of hypertarget in PDFs. Then (at least in TeX Live 2016) the behaviour was changed, there are no more symbolic names inside.
How can I get the names back?
An example:
\documentclass{article}
\usepackage[verbose]{hyperref}
\begin{document}
An anchor for postprocessing:
\hypertarget{ID01234567}{}
\end{document}

After the document is compiled with xelatex, I review the internals:
$ qpdf --stream-data=uncompress test.pdf - | gvim -

What I want is to find:
<< /Names [ (Doc-Start) 7 0 R (ID01234567) 8 0 R (page.1) 9 0 R ] >>

I get the desired result with TeX Live 2013, but not 2016.
30 July 2018, update
I've generated XDV (instead of PDF) on a newer system and converted XDV to PDF on an older system. I've got the destinations. So, the problems are, most likely, in dvipdfm. Here is a changelog for later investigation:
http://www.tug.org/svn/texlive/trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c?view=log

A: This is documented as a incompatible change in section 11 of the dvipdfmx manual. The bit position 5 for the -C option can be used to disable optimizing PDF destinations. The count starts with 1, so bit position 5 corresponds to 16. You can pass this flag when calling XeLaTeX with
 xelatex -output-driver="xdvipdfmx -C 16" test.tex

If you use Windows, you might need another way to quote the command.


text:
Q: SVG Image with filter - filter covers area bigger than the image I have a problem with applying filters to an svg image. I'd like to apply a flood filter to just the image, but when I set that filter, it covers an area bigger than the image, seemingly increasing the size of the image. Is there a way to fix this? Run the snippet below to see the problem.
One thing to note: the height of the image is unknown

image {
  outline: 3px solid red;
  outline-offset: -3px;
}

image.flood {
  filter: url(#floodFilter);
}
<svg width="500" height="200" viewBox="0 0 500 200">
  <defs>
    <filter id="floodFilter" filterUnits="objectBoundingBox">
      <feFlood flood-color="lightblue" flood-opacity="1"></feFlood>
      <feBlend in="SourceGraphic" in2="floodFill" mode="multiply"></feBlend>
    </filter>
  </defs>
  <image x="0" y="30" width="200" href="https://www.fillmurray.com/g/200/140">   </image>
  <image class="flood" x="230" y="30" width="200" href="https://www.fillmurray.com/g/200/140"></image>
</svg>

A: Just give the filter explicit bounds, the exact size of the object being filled.
By default the bounds are 10% bigger than the object so that drop shadows work.
Note that for your images to work cross-browser they will need height attributes.

image {
  outline: 3px solid red;
  outline-offset: -3px;
}

image.flood {
  filter: url(#floodFilter);
}
<svg width="500" height="200" viewBox="0 0 500 200">
  <defs>
    <filter id="floodFilter" filterUnits="objectBoundingBox" x="0" y="0" width="1" height="1">
      <feFlood flood-color="lightblue" flood-opacity="1" result="floodFill"></feFlood>
      <feBlend in="SourceGraphic" in2="floodFill" mode="multiply"></feBlend>
    </filter>
  </defs>
  <image x="0" y="30" height="140" width="200" href="https://www.fillmurray.com/g/200/140">   </image>
  <image class="flood" x="230" y="30" height="140"  width="200" href="https://www.fillmurray.com/g/200/140"></image>
</svg>


text:
Q: On window re-size challenge using the Isotope masonry view Here is my dilemma i have two views which work fine on toggle I have the Isotope and Masonry view, this works fine the challenge was to have the masonry view re size certain images depending on the view port, which I did using the below code.
$(function(){

  var $container = $('#container');
  // add randomize the size of images on the selected class//
  $container.find('.element').each(function(){
    var $this = $(this),
        number = parseInt( $this.find('.number').text(), 10);

    if (number  % 1 === 0 ){$this.addClass('width2');}

        if (window.matchMedia("(max-width: 599px)").matches) {
            if ( number   % 5 === 3) {
                $this.addClass('height2');}
            }
        if (window.matchMedia("(min-width: 600px) and (max-width:1023px)").matches) {
            if ( number %12   % 5 === 2) {
                $this.addClass('height2');}
            }
        if (window.matchMedia("(min-width: 1024px)").matches) {
            if ( number %10   % 10 === 5)  {
                $this.addClass('height2');}
            }
    });

I make this work by assigning a number to an element using the below
var $l = document.getElementsByClassName("number");
        for(i=0; i < 40; i++){ $l[i].innerHTML = i + 1;}

what this does it ads a number to the class "number", I use the top code to return that number and I use modulus to assign a class to the returned numbers.
All of this works fine, if I open a browser window at the given size in my code the class is added to the assigned number range, now my issue is I have to make this work on window re-size which is where I am stuck, is there an easier way to accomplish what I am trying to do or any tips will be greatly appreciated.
here is a bit of the HTML code

                     Available

                        HD

                        Available

                            HD

kinkykat

A: after reading a few doc's regarding isotop found the below solution
    // init Isotope
$(window).ready(function(){

    var $element_holder = $('.element_holder');
    $element_holder.hide();
    var $container = $( '.element' );

           $container.imagesLoaded(function(){
      $element_holder.fadeIn();

                $container.isotope({
                    itemSelector: '.element_holder',
                    layoutMode: 'fitRows',
                    fitRows: {
                            gutter: 1,
            columnwidth: '.element_holder',
                        }
         });
});

the issue was the gutter which was not set. :('


text:
Q: Typescript: How do I define interfaces for nested (nested) objects? See below my current JSON payload:
{
  "state_1": {
    "date": [
     {
          1000: {
            "size": 3,
            "count": 0
          }
        }
      {
          1001: {
            "size": 3,
            "count": 1

          }
        }
      }
    ]
}

How would I set up the definition of the Example interface to model a type state that has a date which has a list of id (here 1000 and 1001) which are a dictionary holding strings size and count.

A: You can use an index signature to handle unknown key definitions.
interface State {
    date: {
        [id: number]: {
            size: string;
            count: string;
        }
    }[];
}


text:
Q: android studio unable to find local maven repository I placed the files of the repository in the .m2 folder but android studio is unable to resolve it
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.redcpt:sdk:0.0.1

does anyone know what might be the issue

A: In the comments you mention "the structure of that folder is sdk -> 0.0.1 ->.pom, .jar, .aar files here.". That is the wrong location. A Maven dependency with coordinates com.redcpt:sdk:0.0.1 should be saved in .m2/repository/com/redcpt/sdk/0.0.1/.
It might be simpler to use Maven to install files into your local repository, see also How to add local jar files to a Maven project? (although I don't know what needs to be done to store the .aar file that way).

A: Android Studio automatically places the Maven repositories in the correct location when you download them from Maven. There's no reason to go into any local maven folders.
Start a new project from scratch while connected online and see if that helps. You will be given updated options on dependencies sourced from Maven.


text:
Q: Parsing Json From Web Service With PHP I'm new with json and web service. After using insert command, I do print_r($result) and got this data:
Array ( [error_code] => 0 [error_desc] => [result] => Array ( [error_code] => 999 [error_desc] => Format input 'date' is wrong ) )
I want to print the error_desc only which is show Format input 'date' is wrong.
I try to parsing it with PHP but I only got empty result. Here is my code:
if (is_array($result)) {
    if ($result['error_code'] =='999') {
      echo $result['error_desc'];
    }
  }

Please help. Thanks.

A: I already got the answer. I just know after print the error_code. Thanks.


text:
Q: nginx is loading wrong website when service isn´t working I have a webserver with two services and an nginx running. Each of the services should be accessible by a URL. This should be done by a configuration file per service:
jenkins.conf
server {
    listen                      [::]:443 ssl;
    listen                      443 ssl;
    server_name                 jenkins.<URL>.de www.jenkins.<URL>.de;

    access_log                  /var/log/nginx/jenkins_access.log;
    error_log                   /var/log/nginx/jenkins_error.log;

    location / {
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;

        proxy_pass              http://localhost:8100;
        proxy_read_timeout      90;
    }

    ssl_certificate ...fullchain.pem; # managed by Certbot
    ssl_certificate_key ...privkey.pem; # managed by Certbot
}

chirpstack.conf
server {
    listen                      80;
    server_name                 chirpstack.<URL>.de www.chirpstack.<URL>.de;

    client_max_body_size        0;

    access_log                  /var/log/nginx/chirpstack_access.log;
    error_log                   /var/log/nginx/chirpstack_error.log;

location / {
    proxy_pass              http://localhost:8102;
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $scheme;
    proxy_set_header        X-Forwarded-Protocol $scheme;
    proxy_set_header        X-Url-Scheme $scheme;
  }
}

I have the scenario where my Jenkins isn´t running (in case of an error or something else) and I have entered the URL jenkins.<URL>.de in my browser. But the browser isn´t showing any sort of error or something like that. Instead, he is showing the login page from my ChirpStack service.

Why is the browser loading the wrong web service when one service isn´t running? How can I avoid it?


text:
Q: Characterization of Lagrangian planes in symplectic vector spaces over finite fields EDIT: As L Spice pointed out, there is an error in the observation. The question is void therefore
Let $p$ be a prime and $q=p^r$. Let $V$ be a $\mathbb F_q$-vector space of dimension four, with a symplectic form $\omega$. Choose a Darboux basis $x_1,x_2,y_1,y_2\in V$ with $\omega(x_i,y_j)=\delta_{ij}$ and $\omega(x_i,x_j)=\omega(y_i,y_j)=0$. A two-dimensional subspace $P$ of $V$ is called a Lagrangian plane, if $\omega(v,w)=0$ for any $v,w\in P$. Denote $\mathfrak L$ the set of all Lagrangian planes.
Using the group structure of $V$, we may define the group algebra $A:=\mathbb F_q\!\left<V\right>$, which as a $\mathbb F_q$-vector space is spanned by symbols $\{Z_i\,,\, i\in V\}$. Multiplication is defined by $Z_i\cdot Z_j :=Z_{i+j}$, so $1=Z_0$. Then $A$ is a local $\mathbb F_q$-algebra with maximal ideal $\mathfrak m$ generated by the $(Z_i-1)$.
For a plane $P\subset V$, we define $S_P := \sum_{i\in P} Z_i$.
We consider the linear $L$ subspace of $A$, spanned by all $S_P$ for $P\in\mathfrak L$. I observed that $L$ is in fact an ideal for $q=2,3,4,5,7$ and I think that this is true for every $q$.
My question is: how to prove that $L$ is an ideal?
The curious thing is that the choice of the set of planes $\mathfrak L$ seems to be completely arbitrary, since the construction of $A$ does not depend on $V$ being symplectic. But in fact, if we replace $\mathfrak L$ by another set of planes, such as the non-isotropic ones, the resulting linear span will not be an ideal. So there are two questions: How to characterize sets of planes $\mathfrak S$ such that the span $\left< S_P\,,\,P \in \mathfrak S\right>$ is an ideal? How to generalize this to higher dimensions?
Remark 1: for $q=2,3,4,5,7$ we have $\dim_{\mathbb F_q} L=10,25,50,91,225$, respectively.
Remark 2: If $q=p$, then $A$ is isomorphic to $\mathbb F_q[Z_{x_1},Z_{x_2},Z_{y_1},Z_{y_2}]/J$, where $J$ is the ideal generated by the $(Z_i-1)^p$. If $P$ is spanned by vectors $v$ and $w$, then $S_P=(Z_v-1)^{p-1}(Z_w-1)^{p-1}$.

A: As we discussed in comments, your space is not an ideal.  In fact it is the same as the space spanned by the elements of the form $S_\ell \mathrel{:=} \sum_{v \in \ell} Z_v$ as $\ell$ runs over lines in $V$.  Indeed, note that every (isotropic) plane contains $p + 1$ lines, and every line is contained in $p + 1$ isotropic planes, so that $S_P = \sum_{\ell : \ell \subseteq P} S_\ell$ and $S_\ell = \sum_{P : \ell \subseteq P} S_P$.  In particular, if $\sum_{v \in V} c_v Z_v \in L$, then $c_v = c_{\lambda v}$ for all $v \in V$ and all $\lambda \in \mathbb F_q^\times$.


text:
Q: Advices on what kind of structure to use in Python to store music informations I'm working on a Music project, and I'm retrieving informations about artists, but I don't know what shoul be the best structure to use to store the data. I was thinking about a simple DataFrame, but I want to insert informations like number of albums, and for everyone of them, other infos like number of song, genre, year, lyrics of the songs and so on...
My last idea was to work with json, and that's the proposal:
jsondic = {
        'artist': 'name',
        'genre': 'rock',
        'link': 'linksite',
        'year': 0000,
        'n_album': 10,
        'album': {
            'title': 'titalbum',
            'release': 'releaseyear',
            'tracks': {
                'id': 1,
                'title': 'songtitle',
                'lyrics':'boby content of songs'
            }
        }
    }

is that a good idea? can you suggest better ways? maybe faster also in terms of computation capacity, because I estimate to store 10,000 artists (with all the songs and the lyrics)
thank you!

A: *

*Looks good at the first glance.

*Add code to populate the structure. (this will enable us to test it)

*Add one code to print the structure.

*10000 is not (assuming you are
not string musics). Repeat one single example 10000 times to get
initial of perfo?
5.Mobile or desktop app?


text:
Q: Unanswered questions showing last editor instead of OP If you visit the list of questions for any SE site, you will notice the original question author's name and icon beside the question.
However, if you visit the list of unanswered questions you will instead see the name and icon for the person who last edited the post.
Is there a justified reason for this? I think it makes more sense to show the OP's name, rather than the last editor.

A: If you'd notice, it says "modified" above the image:

It means that the information is regarding the latest modification (probably because that's how it's listed). I'd call this one status-bydesign.
You shouldn't care about the OP's reputation when answering a question. You don't answer users, you answer questions. It's all about the questions. It's possible for a 1 reputation to ask a much better question than a 40k one. Also, if you need to see the OPs reputation so bad, just enter the question.

A: It seems as though it's worded poorly. Take this question for example:

modified seems to mean there was some sort of activity on this question. In the case of the above question, that happened to be the last user who answered the question. There was nothing modified in the question.


text:
Q: Issues with If/else-if statements - Text Based Adventure [C Programming] Text Based Adventure issue/question for lines (78-100)
Currently, in my first programming class, we are asked to do a project and a group project. The project my group chose was a text based adventure. I'm doing a majority of the work or doing research and ran into trouble and couldn't google my issue. My issue is, in the lines 78-100, I'm having to use an _ (underscore) to count as a space in my if/else statements. Is there a way I can have it to where anyone that plays this can just enter "Look around" as opposed to "Look_around"? I find that it could be extremely inconvenient having to always use an underscore to answer questions with more than one word. Any help and/or advice would be greatly appreciated.
My code is below:
// ConsoleApplication2.cpp : Defines the entry point for the console
application.
//

#include "stdafx.h"
#include <conio.h> // Allows the getch function //
#include <string.h> // Allows string/char functions //
#include <stdlib.h>
#include <stdio.h>
#define getch() _getch() // Allows you to use getch()
using namespace std;

int main()
{
char user_input[25];
char name[50];
// user_input = (char)toupper(user_input); // This is example of what
perhaps getting user_input to print capital letters //

printf("What is your name, weary traveler?\n\n"); // Introduction //
scanf("%s", name);
printf("You wake up to find yourself on the ground, in a dimmly lit room. \n");
printf("You stand up and look around, only to see a shadowy figure, it speaks, ");
printf("\nYou see %s, you're caught in a place that is both awake and dormant.\n", name);
printf("In this place, it's your fears that come to life, ones that'll haunt you,\n");
printf("in short, you're in your own nightmare. ");
printf("It's best you find a way to wake up soon or else you'll be trapped here forever. . .\n\n\n");

printf("------------------------------Press any key to continue-------------------------"); // End of introduction //
getch(); // Grabs any key hit and allows it to go to the next line of code //

system("cls"); // Clears screen so you can begin the game //
printf("\n\n\n----------------------Chapter 1: Nightmare on 2325 Chester Blvd-----------------\n\n\n"); // Begins Chapter 1 //
printf("You turn away from the shadowy figure to make sense where you are, ");
printf(" but when you turn back around to ask the figure where you are, you ");
printf("notice no one is there, you ask yourself \"Where am I?\"\n\n\n");
printf("You figure, to get the answers you seek, you must explore.\n");
printf("Where do you go? (Options: North/Up, East/Right, South/Down, West/Right)\n\n\n");
scanf("%s", user_input);

if ((strcmp(user_input, "North") == 0) || (strcmp(user_input, "north") == 0) || (strcmp(user_input, "Up") == 0) || (strcmp(user_input, "up") == 0)) { // This intends that you go North, expand onto this If statement to specify what happens if you go North //
    printf("\nYou are going up.\n");
}
if ((strcmp(user_input, "East") == 0) || (strcmp(user_input, "east") == 0) || (strcmp(user_input, "Right") == 0) || (strcmp(user_input, "right") == 0)) { // This intends that you go East, expand onto this If statement to specify what happens if you go East //
    printf("\nYou are going right.\n");
}
if ((strcmp(user_input, "South") == 0) || (strcmp(user_input, "south") == 0) || (strcmp(user_input, "Down") == 0) || (strcmp(user_input, "down") == 0)) { // This intends that you go South, expand onto this If statement to specify what happens if you go South //
    printf("\nYou are going down.\n");
}
if ((strcmp(user_input, "West") == 0) || (strcmp(user_input, "west") == 0) || (strcmp(user_input, "Left") == 0) || (strcmp(user_input, "left") == 0)) { // This intends that you go West, expand onto this If statement to specify what happens if you go West //
    printf("\nYou are going left.\n");
}
if ((strcmp(user_input, "Quit") == 0)) { // Without this if statement, the fourth If would only right "You're going left." Thus, this eliminates that so you can continue to have the if statement followed by the else statement.
    exit(0);
}

// Begin doing if statements for North and what inputs/scenarios would go into that "if" state

if ((strcmp(user_input, "North") == 0) || (strcmp(user_input, "north") == 0) || (strcmp(user_input, "Up") == 0) || (strcmp(user_input, "up") == 0)) { // This intends that you go North, expand onto this If statement to specify what happens if you go North //
    printf("\nYou walk down the hallway in front of you, you find several classroom doors shut, except one which seems to be cracked open, ");
    printf("however, you still haven't reached the end of the hall\n.");
    printf("\nWhat do you want to do? Where do you want to go? (Options: Straight/Forward or Classroom)\n\n");
    scanf("%s", user_input);
}

if ((strcmp(user_input, "Straight") == 0) || (strcmp(user_input, "straight") == 0) || (strcmp(user_input, "Forward") == 0) || (strcmp(user_input, "forward") == 0)) { // Can only use one word to do the printf line, meaning straight works but go straight doesn't //
    printf("You continue");
}

if ((strcmp(user_input, "Classroom") == 0) || (strcmp(user_input, "classroom") == 0)) {

    printf("You open up the half shut door of the classroom and begin to enter, only to see it's pitch black inside.");
    // You enter the classroom, it's dark. //
}

printf("\n\nWhat do you do?\n\n"); // Asks the user where they want to go, down the hallway or in the classroom //
scanf("%s", user_input);

if ((strcmp(user_input, "Look_around") == 0)) {// While loop that'll force users to have to look for a light source //

    printf("It's too dark to see, maybe there's a light source around here.");
    printf("\n\nWhat do you do?\n\n"); // loops back up //
    scanf("%s", user_input);
    printf("\n");
}

if ((strcmp(user_input, "Find_lightswitch") == 0)) {
    printf("The classroom light turns on. ");
    printf("You glance around the room and find that the desks are pushed against the back windows. \n");
    printf("You notice that the desks can be moved, but you don't know if you should.");
}

printf("\n\nWhat do you wish to do?\n\n");
scanf("%s", user_input);
printf("\n\n\n");

if ((strcmp(user_input, "Leave_classroom") == 0) || (strcmp(user_input, "Leave_the_classroom") == 0) || (strcmp(user_input, "Leave") == 0) || (strcmp(user_input, "Leave_room") == 0) || (strcmp(user_input, "Leave_the_room") == 0)) {
    printf("You attempt to leave the classroom, but find that the door is locked.");
}
else if ((strcmp(user_input, "Move_desks") == 0)) {
    printf("Moving the desks reveals, \"You are not dreaming\", is written in green on the window."); // \" and \" gives "and" //
    printf("You write on the window \"Yes I am\" and turn around and begin walking away, you hear a splash.\n\n");
    printf("\n\n\n");
}

printf("The Window - \"Yes you are.\"\n\n");
printf("\t\t\t\"No I'm not, wait are you just trying to confuse me?\" - %s \n\n", name);
printf("The Window - \"Yes, you seem like you could be fooled, so I fooled you\"\n\n");
printf("\t\t\t\"Well, I know I'm dreaming and that's that.\" - %s \n\n", name);
printf("The Window - \"Since I'm unable to fool you, so you say,");
printf(" you must answer these questions to be able to leave the room.\"\n\n");
return 0; //"You write on the window \"Yes I am\" and turn around and begin walking away, you hear a splash.\n\n");

}

A: If you don't know exactly how many words the user will type in, you are better off using fgets() instead of scanf().  fgets() will keep reading, up to a maximum number of characters, until a newline character is hit.  So you can read in the entire user input, and then figure out how to break it into words using blanks as seperators (strtok() would probably work ok in this situation).
# define MAX_INP 256

int main()
{
    char userInp[MAX_INP];

    if (fgets(userInp, MAX_INP, stdin) == NULL) {
        // handle error
    }

    printf("%s\n", userInp);

    // now break userInp into individual words
}

Your input buffer is user_input, MAX_INP should be equal to the size of your input buffer, in your example above, that would be 25.  In that case, at most 24 letters would be read and stored in user_input along with a terminating \0.  stdin means that you wish to read from standard in, instead of from a file.
I would look around for a manpage for fgets() for more details.  If you understand how scanf() works, it shouldn't be difficult to understand fgets().


text:
Q: tccd stuck and taking up lots of cpu Often when I am using XCode (and sometimes other apps) the tccd process will take up lots of CPU or just get stuck. I find myself more and more having to kill that process (now it happens multiple times a day). It always seems to immediately re-start the process as soon as it is killed.
I am wondering if there is a way to fix it so that it does not break all the time.

A: I found this blog post titled: Fix TCCD process consuming high CPU usage when run Xcode.
excerpt

Using Xcode 8 is really a frustrating experience. When compile swift source files or write code in Sierra(the latest macOS), Xcode frequently freeze. It's nuking productivity. After a long time of searching, I found this is caused by a process named tccd which take up to 70% of CPU usage. What is tccd? It seems to be a access controller that manage the permission to user's contacts. So the solution is quite easy, go to
System Preferences → Security & Privacy → Privacy → Contacts
uncheck Xcode and restart it. Then, it works again.

So it would seem, simply disabling contacts will disable tccd thereby dropping the high CPU load.


text:
Q: how to set JFrame background transparent but JPanel or JLabel Background opaque? As per assignment, we have to create a image viewer just like Picasas one. picture in the middle, translucent black background and changing images with left/right buttons.
i can display an image set it to undercoated, set it to translucent frame but along with frame the the picture becomes translucent. what am i doing wrong.
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

JFrame f1 = new JFrame("ShowImage");
f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f1.setSize(dim);

f1.setUndecorated(true);
f1.setOpacity(0.5f);
ShowImage panel = new ShowImage();
panel.setBackground(Color.black);

f1.setContentPane(panel);
f1.setVisible(true);

i tried
si.setOpaque();
si.setBackground(Color.black);
si.setForeground(Color.red);

none worked
when i took a boolean and tested
si.isDisplayable();
si.isVisible();
si.isShowing();

only is visible returns true, rest are false, are these any contributing factor?

A: The problem is, the JFrame's default Layout manager is a BorderLayout, this means that your ShowImage pane is filling the entire area of the frame (in black). I bet if you changed the background of the ShowPane to red. It would show up completely filled in red instead
Now you can have a look at A Visual Guide to Layout Managers or change the way your ShowPane works
UPDATE
Apologies, I'm not familiar with the new Transparency API in Java 7 (still using the Java 6 hack ;))

Can you verify for me that this is the kind of effect you are looking for?  Where the read square would be the image (and the black background is the frame - nb, I only captured the frame)
UPDATE

First you want to read Window.isOpaque and Window.setBackground to understand how this solution works.
Next, don't use Window.setOpacity, it isn't going to achieve what you want.  The main reason is that the opacity value is applied to the parent and it's children (this through me at first).
So, the frame code:
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// Make sure where in the top left corner, please lookup how
// to find the screen insets ;)
setLocation(0, 0);
setSize(dim);
// Set undecorated
setUndecorated(true);
// Apply a transparent color to the background
// This is ALL important, without this, it won't work!
setBackground(new Color(0, 255, 0, 0));

// This is where we get sneaky, basically where going to
// supply our own content pane that does some special painting
// for us
setContentPane(new ContentPane());
getContentPane().setBackground(Color.BLACK);
setLayout(new BorderLayout());

// Add out image pane...
ShowImage panel = new ShowImage();
add(panel);

setVisible(true);

The ContentPane.  Basically, we need to "trick" the paint engine into thinking where transparent (not opaque) and then paint our own opacity
public class ContentPane extends JPanel {

    public ContentPane() {

        setOpaque(false);

    }

    @Override
    protected void paintComponent(Graphics g) {

        // Allow super to paint
        super.paintComponent(g);

        // Apply our own painting effect
        Graphics2D g2d = (Graphics2D) g.create();
        // 50% transparent Alpha
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));

        g2d.setColor(getBackground());
        g2d.fill(getBounds());

        g2d.dispose();

    }

}

I'm sorry for my earlier answer, but I hope this makes up for it ;)
UPDATE with Buttons
This is how I modified it
ShowImage panel = new ShowImage();
panel.setBackground(Color.RED);

setContentPane(new ContentPane());
getContentPane().setBackground(Color.BLACK);
setLayout(new BorderLayout());
add(panel);

JPanel pnlButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
pnlButtons.setOpaque(false);
pnlButtons.add(new JButton("<<"));
pnlButtons.add(new JButton("<"));
pnlButtons.add(new JButton(">"));
pnlButtons.add(new JButton(">>"));

// Okay, in theory, getContentPane() is required, but better safe the sorry
getContentPane().add(pnlButtons, BorderLayout.SOUTH);

setVisible(true);


text:
Q: MKMapView inside a UIScrollView doesn't move with swipes I've got a detail view with various labels and such providing information about a place (address, phone, etc.). The information provided is taller than an iPhone screen so they're all in a UIScrollView (itself inside a UIView) that allows you to swipe up and down to see everything.
I also have an MKMapView inside the scrollview. When it's not attached to anything in Interface Builder it moves up and down with the scrollview, as it should, staying in it's correct relative position to the other controls in the scrollview. You can play with the map, zooming and panning it, etc. and it shows your current location by default.
However, as soon as I hook it to an MKMapView variable in IB, the mapview no longer scrolls with the scrollview. Instead it literally just sits in the position it's originally displayed in (bottom of the view, with a little of the map hidden below the bottom of the view) and the scrollview scrolls up and down behind it.
What's happening here? I've tried changing a bunch of the mapview's and scrollview's properties in IB, but it has no effect. The only thing I haven't tried is just creating the mapview entirely in code, but that doesn't seem like an obvious solution.
EDIT: Sorry to everyone about the expired bounty. I got hung up in other areas of the project and couldn't get back here until now. I didn't know it would expire.
FURTHER EDIT: Well, I figured out my problem. For reasons completely unknown to me I had
[self.view addSubview:mapView];

in the viewcontoller's ViewDidLoad. Once it was hooked up then that line of code would (obviously) make the map a subview of my of view, effectively yanking it out of the scrollview.
Stupid mistake, sorry to have wasted your time (and the bounty). I'll delete this question after I think the answerers have had a chance to see the result.

A: Do you have setContentSize property set to the content's size in the viewDidLoad method of the UIViewController?

A: Looking like as you are using the ScrollView,you need to scrolling facility in your DetailView.
Instead of using the ScrollView ,I had an alternative of this ....
You can try your hard luck by using the TableView instead of ScrollView.
Just take all the labels and mapView in a single View and then put that view in the header of the TableView.
like this :
UITableView
--> View
------>All Labels  // Inside the singleView
------>MKMApView   // At bottom of the View
Still You can play with the map, zooming and panning it, etc. and it will show your current location by default.
Hope this alternative can solve your problem.......
All the Best

A: If hooking up an outlet in IB is breaking an otherwise working view, you might be able to try this to locate the view at runtime:
- (UIView *) findClass:(Class) aClass inView:(UIView *) aSuperview {
    for ( UIView *view in aSuperview.subviews ) {
        if ( [view isKindOfClass: aClass] ) break;
        if ( ( view = [self findClass: aClass inView: aSuperview] ) ) break;
    }

    return view;
}

- (void) viewDidLoad {
    MkMapView   *map = [self findClass: [MkMapView class] inView: self.view];
}

A: I figured out my problem. For reasons completely unknown to me I had
[self.view addSubview:mapView];

in the viewcontoller's ViewDidLoad. Once it was hooked up then that line of code would (obviously) make the map a subview of my of view, effectively yanking it out of the scrollview.


text:
Q: How to get the assigned properties of an object initializer using reflection? I have classes that specify hard coded values. An example looks like the following:
    [CodeGenAsValueObject]
    public class DfltTaxableTypes : WithEnumerablePropsOfType<TaxableType>
    {
        public static TaxableType Taxable = new TaxableType()
        {    // <-  I want what's inside of here specifically as Dict<string, object>
            TaxableTypeId = new Guid("7a702ec4-94a3-431b-8217-2b44ef0ae22a"),
            Name = "Taxable"
        };   //  <-  To here

        public static TaxableType NonTaxable = new TaxableType()
        {
            TaxableTypeId = new Guid("76eee771-cbdc-4a7b-95d5-0d6e0959bdff"),
            Name = "NonTaxable"
        };
    }

Assume TaxableType has many properties that otherwise I don't care about.
How can I using reflection get something like a Dictionary<string, object> of assigned properties for each static TaxableType?
I am using this in custom Code Generation for our Typescript clients so performance is not an issue.
What I have as a start:
    var dfltValObjContainers = myAssy.GetTypes()
        .Where(x => x.CustomAttributes.Select(y => y.AttributeType)
            .ToList()
            .Contains(typeof(CodeGenAsValueObject)))
        .Distinct().ToList();

    var containerInstances= dfltValObjContainers.Select(x => {
            var instance = Activator.CreateInstance(x);
            // Could get all Fields' values where value != default(fieldType)..
            // Would prefer a more direct get assigned properties of object initializer.
            var eaValueObj = x.GetFields().Select(f => {
                return f.GetObjectInitializersAsDict() // <- Need help here.
            }).ToList();
        }).ToList();


text:
Q: How can we connect and execute oracle database objects from Sybase database objects Could you please anybody let me know how to connect to oracle database and execute the stored procedure/function from Sybase database objects?

A: Please look at the Oracle Gateway for ODBC as an option.  It is free (the other database-specific gateways can be costly) and fairly easy to setup.  Check the Oracle docs for further information.
Simply put, with this approach you'll create a Oracle dblink that will be resolved by a listener that will in turn call the gateway which will communicate with the Sybase database via ODBC.
HTH

A: you have tagged your question with sybase-sql-anywhere, sybaseiq, sybase-ase-15.7 - these are separate SAP (ex Sybase) products - each has its own methods of connecting to remote databases.
If you mean SQL Anywhere and you want to execute Oracle procedures from SQL Anywhere (not the other way round) then the basic steps are
a) define a remote server in the SQLA database for the Oracle
    database ( CREATE SERVER, CREATE EXTERNAL LOGIN)
b) define a remote procedure in the SQLA database for the Oracle
    procedure (CREATE PROCEDURE ... AT ...)
I have linked the SQL commands above, to the SAP online documentation. If you have problems I suggest asking at the dedicated SQL Anywhere support forum http://sqlanywhere-forum.sap.com/


text:
Q: Unfortunately App has stopped with no verbose in logcat I created an app with login activity and wanted to add an splash screen,I have added a java class and layout for the splash screen and bind the layout to the java class and run the app.
It doesn't run it show a dialog that says "unfortunately "my app" has stopped" and no verbose or any error appears in the logcat so i can't find where is the error !!! anyone can help,please??

my java class for splash screen
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;

public class Splash extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        Thread myThread=new Thread(){
            @Override
            public void run() {
                try {
                    sleep(2000);
                    Intent in =new Intent(getApplicationContext(),LoginActivity.class);
                    startActivity(in);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        myThread.start();
    }
}

logcat after editing :
/com.google.android.gms.persistent E/InstantApps: DomainFilterImpl: Error while reading domain filter from WHAPI
                                                                              java.util.concurrent.ExecutionException: axvq: INVALID_ARGUMENT: Application credential header not valid. Please fix the client to pass a valid application credential header.
                                                                                at java.util.concurrent.FutureTask.report(FutureTask.java:93)
                                                                                at java.util.concurrent.FutureTask.get(FutureTask.java:163)
                                                                                at tik.get(:com.google.android.gms:2099)
                                                                                at tmd.a(:com.google.android.gms:347)
                                                                                at tmd.a(:com.google.android.gms:313)
                                                                                at tmd.a(:com.google.android.gms:131)
                                                                                at tmd.b(:com.google.android.gms:101)
                                                                                at tly.b(:com.google.android.gms:38)
                                                                                at com.google.android.gms.instantapps.routing.DomainFilterUpdateChimeraService.a(:com.google.android.gms:74)
                                                                                at rml.run(:com.google.android.gms:261)
                                                                                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                at java.lang.Thread.run(Thread.java:818)
                                                                               Caused by: axvq: INVALID_ARGUMENT: Application credential header not valid. Please fix the client to pass a valid application credential header.
                                                                                at axvm.c(:com.google.android.gms:505)
                                                                                at lgy.a(:com.google.android.gms:168)
                                                                                at thx.b(:com.google.android.gms:7164)
                                                                                at thx.a(:com.google.android.gms:57)
                                                                                at til.call(:com.google.android.gms:1049)
                                                                                at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                at lmq.run(:com.google.android.gms:450)
                                                                                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                at lra.run(:com.google.android.gms:17)
                                                                                at java.lang.Thread.run(Thread.java:818)

manifest file :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="app.com.example.abdelrahman.carcare">

    <!-- To auto-complete the email text field in the login form with the user's emails -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".Splash"
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".CreatNew"
            android:label="@string/title_activity_creat_new">
        </activity>
        <activity android:name=".LoginActivity"
            android:label="@string/app_name"
            ></activity>
    </application>

</manifest>

:

A: That's because you can now only see logs from Firebase. Change it to Show only Selected Application


text:
Q: How to filter deep nested data? - Javascript JSON I need to filter a JSON data between three values, I got two values working which is "timestamp" that are not nested/deep, but one value is nested which is "fromMe".
I have access to the "timestamp" value because its not nested, but I cant get it working to access the lastMsg -> id -> fromMe.
Javascript code
         var filterMessages = chats_ativo.filter(function(x){
            return x.timestamp >= variable1 && x.timestamp <= variable2; /* working */
            return x.timestamp >= variable1 && x.timestamp <= variable2 && x.lastMsg.id.fromMe == false; /* not working */
         });

JSON data - console log (deleted some personal info)
  "id": {
   "server": "c.us",
   "user": "phonenumber",
   "_serialized": "phonenumber@c.us"
  },
  "name": "Name",
  "isGroup": false,
  "isReadOnly": false,
  "unreadCount": 0,
  "timestamp": 1596167676,
  "archived": false,
  "lastMsg": [
   {
    "id": {
     "fromMe": false,
     "remote": {
      "server": "c.us",
      "user": "phonenumber",
      "_serialized": "phonenumber@c.us"
     },

A: This approach should work, since the lastMsg property is an array, I'd note that we should also ensure that lastMsg exists and the properties accessed are available.
You could also consider having a look at the lodash get function, this can be very useful for accessing nested properties.

let chats_ativo = [{ "id": { "server": "c.us", "user": "phonenumber", "_serialized": "phonenumber@c.us" }, "name": "Name", "isGroup": false, "isReadOnly": false, "unreadCount": 0, "timestamp": 1596167676, "archived": false, "lastMsg": [ { "id": { "fromMe": false, "remote": { "server": "c.us", "user": "phonenumber", "_serialized": "phonenumber@c.us" } } }] }];

var variable1 = 1596167676;
var variable2 = 1596167676;

var filterMessages = chats_ativo.filter(function(x) {
    return x.timestamp >= variable1 && x.timestamp <= variable2 && x.lastMsg[0].id.fromMe == false;
});

console.log("Filtered messages:", filterMessages);

A: The lastMsg is an array. It needs to be accessed by index.
Assuming it has only one object as an element.
return x.timestamp >= variable1 && x.timestamp <= variable2 && x.lastMsg[0].id.fromMe == false;


text:
Q: Application crashing when user signs out Guys i have been making this simple Uber app and whenever the Driver LogsOut my app crashes because the getCurrentUser() method is returning a null value. But whenever the user logsOut im closing the activity, and before calling getCurrentUser() i have this if(getApplicationContext()!=null) which should return false because the activity is closed so it should prevent getCurrentUser() from being called. How do i prevent it from crashing? What am i missing here?
This is where on Button click i logOut my user
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

//some code here

    mLogout=(Button)findViewById(R.id.logout);
            mLogout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    isLoggingOut = true;
                    disconnectDriver();

                    //Signing out user here
                    FirebaseAuth.getInstance().signOut();
                    Intent intent = new Intent(DriverMapActivity.this, MainActivity.class);
                    startActivity(intent);
                    return;
                }
            });
//some code here
}

This is where the error is happening
@Override
    //this is going to run whenever the driver location changes
    public void onLocationChanged(Location location) {
        if(getApplicationContext()!=null) {

            mLastLocation = location;
            LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());

            mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
            mMap.animateCamera(CameraUpdateFactory.zoomTo(11));

            //
            //This is where the error is happening
            //java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.auth.FirebaseUser.getUid()' on a null object reference

            String userId = FirebaseAuth.getInstance().getCurrentUser().getUid();

            DatabaseReference refAvailable = FirebaseDatabase.getInstance().getReference("driversAvailable");

            DatabaseReference refWorking  = FirebaseDatabase.getInstance().getReference("driversWorking");

            GeoFire geoFireAvailable = new GeoFire(refAvailable);

            GeoFire geoFireWorking = new GeoFire(refWorking);

            switch(customerId){

                case "":

                   geoFireWorking.removeLocation(userId);
                    geoFireAvailable.setLocation(userId, new GeoLocation(location.getLatitude(), location.getLongitude()));
                    break;
                default:

                    geoFireAvailable.removeLocation(userId);
                    geoFireWorking.setLocation(userId, new GeoLocation(location.getLatitude(), location.getLongitude()));
                    break;

            }
        }
    }

This is the Error Log
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.jonanako.uber, PID: 15522
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.auth.FirebaseUser.getUid()' on a null object reference
        at com.jonanako.uber.DriverMapActivity.onLocationChanged(DriverMapActivity.java:211)
        at com.google.android.gms.internal.location.zzat.notifyListener(com.google.android.gms:play-services-location@@18.0.0:2)
        at com.google.android.gms.common.api.internal.ListenerHolder.zaa(com.google.android.gms:play-services-base@@18.0.1:2)
        at com.google.android.gms.common.api.internal.zacb.run(Unknown Source:4)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

A: getApplicationContext() won't be null when you finish() Activity, even last or one and only. consider using if(!isFinishing()), lifecycle checking or just set own boolean flag.
additionally you may (should) also check that getCurrentUser() returns null, that would mean that user logs out. if is null then don't call any method on returned object (because nothing is returned in fact)
if(!isFinishing() && FirebaseAuth.getInstance().getCurrentUser()!=null) {

A: Since you assign false to your isLoggingOut = true; whenever you click on the button, you should just check if(getApplicationContext()!=null && !isLoggingOut) so the code wont run whenever isLoggingOut==false;


text:
Q: SignalR notification system This is my first time playing around with SignalR. I am trying to build a notification system where the server checks at regular intervals to see if there is something (query database) to broadcast and if there is then it broadcasts it to all the clients.
I came across this post on Stackoverflow and was wondering if modifying the code to make a DB call at a particular interval was indeed the right way to do it. If not is there a better way to do it?
I did see a lot of Notification related questions posted here but none with any code in it. Hence this post.
This is the exact code that I am using:
public class NotificationHub : Hub
{
    public void Start()
    {
        Thread thread = new Thread(Notify);
        thread.Start();
    }

    public void Notify()
    {
        List<CDCNotification> notifications = new List<CDCNotification>();
        while (true)
        {
            notifications.Clear();
            notifications.Add(new CDCNotification()
                {
                    Server = "Server A", Application = "Some App",
                    Message = "This is a long ass message and amesaadfasd asdf message",
                    ImgURL = "../Content/Images/accept-icon.png"
                });
            Clients.shownotification(notifications);
            Thread.Sleep(20000);
        }
    }
}

I am already seeing some weird behaviour where the notifications come more often than they are supposed to. Even though I am supposed to get it every 20s I get it around 4-5 secs and I get multiple messages.
Here is my client:
var notifier = $.connection.notificationHub;
notifier.shownotification = function (data) {
    $.each(data, function (i, sample) {
        var output = Mustache.render("
{{Application}}
{{Server}}
{{Message}}
", sample);
        $.sticky(output);
    });
};

$.connection.hub.start(function () { notifier.start(); });

A: Couple of notes:

*

*As soon as a second client connects to your server there will be 2 threads sending the notifications, therefore if you ave more than one client you will have intervals smaller than 20s

*Handling thread manually within ASP.NET is considered bad practice, you should avoid this if possible

*In general this smells a lot like polling which is kind of the thing SignalR lets you get rid of since you don't need to signal the server/client

In order to solve this you need todo something like this (again, threads in a web application are generally not a good idea):
public class NotificationHub : Hub
{
  public static bool initialized = false;
  public static object initLock = new object();

  public void Start()
  {
    if(initialized)
      return;

    lock(initLock)
    {
      if(initialized)
        return;

      Thread thread = new Thread(Notify);
      thread.Start();

      initialized = true;
    }
  }

  public void Notify()
  {
    List<CDCNotification> notifications = new List<CDCNotification>();
    while (true)
    {
      notifications.Clear();
      notifications.Add(new CDCNotification() { Server = "Server A", Application = "Some App", Message = "This is a long ass message and amesaadfasd asdf message", ImgURL = "../Content/Images/accept-icon.png" });
      Clients.shownotification(notifications);
      Thread.Sleep(20000);
    }
  }
}

The static initialized flag prevents multiple threads from being created. The locking around it is to ensure that the flag is only set once.

A: I am working on the same task over here. Instead of continuously checking the database, I created my own events and listener, where an event is RAISED when a NOTIFICATION IS ADDED :) What do you think about that?


text:
Q: how to create dictionary or json from list of strings in python? I am trying to create dictionary or json from list of strings which is going to be value for dictionary and I have dictionary key that going to be match value. I think it is intuitive for me to get this done, but I have following error:
> Traceback (most recent call last):
>     output[elm].append(k) TypeError: list indices must be integers or slices, not str

I am curious what cause this problem. can anyone point me out what is wrong with me code?
my attempt
here is my code:
update
lst = {api, 1,0,0}
mystring = lst.split(",")

mystring = ['api', '1', '0', '0']
names = {'name', 'mayor', 'minor', 'patch'}

output =[]
for elm in range(len(names)):
    for k in range(len(mystring)):
        output[elm].append(k)

print(output)

how can I fix the error? Is there efficient way to make dictionary or json from list of strings without using nested for loop? any better idea?
desired output:
I want to get dictionary or json something like this:
{
  "mayor": 1,
  "minor": 0,
  "name": "api",
  "patch": 0
}

I am sorry if my coding defect is minor, I couldn't locate source of the problem. thanks

A: A neat one-liner:
my_string = ['api', '1', '0', '0']
names = ['name', 'mayor', 'minor', 'patch']

output = {names[i]: my_string[i] for i in range(len(my_string))}
print(output)

This should give:
{'name': 'api', 'mayor': '1', 'minor': '0', 'patch': '0'}

Note that your variable names is no longer a set; There was no need to have a set. Also, if there was a set, the code wouldn't work because sets are not subscriptable.
There are a lot of errors in your code:
Over here, you are declaring a list, not a dictionary:
output =[]

Over here you are going over the length of your set and list, you have to go over them:
for elm in range(len(names)):
    for k in range(len(mystring)):

A: Use builtin zip function. Zip works on lists, so you need to convert your set to list first. Of cause it's not a good idea to rely on the order in the set, so it's better to create both lists as list
mystring = ['api', '1', '0', '0']
names = {'name', 'mayor', 'minor', 'patch'}
output = zip(list(names),mystring)
print(dict(output))

or using two lists as an input
mystring = ['api', '1', '0', '0']
names = ['name', 'mayor', 'minor', 'patch']
output = zip(names, mystring)
print(dict(output))

Both prints
{'name': 'api', 'patch': '1', 'mayor': '0', 'minor': '0'}

Of cause if you want numbers to be a number and not string, make sure their types are correct in the list that you pass to zip:
mystring = ['api', 1, 0, 0]
names = {'name', 'mayor', 'minor', 'patch'}
output = zip(list(names),mystring)
print(dict(output))

prints
{'patch': 'api', 'minor': 1, 'mayor': 0, 'name': 0}


text:
Q: Change unity input to crossplatform input This is the code i have coded through the online tutorial it is a normal swiping input but i want to change it to cross-platform input. I have no idea how to change it hope you guys can help me out
if (Input.touchCount == 1)
{
    if (isSwipping)
    {
        Vector2 diff = Input.GetTouch(0).position - startingTouch;
        diff = new Vector2(diff.x / Screen.width, diff.y /
        Screen.width);

        if (diff.magnitude > 0.01f)
        {
            if (Mathf.Abs(diff.y) > Mathf.Abs(diff.x))
            {
                if (diff.y < 0)
                {
                    Slide();
                }
                else
                {
                    Jump();
                }
            }
            else
            {
                if (diff.x < 0)
                {
                    ChangeLane(-1);
                }
                else
                {
                    ChangeLane(1);
                }
            }

            isSwipping = false;
        }
    }

    if (Input.GetTouch(0).phase == TouchPhase.Began)
    {
        startingTouch = Input.GetTouch(0).position;
        isSwipping = true;
    }
    else if (Input.GetTouch(0).phase == TouchPhase.Ended)
    {
        isSwipping = false;
    }
}