Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
1,507,049
1,507,050
Height not setting to the actual height of the div
<p>I have a DIV that slides open to the height of the content, but for some reason on divs that have no content it's calculating the height wrong.</p> <p>The 2nd blog entry down (Thoma) is a good example when expanded.</p> <p><a href="http://dririser.co.uk/index.php" rel="nofollow">http://dririser.co.uk/index.php</a></p> <p>The 'data-height' is 108px but it's setting the height of the DIV to 360px. The DIVs with content in work fine, it sets the correct height but seems to come to the wrong calculation on DIVs with no content in.</p> <p>This is basically the jist of the code.</p> <p>Set the hight as a value on the div.</p> <pre><code>$(".articleSlide").each(function () { var current = $(this); current.attr("data-height", current.height()); }); </code></pre> <p>Set a variable then apply the height.</p> <pre><code>$(".showTeamList").toggle(function() { var open_height = $(".articleSlide").attr("data-height") + "px"; $(this).parent().parent().animate({"height": open_height}, "slow" ); }, function() { $(this).parent().parent().animate({"height": "35"}, "slow" ); }); </code></pre>
jquery
[5]
4,770,454
4,770,455
How to start chronometer in reverse in android?
<pre><code>cmtr.setText(finalTime); cmtr.setBase(SystemClock.elapsedRealtime()); timetest = SystemClock.elapsedRealtime(); Log.d("SETTIME: ", ""+timetest); cmtr.start(); eltime = SystemClock.elapsedRealtime(); Log.d("ELapsed: ", ""+eltime); </code></pre> <p>Note: i want to start my chronometer in reverse order. like i set chronometer 10 seconds. now, i want to start from 10 to 0 seconds in reverse order. so can anyone help to get this solution.? Thank you so much in advance.</p>
android
[4]
5,551,319
5,551,320
Python: Converting to str while keeping leading 0's
<p>So in python I'm trying to access a file path in the order of 000X</p> <p>So I start by setting a string to </p> <pre><code>path = '0001' </code></pre> <p>and then point to and open the file path</p> <pre><code>filepath = open('/home/pi/Pictures' + path + '.JPG', 'rb') </code></pre> <p>so I do my business and now want to access the next file of extension 0002</p> <pre><code>intpath = int(path) intpath = intpath + 1 path = str(intpath) </code></pre> <p>I'm sure this is inefficient, but I'm starting out. Unfortunately, this makes path '2' and not '0002'....any idea how I can maintain the leading zeros? </p>
python
[7]
679,044
679,045
android answer telephone
<p>we can not use the java reflect to answer calls after android2.3.So another way found to acswer:</p> <pre><code>private void answerPhoneHeadsethook(Context context) { // Simulate a press of the headset button to pick up the call Intent buttonDown = new Intent(Intent.ACTION_MEDIA_BUTTON); buttonDown.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HEADSETHOOK)); context.sendOrderedBroadcast(buttonDown, "android.permission.CALL_PRIVILEGED"); // froyo and beyond trigger on buttonUp instead of buttonDown Intent buttonUp = new Intent(Intent.ACTION_MEDIA_BUTTON); buttonUp.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_HEADSETHOOK)); context.sendOrderedBroadcast(buttonUp, "android.permission.CALL_PRIVILEGED"); } </code></pre> <p>I find a little information of <code>mediaButtonBroadcastReceive</code> in <code>AudiaService</code>, but I not find the direct class which dealing with the event.Who can tell me ? </p>
android
[4]
2,284,431
2,284,432
Adding zeros when length is less
<p>Is there a smart way to convert numbers to string and automatically add zeroes so the length is the same as the maximum?</p> <p>like this:</p> <pre><code>for (var i=0; i&lt;30; i++) { var c = i.toString(); if (c.length == 1) { c = '0'+=c; } } </code></pre> <p>But smarter</p>
javascript
[3]
2,943,576
2,943,577
HashMap synchronisation
<p>I have a map and i am synchronising it in between.Will there be any difference in behaviour of the map in insertion after the synchronisation?</p> <pre><code>HashMap&lt;String,String&gt; myMap = new HashMap&lt;String,String&gt;(); myMap.put("abc","123"); myMap.put("efg","456"); Collections.synchronizedMap(myMap); myMap.put("hij","789"); myMap.put("jkl","234"); </code></pre>
java
[1]
2,638,355
2,638,356
preg_match help
<p>I was just helped in <a href="http://stackoverflow.com/questions/3692580/how-can-i-use-regex-to-solve-this">another thread</a> with a regex that has been verified to work. I can see it actually working on Rubular but when I plug the regex into preg_match, I get absolutely nothing.</p> <p>Here is the regex with my preg_match function:</p> <pre><code> preg_match('/^!!([0-9]{5}) +.*? +[MF] ([0-9]{3})([0-9]{3})([A-Z]{3})([A-Z]{3}) + ([A-Z])[0-9]{3}([0-9]{4})([0-9]{2})([0-9]{2})/', $res, $matches); </code></pre> <p>All I am getting is an empty array returned. Can someone please help?</p>
php
[2]
2,525,146
2,525,147
Simple text and image slider
<p>I've been looking for a slider that can slide whatever kind of content that I want to enter. I tried out various Wordpress plugins, but most of them only can slide Wordpress posts or images only with a small caption. I'm looking for something like the <a href="http://www.gopiplus.com/work/2011/06/02/wordpress-plugin-wp-photo-slider-50/#comment-52504" rel="nofollow">WP Photo Slider 50</a>. Unfortunately this slider doesn't work in my theme, though as there is a jquery conflict and I have no clue how to modify the plugin so that there won't be a conflict (if possible at all).</p> <p>I was wondering if somebody could help me find a slider plugin similar to the one above, direct me to a "how to creat a slider yourself" website or help me figure out how to get rid of the jquery conflict with the plugin mentioned above.</p> <p>My website (still heavily under construction): <a href="http://www.zoomingjapan.com" rel="nofollow">here</a></p> <p>Thanks a lot in advance :)</p>
jquery
[5]
1,475,838
1,475,839
slicing an array with offset and limit
<p>i'm migrating some data from SqlAlchemy selects into a cache of item ids.</p> <p>i'm trying to figure out the best way to handle migrating functions that have a limit and offset attached.</p> <p>the code i have below works fine. my worry is that it takes 7 lines - and usually when something like this takes a few lines, it's because I'm not seeing something or there's something about Python that I forgot about or haven't learned yet.</p> <pre><code>def sampling( selection, offset=0 , limit=None ): if offset or limit: if limit is not None: limit = offset + limit else: limit = len(selection) selection = selection[offset:limit] return selection ids = range(1,100) print sampling(ids,1,20) print sampling(ids,10,20) print sampling(ids,90) print sampling(ids,90,300) </code></pre>
python
[7]
3,126,761
3,126,762
Why declare static classes as sealed and abstract in C#?
<p><a href="http://msdn.microsoft.com/en-us/library/ms229038.aspx" rel="nofollow">This MSDN article</a> states that static classes should be declared as sealed and abstract. I was under the impression that static classes were already sealed. Why would you also need to declare a static class as sealed?</p>
c#
[0]
1,227,026
1,227,027
jquery find immediate parent of current element
<p>how can i get immediate parent of a given element ?</p> <p>$(e.target).parent() ?</p>
jquery
[5]
2,752,283
2,752,284
jQuery: Scroll down page a set increment (in pixels) on click?
<p>I'm trying to make a page scroll down 150px from the current position when an element is clicked. So lets say you're roughly halfway scrolled down a page. You click this link, and it will slide you down an additional 150 pixels.</p> <p>Is this possible with jQuery?</p> <p>I've been looking at scrollTop and the scrollTo plugin, but I can't seem to connect the dots.</p>
jquery
[5]
5,872,045
5,872,046
Print data from column and row in matrix
<p>Suppose i have a matrix like this</p> <pre><code>table = [ # grid: 4 by 9 ['A','B','C','D'], ['E','F','G','H'], ['I','J','K','L'], ['M','N','O','P'], ['Q','R','S','T'], ['U','V','W','X'], ['Y','Z','1','2'], ['3','4','5','5'], ['7','8','9','0'], ] </code></pre> <p>If i want to print the the string thats two down on the third column(2x,3y) resulting in G. Or something along the lines. How do i tell python that it should be a grid? And how do i return list information, the table.find(something) did not work (saying table has no find attribute) Im fairly new to python. I have searched the internet, with not much help..</p> <p>edit: I must be doing something wrong?</p> <pre><code>table = [ # grid: 4 by 9 # 1 2 3 4 ['A','B','C','D'],#1 ['E','F','G','H'],#2 ['I','J','K','L'],#3 ['M','N','O','P'],#4 ['Q','R','S','T'],#5 ['U','V','W','X'],#6 ['Y','Z','1','2'],#7 ['3','4','5','5'],#8 ['7','8','9','0'],#9 ] print table[1][2], table[4][3] </code></pre> <p>Prints O and T. O is right, but T is not, thats row 5 isnt it?'</p> <p>I'm trying to write a text positional encryption algorithm with text matrixes, like one of the famous ciphers( i cant remember the name of).</p> <p>I want to apply the said printing of each letter to the text that is caught by raw_input, i used dictionaries before, but i want to try this row/column method if possible, it will be much harder to break.</p>
python
[7]
2,661,870
2,661,871
jQuery fadeOut & fadeIn not working properly
<p>I have the following code:</p> <pre><code>$('#oldLoginProblem').fadeOut(); $('#newLoginProblem').fadeOut(); $('#newLoginProblem').fadeIn(); </code></pre> <p>It runs each time I press a button.</p> <p>In the beginning, it'll look like this:</p> <p><code>foobar</code></p> <p>But when I press my button and run that code, it looks like this:</p> <p><code>foobar</code></p> <p><code>foobar2</code></p> <p>The first element doesn't disappear, it remains. The second element just shows up below, as if I have a simple .show(). Also, there is no fading occurring in any way. How can I solve this?</p>
jquery
[5]
5,978,911
5,978,912
In best case how can I check a link belongs to *.domain.com?
<p>How can I check a link belongs to a domain *.domain.com using javascript?</p> <p>I mean that I ignore subdomain.</p>
javascript
[3]
1,398,393
1,398,394
Importing a file from web
<p>I have a file in txt-format saved on an ftp server. The server does not require a username or password. </p> <p>I want to import this into my android app so that I can use the text and numbers from it.</p> <p>How do I do this, or where can I find more information regarding this?</p>
android
[4]
3,477,800
3,477,801
to find and replace the string in php
<p>I have got a number of values by a foreach loop. Now I want to check each the values with a string.</p> <p>My string is <code>"http://www.example.com/TantraProjects/Ranjit/nt_plugin"</code></p> <p>I have the values like written below:</p> <pre><code>http://blogsearch.google.com/blogsearch?scoring=d&amp;partner=wordpress&amp;q=link:http://www.example.com/TantraProjects/Ranjit/nt_plugin/ http://blogsearch.google.com/blogsearch_feeds?scoring=d&amp;ie=utf-8&amp;num=10&amp;output=rss&amp;partner=wordpress&amp;q=link:http://www.example.com/TantraProjects/Ranjit/nt_plugin/ link:http://www.example.com/TantraProjects/Ranjit/nt_plugin/ - Google Blog Search </code></pre> <p>Now I want to change all the values, replacing <code>http://www.example.com/TantraProjects/Ranjit/nt_plugin</code> with <code>MY NEW PATH</code>.</p> <p>How can I replace the string using php?</p>
php
[2]
839,433
839,434
How can you check if something read in from a file is a valid integer?
<p>I'm trying something like:</p> <pre><code>int integer; cin &gt;&gt; integer; if(!integer) {//do something} </code></pre> <p>but obviously this is a problem if integer = 0.</p> <p>Are there more efficient methods for checking if something is an integer?</p>
c++
[6]
11,305
11,306
Intercept click event on a button, ask for confirmation, then proceed
<p>Based on a variable <code>SomeCondition</code>, I need to intercept a click event on a button, and ask for confirmation, if they say ok, proceed, otherwise ignore click.</p> <p>So something like:</p> <pre><code>if(SomeCondition) { // disable click on button var isOk = window.confirm("Are you sure?"); if(isOk) { $("#button1").click(); } } </code></pre> <p>Note: button1 has already been wired up with a click event via javascript from an external .js file that I can't change.</p> <p>I don't know what the click event was bound too, so I have to disable the click if SomeCondition is true, then ask for confirmation, then continue with the click.</p>
jquery
[5]
5,314,704
5,314,705
how to get particular data from jsonarray?
<p>I want to get the CreateDate value from xml file the xml file is like this way.</p> <pre><code>&lt;d:CreateDate m:type="Edm.DateTime"&gt;2012-03-18T15:11:30.403&lt;/d:CreateDate&gt; </code></pre> <p>I created JSONObject as</p> <pre><code>JSONObject json=new WCFServices().getWhatsNew();//i get the json object WCFServices class. JSONArray whatsnew= json.getJSONArray("d"); String CreateDate= c.getString("CreateDate"); </code></pre> <p>if i try to print the value it gives me output as:</p> <pre><code> /Date(1330041600000)/ </code></pre> <p>I want to get the value as like <code>2012-03-18T15:11:30.403</code> how to get it ?</p>
android
[4]
3,806,957
3,806,958
Android HtmlGet trouble
<p>I want to get source of webpage. And for now only display. I can't compile this code succesfuly. Eclipse saying Unhandled declaration type IOExeption. When i add "throws declaration" still have some problems. I'm sorry for my english. Thanks for answers. </p> <pre><code>package com.html; import java.io.BufferedReader; // More and more import import android.widget.TextView; public class GetHtmlActivity extends Activity { String html; public String HtmlGet(String url) throws IOException { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(url); HttpResponse response = client.execute(request); InputStream in = response.getEntity().getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder str = new StringBuilder(); String line = null; while((line = reader.readLine()) != null) { str.append(line); } in.close(); return str.toString(); } public void onCreate(Bundle Spusteni) { super.onCreate(Spusteni); setContentView(R.layout.main); HtmlGet("***"); TextView tv = new TextView(this); tv.setText(html); setContentView(tv); } } </code></pre>
android
[4]
2,124,731
2,124,732
changing jars order in classpath during runtime
<p>Is there an option in java to change the order of jars file during runtime depends on parameter to the application.</p> <p>Case1: Input parameter with value true: jar A will be before jar B in the classpath</p> <p>Case2: Input parameter with value false: jar B will be before jar A in the classpath</p> <p>Thanks in advance.</p>
java
[1]
3,929,966
3,929,967
Easiest way to convert two columns to Python dictionary
<p>How would I put the following information into a Python dictionary -- <a href="http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html" rel="nofollow">http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a>? Keys would be the country and values would be the two-character ISO code.</p> <p>For example, I want the result to be:</p> <pre><code>mapping_of_country_to_iso = {'AALAND ISLANDS':'AX','AFGHANISTAN':'AF',...} </code></pre>
python
[7]
4,606,200
4,606,201
Android: "Conversion to Dalvik format failed with error 1"
<p>While running my application, I received the following error:</p> <blockquote> <p>Android: Conversion to Dalvik format failed with error 1</p> <p>trouble processing "javax/net/SocketFactory.class":</p> </blockquote>
android
[4]
2,599,601
2,599,602
Offline spell checking api
<p>I'm building my own custom IME and want to include spell checking. Are there any offline spell checking api's that are available?</p>
android
[4]
3,061,282
3,061,283
secure message in IE for ASP.Net webiste
<p>can anybody please tell me,why this no-secure message comes on my site's homepage in Internet Explorer Following is message:</p> <p>"The web page contains content that can not be delivered using secure HTTPS connection" message box comes with yes/no option.</p>
asp.net
[9]
3,042,328
3,042,329
Function pointer as a template
<p>How to write a function pointer as template?</p> <pre><code>template &lt;typename T&gt; T (*PtrToFunction)(T a); </code></pre>
c++
[6]
721,774
721,775
fieldset form with Table-like layout with CSS?
<p>I have an application in which I'm currently using a two column table in order to get accurate cell alignment of the left column labels/descriptions with the right column form fields.</p> <p>I'd like to convert it to css and use jQuery to expand/collapse specific sections.</p> <p>I've seen some jQuery libraries, the menu.js in particular. And they appear to all use list items for the markup. I'm OK with converting my table to UL/LI structure if that's what I need to do.</p> <p>Just looking for some advice.</p>
jquery
[5]
2,194,450
2,194,451
How do I parse a templated string in Python?
<p>I'm new to Python, so I'm not sure exactly what this operation is called, hence I'm having a hard time searching for information in it.</p> <p>Basically I'd like to have a string such as:</p> <pre><code>"[[size]] widget that [[verb]] [[noun]]" </code></pre> <p>Where size, verb, and noun are each a list.</p> <p>I'd like to interpret the string as a metalanguage, such that I can make lots of sentences out permutations from the lists. As a metalanguage, I'd also be able to make other strings that use those pre-defined lists to generate more permutations.</p> <p>Are there any capabilities for variable substitution like this in Python? What term describes this operation if I should just Google it?</p>
python
[7]
1,494,355
1,494,356
maintaining continuous count in php
<p>I have a small problem maintain a count for the position. i have written a function function that will select all the users within a page and positions them in the order.</p> <p>Eg:<br> Mike Position 1<br> Steve Postion 2..............<br> ....<br> Jacob Position 30<br></p> <p>but the problem that i have when i move to the second page, the count is started from first Eg: Jenny should be number 31 but the list goes,</p> <p>Jenny Position 1 <br> Tanya Position 2.......</p> <p>Below is my function</p> <pre><code>function nrk($duty,$page,$position) { $url="http://www.test.com/people.php?q=$duty&amp;start=$page"; $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,$url); $result=curl_exec($ch); $dom = new DOMDocument(); @$dom-&gt;loadHTML($result); $xpath=new DOMXPath($dom); $elements = $xpath-&gt;evaluate("//div"); foreach ($elements as $element) { $name = $element-&gt;getElementsByTagName("name")-&gt;item(0)-&gt;nodeValue; $position=$position+1; echo $name." Position:".$position."&lt;br&gt;"; } return $position; } </code></pre> <p>Below is the for loop where i try to loop thru the page count</p> <pre><code>for ($page=0;$page&lt;=$pageNumb;$page=$page + 10) { nrk($duty,$page,$position); } </code></pre> <p>I dont want to maintain a array key value in the for each coz i drop certain names...</p>
php
[2]
5,437,044
5,437,045
passing get variables without opening URL
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2259892/how-to-read-a-web-page-in-php">How to read a web page in PHP</a> </p> </blockquote> <p>I'm sure there is some simple way to do this. I need to pass get variables through to my cart software to record a conversion, but not redirect the user, I just want the server to send GET variables to a URL. I'd rather not turn on allow_url_fopen in php.ini. </p> <p>Anyone know the best way to do this? Thanks in advance.</p>
php
[2]
4,148,866
4,148,867
handling broadcast reciver
<p>I have an app which has MainActivity(without gui.. please just flow with it:) )</p> <p>now this MainActivity running a service, this service using sendBroadcast() in order to comunnicate with the MainActivity.. now ofcourse i need to <strong>registerReceiver</strong> in the <strong>onResume</strong>() of the MainActivity.</p> <p>but i also need to add <strong>unregisterReceiver</strong>(receiver) in the <strong>onDestroy</strong>() of the MainActivity.</p> <p>problem is: when i first start that app i need it to up the service, and i dont want the user to lose focus, so i press <strong>finish</strong>() after i`am starting the service.. but then auto invoked also unregisterReceiver(receiver).. and this is not good for me.. i get error it's said it couldnt find any registerd reciver.</p> <p>so i fixed it by delete this line.. but i am sure its going to 'revenege' me in the future, when/where could i have problem if i wont use unregisterReceiver(receiver).. at the onDestroy()</p> <p>mybe i should remove it (instead of delete it) to onPause()?</p> <p>thanks,</p> <p>ray.</p>
android
[4]
4,467,351
4,467,352
MenuItem#getTag()
<p>On subclasses of <code>View</code> there is <code>getTag()</code>, which returns the <code>android:tag</code> attribute's value from .xml. I would like the same for a <code>MenuItem</code>... is it okay to just cast it to a <code>View</code>? Because item elements also allow a tag attribute in .xml...</p> <p><strong>Update:</strong> My goal with this is setting a tag in .xml, i.e. <code>"notranslate"</code>, and querying it at runtime (yes we localize by hand at runtime, don't even ask :P...)</p>
android
[4]
1,471,144
1,471,145
Convert multi-dimensional list to a 1D list in Python
<p>A multidimensional list like <code>l=[[1,2],[3,4]]</code> could be converted to a 1D one by doing <code>sum(l,[])</code>. Can anybody please explain how that happens?</p> <p>Thanks,<br> Sayan</p>
python
[7]
2,626,844
2,626,845
C# numeric constants
<p>I have the following C# code:</p> <pre> byte rule = 0; ... rule = rule | 0x80; </pre> <p>which produces the error: <em>Cannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast?)</em></p> <p>[Update: first version of the question was wrong ... I misread the compiler output]</p> <p>Adding the cast <strong>doesn't</strong> fix the problem:</p> <pre> rule = rule | (byte) 0x80; </pre> <p>I need to write it as:</p> <pre> rule |= 0x80; </pre> <p>Which just seems weird. Why is the |= operator any different to the | operator?</p> <p>Is there any other way of telling the compiler to treat the constant as a byte?</p> <hr> <p><strong>@ Giovanni Galbo</strong> : yes and no. The code is dealing with the programming of the flash memory in an external device, and logically represents a single byte of memory. I could cast it later, but this seemed more obvious. I guess my C heritage is showing through too much!</p> <p><strong>@ Jonathon Holland</strong> : the 'as' syntax looks neater but unfortunately doesn't appear to work ... it produces: <em>The as operator must be used with a reference type or nullable type ('byte' is a non-nullable value type)</em> </p>
c#
[0]
3,971,926
3,971,927
out of memory exception while reading large pdf files
<p>Following is my code.It reads the pdf file .It works fine with smaller pdf files but when i try to open large files it gives out of memory exception.can anyone help.</p> <pre><code> public void nextPage() { try { if (i &lt;= numberOfPages) { s = extractor.getTextFromPage(i); s = s.replaceAll("\\\\", " "); tv.setText(s); tv2.setText("Page no." + i); } else if (i &gt; numberOfPages) { Toast.makeText(PDFView.this, "Already at last page", Toast.LENGTH_SHORT).show(); } } catch (Exception e) { e.printStackTrace(); } } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pdf_view); tv = (TextView) findViewById(R.id.TextView01); tv2 = (TextView) findViewById(R.id.TextView02); Bundle extras = getIntent().getExtras(); fileName = extras.getString("fileName"); System.out.println("@@@@!!!" + fileName); try { reader = new PdfReader(fileName); numberOfPages = reader.getNumberOfPages(); System.out.println("This document contains:" + numberOfPages); extractor = new PdfTextExtractor(reader); nextPage(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } </code></pre>
android
[4]
1,288,602
1,288,603
jquery disable parts of page
<p>I am displaying a modeless jquery dialog on top of a page. When the dialog is displayed I wish to only allow the user to interact with a certain portion of the page (mainly because I do not want them naving away or clicking other controls that cause postbacks). I thought it would work well to use the same mechanism that jquery uses with a modal dialog except instead of disabling the entire page, disable all but the portion I wish to remain active. Does someone know how jquery modal dialog does this or have a better suggestion?</p>
jquery
[5]
2,592,579
2,592,580
convert dd/mm/yyyy to mm/dd/yyyy in javascript
<p>I want to convert dd/mm/yyyy to mm/dd/yyyy in javascript.</p>
javascript
[3]
2,387,563
2,387,564
Android textview multiple text colours
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1529068/is-it-possible-to-have-multiple-styles-inside-a-textview">Is it possible to have multiple styles inside a TextView?</a> </p> </blockquote> <p>I am using a textview to display some text and I would like different parts of the text to be shown in different colours, e.g. first half of the text in red, second in blue. I cant seem to find a way of doing this. I have heard of using Html.fromHtml() but I am not exactly sure how to do it this way. </p>
android
[4]
2,745,495
2,745,496
pass data to a site from android
<p>blahNow I am doing an ANdroid application.In my app I have to login using a url.Just like...www.blah.com/api/login/username/password.</p> <pre><code>private void sendAccelerationData() { ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(7); nameValuePairs.add(new BasicNameValuePair("","test3")); nameValuePairs.add(new BasicNameValuePair("","pass3")); this.sendData(nameValuePairs); } private void sendData(ArrayList&lt;NameValuePair&gt; data) { try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://blah.com/api/login/"); httppost.setEntity(new UrlEncodedFormEntity(data)); HttpResponse response = httpclient.execute(httppost); } } </code></pre> <p>but I am getting 404 error.and if i write my sendData() like </p> <pre><code>HttpPost("http://eesnap.com"); </code></pre> <p>and sendAccelerationData() like</p> <pre><code>nameValuePairs.add(new BasicNameValuePair("","api")); nameValuePairs.add(new BasicNameValuePair("","login")); nameValuePairs.add(new BasicNameValuePair("","test3")); nameValuePairs.add(new BasicNameValuePair("","pass3")); </code></pre> <p>I am getting 200 success. If post www.blah.com/api/login/username/password on brower then I am getting a result on the browser</p>
android
[4]
1,490,161
1,490,162
how to know tables name in the connected database in c#
<p>i have database which is already created from sql and i make connection on it is there is any way by which i can know the names of the tables in this database from c# as i know the tables in it but i won't to display tables names using code and programming and c#</p>
c#
[0]
3,238,401
3,238,402
How to make Javascript more specific?
<p>I am new at JavaScript so I think my problem may be simple. This works:</p> <pre><code>var convId = document.getElementById("wrapper"); convId.setAttribute("align","right"); </code></pre> <p>But when I try to make it more specific:</p> <pre><code>var convId = document.getElementById("wrapper"); var convIdDl = convId.getElementsByTagName("dl"); convIdDl.setAttribute("align","right"); </code></pre> <p>my definition list doesn't align to the right. I have checked the HTML and CSS and everything is correct, but that shouldn't even matter JavaScript overwrites them both.</p>
javascript
[3]
753,588
753,589
getting data from edittext placed in listview
<p>I created a list with textview &amp; edittext using holder... it looks like</p> <pre><code> Textview Edittext --------------------------------- Textview Edittext --------------------------------- Textview Edittext --------------------------------- </code></pre> <p>but I cant get the data from each every Edittext... can any one assist me.. how to achieve it... assist with sample code...</p>
android
[4]
5,545,375
5,545,376
javascript validate uk date
<p>I am trying to validate a date in the format dd/mm/yyyy using a function I have found online, but I get this error : 'input is null'</p> <p>Can anybody tell me where my syntax is wrong?</p> <pre><code>if (validateDate($("#&lt;%=StartDate.ClientID%&gt;")) == false) { alert("not date"); } else { alert("date"); } function validateDate(dtControl) { var input = document.getElementById(dtControl) var validformat = /^\d{1,2}\/\d{1,2}\/\d{4}$/ //Basic check for format validity var returnval = false if (!validformat.test(input.value)) alert('Invalid Date Format. Please correct.') else { //Detailed check for valid date ranges var dayfield = input.value.split("/")[0] var monthfield = input.value.split("/")[1] var yearfield = input.value.split("/")[2] var dayobj = new Date(yearfield, monthfield - 1, dayfield) if ((dayobj.getMonth() + 1 != monthfield) || (dayobj.getDate() != dayfield) || (dayobj.getFullYear() != yearfield)) alert('Invalid Day, Month, or Year range detected. Please correct.') else { returnval = true } } if (returnval == false) input.focus() return returnval } </code></pre>
javascript
[3]
222,309
222,310
statement that I don't quite understand ( setter = (o) => { }; )
<p>Right, so I've got this piece of code that initializes default values for Properties in C#. source: <a href="http://www.codeproject.com/KB/dotnet/DefValInit.aspx" rel="nofollow">http://www.codeproject.com/KB/dotnet/DefValInit.aspx</a></p> <p>Now i've rewritten it to C++ code, which sadly does not support extensions, but supplying the Object to the ApplyDefaultValues works as well.</p> <p>One line that I was not able to rewrite to C++ are the lines containing this expression:</p> <pre><code>setter = (o) =&gt; { }; </code></pre> <p>I would like to know if someone knows what this line does. Google gave no results</p>
c#
[0]
1,601,140
1,601,141
Getting the fram around the pharagraph when Export the CrestalReport in .net in to Word Document
<p>I got the Frame with dasheslines around the paragraph when I have exported the CrystalReport in to the word document.can you please find the solution for it....</p> <p>latha..</p>
asp.net
[9]
5,636,991
5,636,992
How to enter elemets in a hashmap and check for the existence of a particular key?
<p>I am trying to read a csv file and storing its contents in a hash map and checking the existence of a particular key in the hash map.</p> <p>Here is my code,Please let me know where am i wrong because i m ant able to figure out my mistake</p> <pre><code>import java.io.*; import java.text.SimpleDateFormat; import java.util.*; public class PoolCsv { public static void main(String[] args) { try { Calendar currentdate = Calendar.getInstance(); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); String presdate = dateformat.format(currentdate.getTime()); currentdate.add(Calendar.DAY_OF_YEAR, 4); String futdate = dateformat.format(currentdate.getTime()); System.out.println(presdate); System.out.println(futdate); String poolcsv = "D:\\pool_items.csv"; BufferedReader br = new BufferedReader(new FileReader(poolcsv)); String lines = null; String[] tokens = null; String startdate = null; String enddate = null; HashMap&lt;String, String&gt; hash = new HashMap&lt;String, String&gt;(); while ((lines = br.readLine()) != null) { tokens = lines.split(","); for (int i = 0; i &lt;= tokens.length; i++) { startdate = tokens[5]; enddate = tokens[6]; } hash.put(startdate, enddate); boolean flag = hash.containsKey(presdate); if (flag) { System.out.println("value exists"); } } } catch (IOException io) { System.out.println(io); } } } </code></pre>
java
[1]
5,940,142
5,940,143
Intercept all current and future links
<p>Just wondering if there is a way with jquery to intercept a link when clicked. The problem is that some of the links on my page are not loaded when the page is first loaded. I have a vague recollection of hearing that jquery has a way of intercepting all current and future links. Here is the code I have. It works on all links there were there at the start but the links that were loaded onto the page later are not getting intercepted by this function</p> <pre><code>$('a').trackClick({ areaClick: function(element) { return getAreaClicked(element); }, href: function(element) { return getHrefFromElement(element); }, text: function(element) { return getTextFromElement(element); }, exceptions: function(element) { return isException(element); } }); </code></pre>
jquery
[5]
2,535,352
2,535,353
inserting multiple record at once
<p>Hello I have a form like below:</p> <pre><code>&lt;form method="post" action=""&gt; &lt;fieldset&gt;&lt;legend&gt;Products List&lt;/legend&gt; &lt;ul&gt; &lt;li&gt;&lt;input type='hidden' name='product[]' value='1'/&gt;Product 1&lt;/li&gt; &lt;li&gt;&lt;input type='hidden' name='product[]' value='2'/&gt;Product 2&lt;/li&gt; &lt;li&gt;&lt;input type='hidden' name='product[]' value='3'/&gt;Product 3&lt;/li&gt; &lt;li&gt;&lt;input type='hidden' name='product[]' value='4'/&gt;Product 4&lt;/li&gt; &lt;li&gt;&lt;input type='hidden' name='product[]' value='5'/&gt;Product 5&lt;/li&gt; &lt;/ul&gt; &lt;input type='submit' name='submit' value='Save'/&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <p>I want to know how to insert all the product id in the hidden field value.</p> <p>Thanks in advance</p>
php
[2]
4,065,388
4,065,389
Localization of Resources
<p>I have a dataTable and a resx file with Name , Value , Comments as Columns.. I'm reading a resource with ResXResourceReader.. and assigning to grid.. I'm adding new values in the grid.. I want to reflect the new values in the resx file.. Can anyone help..After Looping and im writing to the corresponding resx!!! Whether it ll be overwriten???? If i do im getting IOException was Unhandled!!!!</p>
c#
[0]
4,768,816
4,768,817
php question checking pics format
<p>I have problem to check picture format the code:</p> <pre><code>// 0 means a successful transfer if ($_FILES["fname"]["error"] &gt; 0) { $_FILES["fname"]["name"] = "holder.jpg"; // line 3 $imgData = $hyperlink.$_FILES["fname"]["name"]; // line 4 } else { $imgData = $hyperlink.$_FILES["fname"]["name"]; } // Only accept files of jpeg format $img = substr($imgData, 37); $_FILES["fname"]["type"] = $img; print "****"; print $_FILES["fname"]["type"]; //print $img; print "****"; // only accept jpg images pjpeg is for Internet Explorer.. should be jpeg if (!($_FILES["fname"]["type"] == "image/pjpeg") || !($_FILES["fname"]["type"== "image/jpg")) { print "I only accept jpg files!"; exit(0); } </code></pre> <p>It always goes to the first <code>if</code> statment (line 3 and 4). If I don’t upload the pictures and when it goes to <code>if</code> statment to check the format and it gives me <em>I only accept jpg files</em>. My guess it accepts it as string so that it says <em>I only accept jpg files</em>.</p>
php
[2]
2,353,747
2,353,748
How much overhead is involved in creating a C# method?
<p>I'm new to C# still, so bear with me here.</p> <p>If I want to run a simple algorithm with just 2 parameters, in other languages I would simply create a function outside of my <code>main()</code>. Instead, in C#, apparently I need to create a class and put the function (method) inside that class, and make the method static so it's coded for runtime instead of having to create an actual object of the class, correct?</p> <p>If all that is true, wouldn't it create a lot of overhead, since you are creating a reference to something?</p>
c#
[0]
483,682
483,683
Conditional Number Formatting In Java
<p>How can I format Floats in Java so that the float component is displayed only if it's not zero? For example:</p> <pre> 123.45 -> 123.45 99.0 -> 99 23.2 -> 23.2 45.0 -> 45 </pre> <p>Edit: I forgot to mention - I'm still on Java 1.4 - sorry!</p>
java
[1]
5,622,368
5,622,369
Custom Analog Timer in Android
<p>Someone please help me in creating Custom Analog Timer. Say if the time span is 30 minutes the clock should show only 30 minutes and start reducing as time reduces.</p> <p>Thanks in Advance.</p>
android
[4]
2,578,405
2,578,406
runonuithread is not working in android
<p>my working task is to read sd card files and i want to show all sdcard files with location on textview but,my code is reading successfully but,i can't update textview text while reading files is not working after i find solution runonuithread but,it's also not working.my code is shown below:</p> <pre><code>public void scan (final File path) { try { for (final File f : path.listFiles()) { if (f.isFile()) { scannedfiles=scannedfiles+1; progresspercentage=scannedfiles*100/FilesCount; MainActivity.this.runOnUiThread(new Runnable() { @Override public void run() { lbl_scan.setText("SCANING:"+f.getAbsolutePath());\\first time only change text after didn't change Toast.makeText(getApplicationContext(),"Files:"+f.getAbsolutePath(),Toast.LENGTH_SHORT).show(); } }); } else { if(!f.getName().equals("Android")) { scan(f); } } } } catch (Exception e) { } } </code></pre> <p>i am calling scan function below code:</p> <pre><code> File root = new File (Environment.getExternalStorageDirectory().getAbsolutePath()); scan(root); </code></pre> <p>can any one help me greatly appreciated.</p>
android
[4]
5,324,558
5,324,559
Getting the names of executing functions in javascript
<p>Is there a way to get the names of all the javascript function executed on a page?</p> <p>something like</p> <pre><code>console.info(functionname) </code></pre> <p>As I am trying to fix some bugs on a customer's page and all javascript function are sepreaded all over the website withing PHP files.</p>
javascript
[3]
2,817,416
2,817,417
How to update Android application through our application without go to android Market?
<p>I have android app, that version is 1.0. There are some updates so changed the version number to 1.1. I did not upload into android market. </p> <p>It's a private application. Normally update app happens like this: If there is version number which differs from installed app, then I should update. That time It don't delete my database contents</p> <p>is it?</p> <p>How we can update into version without publishing into android market?</p> <p>because my applications sales person going use.when there are in the fields(on way to go shop or anywhere their-self want to update)</p> <p>If there are new version is available then In sql server database also we mention the flag "1" (bacause of sales person can identify there are update version is available)then It should download apk &amp; need to update the system automatically?</p> <p>OR </p> <p>when we launch the app,It should check the version number or update available, then should update automatically..</p> <p>How we can do it?</p> <p>OR give me a idea of update the android apps..</p> <p>How we can do this?</p> <p>Please help me..</p> <p>Thanks in advance</p>
android
[4]
218,978
218,979
Out Of Memory Exception
<p>In my app i am giving video file path to FileInputStream class after that i want it to convert into byte Array but it throws Out of memory Exception Please suggest me how to do it.Iam posting the code here thanks in advance.</p> <pre><code>public byte[] readBytes(InputStream inputStream) throws IOException { ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream(); int bufferSize = 1024; byte[] buffer = new byte[bufferSize]; int len = 0; while ((len = inputStream.read(buffer)) != -1) { byteBuffer.write(buffer, 0, len); } return byteBuffer.toByteArray(); } </code></pre>
android
[4]
4,838,816
4,838,817
Android Unable to merge two wave files
<p>I am working in android. I want to merge two wave files and want to create third file. For this I create two input streams and then trying to write those input streams into one output stream file.</p> <p>This is my code:-</p> <pre><code> File file = new File("/sdcard/z.wav"); File file1 = new File("/sdcard/zz.wav"); InputStream is = new FileInputStream(file); InputStream is1 = new FileInputStream(file1); // Get the size of the file long length = file.length(); long length1 = file1.length(); // Create the byte array to hold the data byte[] bytes = new byte[(int)length]; byte[] bytes1 = new byte[(int)length1]; // Read in the bytes int offset = 0; int numRead = 0; while (offset &lt; (int)length &amp;&amp;( numRead=is.read(bytes, offset, bytes.length-offset)) &gt;= 0) { offset += numRead; } int offset1 = 0; int numRead1 = 0; while (offset1 &lt; (int)length1 &amp;&amp;( numRead1=is1.read(bytes1, offset1, bytes1.length-offset1)) &gt;= 0) { offset1 += numRead1; } FileOutputStream fos=new FileOutputStream("sdcard/guruu.wav"); Log.v("Trying Activity","before first write"); fos.write(bytes); fos.write(bytes1,0,bytes1.length); fos.write(bytes); fos.close(); is.close(); is1.close(); </code></pre> <p>when I play output file guruu.wav then this only playing file of <strong>file1</strong>, it is not playing content of file2. Please suggest me what mistake I have done. Is any other way to do this ?</p> <p>I am very new in this so please do not down vote it. </p> <p>Thank you in advance. </p>
android
[4]
3,684,902
3,684,903
How to decide parameters of the property of an instance variable in iPhone os
<p>I am noob in iPhone development..I have a query hope I you people will solve..</p> <p>In every interface file(*.h file) we declare a property for every instance variable like this...</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface Fruit : NSObject { NSString *name; NSString *description; } @property(nonatomic, copy) NSString *name; @property(nonatomic, copy) NSString *description; - (id)initWithName:(NSString*)n description:(NSString *)desc; @end </code></pre> <p>In this, how do we decide what will be parameters for the property of a variable????</p> <p>thanks in advance..</p>
iphone
[8]
2,094,852
2,094,853
Microsoft Visual C# Express Edition 2008 Question
<p>I completed a project, and after I finished it I saved and closed out. When I reopen Microsoft Visual C# Express Edition it shows me all my recent projects. When I open one I can find the Form1.cs however I can not find the code that handles all my events and everything. Does anyone know what I am doing wrong?</p>
c#
[0]
15,525
15,526
Python | How to create dynamic and expandable dictionaries
<p>I want to create a Python dictionary which holds values in a multidimensional accept and it should be able to expand, this is the structure that the values should be stored :-</p> <pre><code>userdata = {'data':[{'username':'Ronny Leech','age':'22','country':'Siberia'},{'username':'Cronulla James','age':'34','country':'USA'}]} </code></pre> <p>Lets say I want to add another user </p> <pre><code>def user_list(): users = [] for i in xrange(5, 0, -1): lonlatuser.append(('username','%s %s' % firstn, lastn)) lonlatuser.append(('age',age)) lonlatuser.append(('country',country)) return dict(user) </code></pre> <p>This will only returns a dictionary with a single value in it (since the key names are same values will overwritten).So how do I append a set of values to this dictionary. </p> <p>Note: assume age, firstn, lastn and country are dynamically generated.</p> <p>Thanks. </p>
python
[7]
4,833,312
4,833,313
ASP.NET Custom Error except 404 errors,
<p>I have setup custom error as follows..</p> <pre><code>protected void Application_Error(Object sender, EventArgs e) { Exception ex = HttpContext.Current.Server.GetLastError(); if (ex is HttpUnhandledException &amp;&amp; ex.InnerException != null) ex = ex.InnerException; if (ex != null) { try { Logger.Log(LogEventType.UnhandledException, ex); } catch { } } HttpContext.Current.Server.ClearError(); Response.Redirect(MyCustomError); } </code></pre> <p>I am wondering if it is possible to detect if this error is a 404 error, and then show the default 404 error?</p>
asp.net
[9]
4,685,780
4,685,781
How to use onUserInteration method in my code?
<p>In my sample application in need find the user inactivity, ie if the user won't do anything for 5 minutes i need show a Alert Dialog. For this, initially i wrote my code in <code>onStart()</code> method in this method i include a thread with which is run 5 minutes delay but it doesn't meet the exact requirement, i searched in Google i got on predefined method <code>onUserInteracation()</code>, unfortunately i can't understand why this method (this method called when i interact the screen). Is it possible to find out the user inactivity through code?</p>
android
[4]
4,134,558
4,134,559
How to display these values using PHP?
<p>I want $amount to be displayed. But that's not happening.</p> <pre><code>$amount = $_POST['amount']; $message = "Thanks. We've got $amount from you."; echo $message; </code></pre> <p>So now in the message displayed, $amount is not being displayed. Why?</p>
php
[2]
2,303,772
2,303,773
set imagebutton after listview and before footer tabbar
<p><em><strong>Hi, I want to place two imagebuttons between listview and footer tabbar. If listview contains 10items then the buttons appear at last of the listview after displaying 10items in listview. Please help. thanks in advance.</em></strong></p>
android
[4]
5,115,747
5,115,748
horizontally scrolling image with zooming effect
<p>May anyone please help me for horizontally scrolling image view along with zoom in , zoom out effect. I was using Gallery for horizontally scrolling but unable to implement zooming with gallery. In web view zooming is there but how to use horizontally scrolling. </p>
android
[4]
5,626,722
5,626,723
Writing string to a file in java
<p>I have a file which contains sql statements. Now in this file, I want to add a word "collate" after every 'char()' and 'varchar()' in the file. How do you do that?</p>
java
[1]
353,423
353,424
Google Play Store warning about fewer devices supported by updated APK
<p>In the latest version of my app I updated the manifest file to include support for ICS version. When activating the APK file, I got a warning (that I apparently ignored) about newest version supports fewer devices than previous version. Later that day I saw couple of posts in forums where user saying that they are getting APP incompatible with their device messages. The current info in manifest looks like this:</p> <pre><code> &lt;uses-sdk android:maxSdkVersion="15" android:minSdkVersion="7" android:targetSdkVersion="14"/&gt; </code></pre> <p>The previous version in manifest had following info</p> <pre><code> &lt;uses-sdk android:maxSdkVersion="14" android:minSdkVersion="7" /&gt; </code></pre> <p>I used targetSDK as 14 to enable action bar. Any idea why this would lead to fewer device support though the maxSDK is 15 instead of 14? Any help will be highly appreciated. Thanks!!</p>
android
[4]
3,756,709
3,756,710
I can't read from DB using java netbeans
<p>I have this code and I faced a problem to read information from MySQL database using java netbeans, data type inside database varchar</p> <pre><code>import com.mysql.jdbc.Statement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.util.Scanner; public class NewDataBase { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); try{ Connection con = DriverManager.getConnection("jdbc:mysql://localhost/mydb","root", "password"); Statement stmt = (Statement) con.createStatement(); System.out.println("Enter name"); String name =sc.next(); String SQL = "select * from list where Name ='"+ name + "'"; ResultSet rs = stmt.executeQuery(SQL); System.out.print("Name: " + rs.getNString("Name")); System.out.print("Number: " + rs.getNString("Number")); // while(rs.next()) // { // System.out.print("Name: " + rs.getNString("Name")); // System.out.print("Number: " + rs.getNString("Number")); //} }catch(Exception e){ System.out.print("Error:" + e.getMessage()); } } } </code></pre> <hr> <p>Error:Can not call getNString() when field's charset isn't UTF-8</p>
java
[1]
24,916
24,917
Passing a function as an argument in a javascript function
<p>I was wondering whether this is legal to do. Could I have something like:</p> <pre><code>function funct(a, foo(x)) { ... } </code></pre> <p>Where <code>a</code> is an array and <code>x</code> is an integer for another function called <code>foo</code>?</p>
javascript
[3]
2,099,666
2,099,667
What's the difference between en_GB and en_GB.UTF8 in PHP's setlocale()?
<p>I have an issue with <code>setlocale()</code> in PHP when using functions such as <code>money_format()</code>.</p> <p>In my localhost, such functions only work if my <code>setlocale()</code> value is <code>en_GB</code>. However, on my live server the same functions will only work if <code>setlocale()</code> is set to <code>en_GB.UTF8</code>.</p> <p>So my question is: what causes the different requirements? As presently my configuration file has a dirty <code>if/else</code> statement to find what server it's being ran on and dynamically specifies the <code>setlocale()</code> value.</p>
php
[2]
1,233,832
1,233,833
session time out when upload new code file
<p>Hey I noticed that when I upload a new file code For example: Class or aspx page All sessions, expired, and all users are thrown out of the website Is there a better way to update code? Thanks in advance Micah</p>
asp.net
[9]
4,922,762
4,922,763
Image Caching Problem
<p>I am Storing the Image taken from UIImagePickerController and saving in the Directory like:</p> <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *path = [NSString stringWithFormat:@"%@/%@", [paths objectAtIndex:0], 1.jpg]; [imgData writeToFile:path atomically:YES]; </code></pre> <p>When iam Retrieving the image from the path and display in TableView it work for 1 or 2 times then application crash and error occurs is "memory urgent" also used code for retrieving image in UIIMageView like [UIImage imageWithContentsOfFile:path] but not working help. so How to handle the image caching?</p>
iphone
[8]
3,656,685
3,656,686
Is there a way to see what data stores each app in phone memory/on sd card?
<p>I want to track everything that apps store in phone memory/on sd card, so I can delete it if the app is uninstalled. Is this possible? If not, how can I get all the files from phone memory/sd card?</p>
android
[4]
5,292,871
5,292,872
setting a default union member
<p>i'm using templated unions to both assure myself that i always get a 64-bit field for pointers (even on 32-bit machines since there is transmission of data to a 64-bit machine occurring) and to save both the user and myself casting.</p> <pre><code>template &lt;typename type&gt; union lrbPointer { uint64_t intForm; type ptrForm; //assumed that type is a pointer type }; //usage lrbPointer&lt;int*&gt; myPointer; int integers[4]; myPointer.ptrForm = integers; myPointer.intForm += 2; //making it easy to jump by less then sizeof(int) </code></pre> <p>this is working well for me, but i would really love to find a way to make a default member. so that the user does not need to use a .ptrForm after the pointer they wish to use.</p>
c++
[6]
5,233,686
5,233,687
How to change jquery parameter with a submit form?
<p>I am a newbie at jQuery. I was trying some things but I need some help.</p> <p>I have the following script </p> <pre><code>jQuery(function($){ $("#query").whatever({ parameter1: 32, parameter2: 4, query: "something" }); }); </code></pre> <p>I need a script to change <code>query: "something"</code> to <code>query: "something else"</code> by a submit form. Is it possible?</p> <p>ps: i change <code>$("#query").something</code> to <code>$("#query").whatever</code> to dont confused with the parameter <code>query: "something"</code></p> <p>Actualy i use jquery code from <a href="http://tweet.seaofclouds.com/" rel="nofollow">http://tweet.seaofclouds.com/</a> I want to change the "query" parameter in example 2 as i told before, by a submit form.</p>
jquery
[5]
6,016,995
6,016,996
How to find the course of multiple php-cgi process?
<p>I have a small wordpress blog on local zend server. Recently I felt my PC slow down and I found a lot of php-cgi.exe are running. Some said cron job is the course but I don't have any plugin running cron job. Where can I go to check the log of php-cig process?</p>
php
[2]
5,462,961
5,462,962
On PopupWindowClose, mainpage redirect
<p>I'm working on the following scenario:</p> <ul> <li><p>A button got clicked in main page.</p></li> <li><p>popupWindow show up.</p></li> <li><p>A button got clicked in popupwindow.</p></li> <li><p>The popupwindow would be closed and the mainpage redirect.</p></li> </ul> <p>How to do that?</p>
asp.net
[9]
1,448,865
1,448,866
Problem in TrayIcon Java
<p>Hi I am developing a desktop application. I used TrayIcon to set the icon in tray. But icon is not being set. I even changed the size of image-icon to 16x16. But still not displayed. If anybody could help?</p>
java
[1]
2,132,930
2,132,931
Random card generation
<p>I need to randomly generate three cards from array i have the array of 52 cards names from card1 to card52</p> <pre><code>String rank[]=new String[52]; for(int i=0;i&lt;rank.length;i++) { rank[i]= "card"+i; } </code></pre> <p>Now i need to select three cards from the array and it should not be repetable.</p> <p>can anybody help me. actually i m doing this bt cards are repeting. pls provide me the sollution.</p> <p>Thanks in Advance.</p>
java
[1]
1,279,743
1,279,744
How do I let a user paste an image on a webpage?
<p>I want to give the user possibility to paste an image into a webform. I don't need to display the image, all I need is the image's location.</p> <p>I know it's possible because the guys at CKEditor(and other editors) are doing it. </p> <p>If you go here, <a href="http://ckeditor.com/demo" rel="nofollow">http://ckeditor.com/demo</a> and paste an image you copied and then right click on it and go to image properties you'll see they have the image's address.</p> <p>How can this be done?</p> <p>Thanks</p>
javascript
[3]
2,422,555
2,422,556
Accessing Android Files and Database Directly on the device if rooted?
<p>When developing for Android I prefer just working with a real device plugged in most of the time since the Android emulators are such total garbage. The one pain point is when I want to access files and sqlite databases though. I believe with the adb shell it is possible to pull the database across, but this isn't a very convenient process.</p> <p>I'm wondering if there are any tools on the market that allow you to see the database in real time, even if it requires rooting a device I'm open to it.</p>
android
[4]
1,895,247
1,895,248
simplest way to create an extension function using Jquery
<p>What is the simplest way to create an extension function or method using Jquery. I am finding it really difficult to create my own property using Jquery.</p> <pre><code>e.g $("#selector").myproperty({para1:val1}); </code></pre>
jquery
[5]
5,235,790
5,235,791
ASP.NET 4.0 on Windows Server 2003 64-bit
<p>Is there a step by step guide on how to enable .NET 4 on IIS 6 running under Windows Server 2003 64bit?</p> <p>Thank you</p>
asp.net
[9]
736,627
736,628
Hide Div on Window Maximize & Resize > 1600px - JQuery
<p>How would I hide a HTML div when the browser window is either maximized or resized greater then 1600px using jquery?</p> <p>I currently have it set so the div hides when the page is greater then 1600px on load but cannot get it to hide when the window is maximized or resized after the page has loaded. Below is the code I have used:</p> <pre><code>if ($(window).width() &gt; 1600) { $('#next').hide(); $('#back').hide(); } </code></pre> <p>Any help would be greatly appreciated.</p> <pre><code>$(window).bind('resize', function(){ if ($(window).width() &gt; 1600) { $('#next').fadeOut(); } else { $('#next').fadeIn(); } }); </code></pre>
jquery
[5]
5,047,310
5,047,311
Javascript - Strategy Pattern suggestion required
<p>I have a Javascript form validator function something like</p> <pre><code> switch (element.getAttribute('validationtype')) { case 'text': if (cic.visible(element)) { if (cic.getValue(element).strip() == "") { errors.push(element.getAttribute('validationmsg')); element.style.border = "1px solid #B23232"; } else { element.style.border = "1px solid #CAD5DE"; } } break; case 'textarea': if (element.value.strip() == "") { errors.push(element.getAttribute('validationmsg')); } break; case 'email': if (!cic.isEmail(cic.getValue(element))) { errors.push(element.getAttribute('validationmsg')); element.style.border = "1px solid #B23232"; } else { element.style.border = "1px solid #CAD5DE"; }; break; case 'numeric': if (cic.getValue(element).strip() == "" || isNaN(cic.getValue(element).replace(',', '.'))) { errors.push(element.getAttribute('validationmsg')); element.style.border = "1px solid #B23232"; } else { element.style.border = "1px solid #CAD5DE"; }; break; } </code></pre> <p>Everytime I need a new validation type I have to change the function. What should be the best way to organize this function as a class, so that it is closed to change.</p>
javascript
[3]
4,961,383
4,961,384
read text from file and apply some operations on it
<p>I have a problem on how to read text from file and perform operations on it for example</p> <p>i have this text file that include</p> <p>//name-//sex---------//birth //m1//m2//m3</p> <pre><code>fofo, male, 1986, 67, 68, 69 momo, male, 1986, 99, 98, 100 Habs, female, 1988, 99, 100, 87 toto, male, 1989, 67, 68, 69 lolo, female, 1990, 89, 80, 87 soso, female, 1988, 99, 100, 83 </code></pre> <p>now i know how to read line by line till i reach null .</p> <p>but this time I want later to perform and average function to get the average of the first colume of numbers m1</p> <p>and then get the average of m1 for females only and for males only</p> <p>and some other operations that i can do no problem</p> <p><hr /></p> <p>I need help i don't know how to get it what i have in mind is to read each line in the text file and put it in a string then split the string (str.Split(','); ) but how to get the m1 record on each string I'm really confused should i use regex to get the integers ? should i use an array 2d? I'm totally lost, any ideas? </p> <p>please if u can improve any ideas by a code sample that will be great and a kindness initiation from u.</p> <p>and after i done it i will post it for you guys to check.</p> <p>{ as a girl I Think I made the wrong decision to join the IT community :-( }</p>
c#
[0]
2,609,718
2,609,719
php delete multiple images from directory
<p>for some reason my php script doesn't delete multiple images, it just delete the thumbnail image then leaves the second one in the directory.</p> <pre><code>if($_POST['pic_id']){ $pic_id = $_POST['pic_id']; $pic_id = mysql_escape_String($pic_id); # Select photo details from database $query = mysql_query("SELECT * FROM gallery WHERE id='$pic_id'"); $queryCount = mysql_num_rows($query); if($queryCount&gt;0){ #Get the fields while($row = mysql_fetch_array($query)){ $image= $row["image"]; $thumbnail = $row["thumbnail"]; } # Unlink thumb source //Delete the thumbnail photo from directory $pic1 = ("$image"); if (file_exists($pic1)) { unlink($pic1); } # Unlink resize source //Delete the big photo from directory $pic2 = ("$thumbnail"); if (file_exists($pic2)) { unlink($pic2); } # Delete the row from the database $sqlTable2 = mysql_query("DELETE FROM gallery WHERE id='$pic_id'"); } else { exit(); } } </code></pre> <p>Been trying for days to get it working, any ideas appreciated. </p>
php
[2]
676,763
676,764
site is auto including some thing from other site
<p>my site is automatically getting download from other site when ever i try to open my site after opening my site it trys to download any thing from this address....</p> <p>google-sk.pch.com.tagged-com.superore.ru</p> <p>please help me what's going on....</p>
php
[2]
2,695,619
2,695,620
How to make android:background="?android:attr/selectableItemBackground work in API level 8
<p>I have a button code, where in i dont want border for this button, so for that i set propertie <code>"android:background="?android:attr/selectableItemBackground"</code>, but it will not work in API version 8 i.e in Froyo emulator. Please provide me the alternatives.</p> <pre><code>&lt;Button android:id="@+id/serviceContactNumber" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignBottom="@+id/icon" android:layout_alignLeft="@+id/serviceName" android:gravity="center_vertical" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:freezesText="true" android:textSize="30dip" android:background="?android:attr/selectableItemBackground"/&gt; </code></pre> <p>Thanks in advance.</p>
android
[4]
329,724
329,725
how to calculate current age of person from birthdate to current date?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1116123/how-do-i-calculate-someones-age-in-java">How do I calculate someone&#39;s age in Java?</a> </p> </blockquote> <p>hi friends</p> <p>i want to calculate total age of any registered person from birthdate to current date ...i want to count total years and month and days in between birtdate and current date..</p> <p>for example=birthdate=8th feb 2008 currentdate=8th april2011 so i want answer is =3 years ,2 months</p>
android
[4]
5,803,655
5,803,656
call function on iframe mouse move
<p>I have a function that i need to call on iframe mousemove(). But i didnt found anything like we have in body tag We have <code>&lt;body mousemove="Function()"&gt;</code> Do we have anything like this for iframe??</p>
javascript
[3]
4,070,772
4,070,773
Game Programming Library C++
<p>Which is the best available, free, easy-to-learn game programming library for C++?</p>
c++
[6]
2,250,199
2,250,200
Why does my original object get affected after I "copied" it to a new object?
<p>I have this (sub)object called <code>products.original</code>.</p> <p>which I then extract to a new object called <code>productArray</code>:</p> <pre><code>var productArray = []; productArray = products.original; /*some calculations here*/ //sort the object by lowest score productArray.sort(function(a, b) {return a.score - b.score;}); </code></pre> <p>Finally, I extract the first three cells in <code>productArray</code> to a third object called <code>resultArray</code>:</p> <pre><code>var resultArray= []; resultArray = productArray.splice(0,3); </code></pre> <p>To my surprise, this reduces the length of <code>products.original</code> by 3 (the splice). Why? And what do I do to hinder this? Thanks in advance.</p>
javascript
[3]
494,532
494,533
How to set different images alternately in listView's row?
<p>I have a listview, in which I am fetching data from Twitter, I also show it in listView, but I want to show different images in different rows of listView.</p> <p>I used <code>convert-view.setBackGroundResource(R.drawable.strip1);</code>, it repeats this image in all rows, but I want to set it alternatively. How is it possible?</p>
android
[4]
4,814,713
4,814,714
Finding class source in android project (LinkedBlockingDeque)
<p>I'm looking for a class source added to the android sdk in version 9. The class is "LinkedBlockingDeque". I thought the android source was located at <a href="http://android.git.kernel.org/" rel="nofollow">http://android.git.kernel.org/</a>, but that site seems to be down at the moment. How do you go about finding the source for a particular class?</p> <p>Thank you</p>
android
[4]
4,099,971
4,099,972
Kill another application in android?
<p>I am try to kill my another application. But this code is not able to kill my another application. I know kill another application is a bad idea. But I have learning purpose, I have tried to kill. My code part<br/></p> <pre><code>Button runningApp = (Button) findViewById(R.id.runningApp); runningApp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String nameOfProcess = "com.example.filepath"; ActivityManager manager = (ActivityManager)ApplicationActivity.this.getSystemService(Context.ACTIVITY_SERVICE); List&lt;ActivityManager.RunningAppProcessInfo&gt; listOfProcesses = manager.getRunningAppProcesses(); for (ActivityManager.RunningAppProcessInfo process : listOfProcesses) { if (process.processName.contains(nameOfProcess)) { Log.e("Proccess" , process.processName + " : " + process.pid); android.os.Process.killProcess(process.pid); android.os.Process.sendSignal(process.pid, android.os.Process.SIGNAL_KILL); manager.killBackgroundProcesses(process.processName); break; } } } }); </code></pre> <p>I have added Permissions are</p> <p><code>&lt;uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" /&gt;</code><br/> <code>&lt;uses-permission android:name="android.permission.GET_TASKS" /&gt;</code></p> <p>Every time I can see the Log cat, the particular application is running in the background. Where i am mistaken. Guide me. Thanks.</p>
android
[4]
3,814,555
3,814,556
How can i create encrypt method like md5
<p>Please, any suggestion how to create encrypt method like md5 </p> <pre><code>$pass = "abc"; $password = xyz($pass); </code></pre> <p>Above method i want to create it myself like md5 method</p> <p>Please any help me, how can i create it. </p>
php
[2]
5,997,040
5,997,041
Substring text with javascript including html tags
<p>i wanted to substring a string something like follow. And i have start position and length of the string . i have checked this ques <a href="http://stackoverflow.com/questions/6003271/substring-text-with-html-tags-in-javascript">Substring text with html tags in javascript</a>. But in this substring is performing from 0 but i have a random start position. Any idea about how it will done</p> <pre><code>var str = 'Lorem ipsum &lt;p&gt;dolor &lt;strong&gt;sit&lt;/strong&gt; amet&lt;/p&gt;, consectetur adipiscing elit.' </code></pre> <p>var tem=str.substr(13,2);</p> <p>now the answer should be <code>&lt;p&gt;ol&lt;/p&gt;</code></p>
javascript
[3]