INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Data Access Layer - Switching from Local SQL Database to Cloud Data Storage I am creating a simple application and getting stuck with data storage option. To begin with I would like to use SQL Server as my data storage. I will not be using any special features of SQL Server, its pure tables with CRUD operations. Now I should be able to switch the underlying data store to either SQL Data Services or Amazon S3 by changing few configuration parameters. Is this possible??? If yes, can anyone provide high level guidance on how to go about it? Do I need to use Entity Framework to begin with SQL Server? Does Entity Framework supports SQL Data Services? Any common component which supports both SQL Data Services and Amazon S3? Too many questions!!! Thanks for the help in advance.
The closest ORM I know of is LightSpeed. I've never used it though. Personally, if the end goal is to use cloud storage, I'd probably just use cloud storage from the get go... If you are going to use Amazon's SimpleDB, M/Gateway has a open source db that mimics their API.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "entity framework, storage, cloud" }
How come the Prophet's father name is "Abdu ellah"? The prophet came to the world in a society that used to believe in many _fake gods_ , and especially not in the great God. The Prophet's father name is **Abdu Allah** which the translation to English is **slave of The God**. Note: **Al** _lah the **Al** in Arabic means is _unique_. So the exact translation would be **slave of the unique God** My question is: How come the prophet's father name is **slave of The God** , while God was unknown or at least not recognized back then?
As goldPseudo explained in his answer, the name Allah was known to them then. Furthermore your question assumes that they did not even know about this one Unique God, that is not totally correct, they knew about Him, and they thought that worshiping the idols would get them closer to Him, but Islam came and said no this is not the Proper way and is Shirk. See Surat Azumar Ayah 3.
stackexchange-islam
{ "answer_score": 4, "question_score": 2, "tags": "prophet muhammad, history" }
Why does this limit not exist Consider this limit: $$\lim _{x\to 4^+}\sqrt{16-x^2}$$ I had to graph this limit function and the values for $f(4)$ and $f(-4)$ were both equal to $0$, but why does the limit not exist?
I'm going to assume $x \in \mathbb{R}$. Suppose $x$ was approaching 4 from the right, i.e., $x=4.0000001$ or something. $x^2=4.0000001^2 > 4.00000000^2 = 16,$ so taking $\sqrt{16-4.0000001^2}$ is effectively taking the square root of a negative number, which is not defined in $\mathbb{R}$.
stackexchange-math
{ "answer_score": 3, "question_score": 1, "tags": "calculus" }
kivy android app: Set the api level from 19 to 26 failed I want to create an android .apk file with kivy, buildozer and Ubuntu 16.04. Now I had an android .apk but google playstore said, that the api level of 19 is not available. I have to set it on 26. Now i set the android.api to 26 in the buildozer.spec file. After running this for creating a new .apk file with an api level of 26 i get the following problem: [INFO]: Avaiable API's are (19) [WARNING]: Request API target 26 is not available, install it with the SDK and android tool.
1. Run ~/.buildozer/android/platform/android-sdk-20/tools/android update sdk 2. Select _API 26_ 3. Run ~/.buildozer/android/platform/android-sdk-20/tools/android 4. Select _Android SDK Build-tools 26.x.x_ 5. Check _aidl_ file in `~/.buildozer/android/platform/android-sdk-20/build-tools/26.x.x/`
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, python, kivy, buildozer" }
RuntimeException and ArithmeticException Java I have the following class: public class TryCatchExample { public static void main(String[] args) { try { System.out.println(1/0); }catch (RuntimeException e) { System.out.println("Runtime exception"); } catch (ArithmeticException e) { System.out.println("Trying to divide by 0 is not ok."); } finally { System.out.println("The program will now exit"); } } } The compiler throws this error: TryCatchExample.java:10: error: exception ArithmeticException has already been caught } catch (ArithmeticException e) { ^ 1 error Why does this occur? ArithmeticException is a subset of RuntimeException, so would this be throwing a RuntimeException or an ArithmeticException? Thanks!
`ArithmeticException` is a _subclass_ of `RuntimeException`, meaning that it would already be handled by the `catch (RuntimeException e) ...` branch. You can reorder the branches so that an `ArithmeticException` is caught first, and any other `RuntimeException` would fall through to the next branch: try { System.out.println(1 / 0); } catch (ArithmeticException e) { System.out.println("Trying to divide by 0 is not ok."); } catch (RuntimeException e) { System.out.println("Runtime exception"); } finally { System.out.println("The program will now exit"); }
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 0, "tags": "java, exception" }
Importing an SWF file in Actionscript 3 I have an external SWF file that I need to load at runtime. However, contained inside the SWF is a single MovieClip - in fact, it is a custom class that extends MovieClip. This custom class has its own instance variables and methods. So, there is an AS class that this MovieClip is linked to. However, when I load the SWF file in the normal way (i.e. with Loader and URLRequest), I cannot access the methods and variables of my custom class. Flash just thinks that it is of type MovieClip, and I have no access to the properties of my custom class. All that remains is the graphics inside the movie clip. Does anyone know what's going on here?
try casting it: `loadedMC.getChildAt(0) as YourCustomClass` You can even set up an interface, say `IYourCustomClass`, which can be implemented by `YourCustomClass` and import the interface in you main movie, to save some bytes. Then you code would be: `loadedMC.getChildAt(0) as IYourCustomClass` \-- this provides access to all the methods and getters/setters.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "flash, actionscript 3" }
Android JSONException "no value for key" I am a getting a JSON object from a website like this: `JSONObject response = new JSONObject(read(placeConnection));` and when I execute `response.toString();` I get the entire String for that JSON object and the key and value that I want is in there. However, when I execute `response.getString("countryName")` I get the above exception and it says there is no value for that key. Here is the JSON in String form: `{"geonames":[{"countryId":"6252001","countryName":"United States","adminCode1":"NC","fclName":"city, village,...","countryCode":"US","lng":"-76.98661","fcodeName":"populated place","toponymName":"Riverdale","distance":"1.30053","fcl":"P","name":"Riverdale","fcode":"PPL","geonameId":4488145,"lat":"34.99599","adminName1":"North Carolina","population":0}]}` Here is the error: `org.json.JSONException: No value for countryName`
Your field is inside an array structure, so your getString on first level does not work. You need to do something like (untested): JSONArray geonames = response.getJSONArray("geonames"); for(int i = 0 ; i < geonames.length() ; i++){ JSONObject geo = (JSONObject)geonames.get(i); String countryName = geo.getString("countryName"); // Do something with it }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "android, json, httpurlconnection" }
How to import a document class file into another flash file? I have 2 .fla files and one of them is associated with a class file called DocumentMain, it is a game. and what I want is when I click "stat" on the first .fla file it takes me to the game swf file. I did the myLoad function and it look like this : btnstart.addEventListener(MouseEvent.CLICK,gamecontent); function gamecontent(myevent:MouseEvent):void { var myLoader:Loader = new Loader (); var myURL:URLRequest = new URLRequest("game.swf"); myLoader.load(myURL); addChild(myLoader); } but I get an Error which is : TypeError: Error #1009: Cannot access a property or method of a null object reference. at DocumentMain()
instead of `addChild(myLoader);` add : myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler); then create this function: function onCompleteHandler(loadEvent:Event):void{ addChild(loadEvent.currentTarget.content); } or add this inisde `DocumentMain()` class: public function DocumentMain():void{ addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event):void{...
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "actionscript 3, flash, class" }
Is there a php function for generating associative array from indexed array Array ( [0] => '1 Fail' [1] => '2 Fail' [2] => '3 Pass' [3] => '4 Pass' [4] => '5 Pass' ) Array ( ['1 Fail'] => '1 Fail' ['2 Fail'] => '2 Fail' ['3 Pass'] => '3 Pass' ['4 Pass'] => '4 Pass' ['5 Pass'] => '5 Pass' ) Is there a php function to convert from array 1 to array 2 PS: I know this so i am looking for a built in function foreach($result as $value) { $assoc[$value] = $value; }
Assuming all your array values are unique: $assoc = array_combine(array_values($arr), array_values($arr));
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "php, arrays" }
Is it possible to use tweepy to update twitter status with GIF and text, when i have only the URL for the media Practically exactly what the title says. I want to tweet status with GIF in it, but I also want it to be automatically generated every time. The thing is I get just the URL, so is there any way to post just with the URL, or do I have to download it, if so could you help me with a way to autamtically download, tweet and ideally delete the Gif. I tried something like this, but it returns `FileNotFoundError: [Errno 2] No such file or directory` : import tweepy auth = tweepy.OAuthHandler("N8IPuyAGAJumrJXXXXXXXXNt2", "WDW512XtqMlkpb3fES2WjjrqbpfcD3zsw80xSqXXXXXXXXXXXy") auth.set_access_token("1536798202967601153-3s6XXXXXXXXXXXXXXXXXrZK9cHE3nO", "myVbx1FgUxyXXXXXXXXXXXXXXXXXXXXaFoWGJvKR19aCr") api = tweepy.API(auth) url = " message = "hihihihuhihi" api.update_status_with_media(message, url)
I managed to solve it by downloading the gif, then posting the tweet and then removing the gif. First I had to get different url for the gif from giphy api_response.data[x].images.original.url Then I used urllib request to download it from urllib import request ... with open("test.gif", "wb") as f: f.write(requests.get(url).content) and then I just posted the tweet and deleted the GIF import os ... api.update_status_with_media(message, "test.gif") os.remove("test.gif") Sadly I didn’t figure out how to post only with the link.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "python 3.x, twitter, tweepy, twitterapi python" }
Find $t_0$ and $x_0$ such that the Picard-Lindelöf Theorem hypothesis is satisfied. I really did not understand what should be done about this problem. > Question: > > Consider the equation $x'=\tan^2(t)(2x+3)^{1/3}$. > > i) Found $(x_0, t_0)$ such that the **Picard-Lindelöf Theorem** hypothesis for the **Initial Value Problem** is satisfied. Some hint, please. And if possible the explanation of what I have to do. thanks in advance.
Notice that the solution to your equation $x(t)$ can also be expressed as the solution to the following integral equation: $$x(t) = x(0) + \int_{t_0}^t \tan^2(s)(2x(s)+3)^{1/3} ds$$ The right-hand side is a nonlinear operator acting on a function $x$, and there is a unique solution if this operator has a unique fixed-point. Therefore, the problem of figuring out when the Picard-Lindelöf theorem applies to your differential equation transforms into a question about the conditions for which the nonlinear operator above satisfies the Banach fixed-point theorem.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "ordinary differential equations" }
Delete old records of "Local Area Connection" After network changes during lifetime of my computer, "Local area connection" ordinal number is now at 12. Ethernet adapter Local Area Connection 3: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Wireless LAN adapter Local Area Connection* 12: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Can I locate and delete records of unnecessary connections 1-11? Do they actually exist somewhere or not?
You can rename the connection to something pretty, such as "Wi-Fi" (Windows will prompt for admin elevation). If the new name will stay, you are probably OK. No need to worry about previous connection/adapter names. Otherwise (if it will create another "Local Area connection" in few days), some hardware issue likely exists. (... added later...) Anyway in output of ipconfig you'll see noise such as "isatap", hyper-v bridges and so on. You can display hidden/non-present devices in Device manager and check if these were physical adapters once connected, and delete them. Normally (if the system looks generally healthy) one does not care about few stale instances. Tampering with device manager or regedit is dangerous.
stackexchange-superuser
{ "answer_score": 1, "question_score": 2, "tags": "networking, windows 8" }
Get-WindowsFeature and Select-Object not displaying installed state? I am trying to create a script that would highlight missing features by comparing features I need installed with the installed features on a server, that I placed in my array variable in powershell. But I cannot figure out why the installed state is not displaying on my powershell? This is the script: $InstallState = "Install State" Get-WindowsFeature | Select-Object "Name",$InstallState | Where-Object {$_.$InstallState -like "Available"} I have also tried this $InstallState = "Install State" Get-WindowsFeature | Select-Object "Name",$InstallState I get the Name, but the Install State is blank.
There is no space. You can see the members with the `Get-Member` command Get-WindowsFeature | Get-Member InstallState Property Microsoft.Windows.ServerManager.Commands.InstallState InstallState {get;} Simply change it to $InstallState = "InstallState" Get-WindowsFeature | Select-Object "Name",$InstallState | Where-Object {$_.$InstallState -like "Available"}
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "powershell, powershell ise" }
How to set bold only to first level list elements? How to set bold style with CSS only to the "titles" in this code? Live example: jsbin.com/xofudovoda/ .container > ol { font-weight: bold; } <div class="container"> <ol type="I"> <li> Title 1 <ol> <li>sub 1</li> <li>sub 2</li> </ol> </li> <li> Title 2 <ol> <li>sub 1</li> <li>sub 2</li> </ol> </li> </ol> </div>
You can set bold on first level `<ol>`, and reset it on the second level `<ol>`s. .container ol { font-weight: bold; } .container ol ol { font-weight: normal; } <div class="container"> <ol type="I"> <li> Title 1 <ol> <li>sub 1</li> <li>sub 2</li> </ol> </li> <li> Title 2 <ol> <li>sub 1</li> <li>sub 2</li> </ol> </li> </ol> </div>
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "html, css" }
Where does the mass of a nucleon originate in an atom? The mass of the three quarks in the nucleons make up only about one to two percent of the mass of the nucleons. What makes up the other 98 percent?
From this wikipedia article: > In quantum chromodynamics, the modern theory of the nuclear force, most of the mass of the proton and the neutron is explained by special relativity. The mass of the proton is about 80–100 times greater than the sum of the rest masses of the quarks that make it up, while the gluons have zero rest mass. The extra energy of the quarks and gluons in a region within a proton, as compared to the rest energy of the quarks alone in the QCD vacuum, accounts for almost 99% of the mass. The rest mass of the proton is, thus, the invariant mass of the system of moving quarks and gluons that make up the particle, and, in such systems, even the energy of massless particles is still measured as part of the rest mass of the system. Also, at about 5:00 of this youtube video by Veritasium is your same question answered. This other physics.se question is also related.
stackexchange-physics
{ "answer_score": 1, "question_score": 1, "tags": "particle physics, mass energy, higgs, quarks, subatomic" }
How to calculate a group probability Problem: > If I have 10 monkeys and 30 bananas, and the monkeys are all equally likely to eat each banana. What is the probability that every monkey eats at least 2 bananas? Could someone walk me through this?
Since there are 30 bananas and 10 monkeys, there are $$\binom{30+10-1}{30}$$ ways to distribute the bananas to the monkeys. Now, to count the number of ways to distribute the bananas to the monkeys with each monkey getting at least 2 bananas, we first distribute 2 bananas each to the monkeys, leaving 10 bananas to distribute. Now, we need to distribute the 10 remaining bananas, for which there are $$\binom{10+10-1}{10}$$ ways. Hence, the probability is $$\frac{\binom{10+10-1}{10}}{\binom{30+10-1}{30}}.$$
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "probability, combinatorics" }
CaseInsensitive Socket.io in() method io.sockets.in(text).emit("Data",data); How can I make socket.io to compare the rooms in sockets without considering the case?
Add a line to convert the `text` variable to lower case. var lowerCaseText = text.toLowerCase(); io.sockets.in(lowerCaseText).emit("Data",data);
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "node.js, socket.io" }
jQuery + onClick Problem when using PHP I had a line of code just like this: <a onClick="someFunc();">Click</a> It worked fine. But I tried to output it in PHP as such: echo "<h3>" . $zone . " <a href='javascript:$('#zoneNotifUnsub').submit()'>Unsubscribe</a></h3>"; And it doesn't work. Using `onClick` or `href` makes no difference, the result is that the code doesn't work. It's clearly some issue of how PHP outputs `<a>` elements. Any help?
There is nothing wrong with PHP, you've just included a syntax error in the output, see: "<a href='javascript:$('#zoneNotifUnsub').submit()'>" Note the apostraphes? You'll need to escape them, ie: "<a href='javascript:$(\'#zoneNotifUnsub\').submit()'>" Or "<a href='javascript:$(\"#zoneNotifUnsub\").submit()'>"
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, javascript, jquery, onclick" }
WebAPI on same server, can it be accessed over http instead of https even though SSL applied on it? I have WebAPP and WEBAPI on same server. I have applied SSL certificate on both the sites under same server (both are separate applications under common IIS default website). Now my point, Can I access same WEBAPI over http instead of https form 3rd intranet application on same server and which is not a secure application? My intention to not hamper performance for 3rd site which is not secured and on the same server.
Actually It depends on your configuration. Generally, when you apply `SSL` on web server your app can now be accessed over `http` and `https` both connections. But, if you have configured it to redirect `http` version to `https` using `CSP` or server end configuration, then you can access `http` version as all requests will get automatically redirected to `https` version.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "performance, ssl, asp.net web api" }
To throw or not to throw an exception in C# > **Possible Duplicate:** > Why catch and rethrow Exception in C#? I've been scouring the net trying to find the answer to this question - What's the between the two? try { //Do Something } catch { throw; } vs try { //Do Something } catch { } or try { //Do Something } catch (Exception Ex) { //Do something with Exception Ex }
catch --> throw will actually just throw your error, so you will have to catch it somewhere else. This can be useful if you want to catch something first and then throw the error to other methods above. Example: try { // do something } catch { Console.WriteLine("Something went wrong, and you'll know it"); throw; } // won't get here anymore, the exception was thrown. While try --> catch will just let you ignore the error. try { // do something } catch { Console.WriteLine("Something went wrong, and you won't know it."); } // continuing happily
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "c#, try catch, throw" }
Need to know about this separate unidentified drive. (snapshots included) The drive in red. I don't remember when I saw it first time. I thought it was a backup drive back then. Can I remove this partition? I can provide any further details if needed ![enter image description here]( ![enter image description here](
From the size and that is a "local" disk and the WINRE marker file I would hazard a guess that it is either the EFI partition or a special utility partition that is created by 3rd party backup and/or partitioning software. Normally such partitions don't get/need a drive-letter and are hidden, but Windows may accidentally attach a drive-letter anyway and in that case you will see it. Using the Disk Administrator tool in Windows you can remove the drive-letter, but don't otherwise modify this partition because that may leave your computer un-bootable!
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "windows, windows 10" }
Formatting Phone Numbers in Non-US format I have the following code that I'm trying to refactor to format a phone number field in the format I need it in: STUFF(STUFF(STUFF(REPLACE('02 212345678','02 2','02 '), 7, 0, ' '), 3, 0, ') '), 1, 0, '(') It returns data currently as this: (02) 123 45678 where I need it in this format (02) 1234 5678 The problem is the extra space after the closing bracket and having 4 numbers either side.
Based on your example, does the following work for you? with sampledata as (select '02 212345678' num) select Concat(Stuff('() ',2,0,Left(num,2)), Stuff(Right(num,8),5,0,' ')) from sampledata
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql server, tsql" }
How to set min and max attributes for input type week I dont want users to select weeks below and above a specific date. I can't seem to figure out how it works. I know about the attributes `min` and `max`, and know how to use them for a date picker. But not for a week picker. I have tried the following: <input type="week" min="01-01-2021" max="31-12-2021"> <input type="week" min="01-2021" max="52-2021"> <input type="week" min="2021-01" max="2021-05"> // Etc. etc.
So I figured out that on this page it says we should use this: <input type="week" min="2021-W01" max="2021-W52"> And it works :)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, attributes, max, min" }
Get a value from the sheet name and cell address Many times I need to get a value from multiple sheets (to some crazy workbooks - it can be up to 200 sheets). The problem is all these 200 sheets have the same structure even their name and it is crazy for me go to link one by one though these 200 sheets. Is there any way to create a user-defined function, something like =getValue(sheetName,cell address) I tried Function GetValue(sheetName As String, cellAddress As String) As Variant GetSheetValue = Range(sheetName & "!" & cellAddress).Value End Function which works well until I switch between Excel files. The function starts to return #Value which my feeling is that it tries to search for SheetA,B,C,D @A1 on other open workbooks. !enter image description here
Try below code Function GetValue(sheetName As String, cellAddress As String) As Variant GetSheetValue = ThisWorkbook.Sheets(sheetName).Range(cellAddress) End Function
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "excel, vba" }
Hash rate of "Antminer S9" in "Antpool.com" is ZERO I setup an **Antminer S9** using this document: ( **Link to document**). And I configured connection to **antpool.com** using this guideline: ( **Link to guideline**). So, I filled out the fields as follows: Pool 1: URL: stratum+tcp://stratum.antpool.com:3333 Worker: MySubAccountNameInAntpool.com.mywork etc ... Pool 2: stratum+tcp://stratum.antpool.com:443 Pool 3: stratum+tcp://stratum.antpool.com:25 And when I **PING** to **antpool.com** , no packet is lost as follows: ![enter image description here]( However, when I see **Miner Status** , there is **no information** ! (as follows:) ![enter image description here]( Also, my hash rate in my dashboard in www.antpool.com is **zero** ! ![enter image description here]( **What is the problem?** _(If you need any further information, please let me know.)_
I found the problem. In fact, although the PING to `Antpool.com` was successful; however, the network used a proxy causing problem of connecting successfully to Antpool.com. So, after changing the network I could see the hash rate in my dashboard.
stackexchange-bitcoin
{ "answer_score": 1, "question_score": 0, "tags": "mining pools, miner configuration, asic, antminer, asicminer" }
Setting Up Custom Font Size Using Textarea, Button and javascript I am trying to set up some code, where the user can enter a number into a `<textartea>` and click a button, which will set the font size of another `<textarea>` by editing the `Style`attribute. I tried the following: <h2>Set Font</h2> <textarea id='input'></textarea> <button onclick ="myFunction()">Click</button> <textarea id='MainText' style="font-size:18px;"></textarea> <script> function myFunction(){ var InputValue = document.getElementById('input').value; document.getElementById('MainText').style.font-size = 'InputValue'; alert('Font Size Changed to ${InputValue}') } I am not sure what to do.
some syntax errors here. You are using JS to do this so you need to camelCase `fontSize`. Also, you are assigning it to a String when you should be assigning it to the variable name so get rid of those quotes. Also, you are interpolating the variable incorrectly in your alert: `alert('Font Size Changed to ${InputValue}')` You need to use backticks for this, not single quotes var InputValue = document.getElementById('input').value; document.getElementById('MainText').style.font-size = 'InputValue'; should be: var inputValue = document.getElementById('input').value; document.getElementById('MainText').style.fontSize = inputValue + 'px';
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, html, css" }
Java / Eclipse profiling: Is there a way to show the number of method calls to each method? I'm currently debugging an applications which lacks performance in one certain situation, expanding a tree node in a custom tree visualizing control, and our assumption is that it is due to some recursive calculation for the tree values. Now the idea was to trace the number of calls to each method to identify methods which are uncommonly often called, which may give us more insight where to look for the performance issue. Is there a built in profiler in Eclipse / some other way to trace the number of method calls (without or preferable with summed up run time within each method)?
The VisualVM CPU profiler can help you : <
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "java, eclipse, profiler" }
how to add a .remove extension for a zip file I am trying to send a project file via Gmail and i am having trouble sending the zip file with a .exe file in it. How can i change the zip file to fileName.zip.remove?
You can use the `+=` operator: string filename = "fileName.zip"; filename += ".remove"; The last line is equivalent to: filename = filename + ".remove"; * * * A common problem when sending e-mails is that antiviruses reject .exe files, even when they are included in zip files. You can hide the exe file in zip file if you encrypt this file. This involves giving a password to the zip file. You can write down this password in the e-mail text. The antivirus is not smart enough to use it.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "zip" }
что значит *m, = range(n+1) в питоне можете объяснить код, а конкретно строку `*m, = range(n+1)`: n, a, b, c, d = map(int, input().split()) *m, = range(n+1)
Открываем `python` и проверяем руками что делает этот код: $ python @>>> n = 10 @>>> *m, = range(n+1) @>>> m [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Видимо, `*m, = range(n+1)` это странный способ написать `m = list(range(n+1))`. Удачи в самостоятельных проверках.
stackexchange-ru_stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "python" }
Open Navigation Controller from App Delegate I've implemented an URL scheme for the redirect back to my app after payment. When a webpage direct back to my app, the app should open a navigation controller **over** the current view. (So open it modal). How to do this from the AppDelete in the `func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool`-method? Thanks in advance!
If the view controller that submitted the request is the one that should display the modal, I'd suggest a different approach. I would suggest defining a notification in the notification center that you use to notify the current view controller. In your view controller, make a call to one of the Notification center methods like `addObserver(forName:object:queue:using:)` to observe your notification. Then call a `Notification` method like `post(name:object:)` from your app delegate's implementation of `application(_:open:options:)` when you get the expected URL.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ios, swift, swift3, appdelegate" }
Retrofit @Part Multipartbody.Part with @multipart throws exception I am implementing this question Retrofit @body with @multipart having Issue. Everything works great. Problem arises while adding `@Part MultipartBody.Part` file. It throws `Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $`. I would appreciate any help. > NOTE: I am using custom converterFactory and Interceptor (by implementing Gson). Could that be problem?
`@Part MultipartBody.Part file. It throws Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $.` This is GSON error and it means that model that you provided does not match to response you received from your server (In your case you received plane string instead of JSON) In order to solve your issue please post full response from server so as your model class
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "android, retrofit2, multipartform data, multipart" }
Laravel echo server console says left the channel and again joins the channel while navigating through pages? I am trying to add realtime functionality to my `laravel` app which is being developed in `laravel-5.4`. So, I have implemented a simple chat example from the documentation that is `laravel-echo-server` with `redis` and `socket.io`. It’s working fine but I have noticed a weird behaviour that is when the user navigates to different pages across the application, the **laravel-echo-server** console says `left the channel` and again `joined the channel` so is it intended behaviour and what is the best practise to use it. am i doing something wrong here? I don't want him to left the channel, instead I want to stay him at the same connection.
If you change page, everything is lost and a new content is dowloaded from the server. So it's normal that the user "left the channel" then re"joined the channel". It's the intended behavior. If you don't want this kind of behavior, you have to stay one the same page (so implementing something like a single page application). Because when you leave a page to go to another, current scripts stops then a new world is re-created.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "node.js, laravel, socket.io, laravel 5.4, laravel echo" }
Switch Collection In a Foreach Both of the collections have ExternalIds. How would I change the collection the foreach uses depending if the argument type is 1 or 2. Do I have to do two separate loops or can I somehow use a collection T ? public ActionResult Details(string id, int type) { IEnumerable<Album> collection1 = ASR.Albums; IEnumerable<Track> collection2 = TSR.Tracks; foreach (var item in collection1) { var result = item.ExternalIds.SingleOrDefault(x => x.Id == id); if (result != null) { return View(item); } } return View(); }
Make an interface with ExternalIds as member, let Album and Track derive from that interface. public interface IExternalIds { public IEnumerable<SomeType> ExternalIds { get; } } public class Album: IExternalIds { ... } public class Track: IExternalIds { ... } public ActionResult Details(string id, int type) { IEnumerable<Album> collection1 = ASR.Albums; IEnumerable<Track> collection2 = TSR.Tracks; var collectionToUse = ((type == 1) ? collection1 : collection2) as IEnumerable<IExternalIds>; foreach (var item in collectionToUse) { var result = item.ExternalIds.SingleOrDefault(x => x.Id == id); if (result != null) { return View(item); } } return View(); }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#, asp.net mvc, loops, generics" }
Find irreducible factors without factorizing I have an exercise from my course notes that states: > Find how many irreducible factors has $f(x) = x^{26}-1$ over $\mathbb{F}_3$ and their degrees. (don't factorize it) I see immediately that the $1$ is a root of $f$. So I have $f(x)=(x-1) g(x)$ where $g$ has degree $25$ with no root in $\mathbb{F}_3$. But I don't know really how to move.
The distinct-degree factorization theorem tells us that $X^{27}-X$ factors mod $3$ into the product of all monic irreducible polynomials in $\mathbb{F}_3[X]$ whose degree divides $3$ (since $27 = 3^3$). So $X^{26}-1$ is the product of all monic irreducible polynomials in $\mathbb{F}_3[X]$ of degree $1$ and $3$ except $X$.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "abstract algebra, complex numbers, field theory, finite fields, extension field" }
Visual Studio Disabling Missing XML Comment Warning I have a project with over 500 `Missing XML Comment` warnings. I know I can remove the XML Comment feature, or paste empty comment snippets everywhere, but I'd prefer a generic solution where I can make one change that disables all warnings of this type. What I do just now is putting ///<Summary> /// ///</Summary> or #pragma warning disable 1591 was just curious if it would be possible.
As suggested above, in general I don't think that these warnings should be ignored (suppressed). To summarise, the ways around the warning would be to: * Suppress the warning by changing the project `Properties` > `Build` > `Errors and warnings` > `Suppress warnings` by entering 1591 * Add the XML documentation tags (GhostDoc can be quite handy for that) * Suppress the warning via compiler options * Uncheck the "XML documentation file" checkbox in project `Properties` > `Build` > `Output` * Add `#pragma warning disable 1591` at the top of the respective file and `#pragma warning restore 1591` at the bottom
stackexchange-stackoverflow
{ "answer_score": 369, "question_score": 237, "tags": "visual studio 2010, xml comments" }
SimpleDateFormat function parse(String s) gives wrong date As an input I have Date object(for example, exDate=Fri Aug 01 00:00:00 EEST 2014) that must be formated. After the parsing of the date, I get wrong date. SimpleDateFormat sdf = new SimpleDateFormat( "dd-MMM-YYYY hh.mm.ss.SSSSSSSSS aa", Locale.ENGLISH); String dateStart = sdf.format(exDate); Date dateF = sdf.parse(dateStart); dateStart will be equal to 01-Aug-2014 12.00.00.000000000 AM and the resut, dateF will be equal to Sun Dec 29 00:00:00 EET 2013 So, after the parsing of a string with date, the result is wrong. Maybe, somebody know the source of the problem? Or another way to format date in another `SimpleDateFormat`?
The problem is the YYYY which means: Y Week year; The actual year, which is what you are looking for would be `yyyy`. I really recommend that you go in the link above to see the full list. You should also replace the milliseconds to `.SSS` as you can't get more precise than that.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "java, simpledateformat" }
Is "on the side" an adverbial phrase you can plug anywhere? I am wondering if you can plug "on the side" (adjacent to me) as an adverbial phrase you can plug anywhere. > She stood next to me when I was watching the TV and stared at me on the side. Can you think of an example where you can't plug "on the side" after a verb + object group?
No, you cannot just use that phrase anywhere. The construction is syntactically correct, but it has semantic issues. In your sentence, _on the side_ doesn't make sense. What are you trying to describe? * She was standing beside you and looking at you. * She was staring at your side. * She was looking at you sideways. * Something else. Typically, _on the side_ has a few meanings: * In addition to. I'd like a sandwich with some fries _on the side_. * A figurative term for cheating. He was seeing someone else _on the side_. * A literal term. I was standing _on the side_ of the crowd. But _stared at me on the side_ doesn't correspond to any of the normal meanings, so it sounds strange. Whatever it is that is meant would likely not be understood. Somebody hearing that sentence would probably ask, "What do you mean?"
stackexchange-ell
{ "answer_score": 1, "question_score": 1, "tags": "grammar" }
ant java jar classpath problem <target name="results"> <echo message="Calculating QI" /> <java jar="jmt.jar" fork="true" failonerror="true" maxmemory="1024m" classpath="jmt/jmt"> <arg value="-name:KIS"/> <arg value="-results:CONSOLE"/> <arg value="../allJavas.jar"/> </java> </target> i want from folder tmp run jar file in folder jmt/jmt. It must be run inside jmt/jmt folder becouse of dependencies files. i can run it like `<java jar="jmt/jmt/jmt.jar"` but then dependencies files are not ok. I try to use classpath but not working. What i am doing wrong?
Use the `dir="jmt/jmt"` attribute to specify the folder to launch the java process in, and use `jar="jmt/jmt/jmt.jar"` to specify the jar. You probably don't need to classpath attribute at all. See <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ant" }
Java private boolean asking for return while return is there I got a weird error in my java code: error: This method must return a result of type boolean Why is this public boolean giving this error while I added return true and return false to it? My code: public void render(float delta) { .................... .... Other code .... .................... if (hasBallCollision(player)){ ball.setZy(3 * screenheight); difficulty += 0.1; } } private boolean hasBallColission(Player player){ if(ball.getX()+8*screenwidth>player.getX()-40*screenwidth&&ball.getX()+8*screenwidth<player.getX()+40*screenwidth){ if(ball.getY()>player.getY()&&ball.getY()<player.getY()+16*screenheight){ return true; } }else{ return false; } } Thanks for reading/helping!
Not all the pathways in your `hasBallColission` (you probably mean "collision") return a value. In your nested `if` statement, there's no `else` statement.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "java, boolean" }
Google indexed page a day before also reflecting in search but today everything vanish We had _robots.txt_ which disallow all robots as we were in development. We are live now. We change _robots.txt_ as per our requirement a day before. Submit indexes using Google Webmaster Tools index status. After this we can see proper result in search as well as Google images search was working as expected. Suddenly today all these things vanish from Google Search. Now again I can see old result i.e. under construction message. I checked _robots.txt_ in Google Webmaster Tools, it's ok - no crawling errors. Kindly let me know what exactly happened? How I can inform this issue to Google?
Google changes his SERP and images results dynamically. Do not disturb about this. It will take approximately a month for all your images come to index stably. If you want, you may report about it to Google, using ability from Google Webmasters Tools (at page of your sites' list in the top right corner there is the button Help. Press it and look for "Send feedback" link). Also you can make sitemap for images and add it to your Google Webmasters Tools site profile.
stackexchange-webmasters
{ "answer_score": 1, "question_score": 1, "tags": "seo, google, robots.txt" }
Is it correct to use DIV inside FORM? I'm just wondering what are you thinking about DIV-tag inside FORM-tag? I need something like this: <form> <input type="text"/> <div> some </div> <div> another </div> <input type="text" /> </form> Is it general practice to use `DIV` inside `FORM` or I need something different?
It is totally fine . The `form` will submit only its input type controls ( *also `Textarea` , `Select` , etc...). You have nothing to worry about a `div` within a `form`.
stackexchange-stackoverflow
{ "answer_score": 152, "question_score": 98, "tags": "html, semantic markup" }
Proof that $n$ must be a multiple of $m$ given these sets. Let $A=n \mathbb{Z}$, the set of all integer multiples of some integer $n$, and let $B=m \mathbb{Z}$. Suppose that $A \subseteq B$. Prove that $n$ must be a multiple of $m$. So far, I have the following: Let $x \in A$. Then, $x=kn$ for some $k \in \mathbb{Z}$. Because $A \subseteq B, x=l m$ for some $l \in \mathbb{Z}$. Hence, $lm = kn$. However, if you then solve the equation for $n$, you obtain $n=\frac{l}{k}m$, which is not necessarily an integer. What is the proper way to complete this proof? I have already proven the converse as part of the exercise but I am having trouble applying the logic in this direction.
$n=1*n$ so $n\in A\subset B =$ {the multiples of $m $}. So $n$ is a multiple of $m$. That's all there is to it.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "elementary set theory, proof writing, divisibility" }
c# assign values from a for loop to individual variables I have the value of Cell and Value in a for loop. For example when i=0, value will be "first value" which I want to assign to A0Text.text. When i=1, , value will be "second value" which I want to assign to A1Text.text.. – for (int i = 0; i < BLOCKS.Count; i++) { //possible values of Cell are A0, A1, A2 ... var Cell = currentBLOCKData["cell"]; var Value = currentBLOCKData["value"]; .... Then I have fields named with the same name as Cell //possible cellName are - A0Text, A1text, A2Text ..... string cellName = Cell + "Text"; I want to assign A0Text.text = First value in above field - Value A1Text.text = 2nd value in above field - Value A2Text.text = 3rd value in above field - Value How can I make the above assigments?
Yes - I figured it out - Searching and assigning as below: txtRef = GameObject.Find(cellName).GetComponent<Text>(); txtRef.text = Value.ToString();
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, for loop, unity3d" }
Extensions of group homomorphisms for special groups Let $G_1, G_2$ be groups, $H\leq G_1$ a subgroup, $\phi\colon H\to G_2$ a group homomorphism. Are there some nice properties for the groups, so that it is true that we can get a group homomorphism $\tilde{\phi}\colon G_1\to G_2$ with $\tilde{\phi}_{|H}=\phi$? I know that this usually isn't correct and this is also discussed in the post Extension of a group homomorphism, but maybe there are some ''nice'' properties for the groups, like $G_1, G_2$ abelian etc., where it works.
Actually I've now found a result for a special situation in another post namely Extending a homomorphism $f:\left<a \right>\to\Bbb T$ to $g:G\to \Bbb T$, where $G$ is abelian and $\mathbb{T}$ is the circle group.. There is an extension if $G_1$, $G_2$ are abelian and $G_2$ is divisable.
stackexchange-math
{ "answer_score": 0, "question_score": 3, "tags": "group theory" }
What's wrong with this code? (Cat class) When I compile , I obtain: error, expected ; after meow(). What's wrong with this code public class Cat { public static void main(String[]args){ String name; String colour; int age; Cat c = new Cat(); c.nome = "Muffin"; System.out.println(c.name); meow(){ System.out.println("Meow! Meow!"); } } }
It looks like you defined the properties of `Cat` as local variables of your main method instead of as members of the class. And your `meow` method shouldn't be inside the main method, and it should have a return type. public class Cat { String name; String colour; int age; public static void main(String[]args) { Cat c = new Cat(); c.name = "Muffin"; System.out.println(c.name); } void meow() { System.out.println("Meow! Meow!"); } }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -3, "tags": "java" }
Can I redistribute MailKit.dll and MimeKit.dll with my PowerShell Script? Can I redistribute only MailKit.dll and MimeKit.dll that are included in package(installer)? I know the MailKit is under the MIT License but I don't understand whether I can redistribute only the dlls. I write a PowerShell Script that uses the MailKit.dll and MimeKit.dll and I want to distribute them as a package. Is it OK?
Yes, you can redistribute the dll's.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "mailkit" }
Setting date_popup year range to more than the 3 years default in Drupal 7 I have a custom module and using date_popup. Currently the popup only shows a 3 year range in the date popup. $form['startdate'] = array( '#type' => 'date_popup', '#title' => 'From', '#default_value' => filter_get('browse-startdate'), '#date_format' => 'Y-m-d', ); What is needed to make the range higher?
Use the following option in the array: '#date_year_range' => '-8:+8' That goes up to 8 years or more. Generally you don't use minDate as that only goes back up to 3 years only.
stackexchange-drupal
{ "answer_score": 6, "question_score": 5, "tags": "7, forms, datetime, javascript" }
How would I use an if else statement to make 2 datasets? I'm looking to take a dataset and look through one column to say: "if this one variable == "true", then add the row to dataset1. Else, add it to dataset2".
We can use `subset` df1 <- subset(df_full, Col1 == 1) df0 <- subset(df_full, Col1 == 0) Or with `split` into a `list` lst1 <- split(df_full, df_full$Col1)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "r, if statement" }
aws-sdk client-s3 Upload: chrome crash after 8 GB of upload I want upload from browser a 17 GB file, but after 8 GB chrome crash for memory exhaustion import { PutObjectCommandInput, S3Client } from '@aws-sdk/client-s3'; import { Progress, Upload } from "@aws-sdk/lib-storage"; const uploadParams: PutObjectCommandInput = { Bucket: 'my-bucket', Key: 'my-file', Body: file, // is File from <input type="file"> }; const upload: Upload = new Upload({ client: s3Client, params: uploadParams, }); // start upload await upload.done(); what I'm doing wrong?
AWS S3 has a 5GB size limit on a single PUT operation. You need to initiate a multi-part upload and split the file into chunks (5GB for example) before uploading - this _may_ also resolve your Chrome crashing. Even if Chrome did not crash, your code wouldn't work as it is - chunk up the file and upload them one by one.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, typescript, aws sdk" }
mktime creates a syntax error when used inside a class? Please could someone tell me why mktime is giving an error inside a class?? <?php $time_Stamp = mktime(6,30,0); echo strftime("%H:%M",$time_Stamp); ?> reports 6:30 <?php class Test_Time{ private $time_Stamp = mktime(6,30,0); } ?> reports Parse error: syntax error, unexpected '(', expecting ',' or ';' in C:\Program Files (x86)\Ampps\www\sandbox\general\mktime.php on line 5
> According to the PHP docs, one can initialize properties in classes with the following restriction: > > "This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated." Try this <?php class Test_Time{ private $time_Stamp; function __construct() { $this->time_Stamp = mktime(6,30,0); echo strftime("%H:%M",$this->time_Stamp); } } ?>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php" }
Unity : Cast a gameObject as custom monobehavior class Is there a way to cast a gameObject as an instance of a monobehavior class? The gameobject has a script component linked with that very class. I have an instance of a custom class, called 'HeroUnit', inheriting from monobehavior. I got it by Instantiating a prefab. I'd like to link this instance to a field of a scriptableobject that expects a 'HeroUnit', but I get an error saying it's a gameObject instead. So... do I somehow cast my GameObject as a 'HeroUnit'? I can see the gameobject has a 'Script' component associated with my 'HeroUnit' class.
Doesn't `GetComponent` answer for this? var _heroUnit = gameObject.GetComponent<HeroUnit>();
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "unity3d" }
Scala replace Seq of keys with Values I have a seq in Scala = `(a1, b1, c1, d1)` and a `Map [(a1, "Hello"), (b1, "Bye"), (c1, "Down"), (d1, "Over")]` I want to get a Seq by replacing keys with values and get Final `Seq (Hello, Bye, Down, Over)` in Scala
Scala's `map` should do the job. In case some keys could be missing from the map, you can use `collect` instead. val a1 = 1;val b1 = 2;val c1 =3;val d1 = 4 val s1 = Seq(a1, b1, c1, d1) val s2 = Seq(a1, 10, b1, c1, d1) val m = Map((a1, "Hello"), (b1, "Bye"), (c1, "Down"), (d1, "Over")) s1 map m //res0: Seq[String] = List(Hello, Bye, Down, Over) s2 collect m //res1: Seq[String] = List(Hello, Bye, Down, Over)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "scala, dictionary" }
Is the VG encrypted with dm_crypt OR luks? How to find out? A system is installed with an encrypted VG. How can I find out if they used dm_crypt or luks? It's running Fedora 14, so I think it's one of those. Or are they the same thing?
I am creating a new answer because the currently accepted answer is incorrect in calling them the same. LUKS adds key management to dm-crypt. It's Linux Unified Key Setup. Without LUKS, you can only have a single master password. LUKS allows you to have multiple keys that can decrypt the single master key that the disk is encrypted with. This allows you to rotate passwords or provide multiple administrators a key that can be revoked later if needed. Also, passwords are better protected against dictionary attacks through the use of PBKDF2 making LUKS + dm-crypt much stronger to crack. @stribika is correct about using `cryptsetup luksDump /dev/sdXX` to correctly detect the presense of the LUKS header. I believe dm-crypt has it's own header to record the type of encryption used, but I am not 100% sure on that issue.
stackexchange-unix
{ "answer_score": 2, "question_score": 0, "tags": "linux, encryption" }
eclipse: sort in eclipse outline for .js files broken I've just upgraded to the latest Eclipse IDE for PHP Developers - Version: 2021-12 (4.22.0). In this version the outline for JS files seems to be broken. The order inside an function is always alphabetically and not in the order of the written code (top to bottom). Clicking the sort ouline button doesn't change the order inside the function. Any ideas? Outline without sorting: ![enter image description here]( Code function outer() { function e() { } function d() { } function c() { } function b() { } function a() { } }
That's a **known issue** of Eclipse Wild Web Developer: **Issue #534: _Outline sort order cannot be changed_** Please comment on the issue. Add a _thumb up_ (+1) reaction emoticon to the issue description to vote for the issue.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, eclipse" }
learning new vocabulary How can I change a passive vocabulary to an active one? A passive vocabulary is a word that I know it when I see it in a text but when I want to speak, I do not remember it for using.
That really depends on how you and your brain works. Some tips that I'd suggest are: **Learning the translation both ways** **Creating sample sentences with the vocabulary** **Just practice and Practice**
stackexchange-ell
{ "answer_score": 1, "question_score": 2, "tags": "word usage, word choice" }
Firefox 7 refuses to download file returned by PHP after upgrading to Firefox 7, I can't download files I output via PHP on my sites. An example: Let's say I have link < returning pretty normal 800KB .ZIP file, with: header("Content-Type: application/octet-stream"); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Disposition: attachment; filename=" .trim($filename). ""); header("Content-Transfer-Encoding: binary"); header("Content-Length: " .filesize($filePath). ")"); readfile($filePath); flush(); Every possible browser, even older versions of Firefox, start downloading the file as usually. Firefox 7 throws "Corrupted Content Error". Does anyone notice similiar behaviour? Any possible solutions?
You have a superfluous `)` in the `content-length` field. That may screw up the file size that the browser expects from the download, and cause the error.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "php, firefox, header, download" }
Cumulative addition in a list based on an indices list Say I have list, `list_a = [100, 5, 1, 2, 200, 3, 1, 300, 6, 6]` And another list, `ind_list = [0, 4, 7]` I want to create a third list that will contain the cumulative sum of the first list which "resets" on every index from `ind_list`. To clarify, the result should be `res_list = [100, 105, 106, 108, 200, 203, 204, 300, 306, 312]`
Use the following: cs= np.cumsum(list_a) for i in ind_list: if i==0: continue cs[i:]-=cs[i-1] Result: cs >>array([100, 105, 106, 108, 200, 203, 204, 300, 306, 312])
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 10, "tags": "python, python 2.7, numpy" }
Regarding Svoloch In _Call of Duty: World at War_ , during the Vendetta mission, you and Reznov encounter a sniper who Reznov calls Svoloch. In the sequel, _Call of Duty: Black Ops_ , during the Vorkuta mission, Mason and Reznov encounter yet another Svoloch, who Mason punches in the face. Are they the same person? If yes, how did he survive a sniper shot from Dimitri?
No, it's not the same person. "Svoloch/Сволочь" in russian means "Bastard". The one in World at War was just some sniper, which was shot and killed in mid of Vendetta mission. The one in Black ops 1, Vorkuta (Gulag), was just some Prison Guard, which Reznov called "Svoloch", Bastard. The Sniper in Vendetta was German, and the Prison Guard in Vorkuta was Russian and those two events were ~21 years apart from each other.
stackexchange-gaming
{ "answer_score": 4, "question_score": 3, "tags": "call of duty black ops, call of duty world at war" }
golang url.PathUnescape can not worked in %% I use golang url.PathUnescape function to unescape url, but it can not worked in %%. I receive a request it url is /search/?ptp=1&q=%27%22&%%3cacx%3e%3cscript%20%3emcyv9834%3c/script%3e&t=bao. when I use golang url.PathUnescape function to unescape url, but it has error is invalid URL escape "%%3". Why? package main import ( "net/url" "fmt" ) func main() { str := `/search/?ptp=1&q=%27%22&%%3Cacx%3E%3CScRiPt%20%3EmCyV9834%3C/ScRiPt%3E&t=bao` a, b := url.PathUnescape(str) fmt.Println(a, b) } The origin url is /search/?ptp=1&q='"&%mCyV9834&t=bao .
> but it has error is invalid URL escape "%%3". Why? Because %%3 is not a valid percent encoding in an URL path. If you need to deal with malformed URLs you must implement that yourself. (Or fix upstream.)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "go, url" }
My Iphone App crashes (Bad access) when turned on it's side (landscape mode) For some reason, every time I run my Iphone App, the App works fine as long as it is upright. The second the simulator turns to the left or right (like if I manually turn it, or if it's trying to play a video), the code crashes, with either a "Bad Access" or an exception. The crazy thing is that this stuff was JUST working, and I didn't change ANYTHING that looks like it would affect landscape mode only. Could something complicated in the background have changed to make this stop working? Is this just a symptom of some sort of memory error? -Jenny
Sure, you could be releasing something which should shouldn't release yet, or similar. I'd put some `NSLog` statements in key places, start with `shouldAutorotateToInterfaceOrientation` and in any custom drawing functions you may have.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "iphone, cocoa touch, rotation, accelerometer, landscape" }
How to retrieve data from iphone 4s when connector/charger is broken My iphone 4s charger/connector broke. My phone ran out of battery, is unchargeable and unbootable. It also will not connect to any computer or other device. I took it to the Genius bar and they said there was nothing they could do to restore the phone or retrieve the data. The problem is that I have important photos on the phone which I need access to. How can I get access to it? Are there services for that? Is there a way to read the hard drive similar to a hard drive enclosure?
You can take it to any of the various iPhone repair kiosks that appear throughout most malls. I took an old iPhone there and had the charger replaced for $45.
stackexchange-apple
{ "answer_score": 2, "question_score": 0, "tags": "iphone, data transfer, charging" }
POST update to Twitter using Oauth and HTTR, R I am trying to post an update to Twitter using the api. Following the steps at < I can get the GET call to work, but I haven't managed to get the POST to work. Here is the relevant code: library(httr) library(httpuv) oauth_endpoints("twitter") myapp <- oauth_app("twitter", key = "key" secret = "secret" ) twitter_token <- oauth1.0_token(oauth_endpoints("twitter"), myapp) #this works fine req <- GET(" config(token = twitter_token)) #this doesn't work. Returns error 403: status is forbidden POST(url = " body = "test", config(token = twitter_token) ) Any solution that allows a status update (Tweet) from R is acceptable.
The docs say you need to pass a parameter `status` as a query parameter, not in the body, which makes sense b/c it can only be 140 characters long anyway. POST(" query = list(status = "testing from R"), config(token = twitter_token) )
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "r, twitter, oauth, twitter oauth, httr" }
Why does this webpage use Javascript to display the date of the article? I came across this webpage in which the date of the article is an integer which is formatted by an inline call to a JavaScript function into the string "Nov 6, 2009 10:17am". The markup looks like this <small> <script type="text/javascript">timestamp(1257520620000,'longDateTime')</script> </small> Is there a good reason to deal with dates in this way? I'm having a hard time thinking of one.
The best idea I can come up with is they would display in the correct time zone and local format for the visitor.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "javascript, datetime, date" }
Querying for entities that match a collection in Hibernate imagine I have two entities - Tag and Text where Text has multiple tags and there are several things I would like to do with them. I would be very happy if you can help me come up with an elegant solution. I want to search for Text entities by multiple Tags at once - all tags must match I want to search for Text entities by multiple Tags, second parameter specifies how many must mach I would like to specify pairs or triplets of tags where at least one of every pair must match Any suggestions? Thank you
The answers to these are pretty much the same, whether you use SQL, HQL or JPQL: > I want to search for Text entities by multiple Tags at once - all tags must match where text like %tag1% and text like %tag2% // etc. > I want to search for Text entities by multiple Tags, second parameter specifies how many must mach StringBuilder sb = new StringBuilder(); for(int i = 0; i < howmany; i++){ sb.append('%').append(param); } sb.append('%'); String query = "some query text where " + sb.toString() > I would like to specify pairs or triplets of tags where at least one of every pair must match where text like %tag1% or text like %tag2% -- etc
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, hibernate" }
git diff :: overriding .gitconfig external tool I've configured `git` to use `meld` as an external diff tool: $ cat ~/.gitconfig | grep -A2 "\[diff\]" [diff] tool = vimdiff external = git-meld ... where `git-meld` is: $ cat $(which git-meld) #!/bin/bash meld $2 $5 However sometimes (e.g. in the case of very minor diffs or if I want to easily copy-paste something from the diff text) I just want to see the differences on the shell and avoid `meld`'s spawning delay. Is there a way (e.g. a command line argument) to override the `.gitconfig` settings and instruct `git` to just do a simple text-only diff?
For your general question: pretty much all options can be overridden on the command line using `-c`: > -c <name>=<value> > > Pass a configuration parameter to the command. The value given will override values from configuration files. The <name> is expected in the same format as listed by git config (subkeys separated by dots). That said, `diff.external` is a problem. You can change its value, but there is no way to unset it on the command line (that I can see). However, `git diff` does have a custom option to ignore the `diff.external` setting: you can use git diff --no-ext-diff
stackexchange-stackoverflow
{ "answer_score": 24, "question_score": 11, "tags": "git, git diff, meld" }
find the non intersection between 2 list, including duplicate I tried to look up this question before asking but could not find any satisfactory. so I have 2 list like this a=[1,2,3,4,4] b=[1,1,2,3,4] I tried this: set(a) - set(b) but got this set() what I want is this [1,4] Since set a has 2 4s and set b has 2 1s. What can I do? Thank you!
Use collections.Counter, is the Python implementation of a multiset: from collections import Counter a = [1, 2, 3, 4, 4] b = [1, 1, 2, 3, 4] c = [1, 1, 1, 2, 3, 4] counts_a = Counter(a) counts_b = Counter(b) counts_c = Counter(c) result_b = (counts_a | counts_b) - (counts_a & counts_b) result_c = (counts_a | counts_c) - (counts_a & counts_c) print(list(result_b.elements())) print(list(result_c.elements())) **Output** [1, 4] [1, 1, 4] Note that `(counts_a | counts_b) - (counts_a & counts_b)` is the Python equivalent of the mathematical formula.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, multiset" }
Models with persistent state between HTTP requests I want to create a web application with a model that persists between HTTP requests. From what I understand languages like PHP treat each HTTP request as a brand new connection except for some global variables like SESSION; so each time the user changes pages all my PHP classes are loaded into memory again (and each AJAX request does this too) - requiring me to build from the database each time. Am I mistaken or am I trying to make a circle fit in a square? Memcached seems to be a good solution for keeping my model in memory between page requests but it still needs to load the cache. PHP CLI seemed promising but after looking into it more it seemed like it would be more trouble than it was worth. Any suggestions?
You should avoid requiring a persistent state in your web application; HTTP is stateless and you need to design your business logic around that. Also, PHP isn't very memory-leak safe since it isn't meant to act as a daemon or run for extended periods. You shouldn't be maintaining a database of information in PHP variables either. You can cache expensive query results in memcache and retrieve them with very little latency. You can serialize your model, store it in a session (or memcache), and deserialize it on the next request in order to keep relevant variables within scope between requests. If you share a bit more about the specifics of your application, perhaps we can help you figure out the best way to handle this.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "php, model, state, persistent data" }
Apply RTL on all Pages I'm trying to apply RTL on ALL of my pages. I have this code and it's working however when i go to another page or refresh, it changes back to LTR. Does anyone know how to apply it on all pages? Because I've only seen answers on how to apply it on just one page. RTL JS: $(document).ready(function(){ /** LANGUAGE BUTTONS **/ $( ".lang-en" ).click(function() { if($(document.body).hasClass('rtl')){ $(document.body).removeClass('rtl');} }); $( ".lang-ar" ).click(function() { if(!$(document.body).hasClass('rtl')){ $(document.body).addClass('rtl');} }); }); HTML: <ul class="list-inline m-0 p-0"> <li class="list-inline-item"><button class="lang-en btn-plain p-1 active">English</button></li> <li class="list-inline-item"><button class="lang-ar btn-plain p-1">العربية</button></li> </ul>
JavaScript is stateless so in this case you need to take help from localStorage or cookie, try following way: $(document).ready(function(){ /** LANGUAGE BUTTONS **/ $('body').addClass(localStorage.getItem("lang")); $(".lang-en").click(function() { localStorage.setItem('lang', 'ltr'); $('body').removeClass('rtl').addClass(localStorage.getItem("lang")); }); $(".lang-ar").click(function() { localStorage.setItem('lang', 'rtl'); $('body').removeClass('ltr').addClass(localStorage.getItem("lang")); }); });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, html" }
how to style 2 nd element in div I want to apply css style to the 2nd child element of div. Here is my HTML <div class="my"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div> CSS .my:nth-child(1) { color:red; } This applying style to every element. Here is my fiddle <
Its like this: .my div:nth-child(1) { color:red; } **DEMO HERE** As you want the second one you want to change the `1` to `2` so `.my div:nth-child(2)` **DEMO HERE**
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "html, css" }
my father or Father? In the following sentence, which one is more common? > I asked my mother, "Where is my father?" Or > I asked my mother, "Where is Father?"
"My father" clarifies which father you're talking about. In common usage, if you're talking to your mother, you don't need to specify "my father" (vs. your mother's father, who you'd refer to as grandfather). You could make a case for "my father" if there was a sort of argument and you wanted to emphasize your personal relationship over your mother's relationship with your father, but generally, if the tone is neutral and the relationship between the three of you is typical, use "Father".
stackexchange-english
{ "answer_score": 1, "question_score": 0, "tags": "single word requests" }
Prove concavity of a particular function The exercise is the following. Let $f:U\longrightarrow\mathbb{R}$ be _semiconcave_ on the open set $U$, that is there exists a constant $K\geq0$ such that $$ \lambda f(x)+(1-\lambda)f(y)\leq f(\lambda x+(1-\lambda)y)+\frac{1}{2}K\lambda(1-\lambda)|x-y|^2 $$ for all $x, y\in U$ and $\lambda\in[0, 1]$. Prove that the above inequality is equivalent to the concavity of the map $x\mapsto f(x)-\frac{1}{2}K|x|^2$. I cannot prove this equivalence. In particular, by the concavity of $x\mapsto f(x)-\frac{1}{2}K|x|^2$, I obtain the inequality $$ \lambda f(x)+(1-\lambda)f(y)\leq f(\lambda x+(1-\lambda)y)+\frac{K}{2}(\lambda|x|^2+(1-\lambda)|y|^2-|\lambda x+(1-\lambda)y|^2). $$ How can I get the desired result? Thank You
Expanding $$\lvert \lambda x + (1 - \lambda y)\rvert^2 = \lambda^2 \lvert x\rvert^2 + 2\lambda(1 - \lambda)\langle x,y\rangle + (1 - \lambda)^2 \lvert y\rvert^2$$ you can write $$\lambda\lvert x\rvert^2 + (1 - \lambda)\lvert y\rvert^2 - \lvert \lambda x + (1 - \lambda) y\rvert^2 = (\lambda - \lambda^2)\lvert x\rvert^2 - 2\lambda(1 - \lambda)\langle x,y\rangle + [(1 -\lambda) - (1 - \lambda)^2]\lvert y\rvert^2$$ or $$\lambda(1 - \lambda)\lvert x\rvert^2 - 2\lambda(1 - \lambda)\langle x,y\rangle + (1 - \lambda)\lambda \lvert y\rvert^2$$ The latter expression is the same as $$\lambda(1 - \lambda)\lvert x - y\rvert^2$$ You can do something similar for the proof of the other direction.
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "real analysis, inequality, convex analysis" }
What is the difference between pip and python2 -m pip? I was unable to simply `pip install pandas` because my system already had it installed for python3. But I expected that `pip` would attempt to install for python2; `pip3` should install for python3. Why do I have to specify the python2 interpreter to use `pip`? ~ pip install pandas Requirement already satisfied: pandas in /usr/local/lib/python3.5/site-packages Requirement already satisfied: numpy>=1.7.0 in /usr/local/lib/python3.5/site-packages (from pandas) ~ python2 -m pip install pandas Collecting pandas Downloading pandas-0.19.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (11.9MB) ...
`pip` will call the `pip` that is in the default version of python on your system. It is not specific to python2. Since python3 is default on your system you need to specify `python2 -m pip` to access the python2 version.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "python, pip" }
SSL certificate still appears as expired My ssl certificate has expired and I generated a new one with the same private key. After I uploaded my new certificate on the server, chrome and other browsers still view the old one. Deleted cache and everything, tried in an incognito window, restarted the express js server. Could it be because I used the same private key?
> Deleted cache and everything, tried in an incognito window, restarted the express js server. Browsers don't cache the server certificate. They might reuse an existing TLS session and not get the new certificate though. But this is only done if the handshake for this connection succeeded, i.e. certificate was valid or the invalid certificate was explicitly accepted. If the browser still complains about the certificate as expired after reloading the page, then the server is still providing the old expired certificate. > Could it be because I used the same private key? No, it does not matter that the same private key is used. Make sure that you a) really replaced the old certificate with the new one and b) replaced it on the correct server, i.e. the one which is actually terminating the TLS connection from the client. Depending on your configuration this might be the express js server itself or some reverse proxy or WAF in front of it.
stackexchange-serverfault
{ "answer_score": 4, "question_score": 0, "tags": "ssl" }
How to get url_for an object in Model method in Rails I would like to create a string that include a path for an object in Rails. def notification_content "#{app.listing_url(my_listing, :host => "example.com")}. " + end This content will then be fed into my ActionMailer as email content. In console, it works fine. However, when I run it on localhost server, I get the following error: undefined local variable or method `app' How should I go about it? Also, how can I make the path to be a hyperlink? Thanks a lot.
include Rails.application.routes.url_helpers def notification_content "#{listing_url(my_listing, :host => "example.com")}. " + ... end
stackexchange-stackoverflow
{ "answer_score": 20, "question_score": 10, "tags": "ruby on rails, url, actionmailer" }
IntelliJ rename java package and occurances? I have intelliJ already setup to "compact empty middle packages" When I do refactor -> rename, the only dialog will only actually rename the directory (even when I have it search for occurances), resulting in my code that uses the package throughout the project, still using the original name. I'm sure there used to be a way to "rename package" and not just the directory, did the mechanism for this change? I really need to rename my package. Please don't mark this as a duplicate, because the other places I see this being asked, the solution is to first "compact empty middle packages" - which I have already done... and I still can't get it to work.
Try to open a class that is in that package, then right click on the `package xyz.abc` line (should be the first line in that file) and choose Refactor -> Rename from the context menu.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "intellij idea" }
Is there an adapter to use a regular phone with Skype or Google Voice? Is there an adapter to use a regular phone with Skype or Google Voice? I found this Dlink adapter but it is discontinued, any idea why? Will it still work in Canada and in the US? Any suggestions for other adapters? Thank you very much!
Linksys SP2102 is the one my company provides for itsVoIP customers, but basically any analog to digital device will suffice. Should work in US and Canada fine, but I don't know how well any given adapter would work with skype.
stackexchange-superuser
{ "answer_score": 1, "question_score": 3, "tags": "skype, voip, google voice" }
How can I use UITableViewAutomaticDimension when the baseclass implements tableView:heightForRowAtIndexPath: I have around 30 view controllers that all have a common base class that implements "heighForRowAtIndexPath". Now we have recently removed iOS 7 support which exposes us to the nifty auto-height calculation with AutoLayout. I was just presented with a rather complicated cell that would be great with this automatic height. The documentation states this: > You may set the row height for cells if the delegate doesn’t implement the tableView:heightForRowAtIndexPath: method. The default value of rowHeight is UITableViewAutomaticDimension. So it seems that since my baseclass implements the heightFor.. the automatic doesn't take effect. Is there any way around this? I would somehow need to "de implement" that specific method.
You can return `UITableViewAutomaticDimension` from `heightForRowAtIndexPath` in your sub class(s): -(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewAutomaticDimension; }
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "ios, objective c, uitableview, ios autolayout, uitableviewautomaticdimension" }
Continuous functions on closed intervals that aren't uniformly continuous on that interval I am asked to give an example of sequences $(x_n)$ and $(y_n)$ in $[a,b] \subset \mathbb{R}$ such that $|x_n-y_n|<\frac{1}{n}$ but $|f(x_n)-f(y_n)|$ is bounded away from zero where $f(x)$ is continuous on $[a,b]$. I couldn't think of an example. In fact, I wonder whether my professor made a mistake.
Suppose that $|f(x_n)-f(y_n)| \geq C>0$. Since $x_n,y_n$ are bounded sequences, they have convergent subsequences. Without loss of generality assume that $x_n \to x,y_n \to y$. The fact that $|x_n-y_n|<1/n$ implies that $x=y$. Now passing to the limit in $|f(x_n)-f(y_n)| \geq C>0$ we get that $0\geq C>0$. Contradiction.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "uniform continuity" }
How do I use jquery to dynamically set the height of a div? Here is my code, but it doesn't work (the div always floats to the top of the page. I want it to be located in the center of the page). HTML: <div id="overlay">Stuff</div> JQuery: $(document).ready(function(){ var height = $('#overlay').height(); var marginTop = (height)/2; document.getElementById("overlay").style.marginTop="-"+marginTop+"px"; document.getElementById("overlay").style.top="50%"; }); What am I doing wrong?
$(document).ready(function(){ resize(); $(window).resize(resize); }); function resize() { var height = $('#overlay').height(); $('#overlay').css('margin-top', (($(window).height() - height) / 2) + 'px'); } Remember, you want the window height minus the overlay height. Then divide by two and you have your desired margin.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "jquery, height" }
how to keep nohup from killing java process that waits for stdin linux I have a java program that is executed on command line (Bash Linux). Once executed the program continues to run, reading stdin until the user inputs 'quit'. Sometimes I would like to **nohup** the program so it continues to run even if my remote connection is closed. The problem is that when I attempt to nohup the program as demonstrated below it seems that its prompt for stdin kills nohup and terminates the program. > Example: $ nohup java -jar myApp.jar I have tried redirecting the program's output to **2>/dev/null** per other suggestions as well as running it in the background using **&**. Neither prevents nohup from being killed. I cannot use **disown** because once I run the program I lose the command prompt to the program.
To get your program running in the background, run `tmux`: tmux This will open up a tmux shell, where you can run your program: java -jar myApp.jar Then to detach from the tmux session, type `ctrl-b` then `d`. Your program will continue to run in the background. To reattach to your program's shell at a later time (to kill it or view its output), run `tmux attach`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, linux, bash" }
Scatter plot over 2D-histogram in matplotlib with log-scale I have two sets of points with values (x, y). One is enormous (300k) and one is small (2k). I want to show a scatter plot of the latter over a 2D-histogram of the former in log-log scale. `plt.xscale('log')`-like commands keep messing up the histogram and when I just take logs of x's and y's and then do all the plotting, my ticks are say -3 not 10^-3 and the pretty logarithmic minor ticks are missing altogether. What's the most elegant solution in matplotlib? Do I have to dig into the artist layer?
If you forgive a bit of self-advertisement, you may use my library `physt` (see < Then, you can write code like this: import numpy as np import matplotlib.pyplot as plt from physt import h2 # Data r1 = np.random.normal(0, 1, 20000) r2 = np.random.normal(0, .3, 20000) + r1 x = np.exp(r1) y = np.exp(r2) # Plot scatter fig, ax = plt.subplots() ax.scatter(x[:1000], y[:1000], s=2) H = h2(x, y, "exponential") H.plot(ax=ax, zorder=-1) # Necessary to put behind Which, I hope is the solution to your problem: ![physt-produced histogram+scatter](
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, matplotlib, plot, histogram, scatter plot" }
How to turn off frontend 'edit module' button Joomla 3.2.2? Does anyone know how to disable this functionality? (See pic below) Additional Information: I'm using Rocket Theme's Metropolis template, so I'm not sure if Rocket Theme introduced this feature via updates or I got it through one of Joomla's updates. The button is visible to registered users whenever they hover the mouse cursor over a module. When they click on it, it sends the user to the backend login screen. I do not want this feature at all. !button that appears on top-right of each module position
In the Joomla backend, go to **System** >> **Global Configuration** , and you will see an option called _Mouse-over edit icons for_ , which you can simply set to _none_. Hope this helps
stackexchange-stackoverflow
{ "answer_score": 32, "question_score": 16, "tags": "joomla3.0" }
How to interact with second tab via javascript So currently Im trying to make Google Chrome extension using Visual Studio Code and JavaScript. I havent worked with JS before. So I have this part right now, Im taking some info from the first page and then I open the second one and try to click button on it, but its still working only on the first one. Ive tried .focus and setTimeout but nothing works. window.open(" setTimeout(1000) document.querySelector(".submitButton").click()
JavaScript only works on page when you code it. If you want to create javascript on new page - you need to write all code again. **On PAGE 2 button will not works , becuse JS is not shared on all pages. You needs to write again JS function to click that button**
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript" }
How to debug a program that uses input from an auxiliary txt file in gdb? I want to debug a file, say file.c, and this file reads information from a txt file, say input.txt. So normally, to compile and run the program I would do the following: gcc -std=c99 -g file.c -o file.exe and to debug I would try the following: gdb ./file.exe input.txt However this doesn't work and fails with `No such file exits. '(null)': Bad address` when the program, file.c, attempts to open the file specified in argv[1] which input.txt is. I have tried the following methods: 1. gdb ./file.exe (gdb) run < input.txt 2. gdb ./file.exe b main (gdb) r (gdb) call (int)dup2(open("input.txt",0),0) $1 = 0 All with the same outcome as described above...`No such file exits. '(null)': Bad address` The code is merely: FILE *input = fopen(argv[1],"r");
Do gdb --args ./file.exe file.txt b main run or do gdb ./file.exe b main run file.txt
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c, gdb, stdin, fopen, c99" }
How to remotely change iCloud settings on iPhone 5? I would like to restore factory settings on my iPhone 5. When I try to do this via iTunes, the computer tells me that I have to change the iCloud settings on my phone: deactivate "Find my iPhone". Unfortunately both buttons are inactive on my phone, so I am not able to get to the settings menu. I am also not able to reboot it. I have tried pressing both of them for a long time to no avail. Do you have any ideas how to get around this?
Remove it from Find My iPhone via the web * < At that point, iTunes will be willing to erase the device and/or restore it. You could also use Apple Configurator 2 which has a command line option to wipe devices: cfgutil restore
stackexchange-apple
{ "answer_score": 1, "question_score": 1, "tags": "iphone, itunes, icloud, activation lock" }
Left join on first value from right table? I need to do left join on table under conditions, so value from left table picks only first value found in right table, sorted by time, and that time in right table is > than time in left. How that can be done? Thanks.
Perhaps a construct like this (using sub-query rather than a join): SELECT (SELECT TOP 1 D2.DiDateEnd FROM Diary AS D2 WHERE D2.DiDateEnd > D1.DiDateEnd ORDER BY D2.DiDateEnd) AS RightTableTime, * FROM Diary AS D1 Have used one of my own tables for the sample, since you didn't provide table/column names.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql, database, sql server 2008, stored procedures, greatest n per group" }
ERC721TokenReceiver, assuming that transfer function exists? When trying to find out if a contract implemented `onERC721Received` from `safeTransferFrom` function, are we just safely assuming the contract has all the erc721 related functionalities? such as transfer, etc? because it is simply just returning an interface identifier `0x150b7a02`, not returning whether it can perform transfer tokens or not.
The interface identifier 0x150b7a02 is for the `ERC721TokenReceiver` interface. That is, contracts that implement `onERC721Received`, and just implies that the contract was designed to _receive_ ERC-721 tokens. This doesn't in any way guarantee that this receiver contract was written to execute any/all of the functions on your ERC-721 Token contract.
stackexchange-ethereum
{ "answer_score": 6, "question_score": 3, "tags": "solidity, erc 721" }
Parse (the platform) maximum config parameters I am designing an app that will make extensive use of the Parse Config parameters as a way to A/B test code changes without having to resubmit the app to the App/Play Stores. Because Parse offers Objects for their parameters, I will be storing large data sets (like monster spawn stats) and game settings in these parameters. I've checked the Parse website, the help docs, and the billing pages, but was unable to find the limits for number of parameters and size of parameters. What are the limits on: * Number of Config parameters per app * Size of Config parameters (each individual parameter) * Total size of Config parameters (all the parameter sizes combined) Any help?
> We currently allow up to 100 parameters in your config and a total size of 128KB across all parameters. <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android, ios, parse platform, config" }
Sorgenfrey's topology- compact subsets Consider the topological space $(R,\tau_{sor})$ Are the atoms $\\{x\\}$ where $x\in X $ compact in Sorgenfrey's topology? And in the usual topology? To say if $\\{0\\}\times [0,\infty)$ is compact in $(R^2,\tau_u \times \tau_{sor})$ is it possible to say that as $[0,\infty)$ is not compact in $\tau_{sor}$ the product topology won't be compact?
Singletons, that means sets of the form $\\{x\\}$ for $x\in X$ are compact in any topology, as each open cover $(U_i)_{i\in I}$ contains a set $U_j$ with $\\{x\\}\subseteq U_j$ and then $\\{U_j\\}$ is a finite subcover. By a similar method one chows that all finite subsets are compact. To show that $A:=\\{0\\}\times[0,\infty)$ is not compact in $\tau_u×τ_{sor}$, find an open cover without a finite subcover. Such a cover can be $\left[\frac12,1\right)∪\left\\{\left[0,\ \frac12-\frac1n\right)\middle| n\in\Bbb N\right\\}$. Then as the projection of $A$ onto $τ_{sor}$ isn't compact, $A$ cannot be compact either.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "general topology, compactness" }
IIS logging and incoming requests When are incoming requests logged to file in IIS? Does it happen before or after they are processed and response is sent to the client? What happens in case if request is accepted but response isn't sent back (is the incomming request logged to file in this scenario)?
The request is logged after the response has been prepared (you have the ability to modify the data that will be logged, under your request). It will be logged even during errors, even though some errors might end up in the HTTPERR-folder (by default under C:\windows\system32\LogFiles\HTTPERR), and I think that certain request might only show up there. I had an issue where a firewall with http inspection would cut a connection that stalls for more than 2 minutes, and since the request failed with "broken pipe" sort of error, I think that only showed up in that error log with status 995. IIS aborts request thread with status 995
stackexchange-serverfault
{ "answer_score": 2, "question_score": 4, "tags": "iis, windows server 2008 r2, web server, logging, iis 7.5" }
Bootstrap 4 Column height in mobile vs desktop I have two columns for desktop of size `6` each. ![enter image description here]( In mobile, I need these columns to fit the height of the phone, i.e. ![enter image description here]( How can we have variable height with Bootstrap 4 according to devices? What I have used is, <div class="row h-100"> <div class="col-xl-6 h-100"></div> <div class="col-xl-6 h-100"></div> </div> How to have that `h-100` vary according to device, like `h-sm-50` and `h-xl-100`?
There's no height class vary according to device the only available thing is vary according to viewport bootstrap Sizing so you can use custom class to assign full height only on mobile view using css media queries Example HTML <div class="row h-100"> <div class="col-xl-6 mobile-100"></div> <div class="col-xl-6 mobile-100"></div> </div> Custom CSS @media only screen and (max-width: 600px) { .mobile-100 {height:100vh} }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "css, bootstrap 4, flexbox" }
MDX calculated member filtration uses measure I need help with calculated member I have this code CREATE MEMBER CURRENTCUBE.[Measures].[Summary distribution by CSKU] AS count( NONEMPTY( crossjoin( descendants ([05_Goods].[CSKU].currentmember,,LEAVES), descendants ([04_Agents].[Agents hierarhy],,LEAVES) ) ) ), FORMAT_STRING = "###,##0;-###,##0", NON_EMPTY_BEHAVIOR = { [Quantity] }, VISIBLE = 1 , DISPLAY_FOLDER = 'Distribution' , ASSOCIATED_MEASURE_GROUP = '01_Sales' ; but I want to see a result without elements where sum([Measures].[Sales amount]) <> 0 How can I do it? Thanks! Dmitry
I don't see other choice than using the MDX Filter function : ... AS count( FILTER( crossjoin( descendants ([05_Goods].[CSKU].currentmember,,LEAVES), descendants ([04_Agents].[Agents hierarhy],,LEAVES) ) , [Measures].[Sales amount] <> 0) ) You might try adding the NonEmpty to the descendants method to improve performance (if some descendants have no [Sales Amount].
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mdx, ssas 2012" }
When is it appropriate to find the limit? Of course you can ask me a question on limits which is an appropriate situation for me to deliver my knowledge of limits. What I'm really asking is how and when can I apply limits to solve problems that I may encounter in the future? When do I decide "ok, it's time to find the limit."?
Everything you learn in calculus _after_ limits is uses limits in some way. Limits are just the foundation. Do you want to find the slope of a curve at a point? Use a limiting process called a _derivative_. Do you want to find area of some complex curvy shape? Use a limiting process called an _integral_. Do you want to sum an infinite sequence of numbers? Use a limiting process called an _infinite series_. Want to know is some crazy function defined algebraically is continuous? Use limits. Everything in calculus is based on limits.
stackexchange-math
{ "answer_score": 0, "question_score": -1, "tags": "calculus, limits, continuity" }
Required clarification about GPL licence for creating extensions of GPL software I asked a question and received quite good answers. I read all answers and other sources about my question. I concluded that if I write my code and distribute it to my clients for a free under my own license and ask them to download F3 separately at their own, my code won't be covered under GPL license anymore as I am not providing the GPL code with my distribution. For example, people are selling WordPress themes and plugins which are not covered by GPL but WordPress is licensed under GPL. Am I right?
It depends. You should ask a lawyer. Actually, you should ask `n` lawyers, one for each country you intend to distribute your software to.
stackexchange-softwareengineering
{ "answer_score": 1, "question_score": 0, "tags": "licensing, gpl, wordpress" }
Laravel - SQLSTATE[HY000]: General error: 2031 $pois = Home::select(\DB::raw('*, st_distance_sphere(homes.geopoint, point(?, ?)) as dist')) ->whereRaw('st_within(homes.geopoint, ST_Buffer(point(?, ?), 1))') ->orderBy('dist') ->get(); returns `Laravel - SQLSTATE[HY000]: General error: 2031` However this query below works $pois = Home::selectRaw('*, st_distance_sphere(homes.geopoint, point('.$data["lng"].', '.$data["lat"].')) as dist') ->whereRaw('st_within(homes.geopoint, ST_Buffer(point('.$data['lng'].', '.$data['lat'].'), 1))') ->orderBy('dist') ->get(); but it is vulnerable to SQLInjection. I've done the suggestions mentioned in stackoverflow. [PDO error: General error: 2031 [duplicate]](
selectRaw and whereRaw allow you to use placeholders and pass an array of values as the second argument: selectRaw('*, st_distance_sphere(homes.geopoint, point(?, ?)) as dist', [$data['lng'], $data['lat']])
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "mysql, laravel" }
AJAX data parse to Controller and return back Here is an AJAX call to the controller: $.ajax({ type: "GET", url: '@Url.Action("getChat", "Chat")', success: function (data) { alert(data); $("#data").html(data); }, error:{ } }); In the controller code, I have a database query which returns multiple rows. I want to return that variable back to JSON and print each row separately in AJAX and write that data in HTML. Here is my Controller code public ActionResult getChat() { var p = (from v in DB.chats where v.chatuserID == id select new { v.status, v.message }).ToList(); return Content(p.ToString()); } The query is returning data. I am attaching an image that shows the variables content. !Image of return data of query
public JsonResult getChat() { var p = (from v in DB.chats where v.chatuserID == id select new { v.status, v.message }).ToList(); return json(p,JsonRequestBehavior.AllowGet); } Now you can loop through the list in you ajax success callback function : here is stuff. $.ajax({ type: "GET", url: '@Url.Action("getChat", "Chat")', success: function (data) { $.each(data,function(){ console.log("Status "+ data.status +" "+"Message"+ data.message); }); }, error:{ } });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "asp.net, ajax" }
To what extent is a "reasonable inference" acceptable as "proof" in a court of law? In his autobiography, T. Boone Pickens relates the story of how he managed to do a deal with a man on his sickbed. He took the contract to the man's house, was shown to the man's room, and handed the papers and a pen to the man. The man pulled the covers over the paper, pen, and his head, and the papers were signed. Pickens' lawyer asked him, "Did you actually see him sign the papers?" Pickens said something like, "No. But I can swear out an affidavit that I handed the papers to him unsigned, and received them back from him signed." In this case, there is an inference that it was the man, and not a supernatural being that signed the papers. How acceptable are such inferences in a court of law?
The standard of proof is "on the balance of probabilities", or, "preponderance of evidence", meaning that your claim must be more probable than the other guy's claim. Rules of evidence may preclude using certain kinds of evidence such as rule 403 > The court may exclude relevant evidence if its probative value is substantially outweighed by a danger of one or more of the following: unfair prejudice, confusing the issues, misleading the jury, undue delay, wasting time, or needlessly presenting cumulative evidence A supernatural alternative can, in fact, defeat all forms of evidence, including forensics and "I saw it directly" testimony. The courts do not exclude evidence (all evidence) on the grounds that you can imagine a sci-fi scenario where "it didn't really happen". The rules of evidence more or less encode the cases where evidence is generally found to _not_ be reliable.
stackexchange-law
{ "answer_score": 3, "question_score": 0, "tags": "united states, evidence" }
How to recognize speech bubbles in comic strips (Ideally OpenCV) I need to recognize speech bubbles to send to OCR and also to know where they are in the strip. How could I do this with OpenCV? I'm using OpenCV 2 and Python 3.6 ![enter image description here](
As said in the comments an efficient way is to first detect letters, words and text with OCR. Then try to expand each text zone to its corresponding text bubble. Depending on the text bubble design there are different approaches. However, a solution that could work well and be robust would be to perform edge detection on the near surrounding of the previously detected text zones and then keeping only the (radially) closest edges from the text zones(that should be the bubble borders). This is just a basic idea, you may have to build a more sophisticated algorithm obviously!
stackexchange-dsp
{ "answer_score": 2, "question_score": 0, "tags": "opencv, object recognition, ocr" }
Video file created with FFmpeg too big In my C# project I capture the screen at regular intervals (with a timer). I then have to convert the images into one video with FFmpeg, so I use this command: "-f image2 -framerate 9 -i E:\\REC\\Temp\\%06d.jpeg -r 30 E:\\REC\\Video\\" + s + ".mkv" It works, but the size of the output video is large, about 8 MB for only 1 minute of video. How can I make the video smaller in size without sacrificing quality?
From what I know MKV is a container, you need to use compression for the video stream, like this: ffmpeg -r 1/5 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4 In this example each image will have a duration of 5 seconds (the inverse of 1/5 frames per second). The video stream will have a framerate of 30 fps by duplicating the frames accordingly. For more information see this article at the FFmpeg wiki.
stackexchange-superuser
{ "answer_score": 2, "question_score": 2, "tags": "video, images, ffmpeg, c#" }
modify php variable name dynamically I want to do something like this, but smarter. $armor = $row['armor']; $elemental_armor = $row['elemental_armor']; ... $unlock_field=mysql_result($wiki_result_set,$i,"unlock_field"); if ($unlock_field == "armor"){ $wiki_armor = $armor; } else if ($unlock_field == "elemental_armor"){ $wiki_elemental_armor = $elemental_armor; } Is something like this possible? $wiki_{$unlock_field} = {$unlock_field}; Sorry for the potentially simple question. I am admittedly a php novice.
$var = "wiki_{$unlock_field}"; $$var = $unlock_field;
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "php, variables" }