qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
4,966,564
I m working on login module. In logout function i worte the code as below, first kill the session,then redirect it to home page. It is working fine but session is not destroying. If anybody knows please help me Here is my code snippet for login & logout: ``` function login() { if(!empty($this->data)) { ...
2011/02/11
[ "https://Stackoverflow.com/questions/4966564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/606445/" ]
Try $this->Session->destroy(); The destroy method will delete the session cookie and all session data stored in the temporary file system. check this [link](http://book.cakephp.org/1.3/en/The-Manual/Core-Components/Sessions.html#destroy)
you dont want to kill the session. only to log the user out! ``` $this->Session->delete('Auth'); ``` otherwise you destroy cookies and other user defined settings which would be pretty annoying (language, ...) but the official cake way would be: ``` $this->redirect($this->Auth->logout()); ```
41,905,301
I am generating a line chart with d3. It works, but typescript code complain about a property not exists in vs. > > Property 'x' does not exist on type '[number, number]' > > > [![enter image description here](https://i.stack.imgur.com/rWbt2.png)](https://i.stack.imgur.com/rWbt2.png) Looking at the error. It see...
2017/01/28
[ "https://Stackoverflow.com/questions/41905301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4611304/" ]
its a typescript error. i think there is no x property right now in your d. can you try this ``` return this.xScale(d?.x); return this.xScale(d?.y); ``` or may be your d have data like this `["x_value","y_value"]` in number format. in this case you should try ``` return this.xScale(d[0]); return this.yScale(d...
.x((d:any) => this.xScale(d.x)) .y((d:any) => this.yScale(d.y))
49,500,309
I'm using Spring JPA and I need to have a native query. With that query, I need to get only two fields from the table, so I'm trying to use [Projections](https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#projections). It isn't working, this is the error I'm getting: ``` org.springframework.core.conv...
2018/03/26
[ "https://Stackoverflow.com/questions/49500309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3514976/" ]
The query should be using a [constructor expression](https://www.objectdb.com/java/jpa/query/jpql/select#Result_Classes_Constructor_Expressions_): ``` @Query("select new com.example.IdsOnly(t.id, t.otherId) from TestTable t where t.creationDate > ?1 and t.type in (?2)") ``` And i dont know Lombok, but make sure ther...
You can return list of Object Array (List) as return type of the native query method in repository class. ``` @Query( value = "SELECT [type],sum([cost]),[currency] FROM [CostDetails] " + "where product_id = ? group by [type],[currency] ", nativeQuery = true ) public ...
98,623
I have a few apps, but this tablet is new and I want more apps. Every time I say download, it says I have insufficient space. Please help!
2015/02/12
[ "https://android.stackexchange.com/questions/98623", "https://android.stackexchange.com", "https://android.stackexchange.com/users/94118/" ]
Go to settings>storage and take a look at what you have for space. Some devices come with very little to start with (4gb) while others have buckets (64gb). Downloading a few movies or games (or loading a big music library) can push a 4gb device to its limit fairly quickly. If you've checked settings and see that you h...
I would suggest checking what it says in your storage settings to see what you have available for space, and what is taking up the most space. Your media files, downloads, or cached data may be taking up more space than you expect.
8,621,141
I am attempting to connect to my local MySQL server with the following code: ``` dbURL = "jdbc:mysql://localhost:3306:/" + dbname; try{ Class.forName("com.mysql.jdbc.Driver"); try{ con = DriverManager.getConnection(dbURL, dbuser, dbpass); } catch (SQLException ex){ System.out.println("ERROR...
2011/12/23
[ "https://Stackoverflow.com/questions/8621141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114045/" ]
In case of JARs, the `-cp` and `-classpath` arguments and the `%CLASSPATH%` environment variable are **ignored**. Instead, the classpath has to be specified in the `Class-Path` entry of JAR's own `/META-INF/MANIFEST.MF` file. It can be a path relative to the JAR itself. E.g. in the same folder or in a `/lib` subfolder....
Install MySQL connector for JAVA ``` sudo apt-get install libmysql-java ``` Set classpath ``` export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java.jar ``` Source: <http://marksman.wordpress.com/2009/03/01/setting-up-mysqljdbc-driver-on-ubuntu/>
28,665
May be we can add a button to ask a previously asked question again to bring it to the top. May be some one else will be able to find it this time and anser. And it will be nice if a rule is put like a question can be "re-asked" only once in a week or so and a total of 5 times or so.. What you think?
2009/11/05
[ "https://meta.stackexchange.com/questions/28665", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/135920/" ]
We definitely won't be doing that. Here's what I recommend: [Getting attention for unanswered questions?](https://meta.stackexchange.com/questions/7046/how-to-get-attention-for-your-old-unanswered-questions)
How will this be beneficial to the community? It will lead to questions being reposted as exact duplicates, which will either be closed very quickly by the community (wasting the time of those who look at the question to answer it, then realise that it is a dupe), or the answers will be spread out too much rather than ...
4,640
It's well-known that we have a quality problem in the [kali-linux](https://unix.stackexchange.com/questions/tagged/kali-linux "show questions tagged 'kali-linux'") tag. Some statistics corroborate this perception (though not to the extent that I'd expected): * 16.4% of the [kali-linux](https://unix.stackexchange.com/q...
2017/10/22
[ "https://unix.meta.stackexchange.com/questions/4640", "https://unix.meta.stackexchange.com", "https://unix.meta.stackexchange.com/users/885/" ]
We've often talked in the chat about having a “reference question” telling people not to use Kali Linux. Well, [here's my proposal](https://unix.stackexchange.com/questions/399626/why-is-kali-linux-so-hard-to-set-up-why-wont-people-help-me). Edits welcome, but please keep the gist unless we decide on meta that this isn...
Listening to my fellow networking security classmates from years back, when it was still called BackTrack Linux, I can fully understand this phenomenon. It's somewhat anecdotal, but Kali Linux is seen as the "Swiss army knife" of Linux, and if you haven't installed it yet you aren't cool. Meanwhile I had been using De...
466,197
I'm running Ubuntu 14.04 LTS, and I have an HD 4600 integrated graphics chip. ``` lspci | grep VGA 00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06) ``` Intel just released the new version of their Graphics driver for Ubuntu 14.04. ...
2014/05/15
[ "https://askubuntu.com/questions/466197", "https://askubuntu.com", "https://askubuntu.com/users/277287/" ]
Here's the easier solution for those with problems: 1. Open Nautilus(file explorer), go to Edit -> Preferences -> Behavior, and make sure that under **Executable text files**, **Ask each time** is selected! (if not, select it) 2. Close the window 3. Open Nautilus (if not already open) 4. Right click **New document > E...
Use gdebi to install the intel-linux-graphics-installer and you won't have the GPG problems. It should automatically install with the deb package. Use the following commands to do so: ``` sudo apt-get update && sudo apt-get install gdebi cd && wget https://download.01.org/gfx/ubuntu/14.04/main/pool/main/i/intel-linux-...
35,541,978
Using the [Refile](https://github.com/refile/refile) gem to handle file uploading in Rails, what is the best way to determine image height and width during / after it has been uploaded? There is no built in support for this AFAIK, and I can't figure out how to do it using MiniMagick.
2016/02/21
[ "https://Stackoverflow.com/questions/35541978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/496080/" ]
Refile attachments have a `to_io` method (see [Refile::File](http://www.rubydoc.info/gems/refile/Refile/File) docs) which returns an IO object that you can pass to MiniMagick. Assuming you have an Image model with a `file` attachment (id stored in a `file_id` string column) and `width` and `height` columns you can use...
You can use MiniMagick to do this (but need to be using the latest version). ``` image = MiniMagick::Image.open('my_image.jpg') image.height #=> 300 image.width #=> 1300 ``` This is all pretty well documented in the README.md for the gem: <https://github.com/minimagick/minimagick>
68,041
Lets say that I have a smart contract C witch has a function setf(uint256). Also let's assume that there are many users(with different accounts) that want to call that function with argument 5 for example. As i understand each of them will make a logically same transaction to the same contract function with the same ar...
2019/03/07
[ "https://ethereum.stackexchange.com/questions/68041", "https://ethereum.stackexchange.com", "https://ethereum.stackexchange.com/users/50750/" ]
Just to add to @haxerl's good answer: you could use a proxy contract which does the logic for you. So the idea is the same but the proxy account would act as an intermediare which is only used for checking for duplicate transactions. The benefit of this is that you can code the actual contract normally and then after...
A very simple solution: you can have a nonce in your contract storage. ``` uint256 contractNonce; uint256 f; function setF(uint256 newF, uint256 providedNonce) public { revert(providedNonce <= contractNonce); f = newF; contractNonce++; } ```
24,349,504
How can I handle very long strings in Play's application.conf? Suppose I have: ``` my.value.param = "Very very very very long line" ``` and I want to split long line like ``` my.value.param = "Very very very " + "very long line" ``` How can I do this using HOCON format? Thanks
2014/06/22
[ "https://Stackoverflow.com/questions/24349504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/511964/" ]
From the [documentation](https://github.com/typesafehub/config/blob/master/HOCON.md#multi-line-strings) it appears to not be possible in that way. You could work around it slightly, like this: ``` my.value.param = ${my.value.param1} ${my.value.param2} my.value.param1="Very very very" my.value.param2="very long line" ...
``` build.path = ${PATH} build.path = ${build.path}":/opt/groovy-2.4.5/bin" build.path = ${build.path}":/opt/gradle-2.9/bin" build.path = ${build.path}":/opt/scala-2.11.7/bin" build.path = ${build.path}":/opt/sbt-0.13.9/bin" ```
4,242,437
I am trying to create a small applescript which will launch the DVD Player application and then resize it to its Actual Size. The code is listed below. When I run the code the DVD Player launches but it does not resize the window. What am I missing to get this to work? Thanks, Rob ``` do_menu("DVD Player", "View", "...
2010/11/22
[ "https://Stackoverflow.com/questions/4242437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434446/" ]
Have you looked at the dictionary for DVD Player? There are properties for adjusting the size. This will open it and go full screen: ``` tell application "DVD Player" open delay 2 set viewer full screen to true end tell ``` Or there is the viewer size property which states: viewer size (half/normal/double/...
I'm not in front of a Mac so I can't really test your code, but my suggestion is to try an existing and proven implementation of the same functionality, which uses recursion rather than nesting: <http://hints.macworld.com/article.php?story=20060921045743404> It's also possible that your `delay 3` is not long enough f...
10,478,234
farmville/frontierville/etc How do I figure out how many "likes" these apps have? The graph API does not work with apps.
2012/05/07
[ "https://Stackoverflow.com/questions/10478234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/179736/" ]
Call ``` https://graph.facebook.com/APP_ID ``` Try this example call in [Graph Explorer](https://developers.facebook.com/tools/explorer): ``` https://graph.facebook.com/farmville ``` which will return a JSON reponse with id, name, picture, link and then likes as 5th value.
You can get the number of likes from Graph API by querying by Application `id` or Application `namespace`. ``` https://graph.facebook.com/APP_ID_OR_NAMESPACE ``` You can also limit results to be only constructed from `id` of an application and `likes` by using `fields` argument in URL: ``` https://graph.facebook.co...
2,807,390
Given function $$F(x,y)=\frac{(x+y-2)(x+y-1)}{2}+y$$ is bijective or not. Attempt: I check $F(x\_1,y\_1)$ and $F(x\_2,y\_2)$ and ends up in $$(x\_1+y\_1)^2-3x\_1-y\_1=(x\_2+y\_2)^2-3x\_2-y\_2$$ Now how to show $(x\_1,y\_1)=(x\_2,y\_2)$? How one can show it is surjective?
2018/06/04
[ "https://math.stackexchange.com/questions/2807390", "https://math.stackexchange.com", "https://math.stackexchange.com/users/317044/" ]
Write it as $(x\_1+y\_1)^2-(x\_2+y\_2)^2+3(x\_2-x\_1)+(y\_2-y\_1)=0$ Now suppose, $x\_1 \neq x\_2$ and $y\_1 \neq y\_2$. What can you say about the expression i.e., can it be $0$? Remember $x\_1,x\_2,y\_1,y\_2 \in \mathbb{N}$.
Its not even injective, since $F(2,0) = 0 = F(1,0)$
4,623
In [this thread about cooking for people with allergies](https://cooking.stackexchange.com/questions/4621/tips-on-cooking-for-people-with-different-allergies) the first commenter (rightly, IMHO) suggests splitting up that general effort into more allergy-specific tips. The overall effort might still be worthwile, but a...
2010/08/09
[ "https://cooking.stackexchange.com/questions/4623", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/8457/" ]
Well, if you're having friends over for dinner, you're probably willing to put in some extra effort anyway. That may sounds like throwaway advice, but it's not meant that way: for instance when my vegetarian friends come over, I make sure to have vegetarian food (duh), or I go buffet-style: as longs as there are enough...
I'd begin by coming up with a couple of dishes for each course that are allergen-free, as this dietary requirement affects the health and well-being of the people. Once you are certain that there are no ingredients that are harmful to health, take the next step regarding omitting other offending ingredients. I think th...
24,414,315
I am using the FOSUserBundle to register users. The errors are appearing in an odd place though. They are appearing within the Password field row, not the username or email ![form errors](https://i.stack.imgur.com/A967p.png) As you can see the errors are rendered next to Password and not Username nor Email. The HTM...
2014/06/25
[ "https://Stackoverflow.com/questions/24414315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/119737/" ]
Assuming (since you won't show it) that `{word}` is expanded to `hello there`, your code becomes: ``` var hello there = 'hello there'; if( hello there == 'hellothere' || hello there == 'hello there' || hello there == 'hello-there' ){ document.write('blah blah'); } else { document.write(''); } ``` As s...
I think you're looking for ``` if ({word}.replace(/-| /g, "") == 'hellothere') { … } ``` (despite the obvious syntax issue). It just removes all hyphens and spaces from the `{word}` before comparing it. If you want to make it case-insensitive, add `.toLowerCase()`.
5,994,040
Sup guys ! I'm currently have some problems about the synchronization with JavaScript. It's about a refresh. When it reach 10 second i refresh an array. ``` var curD = new Date(); if((curD.getTime() / 1000) - dMList[i].startTime > dMList[i].refreshTime) { dMList[i].elem = new Array(); RSSDropMenuConstructor(d...
2011/05/13
[ "https://Stackoverflow.com/questions/5994040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/632950/" ]
You need to wait for the feed to come back from the server before calling sendResponse(). Place the call to sendResponse() in the callback function (that is, function(feed){...}). Because AJAX is asynchronous, Javascript will continue to execute your code, even while a request to the server is pending. The callback, o...
Put the sendReponse() function inside the if statement. That way it will execute when the rest of the code inside that block is executing.
2,800,013
I'm learning math. I've recently thought more about the proof by contradiction technique, and I have a question that I would like cleared up. Let me set the stage. Suppose I am trying to prove a theorem. Theorem: If A and $\neg$B, then $\neg$C. Proof (contradiction): Let us suppose that A is true and $\neg$B is tru...
2018/05/29
[ "https://math.stackexchange.com/questions/2800013", "https://math.stackexchange.com", "https://math.stackexchange.com/users/565705/" ]
Similar to what Wofsey commented, a statement must be either true or false. You might wonder what happens if we have conflicting axioms. That is, what if we assume A and not A? It turns out that you can then prove any statement with these assumptions.
If assuming that C is true leads to a contradiction, and assuming that C is false also leads to a contradiction, then the universe collapses in on itself and time comes to an end. Seriously, either you have made an error in your proofs, or your axioms are mutually contradictory. Do you actually have an example of thi...
457,026
I was wondering that the density of electric field lines determine the strength of the electric field .Now let's say you have an isolated charge ; you know the flux through a closed surface which I take to be a unit sphere suddenly limited by the Gauss law. If the flux is limited then it's bound to be the field lines s...
2019/01/27
[ "https://physics.stackexchange.com/questions/457026", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/187604/" ]
***I was wondering that the density of electric field lines determine the strength of the electric field*** First we need to realize that electric field lines are used to visualize and analyze electric fields and therefore should be considered as a pictorial tool as opposed to a physical entity. For example, one canno...
It is **not** true that if $E \rightarrow \infty$ then it should be the case that $\Phi\_E \rightarrow \infty$. Notice that in your example, the surface area of your sphere tends to zero $A \rightarrow 0$ as the sphere gets smaller. Since you're computing $\Phi\_E = EA$, you're trying to multiply a quantity that tend...
50,180,241
I am trying to connect to an AWS RDS MySQL instance from Google Dataflow. I created a java program to create the pipeline. The job creates successfully but the MySQL connection always fails with the following error: ``` java.lang.RuntimeException: org.apache.beam.sdk.util.UserCodeException: com.mysql.cj.jdbc.exception...
2018/05/04
[ "https://Stackoverflow.com/questions/50180241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9742590/" ]
``` > number <- 1059 > x <- strsplit(as.character(number), "")[[1]] > y <- seq_len(nchar(number)) > as.numeric(as.numeric(x) %*% y) [1] 52 ```
``` weighted.digit <- function(str) { splitted.nums <- as.numeric(strsplit(str, '')[[1]]) return(sum(splitted.nums * 1:length(splitted.nums))) } weighted.digit('1059') [1] 52 ``` One could modify this to accept a numeric input, and then simply convert that to character as a first step.
34,428,972
So I created my first label without story board today and I am wondering how to change the text of the label when I click a button. The action for the button works just fine. I did create an outlet for the label so I could refer to it out of the method I initially called it in but when I click the button the app crashe...
2015/12/23
[ "https://Stackoverflow.com/questions/34428972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5709705/" ]
Dave's answer is pretty good. Look there for an explanation. If you are still having trouble I'll simplify it. **Case 1:** ``` if(a && b || c || d || e) ``` In this case you can simplify it by saying `z = a && b` This means that the expression becomes ``` if(z || c || d || e) ``` This is the same as the ex...
`if(a && b || c || d || e)` stands for: If `a` is `true` and `b` or `c` or `d` or `e` is true then it will go `inside`. That's it. So, if `a` is `true` and at least any rest other variables(`b` or `c` or `d` or `e`) then it will go inside. Otherwise it won't.
36,208,630
I use some of Xcode's source control features, specifically the blame feature in the main editor, but use git on the command line for all of my actual version control. This means that, fairly often, git commands on the command line fail with the message: ``` fatal: Unable to create '/path/to/repo/.git/index.lock': Fil...
2016/03/24
[ "https://Stackoverflow.com/questions/36208630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/378418/" ]
Here's my hacky patchy for this: a few lines of bash which waits till the lock file disappears and then runs your git commands. Race conditions are certainly possible, this isn't bullet proof but would work *most of the time*. ``` function retry { while [ 1 == 1 ]; do if test -f /path/to/repo/.git/index.lo...
I used to use Xcode's git client, and it was consistently causing errors including this one, so I've stopped using Xcode to setup my workspaces or make commits. To enable this setup, I installed the git support from the Command Line Tools for Xcode X.x, and refer to an external git GUI for any commands that result in a...
39,016,923
I am trying to benchmark CPU calculation power with a simple function, without adding huge frameworks with thousands of lines and some MB's to my project. I developed this sample code. It is a for wich does 100 times a huge task. This huge task (benchmark() function) consists in a while which will do a math complex ca...
2016/08/18
[ "https://Stackoverflow.com/questions/39016923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/479886/" ]
Overheating? No. I doubt that this calculation can make your CPU break a sweat. I think the change over time has to do with the JVM and statistics. The HotSpot compiler uses them to optimize code branching based on what your code is doing. <http://blog.takipi.com/jvm-performance-magic-tricks/> <https://wiki.openjdk....
If I understand correctly, the two log snippet are for different execution made with different JVM launches? In this case, the difference between the two cannot be caused by the JVM (as it has been restarted). So, the difference can be caused by a lot of stuff: OS file cache (there is already some file stuff going on...
15,300
My cat has a problem with eating houseplants. He ate an entire succulent over a month time period while I was at work even with lemons near or aluminum foil on the windowsill. I was thinking about going the pet grass option but he has another problem. He also likes to knock over plants and scatter the dirt around. I...
2016/09/16
[ "https://pets.stackexchange.com/questions/15300", "https://pets.stackexchange.com", "https://pets.stackexchange.com/users/6901/" ]
I think it is important to offer cat grass (in austria it is even mentioned in the law as minimum requirement for having a cat indoors). I feel like my cats are a lot less interested in my plants since they have cat grass (that they got calmer after turning 3 helped as well). I placed it somewhere high where they can s...
The easiest, safest and best way is simple; don't let them get near it. You can't teach a cat not to do something, you can only teach them to not do something while you are nearby. Small example, our cats never walk on the dinner table when we are home, but if we happen to be outside in the garden or come home when t...
23,281,399
Hi I am trying to find the depth of the binary tree. I was trying a different method than the conventional way to do it. My logic is trying to find max of the levels while doing a depth traversal. Following is the code. This approach is not working as the max value is always zero once it reaches the else part. I am not...
2014/04/24
[ "https://Stackoverflow.com/questions/23281399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3246489/" ]
Your analysis is correct. Unrelated `JOIN` create cartesian products. You have to do the sums separately and then do a final addition. This is doable in one query and you have several options for that: * Sub-requests in your SELECT: `SELECT a.id, (SELECT SUM(b.debit) FROM b WHERE b.a_id = a.id) + ...` * `CROSS APPLY`...
Can also be done with correlated subqueries: ``` SELECT a.id , (SELECT SUM(debit) FROM b WHERE a.id = b.a_id) , (SELECT SUM(credit) FROM c WHERE a.id = c.a_id) , (SELECT SUM(other) FROM d WHERE a.id = d.a_id) FROM a ```
37,100,825
I'm looking to escape some character `(` and `)`, their respective escape codes are `(40)` and `(41)`. ``` echo 'Hello (world)' | sed 's/(/(40)/g;s/)/(41)/g' ``` This code fails with `Hello (40(41)world(41)` because it will also process the output from the first replacement. Is there any way I can skip the replaceme...
2016/05/08
[ "https://Stackoverflow.com/questions/37100825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2108150/" ]
All you need is: ``` $ echo 'Hello (world)' | sed 's/(/(40\n/g; s/)/(41)/g; s/\n/)/g' Hello (40)world(41) ``` The above is safe because `\n` can't be present in the input since sed reads one line at a time. With some seds you might need to use a backslash followed by a literal newline or `$'\n'` instead of just `\n`...
The problem is solved by creating an ord function in awk. It doesn't appear sed has this functionality. ``` #! /bin/sh awk ' BEGIN { _ord_init() } function _ord_init(low, high, i, t) { low = sprintf("%c", 7) # BEL is ascii 7 if (low == "\a") { low = 0; high = 127; ...
624,354
I want to rescale this table because I want it to fit in one page but for some reason it won't and it gives me errors. I tried using `\scalebox{0.5}` that I used for another table but it doesn't work. ``` \begin{table}[h] \centering \caption{Panel A} \begin{tabular}{l*{2}{c}} \hline\hline ...
2021/11/29
[ "https://tex.stackexchange.com/questions/624354", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/239891/" ]
After half of year (I didn't notice this question before) ... Your first table in its current format is too long to fit on a page. If you willing to write standard errors in separate columns and round number of decimals to (reasonable) three, than is possible to fit it on one page at using normal font size. By use of...
I have no problems to scale your first example: ``` \begin{table}[h] \centering \caption{Panel A} \scalebox{0.5}{\begin{tabular}{l*{2}{c}} \hline\hline &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}\\ \hline Highest schooling attained& -0.00577 & -0.00835 ...
39,411,200
I heard that the computer only understands numbers in base two (binary) for years. Recently, I wanted to understand in depth how my machine was working by stopping high level scripting languages and read few Assembly. I understood that the goal of this language was for the CPU to be fast: simple for it, the CPU can eas...
2016/09/09
[ "https://Stackoverflow.com/questions/39411200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6813446/" ]
"The computer only understands binary" is an oversimplification of reality. The CPU (lets limit it to just the CPU for now), is a very complicated piece of hardware. It consists of modules like the arithmetic and logic unit (ALU) and the control unit (CU). Now a program which the CPU can "understand" is only in binar...
I will try to focus on the question that what do we mean when we say computer only understands binary First let's take this example Say you have to store a letter 'g' in the machine First we convert it to it's ASCII value that is 103 Now binary equivalent of 103 is 1100111 Now we don't have any mechanism to store...
22,305,141
I am fairly new to java. I want to count the occurrences of words in a particular line. So far i can only count the words but no idea how to count occurrences. Is there a simple way to do this? ``` Scanner file = new Scanner(new FileInputStream("/../output.txt")); int count = 0; while (file.hasNextLine()) { St...
2014/03/10
[ "https://Stackoverflow.com/questions/22305141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3375627/" ]
Check Guava's [Multiset](http://code.google.com/p/guava-libraries/wiki/NewCollectionTypesExplained#Multiset). Their description starts with `'The traditional Java idiom for e.g. counting how many times a word occurs in a document is something like:'`. You find some code snippets how to do that without a MultiSet. BTW:...
In a given `String`, occurrences of a given `String` can be counted using `String#indexOf(String, int)` and through a loop ``` String haystack = "This is a string"; String needle = "i"; int index = 0; while (index != -1) { index = haystack.indexOf(needle, index + 1); if (index != -1) { System.out.pri...
57,601
Write a program or function that transforms an input string into [Zalgo](https://stackoverflow.com/questions/6579844/how-does-zalgo-text-work) text. For example, for an input string `Zalgo`, a possible output might look like: > > Z̗̄̀ȧ̛̛̭̣̖̇̀̚l̡̯̮̠̗̩̩̥̭̋̒̄̉̏̂̍̄̌ģ̨̭̭̪̯̫̒̇̌̂o̢̟̬̪̬̙̝̫̍̈̓̅̉̇ > > > Zalgoification s...
2015/09/11
[ "https://codegolf.stackexchange.com/questions/57601", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/41723/" ]
MATLAB, 106 bytes ================= I thought I'd submit another answer from a language which actually has a built in normal distribution function. I don't think I've ever tried MATLAB before so this may not be the most golfed it can be. ``` function o=z(a) o=[] for c=a o=[o c floor(rand(1,floor(normrnd(5,10)*isstrpr...
Perl, 73 bytes -------------- ```perl s!\w\K!$x=-140;$x+=rand for 1..300;(x x $x) =~ s/x/chr 768+rand 48/ger!ge ``` Input is taken as newline-separated strings. If you want to ignore the warnings printed to STDERR, use the `-C7` command-line flag. This uses the same approximation for a normal distribution as the M...
2,469,767
We always say that method overloading is static polymorphism and overriding is runtime polymorphism. What exactly do we mean by static here? Is the call to a method resolved on compiling the code? So whats the difference between normal method call and calling a final method? Which one is linked at compile time?
2010/03/18
[ "https://Stackoverflow.com/questions/2469767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/296495/" ]
Your are right - calls to overloaded methods are realized at compile time. That's why it is *static*. Calls to overridden methods are realized at run-time, based on the type on which the method is invoked. [On virtual methods wikipedia says:](http://en.wikipedia.org/wiki/Virtual_function#Java) > > In Java, all non-...
First, I want to discuss Run-time/Dynamic polymorphism and Compile-time/static polymorphism. Compile-time/static polymorphism:- as its name suggests that it bind the function call to its appropriate Function at compile time. That means the compiler exactly know which function call associated to which function. Functio...
2,430,350
I am trying to set and catch the URL variable It begins with a form which has the standard action set to "/autorisation/logout" Then a button with an inline JavaScript function ``` function tbPayout() { parent.location = "/autorisation/logout?rcgo=payout"; return true; } <input src="/images/go02.gif" type=image bor...
2010/03/12
[ "https://Stackoverflow.com/questions/2430350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133418/" ]
**Since php 5.3:** Use `static::MY_CONST` --- **More details on `static`** In this case [the keyword `static`](http://php.net/manual/en/language.oop5.late-static-bindings.php#language.oop5.late-static-bindings.usage) is a reference to the actually called class. This illustrates the difference between `static $var`...
I couldn't get it to work with const as it prints "yonderyonder" (that's the thing about constants, they don't change), but it works fine with var: ``` <?php class MyClass { var $MY_CONST = "yonder"; public function __construct() { echo $this->MY_CONST; } } class ChildClass extends MyClass { ...
1,231,288
I have an object that has several properties. If I have a pointer to one of those properties, is it possible to get a pointer to the class instance to which that ivar belongs? for example: foo.bar, where I know the address of bar, can the address of foo be found? This seems related to: [run time references](http://de...
2009/08/05
[ "https://Stackoverflow.com/questions/1231288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
First, you need to adjust your terminology a bit. You cannot have a pointer to a property, because a property is an interface to an object, specifying the format of the getter and setter methods. If you had a pointer to the getter, a method (IMP) at best you could get back would be a pointer to the class, certainly y...
Unless the object has a pointer back to it's "parent" or you explicitly track it yourself, I don't believe there's a way to resolve that. You'd really have to trace through memory to find what basically amounts to "who points to me". It's essentially the same problem as finding the previous node in a singly-linked list...
136,302
I’m in talks with an early age startup (would be joining as employee number 2). I do realise that working in a startup is not a classic 9-5. I understand that there might often be deadlines which will require me to put in more work than that. I understand that and am ok with this arrangement - obviously I will *want* t...
2019/05/09
[ "https://workplace.stackexchange.com/questions/136302", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/-1/" ]
Here's the thing: I *do* want to work eight hours a day and no more. And I do a good job in eight hours. I know I wouldn't do any more work in ten hours, so that would be pointless. Now whether the startup thinks spending time in the office is necessary to prove your dedicated, or whether they just think they want so...
Read "Slicing Pie" about wages vs equity in a startup. If you're getting paid 100% of your market wage, you get no equity; if you work for free, you get your wage equivalent in equity, and everything in between. The important thing is, this should be laid out before you start. This approach accounts for the different ...
27,712,915
We're working on a website makeover and have the look that we would like but are trying to figure out how to get it to be functional. The page is linked below for reference. <http://centraliowaaccountant.com/newhomepage.html> Basically what we're looking for is the entire area when you hover on "Tax Preparation" to ...
2014/12/30
[ "https://Stackoverflow.com/questions/27712915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4406686/" ]
This example is taken from <http://api.jquery.com/animate/> ``` $( "#book" ).animate({ opacity: 0.25, left: "+=50", height: "toggle" }, 5000, function() { // Animation complete. }); ``` Basically instead of setting the height directly you pass the animate function the value it should be. The animate function...
In my opinion, a "setInterval" it's a little heavier, because it's always checking something. Did you try with css?... What if you put a transition to the .flexht class? ``` .flexht{ -moz-transition:all 1s; -webkit-transition:all 1s; transition:all 1s; } ``` Sorry, I don't know how your HTML looks like. But i...
20,296
Suppose I build a neural network for classification. The last layer is a dense layer with Softmax activation. I have five different classes to classify. Suppose for a single training example, the `true label` is `[1 0 0 0 0]` while the predictions be `[0.1 0.5 0.1 0.1 0.2]`. How would I calculate the cross entropy loss...
2017/07/10
[ "https://datascience.stackexchange.com/questions/20296", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/15412/" ]
Let's start with understanding entropy in information theory: Suppose you want to communicate a string of alphabets "aaaaaaaa". You could easily do that as 8\*"a". Now take another string "jteikfqa". Is there a compressed way of communicating this string? There isn't is there. We can say that the entropy of the 2nd str...
The problem is that the probabilities are coming from a 'complicated' function that incorporates the other outputs into the given value. The outcomes are inter-connected, so this way we are not deriving regarding to the actual outcome, but by all the inputs of the last activation function (softmax), for each and every ...
27,236,947
I am trying to use MailKit (<http://jstedfast.github.io/MailKit/docs/index.html>) to log into Gmail using oAuth. I am able to log into Google API using a refreshed AuthToken, but when I try to use the refreshed token in MailKit, I get an error "Invalid Credentials" Any clues?? Thanks, Jeff Here is my code: ```cs var...
2014/12/01
[ "https://Stackoverflow.com/questions/27236947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/797825/" ]
a clearer answer is that the scope was incorrect in the original code ```cs Scopes = new string[] { GmailService.Scope.GmailReadonly } ``` needs to be ```cs Scopes = new string[] { GmailService.Scope.MailGoogleCom } ``` in order to authenticate with imapi using a access token.
```cs using (var client = new ImapClient()) { client.Connect("imap.gmail.com", 993, true); client.AuthenticationMechanisms.Remove("XOAUTH2"); client.Authenticate(EmailId, Password); } ``` The above piece of code is used to log in to gmail using imap and MailKit tool. But before this,...
17,128,999
I have decided to give bluestack a try for debugging and testing my android dev games. However I have discover that the tilt doesn't seem to work. There seem to be a few config files in the app folder, but they are for specfic game and have a classpath associated with them. eg.. com.halfbrick.jetpack.input.cfg ``` # ...
2013/06/15
[ "https://Stackoverflow.com/questions/17128999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/830439/" ]
In this case, it is advised that you declare it in only one place. It will be more readable and spare some lines of code. Renaming would also be good, maybe something that suggests that is the final result of your method (like `returnArray`, `resultArray`). In other circumstances, when that list would mean several d...
There's nothing wrong with declaring it multiple times, but you have a lot of repeated code: you can significantly improve your code by refactoring. In your case, the JDK provides a convenience utility method to create ArrayLists in-line: Instead of: ``` ArrayList<E> arr = new ArrayList<E>(); arr.add(slow.element); ...
14,064,111
I have a Java program which uses javax.mail to send an SMTP message. This program works fine on a Linux box, I want to emphasize that beforehand. When I try this same code on my Windows 7 x64 box, I get this error: ``` send failed, exception: javax.mail.MessagingException: Could not connect to SMTP host: smtp.west...
2012/12/28
[ "https://Stackoverflow.com/questions/14064111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1071914/" ]
I was also facing the same issue , basically it was a Java 7 issue, Just passing in JVM argument "-Djava.net.preferIPv4Stack=true", i got rid from issue .
I had similar issue but strangely everything was working fine with jdk 1.6 once I install jdk 1.7 I got the exception. I wonder what could be the reason for this! After adding IPV4 argument it is working fine..Thank you so much.
57,865,772
I have a script in php that is calling a python one, which is a neural network being trained and it takes about 80 seconds to finish, but my php script finishes fast. I tried just creating a csv file in python which is a quick process, and it worked, so its really a question of time. I've already tried using the fol...
2019/09/10
[ "https://Stackoverflow.com/questions/57865772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10807658/" ]
Just use the Symphony Process component -> <https://symfony.com/doc/current/components/process.html> It allows you to run processes asynchronously and check whether they are still running: <https://symfony.com/doc/current/components/process.html#running-processes-asynchronously> Cheers.
Straight from the manual <https://www.php.net/manual/en/function.sleep.php> ``` sleep ( int $seconds ) : int ``` Delays the program execution for the given number of seconds. **Parameters ¶** seconds Halt time in seconds. **Return Values ¶** Returns zero on success, or FALSE on error. If the call was interrupt...
838
I recently came across this picture of the Boeing 787 series aircraft's incredible wingflex: ![](https://i.stack.imgur.com/lEhvU.jpg) I suppose this is a consequence of using very light CFRP wings, but how does the wingflex itself improve the 787's flight performance? Do the benefits/drawbacks also apply to the 747-8...
2014/01/10
[ "https://aviation.stackexchange.com/questions/838", "https://aviation.stackexchange.com", "https://aviation.stackexchange.com/users/504/" ]
The wings of the Boeing 787 are so flexible because its carbon fiber material can be stretched more, and the high aspect ratio of 11 will magnify this effect. In flight, all you will feel is less shaking due to gusts, because the wing will dampen load changes more effectively. On the ground, the wing might have less ti...
Not only the 787 with CFRP has this, all wings flex a lot as shown by the lower part of this image. [![B52 deformation](https://i.stack.imgur.com/igVdz.jpg)](https://i.stack.imgur.com/igVdz.jpg) Source: [Introduction to Transonic Aerodynamics](https://books.google.nl/books?id=KG3xCAAAQBAJ&pg=PA479&lpg=PA479&dq=rigid%20...
6,057,074
I've a table we have userids of people and the langauges they can speak. just two columns, userid and language. I want to find all those users who can speak hindi AND english AND german AND french. How should I write this query ? I cannot use Inner Join 4 times. Problem being the check for number of languages might in...
2011/05/19
[ "https://Stackoverflow.com/questions/6057074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/422028/" ]
If using MySQL, you could do something like (to be debugged, not tested): ``` SELECT userid FROM ( SELECT userid, GROUP_CONCAT(language SEPARATOR ',') AS languages FROM UserLanguage ORDER BY userid ASC, language ASC GROUP BY userid) WHERE languages LIKE '%english%french%german%hindi%'; ``` (the lan...
You could use a [correlated subquery](http://msdn.microsoft.com/en-us/library/ms187638.aspx), like this: ``` SELECT UserId FROM UserLanguage UL1 WHERE EXISTS (SELECT * FROM UserLanguage UL2 WHERE UL2.UserId = UL1.UserId AND UL2.Language = 'english') AND EXISTS (SELECT * FROM UserLanguage UL2 WHERE UL2....
37,144,094
how to update ReyclerView adapter without make OnCreateViewHolder(...) being called? Because when i do `mRecyclerView.getAdapter().notifiItemChanged(position)` it goes inside `OnCreateViewHolder(...)` what i don't want to. The reason why i don't want is because I have expanded item view and `onCreateViewHolder(.....
2016/05/10
[ "https://Stackoverflow.com/questions/37144094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4543133/" ]
you have several options **1)** Include the path to the folder test to `sys.path` you can do hardcoded b.py ``` import sys sys.path.append("path/to/test") import test.a.a ``` but in this case you have to change it manually if later you change the test folder to another place you can also do automatic with b.py...
The module `test` is part of the standard library. So when you `import test.a`, it tries to import the `a` module in it. So, even if you find a solution, it is better you don't use that name for your package.
3,818,956
When we solve the equation $$x^{12}+x^6+1=0$$ we obtain $2$ solutions that also satisfy $$x^2+x+1=0$$ namely $-\frac{1}{2}\pm i\frac{\sqrt3}{2}$. Shouldn't this imply that $x^2+x+1$ is a factor of $x^{12}+x^6+1$? However, the fully factorsied form of $x^{12}+x^6+1$ is $$(x^6-x^3+1)(x^6+x^3+1)$$ The reason I think that ...
2020/09/08
[ "https://math.stackexchange.com/questions/3818956", "https://math.stackexchange.com", "https://math.stackexchange.com/users/764058/" ]
You are correct that if all of the roots of a polynomial $f(x)$ are roots of a polynomial $g(x)$, then $f(x)$ is a factor of $g(x)$. However $x^2 + x + 1$ is not a factor of $x^{12} + x^6 + 1$. The reason is because $- \frac{1}{2} \pm i \frac{\sqrt{3}}{2}$ are not roots of that polynomial. This is because $$ \left( -...
Another issue besides that mentioned by several posters in both answers and comments is this: You say the "the fully factorsied form" is a certain product of two cubic polynomials with integer coefficients. But if that is "the fully factorsied form", that would mean that's as much factoring as can be done with integer ...
895,276
I extracted a `.zip` file compressed on a Mac and discovered that the compression included all the `.DS_STORE` meta-directory files (I think used to speed up spotlight search, but besides the point?). Is there a one-liner I can execute from a Windows PowerShell or simple python script to clean up this folder by recurs...
2015/03/29
[ "https://superuser.com/questions/895276", "https://superuser.com", "https://superuser.com/users/155701/" ]
In PowerShell do this: ``` cd MyFolder Get-ChildItem -recurse -filter .DS_STORE | Remove-Item -WhatIf ``` When you specify `-WhatIf`, then PowerShell won't make any changes. It will instead tell you what it would have done. When you are happy with what it will do, then you can remove the `-WhatIf`. (It always pays ...
That [`find`](http://linux.die.net/man/1/find) syntax you are using in your example seems to me to be more appropriate for Mac OS X or Linux/Unix setups than a Windows setup. Instead, perhaps use the [`del`](https://technet.microsoft.com/en-us/library/cc771049.aspx) command like this in Windows [as explained here](http...
56,443,904
I have a JSON object that I pass to an API endpoint: ``` { "ID": 12312, "location": "London", "friends": 1231, "Name": "dsd", "verified": true } ``` I have an endpoint `UserController`: ``` @PostMapping("saveUser") public String Save(@RequestBody(required = true) User newUser){ //TODO: User...
2019/06/04
[ "https://Stackoverflow.com/questions/56443904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10840790/" ]
camelCase. Try changing ID to id and Name to name. Frameworks assumes getID would have been declared as iD.
`@JsonProperty("ID"); private long ID;` use the @JsonProperty to tell the mapper object the property of the request body object to read from and the response body.
44,658,044
I have a Java class that has a private constructor: ``` public class MyClass { private static final MyClass myClass = new MyClass(); private MyClass() {} public static MyClass getInstance() { return myClass; } } ``` This class is being used in the application like this: ``` MyClass myClass = MyClass.g...
2017/06/20
[ "https://Stackoverflow.com/questions/44658044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3518066/" ]
Your error has nothing to do with static-ness or your constructor. From the [javadocs](https://docs.oracle.com/javase/8/docs/api/): > > Thrown if the Java Virtual Machine or a ClassLoader instance tries to > load in the definition of a class (as part of a normal method call or > as part of creating a new instance u...
**NoClassDefFoundError** Occurs when JVM tries to load a particular class that is the part of your code execution (as part of a normal method call or as part of creating an instance using the new keyword) and that class is not present in your classpath but was present at compile time because in order to execute your pr...
9,262,535
I am new to iOS5 development and using objective-c. I have trouble understanding the difference between **strong** and **weak** storage. I have read the documentation and other SO questions, but they all sound identical to me with no further insight. I read [the documentation: Transitioning To ARC](https://developer.a...
2012/02/13
[ "https://Stackoverflow.com/questions/9262535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/529310/" ]
> > Aren't the two definition identical. > > > Absolutely not. The key difference in the two definitions that you've pointed out is the "as long as someone else". It's the "someone else" that is important. Consider the following: ``` __strong id strongObject = <some_object>; __weak id weakObject = strongObject; ...
I know I'm rather late to this party, but I think it's important to confuse the issue by pointing out that the meaning of "strong and weak memory models" depends on whether you are talking about software or hardware. For hardware, weak or strong indicates whether there is support for sequential consistency. > > [SC...
58,422,224
I am trying to get from My Starting DataFrame ![My Starting DataFrame](https://i.stack.imgur.com/dTzen.png) to My Desired Results ![My Desired Results](https://i.stack.imgur.com/eR98H.png). I am trying to do a groupby on two columns (Name, Month) and I have a column (Category) that has either the value 'Score1' or...
2019/10/16
[ "https://Stackoverflow.com/questions/58422224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12229134/" ]
You can use [Pivot Table](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.pivot_table.html) ``` df.pivot_table(index=['Name', 'Month'],values='Value', columns='Category').rename_axis(None, axis=1).reset_index() Out[1]: Name Month Score1 Score2 0 Jack Jan. 1.0 2.0 1 Sarah Feb. ...
one way is with `groupby` and `unstack` ``` new_df = (df.groupby(['Name','Month','Category']) ['Value'].first().unstack().reset_index()) print(new_df) Category Name Month Score1 Score2 0 Jack Jan. 1.0 2.0 1 Sarah Feb. 3.0 4.0 2 Zack Feb. 5.0 NaN ```
7,807,512
I have created a sample application in Silverlight with RIA services. I am using entity framework for CRUD operation but it does not work for INSERT Operation with following Exception, **"Submit operation failed validation. Please inspect Entity.ValidationErrors for each entity in EntitiesInError for more information."...
2011/10/18
[ "https://Stackoverflow.com/questions/7807512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/748021/" ]
The SubmitOperation callback has an `EntitiesInError` property which you can use to iterate thru the entities. That's the way of getting the "real" error. Here's the method I have to show the user what went wrong... ``` public static bool WasSubmittedOK(SubmitOperation so, string errorMessageHeader, out string errorM...
Are you able to drill into the validation errors? I actually have an article about this coming in December MSDN Magazine Data Points but I bet you don't want to wait, right? :) Even if you haven't applied any specific validations, there are things like foreign key contsraints that EF will still check. If you can see w...
13,077,010
I would like to modify the default behavior of a regular WinForms C# textbox control so that pressing `backspace` deletes **whole words** instead of just a single character. Ideally I would like to have this special behavior **only** when the caret position is in-front of a white-space character. For example; pressing...
2012/10/25
[ "https://Stackoverflow.com/questions/13077010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/805220/" ]
Take a look at the keypress/keydown events.
Its a psuedo code, I hope you will find it helpful: ``` // check backspace is pressed if keycode==keycode(backspace) then // testing cursor is just after space(113) character if string[string length] == keycode(space) then // loop through string in reverse order loop each character in reverse /...
2,041,782
In the application I'm developing at the moment I'm using a datagridview to display data. To fill it, I've to press a button and a backgroundworker will start running, it will fill a datatable and when it's finished running it will use the datatable as the datasource for the datagrid. This works fine, the UI stays resp...
2010/01/11
[ "https://Stackoverflow.com/questions/2041782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65002/" ]
I found another way to do the reflection double buffering for slow datagrids: Create an extension method with some reflection to set double buffering on the datagrid: ``` public static class DataGridViewExtensioncs { public static void DoubleBuffered(this DataGridView dgv, bool setting) { var dgvType...
Turn on double buffering List of namespaces required for the function to compile is: ``` using System; using System.Reflection; using System.Windows.Forms; public static class ExtensionMethods { public static void DoubleBuffered(this DataGridView dgv, bool setting) { Type dgvType = dgv.GetType(); P...
49,142,045
I'm relatively new to Laravel. I'm confused on what is the proper way to deploy a Laravel 5.5 app to a Godaddy cPanel shared hosting. I've read multiple posts on the subject and they give conflicting advice. Part of what I'm not clear on is do I copy all my files to the server and then run the following composer comma...
2018/03/07
[ "https://Stackoverflow.com/questions/49142045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2026659/" ]
I figured out how to deploy Laravel on a Godaddy shared hosting plan after reading more posts about the subject. Here are the steps I took: 1. Created a new folder outside the public\_html folder and uploaded all of the app files to that folder except the vendor folder. 2. Using SSH access, I ran the command `curl -sS...
~~The biggest problem you have is that GoDaddy's latest supported version of PHP is v5.6. Laravel v5.5 and later all require PHP v7.0 or higher.~~ Apparently, they added PHP 7 support in late 2017. I'd **still** highly recommend shifting to a much more reputable host like (closest comparison) BlueHost.com or DigitalOc...
148,733
This may or may not be off-topic; feel free to point me to a better place to ask this. My father brought home a cell phone he found in the woods, and I thought I'd charge it and turn it on to see if I can find out anything about the owner. (Needless to say I got no further than the lock screen.) The phone is now tur...
2016/06/19
[ "https://android.stackexchange.com/questions/148733", "https://android.stackexchange.com", "https://android.stackexchange.com/users/172233/" ]
Take out the battery while it is plugged into a laptop, computer, or maybe the wall, then leave it out for a few seconds. A battery with a red exclamation point should show up and that is when you insert the battery and turn it back on.
Had the same **problem with** **LG flex2 frozen firmware screen**: "*Firmware Update - do not unplug the USB connection until the process is complete*", stuck on 0% while plugged into charger all night long without any progress, no response from any button or button combination; not even 2 minutes of holding down the ...
3,994,288
I have enum say ErrorCodes that ``` public enum ErrorCodes { INVALID_LOGIN(100), INVALID_PASSWORD(101), SESSION_EXPIRED(102) ...; private int errorCode; private ErrorCodes(int error){ this.errorCode = error; } //setter and getter and other codes } ``` now...
2010/10/22
[ "https://Stackoverflow.com/questions/3994288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Either you do it with a if-statement or a switch, or you just implement the logic in question into the ErrorCode somehow. In an OO fashion it all depends on how you want the application or system react to the error code. Lets say you just want it to output somekind of dialog: ``` public doSomethingWithError() { Er...
You can create a map of error codes(Integer) against enum types **Edit** In this solution, once the map is prepared, you can look up an error code in the map and thus will not require if..else look ups. E.g. ``` Map<Integer, ErrorCodes> errorMap = new HashMap<Integer, ErrorCodes>(); for (ErrorCodes error : ErrorCod...
61,173,695
I have been trying to automate my firefox browser in Kali linux. I installed selenium and geckdriver and running this simple script: ``` from selenium import webdriver browser = webdriver.Firefox('/usr/bin/') browser.get('www.duckduckgo.com') #I saw a video where the guy mentioned that we do not have to use the path ...
2020/04/12
[ "https://Stackoverflow.com/questions/61173695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13288913/" ]
Just another option is to `try_convert()` into a `date` Note: the format() is optional **Example** ``` Declare @YourTable Table ([Period_Name] varchar(50)) Insert Into @YourTable Values ('Jan-19') ,('Feb-19') Select * ,NewVal = format(try_convert(date,'01-'+Period_Name),'MM') from @YourTable ``` **Retu...
A simply approach: ``` select right(t.period_name, 2) year, m.period, m.name from (select '01' period, 'Jan' name union select '02', 'Feb' ... union select '12', 'Dec') m inner join table1 t on Left(t.period_name,3) = m.name order by right(t.period_name, 2), m.period ``` Return: ``` year -- period -- ...
5,119,070
I am writing a very simple RSS reader - all it needs to do is get the xml doc, and print to the console the title and publish date of every item. I got started using these two questions: [How can I get started making a C# RSS Reader?](https://stackoverflow.com/questions/576267/c-rss-reader) [Reading the Stack Overflo...
2011/02/25
[ "https://Stackoverflow.com/questions/5119070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/265640/" ]
The standard way is to poll. Not every x seconds but every x minutes or x hours. The reasoning behind RSS is to keep the feed extremely simple. Small download and the same file can be served to all subscribers (easy to cache in memory and no processing overhead to find out exactly what and when to send to each client)...
Not sure you quite understand the concept of *RSS feeds*. It is simple: 1. You application (RSS reader) sends an `HTTP GET` request to given RSS feed url. 2. You get `XML` in return. 3. You parse that `XML` and show that data on your `UI`. And generally, the websites you mentioned are smart enough to identify DOS at...
36,579,184
I want to change the `border-radius` of a circle when I scale the object (`if scaleX/scaleY>1`)... **This is my circle object in fabricJS:** ``` function makeStation(left, top, stationID) { var c = new fabric.Circle({ radius: 2, fill: '#5afffa', stroke: '#666', selectable: true, ...
2016/04/12
[ "https://Stackoverflow.com/questions/36579184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5740092/" ]
You need to define 'ng2-highchart' within your SystemJS configuration: ``` <script> System.config({ map: { 'ng2-highchart': 'node_modules/ng2-highchart' }, (...) }); </script> ``` See this question for more details: * [How to use highcharts with angular 2?](https://stackoverflow.com/questions/3...
Remove format: 'register' from you packages. This will help it detect the right format. Or you can add the format as follows: ``` System.config({ packages: { app: { format: 'register', defaultExtension: 'js' }, "node_modules/ng2-highcharts": { ...
238,460
I just came to the conclusion that simply pressing someone else claim does not make them a vassal of you but grands them independence, which has been "too" nice of me. So what could I have done to avoid this? After doing some reading I came to the conclusion that if I had the guy I pressed the claim for already had as...
2015/10/02
[ "https://gaming.stackexchange.com/questions/238460", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/48810/" ]
Bungie did not give much information about Three of Coins, besides a paragraph in the [Bungie Weekly Update on 9/17/15](https://www.bungie.net/7_Bungie-Weekly-Update---09172015/en/News/News?aid=13575): > > Xûr will also sell a new consumable, the Three of Coins, which gives bosses a chance to drop Exotic Engrams, inc...
it used to be that the Three of Coins worked as a method of exotic farming. after the recent patch however, it has been dramatically nerfed. it is designed to be used for the end boos on strikes and story missions, so it now has a hidden cooldown. you now only get the 'chance' of getting anything by using them every 10...
52,677,194
I am Trying to Using Observer for Deleting With Relationship But Problem Is When i DD in Created Function Its Working Fine But When i DD In Deleted Function It Shows Nothing (POSTMAN) Means Neither Working Nor Error With Same Everything Here Is Api: ``` $api->post('store','App\Http\Controllers\CustomerController@sto...
2018/10/06
[ "https://Stackoverflow.com/questions/52677194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10033986/" ]
can you do all things 1 add line in `Customer::observe(CustomerObserver::class);` in CustomerServiceProvider in `boot` method 2. add `CustomerServiceProvider` in app.php file in provider array 3. `composer dump-autoload` 4. `php artisan config:cache`
Only these Methods Works ``` $customer=Customer::where('id',$id)->first(); if($customer){ $customer->delete(); } Or $customer=Customer::find($id)->delete(); ```
24,043
[Murder Investigation](https://gatherer.wizards.com/Pages/Card/Details.aspx?name=Murder%20Investigation) reads: > > When enchanted creature dies, put X 1/1 white Soldier creature tokens onto the battlefield, where X is its power. > > > [Flowstone Slide](https://gatherer.wizards.com/Pages/Card/Details.aspx?name=Fl...
2015/05/06
[ "https://boardgames.stackexchange.com/questions/24043", "https://boardgames.stackexchange.com", "https://boardgames.stackexchange.com/users/12554/" ]
Any. Your graveyard is a graveyard. Your opponent's graveyard is a graveyard. Cards in either graveyards are cards in a graveyard. It would say ["your graveyard"](http://magiccards.info/mma/en/219.html) or ["an opponent's graveyard"](http://magiccards.info/wwk/en/48.html) otherwise.
It means you pick the graveyard. So, it could be your graveyard or one belonging to an opponent; i.e. any graveyard. If it were supposed to only apply to your or an opponent's graveyard, the card would say so.
96,105
I added this condition to my collection for adding the or condition: ``` $collection->addFieldToFilter( array('city','mobile_badge'), array(array('eq' => $arealist), '1')); ``` But it returns the wrong result. This `$collection->getAllIds();` also returns the correct ids. But when I execute ``` $collection->getSel...
2016/01/06
[ "https://magento.stackexchange.com/questions/96105", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/24541/" ]
There is no way to deploy static files in 2.0.\* only for your theme. You need to upgrade to 2.1.1 if you want to deploy specific theme only. From version 2.1.1 there is `--theme` option for `setup:static-content:deploy` command. ``` php bin/magento setup:static-content:deploy --theme Vendor/mytheme ``` There is al...
You can try delete your theme static content in pub/static/frontend/YOURTHEME, and clear cache - refresh site to view change.
13,946,384
I have ``` var a = 5; var b = 5; var c = 5; var d = 5; ``` What could be robust and quick way to compare if they hold same value in plain JavaScript then return true else false. ``` function compare(){ var } ```
2012/12/19
[ "https://Stackoverflow.com/questions/13946384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/569403/" ]
A quick comparison would be `a === (b&c&d)` A generic comparison function could be: ``` function allEqual(){ if (arguments.length<2){ return true; } var args = [].slice.call(arguments); return args.filter( function(a,i){return a === this[i ? i-1 : 0]},args) .length === args.length; } //u...
I think the javascript equality test is If a==b then something;
1,334,221
I'm trying to return a JSON response from a Django view call via an ajax call like below: ``` var tab = 'test'; var response = $.ajax({ url: "/" + tab + "/" }).responseText; alert(response); ``` Here is my Django view: ``` if request.is_ajax() == True: req = {} req['html'] = '<b>This is a test</b>' ...
2009/08/26
[ "https://Stackoverflow.com/questions/1334221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48796/" ]
Unless I am mistaken, `responseText` isn't an attribute on whatever `$.ajax()` returns. I think you have to do something like this: ``` $.ajax({ url: "/test", dataType: "json", success: function(data) { // use data } }); ``` Because of the `dataType` parameter, the data yielded to the success callback is...
I'm having the same issue but only under a specific environment. I'm wondering if your issue is the same. My environment: 1. Running Django's internal webserver (./manage.py runserver 0.0.0.0:8080) 2. Viewing my website in Google Chrome (v4.1.249.1025). Under those circumstances, the following jQuery code leads to da...
37,724,495
I am trying to delete any five rows from my *users* table. I used following code for that. ``` DB::table('users')->take(5)->delete(); ``` But it deletes all rows in that table. How will I overcome this problem?
2016/06/09
[ "https://Stackoverflow.com/questions/37724495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3659972/" ]
You said you want to delete 5 rows **randomly**, in this case this will work, I've tested it: ``` DB::table('users')->whereIn('id', DB::table('users')->orderBy(DB::raw("RAND()"))->take(5)->lists('id'))->delete(); ``` It will take 5 random IDs and then will delete rows with these IDs with just two queries: ``` selec...
You can use `foreach` ``` $users = DB::table("users")->orderBy(DB::raw("RAND()"))->take(5)->get(); foreach($users as $user){ DB::table("users")->where("id", $user->id)->delete(); } ```
8,790,926
I'm trying to compile code such as the below using JDK1.5.0\_u22. I get two compile errors (further below). It works fine with JDK1.6.0u30, but my project is restricted to Java 5. It also works fine if I repleace float with the wrapper class Float. Does anyone know what's going on here? A simple bug or some general res...
2012/01/09
[ "https://Stackoverflow.com/questions/8790926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1138964/" ]
I'm going to give the answer for the 1st compiler error and keep digging to see if I can find the one for the 2nd compiler error... Running the following by itself produces no errors using jdk1.5.0\_22: ``` System.out.println(Arrays.asList(new float[1]).size()); ``` Running this by itself... ``` System.out.println...
Generics don't handle primitives consistently. This is because Generics it is just a compile time addition to a single class.
38,021,348
I have the following code: ``` for x in "${array[@]}" do echo "$x" done ``` The results are something like this (I sort these later in some cases): ``` 1 2 3 4 5 ``` Is there a way to print it as `1 2 3 4 5` instead? Without adding a newline every time?
2016/06/24
[ "https://Stackoverflow.com/questions/38021348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6263005/" ]
Yes. Use the `-n` option: ``` echo -n "$x" ``` From `help echo`: > > -n do not append a newline > > > This would strips off the last newline too, so if you want you can add a final newline after the loop: ``` for ...; do ...; done; echo ``` --- **Note:** This is not portable among various implementations ...
``` printf '%s\n' "${array[@]}" | sort | tr '\n' ' ' ``` `printf '%s\n'` -- more robust than `echo` and you want the newlines here for `sort`'s sake `"${array[@]}"` -- quotes unnecessary for your particular array, but good practice as you don't generally want word-spliting and glob expansions there
108,803
I moved my website from old hosting to new hosting and its giving me error every were like following please any one sort this out ``` There has been an error processing your request SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY' Trace: #0 C:\inetpub\vhosts\dotnpixel.uk\i...
2016/03/31
[ "https://magento.stackexchange.com/questions/108803", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/38093/" ]
I agree with Fabian's answer in that I would assume that your table lost it's last increment id. On that table, back it up, then either set the increment id to a number higher than your largest id, or clear out the values in that table. ``` ALTER TABLE adminnotification_inbox AUTO_INCREMENT=X; ``` (set X to a num...
You should run Magento's database checking tool. I don't know how this happens, but I have seen Magento installations where many or all of the foreign key restraints are missing. In your case, the auto increment setting seems to be turned off for that table, but you might have other errors too. Do you know which metho...
9,366,755
I worked a lot lately on android stuff in my favorite IDE, NetBeans. It was a pain to simply set up the basic android sdk in it, but now i need to make an app with facbook connection. Is there a way to make the Facebook-related classes work with NetBeans? Has anyone done it? Thanks for any help, and sorry for my englis...
2012/02/20
[ "https://Stackoverflow.com/questions/9366755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1126273/" ]
I tried to find a solution to this problem many times when I found the solution provided by bali182. However I couldn't properly understand the solution so I decided to give more explanations about the it: 1. You need to create a new android project 2. get github.com/facebook/facebook-android-sdk (only facebook direct...
Well thanks to Rstar-s tutorial, i finally found the solution. I tought, that i need to install an extension, similar to the core Android SDK, but no, here is what you need to do: 1.) go to github.com/facebook/facebook-android-sdk 2.) download the facebook directory ONLY! The other directories are only examples. 3....
6,527,783
I want call OnClick function on page load with out user clicking. Can we do that in jQuery or javascript? ``` <input name="ctl00$PlaceHolderMain$ButtonSection$RptControls$BtnSubmit" class="ms-ButtonHeightWidth" id="ctl00_PlaceHolderMain_ButtonSection_RptControls_BtnSubmit" accessKey="o"...
2011/06/29
[ "https://Stackoverflow.com/questions/6527783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158008/" ]
``` $(document).ready(function() { $("#ctl00_PlaceHolderMain_ButtonSection_RptControls_BtnSubmit").click(); }); ``` This will trigger the `click` event on the element with the supplied `id`, and it will run when the document is fully loaded.
You can try doing a `$("#ctl00_PlaceHolderMain_ButtonSection_RptControls_BtnSubmit").trigger('click');` This would emulate a click on the button more info [here](http://api.jquery.com/trigger/)
11,300,200
Can someone please explain why ?\_\_\_SID=U is appearing in some Magento URLs on my site and not others? I think it has something to do with sessions but I am not entirely clear. Also, what makes it more confusing is the fact that it's only appearing in some URLs and not others. I don't need to know how to remove it ...
2012/07/02
[ "https://Stackoverflow.com/questions/11300200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I addition to Brendan's answer, the `___SID=U` is used in the cache as a placeholder for the session ID. It is replaced by `Mage_Core_Model_Url::sessionUrlVar()` which in turn calls `Mage_Core_Model_Url::sessionVarCallback()`. These methods are called from `Mage_Core_Block_Abstract::_afterCacheUrl()`, which means that ...
The SID is a "session ID". Magento uses this to track a user's activity within the same Magento installation. Normally, Magento powers one website and one store from one installation (database). Magento could power multiple websites with multiple stores from one installation though. The SID allows users to stay logged...
33,766,963
Is it possible to add an `imageView` behind a `UITableView`? How would I add this image: ![backGroundTexture](https://i.stack.imgur.com/9gBkj.png) So that users could see it behind a tableview (background set to clear)?
2015/11/17
[ "https://Stackoverflow.com/questions/33766963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5571164/" ]
The following should work: ``` tableView.backgroundColor = UIColor(patternImage: UIImage(named: "your_image_name")!) ``` As the function names imply, a `UIColor` is created from the image you supply. Refer to the Apple documentation [here](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIColo...
Funny, I just did a tutorial that had this in it, but code was used instead of an image. In Swift 2.0 you create a file (let's call it BackgroundView) of type `UIView`, add this code in the pre-made `drawRect` function: ``` // Change these colors to the ones you want. let lightPurple: UIColor = UIColor(red: 0.377, gre...
50,359,814
I want to create TableLayout in my fragment to insert data. I used for that this methode below. I have to call the methode **updateTable** outside of the onCreated view method. But I got always this error: > > java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.co...
2018/05/15
[ "https://Stackoverflow.com/questions/50359814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9039646/" ]
Your fragment is not attached. You're doing this: ``` TableSon= TableController(view.getTableChild()) setChildSFather() TableSon?.updateTable( father!!.giveTemps()) ``` Where `getTableChild` returns what has been initialized like this: ``` val tablePresentation=TablePresentation() ``` This creates an...
@Dennis K weel we can call the method from onAttach or even from onViewCreated. I know that work perfectly. But my question was why we can not do that \*\*the call of the method i mean \*\* outside of those 2 methode.Why could not we do that? Finally because i have not found the answer to my why i have called my met...
4,204,378
This may be a very silly question, but I've been wanting to ask it for a while so here goes. I've been reviewing basic high school math in preparation for analysis, and I find myself questioning a lot of things - especially basic algebra - to the point I'm going a little mad. For instance, polar coordinates can be rel...
2021/07/21
[ "https://math.stackexchange.com/questions/4204378", "https://math.stackexchange.com", "https://math.stackexchange.com/users/827203/" ]
Your question is not silly. Some aspect of it drove hard-core mathematicians totally crazy in the 20'th century. People like Hilbert, one of the greatest, never quite got over it; a guy called Gödel actually *proved* that it is *impossible* to create a "perfect" kind of maths and was the big destroyer of dreams. You ca...
You've got two good answers. Here are some points about polar coordinates that seems not to be addressed, but that consistently bother at least some students in ways that sound similar to your doubts. The equations $x = r\cos\theta$ and $y = r\sin\theta$ define a *mapping* from the plane to itself, which we might expr...
19,186,208
I'm sorry if question is not clear, let me explain: I need to achieve the following: ``` <div> <div>art 1</div> <div>art 2</div> </div> <div> <div>art 3</div> <div>art 4</div> </div> <div> <div>art 5</div> <div>art 6</div> </div> etc ``` where each art is inside an array. So far I have...
2013/10/04
[ "https://Stackoverflow.com/questions/19186208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2158500/" ]
What you need is a modulo. A modulo divides by the number and returns the remainder. it's perfect for determining where you are in your count. The character for a modulo is % ``` $counter = 1; foreach($articles as $article) { if($counter % 2 == 1) echo '<div>'; echo '<div>'.$article->title.'</div>'; if($co...
Try: ``` foreach( $articles as $key => $article ){ $key++; if( $key % 2 == 0 ){ echo '<div>'.$article->title.'</div>'; echo '</div><div>'; }else{ echo '<div>'.$each['title'].'</div>'; } } ```
60,580,625
I'm new in programming and I'd like to ask you how can I write my code so that it read all the pic whitin a directory, process it one by one, and then save the output images in another directory. ``` %pylab %matplotlib inline import cv2 import glob import os import numpy as np import cv2 as cv from matplotlib import p...
2020/03/07
[ "https://Stackoverflow.com/questions/60580625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13024064/" ]
You don't need to create a list of all the pixel data of all the images in memory, that is just wasteful of memory. So, remove the lines: ``` images = [] ``` and ``` images.apoend(...) ``` Then change your `imwrite()` to overwrite the current image: ``` cv2.imwrite(img,blur) ``` --- Here's a more complete ver...
Try this way: `cv2.imwrite("mypicture.jpg", gray[y:y+h,x:x+w])`
3,205,256
I've encountered a rather odd case in Java EE 6 where using the JPA EntityManager's `find` method along with an entity's primary id returns null, but using the Criteria API to select all entities with that id works fine. Here is the code I'm using for `find`: ``` // Always returns null, even for records I know for su...
2010/07/08
[ "https://Stackoverflow.com/questions/3205256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62571/" ]
I figured out the problem. It was due to a field in the database being `null` where it should not have been permitted. This was due to me editing it by hand. After I added a value to that field, the problem went away.
One reason could be that the "id" field has not been correctly marked as the id for the User entity.
58,042,010
I'm trying to display "Number not found" when i input a number that is not in the list ... I can't figure out what is wrong with the code. my code: ``` import java.util.*; public class Searchu { static Scanner console = new Scanner(System.in); public static void main(String[] args) { int [][] x = new i...
2019/09/21
[ "https://Stackoverflow.com/questions/58042010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12099992/" ]
Your error was the last checking. I added a flag about whether we found the number. I agree with the comments, you do not need to use 2D array. ``` public static void main(String[] args) { int[][] x = new int[1][5]; int k, z = 0, y, item, item1; System.out.println("Enter 5 numbers: "); for (y = 0; y ...
With the "break" you are exiting only from the second for loop,please try the below code. ``` import java.util.*; public class Searchu { static Scanner console = new Scanner(System.in); public static void main(String[] args) { int [][] x = new int [1][5]; int k , z=0 , y , item , item...
7,327,497
I dont want to use the "loop" related keyword, how can I implement loop with basic sql command in oracle ? I have two table : ``` A: ID, Color B, ID, AID, Type ``` I want to loop all records in B, and if ID = AID, then set the A.Color = B.Type Thanks in advance !
2011/09/07
[ "https://Stackoverflow.com/questions/7327497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/140899/" ]
An alternate method: ``` MERGE INTO a USING b ON (b.aid = a.id) WHEN MATCHED THEN UPDATE SET a.color = b.type; ```
To do that you will have to write a stored procedure using PL/SQL. [Here](http://www.oracle.com/technetwork/database/features/plsql/index.html) is the oracle page with some info and papers on the topic.
57,571,402
I'm trying to do conditional formatting with a vlookup. The problem is that I don't know how to skip the first occurrence of the vlookup if the value that the vlookup is not the one that I want. For example : ``` a 5 b 2 c 9 a 3 d 4 ``` Here is a table I'm looking in column A the value...
2019/08/20
[ "https://Stackoverflow.com/questions/57571402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11703952/" ]
### its not value - its [input-value](https://github.com/vuetifyjs/vuetify/blob/f55071368fe0bc99d6bda8538ccfa83875c8df63/packages/vuetify/src/mixins/selectable/index.ts#L20) ```js new Vue({ el: '#app', data(){ return { t:false } }, methods: { change(){ console.log("change"); this....
Decompose `model` on `value` and `change` and reverse the algorithm, like this: ``` <v-switch :value="!mute" @change="(v) => mute = !v" :label="`Switch mute: ${mute.toString()}`"></v-switch> ``` **v-model & reversed** ``` <div id="app"> <v-app id="inspire"> <v-container fluid> <v-switch v-model="mute" :...
24,107,234
I have a dataset on excel with more than 40k entries, and there are 2 columns. I want to find if there exists an entry for example with 1 in the first column and 1687 in the second column, I tried using this following IF function: =IF(COUNTIF(B2:B178,"1687"),"Yes","No) where A1:A178 have 1 in the first column. This...
2014/06/08
[ "https://Stackoverflow.com/questions/24107234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3719861/" ]
Try this formula and fill it all the way down, should be more efficient than `COUNTIF`: ``` =IF(AND($A1="1",$B1="1687"),TRUE,FALSE) ``` Then you have a column of `TRUE`/`FALSE` that you can use to do what you want.
Change your range into a table and use built in Excel filtering capabilities. See <http://office.microsoft.com/en-001/excel-help/filter-data-in-a-range-or-table-HP010073941.aspx#BMfilter_text>
51,609,953
I have a method that receives a format string and a set of values provided by a user, and uses these to write an output to a screen. ``` def makestring(fmt, vals): s = fmt.format(*vals) return s fmt_expecting_three = 'a={:0.2f}, b={:0.4f}, c={:0.1f}' threevalues = [(x+1)/7. for x in range(3)] makestring(fmt...
2018/07/31
[ "https://Stackoverflow.com/questions/51609953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3904031/" ]
Though learning regex is painful, it pays off! Modified from <http://www.rexegg.com/regex-cookbook.html> ``` things = ['pi={:0.2f}, e={:0.4f}', 'pi={:0.2f}, e={q', '{{}', '{}wow', 'wow', '{}'] # includes some pathologicals import re for thing in things: print len(re.findall('{([^{)]*)}', thing)),...
For something like this, I tend to look at the way the Python interpreter solves the problem, rather than reinventing the wheel. I found a [C function in python 3](https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Python/modsupport.c#L43) called `countformat()`. (This also [looks about th...
14,890,911
In my custom control I have 2 textboxes. When either one of them is focused, it changes its style slightly... it looses a bit of its border. I would like to prevent this behaviour, which seems to be default textbox behaviour. Now, I assume that its something to do with the style, possibly with the part of the textbox ...
2013/02/15
[ "https://Stackoverflow.com/questions/14890911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1051751/" ]
@Daniel You have to edit `Focussed State StoryBoard`. For that edit your `TextBox Template` for changing the State.If you have `Expression Blend` it will be easy for you.
You have to edit the default `TextBox ControlTemplate` which you can find [here](http://msdn.microsoft.com/en-us/library/ms752068%28v=vs.85%29.aspx).
96,568
How do the statements *if p then q* and *p only if q* compare
2023/01/31
[ "https://philosophy.stackexchange.com/questions/96568", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/64529/" ]
In simple cases at least, "if p, then q" and "p only if q" have the same truth conditions. But this is not the same as saying that they mean the same thing. Typically with conditionals, the antecedent is logically, epistemologically or temporally prior to the consequent. David Sanford, in his book "If P then Q" gives ...
**How does "if p, then q" compare to "p only if q"?** "If p, then q" says that there is *at least* one event p that will result in event q. "p only if q" says that there is *exactly* one event q that will result in event p. The difference is important to analyzing statements for fallacies. In the first example, "if n...
1,454,896
I have php condition basically static if the page is "biz-los-angeles.php" show specific html. I would like to add another condition for example "retail-biz-los-angeles.php". What would be the easiest way to do this. Basically i just want to script to pick up "retail" text at the beginning of the url and return specifi...
2009/09/21
[ "https://Stackoverflow.com/questions/1454896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can check something like this: ``` if (strpos($currentpage, 'retail-') === 0)) ... ``` Depending on your server / CMS / whatever you might also consider using mod\_rewrite. ``` RewriteRule ^retail-(.*)$ $1?retail=1 [L,QSA] ``` This would give you `$_GET['retail'] == 1` on the retail pages.
you could make it more robust by making a switch statement. I haven't tested the code, but something like the following would make it easier to maintain. ``` $currentpage = basename($_SERVER['SCRIPTNAME']); $pageParts = explode('-',$current_page); $section = $pageParts[0]; switch($section){ ...
68,980,539
I basically have the below code: // To identify the Active Spreadsheet and link to Google Calendar ``` function scheduleNotifications(){ var sheet = SpreadsheetApp.getActiveSheet(); var eventCal = CalendarApp.getCalendarById("xyz@gmail.com"); ``` // To identify the rows and columns to collect the data from ``` var...
2021/08/30
[ "https://Stackoverflow.com/questions/68980539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16784981/" ]
*Edit: As the comment by user Botje detailed, C++ doesn't recognise files, only code. I realise I've said things like "main file" which are practically correct, but technically wrong.* Whichever file contains the `main()` function will run as the main file, so if you only want the second file to run, put the main func...
As the previous comments by @JackBennett and @MSalters suggests, The C++ projects should have **one main function** from where the execution would start. But I have come across situations where I had to compile a library separately, *which I guess you are referring here*, so you can check [this post [Compile .so ...
39,603,449
Images with examples of the problem: <http://imgur.com/gallery/vmMyk> Hi, I need some help with rendering 2D objects in 3D scene with 3D camera. I think I managed to solve 2D coordinates with LH world coordinates. However, my rendered 2D objects are in a correct place, only when camera is at `[0.0f, 0.0f, 0.0f]` coord...
2016/09/20
[ "https://Stackoverflow.com/questions/39603449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3408335/" ]
Well, I fixed my problem. For some weird reason, DirectXMath was generating false XMMATRIX. My `XMMatrixOrtographicLH()` was completely incorrect for good parameters. I solved my problem with classic definition of Ortohraphic matrix, [found in this article](http://www.codinglabs.net/article_world_view_projection_matrix...
galop1n give a good solution but on my system `cbuffer ConstantBuffer : register( b0 ) { float2 rcpDim; // 1 / renderTargetSize }` NEED to be a multiple of 16 for made like here: ``` struct VS_CONSTANT_BUFFER { DirectX::XMFLOAT2 rcpDim; DirectX::XMFLOAT2 rcpDim2; }; // Supply the vertex shader constant da...
29,286,882
I have a few activities and can't figure out a way to make it work with the backstack. Is there a way to do this: MainActivity ->(intent) subActivity ->(intent)subsubActivity->(back press)subActivity->\*(back press)MainActivity \*This is where I am having problems. Since I am coming from my subsubActivity, even thou...
2015/03/26
[ "https://Stackoverflow.com/questions/29286882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4451244/" ]
This is a perfect candidate for using a combination of `startActivityForResult` and overriding `onActivityResult` in the calling `Activity`. Assuming you have `Activity A`, which starts `Activity B` (which we cannot move back to), which starts `Activity C`: `Activity A` will call `Activity B` the way you are now. `Ac...
If i get what you want You can use [startActivities](http://developer.android.com/reference/android/content/Context.html#startActivities(android.content.Intent[])) with an array of intents which will be fired one after another activity1->activity2->activity3 -back-activity2 -back-acitivty1
29,326,666
I am planning to have a web application. To do so, I studied about ruby and ruby on rails. I am using linux server from amazon clouding system. I bought a domain from godday, and I put the IP address on DNS setting. When I run 'rails s' command, I can connect to the wep page through port 3000 in such a way that domai...
2015/03/29
[ "https://Stackoverflow.com/questions/29326666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4358807/" ]
**EDIT 2017** - *With **XAMLC** (XAML-Compiler, read more [here](https://developer.xamarin.com/guides/xamarin-forms/xaml/xamlc/)) XAML is compiled to IL code at **build time** so no XAML parsing is involved at runtime anymore. In many cases this makes XAML as fast or very close to coding the UI in code-behind C#. With ...
In my opinion, and it's definitely just an opinion, I prefer to have a almost zero lines of code in a code behind class, where all the definitions of the view will residue in the Xaml file only. This way, you'll **separate the UI from your code logic** and will probably have a much cleaner code eventually. Having said...
6,092
How can I find out what my AUCTeX version is? I have Googled this question to no avail.
2015/01/06
[ "https://emacs.stackexchange.com/questions/6092", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/4084/" ]
It is contained in the `AUCTeX-version` variable: ``` C-h v AUCTeX-version RET ```
If you installed AUCTeX from ELPA (which I generally recommend), then `M-x list-packages` will give you that information (the good thing about this method, is that it works for all packages installed from ELPA).
14,382,636
I have two questions: 1. How can I force IE10 to render in IE9 document mode? Currently it's rendering my page in Standard document mode. 2. In IE10's developer toolbar, I am not able to see the option of document mode of IE10. Is it not implemented, or is my browser version is out of date? Thanks for all your help. ...
2013/01/17
[ "https://Stackoverflow.com/questions/14382636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/739658/" ]
You can force IE10 to render in IE9 mode by adding: `<meta http-equiv="X-UA-Compatible" content="IE=9">` in your `<head>` tag. See [MSDN](http://msdn.microsoft.com/en-us/library/ie/ms533876%28v=vs.85%29.aspx) for more information...
there are many ways can do this: add X-UA-Compatible tag to head http response header using IE tools F12 change windows Registry
65,636
I've got a message from a peer programmer (over a conflict happened due to his changes in the code I'm responsible for, done over my head). He wrote that they (he and PM) already decided to do it this way, aren't going to change anything and my opinion means nothing. That guy is in the same position, and I wasn't told ...
2016/04/21
[ "https://workplace.stackexchange.com/questions/65636", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/22134/" ]
I get you are getting beat up over this but I would consider quitting also. In summary ---------- * Code you are responsible for * You had not been informed of any problems * Peer meets with PM over refactoring code you are responsible for You are not included nor informed * According to peer an executive decision...
I want to stress something: You need to cover your \*ss in writing. Compose an email (yes, email, not an IM that can go away) officially stating that 1) The code change was done by your colleague, 2) That it breaks the product, 3) That in your professional opinion the change should be reverted. You need to get all of t...
10,633,628
We have a time management system where our employees or contractors (resources) enter the hours they have worked, and we derive a cost for it. I have a table with the historic costs: ``` CREATE TABLE ResourceTimeTypeCost ( ResourceCode VARCHAR(32), TimeTypeCode VARCHAR(32), EffectiveDate DATETIME, CostRate DECIMAL...
2012/05/17
[ "https://Stackoverflow.com/questions/10633628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1174045/" ]
``` IF OBJECT_ID ('tempdb..#ResourceTimeTypeCost') IS NOT NULL DROP TABLE #ResourceTimeTypeCost CREATE TABLE #ResourceTimeTypeCost ( ResourceCode VARCHAR(32), TimeTypeCode VARCHAR(32), EffectiveDate DATETIME, CostRate DECIMAL(12,2) ) INSERT INTO #ResourceTimeTypeCost SELECT 'ResourceA' as resourcecode, 'Normal' a...
You might give this a try. [CROSS APPLY](http://riteshshah.wordpress.com/2009/03/03/cross-apply-and-outer-apply-clause-in-sql-server-2005/) will find first ResourceTimeTypeCost with older or equal date and same ResourceCode and TimeTypeCode as current record from TimeEntered. ``` SELECT te.ResourceCode, te.Time...
29,248
I have data for a test on three groups. The measured variable is ratio scaled. The R code is ``` g1a<-c(7, 3, 40) g2a<-c(1,1,2) g3a<-c(0,0,0) ``` Since the sample is small and normality cannot be guaranteed, I run a Kruskal Wallis test to check for significance: ``` l<-list(g1a,g2a,g3a) kruskal.test(l) ``` The p-...
2012/05/27
[ "https://stats.stackexchange.com/questions/29248", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/1048/" ]
Your mistake is in choosing the Wilcoxon/Mann-Whitney rank-sum tests as your *post hoc* tests following the rejection of the Kruskal-Wallis. The appropriate *pos hoc* test is *Dunn's test*\* which properly (1) accounts for *pooled variance* assumed by the null hypothesis, and (2) uses *the same ranks* for your data as ...
This is a well-known problem in two-stage comparisons, observed e.g., already by Gabriel [Gabriel KR (1969) Simultaneous test procedures - some theory of multiple comparisons. The Annals Mathematical Statistics 40(1):224-250].
35,087,625
This question is about HTTP *Request* headers -- not HTTP Response headers. Is there any way to programmatically make User Agents add or change any HTTP Request Header e.g. by means of HTML, JavaScript, for links or resources from a web page. There exists some HTTP Request Headers that one would think should be able t...
2016/01/29
[ "https://Stackoverflow.com/questions/35087625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/977241/" ]
Thanks for your input. I have chosen to create the intervals using a simple loop, to ensure that the intervals were of the desired size. I created a data.frame with sizes of chromosomes ``` chrSizes <- data.frame(chromosome = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17...
If the bin range is constant, this works: ``` mydata <- data.frame(position = c(20000, 30000, 60000, 49850, 49851, 99700, 99701)) mydata$bin <- ceiling(mydata$position / 49850) ``` More generally, if the bin range is not constant but you have defined the cut points already, you can use...
7,411,362
For example if an error occurs inside the constructor (e.g. the parameters pass in were invalid) and I wanted to stop an object being created would it be possible to return null rather than a reference to a new object. (I know the term return is technically correct in this case but you know what I mean).Basically, is i...
2011/09/14
[ "https://Stackoverflow.com/questions/7411362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/452680/" ]
Yes, you can throw an exception, which will terminate object creation. You cannot return null or any other value from a constructor.
If the parameters passed in are invalid, you should throw an `IllegalArgumentException` with a descriptive message. `NullPointerException` should be thrown in case of illegal `null` values. Here's an example of a `BigCar` class that requires its engine to be > 4000 CC. ``` public class BigCar { private final En...
7,550
> > I wonder why they are so late. They *should have* arrived a long time ago. > > > Does this sentence have two possible meanings? How would we choose between them? > > 1) I expected (predicted) their arrival would have taken place a long time ago. > > > 2) It would have been better for them to arrive much ea...
2013/06/23
[ "https://ell.stackexchange.com/questions/7550", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/1616/" ]
The ambiguity is real, but in practice will be overcome by context. In the context of *I wonder why they are so late* the natural interpretation of *should* is *epistemic* referring to probability or expectation: your 1). > > I wonder why they are so late. They should have arrived long ago. I hope nothing's happene...
Lots of words in English have multiple possible meanings. Usually you can tell which is meant from context. Usually the intended meaning is so obvious that the reader does not even pause to think about it, he just naturally infers the correct meaning. It is certainly true that writers sometimes slip up and have one mea...
16,458,538
I need to select a value from dropdown can some one help me on that. Html part is below ``` <div id="element11_chzn" class="chzn-container chzn-container-single" style="width: 320px;"> <a class="chzn-single" href="javascript:void(0)" tabindex="0"> <div class="chzn-drop" style="left: -9000px; width: 318px; top: 29px;">...
2013/05/09
[ "https://Stackoverflow.com/questions/16458538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2365661/" ]
This should work for you : ``` Select select = new Select(yourDropdownElement); select.selectByVisibleText(text); ```
``` driver.findElement(By.id("element11_chzn")).click(); driver.findElement(By.id("element11_chzn_o_7")).click(); /*It will select 'Assessment' from drop down.*/ ``` Hope it will help you.
39,884
I wish to know how to handle a certain situation regarding chess etiquette. Consider the following: I went for an OTB tournament recently - rapid 15 + 10 time control. Organizers stated that recording is not compulsory, but I still recorded for the purpose of post-mortem analysis. One of my opponents didn't record the...
2022/05/27
[ "https://chess.stackexchange.com/questions/39884", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/30282/" ]
> > Should I let him take a photo or ask him to record his game himself if he wants to do post-mortem analysis? > > > The [FIDE Laws of Chess](https://handbook.fide.com/chapter/E012018) say this about the ownership of the scoresheet: > > 8.3 The scoresheets are the property of the organiser of the competition. >...
This is too long for a comment, but Brian Towers answer as it currently stands is legally wrong. It is true that the score sheets are property of the organizers. But the document you wrote during the game is not a score sheet as understood by the rules, these are just your personal notes that happen to have a form that...
18,175,098
In ruby, there is a function called `gsub`, where g stands for `global` and sub stands for `substitution`. What `p` from `preg_match`? I suppose `reg` is for `regular` and `match` is really `match`. Is that correct?
2013/08/11
[ "https://Stackoverflow.com/questions/18175098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/413494/" ]
It stands for [PCRE - Perl Compatible Regular Expressions](http://www.pcre.org/).
P stands for Perl in 'preg'. They comes under Function list.[PCRE : Perl Compatible Regular Expressions](http://www.php.net/manual/en/ref.pcre.php)