text:
Q: Using Junior Framework with Meteor (Jr not defined) So I'm currently working on my first meteor app which will be a nice mobile app.
Since it will only run on mobile devices I want to use the Junior Framework to achieve the look and feel of a classic app + the slide transitions.
It is based on backbone.js.
So my meteor app also already uses backbone and works just fine. Problem is now that when I include junior into my meteor project the Junior namespace ("Jr") is NOT defined.
I think that this has the following reason:
Meteor always automatically wraps any *.js file from within the project with the following code:
(function(){ ... }).call(this);

This destroys the class definition of the junior js class which results in "Jr" not defined.
How can I get around this? I really need Junior to use the slide transitions and everything.
Or let's put it another way: Do you know of any way to include slide transitions between pages within a meteor project which is also using backbone.js (at the moment I'm using a standard backbone router + Meteor's Template.templatename.var syntax)?
Thank you in advance,
best regards
Patrick

A: Where are you putting your CSS + JS for Junior?
You should put all this 3rd party stuff in folder "public" (it will be not bundled as meteor js, but as 3rd party js + css. http://docs.meteor.com/#structuringyourapp
I created quick demo I putt all in there and
HTML

    <title>junior</title>

    <link rel="stylesheet" href="lib/stylesheets/ratchet.css"/>
    <link rel="stylesheet" href="src/stylesheets/junior.css"/>

  {{> hello}}

<template name="hello">

Hello World!

        {{greeting}}
        <input type="button" value="Click" />

</template>

JavaScript
// then i'm able to get Jr object on client side (anywhere)
console.log(Jr);

A: So junior will not do the job!
First and foremost: slide transitions are still very buggy and slow to this date on mobile devices. So only include them if you really need them.
If you then still are looking for a way to have sliding transitions within a meteor project I suggest to have a look at: Tom C's transitioner
It does not work perfectly but it is by far the best solution out there right now!


text:
Q: Flask Max Recursion Depth I have a max recursion depth error that is driving me nuts
In the flask __init__.py file I have:
@app.route('/vpcs')
@app.route('/vpcs/<vpc>')
def getVPCs(vpc=False):
    """
    Get the vpcs.
    """
    results = getVPCs()
    return jsonify(**results)

It calls the functions from:
def getVPCs():
   """
   This is the function that loops through the accounts and regions and does all the connections.
   """

A function that loops through the config file with the account keys
   accounts = getAccountCreds()

   vpc_list = []
   try:

Loop through each region ...
         # for each region
         for r in REGIONS:
Loop through each of the accounts
       # for each of the 8,yes 8, AWS accounts...
       for account,keys in accounts.iteritems():
         conn = VPCConnection(region=ec2.get_region(r),aws_access_key_id=keys[0],aws_secret_access_key=keys[1])

Get all the VPCs for each account ...
          vpcs = conn.get_all_vpcs()
          if formatVPC(account,vpcs[0]):
                vpc_list.append(formatVPC(account,vpcs[0]))
            return vpc_list
  except boto.exception.BotoServerError, e:
    print e

Which also calls:
def formatVPC(account,instance):
    """
    Function to format VPC data.
    Keys we want:
    - id
    - instance_tenancy
    - tags
    - region.name
    - region.connection
    - region.endpoint
    - state
    - cidr_block
    """
    result_dict = {}
    if instance:
        result_dict['account'] = account
        result_dict['id'] = instance.id
        result_dict['cidr_block'] = instance.cidr_block
        result_dict['instance_tenancy'] = instance.instance_tenancy
        result_dict['region'] = {'name':instance.region.name,'connection':   instance.region.connection,'endpoint':instance.region.endpoint}

        if result_dict:
            return result_dict

Error:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)

A:
It calls the functions from:

Nope, the getVPCs from your snippet just calls itself:
@app.route('/vpcs')
@app.route('/vpcs/<vpc>')
def getVPCs(vpc=False):
    """
    Get the vpcs.
    """
    results = getVPCs()  # Here.
    return jsonify(**results)

and does so recursively, without any "boundary" other than recursion limit, which results in RuntimeError: maximum recursion depth exceededyou've mentioned.
Change one of these functions' names (and, of course, adjust the call if necessary).

A: https://docs.python.org/2/library/sys.html
sys.getrecursionlimit()
Return the current value of the recursion limit, the maximum depth of the Python interpreter stack. This limit prevents infinite recursion from causing an overflow of the C stack and crashing Python. It can be set by setrecursionlimit().

redpajama_set_name: RedPajamaStackExchange


text:
Q: What does the @data directive mean in MASM? I have come across the following directive in some assembly code:
mov    ax, @data

I've gone through my assembler book and tried some Googl-ing, but can't find a definition.
Thanks,
Scott

A: @data is a macro for the default data group, which is only relevant if you're not using the FLAT model.
The code you provided is typically followed by mov ds, ax, which sets up the data segment register for the current executable.
(MSDN reference at @data.)


text:
Q: Mac storage usage I have a mid 2014 macbook pro, with just 128gb of storage. So as you can imagine, space is at a premium. When i've left it on for a day or so I notice my remaining space goes down. Is this some sort of caching or system restore or something that's eating up all my usable remaining space? I have about 5gb free, but the end of the day it's normally full. Is this normal? Or is something leaking
All I do to clear it is reboot. The following screenshot is after and before a reboot

A: When my Mac was almost full it used to do that. Usually 2 or 3 GB, i believe that is really a kind of cache.
I upgraded my storage with a SD adapter and it stopped to happen.
Mine is from TheMiniDrive, now i have more 256GB hehehe


text:
Q: Mark spots in image I am new to fronted implementation.
I have a stock image of a vehicle that I'm using as a base for my users to mark damage on. I would like the user to be able to edit this image to show damage, and save this newly created image.
The image below visualises this concept. If anyone has an idea on how to achieve this that would be much appreciated, thanks.


text:
Q: How to hide my domain name or ip from the user who downloads from my site(ASP.NET)? I'm developing a windows application in C# and I also developed a asp.net website and hosted in a server. My motive is to not show my server source or domain address to the user.
Hence I designed a custom browser in c#(win app) then I just navigated user to my asp.net site. I haven't kept address bar and I disabled right click option in that browser. So the user just can view the page, cant find the server info.
But the issue that I'm facing now is, when the user tries to download anything from the site, Internet Explorer's download window opens up and asks where to save. But there in the screen it shows my server ip or domain address to the user. so how can I hide that from the user, or can you please say me a solution to my problem. ie ( I dont wanna show my server info to my users but I want them to download or save from my site)

A: This is impossible. The user can always find the remote IP address using netstat or their router's network logging information.
If you absolutely must continue down this path then you can do something similar by requiring your users to configure the Tor services and publish your server as a Tor hidden service. The Tor hidden services are only accessible by users on Tor and they cannot determine the "source" IP address because it has been bounced through several anonymizing routers on the public Internet.
Depending upon your user base this might either be impossible, unlikely, or the most logical step.

A: I initially had the same response as everyone else, but upon reconsidering I decided that there's a little more nuance in this question than I originally thought, as well as some opportunities for learning.
Who is your "adversary" in this scenario, and what is the cost of them finding out your server? How much control do you have over the rest of the computer? The network?
If your target platform is a kiosk in a shopping mall that doesn't run any other software and is pretty well locked down at the OS level, on a network that you (or at least an indifferent third party) has control over, then you might have a chance at making your plan work.
Your plan will fail if the attacker has both any control over the computer or network and a sufficient motivation to find out your secret.
Your proposed plan is a bad idea if the consequences of your server location being disclosed are high. Will someone lose money? Will someone go to jail? Will someone who should go to jail, not go to jail?
If your adversary controls a computer (including network routers), then there is no way to put a secret on that computer in such a way that your software knows it but theirs doesn't. If your software knows the address of the server, a sufficiently motivated adversary can too.
Some people mentioned Tor as an option. This is a good option as it moves the secret off of the client computer and it's network to the indifferent, third-party, network of Tor nodes. However, Tor can be considered a security protocol, and the use of security protocols is always the beginning of your security odyssey, not the end of it. You probably can make it work if you introduce Tor into the system. It will take a lot of your resources to do so.
Evaluate your goals. How secret do you want to keep this secret?
Evaluate your adversary. What are their capabilities? What do they control? How motivated are they to get your secret?
Tailor your design accordingly.


text:
Q: RHEL 7 allocate physical cores and rams for users Dears,
Back at work we have Dell blade server with 64 physical cores, and we intend to use heavy simulations on softwares by multiple users.
My question: Is there a way to assign certain number of cpu cores/rams for each user to use?
Example: user x gets 4 cores and 16GB rams.
So when he runs software like Matlab it will use 4 physical cores and his 16GB of ram preallocated to the user x.
Thanks!


text:
Q: android studio - opening files from multiple projects is there anyway to open file from multiple project like the eclipse does?!
I am learning android app developing and I use my older projects as my own coding reference (to master em) a lot. previously  I used to do such a thing with ecplispe with ease but in android studio I havent found such an option like project explorer as ecplipse's.
is there such a project explorer thing in android studio?
tnx in advance

A: You can do this in two ways:
1) Open the older project while new one is open and choose (New Window) when prompted. See this help page for more information on using multiple projects/windows (the help is for IntelliJ IDEA, but it works the same in Android Studio).
2) Drag and drop the file you want to view into the window and it will open in it's own tab.
The first option would be best suited if you want to refer to many files in the older project and the second if you just want to quickly view something in one file.


text:
Q: WPF version of Silverlight GetResourceStream Does WPF have something that does the same as Silverlight's
public static StreamResourceInfo GetResourceStream(
    StreamResourceInfo zipPackageStreamResourceInfo, Uri uriResource)

Returns a resource file from a location in the specified zip package.

as the Windows version of this function does this:

Returns a resource stream for a resource data file that is located at the specified Uri

Basically I want to read files from within a zip file without having to extract them all first, which I think is what the silverlight version of the function can do...

A: You can look into SharpZipLib here, here and for an alternative here.


text:
Q: How manage Rails log/development.log with Git(Hub) and multiple users I am newish to Rails and GitHub and struggling with managing two coders' development logs. Specifically:

*

*How do I merge two developers development logs?

*Can I automate their merger? Or can I differentiate them in some Railsy or GitHub Flowy way?

The Rails app I am developing on command line CentOS 6 is being worked on by another developer. We are using a private GitHub repo to help us manage our codebase and are trying to follow The GitHub Flow.
This strategy works well for almost every aspect of our project. The only major problem I've run into with this so far is that our development logs are (of course) out of sync. For instance, he branches from master, then I do. Then he merges to master, then I do, but my merge will fail, citing the automatic merge failure on log/develoment.log. Our logs will be structured like this:
log/development.log - mine
Shared: (Tens of thousands of lines of code from master branch point)
Not:    (Thousands of lines of code unique to my branch)
log/development.log - his
Shared: (Tens of thousands of lines of code from master branch point)
Not:    (Thousands of lines of code unique to his branch)
So, I find going through this manually, even with diff tools like git mergetool, impractical because of the volumes of code involved. (Am I simply too much of a vim novice to be able to put this to good use? Do others find this trivial?)

*

*Is there a git or rails development strategy we can employ to keep these files without them clashing? (ex: some tinkering with Rails configuration to designate 'Development1' environment vs. 'Development2' environment)?

*Is there some command line tool that merges two clashing logs based on time last updated? I'm imaging a tool that, given two clashing git-tracked documents can merge them by comparing the branch point/time, using that as the 'shared' base and adding in the remainder based on which was more recently updated (more recent > appended last). A more advanced version would walk back through commit history to append updates based on commit timestamps.

A: Logs are useful for your own purposes:

*

*check requests sent

*check params sent

*check correct matching url/controller-action

*check sql queries

*check your own stuff (you can log things if you desire)

So because its for your only purpose, no need to pollute your repository with it: add log folder to your gitignore.
There is a recommended gitignore for Rails projects here.
BTW, if logs in console are enough for you, save your disk space and add:
config.logger = Logger.new(STDOUT)

in development.rb


text:
Q: com.android.volley.ParseError: org.json.JSONException I got this error from volley library
@Override
public void onErrorResponse(VolleyError error) {
    error.printStackTrace();
}

the error
com.android.volley.ParseError: org.json.JSONException: Value [{"id":"admin","name":"Admin"}] of type org.json.JSONArray cannot be converted to JSONObject

How can I receive the result as string and then I will process it using jackson ?

A: I noticed that there is class JsonArrayRequest supported by volley so I use this class and the problem solved, I was using JsonObjectRequest
https://android.googlesource.com/platform/frameworks/volley/+/43950676303ff68b23a8b469d6a534ccd1e08cfc/src/com/android/volley/toolbox

A: If you want to receive the result as a string don't use the JSONRequest. Go with the simple Request class.
Your problem is pretty simple the server is giving back a JSONArray with just one element inside.
A JSONArray is not a JSONObject. That's why the parsing is failing.

A: We Have to use JsonArrayRequest instead of JsonObjectRequest. The code as:
    RequestQueue queue = Volley.newRequestQueue(this);

    final String url = "http://192.168.88.253/mybazar/get_product_list.php";

    // prepare the Request
    JsonArrayRequest getRequest = new JsonArrayRequest(Request.Method.GET, url, null,
            new Response.Listener<JSONArray>()
            {
                @Override
                public void onResponse(JSONArray response) {
                    // display response
                    Log.d("Response", response.toString());
                }
            },
            new Response.ErrorListener()
            {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Log.d("Error.Response", error.toString());
                }
            }
    );

    // add it to the RequestQueue
    queue.add(getRequest);

Hope, it's solve the problem.

A: Probably the below logic will work for you:
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
                Request.Method.GET,
                url,
                null,
                new Response.Listener<JSONObject>() {
                    @Override
                    public void onResponse(JSONObject response) {
                        try {
                            JSONObject jsonObject1 = new JSONObject(response.toString());
                            JSONArray jsonArray = jsonObject1.getJSONArray("statewise");
                            Log.d("Json response", "onResponse: "+jsonObject1.toString());

                            for (int i = 0; i < jsonArray.length; i++) {
                                JSONObject jsonObject = jsonArray.getJSONObject(i);

                                //Here you will get your result so can use textview
                               //to populate the result
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Log.d(TAG, "onErrorResponse: "+error);
            }
        });
        RequestQueue requestQueue = Volley.newRequestQueue(this);
        requestQueue.add(jsonObjectRequest);
    }


text:
Q: Error 1264 MySQL even though the value is within int parameters I have read and understand that int can only hold a max value of 2147483647. My issue is that the field MySQL is saying it has a problem with, has the value of "1", which is well within 2147483647.
Here is the response I am getting:
Error Code: 1264. Out of range value for column 'state_Title_ID' at row 1

Here is the code I am using:
INSERT INTO tbl_position_history
    SELECT * FROM tbl_active_position
        WHERE position_AI_Number=1
            AND uconn_position_ID=99002805;

Here is the information it is selecting:
position_AI_Number, uconn_Position_ID, data_Start_Date, data_End_Date, employee_AI_Number, state_Title_ID, functional_Title_ID, org_ID, pos_Paid_By_ID, bond_Fund_Paid_Engineer, union_ID, job_Start_Date, full_Time_Employee, additional_History, status_TSHC, object_ID, cust_Floater, assignment_ID, status_ID, staffing_Plan_ID, shift_ID, cust_Area_ID
'1', '99002805', '0000-00-00', '2016-07-27', '2', '1', '1', '1616', '2', '1', '6', NULL, '1', 'Facilities IT', '0', '5240', '0', NULL, '2', NULL, '1', NULL

This is the position history table:
    Field, Type, Null, Key, Default, Extra
    'position_AI_Number', 'int(11)', 'NO', 'PRI', NULL, ''
    'uconn_Position_ID', 'int(11)', 'NO', 'PRI', NULL, ''
    'data_Start_Date', 'date', 'NO', '', NULL, ''
    'state_Title_ID', 'int(11)', 'YES', 'MUL', NULL, ''
    'functional_Title_ID', 'int(11)', 'YES', 'MUL', NULL, ''
    'org_ID', 'int(11)', 'YES', 'MUL', NULL, ''
    'pos_Paid_By_ID', 'int(11)', 'YES', 'MUL', NULL, ''
    'bond_Fund_Paid_Engineer', 'int(11)', 'YES', 'MUL', NULL, ''
    'union_ID', 'int(11)', 'YES', 'MUL', NULL, ''
    'employee_AI_Number', 'int(11)', 'YES', 'MUL', NULL, ''
    'data_End_Date', 'date', 'YES', '', NULL, ''
    'job_Start_Date', 'date', 'YES', '', NULL, ''
    'full_Time_Employee', 'float', 'YES', '', NULL, ''
    'additional_History', 'longtext', 'YES', '', NULL, ''
    'status_TSHC', 'tinyint(1)', 'YES', '', NULL, ''
    'object_ID', 'int(11)', 'YES', 'MUL', NULL, ''
    'cust_Floater', 'tinyint(1)', 'YES', '', NULL, ''
    'assignment_ID', 'int(11)', 'YES', 'MUL', NULL, ''
    'status_ID', 'int(11)', 'NO', 'MUL', NULL, ''
    'staffing_Plan_ID', 'int(11)', 'YES', 'MUL', NULL, ''
    'shift_ID', 'int(11)', 'YES', 'MUL', NULL, ''
    'cust_Area_ID', 'int(11)', 'YES', 'MUL', NULL, ''

This is the position active history:
Field, Type, Null, Key, Default, Extra
'position_AI_Number', 'int(11)', 'NO', 'PRI', NULL, 'auto_increment'
'uconn_Position_ID', 'int(11)', 'NO', 'PRI', NULL, ''
'data_Start_Date', 'date', 'NO', '', NULL, ''
'data_End_Date', 'date', 'YES', '', NULL, ''
'employee_AI_Number', 'int(11)', 'YES', 'MUL', NULL, ''
'state_Title_ID', 'int(11)', 'YES', 'MUL', NULL, ''
'functional_Title_ID', 'int(11)', 'YES', 'MUL', NULL, ''
'org_ID', 'int(11)', 'YES', 'MUL', NULL, ''
'pos_Paid_By_ID', 'int(11)', 'YES', 'MUL', NULL, ''
'bond_Fund_Paid_Engineer', 'int(11)', 'YES', 'MUL', NULL, ''
'union_ID', 'int(11)', 'YES', 'MUL', NULL, ''
'job_Start_Date', 'date', 'YES', '', NULL, ''
'full_Time_Employee', 'float', 'YES', '', NULL, ''
'additional_History', 'longtext', 'YES', '', NULL, ''
'status_TSHC', 'tinyint(1)', 'YES', '', NULL, ''
'object_ID', 'int(11)', 'YES', 'MUL', NULL, ''
'cust_Floater', 'tinyint(1)', 'YES', '', NULL, ''
'assignment_ID', 'int(11)', 'YES', 'MUL', NULL, ''
'status_ID', 'int(11)', 'NO', 'MUL', NULL, ''
'staffing_Plan_ID', 'int(11)', 'YES', 'MUL', NULL, ''
'shift_ID', 'int(11)', 'YES', 'MUL', NULL, ''
'cust_Area_ID', 'int(11)', 'YES', 'MUL', NULL, ''

This code runs perfectly even though it has the same value for State_Title_ID:
INSERT INTO `positioncontrolv1`.`tbl_position_history`
(`position_AI_Number`,
`uconn_Position_ID`,
`data_Start_Date`,
`status_ID`,
`state_title_ID`)
VALUES
(100, 1010101, '2016-08-02',1,1);

Any suggestions on what to do here?

A: You are inserting tbl_active_position.data_End_Date (a date) into tbl_position_history.state_Title_ID (an int). MySQL will not automagically match up your field names.


text:
Q: Is there a module can be used as FindWindow API in python On Windows there is a WinAPI: FindWindow that you can use to get window handle of a existing window and use this handle to send message to it. Is there a python module can do that too? Find a window & communicate with it?
If this module do exist, could the same mechainsm be able applied on Ubuntu too?
Thanks a lot!

A: You can execute your commands with a subprocess:
import subprocess
import time

process = subprocess.Popen("echo 'start' & sleep 60 & echo 'stop'", shell=True)
time.sleep(60) # Maybe you want a timer...

The you have two options of closing, use terminate or kill methods in the Popen returned object or simulate a Ctrl. + C
import subprocess
import time

process = subprocess.Popen(cmd, shell=True)
time.sleep(5)
process.terminate() # Or kill

Simulate de ctrl + c:
import subprocess
import time
import os
import signal

process = subprocess.Popen(cmd, shell=True)
time.sleep(5)
os.kill(process.pid, signal.SIGINT) # Ctrl. + C

If you want to get the output you can use:
process.communicate()[0].strip()

Which gives you a string.
If you want a console GUI, you can use a command like:
gnome-terminal -x sh yourCommand

Or the equivalent for the terminal you have installed.


text:
Q: Write bytes from textbox to file from basestream with C# Basically I need to convert text in a textbox from UTF-8 to base16 (I think that is what hex is in) and write it to a file.
This but back words:
//Setup byte reader.
            FileStream fs = new FileStream(EditOpen.FileName, FileMode.Open);
            BinaryReader br = new BinaryReader(fs);
            long length = fs.Length;
            //Read bytes to textBox1.
            br.BaseStream.Position = 0x00001844; //Min loading address.
            byte[] PT = br.ReadBytes(0x00000428); //Amount of bytes to load (1064 to be exact).

            //Print string PT to textBox1 after converting to UTF-8 and replace 0's with DOT's.
            textBox1.Text = System.Text.Encoding.UTF8.GetString(PT).Replace("\0", ".");
            fs.Close();

A: The easiest way is to use a StreamWriter created with the correct encoding
  using(StreamWriter sw =
            new System.IO.StreamWriter(fs,
                System.Text.UTF8Encoding))
  {
     sw.Write(textBox1.Text);
  }


text:
Q: Finding companies appearing with different IDs in MS Excel I have 2 columns in my data:

*

*A - each company's unique ID.

*B - the company name that corresponds to the respective ID.

This type of data extends to 13,000 rows. For instance:
Col A  Col B
12     Google Inc
12     The Google
14     Google
18     Amazon
18     Amazon
21     Amazon INC
18     Amazon
...

As you can see from the example above, the issue is that sometimes the company has a different ID appearing. Furthermore, although in all 3 cases, the company is still the same, the fact that they've been worded differently makes it hard to do an exact match.
My goal in this exercise is two-fold:

*

*Find which companies have different IDs showing.

*Identify the row at which this happens.

It would be cumbersome to go through all 13,000 rows. What Excel formulas would do the trick?

A: You could use pivot tables to count how many duplicates each name has.
I would also:
Order the list by column B.
Add a formula in column c that compares the formula row with the previous row.
For example consider a formula in row 5:
=IF(B4=B5,"Identical","Different")

You could build in more intelligence for example compare the first word in the name in row 5 to see if it is in the row 4 name. eg
=IF(  iserror(  find(  LEFT(B5,FIND(" ",B5,1)-1)  ,B4,1)  )
   ,""
   ,"Similar")

You could combine the above tow into a single function, or may use both in different columns (which is easier)
PART 2:
The data must be ordered by column B!
So using the above logic to compare the IDs you should add another column (column F) with this formula
= find(  LEFT(B5,FIND(" ",B5,1)-1)  ,B4,1)

Then add another column (column G)
=IF(B4=B5
   , B5
   , IF(  iserror(F5)  )
       ,""
       , F5   )
   )

This results in a value in column G which is either the identical company name or the first word of a company that has a matching name.
You can then add another column (column H)  which compares the id's of rows with the same IDs
=IF(F4=F5
    , IF(A4<>A5, "Different IDS, "Ok IDs")
    , "First row in company group"
   )


text:
Q: How to update ModelState? This is a controller action that I call with ajax post method:
    [HttpPost]
    public ActionResult Add(Comment comment)
    {
        if (User.Identity.IsAuthenticated)
        {
            comment.Username = User.Identity.Name;
            comment.Email = Membership.GetUser().Email;
        }

        if (ModelState.IsValid)
        {
            this.db.Add(comment);
            return PartialView("Comment", comment);
        }
        else
        {
            //...
        }
    }

If the user is logged in, submit form doesn't have Username and Email fields, so they don't get passed by ajax call. When action gets called ModelStat.IsValid returns false, because these two properties are required. After I set valid values to properties, how do I trigger model validation to update ModelState?

A: You can try calling the built in TryUpdateModel method which returns a boolean so you can check that value.
UPDATE:  Try using TryUpdateModel with exceptions. Use a formcollection instead of Comment into the Action.
[HttpPost]
    public ActionResult Add(FormCollection collection)
    {

        string[] excludedProperties = new string[] { "Username". "Email" };
        var comment = new Comment();
        if (User.Identity.IsAuthenticated)
        {
            comment.Username = User.Identity.Name;
            comment.Email = Membership.GetUser().Email;
        }

        TryUpdateModel<Comment>(comment, "", null, excludedProperties, collection.ToValueProvider());

        if (ModelState.IsValid)
        {
            this.db.Add(comment);
            return PartialView("Comment", comment);
        }
        else
        {
            //...
        }
    }

A: You can use a custom model binder to bind the comment's Username and Email properties from User.Identity. Because binding occurs before validation the ModelState will be valid then.
Another option is to implement a custom model validator for the Comment class, that checks the ControllerContext.Controller for a validated user.
By implementing any of these options you can remove the first if check.


text:
Q: Where does eclipse keep its ANT classpath I know I can look at the Preferences dialog box, but when comparing a broken build with a working one I would like to diff the files.
So where does eclipse keep its ant settings stored. I am specifically interested in the global settings.
Running Eclipse Version: Indigo Release Build id: 20110615-0604

A: Look into your workspace\.metadata directory and search for *.launch. These are the launch configurations including ant.

A: Launch configurations (including those for Ant) can be kept in the workspace by selecting "Save as - Shared File" in the "Common" tab in the launch configuration editor.

A: The file is
workspace.metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.ant.core.prefs


text:
Q: How to using IF Statement in WHERE clause How to using IF statement in WHERE? Below code doesn't works
SELECT item.item_id,
       item.item_name,
       item.item_qty
IF(sell.product_qty IS NULL, item.item_qty, item.item_qty - SUM(sell.product_qty)),
       sell.date_order,
       sell.date_shipping
FROM item
     OUTER JOIN sell
                ON item.item_id = sell.product_item_id
WHERE NOW() BETWEEN sell.date_order AND sell.date_shipping

A: You should use CASE statement.
CASE WHEN sell.product_qty IS NULL THEN item.item_qty
ELSE item.item_qty - SUM(sell.product_qty) END


text:
Q: How do I let a parent window access my frame's content if I control the frame? I am making a little script that has to open an API window like:
var api = window.open("https://example.com", "Poppout", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=350,height=400,top="+(screen.height-400)+",left="+(screen.width-840));

when ever I try to access it like:
api.document.getElementById('ex').value;
I get the error:
Uncaught DOMException: Blocked a frame with origin "https://example.com" from accessing a cross-origin frame.
    at <anonymous>:1:5

I know why this is happening but since I'm the owner of the API's url can I enable this some way?
My index.js code:
const express = require('express');
const app = express();
const http = require('http');
const router = express.Router();
const path = require('path')
const server = http.createServer(app);
const { Server } = require("socket.io");
const i = new Server(server);

app.use(express.json());
app.use(function(req, res, next) {
   res.header("Access-Control-Allow-Origin", "*");
   res.header("Access-Control-Allow-Headers", "*");
  next();
 });
router.get('/', function(req, res) {
  res.sendFile(path.join(__dirname, '/index.html'))
});
app.use('/', router);

app.post('/', (req, res) => {
  const { chat, username } = req.body;
  console.log(username, '÷', chat)
  i.emit('chat', chat, username);
});

server.listen(3000, () => {
  console.log('listening on port: 3000');
});

A: *

*Install cors npm i cors

*import cors and use it to manage cross orign requests
const cors = require('cors');
app.use(cors());  //allow any url
app.options('*', cors())
You can also whitelist specific Urls by setting cors options Origin value:
const cors = require('cors');

const corsOptions = {
origin: [
 'https://example.com',
'https://yourURL.com',
'http://anotherURL.com
],
optionSuccessStatus:200, //for Legacy browsers

}
app.use(cors(corsOptions));
app.options('*', cors());


text:
Q: PHP - Curl - Form Issues I have a script to check if a email:password is in my site, But I want to be able to mass check this by being able to copy and paste a bunch of Email:password's into seperate lines in a textarea, when you do that and click submit it will seperate Email from the :pass aswell as pass with email: and put them into a variable and check them with curl one by one. No idea where I would start with this but for the email:pass seperation im guessing explode()?
PHP:
<?php
if(isset($_POST['email']) && isset($_POST['pass'])){

$URL = 'http://example.com/api/?checkere='.$_POST['email'].'&checkerp='.$_POST['pass'];

$ch     = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$page = curl_exec($ch);

if (strpos($page, '<title>Works</title>') !== false) {
    file_put_contents('output.txt',$_POST['email'].':'.$_POST['pass'].' is Working!');
} else {
    file_put_contents('output.txt',$_POST['email'].':'.$_POST['pass'].' is Invalid!');
}

}
?>

API:
<?php
if(isset($_GET['email']) && isset($_GET['pass'])) {

$email=$_GET['email'];
$pass=$_GET['pass'];

$url='https://example.com/Login';
$cookie="cookie.txt";

$ch2 = curl_init();
curl_setopt ($ch2, CURLOPT_URL, $url);
curl_setopt ($ch2, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch2, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31");
curl_setopt ($ch2, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch2, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt ($ch2, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch2, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch2, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch2, CURLOPT_REFERER, $url);

$result2 = curl_exec ($ch2);

curl_close($ch2);

$expA=explode('name="authURL" value="',$result2);
$expB=explode('"/>',$expA[1]);
$auth=$expB[0];

$postdata = http_build_query( array('email' => urlencode($email), 'password' => $pass, 'authURL' => urlencode($auth)));
$postdata = http_build_query( array('email' => $email, 'password' => $pass, 'authURL' => $auth, 'RememberMe' => ''));

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_REFERER, $url);

curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);

echo $result;

curl_close($ch);

}
?>

My Current HTML:
<!DOCTYPE html>

    <title>Account Checker</title>

    <?php include('../../metadata.php'); ?>

    <?php include('../../assets/css/stylesheets.php'); ?>

    <?php include('../../ui/menu.php'); ?>

    <?php include('../../ui/notifications.php'); ?>

Account Checker

    <form action="output.php" method="post">

    <input type="text" placeholder="Email" id="minime_url_textbox" name="email">

    <input type="text" placeholder="Password" id="minime_url_textbox" name="pass">
     <input name="submit" type="submit" id="submit" value="Check">

    </form>

    <?php include('../../ui/footer.php'); ?>

    <?php include('../../assets/scripts/javascript.php'); ?>

The referenced output.php in  just contains the first PHP mentioned above.
How could I do this? Couldnt find any helpful information online.


text:
Q: is it possible to view the documentation? I'd like to know if there is somethings like Javadoc but for PHP, like the documentation on the official website.
So, for example, if I wrote a function such as mysql_error, view on NetBeans this kind of documentation.

A: Yes. PHPDoc.
http://www.phpdoc.org/


text:
Q: Is this proof of L'Hospital's rule correct? Assume $f(a)=g(a)=0$, $f'(a)$ and $g'(a)$ exists, and $g'(x)$ is not zero in some neighborhood of $a$.
$$
\begin{align*}
\lim_{x\to a}\frac{f(x)}{g(x)} &= \lim_{x\to a}\frac{f(x)-f(a)}{g(x)-g(a)} \\
&= \lim_{x\to a}\frac{(f(x)-f(a))/(x-a)}{(g(x)-g(a))/(x-a)} \\
&= \frac{\lim_{x\to a}(f(x)-f(a))/(x-a)}{\lim_{x\to a}(g(x)-g(a))/(x-a)} \\
&= \frac{f'(a)}{g'(a)}
\end{align*}
$$
Most proofs I've seen are based on Rolle's theorem. I am not sure if this 'simpler' proof works or not.


text:
Q: Why is ADDITIONAL SECTION missing from my dig response? I have a couple bind servers recently upgraded to Ubuntu 16.04 (from 14.04). Cron runs dig . ns once a day to grab an updated list of Root servers used in the bind configuration.
The script run by cron checks for ADDTIONAL SECTION in the output to determine if the query failed. It's been failing since the upgrade because section is no longer being returned. Anyone know what's up with this? I've not turned up anything specific on google yet.
on 14.04 dig returns this
# dig . ns
; <<>> DiG 9.9.5-3ubuntu0.19-Ubuntu <<>> . ns
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1492
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 27

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 900
;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       73048   IN      NS      e.root-servers.net.
.                       73048   IN      NS      b.root-servers.net.
.                       73048   IN      NS      j.root-servers.net.
.                       73048   IN      NS      d.root-servers.net.
.                       73048   IN      NS      m.root-servers.net.
.                       73048   IN      NS      k.root-servers.net.
.                       73048   IN      NS      g.root-servers.net.
.                       73048   IN      NS      l.root-servers.net.
.                       73048   IN      NS      c.root-servers.net.
.                       73048   IN      NS      i.root-servers.net.
.                       73048   IN      NS      h.root-servers.net.
.                       73048   IN      NS      a.root-servers.net.
.                       73048   IN      NS      f.root-servers.net.

;; ADDITIONAL SECTION:
a.root-servers.net.     222215  IN      A       198.41.0.4
a.root-servers.net.     308618  IN      AAAA    2001:503:ba3e::2:30
b.root-servers.net.     73048   IN      A       199.9.14.201
b.root-servers.net.     73048   IN      AAAA    2001:500:200::b
c.root-servers.net.     308618  IN      A       192.33.4.12
c.root-servers.net.     308618  IN      AAAA    2001:500:2::c
d.root-servers.net.     73048   IN      A       199.7.91.13
d.root-servers.net.     73048   IN      AAAA    2001:500:2d::d
e.root-servers.net.     73048   IN      A       192.203.230.10
e.root-servers.net.     73048   IN      AAAA    2001:500:a8::e
f.root-servers.net.     73048   IN      A       192.5.5.241
f.root-servers.net.     75235   IN      AAAA    2001:500:2f::f
g.root-servers.net.     308618  IN      A       192.112.36.4
g.root-servers.net.     75235   IN      AAAA    2001:500:12::d0d
h.root-servers.net.     308618  IN      A       198.97.190.53
h.root-servers.net.     312215  IN      AAAA    2001:500:1::53
i.root-servers.net.     73048   IN      A       192.36.148.17
i.root-servers.net.     75235   IN      AAAA    2001:7fe::53
j.root-servers.net.     73048   IN      A       192.58.128.30
j.root-servers.net.     75235   IN      AAAA    2001:503:c27::2:30
k.root-servers.net.     73048   IN      A       193.0.14.129
k.root-servers.net.     75235   IN      AAAA    2001:7fd::1
l.root-servers.net.     73048   IN      A       199.7.83.42
l.root-servers.net.     75235   IN      AAAA    2001:500:9f::42
m.root-servers.net.     73048   IN      A       202.12.27.33
m.root-servers.net.     75235   IN      AAAA    2001:dc3::35

;; Query time: 1 msec
;; SERVER: 192.168.136.183#53(192.168.136.183)
;; WHEN: Thu Feb 28 09:31:26 CST 2019
;; MSG SIZE  rcvd: 811

On 16.04 dig returns this
# dig . ns
; <<>> DiG 9.10.3-P4-Ubuntu <<>> . ns
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57497
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       55229   IN      NS      j.root-servers.net.
.                       55229   IN      NS      a.root-servers.net.
.                       55229   IN      NS      h.root-servers.net.
.                       55229   IN      NS      b.root-servers.net.
.                       55229   IN      NS      d.root-servers.net.
.                       55229   IN      NS      i.root-servers.net.
.                       55229   IN      NS      c.root-servers.net.
.                       55229   IN      NS      m.root-servers.net.
.                       55229   IN      NS      g.root-servers.net.
.                       55229   IN      NS      l.root-servers.net.
.                       55229   IN      NS      f.root-servers.net.
.                       55229   IN      NS      e.root-servers.net.
.                       55229   IN      NS      k.root-servers.net.

;; Query time: 1 msec
;; SERVER: 192.168.32.4#53(192.168.32.4)
;; WHEN: Thu Feb 28 09:30:41 CST 2019
;; MSG SIZE  rcvd: 239

Updated: 16.04 with +additional
# dig . ns +additional

; <<>> DiG 9.10.3-P4-Ubuntu <<>> . ns +additional
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32682
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       402756  IN      NS      l.root-servers.net.
.                       402756  IN      NS      h.root-servers.net.
.                       402756  IN      NS      j.root-servers.net.
.                       402756  IN      NS      b.root-servers.net.
.                       402756  IN      NS      e.root-servers.net.
.                       402756  IN      NS      g.root-servers.net.
.                       402756  IN      NS      m.root-servers.net.
.                       402756  IN      NS      f.root-servers.net.
.                       402756  IN      NS      d.root-servers.net.
.                       402756  IN      NS      a.root-servers.net.
.                       402756  IN      NS      c.root-servers.net.
.                       402756  IN      NS      k.root-servers.net.
.                       402756  IN      NS      i.root-servers.net.

;; ADDITIONAL SECTION:
a.root-servers.net.     107396  IN      A       198.41.0.4

;; Query time: 0 msec
;; SERVER: 192.168.32.4#53(192.168.32.4)
;; WHEN: Wed Mar 06 09:57:10 CST 2019
;; MSG SIZE  rcvd: 255


text:
Q: How to synchronize processes through a static library on Linux? I have a homework project that require the creation of a STATIC library to provide mutual access to a couple of named pipes.
These pipes are used for communication between various clients using the library and a server.
Now, suppose I want to use pthread mutexes; how can I achieve that? How can the processes know which is the shared memory area in which the mutex is stored? And who should require this memory area?  The server can't because it's required the library itself to provide mutual exclusion.
Thanks to asveikau i came up with this:
#define SHARED 1
#define MUTEX 1

int main() {

    sem_t* mutex = sem_open("mutex", O_CREAT);

    sem_init(mutex, SHARED, MUTEX);

    fork(), fork(), fork();

    sem_wait(mutex);

    int i;
    for(i = 0; i < 10; i++)
        printf("process %d %d\n", getpid(), i), fflush(stdout);

    sem_post(mutex);
}

that from the output really seem to solve my problem.
Thank you to everyone.

A: I put this down as a comment, but it's worth an answer I think.
As others state, pthread mutexes are not cross-process.  What you need is a "named mutex".  You can use sem_open to create a cross-process semaphore, and give it an initial count of 1.  In that case sem_wait becomes "mutex lock" and sem_post becomes "mutex unlock".
Note that sem_open, while part of POSIX, is not universally supported.  I believe it works on Linux and Mac OS X.  Probably Solaris if you care about that (these days you probably don't).  I know on OpenBSD it always fails with ENOSYS.  YMMV.


text:
Q: Failure to project shapefile to Mass State Plane NAD83 (meters) SRS with ArcMap I am working with a shapefile that I have not been able to project to the Mass State Plane NAD83 meters (i.e., EPSG:26986) SRS using ArcMap's "Project" tool. The "Project" tool reports that "no datum conversion" is available between the SRS of the shapefile and EPSG:26968.
Taking a look at the parameters of the shapefile's SRS using ArcMap, gives the following:

*

*Projected Coordinate System: NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001

*Projection: Lambert_Conformal_Conic

*False_Easting: 200000.00000000

*False_Northing: 750000.00000000

*Central_Meridian: -71.50000000

*Standard_Parallel_1: 41.71666667

*Standard_Parallel_2: 42.68333333

*Latitude_Of_Origin: 41.00000000

*Linear Unit: Meter

*Geographic Coordinate System: GCS_GRS_1980

*Datum: D_GRS_1980

*Prime Meridian: Greenwich

*Angular Unit: Degree

This looks weird. I've never seen an SRS that looks like this one. It seems as though the shapefile has two (different) notions of which datum its SRS is using: NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001 (see first bold text, above), and D_GRS_1980 (second bold text, above.)
As-is this shapefile, or at least its geometry, is useless for my purposes. ArcMap cannot correctly overlay it (using on-the-fly projection) with other data I'm using, and thus none of the geoprocessing tools will work correctly with it (e.g., spatial join with another dataset.) When an attempt is made to overlay this data with other data in ArcMap (using its on-the-fly projection mechanism), the shapefile data is way off from "ground truth", usually by around 40 meters.
This suggests some kind of datum mismatch to me, but it appears to be one that ArcMap is not capable of reconciling.
How can I project this shapefile to some well-defined, well-known SRS?
EPSG:26986 would be ideal, but I will settle for any other SRS that allows the data to subsequently be projected to EPSG:26986.
I have tried to get a handle on the origin of this problematical shapefile, but haven't been able to turn up much. It dates back possibly as long as 10 years, and the person/people who created it may or may not be around/available to answer questions. My best understanding is that it is the result of importing some data in EPSG:26986 (specifically, the Massachusetts state Road Inventory) into a transportation demand modeling tool called TransCAD.

A: Problem solved: Although I've not be able to track down the person who imported this data into TransCAD, I was able to get in touch with the person who exported this data from TransCAD, and walked through the choices available in the TraansCAD export dialog with him. I suggested selecting "No datum transformation" under "choice of datum" (or however exactly the combo box in question was labeled.) The resulting shapefile lines up perfectly with the other datasets we're working with in this project.
Thanks to everyone who chimed in with suggestions and/or advice.

A: Here's my suggestion (without knowing exactly where [pun intended] you got the shapefile from.)
Outside of ArcGIS Desktop

*

*Copy the shapefile and all related files to a new folder so we don't mess anything up

*Delete the prj file from that new folder so the Shapefile appears to have an unknown projection

Inside of ArcGIS Desktop

*Use the Toolbox to find the Define Projection command and open it

*Point the tool to your shapefile in the new folder

*Finish running the tool to apply your 'correct' Stateplane projection by finding it in the dropdown lists
(I presume this is the one you want?)

*Test out how the shapefile behaves after the redefining of the projection goes


text:
Q: URL encoding is getting failed for special character. #Android I'm working on a solution where need to encode string into utf-8 format, this string nothing but device name that I'm reading using BluetoothAdapter.getDefaultAdapter().name.
For one of sampple I got a string like ABC-& and encoding this returned ABC-%EF%BC%86 instead of ABC-%26. It was weird until further debugging which helped to identify that there is difference between & and &. Second one is some other character which is failing to encoded as expected.
& and & both are different.
For encoding tried both URLEncoder.encode(input, "utf-8") and Uri.encode(input, "utf-8") but nothing worked.
This is just an example, there might be other character which may look like same as actual character but failed to encode. Now question are:

*

*Why this difference, after all it is reading of some data from device using standard SDK API.

*How can fix this be fixed. Find and replace with actual character could be a approach but scope is limited, there might be other unknown character.

Any suggestion around !!

A: One solution would be to define your allowed character scope. Then either replace or remove the characters that fall outside of this scope.
Given the following regex:
[a-zA-Z0-9 -+&#]

You could then either do:
input.replaceAll("[a-zA-Z0-9 -+&#]", "_");

...or if you don't care about possibly empty results:
input.replaceAll("[a-zA-Z0-9 -+&#]", "");

The first approach would give you a length-consistent representation of the original Bluetooth device name.
Either way, this approach has worked wonders for me and my colleagues. Hope this could be of any help .


text:
Q: Autorun batch file through eject command Is it possible for a batch script on my local machine (e.g. in D:\ Batch files\1.bat) to run after I insert or eject a USB drive?

A: Preliminaries:

*

*Right-click Computer icon, select Manage, go to Services,
select Windows Driver Foundation - User-mode Driver Framework and make sure it's running and its Startup Type is set to Automatic or Automatic (Delayed Start).

Now go to Task Scheduler:

*

*Make a new task, name it MyCoolBatch on USB-connect.

*On Triggers tab add a new trigger:

*

*On an event in the first dropdown box

*Microsoft-Windows-DriverFrameworks-UserMode/Operational in the Log dropdown

*DriverFrameworks-UserMode in the Source

*2003 in the Event ID (this is USB connect event)

*On Actions tab make a new action and select your batch file.
You can add a parameter like plugged.
Repeat steps 1-3 with an Event ID 2100 (the USB disconnect event) and a batch file parameter like ejected so, assuming the same batch file is used, you can check if device was connected/ejected:
if "%1"=="plugged" .........
if "%1"=="ejected" .........

Based on The Windows 7 Event Log and USB Device Tracking article.


text:
Q: How to make cruisecontrol only build one project at a time I have just set up cruise control.net on our build server, and I am unable to find a setting to tell it to only build one project at a time.
Any ideas?

A: If you are using CruiseControl 1.3 or later you can use an Integration Queue
These allow you to control which projects can be built concurrently and which must be serialized.


text:
Q: SQLAlchemy how do I copy an auto-incrementing primary key column? It seems like a bit of a workaround to commit changes, query the database for the key, and insert it somewhere else.
I assumed one should use the synonym() function for this, but it doesn't seem to have any effect, i.e. my synonymous column doesn't exist when querying the database afterwards.
E.g.
class MyClass(Base):
    __tablename__ = 'my_table'

    id = Column(Integer, primary_key=True, autoincrement=True)
    job_status = Column(String(50))

    other_id = synonym("id")


text:
Q: error Execution failed for task ':app:kaptDemoProductionDebugKotlin'.? I am getting the following exception below:
C:\Users\admin\Desktop\masters\app\build\tmp\kapt3\stubs\demoProductionDebug\com\empowered\healo\ui\adapters\HistoryQuestionAdapter.java:155:
error: incompatible types: possible lossy conversion from long to int @android.support.annotation.IntDef(value = {1L, 0L})

Below is my Logcat:
3:55:52 PM: Executing task 'assembleDebug'...

Executing tasks: [assembleDebug]

NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to C:\Users\admin\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to C:\Users\admin\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
:app:checkDemoProductionDebugClasspath UP-TO-DATE
:app:preBuild UP-TO-DATE
:errorcheckmodule:preBuild UP-TO-DATE
:errorcheckmodule:preDebugBuild UP-TO-DATE
:errorcheckmodule:checkDebugManifest UP-TO-DATE
:errorcheckmodule:processDebugManifest UP-TO-DATE
:app:preDemoProductionDebugBuild UP-TO-DATE
:errorcheckmodule:compileDebugAidl NO-SOURCE
:app:compileDemoProductionDebugAidl NO-SOURCE
:errorcheckmodule:packageDebugRenderscript NO-SOURCE
:app:compileDemoProductionDebugRenderscript UP-TO-DATE
:app:checkDemoProductionDebugManifest UP-TO-DATE
:app:generateDemoProductionDebugBuildConfig UP-TO-DATE
:app:mainApkListPersistenceDemoProductionDebug UP-TO-DATE
:app:mergeDemoProductionDebugShaders UP-TO-DATE
:app:compileDemoProductionDebugShaders UP-TO-DATE
:app:generateDemoProductionDebugAssets UP-TO-DATE
:errorcheckmodule:mergeDebugShaders UP-TO-DATE
:errorcheckmodule:compileDebugShaders UP-TO-DATE
:errorcheckmodule:generateDebugAssets UP-TO-DATE
:errorcheckmodule:packageDebugAssets UP-TO-DATE
:app:mergeDemoProductionDebugAssets UP-TO-DATE
:app:processDemoProductionDebugGoogleServices
Parsing json file: C:\Users\admin\Desktop\masters\app\google-services.json
:app:createDemoProductionDebugCompatibleScreenManifests UP-TO-DATE
:app:processDemoProductionDebugManifest
:app:fabricGenerateResourcesDemoProductionDebug
:app:generateDemoProductionDebugResValues UP-TO-DATE
:app:generateDemoProductionDebugResources UP-TO-DATE
:errorcheckmodule:compileDebugRenderscript UP-TO-DATE
:errorcheckmodule:generateDebugResValues UP-TO-DATE
:errorcheckmodule:generateDebugResources UP-TO-DATE
:errorcheckmodule:packageDebugResources UP-TO-DATE
:app:mergeDemoProductionDebugResources
C:\Users\admin\Desktop\masters\app\build\intermediates\incremental\mergeDemoProductionDebugResources\merged.dir\values\values.xml:2601: warn: multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?.
C:\Users\admin\Desktop\masters\app\build\intermediates\incremental\mergeDemoProductionDebugResources\merged.dir\values\values.xml:2674: warn: multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?.
C:\Users\admin\Desktop\masters\app\build\intermediates\incremental\mergeDemoProductionDebugResources\merged.dir\values\values.xml:2675: warn: multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?.

:app:splitsDiscoveryTaskDemoProductionDebug UP-TO-DATE
:errorcheckmodule:generateDebugRFile UP-TO-DATE
:app:processDemoProductionDebugResources
error: string too large to encode using UTF-8 written instead as 'STRING_TOO_LARGE'.

:errorcheckmodule:generateDebugBuildConfig UP-TO-DATE
:errorcheckmodule:prepareLintJar UP-TO-DATE
:errorcheckmodule:generateDebugSources UP-TO-DATE
:errorcheckmodule:javaPreCompileDebug UP-TO-DATE
:errorcheckmodule:compileDebugJavaWithJavac UP-TO-DATE
:errorcheckmodule:processDebugJavaRes NO-SOURCE
:errorcheckmodule:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:app:kaptGenerateStubsDemoProductionDebugKotlin UP-TO-DATE
e: C:\Users\admin\Desktop\masters\app\build\tmp\kapt3\stubs\demoProductionDebug\com\empowered\healo\ui\adapters\HistoryQuestionAdapter.java:155: error: incompatible types: possible lossy conversion from long to int
    @android.support.annotation.IntDef(value = {1L, 0L})
                                                ^
e: C:\Users\admin\Desktop\masters\app\build\tmp\kapt3\stubs\demoProductionDebug\com\empowered\healo\ui\adapters\HistoryQuestionAdapter.java:155: error: incompatible types: possible lossy conversion from long to int
    @android.support.annotation.IntDef(value = {1L, 0L})
                                                    ^
:app:kaptDemoProductionDebugKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:kaptDemoProductionDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 29s
33 actionable tasks: 6 executed, 27 up-to-date
3:56:22 PM: Task execution finished 'assembleDebug'.

A: Check this first for your lossy primitives types: https://stackoverflow.com/a/51632153/3460038
Then for your NDK issues check there : https://stackoverflow.com/a/42324530/3460038


text:
Q: Why JavaScript function not fired when a check changed is triggered in the browser's console? I am new to JavaScript/jQuery, while learning I found something strange for me. Basically, I have a function that capture the checkbox check state.
HTML
<input type="checkbox" id="accs" class="forsummary" name="Accessory">

jQuery
$(document).on('change keyup keypress','.forsummary',function(){

  if ($(this).prop("checked") == true) {
      console.log("This is checked");
  }else{
     console.log("This is unchecked");
  }

});

this code works when the trigger is done within the website, But when I run this code In the browser's console, the function is not fired:
$('#accs').prop('checked', false);

Can anyone provide me the simplest explanation? Thanks.

A: the problem is you add wrong selector filter to jquery on.you set a none exists class .forsummary selector.I chagne it to #accs,it works.you can run my code to test it

$(document).on('change keyup keypress','.forsummary',function(){

  if ($(this).prop("checked") == true) {
      console.log("This is checked");
  }else{
     console.log("This is unchecked");
  }

});
setTimeout(function(){
$("#accs").trigger("click")
console.log("trigger")
},1000)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<input type="checkbox" id="accs" class="forsummary" name="Accessory">

A: I just checked, what @Barmar mentioned works quite well only thing is I fired the event using click that will anyway make a change

A:

$(".forsummary").change(function() {
  if($(this).prop("checked")){
    console.log('true');
  }else{
  console.log('false');
  }
});

setTimeout(function(){
$("#accs").trigger("click");
},1000);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="checkbox" id="accs" class="forsummary" name="Accessory">

A: You can try between them

document.querySelector('.forsummary').addEventListener('change', function (el) {
  if (el.target.checked) {
    console.log("This is checked");
  }else{
    console.log("This is unchecked");
  }
});
<input type="checkbox" id="accs" class="forsummary" name="Accessory">

function checkbox_status (el) {
  if (el.checked) {
    console.log("This is checked");
  }else{
    console.log("This is unchecked");
  }
}
<input type="checkbox" onchange="checkbox_status(this)" name="Accessory">


text:
Q: Does the entropy of a real gas increase or decrease as compared to the entropy of ideal gas when the gas compartment is expanded so $V_f > V_i$ so i know the derived equation for change in entropy of a real gas but im struggling to understand how to compare that to the change in entropy for an ideal gas to answer the above question

A: The partial derivative of entropy with respect to pressure for an arbitrary substance is given by $$\left(\frac{\partial S}{\partial V}\right)_T=\left(\frac{\partial P}{\partial T}\right)_V$$For an ideal gas, this reduces to $$\left(\frac{\partial S}{\partial V}\right)_T=\frac{R}{V}$$What is it for a van der Waals gas? I get:$$\left(\frac{\partial S}{\partial V}\right)_T=\frac{R}{V-b}$$So, for a real gas, the entropy change is greater than an ideal gas.
ADDENDUM FOR BOB D
At constant pressure, $$dS=\frac{C_p}{T}dT$$
and
$$dP=\left(\frac{\partial P}{\partial T}\right)_VdT+\left(\frac{\partial P}{\partial V}\right)_TdP=0$$So, $$\left(\frac{\partial T}{\partial V}\right)_P=-\frac{\left(\frac{\partial P}{\partial V}\right)_T}{\left(\frac{\partial P}{\partial T}\right)_V}$$Therefore, at constant pressure, $$dS=-\frac{C_p}{T}\frac{\left(\frac{\partial P}{\partial V}\right)_T}{\left(\frac{\partial P}{\partial T}\right)_V}dV$$For a van der Waals gas at constant pressure, this reduces to:  $$dS=\frac{C_p}{(V-b)}\left[1-\frac{2a(V-b)^2}{RTV^3}\right]dV$$
For a real gas, the relationship between the heat capacity at constant pressure and the heat capacity at constant volume is given by:
$$C_p=C_v+T\left(\frac{\partial P}{\partial T}\right)_V\left(\frac{\partial V}{\partial T}\right)_P=C_v-T\frac{\left(\frac{\partial P}{\partial T}\right)_V^2}{\left(\frac{\partial P}{\partial V}\right)_T}$$For the van der Waals model of a real gas, this reduces to:
$$C_p=C_v+R+R\frac{\xi}{1-\xi}$$where $$\xi=\frac{2a(V-b)^2}{RTV^3}$$For a van der Waals gas we can also show that the heat capacity at constant volume is equal to the ideal gas heat capacity at constant volume $C_v^{IG}$, independent of gas volume or pressures.  Therefore, $$C_p=C_p^{IG}+R\frac{\xi}{1-\xi}$$So for the van der Waals model, the heat capacity at constant volume is higher than the value in the ideal gas limit.
So for the van der Waals model at constant pressure, the variation of entropy with volume is given by combining previous equations to obtain:
$$dS=\frac{C_p^{IG}+R\frac{\xi}{1-\xi}}{(V-b)}\left[1-\xi\right]dV$$
Therefore, for the van der Waals model at constant pressure, this result indicates that the ratio of the real gas entropy change to that of an ideal gas can greater or less than unity, depending on the specific values of the parameters involved.


text:
Q: Proof that if $p \mid G$ and $G$ is finite abelian it has an element of order $p$ I want to prove the following lemma.

Let $p$ be a prime number and $G$ a finite abelian group such that $p\mid\#G$, then $G$ has an
  element of order $p$.

Here's the proof my professor presented.
Let $|G|=pm$ for some $m\in\mathbb{N}$. We will prove the result
by induction on $m$.
The base case, $m=1$, is clear (every group of prime order is cyclic).
For the inductive step, choose $x\in G$ such that $\text{ord}(x)=t>1$.
If $p\mid t$ (don't we need to require that $p\neq t$?), then $\text{ord}\big((x^{\frac{t}{p}})^{p}\big)=1$ which implies that
$\text{ord}(x^{\frac{t}{p}})=p$, and we are done.
Now suppose that $p\nmid t$. Since $G$ is a abelian then every subgroup
is normal, in particular $\langle x\rangle\trianglelefteq G$ and
$|G/\langle x\rangle|=\frac{pm}{t}$.
By hypothesis, $\exists y\in G$
such that $\text{ord}(y\langle x\rangle)=p$. (why?) Since for the homomorphism
$f:G\rightarrow G/\langle x\rangle$ we have that $\text{ord}\big(f(y)\big)\mid \text{ord}(y)$
it follows that $\text{ord}(y\langle x\rangle)=p\mid \text{ord}\;y$ and we go
back to the case where $p$ divides the order or a nontrivial element
of $G$.

My questions:
1) the first questions appear in bold in the above text.
2) I don't really get the structure of this induction proof. When the inductive step is presented I don't see in what way we assume that the results holds for $m$ and how we show it is true for $m+1$.
My apologies if these questions are too basic but I am a former physics student and lack some background and experience with proofs.

A:
don't we need to require that $p \neq t$?

Not that I can see from your argument. If $\operatorname{ord}(x) = p$, then there is nothing to prove. That said, the way you currently have structured your argument, you will need to ensure $p \nmid t$ when applying the inductive hypothesis to the group $G / \langle x \rangle$.
One way around this would be to replace your current definition of $x$ with something more specific. For instance, you could say

Choose any $x \in G \setminus \{ 1 \}$. If $p \mid \operatorname{ord}(x)$, say $\operatorname{ord}(x) = pq$ for $q \in \mathbb{N}$, then by definition $y = x^q \in G$ is an element of order $p$. Conversely, suppose $p \nmid \operatorname{ord}(x)$ [$\ldots$]

and take things from there. This seems to be what you mean, but calling out the two possible cases more explicitly goes a long way towards clarifying the rest of the argument (for both the reader and you!).

By hypothesis, $\exists y \in G$ such that $\operatorname{ord}(y\langle x\rangle)=p \operatorname{ord}(y\langle x\rangle)=p$. (why?)

If you assume $p \nmid t$, then this is because $|G/\langle x \rangle|$ is of the form $pm'$ where $m' < m$ (and so the inductive hypothesis applies).
Regarding your last question: It sounds like you're assuming that this is a proof by weak induction, when this is really a proof by strong induction. Suppose $P$ is a property of the natural numbers, and you know that $P(1)$ is true. The difference in proving that $P(N)$ is true for all $N \in \mathbb{N}$ using weak and strong induction is the following:

*

*Using weak induction, you assume for a fixed $N \in \mathbb{N}$ that $P(N)$ holds and show that this implies $P(N + 1)$.

*Using strong induction, you assume for a fixed $N \in \mathbb{N}$ that $P(n)$ holds for all $n \leq N$ and show that these statements together imply $P(N + 1)$ holds.

See this set of notes for examples of both types of proofs. Each of these is a valid form of induction.
Your proof relies on strong induction, and you can see this from how you apply your inductive hypothesis. First, you choose an arbitrary $x \in G$ with $x \neq 1$ and $p \nmid t := \operatorname{ord}(x)$. You then apply the inductive hypothesis to the group $G/\langle x \rangle$. Supposing that $|G/\langle x \rangle| = pk$, you don't know the value of $k$, since you don't know enough about $x$. All you know is that it is less than $m$ where $|G| = pm$. To cover all bases, you have to assume the claim holds for all finite abelian groups of order $pn$ for $n < m$, not just for those of order $p(m - 1)$.

A: 1) If $p=t$, $t/p=1$, so $x$ has order $p$ anyway and is the element we want.
2) Your second piece of bold is where the inductive step is used: the key point is that $G/\langle x \rangle$ is a group of order $pm/t$, and if $p \not\mid t$, then there is an integer $n$, smaller than $m$, so that $pm/t = pn$. The induction hypothesis then says the group $G/\langle x \rangle$ has an element of order $p$; and then the structure of the quotient group means that there is $y \in G$ so that this element can be written as $y\langle x \rangle$.


text:
Q: Kubuntu 20 LTS - Wifi stopped working I have a problem: My Wifi suddenly stopped working correctly overnight (without me updating in the meantime).
Mon Laptop: MSI Modern 14 A10M.
I've had this PC since the end of July, and my WiFi had always worked until now.
But I turned on my PC one morning, and the wifi didn't work.
And when I do:
sudo rfkill list
I have this:
0: hci0: Bluetooth
  Soft blocked: no
  Hard blocked: no

Whereas before (when my wifi is working) I had this:
0: hci0: Bluetooth
  Soft blocked: no
  Hard blocked: no
1: phy0: Wireless LAN
  Soft blocked: no
  Hard blocked: no

Then then by doing this:
sudo modprobe -r iwlwifi
sudo modprobe iwlwifi

My Wifi had started working again...
But sometimes my Wifi stops working again (and I have to retype the "modprobe" command lines each time to make it work again temporarily...).
_Do you know what could have triggered my problem please?
_Do you know how I can correct this problem please?
Thank you in advance.

A: With this command :
sudo journalctl -p 3 -xb
I have this :
-- Logs begin at Wed 2020-09-23 12:42:14 EEST, end at Tue 2020-12-29 11:40:27 EET. --
déc. 29 11:39:59 msi-14 kernel: ACPI BIOS Error (bug): Could not resolve symbol [^^^RP09.PEGP], AE_NOT_FOUND (20200528/psargs-330)
déc. 29 11:39:59 msi-14 kernel: ACPI Error: Aborting method \_SB.PCI0.LPCB.EC._QD3 due to previous error (AE_NOT_FOUND) (20200528/psparse-529)
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: SecBoot CPU1 Status: 0x55ac, CPU2 Status: 0x3
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: UMAC PC: 0x8047cb2c
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: LMAC PC: 0x1423a
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: Loaded firmware version: 55.d9698065.0 QuZ-a0-jf-b0-55.ucode
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | ADVANCED_SYSASSERT
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | trm_hw_status0
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | trm_hw_status1
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | branchlink2
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | interruptlink1
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | interruptlink2
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | data1
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | data2
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | data3
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | beacon time
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | tsf low
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | tsf hi
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | time gp1
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | time gp2
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | uCode revision type
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | uCode version major
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | uCode version minor
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | hw version
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | board version
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | hcmd
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | isr0
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | isr1
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | isr2
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | isr3
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | isr4
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | last cmd Id
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | wait_event
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | l2p_control
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | l2p_duration
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | l2p_mhvalid
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | l2p_addr_match
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | lmpm_pmg_sel
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | timestamp
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: 0x00000000 | flow_handler
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: Start IWL Error Log Dump:
déc. 29 11:40:00 msi-14 kernel: iwlwifi 0000:00:14.3: Status: 0x00000000, count: 7

A laptop without WiFi is very annoying.
I would point out that my WiFi had always worked from the end of July 2020 until the beginning of December.
I would also like to point out that I have SecureBoot disabled in my BIOS, and that I haven't updated the BIOS in the meantime.
PS: For a try, I upgraded Kubuntu 20.04 to 20.10, it didn't solve my problem.
And when I boot my PC on a bootable USB stick, I have the same problem ...
Any Ideas please?


text:
Q: Smallest offset so that the Rips complex is always a subcomplex of the Cech complex. Let $X$ be a finite set of points in $\mathbb R^n$.
For $\epsilon >0$, let $\mathcal R_\epsilon (X)$ and $\mathcal C_\epsilon (X)$ be the Rips and Cech complexes on $X$, respectively.
It's well-known the Cech complex is always a subcomplex of the Rips complex, but when is the Rips complex a subcomplex of the Cech complex?
In other words, what is the smallest $\delta > 0$ (as a function of $n$) such that $\mathcal C_\delta (X)$ is a subcomplex of $\mathcal R_\epsilon (X)$ for all $\epsilon >0$?
(This appears as a bonus problem in Problem Set 1 of Vidit Nanda's Computational Algebraic Topology course)
Well, for the Rips complex to be a subcomplex we would need that wherever a subset of $k$ points are pairwise at most $\epsilon$ distance apart from each other, the balls of radius $\delta$ around those points have nonempty intersection.
Nanda specifies in the question that $\delta$ is a function of $n$, which I don't quite understand the relevance of.

A: De Silva and Ghrist showed in "Coverage in sensor networks via persistent homology" (theorem 2.5) that if $X \subseteq \mathbb{R}^n$, then $$\mathcal{R}_{\epsilon'}(X) \subseteq \mathcal{C}_\epsilon(X) \subseteq \mathcal{R}_\epsilon(X)$$ whenever $\epsilon \geq \epsilon' \sqrt{\frac{2n}{n+1}}$, and that this constant is optimal in general (in fact, attained by points on a regular $n$-simplex).


text:
Q: How can I speed up this Data Explorer query? I have the following Data Explorer query which attempts to compute the number of characters per reputation sorted in descending order for each user. Think of it as a silly level of effort metric. Who typed the most number of characters for each reputation point earned? Just a fun little comparison.
select top 10    /* 100 would be better */
    u.Id,
    u.DisplayName,
    min(u.Reputation) as Reputation,
    sum(len(p.Body)) as TotalLength,
    count(*) as TotalPosts,
    avg(len(p.Body)) as AvgPostLength,
    (cast(sum(len(p.Body)) as float) / cast(min(u.Reputation) as float)) as PostLengthPerReputation
from
    Posts p
    inner join Users u ON u.Id = p.OwnerUserId
where
    u.Reputation > 100000   /* 1000 would be better */
group by
    u.Id, u.DisplayName
order by
    PostLengthPerReputation desc

The problem is that I would like to do a top 10 (or even 100) for users above say 10,000 or even 1,000 reputation, but the query will timeout. I did get it to return for users with reputation > 100,000, but that is not very interesting. Anyone have any ideas on how to get this to work?

A: As indicated in the comments Jardanel27 forked the query and moved the WHERE into the join, as suggested by ConcernedOfTunbridgeWells
SELECT TOP 100
    u.Id AS [User Link],
    min(u.Reputation) as Reputation,
    sum(len(p.Body)) as TotalLength,
    count(*) as TotalPosts,
    avg(len(p.Body)) as AvgPostLength,
    (cast(sum(len(p.Body)) as float) / cast(min(u.Reputation) as float)) as PostLengthPerReputation
FROM
    Posts p
    INNER JOIN Users u ON u.Id = p.OwnerUserId
    AND u.Reputation > 1000
GROUP BY
    u.Id
ORDER BY
    PostLengthPerReputation DESC


text:
Q: jquery input detection after tirgger key for online pos im writing a php pos system for my store, and im dealing with the barcode system now.
basically i want to be able to monitor the window, and when the barcode comes in put it in the input search box and submit it.
the 2nd part is the easy part, im having difficulty with the first part.
i made the scanner append te pipeline charecter (|) to the barcode, and i have jquery monitoring the window for any key presses that are pipeline, but how would i read the key presses after the pipeline once its triggered? maybe i have the wrong approach to this..?

A: Last time I built something like that, the page had a big fat <input> element, that was auto-focused. Your scanner acts as a keyboard, with the exception of pasting the string in one event, rather then emitting a key-events for each distinct character. (at least that was the case with our scanners).
add an <input> element, focus it. When your scanner sends a code, it will be written into the <input>. There you can react to keyup or change events to see if the code was written completely and then react accordingly. In our case, a newline (\n) was appended to the code to mark its end. But I guess a pipe (|) would be just fine as well.


text:
Q: jQuery 1.5.1 Sizzle 'cannot read property nodename' child '>' selector with knockoutjs I'm using jQuery 1.5.1 and Knockoutjs 2.0.0.  My situation's a little bit complicated, but as I understand it here's what's happening:
I have some elements bound to Knockoutjs that also have jQuery.live bindings.  Some of these bindings contain the child (parent?) selector '>'.  When I remove the element (using Knockout), I get this error:

Uncaught TypeError: Cannot read property 'nodeName' of null

thrown by the following code in jQuery:
">": function (checkSet, part) {
  ...
    for (; i < l; i++) {
      elem = checkSet[i];

      if (elem) {
        var parent = elem.parentNode;
        checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
        //Uncaught TypeError: Cannot read property 'nodeName' of null
      }
    }
 ...

It seems Knockout is removing elements from the document before jQuery gets around to checking the live bindings, so when the element is finally checked its parent is null, and this error is thrown.
My question:
Where/how would people recommend I fix this?  I was thinking something like this:
var parent = elem.parentNode;
checkSet[i] = parent && parent.nodeName.toLowerCase() === part ? parent : false;

Seems like the '>' selector should fail if the parent is null, but I could be wrong about that.  What would you guys do?
UPDATE:
JSFiddle demonstrating the issue (try removing a table row):
This only happens when I use one of the selectors below for my .live binding.  Using only one class in the :not selector causes the bug to disappear.
'.grid:not(.anything, .anythingelse) > tbody > tr'
'.grid:not(.anything, .anythingelse) tbody > tr'

A: The reason why the bug seems to disappear when you pass one class to :not() is because it then becomes a valid CSS3 selector, so it's being passed to querySelectorAll(), skipping Sizzle altogether. See this question for details.
I'm not sure if the behavior you're seeing with > is a bug with Sizzle, and if so whether it has been addressed (as of jQuery 1.8), but since a CSS selector is guaranteed to work as close to the spec as a browser can promise then I can only suggest using the workaround that you have.


text:
Q: Styling combobox dropdown in windows store apps (XAML) I'm trying to style the ComboBox control in XAML but haven't managed to style the colors in the dropdown/popup. The ComboBox seem to contain a ScrollViewer so I'm trying to style that. The items in the ScrollViewer is generated using a ContentTemplate and I guess I need to style it somehow.

A: Check this default system brush. You can customize these colors by adding below line in resource dictionary.
<SolidColorBrush x:Key="ComboBoxArrowForegroundThemeBrush" Color="MY_COLOR_HEX_CODE"/>


text:
Q: Evaluating $\int_0^n \{x^2\}\,\text{d}x$ I have problems with the series that appear evaluating this integral $$\int_0^n \{x^2\}\,\text{d}x$$ where $\{\cdot\}$ is the fractional part function. Now, I'm pretty sure that $$I=\sum_{k=0}^{n^2-1}\int_\sqrt k^\sqrt{k+1} (x^2-k)\,\text{d}x$$ since $\{x^2\}=x^2-\lfloor x^2\rfloor=x^2-k$ for $x\in[\sqrt k,\sqrt{k+1})$. Now, if that is correct, I proceed integrating and I obtain the series $$I=\frac13\sum_{k=0}^{n^2-1} ((k+1)^\frac32-k^\frac32)-\sum_{k=0}^{n^2-1} k(\sqrt{k+1}-\sqrt k)$$ The first telescopes to $\frac{n^3}3$ while for the second I thought to apply the formula of summation by parts, that is $\sum_{n=k}^Na_nb_n=S_Nb_N-S_{k-1}b_k-\sum_{n=k}^{N-1}S_n(b_{n+1}-b_n)$ where $S_N=\sum_{n=1}^Na_n$. Choosing $a_n=\sqrt{k+1}-\sqrt k$, since its $(n^2-1)$-th partial sum telescopes to $n-1$, the formula gives $$\sum_{k=0}^{n^2-1} k(\sqrt{k+1}-\sqrt k)=(n-1)(n^2-1)-\sum_{k=0}^{n^2-2} (k-1)$$ that seems to be false because $\sum_{k=0}^{n^2-2} (k-1)>(n-1)(n^2-1)$ while $\sum_{k=0}^{n^2-1} k(\sqrt{k+1}-\sqrt k)>0$. I sincerely think I have done something wrong but I don't understand what… Could someone explain or find another solution (the answer given by the book is $-\frac{2n^3}3+\sum_{k=1}^{n^2} \sqrt k$)?

A: Ok, I just understood my mistake and it's very silly. We have that $S_k=\sqrt{k+1}-1$ and instead I used $S_{k^2-1}$ as $S_k$. Then the answer comes easily expanding, re-elaborating and re-indexing the sums. So stupid...


text:
Q: Individual + plural or individual + singular? I have a sentence like:

Morphological and statistical features of individual heartbeats are
  used to...

I'm not sure whether it's correct or I should use individual heartbeat.
I googled it and it seems individual comes with both singular and plural nouns.

A: Individual is indeed a noun and an adjective. When used as a noun, it refers to a person, or someone. For example:

That individual over there is a nasty piece of work.

To give a couple of examples of the use of the adjective, using heartbeat in its singular and plural:
Singular

You can feel each individual heartbeat when you take someone's pulse.

Or

When I put my hand to your chest I can feel every individual heartbeat

Note: when singular, individual would be preceded by each, every, one, an, or the.
Plural

If you add up all of the individual heartbeats, and divide them by the
time you felt them in, that will give you the person's heart rate.

Summary
So, in short, use individual heartbeat if you are talking about one particular heartbeat, or individual heartbeats when referring to the separate heartbeats as an ensemble.
In the example that you provide,

Morphological and statistical features of individual heartbeats are
used to...

you are referring to the features of a collection (plural) of heartbeats (even though, you are considering each and every individual heartbeat), and so you are correct in using individual heartbeats


text:
Q: Use multiple zfs pools in LXD I have several pools: tank1, tank2 and tank3.
How can I make LXD container use designated pool. eg. C1 & C2 use tank1, C3 use tank2, C4 & C5 use tank3?

A: You can do it at the moment you init the container:
lxc init <image> <name> -s <pool>

I you have already created you containers in other pool, you need to stop them, publish as images, delete original containers and init them in new storage pool:
lcx stop c1
lxc lxc publish -f c1 --alias c1
lxc delete c1
lxc init c1 c1 -s <new pool>
lxc start c1
lxc image delete c1

A: The way I see it, each lxd host can only use one pool.


text:
Q: Why is the body of the node request is always a string? I am trying to use a npm package to do API GET calls in node. However, for some reasons, no matter what, the body of the request is always a string (instead of an object or array). Anyone know why that is the case and what can I do to stop it from doing that?
Example (this API is supposed to return an array, yet the body is a string):
body: '["I call this turf 'n' turf. It\'s a 16 oz T-bone and a 24 oz porterhouse. Also, whiskey and a cigar. I am going to consume all of this at the same time because I am a free American."]'

A: Generally when you send data to and from a server, it is sent as a 'serialized' string. This string is usually in XML or JSON format. Since it looks like you are working with a JSON string you should be able to parse the sting using var obj = JSON.parse(str).
Take a look at this post. I presume this is something similar to what you are doing (Ajax request using Node). See the answer given shows that the body is parsed using the JSON.parse() function to retrieve the original object from the string.
Also take a look at how HTTP works - Hyper Text Transfer Protocol. This is the method used for sending and receiving data over the internet. The data is sent in a readable string format.


text:
Q: Phantom DSL questions on set contains and sorting I have written this scala code using Phantom DSL to query cassandra
  def getByGenreAndYear(genre: List[String], year: Int) : Future[Seq[Movie]] = {
    var criteria = select.where(_.genre contains genre.head)
    criteria = genre.tail.foldLeft(criteria){(accum, i) => accum.and(_.genre contains i)}
    criteria.and(_.year eqs year)
    criteria.allowFiltering().fetch()
  }

It works but I have a few questions

*

*Set Contains

When querying whether a set contains values. is it right to build the query criteria like I have done? basically I have a AND clause for every value for which we want to check. Could this have been done in a single shot like
select.where(_.genre contains genreList)

*

*Sorting

I am not able to generate the sort query. when I try to do
  def getByGenreAndYear(genre: List[String], year: Int) : Future[Seq[Movie]] = {
    var criteria = select.where(_.genre contains genre.head)
    criteria = genre.tail.foldLeft(criteria){(accum, i) => accum.and(_.genre contains i)}
    criteria.and(_.year eqs year)
    criteria.orderBy(_.year desc)
    criteria.allowFiltering().fetch()
  }

The code desn't even compile

A: Contains queries
You cannot do contains queries on multiple values at the same time. You have several ways of achieving the above. The first is to use filtering and build a query.
def getByGenreAndYear(genre: List[String], year: Int): Future[Seq[Movie]] = {
    val rootQuery = select.where(_.genre contains genre.head)
    genre.tail.foldLeft(rootQuery){ (accum, i) => accum.and(_.genre contains i)}
   .and(_.year eqs year)
   .orderBy(_.year desc)
   .allowFiltering().fetch()
  }

This is what you are doing here except the phantom query builder is immutable, every single operation you do will create a new Query instance. There is a very good reason for that.
The other way is to to sequence futures and not filter in Cassandra, which is not always very advisable.
def getByGenreAndYear(genre: List[String], year: Int): Future[Seq[Movie]] = {
  // This will create a future to query for a single value.
  val futures = genre.map(item => select.where(_.year eqs year).and(_.genre contains item).fetch())
  // This will sequence the entire set, produce a list of lists, flatten it and create an union, and deduplicate by set conversion granted you define the right `hashCode` method on the `Movie` class.
  Future.sequence(futures) map {
   // You could also probably get away with lists.flatten
   lists => lists.foldRight(Nil)((item, acc) => item ::: acc)).toSet
  }
}

At this point in time doing a CONTAINS query is not possible against multiple values in a single query. You get an error:
cql
select * from marvis.expenses where tags contains ('food', 'office-food');
InvalidRequest: code=2200 [Invalid query] message="Invalid tuple type literal for value(tags) of type text"

This however works:

select * from marvis.expenses where tags contains 'food' and tags contains 'office-food' ALLOW FILTERING;

Sorting
To achieve sorting, you need a Compound or Composite key, and you can only sort by the clustering key part of the column, not the Partition key part. Have a look at this tutorial for more details on Cassandra indexing if need be.


text:
Q: How to avoid coredns resolving overhead in kubernetes I think the title is pretty much self explanatory. I have done many experiments and the sad truth, is that coredns does add a 20 ms overhead to all the requests inside the cluster. At first we thought maybe by adding more replications, and balancing the resolving requests between more instances, we could improve the response time, but it did not help at all. (we scaled up from 2 pods to 4 pods)
There was some enhancements on the fluctuations of resolving time, after scaling up to 4 instances. But it wasn't what we were expecting, and the 20 ms overhead was still there.
We have some web-services that their actual response time is < 30 ms and using coredns we are doubling up the response time, and it is not cool!
After coming to a conclusion about this matter, we did an experiment to double-check that this is not an OS level overhead. And the results were not different from what we were expecting.

We thought maybe we can implement/deploy a solution based on putting list of needed hostname mappings for each pod, inside /etc/hosts of that pod. So my final questions are as follows:

*

*Has anyone else experienced something similar with coredns?

*Can you please suggest alternative solutions to coredns that work in k8s environment?

Any thoughts or insights are appreciated. Thanks in advance.

A: There are several things to look at when running coreDNS in your kubernetes cluster

*

*Memory

*AutoPath

*Number of Replicas

*Autoscaler

*Other Plugins

*Prometheus metrics

*Separate Server blocks

Memory
CoreDNS recommended amount of memory for replicas is
MB required (default settings) = (Pods + Services) / 1000 + 54

Autopath
Autopath is a feature in Coredns that helps increase the response time for external queries
Normally a DNS query goes through

*

*..svc.cluster.local

*.svc.cluster.local

*cluster.local

*Then the configured forward, usually host search path (/etc/resolv.conf

Trying "example.com.default.svc.cluster.local"
Trying "example.com.svc.cluster.local"
Trying "example.com.cluster.local"
Trying "example.com"
Trying "example.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55265
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;example.com.           IN  A

;; ANSWER SECTION:
example.com.        30  IN  A   93.184.216.34

This requires more memory so the calculation now becomes
MB required (w/ autopath) = (Number of Pods + Services) / 250 + 56

Number of replicas
Defaults to 2 but enabling the Autoscaler should help with load issues.
Autoscaler
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: coredns
  namespace: default
spec:
  maxReplicas: 20
  minReplicas: 2
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: coredns
  targetCPUUtilizationPercentage: 50

Node local cache
Beta in Kubernetes 1.15

NodeLocal DNSCache improves Cluster DNS performance by running a dns caching agent on cluster nodes as a DaemonSet. In today's architecture, Pods in ClusterFirst DNS mode reach out to a kube-dns serviceIP for DNS queries. This is translated to a kube-dns/CoreDNS endpoint via iptables rules added by kube-proxy. With this new architecture, Pods will reach out to the dns caching agent running on the same node, thereby avoiding iptables DNAT rules and connection tracking. The local caching agent will query kube-dns service for cache misses of cluster hostnames(cluster.local suffix by default).

https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/
Other Plugins
These will also help see what is going on inside CoreDNS
Error - Any errors encountered during the query processing will be printed to standard output.
Trace - enable OpenTracing of how a request flows through CoreDNS
Log - query logging
health - CoreDNS is up and running this returns a 200 OK HTTP status code
ready - By enabling ready an HTTP endpoint on port 8181 will return 200 OK when all plugins that are able to signal readiness have done so.
Ready and Health should be used in the deployment
        livenessProbe:
          httpGet:
            path: /health
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 60
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
        readinessProbe:
          httpGet:
            path: /ready
            port: 8181
            scheme: HTTP

Prometheus Metrics
Prometheus Plugin
coredns_health_request_duration_seconds{} - duration to process a HTTP query to the local /health endpoint. As this a local operation, it should be fast. A (large) increase in this duration indicates the CoreDNS process is having trouble keeping up with its query load.
https://github.com/coredns/deployment/blob/master/kubernetes/Scaling_CoreDNS.md
Separate Server blocks
One last bit of advice is to separate the Cluster DNS server block to external block
    CLUSTER_DOMAIN REVERSE_CIDRS {
        errors
        health
        kubernetes
        ready
        prometheus :9153
        loop
        reload
        loadbalance
    }

    . {
        errors
        autopath @kubernetes
        forward . UPSTREAMNAMESERVER
        cache
        loop
    }

More information about the k8 plugin and other options here
https://github.com/coredns/coredns/blob/master/plugin/kubernetes/README.md


text:
Q: Allow vertical scroll (don't cut content) I have a modal on an event page, problem is when the content is below the fold, it get cut instead appear vertical scroll to scrolldown the content. You can see an example here (click the day 27, you will see that the content modal cut):
https://www.fundacioncb.es/agendafundacioncb
I attach an image too.
CSS Structure:
.modalDialog > div {
    max-width: 896px;
    position: relative;
    margin: 6% auto;
    margin-top: 90px;
    padding: 0;
    border-radius: 0px;
    background: #fff;
}

.modalDialog > div {
    margin-top: 150px !important;
}
.modalDialog * {
    display: block;
    float: none;
}

HTML

      X

27 · 09 · 2019

Seminario formativo

"La trata de mujeres con fines de explotación sexual desde un enfoque de género y crítico de derechos humanos"

 El 27 de septiembre en el Centro Cultural "Santo Domingo" de Fundación CB (Mérida).

Exposición

"Paisajes humanos"

 Del 7 de septiembre al 12 de octubre en Arte Joven Galería (Calle San Isidro, 16C, Badajoz).

Exposición

"Migraña en Exposición"

Del 23 de septiembre al 4 de octubre en Centro Cultural Santo Domingo (Mérida).

Exposición

Academia de dibujos y pinturas Miro

Del 15 de septiembre al 15 de octubre en Centro Cultural Santo Domingo (Mérida).

Exposición

"Haiku del alma", de Teresa Crespo

Del 10 al 27 de septiembre en Espacio CB Arte (Badajoz).

Formativo

MALVALUNA

El 27 de septiembre de 9:30h a 14:00h en el Centro Cultural "Santo Domingo" de Fundación CB (Mérida).

Curso

Asesoría e Imagen

El 27 de septiembre en la biblioteca de la RUCAB.

Concierto

Iván Sanjuan

El 27 de septiembre a las 20:30h en el salón de actos de la RUCAB.

A: You can provide scroll to popup so you never lose any content. Add following css.
.articulos-dia {
    height: calc(100vh - 390px);
    overflow-y: scroll;
}

A: This is how you can set scroll for over flow content. Check the following code
<!DOCTYPE html>

    <title>Test</title>

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.