id int64 4 73.8M | title stringlengths 10 150 | body stringlengths 17 50.8k | accepted_answer_id int64 7 73.8M | answer_count int64 1 182 | comment_count int64 0 89 | community_owned_date stringlengths 23 27 ⌀ | creation_date stringlengths 23 27 | favorite_count int64 0 11.6k ⌀ | last_activity_date stringlengths 23 27 | last_edit_date stringlengths 23 27 ⌀ | last_editor_display_name stringlengths 2 29 ⌀ | last_editor_user_id int64 -1 20M ⌀ | owner_display_name stringlengths 1 29 ⌀ | owner_user_id int64 1 20M ⌀ | parent_id null | post_type_id int64 1 1 | score int64 -146 26.6k | tags stringlengths 1 125 | view_count int64 122 11.6M | answer_body stringlengths 19 51k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,177,399 | How to display image from database in CodeIgniter? | <p>I am using CodeIgniter 2.1.0 and MySQL database. I have uploaded an image through a form and successfully stored it in a uploads directory and I have also successfully stored the full path of the image in my database. but i am having problem with showing the image by calling the full path from my database.</p>
<p>H... | 9,177,839 | 3 | 2 | null | 2012-02-07 13:49:38.67 UTC | 3 | 2012-09-07 09:31:26.093 UTC | 2012-02-07 14:01:01.773 UTC | null | 1,156,026 | null | 1,156,026 | null | 1 | 7 | mysql|image-processing|imageview|codeigniter-2|image-uploading | 38,393 | <p>In your database, if i have understood correctly, you're storing the image as <code>C:/wamp/www/my_project/uploads/_1_.jpg</code></p>
<p>So when you're echoing out the image path the <code>img src</code> attribute, you will have</p>
<p></p>
<p>which won't work as this as local path on your machine. I won't have t... |
9,186,150 | Decoding and understanding assembly code | <p>So a little background. I am a beginner with c and assembly code, we have an "bomb" assignment (written in c)which calls methods that require certain passwords, but the code is not visible and I need to determine the correct password by looking at the assembly code.</p>
<p>The code indicates the password for this m... | 9,188,023 | 1 | 2 | null | 2012-02-08 00:22:08.06 UTC | 17 | 2012-09-20 12:56:05.18 UTC | 2012-09-20 12:56:05.18 UTC | null | 1,288 | null | 1,186,511 | null | 1 | 21 | c|gdb|assemblies | 26,986 | <p>Here is a C equivalent of phase2:</p>
<pre><code>int t[6];
read_six_numbers (t);
if ((t[0] != 0) || (t[1] != 1)) {
explode_bomb();
}
for (int i = 2; i < 6; i++) {
if (t[i] != t[i - 2] + t[i - 1]) {
explode_bomb();
}
}
</code></pre>
<p>So the password is 0, 1, 1, 2, 3, 5.</p>
<p>How... |
29,530,199 | Why can't I use protected constructors outside the package? | <p>Why can't I use protected constructors outside the package for this piece of code:</p>
<pre><code>package code;
public class Example{
protected Example(){}
...
}
</code></pre>
<p>Check.java</p>
<pre><code>package test;
public class Check extends Example {
void m1() {
Example ex=new Example(); //com... | 29,530,299 | 3 | 4 | null | 2015-04-09 05:07:11.42 UTC | 7 | 2018-06-14 12:20:19.917 UTC | 2018-06-14 12:20:19.917 UTC | null | 1,033,581 | null | 4,029,693 | null | 1 | 39 | java|protected|access-modifiers | 12,774 | <p>protected modifier is used only with in the package and in sub-classes outside the package. When you create a object using <code>Example ex=new Example();</code> it will call parent class constructor by default. </p>
<p>As parent class constructor being protected you are getting a compile time error. You need to ca... |
16,261,119 | Typescript objects serialization? | <p>Are there any means for JSON serialization/deserialization of Typescript objects so that they don't lose type information? Simple <code>JSON.parse(JSON.stringify)</code> has too many caveats.</p>
<p>Or I should use adhoc solutions?</p> | 16,261,168 | 6 | 0 | null | 2013-04-28 08:38:34.387 UTC | 8 | 2022-05-02 11:35:23.13 UTC | 2022-05-02 11:35:23.13 UTC | null | 83,938 | null | 83,938 | null | 1 | 55 | javascript|json|serialization|typescript | 77,151 | <p>Use Interfaces to get strong types:</p>
<pre><code>// Creating
var foo:any = {};
foo.x = 3;
foo.y='123';
var jsonString = JSON.stringify(foo);
alert(jsonString);
// Reading
interface Bar{
x:number;
y?:string;
}
var baz:Bar = JSON.parse(jsonString);
alert(baz.y);
</code></pre>
<p>And use type assertio... |
16,143,684 | Can Java 8 code be compiled to run on Java 7 JVM? | <p>Java 8 introduces important new language features such as lambda expressions.</p>
<p>Are these changes in the language accompanied by such significant changes in the compiled bytecode that would prevent it from being run on a Java 7 virtual machine without using some retrotranslator?</p> | 22,492,421 | 5 | 1 | null | 2013-04-22 09:29:24.503 UTC | 31 | 2017-09-12 07:06:52.183 UTC | 2017-09-12 07:06:52.183 UTC | null | 320,911 | null | 574,351 | null | 1 | 168 | java|jvm|compatibility|java-7|java-8 | 72,275 | <p>No, using 1.8 features in your source code requires you to target a 1.8 VM. I just tried the new Java 8 release and tried compiling with <code>-target 1.7 -source 1.8</code>, and the compiler refuses:</p>
<pre><code>$ javac Test -source 1.8 -target 1.7
javac: source release 1.8 requires target release 1.8
</code></... |
42,117,911 | Lambda functions vs bind, memory! (and performance) | <p>I would like to determine which is the best practice between equivalent solutions. The use case is an instance of a class that listen to an event. Dr. Axel Rauschmayer <a href="http://www.2ality.com/2016/02/arrow-functions-vs-bind.html" rel="noreferrer">prefers the lambda</a> for readability. I agree with him. But i... | 42,395,668 | 1 | 21 | null | 2017-02-08 16:00:47.21 UTC | 8 | 2017-02-22 15:32:24.41 UTC | 2017-05-23 11:47:35.397 UTC | null | -1 | null | 3,786,294 | null | 1 | 30 | javascript|lambda|bind | 12,543 | <h1>Closures (or <em>arrow functions</em>, aka <em>lambdas</em>) don't cause memory leaks</h1>
<blockquote>
<p>Can someone to confirm or infirm if the local variables (here <code>el</code>) can't be cleared by the garbage collector? Or, are modern browsers capable to detect they are unused in the closure?</p>
</bloc... |
57,751,607 | Package '@angular/cli' is not a dependency | <p>I am getting the following error when I try to run the command</p>
<p><code>ng update @angular/cli @angular/core --allow-dirty</code></p>
<pre><code>Repository is not clean. Update changes will be mixed with pre-existing changes.
Using package manager: 'npm'
Collecting installed dependencies...
Found 28 dependenc... | 57,752,631 | 6 | 1 | null | 2019-09-02 04:58:29.427 UTC | 8 | 2022-09-21 06:58:44.72 UTC | 2019-10-30 03:50:02.003 UTC | null | 410,937 | null | 9,526,337 | null | 1 | 111 | angular|angular-cli | 95,445 | <p>First commit all your changes to the repo and then try following commands. </p>
<pre><code>npm i -g @angular/cli@8.0.0
</code></pre>
<p>and </p>
<pre><code>ng update --all --force
</code></pre>
<p>Please read <a href="https://github.com/angular/angular-cli/issues/14561" rel="noreferrer">this</a> issue on github<... |
17,444,248 | Reason: (noSuchName) There is no such variable name in this MIB | <p>I am using centos Operating System.<br>
i am trying to get the memory statistics of localhost through <code>snmpget</code> command, i am getting this error. </p>
<pre><code>snmpget -v 1 -c public localhost .1.3.6.1.4.1.2021.4.6
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed... | 17,463,065 | 1 | 0 | null | 2013-07-03 09:21:51.773 UTC | 2 | 2013-07-04 06:13:50.23 UTC | 2013-07-03 09:40:49.407 UTC | null | 1,061,636 | null | 2,545,616 | null | 1 | 9 | centos|snmp | 39,997 | <p>You'd better read the FAQ page of net-snmp,</p>
<p><a href="http://www.net-snmp.org/wiki/index.php/FAQ:Applications_09">http://www.net-snmp.org/wiki/index.php/FAQ:Applications_09</a></p>
<p>You should use </p>
<p><code>snmpget -v 1 -c public localhost .1.3.6.1.4.1.2021.4.6.0</code>.</p> |
21,982,187 | Bash: Loop until command exit status equals 0 | <p>I have a netcat installed on my local machine and a service running on port 25565. Using the command:</p>
<pre><code>nc 127.0.0.1 25565 < /dev/null; echo $?
</code></pre>
<p>Netcat checks if the port is open and returns a 0 if it open, and a 1 if it closed.</p>
<p>I am trying to write a bash script to loop end... | 21,982,743 | 2 | 2 | null | 2014-02-24 08:11:10.02 UTC | 4 | 2020-10-28 22:17:12.54 UTC | 2015-10-09 05:56:12.64 UTC | null | 667,820 | null | 2,274,960 | null | 1 | 27 | linux|bash|loops|netcat | 41,022 | <p><strong>Keep it Simple</strong></p>
<pre><code>until nc -z 127.0.0.1 25565
do
echo ...
sleep 1
done
</code></pre>
<p><em>Just let the shell deal with the exit status implicitly</em></p>
<p>The shell can deal with the exit status (recorded in <code>$?</code>) in two ways, explicit, and implicit.</p>
<p>Explic... |
19,601,921 | Center Crop an Android VideoView | <p>I am looking for something like the CENTER_CROP in <a href="http://developer.android.com/reference/android/widget/ImageView.ScaleType.html">ImageView.ScaleType</a></p>
<blockquote>
<p>Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equa... | 23,011,598 | 5 | 4 | null | 2013-10-26 01:45:53.203 UTC | 6 | 2022-04-13 21:29:24.043 UTC | null | null | null | null | 1,359,431 | null | 1 | 29 | android|scale|center|crop|android-videoview | 20,217 | <p>You can only achieve this with a TextureView. (surfaceView won't work either). Here's a lib for playing video in a textureView with center crop function. TextureView can only be used in api level 14 and up unfortunately. </p>
<p><a href="https://github.com/dmytrodanylyk/android-video-crop" rel="noreferrer">https://... |
17,601,615 | The Chrome extension popup is not working, click events are not handled | <p>I have created a JavaScript variable and when I click on the button it should increment by 1, but its not happening.</p>
<p>Here's <code>manifest.json</code>.</p>
<pre><code>{
"name":"Facebook",
"version":"1.0",
"description":"My Facebook Profile",
"manifest_version":2,
"browser_action":{
"default_ic... | 17,612,988 | 2 | 7 | null | 2013-07-11 19:18:38.283 UTC | 13 | 2013-07-13 21:13:14.647 UTC | 2013-07-13 21:13:14.647 UTC | null | 938,089 | null | 2,293,974 | null | 1 | 36 | javascript|google-chrome|button|google-chrome-extension|content-security-policy | 49,468 | <p>Your code is not working because it violates the default <a href="https://developer.chrome.com/extensions/contentSecurityPolicy.html" rel="noreferrer">Content Security Policy</a>. I've created a screencast of one minute to show what's wrong:</p>
<p><a href="https://i.stack.imgur.com/s8Wxd.gif" rel="noreferrer" title... |
18,709,834 | HTTP Status 424 or 500 for error on external dependency | <p>I am trying to create a service that has 2 dependencies. One of the dependencies is internally managed while the 2nd requires an external http outbound call to a third party API. The sequence requires the updating the resource and then executing the http outbound call. </p>
<p>So my question is, on the event of a f... | 18,711,343 | 3 | 0 | null | 2013-09-10 02:27:27.73 UTC | 8 | 2017-10-25 16:11:44.543 UTC | 2017-10-25 16:11:44.543 UTC | null | 317,522 | null | 887,040 | null | 1 | 92 | rest|http-status-codes | 69,181 | <p>The failure you're asking about is one that has occurred within the internals of the service itself, so a 5xx status code range is the correct choice. 503 Service Unavailable looks perfect for the situation you've described.</p>
<p>5xx codes are for telling the client that even though the request was fine, the serve... |
18,713,415 | User Activity Tracking using javascript library | <p>Is it possible to track every action of a user on a webpage and creating log of it? The idea is to transfer log of user actions to server via AJAX and saving it. On each event for each element I can write code/logic to write some log in console, but I was wondering if there is any library/shortcut available which ca... | 26,142,412 | 4 | 4 | null | 2013-09-10 07:53:59.78 UTC | 25 | 2021-01-07 12:30:16.44 UTC | 2021-01-07 12:30:16.44 UTC | null | 6,887,084 | null | 1,356,109 | null | 1 | 17 | javascript|jquery|html|dom|logging | 41,848 | <p>You can use ready-made solutions:</p>
<ul>
<li><a href="http://www.google.com/analytics/">http://www.google.com/analytics/</a></li>
<li><a href="http://www.clicktale.com/">http://www.clicktale.com/</a></li>
<li><a href="https://segment.io/">https://segment.io/</a></li>
<li><a href="http://www.extrawatch.com/">http:... |
5,048,695 | jQuery Mobile for mobile and desktop? | <p>I'm developing a web app. MySql/PHP back-end, and HTML/jQuery front-end.</p>
<p>I wanted to use jQuery UI framework. </p>
<p>Now is see that jQuery Mobile is out, and I want to make the app accessible to mobile devices as much as possible.</p>
<p>I Googled, but didn't find a quality answer. </p>
<p>Can I make ... | 5,048,725 | 3 | 0 | null | 2011-02-19 03:38:42.037 UTC | 17 | 2016-05-09 05:40:19.177 UTC | 2016-05-09 05:40:19.177 UTC | null | 13,302 | null | 329,200 | null | 1 | 44 | jquery|jquery-ui|mobile|jquery-mobile | 26,078 | <p>I think it largely depends on what you want to do and functionality you're trying to capture. If you want a webpage to behave a certain way on mobile and the same desktop, then with some careful coding/testing, you'll be alright with jquery.mobile. </p>
<p>If you check out the CSS for jquery.mobile (uncompressed v... |
9,476,131 | Is there a way to remove the authorization prompt from command-line instances of Instruments (Xcode)? | <p>I am currently using Instruments via a bash script to initiate the command-line interface to start up runs of the Automation plug-in. </p>
<p>With 4.2, this worked well enough, however with the upgrade to Xcode 4.3, I am now being prompted for an authorized user to 'analyze other processes'. No user is ever actua... | 9,678,612 | 11 | 4 | null | 2012-02-28 03:53:00.857 UTC | 24 | 2022-05-09 23:31:01.307 UTC | 2022-05-09 23:31:01.307 UTC | null | 5,175,709 | null | 392,410 | null | 1 | 30 | ios|keychain|instruments|ios-ui-automation | 20,252 | <p>Here's a wonderful command that may work for you:</p>
<pre><code>security unlock-keychain -p [password] "${HOME}/Library/Keychains/login.keychain"
</code></pre>
<p>It's the command-line way to gain access to a keychain on the Mac. I haven't tested it with Automation, but it's how I've integrated my iOS builds with... |
15,233,290 | ToString("X") produces single digit hex numbers | <p>We wrote a crude data scope.</p>
<p>(The freeware terminal programs we found were unable to keep up with Bluetooth speeds)</p>
<p>The results are okay, and we are writing them to a Comma separated file for use with a spreadsheet. It would be better to see the hex values line up in nice columns in the RichTextBox i... | 15,233,319 | 1 | 2 | null | 2013-03-05 20:18:47.323 UTC | 5 | 2018-10-15 11:57:24.747 UTC | 2014-01-14 13:21:40.203 UTC | null | 1,901,636 | null | 1,901,636 | null | 1 | 28 | c#|hex | 96,164 | <p>Use a <a href="http://msdn.microsoft.com/en-us/library/txafckwd.aspx" rel="noreferrer">composite</a> format string:</p>
<pre><code>pass += b[i].ToString("X2") + " ";
</code></pre>
<p>The documentation on MSDN, <a href="http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx" rel="noreferrer">Standard Numeric Format ... |
15,164,886 | Hadoop speculative task execution | <p>In Google's MapReduce paper, they have a backup task, I think it's the same thing with speculative task in Hadoop. How is the speculative task implemented? When I start a speculative task, does the task start from the very begining as the older and slowly one, or just start from where the older task has reached(if s... | 15,165,199 | 1 | 1 | null | 2013-03-01 18:56:31.31 UTC | 16 | 2016-03-24 17:11:35.98 UTC | null | null | null | null | 495,798 | null | 1 | 31 | hadoop|mapreduce | 38,296 | <p>One problem with the Hadoop system is that by dividing the tasks across many nodes, it is possible for a few slow nodes to rate-limit the rest of the program.</p>
<p>Tasks may be slow for various reasons, including hardware degradation, or software mis-configuration, but the causes may be hard to detect since the t... |
28,002,261 | Parse 'Date & Time' string in Javascript which are of custom format | <p>I have to parse a date and time string of format "2015-01-16 22:15:00". I want to parse this into JavaScript Date Object. Any help on this?</p>
<p>I tried some jquery plugins, moment.js, date.js, xdate.js. Still no luck.</p> | 28,002,368 | 6 | 2 | null | 2015-01-17 17:38:07.13 UTC | 5 | 2021-12-06 13:08:04.853 UTC | null | null | null | null | 2,323,097 | null | 1 | 21 | javascript|jquery|momentjs|datejs|datetime-parsing | 80,603 | <p>With moment.js you can create a moment object using the <a href="http://momentjs.com/docs/#/parsing/string-format/">String+Format constructor</a>:</p>
<pre><code>var momentDate = moment('2015-01-16 22:15:00', 'YYYY-MM-DD HH:mm:ss');
</code></pre>
<p>Then, you can convert it to JavaScript Date Object using <a href=... |
8,023,829 | NSDictionary setValue:forKey: -- getting "this class is not key value coding-compliant for the key" | <p>I have this simple loop in my program:</p>
<pre><code>for (Element *e in items)
{
NSDictionary *article = [[NSDictionary alloc] init];
NSLog([[e selectElement: @"title"] contentsText]);
[article setValue: [[e selectElement: @"title"] contentsText] forKey: @"Title"];
[self.articles insertObject: art... | 8,023,875 | 2 | 2 | null | 2011-11-05 22:43:04.407 UTC | 4 | 2011-11-05 22:50:09.457 UTC | null | null | null | null | 29,595 | null | 1 | 26 | objective-c|data-structures|nsdictionary | 40,586 | <p>First off, you're using <code>-setValue:forKey:</code> on a dictionary when you should be using <code>-setObject:forKey:</code>. Secondly, you're trying to mutate an <code>NSDictionary</code>, which is an immutable object, instead of an <code>NSMutableDictionary</code>, which would work. If you switch to using <code... |
8,706,017 | maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e | <p>I have a fairly simple Maven project:</p>
<pre class="lang-xml prettyprint-override"><code><project>
<dependencies>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
... | 8,752,807 | 8 | 3 | null | 2012-01-02 22:34:48.863 UTC | 49 | 2015-03-06 11:14:27.313 UTC | 2014-05-20 03:54:30.53 UTC | null | 1,521,627 | null | 128,967 | null | 1 | 156 | eclipse|maven|m2eclipse | 133,657 | <p>It seems to be a known issue. You can instruct m2e to ignore this. </p>
<p><strong>Option 1: pom.xml</strong></p>
<p>Add the following inside your <code><build/></code> tag:</p>
<pre><code><pluginManagement>
<plugins>
<!-- Ignore/Execute plugin execution -->
<plugin>
... |
5,227,607 | Posting an embedded video link using the Facebook Graph API | <p>When manually attaching a video link (from YouTube, Vimeo, etc) to a post using the Facebook web interface, Facebook automatically recognizes the link as a video, and allows the resulting status message to play the video inline. The video is displayed as an embedded player in the Wall or News feed.</p>
<hr>
<p>He... | 5,316,090 | 7 | 2 | null | 2011-03-08 02:20:49.543 UTC | 27 | 2015-07-31 08:28:43.737 UTC | null | null | null | null | 8,985 | null | 1 | 41 | facebook|youtube|facebook-graph-api|embed|vimeo | 53,808 | <p>It appears that you have to extract the URLs of the actual swf in the page and the thumbnail image yourself. For example, this seems to work:</p>
<pre><code>curl -F 'access_token=...' \
-F 'message=Link to YouTube' \
-F 'link=http://www.youtube.com/watch?v=3aICB2mUu2k' \
-F 'source=http://www.youtube... |
5,376,559 | Is Perl a compiled or an interpreted programming language? | <p>Is Perl compiled or interpreted?</p> | 5,376,580 | 9 | 0 | null | 2011-03-21 10:46:50.58 UTC | 11 | 2021-01-26 20:06:21.77 UTC | 2013-04-08 17:26:38.683 UTC | null | 1,350,209 | null | 134,246 | null | 1 | 28 | perl|interpreted-language|compiled-language | 28,540 | <p>Well, that depends on what you mean by a compiled language. Maybe this is why googling did not bring forth a clear answer to your question.</p>
<p>One viewpoint is that compilation means compiling from a source code description to another, i.e. <a href="http://en.wikipedia.org/wiki/Code_generation_%28compiler%29" r... |
16,773,189 | "Hacking" a way to a remote shell in 5 characters | <p>This weekend, there was a CTF wargame happening, Secuinside CTF 2013 ( <a href="http://war.secuinside.com/" rel="nofollow">http://war.secuinside.com/</a> )</p>
<p>Being a computer security enthousiast, I took a look at the challenges, and at their solutions after the CTF was over.</p>
<p>One of the challenges was ... | 16,775,110 | 1 | 2 | null | 2013-05-27 12:25:43.863 UTC | 8 | 2013-11-07 14:28:32.417 UTC | 2013-11-07 14:28:32.417 UTC | user1228 | null | null | 1,532,392 | null | 1 | 11 | bash|security|shell | 1,782 | <p>4 is your connection's file descriptor.</p>
<p>0 is the program stdin, 1 is the program stdout, 2 is the program stderr, when you created a socket to listen for connections it was then assigned to 3, and when it accepted your connection, a new file descriptor of number 4 was created to handle this connection.</p>
... |
29,543,780 | Why do linked lists use pointers instead of storing nodes inside of nodes | <p>I've worked with linked lists before extensively in Java, but I'm very new to C++. I was using this node class that was given to me in a project just fine</p>
<pre><code>class Node
{
public:
Node(int data);
int m_data;
Node *m_next;
};
</code></pre>
<p>but I had one question that wasn't answered very w... | 29,543,917 | 11 | 22 | null | 2015-04-09 16:17:12.857 UTC | 24 | 2020-07-10 00:48:30.857 UTC | 2016-03-27 20:33:36.647 UTC | null | 3,772,221 | null | 3,772,221 | null | 1 | 125 | c++|pointers|linked-list | 16,190 | <p>It's not just better, it's the only possible way.</p>
<p>If you stored a <code>Node</code> <em>object</em> inside itself, what would <code>sizeof(Node)</code> be? It would be <code>sizeof(int) + sizeof(Node)</code>, which would be equal to <code>sizeof(int) + (sizeof(int) + sizeof(Node))</code>, which would be equa... |
65,303,304 | Xcode 12.3: Building for iOS Simulator, but the linked and embedded framework was built for iOS + iOS Simulator | <p>I have an app using a linked and embedded custom framework. The app built properly for iOS devices and simulators until Xcode 12.2. Starting from Xcode 12.3 however, I'm getting the following error:</p>
<blockquote>
<p>Building for iOS Simulator, but the linked and embedded framework 'My.framework' was built for iOS... | 65,315,026 | 4 | 9 | null | 2020-12-15 09:39:08.4 UTC | 40 | 2022-08-19 23:24:42.19 UTC | 2022-08-19 22:49:41.62 UTC | null | 63,550 | null | 1,707,129 | null | 1 | 187 | ios|xcode12|lipo | 104,189 | <p>I'm afraid that this is actually the correct error and the framework shouldn't contain iOS and iOS Simulator code at the same time. Apple tries to force us to use <code>XCFramework</code>s for this purpose. They started it in Xcode 11 and just tightened up the restrictions.</p>
<p>The only correct way to resolve thi... |
12,445,010 | What is The use of moveToFirst () in SQLite Cursors | <p>I am a programming newbie
and I found this piece of code in the internet and it works fine</p>
<pre><code>Cursor c=db.query(DataBase.TB_NAME, new String[] {DataBase.KEY_ROWID,DataBase.KEY_RATE}, DataBase.KEY_ROWID+"= 1", null, null, null, null);
if(c!=null)
{
c.moveToFirst();
}
<... | 12,445,030 | 5 | 0 | null | 2012-09-16 06:58:24.233 UTC | 7 | 2021-12-23 04:08:58.933 UTC | 2021-12-23 04:08:58.933 UTC | null | 4,294,399 | null | 1,675,286 | null | 1 | 23 | android|sqlite|database-cursor | 49,595 | <p>The docs for <a href="http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#query%28java.lang.String,%20java.lang.String%5B%5D,%20java.lang.String,%20java.lang.String%5B%5D,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String%29">SQLiteDatabase.query()</a> say ... |
12,639,407 | SQL - IF EXISTS UPDATE ELSE INSERT Syntax Error | <p>I have the following SQL query:</p>
<pre><code>IF EXISTS(SELECT * FROM component_psar WHERE tbl_id = '2' AND row_nr = '1')
UPDATE component_psar
SET col_1 = '1', col_2 = '1', col_3 = '1', col_4 = '1', col_5 = '1',
col_6 = '1', unit = '1', add_info = '1', fsar_lock = '1'
WHERE tbl_id ... | 12,639,529 | 6 | 4 | null | 2012-09-28 11:46:57.247 UTC | 10 | 2017-05-05 15:23:59.037 UTC | 2012-09-28 12:27:09.747 UTC | null | 1,297,603 | null | 1,540,332 | null | 1 | 33 | mysql|sql | 132,866 | <pre><code>INSERT INTO component_psar (tbl_id, row_nr, col_1, col_2, col_3, col_4, col_5, col_6, unit, add_info, fsar_lock)
VALUES('2', '1', '1', '1', '1', '1', '1', '1', '1', '1', 'N')
ON DUPLICATE KEY UPDATE col_1 = VALUES(col_1), col_2 = VALUES(col_2), col_3 = VALUES(col_3), col_4 = VALUES(col_4), col_5 = VALUES(col... |
12,419,619 | What's the difference between ng-model and ng-bind | <p>I'm currently learning AngularJS and am having difficulty understanding the difference between <code>ng-bind</code> and <code>ng-model</code>.</p>
<p>Can anyone tell me how they differ and when one should be used over the other?</p> | 12,420,157 | 8 | 0 | null | 2012-09-14 07:02:10.507 UTC | 160 | 2018-11-16 13:09:20.28 UTC | 2016-11-16 09:45:03.2 UTC | null | 133,203 | null | 448,337 | null | 1 | 560 | angularjs|angular-ngmodel|ng-bind | 252,043 | <p><strong>ng-bind</strong> has one-way data binding ($scope --> view). It has a shortcut <code>{{ val }}</code>
which displays the scope value <code>$scope.val</code> inserted into html where <code>val</code> is a variable name.</p>
<p><strong>ng-model</strong> is intended to be put inside of form elements and has tw... |
12,370,495 | Share a cookie between two websites | <p>I have built a website (A) which logs in to and retrieves customer data from a separate web service.</p>
<p>The organisation that owns (A) also has a website (B) which has a web form. They want a logged in customer on (A) to be able to click across to (B) and see a pre-populated form with their details.</p>
<p>Thi... | 12,370,586 | 7 | 1 | null | 2012-09-11 13:10:10.163 UTC | 17 | 2019-04-19 02:37:45.067 UTC | null | null | null | null | 214,980 | null | 1 | 51 | http|cookies | 75,677 | <p>No. Website B can't read a cookie from website A. </p>
<p>The easiest work-around is to pass login/credential information from website A to website B and have website B set a seperate cookie. For example, after logging into website A you could have them quickly redirected to website B with an encrypted querystring.... |
12,450,321 | why is javascript node.js not on google app engine | <p>Google created the V8 JavaScript engine: V8 compiles JavaScript source code directly into machine code when it is first executed.</p>
<p>Node.js is built on V8 - why is Google not offering any Node.js servers like Microsoft Azure?</p>
<p>Google App Engine would be a natural place to put Node.js.</p>
<p>Do you kno... | 24,427,331 | 12 | 3 | null | 2012-09-16 20:08:34.76 UTC | 29 | 2021-07-04 18:36:29.987 UTC | 2019-07-25 14:42:16.053 UTC | null | 1,082,449 | null | 699,215 | null | 1 | 72 | google-app-engine|node.js | 34,821 | <p>As of June 2014, Google had a limited preview for custom languages on <a href="https://stackoverflow.com/questions/22697049/what-is-the-difference-between-google-app-engine-and-google-compute-engine">Google App Engine (which is different from Google Compute Engine)</a>.</p>
<p>Watch <a href="https://www.youtube.com... |
19,158,559 | How to fix a header on scroll | <p>I am creating a header that once scrolled to a certain amount of pixels it fixes and stays in place.</p>
<p>Can I do this using just css and html or do i need jquery too?</p>
<p>I have created a demo so you can understand. Any help would be great!</p>
<p><a href="http://jsfiddle.net/gxRC9/4/" rel="nofollow noreferre... | 19,158,690 | 16 | 4 | null | 2013-10-03 11:54:34.11 UTC | 30 | 2022-08-23 09:01:33.4 UTC | 2021-10-30 11:53:34.377 UTC | null | 3,343,230 | null | 2,798,492 | null | 1 | 58 | jquery|css|header|fixed | 342,458 | <p>You need some JS to do scroll events. The best way to do this is to set a new CSS class for the fixed position that will get assigned to the relevant div when scrolling goes past a certain point.</p>
<p><strong>HTML</strong></p>
<pre><code><div class="sticky"></div>
</code></pre>
<p><strong>CSS</stron... |
19,066,066 | iOS 7 UIWebView not rendering | <p>I'm porting my app to iOS 7 and I have a problem with UIWebView in iOS 7.
I load local html string in it with this code:</p>
<pre><code>NSURL *baseURL = [NSURL fileURLWithPath: DOCUMENTS_DIRECTORY];
[self.descWebView loadHTMLString:html baseURL:baseURL];
</code></pre>
<p>It works perfectly on iOS 6 and prior but o... | 19,328,839 | 10 | 6 | null | 2013-09-28 10:46:14.357 UTC | 5 | 2015-11-30 04:30:16.853 UTC | null | null | null | null | 2,826,077 | null | 1 | 28 | ios|uiwebview|ios7 | 11,492 | <p>As mentioned by @zaplitny, I had to update Crittercism to the latest version (4.1.0) for this problem to go away. </p> |
24,430,220 | E11000 duplicate key error index in mongodb mongoose | <p>Following is my <code>user</code> schema in <code>user.js</code> model -</p>
<pre><code>var userSchema = new mongoose.Schema({
local: {
name: { type: String },
email : { type: String, require: true, unique: true },
password: { type: String, require:true },
},
facebook: {
... | 24,430,345 | 22 | 4 | null | 2014-06-26 12:12:30.777 UTC | 71 | 2022-08-24 09:34:38.477 UTC | 2018-08-09 05:14:35.473 UTC | null | 6,792,646 | null | 1,594,368 | null | 1 | 332 | node.js|mongodb|mongoose | 476,396 | <p>The error message is saying that there's already a record with <code>null</code> as the email. In other words, you already have a user without an email address.</p>
<p>The relevant documentation for this:</p>
<blockquote>
<p>If a document does not have a value for the indexed field in a unique index, the index will ... |
24,340,061 | iOS 8 Custom Keyboard | <p>I am trying to build a custom keyboard, it's like a emoji keyboard, but the keyboard's data is from a json file. After parse this json file and get the data, how to make the custom keyboard use it and show in the keyboard view, like the emoji keyboard that built in? Right now, I follow App Extension Keyboard: Custom... | 24,480,540 | 2 | 5 | null | 2014-06-21 09:03:34.34 UTC | 11 | 2016-02-01 04:15:41.67 UTC | 2016-02-01 04:15:41.67 UTC | null | 189,804 | null | 1,037,295 | null | 1 | 12 | ios|keyboard|swift|ios8|ios-app-extension | 11,440 | <p>You can build a xib file by clicking new file -> view</p>
<p>1) inside the xib file create a uiview 320x216 and you can drag'n'drop whatever controls you want into it</p>
<p>2) then you can load the nib like this into your keyboard's inputView:</p>
<pre><code>// Perform custom UI setup here
UIView *layout = [[[NS... |
24,297,257 | Save HTML of some website in a txt file with python | <p>I need save the HTML code of any website in a txt file, is a very easy exercise but I have doubts with this because a have a function that do this:</p>
<pre><code>import urllib.request
def get_html(url):
f=open('htmlcode.txt','w')
page=urllib.request.urlopen(url)
pagetext=page.read() ## Save the html a... | 24,297,356 | 2 | 9 | null | 2014-06-19 01:05:17.247 UTC | 6 | 2019-09-26 06:47:45.047 UTC | 2014-10-28 19:03:24.353 UTC | null | 3,001,761 | null | 2,036,128 | null | 1 | 14 | python|html|parsing|python-3.x|urllib | 46,412 | <p>Easiest way would be to use <a href="https://docs.python.org/2/library/urllib.html#urllib.urlretrieve" rel="noreferrer">urlretrieve</a>:</p>
<pre><code>import urllib
urllib.urlretrieve("http://www.example.com/test.html", "test.txt")
</code></pre>
<p>For Python 3.x the code is as follows:</p>
<pre><code>import ur... |
22,669,528 | Securely storing environment variables in GAE with app.yaml | <p>I need to store API keys and other sensitive information in <code>app.yaml</code> as environment variables for deployment on GAE. The issue with this is that if I push <code>app.yaml</code> to GitHub, this information becomes public (not good). I don't want to store the info in a datastore as it does not suit the pr... | 35,261,091 | 15 | 7 | null | 2014-03-26 18:08:23.807 UTC | 41 | 2022-02-18 08:19:13.54 UTC | null | null | null | null | 1,676,476 | null | 1 | 116 | python|google-app-engine|python-2.7|environment-variables | 53,106 | <p>If it's sensitive data, you should not store it in source code as it will be checked into source control. The wrong people (inside or outside your organization) may find it there. Also, your development environment probably uses different config values from your production environment. If these values are stored in ... |
8,419,332 | Proper session hijacking prevention in PHP | <p>I know this topic has been discussed <em>a lot</em>, but I have a few specific questions still not answered. For example:</p>
<pre><code>// **PREVENTING SESSION HIJACKING**
// Prevents javascript XSS attacks aimed to steal the session ID
ini_set('session.cookie_httponly', 1);
// Adds entropy into the randomization... | 8,419,884 | 1 | 6 | null | 2011-12-07 17:02:34.637 UTC | 20 | 2016-03-02 01:54:23.927 UTC | null | null | null | null | 2,612,112 | null | 1 | 23 | php|security|session|sessionid|session-hijacking | 10,503 | <p>Your configuration is awesome. You definitely read up on how to lock down php sessions. However this line of code negates a lot of the protection provided by your php configuration:
<code>session_id(sha1(uniqid(microtime()));</code></p>
<p>This is a <strong>particularly awful</strong> method of generating a sess... |
8,656,089 | Solution for "Fatal error: Maximum function nesting level of '100' reached, aborting!" in PHP | <p>I have made a function that finds all the URLs within an html file and repeats the same process for each html content linked to the discovered URLs. The function is recursive and can go on endlessly. However, I have put a limit on the recursion by setting a global variable which causes the recursion to stop after 10... | 8,667,421 | 23 | 6 | null | 2011-12-28 12:46:23.873 UTC | 28 | 2020-12-31 18:09:07.29 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 569,085 | null | 1 | 146 | recursion|xdebug|php | 313,801 | <p>A simple solution solved my problem. I just commented this line:</p>
<pre><code>zend_extension = "d:/wamp/bin/php/php5.3.8/zend_ext/php_xdebug-2.1.2-5.3-vc9.dll
</code></pre>
<p>in my <code>php.ini</code> file. This extension was limiting the stack to <code>100</code> so I disabled it. The recursive function is no... |
10,949,937 | How to call a controller method from Javascript | <p>I am displaying a bunch of movies in a table, I am eventually deleting each movie through Javascript which hides the div. </p>
<p>I now want to delete the movie from the database as well, so what is the best way to call the controller method from the Javascript?</p> | 10,950,172 | 4 | 3 | null | 2012-06-08 13:37:27.83 UTC | null | 2022-08-18 16:46:31.967 UTC | 2014-09-30 14:47:27.723 UTC | null | 2,460,971 | null | 781,238 | null | 1 | 7 | asp.net|.net|asp.net-mvc-3 | 73,295 | <p>Have an <strong>HTTPPost</strong> action method to delete in your <code>movie</code> controller</p>
<pre><code>[HttpPost]
public ActionResult Delete(int id)
{
try
{
repo.DeleteMovie(id);
return "deleted"
}
catch(Exception ex)
{
//Log errror
}
return "failed";
}
</code></pre>
<p>And in you... |
11,029,538 | SQLite query from multiple tables using SQLiteDatabase | <p>I have 2 tables in my database, for example: <code>Table1: id (PK), data1</code> and <code>Table2: id (PK), id_table1 (FK), data2</code>. How can I make a query like that: </p>
<pre><code>SELECT * FROM Table1, Table2 WHERE Table1.id = Table2.id_table1
GROUP BY Table1.data1
</code></pre>
<p>I'm using <code>SQLiteD... | 11,029,587 | 2 | 0 | null | 2012-06-14 08:40:28.797 UTC | 12 | 2012-06-14 08:53:14.56 UTC | 2012-06-14 08:41:59.793 UTC | null | 385,478 | null | 1,049,280 | null | 1 | 13 | android|sqlite | 54,265 | <p>Try this:</p>
<pre><code>Cursor mCursor = db.rawQuery("SELECT * FROM Table1, Table2 " +
"WHERE Table1.id = Table2.id_table1 " +
"GROUP BY Table1.data1", null);
</code></pre> |
11,337,420 | Can I use an existing user as Django admin when enabling admin for the first time? | <p>I have built a Django site for a while, but I never enabled Django admin. </p>
<p>User accounts are registered on both LDAP and Django, but the master record is based on LDAP. So I must use the account in LDAP as super user.</p>
<p>When I enable Django Admin, I am prompted to create a super user. Can I use an exis... | 11,337,600 | 2 | 0 | null | 2012-07-05 03:06:40.383 UTC | 11 | 2020-03-04 17:12:18.853 UTC | 2012-07-05 03:12:43.703 UTC | null | 15,168 | null | 1,253,487 | null | 1 | 30 | django|django-admin | 13,999 | <p>Yes, but you'll do it through the Django shell:</p>
<pre><code>python manage.py shell
</code></pre>
<p>Then fetch your user from the database:</p>
<pre><code>from django.contrib.auth.models import User
user = User.objects.get(username="myname")
user.is_staff = True
user.is_admin = True
user.save()
</code></pre>
... |
10,930,624 | Creating JSON objects directly from model classes in Java | <p>I have some model classes like <code>Customer</code>, <code>Product</code>, etc. in my project which have several fields and their setter-getter methods, I need to <strong>exchange objects of these classes as a JSONObject via Sockets</strong> to and from client and server.</p>
<p>Is there any way I can create <code... | 10,930,794 | 5 | 0 | null | 2012-06-07 11:10:05.547 UTC | 2 | 2019-12-20 09:11:26.01 UTC | 2019-09-18 16:34:32.23 UTC | null | 2,306,173 | null | 414,749 | null | 1 | 32 | java|json|sockets | 102,749 | <p><a href="http://code.google.com/p/google-gson/">Google GSON</a> does this; I've used it on several projects and it's simple and works well. It can do the translation for simple objects with no intervention, but there's a mechanism for customizing the translation (in both directions,) as well.</p>
<pre><code>Gson g ... |
11,039,658 | How to check whether a select box is empty using JQuery/Javascript | <p>I have a select box that is being populated dynamically from a database. As of right now the population of this check box is working flawlessly.</p>
<p>I have added functionality that consists of a button which on click calls <code>isSelextBoxEmpty</code>. The job of this function is to know whether this particular... | 11,039,741 | 4 | 0 | null | 2012-06-14 19:01:13.68 UTC | 9 | 2021-04-13 09:22:49.487 UTC | 2020-03-23 15:27:21.53 UTC | null | 1,046,690 | null | 1,046,690 | null | 1 | 40 | javascript|jquery|html|jquery-mobile|jquery-selectbox | 145,132 | <p>To check whether select box has any values:</p>
<pre><code>if( $('#fruit_name').has('option').length > 0 ) {
</code></pre>
<p>To check whether selected value is empty:</p>
<pre><code>if( !$('#fruit_name').val() ) {
</code></pre> |
10,877,494 | Including header files in C/C++ more than once | <p>Is it ever useful to include a header file more than once in C or C++?</p>
<p>If the mechanism is never used, why would the compiler ever worry about including a file twice; if it really were useless, wouldn't it be more convenient if newer compilers made sure every header is included only once?</p>
<p>Edit:</p>
... | 10,877,554 | 6 | 3 | null | 2012-06-04 07:03:19.29 UTC | 8 | 2014-10-23 15:56:12.957 UTC | 2014-10-23 15:56:12.957 UTC | null | -1 | null | 956,134 | null | 1 | 49 | c++|c|header-files | 6,535 | <p>Yes, it's useful when generating code with the preprocessor, or doing tricks like Boost.PP does.</p>
<p>For an example, see X Macros. The basic idea is that the file contains the body of the macro and you <code>#define</code> the arguments and then <code>#include</code> it. Here's a contrived example:</p>
<p>macro... |
11,082,278 | How to properly assemble a valid xlsx file from its internal sub-components? | <p>I'm trying to create an xlsx file programmatically on iOS. Since the internal data of xlsx files is basically stored in separate xml files, I tried to recreate xlsx structure with all its files and subdirectories, compress them into a zip file and set its extension to xlsx. I use GDataXML parser/writer for creating ... | 11,116,875 | 4 | 0 | null | 2012-06-18 11:54:51.083 UTC | 22 | 2022-03-10 12:26:00.633 UTC | 2012-06-18 12:51:03.07 UTC | null | 293,317 | null | 293,317 | null | 1 | 53 | xml|zip|xlsx | 44,555 | <p>In answer to your questions:</p>
<ol>
<li>XLSX is just a collection of XML files in a zip container. There is no other magic.</li>
<li>If you decompress/unzip a valid XLSX files and then recompress/zip it and you can't read the resulting output then the problem is generally with the files being rezipped or, less lik... |
10,894,122 | Java regex for support Unicode? | <p>To match A to Z, we will use regex:</p>
<blockquote>
<p>[A-Za-z]</p>
</blockquote>
<p>How to allow regex to match utf8 characters entered by user? For example Chinese words like 环保部</p> | 10,894,689 | 4 | 1 | null | 2012-06-05 08:42:49.423 UTC | 27 | 2020-03-09 08:30:32.923 UTC | 2012-06-05 09:50:09.97 UTC | null | 1,136,195 | null | 108,869 | null | 1 | 89 | java|regex|unicode|cjk | 83,731 | <p>What you are looking for are Unicode properties.</p>
<p>e.g. <code>\p{L}</code> is any kind of letter from any language</p>
<p>So a regex to match such a Chinese word could be something like</p>
<pre><code>\p{L}+
</code></pre>
<p>There are many such properties, for more details see <a href="http://www.regular-ex... |
11,170,827 | How do I tell a Python script to use a particular version | <p>How do I, in the main.py module (presumably), tell Python which interpreter to use? What I mean is: if I want a particular script to use version 3 of Python to interpret the entire program, how do I do that?</p>
<p>Bonus: How would this affect a virtualenv? Am I right in thinking that if I create a virtualenv for m... | 11,171,390 | 8 | 0 | null | 2012-06-23 15:46:23.33 UTC | 17 | 2022-03-31 08:29:40.007 UTC | 2017-01-20 17:26:38.007 UTC | null | 63,550 | null | 508,385 | null | 1 | 99 | python|version|virtualenv | 235,798 | <p>You can add a shebang line the to the top of the script:</p>
<pre class="lang-sh prettyprint-override"><code>#!/usr/bin/env python2.7
</code></pre>
<p>But that will only work when executing as <code>./my_program.py</code>.</p>
<p>If you execute as <code>python my_program.py</code>, then the whatever Python versio... |
12,762,272 | android CountDownTimer - additional milliseconds delay between ticks | <p>From my observation the android CountDownTimer countDownInterval between ticks happens to be not accurate, the countDownInterval is regularly a few milliseconds longer than specified. The countDownInterval in my specific app is 1000ms, just counting down a certain amount of time with one second steps. </p>
<p>Due t... | 12,762,416 | 6 | 0 | null | 2012-10-06 17:47:13.037 UTC | 12 | 2019-08-18 14:07:14.353 UTC | null | null | null | null | 1,621,859 | null | 1 | 9 | android | 14,398 | <p><strong>Rewrite</strong></p>
<p>As you said, you also noticed that the next time in <code>onTick()</code> is calculated from the time the previous <code>onTick()</code> ran, which introduces a tiny error on <em>every</em> tick. I changed the CountDownTimer source code to call each <code>onTick()</code> at the speci... |
12,809,971 | Quick Print HTML5 Canvas | <p>I want to send/print the canvas image directly to the default printer. That means a quick printing. </p>
<p>Anyone can give a hint.</p>
<p>Javascript or jQuery. </p> | 17,061,022 | 5 | 2 | null | 2012-10-09 23:41:35.247 UTC | 5 | 2022-03-30 18:03:50.68 UTC | null | null | null | null | 855,185 | null | 1 | 11 | javascript|jquery|html|canvas | 44,503 | <p>I have searched alot and found a solution which works perfectly :)
Used <strong>onclick</strong> event</p>
<pre><code>function printCanvas()
{
var dataUrl = document.getElementById('anycanvas').toDataURL(); //attempt to save base64 string to server using this var
var windowContent = '<!DOCTYPE html... |
12,997,635 | Object passed as parameter to another class, by value or reference? | <p>In C#, I know that by default, any parameters passed into a function would be by copy, that's, within the function, there is a local copy of the parameter. But, what about when an object is passed as parameter to another class? </p>
<p>Would a scenario like the following one be passed by reference or by value:</p>
... | 12,997,745 | 7 | 1 | null | 2012-10-21 12:04:49.293 UTC | 3 | 2021-05-06 16:57:30.073 UTC | null | null | null | null | 750,511 | null | 1 | 24 | c#|pass-by-reference | 148,486 | <p>Objects will be passed by reference irrespective of within methods of same class or another class. Here is a modified version of same sample code to help you understand. The value will be changed to 'xyz.'</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
us... |
12,997,645 | What operator is <> in VBA | <p>I was studying some <a href="/questions/tagged/vba" class="post-tag" title="show questions tagged 'vba'" rel="tag">vba</a> code and came across this: </p>
<pre><code>If DblBalance <> 0 Then
</code></pre>
<p>I can't figure out what operator this is, any help would be appreciated.</p> | 12,997,654 | 7 | 0 | null | 2012-10-21 12:05:22.537 UTC | 6 | 2018-04-02 18:17:42.497 UTC | 2018-04-02 18:17:42.497 UTC | null | 8,112,776 | null | 823,528 | null | 1 | 25 | vba|operators | 206,119 | <p>It is the "not equal" operator, i.e. the equivalent of <code>!=</code> in pretty much every other language.</p> |
12,837,682 | non-breaking utf-8 0xc2a0 space and preg_replace strange behaviour | <p>In my string I have utf-8 non-breaking space (0xc2a0) and I want to replace it with something else.</p>
<p>When I use</p>
<pre><code>$str=preg_replace('~\xc2\xa0~', 'X', $str);
</code></pre>
<p>it works OK.</p>
<p>But when I use</p>
<pre><code>$str=preg_replace('~\x{C2A0}~siu', 'W', $str);
</code></pre>
<p>non... | 12,838,189 | 5 | 1 | null | 2012-10-11 10:38:07.46 UTC | 14 | 2018-09-10 11:48:19.917 UTC | 2012-10-11 11:00:54.377 UTC | null | 626,273 | null | 1,137,546 | null | 1 | 36 | php|regex | 28,748 | <p>Actually the documentation about escape sequences in PHP is wrong. When you use <code>\xc2\xa0</code> syntax, it searches for UTF-8 character. But with <code>\x{c2a0}</code> syntax, it tries to convert the Unicode sequence to UTF-8 encoded character.</p>
<p>A non breaking space is <code>U+00A0</code> (Unicode) but ... |
12,857,604 | Python - How to check if Redis server is available | <p>I'm developing a Python Service(Class) for accessing Redis Server. I want to know how to check if Redis Server is running or not. And also if somehow I'm not able to connect to it.</p>
<p>Here is a part of my code</p>
<pre><code>import redis
rs = redis.Redis("localhost")
print rs
</code></pre>
<p>It prints the fo... | 12,968,704 | 7 | 2 | null | 2012-10-12 10:59:52.303 UTC | 9 | 2021-07-21 17:00:18.8 UTC | null | null | null | null | 1,655,450 | null | 1 | 44 | python|redis | 82,042 | <p>The official way to check if redis server availability is ping ( <a href="http://redis.io/topics/quickstart" rel="noreferrer">http://redis.io/topics/quickstart</a> ).</p>
<p>One solution is to subclass redis and do 2 things:</p>
<ol>
<li>check for a connection at instantiation</li>
<li>write an exception handler i... |
13,052,857 | Comparing two lists using the greater than or less than operator | <p>I noticed a piece of code recently directly comparing two lists of integers like so:</p>
<pre><code>a = [10,3,5, ...]
b = [5,4,3, ...,]
if a > b:
...
</code></pre>
<p>which seemed a bit peculiar, but I imagined it would return <code>True</code> if all of <code>list_a</code>'s elements are larger then <code... | 13,052,908 | 3 | 0 | null | 2012-10-24 15:51:55.657 UTC | 13 | 2021-09-25 00:47:59.43 UTC | null | null | null | null | 396,300 | null | 1 | 52 | python|list | 40,006 | <p>From <a href="http://docs.python.org/tutorial/datastructures.html#comparing-sequences-and-other-types" rel="noreferrer">Comparing Sequences and Other Types</a> in the Python tutorial:</p>
<blockquote>
<p>The comparison uses lexicographical ordering: first the first two items are compared, and if they differ this ... |
16,712,413 | An error when creating new project in android studio | <p><strong>Every time I create new project i get this error:</strong></p>
<pre><code>Failed to import new Gradle project: Could not fetch model of type 'IdeaProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
Unable to start the daemon process.
This problem might be caused... | 19,469,594 | 12 | 2 | null | 2013-05-23 11:10:41.537 UTC | 9 | 2016-09-22 23:21:10 UTC | 2013-07-22 21:34:17.573 UTC | null | 1,373,278 | null | 2,281,822 | null | 1 | 22 | android|gradle|android-studio | 43,997 | <p>Start Android Studio, close any open project.</p>
<p>On the right side, click on Configure -> Settings.</p>
<p>On the left side, in Compiler->Gradle set VM Options to "-Xmx512m" (without quotes)</p>
<p>Press OK, then create a project. Worked for me.</p> |
16,721,051 | Multi-tenant Django applications: altering database connection per request? | <p>I'm looking for working code and ideas from others who have tried to build a multi-tenant Django application using database-level isolation.</p>
<p><strong>Update/Solution:</strong> I ended solving this in a new opensource project: see <a href="https://github.com/mik3y/django-db-multitenant">django-db-multitenant</... | 17,600,266 | 3 | 6 | null | 2013-05-23 18:13:24.08 UTC | 21 | 2019-02-27 00:32:44.493 UTC | 2013-12-02 07:13:00.67 UTC | null | 642,485 | null | 642,485 | null | 1 | 33 | mysql|django|multi-tenant | 7,892 | <p>For the record, I chose to implement a variation of my first idea: issue a <code>USE <dbname></code> in an early request middleware. I also set the CACHE prefix the same way.</p>
<p>I'm using it on a small production site, looking up the tenant name from a Redis database based on the request host. So far, I'... |
16,678,927 | Is MemoryCache scope session or application wide? | <p>I'm using <code>MemoryCache</code> in ASP.NET and it is working well. I have an object that is cached for an hour to prevent fresh pulls of data from the repository.</p>
<p>I can see the caching working in debug, but also once deployed to the server, after the 1st call is made and the object is cached subsequent ca... | 16,689,455 | 2 | 1 | null | 2013-05-21 20:28:01.66 UTC | 20 | 2018-08-24 00:00:40.163 UTC | 2013-05-21 21:02:36.803 UTC | null | 76,337 | null | 410,937 | null | 1 | 55 | asp.net|caching|memorycache | 37,679 | <p>From <a href="http://msdn.microsoft.com/en-us/library/system.runtime.caching.memorycache.aspx">MSDN</a>:</p>
<blockquote>
<p>The main differences between the Cache and MemoryCache classes are
that the MemoryCache class has been changed to make it usable by .NET
Framework applications that are not ASP.NET appl... |
16,958,448 | What is http multipart request? | <p>I have been writing iPhone applications for some time now, sending data to server, receiving data (via HTTP protocol), without thinking too much about it. Mostly I am theoretically familiar with process, but the part I am not so familiar is HTTP multipart request. I know its basic structure, but the core of it elude... | 19,712,083 | 3 | 1 | null | 2013-06-06 09:28:21.703 UTC | 138 | 2022-03-02 16:27:26.45 UTC | 2016-02-04 14:07:19.533 UTC | null | 1,788,160 | null | 744,270 | null | 1 | 419 | http-headers|multipart | 402,441 | <p>An HTTP multipart request is an HTTP request that HTTP clients construct to send files and data over to an HTTP Server. It is commonly used by browsers and HTTP clients to upload files to the server.</p>
<ul>
<li><a href="https://stackoverflow.com/questions/913626/what-should-a-multipart-http-request-with-multiple-f... |
4,480,485 | ASP.net MVC Controller - Constructor usage | <p>I'm working on an ASP.net MVC application and I have a question about using constructors for my controllers. </p>
<p>I'm using Entity Framework and linq to Entities for all of my data transactions. I need to access my Entity model for nearly all of my controller actions. When I first started writing the app I was c... | 4,480,604 | 2 | 2 | null | 2010-12-18 22:25:15.11 UTC | 23 | 2019-10-04 09:57:41.763 UTC | 2019-10-04 09:57:25.41 UTC | null | 133 | null | 468,302 | null | 1 | 37 | asp.net-mvc|asp.net-mvc-2|c#-4.0|constructor | 46,820 | <p>You are asking the right questions.</p>
<p>A. It is definitely not appropriate to create this dependencies inside each action method. One of the main features of MVC is the ability to separate concerns. By loading up your controller with these dependencies, you are making the controller for thick. These should be i... |
70,344,098 | Data path "" must NOT have additional properties(extractCss) in Angular 13 while upgrading project | <p>I am facing an issue while upgrading my project from angular 8.2.1 to angular 13 version.</p>
<p>After a successful upgrade while preparing a build it is giving me the following error.</p>
<pre><code>Data path "" must NOT have additional properties(extractCss).
</code></pre>
<p>I already renamed <code>styl... | 70,349,043 | 1 | 4 | null | 2021-12-14 05:15:32.3 UTC | 2 | 2022-01-27 14:41:47.027 UTC | 2022-01-27 14:41:47.027 UTC | null | 4,786,273 | null | 8,805,085 | null | 1 | 33 | angular|angular-upgrade|angular13 | 13,420 | <p>Just remove the <code>"extractCss": true</code> from your production environment, it will resolve the problem.</p>
<p>The reason about it is extractCss is deprecated, and it's value is true by default.
See more here: <a href="https://stackoverflow.com/questions/67209871/extracting-css-into-js-with-angular-... |
9,881,227 | spring multipart file upload form validation | <p>I'm new to spring, and i'm currently struggling with the many pieces required to get a multipart form submit/validation scenario with error beeing displayed in the view.</p>
<p>Here are the files i currently have :</p>
<p>resourceupload.jsp : a view that displays a form to upload the file.</p>
<pre><code><for... | 9,889,452 | 4 | 0 | null | 2012-03-26 23:11:31.78 UTC | 2 | 2017-01-20 16:51:46.047 UTC | 2012-05-17 13:40:13.487 UTC | null | 21,234 | null | 194,470 | null | 1 | 5 | validation|spring-mvc|multipartform-data | 40,157 | <p>Seems like I found the solution on my own.</p>
<p>First, the link that helped me a lot : <a href="http://www.ioncannon.net/programming/975/spring-3-file-upload-example/" rel="nofollow noreferrer">http://www.ioncannon.net/programming/975/spring-3-file-upload-example/</a>
and
<a href="https://stackoverflow.com/questi... |
9,721,161 | Microsoft Interop: Excel Column Names | <p>I am using Microsoft Interop to read the data.</p>
<p>In excel-sheet the column-names are like A,B,C,D,....,AA,AB,.... and so on. Is there any way to read this column-names?</p>
<p>If you need any other info please let me know.</p>
<p>Regards,
Priyank</p> | 9,721,691 | 2 | 6 | null | 2012-03-15 13:53:57.613 UTC | null | 2013-08-14 11:49:00.797 UTC | null | null | null | null | 1,060,026 | null | 1 | 10 | c#|office-interop|excel-interop | 40,602 | <pre><code> Excel.Application xlApp = new Excel.Application();
Excel.Workbook xlWorkbook = xlApp.Workbooks.Open("workbookname");
Excel.Worksheet xlWorksheet = xlWorkbook.Sheets[1]; // assume it is the first sheet
int columnCount = xlWorksheet.UsedRange.Columns.Count;
List<string> columnNam... |
9,921,548 | SSLSocketFactory in java | <p>What role does <code>SSLSocketFactory</code> class in java play when using <code>HttpsURLConnection</code>? The java docs is not of much help. </p>
<p>Are there any ways to bind the keystore and the truststore to with the sslsocketfactory object, to make it point to the keystore and the truststore?</p>
<p>Otherwis... | 9,921,818 | 1 | 0 | null | 2012-03-29 08:16:48.747 UTC | 7 | 2016-08-06 00:10:05.683 UTC | 2016-08-06 00:10:05.683 UTC | null | 2,913,306 | null | 1,139,023 | null | 1 | 13 | java|ssl|https | 43,863 | <p>It is done through SSLContext. You init one and then use it's socket factory to create HttpsConnection instances.</p>
<p>Here is rough example of how I manage this in my application:</p>
<pre><code>SSLContext sc = SSLContext.getInstance("SSL");
sc.init(myKeyManagerFactory.getKeyManagers(), myTrustManagerArray, new... |
9,729,691 | An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module | <p>I am developing a c# application and I get the following error at debug runtime:</p>
<blockquote>
<p>An unhandled exception of type 'System.IO.FileNotFoundException'
occurred in Unknown Module.</p>
<p>Additional information: Could not load file or assembly
'Autodesk.Navisworks.Timeliner.dll' or one of it... | 9,729,835 | 6 | 0 | null | 2012-03-15 23:23:19.093 UTC | 4 | 2021-08-29 02:49:55.713 UTC | null | null | null | null | 1,261,829 | null | 1 | 14 | c#|exception|runtime | 141,679 | <p>First check - is the working directory the directory that the application is running in:</p>
<ul>
<li>Right-click on your project and select Properties.</li>
<li>Click the Debug tab.</li>
<li>Confirm that the Working directory is either empty or equal to the bin\debug directory.</li>
</ul>
<p>If this isn't the pro... |
10,066,364 | array_walk an anonymous function | <p>Is there a way I can get this array walk with my anonymous function to set the values?</p>
<pre><code>$url = array('dog', 'cat', 'fish');
array_walk($url, function(&$value, &$key) {
$url[$key] = str_replace('dog', '', $value);
});
echo '<pre>';
print_r($url);
echo '</pre>';
</code></pre> | 10,066,381 | 1 | 0 | null | 2012-04-08 20:47:02.357 UTC | 3 | 2012-04-08 20:48:46.16 UTC | null | null | null | null | 216,909 | null | 1 | 32 | php | 24,876 | <p>You are already <a href="http://php.net/manual/en/language.references.pass.php">passing the value by reference</a>, so just do the following:</p>
<pre><code>array_walk($url, function(&$value, &$key) {
$value = str_replace('dog', '', $value);
});
</code></pre> |
9,736,202 | Read tab-separated file line into array | <p>I would like to read a file into a script, line by line. Each line in the file is multiple values separated by a tab, I'd like to read each line into an array. </p>
<p>Typical bash "read file by line" example;</p>
<pre><code>while read line
do
echo $line;
done < "myfile"
</code></pre>
<p>For me though, myfile ... | 9,736,732 | 3 | 0 | null | 2012-03-16 11:10:12.493 UTC | 34 | 2018-11-12 23:18:31.347 UTC | 2018-11-12 23:18:31.347 UTC | null | 6,862,601 | null | 560,065 | null | 1 | 81 | arrays|bash | 131,933 | <p>You're very close:</p>
<pre><code>while IFS=$'\t' read -r -a myArray
do
echo "${myArray[0]}"
echo "${myArray[1]}"
echo "${myArray[2]}"
done < myfile
</code></pre>
<p>(The <code>-r</code> tells <code>read</code> that <code>\</code> isn't special in the input data; the <code>-a myArray</code> tells it to split... |
8,328,908 | javascript surprising array comparison | <p>I'm trying to compare two arrays in javascript.</p>
<p>What I'd like is: </p>
<blockquote>
<p>a < b ⇔ ∃ i ≥ 0 s.t. a[i] < b[i] and ∀ 0 ≤ j < i, a[j] = b[j]</p>
</blockquote>
<p>So arrays of non-negative numbers work as desired:</p>
<pre><code>firebug> [0,1,2,3,4] < [1,0,0]... | 8,329,014 | 3 | 2 | null | 2011-11-30 15:58:12.39 UTC | 5 | 2015-06-23 14:47:05.95 UTC | null | null | null | null | 9,859 | null | 1 | 29 | javascript|arrays|comparison | 6,016 | <p>The array is converted to a string, which comes down to <code>.join()</code>, which in turn joins the elements with a comma (<code>,</code>) as delimiter.</p>
<pre><code>"-1,1" < "0,0" === true
</code></pre>
<p>because the <em>character code</em> of <code>-</code> (45) is smaller than the <em>character code</em... |
11,959,841 | How to place an imageview on top of another imageview in android | <p>This is my layout which i tried so far without any success</p>
<pre><code><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white">
<LinearLayout
... | 11,959,915 | 7 | 2 | null | 2012-08-14 19:59:45.867 UTC | 4 | 2019-10-25 14:26:37.817 UTC | null | null | null | null | 609,387 | null | 1 | 23 | android|android-layout|imageview | 63,922 | <pre><code> <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white" >
<ImageView
android:id="@+id/inside_imageview"
android:layout_width="w... |
11,867,538 | How can I use Python to transform MongoDB's bsondump into JSON? | <p>So I have an enormous quantity of .bson from a MongoDB dump. I am using <a href="http://docs.mongodb.org/manual/reference/bsondump/">bsondump</a> on the command line, piping the output as stdin to python. This successfully converts from BSON to 'JSON' but it is in fact a string, and seemingly not legal JSON.</p>
<p... | 11,886,476 | 4 | 6 | null | 2012-08-08 15:07:37.717 UTC | 12 | 2019-07-04 14:11:51.457 UTC | 2012-08-08 17:59:29.97 UTC | null | 1,283,745 | null | 1,283,745 | null | 1 | 25 | python|json|mongodb|bson | 23,320 | <p>What you have is a dump in Mongo Extended JSON in TenGen mode (see <a href="http://www.mongodb.org/display/DOCS/Mongo+Extended+JSON">here</a>). Some possible ways to go:</p>
<ol>
<li><p>If you can dump again, use Strict output mode through the MongoDB REST API. That should give you real JSON instead of what you hav... |
11,608,238 | Is it possible to add a where clause with list comprehension? | <p>Consider the following list comprehension</p>
<pre><code>[ (x,f(x)) for x in iterable if f(x) ]
</code></pre>
<p>This filters the iterable based a condition <code>f</code> and returns the pairs of <code>x,f(x)</code>. The problem with this approach is <code>f(x)</code> is calculated twice.
It would be great if we ... | 11,608,419 | 4 | 8 | null | 2012-07-23 07:40:21.643 UTC | 3 | 2018-12-13 20:02:58.86 UTC | 2018-12-13 20:02:58.86 UTC | null | 463,758 | null | 463,758 | null | 1 | 28 | python|python-3.x|list-comprehension|python-assignment-expression|python-3.8 | 21,328 | <p>You seek to have <code>let</code>-statement semantics in python list comprehensions, whose scope is available to both the <code>___ for..in</code>(map) and the <code>if ___</code>(filter) part of the comprehension, and whose scope depends on the <code>..for ___ in...</code>.</p>
<hr>
<p><strong>Your solution, modi... |
11,691,775 | Why my App is not showing up on tablets in Google Play? | <p>I just released my app for phones and tablets but it is not showing up in Google Play for tablets.</p>
<p>Checked on Nexus 7 and Asus eeeePad</p>
<p>This is what I have in my manifest file</p>
<pre><code><compatible-screens>
<!--no small size screens -->
<!--Only hdpi and xhdpi for normal ... | 11,745,425 | 7 | 5 | null | 2012-07-27 16:19:37.793 UTC | 17 | 2016-09-02 05:32:15.193 UTC | 2014-09-29 11:01:21.033 UTC | null | 1,649,309 | null | 1,522,067 | null | 1 | 39 | android|tablet|google-play | 39,363 | <p>At last adding a special case for Nexus 7 with in <code><compatible-screens></code> tag worked for me. As Nexus 7 has tvdpi density</p>
<pre><code><compatible-screens>
<!--no small size screens -->
<!--all normal size screens -->
<screen android:screenSize="normal" android:... |
11,965,524 | How to make a regex match case insensitive? | <p>I have following regular expression for <a href="http://en.wikipedia.org/wiki/Postal_codes_in_Canada" rel="noreferrer">postal code of Canada</a>. </p>
<pre><code>^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$
</code></pre>
<p>It is working fine but accepts only Capital letters. I want it work for both ... | 11,965,836 | 1 | 7 | null | 2012-08-15 07:27:52.657 UTC | 5 | 2017-04-26 14:16:16.057 UTC | 2012-08-15 08:00:43.367 UTC | null | 626,273 | null | 1,512,393 | null | 1 | 53 | c#|.net|regex | 67,893 | <p>Just use the option <code>IgnoreCase</code>, see <a href="http://msdn.microsoft.com/en-us/library/yd1hzczs.aspx">.NET regular Expression Options</a></p>
<p>So your regex creation could look like this</p>
<pre><code>Regex r = new Regex(@"^[ABCEGHJKLMNPRSTVXY]\d[A-Z] *\d[A-Z]\d$", RegexOptions.IgnoreCase);
</code></... |
11,883,534 | How to dismiss notification after action has been clicked | <p>Since API level 16 (Jelly Bean), there is the possibility to add actions to a notification with</p>
<pre><code>builder.addAction(iconId, title, intent);
</code></pre>
<p>But when I add an action to a notification and the action is pressed, the notification is not going to be dismissed.
When the notification itself... | 11,884,313 | 10 | 0 | null | 2012-08-09 12:32:08.467 UTC | 32 | 2022-04-08 10:45:54.163 UTC | 2016-09-19 14:32:23.77 UTC | null | 1,276,636 | null | 760,668 | null | 1 | 173 | android|action|android-notifications | 128,742 | <p>When you called notify on the notification manager you gave it an id - that is the unique id you can use to access it later (this is from the notification manager:</p>
<pre><code>notify(int id, Notification notification)
</code></pre>
<p>To cancel, you would call:</p>
<pre><code>cancel(int id)
</code></pre>
<p>w... |
3,936,088 | MySQL: Split comma separated list into multiple rows | <p>I have an unnormalized table with a column containing a comma separated list that is a foreign key to another table:</p>
<pre><code>+----------+-------------+ +--------------+-------+
| part_id | material | | material_id | name |
+----------+-------------+ +--------------+-------+
| 339 | 1.2mm;1.6... | 22,375,303 | 4 | 1 | null | 2010-10-14 17:58:39.43 UTC | 5 | 2019-06-08 00:16:42.58 UTC | 2019-06-08 00:16:42.58 UTC | null | 42,223 | null | 476,074 | null | 1 | 19 | mysql|sql|delimiter|csv | 56,633 | <p>In MySQL this can be achieved as below </p>
<pre><code>SELECT id, length FROM vehicles WHERE id IN ( 117, 148, 126)
+---------------+
| id | length |
+---------------+
| 117 | 25 |
| 126 | 8 |
| 148 | 10 |
+---------------+
SELECT id,vehicle_ids FROM load_plan_configs WHERE load_plan_configs.... |
3,340,342 | Writing to the real STDOUT after System.setOut | <p>I'm trying to intercept System.out and System.err, but maintain the ability to write to the original streams directly when necessary.</p>
<pre><code>PrintStream ps = System.out;
System.setOut(new MyMagicPrintStream());
ps.println("foo");
</code></pre>
<p>Unfortunately, the details of the System class' implementati... | 3,340,416 | 4 | 0 | null | 2010-07-27 02:18:29.197 UTC | 10 | 2019-12-27 21:21:06.867 UTC | 2019-12-27 21:21:06.867 UTC | null | 1,429,432 | null | 293,358 | null | 1 | 27 | java | 21,512 | <p>try this:</p>
<pre><code>PrintStream ps = new PrintStream(new FileOutputStream(FileDescriptor.out))
</code></pre> |
3,468,102 | Regex word boundary expressions | <p>Say for example I have the following string <code>"one two(three) (three) four five"</code> and I want to replace <code>"(three)"</code> with <code>"(four)"</code> but not within words. How would I do it?</p>
<p>Basically I want to do a regex replace and end up with the following string:</p>
<pre><code>"one two(th... | 3,468,269 | 4 | 1 | null | 2010-08-12 13:25:35.967 UTC | 6 | 2014-02-05 21:39:44.81 UTC | 2010-08-12 13:32:44.767 UTC | null | 418,455 | null | 418,455 | null | 1 | 32 | c#|regex | 39,179 | <p>Your problem stems from a misunderstanding of what <code>\b</code> actually means. Admittedly, it is not obvious.</p>
<p>The reason <code>\b\(three\)\b</code> doesn’t match the threes in your input string is the following:</p>
<ul>
<li><code>\b</code> means: the boundary between a <em>word character</em> and a <em... |
3,342,319 | How do I use T-SQL's Case/When? | <p>I have a huge query which uses <em>case/when</em> often. Now I have this SQL here, which does not work.</p>
<pre><code> (select case when xyz.something = 1
then
'SOMETEXT'
else
(select case when xyz.somethingelse = 1)
then
'SOMEOTHERTEXT'
end)
(select case when xyz.somethi... | 3,342,349 | 4 | 0 | null | 2010-07-27 09:40:59.427 UTC | 9 | 2019-01-28 09:44:36.297 UTC | 2013-03-06 17:43:55.51 UTC | null | 5,640 | null | 304,357 | null | 1 | 51 | tsql|case-when | 130,543 | <pre><code>SELECT
CASE
WHEN xyz.something = 1 THEN 'SOMETEXT'
WHEN xyz.somethingelse = 1 THEN 'SOMEOTHERTEXT'
WHEN xyz.somethingelseagain = 2 THEN 'SOMEOTHERTEXTGOESHERE'
ELSE 'SOMETHING UNKNOWN'
END AS ColumnName;
</code></pre> |
3,720,222 | Using Statement with Generics: using ISet<> = System.Collections.Generic.ISet<> | <p>Since I am using two different generic collection namespaces (<code>System.Collections.Generic</code> and <code>Iesi.Collections.Generic</code>), I have conflicts. In other parts of the project, I am using both the nunit and mstest framework, but qualify that when I call <code>Assert</code> I want to use the nunit ... | 3,720,263 | 6 | 5 | null | 2010-09-15 17:40:56.077 UTC | 4 | 2020-04-09 10:02:28.473 UTC | 2013-03-16 14:43:59.123 UTC | null | 445,517 | null | 128,968 | null | 1 | 48 | c#|generics|syntax|alias|using | 8,234 | <p>I think you're better off aliasing the namespaces themselves as opposed to the generic types (which I don't think is possible).</p>
<p>So for instance:</p>
<pre><code>using S = System.Collections.Generic;
using I = Iesi.Collections.Generic;
</code></pre>
<p>Then for a BCL <code>ISet<int></code>, for example... |
3,389,620 | How to fix Subversion «!» status | <p>The Subversion manual states:</p>
<blockquote>
<p>'!'</p>
<p>Item is missing (e.g. you moved or
deleted it without using svn). This
also indicates that a directory is
incomplete (a checkout or update was
interrupted).</p>
</blockquote>
<p>But as so often with Subversion, there is no indication on how to fix the prob... | 3,389,731 | 6 | 2 | null | 2010-08-02 16:16:24.157 UTC | 12 | 2020-06-29 11:05:05.773 UTC | 2020-06-29 11:05:05.773 UTC | null | 9,802 | null | 341,091 | null | 1 | 65 | svn | 60,431 | <pre><code>svn revert /path/to/file
svn rm /path/to/file # if you want to delete it from svn itself
</code></pre>
<p>Golden rule is: once something is under svn-control, any moving, deleting, renaming, should be done with svn commands (svn mv, svn rm, etc.), not using normal filesystem/file-explorer functions.</p... |
3,601,273 | HTML5 and frameborder | <p>I have an iframe on an HTML5 document. when I validate I am getting an error telling me that the attribute on the <code>iframe frameBorder</code> is obsolete and to use CSS instead.</p>
<p>I have this attribute <strong><code>frameBorder="0"</code></strong> here because it was the only way I could figure out how to ... | 3,601,946 | 6 | 0 | null | 2010-08-30 14:30:02.56 UTC | 8 | 2019-12-11 08:05:28.307 UTC | 2015-03-01 03:40:18.897 UTC | null | 1,696,030 | null | 46,011 | null | 1 | 92 | css|internet-explorer|html | 126,354 | <blockquote>
<p><s>HTML 5 doesn't support attributes such as frameborder, scrolling, marginwidth, and marginheight (which were supported in HTML 4.01). Instead, the HTML 5 specification has introduced the seamless attribute. The seamless attribute allows the inline frame to appear as though it is being rendered as par... |
3,925,183 | Method to Find GridView Column Index by Name | <p>I'm trying to write a small method to loop through and find a <code>GridView</code> Column by its Index, since it can change position based on what might be visible.</p>
<p>Here is what I have so far: </p>
<pre><code>private int GetColumnIndexByName(GridView grid, string name)
{
foreach (DataColumn col in grid... | 3,925,334 | 7 | 0 | null | 2010-10-13 15:13:32.7 UTC | 6 | 2018-12-16 16:27:46.497 UTC | 2016-03-29 11:23:20.147 UTC | null | 1,735,406 | null | 398,222 | null | 1 | 21 | c#|asp.net | 71,679 | <p>I figured it out, I needed to be using <code>DataControlField</code> and slightly different syntax.</p>
<p>The working version:</p>
<pre><code>private int GetColumnIndexByName(GridView grid, string name)
{
foreach (DataControlField col in grid.Columns)
{
if (col.HeaderText.ToLower()... |
3,964,681 | Find all files in a directory with extension .txt in Python | <p>How can I find all the files in a directory having the extension <code>.txt</code> in python?</p> | 3,964,691 | 25 | 0 | null | 2010-10-19 01:09:13.617 UTC | 587 | 2021-11-11 13:54:18.347 UTC | 2017-04-12 15:56:53.207 UTC | null | 5,097,722 | null | 201,140 | null | 1 | 1,041 | python|file-io | 2,519,920 | <p>You can use <a href="https://docs.python.org/2/library/glob.html" rel="noreferrer"><code>glob</code></a>:</p>
<pre><code>import glob, os
os.chdir("/mydir")
for file in glob.glob("*.txt"):
print(file)
</code></pre>
<p>or simply <a href="https://docs.python.org/2/library/os.html#os.listdir" rel="noreferrer"><cod... |
8,268,154 | Run ruby script in elevated mode | <p>I need to run a ruby script in elevated mode (Admin priviledges) under Windows. Is it possible?</p> | 8,336,031 | 4 | 2 | null | 2011-11-25 11:04:06.777 UTC | 8 | 2021-01-10 02:57:22.04 UTC | null | null | null | null | 19,224 | null | 1 | 8 | ruby|windows | 4,881 | <p>Here's how to do it. The easiest way is to restart your executable with elevaded (Admin) privileges using <code>ShellExecute</code>.</p>
<p>With Ruby you do it like this:</p>
<pre><code>require 'win32ole'
shell = WIN32OLE.new('Shell.Application')
shell.ShellExecute('path_to_ruby_program', nil, nil, 'runas')
</code>... |
7,839,642 | int to String in Android | <p>I get the id of resource like so:</p>
<pre><code>int test = (context.getResourceId("raw.testc3"));
</code></pre>
<p>I want to get it's id and put it into a string. How can I do this? .toString does not work.</p> | 7,839,678 | 4 | 0 | null | 2011-10-20 17:16:13.007 UTC | 6 | 2020-01-31 11:22:48.777 UTC | 2015-12-05 13:20:33.537 UTC | null | 196,919 | null | 956,868 | null | 1 | 58 | android|string | 88,520 | <pre><code>String testString = Integer.toString(test);
</code></pre> |
8,014,500 | MacOSX: autostart mysql on boot | <p>I just installed mysql in terminal through homebrew.</p>
<p>Now when I try to connect to mysql it fails, but after I run <code>mysqld</code> it works.. </p>
<p>So what I need to do now is run mysqld when I boot my Mac.</p>
<p>I've searched Google for <code>mysqld autoload at startup</code> etc. but couldn't find ... | 8,085,693 | 7 | 0 | null | 2011-11-04 19:05:57.59 UTC | 11 | 2018-05-10 20:17:57.913 UTC | 2016-10-27 12:09:40.147 UTC | null | 147,562 | null | 540,447 | null | 1 | 45 | macos|terminal|homebrew|mysql | 36,147 | <p><code>brew info mysql</code> gives you the instructions for loading MySQL at startup, but here's all you need to do:</p>
<pre><code>mkdir -p ~/Library/LaunchAgents
cp `brew --prefix mysql`/*mysql*.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/*mysql*.plist
</code></pre> |
8,273,823 | How can I discard modified files? | <p>This is a Linux 2.6 kernel repository. I git clone it to my local host.</p>
<p>After that. I didn't make any change. But when I "git status". I found 13 modified files. I want to discard them, but I can't.</p>
<pre><code>> luke@Macbook-Pro~/Documents/workspace/linuxkernel/linux-2.6$ git
> status
> # On br... | 8,273,847 | 10 | 4 | null | 2011-11-25 20:16:54.84 UTC | 11 | 2020-06-09 02:20:33.523 UTC | 2012-06-01 17:17:42.743 UTC | null | 229,044 | null | 845,081 | null | 1 | 49 | git | 108,655 | <p>A <code>git reset --hard HEAD</code> should solve the problem.</p> |
7,771,586 | How to check what user php is running as? | <p>I need to detect if php is running as nobody. How do I do this? </p>
<p>Are there any other names for "nobody"? "apache"? Any others?</p> | 7,771,662 | 16 | 6 | null | 2011-10-14 17:56:31.37 UTC | 29 | 2022-05-09 14:24:02.877 UTC | 2012-07-26 05:06:29.543 UTC | null | 168,868 | user429620 | null | null | 1 | 137 | php|apache | 199,425 | <p>If available you can probe the current user account with <a href="http://php.net/posix_geteuid" rel="noreferrer"><code>posix_geteuid</code></a> and then get the user name with <a href="http://php.net/posix_getpwuid" rel="noreferrer"><code>posix_getpwuid</code></a>.</p>
<pre><code>$username = posix_getpwuid(posix_g... |
4,071,811 | How to transform vertical data into horizontal data with SQL? | <p>I have a table "Item" with a number of related items, like so:</p>
<pre><code>ID Rel_ID Name RelRank
--- ------ ---- -------
1 1 foo 1
2 1 bar 2
3 1 zam 3
4 2 foo2 1
</code></pre>
<p>I'm trying to get a query so items with the same Rel_ID would appear in the same r... | 4,071,845 | 3 | 5 | null | 2010-11-01 18:19:05.02 UTC | 3 | 2016-09-07 13:44:47.43 UTC | 2010-11-01 18:34:10.65 UTC | null | 89,244 | null | 89,244 | null | 1 | 18 | sql|mysql|pivot | 74,971 | <p>Regardless of the database you are using, the concept of what you are trying to achieve is called "Pivot Table".</p>
<p>Here's an example for mysql:
<a href="http://en.wikibooks.org/wiki/MySQL/Pivot_table" rel="noreferrer">http://en.wikibooks.org/wiki/MySQL/Pivot_table</a></p>
<p>Some databases have builtin featur... |
4,575,326 | In Python, can I specify a function argument's default in terms of other arguments? | <p>Suppose I have a python function that takes two arguments, but I want the second arg to be optional, with the default being whatever was passed as the first argument. So, I want to do something like this:</p>
<pre><code>def myfunc(arg1, arg2=arg1):
print (arg1, arg2)
</code></pre>
<p>Except that doesn't work. ... | 4,575,371 | 3 | 2 | null | 2011-01-01 19:16:10.93 UTC | 5 | 2011-01-01 20:38:58.897 UTC | null | null | null | null | 125,921 | null | 1 | 39 | python|function|default-value|arguments | 12,339 | <p>As @Ignacio says, you can't do this. In your latter example, you might have a situation where <code>None</code> is a valid value for <code>arg2</code>. If this is the case, you can use a sentinel value:</p>
<pre><code>sentinel = object()
def myfunc(arg1, arg2=sentinel):
if arg2 is sentinel:
arg2 = arg1
... |
4,810,268 | Eclipse and Facets | <p>In the courses java, everyone (or at least most people) seemed to have a working eclipse. They always seemed to have a working faces-config (a visual one), and autocomplete in xhtml files (for facelets). Though for autocomplete, we added *.xhtml files on JSP's.</p>
<p>It seems that this was a part I don't know well... | 4,810,543 | 4 | 0 | null | 2011-01-26 21:31:53.633 UTC | 4 | 2016-11-20 18:24:06.023 UTC | null | null | null | null | 336,547 | null | 1 | 8 | eclipse|facet | 42,663 | <p>Eclipse functionality is driven by project metadata. If you don't have the right metadata, the projects aren't going to behave correctly. </p>
<p>If you are starting from scratch and creating projects in Eclipse, make sure to place all of the metadata files in your source control system (including everything under ... |
4,233,354 | How to iterate json data in jquery | <p>How to iterate the json data in jquery.</p>
<pre><code>[{"id":"856","name":"India"},
{"id":"1035","name":"Chennai"},
{"id":"1048","name":"Delhi"},
{"id":"1113","name":"Lucknow"},
{"id":"1114","name":"Bangalore"},
{"id":"1115","name":"Ahmedabad"},
{"id":"1116","name":"Cochin"},
{"id":"1117","name":"London"},
... | 4,233,367 | 4 | 0 | null | 2010-11-20 15:07:18.723 UTC | 4 | 2017-10-25 13:26:15.293 UTC | null | null | null | null | 433,904 | null | 1 | 23 | jquery|json | 57,063 | <p>You can use <a href="http://api.jquery.com/jQuery.each/" rel="noreferrer"><code>$.each()</code></a> like this:</p>
<pre><code>$.each(data, function(i, obj) {
//use obj.id and obj.name here, for example:
alert(obj.name);
});
</code></pre> |
4,435,853 | echo outputs -e parameter in bash scripts. How can I prevent this? | <p>I've read the man pages on echo, and it tells me that the -e parameter will allow an escaped character, such as an escaped n for newline, to have its special meaning. When I type the command</p>
<pre><code>$ echo -e 'foo\nbar'
</code></pre>
<p>into an interactive bash shell, I get the expected output:</p>
<pre><c... | 4,436,025 | 4 | 3 | null | 2010-12-14 04:26:24.533 UTC | 5 | 2017-03-21 01:22:26.743 UTC | null | null | null | null | 434,731 | null | 1 | 29 | bash|echo | 24,048 | <p>You need to use <code>#!/bin/bash</code> as the first line in your script. If you don't, or if you use <code>#!/bin/sh</code>, the script will be run by the Bourne shell and its <code>echo</code> doesn't recognize the <code>-e</code> option. In general, it is recommended that all new scripts use <code>printf</code> ... |
4,115,953 | Where do tabindex="0" HTML elements end up in the tabbing order? | <p>In what order are elements with a <code>tabindex</code> value of 0 focused when the web page is tabbed?</p> | 4,115,989 | 4 | 2 | null | 2010-11-07 00:39:19.093 UTC | 11 | 2018-12-26 07:16:52.523 UTC | 2010-11-07 00:58:16.487 UTC | null | 20,578 | null | 697,684 | null | 1 | 52 | html|tabindex | 66,421 | <p>The <a href="http://www.w3.org/TR/html401/interact/forms.html#tabbing-navigation" rel="noreferrer">HTML specification</a> states:</p>
<blockquote>
<p>Elements that have identical tabindex
values should be navigated in the
order they appear in the character
stream.</p>
</blockquote> |
4,230,375 | What's the easiest way to remove <fieldset> border lines? | <p>What's the easiest way to remove the <strong>border</strong> lines of a <code><fieldset></code>?</p>
<p>I mean a cross-browser solution... is that possible ?</p> | 4,230,381 | 4 | 2 | null | 2010-11-19 23:45:11.617 UTC | 3 | 2018-12-28 07:05:47 UTC | 2010-11-20 04:02:55.143 UTC | null | 333,255 | null | 257,022 | null | 1 | 68 | html|css | 86,820 | <pre><code>fieldset {
border: 0;
}
</code></pre> |
4,215,472 | Python: take max N elements from some list | <p>Is there some function which would return me the N highest elements from some list?</p>
<p>I.e. if <code>max(l)</code> returns the single highest element, sth. like <code>max(l, count=10)</code> would return me a list of the 10 highest numbers (or less if <code>l</code> is smaller).</p>
<p>Or what would be an effi... | 4,215,776 | 5 | 3 | null | 2010-11-18 13:54:56.453 UTC | 6 | 2021-10-20 08:04:53.753 UTC | null | null | null | null | 133,374 | null | 1 | 38 | python|max | 39,163 | <p><a href="http://docs.python.org/library/heapq.html#heapq.nlargest"><code>heapq.nlargest</code></a>:</p>
<pre><code>>>> import heapq, random
>>> heapq.nlargest(3, (random.gauss(0, 1) for _ in xrange(100)))
[1.9730767232998481, 1.9326532289091407, 1.7762926716966254]
</code></pre> |
4,189,365 | Use jQuery to convert JSON array to HTML bulleted list | <p>How can you convert an array of strings represented in JSON format and convert this to an HTML bulleted list using jQuery?</p> | 4,189,444 | 6 | 4 | null | 2010-11-15 22:13:31.33 UTC | 2 | 2019-05-25 23:47:56.24 UTC | 2019-05-25 23:47:56.24 UTC | null | 819,651 | null | 47,281 | null | 1 | 17 | jquery|json | 61,636 | <pre><code>var ul = $('<ul>').appendTo('body');
var json = { items: ['item 1', 'item 2', 'item 3'] };
$(json.items).each(function(index, item) {
ul.append(
$(document.createElement('li')).text(item)
);
});
</code></pre>
<p>As far as fetching the JSON from your server using AJAX is concerned you c... |
4,216,123 | How to scale a BufferedImage | <p>Following the javadocs, I have tried to scale a <code>BufferedImage</code> without success here is my code:</p>
<pre><code>BufferedImage image = MatrixToImageWriter.getBufferedImage(encoded);
Graphics2D grph = image.createGraphics();
grph.scale(2.0, 2.0);
grph.dispose();
</code></pre>
<p>I can't understand why it ... | 4,216,635 | 7 | 3 | null | 2010-11-18 14:59:59.243 UTC | 29 | 2022-07-05 04:40:32.823 UTC | 2018-04-04 05:46:36.917 UTC | null | 4,283,581 | null | 52,924 | null | 1 | 56 | java|image|image-processing|bufferedimage|image-scaling | 121,216 | <p><a href="http://docs.oracle.com/javase/8/docs/api/java/awt/image/AffineTransformOp.html" rel="noreferrer"><code>AffineTransformOp</code></a> offers the additional flexibility of choosing the interpolation type.</p>
<pre><code>BufferedImage before = getBufferedImage(encoded);
int w = before.getWidth();
int h = befor... |
4,398,951 | Force SSL/https using .htaccess and mod_rewrite | <p>How can I force to SSL/https using .htaccess and mod_rewrite page specific in PHP.</p> | 4,399,158 | 9 | 0 | null | 2010-12-09 13:56:28.533 UTC | 97 | 2019-07-02 10:27:10.707 UTC | 2016-05-17 15:18:12.607 UTC | null | 646,551 | null | 235,007 | null | 1 | 250 | php|.htaccess|mod-rewrite|ssl|https | 305,811 | <p>For Apache, you can use <a href="http://httpd.apache.org/docs/2.2/mod/mod_ssl.html" rel="noreferrer"><code>mod_ssl</code></a> to force SSL with the <a href="http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#sslrequiressl" rel="noreferrer"><code>SSLRequireSSL Directive</code></a>:</p>
<blockquote>
<p>This directiv... |
4,749,963 | What is the best way to stop a Unicorn Server process from running? | <p>What is the best way to stop a Unicorn Server process from running? Whenever I try to stop it using <code>kill -p 90234</code> it does not work. It is most likely something I am doing wrong. </p>
<p>Thanks.</p> | 4,749,994 | 10 | 3 | null | 2011-01-20 16:45:34.663 UTC | 16 | 2016-09-18 16:21:14.787 UTC | 2013-10-02 23:41:25.02 UTC | null | 128,421 | null | 577,180 | null | 1 | 34 | ruby-on-rails | 37,078 | <p>Simple Things There - In Terminal type "ps" and have a look for the Master Unicorn Process. Copy the PID of it and then type "kill −9 90234" (where 90234 is PID of master unicorn process). After that worker process should disappear itself.</p> |
4,190,429 | How to clear the Android Stack of activities? | <p>I have an application with several Activities in Android and I want the user to be able to log-out by pressing a menu button. The problem I have is that</p>
<p>A) Android doesn't let you terminate the application and<br>
B) even when I send the user to the <code>LoginActivity</code> again they can always press <em>... | 4,190,906 | 10 | 2 | null | 2010-11-16 01:29:56.033 UTC | 11 | 2020-11-12 07:14:57.973 UTC | 2013-10-08 14:20:37.577 UTC | null | 356,895 | null | 505,162 | null | 1 | 54 | android|android-activity|stack|back-stack | 57,827 | <p>In your login activity, override the back button, so it hides your app instead of finishing the activity:</p>
<pre><code>@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
moveTaskToBack(true);
return true;
}
return super.onKeyDown(k... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.