text:
Q: Running a program after not being used for 15 minutes I am finishing building Google Earth for my hotel that contains different activities, shopping, and dining ideas. The owner wants it in a certain way, however, I am not a programmer and he does not want to pay for one. So I am learning as I go. I posted before about something I was wondering. ( Closing and Opening a .exe with a batch file. Upon closing the program asks to save or not)
My next question is; is it possible to force close the program and open in up if the program was not used for 15 minutes? Could some one point me into the right direction. Thank you.

A: You'll need qprocess or tasklist commands and there's a small chance to not have neither of these (you should check it)
here's an example script
@echo off
rem -- checking if the machine is x32 or x64
rem -- google earth clinet is x32
if defined ProgramFiles(x86) (
  set "ge=C:\Program Files (x86)\Google\Google Earth\client\googleearth.exe"
) else (
   set "ge=C:\Program Files\Google\Google Earth\client\googleearth.exe"
)

rem -- better approach is to check the registry bu here I'll use default folders

:repeat
tasklist | find /i "googleearth" && (
   rem -- program is running
   rem -- we need to wait and repeat
   rem -- waiting 15 minutes
   ping 192.0.2.1 -n 1 -w 90000 >nul 2>nul
   goto :repeat
) || (
  rem -- program is not running
  rem -- we need to start it again

  start "" "%ge%"

)


text:
Q: How to have two lookup to feld (Country and Town) - Sharepoint List - Add new Object
I have created a default list
and two extra list
: Country
Countryname
: Town
Town - Countryname (Lookedup from Country)
But now when i go into by Default list (Country is lookedup from CountryList and Town is Lookedp from TownList)
But when i start a new object it will not filterout the towns thats not related to that country
I Use sharepoint from Office365.

A: I assume what you are looking for is a cascading dropdown.
As for SharePoint Online modern list, we are not able to create a cascading dropdown in modern experience with Out-of-box solution. If you have access to PowerApps, you can use it to customize the list form. Here is a video for your reference.
And here is a thread discussing with some solutions and workarounds about it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Unable to use record Completely new to graal-native-image, trying to familiarize with that.
According to documentation I'm using tests and agent to create explicit metadata. It discovered reflection and and even some c libraries and it works. But java record does not. I have it fully covered by tests, so agent stepped on everything. Record instance is created by JacksonMapper, and even that flow is covered by tests.
record looks like this:
record Issue(String a, String b, String c, String d) {}

generated metadata contains (I'm selecting interesting parts):
{
  "name":"a.b.c.D$Issue",
  "allDeclaredFields":true,
  "queryAllDeclaredMethods":true,
  "queryAllDeclaredConstructors":true,
  "methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","java.lang.String","java.lang.String"] }]
}

...

{
  "name":"java.lang.Record",
  "allDeclaredFields":true,
  "queryAllDeclaredMethods":true
}

...

{
  "name":"java.lang.reflect.RecordComponent",
  "methods":[
    {"name":"getName","parameterTypes":[] },
    {"name":"getType","parameterTypes":[] }
  ]
}

but still, during build of native image I'm getting:
Caused by: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public java.lang.String a.b.c.D$Issue.d()

IIUC it means, that compiller found call to d(), which weren't discovered before (am I right?), but:

*

*why isn't it 'auto-discovered'? It's not reflection or anything that hard to understand.

*why is it considered as new if (as far as I understand) covered by explicit metadata?

what am I overlooking? Trivial replace with static inner class is working workaround, but I would like to understand why records does not work...


text:
Q: Div title shows just one time I'm using this code:

when I get the mouse over it shows correctly the title CARS, then I drag the marker to the google maps, a new marker replaces the one I've just dragged but the title CARS does not show again at the same place where the original marker was.
Is there a way to fix this? I've tried this.title but it makes the marker undraggable.
Thanks in advance for your time.

A: give the title to the img, not the div
Edit:
I think the fault is in your javascript.
// Append icon
  var img = document.createElement("img");
  img.src = obj.firstChild.getAttribute("src");
  img.style.width = "32px";
  img.style.height = "32px";
  m.appendChild(img);
  drag_area.replaceChild(m, obj);

I think you are missing

img.title = obj.firstChild.getAttribute("title");

A: I believe he means like this

I moved the title attribute from the div to the image.


text:
Q: Can I make this search relevancy function better without "doing advanced stuff"? My search engine uses the following function to calculate relevancy.
private static int calculateScore(String result, String searchStr, int modifier)
{
    String[] resultWords = result.split(" ");
    String[] searchWords = searchStr.split(" ");

    int score = 0;
    for (String searchWord : searchWords)
    {
        for (String resultWord : resultWords)
        {
            if (resultWord.equals(searchWord))
                score += 10;
            else if (resultWord.startsWith(searchWord))
                score += 4;
            else if (resultWord.endsWith(searchWord))
                score += 3;
            else if (resultWord.contains(searchWord))
                score += 1;
        }

    }
    return score;
}

Nothing fancy, and I haven't been given enough hours to do anything fancy either, but are there any simple improvements I can do to make the function better at upping the relevant stuff, and keeping the irrelevant stuff down?
No need to remark on speed optimizations, this is just the "functional part" of the function :)
Thanks.

A: Not sure if it counts as fancy, but a soundex comparison, presumably earning a +1 score on your scale, will grant a little relevance to typographical near misses and homophones.
I'd suggest using a stop word list to either prevent or radically reduce relevancy granted from common words.  If someone is searching for "the horse is on the roof", you want to grant relevancy to "horse" and "roof", not massively upscore everything containing "the".
Another easy boost is to grant a whole bunch of relevancy to a result that contains the entire search string in order (case and punctuation insensitive).

A: The classic vector space model is actually standard nice and rather simple (in implementation) solution.
http://www.miislita.com/term-vector/term-vector-3.html

A: You should also probably normalize case before you do your equals.

A: You could add +1 to the score if the Levenshtein Distance is below some threshold.

A: If you want to make your search algorithm a little bit more sophisticated, look at cosine similarity. It's pretty easy to implement and works pretty well in practice.

A: You could:

*

*Cull out noise words (the, a, at, etc...)

*Change weight for searchable text relevancy - if a search word occurs in a document's title and its body, the title is probably more relevant.

*Depending on your resultWord text, consider adding weight for words earlier or later in the text.

*Make unique search word matches worth more (you'd have to determine what makes a word unique).

A: Obvious, but you'd want to lowercase everything.


text:
Q: What is the best way to profile my javascript code ? I am interested in know how much memory my JavaScript code running inside a browser is consuming and how it is increasing decreasing with time. How do I do it ?

A: http://getfirebug.com/javascript
Firebug includes a powerful JavaScript debugger that lets you pause execution at any time and see what each variable looked like at that moment. If your code is a little sluggish, use the JavaScript profiler to measure performance and find bottlenecks fast.
Edit : You may refer previously answered questions on stackoverflow.

JavaScript Profiler in IE
Javascript memory profiler for Firefox
Measuring Javascript performance in IE
How to profile and and get Javascript performance
http://www.imnmotion.com/documents/html/technical/dhtml/jsprof.html

A: If you are using FireFox then Firebug is perfect for this application. I'd highly recommend it for debugging javascript in browser.
StackOverflow: what-is-the-best-way-to-profile-javascript-execution
Looks like this would be a good answer for you too.

A: It depends on your browser...
If you're using Chrome (that's what i'm using...):

*

*Open up the page

*Right click anywhere -> Inspect element (opens up Dev toolbar)

*Go to Profiles tab

*Click the little "recording" icon (cirle) at the bottom of the screen (4th button)

*When it's read it's indicating it's recording

*Do your thing

*Click the rec button again

*enjoy the statistics


text:
Q: Are the contents of git blob encrypted? I am reading about the git internals and it says that a blob just contains the content of the file. So I went on doing the following
echo "hello world" > a.txt
git add a.txt

The .git/object had a folder 3b18e512dba79e4c8300dd08aeb37f8e728b8dad.
Upon opening it, there was junk value in it. But running the following command,
git cat-file -p 3b18e512dba79e4c8300dd08aeb37f8e728b8dad
// hello world

So the cat-file command is definitely knowing how to parse the blob object. What is that junk value in the blob and how does cat-file interpret it. I'm sure it is the content of the file, but in what format is it written as?

A: In a case of blobs, its content represents blob header and content. You can check this with:
$ openssl zlib -d -in .git/objects/3b/18e512dba79e4c8300dd08aeb37f8e728b8dad
blob 12hello world

for example.

A: In git a blob is the content of a file.   All blobs are compressed with zlib and delta compression in git (so revisions don't eat up massive amounts of space), which is why blobs are unreadable.  The name of a blob is its SHA-1 hash.


text:
Q: Word search within a sentence and delete previous ones For example, this sentence:
"Hello Humanity D. Humanity is a wonderful thing"
"Today weather, good D. maybe tomorrow will be bad"
"I could not find another sentence D. this last example sentence"
I have 495 sentences for like this.
Here are the sentence to be deleted
"Hello Humanity D. "
"Today weather, good D. "
"I could not find another sentence D. "
The common feature of each letter is the presence of the letter "D."
How do I remove sentences before D.?
function removeEverythingBefore($in, $before) {
    $pos = strpos($in, $before);
    return $pos !== FALSE
        ? substr($in, $pos + strlen($before), strlen($in))
        : "";
}
echo(removeEverythingBefore("I could not find another sentence D. this last example sentence", "D. "));

Image

A: A quick one line way of doing this:
<?php

echo trim(str_replace(' D.', '', strstr($string, ' D.')));

An example with output:
<?php

$string = 'I could not find another sentence D. this last example sentence';

echo trim(str_replace(' D.', '', strstr($string, ' D.')));
//Outputs: this last example sentence

A: with a preg_replace:
$re = '/.*D\.\s*(.*)/';
$str = 'Hello Humanity D. Humanity is a wonderful thing';
$subst = '$1';

$result = preg_replace($re, $subst, $str);

echo $result;

result:
Humanity is a wonderful thing

A: You can find the position of 'D.' with strpos and substract whats after.
$new_sentance = substr($sentance, strpos($sentance, 'D.') + 1);

A: Another suggestion:
$str = 'Hello Humanity D. Humanity is a wonderful thing';
$a = explode("D.",$str);
array_shift($a);
$result = trim(implode("", $a));

This way you won't have to fiddle around with regex.
Speed comparison: http://sandbox.onlinephpfunctions.com/code/a078d7ca01c149aabaaddb335a4b0ad8669fb273

A: Try this regex: https://regex101.com/r/mvoJDs/1/
<?php

$strings = [
'Hello Humanity D. Humanity is a wonderful thing',
'Today weather, good D. maybe tomorrow will be bad',
'I could not find another sentence D. this last example sentence',
'I have 495 sentences for like this. Here are the sentence to be deleted',
'Hello Humanity D. ',
'Today weather, good D. ',
'I could not find another sentence D.     '
];

$regex =  '#.+\sD\.\s#';

foreach ($strings as $key => $val) {
    $strings[$key] = preg_replace($regex, '', $val);
}

var_dump($strings);

Which will output:
array(7) {
[0]=> string(29) "Humanity is a wonderful thing"
[1]=> string(26) "maybe tomorrow will be bad"
[2]=> string(26) "this last example sentence"
[3]=> string(71) "I have 495 sentences for like this. Here are the sentence to be deleted"
[4]=> string(0) ""
[5]=> string(0) ""
[6]=> string(4) " "
}

See it working here https://3v4l.org/kfPnm


text:
Q: Show Home page as Category page I'm working on a custom Prestashop theme for my e-commerce, and I want to show the index homepage as the category pages.
I have a one big category (Home) that contains 4 subcategories ( Girl, boy, children, Babies)
I've setup the pages of the categories to show a 4 column list, and i want the same in the homepage ( to show all the products of my prestashop products with pagination, the home category ) but, I tried to copy the code, and of course, it doesn't work right the way....
How can i setup an specific Category ( Home in my case ) for re-use the code from category.tpl ?
Because i think, smarty doesn't see the home page as a category page: so can't use globals $category or $subcategories.
Thanks for your help,
Rodrigo

A: Normally in PS, on homepage the featured products are shown. Featured products are those products which are added in Home Category directly, but it has a limited number of products.
If you want the home page to be as category page, then you have to modify the homefeatured module or copy past that module to create a new module for that home page. Now in that module, copy past the code from the category controller  to fetch products count and fetch products. After assigning it to smarty variables, you can access them in your template file for that module, like in homefeatured.tpl.
For pagination, you have to add the pagination.tpl file in your module template file.
Hope this will give you the idea that how you can do it.
Thank you


text:
Q: Facebook: How to retrieve an access token programmatically? I need to post a message on my own Facebook page; and I need to do it programmatically (in my case using Python). I managed to do this part using this code (in Python):
import urllib, urllib2

access_token='XXXX'
fb_page_id='YYYY' # my page ID

post_data = {'access_token':access_token, 'message':'hey this is a test!'}
request_path = str(fb_page_id)+'/feed'
post_data = urllib.urlencode(post_data)
response = urllib2.urlopen(
    'https://graph.facebook.com/%s' % request_path, post_data
)

The ID of the generated post on the FB page is correctly returned:
In [11]: response.readlines()
Out[11]: ['{"id":"135386143198208_461964357207050"}']

Problem:
In order to generate the access_token and make the API request above I had to manually follow the three steps detailed here.
But in practice this manual process is unacceptable as I need to run this task from a cron job. Hence I need to automate it because access_token in Facebook is temporary. I.e. I need to get an access token each time I run this script. How to do that?
Feel free to use any scripting tool in your answer (curl, JavaScript, Java, PHP) as long you communicate the steps involved. Note that I need to do this using any server-side language (Python/Ruby/PHP).

A: You cannot retrieve a short-lived token programmatically. It defeats the purpose of user interaction.
Facebook intentionally has made it this way to ensure the user has full manual control over what apps they install.
Once the user grants initial access you can then automate the process up to two months (or earlier if the user invalidates the token, for example by changing their password)
by doing an HTTP request to
https://graph.facebook.com/oauth/access_token?
    grant_type=fb_exchange_token&
    client_id=APP_ID&
    client_secret=APP_SECRET&
    fb_exchange_token=SHORT_LIVED_ACCESS_TOKEN

After these two months are over, the user must be the one to re grant access to the application giving a new short lived token which you can then re-extend using the code above.

A: If you extend your (User) access token, you can then request a (Page) access token which does not in fact expire at all.
See the "Extending Page access tokens" section of the following document: https://developers.facebook.com/docs/howtos/login/extending-tokens/

A: Bless the soul who wrote this code. Not me, but found it somewhere. Works smoothly. Call this function with your email & password.
MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; U; en-gb; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.16 Safari/535.19"
FB_AUTH = "https://www.facebook.com/v2.6/dialog/oauth?redirect_uri=fb464891386855067%3A%2F%2Fauthorize%2F&display=touch&state=%7B%22challenge%22%3A%22IUUkEUqIGud332lfu%252BMJhxL4Wlc%253D%22%2C%220_auth_logger_id%22%3A%2230F06532-A1B9-4B10-BB28-B29956C71AB1%22%2C%22com.facebook.sdk_client_state%22%3Atrue%2C%223_method%22%3A%22sfvc_auth%22%7D&scope=user_birthday%2Cuser_photos%2Cuser_education_history%2Cemail%2Cuser_relationship_details%2Cuser_friends%2Cuser_work_history%2Cuser_likes&response_type=token%2Csigned_request&default_audience=friends&return_scopes=true&auth_type=rerequest&client_id=464891386855067&ret=login&sdk=ios&logger_id=30F06532-A1B9-4B10-BB28-B29956C71AB1&ext=1470840777&hash=AeZqkIcf-NEW6vBd"

def get_access_token(email, password):
    s = robobrowser.RoboBrowser(user_agent=MOBILE_USER_AGENT, parser="lxml")
    s.open(FB_AUTH)
    ##submit login form##
    f = s.get_form()
    f["pass"] = password
    f["email"] = email
    s.submit_form(f)
    ##click the 'ok' button on the dialog informing you that you have already authenticated with the Tinder app##
    f = s.get_form()
    s.submit_form(f, submit=f.submit_fields['__CONFIRM__'])
    ##get access token from the html response##
    access_token = re.search(r"access_token=([\w\d]+)", s.response.content.decode()).groups()[0]
    #print  s.response.content.decode()
    return access_token

A: To get a facebook token for even normal users programmatically, you might be interested in this: https://github.com/fbessez/Tinder/blob/master/fb_auth_token.py, it's a python script to automatically retrieve the token when supplied email/password.
Make sure you have lxml, requests and robobrowser installed, as these are prerequisities. Both requests and robobrowser can be easily aquired with running
pip install robobrowser and
pip install requests
The lxml is a "little" more tricky, as it will have to be compiled (to have a recent version). Follow this SO for it: How to install lxml on Ubuntu


text:
Q: How to pass activity to a function in kotlin How to pass activity to a function in kotlin
I have buttons that pass one activity to another so I want to write intent in a function in order to do that I have to pass activity to which we need to go after pressing the button. So how can I pass activity to a function in kotlin?
I know how to move from one activity to another .I just want to know if I want Activity in parameter what to write here in kotlin: private fun replaceActivity(what to write here) –
 override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    replaceActivity(MenuActivity())
}
fun replaceActivity(activity: Activity) {
 val intent = Intent(this, activity::class.java)
                startActivity(intent)
}

replaceActivity(MenuActivity::class.java) this is how I am calling the function

A: Your question is quite confusing, but if I understood correctly:
If you want to be able to only pass MenuActivity to the function:
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        replaceActivity(MenuActivity::class.java) // doesn't necessarily need to be here
    }
    fun replaceActivity(classOfMenuActivity: Class<MenuActivity>) {
      // do something with that class
    }

if you want to pass activities (that aren't the same, so not only AnotherActivity class):
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        replaceActivity(AnotherActivity())
    }
    fun replaceActivity(activity: Activity) {
      // do something with that activity
        val classOfTheActivity = activity::class.java
    }

Also, creating apps with multiple activities is... a mess, nowadays all of the apps are written with one activity and multiple fragments, if you are wondering why check this answer out


text:
Q: Need a regex expression to validate a phone number must contain only the characters +, -, *, ? and 0-9 Hope you all are doing good. I am in need of a regex expression where I need to validate the below conditions:

*

*Phone number must contain only the characters +, -, *, ? and 0-9.

*Only the leading character may be a + (only once it should come, should fail if more than 1 + appends to the leading character).

*Only the trailing character may be a *. (only once it should come, should fail if more than 1 * appends to the leading character).

*In between the + and *, I can have 20 characters (allowed are 0-9, -, ?).

I have the below expression to validate the leading (+) and trailing character (*). It needs to be expanded to validate if more than one same character appends to the leading and trailing character.
^[0-9+].*[0-9*]$

A: Try this ...
^\+?([-?0-9]{0,20})\*?

This will match between 0 and 1 of the leading character (+) and trailing character (*).
It'll also check that 0-9, - and ? occur between 0 and 20 times.
So this would match:

*

*+23-4932-4234?3423*

*23-4932-4234?3423*

*+23-4932-4234?3423

*23-4932-42343423

*etc,

Otherwise have a look at the Regular Expression Library.


text:
Q: how to change the value of a column in laravel on logout i have a column called active_user to show when a user is online(1). When i log a user in i set the active_user column to 1  but when i log the user out and check  active_user it still shows online(1). what i want is that when i click the logout button the aactive_user column will change to offline(0) and also update it to the database. my login is below.
 public function postSignIn(Request $request) {

    $this->validate($request, [

        'email' => 'required',
        'password' => 'required'

    ]);

   if(Auth::attempt(['email' => $request['email'], 'password' => $request['password']])) {
       $user=User::whereRaw('email=?',[Input::get('email')])->first();

       //this is where i set the active_user to 1
       $user->active_user=1;
       $user->save();

       if($user!=null){
           switch($user->role_id){
               case 1:
                   if($user->status==0){
                       session()->flash('flash_message_error', ' Your Account has been  deactivated. Contact the administrator');
                       return Redirect::to('admin/login');
                   }
                   return redirect()->route("index");
               break;

then below is my logout function
public function LogOut($id) {
    $user = User::find($id);
    $user->active_user=1;
    $user->save();
    Auth::logout();

    return redirect('admin/login');
}

in the logout function i want to change the active_user back to offline(0) but i keep getting an error "Missing argument 1 for App\Http\Controllers\AdminController::LogOut()"

A: Your route logout is now expecting an id attribute passed to it. This seems wrong to me as it is the authenticated user that you want to apply this logic to, having to pass their id to logout is unnecessary. For example if your logged in user has an id of 1, to logout with your code they would need to go to a url such as:
http://myapp.app/logout/1

Instead, use the Auth implementation to modify the user.
// Remove requirement for ID as a parameter
public function LogOut() {
    $user = Auth::user();
    $user->active_user=1;
    $user->save();
    Auth::logout();

    return redirect('admin/login');
}


text:
Q: Using PiL to take a screenshot of HTML/CSS I want to enable a user on a website to upload an image, and write some text over it.  Also, they should be able to crop/scale/move the image and text.  For that stuff, I can do it in jQuery.
After they've made the image the way they want it, is there a way i can take a screenshot of that image (using PiL) and save it on the server?
What is the best/proper way to do this?

A: Taking a "screenshot" of the picture is neither the best, nor the proper way to do it. To take a screenshot, you need to execute code on the client machine, which is "not possible" in a website scenario.
Have a look at lolcat builder (I can't think of a more serious example right now ;). Everytime you click the "Preview" button, the image src is updated with an url containing the text, its style and position. The request is handled by the server which will generate a new picture to display.

A: I assume you got Python on the server side.
The best way imo is to somehow 'get' all the editing parameters from the client, then re-render it using PIL.
Update: How I will do it
On the server side, you need an url to handle posts.
On the client side, (after each edit, )send a post to that url, with the editing parameters.
I think there is not an easy solution to this.
Maybe if you don't use PIL to render the final image, but only remember the parameters, each view from clients can render itself?

A: PIL isn't available on the client side.. so unless, as Jack Ha suggests, you intend to upload all the instructions of your image editing to the server and re-execute them, it's not an option.  I would shy away from this because you'd need to implement the same editing routines on both the client and the server, doubling the size of your code base.  (Perhaps if your server-side code was written in Javascript it would make sense, so the drawing code could be reused.)
Instead, look into finding a Javascript library that does complete image manipulation client-side, and have the browser upload the final, edited image.  I'm not familiar with the options in that area, but a quick Google search turned this up, which uses the canvas element to store the pixel data.

A: Well, even if others are trying to discourage you from doing this, it would probably not be that hard.
On the client-side, you, you define a div that is floated/resizable over the image, with transparency, that can be scaled for the crop.
Move, I assume it applies only to the text, so you dynamically create draggable spans on the client side, still easy.
Scale, I have no Idea of a simple UI to do it.
When you want to update your Image, you serialize your data (position of your cropping div and position of your text spans / scaling, relative to the position to the image.) Then, using json or anything similar you'd like, you transfer the data to the server.
Then, on the server, using python/PIL, you reproduce the transformations that you have serialized.


text:
Q: 3 open conjectures about simple theories? To my knowledge, there are still 3 open conjectures concerning simple theories : elimination of hyperimaginaries, Lascar strong type = strong type, and stable forking conjecture (if a type forks over some parameters, this is due to an instance of a stable formula).
I haven't think of it very hard, but intuitively elimination of hyperimaginaries implies Lstrong type = strong type, isn't it ?
Are there more implications between those 3 conjectures ?
On the other hand, do you think the resolution of one of them would be an important breakthrough in model theory ? Or at the contrary would be rather anecdotal ?

A: You can find a nice summary of the relationships between (variants of) these three conjectures in this paper by Palacín and Wagner.
In particular:

*

*A theory with stable forking has weak elimination of hyperimaginaries.

*A one-based simple theory with weak elimination of hyperimaginaries has (strong) stable forking.

*If $T$ is $G$-compact (and every simple theory is $G$-compact), then $T$ has elimination of hyperimaginaries if and only if (a) $T$ has weak elimination of hyperimaginaries and (b) Lstp = stp.

So it seems that for simple theories we have:

*

*Elimination of hyperimaginaries implies Lstp = stp.

*Elimination of hyperimaginaries and one-based implies stable forking.

*Lstp = stp and stable forking implies elimination of hyperimaginaries.

Caveat: I'm not an expert on these issues, and it's possible I've made a silly mistake in collecting these results.

Do you think the resolution of one of them would be an important breakthrough in model theory?

It would certainly be a breakthrough, since these questions seem very hard and have been open for a long time. In my opinion, how important a breakthrough is really depends on the proof, i.e. whether useful new techniques or conceptual frameworks are developed that significantly increase our understanding. It seems likely to me that progress on these conjectures would require these kinds of new ideas - but you never know.


text:
Q: Application Insights 2.4 on IIS 10 and .net framework 461 requires IIS reset After I've updated Application Insights to version 2.4, I need to reset IIS after build the project changes. I reverted this and it started to work normally. I am using IIS on windows 10 64bits, with a dedicated application pool, on the root.
I tried to look around for some issue reported like this one but I couldn't find any information.
Do you guys have any idea of what can cause this and how to work around it?


text:
Q: Limitation of free plan in firebase What is the meaning of the following?
50 Max Connections, 5 GB Data Transfer, 100 MB Data Storage.
Can anyone explain me?  Thanks
EDIT - Generous limits for hobbyists
Firebase has now updated the free plan limits
Now you have
100 max connections
10 GB data transfer
1 GB storage

A: That means that you can have only 50 active users at once, only 5GB data to be transferred within one month and store only 100 MB of your data.
i.g. you have an online web store: only 50 users can be there at once, only 100 mbytes of data (title, price, image of item) can be stored in DB and only 5 GB of transfer - means that your web site will be available to deliver to users only 5gb of data (i.e. your page is 1 mbyte size and users will be able to attend that page only 50 000 times).
UPD: to verify the size of certain page (to define if 5gb is enough for you) - using google chrome right click anywhere on page - "Inspect Element" and switch to tab "Network". Then refresh the page. In bottom status bar you will amount of transferred data (attached size of current stackoverflow page, which is 25 kbytes)

A: From the same page where the question was copied/pasted:

What is a concurrent connection?
A connection is a measure of the number of users that are using your
  app or site simultaneously. It's any open network connection to our
  servers. This isn't the same as the total number of visitors to your
  site or the total number of users of your app. In our experience, 1
  concurrent corresponds to roughly 1,400 monthly visits.
Our Hacker Plan has a hard limit on the number of connections. All of
  the paid Firebases, however, are "burstable", which means there are no
  hard caps on usage. REST API requests don't count towards your
  connection limits.

Data transfer refers to the amount of bytes sent back and forth between the client and server. This includes all data sent via listeners--e.g. on('child_added'...)--and read/write ops. This does not include hosted assets like CSS, HTML, and JavaScript files uploaded with firebase deploy
Data storage refers to the amount of persistent data that can live in the database. This also does not include hosted assets like CSS, HTML, and JavaScript files uploaded with firebase deploy

A:
These limits mentioned and discussed in the answers, are per project

The number of free projects is not documented. Since this is an abuse vector, the number of free projects is based on some super secret sauce--i.e. your reputation with Cloud. Somewhere in the range of 5-10 seems to be the norm.
Note also that deleted projects take around a week to be deleted and they continue to count against your quota for that time frame.
Ref


text:
Q: Let wrap take full width How can I make the red box to use full width and put the button to the very right of the screen when wrapping?

Also I want spaceBetween if the button is not wrapping, but it does not work:

This is what I have sofar:
Column(
  children: [
    Align(
      alignment: Alignment.topLeft,
      child: Container(
        color: Colors.red,
        child: Wrap(
          alignment: WrapAlignment.end,
          crossAxisAlignment: WrapCrossAlignment.center,
          children: [
            Container(
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text(
                  "Please wrap on small screens",
                  style: Theme.of(context).textTheme.bodyText1,
                ),
              ),
            ),
            TextButton(
                onPressed: () {},
                child: Text("Bearbeiten"))
          ],
        ),
      ),
    ),
    // ...
  ]
)

A: Updated
Finally, I manage to solve your problem. Probably is not a canonic way, but it's working.
You need to compute the total width of your content in order to compare it with the width of the screen (the width is the width of the widgets, plus space you want between widgets, plus padding from both sides).
With that, you are able to know when you need to change the layout, and you can apply the layout you want to each case.
Here I leave the code:
class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final GlobalKey textKey = GlobalKey();
  final GlobalKey buttonKey = GlobalKey();

  double widthLimit = double.infinity;

  void initState() {
    super.initState();

    SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
      final textBox = textKey.currentContext.findRenderObject() as RenderBox;
      final buttonBox = buttonKey.currentContext.findRenderObject() as RenderBox;

      widthLimit = textBox.size.width + buttonBox.size.width + 8 + 16 * 2;
    });
  }

  Widget _wrap(bool spaceBetween, Widget child) => spaceBetween
      ? child
      : Align(
          alignment: Alignment.centerRight,
          child: child,
        );

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Container(
          width: double.infinity,
          padding: EdgeInsets.all(16.0),
          color: Colors.red,
          child: Builder(builder: (context) {
            final screenWidth = MediaQuery.of(context).size.width;
            final spaceBetween = screenWidth >= widthLimit;

            return Wrap(
              crossAxisAlignment: WrapCrossAlignment.center,
              alignment: WrapAlignment.spaceBetween,
              children: [
                Text("Please wrap on small screen small screen", key: textKey),
                _wrap(
                    spaceBetween,
                    TextButton(
                      key: buttonKey,
                      onPressed: () {},
                      child: Text("Bearbeiten"),
                    )),
              ],
            );
          }),
        ),
      ),
    );
  }
}

Old Answer
I am going to take a couple of premises from your screenshots:

*

*The Wrap doesn't have to take the full width by default

*You only want to go to two lines when there is not enough space in the device screen.

With that, you can make what you want with this code:
Container(
  padding: EdgeInsets.all(16.0),
  color: Colors.red,
  child: Wrap(
      spacing: 8,
      crossAxisAlignment: WrapCrossAlignment.center,
      alignment: WrapAlignment.end,
      children: [
        Text("Please wrap on small screen"),
        TextButton(onPressed: () {}, child: Text("Bearbeiten")),
      ]),
),

I added the spacing property to the Wrap to provide space as you wanted when both widgets are at the same line. Also, I set the alignment of the Wrap to end to align as you want.
When there is not enough space on the screen, the widget is going to move to a new line and align to the end. As the first widget is longer than the wrapped one and, as I said in the premises, we don't need to take the full width of the screen, Wrap will adapt to keep things aligned properly.


text:
Q: How can I process images faster with Python? I'd trying to write a script that will detect an RGB value on the screen then click the x,y values. I know how to perform the click but I need to process the image a lot faster than my code below currently does. Is this possible with Python?
So far I'm reading a row at a time, when x = 1920 I go onto the second row but it takes about 10 seconds to do one row. By that time the person on screen would have moved into a completely different spot and I have only done one row!
Can I speed this code up OR is there a better way to achieve what I want? If it is not possible in Python I am open to C++ options :)
import Image

x = 0
y = 0

im = Image.open("C:\Users\sean\Desktop\screen.jpg")
pix = im.load()
print im.size #get width and height of the image for iterating over
while x < 1920:
    print pix[x,y] #get RGBA value of the pixel of an image
    print "x is:" +str(x)
    x = x + 1
    print "y is: " +str(y)
    if x == 1920:
        x = 0
        y = y + 1

A: Generally, you want to avoid per-pixel loops in Python. They will always be slow. To get somewhat fast image processing, you need to get used to working with matrices instead of individual pixels. You have basically two options, you can either use NumPy or OpenCV, or a combination of the two. NumPy is a generic mathemtical matrix/array library, but you can do many image-related things with it. If you need something more specific, OpenCV supports many common operations on images.

A: Thanks for the responses, below is the code I used, I didn't change my original. Turns out it is fast enough but printing is a very costly operation :) It finds the x and y coords of the RGB value in less than a second
#check for certain RGB in image

##need to screen grab

import Image, sys

x = 0
y = 0

im = Image.open('C:\\Users\\sean\\Desktop\\test.jpg')
pix = im.load()
print im.size #get width and height of the image for iterating over
while x < 1914:
    value = pix[x,y] #get RGBA value of the pixel of an image
    if value == (33, 179, 80):
        #call left_click(x,y)
        print x,y
    x = x + 1
    if x == 1914:
        x = 0
        y = y + 1
print "Finished"
sys.exit()

A: Image.getpixel is considered very slow. Instead, consider using Image.getdata. That will give you a sequence with data for all the pixels through which you can iterate.
Something like this:
import Image
import math

x = 0
y = 0

im = Image.open("IMG_2977.JPG")
(width, height) = im.size
print width
print height

pix = im.getdata()

i = 0

for pixel in pix:
    print pixel
    x = i % ( width )
    y = math.trunc( i / width)
    print "x is: {}".format(x)
    print "y is: {}".format(y)
    i += 1

Without printing (just storing pixel in a variable) that runs in 2 seconds of user time (0.02 seconds of processor time) on my MacBook Pro.

A: You may want to do one of two things here.
1. Get a single pixel from the image
In this case, you don't need to iterate through the entire file. Just use im.getpixel. @Daniel makes a valid point that this is slow in a loop, but if you just want a single pixel, this is very efficient.
from PIL import Image
im = Image.open('screenshot.png')

im.getpixel((x, y))    # Returns the colour at (x, y)

2. Process multiple pixels from the image
This is best done using NumPy as @Lukáš suggests. If you want to do something like get the average colour of the 10 x 10 grid around the pixel, for example.
You can get the data as a NumPy array using scipy.misc.fromimage
from PIL import Image
from scipy.misc import fromimage

im = Image.open('screenshot.png')
data = fromimage(img)

Let's compare the time it takes to get this data against a for loop.
In [32]: pix = im.load()

In [33]: %timeit fromimage(im)
10 loops, best of 3: 8.24 ms per loops

In [34]: %timeit [pix[x, y] for x in xrange(im.size[0]) for y in xrange(im.size[1])]
1 loops, best of 3: 637 ms per loop

To summarise:

*

*scipy.misc.fromimage is the fastest, at ~8ms for a 1920x1080 image

*Looping through pix[x, y] takes ~640ms, about 80 times slower

A: There is something called pyautogui and it will find the entire image on the screen within 1-5 seconds usually, which is not too fast but seems better than you current option

A: You can get the first half of image and second half of image in 2 threads and process these halfs, but for me it speed up only for 15%. Normal speed for me is 2,7 secs at the image of height 375 and width 483. Threads speed it up to 2,3 secs. This is why I'm searching this question.


text:
Q: can someone tell me why this error appears to me? The error :
React Hook "useState" is called in function "createFlight" that is
neither a React function component nor a custom React Hook function.
React component names must start with an uppercase letter  react-
hooks/rules-of-hooks

My code:
import React, {Component} from 'react';
import { useState } from 'react'

function createFlight(){
    const [flight, setflight] = useState({flightNumber: "", departureTime: "", arrivalTime: "", departureDate: "", arrivalDate: "", cabin: "", economySeatsAvailable: "", businessSeatsAvailable: "", airport: "", from: "", to: "" });

}

export default createFlight;

A: Change the name of your component to start with an uppercase (as the error states).
function CreateFlight(){

If instead it is supposed to be a custom hook you need to name it prepending use in the name. Such as useCreateFlight

A: React hooks can only be called in React components or other React hooks.
React components have to be upper-case, like so
function CreateFlight(){
    const [flight, setflight] = useState();
}

They can then be rendered like so
<CreateFlight />

React hooks are functions that bind behaviour into a component. They have to be named "use..." like, "useFlight" or something.


text:
Q: Como receber um array e retornar outro Tenho a seguinte questão:
Necessitamos uma função maisMenos que receba um array e retorne outro com os seguintes três números:
na primeira posição, a fração de números que são positivos
na segunda posição, a fração de números que são zero
na última posição, a fração de números que são negativos
Por exemplo, maisMenos([1, 2, 0, -1]) deveria retornar [0.5, 0.25, 0.25], devido a que há 50% de positivos, 25% de zeros, e 25% de negativos.
DICA
Algumas perguntas que poderiam ajudar: Como poderia passar um array e perguntar a cada elemento se é positivo, negativo ou zero? Como poderia contabilizar os elementos? Como construir o array resultante com estes valores?

A: Seja bem vindo a comunidade e ao mundo vasto da programação. Segue a solução com as explicações:

var numeros = [1, 2, 0, -1]; //O Array de números fornecido pela questão
maisMenos(numeros); //Enviando o array para a função

function maisMenos(numeros) {
  /* Utilizando a função 'length' para obter a quantidade de elementos
  do array recebido como parâmetro */
  var quantidade = numeros.length;

  //Inicializando os contadores
  var positivos = 0;
  var zeros = 0;
  var negativos = 0;

  /*Percorrendo cada elemento do array para verificar se é um número
    positivo, negativo ou zero */
  for (i = 0; i < quantidade; i++) {
    if (numeros[i] > 0) {
      positivos = positivos + 1; //Caso seja positivo, some mais 1
    } else if (numeros[i] < 0) {
      negativos = negativos + 1; //Caso seja negativo, some mais 1
    } else {
      zeros = zeros + 1; //Caso seja zero, some mais 1
    }
  }

  //Calculando as frações
  positivos = positivos / quantidade;
  zeros = zeros / quantidade;
  negativos = negativos / quantidade;

  //Criando o novo array que exibirá os resultados fracionados
  var array = [positivos, zeros, negativos];

  //Exibindo o array com os resultados no console do navegador
  console.log(array);

  return array;
}

A: Segue a resposta. Recebe a variável de arrayEntrada e retorna um array de saída (não joguei dentro de uma variável, mas é bem simples).
function inverterArray(arrayEntrada) {
    var totalElementos = arrayEntrada.length;
    var fracaoPositivo = 0;
    var fracaoNegativo = 0;
    var fracaoNula = 0;

    // Como poderia contabilizar os elementos
    arrayEntrada.forEach(function(valor) {
        if (valor > 0) {
            fracaoPositivo++;
        } else if (valor < 0) {
            fracaoNegativo++;
        } else {
            fracaoNula++;
        }
    });

    // Como construir o array resultante com estes valores
    return [(fracaoPositivo / totalElementos), (fracaoNula / totalElementos), (fracaoNegativo / totalElementos)];
}

A: Outra forma de resolver isso é utilizando o Math.sign() do javascript, ficaria uma resolução parecida com a do nosso amigo acima. Segue o exemplo:
let valores = [1,2,0,-1];
let positivos = [];
let negativos = [];
let nulos = [];
let tamanho = valores.length;

for (let i = 0; i < tamanho ; i++) {
    let x = Math.sign(valores[i]);
    if (  x == 0  ) {
        nulos.push(i);
    } else if ( x == 1 ) {
        positivos.push(valores[i]);
    } else {
        negativos.push(valores[i]);
    }
}

let resposta = [(positivos.length/tamanho) , (negativos.length/tamanho) , (nulos.length/tamanho)];


text:
Q: 12V DC motor takes substantial amount of current when the direction is reversed I am working on an underwater ROV. I am running four 12V DC motors using an Arduino Uno and four N-type logic level MOSFETs to control the speed of each motor individually. There are also four 12V relays for each motor to change the direction of the motor when needed. The relays are turned on using the Arduino through a standard transistor circuit. I have a 7 inch motor and a car reverse camera connected to the system. The system is powered through a bench power supply at 12V, 10A.
When I am running two motors at full speed, the system is fine, although I see some noise on the monitor. If I switch the relays to turn the motors counterclockwise while the two motors are running clockwise, as soon as I switch the direction of the motor the voltage drops for a fraction of a second and the monitor turns off for a couple of seconds before turning back on. When I start the motors in reverse, everything seems fine.
Why does that happen? Why is there a voltage sag of almost 1.5V - 2V as soon as the polarity of the motors is changed? Is it because of the magnetic field inside the motor that takes a while to run in reverse which in-turn takes a lot of current? I am just guessing, I need to be educated on that and what I can do to fix it.
Also, there are horizontal lines that appear on the monitor when one motor turns on and it gets worse when all four motors are on. Is there an easy fix for this?
Please let me know if there is more information required.

A: Abruptly reversing a spinning DC motor can (and does) lead to big spikes of current, mechanical stress, and double voltage over the motor.
To reverse the motors you should first ramp down the PWM to zero - the motor should follow reducing speed; then wait a little, switch the relay, and then ramp up the PWM again.

A: The induced voltage in DC motors is the reason why the motor draws less current than the input voltage/coil resistance. The induced voltage is proportional to the r.p.m and it's like a voltage source in series with the coil resistance, but opposite to the input voltage.
When you suddenly change the input voltage polarity the induced voltage is to the same direction as the new input voltage, so the current is more than the input voltage/coil resistance - your motor draws more than when starting.
As already said by others you can brake electrically and switch the reversed voltage later. Turn the input DC at first off and direct the motor (it's as well a generator) energy to a braking load - a short circuit is very effective, the motor resistance dissipates the rotational energy.  Turn the reversed DC voltage ON when the motor has stopped (=no induced voltage).
High power systems prefer to use electronics which save energy by charging a battery with the braking energy. The braking energy is not only in the motor, it's in the moving mass of the whole moving vehicle.

A: As explained by user287001, when you reverse the polarity of the motor, it acts as a generator, but its polarity is opposite to the power supply voltage, so it will draw a lot more current than even its starting current. You can think of this "generator" as connecting a battery to your power supply, but with the wrong polarity.
On the left, the FET is ON, and the motor is powered (I drew it as a voltage source with internal resistance and inductance). Current flows according to the red arrows.

In the second schematic, the relay just reversed the motor polarity, so the voltage source polarity and inductor polarity are also inverted on the schematic. Due to the motor inductance, which has been flipped around, current reverses. This isn't a problem, if the FET is ON it'll go through the FET, otherwise it'll go through the body diode. This lasts a very short time.
Schematic 3: Once the inductance is discharged, the motor is still a generator, but its polarity is now opposite to the power supply. Therefore, current will be much larger than the motor starting current. When a motor acts as generator, the output voltage is roughly proportional to rpm, so the faster it goes, the more trouble you'll have when reversing polarity. In addition, the motor gets close to double the usual voltage and current, so if the power supply doesn't wimp out, it'll deliver double the torque... and the torque will change sign very fast... which means some fasteners designed for the nominal torque may just give up. Basically, reversing polarity on a motor running at full rpm can have some pretty spectacular effects, like the machine jumping off the floor and throwing some spare parts around.
Schematic 4: if you set PWM to zero (turning off the MOSFET) however, the polarity of the motor-generator's output voltage is such that it will be shorted by the diode.
So, you can't switch polarity and apply full power on a dime. You could reverse polarity and set PWM to zero at the same time, then wait for a while until the energy stored in the motor's rotational inertia is dissipated in both the diode and the motor's winding resistance. Make sure the diode can withstand this, otherwise it will fry. Then, wait for the motor to slow down. Once it has slowed down enough, you can then ramp up the PWM to start it in the other direction. The diode provides a convenient way to short the motor to slow it down faster, but it will do so only if the relay reverses the polarity and the FET is OFF. If the relay is not reversed and the FET is OFF, the motor will simply coast. So depending on the relay position, you either get braking or coasting.
An option would be to use a MOSFET driver with an integrated RS latch and  comparator, like MCP1630, or other similar scheme. Basically, a current sense resistor in the MOSFET source monitors motor current, and turns off the FET when it exceeds a set value, which shortens the PWM cycle and ensures current never goes above the maximum that your power supply or battery can tolerate.
Otherwise you'll have to use fixed delays in your code, or monitor the motor current in some way, to ensure enough delay between reversing the polarity and turning the MOSFET ON again.
So if you want to be able to reverse direction quickly with your ROV, it all depends on the inertia of the motors and propellers. More inertia means you'll have to wait for longer.
Since this is an underwater ROV, the water itself could load the motors enough to slow them down, which would allow quicker change of polarity. But the opposite could also be true, if the ROV is advancing and the motors are powered down, its speed through the water may force the propellers to turn, and then your motor may not slow down as quickly as you want. I have no idea which of the two will win. Testing on a bench in air won't answer that question either.
So I guess you'd need to run a test in water: go full speed, revrese the relay and set PWM to zero, shorting the motors with the diodes, and time how long it takes for them to go from full RPM to something easier to turn around, like 25% rpm. See if that delay is okay, if it's not too long to feel sluggish to the operator.
Another option would be to use a H-bridge. In this case, the motor's inductance is exploited to turn the H-bridge into a boost converter when it acts as a generator during braking, which recovers the energy into your battery. However, this needs a smart control algo to adjust the PWM. Not rocket science, but not 2 lines of code either.
I guess that's why variable pitch propellers are popular...


text:
Q: Rust "combine" iterators? I am curious if rust has some buildin function to combine iterators aka. "every element from A with every element from B". Similar how haskell handles [(x,y)| x <- [1..3], y <- [3..6]]
    let t = (1..3)
        .into_iter()
        ."combine"((3..6) //Magic goes here?
            .into_iter())
        .collect::<Vec<usize>>();
    assert_eq!(t, vec![(1,3),(2,3),(1,4),(2,4)....]);

Thanks :D


text:
Q: How to create a function in powershell that runs a macro in an Excel workbook? How do I create a function in powershell that runs a macro in an Excel workbook?
I've tried the following:
Function xlRunMacro($excel, $macroname){
    try{
    $excel.Run($macroname)
    }catch{
        echo $error
        $key = 'Open-Excel';
        $date = Get-Date -Format 'yyyy-MM-dd';
        Log-Error $key $date;
        $error.Clear()
    }
}

$macroname = "'delete_old'"

$setexcel = New-Object -ComObject Excel.Application
$currentworkbook = $setexcel.Workbooks.Open("${paths}${files}")
xlRunMacro($setexcel, $macroname)

However, I get this error:
Method invocation failed because [System.String] does not contain a method named 'Run'.
Any ideas please?

A: As @Lee_Dailey mentioned, params need to be separated.
To be on the safe side generally, it's a good idea for functions to accept params by name rather than position.
e.g.
Function xlRunMacro{
    param(
        $excel,
        [string]$macroname
    )
    $excel.Run($macroname)
}

xlRunMacro -excel $setexcel -macroname $macroname


text:
Q: Adding a bootstrap class to rails form time_select field Bootstrap has the class 'form-control' to add to select boxes to give them styling. I was able to do it successfully so for the following field:
 <%= f.collection_select :team_a_id, @teams, :id, :name, {prompt: "Select first team"}, {class: "form-control"} %>

However I have the following form field for time_select. I need to apply an html class(preferably "form-control") to the following form field and have not been successful in doing so with the same approach above.
 <%= f.time_select :match_time, prompt: {hour: 'Choose hour', minute: 'Choose minute'}, minute_step: 15 %>

How would I approach this problem?

A: The html_options is the third parameter, as described in the docs:
time_select(method, options = {}, html_options = {})

so something like this should work:
 <%= f.time_select :method, { prompt: {hour: 'Choose hour', minute: 'Choose minute'}, minute_step: 15 }, { class: 'form-control' } %>

A: From DOCs
time_select(object_name, method, options = {}, html_options = {})
Probably you are looking smth like this:
<%= f.time_select :match_time, '', {prompt: {hour: 'Choose hour', minute: 'Choose minute'}, minute_step: 15}, class: "form-control" %>


text:
Q: Empty Reports in crystal report from datasets in c#? I am working on crystal report, i am using data set in c#, i create them by wizard, after that i choose the crystal report and created a report through the same dataset, and wrote following code.
    String temp = "c:\\a.pdf";

    DataSet1 ad = new DataSet1();

    ReportDocument d = new ReportDocument();

    d.Load("c:\\CrystalReport2.rpt");

    d.SetDataSource(ad.Tables[0]);

    d.Refresh();

At table[0] my employee tables lies. Problem is i am getting empty reports.. although my table is pretty much populated with records.

A: I actually solved the problem my self.. I was lacking the table names which i have to send to dataset while filling them. Because of difference of name of dataset and provided name they table was un able to be fetched so the reports were empty.


text:
Q: Symfony2 classess and repository name That is simple for you, but I can't understand the  difference (if it exist) between two "name" of this same class:
First if I use php function (get_class()) for some entity I get something like structure to directory to class of this object (App\Module\Class).
Second: If i want to get some data form db I have to use a repository name as AppModule:Class
So is there any method to transform first naming to second?
I don't know how you naming this two methods, I am sorry for my mistakes.

A: If you use ClassName::class where ClassName is whatever a class is, you'll obtain the class FQCN (Fully Qualified Class Name; in your example, for instance, App\Module\Class)
I suggest to use ClassName::class every time you can instead of VendoBundle:Class convention
This will work only if you use PHP >= 5.5 btw, but I hope you do!


text:
Q: GSheet Script: How to Optimize my Row and Sheet Iterator Long story short, I have this bit of Google Script that clears content automatically in a GSheet. It is set on a trigger and it works...the code does what it's supposed to do. The issue is that it runs slow. It takes 2 to 3 minutes for the iterator to run. To help you scope the size of the task: there is 150 rows on each of the 8 sheets.
The objective of the code is to clear a number of rows on each sheet based on the value of the cell in the first column of a row.
So I would like to know if anyone has any insight or suggestion to improve the running time. I understand my method of using a for loop checks rows one by one, and that's a time-consuming task. I couldn't think of an alternate method with arrays or something?
Thanks all!
Here's the code:
     function Reset_Button() {

      var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();

       for (var i = 1; i < sheets.length ; i++ ) {

         var sheet = sheets[i];
         sheet.getRange("C2").setValue(new Date());

         var rangeData = sheet.getDataRange();
         var lastRow = rangeData.getLastRow();
         var searchRange = sheet.getRange(1,1, lastRow, 1);

            for ( j = 1 ; j < lastRow ; j++){

              var value = sheet.getRange(j,1).getValue()
                if(value === 0){
                sheet.getRange(j,2,1,5).clearContent()
  }}}}

A: Typically you want to do as few writes to the spreadsheet as possible. Currently your code goes through each line and edits it if necessary. Instead get the entire data range you will be working with into one variable (let's say dRange and use .getValues() to get a 2d array of all the values into a second variable (let's say dValues). Then simply iterate over dValues, setting a blank "" in each you want to clear. Once you are done going over all values, just do a dRange.setValues(dValues) (that's why I said to keep the range in a separate variable). So as an example, the following will clear columns B through F if column A has a 0
function test(){
  var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();

  for (var i = 1; i <sheets.length; i++) {
    sheets[i].getRange("C2").setValue(new Date());
    var dRange = sheets[i].getDataRange();
    var dValues = dRange.getValues();

    for (var j = 1; j < dRange.getLastRow(); j++){
      if (dValues[j][0] == 0) {
        for (var c = 1; c < 6; c++) {
          dValues[j][c] = ""
        }
      }
    }
    dRange.setValues(dValues);
  }
}

For a single sheet of ~170 rows this takes a few seconds. One thing to note is that I wrote it based on your script, you set a date value in C2 however in your sript (and thus in the one I wrote based on yours) that falls within the range you are checking to be cleared, so double check your ranges


text:
Q: How to split a Pandas dataframe into multiple csvs according to when the value of a column changes So, I have a dataframe with 3D point cloud data (X,Y,Z,Color):
dataframe sample
Basically, I need to group the data according to the color column (which takes values of 0,0.5 and 1). However, I don't need an overall grouping (this is easy). I need it to create new dataframes every time the value changes. That is, I'd like a new dataframe for every set of rows that are followed by and preceded by 5 zeros (because single zeros are sometimes erroneously present in chunks of data that I'm interested in).
Basically, the zero values (black) are meaningless for me; I'm only interested in the 0.5 (red) and 1 values (green). What I want to accomplish is to segment the original point cloud into smaller clusters that I can then visualize. I hope this is clear. I can't seem to find answers to my question anywhere.

A: First of all, you should understand the for loop well. Python is a great programming language for using the code of any library inside functions and loops. Let's say you have a dataset and you want to navigate and control column a. First, let's start the loop with the "for i in dataset:" code. When you move to the bottom line, you have now specified the criteria you want with the code if "i[a] > 0.5:" in each for loop. Now if the value is greater than 0.5, you can write the necessary codes to create a new dataset with all the data of the row you are in. In terms of personal training, I did not write ready-made code.


text:
Q: Rails 3.2 and bootstrap - how do I create a inline form? I am trying to assign a form-inline class to the following form in rails

    <%= form_for @annual do |f| class="form-inline" %>
      <%= render 'shared/error_messages', :object => f.object %>

      <%= f.label :a %>
      <%= f.text_field :a class="input-small" placeholder="a" %>

      <%= f.label :b %>
      <%= f.text_field :b class="input-small" placeholder="b" %>
      .
      .
      .

The bootstrap documentation for inline forms is here:
http://twitter.github.com/bootstrap/base-css.html?#forms
When I try the above approach for the classes and placeholders, I get an error. What is the correct way to do this in rails?

A: In case this helps someone, I had to do :html => {:class -> "form-inline"} for it to add the css class in Rails 4.

A: I found the solution via google, for those interested it is:

  <%= form_for @annual, {:class => "form-inline"} do |f| %>
    <%= render 'shared/error_messages', :object => f.object %>

    <%= f.text_field :a, :class=> "input-small", :placeholder=>"a" %>

    <%= f.text_field :b, :class=> "input-small", :placeholder=>"b" %>


text:
Q: Type theory for $\infty$-categories: how do we inhabit $\text{hom}$ types? I've started reading Riehl and Shulman's A type theory for synthetic $\infty$-categories, which looks like it develops some beautiful theory, but I want to make sure I'm not misunderstanding some of the initial formalities. In particular, I want to make sure I understand the constructor for function types out of shapes.
For instance, recall $\Delta^1:\equiv\{t:\mathbb{2}\space\vert\space\top\}$ (for definitions and formal deduction rules I refer you to the linked paper). Now, as I understand it, given a type $A$, to define a non-dependent function $\Delta^1\rightarrow A$ (shorthand for $\langle \Delta^1\rightarrow A\space\vert\space^{\bot}_{\text{rec}_\bot}\rangle$), we need a term $a$ (possibly containing $t$ free) such that $\{t:\mathbb{2}\space\vert\space\top\}\vdash a:A$; then $(\lambda t.a):\Delta^1\rightarrow A$. The problem is, I don't see how to define any non-constant functions of this kind (ie functions where $a$ has non-trivial dependence on $t$).
I believe the only non-trivial rule for constructing type elements that depend on shape variables is the given recursion principle for disjunction of topes, which says that if $\{t:I\space\vert\space\varphi\}\vdash a_\varphi:A$, $\{t:I\space\vert\space\psi\}\vdash a_\psi:A$, and $\{t:I\space\vert\space\varphi\wedge\psi\}\vdash a_\varphi\equiv a_\psi$, then $\{t:I\space\vert\space\varphi\vee\psi\}\vdash \text{rec}^{\varphi, \psi}_\vee(a_\varphi, a_\psi):A$, with computation rules given by $\{t:I\space\vert\space\varphi\}\vdash \text{rec}^{\varphi, \psi}_\vee(a_\varphi, a_\psi)\equiv a_\varphi$ and $\{t:I\space\vert\space\psi\}\vdash \text{rec}^{\varphi, \psi}_\vee(a_\varphi, a_\psi)\equiv a_\psi$. So, for instance, defining non-trivial functions out of the boundary $\partial\Delta^1:\equiv \{t:\mathbb{2}\space\vert\space t\equiv 0\vee t\equiv 1\}$ is easy: just choose terms $a_0, a_1:A$, and then $\lambda t.\text{rec}^{t\equiv 0, t\equiv 1}_\vee(a_0, a_1):\partial\Delta^1\rightarrow A$.
However, I cannot see any way of writing $\top$ as a disjunction that would allow this recursion principle to be useful for maps out of $\Delta^1$. In particular, I do not understand how we would inhabit a $\text{hom}$ type with non-trivial elements; recall that given a type $A$ and terms $x, y:A$, we define $\text{hom}_A(x, y):\equiv\langle\Delta^1\rightarrow A\space\vert\space^{\partial\Delta^1}_{\text{rec}^{t\equiv 0, t\equiv 1}_\vee(x, y)}\rangle$. It seems to me that the only way we can inhabit this type (with only the rules given so far) is if $x\equiv y$, and in this case the only inhabitant we can construct is $\lambda t.x$. (Which is imagine is supposed to correspond to the "identity morphism" at $x$?)
As a first question, I would just like someone to confirm for me that this is a correct understanding. As a second question, if that is the case, this situation seems to me comparable to the fact that the only constructor for identity types in undirected HoTT is $\text{refl}$. Indeed, if I remember correctly, it is relatively consistent in Martin-Lof type theory without univalence for every type to be a set. However, once one has univalence, then one can begin constructing non-trivial paths – for instance, the path induced by the non-trivial auto-equivalence of $\mathbf{2}$. So, my question is whether there is anything analogous in Riehl and Shulman's theory. A priori can one exhibit a type with a non-trivial $\text{hom}$ type? And if not, is there a "directed analog" of the univalence axiom that would allow us to construct them?
Bear in mind that I haven't yet read the paper in any detail, so apologies if this is discussed somewhere within it – I want to make sure that I'm understanding these preliminaries before tackling the paper in full. Also, if possible, I would prefer answers that don't depend too heavily on the semantic interpretation of this theory in Segal spaces, as I am not well-versed in the latter. I do know basic definitions though so could (hopefully) follow if that language is necessary to answer the question properly.

A: You're correct that in our type theory without additional axioms, there are no nontrivial closed terms in hom-types.  (Of course, by hypothesizing elements of hom-types, we can produce other elements of hom-types.)  Thus, the theory is only potentially a theory of $(\infty,1)$-categories, in the same way (as you said) that MLTT is potentially a theory of $\infty$-groupoids.  Directed univalence is a subject of current research; Cavallo-Riehl-Sattler have proven a form of it in the bisimplicial model, and Weaver-Licata have a constructive version in a bicubical model, but I don't think any of it has appeared publically yet.


text:
Q: How to display a "historic" image file in a mediawiki article in mediawiki you embed images in articles using the following notation:

*

*[[File:filename.extension|options|caption]]
this notation always(!) displays the latest and greatest file on the article.
every file (including images) keep their file history, in which it is possible to see what has changed over time.
question:
I would like to display a certain version of a file in an article and am not able to figure out how this is done.
does somebody know an elegant way to do this?

A: Not using mediawiki, but here is some info that might be helpful.
Help:URL says:

To link to a particular version of a page:
  http://en.wikipedia.org/w/index.php?title=Train&oldid=1374279.
   Note that the version ID is unique across all pages, so the title parameter here has no effect, and can in fact be omitted.

This only seems useful if the page contains just the one image.
Manual:Hooks mentions the GetMetadataVersion extension described as :

Allows to modify the image metadata version currently in use

To know if one of the above is useful will require more knowledge about mediawiki than I have.

A: I can't find a source for this yet, but I believe this is not supported in MediaWiki for practical reasons: If someone vandalizes an image, the image can be protected. If you could display an older (vandalized) version of the image by editing the page it was displayed on, it would nullify the protection of the image.


text:
Q: How to set TCP_CORK option in Java code I'm using java 7, java nio to build my application. I don't know how to set TCP_CORK option in java code.
I just see TCP_NODELAY, SO_SNDBUF... options.
Please tell me how.
Thank you

A: You can't. TCP_CORK is a Linux specific socket option and not specified by e.g. POSIX. It's therefore platform specific and not available in Java.


text:
Q: Trouble loading data for TableView from server Im using a web-service API to load information from a DB (mySQL). When transitioning to a UITableViewController, I retrieve an array that contains categories in the VieDidLoad method. However, I am not able to display the array of categories that I got into the table view cells. When I init the category NSMutubaleArray and hardcode it on the otherhand, the tableview does display the information. I am trying to understand what I'm doing wrong in the steps of loading this array and populating it onto the tableview. Here is my code:
- (void)viewDidLoad
{
[super viewDidLoad];

//When I init the _categoryList the way below, it displays the info.
//_categoryList = [[NSMutableArray alloc] initWithObjects:@"Trending",@"Sports",@"Portraits", @"Art",@"IdUser", nil];
    _toCategory = [[NSString alloc]init];

//When I try to populate it from the server it doesnt work.
_categoryList = [[NSMutableArray alloc]init];
//just call the "getCategories" command from the web API
[[API sharedInstance] commandWithParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:
                                         @"getCategories",@"command",
                                         nil]
                           onCompletion:^(NSDictionary *json) {
                               //got stream
                               NSArray *tempArray = [json objectForKey:@"result"];
                            for (int i=0;i<tempArray.count;i++){

                                [_categoryList insertObject:[tempArray objectAtIndex:i] atIndex:i];

                               }
                               //I verify that I was able to retrieve the array with the correct conent.
                               [self printArray:_categoryList];
                               NSLog(@"got categories");
                               [self.tableView reloadData];
                           }];
}

Any help would be greatly appreciated. Thanks!
UPDATE #1:
The JSON return is an array with NSDictioanry's. I print out its contents just to make sure, by calling the JsonArray objectForKey['categories'] and get this:
   SwiphtMVPClone[2410:11303] Array at Index 0 = Trending
   SwiphtMVPClone[2410:11303] Array at Index 1 = Sports
   SwiphtMVPClone[2410:11303] Array at Index 2 = Portraits
   SwiphtMVPClone[2410:11303] Array at Index 3 = Art

Right now, my app is actually crashing – getting this error:
 [__NSCFDictionary isEqualToString:]: unrecognized selector sent to instance 0x72a85d0


text:
Q: Prettier Code Formatter for VS code fails with 'No loader specified for extension ".cjs"' In VS Code, When I select Format Document With... then choose Prettier - Code Formatter, I get the following error:
Command 'Format Document' resulted in an error (No loader specified for extension ".cjs", so searchPlaces item ".prettierrc.cjs" is invalid)

From what I can gather this has something to do with underlying TypeScript in VS Code not having a loader available for .cjs files and Prettier searching for prettierrc.cjs but I can't quite see how that all fits together, or how to work around it.
Has anyone else encountered, found a work around or solved this or a similar issue in VS Code?

A: I tried disabling the Prettier VS Code extension and enabling it again and that fixed the issue for me.
Credits @NikolajDamLarsen


text:
Q: XmlSerializer ignores [XmlAttribute] in WebApi I have a WebApi that returns a simple object, but when I'm forcing it to return as XML (Accept: application/xml) it ignores the [XmlAttribute] attribute I've set on the object.
This is my object:
public class Foo
{
    [XmlAttribute]
    public string Bar { get; set; }
}

And I return it like this in the code:
[RoutePrefix("api/mytest")]
public class MyTestController : System.Web.Http.ApiController
{
    [HttpGet]
    [Route("gettest")]
    public Foo GetTest()
    {
        return new Foo() { Bar = "foobar" };
    }
}

The resulting XML is:
<Foo>
    <Bar>foobar</Bar>
</Foo>

Whereas I would expect it to be returned like this:
<Foo Bar="foobar">
</Foo>

Why does the XmlSerializer used by WebApi ignore the [XmlAttribute] attribute, and how can I make it work like I want to?

A: Try setting this global configuration value in your WebApi to true
GlobalConfiguration.Configuration.Formatters.XmlFormatter.UseXmlSerializer = true;

By default Web API uses DataContractSerializer in XmlMediaTypeFormatter.

A: This worked for me... no need to change global configuration.
var configuration = new HttpConfiguration();
configuration.Formatters.XmlFormatter.UseXmlSerializer = true;
return Request.CreateResponse(HttpStatusCode.OK, myObjectToSerialize, configuration);


text:
Q: Running Parameterized Stored Proc From Power Query I have been following the tutorial HERE but anytime I try to refresh the workbook, it gives me an error of:

DataSource.Error: Microsoft SQL: This database function doesn't support the query option 'Query' with value 'null'.

This is the SQL behind the query, and nothing is returning null, and the stored proc is set-up to accept 3 input parameters.
CSR=Excel.CurrentWorkbook(){[Name="param"]}[Content]{0}[#"CSR"],
d1=Excel.CurrentWorkbook(){[Name="param"]}[Content]{0}[#"d1"],
d2=Excel.CurrentWorkbook(){[Name="param"]}[Content]{0}[#"d2"],
Source = Sql.Database("ServerInstanceName", "Credentials",
[Query="exec [dbo].[StoredProcToRun] '" & Number.ToText(d1)
& "''," & Number.ToText(d2) & "','" & CSR & "'"])

And this is the set-up of my stored procedure showing it accepts 3 params:
Alter PROCEDURE dbo.StoredProcToRun
@d1 varchar(50), @d2 varchar(50), @CSR varchar(500)

AS
BEGIN

What do I need to modify in order for this power query to pass the Excel Parameters to my SQL stored procedure and return the data back to the Excel workbook?
I altered my power query sql to the below and now I get an error of

Token comma expected

[Query="exec [dbo].[StoredProcToRun]
& Number.ToText(d1) & "','"
& Number.ToText(d2) & "','"
& CSR & "'"])

A: make sure to have a string when concatenating your substrings.
Values, which are numeric (e.g. CSR) have to be converted to a string for the concatenation.
CSR=Excel.CurrentWorkbook(){[Name="param"]}[Content]{0}[#"CSR"],
d1=Excel.CurrentWorkbook(){[Name="param"]}[Content]{0}[#"d1"],
d2=Excel.CurrentWorkbook(){[Name="param"]}[Content]{0}[#"d2"],
Source = Sql.Database("ServerInstanceName", "Credentials",
    [Query="exec [dbo].[StoredProcToRun] '" &
    Number.ToText(d1)  & "','" &
    Number.ToText(d2)  & "','" &
    Number.ToText(CSR) & "'"])

see also here an another example as the tutorial you found.
Just tried with a part of the script to generate the string for the EXEC Statement.
Eventually try to generate the string and copy it on Management Studio to check if it works there.


text:
Q: Question about Change of Variables Proof To prove change of variables in Differential geometry, we first prove the following lemma:

Lemma 1. Suppose that the change of variables theorem holds for the diffeomorphisms $g:U\to V$ and $h: V\to W$ (and all of $f$). Then it also holds for $h\circ g: U\to W$ (for all $f$).
  Proof: (1)
  $\\
 \int_W f=
\\(2) \int_V(f\circ h)|\det Dh|=
\\
(3)\int_U(f\circ h \circ g))|(\det Dh)\circ g||\det Dg|=
\\
(4)\int_U (f\circ h\circ g))|(\det D(h\circ g)| \text{ (by the chain rule}).$
  $\\$

These are the notes my professor gave. The part of this proof I don't understand is getting from (2) to (3) because I don't totally understand $|\det Dh|$. I know that $\det Dh$ will be the function obtained from taking the derivative of the diffeomorphism $h$, and we know $\det Dh\neq 0$. But then what do we know about $|\det Dh|$? Is this function continuous? How are we guaranteeing that when I multiply $|\det Dh|$ with the continuous function $(f\circ g)$ that I still have some continuous function that I can apply the change of variables theorem to?
I'm brand new to differential geometry, so feel free to talk to me as if I don't know what I'm talking about! :D
Thanks!

A: yes the scalar valued function det Dh is a sum of products of+-1 and partial derivatives the h_i's where h = (h_1,h_2,...h_n) so is continuous  so |det(Dh)| is also continuous and it's product with the continuous f0g is also continuous .So you are fine getting from (2) to (3) by applying the theorem to g .

A: Let us investigate the expression $|\det Dh|$ you pointed out as a possible obstacle in your understanding. Specifically, if we $h$ being a diffeomorphism implies that $|\det Dh|$ is smooth.
We assume $h \colon V \rightarrow W$ is a diffeomorphism. This means that the partial derivatives $\frac{\partial h^i}{\partial x^j}$ are smooth functions for all $i,j \in \{1,..,n \}$ (where $n = \dim U = \dim V = \dim W)$. The differential $Dh$ may be represented via the Jacobian matrix of $h$. Entries of this matrix are the partial derivatives, i.e. $(Dh)_j^i =  \frac{\partial h^i}{\partial x^j}$. The expression $\det Dh$ is the determinant of $Dh$, that is, a polynomial with monomials given by products of the partial derivatives. Lets see why the implication $$h \text{ smooth } \Rightarrow \det Dh \text{ smooth}$$ holds.
Because a product of arbitrary smooth functions is a smooth function (consequence of the product rule), the monomials in $\det Dh$  must be smooth. Observe that any polynomial is given be the sum of its monomials and that a finite sum of smooth functions is a smooth function. Thus we know $\det Dh$ is a smooth function. Now we will make clear why the following holds $$h \text{ diffeomorphism } \Rightarrow |\det Dh| \text{ smooth.} $$
Because $h$ is a diffeomorphism, corresponding $Dh$ is a regular matrix, meaning: $\det Dh \neq 0$ holds on the whole domain of $h$. This implies that $\det Dh$ is always either positive or negative, therefore applying absolute value function on $\det Dh$ will not violate the smoothness. We conclude that $|\det Dh|$ is smooth.


text:
Q: Wordpress behind reverse proxy Our organization is remaking it's site. Someone had set up new site on new server. It can be accessed after putting an entry in /etc/hosts. And works perfectly when accessed this way.
But since most of the people involved, are not good with computers I've decided to setup a reverse proxy.
I don't have access to the site nor the server witch hosts it. I have an editor account on Wordpress installed there.
I've put an entry in /etc/hosts of my private server and setup reverse proxy with following config, my server is running apache-2.2 under Debian stable:
<VirtualHost *:80>
    ServerName xxx.xxx.xxx.xxx
    ProxyRequests off
    ProxyPass /some/prefix/ http://site.example.com/
    ProxyPassReverse /some/prefix/ http://site.example.com/
    ProxyHTMLURLMap http://site.example.com/ http://xxx.xxx.xxx.xxx/some/prefix/
    <Location /some/prefix/>
            SetOutputFilter INFLATE;proxy-html;DEFLATE
            ProxyHTMLURLMap  http://site.example.com/ /some/prefix/
    </Location>
    ProxyPassReverseCookieDomain site.example.com xxx.xxx.xxx.xxx
    ProxyPassReverseCookiePath / /some/prefix/
    ProxyHTMLExtended On
</VirtualHost>

Almost everything works. I can't make new posts(the text editor does not load properly). Iceweasel's(Firefox) developer mode says:
(...)
[00:13:33.365] GET http://xxx.xxx.xxx.xxx/some/prefix/wp-includes/js/tinymce/langs/pl.js?wp-mce-4107-20141130 [HTTP/1.1 404 Not Found 399ms]
(...)
[00:13:33.648] Failed to load: http://xxx.xxx.xxx.xxx/some/prefix/wp-includes/js/tinymce/langs/pl.js
[00:13:46.733] POST http://xxx.xxx.xxx.xxx/wp-admin/admin-ajax.php [HTTP/1.1 404 Not Found 102ms]

I've omitted non errors.
It seems to me that Apache is not rewriting something.
Any ideas?

A: Here my working config for your case.
<VirtualHost *:80>
    ServerName proxy.example.net
    ProxyRequests off
    ProxyPass /some/prefix/ http://backend.example.net/
    ProxyPassReverse /some/prefix/ http://backend.example.net/

    <Location /some/prefix/>
            ProxyHTMLEnable On
            ProxyHTMLExtended On

            ProxyHTMLLinks  a               href
            ProxyHTMLLinks  area            href
            ProxyHTMLLinks  link            href
            ProxyHTMLLinks  img             src longdesc usemap
            ProxyHTMLLinks  object          classid codebase data usemap
            ProxyHTMLLinks  q               cite
            ProxyHTMLLinks  blockquote      cite
            ProxyHTMLLinks  ins             cite
            ProxyHTMLLinks  del             cite
            ProxyHTMLLinks  form            action
            ProxyHTMLLinks  input           src usemap
            ProxyHTMLLinks  head            profile
            ProxyHTMLLinks  base            href
            ProxyHTMLLinks  script          src for
            ProxyHTMLLinks  iframe          src

            RequestHeader    unset  Accept-Encoding

            ProxyHTMLURLMap  /wp-admin/  /some/prefix/wp-admin/
            ProxyHTMLURLMap  \/wp-admin\/ \/some\/prefix\/wp-admin\/
            ProxyHTMLURLMap  http://backend.example.net/ http://proxy.example.net/some/prefix/
    </Location>
    ProxyPassReverseCookieDomain backend.example.net proxy.example.net
    ProxyPassReverseCookiePath / /some/prefix/

#    LogLevel warn proxy_html:trace3
    ErrorLog ${APACHE_LOG_DIR}/errorprox.log
    CustomLog ${APACHE_LOG_DIR}/accessprox.log combined

</VirtualHost>

Some explanations

*

*I have to set ProxyHTMLLinks because there are some errors in apache log below. The configuration was ripped from this blog post.

[Sun Dec 21 23:02:49.053825 2014] [proxy_html:trace1] [pid 3368:tid 140385487116032] mod_proxy_html.c(823): [client 36.71.243.192:56711] No links configured: nothing for proxy-html filter to do

*Parameter RequestHeader    unset  Accept-Encoding was used to substituting parameter SetOutputFilter INFLATE;proxy-html;DEFLATE. The effect is traffic between proxy and real wordpress wasn't compressed. See this page for the details.

*URL wp-admin/admin-ajax.php was defined and called by javascript. Parameter ProxyHTMLExtended On should do this job.

*URL wp-admin/admin-ajax.php defined without domain (you can see it when clicked View Page Source in Firefox). This caused parameter http://site.example.com/ /some/prefix/ doesn't match this string. So, I set new parameter

*

*ProxyHTMLURLMap  /wp-admin/  /some/prefix/wp-admin/ for regular string.

*ProxyHTMLURLMap  \/wp-admin\/ \/some\/prefix\/wp-admin\/ for escaped string.


text:
Q: How ubuntu cloud image instance persist writing to the console after systemd started? I am creating the cloud image for ubuntu I a try to figure out, how it writes all informations on the serial console when running in the cloud.
I used this image:
https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
When I try to recreate that behaviour on my image it stops writing after journald is started
[   11.192345] systemd[1]: Starting Create list of required static device nodes for the current kernel...
[   11.362003] systemd[1]: Mounted RPC Pipe File System.
[   11.461612] systemd[1]: Mounted POSIX Message Queue File System.
[   11.555519] systemd[1]: Mounted Huge Pages File System.
[   11.649353] systemd[1]: Mounted Debug File System.
[   11.743620] systemd[1]: Started Journal Service.
^[[r^[[H^[[2J

Ubuntu 16.04.1 LTS euca-10-254-38-28 ttyS0

euca-10-254-38-28 login: Ubuntu 16.04.1 LTS euca-10-254-38-28 ttyS0

I want something similar like here:
[    3.469429] systemd[1]: Started Nameserver information manager.
[^[[0;32m  OK  ^[[0m] Started Nameserver information manager.
[    3.475530] iscsi: registered transport (tcp)
[    3.492282] systemd[1]: Started Journal Service.
[^[[0;32m  OK  ^[[0m] Started Journal Service.
[    3.511329] iscsi: registered transport (iser)
[^[[0;32m  OK  ^[[0m] Started LVM2 metadata daemon.
         Starting Create Static Device Nodes in /dev...
         Starting Load/Save Random Seed...
         Starting Flush Journal to Persistent Storage...
         Starting udev Coldplug all Devices...
[^[[0;32m  OK  ^[[0m] Started Set console keymap.
[^[[0;32m  OK  ^[[0m] Started Load Kernel Modules.
[^[[0;32m  OK  ^[[0m] Started Load/Save Random Seed.
[^[[0;32m  OK  ^[[0m] Started Create Static Device Nodes in /dev.

I added "console=tty0 console=ttyS0" to grub. I thought this is changed in /etc/systemd/journald.conf, but everything is default there.

A: I think once systemd starts, it sending output to the journal instead of the tty. In /etc/systemd/system.conf, try setting DefaultStandardOutput= to either journal+console or tty.  Reboot to test.
You can the docs for any systemd directive by starting at man systemd.directives and looking up the directive.


text:
Q: Nginx conflicting server name in server block configuration After getting certbot certificates i get the following error when doing nginx -t :
nginx: [warn] conflicting server name "naos-soultrap.online" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.naos-soultrap.online" on 0.0.0.0:80,ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Here is my server block configuration :
server {

    server_name naos-soultrap.online www.naos-soultrap.online;

    root /home/pierre/public/naossoultrap;

    index index.html index.htm;

    location / {
        try_files $uri $uri/ =404;
    }

    listen [::]:443 ssl http2 ipv6only=on; # managed by Certbot
    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/escapingthematrix.online/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/escapingthematrix.online/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = www.naos-soultrap.online) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    if ($host = naos-soultrap.online) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

     listen 80;
     listen [::]:80;
     server_name naos-soultrap.online www.naos-soultrap.online;
     return 404; # managed by Certbot
}
server {
    if ($host = naos-soultrap.online) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;

    server_name naos-soultrap.online www.naos-soultrap.online;
    return 404; # managed by Certbot

}

A: Your warning literally tell you what is wrong with the config:
nginx: [warn] conflicting server name "naos-soultrap.online" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.naos-soultrap.online" on 0.0.0.0:80, ignored

Two of your server configurations (which you have three of in total) have conflicting names.
The first server block is for https/443:
server {

    server_name naos-soultrap.online www.naos-soultrap.online;
    root /home/pierre/public/naossoultrap;
    index index.html index.htm;

    location / {
        try_files $uri $uri/ =404;
    }

    listen [::]:443 ssl http2 ipv6only=on; # managed by Certbot
    listen 443 ssl http2; # managed by Certbot

    ssl_certificate /etc/letsencrypt/live/escapingthematrix.online/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/escapingthematrix.online/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

After that you have two http/80 server blocks with identical server names and if we look close enough we can notice that the second http/80 server block here is redundant and in fact doesn't add any new configuration on top of the first server http/80 block. I would assume you can safely remove it.
server {
    if ($host = www.naos-soultrap.online) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    if ($host = naos-soultrap.online) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;
    server_name naos-soultrap.online www.naos-soultrap.online;
    return 404; # managed by Certbot
}

server {
    if ($host = naos-soultrap.online) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;

    server_name naos-soultrap.online www.naos-soultrap.online;
    return 404; # managed by Certbot
}


text:
Q: is RCS permission in Android still signature level in 2020 ? (samsung/google) I'm trying read text message from Android RCS Message Apps (Google / Samsung)
What I was trying

*

*set permission concerned with rcs

*

*com.samsung.rcs.im.READ_PERMISSION (samsung galaxy series)

*com.gsma.rcs.permission.RCS (google)

But, I got this exception.
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.sec.internal.tapi.service.provider.HistoryLogProvider from ProcessRecord{e7c133 3845:com.gilapps.rcstest/u0a240} (pid=3845, uid=10240) requires com.gsma.services.permission.RCS or com.sec.imsservice.WRITE_IMS_PERMISSION

I'm guessing that maybe permission with RCS is still signature level permission.
Am I Right?


text:
Q: why I cannot reshape or resize my numpy array I have the following output for a
 [  1.   3.   5.   7.   9.  11.  13.  15.  17.  19.  21.  23.  25.  27.
    29.  31.  33.  35.  37.  39.  41.  43.  45.  47.  97.  99. 101. 103.
    105. 107. 109. 111. 113. 115. 117. 119. 121. 123. 125. 127. 129. 131.
    133. 135. 137. 139. 141. 143.]

I want to reshape it to the below
[[1.   3.   5.   7.   9.   11.  13.  15.]
 [17.  19.  21.  23.  25.  27.  29.  31.]
 [33.  35.  37.  39.  41.  43.  45.  47.]
 [97.  99. 101. 103.  105. 107. 109. 111.]
 [113. 115. 117. 119. 121. 123. 125. 127.]
 [129. 131. 133. 135. 137. 139. 141. 143.]]

I tried to use a.resize(6, 8), but it gives me this error: "resize only works on single-segment arrays"
Also, when I am trying to use a.reshape(6, 8), it gives me the same array.
I don't understand what is the reason for that as I have tested another array and worked well.

A: try a.reshape((8, 6))
notice the double parentheses
a = np.array([1., 3., 5., 7., 9., 11., 13., 15., 17., 19., 21., 23., 25., 27.,
              29., 31., 33., 35., 37., 39., 41., 43., 45., 47., 97., 99., 101., 103.,
              105., 107., 109., 111., 113., 115., 117., 119., 121., 123., 125., 127., 129., 131.,
              133., 135., 137., 139., 141., 143.])
print(a.reshape((8, 6)))

out:
[[  1.   3.   5.   7.   9.  11.]
 [ 13.  15.  17.  19.  21.  23.]
 [ 25.  27.  29.  31.  33.  35.]
 [ 37.  39.  41.  43.  45.  47.]
 [ 97.  99. 101. 103. 105. 107.]
 [109. 111. 113. 115. 117. 119.]
 [121. 123. 125. 127. 129. 131.]
 [133. 135. 137. 139. 141. 143.]]

Process finished with exit code 0

do notice that for the output you requested, the dimensions should be
a.reshape((6,8))

out:
[[  1.   3.   5.   7.   9.  11.  13.  15.]
 [ 17.  19.  21.  23.  25.  27.  29.  31.]
 [ 33.  35.  37.  39.  41.  43.  45.  47.]
 [ 97.  99. 101. 103. 105. 107. 109. 111.]
 [113. 115. 117. 119. 121. 123. 125. 127.]
 [129. 131. 133. 135. 137. 139. 141. 143.]]

Process finished with exit code 0

you can read about NumPy's reshape here: reshape documentation

A: Try
b = a.reshape((8,6))

and keep in mind 2 things, for future use of similar methods:

*

*the reshape method takes a tuple as input, in that case (8,6) , calling b = a.reshape(8,6)  gives 2 int arguments to the method instead of the tuple it expects. always pay attention to the expected values. you can investigate that by just hovering over a function in pycharm and most editors.

*in numpy, many methods do not manipulate the given object but rather return a new value for you to use.
it is healthy to always check for that in documentation, in order to avoid catastrophic heartbreaks, trust me.


text:
Q: Translate PHP String Functions to Javascript / jQuery This is the PHP code I'm trying to translate into Javascript / jQuery.  Any ideas?
$root_folder = 'es';
$url = "http://domainNamehere.com/event/test-event-in-the-future/";

$p = strpos($url, '/', 8);
$url_new = sprintf('%s/%s/%s', substr($url, 0, $p), $root_folder, substr($url, $p+1));

A: strpos() ~ .indexOf()
substr() ~ .substring()
sprintf() ~ +

A: var root_folder = "es",
    url = "http://domainNamehere.com/event/test-event-in-the-future/",
    url_new = "",
    path_finder = /^(((http)s?:)?\/\/[^\/]+\/)/i;

url_new = url.replace(path_finder, "$1" + root_folder + "/");

A: PHP.js offers ports of many common PHP functions to JavaScript.


text:
Q: JSF2.0 display array of dynamic images I have an application that calls a service that returns a Json string with about ten images as byte array.  I loop through the Json string and pull out the images and convert them to StreamedContent and place them into an object then populate a List with the object that has the image and name of that image.  I am trying to display those image in a JSF page with the PrimeFaces  tag, but the images are not displaying.  My code follows:
ImageBackingBean
    private String sku;
private StreamedContent image;
private List<ImageBackingBean> imageList;

public String getSku(){
    return sku;
}
public void setSku(String sku){
    this.sku = sku;
}
public StreamedContent getImage() {
    FacesContext context = FacesContext.getCurrentInstance();
    if(context.getRenderResponse()){
        return new DefaultStreamedContent();
    }else{
        String id = context.getExternalContext().getRequestParameterMap().get("sku");
        List<ImageBackingBean> list = getImageList();
        for(ImageBackingBean bean : list){
            if(bean.getSku().equalsIgnoreCase(id)){
                return bean.getImage();
            }
        }
    }
    return image;
}
public void setImage(StreamedContent image) {
    this.image = image;
}

public List<ImageBackingBean> getImageList(){
    return imageList;
}

public void setImageList(List<ImageBackingBean> imageList){
    this.imageList = imageList;
}

public String getImageFromDatabase() throws IOException{
    setImageList(DBImages.getImages());
    if(getImageList() == null){
        return "error";
    }
    return "success";
}

My JSF page is simple and is as follows:
                <h:dataTable var="items" value="#{imageBackingBean.imageList}">
                <h:column>
                    <p:graphicImage value="#{items.image}">
                        <f:param name="sku" value="#{items.sku}" />
                    </p:graphicImage>
                </h:column>
            </h:dataTable>

Everything I've read online tells me this is how I need to display dynamic images.  Should I not store the images as type StreamedContent in the list?


text:
Q: Projecting a vector on orthogonal planes I am looking from an engineer point of view. I have a sensor for which I need vector projecting on two different planes.
I have the unit vector in the body frame that is to be projected and I obtained that using the rotation matrix. Also I have the unit vectors of the frame which is formed by the three planes.
If {n1, n2, t} represents those three unit vectors and s gives me the unit vector measured in body frame, how can I obtain projection of s on n1,t and n2,t plane.

A: If the vectors n1, n2, and t are mutually orthogonal, the projection of s onto the n1,t plane is "s - (sn2)n2", that is, find the projection of s onto n2, the normal to the n1,t plane, and subtract it from s. Similarly, the projection onto the n2,t plane would be "s - (sn1)n1". This is not a change of coordinate system, if that is what you wanted. If that is what you wanted, you can obtain the coordinates in the n1, n2 and t directions by dotting the unit vectors with s, i.e. "s = s_i * e_i' = s * e_i" where s_i is the component of s in the e_i direction and e_i belongs to {n1,n2,t}.


text:
Q: Android Application Crashes When Element Added to A List I have a list an element defined as such:
public List<Bullet> Bullets;
Bullet newBullet = new Bullet(0, 0, 0, 0, 0, 0, 0, 0);

When an onscreen button is pressed I run:
 newBullet.setProperties((int)(CannonCenterX + CannonEndX), (int)(CannonCenterY + CannonEndY), (int)(25*scaleX), (int)(25*scaleY), CannonEndX, CannonEndY, screenWidth, screenHeight);
 Bullets.add(newBullet);

That should change the properties of the newBullet element, and add a copy of it to the Bullet List.  However once I do that the application crashes.
The threading part here:
// try locking the canvas for exclusive pixel editing on the surface
        try {
            canvas = this.surfaceHolder.lockCanvas();
            synchronized (surfaceHolder) {
                // update game state
                this.gamePanel.update();

                // draws the canvas on the panel
                this.gamePanel.onDraw(canvas);
            }
        } finally {
            // in case of an exception the surface is not left in
            // an inconsistent state
            if (canvas != null) {
                surfaceHolder.unlockCanvasAndPost(canvas);
            }
        }   // end finally

Generates an exception and the program closes.  I have no idea why adding an already generated element to a list would crash the program.  Any help is appreciated.
-Nathan

A: You need to create the list:
public List<Bullet> Bullets = new ArrayList<Bullet>();