text:
Q: Does dereferencing an rvalue pointer produce a lvalue? I have the simple code:
int & i = *(new int(100));

As far as I know, the RHS of the equation is a rvalue.. How can an rvalue bound to a lvalue reference?
Also if this is legal, does it produce the desired result always, or it is an undefined behavior? And if I do delete &i, will it be an undefined behavior too?

A: The right-hand side of the assignment is a dereferenced pointer, and this is an lvalue, so  there no problem binding an lvalue reference to it. The standard specifically gives the example of a dereferenced pointer in its definition of an lvalue (3.10/1):

An lvalue (so called, historically, because lvalues could appear on the left-hand side of an assignment expression) designates a function or an object. [ Example: If E is an expression of pointer type, then *E is an lvalue expression referring to the object or function to which E points. As another example, the result of calling a function whose return type is an lvalue reference is an lvalue. — end example ]

There is no undefined behavior because i refers to a valid object.
Your question about delete is covered here.


text:
Q: Converting and comparing python multiindex dataframes I am trying to compare two dataframes, looking for different values between theme. One of the dataframes has multiindex columns containing data necessary for the comparison. Below a sample
weight = [1,5,2,4]
price = [2,6,3,5]
item = ['A','B','A','B']
date = ['20-12-2020', '21-12-2020', '20-12-2020', '21-12-2020']

DF2 = pd.DataFrame({'Date':date, 'weight':weight, 'price':price, 'item':item})

tuples = (['A', 'weight'], ['A', 'price'], ['B', 'weight'], ['B', 'price'])
index = pd.MultiIndex.from_tuples(tuples)

DF1 = pd.DataFrame(columns = index)

DF1['A','weight'] = [1,2]
DF1['A', 'price'] = [2,3]
DF1['B', 'weight'] = [5,4]
DF1['B', 'price'] = [6,5]
DF1.rename(index={0:'20-12-2020', 1:'21-12-2020'})

The aim would be to spot differences in weight and price for a given item and date between DF1 and DF2, but I don't know how to proceed given the multiindex in DF1 which contains also necessary data since it contains the item.

A: The easiest way to do this would be:
DF1[('C','diff weight')] = (DF1[('A','weight')] - DF1[('B','weight')])
DF1[('C','diff price')] = (DF1[('A','price')] - DF1[('B','price')])

which is
      A            B                 C
  weight price weight price diff weight diff price
0      1     2      5     6          -4         -4
1      2     3      4     5          -2         -2

Alternatively
DF1 = DF1['A'] - DF1['B']
DF1.columns = pd.MultiIndex.from_tuples([('diff',col) for col in DF1.columns])

wich gives
    diff
  weight price
0     -4    -4
1     -2    -2

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do get the view that is the tapped detail-disclosure-button The cell in this iPhone TableView definitely has a Detail-Disclosure-Button.
When I tap it... shouldn't this code give me access to the button?
Instead detailButton is always just null.
- (void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *aCell = [tableView cellForRowAtIndexPath:indexPath];
    UIButton *detailButton = (UIButton *)[aCell accessoryView];
}

A: are you over-riding the cell accessory button in 'cellForRowAtIndexPath' by any chance?

A: accessoryView is provided for your own customization, to override accessoryType.  The table view cell will internally handle whatever you assign to accessoryType without affecting accessoryView.


text:
Q: Set negative values in a array to zero by using the if conditional I have a function of some variables, which will yield an array consisted of both negative and positive values (Real). But since only positive values are physically meaningful to me, I want to set all negative values inside the array to be zero.
I have provided my code related to this function below:
The reason I declare a temporary variable 'res' is that I try to build in an IF-ELSE in the position I marked in code as follows:
If (res >= 0) Then
   result = res
Else
   result = 0
End If

But the error says a scalar-valued expression for S_A if required here.
If instead of res we use res(il,ir) is used,
If (res(il,ir) >= 0) Then
   result(il,ir) = res(il,ir)
Else
   result = 0
End If

the error says error #6351: The number of subscripts is incorrect.
Is there any way to implement this idea?
 Function somefunction(x,y,il,ir) Result(result)

 !! ---- begin of declaration ---------------------------

 Implicit None

 !! boundary indices
 Integer,            Intent ( in ) :: il,ir
 !! the vars
 Real ( kind = rk ), Intent ( in ), Dimension ( il:ir ) :: x,y
 !! the result
 Real ( kind = rk ), Dimension ( il:ir ) :: result
 !! temp vars
 Real ( kind = rk ), Dimension ( il:ir ) :: res
 !! loop index
 Integer :: i

 !! ---- end of declaration -----------------------------

 res     = x+y
 SA = S_A
 !!IF-ELSE!!
 End Function somefunction

A: If you want to have an if statement element wise on an array, you should use the where statement, for example:
program min0
    implicit none
    real :: res(5, 5), result(5, 5)
    call random_number(res)
    res=res-0.5

    print '(5(F5.2,X))', res

    where (res>=0)
        result = res
    elsewhere
        result = 0
    end where

    print *, '---------------------------------------'
    print '(5(F5.2,X))', result
end program min0

I don't know why you get a subscript error, it might help if you tell us which line of the code the error occurs. But of course in the second code, you update a single element of result if res is larger than 0, but set the whole array result to 0 if it isn't. This is almost certainly not what you want.
Cheers

A: The function appears to take in X and Y dimensioned from (il:if)... say from (3:6), so a vector. However the index later says (il,ir) which means it is a 2 dimensional array.
WHERE seems like a good choice. Another would be a logical MASK to associate the where-positions. It makes sense is PACK and unpack are usd,
Why even say what size the vectors are?
ELEMENTAL Function somefunction(x,y) Result(Res)

!! ---- begin of declaration ---------------------------

Implicit None

Real ( kind = rk ), Intent (IN), Dimension (:) :: x,y
!! the result
Real ( kind = rk ), Dimension ( il:ir ) :: res
!! loop index
Integer :: i

!! ---- end of declaration -----------------------------

res     = x+y
WHERE res <= 0
  Res = 0
ENDWHERE
!!IF-ELSE!!
End Function somefunction

Then on the calling side... call the function over the range of undecided you want.
Z(1:5) = somefunction(X(1:5),Y(1:5))


text:
Q: Cant open corrupted .cs file So my computer crashed while Visual Studio 2012 was on and my .cs file got corrupted. In Notepad++ there are just many 'NUL' words in black font and in simple notepad just white spaces, file had taken up some memory so I think its not all gone. I tried to recover it with Recuva, but after that file has a lot of random symbols screenshot:

So should I start coding over or I have a chance of saving it?
Thank you in advance.
P.S. The recovered file is in a different location so I do have the original corrupted file.Corrupted file

A: This happened to me a few times as well when VS crashed. In some of the cases, the files couldn't be recovered at all, but sometimes I managed to recover them using Recuva. You can find a tutorial here.

A: So I tried Recuva again but this time I looked in all shadow copies. I got few versions of my file and it seems not to miss any info needed. I thank everyone who contributed.


text:
Q: Looping through a Json array (C#) I have been working on some automated tests with selenium and I need to get some data out of a JSON file.
how can i go about coding this, i have this so far
string json = File.ReadAllText("myfilepath");
dynamic data = jsonConvert.DeserializeObject(json);
string x = data[0].CountryName.Value;

foreach(var CN in data.countryName)
{
    var CountryName = CN.CountryName;
}

I am a bit stuck on getting data through to loop it
Any help would be amazing guys
Example Json :
[
   {
       "CountryLookupId":123,
       "CountryName":data,
       "CountryLocation": moredata
   }
]

I am trying to loop through the CountryName,i need to loop through 31 things

A: With out testing it. make a object model:
public class CountryClass
{
    [JsonProperty("CountryLookupId")]
    [JsonConverter(typeof(ParseStringConverter))]
    public long CountryLookupId { get; set; }

    [JsonProperty("CountryName")]
    public string CountryName { get; set; }

    [JsonProperty("CountryLocation")]
    public string CountryLocation { get; set; }
}

Than deserialize list of object model:
List<CountryClass> data = jsonConvert.DeserializeObject<List<CountryClass>>(json);

Finally you can loop over your list of country objects:
foreach(var cn in data)
{
    var countryName = cn.CountryName;
}


text:
Q: How can I organize complex queries? I am analysing a relatively large (25GB compressed MySQL dump) static data set.  Some of the queries I'm writing are several tens of lines long, which makes them difficult to understand, modify, and reuse.  Also many query parts are reused in multiple queries.
I would like to break the processing into smaller parts, so that I can individually write and debug each part and reuse its results in other queries further down the road.  I could break the processing into views, but this would mean that each view would be evaluated multiple times (MySQL doesn't offer materialized views) making later queries very slow.  Alternatively, I could create intermediate tables (and suitable indices).  However, this would force me every time I modify a query, to find and recreate tables that depend on its results; a time-consuming and error-prone process.
I am thinking of automating and managing my workflow with make.  I would write one SQL query to create or recreate a table with its results (and suitable indices) in a separate file.  A make rule would create a dummy file every time the query gets evaluated, thus creating a timestamp, which will be used to determine which queries need to be executed or re-executed.  Dependencies between tables would be recorded in the Makefile, ensuring that all dependent tables get correctly updated.  Dependencies could be even automatically extracted from the queries by looking at the right of (suitably formatted) FROM and JOIN keywords.  This approach would provide me with modularity (one small query per file) and time efficiency (only the minimal set of queries will get evaluated when I change something).  Note that space is currently not a concern in my setup.
Given that the problem I'm facing must be fairly common, I wonder whether I'm missing another established solution.  I've read the How to Eat a SQL Elephant in 10 Bites blog post, and I've also searched for similar questions here, but I can't say I've found something that addresses my requirements and concerns.


text:
Q: Some options for programs on C in Linux I want to know can I run some compiled C program for example main.exe with option, that make sleep it after program work? Or can I run immediatly second program and using process, which running with main.exe?
I need to calculate memory of process, when I do it in background /proc/[pid]/status and ps aux show me incorrect values, because main.exe works so fast.
Or may be I can exec 2 programs in C using one fork()? Or can make option for execv or execl?

A: In Linux, time command can be used to calculate execution time, memory usage, etc
Refer http://linux.die.net/man/1/time
Usage ::
$ time main.exe

A: If you have access to source code of your application just insert code to send signal SIGSTOP to itself at the point you want to measure:
 raise( SIGSTOP );

then you can measure whatever you want and let program go by sending SIGCONT from outside. If you do not have such access you may try to run this process and send signal outside, for example by shell script, but you would need to play with delay:
#!/bin/bash
./main.exe &
sleep 0.1 # this may not work on your distro, you will need to find how to sleep subsecond
kill -SIGSTOP %1


text:
Q: Android: Need to show Package and Folder that contains database (XML, .TXT) after installation How to make folder and files that consists of database in .TXT and .XML appear after installation?
I know it was silly question, but I am creating an offline application using SQLite Database. If user submits the data from apps (e.g: insert to do list, create purchase order), the data will be saved and then TXT file is generated.
This .txt has role as database. The apps will get new data from .txt they recieve via email / cable data and upload .txt users generate to email. This feature is really important, so how to make those files appear in file directory? They have to be seen in order to do so.
Beside that, when I installed my apps I cant find my package folder installed. Though I did install my application from file explorer. I know that I can do it with USB Driver, but my PC couldnt update USBDriver to the phone since it said that my current one was newer. So I had to install it using package installer in my files.
I am very new in learning Android, so I hope you wouldn't mind to tell me what I need to do in my code.. Thanks.
my related previous question: Cant generate folders contains Offline Database after Android APK installation


text:
Q: How to make the downloaded data appear on the screen without delay? I have a data load method that returns LiveData. This LiveData is then passed through the Repository and ViewModel and its contents are viewed in the fragment. This happens in the onCreateView method. The problem is that the data from the database is displayed on the screen after a split second and the effect of the data appearing after starting this window is created. How can you prevent such a delay?
It is necessary for the user to immediately see this data as if it was hardcoded on the screen.
 @Transaction
 @Query("SELECT * FROM data")
    fun getData(): LiveData<List<Data>>?

A: Well that is how LiveData works. It releases your UI to continue rendering whats happening (loading the new fragment) and only updates the fields once data is loaded.
To stop this, you will have to slow down the UI transition by adding animations etc, but if a users phone is slow it might not be sufficient..
Alternatively you could design a loading screen and gracefully deal with the loading delay.


text:
Q: Salary with vector array to get sum of employee gross pay I am to create an application that takes at least 5 employees i.d, names, pay rate, and hours. And then I am to add the pay rate and the hours together to show the gross pay for each employee at the end of the initial inquiries. I am stuck on how to add it in the vector please help!
** Here is the assignment that our instructor gave us **
http://itweb.fvtc.edu/ag/?u=3&f=cpp-assignment4
I've added a vector and added all the essential information for the employee
#include <iostream>
#include <conio.h>
#include <string>
#include <vector>

using namespace std;

struct Employee
{
    int id;
    string firstName;
    string lastName;
    float payRate;
    int hours;

};

int main()
{
    /*========= other way of adding employee information ==========*/

    /*const int NUM_EMPLOYEE = 5;
    Employee employee[NUM_EMPLOYEE];

    for (int i = 0; i < 5; i++)
    {
        cout << "ID of employee " << (i + 1) << ": ";
        cin >> employee[i].id;

        cout << "First Name of employee " << (i + 1) << ": ";
        cin >> employee[i].firstName;

        cout << "Last Name of employee " << (i + 1) << ": ";
        cin >> employee[i].lastName;

        cout << "Pay rate for employee " << (i + 1) << ": ";
        cin >> employee[i].payRate;

        cout << "Hours worked " << (i + 1) << ": ";
        cin >> employee[i].hours;
    }*/

    /*========= End of other way of adding employee information ==========*/

    vector<Employee> employees;

    char Another = 'y';

    while (Another == 'y' || Another == 'Y')
    {
        Employee e;
        cout << "Enter employee ID: \n";
        cin >> e.id;
        cout << "Enter employee first name: \n";
        cin >> e.firstName;
        cout << "Enter employee last name: \n";
        cin >> e.lastName;
        cout << "Enter employee pay rate: \n";
        cin >> e.payRate;
        cout << "Enter employee hours worked: \n";
        cin >> e.hours;
        employees.push_back(e);

        cout << "Another? (y/n): \n";
        cin >> Another;

    }

    float sum = 0;

    vector<Employee>::iterator it = employees.begin();

    for (; it != employees.end(); it++)
    {
        cout << "ID of employee:  \n" << it->id << ": \n"
            << "Employees name: \n" << it->firstName << " " << it->lastName << ": \n"
            << "Employee pay rate: \n" << it->payRate << ": \n"
            << "Employee hours worked: \n" << it->hours << "\n";
    }

    float avg = sum / employees.size();

    Employee e;

    /*cout << " ID of employees: \n" << e.id;
    cout << " Name of employees: \n" << e.firstName << " " <<
 e.lastName;*/
    cout << "Gross pay of employees: \n" << avg;

    _getch();
    return 0;

}

Show Id, names, and gross pay of all employees to user

A:     vector<Employee> employees;

    char Another = 'y';

    while (Another == 'y' || Another == 'Y')
    {
        Employee e;
        cout << "Enter employee ID: \n";
        cin >> e.id;
        cout << "Enter employee first name: \n";
        cin >> e.firstName;
        cout << "Enter employee last name: \n";
        cin >> e.lastName;
        cout << "Enter employee pay rate: \n";
        cin >> e.payRate;
        cout << "Enter employee hours worked: \n";
        cin >> e.hours;
        employees.push_back(e);

        cout << "Another? (y/n): \n";
        cin >> Another;

    }

    float sum = 0;

    vector<Employee>::iterator it = employees.begin();

    cout << "ID" << "\t" << "First Name" << "\t" << "Last Name" << "\t" << "Pay rate" << "\t" << "Hours" << "\t" << "Gross Pay" << "\n" ;

    for (; it != employees.end(); it++)
    {
        float grossPay = it->payRate * it->hours;
        cout << it->id << "\t" << it->firstName << "\t\t" << it->lastName << "\t\t" << it->payRate << "\t\t"
            << it->hours << "$" << "\t" << grossPay << "\n";
        sum += grossPay;
    }

    cout << "The gross pay for all employee is: " << "$" << sum;

    _getch();
    return 0;

}

//This is what i got so far. But if I want to make the application ask the user to input how many employee they want to enter into the database how do i do that? would it be like this?

int EMPLOYEE_NUM[][]    // ??


text:
Q: UmbracoLog table In a load balanced server setup, our UmbracoLog table is receiving on the order of 50 records a second being written that all follow the same pattern (apologies for formatting)
**id    userId  NodeId  Datestamp   logHeader   logComment

1122069437  0   -1  41302.1891  System  Submitting calls to distributed servers

1122069438  0   -1  41302.1891  Custom  http://www.url.com/umbraco/webservices/cacheRefresher.asmx

1122069439  0   -1  41302.1891  System  Submitting calls to distributed servers

1122069440  0   -1  41302.1891  System  Distributed server push completed with no nodes reporting an error

1122069441  0   -1  41302.1891  System  Distributed server push completed with no nodes reporting an error

1122069442  0   -1  41302.1891  Custom  http://www.url.com/umbraco/webservices/cacheRefresher.asmx**

Over a 24 hour period, this results in a 6.9GB table and a database that's persistently running hot in terms of CPU and mem usage.
We've checked the web.config and umbraco.config settings files of other similar site setups, and there's no differences in terms of configuration.
We can disable the system level logging but we would lose other meaningful messages.
Can anyone help with isolating this issue?
TL;DR Umbraco,Log table being hammered with multiple calls every millisecond.

A: I'd suggest you have two options and you take both of them.
Report the issue on the issue tracker (issues.umbraco.org) so the guys can look into if it is something out of the ordinary.
Then to stop it you could do a custom build with the log messages commented out. See this file for the offending code: https://bitbucket.org/slace/umbraco/src/e9e2f67c6cae/umbraco/presentation/umbraco/cache/dispatcher.cs
Not ideal but could get you up and running and lighten the load on the DB server until you get a fix.
A bigger question is why that code would be running so often, might be worth a dig around in the code to see if you can see why. If you do find out do report it back to Umbraco HQ so they can fix it for other ;)

A: We have identified the issue. It came down to expired documents and how umbraco 4.5.2 handles them.
After disassembling the dll, we found the culprit in CheckPublishing method in the publishingService class (umbraco.presentation):
foreach (Document d in Document.GetDocumentsForExpiration())
{
   library.UnPublishSingleNode(d.Id);
}

And the GetDocumentsForExpiration() runs the following query:
IRecordsReader dr = CMSNode.SqlHelper.ExecuteReader("select distinct nodeId from cmsDocument where newest = 1 and not expireDate is null and expireDate <= @today", new IParameter[] { CMSNode.SqlHelper.CreateParameter("@today", DateTime.Now) });

So, umbraco runs this publishing service to check and unpublish the expired documents without actually updating the expiry date, which is used to fetch the documents that need to be expired/unpublished. Hence the documents are never expired (though they are unpublished).
Call(s) to distributed servers happen each time there is a change in the documents (publish, unpublish, save etc). Because of the publishingService and the code outlined above, these expired documents were unpublished each time the service run, resulting in many distributed calls (and database records being written).
The solution is to either clear out the expiry dates on these documents (manually or via SQL agent jobs) or to fix the Umbraco source code.
This bug was fixed in later versions of Umbraco (not sure which version it was fixed in, but I checked 4.11.3 and it has the fixed code).


text:
Q: displaying suggestion toolbar above ios keyboard I am a newbie in iOS development. I am trying to create a spell suggestion type application in ios 5.1 having a textView such that if user taps on a key of the keyboard a suggestion toolbar come at the top of the keyboard containing all the suggestions and if user taps onto one of those suggestions it will be displayed on the textView .
Like the one shown in figure.

I have handled the keyboard press event and handled all processing over there. Now what i want to do is that i have a NSArray of suggestions and I want to create a suggestion toolbar and assign all those suggestion from NSArray to  that toolbar and also if user taps on any of those suggestion it should be placed on the textView.
I am unable to understand how should i proceed with that and which component should i use to create that toobar above the keyboard.
using IOS SDK 5.1 and xcode 4.3

A: You can make a view stick to the top of the keyboard by making it the inputAccessoryView for whichever text editing controls (UITextField, UITextView, etc) you want it to appear with. See the UITextInputTraits protocol docs for details.
If you're not sure where to start on making a view showing words which can be tapped, you might want to look at the View Programming Guide or a good intro-to-iOS-programming book.

A: You can use accessory view of keyboard to achieve this, check out this developer same code- http://developer.apple.com/library/ios/#samplecode/KeyboardAccessory/Introduction/Intro.html


text:
Q: Java Simple RMI Chat Application I am trying to make a very simple chat program using RMI (no GUI's) but i am struggling for ideas.
How do i register clients when they connect to the server?
When i use

RemoteServer.getClientHost()

all this does is show the ip address (and they are the same for all clients that connect from the same computer (from multiple command windows).
What i am trying to implement is this: when a client logs on he is shown a switch-case menu and ift they press

*

*they get a list of connected clients.

*sendMessage(client, String)

But i do not know how to identify individual clients?
And when i do, how do i show a string only on that client's window ?
Thanks,
Research:
(i have looked at ideas on the web but a lot of them are more advanced than i want.
This is a simple application and i do not want to complicate it / copy code i dont understand).
There are previous questions on SO but with 0/1 answers (not very popular topic!) or not helpful!

A: Looks like i found what i was looking for:
RMI Callback
Basically making every client a server, so the server can respond as well as receive messages.
I have been directed to a resource that might help:
Java Network Programming and Distributed Computing by David Reilly & Michael Reilly


text:
Q: Skip rows in an unsorted list I have an Angular app which displays a list and a Scala API which provides data. I encountered a problem (and the languages don't matter, is just about logic).
The problem is that the table from which I get data doesn't have a primary key. Because I need to display the data plain in a widget (of type table) without sorts, just like in the database, I just do "SELECT * FROM table LIMIT 30".
The problem is when I want to change the page, my query became SELECT * FROM table OFFSET 30 LIMIT 30

ERROR: OFFSET can not be used without an ORDER BY option.

How can be solved this problem?

A: As the error says, you have to have an order by clause in order to use the offset clause. If you don't have any meaningful way of sorting the table, you could just pick some arbitrary value, like the first column:
SELECT * FROM sometable ORDER BY column1 OFFSET 30 LIMIT 30


text:
Q: Native SQL , generic duplicate entries retrieval I have a table T with fields f1 , f2 and f3.
I would like to retrieve every f1 which belongs to the row with duplicate f2 and f3 fields. How can this be done ?
Edit :
Such as for :
(1,2,3)
(2,2,3)
(4,1,1)
(2,2,2)
(3,4,3)
(1,5,6)

Expected result being :
(1)
(2)

A: try this
select f1 from T group by (f1) having (count(f2) > 1 and count(f3) > 1)

A: This will bring back every f1 value that is on a row where the f2 and f3 values appear on multiple rows.
select T.f1 from T
inner join (select f2,f3 from T group by f2,f3 having count(*) > 1) dups
on t.f2 = dups.f2 and t.f3 = dups.f3;

So if you have the data.
f1 f2 f3
-- -- --
1  A  b
2  A  c
3  A  b
4  B  b

You'd get back 1 & 3.


text:
Q: SSIS - Custom message into logs I am in process of researching the best way to track all the queries which run within an SSIS package. The plan is to create an automatised report which could pull from SQL server that shows the queries the SSIS package runs and where it loads the data. I was wondering is it possible to customised a log message. My plan would be to insert a log after the task has run and say the logic which ran.
An example would be if I had a Execute SQL task I could write a custom message that would say the logic which just ran. I have been trying a various of other solutions but couldn't really see much which would help me create a directory of the info of all SSIS packages.


text:
Q: Javascript for loop stops if statement I'm programming a formgenerator with javascript and php.. I've a little problem with Javascript
The code stops in at line 43. After he finished the for loop, why does he quit the if statement, too?
script.js
function addrow(){
var table = document.getElementById('table_actions')
var row   = table.insertRow(-1);
addcell(table, row);
}

function addcell(table, row){

// ------Config file -----

var object = new Array();
object[0] = "Text";
object[1] = "Password";
object[2] = "Checkbox";
object[3] = "Radio";
object[4] = "Label";
object[5] = "Textarea";

// --------End Config file -----

for (var i = 0; i < 4; i++) {
    console.log(i);
    var cell = row.insertCell(i);
    if (i == 0){
        var input = document.createElement('input');
        input.setAttribute('type', 'text');
        input.setAttribute('name', 'beschriftung');
        cell.appendChild(input);
    } else if (i == 1) {
        var input = document.createElement('input');
        input.setAttribute('type', 'text');
        input.setAttribute('name', 'name');
        cell.appendChild(input);
    } else if (i == 2) {
        var dropdown = document.createElement('select');
        for (var i = 0; i < object.length; i++) {
            var option  = document.createElement('option');
            option.text = object[i];
            option.value   = object[i];
            dropdown.options.add(option);
            cell.appendChild(dropdown);
        }
        continue;
    } else if (i == 3) {
        var checkbox = document.createElement('input');
        checkbox.setAttribute('type', 'checkbox');
        checkbox.setAttribute('name', 'pflicht');
        cell.appendChild(checkbox);
    } else {
        cell.setAttribute('name', i);
    }
}
}

html
        <form action="site.php" method="post">

                    Beschriftung	Name	Objekt	Pflichtfeld

+

            <input type="submit" value="Erstellen!" class="action-btn">

    </form>

Please take a look here
Why does javascript quit the if statement after the for loop at line 43??

A: You are using the same variable i inside the if statement loop thus at end it is object.length.
for (var i = 0; i < 4; i++) {
    if (i == 0) {
        ...
    } else if (i == 2) {
        for (var i = 0; i < object.length; i++) {
           ...
        }
        // Now i === object.length
    } ...
}

Had to look around a bit, but this answer gives you some detail that can be of use:

*

*Javascript - scope of nested for loop index

A: the inner loop corrupt, the i counter used for main loop:
} else if (i == 2) {
var dropdown = document.createElement('select');

    // this :
    //for (var i = 0; i < object.length; i++) {

    // its needs to be changed to `j` for example, like:
    for (var j = 0; j < object.length; j++) {

    var option  = document.createElement('option');
    option.text = object[j];     // also i references needs to be changed to j
    option.value   = object[j];  // also i references needs to be changed to j
    dropdown.options.add(option);
    cell.appendChild(dropdown);
    }
    continue;


text:
Q: Error when passing values to other view in eclipse e4 I am using IEventBroker to send the events to other view synchronously
@Inject
private IEventBroker eventBroker;

The sender part has the following code:
Map<String,List<TreeMap<Timestamp, Long>>> StatisticValue = new HashMap<String,List<TreeMap<Timestamp, Long>>>();
//some code to add values in statisticValue
eventBroker.send("value", StatisticValue);

The receiver side has the following code snippet.
@Inject
@Optional
public void getEvent(@UIEventTopic("value")HashMap<String,List<TreeMap<Timestamp, Long>>> entriesForTs)
{
System.out.println("size"+entriesForTs.size());
}

I am getting the following error in the receiving end:
 Exception while dispatching event org.osgi.service.event.Event [topic=value] to handler org.eclipse.e4.ui.internal.di.UIEventObjectSupplier$UIEventHandler@6d79dea2
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
    at org.eclipse.e4.ui.internal.di.UIEventObjectSupplier$UIEventHandler$1.run(UIEventObjectSupplier.java:49)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:4688)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:205)
    at org.eclipse.e4.ui.internal.di.UIEventObjectSupplier$UIEventHandler.handleEvent(UIEventObjectSupplier.java:47)
    at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
    at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
    at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
    at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
    at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
    at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
    at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:80)
    at com.xyz.abc.project.parts.StatisticsPart.processFiles(StatisticsPart.java:270)
    at com.xyz.abc.project.parts.StatisticsPart$5.selectionChanged(StatisticsPart.java:205)
    at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:164)
    at org.eclipse.jface.util.SafeRunnable$1.run(SafeRunnable.java:128)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
    at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:162)
    at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2188)
    at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1211)
    at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1241)
    at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:239)
    at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:233)
    at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:403)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:162)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.NullPointerException
    at com.xyz.abc.project.parts.showGraph.getEvent(showGraph.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
    ... 48 more

I am confused why am I getting this error. I have checked the size(size = 2) of the StatisticValue in the sender side. But it is showing some nullpointer exception. Can anyone please help me?

A: The exception is reporting a NullPointerException in your getEvent method because the entriesForTs is null.
The @UIEventTopic handling code seems to call the event handler once with a null value the first time it is used (and then calls it again with the correct value). So just check for null in your getEvent.
Update:
You could try using org.osgi.service.event.Event as the type of the getEvent argument in case there is some problem with resolving the argument type:
public void getEvent(@UIEventTopic("value") Event event)
{
  data = event.getProperty(IEventBroker.DATA);

You could also try IEventBroker.subscribe if the @UIEventTopic refuses to work.
Update 2:
The event broker send (and post) methods treat Map specially and assumes it is a map containing the values you want to send. So it will be looking in the Map for an IEventBroker.DATA key. It would be best to wrap your map in a container class.


text:
Q: C/C++ obfuscator for making .EXEs not flagged as malware I've some benign tools that my anti-virus flags as malware.
In particular, I download the prebuild .EXE files, instead of building the C/C++ source code myself (GitHub).
I hope that if I build the obfuscated source code locally, that the programs won't get flagged by anti-virus, since the AV probably relies on signature detection.
What are the best approaches of obfuscating C/C++ code, so that (hopefully) different binaries will be created by the Visual Studio C/C++ compiler?


text:
Q: Checkbox issue on ios safari Issue Image
I am facing this issue only for ios safari. this checkbox working ok for other platforms.
I cant inspect to apply the styling.
On web safari its working fine as well.

A: I ran into a similar issue with a button. This line of code fixed it for me.
-webkit-appearance: none;


text:
Q: How to properly run a extension test using JUnit's Test Engine? I have written a JUnit Extension which generates some reports after a test is executed.
I wanted to make a test case that ensures the extension works as expected and found this SO:
How to test JUnit Jupiter (JUnit 5) Extensions
Following the guides I managed to get to a point where my test is working, but is "flaky", because ExampleExtensionTest is executed twice - once as part of the main junit execution (gradle test) and once as part of the extensionShouldGenerateReport() test case.
As per JUnit's docs I could just change static class ExampleExtensionTest into class ExampleExtensionTest and JUnit won't pick it up. The problem then is that it's not picked up inside extensionShouldGenerateReport() as well!
It looks like I'm missing something, but I can't seem to figure it out.
Here's my test case:
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor;
import org.junit.platform.testkit.engine.EngineExecutionResults;
import org.junit.platform.testkit.engine.EngineTestKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.file.Path;

import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass;

public class ExtensionTest
{

    private final Logger logger = LoggerFactory.getLogger(ExtensionTest.class);

    @Test
    public void extensionShouldGenerateReport() throws IOException
    {

        Path reportPath = Path.of("build/tmp/example-recorded-test");
        logger.info("Configured report path: {}", reportPath);

        EngineTestKit.engine(JupiterEngineDescriptor.ENGINE_ID)
                     .selectors(selectClass(ExtensionTest.ExampleExtensionTest.class))
                     .execute()
                     .containerEvents()
                     .assertStatistics(stats -> stats.started(1).succeeded(1));

        // Assert all files were generated.
        assertThat(reportPath.toFile().exists()).isTrue();
        assertThat(reportPath.resolve("index.html").toFile().exists()).isTrue();
        assertThat(reportPath.resolve("metadata.json").toFile().exists()).isTrue();

    }

    @ExtendWith(MyExtension.class)
    static class ExampleExtensionTest
    {
        @MyAnnotation(reportPath = "build/tmp/example-recorded-test")
        public void test()
        {
            return; // noop.
        }
    }

}

A: After hours wasted on this problem, I found a way to fix this issue.
The easiest and most non-intrusive way is to use the @EnabledIfSystemProperty(name = "some-property") annotation over the ExampleExtensionTest.
Here's the code:
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor;
import org.junit.platform.testkit.engine.EngineExecutionResults;
import org.junit.platform.testkit.engine.EngineTestKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.file.Path;

import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass;

public class ExtensionTest
{

    private final Logger logger = LoggerFactory.getLogger(ExtensionTest.class);

    @BeforeAll
    public static void beforeAll()
    {
        System.setProperty("my-property", "true");
    }

    @AfterAll
    public static void afterAll()
    {
        System.clearProperty("my-property");
    }

    @Test
    public void extensionShouldGenerateReport() throws IOException
    {

        Path reportPath = Path.of("build/tmp/example-recorded-test");
        logger.info("Configured report path: {}", reportPath);

        EngineTestKit.engine(JupiterEngineDescriptor.ENGINE_ID)
                     .selectors(selectClass(ExtensionTest.ExampleExtensionTest.class))
                     .execute()
                     .containerEvents()
                     .assertStatistics(stats -> stats.started(1).succeeded(1));

        // Assert all files were generated.
        assertThat(reportPath.toFile().exists()).isTrue();
        assertThat(reportPath.resolve("index.html").toFile().exists()).isTrue();
        assertThat(reportPath.resolve("metadata.json").toFile().exists()).isTrue();

    }

    @ExtendWith(MyExtension.class)
    @EnabledIfSystemProperty(named = "my-property", matches = "true")
    static class ExampleExtensionTest
    {
        @MyAnnotation(reportPath = "build/tmp/example-recorded-test")
        public void test()
        {
            return; // noop.
        }
    }

}

This will cause the test to be excluded from the global run, but still work when it's programatically called via the EngineTestKit.


text:
Q: Localize watchkit companion app display name I am having some issues localizing app display name on apple watch companion app. Following the guide lines i have localize the CFBundleName as follow:
CFBundleDisplayName = "My app";
CFBundleName = "Myapp";
I did it for every different language supported by my app, but in apple watch companion app it is always shown the english CFBundleDisplayName.
Any idea on how properly localize apple watch companion app name?
thank you very much for helping

A: I believe that is a bug of the iOS9.
The reason is clear, There is no apps on AppStore that provides localized companion App Title.


text:
Q: PHP - Move content to the bottom of list when checked the checkbox I want to make a multiple User Agreement, that user must check the checkbox one by one. When a user checked content number 1, then content number 2 will move to the top of the list, and content number 1 will be dropped from the list.
So, the problem is, when user check the checkbox, the content is not moving.
Can someone help me to make moving content when checkbox is checked.
here's my script :

<form id="form" name="form" method='POST'>

If this checkbox is checked, then the next checkbox should be appeared in top of list and the checked one is in bottom of list or dissapear.

I Agree *)<input name="amanat1" type="checkbox" class="required agreement" onchange="showAmanat1()"/>

dummy for 2
I Agree*)<input name='amanat2' type='checkbox' class='required agreement' onchange='showAmanat2()' disabled="disabled"/>

dummy for 3
I Agree *)<input name='amanat3' type='checkbox' class='required agreement' onchange='showAmanat3()'disabled="disabled"/>

dummy for 4
I Agree *)<input name='amanat4' type='checkbox' class='required agreement' onchange='showAmanat4()' disabled="disabled"/>

dummy for 5
I Agree *)<input name='amanat5' type='checkbox' class='required agreement' onchange='showAmanat5()' disabled="disabled"/>

dummy for 6
I Agree *)<input name='amanat6' type='checkbox' class='required agreement' onchange='showAmanat6()' disabled="disabled"/>

dummy for 7
I Agree*)<input name='amanat7' type='checkbox' class='required agreement' onchange='showAmanat7()' disabled="disabled"/>

dummy for 8
I Agree *)<input name='amanat8' type='checkbox' class='required agreement' onchange='showAmanat8()' disabled="disabled"/>

dummy for 9
I Agree*)<input name='amanat9' type='checkbox' class='required agreement' onchange='showAmanat9()' disabled="disabled"/>

dummy for 10
I Agree *)<input name='amanat10' type='checkbox' class='required agreement' onchange='showAmanat10()' disabled="disabled"/>

dummy for 11
I Agree *)<input name='amanat11' type='checkbox' class='required agreement' onchange='showAmanat11()' disabled="disabled"/>

dummy for 12
I Agree*)<input name='amanat12' type='checkbox' class='required agreement' onchange='showAmanat12()' disabled="disabled"/>

dummy for 13
I Agree *)<input name='amanat13' type='checkbox' class='required agreement' onchange='showPernyataan()' disabled="disabled"/>

</form>

and heres my fiddle
https://jsfiddle.net/a6ea9yhL/5/

A:
Hiding the element is easy

I would suggest you to put each point in a span and give that span an id like below:

dummy for 2

    I Agree*)
    <input name='amanat2' type='checkbox' class='required agreement' onchange='showAmanat2()' disabled="disabled"/>

Then in if block of your functions add
document.getElementById('amanat2').style.display = 'none'; // chnage the id

A: Your code's strategy has to be changed, rather than fixed!
Why don't you reorder the list each time the user check an item, for example, initiate all the checkboxs as list elements, with a specific class: "vergin", and on each click, reorder the list according to the function: .prepend()
Follow the link for more details:
jQuery reorder list items based on class

A: Try this script. This script will move clicked list to the bottom of the list

1

2

3

4

5

6

7

$("li").click(function(){
  $(this).appendTo('ul');
});

Hope this will help you.

A: Looks like this is what you want

function clickCheckBox(elem){
  document.getElementById('agreement').appendChild(elem);
}

Agreement * <input type="checkbox" class="checkbox-item" />

Agreement * <input type="checkbox" class="checkbox-item" />

Agreement * <input type="checkbox" class="checkbox-item" />

Agreement * <input type="checkbox" class="checkbox-item" />

Agreement * <input type="checkbox" class="checkbox-item" />

Agreement * <input type="checkbox" class="checkbox-item" />


text:
Q: How to debug coffeescript on the server with node I've got below code that is run with Coffeescript, NodeJS PhantomJS and SpookyJS
try
  Spooky = require 'spooky'
  mysql = require 'mysql'
catch e
  console.log e
  Spooky = require 'node_modules/spooky/lib/spooky'

spooky = new Spooky(
  casper: ->
    logLevel: 'debug',
    verbose: true

  (err) ->
    if (err)
      e = new Error('Failed to initialize SpookyJS')
      e.details = err
      throw e

    spooky.on 'error', (e) ->
      console.error e

    spooky.on 'log', (log) ->
      if (log.space == 'remote')
        console.log log.message

    spooky.on 'console', (line) ->
      console.log line

    spooky.start 'http://www.website.com/'

    spooky.thenEvaluate ->
      console.log 'Hello, from', document.title;

    spooky.run;
)

In the console when I run with coffee command, it comes up with [info] [phantom] Starting... and hangs there.
Is there a way to debug this to find out what is going on or are there something wrong with the syntax itself?

A: You can run coffee --compile file.coffee to attempt to compile a CoffeeScript file into JavaScript. If it compiles properly, then there are no CoffeeScript syntax errors, and you have the compiled JavaScript version that you can use to debug.


text:
Q: Silverlight 4 chart created at runtime won't show data Using the Silverlight 4 toolkit chart control, I am trying to create a chart 100% at runtime with no evidence of it anywhere in the XAML. To do so, I create the blank chart when the page loads:
        Chart TrendChart = new Chart();
        TrendChart.Name = "TrendChart";
        TrendChart.Title = "Call History";
        TrendChart.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;
        TrendChart.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
        TrendChart.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
        TrendChart.VerticalContentAlignment = System.Windows.VerticalAlignment.Stretch;

        GridPanel.Children.Add(TrendChart);

After the user clicks on a button to retrieve data, a List is created of this custom class:
    private class PhoneTrendDataPoint
    {
        public string XValue { get; set; }
        public double YValue { get; set; }
    }

I use that List, called CurrentCallTrends, as an ItemsSource for my chart.
        // Update the chart with the received data
        Chart TrendChart = (Chart)this.FindName("TrendChart");

        // Wipe out previous chart data
        TrendChart.Series.Clear();

        // set the data
        ColumnSeries columnSeries = new ColumnSeries();
        columnSeries.Name = "Current Call Volume";
        columnSeries.ItemsSource = CurrentCallTrends;
        //columnSeries.SetBinding(ColumnSeries.ItemsSourceProperty, new Binding("CurrentCallTrends"));
        columnSeries.DependentValueBinding = new Binding("XValue");
        columnSeries.IndependentValueBinding = new Binding("YValue");
        TrendChart.Series.Add(columnSeries);

The problem is that I get a runtime error where it prompts me to open a debugger regarding an object reference not set to an instance of an object. If I comment the line to .SetBinding then the ItemsSource vanishes and no data shows up, but at least there is no runtime error.
What am I missing?

A: After additional Googling, I made some modifications that seem to work but don't strike me as the best way to go about doing this. Data now shows up, but I will not accept this as the answer unless there is no better method:
        // Update the chart with the received data
        Chart TrendChart = (Chart)this.FindName("TrendChart");

        // Wipe out previous chart data
        TrendChart.Series.Clear();

        // test data
        KeyValuePair<string, double>[] CurrentCallData = new KeyValuePair<string, double>[CurrentCallTrends.Count];
        for (int i = 0; i < CurrentCallTrends.Count; i++)
        {
            CurrentCallData[i] = new KeyValuePair<string, double>(CurrentCallTrends[i].XValue, CurrentCallTrends[i].YValue);
        }

        // set the data
        ColumnSeries columnSeries = new ColumnSeries();
        columnSeries.Name = "CurrentCallVolume";
        columnSeries.Title = "Current Call Volume";
        columnSeries.SetBinding(ColumnSeries.ItemsSourceProperty, new Binding());
        //columnSeries.ItemsSource = CurrentCallTrends;
        columnSeries.ItemsSource = CurrentCallData;
        columnSeries.DependentValueBinding = new Binding("Value");
        columnSeries.IndependentValueBinding = new Binding("Key");
        TrendChart.Series.Add(columnSeries);

        //this.DataContext = CurrentCallTrends;


text:
Q: Mark location of all companies on map I want to mark the location(longitude and latitude) of all companies listed as posts in wordpress on a map just like http://finntakst.no/ have done it.
I have been trying it since 5 hours

A: You can use plugin to achieve it
Try intergeo map plugin, here is a link to download it https://wordpress.org/plugins/intergeo-maps/
Simply activate the plugin and you can do it easily


text:
Q: Fibrant objects in Bousfield localization of homotopy pullback closure of Nisnevich hypercovers Let $M$ be a model topos and $S$ a set of morphisms, there exists a set of morphism $\bar{S}$ which is generated by the $S$-local equivalences which is closed under homotopy pullbacks in $M$. Suppose that $M$ is left proper combinatorial, then the Bousfield localisation $M_{\bar{S}}$ is a model topos [Prop.6.2.1.2, HTT, Lurie].
Let $sPre(C)$ be the category of simplicial presheaves of an essentially small category $C$, the fibrant objects of the Bousfield localisation with respect to the set of all hypercovers $S$ are precisely the $S$-local objects, that is, the presheaves of Kan complexes satisfying descent for all hypercovers. Under suitable condition, this localisation is equivalent to the localisation of the set of all bounded hypercovers. And a presheaf satisfies descent for all bounded hypercover is equivalent to that it satisfies Čech descent. Thus the fibrancy condition can be reformulated for Čech descent which is a relatively concrete condition.
In the case of Nisnevich descent, where $C$ is a site whose topology is defined by a complete bounded regular cd structure, the fibrancy condition can be stated for the distinguished square, that is, a simplicial presheaf $F$ is fibrant if and only if $F$ takes values in Kan complexes and it takes every elementary ditinguished square to a homotopy pullback.
Let $\alpha$ be  a Nisnevich distinguished square,
$\require{AMScd}$
\begin{CD}
W @>>> Y \\
@VVV @VpVV\\
U @>i>> X
\end{CD}
and let $P(\alpha)\to X$ be the morphism from the pushout of the upper part $U\leftarrow W \rightarrow Y$ to $X$.
Question:
Consider the set of morphism $Nis=\{P(\alpha)\to X\}_{\alpha}$ and the localisation $sPre(C)_{\overline{Nis}}$ of $\overline{Nis}$, are the fibrant objects of $sPre(C)_{\overline{Nis}}$ the same as $sPre(C)_{{Nis}}$?
Further question after edit: Consider the category $sPre(C)_{\mathbb{A}_1,\overline{Nis}}$ which has a different model category structure than the motivic homotopy category $sPre(C)_{\mathbb{A}_1,{Nis}}$, are the fibrant objects  in $sPre(C)_{\mathbb{A}_1,\overline{Nis}}$ the same as that for $sPre(C)_{\mathbb{A}_1,{Nis}}$?
I slightly modified the question as now the question is not generally about hypercover as I thought. What I'm looking for are the fibrant objects in the model topos $sPre(C)_{\mathbb{A}_1,\overline{Nis}}$. In the comments below, Pavlov mentioned the paper by Strunk and Raptis,

Let $\mathcal{C}$ be a small simplicial category. Then there is a bijective correspondence between Grothendieck topology $\bar{\tau}$ on $Ho(\mathcal{C})$ and homotopy left exact left Bousfield localization of $sPSh^{\Delta}(\mathcal{C})$ which are $t$-complete.

where a $\mathcal{U}$-local model topos $sPSh^{\Delta}(Sm_S)_{\mathcal{U}Nis}$ is given together with its Grothendieck topology arising from Nisnevich topology on the ordinary category $Sm_S$. $sPSh^{\Delta}(\mathcal{C})$ denotes the functor category of simplicial functors $\mathcal{C}^{op}\to \mathcal{sSet}$ for a small simplicial category $\mathcal{C}$. A Grothendieck topology for a simplicial category $\mathcal{C}$ is by definition a Grothendieck topology on $Ho(\mathcal{C})$.
Given a Grothendieck topology above, the model structure of the localization can be described by hypercovers of this topology.
By this theorem, there should be a Grothendieck topology for $Ho(Sm_k)$ that gives the localisation $(sPSh^{\Delta}(Sm_S)_{\mathcal{U}Nis})_{\overline{\mathcal{H}(Nis)}}\cong sPsh(Sm_k)_{\mathcal{A_1},\overline{Nis}}$ of $sPsh^{\Delta}(Sm_k)$. The Grothendieck topology of the $\mathcal{U}$-local model topos $sPSh^{\Delta}(Sm_S)_{\mathcal{U}Nis}$ arises from the Nisnevich topology of $Sm_k$ as ordinary category. So this topology isn't the one that gives the final localization.
How can one determine this Grothendieck topology hence find the fibrant objects of $sPre(C)_{\mathbb{A}_1,\overline{Nis}}$?

A:
are the fibrant objects of sPre(C)_Nis the same as sPre(C)_Nis?

Yes.  This follows from the characterization of fibrant objects
in a left Bousfield localization as fibrant objects in the original
model structure that are also local.
The closure of S under homotopy base changes does not change the class of local objects: S is contained in S-local weak equivalences and
the class of S-local weak equivalences of simplicial presheaves in any model topos
(such as sPre(C)_Nis) is closed under homotopy base changes (computed in simplicial presheaves before localization) because the localization (sheafification) functor
sPre(C)→sPre(C)_Nis is right exact, i.e., preserves finite homotopy limits.
Since S-local weak equivalences are the same, the S-local objects are also the same.


text:
Q: Calculate $\lim\limits_{x\to 4}\frac{2x\sqrt{x}+x-8\sqrt{x}-4}{x+\sqrt{x}-6}$ by just factoring Calculate $$\lim_{x\to 4}\dfrac{2x\sqrt{x}+x-8\sqrt{x}-4}{x+\sqrt{x}-6}$$ by just factoring
Factoring $2x\sqrt{x}+x-8\sqrt{x}-4$ gives us $(x-4)(2\sqrt{x}+1)$
$\color{red}{2x\sqrt{x}+x-8\sqrt{x}-4=x(2\sqrt{x}+1)-4(2\sqrt{x}+1)=(x-4)(2\sqrt{x}+1)}$
Factoring $x+\sqrt{x}-6$ gives us $(\sqrt{x}+3)(\sqrt{x}-2)$
Let $y=\sqrt{x}$, then $\color{blue}{y^2+y-6=(y+3)(y-2)=(\sqrt{x}+3)(\sqrt{x}-2)}$
So our limit becomes:
$$\lim_{x\to 4}\dfrac{(x-4)(2\sqrt{x}+1)}{(\sqrt{x}+3)(\sqrt{x}-2)}$$
but still this is indeterminate form, and so how would I further factor this, if posssible?

A: Let $x=t^2$
If
$$x=4 $$
Then
$$t=2$$
We have to find
$$\lim_{t\to 2} \frac{2t^3+t^2-8t-4}{t^2+t-6} $$

$$\lim_{t\to 2} \frac{\color{blue}{(t-2)}(t+2)(2t+1)}{\color{blue}{(t-2)}(t+3)} $$

I think you can handle further.
$\color{red}{OR}$
In your equation factories as follows

$$(x-4)=(\sqrt x +2)\color{blue}{(\sqrt x-2)}$$


text:
Q: Multilanguage Database: which method is better? I have a Website in 3 languages.
Which is the best way to structure the DB?
1) Create 3 table, one for every language (e.g. Product_en, Product_es, Product_de) and retrieve data from the table with an identifier:
e.g. on the php page I have a string:
$language = 'en'

so I get the data only
SELECT FROM Product_$language

2) Create 1 table with:
ID  LANGUAGE   NAME    DESCR

and post on the page only
WHERE LANGUAGE = '$language'

3) Create 1 table with:
ID  NAME_EN   DESCR_EN   NAME_ES   DESCR_ES   NAME_DE   DESCR_DE

Thank you!

A: I'd rather go for the second option.
The first option for me seems not flexible enough for searching of records. What if you need to search for two languages? The best way you can do on that is to UNION the result of two SELECT statement. The third one seems to have data redundancy. It feels like you need to have a language on every names.
The second one very flexible and handy. You can do whatever operations you want without adding some special methods unless you want to pivot the records.

A: I would opt for option one or two.  Which one really depends on your application and how you plan to access your data. When I have done similar localization in the past, I have used the single table approach.
My preference to this approach is that you don't need to change the DB schema at all should you add additional localizations.  You also should not need to change your related code in this case either, as language identifier just becomes another value that is used in the query.

A: That way you would be killing the database in no-time.
Just do a table like:
TABLE languages with fields:

-- product name
-- product description
-- two-letter language code

This will allow you, not only to have a better structured database, but you could even have products that only have one translation. If you want you can even want to show the default language if no other is specified. That you'll do programmatically of course, but I think you get the idea.


text:
Q: Proving convergence in probability. Let $Y_k$ be independently Bernoulli distributed rvs holding $P(Y_k = 1) = \frac{1}{k}$ for every $k = 1,2,...,n$. I need to prove that the sum $\frac{1}{\log n} \sum_{k=1}^n Y_k$ converges in probability to $1$. How can I also check if it converges or not almost surely?
Well, I tried to use some well known inequalities but they don't work. Also Kolmogorov's theorem is of no use here.

A: As you've mentioned in your comment convergence in probability is not interesting anymore. So, first we show that the series is indeed convergent in $\mathbf{R}$ a.s.

Denote $\tilde{Y}_k := \frac{Y_k}{\log n}$. To use Kolmogorov's two-series theorem we need to show that the series of expected values and variances converge in $\mathbf{R}$.
For the mean we have
$$
\sum_{k=1}^n \mathbb{E}\tilde{Y}_k = \frac 1 {\log n} \left(1 + \frac 1 2 + \dots + \frac 1 n\right) \le C_n,
$$
with $C_n \to 1$ as $n \to \infty$.
To see the latter inequality, note that $1 + \frac 1 2 + \dots + \frac 1 n$ is a harmonic series, which is known to have a pretty good approximation of $\log [n] + \gamma$, where $\gamma$ is Euler's constant. This approximation gets arbitrary small when $n$ gets larger. Hence, we have
$$
\frac 1 {\log n} \left(1 + \frac 1 2 + \dots + \frac 1 n\right) \approx \frac{\log n + \gamma}{\log n} = 1 + \frac{\gamma}{\log n},
$$
so taking $C_n = c\left( 1 + \frac{\gamma}{\log n}\right)$ with some absolute constant $c$ large enough ensures the inequality for the sum of expected value. Hence, $\sum_{k=1}^{\infty} \mathbb{E}\tilde{Y}_k$ converges in $\mathbf{R}$.
Similarly,
$$
\sum_{k=1}^n \mathbb{V}ar\tilde{Y}_k = \frac 1 {\log^2 n} \left(\underbrace{1 + \frac 1 2 + \dots + \frac 1 n}_{\log [n] + \gamma} - \underbrace{\left(1 + \frac 1 {2^2} + \dots + \frac 1 {n^2}\right)}_{\pi^2/6}\right) \to 0, \quad \text { as } n \to \infty.
$$
So, the theorem implies that $\sum_{k=1}^{n} \frac 1 {\log n} Y_k$ converges a.s. when $n \to \infty$. Finally, since we know that convergence almost surely implies convergence in probability and there is convergence in probability to a constant $1$, then we have almost surely convergence to $1$ as well.


text:
Q: Android T:V Background customisation I have five background images which are displayed back to back after a certain time interval. I have to add a page indicator for backgrounds so that user can know which background is currently selected. The user should also be able to select next backgrounds using tv remote.
I cannot compromise tv look and feel for rail and its contents which are displayed on the screen.
I also need to resize background image. I do not want the image to be full screen and its size should cover half portion of tv only. Background image should overlap first rails content to an extent.
I am not getting any such sample or blogs depicting customization of background. Any help would be really appreciated..!!!

A: Try to use layout themes for TV.

Android Themes can provide a basis for layouts in your TV apps.
  You should use a theme to modify the display of your app activities
  that are meant to run on a TV device. This section explains which
  themes you should use.

Style and Themes can be:

A style is a collection of attributes that specify the look and format
  for a View or window. A style can specify attributes such as height,
  padding, font color, font size, background color, and much more. A
  style is defined in an XML resource that is separate from the XML that
  specifies the layout.

You can see samples codes as well from the documentation.

A: I added two fragments inside my Activity. One fragment is for displaying background and indicator. While another fragment is extending BrowseFragment of leanback library, and is used to display rails/headers as is depicted in tv app android sample which is generated via android studio.


text:
Q: Discrete Fourier Transform sample frequencies using numpy I'm using numpy to calculate sample frequencies, specifically fft.fftfreq(n, d=1.0).
I want to calculate d. Is there any formula or a library I can use to calculate d?
How can I calculate the sampling rate of a time-series dataset, because d is the inverse of the sampling rate?
Thanks

A: You must read a little about sampling rate before looking to a "magic function".
According to numpy documentation the parameter 'd' is "Sample spacing (inverse of the sampling rate)."
Looking for Sampling rate, the 'd' is equivalent to 'T' in time which stands for Period (the time in seconds between each sample). But you're using the DFT, so you can choose the time unit. If you have 1 sample per day, you 'd' is 1 and the result of fftfreq will be in cycles/day. If you have 2 samples per day, your 'd' is 1/2 to have the output in cycles/day.
So, the function you're looking for is just  1/(samples per time unit), where the time unit could be days, hours, minutes, seconds ...
If you have the timestamps of your samples, you can calculate de 'd' as the time difference between each one. There is no way to calculate that without knowing some information about the signal.


text:
Q: How to fix the clumped up text? How to fix the background not going all the way down? In this code, my text on the sidebar side keeps no getting clumped up together. How can I fix that? Also, how can I extend the sidebar's background all the way to the point where it meets the footer like how the area main does. The whole page is set up in a grid from Grommet. I tried using padding and margin as shown in the code but it still does not work. I also tried some functions in the CSS but it still did not work.
import React from "react";
import { Grommet, Box, Grid, Heading, Paragraph, List, Text, Button, Form, FormField, TextInput } from "grommet";
import { Gremlin, LocationPin, FormNext, DocumentText } from "grommet-icons";
import { custom } from "grommet/themes";
import { deepMerge } from "grommet/utils";
import "./Purpleheader.css";
import "./TechnicalScholarshipApp.css";
import { Simple } from "./StatesForm";
import { Household } from "./Household";
import { Phone } from "./PhoneForm";
import { MainFooter } from "../Footer/Footer";

const data = [
    { text: "You are a graduating senior from Stranahan High School" },
    {
        text:
            "You will attend a certified educational institution this fall, with a definite one or two year goal in mind.  For example, x-ray tech, beautician, welder, etc. ",
    },
    { text: "You have completed the application and the attached the following:" },
];

const data2 = [
    { text2: "A copy of your Stranahan transcript, including the first semester of your senior year." },
    { text2: "Two letters of recommendation. One from an educator, one from a mentor, employer, or community member." },
    { text2: "A copy of your Federal Financial Aid form." },
    { text2: "A copy of your Stranahan transcript, including the first semester of your senior year." },
    { text2: "A short essay that addresses one of the following:" },
];

const data3 = [
    { text3: "One major accomplishment I have achieved and why it was important." },
    { text3: "One major obstacle in my life and how I overcame it." },
    { text3: "What impact my education at Stranahan has had on me." },
];

const data4 = [
    {
        text4:
            "These completed materials must be submitted in an envelope or organized folder to Ms. Lewis no later than Friday, March 3rd.",
    },
];

const customTheme = deepMerge(custom, {
    formField: {
        label: {
            requiredIndicator: true,
        },
    },
});

const TechnicalScholarshipApp = () => (
    <Grommet themes={custom}>
        <Box>
            <Grid className="PurpleHeader" rows={["xxsmall"]} areas={[["header"]]} gap="small">
                <Box background="brand" gridArea="header">

Technical/Vacational Scholarship Application

                </Box>
            </Grid>

            <Box className="bodypage">
                <Grid rows={["xlarge"]} columns={["1/2", "1/2"]} areas={[["sidebar", "main", "footer", "footer"]]}>
                    <Box background="light-5" gridArea="sidebar">
                        <Box pad={{ top: "medium", bottom: "large" }}>
                            <Heading textAlign="center">Stranahan Education Endowment Foundation</Heading>
                        </Box>
                        <Box pad={{ top: "large", left: "large" }}>
                            <Heading textAlign="center" size="small">
                                One or Two Year Scholarship Application
                            </Heading>
                        </Box>
                        <Box align="center" pad={{ bottom: "xlarge", top: "large" }}>
                            <Paragraph textAlign="center" size="large">
                                This form is for a five hundred dollar grant toward a technical, vocational or medical
                                career. Your application cannot be considered unless the following requirements are met:
                            </Paragraph>
                        </Box>
                        <Box pad={{ bottom: "xlarge", left: "small" }} align="center">
                            <List data={data} border={false}>
                                {(datum) => (
                                    <Box direction="row-responsive" gap="medium" align="center">
                                        <LocationPin size="large" />
                                        <Text weight="bold">{datum.text}</Text>
                                    </Box>
                                )}
                            </List>
                        </Box>
                        <Box pad={{ top: "xlarge", left: "large", right: "xlarge", bottom: "xlarge" }} align="center">
                            <List data={data2} pad="medium" border={false}>
                                {(datum) => (
                                    <Box direction="row-responsive" gap="medium" align="center">
                                        <FormNext size="large" />
                                        <Text weight="bold">{datum.text2}</Text>
                                    </Box>
                                )}
                            </List>
                        </Box>

                        <Box
                            pad={{ top: "xlarge", left: "medium", top: "xlarge", bottom: "xlarge" }}
                            align="center"
                            margin={{ top: "xlarge" }}
                        >
                            <List data={data3} pad="medium" border={false}>
                                {(datum) => (
                                    <Box direction="row-responsive" gap="medium" align="center">
                                        <DocumentText size="large" />
                                        <Text weight="bold">{datum.text3}</Text>
                                    </Box>
                                )}
                            </List>
                        </Box>

                        <Box
                            pad={{ top: "xlarge", left: "large", right: "xlarge" }}
                            align="center"
                            margin={{ top: "xlarge" }}
                        >
                            <List data={data4} pad="medium" border={false}>
                                {(datum) => (
                                    <Box direction="row-responsive" gap="medium" align="center">
                                        <FormNext size="large" />
                                        <Text weight="bold">{datum.text4}</Text>
                                    </Box>
                                )}
                            </List>
                        </Box>
                    </Box>
                    <Grommet theme={custom}>
                        <Box background="light-2" gridArea="main" className="mainForm">
                            <Box align="center" pad="large">
                                <Heading textAlign="center" size="small">
                                    One or Two Year Scholarship Application
                                </Heading>
                            </Box>
                            <Box align="center" pad="large">
                                <Form>
                                    <FormField name="firstName" htmlFor="firstName" label="First Name" required>
                                        <TextInput id="firstName" name="firstName" />
                                    </FormField>
                                    <FormField name="lastName" htmlFor="lastName" label="Last Name" required>
                                        <TextInput id="lastName" name="lastName" />
                                    </FormField>

                                    <FormField
                                        name="streetAddress"
                                        htmlFor="streetAddress"
                                        label="Street Address"
                                        required
                                    >
                                        <TextInput id="streetAddress" name="streetAddress" />
                                    </FormField>

                                    <FormField name="addressLine2" htmlFor="addressLine2" label="Address Line 2">
                                        <TextInput id="addressLine2" name="addressLine2" />
                                    </FormField>

                                    <FormField name="city" htmlFor="city" label="City" required>
                                        <TextInput id="city" name="city" />
                                    </FormField>

                                    <Box>
                                        <FormField name="zipCode" htmlFor="zipCode" label="Zip Code" required>
                                            <TextInput id="zipCode" name="zipCode" />
                                        </FormField>
                                    </Box>
                                    <Simple />

                                    <Phone />

                                    <FormField name="email" htmlFor="email" label="Email" required>
                                        <TextInput id="email" name="email" type="email" />
                                    </FormField>

                                    <Household />

                                    <FormField
                                        name="mothersOccupation"
                                        htmlFor="mothersOccupaton"
                                        label="Mothers Occupation"
                                    >
                                        <TextInput id="mothersOccupation" name="mothersOccupation" />
                                    </FormField>
                                    <FormField
                                        name="fathersOccupation"
                                        htmlFor="fathersOccupaton"
                                        label="Fathers Occupation"
                                    >
                                        <TextInput id="fathersOccupation" name="fathersOccupation" />
                                    </FormField>

                                    <Button type="submit" label="Submit" primary />
                                    <Text margin={{ left: "small" }} size="small" color="status-critical">
                                        * Required Field
                                    </Text>
                                </Form>
                                <Box gridArea="footer" pad={{ top: "large" }}>
                                    <MainFooter />
                                </Box>
                            </Box>
                        </Box>
                    </Grommet>
                </Grid>
            </Box>
        </Box>
    </Grommet>
);

export default TechnicalScholarshipApp;

A: Short answers:

How to fix clumped-up text?

Understand the behavior of CSS flexbox, and control it better on your app. Usage of flex={false} solved your clumped-up text.

How to fix the background not going all the way down

This behavior was resulted in setting hard-coded row height within your grid. So rows={["xlarge"]} resulted in this behavior, changing it to rows="auto" fixed the problem, and now all the content inside this grid cell is included in the background.
Longer answer:
Regardless of these two fixes, I wasn't able to get the full picture of your problem since your code includes many other components and stylesheets that are not part of the code you shared. Few things I picked up on that you'd might want to invest some time fixings are:

*

*Learn more about Heading levels and sizes for better accessibility support, I fixed some of the issues in that area with the code you shared but it might need more attention.

*After adding flex={false} to avoid clumped-up text, the pad setters were redundant, so you can clean up those easily by removing the pad prop.

*With a clean grommet app, you are not really supposed to use a stylesheet, I suggest learning how to leverage the theme power instead.

*Instead of using multiple Grommet components to switch themes, try to use ThemeContext instead.

Here is a quick snippet of the cleaned up code that solves your problem (although I think it needs more clean-ups, it does the tricks you expect it too)
import React from "react";
import { render } from "react-dom";

import {
  Grommet,
  Box,
  Grid,
  Heading,
  Paragraph,
  List,
  Text,
  Button,
  Form,
  FormField,
  TextInput
} from "grommet";
import { LocationPin, FormNext, DocumentText } from "grommet-icons";
import { custom } from "grommet/themes";
import { deepMerge } from "grommet/utils";

const data = [
  { text: "You are a graduating senior from Stranahan High School" },
  {
    text:
      "You will attend a certified educational institution this fall, with a definite one or two year goal in mind.  For example, x-ray tech, beautician, welder, etc. "
  },
  { text: "You have completed the application and the attached the following:" }
];

const data2 = [
  {
    text2:
      "A copy of your Stranahan transcript, including the first semester of your senior year."
  },
  {
    text2:
      "Two letters of recommendation. One from an educator, one from a mentor, employer, or community member."
  },
  { text2: "A copy of your Federal Financial Aid form." },
  {
    text2:
      "A copy of your Stranahan transcript, including the first semester of your senior year."
  },
  { text2: "A short essay that addresses one of the following:" }
];

const data3 = [
  {
    text3: "One major accomplishment I have achieved and why it was important."
  },
  { text3: "One major obstacle in my life and how I overcame it." },
  { text3: "What impact my education at Stranahan has had on me." }
];

const data4 = [
  {
    text4:
      "These completed materials must be submitted in an envelope or organized folder to Ms. Lewis no later than Friday, March 3rd."
  }
];

const customTheme = deepMerge(custom, {
  formField: {
    label: {
      requiredIndicator: true
    }
  }
});

const App = () => (
  <Grommet themes={customTheme} full style={{ height: "auto", width: "100%" }}>
    <Box fill>
      <Grid rows={["xsmall"]} areas={[["header"]]} gap="small">
        <Box background="brand" gridArea="header">

Technical/Vacational Scholarship Application

        </Box>
      </Grid>

      <Box className="bodypage" fill>
        <Grid
          rows="auto"
          columns={["1/2", "1/2"]}
          areas={[["sidebar", "main", "footer", "footer"]]}
        >
          <Box background="light-5" gridArea="sidebar" fill>
            <Box flex={false}>
              <Heading textAlign="center">
                Stranahan Education Endowment Foundation
              </Heading>
            </Box>
            <Box pad={{ top: "large", left: "large" }} flex={false}>
              <Heading textAlign="center" level={2}>
                One or Two Year Scholarship Application
              </Heading>
            </Box>
            <Box align="center" flex={false}>
              <Paragraph textAlign="center" size="large">
                This form is for a five hundred dollar grant toward a technical,
                vocational or medical career. Your application cannot be
                considered unless the following requirements are met:
              </Paragraph>
            </Box>
            <Box align="center">
              <List data={data} border={false}>
                {(datum) => (
                  <Box direction="row-responsive" gap="medium" align="center">
                    <LocationPin size="large" />
                    <Text weight="bold">{datum.text}</Text>
                  </Box>
                )}
              </List>
            </Box>
            <Box align="center">
              <List data={data2} pad="medium" border={false}>
                {(datum) => (
                  <Box direction="row-responsive" gap="medium" align="center">
                    <FormNext size="large" />
                    <Text weight="bold">{datum.text2}</Text>
                  </Box>
                )}
              </List>
            </Box>

            <Box align="center">
              <List data={data3} pad="medium" border={false}>
                {(datum) => (
                  <Box direction="row-responsive" gap="medium" align="center">
                    <DocumentText size="large" />
                    <Text weight="bold">{datum.text3}</Text>
                  </Box>
                )}
              </List>
            </Box>

            <Box align="center" margin={{ top: "xlarge" }}>
              <List data={data4} border={false}>
                {(datum) => (
                  <Box direction="row-responsive" gap="medium" align="center">
                    <FormNext size="large" />
                    <Text weight="bold">{datum.text4}</Text>
                  </Box>
                )}
              </List>
            </Box>
          </Box>
          <Box background="light-2" gridArea="main" className="mainForm" fill>
            <Box align="center">
              <Heading textAlign="center" size="small">
                One or Two Year Scholarship Application
              </Heading>
            </Box>
            <Box align="center" pad="large">
              <Form>
                <FormField
                  name="firstName"
                  htmlFor="firstName"
                  label="First Name"
                  required
                >
                  <TextInput id="firstName" name="firstName" />
                </FormField>
                <FormField
                  name="lastName"
                  htmlFor="lastName"
                  label="Last Name"
                  required
                >
                  <TextInput id="lastName" name="lastName" />
                </FormField>

                <FormField
                  name="streetAddress"
                  htmlFor="streetAddress"
                  label="Street Address"
                  required
                >
                  <TextInput id="streetAddress" name="streetAddress" />
                </FormField>

                <FormField
                  name="addressLine2"
                  htmlFor="addressLine2"
                  label="Address Line 2"
                >
                  <TextInput id="addressLine2" name="addressLine2" />
                </FormField>

                <FormField name="city" htmlFor="city" label="City" required>
                  <TextInput id="city" name="city" />
                </FormField>

                <Box>
                  <FormField
                    name="zipCode"
                    htmlFor="zipCode"
                    label="Zip Code"
                    required
                  >
                    <TextInput id="zipCode" name="zipCode" />
                  </FormField>
                </Box>

                <FormField name="email" htmlFor="email" label="Email" required>
                  <TextInput id="email" name="email" type="email" />
                </FormField>

                <FormField
                  name="mothersOccupation"
                  htmlFor="mothersOccupaton"
                  label="Mothers Occupation"
                >
                  <TextInput id="mothersOccupation" name="mothersOccupation" />
                </FormField>
                <FormField
                  name="fathersOccupation"
                  htmlFor="fathersOccupaton"
                  label="Fathers Occupation"
                >
                  <TextInput id="fathersOccupation" name="fathersOccupation" />
                </FormField>

                <Button type="submit" label="Submit" primary />
                <Text
                  margin={{ left: "small" }}
                  size="small"
                  color="status-critical"
                >
                  * Required Field
                </Text>
              </Form>
              <Box gridArea="footer" pad={{ top: "large" }}></Box>
            </Box>
          </Box>
        </Grid>
      </Box>
    </Box>
  </Grommet>
);

render(<App />, document.getElementById("root"));

Copy/paste this code to this template and it should work as expected.


text:
Q: C# Проблема с IComparable при наследовании Вопрос такой
Есть следующий код
class A : IComparable, IComparable
{
        int IComparable.CompareTo(B other)
        {
            //Code
        }

        int IComparable.CompareTo(A other)
        {
            //Code
        }
}

class B : A, IComparable, IComparable
{
        int IComparable.CompareTo(B other)
        {
            //Code
        }

        int IComparable.CompareTo(A other)
        {
            //Code
        }
}

class Program
{
        static void Main()
        {
               List a = new List();
               // Заполняем список рандомными элементами А и B
        }
}

И при попытке отсортировать массив А, элементы сортируются не по правилам, описанным в компараторах.
В чем может быть проблема?

A: Вы не должны явно реализовывать IComparable<T>:
class A : IComparable
{
    public virtual int CompareTo(A? comparand) => <...>;
}
class B : A, IComparable
{
    public override int CompareTo(A? comparand) =>
        comparand is B b ? CompareTo(b) : -1;
    public virtual int CompareTo(B? comparand) => <...>;
}

Не нужно в базовом классе добавлять интерфейс для сравнения наследуемого, сам наследуемый реализует интерфейс.
Для большей ясности пример: в классе A есть поле a типа int. В классе B добавили поле b. Тогда реализация будет такой:
class A : IComparable
{
    public static readonly A Default = new A();

    readonly int a;

    public virtual int CompareTo(A? comparand)
    {
        comparand ??= Default;

        return a.CompareTo(comparand.a);
    }
}
class B : A, IComparable
{
    public static readonly B Default = new B();

    readonly int b;

    public virtual int ComareTo(B? comparand)
    {
        comparand ??= Default;

        var cmp = b.CompareTo(comparand.b);

        if (cmp != 0) return cmp;

        return base.CompareTo(comparand);
    }
    public override int CompareTo(A? comparand) =>
        comparand is B b ? CompareTo(b) :
            (b == 0 ? CompareTo(comparand) : -1);
}

var a = A.Default;
var b = B.Default;

a.CompareTo(a); // 0
b.CompareTo(a); // 0
a.CompareTo(b); // 0 // так можно, т. к. идёт implicit cast `B` -> `A`


text:
Q: how to sort array based on value os child array Below is my array , i want to sort it based on [attributes]->[0]->[value]
how can i do it please guide me.
i tried using sort but how to make it work for value of child array.
Pls guide me its new for me.
[549246] => Array
        (
            [info] => Array
                (
                    [price] => $281.00
                    [qty] => 10
                    [prod_id] => 549246
                )

            [attributes] => Array
                (
                    [0] => Array
                        (
                            [code] => sizes
                            [label] => Size
                            [value] => 25mg
                            [attribute_id] => 191
                            [option_id] => 26
                        )

                )

        )

    [549245] => Array
        (
            [info] => Array
                (
                    [price] => $75.00
                    [qty] => 10
                    [prod_id] => 549245
                )

            [attributes] => Array
                (
                    [0] => Array
                        (
                            [code] => sizes
                            [label] => Size
                            [value] => 5mg
                            [attribute_id] => 191
                            [option_id] => 24
                        )

                )

        )

A: try below;
function customer_sort ($a, $b) {

if ((int)$a['attributes'][0]['value'] == (int)$b['attributes'][0]['value']) {
    return 0;
}

return (int)$a['attributes'][0]['value'] > (int)$b['attributes'][0]['value'] ? 1 : -1;

}
uasort($arr, 'customer_sort');


text:
Q: How to find 58 bytes of hexa checksum in java I want to know how to find  Hexa checksum using java code
5AA50000000100000001000100020003000400050006000700080009001000110012001300140015001600170018001900200021002200230024

I tried using checksum interface it returns a long value
byte[] bytes=value.getBytes();
Checksum cs = new CRC32();

   cs.update(bytes, 0, bytes.length);
  System.out.println(cs.getValue()+"check sum");

Header(10)  Start Byte(2)   Source Addr(4)  Destination Addr(4)
Payload (48)    Data1 - Data24
Checksum(1) Least 8bit of 58Byte Sum Value
EndByte(1)  0x20
how to achieve 5B as a checksum

A: The problem is that the value seems to be a hexadecimal representation of bytes, 2 characters forming one byte value in base 16; "5A" = (byte) 170. To get those bytes:
byte[] bytes = new BigInteger(value, 16).toByteArray();

Note that this hacky conversion requires that the value does not start with "00".
As I believe that checksums of two arrays where one has preceeding zeroes are different:
int zeroes = 58 - bytes.length;
if (zeroes > 0) {
    byte[] bytes2 = new byte[58];
    System.arraycopy(bytes, 0, bytes2, zeroes, bytes.length);
    bytes = bytes2;
}

After comment, some further research:
Hex conversion best done with:
    final int N = value.length() / 2;
    byte[] bytes = new byte[N];
    for (int i = 0; i < N; ++i) {
        bytes[i] = (byte)Integer.parseInt(value.substring(i*2, i*2 + 2), 16);
    }

I tried CRC8 as that would give an 8 bit result. Did not work.
Short endianness (endian byte order) also did not work.
The CRC32 gives 0x8a82c8cb which cannot easily be converted to 0x5b
That the checksum is a single byte value is hard to believe. Hence my conjecture for CRC8.
Sometimes precalculated CRC32 tables are used, and those may vary.
No solution here!


text:
Q: How to set more than one Angular2 var in Jquery onchange I am unable to assign more than one var in jquery in Angular2.
what I am doing is:
jQuery('.source-select').on('change',(e) => this.updateForm.value.sources = jQuery(e.target).val().split('--')[0]);

this is working prefectly but I want to assigned splited value of index [1] to another object as:
  jQuery('.source-select').on('change',(e) => this.updateForm.value.sources = jQuery(e.target).val().split('--')[0]
   ,(e) => this.selected_text = jQuery(e.target).val().split('--')[1]
   );

But at this time I am this.selected_text is set but not this.updateForm.value.sources . Any guess what I am doing wrong.
*** I tried using on change twice and that is working fine but I dont think its good to do that.

A: I don't know if I really understand your question but why don't you use it ike this?
 jQuery('.source-select').on('change',function(e){
    this.updateForm.value.sources = jQuery(e.target).val().split('--')[0];
    this.selected_text = jQuery(e.target).val().split('--')[1];
});


text:
Q: Error using K&R style function definition I got the following error at compile time.I know it sounds wrong,but what's the exact message compiler is trying to convey:
error: conflicting types for 'fun'
error: previous decalaration of fun was here:
 int main( )
 {
    extern int fun(float);
    int a;
    a=fun(3.14F);
    printf("%d\n",a);
    return 0;
}

int fun( aa )
float aa;
{
    return( (int) aa);
}

A: K&R-style function declarations aren't quite the same as modern style ones.  In particular, the default argument promotions take place, making your float parameter not quite legal.  You have two choices to fix your problem:

*

*Change fun to accept a double parameter instead of a float.

*Change the definition of fun to a standard-C-style function definition:
int fun(float aa)
{
    return aa;
}

I also removed the unnecessary cast & parentheses.
As an aside, if you are a beginner, you might find clang helpful - it sometimes provides much better error messages.  For your program, for example:
example.c:13:7: warning: promoted type 'double' of K&R function parameter is not
      compatible with the parameter type 'float' declared in a previous
      prototype [-Wknr-promoted-parameter]
float aa;
      ^
example.c:5:25: note: previous declaration is here
    extern int fun(float);
                        ^


text:
Q: Get the value of a field for the latest record in a collection I have a collection rawUnits. I am getting the latest record from this collection using
db.getCollection('rawUnits').find().limit(1).sort({$natural:-1})

This gives me the record which has a nested field saleinfo.group.id
I want to get the value for this field how do I do that?

A: You can $project it:
db.getCollection('rawUnits').find({}, {'saleinfo.group.id':1}).limit(1).sort({$natural:-1})

But it is better to limit your search, if you filter by any field...


text:
Q: how to check if a webpart already exists on a page or not I am adding three webparts with different titles to a given page url, but I need to check if webpart is already on page or not, here is the code i am using atm to add webpart to the page.
     using (SPSite mySite = new SPSite(PageUrl))
                {
                    using (SPWeb web = mySite.OpenWeb())
                    {
                        try
                        {
                            web.AllowUnsafeUpdates = true;

                            using (SPLimitedWebPartManager manager = web.GetLimitedWebPartManager("default.aspx", PersonalizationScope.Shared))
                            {
                            webpart webpart = new webpart();
                            webpart.AllowClose = true;
                            webpart.AllowMinimize = true;
                            webpart.AllowConnect = true;
                            webpart.ChromeType = PartChromeType.None;
                            webpart.ChromeState = PartChromeState.Normal;
                            webpart.AllowZoneChange = true;
                            webpart.AllowHide = true;
                            webpart.ExportMode = WebPartExportMode.All;
                            webpart.Hidden = false;
                            webpart.AllowEdit = true;
                            webpart.AllowZoneChange = true;
                            webpart.AllowHide = true;
                            webpart.ButtonCSSClass = "DefaultButton";

                            manager.AddWebPart(webpart, "Right", index);
                            }
                      }
                 }

A: Here is LINQ code that finds a Web Part with a title:
    string _webPartTitle = "mywebpart";
    //Retrive the webpart with some title
    IList<Microsoft.SharePoint.WebPartPages.WebPart> _listFormWebParts = (from _wp in manager.WebParts.Cast<Microsoft.SharePoint.WebPartPages.WebPart>()
                                                                            where string.Compare( _wp.Title , _webPartTitle  , true ) == 0
                                                                            select _wp).ToList();

    //Check if there are any web parts found
    if (_listFormWebParts != null)
    {

    }


text:
Q: Windows 10 refresh and effect on the registry Windows 10 offers what many seem to call a "Refresh" option, which behaves somewhat like a fresh install except many user files are kept. This can be found in Update & Security, under Recovery and Reset this PC, where you opt to keep your files.
What happens to the registry when this is run? Is the registry completely reset to factory defaults, or is it left intact?
I ask this question because I have remotely been helping a user clean their computer. After refreshing, AVG found many (400+) registry errors. My first guess was that the refresh option kept the registry as-is while removing programs, which would result in these errors. I do not understand why a fresh registry would have so many errors.

A: When you refresh your system, the Windows registry goes back to "factory-default" as you might say.
Running a Registry cleaner on your PC is pretty useless and sometimes adversely affects your system. There are numerous websites that emphasize this, for example, here and here.
When AVG found those errors, it plainly showed that it didn't do any real registry cleaning. As @Ramhound mentioned, the errors that AVG found were not actual errors, but was probably an attempt to impress you on buying some of their paid software.


text:
Q: How can we write unit test cases using jest for a function which has a switch case in which it takes the data from state and update it I want to test my function which has a switch case and the state updates based on the value. I am using jest and enzyme for testing. How do we do unit testing for a switch statement ?
 constructor(props) {
            super(props);
            this.state = {
               timeData: {
                    endTime: moment(),
                    startTime: moment().subtract(2, 'h'),

                },
                dropdownOption: '2HOURS'
    }

onClick(){
                let time = {...this.state.timeData};
                option = this.state.dropdownOption;
                switch(option){
                    case '10hours':
                timeData['startTime'].subtract(10, 'h');
                timeData['endTime'].subtract(10, 'h');

                case '20hours':
                timeData['startTime'].subtract(20, 'h');
                timeData['endTime'].subtract(20, 'h');
            }
            this.setState({timeData: time}, this.callAPI())
        }