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
5,322,685
5,322,686
How to give the path of the images stored in assets folder?
<p>In my application I need to <strong>store the images in assets folder</strong> and should display them. I have tried all ways but still the image is not displaying. <strong>I have tried using Asset Manager, InputStream and Uri but no result finally</strong>. Please help me with this issue. I am struugling a lot ...Can u please tell how to give the path....for example I saved my images in assets folder then I am giving as </p> <pre><code> InputStream val=getAssets().open("/assets/62.gif"); </code></pre> <p>Is that path correct? Please tell me where I went wrong..</p> <p>Thanks in Advance</p>
android
[4]
5,308,218
5,308,219
Android OS update system
<p>Suppose I want to make an Android device with some custom OS modifications.</p> <p>How could I setup an update system that users could use to get the latest version of my modified Android system for their device?</p> <p>I can't find anything regarding updates in the Android source code.</p>
android
[4]
5,839,489
5,839,490
Handle windows calls with in .net program?
<p>I have an application which runs on click of tray icon in windows( developed in C#). I want to minimise the application on click of escape button. how do i accomplish this ? </p> <p>Thanks in advance, Ravi Naik.</p>
c#
[0]
4,220,373
4,220,374
Save cookies with javascript how to specify domain?
<p>I'm using this code to save cookies:</p> <pre><code>function saveCookie(name,value) { var date = new Date(); date.setTime(date.getTime()+(60*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); document.cookie = name+"="+value+expires+"; path=/"; } </code></pre> <p>My problem is that it saves the cookie with domain "example.com" and I want to write them to ".example.com" so I can also read them from subdomains. This is easy to do with PHP but I don't know how to do it with javascript. How can I add a dot before the domain when I save the cookie?</p>
javascript
[3]
4,760,304
4,760,305
Why does the map size returns 0
<pre><code> using namespace std; class A { public: A() {} ~A() {} map&lt;int, string*&gt;&amp; getMap() { return mapStr; } void setMap(const map&lt;int,string*&gt; m) { mapStr = m; } private: map &lt;int, string*&gt; mapStr; }; class B { public: A getA() { return a; } private: A a; }; int main(int argc, char*argv[]) { map&lt;int, string*&gt; mm; mm.insert(std::make_pair(1, new string("abc"))); mm.insert(std::make_pair(2, new string("def"))); B b; b.getA().setMap(mm); cout &lt;&lt; "Size " &lt;&lt; b.getA().getMap().size() &lt;&lt; std::endl; return 0; } </code></pre> <p>Output: Size 0</p> <p>Any ideas as to why does this return the map size to be 0 and what needs to be done to be fixed</p>
c++
[6]
4,071,391
4,071,392
Check whether activity is active
<p>I'm having a problem witch a listener in a certain activity. </p> <p>The problem is that this listener contains an alert.show(); which can be called after we try to push a new activity (which then gives an exception).</p> <p>e.g.: I'm listening in activity A for a signal from an other phone. I press back and try to run a new activity B but the program crashes because of the alert.show() A's listener.</p> <pre><code>ERROR/AndroidRuntime(3573): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@476c21c0 is not valid; is your activity running? </code></pre> <p>Can I check in A's listener whether this activity is active and then show the alert or not depending on this value?</p>
android
[4]
2,719,087
2,719,088
Add class to first row PHP
<p>I have a loop pulling information from my database. How can I add a class to my first row without using jQuery? </p> <pre><code>while ( $query-&gt;have_posts() ) : $query-&gt;the_post(); if ( $keys = get_post_custom_keys() ) { echo "&lt;div class='card-prod'&gt;&lt;span class='card-title'&gt;"; echo the_title(); echo "&lt;/span&gt;"; foreach ( (array) $keys as $key ) { $keyt = trim($key); if ( '_' == $keyt{0} || 'pricing' == $keyt || 'vehicleType' == $keyt || 'coverageRegion' == $keyt || 'locationType' == $keyt ) continue; $values = array_map('trim', get_post_custom_values($key)); $value = implode($values,', '); echo "&lt;span class='srch-val'&gt;".apply_filters(" $value\n", $value)."&lt;/span&gt;"; } echo "\n"; echo '&lt;img src="wp-content/themes/cafc/images/cards/dummy.png" /&gt;'; echo the_excerpt()."&lt;/div&gt;";} endwhile; </code></pre>
php
[2]
4,688,711
4,688,712
how can i get the desktop full address of user?
<p>i want to get the full address of user programatically using c# how can i do so?</p>
c#
[0]
755,772
755,773
how to get macid and mobile number only in android mobile device not in database
<p>how to get macid and mobile number only in android mobile device not in database</p>
android
[4]
3,870,523
3,870,524
Deserialization fails
<p>this is my code </p> <pre><code> DropDownList1.Items.Add(new ListItem(" Prueba1")); DropDownList2.Items.Add(new ListItem(" Prueba1")); //string[] filePaths = Directory.GetFiles(@"\\hmfsw\web\DTCWIN107\MYSITE.com\public_html\post\"); // Make a reference to a directory. DirectoryInfo di = new DirectoryInfo(@"\\hmfsw\web\DTCWIN107\MYSITE.com\public_html\post\"); string path = @"\\hmfsw\web\DTCWIN107\MYSITE.com\public_html\linker\linker.xml"; // Get a reference to each file in that directory. FileInfo[] fiArr = di.GetFiles(); // Display the names of the files. foreach (FileInfo fri in fiArr)DropDownList1.Items.Add(new ListItem(fri.Name)); System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(selector)); System.IO.TextReader reader = new System.IO.StreamReader(path); selector s = (selector)serializer.Deserialize(reader); reader.Close(); </code></pre> <p>OKay, The first thing is that the dropdownlist daes not update with prueba1 and prueba2</p> <p>But the dropdownlist do update with info of the folder...</p> <p>And the second thiing is that the serializer.Deserialize daes nothing. The dropdownlist is not been load with the xml ...</p> <p>Could you plz help me?</p> <p>Thanks</p>
asp.net
[9]
3,763,815
3,763,816
quick problem with regular expressions
<p>I'm having trouble stripping this piece of HTML:</p> <pre><code>title="External Link" alt="External Link"/&gt;&lt;/h5&gt; &lt;/a&gt; This text is needed without the spaces.. &lt;/div&gt; </code></pre> <p>Here is the general method I attempted:</p> <pre><code>$array = array(); preg_match( '/&lt;\/h5&gt;(.*?) /si', $data, $array ) ; </code></pre> <p>I just can't seem to crack it.</p> <p>Any help would be appreciated,</p> <p>Thanks!</p> <p><strong>P.s</strong> The text may also contain html tags itself, such as <code>&lt;em&gt; or &lt;strong&gt;</code></p>
php
[2]
4,802,195
4,802,196
Android onMeasure change View's parameters twice
<p>I've created a new view (extends ImageView) and override onMeasure method.</p> <p>Xml code:</p> <pre><code>&lt;by.bsuir.klondike.mainCardsView android:id="@+id/imageview1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scaleType="fitEnd" android:baselineAlignBottom="true" android:src="@drawable/cardsmain" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" /&gt; </code></pre> <p>At first I overrode a method like this</p> <pre><code> @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){ int parentWidth = MeasureSpec.getSize(widthMeasureSpec); int parentHeight = MeasureSpec.getSize(heightMeasureSpec); width = parentWidth/2; height = 210*width/498; this.setMeasuredDimension(width, height); this.setLayoutParams(new *ParentLayoutType*.LayoutParams(width,height)); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } </code></pre> <p>According to <a href="http://developer.android.com/guide/topics/ui/how-android-draws.html" rel="nofollow">Android developer</a> onMeasure calls twice. On it's first call I receive parentWidth == 480 and parentHeight == 320. But on second call I receive parentWidth == 240 and parentHeight == 101. It turns out, that the size is changing twice. I've solve this problem using bool flag and change dimension only on first call.</p> <pre><code>@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (flag){ flag=false; int parentWidth = MeasureSpec.getSize(widthMeasureSpec); int parentHeight = MeasureSpec.getSize(heightMeasureSpec); width = parentWidth/2; height = 210*width/498; } this.setMeasuredDimension(width, height); } </code></pre> <p>But I think that it's a wrong way. How can I do it right?</p>
android
[4]
48,121
48,122
Using parts of sliced string in python
<p>My task is doing a base converter. I thought of switching it to base 10 and then switch it to the wanted base. So I want to get a string and them put it in a list, and slice it and after that to use the sliced parts:</p> <pre><code>s=input() NumList=[s] NumList[::] </code></pre> <p>Is there any way of doing it? Do you have any better idea?</p>
python
[7]
5,165,866
5,165,867
Why does `for(;;i++)` works just like `for(;;++i)` in Java?
<p>I mean:</p> <pre><code>for (int i = 0; i &lt; 10; i++) System.out.println(i); </code></pre> <p>and</p> <pre><code>for (int i = 0; i &lt; 10; ++i) System.out.println(i); </code></pre> <p>Will yield the same results. Is <code>++i</code> not evaluated at all till the first loop completes?</p>
java
[1]
4,701,778
4,701,779
jQuery fisheye effect + mouse movement panning
<p>I'm trying to combine a mouse panning effect with the fisheye plugin at <a href="http://interface.eyecon.ro/docs/fisheye" rel="nofollow">http://interface.eyecon.ro/docs/fisheye</a>.</p> <p>These work fine separately, but together they go completely spastic</p> <p>Is there anything that can be changed or added to the code below to smooth everything out?</p> <p>Mouse panning:</p> <blockquote> <pre><code>$("body").mousemove(function(e) { var distance = e.pageX - $(this).offset().left; var percentage = distance / $(this).width(); var targetX = -Math.round(($(".dock-container").width() - $(this).width()) * percentage); $('.dock-container').animate({left: [targetX+"px", "easeOutSine"]}, { queue:false, duration:2500 }); }); </code></pre> </blockquote> <p>Fisheye:</p> <blockquote> <pre><code>$('#dock').Fisheye({ maxWidth: 42, items: 'a', itemsText: '', container: '.dock-container', itemWidth: 40, proximity: 90, halign : 'center' }); </code></pre> </blockquote>
jquery
[5]
3,995,642
3,995,643
Setters/getters and hierarchical data structures
<p>I know it is considered a bad idea to have public fields in your class. But what's the best approach when your class includes numerous hierarchical data structures and fields? For example:</p> <pre><code>class A {B d1; C d2; D d3;} class B {E d4; F d5;} class E {G d6; int d7;} </code></pre> <p>In C it is quite easy to access such a data structure, e.g. ptr_to_A->d1.d4.d7 and so on... But what's the approach when we use setters/getters?</p> <p>When using setters and getters in C++, expressions like A.get_d1().get_d4().get_d7() don't seem convenient, and they force returning references. Since some structures are pretty big, returning by value seems a terrible idea.</p> <p>Which approach or coding style do you use in these cases? Maybe getting rid of setters/getters and making these fields public? </p>
c++
[6]
3,081,142
3,081,143
JavaScript setSelectionRange() method and cursor position
<p>I have the following piece of JavaScript for dynamically inserting unicode characters - represented below by the txtToIns variable - into a body of text</p> <pre><code>elmt.value = elmt.value.substring(0, elmt.selectionStart) + txtToIns + " " + elmt.value.substring(elmt.selectionStart, elmt.selectionEnd) + elmt.value.substring(elmt.selectionEnd, elmt.value.length) + " "; elmt.focus(); elmt.value = elmt.value.trim(); </code></pre> <p>With the above the cursor is always at the end of the text. Is there any way I can place it directly after txtToIns? And no, txtToIns.focus() won't work</p>
javascript
[3]
5,793,950
5,793,951
modify Post data before controls LoadPostData() in ASP.NET
<p>We want to "replay" a complex filter ui once the request has been exectued and the user comes back to the filter page.</p> <p>Since the filter is very complex and dynamic we don't want to walk through all items and remember the selected values and then apply the saved values from the code - the post data contains all selected options anyway...</p> <p>So the goal is to intercept a !IsPostBack request, check if we have a saved filter for the scenario, inject the saved post data into the request and then go on and let all ASP.NET controls do their work as if it was a postback.</p> <p>What we've tried so far:</p> <ul><li>Server.Transver preserving the Form is a nice idea, but the Request.Form is a readonly colletion.</li> <li>creating a new HttpWebRequest to the same page with custom post data seems to stall the IIS worker process.</li> <li>Not sure if an IHTTPHandler can modify the Post data or if that is already too late?</li> </ul> <p>Any ideas? This would be really cool and extremely flexible for replaying any kind of requests...</p>
asp.net
[9]
1,592,952
1,592,953
Android Application Building Alternatives
<p>I'm beginning to look into Android programming.</p> <p>When developing a mobile application, are there other options besides using the SDK to develop a native application?</p> <p>For instance, is it possible to develop an application using only web technologies?</p> <p>If so, what is your experience on the different techniques (limitations, etc)?</p> <p>Thanks</p>
android
[4]
750,169
750,170
how can i read inbox in android mobile?
<p>i want read Sms inbox in android mobile via android application.Any one know this </p>
android
[4]
543,223
543,224
Jquery Jpoll Plugin not working
<p>I am refering <a href="http://www.danwellman.co.uk/category/plugin/" rel="nofollow">http://www.danwellman.co.uk/category/plugin/</a> for Jpoll stub</p> <p>But getting Java script error as "Expected :"</p> <p>Following are my code details</p> <pre><code>&lt;TABLE CELLPADDING="1" CELLSPACING="1" BORDER="0" WIDTH="98%" height="100%" CLASS="GridOne"&gt; &lt;TR&gt;&lt;TD class="boldText"&gt;Todays Poll&lt;/TD&gt;&lt;/TR&gt; &lt;TR&gt;&lt;TD&gt;&lt;div id="pollContainer"&gt;&lt;/div&gt;&lt;/TD&gt;&lt;/TR&gt; &lt;/TABLE&gt; &lt;SCRIPT type=text/javascript&gt; $(document).ready(function(){ var config = { ajaxOpts.url: "miscellaneous.do?requestSource=PROCESS_POLL", groupName:"a string", groupIDs:["One", "Two" , "Three"], pollHeading:"", rowClass:"", errors:true || false }; $("#pollContainer").jPoll(config); }); &lt;/script&gt; </code></pre> <p>But if i remove this line eror is not occur.</p> <pre><code> ajaxOpts.url: "miscellaneous.do?requestSource=PROCESS_POLL", </code></pre> <p>Please help.</p>
jquery
[5]
2,706,376
2,706,377
scanf is skipped
<p>I have the following code and I have defined the functions that I am calling here, the problem here is : I run the code input: 1 input: 2 input: 2 input: 6 input: 5 6 // for the scanf associated with i=6; after this I get the output on the screen as enter ur choice and then it exits out of the program ... its like the scanf gets the value from somewhere but I dunno from where I also tried fflush(stdin) doesnt seem to work can any one please help</p> <pre><code>int main() { int i,*j,k,pos,val; Element *stacka = new Element; stacka =NULL; while(i!=5) { printf("Enter ur choice \n"); fflush(stdin); scanf("%d",&amp;i); if(i==1) { if(createStack(&amp;stacka)) { printf("yes"); } } if(i==2) { k=2; if(push(&amp;stacka,&amp;j)) { printf("yes"); } } if(i==3) { if(pop(&amp;stacka,&amp;k)) { printf("yes %d",k); } } if(i==4) { if(emptyStack(&amp;stacka)) { printf("yes"); } } if(i==6) { scanf("%d,%d",&amp;pos,&amp;val); fflush(stdin); insert_at_pos(pos,val,&amp;stacka); } } return 0; } </code></pre>
c++
[6]
823,604
823,605
Android Layout question?
<p>I want to have navigation bar at the bottom of my screen. There will be 'Prev' button at rightest and a 'Next' button at leftest. And a textview on center.</p> <p>I tried linear and relative layout but failed. When I put width="fill_parent" to text then left button dissappears.</p> <p>Here the one I tried:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:id="@+id/rlayout" android:layout_height="fill_parent" &gt; &lt;!-- other content a listview etc. --&gt; &lt;LinearLayout android:id="@+id/navigator" android:orientation="horizontal" android:layout_alignParentBottom="true" android:layout_width="fill_parent" android:layout_height="wrap_content" &gt; &lt;Button android:id="@+id/prevbtn" android:background="@drawable/prev" android:onClick="prevPage" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;TextView android:id="@+id/pageText" android:text="" android:gravity="center_horizontal" android:layout_centerHorizontal="true" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; &lt;Button android:id="@+id/nextbtn" android:background="@drawable/next" android:onClick="nextPage" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre>
android
[4]
3,068,407
3,068,408
How to center a page on the screen using jQuery?
<p>i use this code:</p> <pre><code>jQuery("#page").css({"left":+'"'+(jQuery(window).innerWidth()-1083)/2+'px"'}); </code></pre> <p>I don't get any errors, but the page isn't centered.</p> <p>I tried various versions, nothing helped. What am I doing wrong?</p>
jquery
[5]
288,411
288,412
What questions should every good Python developer be able to answer?
<p>What questions do you think should a good Python programmer be able to respond to?</p> <p>PS: I have seen this question based on other languages but not Python!</p>
python
[7]
1,516,277
1,516,278
Python: Catch exception and repeat code
<p>I have this code:</p> <pre><code>import imaplib, re import os import time conn = imaplib.IMAP4_SSL("imap.gmail.com", 993) conn.login("ddd", "dddd") while(True): unreadCount = re.search("UNSEEN (\d+)", conn.status("INBOX", "(UNSEEN)")[1][0]).group(1) print unreadCount if int(unreadCount) &gt; 10: print "restarting..." time.sleep(50) </code></pre> <p>Which sometimes loses the connection and stops working. How can I catch the exception and start the code over every time it breaks?</p> <p>Thanks</p>
python
[7]
5,516,077
5,516,078
Long (5 second) DOMContentLoaded wait when opening PHP file
<p>Thanks in advance for your help with this. I've got a very simple PHP file that returns HTML code for an image based on some passed parameters. The code works fine, and the image shows up quickly. However, the page itself doesn't finish loading for a good 5 seconds, which is interfering with some AJAX calls I'm trying to do. Firebug says the time breakdown is like this:</p> <ul> <li>0ms: DNS lookup </li> <li>0ms: Connecting </li> <li>0ms: Queuing </li> <li>211ms: Waiting for response</li> <li>14ms: Receiving data</li> <li>+5.32s: 'DOMContentLoaded' (event)</li> <li>+5.33s: 'load' (event)</li> </ul> <p>Here's my PHP code:</p> <pre><code>&lt;?php $getimage = $_GET['p']; $getcity = $_GET['c']; ?&gt; &lt;img src="/images/photos/big/&lt;?php echo $getcity; ?&gt;_&lt;?php echo $getimage; ?&gt;.jpg" alt="" class="gallery" /&gt; </code></pre> <p>Pretty simple, no? Any idea what's going on?</p>
php
[2]
3,084,123
3,084,124
Simple? Increase Field/Box Size
<p>We have a custom CMS on a football website. Within the CMS admin panel is a squad biography section, as shown here:</p> <p><img src="http://i.stack.imgur.com/VTjBJ.jpg" alt="app.php"></p> <p>On the above screenshot you will see the ‘Biography’ section highlighted. The code for this section within /app.php is;</p> <pre><code> &lt;ul class="tr"&gt; &lt;li class="td1"&gt;Biography&lt;/li&gt; &lt;li class="td2"&gt;&lt;input type="text" name="biography" value="&lt;?=$row['biography']; ?&gt;" /&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I’m trying to make the Biography box bigger as this field will require several paragraphs. Currently, it’s just one character limited row.</p> <p>I’m also hoping to replicate making the box bigger on the actual outcome too. Screenshot of which is here: <img src="http://i.stack.imgur.com/C0bYD.jpg" alt="index.php"></p> <p>/index.php contains this code;</p> <pre><code>&lt;ul class="tr"&gt; &lt;li&gt;&lt;?=$row['biography']; ?&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Any help as to how I can make the input and output boxes bigger (to accommodate paragraphs rather than one single line) would be massively appreciated.</p>
php
[2]
1,431,618
1,431,619
get rss feeds for weather forecast
<p>I am trying to get weather forecast details for 3 days for user location. I cant find any content providers providing weather forecast details with weather code. So, anyone please suggest me which api can i use to get this information. I will ready also to pay for the feeds. Thanks in advance.</p>
android
[4]
2,844,969
2,844,970
How to double-quote a string in C#
<p>I want to produce a string like this: <code>"blabla"</code></p> <p>I tried wrapping it in single quotes: <code>"'blabla'"</code>, but that produces <code>'blabla'</code>. How can I wrap a string in double-quotes?</p>
c#
[0]
887,240
887,241
JS object naming issue
<p>Probably a really silly question, but I can't fathom it:</p> <p>I want to be able to create a tab by calling a function - newTab(); I want this function to create a new tab object (that I can manipulate by doing things such as tab0.close();)</p> <p>My problem arises in getting the object to have a unique name:</p> <pre><code>//This will be used for the object ID var tabQty = 0; //Call to create a tab newTab(); //Function to make the tab function newTab(){ //This is how I want to make the names - tab0, tab1, tab2 etc tabName = "tab" + tabQty; // - this is my problem line - I can't use tabName = as it just overwrites the value of tabName. How do I get around this? return tabName = new tabBuilder(tabName); } function tabBuilder(tabName){ return{ name: tabName, close: function(){//blah} //More to come here } } </code></pre> <p>I understand this may not be the best way of doing things either, so I'm open to suggestions!</p> <p>Cheers,</p>
javascript
[3]
4,729,284
4,729,285
Can't figure out the error in this simple Java code
<pre><code>public class Test { class Foo { int frob() { return 7; } } class Bar extends Foo { @Override int frob() { return 8; } } class Baz extends Foo { @Override int frob() { return 9; } } public static int quux(Bar b) { return b.frob(); } public static void main(String[] args) { System.out.println(quux(new Bar()));//this line gives non-static variable this cannot be referenced from a static context } } </code></pre>
java
[1]
2,928,051
2,928,052
Understanding javascript closure
<pre><code>function makeHelpCallback(help) { return function() { showHelp(help); }; //array elements here for (var i = 0; i &lt; helpText.length; i++) { var item = helpText[i]; document.getElementById(item.id).onfocus = makeHelpCallback(item.help); } </code></pre> <p>I am having trouble understanding the last line. I have never seen the equal sign used in that way,</p>
javascript
[3]
591,543
591,544
android need idea about image uplaod on server
<p>i want to capture the photo from android mobile and upload on server any one have done this type of example than plzz give simple steps for this i am not asking about the code but way for do this</p> <p>i have some idea but is right or wrong i don't understand first i take the picture from android after this i conver that picture in bitmap than convert in byte after this i will send it to server using httpclient php webservice it is right or wrong if any one know the complete way than tell me thanks</p>
android
[4]
757,298
757,299
What is the idea behind creating levels for iPhone games?
<p>I want to know how different levels are made in iPhone games like "AngryBirds". Do they have some large array which has locations where to put the brick or something? How do those kinds of levels are developed? </p>
iphone
[8]
2,832,694
2,832,695
Parse Excel document for keywords using C#
<p>I need to parse the excel document for certain keywords using C# and count the number of their occurrences. These keywords are required to be searched within a certain range, which is not fixed.</p> <p>Please provide some help for this.</p> <p>Thanks!</p>
c#
[0]
2,759,268
2,759,269
jQuery.proxy() usage
<p>I was reading the api about <a href="http://api.jquery.com/jQuery.proxy/"><code>jQuery.proxy()</code></a>. It looks promising but I was wondering in what situation is this best use. Can anyone enlighten me? Thanks.</p>
jquery
[5]
4,814,254
4,814,255
Which method is faster?
<p>I have a text file that serves as a simple database, each entry spanning two lines, like so:</p> <pre><code>name number bob 39 jack 22 jill 85 </code></pre> <p>Now say that I have each line separated in an array, and I wanted to analyze each NAME and see if it equals a variable. Would it be faster to do this:</p> <pre><code>if($variable == $line) { //true } </code></pre> <p>Or first filter out the even numbered lines (the names), and then analyze them to see if they equal the variable? If you don't know, the first line following basically finds the remainder of the count (this is all in a foreach loop) divided by 2, and if it equals 0 then it is an even number.</p> <pre><code>if ($count%2 == 0) { if($variable == $line) { //true } } </code></pre> <p>Thanks.</p>
php
[2]
426,026
426,027
Select & replace a random word in javascript
<p>I'd like to write a code in javascript that selects a random word from a text, and replaces it for another word.</p> <p>Here's my code: </p> <pre><code>var text = "dog cat apple stone"; var keyword = text[Math.floor(Math.random()*text.length)]; // select random word var new_phrase = text.replace( keyword, "house"); // replace for other word document.write("&lt;p&gt;" + text + "&lt;/p&gt;" ); document.write("&lt;p&gt;" + new_phrase + "&lt;/p&gt;"); </code></pre> <p>However, this replaces a letter in the text not a word. Like this: "dog chouset apple stone"</p> <p>How can I select a random word not a letter?</p>
javascript
[3]
1,182,236
1,182,237
Is it possible to add a GLSurfaceView to ViewGroup without making screen go black
<p>I have a ViewGroup (V) that is the Activity's content view and I draw on the V's Canvas directly. At runtime, I create a GLSurfaceView (G) whose initial content is set to be the same as the V. Then I call V.addView(G) to add G to the top of V. I expect this to be a smooth transition and users should not notice any artifacts. However, during the transition, the screen goes black for about half a second and then G shows up. I am not sure why it is so and is there any way to get rid of this effect? </p> <p>Best Regards, Frank</p>
android
[4]
1,709,851
1,709,852
BinaryFormatter vs SoapFormatter
<p>Can someone tell me why Objects serialized with SoapFormatter are more likely to successfully traverse firewalls than BinaryFormatter?</p> <p>Thanks</p>
c#
[0]
215,564
215,565
Remove HTML "Things" from parsed source code
<p>Evening, I fetch a list of source's from a wiki and parse it with regular expressions. So far so good, but there i got something like that in the parsed source code:</p> <pre><code>&amp;lt;b&amp;gt;0&amp;lt;/b&amp;gt; to disable and &amp;lt;b&amp;gt;1&amp;lt;/b&amp;gt; to enable. </code></pre> <p>The readable, formatted text is:</p> <p><strong>0</strong> to disable and <strong>1</strong> to enable.</p> <p>I know, I could do it simply with <code>.Replace()</code>, but I hope/guess there is a .Net Function for this - although I found nothing with google.</p>
c#
[0]
1,766,058
1,766,059
Declaring and initializing a static int in a header
<p>If I have the following in a header file:</p> <p>Foo.h</p> <pre><code>Foo { public: static const int BAR = 1234; ... }; </code></pre> <p>Do I also need to define the variable in the .cpp, e.g.:</p> <p>Foo.cpp</p> <pre><code>const int Foo::BAR; </code></pre> <p>We have an issue where initializing a static in a header seems to work on MS compilers but with gcc on the Mac it seems to give linker errors.</p>
c++
[6]
4,168,820
4,168,821
How to parse time durations from Strings with 2 different Format and add them?
<p>I Have 2 Strings with two different format e.g. First Format : "08:50 09:50" Second Format : "10:30"</p> <p>how can i parse &amp; subtract the first to be 01:00 and add it to the second one after parse it to get total = 11:30 </p>
java
[1]
1,054,422
1,054,423
Want to convert EST to PST for given date in PHP
<p>Can we change date which is in EST to PST format...like any PHP function for that</p> <p>Ex <code>2012-11-28 08:00:00</code> which is EST to PST <code>2012-11-28 05:00:00</code></p> <p>I know that we can directly subtract 3 hrs from EST. But is there any PHP in built function which support it ?</p>
php
[2]
5,948,024
5,948,025
how to display a web page with python?
<p>I am learning python at college. I have got a very stupid question. How do i make a web page with python?</p> <p>I do this and save as test.py</p> <pre><code>print "Hello test \n"; print "\n" print "Just testing \n"; </code></pre> <p>When i go to the url I get the same output</p> <pre><code>print "Hello test \n"; print "\n" print "Just testing \n"; </code></pre> <p>I am really confused. What am i doing wrong? My hosting is with hostgator. On their web site it says to do like this:</p> <pre><code>#!/usr/bin/python print "Content-type: text/html\n\n"; print "&lt;html&gt;&lt;head&gt;"; print "&lt;title&gt;CGI Test&lt;/title&gt;"; print "&lt;/head&gt;&lt;body&gt;"; print "&lt;p&gt;Test page using Python&lt;/p&gt;"; print "&lt;/body&gt;&lt;/html&gt;"; </code></pre> <p>this gives me the same error.</p>
python
[7]
2,275,130
2,275,131
Is :focus return always false
<p>I creating a script, and I like to know if a scecific field is focused by using the following code:</p> <pre><code>console.log($('#element_title').is(':focus')); </code></pre> <p>The problem is that either the field is focus or not, I always get "false" as result. Am I doing something wrong with that ?</p> <p>The element I try to check is a text field.</p> <hr> <p>The problem solved, with the reccomendation of the "adeneo".</p> <p>Thanks a lot :)</p>
jquery
[5]
3,853,866
3,853,867
How can I go through each link on a page and append something with jQuery?
<p>I have a bunch of links on a page that on an action, I run a function and it appends an extra variable like so:</p> <pre><code>function storeId(uID) { $('a.special').each(function(){ $(this).attr('href',$(this).attr('href')+'&amp;variable='+uID+''); }); } </code></pre> <p>My understanding is, the above would go through each link identified, and grab the existing href, then append the variable bits onto the end. I have got the variable appending, but its not working as expected... e.g its appending the '&amp;variable=' part twice, the first time, like '&amp;variable=undefined' and then on top of that '&amp;variable=23'. </p> <p>Is there a better way to do this? Or a way I can just say go through each of these links and simply update the value that is set to the variable rather than rewriting the whole href?</p> <p>So just to re-iterate, my original link is just something like this:</p> <pre><code>&lt;a class="special" href="/page.php?random=1"&gt;link name&lt;/a&gt; </code></pre> <p>And the aim is to have it look like the following after the function is performed:</p> <pre><code>&lt;a class="special" href="/page.php?random=1&amp;variable=32"&gt;link name&lt;/a&gt; </code></pre> <p>But it winds up looking like:</p> <pre><code> &lt;a class="special" href="/page.php?random=1&amp;variable=undefined&amp;variable=32"&gt;link name&lt;/a&gt; </code></pre>
jquery
[5]
5,007,874
5,007,875
The specified CGI application misbehaved by not returning a complete set of HTTP headers
<p>I am getting the following error while trying to run a PHP page</p> <p>The specified CGI application misbehaved by not returning a complete set of HTTP headers.</p> <p>The page was working fine earlier.Then i made some changes to the page for formating of the content(Added some more rows to the HTMLtable and gave some styles for it)</p> <p>Can anyone tell me why its coming ? </p> <p>In my local environemnt (WAMP ) its working fine . My Production server is running in an IIS </p>
php
[2]
2,544,036
2,544,037
recursive definition in CPP
<p>I meet a problem like this: <strong>UPDATE</strong></p> <pre><code>class A { public: A(){} int i; B b; }; class B { public: B(){} int j; A a; }; </code></pre> <p>When I define it in one .h file, it would give an error. I think the problem is the recursive definition. But could someone help me how to solve such issue?</p> <ol> <li><p><code>error C2146: syntax error : missing ';' before identifier 'b' c:\users\xingyo\documents\visual studio 2010\projects\cppalgo\recudef\test1.h 9 1 RecuDef</code></p></li> <li><p><code>error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\xingyo\documents\visual studio 2010\projects\cppalgo\recudef\test1.h 9 1 RecuDef</code></p></li> <li><p><code>error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\xingyo\documents\visual studio 2010\projects\cppalgo\recudef\test1.h 9 1 RecuDef</code></p></li> </ol>
c++
[6]
3,506,339
3,506,340
Priority when more than one event handler is bound to an element
<p>When more than one event handler is bound to an element, how is it determined which one is triggered first?</p> <pre><code>&lt;script&gt; $(function(){ $(".li").find('input').click(function(){alert('li&gt;input');}); $(".li").click(function(){alert('li');}); $('input').click(function(){alert('input');}); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;ul&gt; &lt;li class="li"&gt;&lt;input type="checkbox" /&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/li&gt; &lt;li class="li"&gt;&lt;input type="checkbox" /&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/li&gt; &lt;li class="li"&gt;&lt;input type="checkbox" /&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/body&gt; </code></pre>
jquery
[5]
4,212,760
4,212,761
Adding Widgets to Masonry Layouts Correctly - jQuery &&|| PHP
<p>I tried incrementally adding in my widget area to the masonry layout (PHP below) it appears but I cannot get it included into the masonry like the other blocks.</p> <pre><code> $counts = 0 ; $addin = get_sidebar('masonry'); foreach ($posts as $post) : setup_postdata($post); $counts++; ?&gt; &lt;div class="box"&gt; &lt;?php if($count == 9) {echo $addin;} else {?&gt; &lt;a href="&lt;?php the_permalink() ?&gt;"&gt; &lt;h2&gt;&lt;?php the_title(); echo $counts; // just to see ?&gt;&lt;/h2&gt; &lt;?php if (has_post_thumbnail()) { the_post_thumbnail('thumbnail'); }?&gt; &lt;?php the_content();?&gt;&lt;/a&gt; &lt;/div&gt;&lt;?php } endforeach; ?&gt; </code></pre> <p>I also tried this jQuery but it broke my masonry:</p> <pre><code>jQuery(document).ready(function($){ $('.arrange').masonry({ itemSelector: '.box', isFitWidth: true, }); $('#addinWidget').click(function(){ var $container = $('#mas-widget'); var addinWidget = $('&lt;div class="element"&gt;&lt;?php get_sidebar('masonry');?&gt;&lt;/div&gt;'); addinWidget.insertAfter($container.find('.element').eq(3)); $container.masonry('reload'); }); </code></pre> <p>Could someone lead me in the right direction to place my widgets correctly inside the masonry layout AT/NEXT TO or IN FRONT OF a specified block number?</p>
jquery
[5]
460,052
460,053
iPhone Cache Manager
<p>I am trying to create a reusable Cache Manager component which can be plugged into other iPhone projects. My cache manager should support caching of Screens(with data in them) as well as images. The primary idea would be to reduce network activity.</p> <p>I am comparatively new to iPhone and have some basic iPhone programming knowledge. Please let me know of the following-</p> <p>1. Am I thinking in the right direction?</p> <p>2. Does iPhone architecture supports this kind of caching? If so, how? </p> <p>3. Also, any pointers towards related iPhone code samples or URLs?</p> <p>Thanks in advance for your time</p>
iphone
[8]
1,562,890
1,562,891
import an excel file with PHP Excel Reader
<p>I'm trying to use this class to import a large amount of data. Most of the data is being read correctly, however I have two date columns which are giving me problems.</p> <p>The dates are in the format <code>DD/MM/YYYY</code> and the values returned are one day ahead of those in the spreadsheet. For example, <code>04/03/2011 00:00</code> becomes <code>04/03/2011 02:00</code></p> <p>I have tried accessing the data like this:</p> <pre><code>$data-&gt;sheets[$sheet]['cells'][$row][$col]; </code></pre> <p>I have also tried using the raw data:</p> <pre><code>$data-&gt;sheets[$sheet]['cellsInfo'][$row][$col]['raw'] </code></pre> <p>Which returns the date as a unix timestamp but still it is one day ahead of what it should be.</p> <p>Is there any way I can force the class to return the value of the column as a simple string?</p>
php
[2]
104,372
104,373
Is it necessary to keep open a excel file, while importing data to data table, C#
<p><strong>My connection string is:</strong></p> <pre><code>String excelConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("abc.xls") + ";Extended Properties='Excel 8.0; HDR=YES;IMEX=1'"; OleDbConnection conn = new OleDbConnection(excelConn); Conn.Open(); </code></pre> <p>It gives an error, like “<strong>Could not decrypt file.</strong>” If my Excel file (abc.xls) is close in my client PC. But it is ok when my excel file is open.</p>
c#
[0]
1,894,040
1,894,041
Register/Login from android using oauth2 and google API
<p>Working on a native app that requires the user to register to our server. I would like the user to be able to use oauth2 with google contact api to login. Not knowing exactly how this would work but idea is:</p> <p>get default google account and get a token. <br> send relevant data to our server.(token/userinfo) <br> verify google account on server and create a one time password <br> send password to phone <br> let user register to our service with google account name and one time password <br></p> <p>I am not really sure how to do this and what type of token / authorization code I need to do this. </p>
android
[4]
65,838
65,839
Audio file to waveform using PHP
<p>I'm looking for PHP class which will take an audio file and them return an image file of the waveform - similar effect can be seen here <a href="http://soundcloud.com/rollin-fire-cru/sets/house-house-house-house/" rel="nofollow">http://soundcloud.com/rollin-fire-cru/sets/house-house-house-house/</a></p> <p>It should run on a linux server and accept the following audio file formats: mp3, mp4, aac, wav</p> <p>I found an example class, but it does a very basic job <a href="http://phpclasses.ca/package/482-PHP-Extracts-attributes-of-audio-files-Visualization.html" rel="nofollow">http://phpclasses.ca/package/482-PHP-Extracts-attributes-of-audio-files-Visualization.html</a> </p> <p>Any help will be highly appreciated!</p>
php
[2]
4,654,871
4,654,872
Detect rotation of iPhone on table
<p>How is it possible to detect the rotation of an iPhone that lies on a table like the compass but is showing a more accurate rotation? I have used the magnetic heading but it is really shakey. I want to achieve the result that Gyrosc does using the heading, accelerometer and gyroscope: <a href="http://appshopper.com/utilities/gyrosc" rel="nofollow">http://appshopper.com/utilities/gyrosc</a></p> <p>How does one combine the 3?</p>
iphone
[8]
2,272,814
2,272,815
How to check that string contains is english only
<p>i have a string which contains values like:</p> <pre><code>string str ="Abhigyan Prakash,Primeshow,NewsPoint,NCP,Inflation,सरकार,राहुल,प्राइम शो,न्यूजप्वाइंट,कमजोर,एनसीपी,अभिज्ञान प्रकाश,Rahul"; </code></pre> <p>i have used below code to convert it to array list:</p> <pre><code> ArrayList altags = new ArrayList( str.Split(',')); </code></pre> <p>now i wants to remove all those strings from arraylist which belongs from non-english language (in my context those words which are written in "hindi" should be removed)</p> <p>please suggest me how to check that string is written in english (with numeric and symbols) or in other language..</p> <p>NOTE: i have no issue with generic list. i cant take it also. but please tell me how to check that string contains only alphabets + numeric + symbols Thanks</p>
c#
[0]
2,342,782
2,342,783
Displaying on Locked Android Screen
<p>Would it be possible to keep an android device in a locked state while having something displayed on the screen? Meaning all functionality would work as if the device is locked (since it would be locked) and the only difference would be that there is something displayed on the screen. The main purpose of this question is to display something just as the notification bar does in a locked state and to be able to return to the original lock screen instead of having something be displayed on the device and once the lock screen is pressed it blanks out the device and you must press it again to return to the locked interface. </p>
android
[4]
1,613,714
1,613,715
treeview position maintain in asp.net
<p>Im using Treeview in asp.net</p> <p>Treeview like</p> <p>PARENT1</p> <pre><code>#Child .Subchild1 .Subchild2 </code></pre> <p>PARENT2 #child1 #child2</p> <p>first when my page load at first time all nodes should be collapsed like</p> <p>PARENT1 PARENT2</p> <p>If i expand PARENT1 and click subchild2 as by my senario my page is rediected and parent1 should be expanded and parent2 should be collapsed....</p> <p>if i click parent2 vise versa...</p> <p>so i have to maintain tree position level in every postback any solution for this?</p> <p>im using the following code </p> <p>but i got error protected void Page_Load(object sender, EventArgs e) { if (Session["tvExpandNode1"] != null) { TreeView1.FindNode(Session["tvExpandNode1"].ToString()).Expand(); } }</p> <p>protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { if (TreeView1.SelectedNode.Expanded==true) { Session["tvExpandNode1"] = TreeView1.SelectedNode.Parent.Parent.Value; if (strOpenpage == "Report.aspx") { OpenNewWindow(strOpenpage); } else { Response.Redirect(strOpenpage, false); } } }</p>
asp.net
[9]
756,651
756,652
moveRight(num) problems!
<p>Hey there Stackoverflow! I'm pretty new at Javascript, but I'm getting the hang of it pretty quickly. I'm working on a website and I can't quite get it working.</p> <p>First we have a button.</p> <pre><code>&lt;SPAN ID="button2"&gt; &lt;A HREF="#" onClick="changeZIndex(1,'contactus');changeZIndex(0,'aboutus');changeZIndex(0,'pagethree');moveRight(310)"&gt; &lt;IMG NAME="two" SRC="contactus.gif"&gt;&lt;/A&gt; &lt;/SPAN&gt; </code></pre> <p>Next we have the code chunk that controls moveRight</p> <pre><code>&lt;script type="text/javascript"&gt; var userWidth = window.screen.width; function moveRight(num) { var pp2 = document.getElementById("bar"); var lft = parseInt(pp2.style.left); var tim = setTimeout("moveRight()",10); lft = lft+5; pp2.style.left = lft+"px"; if (lft &gt; num) { pp2.style.left = num; clearTimeout(tim); } } &lt;/script&gt; </code></pre> <p>The movement is fine. The problem I have is with stopping it, which is what this snippet does</p> <pre><code> pp2.style.left = lft+"px"; if (lft &gt; num) { pp2.style.left = num; </code></pre> <p>When the num in (lft > num) and pp2.style.left = num is substituted with a real number, say 310, it works just fine. However when "num" is left in it does not stop. The reason I want to be able to substitute the stopping number is because I will have several buttons that will make the bar stop at various places on the site. I've been working on it for several hours and I've done everything I could think of. Hopefully you guys can do better than me! :)</p>
javascript
[3]
1,245,465
1,245,466
How to run jar application from window service registry?
<p><strong>DUPE: <a href="http://stackoverflow.com/questions/68113/how-to-create-a-windows-service-from-java-app">http://stackoverflow.com/questions/68113/how-to-create-a-windows-service-from-java-app</a></strong></p> <p>I have developed a Java jar application which processes input file and converts into csv file. Now my requirement is to run that jar application fom windows service. I have no idea of how to do that.</p> <p>How can I make a Java application into a Windows service?</p>
java
[1]
4,234,554
4,234,555
What's the difference between a public constructor in an internal class and an internal constructor?
<p>I have an internal class, an internal constructor won't allow it to be used in a generic collection so I changed it to public. What's the accessibility if you have a public constructor in an internal class and is it any different to having an internal constructor?</p>
c#
[0]
5,602,138
5,602,139
IE7 jquery .each on array
<p>Having some problems with IE7 on jquery $.each, this gives me an "Object does not support...."</p> <pre><code>arr = arr[1].split('::'); $.each(arr, function() { item = $(this).split("#_#"); }); </code></pre>
jquery
[5]
309,412
309,413
Please, I just need to improve my dictionary project in python
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2356408/problems-with-nested-loops">Problems with nested loops…</a> </p> </blockquote> <p>I have 2 different dictionary programs that I want combined (or put together).<br> The first one has the possibility to get good translation with grammar etc.<br> Here is the code so far:</p> <pre><code>words = {('i',): 'jeg', ('read',): 'leste', ('the', 'book'): 'boka'} max_group = len(max(words)) sentence = "I read the book".lower().split() translation = [] position = 0 while sentence: for m in range(max_group - 1, -1, -1): piece = tuple(sentence[:position + m]) if piece in words: translation.append(words[piece]) sentence = sentence[position + m:] position += 1 print(' '.join(translation)) </code></pre> <p>In program 2 you can write more than just one sentence at a time.<br> You will also get the first letter in a sentence capitalized.<br> The third thing is that you get the word that isn’t in the dictionary printed out. </p> <p>Here is the code for program 2:</p> <pre><code>import re words = {'i':'jeg','am':'er','happy':'glad'} sentence =input('Write a sentence:') sentence = sentence.split() translation = [] for word in sentence: piece = re.sub('[^a-z0-9]', '', word.lower()) punctuation = word[-1] if word[-1].lower() != piece[-1] else '' if piece in words: translation.append(words[piece] + punctuation) else: translation.append(word) translation = ' '.join(translation).split('. ') print('. '.join(s.capitalize() for s in translation)) </code></pre> <p>So the question is: How could I use the best of each program and just make a good one?...</p> <p>I appreciate every good effort…<br> Thanx in advance!</p>
python
[7]
5,300,513
5,300,514
fast way of looping in array with 300 elelment for searching key in javascript
<p>I have below code, I need it doesn't take so long for to sort through this array:</p> <p>This is the code I am using now:</p> <pre><code>var key= { '1001': { 'color': 'green', 'size': 'Big' }, '1002': { 'color': 'white', 'size': 'extralarge' }, '1003': { 'color': 'orange', 'size': 'small' }, //(AND so on.......about 300 keys) }; var code = 3001; if (code in key) { var color= key[code]['color']; var size= key[code]['size']; </code></pre> <p>So basically, it cycles through hundreds of possibilities trying to find a match, which takes to much time.... </p> <p>Is there a good way to do this so that it will not take so long?</p>
javascript
[3]
1,787,959
1,787,960
jquery explode()
<p>i want make function like that</p> <pre><code>function(data){ } </code></pre> <p>i want this data as this url,email,comments</p> <pre><code>function($data){ foreach(explode(",",data) as $value) var value = $("#value").val(); } </code></pre> <p>this code is like php iam sure its not work but i want make this by jquery i made it by php please help me</p>
jquery
[5]
5,040,457
5,040,458
android DatePickerDialog
<p>Is there any way to make DatePickerDialog not dismiss after clicking set button ?</p>
android
[4]
2,281,538
2,281,539
Migrating existing Activities application to Fragments
<p>I've an app written for phones. I'm planning on adding Fragments API so that same app runs 1.6 all the way to 3.2. However, the problem is with extending FragmentsActivity. My activities are extending a common activity which has all the common functions. Moving them into interface and implementing them is a lot of rework.</p> <p>What is the best way out? </p>
android
[4]
1,675,653
1,675,654
auto fired the text field once the value reach the certain length
<p>Now I am developing a bar code based attendance system . Any there any javascript event can solve once the text field has detected the value has 10 characters, the text field will be fired and i can able to get the value. </p> <p>Is there any solution ?</p>
javascript
[3]
988,856
988,857
Add Arrays of C# button Click in code in Run Time
<p>To create Button and its click event in run time I use:</p> <pre><code>Button b = new Button(); b.Name = "btn1"; b.Click += btn1_Click; </code></pre> <p>But now I have an array of Buttons to create in run time; how to set each button's event - I cannot interpolate because it's not a string.</p> <pre><code>Button[] b = new Button(Count); for (int i=0; i &lt; Count; i++) { b[i] = new Button(); b[i].Name = "btn" + i; b[i].Click += ?????? } </code></pre> <p>what should I do for "?????"</p>
c#
[0]
5,415,450
5,415,451
Can anyone suggest good Guidelines for asp .net UI design?
<p>I am a c# developer.</p> <p>Recently I had to design a web UI in asp .net 2.0 .I had strange problems with aligning controls in Visual studio UI. I have used Div, table tags to align asp .net controls(labels, textbox, grid etc).</p> <p>But the problem was what I saw in design surface of visual studio was entirely different (most of the time) when I view the page in browser.</p> <p>The gap between controls and alignments was never perfect .I have seen other developers also doing trial and error methods without a proper guidelines.</p> <p>C# coding I am pretty good and I have lots of Microsoft articles and help materials to guide me.</p> <p>But I haven’t found proper articles and guidelines for UI design of asp .net pages.(may be its out there and i havent found yet?)</p> <p>Can anyone through more light on this subject. Any good books ,suggestions etc? </p> <p>Thanks in advance</p> <p>SNC</p>
asp.net
[9]
3,229,599
3,229,600
JavaScript library for stretching divs
<p>I need advice. I need to make something like a rich text editor but only for div tags. User can move div, change place of two divs with drag and drop (add gravity), stretch width and height of div with mouse pointer. All divs which can be edited is in one parent div. My question is, because I am new to JavaScript, which library is the best for these kinds of things, has anyone done something similar with some library ?</p>
javascript
[3]
1,026,025
1,026,026
Convert byte[] to ArrayList<String>
<p>I found a question here on SO: <a href="http://stackoverflow.com/questions/5618978/convert-arrayliststring-to-byte">Convert ArrayList&lt;String&gt; to byte []</a></p> <p>It is about converting <code>ArrayList&lt;String&gt;</code> to <code>byte[]</code>. </p> <p>Now is it possible to convert <code>byte[]</code> to <code>ArrayList&lt;String&gt;</code> ?</p>
java
[1]
616,273
616,274
When to use Handler/Message to communicate in android application
<p>I can use Intent with data stored in extras to exchange information/ communicate between 2 android activities. When should I use Handler/Message to communicate in android applications?</p> <p>Thank you.</p>
android
[4]
4,245,240
4,245,241
How to pass values from html page to .aspx page?
<p>i have </p> <pre><code>&lt;input type ="text" id ="ID" value="" /&gt; &lt;input type ="text" id="Name" value ="" /&gt; &lt;input type="button" id="Submit" name="Submit" value="Submit" size ="45" /&gt; </code></pre> <p>when i click Submit button to pass values to .aspx page. </p>
c#
[0]
3,514,192
3,514,193
Open modal box by jquery onchange of select optuon
<p>How can I open a model box by jquery onchange of select option???</p>
jquery
[5]
4,174,723
4,174,724
Android "squishing" game graphics into upper left corner of large screen
<p>I'm doing something like the following:</p> <p><code>Bitmap mBitmap;</code></p> <pre><code>mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.myimage); </code></pre> <p>In onDraw I'm doing this:</p> <pre><code>canvas.drawBitmap(mBitmap,0,0,null); </code></pre> <p>My Manifest looks like this:</p> <p><code>&lt;supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="true" android:anyDensity="false" /&gt;</code></p> <p>On Larger screens, my images shrink down to about a quarter the size of the large screen and sit in the upper left hand corner.</p> <p>For the life of me, I cannot figure out how to get my images and screen coordinates to automatically adjust to the larger screens.</p> <p>The thing is, the code above works great on most devices, like Droids and normal screens. It's just tablets or slightly larger screen devices where this is happening.</p> <p>What am I doing wrong where the images and coordinates on the screen don't just resize like they do on the Droid?</p>
android
[4]
4,098,468
4,098,469
Where is located private certificate store on Android version below 4.0?
<p>I'm developing Android app which read private certificate and key from Android key store. Certificate was imported on Android from .p12 file on SD CARD using Settings > security >Install from storage (Credetial storage). </p> <p>On version 4.0 and higher I can get certificate and key from Android <a href="http://nelenkov.blogspot.com/2011/11/using-ics-keychain-api.html" rel="nofollow">KeyChain</a>. Can I programmatically get this certificate on Android version below 4.0?</p> <p>I can see certificate and can choose it from WI-FI settings and that's all. I try "BKS" and "PKCS12" stores, but get empty resultset. I can access CA certificate store and get CA certificate data, but that is not what I need.</p>
android
[4]
5,192,615
5,192,616
How to use single thread class for multiple web calls in android
<p>I've two buttons.i need to get two different web calls using two buttons.But need to use single thread through.If i use like below code.,the thread class didn't return json response.It returns null value.How could i resolve this issue?</p> <p>MY Thread class:</p> <p>public static json runDialogLogin(String URL) {</p> <p>JSONObject json;</p> <p>JSONParser jParser = new JSONParser();</p> <pre><code> new Thread() { public void run() { try { // getting JSON string from URL json = jParser.getJSONFromUrl(URL); } catch (Exception e) { e.printStackTrace(); } } }.start(); return json; } </code></pre> <p>My Main class:</p> <p>.....</p> <pre><code> @Override public final void onClick(final View v) { switch (v.getId()) { case R.id.button1: json= runDialogLogin("My URL1"); if(json!=null){ Intent i=new Intent(this,result1.class); startActivity(i); case R.id.button2: json= runDialogLogin("My URL2"); if(json!=null){ Intent i=new Intent(this,result2.class); startActivity(i); } } } </code></pre>
android
[4]
5,784,344
5,784,345
HorizontalListView Selector
<p>i have a HorizontalListView <a href="https://github.com/vieux/Android-Horizontal-ListView" rel="nofollow">https://github.com/vieux/Android-Horizontal-ListView</a> with several items inside, each of these items has a relative layout enclosing some text and an image. i have added a selector to this relative layouts and it works great in newer versions of android setting white the relativelayout of each item white when is pressed.</p> <p>the problem is that in older versions of android the HorizontalListview starts acting weird when i scroll, this is because i add android:clickable="true" to each relative layout. if i remove this attribute the HLV starts working normally but the selector wont work.</p> <p>Here is my Layout: </p> <pre><code>&lt;RelativeLayout android:id="@+id/marcoNota" android:layout_width="@dimen/tile_width" android:layout_height="@dimen/tile_height" android:background="@drawable/tile_selector" android:clickable="true" android:paddingBottom="2dp" android:paddingTop="2dp" android:paddingLeft="2dp" android:paddingRight="2dp"&gt; &lt;/RelativeLayout&gt; </code></pre> <p>I even tried setting an onTouchListener on the adapter obtaining the same result.</p> <p>I would like to know if its possible to use a selector whitout setting Clickable="true" or any work around on this.</p>
android
[4]
2,446,990
2,446,991
Extend Array using John Resig Extend
<p>I have been using John Resig's simple inheritance scheme in my project. <a href="http://ejohn.org/blog/simple-javascript-inheritance/" rel="nofollow">http://ejohn.org/blog/simple-javascript-inheritance/</a></p> <p>Basically, I have an object that I want to use as an array, but with some more properties. </p> <p>I'm aware that there are other ways to extend Array, however I have been using this extend method throughout my code, so I would like it to be consistent.</p> <p>I would like something like this, it's very awkward though:</p> <pre><code>var Array2 = Class.extend(Array); var Foo = Array2.extend( { init : function() { } }); </code></pre> <p>EDIT: One of the major problems is that the 'length' property is not properly updated when you add something via index. I.e </p> <pre><code>var x = new Foo(); x[0] = "test"; alert(x.length) //0 </code></pre>
javascript
[3]
1,898,803
1,898,804
PHP Ucwords on underscores
<p>Just curious if anyone knows a quick way to use ucwords() on a string replacining underscores with spaces? I have a preg_replace that will do it, but won't add the needed spaces in between...</p> <pre><code>// this_string_contents -&gt; ThisStringContents preg_replace('/(?:^|_)(.?)/e',"strtoupper('$1')",$string); </code></pre> <p>And the reverse</p> <pre><code>// ThisStringContents -&gt; this_string_contents strtolower(preg_replace('/([^A-Z])([A-Z])/', "$1_$2", $string)); </code></pre> <p>It would be nice if these were symmetrical too, the above will do something like this</p> <pre><code>* this_is_a_string -&gt; ThisIsAString -&gt; this_is_astring * GetURLForString -&gt; get_urlfor_string -&gt; GetUrlforString </code></pre>
php
[2]
4,721,291
4,721,292
Python pickle on list
<p>Im trying to store a list in a flat file through and for some reason I dont see the file being created..under c:\python27\basics\db.txt</p> <p>Here is my code:</p> <p>make_db_pickle.py</p> <pre><code>from Basics import data import pickle db = data.people dbfilename = 'c:\python27\Basics\db.txt' try: dbfile = open('dbfilename','wb') except IOError as (errno,strerror): print "I/O error({0}): {1}".format(errno, strerror) except ValueError: print "Could not convert data to an integer." except: print "Unexpected Error", sys.exc_info() [0] pickle.dump(db,dbfile) dbfile.close() </code></pre> <p>data.py</p> <pre><code>bob={'name':'bobs mith','age':42,'salary':5000,'job':'software'} sue={'name':'sue more','age':30,'salary':3000,'job':'hardware'} people={} people['bob'] = bob people['sue'] = sue </code></pre>
python
[7]
659,749
659,750
text change on jquery :ischecked
<p>I am trying to build a function to change the text on checkbox selection, please check following...</p> <p>Jquery code</p> <pre><code>$(document).ready(function() { if($('#active').is(':checked')) { $('strong', '#status').text('Active'); } else { $('strong', '#status').text('Inactive'); } }); </code></pre> <p>Html Form</p> <pre><code> &lt;span id="status"&gt;&lt;input name="active" type="checkbox" value="1" id="active" /&gt; &lt;strong&gt;Active&lt;/strong&gt;&lt;/span&gt; </code></pre> <p>It works perfect when page loads, but if we change value of #active or we click #active it doesn't change text like active or inactive. thanks for help.</p>
jquery
[5]
638,296
638,297
Uncaught TypeError: Object #<HTMLObjectElement> has no method 'RedrawWorkflow'
<p>I have the following code and it works in IE but not Chrome:</p> <pre><code>&lt;object id="WorkFlowGraph" name="WorkFlowGraph" width="800px" height="600px" classid="clsid:1E595677-765C-4B01-9B60-59AEE2BFAB2C" codebase="../../CAM/Scripts/WFDesigner3.ocx#Version=-1,-1,-1,-1"&gt;&lt;/object&gt; </code></pre> <p>And then in Javascript:</p> <pre><code>document.WorkFlowGraph.NextStepID = document.frmProcess.hidNextStepID.value; document.WorkFlowGraph.ComponentsXML = FixupString(document.frmProcess.hidComponentXML.value); document.WorkFlowGraph.WorkflowXMLIn = FixupString(document.frmProcess.hidWorkflowXML.value); document.WorkFlowGraph.IsWorkflowAllowRevision = document.frmProcess.hidIsAllowRevision.value.toString() == 'true' ? true:false; document.WorkFlowGraph.RedrawWorkflow(); </code></pre> <p>I am getting an error on document.WorkFlowGraph.RedrawWorkflow();</p> <p>It throws this error:</p> <p><strong>Uncaught TypeError: Object # has no method 'RedrawWorkflow'</strong></p> <p>I have searched and searched and can't figure it out. Please help.</p>
javascript
[3]
1,119,768
1,119,769
c++ array code error
<p>The code won't run, says the "return value" is wrong where it says return <code>found[i]=letter</code>, and the <code>srand time</code> is also showing error. I am not sure how to fix it? Perhaps put <code>found[i]</code> in <code>main()</code> and put <code>return 1?</code>? And not sure how to get the <code>srand</code> to work properly? </p> <pre><code>#include &lt;iostream&gt; using namespace std; void getarray(char [], int); void printa(char [],int ); void search(char [],int, char); void main() { srand(time(0)); //1-declare char letter=' '; char guess[7]; char found[7]={letter}; int res=0; char answer='Y'; } //2-init getarray(guess,7); //3- processing printa(guess,7); while(answer == 'Y') { cout &lt;&lt; "enter a letter"; cin &gt;&gt;letter; search(guess,7,letter); if (res != -1) printa(found,7); cout &lt;&lt;" do you want to continue(Y/N)?"&lt;&lt;endl; cin &gt;&gt;answer; } //printing system("pause"); } void getarray(char a[], int n) { for(int i=0;i&lt;n;i++) a[i]= 65 + rand()%26; } void printa(char a[], int n) { for(int i=0;i&lt;n;i++) cout &lt;&lt; " the letter " &lt;&lt; i+1 &lt;&lt; " is "&lt;&lt;a[i]&lt;&lt;endl; } void search(char a[],int n, char key) { for(int i=0;i&lt;n;i++) if ( a[i]== key) return Found[i]=={letter}; } </code></pre>
c++
[6]
1,820,281
1,820,282
Android: What is the reason for deprecating startManagingCursor?
<p>What is the reason for deprecating startManagingCursor ?</p> <p>My simple app has a table view with list of data from DB. So, what I have now in onCreate:</p> <pre><code> final Cursor cursor = getDataFromDB(); startManagingCursor(cursor); setListAdapter(new CursorAdapter(cursor)); </code></pre> <p>And thats it, and I dont need to do anything else...</p> <p>But startManagingCursor is deprecated now, and I should implement LoaderCallbacks , override onCreateLoader, onLoadFinished, onLoaderReset, create ContentProvider fo my DB and so on. But I dont need all this staff, I just need to get few lines of information from DB. How to be ? Why android did that ? Why should I implement all this staff ?</p>
android
[4]
1,292,830
1,292,831
How to upload the Image in a faster way on the Server
<p>We have written a program for Android. We are uploading the image of the size (50KB). It is compressed by converting the Image from png to jpg. It is taking more than 1 min to upload one image. Is there any alternative to upload the Image faster way?</p>
android
[4]
4,349,673
4,349,674
how to remove character from edittext?
<p>I want to know is there any method by which i can remove the specific character from the <code>EditText</code>. I want to remove charter from <code>EditText</code> by specifying position in edit text is there something like <code>removeAt()</code> for <code>EditText</code>?</p> <pre><code> public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button b1=(Button)findViewById(R.id.button1); final EditText ed1=(EditText)findViewById(R.id.editText1); b1.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub //i want something like this ed1.removeAt(5); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } } </code></pre> <hr> <p><strong>EXTRA INFORMATION</strong></p> <p>the main problem is i want to make text bold inside edittext but not all the text. The text that is typed after setting bold button on(bold is my toggle button). ok here is the code</p> <pre><code> ed1.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // TODO Auto-generated method stub int i = 0; switch(event.getAction()) { case KeyEvent.ACTION_UP: if(bold.isChecked()) { i=ed1.getSelectionStart(); ed1.append(Html.fromHtml("&lt;b&gt;"+ed1.getText().toString().charAt(i-1)+"&lt;/b&gt;")); } return true; } return false; } }); </code></pre> <p>the problem is that i get double character's one is normal character and then again the bold one so i want to remove that normal characters by specifying there position</p>
android
[4]
1,093,487
1,093,488
How do I convert a string to a decimal, and format it for pretty output?
<p>I want to convert "372551.40" to decimal. But I need to see it after converting this format 372.551,40.</p>
c#
[0]
967,038
967,039
how can an .ASPX page get its file system path?
<p>I have a page something.aspx, with associated codebehind something.aspx.cs. In that codebehind, I want to know the filesystem location of something.aspx. Is there any convenient way to get it?</p> <p>Update: I got several excellent answers, which unfortunately didn't work because of something else crazy I'm doing. I'm encoding some additional information on the URL I pass in, so it looks like this:</p> <p><a href="http://server/path/something.aspx/info1/info2/info3.xml" rel="nofollow">http://server/path/something.aspx/info1/info2/info3.xml</a></p> <p>The server deals with this OK (and I'm not using querystring parameters to work around some other code that I didn't write). But when I call Server.MapPath(Request.Url.ToString()) I get an error that the full URL with the 'info' segments isn't a valid virtual path.</p>
asp.net
[9]
4,518,702
4,518,703
jquery assign value to key via .data() not working
<p>I have a pretty straightforward (one would think) task. </p> <p>Pass a value to a popup window and based on a click (proceed or cancel) perform an action using the value passed.</p> <pre><code> // on click we pass the value to the function testing - so far so good $('#numbers').delegate('.icondelete', 'click', function(){ testing( $(this).attr('data-options') ); }); </code></pre> <p>I pass the value found to a function, then try to assign it to a key</p> <pre><code>function testing(id){ //we can see that it passed successfully alert("here it is: " + id); //push the data into key data-id $('#dodelete').data('data-id',id); //but this alert doesn't return the value alert("it should be here shouldn't it? " + $('#dodelete').attr('data-id')); } </code></pre> <p>html</p> <pre><code>&lt;div id='numbers' &gt; &lt;div class='icondelete' data-options='123' &gt;Set data-options as 123 - click here to test&lt;/div&gt; &lt;/div&gt; &lt;br&gt;&lt;br&gt; &lt;div id='dodelete' data-id=''&gt;landing div&lt;/div&gt; </code></pre> <p>If you check out the fiddle <a href="http://jsfiddle.net/Microbe/cRLfC/4/" rel="nofollow">http://jsfiddle.net/Microbe/cRLfC/4/</a> , you can see that the value is passed into the function no probs, but then when I try to assign it to the key it doesn't.</p> <p>Where am I going wrong?</p>
jquery
[5]
4,708,084
4,708,085
Full screen browser window with javascript (cross-browser) or alternatives?
<p>Running a web-based app that when full-screen maximizes real-estate for best usage for this type of industry. I need to find a way to link up a javascript function to a button (like pressing F11) that will fully maximize the browser window.</p> <p>We also have an installer that places .url shortcuts in Windows. A nice alternative would be some sort of parameter that opens the default browser full-screen.</p> <p>Does anyone have a clean approach? The code provided here is very dirty but <em>almost</em> gets the job done: <a href="http://stackoverflow.com/questions/7550989/full-screen-browser-window-like-f11">Full Screen Browser window (Like F11)</a></p> <p>Thanks!</p>
javascript
[3]
90,227
90,228
How do I write a jquery function that accepts a callback
<p>i wrote a custom jquery function that accept a callback but not being able to understand how call back function will execute at the calling environment when animate function execution end.</p> <p>here is my custom function code</p> <pre><code>jQuery.fn.busyToggle = function (flag, marginBottom, opacity, speed, easing, callback) { if (flag == 1) { return this.stop(true).animate({ marginBottom: marginBottom, opacity: opacity }, { queue: false, duration: speed }); } else { return this.stop(true).animate({ marginBottom: marginBottom, opacity: opacity }, { queue: false, duration: speed }); } }; </code></pre> <p>this way i am calling this function</p> <pre><code>$('#BusyBox').busyToggle(flag,0,1,500); </code></pre> <p>i need to know that how to capture when animate function end from calling environment. if possible please discuss in detail. thanks</p>
jquery
[5]
806,579
806,580
PHP - Commercial round
<p>I want to make commercial round to prices (with PHP)</p> <p>For example : </p> <p>15.55 becomes 15.60</p> <p>15.54 becomes 15.50</p> <p>147.77 becomes 147.80</p> <p>==> Always zero in the end.</p> <p>How can I do that ?</p> <p>Thanks a lot.</p>
php
[2]
4,875,672
4,875,673
how to validate date with PHP
<p>If a date is submitted by form in following format, <code>$month=2, $day=31, $year= 2010</code>. How can i verify using PHP date function if it is valid date or not? Thanks.</p>
php
[2]
5,725,697
5,725,698
getDate() does not return the exact date that system have?
<p>i am implementing custom listview in android with image, text and date but when i call getDate method it will work but return 1/1/1970 instead of showing my system date?</p>
android
[4]
924,468
924,469
Get index of an array
<p>I'm having some problems retrieving data from a multidimensional array. I have something like this:</p> <pre><code>$Act[0] = array( "Number" =&gt; 23, "Local" =&gt; "woods", "props" =&gt; "swords..." ..... $Act[1] = array( "Number" =&gt; 27, "Local" =&gt; "castle", "props" =&gt; "swords..." ..... ...... $Story[$day] = array( "Date" =&gt; $SDate, "Acts" =&gt; $Acts ); </code></pre> <p>What I want to do is to get all the numbers from the Act array and use implode to store it in a mysql db. I tried array_keys but it doesnt work with multi-dimensional arrays. I dont know if it would be even appropriate for this. So basically I want an array with all the values of "Number" of $Story[1]["Acts"], so it would have to go through:</p> <pre><code>$Story[1]["Act"][0]["Number"] $Story[1]["Act"][1]["Number"] $Story[1]["Act"][2]["Number"] ... </code></pre>
php
[2]