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
3,861,305
3,861,306
Getting image from a secured website with popup username/password
<p>I am using c# to get a value from a website like so url = </p> <pre><code>"http://user:[email protected]/p/status.html" </code></pre> <p>this works fine once here I can pull the html and get the value.</p> <p>My problem is I am trying to do the same thing but this time pull an image from the webite like so</p> <pre><code>picturebox.Load("http://username:[email protected]/images/pic.jpg"); </code></pre> <p>This returns an unauthorized error.</p> <p>I also tried displaying the picture in a browser using </p> <pre><code>webbrowser.url(uri(http://username:[email protected]/images/pic.jpg"); </code></pre> <p>this works fine. However this is a camera feed so I would have to refresh the page each time which pages it go white and is not what I want.</p> <p>Is there a way to accomplish this? preferably loading the picturebox with the url and getting the image in the picturebox.</p> <p>Thanks,</p>
c#
[0]
2,540,116
2,540,117
Get the IP address of printer
<p>I want connect to the printer via wifi.In order to connect,i should find the ip address and port number of the printer.How to find them?</p> <p>can anybody help me?</p> <p>Thanks.</p>
android
[4]
5,078,538
5,078,539
help to turn numbers into symbols?
<p>I want this code to represent symbols and not numbers (A, O, X)? Can someone give me a simple code to make the numbers into symbols? Thanks </p> <pre><code>int game[3][3]; int x, y; int lines = 0; // select a random grid srand(time(0)); for(x = 0; x &lt; 3; x++) { for(y = 0; y &lt; 3; y++) { game[x][y] = rand() % 3; cout &lt;&lt; game[x][y]; if (y == 2) cout &lt;&lt; '\n'; } } for (y = 0; y &lt; 2; y++) if (game[0][y] == game[1][y] &amp;&amp; game[0][y] == game[2][y]) lines++; </code></pre>
c++
[6]
183,647
183,648
jQuery data attribute click event
<p>I have made a quick fiddle to outline my problem: <a href="http://jsfiddle.net/mYdxw/" rel="nofollow">http://jsfiddle.net/mYdxw/</a></p> <p>I'm trying to click on a div, grab its data attribute and show its corresponding set of divs.</p> <p>Can anyone spot why it isn't doing this currently?</p> <p><em><strong>JS</em></strong></p> <pre><code>$(document).ready(function() { $('.categoryItems').click(function() { $('.itemLinks').hide(); var target_category = $(this).attr('data-target_category'); $('.itemLinks [data-category=' + target_category + ']').show(); }); }); </code></pre> <p><em><strong>HTML</em></strong></p> <pre><code>&lt;div id="categories"&gt; &lt;div data-target_category="html-site-templates" class="categoryItems"&gt;HTML Site Templates&lt;/div&gt; &lt;div data-target_category="jquery-plugins" class="categoryItems"&gt;jQuery Plugins&lt;/div&gt; &lt;div data-target_category="tumblr-themes" class="categoryItems"&gt;Tumblr Themes&lt;/div&gt; &lt;div data-target_category="wordpress-themes" class="categoryItems"&gt;WordPress Themes&lt;/div&gt; &lt;/div&gt; &lt;div id="content"&gt; &lt;a class="itemLinks" data-category="tumblr-themes" href="/tumblr-themes/mini-tumblr-theme/"&gt;Mini Tumblr Theme&lt;/a&gt; &lt;a class="itemLinks" data-category="jquery-plugins" href="/jquery-plugins/randomr-jquery-plugin/"&gt;Randomr jQuery Plugin&lt;/a&gt; &lt;a class="itemLinks" data-category="wordpress-themes" href="/wordpress-themes/redux-wp-theme/"&gt;Redux WP Theme&lt;/a&gt; &lt;/div&gt; </code></pre>
jquery
[5]
2,129,361
2,129,362
flikr api+iphone+for geting photos and latitude/longitude of that photos
<p>I want to use the flikr api. in which i can pass current latitude -longitude and can get the photos and latitude and longitude of that photos.</p> <p>Please help me..If flikr is providing any such url then.. And also please help me if anyone had any knowledge of other such kind of api</p> <p>Thanks</p>
iphone
[8]
83,584
83,585
How to convert date in milliseconds to iso format javascript?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2573521/how-do-i-output-an-iso-8601-formatted-string-in-javascript">How do I output an ISO-8601 formatted string in Javascript?</a> </p> </blockquote> <p>If I have an integer that represents a date in milliseconds, what is the syntax to convert this to an iso format?</p>
javascript
[3]
4,446,716
4,446,717
In C# is there any difference between += and =+?
<p>If I go</p> <pre><code>variable1 =+ variable2 variable1 += variable2 </code></pre> <p>I get the same result for variable1.</p> <p>So is there any difference?</p>
c#
[0]
2,164,693
2,164,694
IE input beeping
<p>I hope someone can help. My asp.net application is exhibiting strange behaviour. Whenever I press the Return/Enter key I get a series of beeps/dings. It sort of goes dindindidindindinggggg !</p> <p>I have reproduced the issue with a small sample application:</p> <pre><code>&lt;%@ Page Language="Oxygene" AutoEventWireup="true" CodeFile="Default.aspx.pas" Inherits="_Default" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt; &lt;/asp:TextBox&gt; &lt;asp:TextBox ID="TextBox2" runat="server"&gt; &lt;/asp:TextBox&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>This only happens in IE, in firefox and chrome there is no beeping. </p> <p>Also as a side issue, if I remove one of the textboxes then there is no dinging but I get a post back instead.</p> <p>Anyone know what is going on here?</p> <p>Thanks,</p> <p>AJ</p>
asp.net
[9]
1,758,782
1,758,783
List-view Lazy Load android
<p>I need to prevent against lazy load in my custom list-view. so i found that scrollview onscroll listner are helpfull over there i have tryed it but not getting success to implement this functionality.</p> <p><strong>code::</strong></p> <pre><code>lviewAdapter = new ListViewAdapter(SaxParser2.this, Arr_ActivityName_fack, Arr_AudioScript_fack,Arr_RequestID_fack,Arr_FolderPath_fack,Arr_RequestTo_fack); lview.setOnScrollListener(SaxParser2.this); lview.setAdapter(lviewAdapter); @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { // TODO Auto-generated method stub if (firstVisibleItem + visibleItemCount == totalItemCount) { generateEntries(); lviewAdapter.notifyDataSetChanged(); } } private void generateEntries() { for (int x = counter; x &lt; counter + 10; x++) { /* * Custom temp = new Custom("Big" + x,"Small" + x); fetch.add(temp); */ Arr_ActivityName_fack[x] = Arr_ActivityName[x]; Arr_AudioScript_fack[x] = Arr_AudioScript[x]; Arr_RequestID_fack[x] = Arr_RequestID[x]; Arr_FolderPath_fack[x] = Arr_FolderPath[x]; Arr_RequestTo_fack[x] = Arr_RequestTo[x]; } counter += 10; } @Override public void onScrollStateChanged(AbsListView arg0, int arg1) { // TODO Auto-generated method stub } } </code></pre> <p>Problem is when i run app,not getting any record.</p>
android
[4]
838,962
838,963
Android - DisplayMetrics Resolution issue when using HDMI
<p>I have a GoogleTV device from Sony which is connected to a Full-HD TV (1920x1080) using HDMI. I use the following code to calculate the target display dimensions of the TV.</p> <pre><code>DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); //dm.widthPixels //dm.heightPixels </code></pre> <p>which works fine and I get 1920 and 1080 px respectively.</p> <p>Now for the issue. When the I connect the GoogleTV box to a different TV with different dimensions, it still shows 1920x1080 whereas the resolution is much different.</p> <p>Is there something I need to extra for getting the new resolution ?</p> <p>Thanks in advance</p>
android
[4]
270,653
270,654
i cant view asp.net pages in my browser
<p>i have created a web project and i want to test it.when i click on debug or click on default page to view on browser , ASP.NET Web Development Server Works but nothing appear in my web browser . even i used internal browser of Visual Studio 2008 but it shows this message : </p> <p>Action canceled</p> <p>i have to mention that there is no installation of IIS in my computer. can you help me please ?</p>
asp.net
[9]
4,361,855
4,361,856
php stacking string query
<p>I am trying to nest if statements based on a query string, but it isnt working</p> <p>query string</p> <pre><code>index.php?list&amp;page=1 </code></pre> <p>php</p> <pre><code>if ($_SERVER['QUERY_STRING'] == 'list') { if ($_GET['page'] == '1') { echo 'hi'; } } </code></pre>
php
[2]
4,342,764
4,342,765
android is it possible to get notified when a new image,video is inserted,deleted from sd?
<p>is it possible to get notified every time a new image,video is inserted on the sd card of your android device and how? I have looked at the Media Scanner class which indexes files but I can't find how to do get notified from that only how to notify Media Scanner of a new image I have created. </p>
android
[4]
1,618,836
1,618,837
JQuery replacing css class attribute of all table cells in a row
<p>I'm trying to set the class attribute of all the cells within a given row in a table. Here is what I've attempted but while I don't get an exception, it doesn't work either.</p> <p>Here is a sample of the current html for the rows/cells is as follows.</p> <pre><code> &lt;tr id="rowid-1234"&gt; &lt;td class="tblistred"&gt;20-400 Silver Metal Closure&lt;/td&gt; &lt;td class="tblistred"&gt;Tecno, LLC&lt;/td&gt; &lt;td class="tblistred"&gt;Closure&lt;/td&gt; &lt;td class="tblistred"&gt;New Item&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>Here is my script:</p> <pre><code> var rowId = "#rowid-" + response.id; $(rowId).each(function (index) { $(this).children('td').addClass('tblist'); }); </code></pre> <p><strong>UPDATE</strong> OK, I changed it to this, but it still isn't setting the class.</p> <pre><code> alert($(rowId).find("td:first-child").text()); $(rowId).children('td').addClass('tblist'); </code></pre> <p>I added the alert to ensure that I have the correct row, and it confirms that I do.</p> <p><strong>SOLUTION</strong> I had to Remove the class that was already there</p> <pre><code> $(rowId + ' td').removeClass('tblistred').addClass('tblist'); </code></pre>
jquery
[5]
4,872,288
4,872,289
Android Development: Webview progress Bar
<p>Take a look at: <a href="http://groups.google.com/group/android-beginners/msg/61802d28a8335809" rel="nofollow">http://groups.google.com/group/android-beginners/msg/61802d28a8335809</a></p> <p>ive done that a got it to work but the progress does not change when clicking on a link in the webbrowser.</p> <p>So the progressbar is showed when the app starts and load the home URL but when i click a link or search in google the bar is not showed. why?</p> <p>Thank-you!</p>
android
[4]
1,028,616
1,028,617
LRU byte Cache java
<p>I need to implement a cache in java with a maximum size, would like to do it using the real size of the cache in the memory and not the number of elements in the cache. This cache will basically have String as key and String as value. I have already implemented the cache using the LinkedHashMap structure of java but the question is how to know the actual size of the cache so that i can adapt the policy to drop an object when the size is too big.</p> <p>Wanted to compute it using the getObjectSize() of the instrumentation package but it seems not working as desired.</p> <p>When I do getObjectSize( a string ) whatever the size of the string is, it returns the same size : 32. I guess it's just using the reference size of the string or something like that and not the content. So don't know how to solve this problem efficiently. </p> <p>Do you have any ideas ? </p> <p>Thanks a lot!</p>
java
[1]
2,370,768
2,370,769
Unable to make multiple calls to single Jquery function
<p>Apologies again - this is probably down to my lack of knowledge with JQuery - but I have set up the following function whihc when passed a parameter which attempt to check for and then remove some dynamically added fields (the check should stop the removal attempt being carried out - if not needed) </p> <pre><code>jQuery.fn.clearFields = function ( clearField ) { var clearfield_search = "#"+clearField+"_search"; var clearfield_link = "#"+clearField+"_link"; var clearfield_search_label = "label[for='"+clearField+"_search']"; var clearfield_link_label = "label[for='"+clearField+"_link']"; alert("About to Remove"); if ($(clearfield_search).length &gt; 0 ) { //Removal of Label and Field (Attempted) //removal of inital break &amp; labels $(clearfield_search_label).prev('br').remove(); $(clearfield_search_label).remove(); $(clearfield_link_label).prev('br').remove(); $(clearfield_link_label).remove(); //Removal of fields $(clearfield_link).remove(); $(clearfield_search).remove(); } alert("Removed"); } </code></pre> <p>But my dilemma is I can't see to make explicit (multiple calls) to this function - - such as </p> <pre><code>jQuery.fn.clearFields("ebsco"); jQuery.fn.clearfields("summon"); </code></pre> <p>it seems only the first function call is executed - then nothing else happens - very frustrating.</p> <p>Do I have to implement the calls using a for loop or the .each method - or I'm guessing there's something more fundamental I'm missing - or there is perhaps an even better cleaner way of doing this ?</p> <p>Again any feedback much appreciated</p>
jquery
[5]
5,088,071
5,088,072
Hiding a cell with a Hidden Field
<p>In my GridView, I am using a Hidden Field to store some data that is not supposed to be seen by the user:</p> <pre><code> &lt;Columns&gt; &lt;asp:BoundField DataField="Название" HeaderText="Название" ItemStyle-Width="250px" HeaderStyle-Width="250px" /&gt; &lt;asp:BoundField DataField="RDName" HeaderText="РД" ItemStyle-Width="250px" HeaderStyle-Width="250px" /&gt; &lt;asp:TemplateField&gt; &lt;ItemTemplate&gt; &lt;asp:HiddenField ID="RD_ID" runat="server" Value='&lt;%# Eval("RD_ID") %&gt;' /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; </code></pre> <p>I have a problem with this. Though the data is not seen in the GridView, the additional empty cell is still there. Could you please tell me how I can hide it completely? Thanks, David</p>
asp.net
[9]
5,189,735
5,189,736
Using _bstr_t to pass parameter of type BSTR* in function
<p>What is the correct way of doing this:</p> <pre><code> _bstr_t description; errorInfo-&gt;GetDescription( &amp;description.GetBSTR() ); </code></pre> <p>or:</p> <pre><code> _bstr_t description; errorInfo-&gt;GetDescription( description.GetAddress() ); </code></pre> <p>Where IError:GetDescription is defined as: </p> <pre><code>HRESULT GetDescription (BSTR *pbstrDescription); </code></pre> <p>I know i could easily do this:</p> <pre><code>BSTR description= SysAllocString (L"Whateva")); errorInfo-&gt;GetDescription (&amp;description); SysFreeString (description); </code></pre> <p>Thanks</p>
c++
[6]
4,646,588
4,646,589
How to submit a form using javascript?
<p>I have a form with id "theForm" which has the following div with a submit button inside:</p> <pre><code>&lt;div id="placeOrder" style="text-align: right; width: 100%; background-color: white;"&gt; &lt;button type="submit" class='input_submit' style="margin-right: 15px;" onClick="placeOrder()"&gt;Place Order&lt;/button&gt; &lt;/div&gt; </code></pre> <p>When clicked, the function "placeOrder()" is called. The function changes the innerHTML of the above div to be "processing ..." (so the submit button is now gone). </p> <p>The above works, but the problem is that I now can't get the form to submit! I've tried putting this in the placeOrder() function:</p> <pre><code>document.theForm.submit(); </code></pre> <p>But that doesn't work.</p> <p>How can I get the form to submit?</p>
javascript
[3]
4,874,325
4,874,326
Does the inaccessible `.0` variable in `locals()` affect memory or performance?
<p>I maintain a project that has a function definition similar to this:</p> <pre><code>def f(a, (b1, b2), c): print locals() </code></pre> <p>While debugging the code I discovered that a <code>.1</code> key appeared in <code>locals()</code>, with the value <code>(b1, b2)</code>. A quick check revealed that a function definition like the following:</p> <pre><code>def f((a1, a2)): print locals() </code></pre> <p>will have a <code>.0</code> key in <code>locals()</code> with the value <code>(a1, a2)</code>. I was surprised by this behavior, but could find no information in the Python documentation.</p> <p>My questions are: do these otherwise-inaccessible positional variables affect memory or performance? Are they documented anywhere? What purpose do they serve?</p> <p>The project in question is feedparser, which is SAX-based and could potentially have dozens or hundreds of function calls that would be affected by this behavior.</p>
python
[7]
3,672,372
3,672,373
Python Library Path
<p>In ruby the library path is provided in $:, in perl it's in @INC - how do you get the list of paths that Python searches for modules when you do an import?</p>
python
[7]
2,950,115
2,950,116
How to generate numbers from an array randomly,with each number being unique
<p>I hav a numeric array,which contains 20 elements.I am displaying the numbers randomly for a blackberry application,bt i want dat all d numbers generated should b unique.It should b randomly generated,bt it has b unique until all the elemnts in the array is exhausted.I am giving the piece of code here,if anyone can help me out,i will b extremely grateful.</p> <pre><code>static int quesNum[] = new int[20]; static int quesCount = -1; private static void initialize(){ Random rgen = new Random(); // Random number generator //--- Initialize the array for (int i=0; i&lt;quesNum.length; i++) { quesNum[i] = i; } //--- Shuffle by exchanging each element randomly for (int i=0; i&lt; quesNum.length; i++) { int randomPosition = rgen.nextInt(quesNum.length); int temp = quesNum[i]; quesNum[i] = quesNum[randomPosition]; quesNum[randomPosition] = temp; } } /*Changed the code to get a unique random number */ public static int getQuestionNumber() { quesCount++; if(quesCount &lt; quesNum.length){ return quesNum[quesCount]; } else{ initialize(); quesCount = -1; return getQuestionNumber(); } } </code></pre>
java
[1]
1,387,140
1,387,141
Displaying Images PHP table Mysql
<p>I am trying to display an image, in a table, the image is in the images folder and the link is placed in the Mysql DB.</p> <p>This is the line of code that calls the image. The mysql query is working but it is only displaying the image link as text and not the picture.</p> <pre><code>&lt;tr &gt;&lt;td &gt;Image&lt;/td&gt; &lt;td &gt;&lt;input type=text name=image value='&lt;img src="&lt;?echo $row['image'];?&gt;"'&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre> <p>I am new to PHP and Mysql, i'm just stuck at this piece of code, </p> <p>How do i get the image to display in the table and not just the code.</p> <p>thanks</p>
php
[2]
5,706,278
5,706,279
Braille in android (IDE: Eclipse)
<p>I am writing an application in android to convert english text to braille. How can I do this? Is there any font that I can download to convert english letters entered by user to Braille or is there any other way to do this?</p> <p>Any support provided will indeed be appreciated!</p>
android
[4]
255,659
255,660
Warning: mail() [function.mail]: SMTP server response: 550 Invalid recipient:
<p>I'm creating a 'forgot password' page where the user enters their email address and the script finds the password associated to that email, and sends it to the stored email address.</p> <p>I believe the problem has to do with my SMTP Mailserver. I am using WAMP which doesn't have one so I downloaded one that was free. </p> <p>This is the php script I'm using:</p> <pre><code> $id = checkEmail($email); $record = readMemberRecord($id); $password = @mysql_result($record,0,'cred'); if($password){ $email_subject = "Email Request"; $email_body = "Your password is ".$password."."; $header = "NinjaMan"; mail($email, $email_subject, $email_body,$header); $msg = "Your password has been sent to ".$email."."; }else{ $msg = "Sorry, the email ".$email." wasn't found."; } </code></pre> <p>The $msg outputs properly so I know the code is passing the mail function.</p>
php
[2]
1,351,341
1,351,342
Undefined pathname in js
<p>I am trying to extract the base of the url:</p> <pre><code>http://google.com/something --&gt; http://google.com http://127.0.0.1:8000/something --&gt; http://127.0.0.1:8000 </code></pre> <p>When I try and use the following:</p> <pre><code>var pathArray = window.location.pathname; alert(pathArray); </code></pre> <p>I get <code>pathArray = undefined</code>. Note: using <code>location.hostname</code> does work here. Why is <code>.pathname</code> returning undefined, and how would I get the url base here? Thank you.</p> <p><strong>Update</strong>: I used <code>var pathArray = 'http://' + window.location</code>.</p>
javascript
[3]
3,938,110
3,938,111
Can Java SE class libraries be used on mobile devices?
<p>I am relatively new to Java, and am developing a Java implementation of a class library I have already written in .NET and Objective-C. The library in Java is primarily being aimed at Android devices (or any device which supports Java) - would a standard Java SE library be compatible with Java ME? The only data types being used are the standard base types, including String, and possibly StringBuffer from the java.text package.</p>
java
[1]
2,470,166
2,470,167
python bisect, it is possible to work with descending sorted lists?
<p>How can I use bisect module on lists that are sorted descending? eg.</p> <pre><code>import bisect x = [1.0,2.0,3.0,4.0] # normal, ascending bisect.insort(x,2.5) # --&gt; x is [1.0, 2.0, 2.5, 3.0, 4.0] ok, works fine for ascending list # however x = [1.0,2.0,3.0,4.0] x.reverse() # --&gt; x is [4.0, 3.0, 2.0, 1.0] descending list bisect.insort(x,2.5) # --&gt; x is [4.0, 3.0, 2.0, 1.0, 2.5] 2.5 at end, not what I want really </code></pre> <p>The only methods are insort (insort_right) or insort_left - none of which work for me. Any suggestions? thank you</p>
python
[7]
2,239,385
2,239,386
alarm: calling an status bar notification activity doesn't work
<pre><code> private void scheduleAlarmReceiver() { AlarmManager alarmMgr = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(this, StatusNotify.class), PendingIntent.FLAG_CANCEL_CURRENT); alarmMgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 2000,AlarmManager.INTERVAL_DAY, pendingIntent); Log.i("alarm", "alarm set"); } </code></pre> <p>statusnotify.class</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_status_notify); NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); int unique_id = 145558; Log.i("status bar" +unique_id , " "); Intent nintent = new Intent(); nintent.setClass(this, TaskTrace.class); PendingIntent pin = PendingIntent.getActivity(getApplicationContext(),0, nintent, 0); String title = "Notification"; String body = "This is a new notification"; Notification n = new Notification(R.drawable.ic_launcher, body, System.currentTimeMillis()); n.contentIntent = pin; n.setLatestEventInfo(getApplicationContext(), title, body, pin); n.defaults = Notification.DEFAULT_ALL; nm.notify(unique_id, n); } </code></pre> <p>Statusnotify works fine when run individually but doesn't get trigered from the alarm class. </p> <p>guess everything is fine in the intent call. Please do help me out. satus bar notifiction must appear 1n 2 seconds when the alarm is set and repeat for every day in same time</p>
android
[4]
2,464,022
2,464,023
Why CompilationTask.getTask(...) automatically creates a folder for output the class files?
<p>I'm doing following to compile my java files. <code>outputFolder</code> is the folder where all my java files are located.</p> <pre><code> //specify classes output folder Iterable&lt;String&gt; options = Arrays.asList("-d", outputFolder); Iterable&lt;? extends JavaFileObject&gt; fileObjects = fileManager.getJavaFileObjects(files); JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, listener, options, null, fileObjects); </code></pre> <p>It complies perfectly. But, it automatically creates a folder called "test" and spits all class files in there... Any clue why my program is doing that? Is there any thing that I've missed?</p> <p>I tried the follwing code too... but still no luck... I got the same result</p> <pre><code>this.filePath = filePath; outputFolder = this.filePath;//+ java.io.File.separator +"outputFolder"; classFolder = new File(outputFolder); if(!classFolder.exists()){ classFolder.mkdir(); } fileManager.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(classFolder)); </code></pre>
java
[1]
4,357,324
4,357,325
Is there a Python module for transparently working with a file-like object as a buffer?
<p>I'm working on a pure Python parser, where the input data may range in size from kilobytes to gigabytes. Is there a module that wraps a file-like object and abstracts explicit .open()/.seek()/.read()/.close() calls into a simple buffer-like object? You might think of this as the inverse of StringIO. I expect it might look something like:</p> <pre><code>with FileLikeObjectBackedBuffer(urllib.urlopen("http://www.google.com")) as buf: header = buf[0:0x10] footer = buf[-0x10:] </code></pre> <p>Note, I asked a <a href="http://stackoverflow.com/questions/14017349/is-there-a-python-module-for-transparently-working-with-a-files-contents-as-a-b">similar quesetion</a> yesterday, and accepted <code>mmap</code>ing a file. Here, I am specifically looking for a module that wraps a file-like object (for argument's sake, say like what is returned by <code>urllib</code>).</p>
python
[7]
2,183,692
2,183,693
clear a view and redraw a image
<p>How to dealloc a view and realloc it?</p> <p>Code:</p> <pre><code>-(IBAction)CancelButton{ [drawImage removeFromSuperview]; [drawImage dealloc]; </code></pre> <p>When you click on the cancel button the view gets cleared but nothing can be drawn on the page. I need to draw on the page.</p>
iphone
[8]
2,671,034
2,671,035
jQuery - If input has more or less that 10 characters inside
<p>I want to make a custom validation for an phone number input.<br></p> <pre><code>var telVal = $("#telefon").val(); if(telVal == '') { $("#telefon").addClass('eroare png'); hasError = true; } </code></pre> <p>This gives me an error if user does not type anything in this input, but I want to check if user types 10 characters. So, the script must be like</p> <blockquote> <p>if(telVal has 9 characters or more than 10) { do this }</p> </blockquote> <p>Thank you!</p>
jquery
[5]
2,394,119
2,394,120
how to get onunload event on IE
<p>Hi i need to catch an onUnload event but its working in firefox not in IE . Can we capture onUnload event in IE?</p>
jquery
[5]
4,133,908
4,133,909
Is inheritance supported for view controllers and nibs
<p>I am creating 2 view controllers and 2 nibs for each of the supported orientations of my app - portrait and landscape as recommended by <a href="http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/BasicViewControllers/BasicViewControllers.html#//apple_ref/doc/uid/TP40007457-CH101-SW26" rel="nofollow">apple</a>.</p> <p>The problem is that I am going to have loads of duplicated code - will inheritance work in interface builder?</p> <p>i.e. can I declare a iboutlet label in a base class and use it for both of the nibs?</p> <p>EDIT: I have 2 controllers, both inherit from a basecontroller. Can I have my IBactions and IBOutlets and arrays and tableview delegate code in the base and then link it from 2 different nibs? I am trying to get rid of some duplication</p>
iphone
[8]
4,437,493
4,437,494
jquery - remove a div from form
<p>I have a form whose html looks like:</p> <pre><code>&lt;div id="form_container"&gt; &lt;h1&gt;&lt;a&gt;Untitled Form&lt;/a&gt;&lt;/h1&gt; &lt;form action="save_form" method="post" id="newform" name="newform"&gt; &lt;div class="form_description"&gt; &lt;h2 class="editable"&gt;Form title. Click here to edit&lt;/h2&gt; &lt;p class="editable"&gt;This is your form description. Click here to edit.&lt;/p&gt; &lt;/div&gt; &lt;ul id="form_body"&gt; &lt;li id="field1" class="world"&gt; &lt;a href="#" onclick="return false;" class="hover"&gt; &lt;label class="editable" for="field1"&gt;Text1&lt;/label&gt; &lt;input type="text" name="field1" value=""&gt;&lt;/a&gt; &lt;div class="element_actions"&gt; &lt;img src="/images/ico_delete_16.png" alt="Delete." title="Delete" class="remove_element"&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>I would like to clone the form and remove the 'element_actions' div from it. I do not want to modify the existing form, just the cloned version of it.</p> <p>I have tried 'remove()' and 'detach' without success.</p> <p>Here's the test on jsfiddle: <a href="http://jsfiddle.net/truthseeker/LYCkt/" rel="nofollow">http://jsfiddle.net/truthseeker/LYCkt/</a></p> <p>thanks for your help.</p>
jquery
[5]
331,935
331,936
how to install jist/swans in windows?
<p>i want to run jist/swans on windows to be able to compile and run via command line </p> <p>this <strong>didn't</strong> help: <a href="http://vanet.info/node/98" rel="nofollow">http://vanet.info/node/98</a></p> <p>source: jist.ece.cornell.edu/sw.html </p> <p>i would really appreciate any easy to do tutorial on how to do setup this!</p>
java
[1]
4,580,127
4,580,128
How to track Gps data from Android Mobil?
<p>I started to learn about Micro..Now I'm doing tacking data from GPS and if will be get data search from Google Earth and then User can create scheduletime in mobile if u r arrived that place and show message, I want to get any Suggestion ??</p>
java
[1]
2,604,767
2,604,768
iPhone:Tabbar hides when pushing from TableView to UIViewController
<p>I have four Tab bar items in a Tab bar which is being bottom of the view where i have the TableView. I am adding Tab bar and items programmatically (Refer below code) not through I.B. Click on first three Tab bar items, will show the data in the same TableView itself. But clicking on last Tab bar items will push to another UIViewcontroller and show the data there. The problem here is, when i push to the viewController when clicking on last Tab bar item, main "Tab bar" is getting removed.</p> <p>Tab bar code:</p> <pre><code>UITabBar *tabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0, 376, 320, 44)]; item1 = [[UITabBarItem alloc] initWithTitle:@"First Tab" image:[UIImage imageNamed:@"first.png"] tag:0]; item2 = [[UITabBarItem alloc] initWithTitle:@"Second Tab" image:[UIImage imageNamed:@"second.png"] tag:1]; item3 = [[UITabBarItem alloc] initWithTitle:@"Third Tab" image:[UIImage imageNamed:@"third.png"] tag:2]; item4 = [[UITabBarItem alloc] initWithTitle:@"Fourth Tab" image:[UIImage imageNamed:@"fourth.png"] tag:3]; item5 = [[UITabBarItem alloc] initWithTitle:@"Fifth Tab" image:[UIImage imageNamed:@"fifth.png"] tag:4]; NSArray *items = [NSArray arrayWithObjects: item1,item2,item3,item4, item5, nil]; [tabBar setItems:items animated:NO]; [tabBar setSelectedItem:item1]; tabBar.delegate=self; [self.view addSubview:tabBar]; </code></pre> <p>Push controller code clicking from last Tab bar item:</p> <pre><code>myViewController = [ [MyViewController alloc] initWithNibName:@"MyView" bundle:nil]; myViewController.hidesBottomBarWhenPushed=NO; [[self navigationController] pushViewController:myViewController animated:NO]; </code></pre> <p>I am not seeing bottom Tab bar when i push my current TableView to myViewController. I am seeing full screen view there. I want to see bottom Tab bar always when every tab item clicked. What might be the problem here? Could someone who come across this issue, please share your suggestion to me?</p> <p>Thank you.</p>
iphone
[8]
5,560,092
5,560,093
php code to display none?
<p>I'm sure this is fairly simple but I really don't get php is there a way to have the below code to display none if there's no url details entered?</p> <pre><code> &lt;div class="details"&gt; &lt;h3&gt;web&lt;/h3&gt; &lt;div&gt;URL: &lt;span&gt;&lt;a href="&lt;?=$website_url?&gt;"&gt;&lt;?=$website_url?&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Thanks</p>
php
[2]
3,325,199
3,325,200
Print value of number (int) spelled out
<p>is there an out-of-box way to spell out an int in C#? For example if I have:</p> <pre><code>int a = 53; </code></pre> <p>I want to print:</p> <pre><code>"fifty three" </code></pre> <p>not</p> <pre><code>"53" </code></pre> <p>If not, does anybody have any examples on how to accomplis this?</p> <p>Thanks!</p>
c#
[0]
1,079,858
1,079,859
How to display clicked button names in another screen in android?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/12262535/how-to-store-and-display-the-button-names-in-different-screensthat-are-clicke">How to store and display the button names ( in different screens)that are clicked by user in android</a> </p> </blockquote> <p>I have several buttons in one screen ,I want to that only clicked button names should be displayed in next screen.</p> <p>How can I do this?</p>
android
[4]
4,150,706
4,150,707
SensorManager.getOrientation()vs. Sensor.TYPE_ORIENTATION
<p>sry if there are Information which answer my question but I can't find anything to solve my problem.</p> <p>I try to get the same Information from azimuth,pitch and roll from the "orientationsensor" and SensorManager.getOrientation() to compare these different ways. I know that SensorManager.getOrientation()give me values in radians is there a solution to calculate azimuth(0-360),pitch(0- +-180) and roll(+-90) from these radians values.</p> <p>Thank You Marcel</p>
android
[4]
4,057,580
4,057,581
How to edit file on console from Java?
<p>I'm trying to edit a file from CLI. I'm executing the <code>nano</code> command (I know that command will always be available); when I execute it, I can see nano's output but I cannot interact with it. How can I pass user input to the command? Do you have a better idea to easily edit a file from within my Java app?</p> <p>This is my code:</p> <pre><code>String command = "nano /tmp/163377867.txt "; try { Process process = Runtime.getRuntime().exec(command); InputStream inputStream = process.getInputStream(); InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String line; while ((line = bufferedReader.readLine()) != null) { System.out.println(line); } } catch (IOException e) { e.printStackTrace(); } </code></pre>
java
[1]
3,393,848
3,393,849
share feature of menu in android application
<p>i asked so many question regarding my title but i could not get my proper answer till yet.I need to implement androd's menu feature in my application ie when we goes to gallery in android phone, when we press menu than it comes with lots of option like share...etc.My question is can i implement same menu feature in my application? It is possible or not? Thanks</p>
android
[4]
2,471,170
2,471,171
building ModalViewAction programmtically
<p>on pressing infobutton modalviewaction comes next to show uiviewcontroller which has uitext view and uinvigation controller on top of uitextview with done button to navigate back to mainviewcontroller. </p> <p>Everything is handled programmtically without interfacebuilder.</p> <p>can someone please show me that what will be the code to present uiviewcontroller modally. i am struggling with this issue for last so many days but it shows only uitextview but not navigationcontroller with done button to goback.</p> <pre><code>self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease]; [self.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; _viewController = [[ModalViewController alloc] init]; [self presentModalViewController:self.viewController animated:YES]; </code></pre> <p>With above lines of code it shows only UITextview</p> <p>when i add below lines of code to the above code like this</p> <pre><code>self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease]; [self.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; _viewController = [[ModalViewController alloc] init]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:_viewController]; navigationController.navigationBar.tintColor = [UIColor brownColor]; self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(Done:)] autorelease]; [self presentModalViewController:self.viewController animated:YES]; [navigationController release]; </code></pre> <p>application crashes and receives message program received signal SIGABRT</p> <p>thanks</p>
iphone
[8]
2,735,691
2,735,692
Serialization of Queue type not working
<p>Consider this piece of code:</p> <pre><code>private Queue Date=new Queue(); //other declarations public DateTime _Date { get { return (DateTime)Date.Peek();} set { Date.Enqueue(value); } } //other properties and stuff.... public void UpdatePosition(...) { //other code IFormatter formatter = new BinaryFormatter(); Stream Datestream = new MemoryStream(); formatter.Serialize(Datestream, Date); byte[] Datebin = new byte[2048]; Datestream.Read(Datebin,0,2048); //Debug-Bug Console.WriteLine(Convert.ToString(this._Date)); Console.WriteLine(BitConverter.ToString(Datebin, 0, 3)); //other code } </code></pre> <p>The output of the first WriteLine is perfect. I.e to check if really the Queue is initialised or not. It is. The right variables are stored etc. (I inserted a value in that Queue, that part of the code is not shown.)</p> <p>But the second WriteLine is not giving the right expected answer: It serializes the entire Queue to 00-00-00.</p>
c#
[0]
979,882
979,883
What does "Return false;" in onclick event for JavaScript mean?
<p>What does "Return false;" in onclick event for JavaScript mean?</p> <pre><code> &lt;input type="button" runat="server" id="btnCancel" value=" Cancel " style="width:70px;" onclick="document.location.href = 'ReportPanel.aspx'; return false;" /&gt; </code></pre> <p>in the onclick event. It has <code>return false;</code> What does it mean? What does it mean if <code>return true;</code>?</p>
javascript
[3]
492,992
492,993
How to start a newline in C++ while doing equations
<p>Im reading through "The C++ Programming Language" and my current assignment is to make a program that takes two variables and determines the smallest, largest, sum, difference, product, and ratio of the values.</p> <p>Problem is i can't start a newline. "\n" doesn't work because i have variables after the quote. And "&lt;&lt; endl &lt;&lt;" only works for the first line. I googled the hell out of this problem and im coming up short.</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt; #include &lt;algorithm&gt; #include &lt;cmath&gt; using namespace std; inline void keep_window_open() {char ch;cin&gt;&gt;ch;} int main() { int a; int b; cout&lt;&lt;"Enter value one\n"; cin&gt;&gt;a; cout&lt;&lt;"Enter value two\n"; cin&gt;&gt;b; (a&gt;b); cout&lt;&lt; a &lt;&lt; " Is greater than " &lt;&lt; b; (a&lt;b); cout&lt;&lt; a &lt;&lt; " Is less than " &lt;&lt; b; keep_window_open(); return 0; } </code></pre>
c++
[6]
306,479
306,480
Is it possible to get the Identity value in the ItemInserted event in a listView?
<p>I'd rather not make a call to the database to query @@IDENTITY. Is there some way to get the identity value for what was just inserted through code?</p>
asp.net
[9]
3,933,090
3,933,091
How to pass a integer into a javascript function?
<p>I am getting a response from ajax request(done by jquery). </p> <p>I have a method that displays errors to the users. Sometimes though I have some other information coming along with the json request.</p> <p>So I don't want this info shown(where the rest of the errors are). So I figured since I always know the length of the json coming back I can just shorten the length since the error method just uses a while loop so if it is one less then it won't display that json part.</p> <p>So I did this</p> <pre><code>var length = result.length -1; ErrorsMethod(result, length); // call function. function ErrorsMethod(result, length) { while( i &lt; length) { // do stuff. } } </code></pre> <p>length is always undefined when it gets passed in though. I don't understand why.</p> <p>I then tried</p> <p>length.length ParseInt(length);</p> <p>None seems to work. I don't even know what I am working with. When I do an alert of "length" var before it goes into the function it spits out a number.</p>
javascript
[3]
2,866,357
2,866,358
Creating Android background images
<p>Does anyone know how to manage background images for android applications?</p> <p>I have my backgrounds looking pretty sweet in my app, however, when ported to another device they are stretched to fit and look awefull.</p> <p>So my question is how do i specify my background image size in dp to account for the ever changing range of devices??</p> <p>any help would be great - thanks.</p>
android
[4]
5,116,781
5,116,782
Is it posible to check how much memory browser is using and clear memory currently using by javascript?
<p>i am stuck with big problem i working on big project that is hanging browser automaticaly javacript executes<br> "how to detect how much memory javascript is using and clear the memory in regular interval.Is it posible?"</p>
javascript
[3]
2,466,646
2,466,647
Get std::fstream failure error messages and/or exceptions
<p>I'm using fstream is there any way to get the failure message/ excpetion. for example if unable to open the file I want to get the reason for it.</p>
c++
[6]
4,549,697
4,549,698
Android system stops application when launching Media Intent
<p>I am launching a media intent to take a photo. After the user took a picture and gets back to the previous activity the whole application has restarted. </p> <p>As this doesn't happen all the time, I think my application goes to the background and android kills it when the device has low memory.</p> <p>Is there any way to keep my application from going to the background?</p> <p>Thanks!</p>
android
[4]
1,000,825
1,000,826
Global variables in Javascript across multiple files
<p>A bunch of my JavaScript code is in an external file called helpers.js. Inside the HTML that calls this JavaScript code I find myself in need of knowing if a certain function from helpers.js has been called.</p> <p>I have attempted to create a global variable by defining:</p> <pre><code>var myFunctionTag = true; </code></pre> <p>In global scope both in my HTML code and in helpers.js.</p> <p>Heres what my html code looks like:</p> <pre><code>&lt;html&gt; ... &lt;script type='text/javascript' src='js/helpers.js'&gt;&lt;/script&gt; ... &lt;script&gt; var myFunctionTag = false; ... //I try to use myFunctionTag here but it is always false, even though it has been se t to 'true' in helpers.js &lt;/script&gt; </code></pre> <p>Is what I am trying to do even doable? </p> <p>Thanks,</p>
javascript
[3]
5,880,571
5,880,572
Android Layout, displaying Multiple Colums
<p>Hi Im new to android. I want to display text such that it would be like:</p> <ol> <li>TITLE 1.1</li> </ol> <p>text about title 1.1</p> <ol> <li>TITLE 1.2</li> </ol> <p>text about title 1.2</p> <ol> <li>TITLE 2.1</li> </ol> <p>text about title 2.1</p> <blockquote> <blockquote> <p>and so on</p> </blockquote> </blockquote> <p>it would be a scrolling windows, but another problem is text could be lengthy and could span multiple lines. What do you recommend i should breakup my layout with. The length will be more then the screen height so i need scrollbars. Plus need to keep title bold.</p> <p>Basically i would be printing this text from a String Array. Is it possible to display it directly from arrays or i can also work with simple strings but need to know how should i breakup my layout. like scrollview -> table layout or what??</p> <p>Thanks,</p>
android
[4]
930,602
930,603
log out function not working (session not killed)
<pre><code>function killsession() { // global $_SESSION; $_SESSION = array(); if (session_id() != "" || isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time() - 42000, '/'); } session_unset(); session_destroy(); header("Location: "index"); } </code></pre> <p>Any ideas why $_SESSION['userid'] still stands after I run this function? I literally stay logged in.</p> <p>Session name and start() is set at the top of every page.</p>
php
[2]
3,375,459
3,375,460
App is started again instead of running current activity
<p>I have a question, I noticed an effect when testing my release on my mobile device like described in this <a href="http://stackoverflow.com/questions/3042420/home-key-press-behaviour/10706598#10706598">link</a>. To sumarize it, after installing my App, when I instantly start it, it is started from a different "root" than when I start it from the home screen. The effect is that when I press the home button after starting it and then want to return to the running activity the app is started again (because it was started from a different context). On this link there is also a solution proposed, but I don`t like it so much. So what I wanted to ask at last is, does this effect appear also to users who are downloading my app from the market? Because if, then I would be really suprised, because till it happened to me I didnt read about it at all and I also didnt hear that somebody has got this problem.</p> <p>Thanks a lot in advance, with best regards eMu</p>
android
[4]
1,752,920
1,752,921
Java programming style
<p>its a maybe a dumb question but i am curious to understand this thing.... The below code works but the one below that doesn't work.</p> <pre><code>import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Menu extends JFrame { public Menu() { JMenuBar menubar = new JMenuBar(); ImageIcon icon = new ImageIcon("exit.png"); JMenu file = new JMenu("File"); file.setMnemonic(KeyEvent.VK_F); JMenuItem fileClose = new JMenuItem("Close",icon); fileClose.setMnemonic(KeyEvent.VK_C); fileClose.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event) {System.exit(0);} }); file.add(fileClose); menubar.add(file); setJMenuBar(menubar); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(300,200); setLocationRelativeTo(null); } public static void main (String args[]) { new Menu(); } } </code></pre> <p>The below one doesn't work</p> <pre><code>import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Menu extends JFrame { public Menu() { setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(300,200); setLocationRelativeTo(null); JMenuBar menubar = new JMenuBar(); ImageIcon icon = new ImageIcon("exit.png"); JMenu file = new JMenu("File"); file.setMnemonic(KeyEvent.VK_F); JMenuItem fileClose = new JMenuItem("Close",icon); fileClose.setMnemonic(KeyEvent.VK_C); fileClose.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event) {System.exit(0);} }); file.add(fileClose); menubar.add(file); setJMenuBar(menubar); } public static void main (String args[]) { new Menu(); } } </code></pre> <p>I thought Java supports free style coding !!! (that's what it says in my Book)</p> <p><em>PS: Please Someone Edit the Tile to suit the question correctly, I am not sure what to put in Title.</em></p>
java
[1]
2,545,457
2,545,458
C++ for loop/char pointer "hack"
<p>I have a small piece of code which does something funny, but I can't figure out how it does it.</p> <pre><code>int main(int argc, const char * argv[]) { char text[] = "object"; for(char *ptr = &amp;text[0]; *ptr != '\0'; ptr+=2) { cout &lt;&lt; ptr &lt;&lt; endl; ptr--; } return 0; } </code></pre> <p>What's happening is that it goes from [1], [2], [3] and so on, to the end of the string every time, printing the content out. I cant understand how it does that, as pointer never gets dereferenced, but right letters seems to get printed. I would assume that instead of the letters of the string, the pointer values would print as weird characters thats all, yet, that's not what happens. </p>
c++
[6]
1,109,182
1,109,183
Refresh page when url hash is present
<p>I have a navigation system on my site that uses javascript to slide horizontally stacked divs left and right into view. I'm trying to make the site function better with javascript turned off, so I have a second navigation system that uses hash values to 'go to' the appropriate section. <br /><br /> The problem arises if someone is on say <a href="http://mysite.com/#page2" rel="nofollow">http://mysite.com/#page2</a> then turns javascript on. The page reloads at the #page2 section which then causes the javascript enabled navigation system to not work correctly. e.g. it reloads thinking the page is at section 1 when it is actually displaying section #whatever.<br /><br /> I have tried adding parent.location.hash = ''; but when the page reloads, it still stays on whichever section it was on.<br /><br /> Any ideas on how to make the page fully refresh when javascript gets turned on?</p>
javascript
[3]
306,604
306,605
Is possible to run export command from java?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2460297/run-shell-command-from-java">run shell command from java</a> </p> </blockquote> <p>I want to export some variable so I have this command.</p> <pre><code>Runtime.getRuntime().exec("export a=b"); </code></pre> <p>what is wrong with this command because this throw exeption:</p> <p>java.io.IOException: Cannot run program "export": java.io.IOException: error=2, No such file or directory</p>
java
[1]
1,357,624
1,357,625
How to know how many event listeners there are on the page
<p>I am building a fairly large application in Javascript. It is a single page that can change different views. All the views have their own variables, events, listeners, elements, etc.</p> <p>When working with large collections and multiple events it's sometimes good to know what exactly is happening on the page.</p> <p>I know all the browsers have developer tools, but sometimes it's hard to click trough all the elements etc. And some options I can not find.</p> <p>One thing I am interested in is to know how many events there currently listened for on the page. This way I can confirm that I am not creating zombies.</p> <p>If the sollution is a developer tool, please let me know where to look and what to do. And most important, which browser to choose.</p>
javascript
[3]
4,194,095
4,194,096
how to check connection to php page
<p>I might have written the title wrong. Sorry for that.</p> <p>I just wonder if there is a way to check users connection to a php page. </p> <p>For example, i have a php page called "download.php" and this page lets user to download sth and insert this action to mysql, like that</p> <pre><code>$query = "INSERT INTO bla bla "; $result = mysql_query($query); header('Content-type: application/zip'); header('Content-Length: ' . filesize($file)); header("Content-Disposition: attachment; filename="file.zip"); readfile($file); </code></pre> <p>But sometimes, download manager softwares like "orbit" etc... connect this page hundreds of time, and blow up the database. </p> <p>is there a way to prevent this ?</p> <p>Thanks</p>
php
[2]
1,480,670
1,480,671
how to solve this exception in java on my mail server open-exchange?
<p>![Error to create new context open-exchange][1]</p> <pre><code>/opt/open-xchange/sbin/registerserver -n oxserver -A oxadminmaster -P admin_master_password server could not be registered: Error: connection failed to host: 127.0.0.1; nested exception is: java.net.ConnectException: Conexión rehusada </code></pre>
java
[1]
2,377,174
2,377,175
How to use WebClient.UploadFileAsync to upload files and POST Params as well?
<p>I am using <code>WebClient.UploadFileAsync</code> to upload local files to a web server and I would also like to pass some parameters with the post as well. I would like to send a few fields that will tell the PHP code on the server specific locations on where to save the uploaded files.</p> <p>I tried to put the fields directly into the url, for example:</p> <pre><code>WebClient client = new WebClient(); Uri uri = new Uri("http://example.com/upload.php?field1=test"); client.UploadFileAsync(uri, "POST", "c:\test.jpg"); </code></pre> <p>The PHP code returns false for <code>isset($_REQUEST['field1'])</code>.</p> <p>Thank you for any suggestions.</p> <p><a href="http://stackoverflow.com/questions/4615507/pass-post-params-to-webclient-uploadfileasync">NOTE: this question was also asked in very similar format for vb.net a while back, but it did not get any answers,</a></p>
c#
[0]
962,775
962,776
is using constants for language file a good idea from the performance point of view?
<p>im trying to implement a language file. im tossing between gettext and constants. i noticed that several OS projects use constants. are there any performance dissadvantages to using many constants?</p>
php
[2]
1,608,638
1,608,639
French date format
<p>I am a newbie in PHP &amp; wordpress. I wanted to know how to make this codde renders the date formating in french (e.g. 5 Fev) when your on the french side but in english format in English (e.g. Jan 5)</p> <p>Here is my code:</p> <pre><code>&lt;?php if (strtolower(ICL_LANGUAGE_CODE) == 'en') {$sidePosts = get_posts('cat=3,4,5,19&amp;posts_per_page=5&amp;order=DESC&amp;orderby=date');} if (strtolower(ICL_LANGUAGE_CODE) == 'fr') {$sidePosts = get_posts('cat=9,10,11,17&amp;posts_per_page=5&amp;order=DESC&amp;orderby=date');} foreach($sidePosts as $sidePosts) { $array = (array) $sidePosts; print("&lt;li&gt;"); print("&lt;span class='date'&gt;".get_the_time('M j', $array[ID])."&lt;/span&gt;"); print("&lt;a href='".get_permalink($array[ID])."' title='".$array[post_title]."'&gt;".$array[post_title]."&lt;/a&gt;"); print("&lt;/li&gt;"); } ?&gt; </code></pre>
php
[2]
26,125
26,126
Generic binary search Java
<p>I've been trying to make this code work. I have to create a generic binary version of the binary search. I'm not sure how to compare two generic types without the comparable interface</p> <pre><code>import java.util.ArrayList; public class BinarySearcher&lt;T&gt; { private T[] a; public BinarySearcher(T[] words) { a = words; } public int search(T v) { int low = 0; int high = a.length - 1; while (low &lt;= high) { int mid = (low + high) / 2; T midVal = a[mid]; if (v.compareTo(midVal) &lt; 0) { low = mid - 1; } else if (v.compareTo(midVal) &gt; 0) { high = mid + 1; } } return -1; } public int compareTo(T a) { return this.value.compare - b; } } </code></pre> <p>This is the tester class:</p> <pre><code>import java.util.Arrays; import java.util.Scanner; /** This program tests the binary search algorithm. */ public class BinarySearchTester { public static void main(String[] args) { String[] words = {"Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliet", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey", "X-Ray", "Yankee", "Zulu"}; BinarySearcher&lt;String&gt; searcher = new BinarySearcher&lt;String&gt;(words); System.out.println(searcher.search("November")); System.out.println("Expected: 13"); System.out.println(searcher.search("October")); System.out.println("Expected: -1"); } } </code></pre>
java
[1]
3,124,849
3,124,850
how to test the presence of an application on a android smartphone
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3694267/android-check-for-presence-of-another-app">Android - check for presence of another app</a> </p> </blockquote> <p>How to check if an application is installed on the smartphone? For my application, I need to know if Facebook and Twitter are installed on the smartphone.To see if I can use them.</p>
android
[4]
1,962,066
1,962,067
DetailsView web control does not change to insert mode when insert is clicked
<p>I'm binding a hashtable to a detailsview web control in ASP.NET 2.0. I have my edit/delete/insert link buttons on the detailsview, but when clicking new, the mode does not change.</p> <p>Any ideas why?</p> <p>If you need code examples, I will be happy to provide them.</p> <p>Thanks</p>
asp.net
[9]
2,894,511
2,894,512
how do you get rid of the picture title bar when using action bar?
<p>Hi I was just wondering if anyone could help me get rid of this bar with the picture above the singleplayer/multiplayer/friends tabs</p> <p><img src="http://i.stack.imgur.com/kkQTu.png" alt="enter image description here"></p> <p>Here is what I tried :</p> <pre><code>ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setDisplayUseLogoEnabled(false); </code></pre> <p>I couldnt find any other option that would take care of this case... Thanks for the help</p>
android
[4]
5,332,111
5,332,112
can't catch java.lang.VerifyError
<p>I'm getting this error: "Uncaught handler: thread main exiting due to uncaught exception java.lang.VerifyError"</p> <p>It's only happening on 1.6. Android 2.0 and up doesn't have any problems, but that's the main point of all.</p> <p>I Can't catch the Error/Exception (VerifyError), and I know it's being caused by calling isInitialStickyBroadcast() which is not available in SDK 4, that's why it's wrapped in the SDK check. I just need this BroadcastReceiver to work on 2.0+ and not break in 1.6, it's an app in the market, the UNDOCK feature is needed for users on 2.0+ but obviously not in 1.6 but there is a fairly amount of users still on 1.6.</p> <p>How to fix?</p> <p>Thanks!</p> <pre><code>private BroadcastReceiver mUndockedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { //FROM ECLAIR FORWARD, BEFORE DONUT THIS INTENT WAS NOT IMPLEMENTED if (Build.VERSION.SDK_INT &gt;= 5) { if (!isInitialStickyBroadcast()) { int dockState = intent.getExtras().getInt("android.intent.extra.DOCK_STATE", 1); if (dockState == 0) { finish(); } } } } }; </code></pre>
android
[4]
364,095
364,096
What style do you use for creating a "class"?
<p>There are a few ways to get class-like behavior in javascript, the most common seem to be prototype based like this:</p> <pre><code>function Vector(x, y, x) { this.x = x; this.y = y; this.z = z; return this; } Vector.prototype.length = function () { return Math.sqrt(this.x * this.x ... ); } </code></pre> <p>and closure based approaches similar to</p> <pre><code>function Vector(x, y, z) { this.length = function() { return Math.sqrt(x * x + ...); } } </code></pre> <p>For various reasons the latter is faster, but I've seen (and I frequently do write) the prototype version and was curious as to what other people do.</p>
javascript
[3]
3,004,904
3,004,905
simple question: how to pull out some info from an object in Java
<p>I'm working in java, and I have a method that returns a pair, ie. (String, integer). At a different point in the program, I want to pull out the String alone. How do I do that? </p> <p>Thanks.</p>
java
[1]
1,010,219
1,010,220
Python execute complex shell command
<p>Hi I have to execute a shell command :diff &lt;(ssh -n [email protected] cat /vms/cloudburst.qcow2.*) &lt;(ssh -n [email protected] cat /vms/cloudburst.qcow2) I tried </p> <pre><code>cmd="diff &lt;(ssh -n [email protected] cat /vms/cloudburst.qcow2.*) &lt;(ssh -n [email protected] cat /vms/cloudburst.qcow2)" args = shlex.split(cmd) output,error = subprocess.Popen(args,stdout = subprocess.PIPE, stderr= subprocess.PIPE).communicate() </code></pre> <p>However I am getting an error diff: extra operand cat</p> <p>I am pretty new to python. Any help would be appreciated</p>
python
[7]
2,390,696
2,390,697
How To Generate A Unique 4-Digit String
<p>I'm looking for a way to generate a (fairly) unique (non auto-incrementing) 4-digit string using the numbers 0 - 9 for each digit using C#. I can validate uniqueness and generate another number if a dup is found. I had thought about basing the number somehow on the DateTime object's Ticks property but am having a difficult time putting the pieces together.</p> <p>Any thoughts or expertise would be much appreciated.</p>
c#
[0]
1,130,297
1,130,298
The type initializer for 'ClosedXML.Excel.XLWorkbook' threw an exception
<pre><code>using ClosedXML.Excel; class XLSXWriter : BExporter { private readonly string _fName; public XLSXWriter(string fileName) { _fName = fileName; } public override void Export(IEnumerable&lt;AnimalData&gt; animals) { var workBook = new XLWorkbook(); &lt;---Throws an exception var workSheet = workBook.Worksheets.Add("MySheet"); workSheet.Cell("A1").Value = "Hello World"; FileStream fs = new FileStream(_fName, FileMode.Create); workBook.SaveAs(fs); fs.Close(); } } </code></pre> <p>Just trying this library <code>ClosedXML.dll</code>, and it throws an exception can't figure out what could be the problem. I get the <code>_fName</code> from the <code>savefiledialog</code>. Ideas anybody?</p>
c#
[0]
2,341,254
2,341,255
return in PHP code
<p>when we use <code>return</code> in PHP on global scope, after <code>return</code>, does execution just stop? or processing will go on?</p> <pre><code>&lt;?php if(defined("A")) return; define("A", true); echo "Hello"; if(defined("A")) return; define("A", true); echo "Hello"; ?&gt; </code></pre>
php
[2]
3,160,717
3,160,718
C# Enum or int constants
<p>I have a group of values that represent a state (ON, OFF, READY, ...). These values also get stored in a DB as an int field, so I am wondering if best practices would say to make this an enum or just bunch of const int types on a class. </p> <p>Enum seems like a natural fit for human reading/coding, but it seems like it hides the fact that it matters which integers the values map to (or else values retrieved from a DB will be instantiated to the incorrect state). Someone may come in later and add a new value to the enum or something and throw the whole thing off. </p> <p>Which is the better approach?</p>
c#
[0]
1,707,498
1,707,499
Add another item in javascript
<p>I am trying to add another item to the approval list below. I also want to make sure if the code is correctly formatted. </p> <pre><code> function getApprovers() { //generate a list of approvers from APPROVAL_LISTS and APPROVALS_REQUIRED var approvers = []; if (item.APPROVALS_REQUIRED !== null) { approvers = item.APPROVALS_REQUIRED; } if (item.APPROVAL_LISTS !== null) { //I am trying to add another item here for example Tools_APPROVAL_LISTS, //What is the correct way to do this. approvers = approvers.concat(item.APPROVAL_LISTS.APPROVALS_REQUIRED); } approvers = getUnique(approvers); return approvers; } </code></pre>
javascript
[3]
2,915,864
2,915,865
Reading a website table from android
<p>I would like to read a 3 column table from a site and store it to three variables <code>col1</code>,<code>col2</code>,<code>col3</code> I found here a sample code <a href="http://www.devx.com/wireless/Article/39810/1954" rel="nofollow">connecting to the web tutorial</a> and I'm trying to manipulate it </p> <pre><code>String str = DownloadText("http://XXXX.com/table1.htm"); TextView txt = (TextView) findViewById(R.id.text); txt.setText(str); </code></pre> <p>know i see on the emulator the html source</p> <pre><code>&lt;html&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt; &lt;body&gt; &lt;table border="0"&gt; &lt;tr&gt; &lt;td class="col1"&gt;8800&lt;/td&gt; &lt;td class="col2"&gt;test&lt;/td&gt; &lt;td class="col3"&gt;300&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>How can I store each cell into a variable (e.g. col1=8000, col2=test, col3=300) ?</p>
android
[4]
5,213,658
5,213,659
How to detect operating system encoding in php?
<p>I want to detect a operating system of filesystem's encoding as default, like Windows OS in different language version it will use different encoding (iso-8859-1, ms950, big5, gb2312..etc) So how can I detect the different operating system of encoding in PHP? Any idea? Thanks.</p>
php
[2]
5,456,340
5,456,341
Appending data into an array when condition is met?
<p>I'm trying to keep a timer for users in my IRC. When a user types a message I'm trying to insert the username &amp; time of the message. This is to stop spammers.</p> <pre><code>if(userList.Contains(username)) { //check the time of message //if last message is 3 seconds ago or greater, continue } else { //Add username &amp; time into the array keeping all other values too } </code></pre> <p>The problem is I don't know how to append data into the array. I don't know how to copy the other existing array data into the new array with the new values. Can this be done?</p> <p>Since array.Contains() doesn't work for two-dimensional arrays, what can I do to record the username and time? Should I insert data in two arrays?</p> <p>Thank you for the help.</p>
c#
[0]
3,231,346
3,231,347
Change default phone language by changing application language in Android?
<p>Is there any way to change language of phone by changing the language from application.</p> <p>I mean when I change the language of my application then the default phone language will also change.</p> <p>Is there any idea about this then please share here.</p> <p>Thanks in advance.</p>
android
[4]
601,678
601,679
how to slice two images into one image in iphone
<p>Hi I have one app where i need to slice two or three images into one image can anybody help me in this</p>
iphone
[8]
3,411,867
3,411,868
android how to make native zip application
<p>I would like to create a zip file from files located on the sd card, I have managed to do that using java but I think that the result is too slow, so I thought of going native using the android NDK.</p> <p>My questions are: </p> <p>Does anyone know any C/C++ library to zip unzip files that will work on android?</p> <p>How to know if the library will work on android?</p> <p>will this make any difference on performance?</p> <p>reagrds maxsap</p>
android
[4]
1,471,162
1,471,163
Flow control patterns and best practices
<p>We got in argument with co-worker about the patterns of flow control and general code design. Need your opinion - which is the better/cleaner/preferred way of writing the code ?</p> <p>This is for MVC 3, but that doesn't really matter.<br/> Version 1:</p> <pre><code>public ActionResult Login(LoginData loginData) { if (!ModelState.IsValid) { ShowGlobalError("Invalid credentials."); return View(loginData); } UserProfile profile = null; try { // see if we have profile with those credentials profile = this.RetrieveUserProfile(loginData.Email.Trim(), loginData.Password.Trim()); // this just goes to db and tries to get user profile. Returns null if profile isn't found } catch (Exception ex) { ShowGlobalError("DB is down"); LogError(...); return View(loginData); } if (profile == null) { // nope, we don't.. ask again ShowGlobalError("Invalid credentials."); return View(loginData); } // ok, we're good Session["Profile"] = profile; FormsAuthentication.SetAuthCookie(profile.Email, false); FormsAuthentication.RedirectFromLoginPage(profile.Email, loginData.EnablePermanentCookie); return View(loginData); } </code></pre> <p>Version 2:</p> <pre><code>public ActionResult Login(Credentials credentials){ try{ PersonalProfile profile = AuthenticateUser(credentials); SetProfileSessionstate(profile); // this does 'Session["Profile"] = profile;' SetFormsAuthenticationAndRedirect(profile); } catch(Exception ex){ ShowGlobalError("invalid login, please try again."); } return View(credentials); } public void SetFormsAuthenticationAndRedirect(PersonalProfile profile){ FormsAuthentication.SetAuthCookie(profile.Email, loginData.EnablePermanentCookie); FormsAuthentication.RedirectFromLoginPage(profile.Email, loginData.EnablePermanentCookie); } </code></pre> <p>Version 1 is littered with return statements, version 2 is using try/catch for flow control. So, which is the better way, or are we both doing it wrong, and there's a better way you can share ?</p> <p>Thanks !</p>
c#
[0]
2,624,458
2,624,459
PHP> Extracting html data from an html file?
<p>What I've been trying to do recently is to extract listing information from a given html file,</p> <p>For example, I have an html page that has a list of many companys, with their phone number, address, etc'</p> <p>Each company is in it's own table, every table started like that: <code>&lt;table border="0"&gt;</code></p> <p>I tried to use PHP to get all of the information, and use it later, like put it in a txt file, or just import into a database.</p> <p>I assume that the way to achieve my goal is by using regex, which is one of the things that I really have problems with in php,</p> <p>I would appreciate if you guys could help me here. (I only need to know what to look for, or atleast something that could help me a little, not a complete code or anything like that)</p> <p>Thanks in advance!!</p>
php
[2]
10,968
10,969
How do I modify the background color of an empty UITableViewCell object based on it's position?
<p>I'm trying to write code to modify the background color of a cell based on it's position in the table. While the following code 'works', it only effects cells that are passed to it. Empty cells don't get effected.</p> <pre><code>- (void)tableView: (UITableView*)tableView willDisplayCell: (UITableViewCell*)cell forRowAtIndexPath: (NSIndexPath*)indexPath { if(!indexPath.row%2) { cell.backgroundColor = [UIColor colorWithRed: 0.0 green: 0.0 blue: 1.0 alpha: 1.0] ; NSLog(@"Blue"); } else{ cell.backgroundColor = [UIColor whiteColor]; NSLog(@"white"); } cell.textLabel.backgroundColor = [UIColor clearColor]; cell.detailTextLabel.backgroundColor = [UIColor clearColor]; } </code></pre> <p>How can I effect the rest of the cells that are displayed, if empty, when there are few items in the list?</p>
iphone
[8]
887,179
887,180
Vanilla JS plugin template
<p>Okay, we all know how to write jQuery plugins: <a href="http://docs.jquery.com/Plugins/Authoring" rel="nofollow">http://docs.jquery.com/Plugins/Authoring</a></p> <p>Can someone advise pure javascript template plugin? With methods and default settings.</p> <p>I want to make it work with single node and <strong>with node array</strong> (<code>querySelectorAll</code>)</p> <p>Something like this:</p> <pre><code>var PliginName = function(selector){ ... } </code></pre> <p>And call it like this:</p> <pre><code>var dropdown = new PluginName('.dropdown'); </code></pre> <p>And be able to close all dropdown like this:</p> <pre><code>dropdown.close(); </code></pre>
javascript
[3]
2,848,723
2,848,724
Orientation in UITabBarController + UIViewController
<p>Anyone please answer for my requirement </p> <p>Im using my application in this order,</p> <p>first page = UIViewController, secondpage = UITabBarController with 4 tabs,</p> <ol> <li>I need landscape on the orientation on the second tabpage(UIViewController) ? not working..</li> </ol> <p>Note : When using UITabBarController its working perfect but when I add the UIViewController for my first page, the orientation not working...?</p> <p>anyone who knows the solution plz answer</p>
iphone
[8]
2,556,033
2,556,034
ASP.NET custom server control cannot make binding expression work on properties
<p>I got an issue which annoys me a lot... I have a custom server control which has a Text property. When I put that control inside the in repeater, listview, etc, for example, given the following markup:</p> <pre><code>&lt;ItemTemplate&gt; &lt;dl:SimpleLabel ID="lblTest" runat="server" Text='&lt;%#Eval("FirstName")%&gt;' /&gt; &lt;/ItemTemplate&gt; </code></pre> <p>When viewing it in browser, it ouputs <code>&amp;lt%Eval("FirstName")%&amp;gt</code> in the source. Do I need to handle the binding in my server control (the Text property already got the Bindable attribute set to true) or it should just work. What is the standard way of doing this?</p> <p>Thanks in advance.</p> <p>Cheers</p>
asp.net
[9]
3,319,466
3,319,467
what is the output if x == 42
<pre><code>switch (x % 5) { case 0: cout &lt;&lt; x++ &lt;&lt; ''; case 1: cout &lt;&lt; x-- &lt;&lt; ''; break; case 2: cout &lt;&lt; ++x &lt;&lt; ''; case 3: cout &lt;&lt; --x &lt;&lt; ''; default: cout &lt;&lt; 2*x &lt;&lt; ''; } </code></pre>
c++
[6]
4,148,370
4,148,371
numeric variables in JS
<p>For a variable x=5, how do I know it is number five or the character '5'? </p> <p>Btw, in JS, do characters follow the ASCII table? Then can I manipulate a character variable. For example, if variable x is character a, can I do x=x+1 to make it character b?</p>
javascript
[3]
884,594
884,595
function concept
<pre><code>void execute(int &amp;x,int y=100) { x=x+y; cout&lt;&lt;x&lt;&lt;endl; } void main() { int a=5,b=6; execute(b); } </code></pre> <p>will the following program work in spite of not assigning a default value to the x(formal parameters in the fuction prototype).</p>
c++
[6]
4,740,040
4,740,041
why setName in Thread class assigns to a character array?why not a String?
<p>When i was dealing with threads concept in Java, i have seen Thread.java source file. I noticed when <code>setName()</code> method assigns string to a character array called <code>"name[]"</code>. Java has a feature of String data type, then why they are using character array. </p> <p>In source file it is initialised like,</p> <pre><code>private char name[]; // why not "private String name;" </code></pre> <p>In <code>setName()</code> method,</p> <pre><code>public final void setName(String name) { checkAccess(); this.name = name.toCharArray(); } </code></pre> <p>Please help me. Thanks in advance.</p>
java
[1]
5,355,197
5,355,198
Bind actions to some html then append
<p>Let's imagine that we have some piece of html with appended actions.</p> <pre><code>var html = $('&lt;a href="#"&gt;click me&lt;/a&gt;'); html.find('a').bind('click', function(e) { alert('You clicked me!'); }); </code></pre> <p>Now we want append this piece of html (with binded actions) to some <code>&lt;div id="destination"&gt;&lt;/div&gt;</code>.</p> <pre><code>$('#destination').append(html); </code></pre> <p>Is it possible? (see <a href="http://jsfiddle.net/6v5NJ/11/" rel="nofollow">jsfidder</a>)</p> <p>I need this functionality to bind some actions for modal window's content and then append this content to modal window's html wrapper and then invoke <code>Modal.show()</code>. So </p> <p>Is it good practice or it is not recommended to do?</p>
jquery
[5]