Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
1,161,636
1,161,637
Modify the windows style of another application using winAPI
<p>My application starts up another application. whereby, i want to remove the title bar of the application which is started using c#.</p> <p>How can i do this, starting up with the piece of code below ?</p> <pre><code>//Get current style lCurStyle = GetWindowLong(hwnd, GWL_STYLE) //remove titlebar elements lCurStyle = lCurStyle And Not WS_CAPTION lCurStyle = lCurStyle And Not WS_SYSMENU lCurStyle = lCurStyle And Not WS_THICKFRAME lCurStyle = lCurStyle And Not WS_MINIMIZE lCurStyle = lCurStyle And Not WS_MAXIMIZEBOX //apply new style SetWindowLong hwnd, GWL_STYLE, lCurStyle //reapply a 3d border lCurStyle = GetWindowLong(hwnd, GWL_EXSTYLE) SetWindowLong hwnd, GWL_EXSTYLE, lCurStyle Or WS_EX_DLGMODALFRAME //redraw SetWindowPos hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_FRAMECHANGED </code></pre>
c#
[0]
4,010,981
4,010,982
Package Access (Protected Modifier) in Java
<p>Suppose I have a package:</p> <pre><code>package com.g00gle.car </code></pre> <p>and </p> <pre><code>package com.g00gle.car.stereo </code></pre> <p>Is it possible to have a class in com.g00gle.car to access a class member in com.google.car.stereo? (Assuming that class member is labeled protected).</p> <p>The answer is no... (by default) but is there a way to circumvent that? I have an application that I want to cut into distinct chunks... and to do that, I create extensions of the package. What's discouraging is the loss of package private access.</p>
java
[1]
1,266,191
1,266,192
android:How do i connect my android phone to projector thru USB/HDMI?
<p>Is it possible to project an Android phone to projector via USB/HDMI?</p>
android
[4]
5,290,347
5,290,348
Proccess info gives an error but a bat file does not
<p>I try to start ilasm from C# using class ProcessInfo</p> <pre><code> string arguments = string.Format("\"{0}\" /exe /output:\"{1}\" /debug=IMPL", ilFullFileName, exeFileFullName); ProcessStartInfo processStartInfo = new ProcessStartInfo(CILCompiler, arguments); processStartInfo.UseShellExecute = false; processStartInfo.CreateNoWindow = false; processStartInfo.WorkingDirectory = @"c:\Windows\Microsoft.NET\Framework\v4.0.30319\"; using (Process process = Process.Start(processStartInfo)) { process.WaitForExit(); } </code></pre> <p>the arguments are:</p> <pre><code>"path_to_il.il" /exe /output:"path_to_exe.exe" /debug=IMPL </code></pre> <p>and then it gives me the error:</p> <pre><code>The application was unable to start correctly (0xc0000007b). Click Ok to close the application. </code></pre> <p>The odd part of that is, when I do exactly the same actions manually using bat file </p> <pre><code>"c:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe" "path_to_il.il" /exe /output:"path_to_exe.exe" /debug=IMPL pause </code></pre> <p>it does work.</p> <p>What did I miss?</p>
c#
[0]
68,550
68,551
how to convert each PDF pages to individual images c#
<p>lots of free library available which can convert pdf to images.</p> <pre><code> string file = "D:/test.pdf"; string image = "D:\\test.png"; try { GflAx.GflAxClass g = new GflAx.GflAxClass(); g.EpsDpi = 150; g.Page = 1; g.LoadBitmap(file); g.SaveFormat = GflAx.AX_SaveFormats.AX_PNG; g.SaveBitmap(image); MessageBox.Show(this, "PDF to PNG conversion ended"); } catch (Exception ex) { MessageBox.Show(this, "GflAx error: " + ex.Message); } </code></pre> <p>another free library like <a href="http://code.google.com/p/lib-pdf/" rel="nofollow">http://code.google.com/p/lib-pdf/</a></p> <p><a href="http://www.codeproject.com/Articles/32274/How-To-Convert-PDF-to-Image-Using-Ghostscript-API" rel="nofollow">http://www.codeproject.com/Articles/32274/How-To-Convert-PDF-to-Image-Using-Ghostscript-API</a></p> <p><a href="http://www.codeproject.com/Articles/57100/Simple-and-Free-PDF-to-Image-Conversion" rel="nofollow">http://www.codeproject.com/Articles/57100/Simple-and-Free-PDF-to-Image-Conversion</a></p> <p><a href="http://www.codeproject.com/Articles/42287/Convert-PDF-pages-to-image-files-using-the-Solid-F" rel="nofollow">http://www.codeproject.com/Articles/42287/Convert-PDF-pages-to-image-files-using-the-Solid-F</a></p> <p>i have 2 requirement like if my pdf file has 20 pages then library which i need to use that will generate 20 images for 20 pages...means one images for each pages at a time and save in folder those images.</p> <p>another requirement is that if i send page no then it will generate the images only for that page...please guide me which library i need to used to fulfill my requirement.</p> <p>thanks</p>
c#
[0]
3,983,989
3,983,990
Comparing element order in Python lists
<p>I am trying to write a function that returns <code>True</code> if the elements in <code>lst1</code> appear in <code>lst2</code> in the same order as they appear in <code>lst1</code>, but not necessarily consecutively.</p> <p>For example,</p> <p><code>test([29, 5, 100], [20, 29, 30, 50, 5, 100])</code> should return <code>True</code>.</p> <p><code>test([25, 65, 40], [40, 25, 30, 65, 1, 100])</code> should return <code>False</code>.</p> <p>Here is what I have so far:</p> <pre><code>def test(lst1, lst2): for i in range(len(lst1)-len(lst2)+1): if lst2 == lst1[i:i+len(lst2)]: return True return False </code></pre>
python
[7]
1,487,947
1,487,948
Read HTML file to generate data using javascript
<p>I got to read a number of HTML files, get its tags content and generate a report using these contents (e.g day1.html has Simon, I need to read day1.html file, and get 'author' div content which is 'Simon' and generate my own report using this data). How can I do it using Javascript? any help is highly appreciated. Many thanks. An</p>
javascript
[3]
5,306,796
5,306,797
Grid using loops
<p>I'm making a program that creates a grid with a number of lines and columns specified by the user. I want the output to look something like this:</p> <p>Lines (2..10) ? 3</p> <p>Columns (2..20)? 5</p> <pre><code> | | | | ---+---+---+---+--- | | | | ---+---+---+---+--- | | | | </code></pre> <p>But my program does this instead:</p> <p>Lines (2..10) ? 3</p> <p>Columns (2..20)? 5</p> <pre><code> | | | | ---+---+---+---+--- | | | | ---+---+---+---+--- | | | | ---+---+---+---+--- </code></pre> <p>This is what the program looks like:</p> <pre><code>String[] vertical = new String[columns-1]; String[] horizontal = new String[columns]; do { for(i = 0; i &lt; vertical.length; ++i) { vertical[i] = (" |"); System.out.print(vertical[i]); } System.out.printf("%n"); for(i = 1; i &lt; columns; ++i) { horizontal[0] = ("---"); horizontal[i] = ("+---"); } if(horizontal.length &gt; 0) System.out.print(horizontal[0]); for(int m = 1; m &lt; horizontal.length; ++m) System.out.print(horizontal[m]); System.out.printf("%n"); ++j; } while (j &lt;= lines - 1); </code></pre> <hr> <p>I know that I need to remove an horizontal line, the problem is that I don't know how to. And sorry for the bad formatting.</p>
java
[1]
2,908,514
2,908,515
create a class in c# in a way where I am just able to use it but I am not able to see the code of that class
<p>I have a class named CreateListView in my project in a .cs file and I am able to use it by including it's namespace in my usings at the top of my page. Is there a way I can compile the file so that I can still use the class but users are not able to see the contents of the class. I want the users to still be able to create objects from that class but I don't want them to modify it and it will also be better if they could not see it.</p>
c#
[0]
4,351,987
4,351,988
Why does casting int to bool gives a warning?
<p>Shouldn't it be ok to use <code>static_cast</code> to convert int to bool as it converts reverse of implicit conversion but i still get a warning?</p> <p><strong>Example:</strong></p> <p>MSVC++ 8</p> <pre><code>bool bit = static_cast&lt;bool&gt;(100); </code></pre>
c++
[6]
2,904,241
2,904,242
loadResourceasStream from a subfolder of the project java
<p>I am sure it's a basic question , I just can't figure it out I am trying to load bunch of images located in images subfolder of my project </p> <p>here is my code</p> <pre><code>package com.ieml.swt.diploma; import java.io.InputStream; public class loadTest { public static void main(String[] args) { System.out.println(getResourceImage("marks.png")); } public static InputStream getResourceImage(String fileName) { return loadTest.class.getResourceAsStream("./images/" + fileName); } } </code></pre> <p>I have a separe folders for src and class files so .java file is located in src/com/ieml/swt/diploma folder and .class file under bin/com/ieml/swt/diploma folder<br> files I'm trying to load here do existt in the "loadTest/images" subfolder loadTest is my project's root directory it justs print s null like it's doesn't load this file am I missing something here ?</p>
java
[1]
4,522,864
4,522,865
JavaScript Array
<p>According to a tutorial I am reading, if you want to create a table with 5 columns and 3 rows to represent data like this...</p> <pre><code>45 4 34 99 56 3 23 99 43 2 1 1 0 43 67 </code></pre> <p>...it says that you can use the following array</p> <pre><code>var table = new Array(5) table[0] = [45, 4, 34, 99, 56]; table[1] = [3, 23, 99, 43, 2]; table[2] = [1, 1, 0, 43, 67]; </code></pre> <p>But I would have expected it to be like this</p> <pre><code>var table = new Array(3) table[0] = [45, 4, 34, 99, 56]; table[1] = [3, 23, 99, 43, 2]; table[2] = [1, 1, 0 43, 67] </code></pre> <p>If, as in the tutorial, <code>var table</code> is initially declared as an array with 5 elements, and then the first (table[0]), second (table[1]) and third (table[2]) are filled with the data, what happens with the other two elements that were initially set in the array with new Array(5). Why do you need to use 5? </p>
javascript
[3]
115,802
115,803
How to define a char stack?
<p>How to define a char stack in java? For example, to create a String stack I can use such construction:</p> <pre><code>Stack &lt;String&gt; stack= new Stack &lt;String&gt; (); </code></pre> <p>But when I'm try to put char instead String I got an error:</p> <pre><code>Syntax error on token "char", Dimensions expected after this token </code></pre>
java
[1]
3,318,840
3,318,841
How can I keep the following asynchronous pattern DRY in JavaScript?
<p>The basic pattern is if X do something asynchronously else do something synchronously. For example</p> <pre><code>if (varNotSet) { setVarAsynchronously(function(callback) { // process callback then... render(page, {'var': myVar}); }); } else render(page, {'var': myVar}); </code></pre> <p>What's bothering me is the following</p> <pre><code>render(page, {var: myVar}); </code></pre> <p>since the same code is repeated. Is there some way that I can encapsulate that logic in a single place?</p>
javascript
[3]
1,769,881
1,769,882
Brief Howto Augmented Reality idea on iPhone
<p>I am currently developing an ar-iphone game as a hobby project. At the moment the user can click through some UIViews (e.g. main menu view) and start the game. I used the UIImagePickerController class and cameraoverlayview to achieve this. So when he presses the start button of the game the camera starts and an imageview is layed over it. </p> <p>Now I want more ;-) I want to make a little coin game. The user should stand still and see little flying coins at the screen. when he touches one he gets a point.</p> <p>Do I have to go into 3D space here? What do you recommend? </p> <p>Thanks ;-)</p>
iphone
[8]
883,446
883,447
How to create a web project for existing source code
<p>I have a source file and I want to create the project for it in VS2010. I have the option in VS2010 to create project from source code but it is not creating a web project.</p> <p>Can you help me please how can I create a web project?</p> <p>Thanks, Alina</p>
asp.net
[9]
1,723,409
1,723,410
How do I get a list of all the printable characters in C#?
<p>I'd like to be able to get a char array of all the printable characters in C#, does anybody know how to do this?</p> <p><strong>edit:</strong></p> <p>By printable I mean the visible European characters, so yes, umlauts, tildes, accents etc.</p>
c#
[0]
5,376,472
5,376,473
C++ Linker Error
<pre><code>/************************************************************ Allocation::Allocation store_all(Allocation &amp;update) { update.location = count; //res=ab.initialise(update[no]); return(update); } /****************************************************************/ </code></pre> <p>Here is my code... I am getting <strong>LINKER ERROR</strong>... CAN ANYONE FIND WHAT IS THE PROBLEM IN THE CODE....Have commented the code where i get the problem...</p> <p><strong>Linker error..Id returned 0 status</strong></p>
c++
[6]
1,655,589
1,655,590
Split Test CALCULATOR for asp.net?
<p>I have a/b test (split test) running on asp.net. It shows variations, visitors and conversions. If I punch these numbers in any split test calculator, it will show me Confidence Level and if there is a winner. Wonder maybe there is a library which calculates it, so I could show these calc results on my page? or formula which I could implement myself?</p>
c#
[0]
4,122,866
4,122,867
Is it wrong to declare a variable inside an if statement in Javascript?
<p>I have a Sublimelinter installed in Sublime Text 2 and it's great. However it doesn't like the following code:</p> <pre><code>if(condition){ var result = 1; }else{ var result = 2; } process(result); </code></pre> <p>It says for <code>var result = 2;</code> that result is already defined and for <code>process(result);</code> that it's used out of scope. Is it just mistaking the <code>{}</code> of the if statement for a more closed scope or should I really be doing it like this:</p> <pre><code>var result; if(condition){ result = 1; }else{ result = 2; } process(result); </code></pre>
javascript
[3]
4,722,403
4,722,404
how do i Find and then have a callback function
<p>I am not sure if my code is correct but I am trying to run some checks on a specific element but my counters are not working - my fields are not hiding.</p> <pre><code>//get all fields, some could be text, text area, checkbox, radio... $(".my-field").each(function(i) { var wrapper = this; //check if the text box has a vaule, this callback here is not working/ correct? $(wrapper).find("input:text", function() { if ($(this).val() != "" || $(this).val().length &gt; 0) { hidden++; $(wrapper).find(".field-content").hide(); $(wrapper).addClass("hide"); } else { visible = visible + 1; } }); }); </code></pre> <p>My Html below is 1 <em>field</em> (one div shown below) they are all wrapped inside a div with other fields</p> <pre><code>&lt;div data-field-type="Text" data-field-id="1" class="display-wrapper my-field"&gt; &lt;div class="field-header"&gt; &lt;span&gt;name: xyz&lt;/span&gt; | &lt;span&gt; text field&lt;/span&gt; &lt;/div&gt; &lt;div class="field-content"&gt; &lt;div class="editor-label"&gt; &lt;p class="clear"&gt; some description...&lt;/p&gt; &lt;/div&gt; &lt;div class="editor-field"&gt; &lt;input type="text" value="iojhiojio" name="1" maxlength="100" id="field-1" class="field-bigtext"&gt; &lt;/div&gt; &lt;br&gt; &lt;/div&gt; &lt;div style="display: none;" class="field-error-wrapper"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>My Question, is this possible with jquery: </p> <pre><code>$(wrapper).find("input:text", function() { .. some code }); </code></pre>
jquery
[5]
5,664,961
5,664,962
Max app space (storage)
<p>I've looked around and have noticed that the max size for an apk is 50MB, but I am curious as to how much application space an app can download. Can one app take up all of the application storage or does it need to download additional content into the internal storage and/or sd card?</p> <p>Thanks</p>
android
[4]
1,789,497
1,789,498
Nesting a list using a comprehension?
<p>I have a list:</p> <pre><code>['EFJAJCOWSS', 'SDGKSRFDFF', 'ASRJDUSKLK', 'HEANDNDJWA', 'ANSDNCNEOP', 'PMSNFHHEJE', 'JEPQLYNXDL'] </code></pre> <p>From this list how do I create a sub list:</p> <pre><code>[['EFJAJCOWSS'], ['SDGKSRFDFF'], ['ASRJDUSKLK'], ['HEANDNDJWA'], ['ANSDNCNEOP'], ['PMSNFHHEJE'], ['JEPQLYNXDL']] </code></pre> <p>Using a list comprehension in Python?</p>
python
[7]
2,729,315
2,729,316
Right Justifying output stream in C++
<p>I'm working in C++. I'm given a 10 digit string (char array) that may or may not have 3 dashes in it (making it up to 13 characters). Is there a built in way with the stream to right justify it?</p> <p>How would I go about printing to the stream right justified? Is there a built in function/way to do this, or do I need to pad 3 spaces into the beginning of the character array?</p> <p>I'm dealing with ostream to be specific, not sure if that matters.</p>
c++
[6]
5,731,406
5,731,407
add active class to menu links using php
<pre><code>&lt;div class="menu clearfix"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="./"&gt;start&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="./?p=rating"&gt;rating&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="./?p=upload"&gt;upload&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p></p> <p>Was a while since i used php. Is there any smart way to do a foreach in php and render this menu + an "active" class to the clicked link. So if the active page is "rating", the html would render:</p> <pre><code> &lt;div class="menu clearfix"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="./"&gt;start&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="./?p=rating" class="active"&gt;rating&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="./?p=upload"&gt;upload&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p></p> <p>Thanks</p>
php
[2]
3,582,931
3,582,932
Convert string to decimal retaining the exact input format
<p>I'm sure this is a piece of cake but I'm really struggling with something that seems trivial.</p> <p>I need to check the inputted text of a textbox on the form submit and check to see if it's within a desired range (I've tried a Range Validator but it doesn't work for some reason so I'm trying to do this server-side).</p> <p>What I want to do is:</p> <p>Get the value inputted (eg. 0.02), replace the commas and periods, convert that to a decimal (or double or equivalent) and check to see if it's between 0.10 and 35000.00.</p> <p>Here's what I have so far:</p> <pre><code>string s = txtTransactionValue.Text.Replace(",", string.Empty).Replace(".", string.Empty); decimal transactionValue = Decimal.Parse(s); if (transactionValue &gt;= 0.10M &amp;&amp; transactionValue &lt;= 35000.00M) // do something </code></pre> <p>If I pass 0.02 into the above, transactionValue is 2. I want to retain the value as 0.02 (ie. do no format changes to it - 100.00 is 100.00, 999.99 is 999.99)</p> <p>Any ideas?</p> <p>Thanks in advance, Brett</p>
c#
[0]
2,775,568
2,775,569
OnBlur does not work on div
<p>I have a div in a table <code>&lt;td&gt;</code>. When I add the onBlur event nothing happens. When I change the onBlur to a different event it works.</p> <p>Does anyone know how I can add the onBlur to the div:</p> <pre><code>&lt;div id="MyForm" onblur='Init()'&gt; </code></pre>
javascript
[3]
1,443,660
1,443,661
Is it possible to declare a method as a parameter in C#?
<p>For example the main method I want to call is this:</p> <pre><code>public static void MasterMethod(string Input){ /*Do some big operation*/ } </code></pre> <p>Usually, I would do something like this this:</p> <pre><code>public static void StringSelection(int a) { if(a == 1) { return "if"; } else { return "else"; } } MasterMethod(StringSelection(2)); </code></pre> <p>But I want to do something like this:</p> <pre><code>MasterMethod( a = 2 { if(a == 1) { return "if"; } else { return "else"; } }); </code></pre> <p>Where 2 is somehow passed into the operation as an input. </p> <p>Is this possible? Does this have a name? </p> <p>EDIT:: Please note, the MasterMethod is an API call. I cannot change the parameters for it. I accidentally made a typo on this. </p>
c#
[0]
3,700,323
3,700,324
Ways to improve foll. Java code
<p>Any ways to improve the foll. code block :</p> <pre><code>public class MyUnits { public static String MILLSECONDS = "milliseconds"; public static String SECONDS = "seconds"; public static String MINUTES = "minutes"; public static String HOURS = "hours"; public int quantity; public String units; public MyUnits(int quantity, String units) { this.quantity = quantity; this.units = units; } public String toString() { return (quantity + " " + units); } // Test code public static void main(String[] args) { System.out.println(new MyUnits(1, MyUnits.MILLSECONDS)); System.out.println(new MyUnits(2, MyUnits.SECONDS)); System.out.println(new MyUnits(3, MyUnits.MINUTES)); System.out.println(new MyUnits(4, MyUnits.HOURS)); } } </code></pre> <p>Any help will be appreciated.</p>
java
[1]
5,847,376
5,847,377
saving to localstorage onkeyup
<p>I am trying to save form data to localstorage on keyup event with javascript. I have the following code but I get the error "Uncaught TypeError: Cannot set property 'onkeyup' of null".</p> <p><strong>html</strong></p> <pre><code>&lt;input type="text" id="username" /&gt; </code></pre> <p><strong>javscript</strong></p> <pre><code>var user = document.getElementById("username"); user.onkeyup = function(){ localStorage.setItem('user', user.value); }; </code></pre>
javascript
[3]
4,632,665
4,632,666
Is there a way in JavaScript to recognize when a browser is loading a page?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1619930/how-to-check-users-leave-a-page">how to check users leave a page</a> </p> </blockquote> <p>For example when somebody refreshes, enters a new URL into the location bar, or navigates away using a link on the page?</p> <p>I need to do some work after someone attempts to leave my page.</p> <p>EDIT: onunload doesn't work because in most browsers that doesn't execute until the page they are attempting to leave to returns a response. I want to execute some code as soon as they attempt to leave.</p> <p>beforeunload appears to work, but I'm not sure a beforeunload without a return is proper form.</p>
javascript
[3]
1,239,197
1,239,198
Join two list row into single row dynamically using toggle button
<p>I want to join two row data into single row (I have custom list of data not using <code>listview</code>). How should I implement this in android.</p>
android
[4]
4,636,051
4,636,052
Get page count in a secured PDF
<p>I've created a C# application using below codings in order to get pdf page count.</p> <pre><code>public static int GetNoOfPagesPDF(string FileName) { int result = 0; FileStream fs = new FileStream(FileName, FileMode.Open, FileAccess.Read); StreamReader r = new StreamReader(fs); string pdfText = r.ReadToEnd(); System.Text.RegularExpressions.Regex regx = new Regex(@"/Type\s*/Page[^s]"); System.Text.RegularExpressions.MatchCollection matches = regx.Matches(pdfText); result = matches.Count; return result; } </code></pre> <p>But I can't get the page count in a protected PDF. How can I get the page count in this kind of a situation.</p>
c#
[0]
3,474,523
3,474,524
I want to open default mail client with the pdf attachment
<p>Hi I am developing an web application using .Net2.0. In the application if i click on a button open a default mail client with PDF should be attached.</p> <p>I have created the PDF and also tried to open the default mail client.</p> <p>But the problem is when i checked mail and it containing the attachment but when i click on attachment it is again opening with the default mail client.</p> <p>I need a solution to create a PDF and open the default mail client with same PDF should be attached.</p> <p>can any body provide the solution to above.</p> <p>Thanks in advance</p>
asp.net
[9]
3,378,767
3,378,768
How to make my controls to be in the middle?
<p>this is my first asp.net site that i write I want to have simple form with 5 textbox line that the user will be able to write in and one button that the user will be able to press when he finish his data input. </p> <p>Each textbox that i adding i automaticly jump to the left side of the form. </p> <p>How can i control the place that it will will be shown ? </p>
asp.net
[9]
2,013,891
2,013,892
Programatically remove <script src="/unwanted.js".. /> reference
<p>I have partial control of a web page where by I can enter snippets of code at various places, but I cannot remove any preexisting code.</p> <p>There is a script reference midway through the page</p> <pre><code>&lt;script src="/unwanted.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>but I do not want the script to load. I cannot access the <code>unwanted.js</code> file. Is there anyway I can use javascript executing above this refernce to cause the <code>unwanted.js</code> file not to load?</p> <p><strong>Edit</strong>: To answer the comments asking what and why:</p> <p>I'm setting up a Stack Exchange site and the WMD* js file loads halfway down the page. SE will allow you to insert HTML in various parts of the page - so you can have your custom header and footer etc. I want to override the standard WMD code with my own version of it. I can get around the problem by just loading javascript after the original WMD script loads and replacing the functions with my own - but it would be nice not to have such a large chunk of JS load needlessly.</p> <p>*WMD = the mark down editor used here at SO, and on the SE sites.</p>
javascript
[3]
1,546,097
1,546,098
how to create a "package" in Java?
<p>I have two classes, Parent and Child. The code for the classes are like this: </p> <p><strong>Parent.class</strong></p> <pre><code>package test; import java.util.*; public class Parent { public static void main(String[] args) { Child child = new Child(); } } </code></pre> <p><strong>Child.class</strong></p> <pre><code>package test; import java.util.*; public class Child { public Child() { System.out.println("A Child object has been created"); } } </code></pre> <p>I put both classes in a directory named "test". I can compile Child.java without any problem but I cant Compile Parent Class. It says that it cannot find the child class. What is the problem?</p>
java
[1]
1,348,167
1,348,168
Deselecting select options with jQuery needs scrolling to actually show
<p>I have a somewhat odd problem deselecting options in a select using jQuery.</p> <p>The code I have now (for selecting all):</p> <pre><code>$select.children().attr('selected', true); </code></pre> <p>This works fine.</p> <p>For deselecting, I have tried various options:</p> <pre><code>$select.children().attr('selected', false); $select.children().removeAttr('selected'); $select.find("option").attr('selected', false); $select.find("option").each(function() { var $this = $(this); $this.removeAttr("selected"); }); </code></pre> <p>etc.. and they all have the same problem (tested in chrome / safari). After I run the deselect code, I have to actually scroll before the options are shown as not selected.</p> <p>Any ideas on how to fix this?</p> <p>Regards, Morten</p>
jquery
[5]
494,901
494,902
fetching items from combobox to label text
<p>I have a combobox say combobox1. I have 4 items in it. Whenever i select an item I wish to get the selected text in the combobox1 on a label text. I tried doing this using the following code but it does not work.</p> <p>cnt refers to the number of items in combobox1. lb is an object of label.</p> <p>Please help..</p> <pre><code>for (int i = 1; i &lt;= cnt; i++) { lb.Text = comboBox1.Items[i].ToString(); } </code></pre>
c#
[0]
3,364,530
3,364,531
in place sort returns None for empty list
<p>Why is it that <code>[].sort() != []</code> but instead <code>[].sort() = None</code>?</p> <p>Logically, it seems that the first case should be true.</p>
python
[7]
4,412,992
4,412,993
javascript Object
<p>When I do the following:</p> <pre><code> alert(objecr); </code></pre> <p>It shows as object Object </p> <p>How do I display the content of what is in the object? I also tried</p> <pre><code> alert(JSON.stringify(objecr)); </code></pre> <p>but it shows the following:</p> <p>"[object Object]"</p>
javascript
[3]
4,778,875
4,778,876
Calling external files (e.g. executables) in C++ in a cross-platform way
<p>I know many have asked this question before, but as far as I can see, there's no clear answer that helps C++ beginners. So, here's my question (or request if you like),</p> <p>Say I'm writing a C++ code using Xcode or any text editor, and I want to use some of the tools provided in another C++ program. For instance, an executable. So, how can I call that executable file in my code? </p> <p>Also, can I exploit other functions/objects/classes provided in a C++ program and use them in my C++ code via this calling technique? Or is it just executables that I can call?</p> <p>I hope someone could provide a clear answer that beginners can absorb.. :p</p>
c++
[6]
467,592
467,593
ASP.NET Shopping Cart on Northwind Database
<p>Thank you for the inputs. I have captured the product selection from the shop page in the form of session variables and displayed them on Checkout page. My last step is to be able to kill a few products on the check out page(incase the customer selected products he did not need). Here is my attempt for the same.</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; namespace ShoppingCart { public partial class Checkout : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CheckBoxList1.DataSource = Session["MySelectedItems"]; CheckBoxList1.DataBind(); } } protected void ReturnBacktoShopping_Click(object sender, EventArgs e) { Response.Redirect("Shopping.aspx"); } public void KillOrders() { for (int i = 0; i &lt; CheckBoxList1.Items.Count; i++) { if (CheckBoxList1.Items[i].Selected) { CheckBoxList1.Items.Remove(i); } } } protected void RemoveItems_Click(object sender, EventArgs e) { KillOrders(); List&lt;ListItem&gt; selectItems = new List&lt;ListItem&gt;(); foreach (ListItem item in CheckBoxList1.Items) { if (item.Equals(null)) selectItems.Add(item); } Session.Add("MySelectedItems", selectItems); CheckBoxList1.DataSource = Session["MySelectedItems"]; CheckBoxList1.DataBind(); } } } </code></pre>
asp.net
[9]
1,812,223
1,812,224
How to run a method at XX:XX:XX time?
<p>HI</p> <p>I want to run a method in my program evry X hours, how to do that ? Im googling and there is nothing :/</p>
java
[1]
2,717,447
2,717,448
how to randomly choose multiple keys and its value in a dictionary python
<p>I have a dictionary like this:</p> <pre><code>user_dict = { user1: [(video1, 10),(video2,20),(video3,1)] user2: [(video1, 4),(video2,8),(video6,45)] ... user100: [(video1, 46),(video2,34),(video6,4)] } (video1,10) means (videoid, number of request) </code></pre> <p>Now I want to randomly choose 10 users and do some calculation like </p> <pre><code> 1. calculate number of videoid for each user. 2. sum up the number of requests for these 10 random users, etc </code></pre> <p>then I need to increase the random number to 20, 30, 40 respectively</p> <p>But "random.choice" can only choose one value at a time, right? how to choose multiple keys and the list following each key?</p>
python
[7]
1,135,354
1,135,355
php variable datatypes
<p>I've just decided to venture off into PHP land for fun and to learn, reading that php is loosely typed and that $var's can be reused is this true that the code below will pose no problem? </p> <pre><code>$x = 996; $x = mysql_query("SELECT aString FROM table1"); </code></pre> <p>the variable x will stored as an int datatype with 996, then after the second line it will stored as a string datatype with the string from the query?</p> <p>There wont be any casting errors?</p>
php
[2]
774,248
774,249
PHP Output Buffering
<p>Simple question:</p> <p>If I enable output buffering...</p> <pre><code>ob_start(); $a = true; header('Location: page.php'); $a = false; ob_end_flush(); </code></pre> <p>... will <strong>$a</strong> be registered as false, or will it just redirect the page without processing the command (as it would if output buffering were not enabled)?</p> <p>Thanks!</p>
php
[2]
5,597,673
5,597,674
Javascript request fullscreen is unreliable
<p>I'm trying to use the JavaScript FullScreen API, using workarounds for current non-standard implementations from here:</p> <p><a href="https://developer.mozilla.org/en/DOM/Using_full-screen_mode#AutoCompatibilityTable">https://developer.mozilla.org/en/DOM/Using_full-screen_mode#AutoCompatibilityTable</a></p> <p>Sadly, it behaves very erratically. I only care about Chrome (using v17), but since I was having problems I did some tests in Firefox 10 for comparison, results are similar. </p> <p>The code below attempts to set the browser to fullscreen, sometimes it works, sometimes not. It ALWAYS calls the alert to indicate it is requesting fullscreen. Here's what I've found:</p> <ul> <li>It USUALLY sets fullscreen. It can get to a state where this stops working, but the alert still happens, i.e. it is still requesting FullScreen, but it doesn't work.</li> <li>It can work if called from a keypress handler (document.onkeypress), but not when called on page loading (window.onload).</li> </ul> <p>My code is as follows:</p> <pre><code>function DoFullScreen() { var isInFullScreen = (document.fullScreenElement &amp;&amp; document.fullScreenElement !== null) || // alternative standard method (document.mozFullScreen || document.webkitIsFullScreen); var docElm = document.documentElement; if (!isInFullScreen) { if (docElm.requestFullscreen) { docElm.requestFullscreen(); } else if (docElm.mozRequestFullScreen) { docElm.mozRequestFullScreen(); alert("Mozilla entering fullscreen!"); } else if (docElm.webkitRequestFullScreen) { docElm.webkitRequestFullScreen(); alert("Webkit entering fullscreen!"); } } } </code></pre>
javascript
[3]
5,201,128
5,201,129
Rookie Q: how to set a program to start over and get a new value?
<p>I am working with a program which requires a value to put in a variable and do some stuff on it. The problem is that I want the program to start over again and ask the user for a new value to process the new value again. </p> <p>For example look at this code, which requires a number as a grade to rate it. When the processing was done I want the program to ask for a new grade ( next student for instance ).</p> <pre><code>#include &lt;iostream.h&gt; int main (int argc, const char * argv[]) { int n; cout&lt;&lt; " Please Enter your grade : " ; cin&gt;&gt;n; switch (n/10) { case 10: cout&lt;&lt; " A+ : Great! "; case 9: break; case 8: cout&lt;&lt; " A : Very Good "; break; case 7: cout&lt;&lt; " B : Good " ; break; case 6: case 5: case 4: case 3: case 2: case 1: case 0: cout&lt;&lt; " Failed "; break; default: break; } return 0; } </code></pre>
c++
[6]
3,295,854
3,295,855
Javascript on usercontrol used twice in same aspx page
<p>I have one user control that contains two list boxes and buttons to transfer listbox elements from one listbox to another used twice in same aspx page. Javascript code is used to transfer items from one list to another. Now I want elements transfer from Listbox on usercontrol1 to Listbox on usercontrol2 on single button click(button on aspx page) using javascript. Can anyone help me in solving this?</p> <p>Thanks in advance</p>
javascript
[3]
3,840,910
3,840,911
Strip "/" from the beginning and the end of my URI
<p>So I have a URI that is returned like so /intelliship/ I need the beginning slash and trailing slash to be removed from that URI.</p> <p>Attempted (FAILED) code:</p> <pre><code>&lt;?php $value = $_SERVER['REQUEST_URI']; function __construct($value){ if(strpos($value,'/')==FALSE){ return trim(substr(strrchr($value, ' '), 1 )); }else{ return trim(substr($value, strpos($value,'/')),'/'); } $value = ucwords($value); } ?&gt; </code></pre> <p>This doesn't strip any slashes and is pretty sloppy code. Any help would be greatly appreciated. </p>
php
[2]
1,928,095
1,928,096
opening 2nd dialog from another form on top of first one in jquery
<p>First of all I want to thank tvanfosson for his contribution here (<a href="http://stackoverflow.com/questions/859309/session-end-in-asp-net-mvc/5305358#5305358">Session End in ASP.net MVC</a>) This thing works great but unfortunately on my implementation it kinda messes up if the session expiring dialog is not the only one dialog on the current tab/window.</p> <p>I was guessing that may be because there are other dialogs already opened that's why another form (the main page) can't open the expiring dialog, but it still doesn't show up when I made the other dialogs non-modal. I am using IE 8 with jQuery 1.4.2 min , 1.8.2 UI, and 1.2.0 layout libs. </p> <p>I have a main page which opens other dialogs / small windows too, so if the session expires while any of them are opened then the expiring dialog don't show up, and IE 8 pops a warning message at the top telling "compatibility view". Is there a way to tell jQuery to allow the expiring dialog to show up no matter what or at what level it pops up?</p>
jquery
[5]
4,050,552
4,050,553
jQuery Zebra selector
<p>I have a CSS class called grid which I place on my tables. I want to Zebra strip my even rows so I use the following jQuery code</p> <pre><code>$(".grid tr:nth-child(even)").addClass("even"); </code></pre> <p>This basically says "Apply the css class even to any tr tag which has a parent (at any level) with a class of grid." The problem with this is when I have nested tables, the child table's tr tags will also get the even style. Since I did not specify the child table with a class of grid, I don't want it to pick up the zebra stripe. </p> <p>How can I specify to only apply the even class on tr tags which are a direct descendant of the tag which has the grid class? </p>
jquery
[5]
4,029,700
4,029,701
Finding iPhone Unique identifier using a web app
<p>I know how to get the unique id of a iPhone/iPod touch from UIDevice. Is there any way to know that from a web app?</p>
iphone
[8]
5,019,577
5,019,578
Getting the number of elements in std::array at compile time
<p>Is the following a valid C++ code, and why not?</p> <pre><code>std::array&lt;std::string, 42&gt; a1; std::array&lt;int, a1.size()&gt; a2; </code></pre> <p>It doesn't compile in GCC 4.8 (in C++11 mode). There is a simple but inelegant workaround:</p> <pre><code>std::array&lt;std::string, 42&gt; a1; std::array&lt;int, sizeof(a1)/sizeof(a1[0])&gt; a2; </code></pre> <p>So clearly the compiler can figure out the number of elements in std::array. Why std::array::size() is not a <code>constexpr static</code> function?</p> <p>EDIT: I have found another workaround:</p> <pre><code>std::array&lt;std::string, 42&gt; a1; std::array&lt;int, std::tuple_size&lt;decltype(a1)&gt;::value&gt; a2; </code></pre>
c++
[6]
122,274
122,275
To download a large file, which is a better approach to use either AsyncTask or Thread?
<p>I've found a sample to download a large data file at the following link, <a href="http://code.google.com/p/apps-for-android/source/browse/#svn/trunk/Samples/Downloader" rel="nofollow">http://code.google.com/p/apps-for-android/source/browse/#svn/trunk/Samples/Downloader</a></p> <p>It seems to be pretty nice (I haven't yet tested it). But I also have read some posts at the stackoverflow to do the same thing by using the AsyncTask class, not using the Thread class as the above sample.</p> <p>What I want to know is, which should I use to achieve downloading a file? And if AsyncTask is better, would you point me to a sample code?</p>
android
[4]
2,800,173
2,800,174
How can I find circular dependencies?
<p>Could someone suggest me a tool to find circular dependencies? I tried with a graph of the project but it has hundreds of header files so is very complicated to find them.</p> <p>I edit the post with the meaning of circular dependency:</p> <ul> <li>File A.h has a #include "B.h" guard.</li> <li>File B.h has a #include "A.h" guard.</li> </ul> <p>Thanks.</p>
c++
[6]
545,827
545,828
What are the best practices for making online high score lists in JavaScript based games?
<p><em>[I know there have been similar questions about preventing cheating on high score lists, but no answer didn't really help me for JavaScript based games, so please try to think about my question, before telling me about similar posts. I ask about <code>best practices</code> because the JavaScript is always visible for the user and therefore it is not possible to prevent cheating completly, I just want to make it harder.]</em></p> <p>I'm developing a JavaScript based game that works in the browser. I want to make a high score list that contains the user name and the score of all users. To achieve that the browser sends , after the user finished the game, the user name and the score to my server (via AJAX) that handles everything for the high scores.</p> <p>To submit fake scores to this list would be fairly easy: One could take a look at the AJAX requests and then make an own AJAX request with a faked score. To use something like a <code>token</code> that has to be send with the other data is pointless, as it will be easy to discover.</p> <p>My only approach, that would prevent cheating, would be to send a description of every user action to the server and calculate the score there. But this is not really practicable as it would be too much for the server.</p> <p><strong>I accepted an answer, but in case anyone has other ideas about how to make cheating harder, please create another answer!</strong></p>
javascript
[3]
571,304
571,305
Asp.net throwing random error
<p>I have an asp.net blog that is randomly throwing this error:</p> <blockquote> <p>The page cannot be displayed because an internal server error has occurred.</p> </blockquote> <p>It lasts anywhere from 5 minutes to 1 hour.</p> <p>I haven't implemented error logging yet, but in the meantime what can cause this? The error goes away on it's own after a while.</p> <p>Thanks.</p>
asp.net
[9]
5,192,415
5,192,416
Scroll down, move up div?
<p>I've been trying to achive a effect that is similar to the one that can be found here <a href="http://www.geoffroydeboismenu.com/" rel="nofollow">http://www.geoffroydeboismenu.com/</a> , where the menu reveals itself by scrolling down, overflowing, in this case, the "picture" div.</p> <p>I've this code atm;</p> <pre><code>$(window).scroll(function(){ $("#container").stop().animate({ "marginTop": ($(window).scrollTop() + 30) + "px"}, "slow"); }); </code></pre> <p>But it kind of does the exact opposite, where my div follows the scroll, instead of going up.</p> <p>I want my #container div to overflow my #slider div.</p>
jquery
[5]
1,543,337
1,543,338
Does an Intent's extras still get flattened into a Parcel even if the new activity is being started within the same task?
<p>I was wondering...</p> <p>So if you start a new activity via an intent, the intent has to be serialized and deserialized because you may have to send the intent to a separate VM instance via IPC. But what if the PackageManager <em>knows</em> that your new activity will be created on the current task? It seems like a reasonably Googly optimization would be not to serialize the intent at all, since it's all happening inside the same VM. But then again, you can't just allow the new activity to use the same instance of each parcelable, because any changes made by the new activity would show up in the old activity and the programmer might not be expecting this.</p> <p>So, is this optimization being done? Or do the extras always get marshalled and unmarshalled, no matter what?</p>
android
[4]
5,634,387
5,634,388
Convert records from SQLite to clickable URL
<p>How do I convert records from my <code>SQLite</code> table to clickable link. See code below.</p> <pre><code>ListAdapter list = new SimpleCursorAdapter(this,android.R.layout.two_line_list_item, myCursor, new String [] {"title","url"}, new int [] {R.id.text1, R.id.text2}); </code></pre> <p>I want the output of <code>R.id.text2</code> to be a clickable URL. </p> <p>Thank you</p>
android
[4]
728,611
728,612
Android - button text from up to down?
<p>is there any way how to set text on button not from left to right, but from top to down?</p> <p>Thanks</p>
android
[4]
2,504,138
2,504,139
placing an image inside the panel
<p>I have an image like a cloud shape I am placing it as background for the panel. the displays. But as I have specified the height and width here the images displays outside the image there is white space around the image which make the user looks that images is placed inside the panel. so is there any way I want the background image only to come.</p> <pre><code>.modalPopup { width:600px; height:400px; } &lt;asp:Panel ID="pnlHead" runat="server" Style="display: none;" BackImageUrl="~/WebSiteContent/Images/Cloudd.JPG" CssClass="modalPopupWD"&gt; &lt;asp:Panel ID="pnlBody" runat="server"&gt; &lt;/asp:Panel&gt; &lt;/asp:Panel&gt; </code></pre>
asp.net
[9]
4,429,613
4,429,614
Why am I unable to assign to a particular element in a list of lists
<p>I don't understand why I am assigning to the first element in every list below:</p> <pre><code>➜ ~ python Python 2.7.3 (default, Sep 26 2012, 21:53:58) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; board = [[None]*5]*5 &gt;&gt;&gt; print board [[None, None, None, None, None], [None, None, None, None, None], [None, None, None, None, None], [None, None, None, None, None], [None, None, None, None, None]] &gt;&gt;&gt; board[0][0] = 1 &gt;&gt;&gt; print board [[1, None, None, None, None], [1, None, None, None, None], [1, None, None, None, None], [1, None, None, None, None], [1, None, None, None, None]] </code></pre> <p>I would expect the final output to be this:</p> <pre><code>[[1, None, None, None, None], [None, None, None, None, None], [None, None, None, None, None], [None, None, None, None, None], [None, None, None, None, None]] </code></pre>
python
[7]
891,222
891,223
How to remove "," in end of text in php?
<p>I have a text:</p> <pre><code>"2G Network":"GSM 850","3G Network":"HSDPA 850", </code></pre> <p>How to remove "," in end of text in php </p> <pre><code>"2G Network":"GSM 850","3G Network":"HSDPA 850" </code></pre>
php
[2]
367,485
367,486
Python Convert UTC to PST / PDT format
<p>I have a web app that captures date / time via a JS script and calculates seconds since epoch in UTC format - ex 134250270000. In the backend we have a Python script that fetches data from DB but has date / time stored in number of seconds since epoch in PST format. There is always a difference of seconds between UTC and PST if counted from epoch.</p> <p>Is there any method by which I can convert the UTC seconds since to epoch to PST seconds since epoch? We need to take a note of daylight changes in PST timezone also?</p> <p>EDIT::</p> <pre><code>I have the seconds since epoch in UTC format: 1342502700 I found that I get the sum in seconds between UTC and local standard time via: &gt;&gt;&gt; time.timezone / 3600 8 So If I add 1342502700 to time.timezone: &gt;&gt;&gt; print 1342502700 + time.timezone 1344153600 </code></pre> <p>Will it always give me PDT / PST times correctly? </p> <p>EDIT::</p> <p>Maybe this is the correct one:</p> <pre><code>&gt;&gt;&gt; import time &gt;&gt;&gt; offset = time.timezone if (time.daylight == 0) else time.altzone &gt;&gt;&gt; offset / 60 / 60 7 </code></pre> <p>time.daylight will be non-zero if daylight savings is currently in effect.</p>
python
[7]
4,793,865
4,793,866
How to transform image over object
<p>Example: <a href="http://gyazo.com/745e6912db5bf2c1dd05a7a7537bfca4.png" rel="nofollow">http://gyazo.com/745e6912db5bf2c1dd05a7a7537bfca4.png</a></p> <p>I wanna put image over object... so that it looks like a native picture over the object. Could you give key words of these image manipulation process that i can google it ;)</p>
php
[2]
883,009
883,010
Are sig_atomic_t and std::atomic<> interchangable
<p>As per the title. Can I use <code>std::atomic&lt;&gt;</code> in a signal handler or does <code>sig_atomic_t</code> provide other compiler features?</p>
c++
[6]
2,780,753
2,780,754
whats wrong with this for loop?
<p>Can someone please help me fix this code up? I am getting some weird error: this for loop not working properly</p> <pre><code>&lt;?php $languages=array('te','hi'); for($langIndex=0;$langIndex&lt;count($languages);$langIndex++) { echo $languages;} ?&gt; </code></pre> <p>expected result:</p> <pre><code>te,hi </code></pre> <p>actual result:</p> <pre><code>Array Array </code></pre>
php
[2]
5,656,499
5,656,500
how to add new calender in android programatically
<p>I am developing a Bluetooth sync application in which i am syncing all contacts and calender events with outlook express.</p> <p>I want event syncing in my own calendar, not Google account's calendar but I haven't found any solution on "how to create new calenders in android". please help me if any one have its solution.</p>
android
[4]
3,518,627
3,518,628
Better approach we have to follow when ever we have call the same method in different classes
<p>I am new to iPhone.I am using some code for getting some data but i am confused whether it is better approach or not to use.can any body suggest me whether it is better approach or not. I have three classes 1.BiblePlayerAppDelegate 2.BiblePlayerViewController 3.ShowProgressViewController</p> <p>In BiblePlayerViewController.m:</p> <pre><code>-(NSString *)selectedBookTitle { //getting the text which is in the bookSelectionButton and assign that to selectedBookTitle selectedBookTitle = [[bookSelectionButton titleLabel]text]; //return the selectedBookTitle String return selectedBookTitle; } </code></pre> <p>I am write the above method in biblePlayerViewController.m and selectedBookTitle is class variable in biblePlayerViewController class.Here in the same class i am calling this method several times nearly 30 times i am calling this method.is it better approach for calling 30 times a method which is in that class.i am using this method in showProgressViewController also for that i am import biblePlayerViewController.h in showProgressViewController and then alloc init the biblePlayerViewController in showProgressViewController class.Is there any better approach for this.Please any body know this suggest me.It will so helpful to me </p>
iphone
[8]
4,048,511
4,048,512
PayPal Donations on Android Apps
<p>I am currently developing an application where I want to be able to have an option to allow the user to donate money for the app. Is there a particular way about doing this for android. I have tried looking at google but it mainly shows about paypal donation buttons for websites</p>
android
[4]
297,254
297,255
Can I open phone app using URL scheme in iPhone?
<p>Can I open the phone app on iPhone using URL scheme? if yes then how? I know I can dial a number using this:</p> <pre><code>[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]]; </code></pre> <p>But I don't want to dial a number, I just want to open the phone as I click on the phone icon on home page.</p>
iphone
[8]
2,563,054
2,563,055
Listview - list items updated with fetched data in background
<p>Currently i am having listview with multiple items (First time, i fetch data with the use of AsyncTask), now i want to implement the below functionalities:</p> <p>I am showing Option Dialog(With options Edit, Delete, Read) whenever user do long-click on any item, now if user select "Delete" option, at that time i want to remove item from the listview, listview should be displayed without that item meanwhile the data should also be fetched(in background) from the web.</p> <p>Anybody knows, how do i implement such?</p>
android
[4]
2,330,030
2,330,031
Prevent the loading of images
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2784418/lazy-load-images-when-they-come-into-the-viewport">Lazy load images when they come into the viewport</a> </p> </blockquote> <p>How can I prevent the loading of all image data in a long grid of images, but only loading the visible images. The others should be loaded on demand, when the potion of the grid they're in gets within the visible area of the screen. </p>
javascript
[3]
3,669,988
3,669,989
Transfering data from a sensor to the iphone
<p>I have an external device (some kind of sensor) that can do a measurment. This sensor can be connected to a PC via Bluetooth or USB cable, and it also comes with its own software. I want to develop an app for iphone that will analyze the data that this sensor is measuring (for example creating a graph, calculating some equations etc.). How can i make my iphone to "recognize" this sensor, so the app will get the data that has benn measured from the sensor? is there any manual which explain how to code this? our preffered way of transfering the data is via Bluetooth, so there will be no need of using cables.</p> <p>Thanks a lot, Or.</p>
iphone
[8]
2,044,108
2,044,109
greater or = to a post value
<p>Hi all i have a post value which i am checking to see if its been posted it has atleast 4 numbers (digits) this works perfect.</p> <pre><code>if (isset($_POST['year']) &amp;&amp; !preg_match('/([0-9]{4})/i', stripslashes(trim($_POST['year']))) ) { </code></pre> <p>now i want to check that the value is greater or = to a vairable and not sure how to achive what i need</p> <p>i tried the below with no luck</p> <pre><code>$yearOff = date("Y")-150; echo $yearOff; if (isset($_POST['year']) &amp;&amp; !preg_match('/([0-9]{4})/i', stripslashes(trim($_POST['year']))) &amp;&amp; $_POST['year'] &gt; $yearOff ) { $ageerrors[] = '&lt;span class="error"&gt; You forgot enter your birth YEAR&lt;/span&gt;'; } </code></pre>
php
[2]
3,582,076
3,582,077
get self HTML code with jQuery
<pre><code>&lt;div&gt; &lt;a href="#" class="selected"&gt;link1&lt;/a&gt; &lt;a href="#"&gt;link1&lt;/a&gt; &lt;/div&gt; </code></pre> <p>and using following</p> <p><code>$('.selected').html()</code> I get </p> <p><code>link1</code></p> <p>as a return value.</p> <p>How can I get full html code of the selected DOM element, in this example to get</p> <p><code>&lt;a href="#" class="selected"&gt;link1&lt;/a&gt;</code> </p> <p>instead?</p> <p>thanks</p>
jquery
[5]
452,658
452,659
calculating the quantity of people in a given class
<p>how can one create a <code>class</code> with a <code>constructor</code> that counts the number of people who are alive,if i have 10 people it should count the quantity of people who are alive,people should be objects in this example,lets say i have a <code>class man</code> like this below</p> <pre><code>class man{ private: string name; man(string name=""){ cout&lt;&lt;"there 10 people alive"&lt;&lt;endl; ~man(){} }; int main(){ } </code></pre> <p>i am getting confused on how to go about it,i really need a simple example i want to use the set and get methods</p>
c++
[6]
5,847,777
5,847,778
Android programming using eclipse,
<p>I need to know how to develop database driven application, i have three tables. how to put data in database and how to report them?</p>
android
[4]
3,809,479
3,809,480
Simple string parsing without using boost
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/236129/splitting-a-string-in-c">Splitting a string in C++</a> </p> </blockquote> <p>I'm working on an assignment for my C++ class and I was hoping I could get some help. One of my biggest problems in coding with C++ is parsing strings. I have found longer more complicated ways to parse strings but I have a very simple program I need to write which only needs to parse a string into 2 sections: a command and a data section. For instance: <code>Insert 25</code> which will split it into Insert and 25. </p> <p>I was planning on using an array of strings to store the data since I know that it will only split the string into 2 sections. However I also need to be able to read in strings that require no parsing such as <code>Quit</code> </p> <p>What is the simplest way to accomplish this without using an outside library such as boost? </p>
c++
[6]
1,359,688
1,359,689
How to list users based on checkBox selection using PHP?
<p>I have a text field and two checkbox, i need to list users based on the selection.... can anyone show me an example.... </p>
php
[2]
3,439,905
3,439,906
Reading a contact as vcard on emulator
<p>Here is the snipped of code (which I tried to minimize, just to show the problem. And that's the reason why Uri is hardcoded. Real code receives Uri from Contacts application when a user does "Share" on a contact).</p> <pre><code> Uri uri = Uri.parse("content://com.android.contacts/contacts/as_vcard/0r1-47532F494753492F475349532F492F53492F3D533B49393B3D47532F"); try { InputStream fis = getContentResolver().openInputStream(uri); byte[] buffer = new byte[1024]; fis.read(buffer); } catch (Exception e) { Log.d("zzz", e.getMessage()); } </code></pre> <p>Such code throws "java.io.IOException: read failed: EINVAL (Invalid argument)" on fis.read operation ONLY on emulator (and works fine on a real device). I tried it on Android 4.0.3 and 4.1.2 emulators (both of them fail)</p> <p>I saw a similar questions (description of this problem): <a href="http://stackoverflow.com/questions/12097692/android-read-failed-exception-when-trying-to-read-vcard-contact-data">Android read failed exception when trying to read vCard contact data</a></p> <p>And a bug, which could be related (or not): <a href="http://code.google.com/p/android/issues/detail?id=26480" rel="nofollow">http://code.google.com/p/android/issues/detail?id=26480</a></p> <p>I am running automated tests on emulator and this problem prevents me from running couple of tests.</p> <p>Two questions:</p> <p>a) Have you seen this behavior?</p> <p>b) Do you know any workaround for this problem?</p>
android
[4]
5,539,093
5,539,094
Count how many times each distinct word appears in its input C++
<pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;sstream&gt; #include &lt;map&gt; int main() { std::string input; std::cout &lt;&lt; "Enter input: "; std::getline(std::cin, input); std::map&lt;std::string, int&gt; m; std::map&lt;std::string, int&gt;::iterator it; std::istringstream iss(input); std::string words; do { iss &gt;&gt; words; it = m.find(words); if(it != m.end()) { m.insert(it, std::pair&lt;std::string, int&gt;(words, m[words] + 1)); } else { m.insert(std::pair&lt;std::string, int&gt;(words, 1)); } }while(iss); for(std::map&lt;std::string, int&gt;::iterator it = m.begin(); it != m.end(); ++it) { std::cout &lt;&lt; it-&gt;first &lt;&lt; " - " &lt;&lt; it-&gt;second &lt;&lt; std::endl; } return 0; } </code></pre> <p>The problem is that it prints 1 for every word, even if it appears twice. What could be the problem? I'm not sure if my test for an iterator not to be empty is correct.</p>
c++
[6]
1,418,128
1,418,129
ifstream overload with issue passing value to operator overload
<p>C++ Regarding Passing Value to ifstream issue</p> <p>At main.cpp</p> <pre><code>int main() { vector&lt;String&gt; lineContent; string filename; filename = "somefile.txt"; while(readFile.good()) { getline(readFile, readLine); vectContent.clear(); //line content is a vector //split string input (string line, string delimiter , vector&lt;String&gt; &amp;s) splitString(readLine,",",lineContent); //assume i got a function which does trim of whitespace front and back.. vectContent = trim(lineContent[0]); if(classType="Map2D") { Map2D m2d_temp; readFile &gt;&gt; m2d_temp; } }//end while good } </code></pre> <p>At map2d.cpp</p> <pre><code>ifstream&amp; operator&gt;&gt;(ifstream &amp;in,Map2D &amp;map2d) { int xData; input.ignore(2); input&gt;&gt;xData; cout &lt;&lt; xData &lt;&lt; " " &lt;&lt; yData &lt;&lt; endl; } </code></pre> <p>I think the problem is because instead of using the normal way to read file, i read it by getline..</p> <p>if i use </p> <pre><code>readLine.getline(line,20,','); </code></pre> <p>then the passed in value - input have no issue and able to obtain the line content.</p> <p>So should i do to retain my way of getLine and yet able to pass in stream.</p>
c++
[6]
5,483,450
5,483,451
How to add image to html from sd card
<p>I have an html file. I show it as webview. I tried to add image on it from sd but i couldn't. Here is the code i used:</p> <pre><code>&lt;tr height="21" style='height:15.75pt'&gt; &lt;td height="21" class="xl71" style='height:15.75pt'&gt;&amp;nbsp;&lt;/td&gt; &lt;td class="borderLeft"&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt; &lt;![if !vml]&gt; &lt;span style='mso-ignore:vglayout;add position:absolute;z-index:20;margin-left:24px;margin-top:3px;width:73px; height:144px'&gt;&lt;img src="/sdcard/SurucuImza.jpg" alt="" width="168" height="120" v:shapes="Picture_x0020_421" /&gt;&lt;/span&gt; &lt;![endif]&gt; &lt;span style='mso-ignore:vglayout2'&gt; &lt;table cellpadding="0" cellspacing="0"&gt; &lt;tr&gt; </code></pre> <p>I have used the path here:</p> <pre><code>&lt;img src="/sdcard/SurucuImza.jpg" alt="" width="168" height="120" v:shapes="Picture_x0020_421" /&gt; </code></pre> <p>But it didn't work. I can't show the image. Do you have any idea?</p>
android
[4]
1,122,794
1,122,795
PHP Date Time Current Time Add Minutes
<p>Simple question but this is killing my time.</p> <p>Any simple solution to add 30 minutes to current time in php with GMT+8?</p>
php
[2]
5,351,137
5,351,138
Getting dynamic dropdown value to a Session in PHP
<p>a PHP newbie here and need to clarify a thing.</p> <p>I have populated a dropdown box with data from a SQL database. The code looks like like below.</p> <pre><code>echo '&lt;select id="dropMe" name="dropMe" style="width:150px; font-family:Georgia;"&gt;'; echo '&lt;option value=""&gt;&lt;/option&gt;'; while($rec=mysql_fetch_array($run1)) { $value = $rec['route']; echo "&lt;option value=\"$value\"&gt;$value&lt;/option&gt;"; } echo '&lt;/select&gt;'; </code></pre> <p>What I want to know it is it possible to assign a value selected by a user to a SESSION hence this is a dynamic dropdown? (saveroute is my submit button)</p> <pre><code>if (isset($_POST['saveroute'])) { $Q = $_POST['dropMe']; $_SESSION['menuRoute'] = $Q; echo ($_SESSION['menuRoute']); } </code></pre> <p>I code something like this, but I get an undefined error with 'dropMe'. I'm not quiet familier with this type of error and can some one throw some suggestions or point out any errors in the method.</p> <p>Thanks for looking. </p>
php
[2]
655,141
655,142
How to parse HTML into PHP to comine with another value in PHP?
<p>I have the following PHP (part) code to create a ZIP file.</p> <p>The original code is as follows:</p> <pre><code>$sourcefolder = "./" ; // Default: "./" $zipfilename = "myarchive.zip"; // Default: "myarchive.zip" $timeout = 5000 ; // Default: 5000 </code></pre> <p>I modified it as follows:</p> <pre><code>$sourcefolder = 'uploads/output/'.$foldername.'' ; // Default: "./" $zipfilename = ''.$foldername.'.zip'; // Default: "myarchive.zip" $timeout = 5000 ; // Default: 5000 </code></pre> <p>The $foldername is a value I get from a HTML form which works smoothly for $zipfilename above and the value is parsed smoothly. My problem lies that the fact that the source folder may be incorrect when I use this method. I think I have an error in the $sourcefolder string which I can't seem to resolve.</p> <p>My suspicions is that <code>$sourcefolder = 'uploads/output/'.$foldername.'' ;</code> is incorrect</p> <p>Any suggestions please?</p>
php
[2]
97,720
97,721
EditText hint not displaying
<p>Being new to Android Development <code>(c# OOP dev 10+)</code> I ran into a slight snag (2.3.3) I don't know how to address. I have an <code>&lt;EditText.../&gt;</code> that has two parameters that cancel each other out. </p> <p>What I mean is that as an Android user I really appreciate when people use tags such as android:inputType="numberDecimal" for an input field where they expect numbers. This saves me from having to flip from ABC to 123 keyboard while trying to complete a field. However the problem comes in when trying to use the <code>android:hint="Hint Text"</code>. The hint text won't display if the field has been determined to be a numeric as defined by the <code>android:inputtype</code>. </p> <p>So I was looking for input on how best to resolve this problem. My thoughts are have a label above the input field...this would standout as the rest of the app uses hint's. I could forgo a hint but not really a good idea as the user would be lost as to what info goes in the field. My third and best thought is to define the inputtype as text then handle the onFocus event and switch it to numeric.</p> <p>Any other suggestions welcome. JB</p>
android
[4]
536,757
536,758
Differences between compiler and ast module in python
<p>The compiler module has been deprecated in python 2.6. Does anybody know what is the reason behind the deprecation ? Is the ast module a direct replacement ? Will the ast module be supported in python 3k ?</p>
python
[7]
5,083,371
5,083,372
Java Marker Interface
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4540820/marker-interface">marker interface</a> </p> </blockquote> <p>How Marker interface works since it has no methods?</p>
java
[1]
2,963,455
2,963,456
Need a short, complicated C++ code and a longer, understandable version
<p>In <a href="http://programmers.stackexchange.com/q/9272/2210">this</a> question, I tried to give an example of two ways of doing the same thing in C++: one short but complicated "fancy" piece of code; and a longer but more readable and understandable way of doing the same thing. The question asks whether it's better to have a well-commented fancy piece of code or a self-commented (i.e. no comments) longer version.</p> <p>The problem with my example was that the fancy version turned out to be more understandable than the non-fancy version. Since I can't think of any good examples, I figure I'd try asking here. So what I need is two examples of C++ code which produce the exact same result, but in one version the code is short but very complicated and cannot be understood immediately without having to think about it, and a longer but much more readable and understandable version.</p> <p>I want someone to look at the fancy version and go "Shit, that's complicated. I'm glad it's commented, otherwise I wouldn't have understood what it does" and then look at the longer version and go "Ah, I understand what it does, even without comments". The shorter example should be something like 1-10 lines and the longer maybe 10-30 lines.</p>
c++
[6]
2,689,611
2,689,612
Android Mediaplayer for voice playback
<p>Is there any possible that we can playback our recorded voice in android through media player with the format of wav or mp3 instead of 3gp or mp4.</p> <p>if it is possible please give me a source code or URL. Thanks in advance.</p>
android
[4]
823,189
823,190
javascript undefined variable - doesn't seem like it?
<p>Sorry for the long code, but my environment does not support script tags.</p> <p><a href="http://pastebin.ca/2105293" rel="nofollow">http://pastebin.ca/2105293</a></p> <p>I try to call loadbang (line 976) and get</p> <pre><code>_r.Multistrokes[z].name is undefined </code></pre> <p>I thought I defined it right there in the function, no?</p> <p>Thanks much in advance</p> <p>Joe</p>
javascript
[3]
1,862,902
1,862,903
It is possible to running multiple php files?
<p>I have two different tasks each task is in php file, so I have two php files. Can I run 2 files at the same time?</p>
php
[2]
4,216,787
4,216,788
Types like int, double, char, long, float all start with lowercase letter, except String type. Why?
<p>I am just beginning to program in Java and I noticed that String is the only type that starts with a capital letter.</p> <p>Is there a reason behind this?</p>
java
[1]
5,401,104
5,401,105
how to open web application in 2003 server with VS2005 when error csproj is not installed
<p>application for project .....csproj is not installed. Make sure the application for the project type (.csproj) is installed</p>
asp.net
[9]
3,906,019
3,906,020
Java: Timezone why different timezone give same value in millisec
<p>I have following code, my target is going to return <code>GMT+0</code> time in millisec. But Why I always get my local timezone millisec? </p> <pre><code>Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); Calendar cal2 = Calendar.getInstance(); System.out.println("Time zone id is:"+cal.getTimeZone().getID()+";time in millisec:"+cal.getTimeInMillis()); System.out.println("Time zone id is:"+cal2.getTimeZone().getID()+";time in millisec:"+cal2.getTimeInMillis()); </code></pre> <p><strong>The output is</strong><br> Time zone id is:GMT;time in millisec:<code>1332740915154</code><br> Time zone id is:Europe/Helsinki;time in millisec:<code>1332740915154</code></p> <p>Why different Timezone give SAME value in millisec?<br> I suppose if it is <code>GMT+0</code> then it should be different value in millisec against local time zone.</p>
java
[1]