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,184,258
1,184,259
FOSS java library to generate *.mobi ebooks?
<p>Firstly there is an almost identical question but the answer is not really satisfactory.</p> <p><a href="http://stackoverflow.com/questions/5032131/is-there-a-java-or-ruby-library-for-generating-mobi-ebook-documents">Is there a Java or Ruby library for generating MOBI ebook documents?</a></p> <p>The answer basically gives a link to amazon and discusses using command line tools which is not really satisfactory for a web app. I want a regular jar file w/ an api that i can invoke without any nasty process invocation.</p> <p>Does anyone know of a FOSS library that provides this functionality ? I would rather simething like ITEXT that allows me to build the document and then writes the mobi file rather than something that converts an already ready PDF into the MOBI.</p>
java
[1]
4,424,783
4,424,784
iPhone:Tabbar item actions are not happening
<p>I created a window application, which has a tabbar controller with four tabbar items. Each tabbar items are linked with a tableview. I have also set Navigation bar for each tabbar items. I have appdelegate file, which calls the first tableview controller of which is set for first tabbar item. I am trying to retrieve and do an action whenever a tabbar item is clicked. For that, i tried to add "- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item" and "- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UITableViewController *)viewController"</p> <p>in my first tableview controller, but it is not at all responding whenever i click any tabbar items. My question is, if i create a window based application and added tabbar controller, tableview and navigation bar in .XIB file, is it not possible to access and do an action programatically whenever a tabbar item is clicked? (or) Am i doing anything wrong? </p> <p>Please help me to resolve this and share your ideas.</p> <p>Thanks.</p>
iphone
[8]
3,350,383
3,350,384
How can I popup when no connection the default Connection Failed dialog?
<p>Whenever a application needs internet and connection fails, I get a message dialog </p> <p><code>Connection failed<br> This application requires network access. Enable mobile network or Wi-Fi to download data.</code></p> <p>and two buttons, Settings, Cancel.</p> <p>How do I detect there is no internet connection?<br> How do I popup a same dialog in my application?</p>
android
[4]
1,733,460
1,733,461
How to add corners to a view
<p>I added a full border around a view but I need to add just the corner as shown image below :</p> <p><img src="http://i.stack.imgur.com/UAnOZ.png" alt="enter image description here"></p> <p><strong>I mean the red corner only .</strong></p> <p>I tried to adjust the below border xml , but it didn't work :</p> <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"&gt; &lt;stroke android:width="10dp" android:height="10dp" android:color="#B22222" /&gt; &lt;solid android:color="#FCE6C9" /&gt; &lt;corners android:radius="20dp" /&gt; &lt;/shape&gt; </code></pre> <p>Any help will be appreciated </p>
android
[4]
5,007,540
5,007,541
jquery global animation duration
<p>I have a page with many jQuery animations, each has it's own duration defined individually. </p> <p>I want to disable all the animations on mobile devices by setting the duration to 0.</p> <p>Is there a way to overwrite all the animation durations globally?</p> <p>something like this:</p> <pre><code> if (isMobile()) { $.animation.duration.disable = true; } </code></pre>
jquery
[5]
3,838,405
3,838,406
Android: Handler for AsyncTask
<p>I use AsyncTask in combination with a ProgressDialog. See my code, I have a problem in onPostExecute. If the task is running for the first time it get a Null Poiter Exception for progressDialog in handleMessage but calling dismiss() direct would work. When I turn the phone before onPostExecute is reached, progressDialog.dismiss() does not work. why does the handler not always work?</p> <pre><code>public class UpdateTask extends AsyncTask&lt;Void, Void, Void&gt; { private ProgressDialog progressDialog; private Handler handler; public UpdateTask(Act activity) { progressDialog = ProgressDialog.show(Activity.this, "Wait", "Wait"); progressDialog.dismiss(); handler = new Handler(){ @Override public void handleMessage(Message msg) { //run on UI Thread switch( msg.what ){ case MSG: progressDialog.show(); break; case DETACH: progressDialog.dismiss(); break; } } }; } void detach() { activity=null; //problematic //progressDialog.dismiss(); //handler.sendEmptyMessage(DETACH); } @Override protected Void doInBackground(Void... params) { handler.sendEmptyMessage(MSG);; return null; } protected void onPostExecute(Void result) { if (activity==null) { Log.w("RotationAsync", "onPostExecute() skipped -- no activity"); } else { //problematic // progressDialog.dismiss(); handler.sendEmptyMessage(MSG); progressDialog = null; } } }; </code></pre>
android
[4]
1,566,607
1,566,608
How to overload methods with variable number of arguments?
<p>I have a class that holds a mysqli instance (this to avoid spreading database settings all over the source code).</p> <p>The class DB looks like:</p> <pre><code>class DB { private $mysqli; public function connect() { $this-&gt;mysqli = new mysqli("localhost", "user", "pwd", "db-name"); } public function __call($method, $args) { return $this-&gt;mysqli-&gt;$method(extract($args)); } } </code></pre> <p>As you might see what I'm trying to do is to overload every method call executing the mysqli ones.</p> <p>In the other php file I have:</p> <pre><code>$unq_vstr = $this-&gt;db-&gt;query("SELECT * FROM user_log WHERE user_ip='$ip' AND user_last_visit='$now';"); if ($unq_vstr-&gt;num_rows &gt; 0) { // ERROR // ... } </code></pre> <p>But I'm getting "Notice: Trying to get property of non-object in /home/alessandro/www/admin/index.php on line 25" corresponding to the if statement ($unq_vstr->num_rows).</p> <p>What am I doing wrong? I'm pretty sure it might depend on the DB class, but I can't figure out what the problem is.</p> <p>Do you think I should use an alternative way to do it (without wrap mysqli inside my own class)? Any suggestion is appreciated.</p>
php
[2]
609,601
609,602
Fetch the data in dropdownlist from table using web service in android
<p>I want to display data in dropdown list from the table using of web service in android.i am not getting any idea can u help me.</p>
android
[4]
1,351,975
1,351,976
Pointer to lowest address in memory
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1001307/detecting-endianness-programmatically-in-a-c-program">Detecting endianness programmatically in a C++ program</a> </p> </blockquote> <p>I'm trying to check if I'm running a little or big endian OS.</p> <pre><code>int main() { int i = 1; unsigned char b = i; char *c = reinterpret_cast&lt;char*&gt;(&amp;i); // line 5 cout &lt;&lt; "Processor identified as: " &lt;&lt; endl; if (*c == b) cout &lt;&lt; "Little endian" &lt;&lt; endl; else cout &lt;&lt; "Big endian" &lt;&lt; endl; } </code></pre> <p>I'm not sure if casting an <code>int*</code> to <code>char*</code> pointer in line 5 is guaranteed to return a lowest address. Am I doing it right?</p>
c++
[6]
1,044,663
1,044,664
Incorrect UUID format in component c#
<p>I need help with the next code, that throws the exception Error emitting 'System.Runtime.InteropServices.GuidAttribute' attribute -- 'Incorrect UUID format.'</p> <pre><code>[GuidAttribute(Discover.CLASS_DiscoverPlugin)] public class Discover : TCustomDiscoverPlugin { public const string CLASS_TenderDialogePlugin = "{CB19D13D-C194-49f1-B1A0-75B49283CFC8}"; public const string CLASS_DiscoverPlugin = "{6111098C-B821-432d-9EC3-146BF5D1C276}"; public override Object PluginGUIDs() { string[] classIDs = new string[1]; classIDs[1] = CLASS_TenderDialogePlugin; return classIDs; } } </code></pre>
c#
[0]
1,322,748
1,322,749
Emulator Not Working in Eclispe
<p>Hello everyone I can't seem to figure out why my emulator isn't working and I don't get the error in the console </p> <p>Here is what it says in the console </p> <pre><code>[2011-08-24 16:28:59 - MePlayer] Android Launch! [2011-08-24 16:28:59 - MePlayer] adb is running normally. [2011-08-24 16:28:59 - MePlayer] Performing com.meplayer.afajje.MePlayer activity launch [2011-08-24 16:28:59 - MePlayer] Automatic Target Mode: Preferred AVD 'Droid' is not available. Launching new emulator. [2011-08-24 16:28:59 - MePlayer] Launching a new emulator with Virtual Device 'Droid' [2011-08-24 16:29:01 - Emulator] invalid command-line parameter: Files. [2011-08-24 16:29:01 - Emulator] Hint: use '@foo' to launch a virtual device named 'foo'. [2011-08-24 16:29:01 - Emulator] please use -help for more information </code></pre>
android
[4]
2,144,805
2,144,806
Importing modules to a package
<p>Is there anyway I can import modules to a package level?</p> <p>for example, consider the following package:</p> <pre><code>- conf - __init__.py - general.py </code></pre> <p>Now I have another package:</p> <pre><code>- conf2 - __init__.py </code></pre> <p>I would like to be able to use <code>import conf2.general</code>. That means, somehow importing the general.py module to conf2 package.</p> <hr> <h2>EDIT:</h2> <p>I have added the following import to <code>conf2/__init__.py</code>: from conf import general</p> <p>Now, I can use <code>from conf2 import general</code> and it works fine. However, what I would like to achieve is <code>import conf2.general</code>. Is that possible?</p>
python
[7]
4,628,022
4,628,023
What is the equivalent of top.location in php?
<p>I am using javascript <code>top.location</code> to retrieve parent location through javascript</p> <p>What i wanted to know is there any way to get parent url through php? </p> <p>I have tried <code>$_SERVER</code> with different parameters but i am getting the child window url.</p>
php
[2]
1,266,971
1,266,972
Is this piece of Javascript inefficient?
<p>I was just wondering whether this snippet of Javascript is going to slow down my site:</p> <pre><code>$(function(){ var realLink = location.href; $( "#nav a" ).each( function( intIndex ){ String.prototype.startsWith = function(str){ return (this.indexOf(str) === 0); } var pageLink = $(this).attr("href"); if ( realLink.startsWith(pageLink) ) $(this).parent().addClass("active"); } ); }); </code></pre> <p>It only loops about 5-7 times, and I don't have very much Javascript looping experience.</p>
javascript
[3]
242,760
242,761
What is the fastest/preferred way to store static data in android?
<p>I want to store around a thousand strings (like some quotes) and populate a <code>ListView</code> or <code>ListFragment</code> using them. These strings are static and not likely to change once loaded. </p> <p>It is a read-only data and user should not be allowed to manipulate it.</p> <p>Should i store them using XML file or a text file, or what could be the best approach?</p>
android
[4]
4,643,679
4,643,680
jQuery - Can't stop getting old submit values from a previous successful form submit
<p>Lets say I have a form:</p> <pre><code>&lt;form id="form1" method="post"&gt; &lt;ul&gt; &lt;li class="button"&gt; Button 1! &lt;input name="some_input" type="hidden" value="Number 1" /&gt; &lt;/li&gt; &lt;li class="button"&gt; Button 2! &lt;input name="some_input" type="hidden" value="Number 2" /&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/form&gt; </code></pre> <p>and my javascript is:</p> <pre><code>&lt;script type="text/javascript"&gt; $('document').ready(function () { $('li.button').bind("click", function() { $('form1').submit(); }); }); &lt;/script&gt; </code></pre> <p>Note: When I click on the li element Button!, it triggers the form to submit. </p> <p>Now when I click (e.g. Button 1!) the form gets sent, it gets sent successfully, and it is processed without any problems. However problem arise when I hit the "Back" button on the browser and click on a different link (e.g. Button 2!). It seems to me as if the browser is submitting the same value as before, even though the input values for the both of them are different.</p> <p>How do I solve this?</p>
jquery
[5]
5,867,600
5,867,601
When do I need to use the global keyword in python
<p>Okay, so I've had this really annoying problem where a variable got set locally but then outside of that function reverted to it's old self (in this case None), but at the same time I could manipulate other variables and still can without using the "global" keyword.</p> <p>I can't provide the real code for this but it goes something like this:</p> <pre><code>foo = {} foo_foo = {} bar = None def changes_foo(): ...do some stuff to foo... class EditThread(threading.Thread): def __init__(self): setup() def run(self): for key, value in foo.items(): do_update_task(key, value) def do_update_task(self, key, value): ...do some editing too foo... del foo[key] bar = [key, value] foo_foo[key] = value def print_the_bar(): print bar </code></pre> <p>Please note that all the operations on <code>foo</code> and <code>foo_foo</code> works just fine, but bar is still None when I call <code>print_the_bar</code>, and I've had lots of print statements in my code to verify that bar inside of <code>do_update_task</code> indeed has the correct values and isn't None.</p> <p>Could someone please explain to me why it is so?</p>
python
[7]
4,337,334
4,337,335
How can I pass a value as class private property
<p>is it possible for a class to accept a dynamic value and make it its private variable?</p> <p>example:</p> <pre><code>class test{ private $var = $x; private function fromUser($var){ //code here } } </code></pre> <p>i want <code>$x</code> to be dynamic like coming from a user input.</p>
php
[2]
3,548,045
3,548,046
How can I retrieve the name of the user's current city?
<p>I would like to retrieve an iPhoneOS user's current city. How can I do that?</p>
iphone
[8]
5,187,772
5,187,773
Javascript setTimeout
<p>Can you tell me why this works:</p> <pre><code>PageMethods.UpdateForcedDisposition(forcedDisposition, a.value, SucceededCallback, FailedCallback); </code></pre> <p>When this doesn’t?</p> <pre><code>setTimeout("PageMethods.UpdateForcedDisposition(" + forcedDisposition + "," + a.value + ", SucceededCallback, FailedCallback);", 1000); </code></pre> <p>Interestingly, a similar call works with <a href="https://developer.mozilla.org/en/window.setTimeout" rel="nofollow"><code>setTimeout</code></a>:</p> <pre><code>setTimeout("PageMethods.UpdateSales(" + id + ", " + a.value + ", SucceededCallback, FailedCallback);", 1000); </code></pre> <p>…I’m stumped!</p>
javascript
[3]
5,260,647
5,260,648
Global keyboard input listener on Android
<p>I was wondering if it is possible to intercept keyboard input on a global level on Android. For example a user types in text into an edittext (does not matter which application) I would like to access said text to check for certain words. Is this even possible with Android's security model (yes I am aware this kind of feature could be used for various wrong things too). </p> <p>Thanks,<br> b3n</p>
android
[4]
1,321,237
1,321,238
How to make a C++ class compatible with stringstream objects?
<p>I would like to be able to serialize my C++ classes using standard techniques like std::stringstream or boost::lexical_cast.</p> <p>For example if I have a Point object (2, 4) then I would like to serialize it to "(2, 4)", and also be able to construct a Point object from this string.</p> <p>I have some code already but with a few issues. Point to string works, but sometimes the input isn't completely read from the stream. The string to Point conversion results in a bad_cast exception.</p> <pre><code>class Point { public: Point() : mX(0), mY(0) {} Point(int x, int y) : mX(x), mY(y){} int x() const { return mX; } int y() const { return mY; } private: int mX, mY; }; std::istream&amp; operator&gt;&gt;(std::istream&amp; str, Point &amp; outPoint) { std::string text; str &gt;&gt; text; // doesn't always read the entire text int x(0), y(0); sscanf(text.c_str(), "(%d, %d)", &amp;x, &amp;y); outPoint = Point(x, y); return str; } std::ostream&amp; operator&lt;&lt;(std::ostream&amp; str, const Point &amp; inPoint) { str &lt;&lt; "(" &lt;&lt; inPoint.x() &lt;&lt; ", " &lt;&lt; inPoint.y() &lt;&lt; ")"; return str; } int main() { Point p(12, 14); std::string ps = boost::lexical_cast&lt;std::string&gt;(p); // "(12, 14)" =&gt; OK Point p2 = boost::lexical_cast&lt;Point&gt;(ps); // throws bad_cast exception! return 0; } </code></pre> <p>How can I fix these problems?</p>
c++
[6]
5,308,789
5,308,790
How to change String value after 5 sec?
<p>I'm willing to write program that after 5 sec shows text that was hidden and after another 5 sec changes both. Example: - program start: TEXT 1 - after 5 sec: TEXT 1 TEXT 2 - after 5 sec: TEXT 3 - after 5 sec: TEXT 3 TEXT 4 ...</p> <p>How I can in C# count those seconds? </p>
c#
[0]
3,524,472
3,524,473
Query about temporary objects
<p>In Exceptional C++, item 10, its talking about use of a temporary (if you have the book, top of page 35 "... namely, the copy of the returned temporary into the destination").</p> <p>The code is</p> <pre><code>template&lt;class T&gt; T Stack::&lt;T&gt;::Pop() { ... T result = ... return result; } ... string s1(s.Pop()); </code></pre> <p>I'm not quite clear on what temporary is being created where and why.</p> <p>When you return an object by value from a function is a temporary always created? Why and what's its scope? In this case s1 is being copy constructed, presumably from the temporary? Why can it not be constructed from the result object within the function?</p> <p>TIA</p> <p>------- EDIT --------- I think I got confused because the book is using the term copy, and its using it with the meaning of an operation while I was thinking of it meaning duplicate. Verr good clear book in general, but this particular paragraph perhaps isn't as clear as it could be.</p>
c++
[6]
5,239,533
5,239,534
How to toggle GPS from an Android appwidget?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4721449/enable-gps-programatically-like-tasker">Enable GPS programatically like Tasker</a> </p> </blockquote> <p>I am making an app that shows gps icon as widget on home-screen. Now, i want to toggle GPS on or off when clicking this icon. I am stuck here. Any help?</p>
android
[4]
3,627,808
3,627,809
Call java class method from jar (not main)
<p>I need to call specific <code>class</code> <code>method</code> from Jar. Is it possible ?</p>
java
[1]
2,480,078
2,480,079
Can you separate python projects logically into separate files/classes like in C#/Java?
<p>I'm looking to develop a project in python and all of the python I have done is minor scripting with no regard to classes or structure. I haven't seen much about this, so is this how larger python projects are done? </p> <p>Also, do things like "namespaces" and "projects" exist in this realm? As well as object oriented principles such as inheriting from other classes?</p>
python
[7]
5,626,951
5,626,952
Select2 doesn't show selected value
<p>Select2 loads all items from my list successful, the issue I found when try to select a specific value when page loads. Example:</p> <p>:: put select2 in a specific html element, no value is selected even all items are loaded.</p> <pre><code>$('#my_id').select2(); </code></pre> <p>:: When the page is loaded I'm trying to show a specific item selected, but doesn't work as expected, because even selected, the select2 doesn't show it.</p> <pre><code>$('#my_id').val('3'); //select the right option, but doesn't render it on page loads. </code></pre> <p>How to make a selected option to pop up when pages loads?</p> <p>Thanks in advance.</p> <h1>UPDATED</h1> <p>:: How I load all select2 items (sorry, its jade, not pure HTML):</p> <pre><code>label(for='category') Category span.required * select(id='category', style='width:230px', name='category') option(value='') - Select - each cat in categories option(value='#{cat.id}') #{cat.description} </code></pre> <p>P.S.: All items from my list are loaded.</p> <p>:: How I initialize the select2:</p> <p>Just put the following line code on my javascript and it does successful:</p> <pre><code>$('#category').select2(); </code></pre> <p>:: How I'm trying to select a specific value:</p> <ul> <li><p>First attempt:</p> <pre><code>$('#category').select2( { initSelection: function(element, callback) { callback($('#field-category').val()); } } ); </code></pre></li> <li><p>Second attempt:</p> <p>$('#category').val($('#field-category').val());</p></li> </ul> <p>P.S.: #field-category has a value its a hidden input field and works OK.</p> <p>Thanks, guys!</p>
jquery
[5]
6,007,153
6,007,154
adding incorrectly displaying
<p>Fixed my code up. However, now the alert pops up saying your value is NaN. However, it is a number. The parseInt, helped a little bit. I am most likely missing something. Right now my code looks like this:</p> <pre><code> &lt;input id="a" type="text"&gt; &lt;script&gt; function myFunction() { x=document.getElementById("a").value; if(x==""||isNaN(x)) { alert("Your First Number is Not Numeric"); } a=document.getElementById("a").value; } &lt;/script&gt; &lt;button type="button" onclick="myFunction()"&gt;Submit Number&lt;/button&gt; &lt;br /&gt; &lt;p&gt;Second Number&lt;/p&gt; &lt;br /&gt; &lt;input id="b" type="text"&gt; &lt;script&gt; function myFunction1() { x=document.getElementById("b").value; if(x==""||isNaN(x)) { alert("Your Second Number is Not Numeric"); } b=document.getElementById("b").value; } &lt;/script&gt; &lt;button type="button" onclick="myFunction1()"&gt;Submit Number&lt;/button&gt; &lt;br /&gt; &lt;script&gt; function add() { d=parseInt(a); e=parseInt("b"); c=d+e; alert("The number is " + c); } &lt;/script&gt; &lt;button type="button" onclick="add()"&gt;Add numbers&lt;/button&gt; </code></pre>
javascript
[3]
3,060,658
3,060,659
global space function inside a namespace
<p>How can I declare the bellow function in the global space?</p> <pre><code>namespace something\else; function example() { #some code here } </code></pre>
php
[2]
2,081,510
2,081,511
how to replace substring with particular value dynamically?
<p>I have values in my properties file like,</p> <blockquote> <p>bloodpressure.properties :<br> (key,value) : (bloodpressure,your blood pressure was <strong><em>B6</em></strong>, this is high)</p> </blockquote> <p>In My java class, i am reading values from properties file but i want to replace values with calculated values like,</p> <pre><code>String B6 = "120"; Properties bp = new Properties(); bp.load(new FileInputStream("filename")); String bpstr = bp.getProperty(bloodpressure); </code></pre> <p>now, i want to replace B6 value with above B6 value(120).<br> How can i do it dynamically?, i have lot of string like this.</p> <p>I just want to iterate through properties file, the values should replace with calculated values. </p>
java
[1]
4,272,188
4,272,189
Change in converted time using TimeZone
<p>I have problem with the date time conversion the code is given below</p> <pre><code>DateTime indianStd = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, "India Standard Time"); DateTime MyanmarStd = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, "Myanmar Standard Time"); DateTime SEAsia = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, "SE Asia Standard Time"); DateTime dtConvertedDT = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(MyanmarStd, "India Standard Time"); </code></pre> <p>when i print these time in a lable</p> <p>indianStd Shows the time 4:30:45;</p> <p>Where as ConvertedDt Shows 5:30:45 Why this one hour difference<br> can any body tell me Reason for this</p>
c#
[0]
5,225,407
5,225,408
When to use on("selector") and when on("selector", "selector")
<p>Using jQuery <code>on()</code> version 1.7. I bind my events usually like this:</p> <pre><code>$(".foo").on("click", function() { console.log("foo clicked"); }) </code></pre> <p>Now after seeing someone elses code, I seen you also can bind like this, specifying a secondary parameter for a specific element (Not sure why it was written like this):</p> <pre><code>$(document).on("click", ".bar", function() { console.log("bar clicked"); }) </code></pre> <p>As seen in this <a href="http://jsfiddle.net/JWUyn/1/" rel="nofollow"><strong>fiddle</strong></a>, they both do the same thing.</p> <p>I always bind directly to the element as in the first code sample and never have any issues.</p> <p>When would I need to use the other way of binding and what is the benefit of one over the other?</p>
jquery
[5]
2,120,906
2,120,907
Jquery - Access DIV inside a td tag
<p>I am having trouble accessing a div element within a table. </p> <pre><code>// All within document ready ... $('.ChangeStatus').click(function() { $('#status_display:100').html('Updated'); }); </code></pre> <p>Here is the HTML</p> <pre><code>&lt;td&gt; &lt;div class="status_display" id="status_display:100"&gt; open&lt;br/&gt; &lt;a href="#" class="ChangeStatus" id="close:100"&gt;Close lead&lt;/a&gt; &lt;/div&gt; &lt;/td&gt; </code></pre> <p>WHen I click the anchor it says the html of the div is null before and after I try to set the html.</p> <p>Thanks in advance!</p>
jquery
[5]
4,336,630
4,336,631
Instantiating a nib object to present in a view
<p>I have a LegendViewController that shows a legend. Originally, I just plopped an UIImageView in there. However now, we need a few legends and I want to reuse the LegendViewController. So I created a new initializer:</p> <pre><code>- (id)initWithView:(UIView *)view withNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { [self initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { [self.view addSubview:view]; } return self; } </code></pre> <p>So now this works assuming I pass in a UIView object. For one of my legends, I was wondering if I could load a .xib into my view controller without an image or a UIView object. I have a very simple legend where I just want some color coded squares (UIViews with colors), and some text (UILabels). I can create this in a standalone .xib file, but I wasn't sure how I could load it into my LegendViewController. I've got so far as:</p> <pre><code>UINib *nib = [UINib nibWithNibName:@"HealthLegend" bundle:nil]; </code></pre> <p>where HealthLegend is my standalone .xib file with my data. Or can this not be done and I need to either create an image in some drawing program, or draw the code manually in drawRect? Thanks.</p>
iphone
[8]
4,538,660
4,538,661
Do I need to declare the iterator inside a for loop?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/790558/variable-scope-in-javascript-for-loop">Variable scope in Javascript for loop</a> </p> </blockquote> <pre><code>for(i=0;i&lt;4;i++){ } </code></pre> <p>Do I need to say:</p> <p><code>for(var i=0;i&lt;4;i++)</code> ...?</p> <p>Otherwise things will be global, right?</p>
javascript
[3]
4,651,189
4,651,190
In Android, What is the x y origin value of Touch/click on app screen?
<p>When I develop a app, I click at the up-left corner, I got x=0 y=59 or something. How do I determine the y value? There are two rows above my Touchable screen in my app: 1 first line/row is a tool/status bar which I don't know how to access it 2. next line is my app name like "Hello World". I think this two play a role to determine the y value. How do I termine origin y value in my program?</p> <p>-Henry</p>
android
[4]
1,759,639
1,759,640
Java switch (use values in a case calculated in another case)
<p>I'm making a program that has menus and I'm using switch to navigate between the menus.</p> <p>I have something like this:</p> <pre><code>switch (pick) { case 1: // Here the program ask the user to input some data related with students (lets say // name and dob). Student is a class and the students data is stored in 1 array of // students. If I do: // for (Student item: students){ // if (item != null){ // System.out.println(item); // } // } // It will print the name and dob of all the students inserted because I've created // a toString() method that returns the name and dob of the students case 2: // On case 2 at some point I will need to print the array created on the case // above. If I do again: // for (Student item: students){ // if (item != null){ // System.out.println(item); // } // } // It says that students variable might have not been initialized. </code></pre> <p>Question:</p> <p>If a variable is created in one case it's values can't be used in another case? What I was trying to do was first enter in case 1 and input the values and then, in case 2 be able to use some of the values defined in case 1. </p> <p>If this can't be done, please point me in the right direction.</p> <p>Please keep in mind that I've started to learn java only a few weeks.</p> <p>favolas</p>
java
[1]
1,415,107
1,415,108
C# How do I make a switch ignore invalid input?
<p>I am trying to make a simple console game that starts with a title screen. The user inputs 'N' for a new game, 'L' to load a game, or 'E' to exit. I have this set up as a switch, but I need to know how to make the program ignore any input other than the aforementioned keys. I've Googled this question but didn't find an answer. Please help if you can.</p> <p>I don't see much point in posting the code as 10 lines of a simple switch probably wouldn't be terribly helpful to solving the problem. Also, if there would be an easier / more efficient way than a switch, I would love to know.</p> <p>Thanks.</p>
c#
[0]
600,814
600,815
Increasing maximum execution time
<p>My code reads from xml file and saves data in mysql database. Through the code it iterates around 8000 times. In the localhost i added the following code in index.php: </p> <pre><code> ini_set('max_execution_time', 8000); ini_set('memory_limit','512M'); </code></pre> <p>But its not working in the server. What should i do to make it working in the server?</p>
php
[2]
1,645,575
1,645,576
chain functions directly to newly created object instance in Javascript
<p>In my ongoing saga to understand more about Object Oriented Javascript - I came across a question about creating a class to respond to the following API:</p> <pre><code>var foo = new bar().delay(750).start().then(onComplete); var bar = function() { this.delay(function(per) { //... }; } </code></pre> <p>Can someone with more experience than me please describe how to create class that would respond to this? I have never seen chaining like this and can't find any information online :(</p>
javascript
[3]
4,388,345
4,388,346
JavaScript how to get tomorrows date in format dd-mm-yy
<p>I am trying to get JavaScript to display tomorrows date in format (dd-mm-yyyy)</p> <p>I have got this script which displays todays date in format (dd-mm-yyyy)</p> <pre><code>var currentDate = new Date() var day = currentDate.getDate() var month = currentDate.getMonth() + 1 var year = currentDate.getFullYear() document.write("&lt;b&gt;" + day + "/" + month + "/" + year + "&lt;/b&gt;") Displays: 25/2/2012 (todays date of this post) </code></pre> <p>But how do I get it to display tomorrows date in the same format i.e. <code>26/2/2012</code></p> <p>I tried this:</p> <pre><code>var day = currentDate.getDate() + 1 </code></pre> <p>However I could keep <code>+1</code> and go over 31 obviously there are not >32 days in a month</p> <p>Been searching for hours but seems to be no answer or solution around this?</p>
javascript
[3]
5,218,087
5,218,088
How do I support my iOS 3.1.2 users now that I've upgraded to Xcode 3.2.3?
<p>I recently released a new version of my iPhone app that was built for iOS 3.1.2. Now I want to release a very small bugfix update, but in the time between my last release and now, I've upgraded Xcode to 3.2.3 and upgraded my test iPhone to 4.0.</p> <p>Since these are very simple changes, I want my iOS 3.1.2 users to be able to get these fixes but it looks like Xcode wants me to build for iOS 3.2. That doesn't really go back far enough for me.</p> <p>I've done some research (mostly around SO) and learned that it's possible to use SDK 3.2 and simply set the Deployment Target to 3.1.2. But if I do that, how can I do a basic sanity check of my app's compatibility with that OS, given that I have a brand new development environment and SDK? My physical hardware is now OS 4, and the iPhone Simulator that ships with Xcode doesn't seem to simulate OS 3.1.2.</p> <p>Is it possible to get an older version of the SDK to test my code? Do I have any other options?</p>
iphone
[8]
396,530
396,531
"Select / Unselect" multiple select fields
<p>I have a multiple select fields defined in a table column, </p> <pre><code>&lt;table border=1&gt; &lt;tr&gt; &lt;td&gt;THIS IS THE PLACE TO SELECT THE PROJECTS&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td id="select_project"&gt; &lt;select class="projects" id="projects" multiple="multiple" name="projects[]" size="10"&gt; &lt;option value="1"&gt;Project 1&lt;/option&gt; &lt;option value="2" selected="selected"&gt;project 2&lt;/option&gt; &lt;option value="3"&gt;Project 3&lt;/option&gt; &lt;/select&gt; CLICK HERE SHOULD "UNSELECT" &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I would like to have the feature that when user click on the space of the column besides the selection field, all selected options should back to unselected status, I have used the following jquery to implement,</p> <pre><code>$("#select_project").bind('click', function(){ $('#projects option').attr('selected', false); return false; }); </code></pre> <p>It works but it also affect the selection field, that's when user select a option, it immediately change back to unselected status automatically, how to get rid of this?</p>
jquery
[5]
3,365,584
3,365,585
how to read a file from a Jar file located on remote server
<p>I want to read and copy file from jar file(for eg. application.xml from EAR )located on remote server to local machine. when i search on net for this, i found java.util.jar.JarFile API. This API read jar only from local machine as it takes only string as input and not URL for jar location in constructor. I know org.apache.commons.net.ftp.FTPClient API.This API can copy any file or even jar from remote server to local machine. But my requirement is to copy only single file from jar located on remote server.</p> <p>Please help me in this regard .</p> <p>Thanks Sameer</p>
java
[1]
1,197,289
1,197,290
how to display 2011-01-27-123907 instead of 20110127123907 (php)
<p>what is the easiest way of </p> <p>displaying string <strong>2011-01-27-123907</strong> instead of <strong>20110127123907</strong> </p> <p>without writing special function for it?</p>
php
[2]
1,582,782
1,582,783
Java unknown output
<p>Soo this problem involves me rolling a pair of dice and estimate the probability that the first roll is a losing roll (2, 3, or 12). </p> <p>output is the count of rolls that were losers (2,3, or 12) and calculated probability (count/N) </p> <pre><code> public static void main(String [] args){ int N1 = (int) (Math.random()*6 + 1); int N2 = (int) (Math.random()*6 + 1); int count = N1 + N2; for (int i = 0; i&lt;=1; i++) if (count==2 || count = 3 || count == 12) </code></pre> <p>I just don't seem to know what to do get the output...... This is my attempt </p>
java
[1]
1,194,622
1,194,623
Asign click handler to newly appended elements
<p>How does one go about adding a click handler in the following example? I need to assign it to the newly appended anchor element.</p> <pre><code>$.each(regions1, function(key, value) { var coords = regions1[key].rel.split('-'); $("#map").append("&lt;a href='javascript:void(0)' id='"+ regions1[key].id +"' class='bullet' style='left: "+ addpx(Number(coords[0]) - rempx(settings.bulletWidthOffset)) +"; top: "+ addpx(Number(coords[1]) - rempx(settings.bulletHeightOffset)) +"'&gt;&amp;nbsp;&lt;/a&gt; ") //.click(function(){showPopup(regions1[key].id);}) }); </code></pre> <p>Cheers</p>
jquery
[5]
1,337,801
1,337,802
How can I multiply a value from a radio button by a number in Javascript and have the answer display in a textstring inside a textarea?
<p>I need to have the user_input from the radio button multiplied by an integer. The user_input is either 1,2, or 3. I can get the radio button value pulled through into the textarea, but how do I take that number and multiply it by something? Ideally, I need textstring += 'Fee (£): ' + (user_input) * '5' + '\n';</p> <p>Thanks for any help!</p> <pre><code> // Get value of the 'Fee' radio buttons. user_input = ''; for (i=0;i&lt;document.forms['example'].fee.length;i++) { if (document.forms['example'].fee[i].checked) { user_input = document.forms['example'].fee[i].value; } } textstring += 'Fee (&amp;#163;): ' + user_input + '\n'; // Write textstring to the textarea. document.forms['example'].output.value = ("\n*** Thank You for your reservation***"+"\n")+ textstring + ("\n*** End of Form***"+"\n"); </code></pre>
javascript
[3]
3,250,453
3,250,454
How do I cut out the middle area of ​​the bitmap?
<p>How do I cut out the middle area of ​​the bitmap? it's my sample code:</p> <pre><code> public void onPictureTaken(byte[] paramArrayOfByte, Camera paramCamera) </code></pre> <p>{</p> <pre><code> FileOutputStream fileOutputStream = null; try { File saveDir = new File("/sdcard/CameraExample/"); if (!saveDir.exists()) { saveDir.mkdirs(); } BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 5; Bitmap myImage = BitmapFactory.decodeByteArray(paramArrayOfByte, 0,paramArrayOfByte.length, options); Bitmap bmpResult = Bitmap.createBitmap(myImage.getWidth(), myImage.getHeight(),Config.RGB_565); int length = myImage.getHeight()*myImage.getWidth(); int[] pixels = new int[length]; myImage.getPixels(pixels, 0, myImage.getWidth(), 0,0, myImage.getWidth(), myImage.getHeight()); Bitmap TygolykovLOL = Bitmap.createBitmap(pixels, 0, myImage.getWidth(), myImage.getWidth(),myImage.getHeight(), Config.RGB_565); Paint paint = new Paint(); Canvas myCanvas = new Canvas(bmpResult); myCanvas.drawBitmap(TygolykovLOL, 0, 0, paint); fileOutputStream = new FileOutputStream("/sdcard/CameraExample/" + "1ggggqqqqGj2.bmp"); BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream ); bmpResult.compress(CompressFormat.PNG, 100, bos); bos.flush(); bos.close(); </code></pre>
android
[4]
2,857,881
2,857,882
With root access, how do I access the OS-level notification system?
<p>I am using a phone without LED notifications. I would like to dev an app to simulate that, however first, with root, I would like to get access to the notifications system on the OS level (so it can be app-agnostic), to get the notifications.</p> <p>How can I do so, or where can I read up more about this?</p> <p>Thank you!</p>
android
[4]
3,702,068
3,702,069
Pause opening div onmouseover
<p>I am wondering how to open a hidden div with javascript but after a user has hovered over a link for one second rather than immediately. I want to do this, as right now you sweep the mouse across the page and these divs open even though I haven't purposely hovered over them. I <strong>dont</strong> want to use jQuery</p> <p>This is the code I have in place:</p> <pre><code>function ShowMemberCats() { // TURN OFF OTHER FRAMES // document.getElementById('BlogCats').style.display = 'none'; document.getElementById('VideoCats').style.display = 'none'; document.getElementById('AudioCats').style.display = 'none'; document.getElementById('ImageCats').style.display = 'none'; document.getElementById('CouponCats').style.display = 'none'; document.getElementById('AdsCats').style.display = 'none'; // OPEN VIDEO FRAME // document.getElementById('MemberCats').style.display = ''; } </code></pre> <p>Any help would be greatly appreciated..</p> <p>Many thanks in advance, Paul</p>
javascript
[3]
1,692,354
1,692,355
Class A not visible in class C but visible in main. Why?
<pre><code>class A {}; class B : private A { }; class C : public B { public: void f() { A a; // This line causes error, but works when it is in main() function } }; int main() { C c; // A a; --&gt; This line works return 0; } </code></pre> <p>I am guessing this has something to do with <code>B</code> inheriting privately from <code>A</code> but cannot put my finger on it. </p> <p>EDIT: Error is "class A is not visible". Compiled with g++.</p>
c++
[6]
72,188
72,189
self.close() is not working
<p>self.close() is not working in a screen of my application. In other screens it is working fine.But in a particular screen some times it is working and some times not.i couldn't find out in what occasions/scenario it is not working.</p> <p>Following is code which is not working?</p> <pre><code>&lt;logic:equal name="cancelFlag" value="yes"&gt; self.close(); &lt;/logic:equal&gt; </code></pre> <p>Actually this code has been written explicitly in my jsp file.if "cancleFlag" from request is yes means the screen should close immediately. but in my screen after executing self.close() it goes to onLoad method-mention in the body tag, instead of closing the screen. </p>
javascript
[3]
3,769,657
3,769,658
work sun.misc.BASE64Encoder/Decoder for getting byte[]
<p>I am trying to use sun.misc.BASE64Encoder/Decoder, but this code:</p> <pre><code>(new sun.misc BASE64Encoder()).encode(new sun.misc.BASE64Decoder().decodeBuffer("test string XML:")) </code></pre> <p>returns "test/string/XML/" I am embarrassed</p>
java
[1]
1,487,617
1,487,618
Loop from x1,y1 to x2,y2, no matter in which order they are
<p>I want to be able to select part of an image via two Points (p1,p2). My problem is that I want to use the same loop regardless in which order they are.</p> <p>right now I have this:</p> <pre><code>for (int x = p1.X; x != p2.X; x += Math.Sign(p2.X - p1.X)) { for (int y = p1.Y; y != p2.Y; y += Math.Sign(p2.Y - p1.Y)) { MessageBox.Show(String.Format("{0} {1}", x, y)); } } </code></pre> <p>With that loop I don't get all of the numbers: e.g. from 1/1 to 3/3 only gones till 2/2.</p> <p>I some how need to loop through both loops one more time, but since I don't know which way I'm actually looping (decreasing or increasing) I can't just add/ subtract one from the loop.</p> <p>any help would be appreciated!</p>
c#
[0]
5,408,882
5,408,883
Android: AsyncTask vs Service
<p>Why do I read in the answer to most questions here a lot about <a href="http://developer.android.com/reference/android/os/AsyncTask.html"><code>AsyncTask</code></a> and Loaders but nothing about <a href="http://developer.android.com/guide/topics/fundamentals/services.html">Services</a>? Are Services just not known very well or are they deprecated or have some bad attributes or something? What are the differences?</p> <p>(By the way, I know that there are other threads about it, but none really states clear differences that help a developer to easily decide if he is better off using the one or the other for an actual problem.)</p>
android
[4]
4,512,153
4,512,154
Datepicker inside sj:dialog is not showing a the top of the page
<p>I'm using the struts2 jquery plugin to show a dialog box. It contains a datepicker element that shows behind the &lt; sj:dialog >. Obviously that's a problem.</p> <p>One problem i noticed is that the element datepicker doesn't append to the dialog element and that the z-index of the dialog is updated dinamically.</p> <p>Is there an easy way to fix this problem?</p>
jquery
[5]
4,146,121
4,146,122
IP-addresses stored as int results in overflow?
<p>I'm writing a chat-server in node.js, and I want to store connected users IP-addresses in a mysql database as (unsigned) integers. I have written a javascript method to convert an ip-address as string to an integer. I get some strange results however.</p> <p>Here is my code:</p> <pre><code>function ipToInt(ip) { var parts = ip.split("."); var res = 0; res += parseInt(parts[0], 10) &lt;&lt; 24; res += parseInt(parts[1], 10) &lt;&lt; 16; res += parseInt(parts[2], 10) &lt;&lt; 8; res += parseInt(parts[3], 10); return res; } </code></pre> <p>When I run call the method as <code>ipToInt("192.168.2.44");</code> the result I get is <code>-1062731220</code>. It seems like an overflow has occurred, which is strange, because the expected output <code>(3232236076)</code> is inside the number range in javascript (2^52).</p> <p>When I inspect <code>-1062731220</code> in binary form, I can see the <code>3232236076</code> is preserved, but filled with leading 1's.</p> <p>I'm not sure, but I think the problem is with signed vs. unsigned integers.</p> <p>Can any of you explain what is going on? And possibly how to parse <code>-1062731220</code> back to an string ip?</p>
javascript
[3]
5,016,559
5,016,560
if ArrayList contains doesn't work
<p>i'm curently developing app which has lots of ArraYlists and it needs to compare them with nonlist data. When i try this method <code>fdata.contains(data2)</code> it always returns false. ArayLists contains class named 'favdat' which looks like this:`</p> <pre><code>public class favdat { public String product,term,note,link; } </code></pre> <p>And Data2 is defined like this: <code>favdat Data2=new favdat();</code> I have also tryed retain all method and it returns list in the size of 0. I know that some data are equal.</p> <p>So the question is how could i tell if <code>fdata</code> contains <code>data2</code>?<code> </code></p>
android
[4]
2,679,265
2,679,266
php not working on my VPS
<p>This is my phptest.php file:</p> <pre><code>&lt;?php echo "Hello"; ?&gt; </code></pre> <p>But when I try 'http://serveraddress/phptest.php'on my browser,it does not work properly and shows the whole php file on my browser.</p> <p>I am using CentOS 5 and PHP version is 5.2.5. When a type 'php phptest.php' on the terminal, it works properly.</p> <p>Please help</p>
php
[2]
3,458,004
3,458,005
Is there any advantage of of using comma over + to concatenate primitive types in Javascript?
<p>I have seen commas to concatenate primitive data types in Javascript and was wondering whether there was any difference in using a comma over say the <code>+</code> operator as well as the .concat() function?</p> <p>So an example the following statement gives me abc</p> <pre><code>var value1 = a, value2 = b, value3 = c; document.write(value1,value2,value3); </code></pre>
javascript
[3]
1,638,428
1,638,429
Converting from Editable to int in android
<p>I want to convert the type <code>Editable</code> from an android <code>EditText</code> to the type integer to do maths operations on a user input number</p> <p>I tried the following:</p> <pre><code>int x=(int)R2.getText().toString(); </code></pre> <p>but it gives me an error of cannot convert a string to int.</p>
android
[4]
1,801,962
1,801,963
Is there a binary difference and patch algorithm (library) for buffers not files?
<p>Is there an algorithm for getting the difference between two buffers in run time (not two files) and applying patch also on a buffer ?</p>
c++
[6]
1,018,363
1,018,364
What does "variable = variable || {}" mean in JavaScript
<p>What does this initialization of a variable stand for:</p> <pre><code>var variable = variable || {} ; </code></pre> <p>How and when should it be used?</p>
javascript
[3]
5,476,808
5,476,809
jquery datepicker refresh method is not working
<p>I am highlighting some days in a month depending on the data coming from backend . When i cahnge month or year , again am calling ajax call . But datepicker shows only previous dates . My code is as follows,</p> <pre><code>$("input.dC").live('click',function() { $(this).datepicker({ showOn:'focus', changeMonth:'true', changeYear:'true', onChangeMonthYear:function(year,month,inst) { var date = new Date(year,month-1); obj.suggestDates(date); $("#"+inst.id).datepicker("refresh"); }, beforeShowDay:function(date){ for(i=0;i&lt;obj.r.length;i++) { var m = obj.r[i]; if(date.getMonth() == m[1] &amp;&amp; date.getDate() == m[0] &amp;&amp; date.getFullYear() == m[2]) { return[true,"ui-state-highlight"];} } return[false,""]; } }).focus(); }); obj.prototype.suggestDates=function(d){ //ajax call here //obj.r=response; } </code></pre>
jquery
[5]
3,722,099
3,722,100
Modern C++ Game Programming Examples
<p>To what extent are modern C++ features like:</p> <ol> <li>polymorphism, </li> <li>STL, </li> <li>exception safety/handling, </li> <li>templates with policy-based class design, </li> <li>smart pointers</li> <li>new/delete, placement new/delete</li> </ol> <p>used in game studios? I would be interested to know the names of libraries and the C++ features they use. For example, Orge3D uses all modern C++ features including exceptions and smart pointers. In other words, if I would be looking for an example for a game library using modern C++, I would go to Orge3D. But I don't know if these features deter game studios from using Orge3D. </p> <p>Further I don't know if there are other examples. For example, I used Box2D some time before briefly, but it uses only placement new, and class keyword as the C++ features. Even encapsulation is broken in these classes as all members are public. </p> <p>Ideally, if C++ features would be the best match for all situations, these would be used most often. But it seems not. What are the impedances? The obvious one is having to read stacks of books, but that's half a reason only. This question is a follow up on "<a href="http://stackoverflow.com/questions/829656/c-for-game-programming-love-or-distrust">C++ for Game Programming - Love or Distrust?</a>" (From the responses there I got an impression that many C++ features are still not used in games; which is not necessarily the way it <em>should</em> be).</p>
c++
[6]
2,689,656
2,689,657
Message Format using C#
<p>I was trying to convert a sample win form app to console application.I just stuck when am trying to convert to message format.</p> <p>Here is the below original code from winform</p> <pre><code>private void PutMessage(StringBuilder message, string mediaType, string filename) { message.AppendFormat(messageFormat, "FileSize", videoInterrogator.GetFileSize(), Environment.NewLine); message.AppendFormat(messageFormat, "Duration", videoInterrogator.GetDuration(), Environment.NewLine); } </code></pre> <p>Am trying to do the same in my console application </p> <p>Am calling the method from FTPDownload method so the code look like</p> <pre><code>PutMessage(file, message); private void PutMessage(string filename, StringBuilder message) { VideoInterrogator videoInterrogator = new VideoInterrogator(); videoInterrogator.LoadFile(filename); message.AppendFormat(format, "FileSize", videoInterrogator.GetFileSize(), Environment.NewLine); message.AppendFormat(format, "Duration", videoInterrogator.GetDuration(), Environment.NewLine); } </code></pre> <p>Any help please how can i call this method pass the file name and return the values.It throws exception at "Format" am not sure what am missing here.</p>
c#
[0]
2,285,131
2,285,132
What is the differnce between "!" and "!!"
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript">What is the !! (not not) operator in JavaScript?</a> </p> </blockquote> <p>I removed !! and put in ! and it broke my code...googled javascript !! and got nothing not even !. I believe ! is the not operator but what is !!...realy realy not.</p> <pre><code>function domPaneFlip() { var button_element = document.getElementById( 'bookmark_flip_button' ), bookmark_list = document.getElementsByName( 'bookmark_link' ), bookmark_element, iterator = 0; if( domPaneFlip.p1 === 'Done' ) { domPaneFlip.p1 = 'Delete'; domPaneFlip.p2 = 'bookmark'; while( !!( bookmark_element = bookmark_list[ iterator++ ] ) ) { bookmark_element.removeEventListener( "click", MBookmarkDelete ); bookmark_element.className = domPaneFlip.p2; } } else { domPaneFlip.p1 = 'Done'; domPaneFlip.p2 = 'bookmark_delete'; while( !!( bookmark_element = bookmark_list[iterator++] ) ) { bookmark_element.addEventListener( "click", MBookmarkDelete ); bookmark_element.className = domPaneFlip.p2; } } button_element.innerHTML = domPaneFlip.p1; } </code></pre>
javascript
[3]
873,923
873,924
event.srcelement || event.target dosent work in ff
<p>hi my code dosent work in ff ... event.target and event.srcelement and </p> <p>window.event.srcElement; dosent work in firefox ... please help me </p> <p>my version of fire fox is : 15.01</p>
javascript
[3]
5,133,436
5,133,437
How to get the id of an anchor tag in jQuery?
<p>How to get the id of an anchor tag in jQuery? This is the tag.</p> <pre><code> &lt;ul class="formfield"&gt; &lt;li class="selected"&gt;&lt;a href="" id="text"&gt;Text&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="" id="textarea"&gt;Textarea&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I need to get the id, i.e., textarea,text etc in a variable.</p> <p>I tried something like this,but there is no such thing as fieldValue I suppose.</p> <pre><code>$('.formfield a').click(function() { fieldType=$('.formfield a').fieldValue(); alert(fieldType); }); </code></pre>
jquery
[5]
3,035,741
3,035,742
ASP.Net not populating Request.Files on receiving multipart data
<p>I'm sending files from an android app to a asp.net webform using multipart/form-data as the content type. However the Request.files property does not get populated. Reading the Request object I get the following</p> <p>Request.Params("ALL_HTTP")</p> <p>"HTTP_CONNECTION:Keep-Alive HTTP_CONTENT_LENGTH:8913 HTTP_CONTENT_TYPE:multipart/form-data;boundary=<strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>****</strong> HTTP_HOST:192.168.1.2 HTTP_USER_AGENT:Dalvik/1.2.0 (Linux; U; Android 2.2; sdk Build/FRF91) "</p> <p>The HTTP_CONTENT_LENGTH shows the correct length. I guess I will have to do a binary read and then parse the content and store the file contents. Has anyone done this before or is there a library/class available?</p> <p>Thanks</p>
asp.net
[9]
1,001,774
1,001,775
Invoking a method in all class's objects simultaneously in java
<p>I have a problem in java programming , how can i make all objects of a class invoke a method of themselves simultaneously in java ?</p> <p>thank in advance.</p>
java
[1]
3,017,644
3,017,645
Browse a Windows directory GUI using Python 2.7
<p>I'm using Windows XP with Python 2.7.2 &amp; Tkinter GUI kit. I want to build a simple GUI that has a text field and "Browse" button that will select a file through directories such as C:\ (Just like Windows Explorer). That file selected will be displayed in the text field in the GUI. Hope this is descriptive enough.</p>
python
[7]
2,157,554
2,157,555
aliasing basic types and constants in C#
<p>We have a C++ code that defines a unified naming convention (majorly for multiplatform reasons).<br> For example:</p> <p><code>#define FOO_UINT32 unsigned long</code><br> and <code>#define FOO_TRUE true</code> </p> <p>now, we want to port some of this code to C#.<br> For the first define in the example I figured out that I need: </p> <p><code>using FOO_UINT32 = System.UInt32;</code></p> <p>The question is? How do I do the second one?</p>
c#
[0]
2,235,912
2,235,913
getPreferences(MODE_PRIVATE) is undefined in BroadcastReceiver
<p>I have application with an activity and a service, I need to save some value in the activity and retrieve in the service.</p> <p>i could save the value using SharedPreferences in the activity, however, when I try to retrieve the value in the BroadcastReceiver, it says <strong>getPreferences is undefined for service.</strong></p> <p><strong>how could I retrieve my value in BroadcastReceiver?</strong> </p>
android
[4]
5,077,138
5,077,139
Difference between: $_SERVER['SCRIPT_NAME'] and $_SERVER['PHP_SELF']
<p>What is the difference between:</p> <pre><code>$_SERVER['SCRIPT_NAME'] </code></pre> <p>and</p> <pre><code>$_SERVER['PHP_SELF'] </code></pre> <p>Thank you.</p>
php
[2]
3,259,960
3,259,961
Android: Example for using a cookie from HttpPost for HttpGet
<p>I am able to use the example here: <a href="http://www.androidsnippets.org/snippets/36/index.html" rel="nofollow">http://www.androidsnippets.org/snippets/36/index.html</a> and successfully get the "HTTP/1.1 OK" response for a webesite I am sending the HttpPost along with the user credentials. However, I am unable to use an HttpGet to further browse other pages on this site. </p> <p>Can anyone please let me know, what's going wrong. I am sorry - I am very new to Java. </p>
android
[4]
366,287
366,288
Style a certain character in a string
<p>I want to style a certain character in a string via jQuery, but have no clue how to approach that. I have the following situation</p> <p><pre><code>&lt;a href="" accesskey="i">Link&lt;/a></pre></code></p> <p>Now i want to underline the character in the <code>accesskey</code> (so the <em>'i'</em> in this case) in the clickable link. So the 'i' in 'Link' should be underlined</p> <p>Does anybody know how?</p>
jquery
[5]
5,764,853
5,764,854
Jquery: Return the value of a ajax call to caller function?
<p>Im trying to return the value that a $ajax call returns, from a function but it only returns "undefined". If a alert the "reponse" from the ajax call it returns the rigth value. Here is the code, what am i doing wrong?:</p> <pre><code>$(".insertCandidate").live("click", (function(e) { var ids = this.id.toString().split("|"); var tempCanID = ids[1]; var canID = ids[0]; var tempName = CandidateName(tempCanID); var canName = CandidateName(canID); //alert("HTML: "+tempName); $("#mergeCandidateDialog").empty(); $.blockUI({ message: $("#mergeCandidateDialog").append( "&lt;div&gt;" + tempName + "s ansøgning til vil blive lagt under den eksiterende ansøger s data.&lt;br /&gt;&lt;br /&gt; Ønsker du at fortsætte?&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;" + "&lt;div id=\"content\"&gt;" + "&lt;input type=\"button\" id=\"" + ids + "\" class=\"insertCandidateYes\" value=\"Ja\" /&gt;" + "&lt;input type=\"button\" id=\"insertCandidateNo\" value=\"Nej\" /&gt;&lt;/div&gt;"), css: { cursor: 'default', fontWeight: 'normal', padding: '7px', textAlign: 'left' } }); })); function CandidateName(candidateID) { var returnstring; $.ajax({ type: "POST", url: "/Admin/GetCandidateName/", data: { 'candidateID': candidateID }, succes: function(response) { returnstring = response; return; }, error: function(response) { alert("FEJL: " + response); } }); return returnstring; } </code></pre>
jquery
[5]
1,166,817
1,166,818
How to check email id existance in java script?
<p>I am taking emails id's on input form along with other details like name, address,contact no etc. Now, User can enter any email id's.</p> <p>e.g. abc@abc.com</p> <p>I can do check for standard domain whether is it present or not. but Is there any way available to check that email id exist or not?</p> <p>Is there any API available?? </p> <p>How can i detect wrong email id's.</p> <p>would be grateful for help...</p>
javascript
[3]
361,461
361,462
c# Short cut for enumerable list
<p>I have the following C# list code,</p> <pre><code>globalFaiths.AddAll( IEnumerable&lt;Religion&gt; religions ) </code></pre> <p>I call it like this</p> <pre><code>globalFaiths.AddAll(new Religion[]{Bahai,Christian,Islam}); </code></pre> <p>Is there a shoter way to send in <code>Bahai,Christian,Islam</code> to the <code>globalFaiths</code> function in c#?</p>
c#
[0]
2,516,479
2,516,480
XCode 3.2 version: now I can't compile
<p>I have this IPhone app underway that was working fine, then I installed OS 10.6 and the shiny new XCode.</p> <p>It's not compiling, instead coming up with the single error,</p> <pre><code>"There is no SDK with the name or path 'iphoneos3.0'" </code></pre> <p>I can't find such a file or folder on my hard drive.</p> <p>What's broke, and how do I fix it?</p> <p>Thanks for any assistance.</p>
iphone
[8]
211,316
211,317
What does "->" mean in php?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php">Reference - What does this symbol mean in PHP?</a> </p> </blockquote> <p>What exactly does -> do in php? </p> <p>I have a good understanding of the basics of php but never understood this. I tend to see in apps that use Codeignitor. </p>
php
[2]
761,527
761,528
How to create an executable jar with dependancy jars
<p>Hi I have created a java application which depends upon some external jars. Now I want to create an executable jar for my project. Means if i double click the project then it should execute.</p> <p>Thanks Sunil Kumar Sahoo</p>
java
[1]
477,393
477,394
Generate max 'N' values from javascript array
<pre><code>var arr = new Array(2, 4, 9, 1, 5, 7, 10) </code></pre> <p>I want function that gets max value, than takes it out of an array and gets another max value.</p>
javascript
[3]
4,467,276
4,467,277
Is it possible to make the execution of a program skip fprintf-statements/How to create my own fprintf-function?
<p>In my C++-code there are several fprintf-statements, which I have used for debugging. Since I might need them again, I would prefer not to comment them out for the moment. However, I need the execution of the program to be fast, so I would like to avoid them being printed out, as they are for the moment (I redirected stderr to a file).</p> <p>Preferably this would be determined by the user passing an argument to the program, which I would extract like this:</p> <pre><code>main (int argc, char *argv[]) { int isPrint=0; if (argc &gt; 1 ) { isPrint = atoi ( argv[2]); } } </code></pre> <p>I thought of renaming fprintf to another name, and then from that function do a fprintf-call using the same parameters, based on the value of <strong>isPrint</strong>; however, then I realized that fprintf can have so many different kind of arguments and a various number of arguments; and that I don't know any generic way of declaring my own function with those requirements.</p> <p>So I wonder how to create a function,which works exactly like fprintf, but which takes the extra parameter <strong>isPrint</strong>; or how to solve the above problem in another way.</p> <p>Complementary information after first post: One solution would be to add this before each fprintf-statement:</p> <pre><code>if (isPrint == true ) </code></pre>
c++
[6]
791,540
791,541
How to get Android rich text editor to compile correctly?
<p>I downloaded the source code for a rich text editor from:</p> <p><a href="http://code.google.com/p/android-richtexteditor/" rel="nofollow">http://code.google.com/p/android-richtexteditor/</a></p> <p>and the code will not compile correctly. The errors I get are: </p> <pre><code>"Unable to resolve target 'android-4'", "AndroidManifest.xml file missing!", and in the Html.java file there are 2 errors involving; "The import org.ccil cannot be resolved" </code></pre> <p>When you download the file you will need to download the version 4 of the source code because the newest versions source code has been removed. I am using eclipse version 4.2.0, Android SDK Manager Revision 20. I have installed API versions 4.0, 4.1 and many of the extras. I am pretty sure I downloaded the "classic" version of eclipse. I suspect there are 2 causes to these errors, and would appreciate input. The other threads concerning both this project and the generic errors have been unhelpful, as at least one of the threads highest ranked answers was in fact incorrect. Also, the instructions put forth were not for my version of eclipse, or were incomplete. </p>
android
[4]
4,433,894
4,433,895
Loading all objects with class into an array using jQuery
<p>I have a bunch of div's on my page with class testClass.</p> <p>I want to load them into an array and then check the array's size.</p> <p>But its not working?</p> <pre><code>myArray = $('testClass'); alert(myArray.count); </code></pre> <p>What's wrong?</p>
jquery
[5]
1,100,495
1,100,496
Java : Why exception is not being caught inside the Second Method catch block
<p>I have this method calling the below method , i am purposufully providing a wrong port number for the URL to be connected . But to my surprise , the exception produced is being caught in first Method catch block Why it is not being handled inside the executeData Method's catch block ??</p> <pre><code>**1st Method** public APIResponse execute(Request request, Class&lt;? extends Response&gt; responseClass) { try { String xmlResponse = executeData(request); // some code return response; } catch (Exception ex) { return new Response(ErrorCode.SYSTEM_ERROR); } } 2nd Method public String executeData(Request request) throws IOException { URL url = null; URLConnection urlc = null; try { url = new URL("http://localhost:80870/"); urlc = url.openConnection(); } catch (Exception ex) { ex.printStackTrace(); **// This is not being executed .** } // Some code // Some code return xmlResponse; } </code></pre>
java
[1]
3,320,044
3,320,045
jQuery - Why won't select box info duplicate but the rest will
<p>I'm using the code below to try and duplicate information from one set of address fields to another set when a checkbox is checked. All of it works except for the state select box (drop down box). It's driving me crazy. </p> <pre><code> //on page load $(document).ready(function() { //when the checkbox is checked or unchecked $('#copyaddress').click(function() { // If checked if ($(this).is(":checked")) { //for each input field $('#cc input', ':visible', document.body).each(function(i) { //copy the values from the billing_fields inputs //to the equiv inputs on the shipping_fields $(this).val($('#info input').eq(i).val()); }); //won't work on drop downs, so get those values var c_state = $("select#c_state").val(); // special for the select $('select#cc_state option[value=' + c_state + ']').attr('selected', 'selected'); } else { //for each input field $('#cc input', ':visible', document.body).each(function(i) { // put default values back $(this).val($(this)[0].defaultValue); }); // special for the select $('select#cc_state option[value=""]').attr('selected', 'selected'); } }); }); </code></pre>
jquery
[5]
4,548,479
4,548,480
How can I get files from the iDisk programmatically?
<p>I need to write an iPhone app that allows the user to download and use files (more specifiably, video files) that are on the Mobile Me iDisk. Is this possible? I was not able to find an iDisk API for Objective-C.</p>
iphone
[8]
505,340
505,341
Opening a "Print Preview" for a PDF
<p>How do I open a <em>Print Preview</em> dialog for a PDF file using jQuery?</p>
jquery
[5]
363,166
363,167
How to shutdown an android mobile programatically?
<p>Is it possible to shutdown the mobile programatically. that is with out using su commands..</p>
android
[4]
1,461,353
1,461,354
iPhone Optimal Stack Data Storage
<p>I have a set of data that I need accessible insdie my iPhone app. The data is constant and currently in a simple CSV format. One of the columns could easily be used as a key in a dictionary but what is the most efficient way to have this const data accessible inside the app? I'm thinking instantiating and populating a NSDictionary at launch is not optimal.</p>
iphone
[8]
3,510,463
3,510,464
Problem When Using More Than Two Wildcards
<p>I am trying to write a program that will take specified letters and wildcard characters(<code>'*'</code>) and check them against words in a list to print all available matches. I have written the below code which will work when two wildcard characters are used:</p> <pre><code>def wildcard_search(letters, count): alpha = 'abcdefghijklmnopqrstuvwxyz' words = ['hello', 'hi', 'good', 'help', 'hellos', 'helloing', 'hallow', 'no'] count = 0 wild_loc = [] while count &lt; len(letters): for letter in letters: if letter == '*': wild_loc.append(count) count += 1 for letter in alpha: new_letters = letters[:wild_loc[1]].replace('*', letter) for each in words: each = each.strip('') if new_letters in each: holder = new_letters for letter in alpha: new_letters = letters[wild_loc[1]:].replace('*', letter) for each in words: each = each.strip('') if holder + new_letters in each: print each </code></pre> <p>My question is, how do I write this code to return results when more than two wildcard characters are used? I have tried using the below while loop, but I end up with an index out of range error:</p> <pre><code>count = 0 store = '' while count &lt;= len(wild_loc)-1: for letter in alpha: if count != len(wild_loc) - 1: new_letter = letters[:wild_loc[count]].replace('*', letter) for each in words: each = each.strip('') if new_letter in each: res = store + new_letter store = new_letter count += 1 elif count == len(wild_loc) - 1: new_letter = letters[wild_loc[count]:].replace('*', letter) for each in words: each = each.strip('') if (res + new_letter) in each: print each count += 1 </code></pre>
python
[7]
2,797,901
2,797,902
What is the use of @property (nonatomic, retain) statement in the application ?
<p>i m a beginner iphone developer and i want to know about what is the use of @property (nonatomic, retain) statement with example , any body can give me any answer ?</p>
iphone
[8]
4,964,162
4,964,163
Google SafeBrowsing Lookup API - PHP
<p>I'm trying to request information about a domain without success; code:</p> <pre><code>&lt;?php echo file_get_contents('https://sb-ssl.google.com/safebrowsing/api/lookup?client=asasd&amp;apikey=MYKEY&amp;appver=1.5.2&amp;pver=3.0&amp;url=http%3A%2F%2Fwww.onet.pl%2F'); ?&gt; </code></pre> <p>Why isn'tit working?</p>
php
[2]
3,289,795
3,289,796
Java garbage collection mechanism
<p>When we write like this: { new A().test(); } The memory of A will be collected by gc after this function return(I knew that it's possible for collection, not be collected right now). The question is, how does the jvm make sure the memory of A won't be realise during the test() excuting(I assume the gc is a independent thread). I thought the compiler may change the statement into this:</p> <pre><code>{ //cover it in a scope { A temp = new A(); temp.test(); } //outside the scope, temp is no longer stay in stack, so that A's memory can be colllected } </code></pre> <p>This is just a conjecture. BTW, very sorry for my poor English, please use simple syntax(to answer or explain), thanks. </p>
java
[1]
1,757,349
1,757,350
simple intro java game programming
<p>My question is where did i go wrong. it is supposed to make a frame where i can control an oval, move it around back forth left and right, and then make it move with the arrows. but right now i cant even make the oval, or even insert a word into it.</p> <pre><code>import java.awt.Graphics; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.JFrame; public class JavaGame extends JFrame{ int x, y; public class AL extends KeyAdapter { public void keyPressed(KeyEvent e){ int keyCode = e.getKeyCode(); if(keyCode ==e.VK_LEFT){ x--; } if(keyCode ==e.VK_RIGHT){ x++; } if(keyCode ==e.VK_DOWN){ y--; } if(keyCode==e.VK_UP){ y++; } } public void keyReleased(KeyEvent e){ } } public JavaGame (){ addKeyListener(new AL()); setTitle("Game"); setSize(250,250); setResizable(false); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void Paint(Graphics g){ x = 150; y = 150; g.fillOval(x, y, 15, 15); repaint(); } public static void main(String[] Args){ new JavaGame(); } } </code></pre>
java
[1]