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
8,258,128
every body. I am getting this error: `You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '14:37:41)' at line 1` for this piece of code ``` public String addName() { // TODO Auto-generated method stub try { j...
2011/11/24
[ "https://Stackoverflow.com/questions/8258128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/847085/" ]
Use `PreparedStatement`. ``` String insert = "INSERT INTO `bookcatalog`.`puch` (`name`, `time`) VALUES (?,?)"; PreparedStatement ps=connect.prepareStatement(insert); ps.setString(1,name); ps.setTimeStamp(2,TimeStamp.valueOf(currentTime)); ps.executeUpdate(); ```
You are missing `'` characters around your currentTime in the insert statement. However, you really should be using a prepared statement for such things, to guard against SQL injection attacks.
40,167,354
I know we can create a auto partition discovery table via ``` CREATE TABLE my_table USING com.databricks.spark.avro OPTIONS (path "/path/to/table"); ``` But this requires change the data path to **partition\_key=partition\_value** format ``` /path/to/table/dt=2016-10-09 /path/to/table/dt=2016-10-10 /path/to/table/d...
2016/10/21
[ "https://Stackoverflow.com/questions/40167354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3015140/" ]
I think what you're asking for is how to return the information for all the images where the height is greater than the width. In which case, I think you want something like this: ``` select * from <table name> where high > wide ; ```
in ormlite can use ".le("picture\_width", new ColumnArg("picture\_height")) "
3,647,869
> > Let $\displaystyle I=\int\_a^b(x^4−2x^2)\,\mathrm dx$, then $I$ reaches the minimum when the ordered pair $(a,b)$ is:$$(-\sqrt2,0)\quad(0,\sqrt2)\quad(\sqrt2,-\sqrt2)\quad( -\sqrt2, \sqrt2)$$ > > > I solved the integration and got $\dfrac{b^5}{5}-\dfrac{2b^3}{3}-\dfrac{a^5}{5}+\dfrac{2a^3}{3}$. If I put $( -\...
2020/04/28
[ "https://math.stackexchange.com/questions/3647869", "https://math.stackexchange.com", "https://math.stackexchange.com/users/87430/" ]
It's easy to sketch the graph of $$x^4-2x^2=x^2(x^2-2)=x^2(x-\sqrt2)(x+\sqrt2)$$ This is an even function, with a double root at $0$ which is a local maximum, and also roots of $-\sqrt2$ and $\sqrt2$. It goes to $\infty$ as $|x| \to \infty$. [![enter image description here](https://i.stack.imgur.com/iF0rk.png)](https...
Simply check out the plot of the function that you are integrating, you will see that \begin{equation} (0, \sqrt{2}) \text { or }(-\sqrt{2}, 0) \end{equation} corresponds P which is negative so this is why the answer is: \begin{equation} (-\sqrt{2}, \sqrt{2}) \end{equation} Also, you need to check all the options becau...
34,942
I want to either use a module or write a module which allows me to count the number of Anonymous Users that are currently using the site. What is the best method for this to be achieved? I looked at the statistics module but this does not enable me to count the data. I discovered views is capable of this with this se...
2012/06/24
[ "https://drupal.stackexchange.com/questions/34942", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/5795/" ]
The [admin\_menu](https://www.drupal.org/project/admin_menu) module does this, and provides this [function](https://cgit.drupalcode.org/admin_menu/tree/admin_menu.module): ``` /** * Counts how many users are active on the site. * * Counts how many users have sessions which have been active since the * specified ti...
For info related to visitors of a website, consider the [visitors](https://www.drupal.org/project/visitors) module as an alternative. One of the things you get from it is a **Visitors Block**, which includes, among others, data about: * Total Visitors. * Unique Visitor. * Registered Users. * ... Combining these 3 n...
28,882,691
While looking for how to enable scrolling with the mouse wheel in Sencha Touch, I came across [this](https://stackoverflow.com/questions/24397159/adding-mousewheel-to-sencha-desktop-app) answer. However, I am relatively new to Sencha Touch and the codebase I was given to maintain that uses it. The answer says to put i...
2015/03/05
[ "https://Stackoverflow.com/questions/28882691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/991710/" ]
The provided code in the other answer is pure Javascript and not ExtJs code, it runs in a global scope so you can add this above Ext.application (outside of ExtJs code, so make it your first bit of JS code that gets run). You could even wrap it inside an Ext.onReady call to make sure ExtJs is also fully loaded before y...
The OP's answer above works, however it throws errors if trying to scroll over elements that do not have indexOf on their className (like SVG elements). Here is the updated code that first checks for the existence of indexOf. I've also extended this method to support horizontal mouse scrolling if the browser supports...
14,236,813
After the app starts, and I press the start button, it s "lagg" but I used this code into viewdidload and viewdidappear too: ``` gombhang = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"button4" ofType:@"mp3"]]; gombha = [[AVAudioPlayer alloc] initWithContentsOfURL:gombhang error:nil]; [gombha prepa...
2013/01/09
[ "https://Stackoverflow.com/questions/14236813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1580269/" ]
Even in languages like FORTRAN, where there is still a GOTO, it's not usually recommended that you use it: <http://books.google.com/books?id=D0HOaW-5svQC&pg=PA63&lpg=PA63&dq=fortran+scientists+and+engineers+goto&source=bl&ots=NWYj9wa2y3&sig=TH0NEPkqNtNQgprVpBn912WHJAQ&hl=en&sa=X&ei=WoftUKiJDcuv0AGM-4DYCQ&ved=0CDQQ6AEw...
Python saw the error in their ways, and added a [goto](http://entrian.com/goto/download.html)! **Just Kidding - please don't use in real code** It was released as an April Fools Joke.
31,564
I'm developing a prototype that uses a quadrature encoder to measure it's linear displacement. The encoder is attached to the prototype body and has a wheel in it's shaft. As the prototype moves straight forward the encoder measure the linear distance. All the trouble around the conversion between linear/angular units ...
2012/05/09
[ "https://electronics.stackexchange.com/questions/31564", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/9165/" ]
I know you explicitly said that you only have 14 pins to solve your problem but I don't understand if this is related to the amount of real state you have on the PCB or if this is a legacy board. If this is due to real state, you could use a [dsPIC33FJ12MC201](http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=...
Was your PIC ISR simple? * > > compute jump based on Quadrature value > > > * > > return +1 or -1 or 0 > > > * > > then add to present value. > > > It should be able to handle it, I think... ....any metastates? then latch the input values. If still nogo. Then use a CPLD with Up/down counters and shift out...
839,683
Let's suppose we have a subversion repository which looks like ``` /original/0.1 /original/0.2 /variantA/trunk /variantA/branches/who/branch_for_xxx /variantA/branches/she/branch_for_yyy /variantB/trunk /variantB/branches/who/branch_for_zzz (... 30 or 40 alike) ``` where variantA and variantB are forks of the origin...
2009/05/08
[ "https://Stackoverflow.com/questions/839683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/103518/" ]
Mercurial comes with a convert extension which should do what you want. See the [convert extension details on the Mercurial web site.](http://www.selenic.com/mercurial/wiki/ConvertExtension)
$ bzr svn-import --layout trunk1 *svn-root-url* bzr.repo Should do the right thing. You need to have the bzr-svn plugin installed in order to be able to do this.
7,137,545
Is there any way by which i could know exactly which server a POST request has originated from ? I'm trying to implement a method wherein i could check that a specific request has originated from my website, and hence this will help me keep my website secure Thanks
2011/08/21
[ "https://Stackoverflow.com/questions/7137545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/807757/" ]
Take a look at this: <http://en.wikipedia.org/wiki/Cross-site_request_forgery#Prevention>
I think you need to read this: <http://www.cyberciti.biz/faq/how-to-determine-retrieve-visitors-ip-address-use-php-code-programming/>
50,948,412
[![Not actual screenshot of the code. But error is same](https://i.stack.imgur.com/R7piT.png)](https://i.stack.imgur.com/R7piT.png) Error: **Looks like the app doesn't have the permission to access location. Add the following line to your app's AndroidManifest.xml** Even though I have added the permissions in manifest...
2018/06/20
[ "https://Stackoverflow.com/questions/50948412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9212055/" ]
Maybe not the answer you were hoping for, but I think these timings are useful. Run on a directory with 15,424 directories totalling 102,799 files (of which 3059 are .py files). Python 3.6: ``` import os import glob def walk(): pys = [] for p, d, f in os.walk('.'): for file in f: if file....
os.walk() uses scandir which is the fastest and we get the file object that can be used for many other purposes as well like, below I am getting the modified time. Below code implement recursive serach using os.scandir() ``` import os import time def scantree(path): """Recursively yield DirEntry objects for given ...
16,204,523
I am creating an application that allows users to make comments on project postings created. I followed this [Railscast](http://railscasts.com/episodes/154-polymorphic-association?) to set up polymorphic associations. Based on the tutorial, the index page in the controller is set up as detailed below takes you to loc...
2013/04/25
[ "https://Stackoverflow.com/questions/16204523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2281142/" ]
With awk : ``` awk '/^StringB/ { if(lastline ~ /^StringA/) {print lastline }} {lastline=$0}' $file ``` StringA and StringB can be regular expressions.
This might work for you (GNU sed): ``` sed ':a;$!N;/^StringA/!D;/^\(StringA\).*\n\1/D;/.*StringB/!ba;P;D' file ``` This removes duplicate `StringA` lines retaining the last and when encountering a `StringB` line prints out the first string in the pattern space.
3,314,203
I saw the formula below in this paper: <http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.331.6329&rep=rep1&type=pdf> It said Assume that $\mathbf H$ is a complex matrix of size $n \times m $,having full column rank $\mathbf S$ is a complex matrix of size $n \times t$,having full column rank the well-known ...
2019/08/05
[ "https://math.stackexchange.com/questions/3314203", "https://math.stackexchange.com", "https://math.stackexchange.com/users/693697/" ]
Your formula for $proj\_u$ is correct when you project along the line defined by $u$. Here we are projecting in a subspace spanned by the column of $H$. You start from the property that $v - proj\_{H}(v)$ is orthogonal to any vector spanned by the columns of $H$: $$ H^T \left( v - proj\_{H}(v) \right) = 0 $$ or $$ H^T ...
If $\ \mathbf{z}\ $ is any $\ n\times 1\ $ column vector, then $\ \mathbf{z}\_P=\mathbf{P}\_H \mathbf{z}\ $ is in the column space of $\ \mathbf{H}\ $, and $$ \left\langle \mathbf{z}\_P,\,\mathbf{z}- \mathbf{z}\_P\right\rangle=\left\langle \mathbf{P}\_H \mathbf{z},\,\mathbf{z}-\mathbf{P}\_H \mathbf{z}\right\rangle = \...
39,535,917
If I have several divs in my HTML like this ``` <div id="div_1"></div> <div id="div_2"></div> <div id="div_3"></div> ``` In my JavaScript, how can I reference them using a variable? ``` // Using Jquery to assign the element to the variable name $div_1 = $(div_1); $div_2 = $(div_2); $div_3 = $(div_3); // set the CS...
2016/09/16
[ "https://Stackoverflow.com/questions/39535917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2721815/" ]
You can create variable holding all elements, use `.filter()` to select an element having a specific full `id`, or `id` ending with specific digit or letter characters ``` // all `div` elements having `id` beginning with `"div"` var divs = $("div[id^=div]"); // select element having `id` ending with `"2"`:`"div_2"` fr...
You can use the "id" attribute of your divs and obtain a reference like below: ``` $div_1 = $("#div_1"); ```
1,761,109
I recently had a debate with a colleague who is not a fan of [OOP](http://en.wikipedia.org/wiki/Object-oriented_programming). What took my attention was what he said: "What's the point of doing my coding in objects? If it's reuse then I can just create a library and call whatever functions I need for whatever task is ...
2009/11/19
[ "https://Stackoverflow.com/questions/1761109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1737290/" ]
The good things about OOP come from tying a set of data to a set of behaviors. So, if you need to do many related operations on a related set of data, you can write many functions that operate on a struct, or you can use an object. Objects give you some code reuse help in the form of inheritance. IME, it is easier t...
My personally view: context When you program in OOP you have a greater awareness of the context. It helps you to organize the code in such a way that it is easier to understand because the real world is also object oriented.
72,181,408
I have written the code and according to me code should be working but it is not working. It is giving me runtime error. can anybody check my ques my help me with the same? Here is my code ``` #include <bits/stdc++.h> using namespace std; string replaceSpaces(string str){ int spaces_count = 0; int length =...
2022/05/10
[ "https://Stackoverflow.com/questions/72181408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19082967/" ]
std::string creates a buffer for the size of the string, when you re-size it, you are using more space, and that is overflowing the allocated buffer. Typically the best pattern for this sort of code, is not to do an in-space modification, but to create a new string which takes the output.
you can do following: ``` #include <bits/stdc++.h> using namespace std; string replaceSpaces(string str){ int n = str.size(); string tmp; for(int i=0; i<n; i++) { if(str[i] == ' ') { tmp.push_back('@'); tmp.push_back('4'); tmp.push_back('0'); } ...
86,266
I have a couple of ebooks as PDFs with passwords, however my ebook reader (sony prs600) doesn't seem to support PDFs with passwords. What is the easiest of removing the password from a PDF (I know the password, which presumably helps a lot). It's a bit annoying buying a book and then only being able to read it in front...
2009/12/21
[ "https://superuser.com/questions/86266", "https://superuser.com", "https://superuser.com/users/10217/" ]
With **[A-PDF Restrictions Remover](http://download.cnet.com/A-PDF-Restrictions-Remover/3000-10743_4-10598299.html?tag=mncol)**, you can remove the password and other restrictions in a few seconds. *A-PDF Restrictions Remover is shareware ($10), try before you buy.*
On GNU/Linux, use the [`qpdf`](http://qpdf.sourceforge.net/) utility: ``` qpdf --password=YOUR_PASSWORD_HERE --decrypt your_input.pdf your_output.pdf ``` this is also easy to automate with a shell script to decrypt multiple PDF files. `qpdf` is available as a package on many/most GNU/Linux distributions. For exampl...
657,488
If there are like 1,000,000 individual files (mostly 100k in size) in a single directory, flatly (no other directories and files in them), is there going to be any compromises in efficiency or disadvantages in any other possible ways?
2009/03/18
[ "https://Stackoverflow.com/questions/657488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49318/" ]
ARG\_MAX is going to take issue with that... for instance, rm -rf \* (while in the directory) is going to say "too many arguments". Utilities that want to do some kind of globbing (or a shell) will have some functionality break. If that directory is available to the public (lets say via ftp, or web server) you may enc...
When you accidently execute "ls" in that directory, or use tab completion, or want to execute "rm \*", you'll be in big trouble. In addition, there may be performance issues depending on your file system. It's considered good practice to group your files into directories which are named by the first 2 or 3 characters ...
65,439,177
I have a `SQLite` file and I want to add `2550 empty (NULL)` rows. I am able to add one empty line with this code ``` INSERT INTO my_table DEFAULT VALUES ``` But I need 2550 rows. Is there any shortcut for it? I don't want to execute same code 2550 times.
2020/12/24
[ "https://Stackoverflow.com/questions/65439177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14341558/" ]
If your version of SQLite support it, you could use a recursive CTE to generate a series from 1 to 2550, and then insert "empty" records along that sequence: ```sql WITH RECURSIVE generate_series(value) AS ( SELECT 1 UNION ALL SELECT value + 1 FROM generate_series WHERE value + 1 <= 2550 ) INSERT ...
You can generate numbers using a recursive CTE and then insert . . . but you need to be more explicit about the values being inserted: ``` with cte as ( select 1 as n union all select n + 1 from cte where n < 2550 ) insert into mytable (<something>) select <something> from ct...
56,413,405
I have 3 input for select file with this names : ``` docs['selfie'] docs['id_card'] docs['bank_card'] ``` I want to check if `docs['selfie']` had file returned `yes` otherwise returned `no`. But always returns `no` function: ``` public function Document(Request $request) { if ($request->hasFile("do...
2019/06/02
[ "https://Stackoverflow.com/questions/56413405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9201031/" ]
As a wrote in my comment, probably you shouldn't worry about performance too much... However, this data structure should fit your needs, let's call it a: Letter X before Y tree. Basically, a tree where each node has children for each letter if the letter appears after the parent nodes letter in the target word For eac...
I don't know much about its time complexity, yet if we just wish to search for words that must have `a` and `e` in it, we would be starting with an expression similar to the following, then we would optimize for runtime: ``` (?=.*a)(?=.*e).* ``` ### Test ``` using System; using System.Text.RegularExpressions; pub...
7,764,591
I have a View with `UIButton`, `UITextField`, and a `UIImageView` for Background. in `viewDidLoad` i try animate `UIImageView` from alpha=0 to alpha =1 using block. it's pretty basic, here's the code: ``` [UIView animateWithDuration:1.5 animations:^(void){ ((UIView*)[self.view viewWithTag:123]).alpha = 1; }comp...
2011/10/14
[ "https://Stackoverflow.com/questions/7764591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/554740/" ]
I ended up not doing this. You can't touch a view that still animating. that's my conclusion. Would be happy to hear some thought on this though.
Isn’t it something that happens on standart iOS apps like Settings back button, menu swipe. There is no way to touch to screen while it is animating whereas you can touch in Android.
582,771
I am having trouble printing (or searching) for sequences containing backslashes when using awk For example - ``` echo "test\test" | awk '{ gsub(/\\\\t/, "\\\\&"); print }' ``` will give the result: ``` test est ``` because the \t will be interperted as tab. I want to be able to have the string as is, meanin...
2020/04/27
[ "https://unix.stackexchange.com/questions/582771", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/408984/" ]
Going with your own suggestion of using a shell loop: ```sh for name in ./*/*/???-*.mp4; do filename=${name##*/} # remove directory path filename=${filename#???-} # remove initial three characters and dash # prepend directory path to target filename and rename mv "$name" "${name%/*}/$filena...
You can use find and invoke a shell using `-exec` ```bsh find . -type f -exec sh -c ' for f; do d=${f##*/} d=${d#*[0-9][0-9][0-9]-} echo mv -v "$f" "${f%'/'*}/$d" done ' _ {} + ``` * The echo is there to tell you how/what is going to be executed, remove it if you think the ouptu is ok The actual output ...
924,574
I'm looking for a Git alternatives to "svn info". Today I added some information that Subversion gives me with the "svn info" command right into my build, and that is then pushed into a source file that prints this during startup. That way I always know where that build came from and how to get it back again. If you ...
2009/05/29
[ "https://Stackoverflow.com/questions/924574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51425/" ]
To complete Charles's answer, you also can make a script displaying "sn info" like information, like [this one](http://blog.inquirylabs.com/2008/06/12/git-info-kinda-like-svn-info/) (already [mentioned there](http://kerneltrap.org/mailarchive/git/2007/11/12/406496)) ```sh #!/bin/bash # author: Duane Johnson # email: ...
Here's gitinfo.ps1 (or Get-GitInfo.ps1 for the purists), a PowerShell version of Duane Johnson's shell script: ``` # From http://stackoverflow.com/a/924657/990504 # Duane Johnson's script translated to PowerShell by Jonathan Fischer 2015.04.25 Push-Location . # Find base of git directory while ( $true ) { if ( Tes...
12,666
My question is about adding a new language into LaTeX: the [Tajik language](http://en.wikipedia.org/wiki/Tajik_alphabet). There is Russian language support in LaTeX and Russian is written using a modified version of the Cyrillic alphabet. Tajik is also written in the Cyrillic alphabet and its orthography is very clos...
2011/03/04
[ "https://tex.stackexchange.com/questions/12666", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/3148/" ]
`Babel` provides currently a minimal tentative locale which can be used with little effort with XeLaTeX and LuaLaTeX. Download the files under the directory for the Tajik locale in the `babel` [GitHub repository](https://github.com/latex3/babel/tree/main/locale-templates/tg) and move them to a place where LaTeX can fin...
And today I have found out another way to make LaTeX understand Tajik language. I achieved that using two packages: **inputenc** with *utf8* option and **fontenc** with *T2A*(or *T2B*, but not ~~T2C~~) option. ``` \usepackage[utf8]{inputenc} \usepackage[T2A]{fontenc} ``` LaTeX is really great!
33,446,814
I have attempted using a nested if in the following code. I have initialized variables but the compiler is telling me that the variable named 'bill' is not initialized even though it has been. Why is the compiler not recognizing the value assigned to the variable? Please see the notes in the code below. ``` package k...
2015/10/31
[ "https://Stackoverflow.com/questions/33446814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5327794/" ]
No, `bill` has not been initialized in all cases. Understand this: the Java compiler will never, ever, evaluate boolean expressions; Simplified version: ``` double bill; if (c1) { bill = v1; } else if (c2) { bill = v2; } // try and use bill here ``` Even if, *according to your logic*, boolean expressions ...
I'm not sure why it gets this error, but try initialising bill as 0.00 when you declare the variable. Also, if(premiumDayMin <0 && premiumNightMin <0) should probably be changed to if(premiumDayMin <0 || premiumNightMin <0) Because you want to make sure that either minutes is not less then zero. You're program s...
9,390,179
I have a list that contains many objects.I want found an object in this list that every properties equals to an object in list. for example: ``` list.Add(object1,object2,object3,object4); // for example I want found object3 //list.find(object3) ``` and I have a problem I must check every its properties except one. f...
2012/02/22
[ "https://Stackoverflow.com/questions/9390179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1129318/" ]
So, seems you like to get the Contains-Method of the List to work for you. Have a look here: [MSDN List.Contains](http://msdn.microsoft.com/en-us/library/bhkz42b3.aspx) According to it, you can implement IEquatable in your object to make it happen. Hope that helps. Cheers Sascha
There's always the [Linq](http://msdn.microsoft.com/en-us/library/system.linq.aspx) way of doing things. For example: ``` var haystack = new List<Tuple<int, bool, string>>() { new Tuple<int, bool, string>(1, true, "one"), new Tuple<int, bool, string>(2, false, "two"), new Tu...
244,406
Could receiving in a text or an email, a URL link just like <https://security.stackexchange.com/questions/ask> of a website, which could be a pernicious one, ever pose a security problem at all? What I am asking is that: if I receive such a link but do NOT click on it, will it ever do harm to my account, computer or ot...
2021/02/07
[ "https://security.stackexchange.com/questions/244406", "https://security.stackexchange.com", "https://security.stackexchange.com/users/250614/" ]
Some software will automatically fetch any URL it sees, even if you don't click it. A few examples: * Browsers that are configured to pre-fetch certain URLs so that they load instantly after clicking (this isn't default on any major browser I'm aware of, but I've seen it). * Messaging clients that show a preview of th...
**Yes** We can be pretty sure this can happen, because something very similar to it did: <https://www.nbcnews.com/tech/security/android-flaw-could-let-hackers-take-over-phone-text-n399016> **Stage-fright**: There was a bug that got named Stage-fright which was in the image or video-processing on Android. Because some ...
43,775
Can you please tell me how much is `(-2) % 5`? According to my Python interpreter is 3, but do you have a wise explanation for this? I've read that in some languages the result can be machine-dependent, but I'm not sure though.
2008/09/04
[ "https://Stackoverflow.com/questions/43775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1876/" ]
Your Python interpreter is correct. One (stupid) way of calculating a modulus is to subtract or add the modulus until the resulting value is between 0 and (modulus − 1). e.g.: 13 mod 5 = (13 − 5) mod 5 = (13 − 10) mod 5 = 3 or in your case: −2 mod 5 = (−2 + 5) mod 5 = 3
As explained in other answers, there are many choices for a modulo operation with negative values. In general different languages (and different machine architectures) will give a different result. According to the [Python reference manual](http://docs.python.org/ref/binary.html), > > The modulo operator always yiel...
5,872,799
I am trying to execute the following code as part of a migration in a transaction, but the code fails unless I put the `GO` statement after the `ADD CONSTRAINT` statement: ``` ALTER TABLE T ADD C INT NULL ALTER TABLE T ADD CONSTRAINT DF_T_C DEFAULT ((1)) FOR C GO UPDATE T SET C = DEFAULT ALTER TABLE T ALTER COLUMN C ...
2011/05/03
[ "https://Stackoverflow.com/questions/5872799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4830/" ]
You can use `EXEC` for the problematic statements so they get compiled as a different batch. ``` EXEC('UPDATE T SET C = DEFAULT; ALTER TABLE T ALTER COLUMN C INT NOT NULL') ``` But you can also do ``` ALTER TABLE T ADD C INT NOT NULL CONSTRAINT DF_T_C DEFAULT ((1)) ``` Rather than doing all these individua...
``` SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET XACT_ABORT ON; BEGIN TRANSACTION; ALTER TABLE T ADD C INT NULL; ALTER TABLE T ADD CONSTRAINT DF_T_C DEFAULT ((1)) FOR C; EXEC ('UPDATE T SET C = DEFAULT'); ALTER TABLE T ALTER COLUMN C INT NOT NULL; COMMIT TRANSACTION; ```
19,452,943
In the following usable example code I define two dictionaries `a` and `b` which I want to combine ``` a = {'device': {'version': '1.2.3'}} b = {'device': {'name': 'testdevice'}} c = {'other': {'cost': '1000'}} q = {} q.update(a) q.update(b) q.update(c) print q p = {} p = dict(p.items() + a.items()) p = dict(p.item...
2013/10/18
[ "https://Stackoverflow.com/questions/19452943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1581090/" ]
As explained by Rohit [here](https://stackoverflow.com/questions/14789478/strange-java-null-behavior-in-method-overloading/14789492#14789492), > > That is because String class extends from Object and hence is more > specific to Object. So, compiler decides to invoke that method. > Remember, Compiler always chooses ...
public void method1(String str) will get executed because object is string supperclass so the string method will be called.
1,543
I'm currently rebuilding our entire intranet from scratch, mostly because the tech behind is out-dated and it has been proved that a lot of information is difficult to find. Though that is beside the point, what I am wondering is what would be the optimum amount of users to use for qualitative and quantitative testing...
2010/09/17
[ "https://ux.stackexchange.com/questions/1543", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/128/" ]
Something else to consider is where the result of your usability report is going. How much work can the people downstream from you fix - and what will the effect of those fixes be? Say I run a test with fifteen people. After the first three I've spotted problems A B C. By the end of the fifteen I've also spotted probl...
For quantitative testing, it's possible to be more explicit about the effect of the sample size on your results but the number of users you need depends on the particular tests or analyses you are considering (examples could be determining the proportion of participants successfully completing a task, estimating the av...
56,050,352
I'm trying to run a function when the location path is changed OR an object via a service is changed. I can't see to fire the function at all. ``` var settings = { value : service.cache.MY_VALUE, location: $location.path() } $scope.$watchCollection(function(){ return settings; }, function(...
2019/05/08
[ "https://Stackoverflow.com/questions/56050352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/866206/" ]
When initializing a variable with an object literal, any function inside that literal is invoked only once: > > ERRONEOUS > > > > ``` > var settings = { > value : service.cache.MY_VALUE, > location: $location.path() > } > > ``` > > The `$location.path()` function needs to be invoked every digest cycle:...
Might be a silly question, but how are you changing those values? If you're expecting settings.value to change when your service cache changes, or settings.location to change when your path changes, it won't affect $scope.settings at all. Otherwise, what you want is a deep watch. Use $watch instead of $watchCollection...
491,061
The standard System.Windows.Forms.TabControl component draws a border around the TabPages it contains. If you set its Dock to Fill, these borders run up to the edge of the parent control, but they're still there, taking up screen space. In Visual Studio, if you dock two windows in the same place, you get a TabControl-...
2009/01/29
[ "https://Stackoverflow.com/questions/491061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15371/" ]
Instead of using the Dock property you should try using the Anchor to anchor each of the four sides. Then you need to position the TabControl so it is positioned a couple of pixels bigger on all sides that the parent. That way the borders are hidden because they cannot be drawn when behind the parent control.
Using the standard .NET tab control, this isn't directly possible. What is the ultimate goal for this? Are you trying to simulate the same type of tabbed-MDI style display as Visual Studio? If that's the case, there are several third-party solutions available - some open source and some commercial. The other responses...
6,807,800
I have a jQuery .get call that hits a URL which returns true or false based on whether the user is signed in or not. This allows me to redirect the user to a login form if they aren't authenticated rather than the entire page being displayed in a small div (which holds content a signed in user should be able to see) I...
2011/07/24
[ "https://Stackoverflow.com/questions/6807800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/324243/" ]
If you want to wait for the dialog box to close, the "open" property indicates whether the dialog box is open or closed. When it's done, resolve the promise. For synchronization, add a timer to periodically test this property. ``` let d = document.querySelector('dialog') d.showModal() await new Promise((re...
Use `Bootstap' modal Then remove close button and disable model window hide by using below code ``` $('#myModal').modal({backdrop: 'static', keyboard: false}) ``` Bind your function and close event to OK button of that modal window.
19,444,267
Can we regenerate .java file from .class file using javap tool of jdk? I used `javap classsfile` command, it just prints .java file with data member and member functions declaration. If not then what are the appropriate methods to accomplish it...
2013/10/18
[ "https://Stackoverflow.com/questions/19444267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590102/" ]
generating .java from .class is called decompililng. So you need some decompiler to generate .java from .class here are some of the open source decompiler [link1](http://cavaj-java-decompiler.en.softonic.com/) [link2](http://java.decompiler.free.fr/) [link3](http://downloads.phpnuke.org/en/download-item-view-g-v-v-...
Yes its possible using java Decompiler.Please download java Decompiler or go through this url <http://jd.benow.ca/>
56,545,582
I am scripting a solution that requires passing %USERPROFILE% to the registry in local\_machine. For example ``` DotJetFolder=%USERPROFILE%\JetFolder ``` But it seems like registry doesn't understand this format. Looking for ideas on how to implement it. This for an RDS solution where we can't pre-determine the use...
2019/06/11
[ "https://Stackoverflow.com/questions/56545582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2782109/" ]
You need to create the value as a REG\_EXPAND\_SZ value if you want environment variables in the string to be expanded when Windows reads the value. In PowerShell the creation of such a value would look somewhat like this: ```bsh $key = 'HKLM:\some\where' $name = 'DotJetFolder' $value = '%USERPROFILE%\JetFolder' S...
From what I understand, you want to have a sub for "%USERPROFILE%" ``` $temp = "$env:USERPROFILE" + "\Jet" Write-Host $temp ``` Hope it Helps! BR
18,152,153
I have successfully used DP to get optimal solution to a problem. The issue I am facing though is, now if I want to reconstruct the solution, I end up with only one such way to get optimal solution. Is there a way, such that I will be able to backtrack all the ways/choices which could have lead to an optimum result?? ...
2013/08/09
[ "https://Stackoverflow.com/questions/18152153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1072192/" ]
The dispatch to one of the `whatIs`methods is decided by the compiler at compile time. The call to one of the `area`methods is decided at runtime, based on the actual class of the object that is referenced.
Q: Why can the Java compiler accurately distinguish between overridden methods for related objects, but not overloaded methods ... why can Java not handle a situation like this? A: You've got the question backwards. Java *ALLOWS* you to distinguish between "overloading" and "overriding". It doesn't try to second-gue...
2,139,798
In development blogs, online code examples and (recently) even a book, I keep stumbling about code like this: ``` var y = x as T; y.SomeMethod(); ``` or, even worse: ``` (x as T).SomeMethod(); ``` That doesn't make sense to me. If you are sure that `x` is of type `T`, you should use a direct cast: `(T)x`. If you ...
2010/01/26
[ "https://Stackoverflow.com/questions/2139798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/87698/" ]
Using 'as' does not apply user defined conversions while the cast will use them where appropriate. That can be an important difference in some cases.
I've often seen references to [this misleading article](http://www.codeproject.com/KB/cs/csharpcasts.aspx) as evidence that "as" is faster than casting. One of the more obvious misleading aspects of this article is the graphic, which does not indicate what is being measured: I suspect it's measuring *failed* casts (w...
205,259
It seems to be that **innovation projects** refer to those projects that are going to innovate current systems or practices with newer things, or generally speaking, bringing something newer to replace existing ones within a given scope. For example, upgrade from 3G network to 4G network, or from 2G to 3G. The process ...
2014/10/29
[ "https://english.stackexchange.com/questions/205259", "https://english.stackexchange.com", "https://english.stackexchange.com/users/80485/" ]
My take on these phrases is one of aspiration versus declaration. An "innovative project" has, in fact, produced an innovation. Conversely, an "innovation project" merely hopes to produce an innovation, but it might not have happened yet. As always, the borders of these words are smeared by hyperbolic usages, such as...
Looking at the meaning of the two terms, they actually refer to the development of something new, which didn't exist or is significantly different from what existed before. The process you refer to in your definition of 'innovation process' is more an 'upgrade process' or an 'update process'. [Innovation](http://www.b...
65,556
A car rental company in Iceland charges extra for two people driving the car. I was wondering what would happen if we pay the fee for only one person, but have an alternate person drive. How will they come to know this? Not just asking to evade fee, but also need to know this for emergency.
2016/03/22
[ "https://travel.stackexchange.com/questions/65556", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/41501/" ]
I usually rent a car to travel with my family during weekends. I would guess if someone else drove the car instead of me, the company would never know *unless* you have some accident. And then you are in serious trouble, because insurance would not cover it - it's in the contract. It is a bit like those european citi...
If you buy insurance or a loss/damage waiver (LDW) from the rental-car company, it won't cover any damage that occurs while a non-authorized driver is at the wheel, if they find out. But, *don't* buy insurance or a loss/damage waiver from the rental-car company. It's a scam. I was renting at Alamo and the guy was pre...
61,861,767
Let's say I have this. ``` Words Mark Suffix Happily ly Emotional dom Emotionally Surfdom ``` I want to mark 1 if the word ends with some suffix in the suffix list, and 0 otherwise. ``` Words ...
2020/05/18
[ "https://Stackoverflow.com/questions/61861767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3120443/" ]
I believe you are looking for `COUNTIF` with `OR` construct in itself through wildcards: ``` =SUMPRODUCT(COUNTIF(A2,"*"&C$2:C$3)) ``` Or if you have O365, `=SUM()` instead of `=SUMPRODUCT()`. If you don't need to refer to column C per se, we can create our own array: ``` =SUM(COUNTIF(A2,{"*ly","*dom"})) ``` This ...
If those three columns are A,B & C then B2 = `=IF(OR(RIGHT(A2,LEN($C$2))=$C$2,RIGHT(A2,LEN($C$3))=$C$3),1,0)` Above formula gives flexibility, to put any values in C2 and C3 and mark them. You don't have to refer to column C `=IF(OR(RIGHT(A2,2)="ly",RIGHT(A2,3)="dom"),1,0)` This is not suitable if you have a large ...
3,448,849
I am trying to write an Object of kind "HashMap" to a file & recover it when my program run again. But I faced with an EOFException when I try to read that object and the Object is not read from the file. I use the flush() & close() methods when I wrote the object for the FileOutputStream & ObjectOutputStream. Also I c...
2010/08/10
[ "https://Stackoverflow.com/questions/3448849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/411186/" ]
I recently stumbled across [this article on Brain.Save()](https://web.archive.org/web/20090617064403/http://hyperthink.net/blog/recycling-appdomains-not-cans/) which talks about exactly this issue from the point of view of hosting WCF (he's Steve Maine - A program manager at Redmond on the Connected Servies Division). ...
Not sure exactly what you want to do when the appication pool recycles but if you add the below event handler to Global.asax then the code in it will run when the application is shut down. ``` protected void Application_End(object sender, EventArgs e) { } ```
39,604,329
I have my .css already linked. Cant find how to also link .js propely. ``` <html> <head> <title>Final</title> <link rel="stylesheet" type="text/css" href="final.css"> </head> <body> </body> </html> ```
2016/09/20
[ "https://Stackoverflow.com/questions/39604329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6855411/" ]
By use of the script tag. ([MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)) ``` <script src="filename.js" type="text/javascript"></script> ``` The above is the simple, short answer. Standard practice tends to be, for most JavaScript, to place the script tag at the bottom of the bod...
``` <script type=“text/javascript" src="filename.js"></script> ```
3,970,746
I use `target="_blank"` to open links in a new tab. But in IE it opens a new window which is completely logical because that is what `_blank` is supposed to do. And i don't know how `target="_blank"` behaves in other browsers. Is there something to force links to open in a new tab. If the browser supports tabs... el...
2010/10/19
[ "https://Stackoverflow.com/questions/3970746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158455/" ]
The way the browser handles new windows vs new tab is set in the browser's options and can only be changed by the user.
You can change the way Safari opens a new page in Safari > Preferences > Tabs > 'Open pages in tabs instead of windows' > 'Automatically'
203,308
With the following code: ``` \documentclass[a4paper]{report} \usepackage{lipsum} \begin{document} a \begin{center} \begin{tabular}{|c|c|c|} \hline Ord & Esplicito (Adam-Bashforth) & Implicito (Adam-Moulton) \\\hline 0 & & $y_{n+1}=y_n+hf_{n+1}$ Eulero implicito \\\hline 1 & $y_{n+1}=y_n+hf_n$, Eulero esplicito & $y_{...
2014/09/26
[ "https://tex.stackexchange.com/questions/203308", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/42315/" ]
The space is obviously caused by the overfull table and it may be fruitful to understand the reason. What you see as an excess vertical space is an empty line. When you do `\\` inside `center` you're closing a paragraph, so the effect is reproducible just by ``` \documentclass{article} \begin{document} a \begin{cente...
I conjecture that the problem really stems from the `center` environment, which is based on `trivlist` with an opening `\item`. When the first “letter” in the item is too wide to fit on the line, TeX inserts a line break. Suggested solution: ``` \newenvironment{senter}{\par\centering\medskip}{\par\medskip} ``` Then ...
38,697,212
I have a string which have following pattern. String will always remain same. Just numbers will be different ``` Showing Results (1 – 15 of 96,831) ``` I want to extract `96,831` from that string. I want to do this with regex. What can be regex for that? I have tried a way where I am using two regex but still not ge...
2016/08/01
[ "https://Stackoverflow.com/questions/38697212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5532516/" ]
This is clear case where you should avoid regex as it just needs simple `strip` and `split`, like so: ``` >>> s = 'Showing Results (1 – 15 of 96,831)' >>> num = s.split()[-1] '96,831)' >>> num.strip(')') '96,831' ``` Or, using `str.rstrip`: ``` >>> num = s.rsplit(maxsplit=1)[-1] >>> num '96,831)' >>> num.strip(')')...
**NOTE:** I assume regex is necessary. ``` import re print (re.findall(re.compile(u'of ([0-9,]+)'), u"Showing Results (1 – 15 of 96,831)")[0].replace(",", "")) ```
52,112,621
I'm working on a map based iOS 11 application and want to make the status bar blurred exactly like it appears in the Apple maps. This is how it looks on the Maps app: [![enter image description here](https://i.stack.imgur.com/64FWq.png)](https://i.stack.imgur.com/64FWq.png) Currently, I'm using UIVisualEffectView to ...
2018/08/31
[ "https://Stackoverflow.com/questions/52112621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8409258/" ]
You could try to use `UIToolbar`. It has the same blur effect as `UINavigationBar` and `UITabBar` that cannot be achieved with `UIBlurEffect`.
you can try Following. ``` yourView.backgroundColor = UIColor.clear let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.light) // Or UIBlurEffectStyle.dark let blurEffectView = UIVisualEffectView(effect: blurEffect) blurEffectView.frame = viewAdvancefilter.blurredView.bounds blurEffectView.autoresizingMask...
23,943
Is a password like > > wwwwwwwwwwwwwwwwwwwwwwwww9 > > > (25x 'w' and a number) secure? It would be easy to remember.
2012/11/13
[ "https://security.stackexchange.com/questions/23943", "https://security.stackexchange.com", "https://security.stackexchange.com/users/6359/" ]
From a theory stand point, no, it isn't more secure because it lacks randomness. From a practical standpoint, with some slight changes it is pretty good. When your password lacks randomness, you always run the risk that someone could write code that could rapidly find your password. For example, it would be easy enough...
One of the best resources I know of can be found here: [GRC's Password Haystack](https://www.grc.com/haystack.htm) It explains why high entropy *is not* the answer when it comes to passwords. You can make a very secure password that is still easy to remember by doing a couple things. Start with an easy to remember pas...
35,080,258
In SQL there's a query `INSERT IGNORE` which keeps duplicate entries out of the database based on the primary key. But is there a way to achieve this functionality in OrientDB since the primary key concept here is kind of achieved using the `@rid` concept?
2016/01/29
[ "https://Stackoverflow.com/questions/35080258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3341645/" ]
The following rules apply to metric and tag values: 1. Strings are case sensitive, i.e. "Sys.Cpu.User" will be stored separately from "sys.cpu.user" 2. Spaces are not allowed. 3. Only the following characters are allowed: a to z, A to Z, 0 to 9, -, \_, ., / or Unicode letters (as per the specification) **`But in fact,...
As of opentsdb version 2.3 there is support for specifying additional characters to allow via the config variable (cross posting from [OpenTsdb: Is Space character allowed in Metric and tag information](https://stackoverflow.com/questions/33935320/opentsdb-is-space-character-allowed-in-metric-and-tag-information/) ) `...
23,733,674
I have a string `char date[16] ;` I want, that the last two signs are zero. I have tried: ``` date[14] = '0'; date[15] = '0'; date[16] = '\0'; ``` But 0 is same what '\0'. How can I reach what I want?
2014/05/19
[ "https://Stackoverflow.com/questions/23733674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1829473/" ]
Storing the character `'0'` in a character array is principally correct the way you have tried it, **but** you say you have `char date[16]` so the indexes including the terminating `'\0'` go from 0 to 15, you must not assign anything to `date[16]`. Depending on what the complete content of `date` is, it should be eith...
If the array is not fully printed, then maybe there is some garbage `'\0'` in it. Have you initialized the whole array ? ``` #include <stdio.h> int main () { char date[] = { [0 ... 14] = '0', [15] = '\0' }; printf("%s\n", date); return 0; } ``` The output is `000000000000000` as expected.
20,459,982
If I have a list and I want to keep adding lines to it and sorting them alphabetically by their last name, how could this be done? Sorted only seems to rearrange them by the first letter of the string. ``` line = "James Edward" #Example line linesList.append("".join(line)) #Add it to a list linesList ...
2013/12/08
[ "https://Stackoverflow.com/questions/20459982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3080274/" ]
If you want fully correct alphabetization (sorted by first name when the last name is the same), you can take advantage of the fact that Python sorting is stable. If you first sort by the default key: ``` lst.sort() ``` and then sort by last name: ``` lst.sort(key=lambda n: n.split()[1]) ``` then the entries with...
In case you have `three` or `n` names and you want to sort it always by the last part of the name you can do: ``` names = ["John Mc Karter", "John Oliver", "Max Raiden", "Naruto Ho Uzumaki"] print(names.sort(key=lambda x:x.split()[-1])) >>>['John Mc Karter', 'John Oliver', 'Max Raiden', 'Naruto Ho Uzumaki'] ```
5,228
I have an NVIDIA Titan GPU and I'm able to add another card, but I wonder whether Blender will benefit from more than one GPUs? Should I do it as SLI or should I just do it as an added card? I just need some help in understanding how Blender will use either SLI or a second GPU. Note that I only use Cycles.
2013/12/02
[ "https://blender.stackexchange.com/questions/5228", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/1730/" ]
There are lots of good articles out there on this topic, and short of recreating them, I can say that the two cards I use are not in SLI (wrong motherboard for it) and it uses them like two separate cores. It'll render two chunks at a time, if you tell it to use both. Some of the articles say that running in SLI is a l...
I have 3 cards, 2 cards scaled with a factor of 2.0, now the 3rd card scaled something along 1.7-1.9 factor. So 2 cards make a huge difference in cycles. You will for sure cut the render times in half. All articles I've read suggest not using SLI for apps using CUDA/Compute. If you're on Windows you can via drivers en...
115,718
I'm having a problem in some VHDL code I'm writing. I want to drive a signal with two other signals AND'd together like this: ``` mysignal <= "010" and '1'; ``` The result I expected was a bitwise AND, resulting in mysignal receiving the value of "010". Instead, I got a compiler error telling me "No feasible entries...
2014/06/17
[ "https://electronics.stackexchange.com/questions/115718", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/44159/" ]
One way is to simplify generating signals of the right range. For example: `mysignal <= "010" and (mysignal'range => '1');` This creates a new value for the second operand, the correct size, with all bits set to '1',
In order to extend '1' to a vector of specific length, usually I would use `(0 => '1', others => 0)` syntax. for example: ``` mysignal <= "010" and (0 => '1', mysignal'left downto mysignal'right+1 => '0'); ``` This specifies that bit 0 is '1' and the rest are zero, producing "001" Another way is to concatenate t...
12,031,163
I have a batch file that FTPs CSV files from my web server. I need to download only the most current CSV file. How do I do that? This is what I have so far: ``` open 44.44.44.444 username password CD /Client/ABCCompany/ get *.csv quit close() ``` Thanks.
2012/08/20
[ "https://Stackoverflow.com/questions/12031163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/516801/" ]
There's no easy way to select the most recent file with the `ftp.exe`. * If you know that the file has today's timestamp in its filename, you can generate the script dynamically with today's timestamp. You can use the `DATE` environment variable, though it has its caveats. A more reliable (and complex) way is to use t...
The easies way to do this would be to split this into two seperate connections and having a text file in the FTP location which will contain the name of the latest file. ``` open 44.44.44.444 username password CD /Client/ABCCompany/ get latestfile.txt quit close() ``` latestfile.txt will contain the name of the newe...
40,419,519
This is my JQUERY CODE : ``` $("body").on("click keypress", "#admin-username",function(){ if($("#admin-username").hasClass("error")){ $("#admin-username").removeClass("error"); setTimeout("$('.message').slideUp('slow');", 50); } }); ``` i have used an id `#admin-username` i.e only one id in t...
2016/11/04
[ "https://Stackoverflow.com/questions/40419519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6831355/" ]
Your selector is corrent but you need to use **this**-inside the callback function to access the element that raised the event ``` $("body").on("click keypress", "#admin-username, #admin-password, #admin-email",function() { if($(this).hasClass("error")) { $(this)...
First you can add same class to the three inputs in your fontend code lets say adminInput, second you can do something like this to eliminate the test you are making, ``` $("body").on("click keypress", ".adminInput.error",function(e) { var $this = $(this); $this.removeClass("error"); ...
63,202,341
``` import urllib.request import time import json import random QUERY = "http://localhost:8080/query?id={}" N = 500 def getDataPoint(quote): stock = quote['stock'] bid_price = float(quote['top_bid']['price']) ask_price = float(quote['top_ask']['price']) price = (bid_price + ask_price)/2 return sto...
2020/08/01
[ "https://Stackoverflow.com/questions/63202341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11284288/" ]
Well, you can simply do it with [flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). All you have to do is to assign the [`display: flex;`](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox) to the parent element of your text and image, then with the flex ...
Please add this style. It will make your image vertically center. ``` .question {align-items: center;} .question-answer .question img{margin: 0;} ```
281,472
File, ``` TABLE1 ------- 1234 TABLE1 ------- 9555 TABLE1 ------- 87676 TABLE1 ------- 2344 ``` I want the output like ``` TABLE1 ------- 1234 9555 87676 2344 ```
2016/05/06
[ "https://unix.stackexchange.com/questions/281472", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/118311/" ]
Here is one liner, using `sed` and `awk` : ``` sed '/^$/d' filename | awk '!a[$1]++' ``` Combination of `grep` and `awk` : ``` grep . filename | awk '!a[$1]++' ``` As @[cas](https://unix.stackexchange.com/users/7696/cas) suggested, You can do that in single `awk` command also. ``` awk '!x[$1]++ && ! /^[[:blank:]]...
I usually use sort and uniq together to get rid of duplicates like this: ``` cat file | sort | uniq ``` However, with your input, it will end up like this: ``` ------- 1234 2344 87676 9555 TABLE1 ``` This command removes all but the numbers and adds the header afterwards: ``` cat ...
1,325,718
I've always been under the impression that using the ThreadPool for (let's say non-critical) short-lived background tasks was considered best practice, even in ASP.NET, but then I came across [this article](http://csharpfeeds.com/post/5415/Dont_use_the_ThreadPool_in_ASP.NET.aspx) that seems to suggest otherwise - the a...
2009/08/25
[ "https://Stackoverflow.com/questions/1325718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58173/" ]
Websites shouldn't go around spawning threads. You typically move this functionality out into a Windows Service that you then communicate with (I use MSMQ to talk to them). -- Edit I described an implementation here: [Queue-Based Background Processing in ASP.NET MVC Web Application](https://stackoverflow.com/questio...
Whether or not IIS uses the same ThreadPool to handle incoming requests seems hard to get a definitive answer to, and also seems to have changed over versions. So it would seem like a good idea not to use ThreadPool threads excessively, so that IIS has a lot of them available. On the other hand, spawning your own threa...
43,721,966
`public static void main(String[] args)` I know conventionally the main function takes in a parameter args that contains the supplied command line arguments as an array of String objects. * I have not see main takes in any parameter other than `String[] args`. Why not a `String` or an array of `Integer`? * If there is...
2017/05/01
[ "https://Stackoverflow.com/questions/43721966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7915557/" ]
Answer to your question: **NO** Details: <http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html> > > The java command starts a Java application. It does this by starting a Java runtime environment, loading a specified class, and calling that class's **main** method. > > > The method must be decla...
> > I have not see main takes in any parameter other than String[] args. Why not a String or an array of Integer? > > > Yes, you can take any `String` or `Integer` as parameter, but that would become a different function `main()` method instead of the one used by java to start your program. After compilation, java...
338,063
I have PDF documents from a scanner. This PDF contain forms filled out and signed by staff for a days work. I want to place a bar code or standard area for OCR text on every form type so the batch scan can be programatically broken apart into separate PDF document based on form type. I would like to do this in Micros...
2008/12/03
[ "https://Stackoverflow.com/questions/338063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can research the iTextSharp library, which can split pdf files. But it isn't very good for reading the actual pdfs. So I have no idea how it would know where to split them. There are companies that already do this for you. You can research the kwiktag company.
check out the [Tesseract .NET wrapper (v 2.04.0)](http://www.pixel-technology.com/freeware/tessnet2/) around the c++ ocr engine by the same name developed by hp in the late 90's, it won awards for its ingenuity
25,674,263
I have been trying for several hours now trying to get my elements to hide one and show another. My script is as follows: ``` <script type="text/javascript"> function () { $('#Instructions').hide(); $('#GodDescription').show(); }; </script> ``` I don't understand why neither one is working. Defaul...
2014/09/04
[ "https://Stackoverflow.com/questions/25674263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3542563/" ]
If you are trying to do it as page loads you have to write this way: ``` $(function () { $('#Instructions').hide(); $('#GodDescription').show(); }); ``` or: ``` $(document).ready(function () { $('#Instructions').hide(); $('#GodDescription').show(); }); ``` Explanation: --...
Here's a pure JavaScript solution ;) ``` <script type="text/javascript"> window.onload = function(){ getDocumentById('Instructions').style.display='none'; getDocumentById('GodDescription').style.display='block'; }; </script> ```
51,236,297
I want to give my Sprite some extra speed when you press the spacebar for 3 seconds. After that you should wait 10 Seconds before using it again. I tried using SFML's Time, but the clock starts right away as the program starts so it starts anyway.... Short Question: How can I delay a function without freezing the prog...
2018/07/08
[ "https://Stackoverflow.com/questions/51236297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10050785/" ]
First of all make sure you do not use "using namespace". That is a bad habit. And why did you have a #include there. I did not need it. It is not part of the problem, but I highly recommend to have a look on <https://gafferongames.com/post/fix_your_timestep/> and manage your delta time. I think I would use a class f...
You can use a thread to create a sleep while normal code continues to execute in unison. They are quite complex for a full explanation but look up an example and see if you think it's worth trying to implement for use with this.
24,928,726
I have created a android project in Visual Studio.I have a few images in the the Drawable folder. These images show in the Resource designer as well. But when I try to access these images the Project Resource explorer does not show them. Also if I try to use them programatically they don't show up. What is wrong?
2014/07/24
[ "https://Stackoverflow.com/questions/24928726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3146095/" ]
You can't add DIV to selectBlock. But you can add option into select: ``` $('#platypusDropDown').click(function () { var myDiv = document.getElementById('addCategory'); $(this).after(myDiv); }); ```
Why you whant add div to Options? You could try like this: ``` $('#platypusDropDown').click(function () { var dropHeight = $(this.options[0]).height() * this.options.length; if($(this).data('open')) { $(this).data('open', false); $('#addCategory').css('padding-top', '0px') return; ...
9,196,066
What does `::=` mean in programming documentation? For example in the [Lua documentation](http://www.lua.org/manual/5.2/manual.html#3.2): or in [Python documentation](http://docs.python.org/release/2.7.1/reference/lexical_analysis.html#identifiers).
2012/02/08
[ "https://Stackoverflow.com/questions/9196066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/702912/" ]
This is [Backus-Naur Form](http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form) (BNF) notation describing the language. `::=` in this context means *is defined as*. For example, in the Python language documentation you refer to, an identifier *is defined as* a letter or an underscore, followed by a letter, a digit ...
As others have already said, it's part of the BNF notation. Wikipedia has an [explanation and some examples](http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form), which I won't repeat here. The history and evolution of the `::=` symbol itself is explained in [The History of the ALGOL Effort](http://heerdebeer.org/AL...
104,687
In my new campaign I am allowed to choose one uncommon magic item, and was considering the Immovable Rod: > > This flat iron rod has a button on one end. You can use an action to press the button, which causes the rod to become magically fixed in place. Until you or another creature uses an action to push the button ...
2017/08/03
[ "https://rpg.stackexchange.com/questions/104687", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/15689/" ]
As other answers have mentioned, placing the rod in a position where they won't be able to wriggle away from it would be difficult (but not impossible). So, adapt your tactics to suit your weapon. Take advantage of the fact that the rod doesn't really have to pin them *to* anything. Slide the rod under the back of t...
**Yes, but** To be successful you will probably need help. Since activating the rod would be an action you would have to have the target pinned/restrained already. The way that I could see this working requires coordination. 1. A Grapple Character (with Grappler Feat) 2. Another character with the Immovable Rod The...
5,904,399
I've been playing around with multi directional scrolling with jquery. I find this is a superb way to navigate through a website, but it has one drawback. The browser needs to load all site content at once because it's in one html document. Now I have been searching unsuccessfully for a way to have this great scrollin...
2011/05/05
[ "https://Stackoverflow.com/questions/5904399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/731779/" ]
This isn't possible in the normal sense of how Request/Response transaction between a client and a server - only a browser could animate changes on this page-change level. There are some other options: 1. When you scroll off to one side, use JS to redirect the browser (with some hash tags or query strings for info) to...
There are two ways that you could get this accomplished. * Use iframes. This is obviously not the best choice. * The second is to make all links in the DIV use ajax and load content into the DIV. Basically, modify all of the links to not actually go anywhere, but to load dynamically on the page into the respective DIV...
31,700,162
I have got a date in this format: `2015-07-29 16:29:32` How can I check the difference in minutes between the current date and the given date? ``` import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Test { public static void main(String[] args) throws ParseExce...
2015/07/29
[ "https://Stackoverflow.com/questions/31700162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/784597/" ]
A simple solution would be to use the `Date.getTime()` method (returns "*milliseconds since 1.1.1970*"), get the difference of these values and divide that value by 1000 \* 60 (1000 ms per second, 60 seconds per minute).
you can use [localdatetime](https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html) as below ``` LocalDateTime d1=new LocalDateTime(date1); LocalDateTime d2=new LocalDateTime(now); int minutesDiff=Minutes.minutesBetween(d1, d2).getMinutes(); ```
17,679,565
My page code looks like this: ``` <asp:Button ID="btnSearch" runat="server" Text="Search" onclick="btnSearch_Click"/> ``` My method looks like this: ``` protected void btnSearch_Click(object sender, EventArgs e) { var value = lblGraphicNameValue.Text.ToString(); Response.Redirect("Search.aspx?tx...
2013/07/16
[ "https://Stackoverflow.com/questions/17679565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/295265/" ]
This code below ultimately does exactly what I needed it to: ``` <a href="<%= this.ResolveUrl("Search.aspx?id=" + lblGraphicNameValue.Text.Remove(lblGraphicNameValue.Text.Length -4)) %>" target="_blank">Search Related</a> ``` This code d...
I think your on the right track, but you're confusing server side code, and client side code. `window.open` is a Javascript function which works on the client side. So you'll need to render some Javascript from C# to make the window popup. Try: ``` protected void btnSearch_Click(object sender, EventArgs e) { var v...
59,441,694
Anyone can tell me why this return to the array to string conversation when I decoding it. I didn't see any error for this type of JSON. ``` {"transaction":{"token":"8mBjEEGt0E7QxhZoObDb8Jy0gSH","created_at":"2019-12-22T04:42:23Z","updated_at":"2019-12-22T04:42:24Z","succeeded":true,"transaction_type":"AddPaymentMetho...
2019/12/22
[ "https://Stackoverflow.com/questions/59441694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12460817/" ]
There is nothing wrong with the JSON. If you try to echo an array like a string, PHP will try to convert the array to a string. Looking at the following JSON, `$json["transaction"]["payment_method"]` is not a string. It is an object or array depending on how you decode it. ``` { "transaction": { "token": "8mBj...
Your try to echo an array: ``` [ "token" => "TRYA1r9WQ0u8jllrJVHRjYyBOIh", "created_at" => "2019-12-22T04:42:23Z", "updated_at" => "2019-12-22T04:42:24Z", // etc ] ``` Try the following command to get the value when you testing: ``` var_dump($json["transaction"]["payment_method"]); ```
14,785,274
I'm trying this: If jQuery is not present, add jQuery dinamically and test it with alert. But this doesn't works, ¿what I'm doing wrong? HMTL: ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http:...
2013/02/09
[ "https://Stackoverflow.com/questions/14785274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/439866/" ]
Use onload event to fire functions when jquery being loaded in first if condition. Wrap all other function which require jquery in one function and call it onload of jquery. this will work for you. ``` if (typeof jQuery == 'undefined') { alert( 'You need to install jQuery to proceed.!'); var oHead = docu...
``` class OutputManager { public $output; public $dom; private $matches; function __construct( &$output ) { $this->output = $output; $this->dom = new DOMDocument(); $this->dom->loadHTML( $this->output ); $this->dom->normalizeDocument(); $this->matche...
11,602,626
In C# is there a way to declare the class then define it later? I really like in C++ where I can list all the methods at the top like a TOC then define everything later. Can that be done is C#? I have used the idea of defining a method that just runs a similarly named method in it then the similar method is at the ...
2012/07/22
[ "https://Stackoverflow.com/questions/11602626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1345055/" ]
this like `Interface` <http://msdn.microsoft.com/en-us/library/87d83y5b.aspx>
If you're doing this as a means to "document" the public interface to a class that's properly encapsulating a concept or object in your problem domain, then use an interface. If you're doing it as a means to get an "overview" the structure of a class, then Visual Studio has several ways to give you this. You can colla...
5,566,287
I need some guidance on how to make a audio stream app for multiple audio files, so the app user can choose from the list and listen to the item. Can someon help me?
2011/04/06
[ "https://Stackoverflow.com/questions/5566287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/450606/" ]
So your restriction is 53 bit? For my understanding order number of bit in hashcode doesn't affect its value (order and value of bit are fully independent from each other). So you could get 64-bit hash function and use only last 53 bits from it. And you must use binary operations for this ( hash64 & (1<<54 - 1) ) not ...
If you can save 16 alphanumeric characters then you can use a hexadecimal representation and pack 16^16 bits into 16 chars. 16^16 is 2^64.
64,298,576
I am currently trying to implement sections into my website using express handlebars. My code looks like this: index.js ``` const path = require("path"); const express = require("express"); const expressHandlebars = require("express-handlebars"); const app = express(); app.engine("handlebars", expressHandlebars({ ...
2020/10/10
[ "https://Stackoverflow.com/questions/64298576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11360318/" ]
There's perhaps a shorter way to do it, but this is my approach: ``` const myTaggedTemplate = (strings, ...vars) => { let result = ''; strings.forEach((str, i) => { result += `${str}${i === strings.length - 1 ? '' : vars[i]}`; }); return result; }; ```
You need to change your function: ``` let myTaggedTemplate = (strings,...values) => ...; ``` and try to follow the example in [this link](https://medium.com/@js_tut/tagged-template-literals-1e1f175c21e4)
33,098,050
My problem is about passing a member function from a Class A, to a member function of a Class B: I tried something like this : ``` typedef void (moteurGraphique::* f)(Sprite); f draw =&moteurGraphique::drawSprite; defaultScene.boucle(draw); ``` `moteurGraphique` is A class, `moteurGraphique::drawSprite` is A member...
2015/10/13
[ "https://Stackoverflow.com/questions/33098050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5367018/" ]
C++11 way: ``` using Function = std::function<void (Sprite)>; void B::boucle(Function func); ... A a; B b; b.boucle(std::bind(&A::drawSprite, &a, std::placeholders::_1)); ```
Member functions need to be called on objects, so passing the function pointer alone is not enough, you also need the object to call that pointer on. You can either store that object in the class that is going to call the function, create it right before calling the function, or pass it along with the function pointer....
50,528,092
I am trying to display different contents base on radio button select in jquery. My HTML is something like this: ``` <div class="col-sm-5"> <label class="radio-inline"> <input type="radio" name="b_type" value="1" <?=(isset($type) && $type == 'Person') ? ' checked' : ''?>> Person </label> <label class="rad...
2018/05/25
[ "https://Stackoverflow.com/questions/50528092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3733831/" ]
Just trigger the change event in the element inside the document.ready Note : You have some id typo . ```js $('input[type="radio"][name="b_type"]').on('change',function(){ alert($(this).val()); if($(this).val() == "1"){ $('#person-block').show(); $('#institute-block').hide(); }else{ $('#institu...
use .is(':checked') ``` if($('#myradiobutton').is(':checked')){ // this }else{ // that } ```
5,553
I'm considering buying a netbook for the express purpose of writing maths notes/articles (so as to not heft my Macbook around), hence (La)TeX is a must. The most obvious choice is to work with Linux, but failing that I was wondering if there is a LaTeX distribution for Chrome. And as I'm unfamiliar with the version/s o...
2010/11/18
[ "https://tex.stackexchange.com/questions/5553", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/141/" ]
Google Chrome OS is just a basic basic stuff that is needed to start the web browser, not much more. My guess is to use something like the [netbook edition of Ubuntu](http://www.ubuntu.com/netbook), that one has a gui that may fits those smaller screen quite well. And the goodie is then that you can apt-get all the n...
If you are comfortable with a delayed compile, you can write it on one machine and compile on another later. If you are coding LaTeX, presumably you don't need WYSIWYG. If you want the PS/PDF now, and are online, you can install Dropbox, set up a remote compile script, and therefore let LaTeX reside on a different co...
39,599,289
I am trying to make a countdown app. I have a button which starts countdown on pressing also the countdown text will appear on the same button too. so when user press again I want pause the countdown and hide text on button and if user press button again the countdown will start and text will show again. So the questi...
2016/09/20
[ "https://Stackoverflow.com/questions/39599289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6465824/" ]
Listeners are overwritten. So just use two different ones, and set them according to the state. ``` public void onCreate( ... ){ Button mButton = ... mButton.setOnClickListener( startListener ); } View.OnClickListener startListener = new View.OnClickListener() { public void onClick( View v ){ // ...
You can have a boolean flag. For example, it can be written as follows: ``` play.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (isCountDown) { ...hide count down text isCountDown = false; } else { ...show ...
24,951,141
from last update of chrome (Version 36.0.1985.125 m) i have problem with uplodify plugin/flash. Chrome shows Aw, Snap Page or sometimes He's Dead, Jim!. Here is my uplodify code: ``` <input type="file" name="file_upload" id="file_upload_50"> <script type="text/javascript"> var basePath = "path to ressources"; var erro...
2014/07/25
[ "https://Stackoverflow.com/questions/24951141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3770756/" ]
I've found that adding a `setTimeout` fixes this. This would indicate a race condition in Chrome / Chrome's Flash implementation / Uploadify's Flash app, the circumstances of which are not clear. Nonetheless, it appears to work in all situations for our use case. ``` $(document).ready(function () { setTimeout(func...
It is due to cache most of the time.. try to change your Javascript include as below and error will be gone!. ```html <script type="text/javascript" src="<<path-to-uploadify>>/jquery.uploadify-3.1.js?ver=<?php echo rand(0,999999);?>"></script> ```
16,336
1. I was wondering where I can find and learn some general idea about the command line interface used in Linux and bash? 2. As to now, I have found pieces of such information only from experience, such as 1. For cat, without any further arguments, it accepts stdin input. But you may explicitly specify STDIN using ...
2011/07/09
[ "https://unix.stackexchange.com/questions/16336", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/674/" ]
I recommend reading a book on unix or Linux shell and command line usage, in order to learn basic usage and get a feeling for some advanced features. Then you can turn to reference documentation. The usage of specific commands is described in their manual. `man cat` will show the manual of the `cat` command on your sy...
I would suggest looking into Unix in a Nutshell by O'rielly or merely just googling a bash tutorial. Bash is aka Bourne Again SHell. The other shells were SH, CSH, and KSH if I remember correctly. CSH is based on C. I would also recommend learning C and Perl or Python, they help speed things up substantially.
57,892,959
I want to trim everything before specific words in SQL. For example if I have the below text: *Action State changed to Completed by Test User (testuser@holdingplc.co.uk). (Change Date: 15/02/2019)* I want remove everything before the words "Change Date:", so I would end up with just "15/02/2019)" Essentially I jus...
2019/09/11
[ "https://Stackoverflow.com/questions/57892959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1765808/" ]
Here is a basic example of React Portals. ``` Index.html <body> <div id="root"></div> <div id="my-widget"></div> </body> ``` MyWidget Component ``` import React, { Component } from 'react'; import ReactDOM from 'react-dom'; const Widget = document.getElementById('my-widget'); class MyWidget extends Componen...
Try to implement something like this [How to force a script reload and re-execute?](https://stackoverflow.com/questions/9642205/how-to-force-a-script-reload-and-re-execute/9642359) in your loadScript function so your script will be force to re-load, re-execute and grab the right data-\* every time componentDidMount is ...
59,300,896
In my team lot of fights I see as some people using `@JsonInclude` annotated objects in `DAO` layer and some people argues to not to use and I could not able to find the reason for this. Please anyone suggests.
2019/12/12
[ "https://Stackoverflow.com/questions/59300896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1523263/" ]
Try [each()](https://api.jquery.com/each/) function: ``` jQuery('.tabs-nav').each( function() { jQuery(this).children('a:first).trigger('click'); }); ```
This is just what I need which is not using unique ID ``` <div class="tabmenu"> <ul> <li><a href="#" class="active">Tab 1</a></li> <li><a href="#">Tab 2</a></li> <li><a href="#">Tab 3</a></li> <li><a href="#">Tab 4</a></li> </ul> <div> <div> <p>This is a...
39,084,977
I am using Fluent Assertion library as part of my unit tests for some custom serialization code and I am looking for a way to force ShouldBeEquivalentTo to compare as equal a null and empty list. Basically, my tests look something like: ``` [Test] public void Should_be_xxx() { ClassWithList one = ...
2016/08/22
[ "https://Stackoverflow.com/questions/39084977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123653/" ]
Based on the information from Dennis above, I was able to solve this will the following actual code: ``` public class ClassWithList { public string Id { get; set; } public List<string> Items { get; set; } public List<ClassWithList> Nested { get; set; } } [TestClass] public ...
You'll have to implement a custom 'IEquivalencyStep' or u.se 'options.Using(custom action).WhenTypeIs(predicate).
28,133,961
I wrote a recursive function that gets 3 strings, out of which two were sorted in alphabetic order and the third one was allocated to put first two strings inside the third. The alphabetic order should stay; for example: ``` s1="abbcde"; s2="bckj"; ``` So, ``` s3="abbbccdekj"; ``` This is the allocation of the th...
2015/01/25
[ "https://Stackoverflow.com/questions/28133961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4491284/" ]
TCP is stream based and does not work on boundaries. So `recv()` returning partial data can be genuine. Or there can be invalid peer who just wants to mess up the connection. TCP will not help. The onus is on application to take action. If the data is not fully received (as many as the length bytes indicate) the appl...
Simply validate all input. If the client sends "N bytes coming" then read N bytes. If you read less (because the stream is depleted before you get N bytes) interpret that as a connection problem or a bug somewhere, log the event and abort the connection.
18,668
Has your job / what you do ever been questioned? How did/do you respond? Ex. * "Oh so you work on sound for advertisements? Aren't advertisements rather useless?" * "Oh so you work on x. It's nice and all, but how's that helping anyone / solving/advancing anything?" * etc.
2013/03/23
[ "https://sound.stackexchange.com/questions/18668", "https://sound.stackexchange.com", "https://sound.stackexchange.com/users/3179/" ]
Interesting question! I always joke about my job not adding anything to society/humanity, but that's not what i really think... I think that storytelling has been an important part of human life for a long time, and that our jobs largely feed into that. As living has become easier (eg. not needing to forage/hunt for f...
I haven't necessarily had the *purpose* of what I do questioned, but I do seem to find that - even though the term sound designer can be traced back decades and decades in cinema alone - people still have an issue grasping what my work actually entails. Now naturally, I'm perfectly at ease explaining what I do - I lov...
1,502,014
From the formula $$\tan^{-1}(x) + \tan^{-1}(y) = \tan^{-1} \left(\frac{x+y}{1-xy}\right)$$ we get that $\tan^{-1}(1)+\tan^{-1}(2)$ should be $\tan^{-1}(-3)$. But if you calculate the value $\tan^{-1}(1)+\tan^{-1}(2)$ directly, you get a positive value that is not equal to $\tan^{-1}(-3)$. Sorry for the silly quest...
2015/10/28
[ "https://math.stackexchange.com/questions/1502014", "https://math.stackexchange.com", "https://math.stackexchange.com/users/85897/" ]
The quoted formula cannot be right, as your argument clearly shows. Let $\theta$ be our sum. A close relative of the quoted formula, namely $$\tan(s+t)=\frac{\tan s+\tan t}{1-\tan s\tan t},$$ **is** right whenever $\tan s$ and $\tan t$ are defined, and the denominator is non-zero. Using it we find that $\tan(\theta)=-...
See <http://eulerarchive.maa.org/hedi/HEDI-2009-02.pdf> for a formula relating the function atan. Also interesting <http://www.craig-wood.com/nick/articles/pi-machin/>
32,370,286
I have a table(mysql) and in my query I would like to get only the columns that are greater or equal to 4, but I have no clue how to do that. ``` SELECT * FROM my_table WHERE * (all foo columns foo1-foo7) >= 4 AND date = '2015-09-03' ``` My table looks like: ``` id | foo1 | foo2 | foo3 | foo4 | foo5 | foo6 | foo 7 ...
2015/09/03
[ "https://Stackoverflow.com/questions/32370286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3917336/" ]
The more appropriate answer (for an RDBMS) is to use two tables with a foreign key relationship and constraint. ``` MASTER ID DATE 1 2015-09-03 DETAIL ID MASTER_ID MYNAME MYVALUE 1 1 tom 5 2 1 bill 10 3 1 kev 8 4...
Try this ``` SELECT * FROM my_table WHERE id >= 4 AND foo1 >=4 AND foo2 >=4 AND date = '2015-09-03' ``` Fill the rest of the foos, Avoid using IS and comparison operators together.
1,525,120
I only know that the folder is called Pictures and the parent folder is called Media (full path could be `C:\XXXX\XXXX\XXXX\Media\Pictures`. Is there anything I can type into the Win10 search engine that retrieves that folder (and any other folder called Media inside a parent folder called Pictures) without knowing the...
2020/02/13
[ "https://superuser.com/questions/1525120", "https://superuser.com", "https://superuser.com/users/985029/" ]
Use Windows Explorer to navigate to the parent `Pictures` folder, so it becomes the current folder. Type into the Search box the text : `Media kind:folder` and press `Enter` to search. Alternatively, you could in the `Search Tools` pane of Explorer, `Refine` group, click `Type` and choose `Folder`. --- You could al...
The below PowerShell command will search for all directories with any combination of "Media" & "Pictures" in the path and export the results (Full path of each match) to a file called FileSearch.txt on your desktop. ``` (gci c:\ -Recurse -Directory | Where {$_.FullName -like "*pictures*" -and $_.FullName -like "*media...
44,193,792
In my solution, we do have 2 projects, one of those contains App.config. I used the namespace of other project in my project. What happens is, the other project's class is using App.config node is not giving me the value of the node. How can I access the same? Below is my tree structure of the solution- ``` MySolution...
2017/05/26
[ "https://Stackoverflow.com/questions/44193792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8068426/" ]
If your prefer `jQuery` then you can use `.insertBefore()`. check below snippet ```js $('.addEnv').click(function(){ $("<input type='text' class='input-field env' />").insertBefore($('.addEnv')); }) ``` ```css .form-style-2{ max-width: 600px; padding: 10px 10px 2px 10px; font: 13px Arial, Helvetica, sa...
use insertBefore(newItem,existingItem) ``` labelEnv.insertBefore(inputEnv,addEnvElement) ```
11,846
I’m a long time developer (I’m 49) but rather new to object oriented development. I’ve been reading about OO since Bertrand Meyer’s Eiffel, but have done really little OO programming. The point is every book on OO design starts with an example of a boat, car or whatever common object we use very often, and they start ...
2010/10/13
[ "https://softwareengineering.stackexchange.com/questions/11846", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/5332/" ]
A class should use the Single Responsibility Principle. Most very large classes I have seen do to many things which is why they are too large. Look at each method and code decide should it be in this class or separate, duplicate code is a hint. You might have an issuePO method but does it contain 10 lines of data acces...
Issuing a purchase order is often a complicated process that involves more than just the purchase order. In this case, keeping the business logic in a separate class and making the purchase order simpler is probably the right thing to do. In general, though, you're right -- you don't want "data structure" classes. For ...
55,388,544
Attempting to apply CSS styles using Javascript to the title of the web page. I can't change the overall structure of the XMHTL, but I am allowed to add CSS and Java to change the appearance. I want to apply a different color to each letter in the site's title. I've tried this example: <https://codepen.io/tomhodgins...
2019/03/28
[ "https://Stackoverflow.com/questions/55388544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Using this example as you mentioned: <https://codepen.io/tomhodgins/pen/YJZyPr> But instead of setting ``` h1.letter[--nth-letter="1"] { background: red; } h1.letter[--nth-letter="2"] { background: orange; } ``` set it as ``` h1.letter[--nth-letter="1"] { color: red; } h1.letter[--nth-letter="2"] { color: orang...
You're going to want to take advantage of the fact that you can easily convert a String into an Array. In your case you're going to use jQuery (or vanilla js such as getElementById() ) to grab the text you want to style, and then use javascript to iterate through the string and assign a new color to each one. For exam...
14,580
Luaotfload has problems finding a font that is installed in my texmf tree. The source: ``` \input luaotfload.sty \font\myfont={CMU Sans Serif Demi Condensed} at 10pt \myfont foo \bye ``` The font is in `texmf-dist/fonts/opentype/public/cm-unicode/cmunssdc.otf` and kpsewhich finds it. What can I do now? Edit: a sist...
2011/03/30
[ "https://tex.stackexchange.com/questions/14580", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/243/" ]
``` \documentclass{minimal} \begin{document} \setlength{\parindent}{0pt} \newlength{\stretchlen}\setlength{\stretchlen}{1em} \def\splitterm{\_} \newcommand{\stretchit}[1]{\leavevmode\realstretch#1\_} \def\realstretch#1{% \def\temp{#1}% \ifx\temp\splitterm \else \hbox to \stretchlen{\hss#1\hss}\expandaft...
one possible form to typeset your table would be to use a table column for each character: ``` \documentclass[11pt, a4paper]{scrreprt} \usepackage{booktabs} \newcommand\Pl{${}+{}$} \newcommand\Mi{${}-{}$} \begin{document} \begin{tabular}{cc@{\hspace{-2pt}}c@{\hspace{-2pt}}c} \toprule 1 & \Pl & \Pl & \Mi \\ 4 ...
122,509
I have two questions on complex geometry. First one is that why the existence of almost complex structure on tangent bundle on real 2n-dimensional manifold is a topological question? Wikipedia describes it as a topological question. I think that mean there is some homology or cohomology group associated to topologica...
2013/02/21
[ "https://mathoverflow.net/questions/122509", "https://mathoverflow.net", "https://mathoverflow.net/users/29334/" ]
(1) Why is the existence of an almost-complex structure a topological question? Suppose $M$ is a $2n$-manifold. The tangent bundle is classified by some map $M\to BGL\_{2n}(\mathbb{R})$; $M$ admits an almost-complex structure if and only if this map admits a lift to $BGL\_{n}(\mathbb{C})$ (that is, an almost-complex st...
If $(x\_0:x\_1:\dots:x\_n)$ are the homogeneous coordinates on $P^n$ then the map $O(-1) \to O^{n+1}$ is given by $s \mapsto (sx\_0,sx\_1,\dots,sx\_n)$.
14,354,695
Experts, i have a little Problem with my sessions. I want to save my login data into the session like this: ***checklogin Controller*** ``` $user = $this->user_model->user($email, $password); $user["logged_in"] = TRUE; var_dump($this->session->set_userdata($user)); // return NULL? is this correct? var_dump($this->se...
2013/01/16
[ "https://Stackoverflow.com/questions/14354695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1675721/" ]
try this.. ``` $user = $this->user_model->user($email, $password); $user["logged_in"] = TRUE; $this->session->set_userdata('user',$user); //set session of users with a name user. ``` to get the session value u can do.. ``` print_r($this->session->userdata('user')); // prints the user session array.. ``` [read mo...
The `set_userdata()` function does not have a return value, so it is correct to display `null` on `var_dump()`. In order to save custom data to user's session you should check the manual [here](http://ellislab.com/codeigniter/user-guide/libraries/sessions.html) The parameter it accepts must be an array.
18,721,667
I am using Samsung smart TV SDK for developing an app. Is it possible to call an existing smart TV app from another app. It is possible in Android, is it also possible here? And if yes, how do you do it?
2013/09/10
[ "https://Stackoverflow.com/questions/18721667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1882331/" ]
The formula for this is easy it's `(Curr-Prev)*100.0/Prev`, what's not clear is how to apply it since we do not know your table definition, contents or keys, and thus do not know how to generically select one month and it's previous value. But, hard-coding it would be like this: ``` SELECT 100.0*(curr.Val - prev...
The problem with working out percentage changes is that you need to be careful of when the 'old value' is 0 or you will get an error. One approach is using nullif(old\_Value, 0) but then the problem with that is when old values are 0 you are asking for New\_Value/NULL which is the new value. (definitely not the % chan...
17,057,544
I would like to get just the folder path from the full path to a file. For example `T:\Data\DBDesign\DBDesign_93_v141b.mdb` and I would like to get just `T:\Data\DBDesign` (excluding the `\DBDesign_93_v141b.mdb`). I have tried something like this: ``` existGDBPath = r'T:\Data\DBDesign\DBDesign_93_v141b.mdb' wkspFldr...
2013/06/12
[ "https://Stackoverflow.com/questions/17057544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1529770/" ]
The built-in submodule [os.path](http://docs.python.org/2/library/os.path.html) has a function for that very task. ``` import os os.path.dirname('T:\Data\DBDesign\DBDesign_93_v141b.mdb') ```
Here is the code: ``` import os existGDBPath = r'T:\Data\DBDesign\DBDesign_93_v141b.mdb' wkspFldr = os.path.dirname(existGDBPath) print wkspFldr # T:\Data\DBDesign ```
27,307
One thing that I really don't like about bounties, is the fact that I have to accept an answer at the end of it. This forces my question effectively 'closed' even though I might not have recieved a satisfactory answer. If I haven't had a satisfactory answer I would much rather leave it open, and just 'lose' the points....
2009/10/26
[ "https://meta.stackexchange.com/questions/27307", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/135353/" ]
Joel has a great point in noting that the bounty should always be awarded, since it is a request for extra work by the contributors. But that could just be left separate from the accepting of an answer. If the person doesn't want to accept an answer, because their problem isn't yet solved, then award the bounty to the ...
Probably because the bounty was meant as a "last resort" measure, and it is assumed that you have tweaked and tuned your question beforehand - making it as high quality as it can be *before* you applied the bounty. Normally/Usually/Generally (hereafter abbreviated NUG) you don't get quality answers to a question becau...
48,087
A colleague in the same team spends most of his time (if not all) conducting private business activities through company’s electronic communication systems or his own cell phone during regular working hours dedicated to company. Usually he comes in office at 9am and leaves at 10am for hours then show up again in the af...
2015/06/11
[ "https://workplace.stackexchange.com/questions/48087", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/37018/" ]
> > Should I report to higher level management or HR in this case? > > > **No.** The individual doesn't report to you. And you indicate that your common manager knows of this individual's action. So no, it's not your role to report on the misbehavior of others. Just focus on your own work and let your manager b...
This is not really the type of violation you go to HR with. The worker is not productive and the manager does not seem to care. It is not like a breach of a security policy. Going to HR would be calling out the worker and manager (who is also your manager). There are a lot of ways that could go poorly for you. You can'...
51,833,806
I am getting an error and I am using SQL Server 2008 ``` select * from where rd_date between to_date('2018-17-05 00:00:00') and to_date('2018-06-06 00:00:00') ``` When I execute, I am getting the below error > > Msg 195, Level 15, State 10, Line 68 'to\_date' is not a recognized built-in function name. > > ...
2018/08/14
[ "https://Stackoverflow.com/questions/51833806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6847222/" ]
To\_date is not a function in sql server: You can try below ``` select * from where rd_date between cast('2018-17-05 00:00:00' as date) and cast('2018-06-06 00:00:00' as date) ``` OR ``` SELECT select * from where rd_date between CONVERT(DATETIME, '2018-17-05 00:00:00', 102) and CONVERT(DATETIME,'2018-06-06 00:00:...
Your format is very custom and is not supported in `CONVERT` function (which you can use to some specific date formats, as presented in the other answer). Thus, you need to do some string operations to get correct format, that can be recognized by SQL. Try below query: ``` select cast( substring(col,1,5) + ...
29,863,837
I have a json data similar like below. I am trying to sort it using the below code ``` function comp(a, b) { return new Date(a.event_date) - new Date(b.event_date); } data=data.sort(comp) ``` But the problem is two events can be on the same dates but on different times which is another element in the json ...
2015/04/25
[ "https://Stackoverflow.com/questions/29863837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1887791/" ]
If subtracting the two dates results in `0` (no difference), include the time in the equation. Something like: ```js var result = document.querySelector('#result'); result.textContent = JSON.stringify(getData().sort(sortDateTime), null, ' ') + '\n\n**using sortDateTime2\n'+ JSON.stringify(getData().sort(...
You could try this ``` function comp(a, b) { var diff = new Date(a.event_date) - new Date(b.event_date); if(diff < 0) return -1; else if(diff > 0) return 1; else if(parseTime(a.event_time) < parseTime(b.event_time)) return -1; else if(parseTime(a.event_time) > parseTime(b.event_time)) return 1; ...
92,465
Consider a society where the population includes a number of sentient androids, practically indistinguishable from humans in appearance. In practice, they are treated exactly like humans under most circumstances, with the exception that they are not legally considered as persons. One might not know whether someone is a...
2017/09/18
[ "https://worldbuilding.stackexchange.com/questions/92465", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/-1/" ]
Corporations are people in a sense. Corporations can be owned by Trusts. Trusts can have articles of incorporation that restrict what the Trust can do. They have people running them, but they must follow the rules of the articles of incorporation. To create a self-owned Android, you create a legal device that gives ...
There is a simple solution: Make all androids the property of the government. Similar to the way the government is often technically the owner of your identity documents, e.g. passport. It is illegal to damage your own passport, because that's defacing government property. In the same way, the government can defend the...
38,099,523
**My Requirement** I need to remove the options which exist in another select box, when the same option is selected in another select box **What I have done** I have created 3 select boxes and loaded with the same values in it, and I have created a 2 functions `enableAllOptions` `disableOptions`, in `enableAllOption...
2016/06/29
[ "https://Stackoverflow.com/questions/38099523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3147385/" ]
ignoring the stack vs heap side of things: because C# made the bad decision to copy C++ when they should have just made the syntax ``` Car car = Car() ``` (or something similar). Having 'new' is superfluous.
When you use referenced types then in this statement ``` Car c = new Car(); ``` there are created two entities: a reference named `c` to an object of type Car in the stack and the object of type Car itself in the heap. If you will just write ``` Car c; ``` then you create an uninitialized reference (provided tha...