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
4,203,005
4,203,006
Set an event for a div with multiple class
<p>I am trying to set an event on a div whos parent has a class="classA classB"; My css is being applied but i cant figure out how to specify it with jquery. How do i set an event with jquery for this class combination</p> <pre><code>$('[class=classA classB]').live('click', function () { alert('a'); }); </code></pre> <p>html</p> <pre><code>&lt;div class="classA classB"&gt;...moredivs...&lt;/div&gt; </code></pre>
jquery
[5]
5,076,715
5,076,716
ASP.NET: when to start worrying about globalisation, localisation? Before, while or at the end?
<p>I've followed a interesting tutorial on how to use Resource.resxfile files to allow the webside to be viewed by users from different cultures.</p> <p>Now, I'd like to know when to start worrying about globalisation, localisation? Before, while or at the end?</p>
asp.net
[9]
564,502
564,503
i am looking api for record and playback functionalities in java
<p>i am looking for an api which provide record the events and playback whenever i want. the feature available in most of test automation tools, which i gone through.some of them are hp quick test pro and selenium ide both have this record and playback feature.</p> <p>but i am not getting how the code will generate automatically when we click on record button and i am not getting which api they used inorder generate the code automatically in source tab(of selenium ide). </p> <p>please help me out</p>
java
[1]
901,904
901,905
how to restore data from appWidgetProvider when reboot the phone?
<p>i'm making a simple memo widget app. just writing some texts and save it to SharedPreference. everything is okay.. but when my phone is reboot, app widget is turned to be default.</p> <p>I heard i should do something about Boot_Complete.. so I add Boot_Complete Permission and Intent-Filter in Manifest. but i have no idea how i can call the onUpdate when my phone is reboot. my source is this.. please see the onReceive part..</p> <pre><code>@Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); for(int i=0; i&lt;appWidgetIds.length; i++){ int widgetId = appWidgetIds[i]; Intent intent = new Intent(context, MyAppPostItActivity.class); intent.putExtra("widgetId", widgetId); PendingIntent pending = PendingIntent.getActivity(context, widgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT); RemoteViews remote = new RemoteViews(context.getPackageName(), R.layout.widget); remote.setOnClickPendingIntent(R.id.layout, pending); appWidgetManager.updateAppWidget(widgetId, remote); } }//onUpdate @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if(intent.getAction().equals("android.intent.action.BOOT_COMPLETED")){ //I guess I should Call the onUpdate In here!! But I don't know how.. } } </code></pre> <p>after boot_complete, how can i restore my widget's data? I hope any suggestion or clue or samples.. thanks a lot~!</p>
android
[4]
3,986,438
3,986,439
Is there a decent Android equivalent to Michael Hartl's Ruby on Rails Tutorial?
<p>I know about the <a href="http://developer.android.com/training/index.html" rel="nofollow">Android Official documentation</a> and some other resources, but these tend to be kind of boring for me. Is there anything like railstutorial.org for the Android world?</p> <p>Suggestions much appreciated.</p>
android
[4]
19,592
19,593
Instrumentation and publishing application
<p>I'd like to use Instrumentation.ActivityMonitor to know if some activity is created. But the <a href="http://developer.android.com/guide/topics/manifest/manifest-intro.html" rel="nofollow">"The AndroidManifest.xml File"</a> article says I must remove <code>&lt;instrumentation&gt;</code> from AndroidManifest.xml before publishing app. Why should I do it and why I can't use Instrumentation.ActivityMonitor in published app?</p> <p>Thank you!</p>
android
[4]
2,457,981
2,457,982
java regular expression to finda a unique sentence from a paragraph
<p>I have a paragraph such as "All are good but God is great all the time and God is great all the time......".</p> <p>My result should be only one sentence: "God is great all the time". Please help me to get good regular expression </p>
java
[1]
1,908,344
1,908,345
Setting one global instead of in every function?
<p>As it is right now, i have my class system to be embedded in my core class. So i call my classes as such:</p> <pre><code>$cms-&gt;userClass-&gt;function(); </code></pre> <p>But this means that for every function i have in my userClass, i constantly need to add:</p> <pre><code>global $cms; </code></pre> <p>To be able to access the database class as such:</p> <pre><code>$cms-&gt;db-&gt;function(); </code></pre> <p>Is there any way to set a global for the whole class, instead of having to define it at the start of every function?</p>
php
[2]
5,767,817
5,767,818
Javascript calling function expression
<p>It makes sense by calling the function this way:</p> <pre><code>print(square(5)); function square(n){return n*n} </code></pre> <p>But why the following calling doesn't work?</p> <pre><code>print(square(5)); square = function (n) { return n * n; } </code></pre> <p>What's the solution if we insist to use the format of "square = function (n)"?</p>
javascript
[3]
1,717,916
1,717,917
arguments.callee alternative
<p>As <code>arguments.callee</code> is going to be deprecated, what would I use of instead of arguments.callee` in the following expression:</p> <pre><code>var self = this; this.async(function(){ if(test()){ then(); }else{ self.async(arguments.callee); } }); </code></pre>
javascript
[3]
4,559,945
4,559,946
How do I check if two html-strings are equivalent with python?
<p>I need to compare two strings, containing HTML text. The test should return true if the html strings are equivalent, i.e. differ only in whitespace and comments.<br> Is there any module that can be used for this task?</p>
python
[7]
6,012,349
6,012,350
How can I send a keystroke to a hidden window?
<p>I create a hidden window process for CMD.EXE like so:</p> <pre><code> // Create the process start window. var processStartInfo = new ProcessStartInfo("cmd.exe", null); // Set the options. processStartInfo.UseShellExecute = false; processStartInfo.ErrorDialog = false; processStartInfo.CreateNoWindow = true; processStartInfo.WindowStyle = ProcessWindowStyle.Hidden; // Specify redirection. processStartInfo.RedirectStandardError = true; processStartInfo.RedirectStandardInput = true; processStartInfo.RedirectStandardOutput = true; // Create the process. currentProcess = new Process(); </code></pre> <p>I then handle all input/output myself through redirected streams. However, I want 'tab' to show the auto-completion data. I have tried sending '\t' to the input stream - no joy. If the window is made visible I have the window handle in the process structure and can set it to the foreground and use 'SendKeys'. This is not acceptable though, as I need the window to be invisible.</p> <p>So does anyone know how to send a keystroke to a process ID?</p> <p>Thanks in advance!</p>
c#
[0]
157,222
157,223
Is there an easy way to trim the last three characters off a string
<p>I have strings like this:</p> <pre><code>var a = "abcdefg"; var b = "xxxxxxxx"; </code></pre> <p>The strings are always longer than five characters. </p> <p>Now I need to trim off the last 3 characters. Is there some simple way that I can do this with C#?</p>
c#
[0]
3,799,309
3,799,310
How do I use the USPS shipping service on a website?
<p>I want to use the USPS shipping service in a shopping site. </p> <p>What are the fields which are required for USPS shipping service? Does anybody know?</p>
asp.net
[9]
59,983
59,984
Replace \n by \\n
<p>I have a xml string shown below:</p> <pre><code>String xml = @"&lt;axislable='ihgyh\nuijh\nkjjfgj'&gt;"; </code></pre> <p>Now when I try to output the xml it shows <code>&lt;axislable='ihgyh\nuijh\nkjjfgj'&gt;</code></p> <p>But my requirement is to break the line like below</p> <pre><code>&lt;axislable='ihgyh uijh kjjfgj'&gt; </code></pre> <p>I have tried replacing the xml using <code>xml = xml.Replace("\n", "\\n");</code> But it doesnt seems to work.Any ideas how to break the line?</p> <p>Regards, Sharmila</p>
c#
[0]
3,414,004
3,414,005
PHP - How to read post data with no key?
<p>This piece of jQuery code posts to one of our php pages.</p> <pre><code>var json = '{"object1":{"object2":[{"string1":val1,"string2":val2}]}}'; $.post("phppage", json, function(data) { alert(data); }); </code></pre> <p>Inside phppage, I have to do some processing depending on the post data. But I am not able to read the post data. </p> <pre><code>foreach ($_POST as $k =&gt; $v) { echo ' Key= ' . $k . ' Value= ' . $v; } </code></pre>
php
[2]
4,619,403
4,619,404
Making a web request and getting request in JSON format in android
<p>I am trying to accomplish the task of </p> <p>Making a Web request ->getting result in JSON format ->Parsing the result -> and finally display the result in a table....</p> <p>Any help regarding any of the task is welcome....</p>
android
[4]
4,330,492
4,330,493
Reset a timer in android
<p>I have a timer running in my android application. I want that after user interaction the timer should reset itself? is there any function like reset() that resets the timer? What is the procedure to reset the timer?</p>
android
[4]
530,701
530,702
Cannot bring ID back to life using .replaceWith
<p>I'm trying to bring an ID from DOM back with a .replaceWith, even though I had already replaced it previously with a div containing an iframe first.</p> <p>I know some will recommended toggle, or show, hide, but I'd rather not load each div on top of each other due to potential video on top of javascript slider at same time, which can get ugly for mobile browsing.</p> <p>I'm using a click event for 'done' link which takes the user back to the javascript slideshow (slider-wrapper) where they began.</p> <p>Cannot bring #slider-wrapper ID back from the dead after .replaceWith.</p> <p>I've obviously tried:</p> <pre><code> $('a.back').live('click', function(evt) { slider = $('#slider-wrapper') $('div.item-container').replaceWith(slider); evt.preventDefault(); </code></pre> <p>..and many other tricks but it does not want to come back after the first .replaceWith</p> <p>On a side note</p> <p>safari does not 'hear' the second click event for .replaceWIth, firefox does though</p> <p>Any help would be very much appreciated!</p> <pre><code>$(window).load(function () { $('a.link').live('click', function(evt) { item = $('&lt;div class="item-container"&gt;&lt;iframe&gt;&lt;/iframe&gt;&lt;a class="back"&gt;Done&lt;/a&gt;&lt;/div&gt;'); $('#slider-wrapper').replaceWith(item); evt.preventDefault(); }); $('a.back').live('click', function(evt) { $('div.item-container').replaceWith($('#slider-wrapper')); evt.preventDefault(); }); }); </code></pre>
jquery
[5]
541,964
541,965
how to send multiple image to web server
<p>How to send a multiple image in sd card android to web server? Two images or more?</p> <p>This is my code</p> <pre><code>Bitmap bitmapOrg =BitmapFactory.decodeFile("/sdcard/Plant/pupuk/134681282302.jpg"); ByteArrayOutputStream bao = new ByteArrayOutputStream(); bitmapOrg.compress(Bitmap.CompressFormat.JPEG, 90, bao); byte[] ba = bao.toByteArray(); String ba1 = Base64.encodeBytes(ba); ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("image", ba1)); </code></pre> <p>I only found the way to select a single image. I can't send two or more image to web server.</p> <p>Thanks for your attention. sorry for my bad english.</p> <p>cheers</p> <p>Alex</p>
android
[4]
4,953,679
4,953,680
How to access manifest of jar inside ear deployed on weblogic
<p>I have an ear deployed on weblogic console. I need to check contents of manifest file of a jar that is present in the deployed ear.</p> <p>Currently I am using below code to access jar inside ear deployed :</p> <pre><code> Hashtable env = new Hashtable(5); env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); env.put(Context.PROVIDER_URL, url); env.put(Context.SECURITY_PRINCIPAL, user); env.put(Context.SECURITY_CREDENTIALS, password); Context ctx = new InitialContext(env); mBeanHome = (MBeanHome)ctx.lookup(MBeanHome.ADMIN_JNDI_NAME); String type = "EJBComponentRuntime"; Set beans = mBeanHome.getMBeansByType(type); try{ for(Iterator it=beans.iterator();it.hasNext();) { EJBComponentRuntimeMBean rt = (EJBComponentRuntimeMBean)it.next(); if(rt.getParent().getName().equals("xxx.ear")){ System.out.println(rt.getName()); </code></pre> <p>Here rt.getName() will give jar inside "xxx.ear"</p> <p>Now I need to access the manifest file of this jar.</p>
java
[1]
5,864,348
5,864,349
Purpose of if(0){ //code }?
<p>Quick question. I just came across the following in a JS file:</p> <pre><code>if (0) { // code } </code></pre> <p>What's the purpose of this if statement? Which cases would the code execute? It currently doesn't run the code in the if clause.</p>
javascript
[3]
2,934,202
2,934,203
how to take snapshot of mjpeg stream displayed in requestwindowfeature in android
<p>i want to take a snapshot of mjpeg stream that is displayed in a requestwindowfeature in android. can anyone help me how i can do this.</p> <p>i use the following to display the mjpeg stream. (its just a small part) whereas i use mjpegsamplecgi.java , mjpegInputstream.java and MjpegView.java</p> <pre><code> requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); mv = new MjpegView(this); setContentView(mv); mv.setSource(MjpegInputStream.read(URL)); mv.setDisplayMode(MjpegView.SIZE_BEST_FIT); mv.showFps(true); </code></pre>
android
[4]
5,786,326
5,786,327
How to set variable value to jtextfield
<p>I have return a program to generate random numbers in java and want to print those values into a textfield. When I use "textField.setText(variable)", it's not working. Please give me some solution.. thanku..</p>
java
[1]
2,377,632
2,377,633
Weird characters on the output of an ifstream
<pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;fstream&gt; #include &lt;cstring&gt; using namespace std; int main(){ char a; cout &lt;&lt; "give me the filename: "; cin &gt;&gt; filename; ifstream caroll; caroll.open(filename.c_str()); while (a=caroll.get() &amp;&amp; !caroll.eof()){ cout &lt;&lt; a &lt;&lt; " "; } caroll.close(); } </code></pre> <p>I am getting output full of weird chars. They are like little squares filled with 2 0's and 2 1's.</p>
c++
[6]
3,481,834
3,481,835
Alternative to nested `for` loops in Python
<p>I am trying to compare a list of forbidden folders read from a file. But we have to check if the task has the parent ID of the folder and then if that folder matches the forbidden folder. The lists I am looping through can contain many items.</p> <pre><code>for task in tasks: #Check the task is on their timesheet if task["id"] == entry["item_id"]: for folder in folders: #See if the task is inside the folder if task["parent_id"] == folder["id"]: for forbiddenFolder in forbiddenFolders: #If the folder is on the list if forbiddenFolder == folder["name"]: body_of_email +=( "Using a task within a folder that is not permiited " + forbiddenFolder + "\r\n" ) folder["name"] break </code></pre> <p>This code uses three nested <code>for</code> loops, which might be slow. Can I make this more efficient?</p>
python
[7]
1,103,871
1,103,872
Search for classes that use a particular method/constructor in Eclipse
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/11635325/eclipse-find-references-for-method">Eclipse find references for method</a> </p> </blockquote> <p>How to search for the classes (own package+other packages) which use a particular method in Eclipse (java)?</p>
java
[1]
1,848,427
1,848,428
How can I attach an image file in email?
<p>I want to attach an image with email, that image is stored in <code>/data/data/mypacke/file.png</code>. How can I attach that image file programmatically? What would sample code look like?</p>
android
[4]
3,577,919
3,577,920
debug.Keystore format file i try to open it using notepad?
<p>I am developing gps base app. For that i need the md5 so i have tried to open the file debug.keystore using notepad,so file format is change to notepad, now i have got the google-apiKey using key-tool menu (install plug-in keytool ), but problem is that when run my app it give me the following error</p> <p>Error generating final archive: <code>java.io.IOException: Invalid keystore format Unknown Android Packaging Problem</code></p> <p>I am not even sure where to begin to look. I cannot launch the application. Can someone give me an idea on what area I can look into? </p> <p>A I am solve this problem </p> <p>Delete your debug certificate under ~/.android/debug.keystore on Linux and Mac OS X; the directory is something like %USERPROFILE%/.androidon Windows.</p> <p>The Eclipse plug-in should then generate a new certificate when you next try to build a debug package. You may need to clean and then build to generate the certificate. Your debug keystore was created automatically</p>
android
[4]
2,802,464
2,802,465
Only add if it's not present
<p>I only want to add this if it's not already present</p> <pre><code>$('#main_state').append('&lt;label class="check error" generated="true"&gt;This field is required.&lt;/label&gt;'); </code></pre> <p>So I have a loop and I only want to add it the first time...any ideas?</p>
jquery
[5]
5,307,270
5,307,271
Gallery view remove focus - Android
<p>I want to remove focus in gallery for a selected item. I am getting an output like this, Here is an image : <img src="http://i.stack.imgur.com/ibTOh.png" alt="enter image description here"></p> <p>Here first item selected. So it is looking darker than 2nd image. I want to display an image as it is not focused or selected.</p> <p>Please anyone help. I'll really appreciate that.</p> <p>Thanks</p>
android
[4]
2,431,082
2,431,083
android: onUpgrade on sqlite wont work for me
<p>I add new column on my database (i have data on this database)</p> <p>I have this code:</p> <pre><code>@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (newVersion &gt; oldVersion) { db.execSQL("ALTER TABLE MEN ADD COLUMN New_Pulse INTEGER DEFAULT 0"); } } </code></pre> <p>but it wont work, from where I get the oldVersion and the newVersion ?</p> <p>For now I done this:</p> <pre><code>try{ db.execSQL("ALTER TABLE MEN ADD COLUMN New_Pulse INTEGER DEFAULT 0"); } catch (Exception e) { // TODO: handle exception } </code></pre> <p>it work for me - but I know that its Ugly solution</p>
android
[4]
2,504,870
2,504,871
Early Abacus program error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
<p>I am attempting to create a simple abacus for a beginner's programming course, and have come across an error that I simply can not get my head around. I've hunted around Google but so far no success. The program will compile in Textpad absolutely fine, and at first it will run fine, displaying the grid and being able to understand what column the mouse is in. However, left clicking to run the addCounter method results in a "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException" error. It directs me to line 50 of AbacusPanel.java which is: </p> <pre><code>myAbacus.addCounter(thisCol); </code></pre> <p>I cannot for the life of me work out what I am doing wrong here, so any help would be really appreciated. I hope Pastebin links are okay.</p> <p><a href="http://pastebin.com/9Bc9NViP" rel="nofollow">AbacusPanel.java</a></p> <p><a href="http://pastebin.com/ye40aRMD" rel="nofollow">AbacusModel.java</a></p>
java
[1]
4,838,369
4,838,370
creating online game for android
<p>what protocol is used to develop real time update games over the internet, from my research here is what i understood:-</p> <ol> <li>you cant make one device (phone) as server to host room, you need real server not sure why</li> <li>UDP have better performance but the data packet may get lost on the way</li> <li>TCP HTTP is the easiest way(what i am familiar with) my question here should i use REST and call the server each second from the clients(phones) to update game status or is there a way where the server can update the client?</li> </ol>
android
[4]
79,218
79,219
When we click back button from HTC or phone , it doesn't go to login screen
<p>My App screen is goes like (First installation Time Only) License screen 1 -> (First installation Time Only)Database Setup screen 2- > Splash Screen 3--> Login Screen 4--> Synchronisation screen ---> Main Screen 5.</p> <p>When I click back button from phone, I doesn't go to previous screen.</p> <p>In other words, I have altogether 25 screen there.screen 1 to screen 5 basic setting screen.Screen 5 is main screen. I am now in Main screen , I clicked back button from phone key ,I won't go to login screen 4 or splash screen 3 or 2 or 1...</p> <p>but if i am in the screen 10 pressed back key,that time it can go upto screen 5 . cant go first screen 4 or screen 3 or 2 or 1.....</p> <p>(Main Screen I am using Tab using ActivityGroup. There i used <code>FLAG_ACTIVITY_CLEAR_TOP</code> .)</p> <p>Please help me ...</p> <p>Thanks in advance....</p>
android
[4]
2,277,111
2,277,112
Sd card not coming in Android 2.2
<p>I am facing a strange problem. when i am creating an emulator targeting Android 1.5 then emulator SD card is coming but when i am creating an emulator targeting Android 2.2 then emulator SD card is not coming. I an unable to solve this problem.. i think for this reason when i am opening emulator camera it is force closing automatically.. can any body help? </p>
android
[4]
1,513,736
1,513,737
adding string at the end of the file python
<p>Clarification: So if my file has 10 lines: THe first line is a heading, so I want to append some text at the end of first line</p> <p>THen I have a list which contains 9 elements..</p> <p>I want to read that list and append the end of each line with corresponding element..</p> <p>So basically list[0] to second line, list[1] to third line and so on..</p> <hr> <p>I have a file which is delimted by comma. something like this:</p> <pre><code>A,B,C 0.123,222,942 ...... </code></pre> <p>Now I want to do something like this:</p> <pre><code>A,B,C,D #append "D" just once 0.123,222,942,99293 ............ </code></pre> <p>This "D" is actually saved in a list so yeah I have this "D" How do I do this? I mean I know the naive way. like go thru each line and do something like</p> <pre><code>string += str(list[i]) </code></pre> <p>Basically how do i append something at the end of the file in pythonic way :)</p>
python
[7]
4,713,694
4,713,695
List is a raw type. References to generic type List<E> should be parameterized
<p>bellow is my syntax </p> <pre><code>List synchronizedpubliesdList = Collections.synchronizedList(publiesdList); </code></pre> <p>I am facing syntax error as "List is a raw type. References to generic type <code>List&lt;E&gt;</code> should be parameterized". Please suggest the solution.</p>
java
[1]
4,412,107
4,412,108
Mocking an Excel workbook
<p>I have some unit tests that require reading an excel file which is painfully slow, so I was wondering if I could mock an excel workbook object using Moq. Has anybody got any experience with this? If so how would I go about this?</p>
c#
[0]
5,685,130
5,685,131
php. write to file
<p>I am learning php. I want to write string to file, but nothing happens. How can I debug it? I have experience with python. there I could use terminal to try small code snippets, but I don't know how check code in php. </p> <pre><code>$myFile = "testFile.txt"; $fh = fopen($myFile, 'w'); $stringData = "Bobby Bopper\n"; $myvar = fwrite($fh, $stringData); $stringData = "Tracy Tanner\n"; fwrite($fh, $stringData); fclose($fh); </code></pre>
php
[2]
2,462,837
2,462,838
Javascript for loop function array
<p>I'm bit of a javascript newbie - I'm trying to make a function that when I click a button it will call out a single object out of my array, in order. </p>
javascript
[3]
4,208,159
4,208,160
what am I doing wrong with java.util.Scanner?
<p>This is my Java 1.5 code (complete example):</p> <pre><code>import org.junit.Test; import static org.junit.Assert.*; import java.util.Scanner; import java.util.regex.Pattern; public class StrangeTest { @Test public void testRegExp() { Pattern re = Pattern.compile("(;|:)[^:;]*"); Scanner scanner = new Scanner(":alpha"); scanner.useDelimiter(""); assertEquals(":alpha", scanner.next(re)); // failure } } </code></pre> <p>What is wrong here?</p>
java
[1]
818,705
818,706
'Access is denied' Javascript error
<p>i am opening a file in IE6.0 from a directory using JavaScript. but iam getting 'Access is denied' error in javascript.My code in javascript</p> <pre><code>function poponload() { testwindow = window.open("C:\Searchtool\asd1.wrl", "mywindow", "location=1,status=1,scrollbars=1,width=300,height=300"); testwindow.moveTo(0,0); } </code></pre> <p>if i use the same function from plain html page it is opening the page. But if i try to do the samething from ASP.NET2008(.ASPX page), i am getting 'access is denied' error. can anybody tell the reason why it is giving error? and Solution?</p> <p>Thanks</p>
javascript
[3]
2,606,076
2,606,077
unable to build C++ project in Eclipse helios
<p>I can't build a C++ project in eclipse helios. It's showing an error (Cannot run program "make": Launching failed)</p> <p>I saw a suggestion that stated add PATH to (Preferences -> C/C++ -> Build -> Environment). But the variable name is PATH, what do I give in the value?</p> <p>Please help</p>
c++
[6]
882,417
882,418
Java strange features of the String class
<p>In Java, the word "String" is not a keyword. That is, we can write:</p> <pre><code>String String = ""; </code></pre> <p>without the compiling error.</p> <p>Also, java.lang.String class can not be used as a second parameter of the "instanceof" operator.</p> <p>Why? What's so special about the String class for the Java compiler and why it isn`t a keyword?</p>
java
[1]
1,272,065
1,272,066
Append barcode images to docx file using pybarcode ImageWriter and docx module
<p>How can i reduce the image size which is generated by pybarcode ImageWriter, and also how can append multiple images to docx file with proper alignment?</p> <p>I read about <strong>dpi</strong> option for ImageWriter but not getting how to use it.</p> <pre><code>import barcode from barcode.writer import ImageWriter from docx import * if __name__ == '__main__': # Default set of relationshipships - these are the minimum components of a document ean = barcode.get_barcode('ean', '123456789102', writer=ImageWriter()) ean.default_writer_options['module_height'] = 3.0 ean.default_writer_options['module_width'] = 0.1 filename = ean.save('bar_image') relationships = relationshiplist() # Make a new document tree - this is the main part of a Word document document = newdocument() # This xpath location is where most interesting content lives docbody = document.xpath('/w:document/w:body', namespaces=nsprefixes)[0] # Add an image relationships,picpara = picture(relationships, filename,'This is a test description') docbody.append(picpara) # Create our properties, contenttypes, and other support files coreprops = coreproperties(title='Python docx demo',subject='A practical example of making docx from Python',creator='Mike MacCana',keywords=['python','Office Open XML','Word']) appprops = appproperties() contenttypes = contenttypes() websettings = websettings() wordrelationships = wordrelationships(relationships) # Save our document savedocx(document,coreprops,appprops,contenttypes,websettings,wordrelationships,'sample_barcode.docx') </code></pre>
python
[7]
5,992,078
5,992,079
Is there any way to get the datetime of when a contact was created?
<p>Is there any way to get the datetime of when a contact was created? </p> <p>I mean using ContactsContract... or if not, any other way?</p>
android
[4]
3,744,000
3,744,001
c# HttpWebRequest IOException
<p>I am using the following function to navigate to URL addresses in my c# winform code. </p> <p>I think, the code is fine but when it tries to make connection to the URL address, it fails and throws a <em>IOException Error</em>:</p> <p>My Question is: </p> <p><strong>How can I add a check in the code to make sure that connection to URL is successfully made and if it is not, than it will re-try until it makes a successful connection?</strong></p> <pre><code>public String WebRequestNavigate(string url) { StringBuilder sb = new StringBuilder(); byte[] buf = new byte[8192]; if (url != "") { HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(url); myReq.KeepAlive = false; try { HttpWebResponse resp = (HttpWebResponse)myReq.GetResponse(); Stream stream = resp.GetResponseStream(); String test = ""; int count = 0; do { **count = stream.Read(buf, 0, buf.Length);** if (count != 0) { test = Encoding.UTF8.GetString(buf, 0, count); sb.Append(test); } } while (count &gt; 0); stream.Close(); } catch (WebException ex) { } } return sb.ToString(); } </code></pre> <p>Thanks friends for all of your answers. They are all correct. However, I finally found my error and corrected it. </p> <p>The problem is I was trying to catch WebException , however, the error I was getting IOException. </p> <p>I changed WebException as IOException and corrected my code as following:</p> <pre><code>catch (IOException ex) { System.Threading.Thread.Sleep(500); myReq = (HttpWebRequest)WebRequest.Create(url); myReq.KeepAlive = false; } </code></pre> <p>I used your suggestion for Thread.Sleep in order to make my code wait before attempting a new URL connection. This solved my problem %100.</p> <p>Sorry for taking your time but you helped me in a great way and provided insight. Thanks!</p>
c#
[0]
1,875,243
1,875,244
Scrolling Header in Jquery
<p>I am trying implement an scrolling header. I have a background image and when I load the page the image doesnt actually scroll its static...can someone help me please?</p> <p>The code also has a gallery where the photos appear and dissapear...but the header doesnt scroll (maybe the .css is conflicting or the jqueries are)..where am i going wrong??</p> <p>I cant seem to post my code here but its on <a href="http://forums.asp.net/p/1644211/4261584.aspx#4261584" rel="nofollow">http://forums.asp.net/p/1644211/4261584.aspx#4261584</a></p> <p>any ideas please? </p>
jquery
[5]
2,055,508
2,055,509
Python: Dividing a string into substrings
<p>I have a bunch of mathematical expressions stored as strings. Here's a short one:</p> <pre><code>stringy = "((2+2)-(3+5)-6)" </code></pre> <p>I want to break this string up into a list that contains ONLY the information in each "sub-parenthetical phrase" (I'm sure there's a better way to phrase that.) So my yield would be:</p> <pre><code>['2+2','3+5'] </code></pre> <p>I have a couple of ideas about how to do this, but I keep running into a "okay, now what" issue.</p> <p>For example:</p> <pre><code>for x in stringy: substring = stringy[stringy.find('('+1 : stringy.find(')')+1] stringlist.append(substring) </code></pre> <p>Works just peachy to return 2+2, but that's about as far as it goes, and I am completely blanking on how to move through the remainder...</p>
python
[7]
5,812,047
5,812,048
culture of datatable
<p>I import data to datatable from scv (OleDb), and I must have specific culture for my datatable</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Globalization; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); ci.NumberFormat.CurrencyDecimalDigits = 1; var dataTable = new DataTable(); dataTable.Locale = ci; Console.WriteLine(ci.NumberFormat.CurrencyDecimalDigits.ToString()); Console.WriteLine(dataTable.Locale.NumberFormat.CurrencyDecimalDigits.ToString()); Console.ReadKey(); } } </code></pre> <p>}</p> <p>return me 1 2, but not 1 1 HELP</p>
c#
[0]
2,174,678
2,174,679
need to create a C# Regex similar to this perl expression
<p>I was wondering if it is possible to build equivalent C# regular expression for finding this pattern in a filename. For example, this is the expr in perl <code>/^filer_(\d{10}).txt(.gz)?$/i</code> Could we find or extract the <code>\d{10}</code> part so I can use it in processing?</p>
c#
[0]
3,680,697
3,680,698
Javascript - return keyword in Form vs Function
<p>How does a return work in a Form vs a function?</p> <p>I know you can <code>return false</code> in a function and it will stop the flow of the program, great if you want to cancel a postback. Why would I have a return in a Form as well?</p> <p>Author snippet from beginning javascript book by Christian Heilmann:</p> <pre><code>&lt;form action="whatever" method="post" onsubmit="return checkSearch();"&gt; function checkSearch() { alert ('foo'); return false; } </code></pre>
javascript
[3]
2,904,384
2,904,385
OCUnit Test Case for abstract class
<pre><code>- (id)someMethod { [self doesNotRecognizeSelector:_cmd]; return nil; } </code></pre> <p>Has for my Information if i call this method which throws and exception</p> <p>for </p> <pre><code>-(void)testSomeMethod{ @try{ Class *testClass = [[Class alloc]init]; STAssertThrowsSpecific([test someMethod], NSExcerption, @"Throws an Exception"); } @catch{ }} </code></pre> <p>Please let me know did i written test case perfectly ?</p> <p>@all Thanks in advance </p>
iphone
[8]
4,431,061
4,431,062
What is "Virtual()" function in PHP?
<p>Can anyone explain me what is use of "Virtual()" function of PHP? I am not able to get its meaning.</p> <p><strong>Resource:</strong> <a href="http://php.net/manual/en/function.virtual.php" rel="nofollow">http://php.net/manual/en/function.virtual.php</a></p>
php
[2]
2,986,942
2,986,943
What is initWithCoder?
<p>Please explain to me what is initWithCoder?</p> <p>Thanks.</p>
iphone
[8]
4,884,016
4,884,017
Sliding in android
<p>If you have installed most of mediaplayers like files managers like ES File Explores, users that touches the screen and move to left or right, the pages moves to left or right. That is exactly like build in android music player for 2.3, when user next music. How can I implement this?</p>
android
[4]
40,814
40,815
Read from Process only works when the process has exited
<p>I created a sub Process and I'm trying to read it output and print it. The process is a very simple python program that prints "Tick" every second and after some time exits.</p> <p>The java code is:</p> <pre><code>[..] try { ProcessBuilder pb = new ProcessBuilder(command); pb.redirectErrorStream(true); Process p = pb.start(); InputStreamReader in = new InputStreamReader(p.getInputStream()); BufferedReader br = new BufferedReader(in); String line; while ((line = br.readLine()) != null) { System.out.println(line); System.out.flush(); } } catch (Exception ex) { System.out.println(ex.getMessage()); System.exit(1); } [..] </code></pre> <p>I only see the output on the console once the python program has exited. How can I read and print at the same time? Thanks</p>
java
[1]
5,487,765
5,487,766
How to Programmatically Build a TemplateColumn
<p>How does one go about programatically building a TemplateColumn object and adding it to a DataGrid. I know how to add it, but not how to build the contents of the TemplateColumn. There are no useful looking methods on the ITemplate the column class exposes.</p>
asp.net
[9]
221,808
221,809
Android TileMode X OR Y only?
<p>In my Activity's layout a have a background, which should be repeated by Y. There is no problem with repeating the background, when it is repeated on X and Y (just add <code>android:tileMode="repeat"</code>). Also, there is no problem with doing this above Android API 15:</p> <p><code>RelativeLayout layout = (RelativeLayout) findViewById(R.id.container_layout);</code></p> <p><code>BitmapDrawable bg = (BitmapDrawable)getResources().getDrawable(R.drawable.my_repeating_bg);</code> <code>bg.setTileModeX(TileMode.REPEAT);</code> <code>layout.setBackground(bg);</code> But the method <code>setBackground(&lt;BitmapDrawable&gt;)</code> is not available on Android API &lt; 16. What should I do when I want to repeat my background only by X or by Y in Android 2.3? Thanks. P.S. The background's width and height are both <code>MATCH_PARENT</code>.</p>
android
[4]
2,053,205
2,053,206
How to compute the zoom level against returned markers?
<p>I'd like to know if there is already a way to know from a given set of markers, the zoom I should apply to the map or do I have to do it my self? (this depends on the resolution so i expected to find it in MapView because it knows its boundaries...)</p> <p>Regards, Zied Hamdi</p>
android
[4]
5,162,543
5,162,544
creating a profile photo using file upload
<p>I just created a profile page were users can enter their name, current location, age, etc. I want users' profile info to be created together with their profile photo on the top left hand corner. I've created a database for the profile but I will need help on how to upload a profile pic using either file upload or any other method.</p>
asp.net
[9]
4,183,237
4,183,238
how to get desired datetime format
<p>i want to generate current date and time in a format like this <strong>Mon, 10/08/12 12:29:39</strong> . But when i used a code shown below</p> <pre><code>DateTime date = DateTime.Now; </code></pre> <p>i am getting like <strong>10/8/2012 12:29:39 PM</strong> , but i actually want a format like <strong>Mon, 10/08/12 12:29:39</strong> , what change in this code i can use to get the desired output. I did this code also ,but didnt success</p> <pre><code>string format = "MMM ddd d HH:mm yyyy"; // Use this format Console.WriteLine(time.ToString(format)); </code></pre>
c#
[0]
4,620,578
4,620,579
Casting/dereferencing member variable pointer from void*, is this safe?
<p>I had a problem while hacking a bigger project so I made a simpel test case. If I'm not omitting something, my test code works fine, but maybe it works accidentally so I wanted to show it to you and ask if there are any pitfalls in this approach.</p> <p>I have an OutObj which has a member variable (pointer) InObj. InObj has a member function. I send the address of this member variable object (InObj) to a callback function as void*. The type of this object never changes so inside the callback I recast to its original type and call the aFunc member function in it. In this exampel it works as expected, but in the project I'm working on it doesn't. So I might be omitting something or maybe there is a pitfall here and this works accidentally. Any comments? Thanks a lot in advance.</p> <p>(The problem I have in my original code is that InObj.data is garbage).</p> <pre><code>#include &lt;stdio.h&gt; class InObj { public: int data; InObj(int argData); void aFunc() { printf("Inside aFunc! data is: %d\n", data); }; }; InObj::InObj(int argData) { data = argData; } class OutObj { public: InObj* objPtr; OutObj(int data); ~OutObj(); }; OutObj::OutObj(int data) { objPtr = new InObj(data); } OutObj::~OutObj() { delete objPtr; } void callback(void* context) { ((InObj*)context)-&gt;aFunc(); } int main () { OutObj a(42); callback((void*)a.objPtr); } </code></pre>
c++
[6]
1,478,214
1,478,215
remove class in jquery not functioning
<p>My Code..</p> <pre> if($("#edButtonHTML").is(".active")) { $("#edButtonHTML").removeClass("active"); $("#edButtonPreview").addClass("active"); } </pre> <p>I need to remove active class from element #edButtonHTML and add to #edButtonPreview Unfortunately not functionating...Help me</p>
jquery
[5]
3,437,097
3,437,098
assigning value to a textfeild in Android application?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4590957/how-to-set-text-in-an-edittext">How To Set Text In An EditText</a> </p> </blockquote> <p>how can we assign value to a textfeild in android application?</p>
android
[4]
3,124,217
3,124,218
Slice notation in python - need clarification on a code snippet
<p>I'm new to python, and while reading about slice notation, I came across the following code snippet. I was able to understand and use it in very simple examples, but I wasn't able to grasp its usage in the following example. Any explanation will really help!</p> <pre><code>&gt;&gt;&gt; a = [1,2] &gt;&gt;&gt; a[1:1] = [3,4,5] &gt;&gt;&gt; print a [1, 3, 4, 5, 2] &gt;&gt;&gt; a = [1,2] &gt;&gt;&gt; a[0:1] = [3,4,5] &gt;&gt;&gt; print a [3, 4, 5, 2] </code></pre>
python
[7]
1,147,786
1,147,787
Mod in Java produces negative numbers
<p>It seems like when I calculate <code>int i = -1 % 2</code> I get -1 in Java. In Python I get 1. What do I have to do to get the same behavior in Java?</p>
java
[1]
5,945,938
5,945,939
Need to hide text in UITextField while editing and should display another text
<p>New to iOS development. Need help regarding <code>UITextField</code> delegate methods. my problem is I have <code>UITextField</code> </p> <p>if i enter some "XYZ" text in textfield it should display some other text like which i want while i'm editing only it should done.</p> <pre><code>- (void)textFieldDidBeginEditing:(UITextField *)textField { [self.requestTextFiled setReturnKeyType:UIReturnKeyDone]; [NSTimer scheduledTimerWithTimeInterval:.1 target:nil selector:@selector(checkingTheQuestion) userInfo:nil repeats:YES]; } -(void)checkingTheQuestion { } </code></pre> <p>I tried if by call checkingTheQuestion but I'm not able to do. Please Help me.</p> <p>Thanks in advance. </p>
iphone
[8]
1,443,968
1,443,969
undefined reference to scan in c++?
<p>Here is my code...I have two dimensional matrices A,B. I want to develop the product of the A and B.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main(int argc, char *argv[]) { int scan(); int multiply(); int print(); int metxa[3][4],metxb[4][3],resut[3][3]; int main(); { scan(); multiply(); print(); return 0; } int scan(); { int i; for(i=0;i&lt;3;i++) { scanf("%d %d %d %d",&amp;metxa[i][0],&amp;metxa[i][1],&amp;metxa[i][2],&amp;metxa[i][3]); } for(i=0;i&lt;4;i++) { scanf("%d %d %d",&amp;metxb[i][0],&amp;metxb[i][1],&amp;metxb[i][2]); } } int multiply(); { int i,j; for(i=0;i&lt;3;i++) { for(j=0;j&lt;3;j++) { resut[i][j]=metxa[i][0]*metxb[0][j]+metxa[i][1]*metxb[1][j]+metxa[i][2]*metxb[2][j]+metxa[i][3]*metxb[3][j]; } } } int print(); { int i,j; for(i=0;i&lt;3;i++) { for(j=0;j&lt;3;j++) { printf("%d\t",resut[i][j]); } printf("\n"); } } system("PAUSE"); return 0; } </code></pre> <p>but I got linker error-undefined reference to scan and multiply methods... why should I get this error? </p>
c++
[6]
4,451,407
4,451,408
drawText Canvas method not working
<p>I am very new to Java and android. my 1st app using canvas and paint. for some reason I get a force close whenever I try using the drawText method.. Please help. I am basically trying to display text in a specific x,y coordinate. which will need updates throughout game play, my code:</p> <pre><code>public class MyGame extends Main { TextView timeDisplay; public String clock; int x_pos = 10; int y_pos = 100; int radius = 20; float x = 10; float y = 20; android.graphics.Paint p; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); super.onCreate(savedInstanceState); setContentView(R.layout.main); // setup Drawing view Bitmap b = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); c.drawText("test", 30, 0,x,y, p); &lt;-- if I comment this out, no force close... </code></pre> <p>Your help is appreciated.</p>
android
[4]
3,716,281
3,716,282
When two buttons are pressed at same time
<p>I have a little problem. I have a form, which is my login form. Then I also have another form, which is my add user form. When I click on the login button for the login form, it needs to check if the shift and control keys are both held down on the same time. Ff both of them are not pressed, then the add user form should not open. but if they are both pressed down and the login button is clicked, it should show the form.</p> <p>What I have:</p> <pre><code>if (Control.ModifierKeys == (Keys.Control &amp; Keys.Shift)) { //Show the form } </code></pre> <p>But this is not working.</p> <p>When I have:</p> <pre><code>if (Control.ModifierKeys == Keys.Shift) { //Show the form } </code></pre> <p>Then it works.</p> <p>How can I achieve this with both buttons pressed down, control and shift?</p>
c#
[0]
933,224
933,225
using splice(0) to duplicate arrays
<p>I have two arrays: ArrayA and ArrayB. I need to copy ArrayA into ArrayB (as opposed to create a reference) and I've been using <code>.splice(0)</code> but I noticed that it seems to removes the elements from the initial array.</p> <p>In the console, when I run this code:</p> <pre><code>var ArrayA = []; var ArrayB = []; ArrayA.push(1); ArrayA.push(2); ArrayB = ArrayA.splice(0); alert(ArrayA.length); </code></pre> <p><strong>the alert shows 0</strong>. What am I doing wrong with <code>.splice(0)</code>??</p> <p>Thanks for your insight.</p>
javascript
[3]
4,952,707
4,952,708
Using javascript to create a value in url and submit that value via form?
<p>I have a site that request that they could send out different urls to clients to track what links are being used. I told them to use google analytics but they are requesting to stay away from it.</p> <p>What they are asking is they want to send a url to there customers such as, <a href="http://www.yoursite.com/?link=Nameoflink" rel="nofollow">http://www.yoursite.com/?link=Nameoflink</a></p> <p>They want to get that cookie and set it. Then when the contact form is used they want to be able to submit that link name with the form submission to show what links are being used to go directly to there site.</p> <p>I was told this is possible but i have no knowledge of that custom of javascript or cookie expertise... =/</p>
javascript
[3]
2,139,565
2,139,566
Where should I locate my baseActivity class?
<p>Say i have com.mydomain.myappname. Is it a good idea to put my baseActivity class (from which all my other activity classes inherit) into com.mydomain? Or is that asking for trouble? I'm worried my other apps could then conflict if installed on the same phone.</p> <p>Also, if not in com.mydomain, where should I place them?</p>
android
[4]
5,390,554
5,390,555
Insert a whole div (which is in another div) before the div comes after
<p>I have this:</p> <pre><code>&lt;div&gt; &lt;div class="navigation&gt; &lt;ul&gt; ... &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="main"&gt; &lt;/div&gt; </code></pre> <p>I want to take .navigation div out of the div it is in, and place it on its own before .main div so I can get this:</p> <pre><code>&lt;div class="navigation&gt; &lt;ul&gt; ... &lt;/ul&gt; &lt;/div&gt; &lt;div class="main"&gt; &lt;/div&gt; </code></pre> <p>Help?</p>
jquery
[5]
5,013,951
5,013,952
How to call a function with a variable number of parameters which correspond to an array values?
<p>OK, I know it sounds weird but I need to make a function that will receive two parameters the first one is a string and the second an array (containing strings).</p> <p>This function will then call <a href="http://ca2.php.net/manual/en/function.sprintf.php" rel="nofollow">sprintf</a>. My first parameter will be <code>$format</code> and my array will correspond to the various <code>$args</code>.</p> <p>How can I achieve this (if possible)?</p> <p>Thanks!</p>
php
[2]
3,733,580
3,733,581
Voice to text conversion : Help on opening a file through converted text and minimizing and maximizing an application
<p>The project is in c#</p> <p>Process.Start(@"D:\Documents and Settings\All Users\Desktop\"+textBox1.Text+".exe"); It displays "cannot find the path specified.</p> <p>Actually i am working on a project that converts voice to text and executes the applications through the converted text..</p> <p>I am not able to find any way of maximizing and minimizing the application and opening it </p> <p>Can you please suggest me some other way to open the file or correct me if i am terribly wrong here.. It will be really helpful for me to complete my project in C# i am a final year student Thanx in advance :)</p>
c#
[0]
2,986,167
2,986,168
Common app.config between applications
<p>I have a need for a common config file shared by three applications</p> <p>I solved it by adding in a file in appSettings </p> <pre><code>&lt;appSettings file="ait.config"&gt; &lt;!--&lt;add key="Culture" value="zh-CN" /&gt;--&gt; &lt;add key="Culture" value=""/&gt; &lt;add key="ClientSettingsProvider.ServiceUri" value=""/&gt; &lt;/appSettings&gt; </code></pre> <p>In the ait.config i store some common values like</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;appSettings&gt; &lt;add key="Username" value="Klabberius" /&gt; &lt;/appSettings&gt; </code></pre> <p>If i try to read it like</p> <pre><code> string stvalue = ConfigurationManager.AppSettings["Username"]; </code></pre> <p>It works fine , but if i try to write a value like</p> <pre><code>System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings["Username"].Value = userName; config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); </code></pre> <p>Instead of writing to the common file ait.config it add the key username to the standard app.config in each seperate application, anyone knows how to solve this.</p>
c#
[0]
399,301
399,302
PHP - Calling pcntl_fork from web app (not cli) - Why not?
<p>I am familiar with the various methods available within php for spawning new processes, forking, etc... Everything I have read urges against using pcntl_fork from within a web-accessible app. Can anyone tell me why this is not recommended?</p> <p>At a fundamental level, I can see how if you are not careful, things could quickly get out of hand. But what if you are careful? In my case, I would like to pcntl_fork my parent script into a new child, run a short series of specific functions, and then close the child. Seems pretty straightforward, right? Would it still be dangerous for me to try this?</p> <p>On a related note, can anyone talk about the overhead involved in doing this a different way... Calling proc_open() to launch an entirely new PHP process? Will I lose any possible speed increase by having to launch the new process?</p> <p>Background: Consider a site with roughly 2,000 concurrent users running fastcgi.</p>
php
[2]
505,084
505,085
Rotating image in Imageview overlaps corners
<p>I am using following code </p> <pre><code>&lt;rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:repeatCount="infinite" android:duration="36000" /&gt; </code></pre> <p>and </p> <pre><code>Animation rotate = AnimationUtils.loadAnimation(this, R.anim.rotate); findViewById(R.id.yourImageId).startAnimation(rotate); rotate.reset(); rotate.start(); </code></pre> <p>The intention was to rotate the image inside the Imageview.</p> <p>Because this image view has a background colour, this appears to rotate the whole ImageView control and it starts to overlap the text view placed next to it, for example after 45 degree rotation one corner would be overlapping the view placed to left of it </p> <p>I want to show that the container is not spinning, rather just the image.</p> <p>I can not remove the background, this will disturb the UI feel in my particular case.</p> <p>Is it a good idea to place this into a Layout and remove background from this imageview and spin ? or is there a smarter way to it.</p>
android
[4]
2,762,251
2,762,252
jQuery insert a class on a node during a find().each() recurse?
<p>In the jQuery below, the highlight span is being inserted into the existing span, creating a nested span element. is it possible to amend the script so that it just adds a highlight class to the existing span, rather than creating a new span? (<a href="http://stackoverflow.com/questions/5779691/jquery-dom-parser">props and thanks to justkt</a> for the example)</p> <pre><code>var content = jQuery('#content').html(); // append to a div to make sure there's a top-level tag. var html = jQuery("&lt;div&gt;&lt;/div&gt;").append(content).html(); // keywordList is a selector for a div containing spans of items representing the contents jQuery(".my_related_kw").find("span").filter(function() { return html.indexOf(jQuery(this).html()) != -1; }).each(function() { jQuery(this).html("&lt;span class='highlight'&gt;" + jQuery(this).html() + "&lt;/span&gt;"); }); </code></pre>
jquery
[5]
3,692,638
3,692,639
Javascript Scope Problem
<p>Sorry for asking, but how do I access <em>myFunction()</em> from <em>someFunction</em>()?</p> <pre><code>&lt;script&gt; $(document).ready(function() { // Get messages var myFunction = function() { // doSth. } // Make the initial call on page load. myFunction(); ); function someFunction() { // Call the function a second time myFunction(); // Call fails! } &lt;/script&gt; </code></pre>
javascript
[3]
5,054,857
5,054,858
Javascript Function Stopping code from executing
<p>I have this function in my javascript which is stopping my code from being executed and returning data, If I remove it from my file the code works perfectly, can anybody see whats wrong?</p> <pre><code>var TimeToRenderHours = EstimatedCoreHours/(245.76); if (TimeToRenderHours &lt;= 1) { alert('less than 1 working'); } else { alert(TimeToRenderHours); } </code></pre> <p>Sorry, I would have posted the page but its huge and very messy, Estimated Core Hours comes from</p> <pre><code> var EstimatedCoreHours = GetNumeric(NoOfFrames) * GetNumeric(RenderingHours) * GetNumeric(CoresInTest); </code></pre> <p>the 3 variables which are multiplied are called from input files, eg</p> <pre><code>var NoOfFrames = document.getElementById ("NoOfFrames").value; </code></pre>
javascript
[3]
4,963,864
4,963,865
How to select value of input onClick?
<p>I have a <code>&lt;input type="text"&gt;</code> and if user clicks inside it I want to make the content (value) of that box selected. How would I do that?</p>
javascript
[3]
5,751,945
5,751,946
How can run a script tag in html page which is already generated by an external javascript file
<p>extenal javascript file: var someVariable="document.write('JavaScript text');";</p> <p>and output should be: JavaScript text</p>
javascript
[3]
943,720
943,721
Library to aid with creating sites that users register for
<p>I am trying to create a website that users have to register for, and this gives them access to all the site features. Potentially, maybe i want users to pay a yearly subscription fee.</p> <p>Is there a library to handle this for me? This should include, keeping track of user cookie and logged in status, keeping track of expiry date, verifying email addresses, banned users... etc. I mainly use PHP and MySQL but am open to using something else if there is this really good library out there.</p> <p>Thanks.</p>
php
[2]
2,027,342
2,027,343
how to set tab order in jquery
<p>I'm using Telerik controls, specifically the numerical textbox where you can set a up-down arrow to increment/decrement values in a textbox. I am required to set the tab order to move to the next field but since there's a button on the up-down arrow, the browser will go through those buttons first then move to the next textbox field.</p> <p>How do you set the jquery to detect the next visible textbox/dropdown/etc input field and move to that on pressing the tab button instead of running through the buttons near it?</p>
jquery
[5]
4,406,548
4,406,549
passing $_POST variable from one page to other
<p>Suppose I have three PHP files: <code>1.php</code>, <code>2.php</code>, <code>3.php</code></p> <p><code>1.php</code> sends data with POST method to <code>2.php</code>. Now I want <code>2.php</code> to send the same data to <code>3.php</code> with POST method. I want to link from <code>2.php</code> to <code>3.php</code> with a single button.</p> <p>How can I do that?</p>
php
[2]
276,051
276,052
Conditional Java Package Distributions
<p>I know there isn't such a thing as conditional compilation as in C/C++ but I wonder if it is possible to produce a java program conditionally based on requirements. For example, there could be a public version which contains some features and private version which contains more features.</p> <p>Am I right to believe that the only way to achieve this is with the help of something like plugins, i.e. the different features are found dynamically if they are present in the classpath?</p>
java
[1]
1,503,939
1,503,940
jQuery how to create tooltip when option hover?
<p>How do I create a tooltip similar to this: <a href="http://jsfiddle.net/CJbeF/22/" rel="nofollow">http://jsfiddle.net/CJbeF/22/</a></p> <p>When having a select option instead.</p> <p>HTML:</p> <pre><code>&lt;select name="trappe[fields][]"&gt; &lt;option value="exhb_1"&gt;Option 1&lt;/option&gt; &lt;option value="exhb_2"&gt;Option 2&lt;/option&gt; &lt;option value="exhb_3"&gt;Option 3&lt;/option&gt; &lt;/select&gt; </code></pre>
jquery
[5]
2,379,998
2,379,999
conditions tree and backtrace
<p>I have some graphs and I generates code from them. One condition from one node. For example generated code can look like this one:</p> <pre><code>def function(): steps = [] if True: steps.append(1) if True: steps.append(2) if False: steps.append(3) return 'a', steps if False: steps.append(4) return 'b', steps if True: steps.append(5) if True: steps.append(6) if False: steps.append(7) return 'a', steps if True: steps.append(8) return 'b', steps </code></pre> <p>I replaced real conditions with <code>True</code>/<code>False</code> to make example cleaner.</p> <p>This function return tuple <code>('b', [1, 2, 5, 6, 8])</code>, so some value and steps which was taken. I want modify this code to remove steps which was not successful. So after modification function should return <code>('b', [1, 5, 8])</code>. </p> <p>My question is, what is the best way to do this?</p>
python
[7]
2,130,560
2,130,561
Get values from textfile with C#
<p>I've got a textfile which contains the following data:</p> <pre><code>name = Very well sir age = 23 profile = none birthday= germany manufacturer = Me </code></pre> <p>And I want to get the profile, birthday and manufacturer value but can't seem to get it right. I succeded including the file into my program but there it stops. I just can't figure out how I will clean the textfile up.</p> <p>Here's my current code: <a href="http://sv.paidpaste.com/HrQXbg" rel="nofollow">http://sv.paidpaste.com/HrQXbg</a></p>
c#
[0]
4,029,523
4,029,524
run python source code line by line
<p>Given a Python source code, is it possible to run the code line by line, as if you were debugging? </p> <p>And when it comes to a function call, I would like to 'step into' the function also.</p> <p>Thanks</p>
python
[7]
3,278,558
3,278,559
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]
5,795,388
5,795,389
Creating Android Contacts Application
<p>I need to create a contacts application that mimics the native android contacts application. The applications needs to be ported on all the android devices and should support the fields that a native application contains.</p> <p>I need to know what all fields does the Content provider supports and how does it deal with the devices in which the stock contacts application is modified (e.g HTC Hero )</p>
android
[4]
5,567,688
5,567,689
Convert string to array in Java?
<p>I have a string which has the values like this (format is the same):</p> <pre><code>name:xxx occupation:yyy phone:zzz </code></pre> <p>I want to convert this into an array and get the occupation value using indexes.</p> <p>Any suggestions?</p>
java
[1]
3,170,550
3,170,551
how to resolve radio button problem when we changing the orientation?
<p>hi all how to implement code for Radio button when i take the radio group i take only two radio buttons from that radio button when i select the second radio button after changing the orientation second radio button is disable (i mean when i select the second radio button in the portrait mode if i change to landscape mode radio button first one is enable and second one disable but my intention is second have to be enable )how to solve this problem so plz help me over come from this problem </p>
android
[4]
4,902,452
4,902,453
how can i implode multi dimentional array
<p>I am retrieving an array values from database which save multi dimensional array..i want to add</p> <p><em><strong>|</em></strong> </p> <p>between two member values of array..i have tried basic implode function which mention in the end what i tried..</p> <p>i have loop mention below</p> <pre><code>$sql = "SELECT `categories` FROM `jos_js_res_record` WHERE `categories` LIKE '%Autumn Market Session%' OR `categories` LIKE '%Farmer Market Profiles%' OR `categories` LIKE '%Spring Market Session%' OR `categories` LIKE '%Summer Market Session%' OR `categories` LIKE '%Winter Market Session%' ORDER BY `user_id`"; $db-&gt;setQuery( $sql ); $unserial = $db-&gt;loadObjectList(); foreach ($unserial as $dataElement) { $categories = unserialize($dataElement-&gt;categories); if (is_array($categories)) { foreach ($categories as $unserKey =&gt; $unserailData) { print $unserailData; } } echo '&lt;br /&gt;'; } </code></pre> <p><strong>i have tried the below line of code in 2nd for each loop but that shows error</strong></p> <pre><code>$comma_separated = implode(",", $unserailData); </code></pre> <p>Kindly guide me how can i implode the values in 2nd array <strong>$unserailData</strong> ?</p> <p><strong>data in $unserailData look like below</strong></p> <blockquote> <p>Summer Market Session</p> <p>Summer Market Session</p> <p>Summer Market SessionAutumn Market Session</p> <p>Summer Market SessionAutumn Market Session</p> </blockquote>
php
[2]
5,794,916
5,794,917
how to use a double value in power function
<p>i am trying to find the power of a value.But the problem is my exponent is a fractional value.power function does not suppporting any datatype other than int.</p> <pre><code> BigDecimal fd_returns_at_time_of_replace=(BigDecimal.valueOf(capitalDiff).multiply((BigDecimal.valueOf((long)constant1+.09)).pow(temp))); </code></pre> <p>here temp is a fractional value.given below is the eror message i am getting.</p> <pre><code>The method pow(int) in the type BigDecimal is not applicable for the arguments (double) </code></pre> <p>please anybody help me to do this.</p>
android
[4]