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
2,909,600
2,909,601
Override document.location.href is it possible in javascript?
<p>Is it possible to override somehow document.location.href ? </p> <p>need override getter, ex.: alert(document.location.href); should return lets say "www.example.com" while real document location is www.stackoverflow.com...</p> <p>don't know is it possible..</p>
javascript
[3]
4,600,890
4,600,891
PHP:Check duplicate values in all nested array
<p>I would like to find out a duplicate value in the all nested arrays within an array. At the moment my array is something like that.</p> <pre><code>Array $bigarray = Array ( [431] =&gt; Array ( [0] =&gt; orange [1] =&gt; apple [2] =&gt; pine ) [440] =&gt; Array ( [0] =&gt; orange [1] =&gt; lilly ) [444] =&gt; Array ( [0] =&gt; orange [1] =&gt; pine ) ) </code></pre> <p>I would like to extract only <code>orange</code> which is in all</p> <pre><code>arrays('431','440','444'). </code></pre> <p>Woudl you give me some idea...? Thanks in advance.</p>
php
[2]
5,753,789
5,753,790
removing value from the list
<p>I have a query I have a Map like this</p> <pre><code> Map ppvValidatedinfo = new HashMap&lt;String, List&lt;String&gt;&gt;(); </code></pre> <p>and it contains the value like this </p> <pre><code> 1 22 23 24 25 </code></pre> <p>so 1 is the key(patient id) and the values(scriptinfo) are 22,23,24,25</p> <p>Now I am getting this value from back end as shown below</p> <pre><code>String ScriptInfo = ((IItemPluRx)item).getScriptInfo(); </code></pre> <blockquote> <p>Now suppose the value of the script info is 24</p> </blockquote> <p>I want to know whether in my Map in the values section that is in list, does it contain 24 and if it contains then I want to remove it from list please advise how to achieve it</p>
java
[1]
78,937
78,938
Android Remote Service without aidl?
<p>Is it possible to write Remote Service in Android without aidl ? If yes - is it better to use then aidl?</p>
android
[4]
2,907,958
2,907,959
How do I specify an assembly file name for a compiled ASP.NET application?
<p>I have read under: Compiling Web Application Projects (http://msdn.microsoft.com/en-us/library/aa983464.aspx)</p> <p>... this compilation model creates a single assembly, you can specify attributes, such as assembly name and version.</p> <p>You can supply a PATH (directory name only) in the Visual Studio "Build Options". </p> <p>But where can the file name for the assembly be specified?</p>
asp.net
[9]
3,780,453
3,780,454
Htm page to Aspx page
<p>I have an htm page.There i have a link Moreinfo.When we click that link it will go to aspx page.Means here the link Moreinfo <a href="http://localhost/akki/akki/b/reg.aspx" rel="nofollow">More Info...</a> when we click that link it has to go reg.aspx.But its not going,,error is shopwing page not found</p> <p>Means In my project,i have index.htm.From this page when i click Moreinfo link,,it has to go reg.aspx..How i can go..I copied this proj from my collegue</p> <p>Nothing is working .both index.htm and reg.aspx are in same site 'b'</p>
asp.net
[9]
1,823,899
1,823,900
how to sent parameter to another activity when recieve sms
<p>how to sent parameter to another activity after recive sms i try but its show error</p> <p>The method putExtra(String, boolean) in the type Intent is not applicable for the arguments (Bundle)</p> <p>below os my code public class SmsReceiver extends BroadcastReceiver {</p> <pre><code>@Override public void onReceive(Context context, Intent intent) { //---get the SMS message passed in--- Bundle bundle = intent.getExtras(); SmsMessage[] msgs = null; String str = ""; if (bundle != null) { //---retrieve the SMS message received--- Object[] pdus = (Object[]) bundle.get("pdus"); msgs = new SmsMessage[pdus.length]; for (int i=0; i&lt;msgs.length; i++){ msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]); str += msgs[i].getMessageBody().toString(); } Intent l = new Intent(context,AgAppMenu.class); Bundle bundle2 = new Bundle(); bundle.putString("msg", str); l.putExtra(bundle); l.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(l); Toast.makeText(context, "SucessFull Login", Toast.LENGTH_SHORT).show(); </code></pre>
android
[4]
4,891,301
4,891,302
What is dInspect and how can I use it?
<p>I am very interested in @Sebastián Grignoli 's answer to <a href="http://stackoverflow.com/questions/255312/how-to-get-a-variable-name-as-a-string-in-php">this question</a> but, when I try to execute it, I get <code>Fatal error: Class 'dInspect' not found</code>.</p> <p>Can anyone tell me how to rectify this? Thanks.</p>
php
[2]
3,894,143
3,894,144
String Split and FileSystemEventArgs argument usage in C#
<p>In some scenario, I need to call FileWatcher onDelete function in my application. The below code works as expected. Please let let me know if there any better way to do this.</p> <pre><code> string path = @"C:\File\Test"; string part1, part2; part1 = path.Substring(0, 3); //C:\\ part2 = path.Substring(3 // File\Test var fseArgs = new FileSystemEventArgs(WatcherChangeTypes.Deleted, part1, part2); onDeleted(path,fseArgs); //FileWacther Delete method </code></pre>
c#
[0]
579,246
579,247
what does ":" stands for, in a for function
<p>i have this code, and i would like to know what the ":" mean in the function</p> <pre><code>Element[][] grid = readFile(); for (Element[] ea : grid) { for (Element e : ea) System.out.print(e.getChar()); System.out.println(); </code></pre>
java
[1]
1,288,497
1,288,498
ASP.NET 2.0 not handling static files under IIS 7
<p>We recently migrated from IIS 6 on windows 2003 server to IIS 7 on windows 2008 server. Our applications are using ASP.NET Framework 2.0 and a custom Forms Authentication module.</p> <p>The issue that we have is that ASP.NET is handling native ASP.NET file types (ex .aspx), but not static files (images, documents, pdf’s, etc). So when a user accesses our site, they get prompted to login. But if they access a file directly, they do not get prompted to login, and are served the file. This is a primary concern where we have a restricted folder under the root folder. The root is not secured, but the restricted folder is, and we have links to documents on the home page directly to files in that folder (you can see now how the users are accessing the files directly).</p> <p>Our site is set up to use Classic Mode as described in the following article. We have followed the instructions, but our static files are still not secured.</p> <p><a href="http://learn.iis.net/page.aspx/508/wildcard-script-mapping-and-iis-integrated-pipeline/" rel="nofollow">http://learn.iis.net/page.aspx/508/wildcard-script-mapping-and-iis-integrated-pipeline/</a></p> <p>Please note: This procedure does work on our local computers (Windows 7, IIS7). But when performing the exact same steps on our servers, we are not getting prompted to log in for static files. </p>
asp.net
[9]
5,518,526
5,518,527
c# function inside lock(obj)
<p>For the example below, will the lock be release before i++ is executed? In otherwords will the lock be released when a function is called inside a lock?</p> <pre><code>lock (lockerobject /*which is static*/) { call2anotherFunction(); i++; } </code></pre>
c#
[0]
3,486,357
3,486,358
writing a single line of a file in C++ into two different arrays
<p>suppose a text file has 11001100 11001101</p> <p>and i open the text file and take the input from the file as pt[0]=11001100, pt[1]=11001101..</p> <p>but if i take the input from file as in>>pt it wont put it in two different arrays which is obvious but it takes the whole line . Thus I have to take another for loop and traverse through the whole string and when I find a null character i start putting into the second array . But how can I do it without putting it into a variable and traversing .. I mean directly from the file itself .. </p>
c++
[6]
1,043,092
1,043,093
Java - Call the main class (this) when i'm am into a method
<p>I don't know how to do this (yes sorry, should be a must to know maybe). It would be easy to explain with an example :</p> <pre><code>public class PageMenuLogin extends Container { public PageMenuLogin() { final ITextField login_user = this.createTextField(); login_user.setName(""); final ITextField login_pass = this.createTextField(); login_pass.setName(""); final IButton button = this.createButton(); button.setLabel("Login"); button.setActionHandler(new IActionHandler() { public ClientActions onAction() throws Exception { // I NEED TO UPDATE THE CONTAINER ITSELF HERE. // HOW CAN I CALL "this"? return null; } }); } } </code></pre> <p>As you can see in the example, i need to call the "this" when i'm into that method. I think everybody in java but markzzz know how to do this :)</p>
java
[1]
4,564,112
4,564,113
Is there other way to reference grandParent object in javascript
<p>I have following code:</p> <pre><code>var objectParent:{ child1:{ test1:function(){}, test2:function(){} }, child2:{ demo1:function(){}, demo2:function(){}, parent:this // gives child2 grandparent: .... // need to reference objectParent here } } </code></pre> <p>We can reference object by using <strong>this</strong> keyword, But what for grand object or i mean parent of parent object?</p> <p>Now, i am using <strong>grandparent:objectParent</strong> to reference parent object</p> <p>Is there other way like <strong>this</strong> selector to reference parentObject?</p> <p>Are these my coding is bad,good or better?</p>
javascript
[3]
5,916,545
5,916,546
need help converting anonymous usort function
<p>I recently started hosting a website on 000webhost which doesn't support PHP 5.3 and kept getting the unexpected T_FUNCTION error at the first usort function in this file.</p> <pre><code>&lt;?php $cityXML = simplexml_load_file("http://build.uitdatabank.be/lib/1.2/city.xml"); $regionXML = simplexml_load_file("http://build.uitdatabank.be/lib/1.2/region.xml"); $headingXML = simplexml_load_file("http://build.uitdatabank.be/lib/1.2/heading.xml"); $cities = array(); foreach($cityXML-&gt;city as $city) { $cities[]=$city; } usort($cities, function($a, $b) { return strcmp($a['city'], $b['city']); }); $regions = array(); foreach($regionXML-&gt;region as $region) { $regions[]=$region; } usort($regions, function($a, $b) { return strcmp($a['title'], $b['title']); }); $headings = array(); foreach($headingXML-&gt;heading as $heading) { $headings[]=$heading; } usort($headings, function($a, $b) { return strcmp($a['title'], $b['title']); }); ?&gt; </code></pre> <p>I believe it's something to do with the fact that this is an anonymous function and therefore doesn't run on an older version of PHP.</p> <p>I've looked into using create_function() to help convert it but can't for the life of me figure out how to do it. Can you guys help?</p>
php
[2]
255,467
255,468
jquery use a datepicker on more pages
<p>I have this in my javascript file:</p> <pre><code>$("#birthdate").datepicker({ changeMonth: true, changeYear: true, altFormat: 'dd-mm-yy', altField: '#birthdate', }); </code></pre> <p>I have various pages which have fields that need a datepicker. Sometimes even more then one datepicker on a page. How can I be sure that this is also going to work for a field that has for example class name "alternateDate"?</p> <p>I tried </p> <pre><code> $("#birthdate #alternateDate").datepicker({ </code></pre> <p>But that's not going to work. </p> <p>Any idea's?</p> <p><strong>Update:</strong></p> <p>Hmm still got a problem with the date format.</p> <pre><code>$.datepicker.formatDate('dd-mm-yy'); $(".datepicker").datepicker({ changeMonth: true, changeYear: true, }); </code></pre> <p>Here is my html</p> <pre><code>&lt;label for="geboortedatum"&gt;Geboortedatum &lt;em&gt;*&lt;/em&gt;&lt;/label&gt;&lt;br/&gt;&lt;input type="text" class="datepicker" id="birthdate" name="birthdate" value="{$birthdate}"&gt;&lt;br/&gt; </code></pre> <p>But the format in the datepicker input field is still shown as 04/01/2009</p> <p>meaning mm/dd/yy</p> <p>Any idea's?</p>
jquery
[5]
1,051,178
1,051,179
ScheduledThreadPoolExecutor scheduleWithFixedDelay and "urgent" execution
<p>I have the following problem that the standard library doesn't solve well, and I'm wondering if anybody has seen another library out there than can do it so I don't need to hack together a custom solution. I have a task that is currently scheduled on a thread pool using scheduleWithFixedDelay(), and I need to modify the code to handle requests for "urgent" execution of the task related to asynchronous events. Thus, if the task is scheduled to occur with a delay of 5 minutes between executions, and an event occurs 2 minutes after the last completed execution, I would like to execute the task immediately and then have it wait for 5 minutes after the completion of the urgent execution before it runs again. Right now the best solution that I can come up with is to have the event handler call cancel() on the ScheduledFuture object returned by scheduleWithFixedDelay() and execute the task immediately, and then set a flag in the task to tell it to reschedule itself with the same delay parameters. Is this functionality available already and I'm just missing something in the documentation?</p>
java
[1]
4,083,833
4,083,834
make notification when clicking app bring to front
<p>I want make a notification, that when clicked on it will bring my app from the background to the front. I am using the following code:</p> <pre><code>NotificationManager noma = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); PendingIntent pen = PendingIntent.getActivity(Timer.this, 0, intent, 0); intent.putExtra("key", "trigerred"); String body = "This is a message"; String title = "This is title"; Notification no = new Notification(R.drawable.ic_launcher, body, System.currentTimeMillis()); no.defaults = Notification.DEFAULT_ALL; no.setLatestEventInfo(this, title, body, pen); noma.notify(uniqueID, no); </code></pre> <p>When I click on the notification that makes a new intent but I want the last created intent brought to the front. How i can do this?</p>
android
[4]
5,084,774
5,084,775
What happens to Activities/Services when phone goes to sleep/standby mode?
<p>What happens to android application and activities and services that belongs to application when the phone/AP goes to sleep mode?Will the framework destroy Activities and Services and OS kills the process?</p>
android
[4]
4,353,373
4,353,374
unexpected comma error message
<p>I don't understand why I am getting the following error:</p> <blockquote> <p>[Sun Apr 10 21:29:31 2011] [error] [client 127.0.0.1] PHP Parse error: syntax error, unexpected ',' in /var/www/pay_registration_fee.php on line 105, referer: <a href="http://localhost/pay_registration_fee.php" rel="nofollow">http://localhost/pay_registration_fee.php</a></p> </blockquote> <p>line 105 is:</p> <pre><code>$STH-&gt;bindParam( ':users_id', $users_id), PDO::PARAM_INT, 1 ); </code></pre> <p>users_id is:</p> <pre><code>$users_id = $_SESSION['LoggedIn']; </code></pre> <p>$_SESSION['LoggedIn'] is:</p> <p>1</p>
php
[2]
2,187,638
2,187,639
edit codes in php.ini in share hosting
<p>Can anyone tell me how I can access to the php.ini file, when I use shared hosting ,, I tried to create a new php.ini to put on the root of website (because I just read depends on the server, maybe can override)</p> <p>anyway, It didn't work for me, how can I add some codes to php.ini while I don't have access to this file directly and I use share hosting.</p>
php
[2]
2,048,876
2,048,877
How Send fax from Android device
<p>I need to write an activity tht should open Fax screen in Android Application.</p>
android
[4]
5,239,200
5,239,201
C++ getline and gcount
<p>Suppose I have an <code>std::istream</code> pointing to the following contents (the line break is a <code>'\n'</code> character):</p> <pre><code>12345678 9 </code></pre> <p>and run the following code:</p> <pre><code>std::istream &amp; is = ... char buff[9]; is.getline(buff, 9); int n = is.gcount(); </code></pre> <p>Now <code>n == 8</code> and <code>strcmp(buff, "12345678") == 0</code>. The question is, how do I know that I read the entire line instead of some of the line?</p> <p>If the steam instead points to the following contents:</p> <pre><code>123456789 0 </code></pre> <p>and the same code is executed, I am still on the same line. How do I differentiate between these two cases?</p>
c++
[6]
1,462,481
1,462,482
PHP: switch() default for all?
<p>I have this:</p> <pre><code>case true: echo '&lt;textarea rows="2" cols="35" name="message_friend" id="message_friend"&gt;&lt;/textarea&gt;'; break; default: echo '&lt;textarea rows="2" cols="35" name="message_friend" id="message_friend" readonly="readonly"&gt;&lt;/textarea&gt;'; break; </code></pre> <p>I am trying to ONLY if it's true, then show normal else do READONLY.</p> <p>The switch is checking from a function</p> <pre><code>switch( ( check_friend_state($showU["id"], 'friend') ) ) </code></pre> <p>And I tried to echo the function, and it returned err2 and not true, so why does it run true?</p> <p>I also tried if/else</p> <pre><code>if(check_friend_state($showU["id"], 'friend') == true){ echo '&lt;textarea rows="2" cols="35" name="message_friend" id="message_friend"&gt;&lt;/textarea&gt;'; }else{ echo '&lt;textarea rows="2" cols="35" name="message_friend" id="message_friend" readonly="readonly"&gt;&lt;/textarea&gt;'; } </code></pre> <p>But as said previously it returns "err2" and still it runs true?</p> <p>My function at the return:</p> <pre><code>if($USER == $uID){ // not yourself return "err1"; }elseif( $checkIsFriend-&gt;rowCount() == 1 ){ // already friends return "err2"; }elseif( $checkAlready-&gt;rowCount() == 1 ){ // already send a request return "err3"; }elseif( $checkBlock-&gt;rowCount() == 1 ){ // blocked return "err4"; }else{ return true; } </code></pre>
php
[2]
5,438,442
5,438,443
Getting decimals from python math function?
<p>I'm a bit new to python and can't seem to figure out what I'm doing wrong.</p> <pre><code>a = 9 b = 13 print ((a-b)/a) -1 </code></pre> <p>But on my calculator, the correct answer is -0.444444444 (meaning 'a' is about 45% lower than 'b'). How can I get a few decimals to show up?</p> <p>I tried </p> <pre><code>print Decimal((a-b)/a) print float((a-b)/a) </code></pre> <p>both with the same result. it works if I make a = 9.0 but I wanted to see if there was anything I can do without changing the variables. </p> <p>I'm sure this is super easy but I'm not sure what to try. Any suggestions?</p> <p>Thanks</p>
python
[7]
2,863,610
2,863,611
Download servlet throwing java heap space exception
<p>I have a search function in which i am returning all the records of the entities to a user on searh button , now matter how much the records are(right now, it is able to search 50,000 records). now i am trying to download all these records in a csv .if the records are less, then its working fine , but when its more than 30,000, it is throwing </p> <p>Edited:-</p> <p>Solution:- used these lines of code </p> <pre><code> InputStream in = new ByteArrayInputStream(buffer.toString().getBytes("UTF-8")); ServletOutputStream out = response.getOutputStream(); byte[] outputByte = new byte[4096]; while(in.read(outputByte, 0, 4096) != -1) { out.write(outputByte, 0, 4096); } in.close(); out.flush(); out.close();*/ </code></pre>
java
[1]
3,804,725
3,804,726
jQuery Post Success
<p>Hey everbody, im getting some trouble here.</p> <p>When span gets clicked, it sends to a php some data, deleteing from my MySQL something. OK! This is fine. Working.</p> <p>But, when i try to set to jquery hide or fade out a element for me, inside the post action, he doesnt hides it.</p> <p>But when i set it out of POST action, it works. Why?</p> <pre><code>$('.deletar span').click(function() { //alert($(this).attr('id')); var id = $(this).attr('id'); $(this).parent().parent().find('.carregando').show(); $(this).parent().parent().fadeOut(); /*$.post('deletar.php',{id: id}, function(data){ //$(this).parent().parent().find('.carregando').hide(); //$.parent().parent().parent().text('haha'); alert($(this).parent().parent().find('.carregando')); $(this).parent().parent().find('.carregando').fadeOut(); });*/ }); </code></pre> <p>Thanks!</p>
jquery
[5]
1,517,527
1,517,528
Why does my MP3 play in Android's Music app but not using MediaController?
<p>I have an MP3 audio file that I want to play from my Android app. I am using MediaController and VideoView like the answer to question <a href="http://stackoverflow.com/questions/2961749">2961749</a>. I get the error "Sorry this video cannot be played." But if I copy the file to /Music on my sd card, I can play it with the Music player app on Android. I've also tried just using MediaPlayer and it has a similar error.</p> <p>Any ideas why this would be? And, an anyone tell me what I need to do to play the audio?</p> <p>Here's my code:</p> <pre><code>setContentView(R.layout.reading_layout); topicGraphic = (ImageView) findViewById(R.id.topic_graphic); videoView = (VideoView) findViewById(R.id.video_view); Uri uri = Uri.parse("/sdcard/audio/mainidea.mp3"); mediaController = new MediaController(this); mediaController.setAnchorView(videoView); videoView.setMediaController(mediaController); videoView.setVideoURI(uri); videoView.start(); </code></pre>
android
[4]
5,290,812
5,290,813
Cant understand what this refers to
<p>Can anybody elaborate below in <code>innerF</code>, what does <code>this</code> refer to? <code>User</code> or <code>innerF</code>?</p> <pre><code>function User(){ this.id = 1; }; User.prototype.sayHi = function(){ var innerF = function(){ this.id = 2; // "this" refers to User or innerF ? }; return innerF; }; </code></pre> <p>Also does the <code>new</code> keyword or <em>anonymous</em> function has to do with changing reference of <code>this</code> keyword?</p> <p>What if I call it all like this:</p> <pre><code>var u = User; var f = u.sayHi(); f(); </code></pre> <p>Or</p> <pre><code>var u = new User; var f = u.sayHi(); f(); </code></pre> <p>Thanks</p>
javascript
[3]
4,562,904
4,562,905
Android: runtime OnClickListener does not work
<p>I'm developing an app for Android devices using Eclipse and Android SDK; I would like to add some ImageButtons (at runtime) with the same OnClickListener. The problem is that the OnClickListener works ONLY for the first added button. For all the next buttons the onClick event simply doesn't fire.</p> <p>Have someone already encountered (and solved) this problem?</p> <pre><code>public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) { ImageButton myButton= new ImageButton(this); myButton.setMaxHeight(140); myButton.setMaxWidth(140); myButton.setPadding(0, 0, 0, 0); myButton.setAdjustViewBounds(true); myButton.setImageResource(resId); myButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub } }); myRelativeLayout.addView(myButton, 0); } </code></pre>
android
[4]
3,822,656
3,822,657
default value of parameter as result of instance method
<p>I would like to initialize method parameter by some default value, if explicit value was not passing in the method. Something like this:</p> <pre><code>class Example def __init__(self, data = self.default_data()): self.data = data def default_data(): # .... return something </code></pre> <p>But I get the error:</p> <pre><code>NameError: name 'self' is not defined </code></pre> <p>How can I fix it?</p>
python
[7]
3,689,212
3,689,213
how to know updated , deleted code in contact list using contact observer?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5996921/how-do-i-make-my-android-contentobserver-for-contactscontract-detect-a-added-up">How do I make my Android ContentObserver for ContactsContract detect a added, updated or deleted contact?</a> </p> </blockquote> <p>// i have use contact observer it works but i am not able to know the exact contact that has been updated or deleted. // i just want to know how to acknowledge the updated contact. // i have use Uri that works but cant fetch id and deleted contact.</p> <pre><code> public class ContactObserver extends ContentObserver{ public static String id=null; public static String flag=null; Context mContext; Uri lookupUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, ContactsContract.Contacts._ID); public ContactObserver(Handler h,Context context) { super(h); mContext = context; } public boolean deliverSelfNotifications() { return true; } public void onChange(boolean selfChange) { final String[] projection = new String[] {RawContacts._ID, RawContacts.DELETED,}; Cursor curval = mContext.getApplicationContext().getContentResolver().query(RawContacts.CONTENT_URI, projection, null, null,null); if(curval!=null) { if(curval.moveToNext()) { id = curval.getString(curval.getColumnIndex(RawContacts.Entity._ID)); flag = curval.getString(curval.getColumnIndex(RawContacts.DELETED)); } } } } </code></pre>
android
[4]
1,566,826
1,566,827
Join txt files side by side in python
<p>I have 2 arrays of data in txt files:</p> <blockquote> <p>A1 A2 A3<br> A4 A5 A6<br> A7 A8 A9</p> </blockquote> <p>and</p> <blockquote> <p>B1 B2 B3<br> B4 B5 B6<br> B7 B8 B9</p> </blockquote> <p>I would like to combine them side by side:</p> <blockquote> <p>A1 A2 A3 B1 B2 B3<br> A4 A5 A6 B4 B5 B6<br> A7 A8 A9 B7 B8 B9 </p> </blockquote> <p>(The spaces are actually tabs in my txt files)</p> <p>Thank you!</p>
python
[7]
2,418,861
2,418,862
generic method to create an instance from an object
<p>Is this a safe way to create an instance (assuming T has a accessible default constructor) ?</p> <pre><code>&lt;T&gt; public T defaultObj(T obj) throws Exception { return (T) obj.getClass().newInstance(); } </code></pre> <p>Because of the type erasure, the above codes will generate an unchecked warning. Is it possible to get rid of this warning other than @SuppressWarnings?</p> <p>Many thanks in advance!</p> <p><strong>Edit:</strong> Yes, I know if I could pass a <code>class&lt;T&gt; type</code> which would be much better. But let's just assume it is out of question for now.</p>
java
[1]
5,569,793
5,569,794
Can i put buttons on Toast message in Android?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3308975/android-button-in-custom-toast">Android : Button in custom Toast</a> </p> </blockquote> <p>HI,i have create toast message,now i want to create buttons on it,please give suggestions to achieve it...</p>
android
[4]
4,840,487
4,840,488
Check that integer type belongs to enum member
<p>I want to check that some integer type belongs to (an) enumeration member.</p> <p>For Example,</p> <pre><code>public enum Enum1 { member1 = 4, member2 = 5, member3 = 9, member4 = 0 } </code></pre> <p>Enum1 e1 = (Enum1)4 gives me member1</p> <p>Enum1 e2 = (Enum1)10 gives me nothing and I want to check it.</p>
c#
[0]
4,551,752
4,551,753
Shortcut for method parameter
<p>I was wondering if there was a way to do something like this in Python:</p> <pre><code>some_method(param1="param1", param2 = somevar or None) </code></pre> <p>I want to pass the param2 if somevar is set, or None if it isn't. Basically I am looking for a shorter way of doing this:</p> <pre><code>if somevar is None: some_method(param1="param1") else: some_method(param1="param1", param2=somevar) </code></pre>
python
[7]
124,150
124,151
How do I scroll to a expanded div inside a scrollable div with jquery?
<p>I made a sort of a custom accordion, and nested it inside a parent div with <code>overflow</code> set to <code>scroll</code>, now whenever an item in that accordion is expanded(<code>slideDown(200)</code>), I need the div to scroll properly to fit that entire item within the div. that is, if the bottom of the expanded item is below the view of the scrollable div, I need it to scroll till the bottom is within view. any ideas?</p>
jquery
[5]
1,180,453
1,180,454
Dimming option menu/android
<p>Okay, so I have an option menu for my current app and it is the same with every class. okay, so I would like to know how to dim the options that are included in the menu when the selected class is already selected. For example, I have the Main Home on my option menu. When I am at the Main Home screen...it does appear on the option menu to click. How in the heck do you dim this? I tried looking on the android development page..but had no luck.. yet, I see it on other apps and it is driving me crazy! Surely, I am sure it is easy to mark the code out..but how can you do it! it is driving be bananas!</p> <p><a href="http://developer.android.com/guide/practices/ui_guidelines/menu_design.html#dim_hide_menu_items" rel="nofollow">http://developer.android.com/guide/practices/ui_guidelines/menu_design.html#dim_hide_menu_items</a></p>
android
[4]
2,773,489
2,773,490
How to Handle networkonmainthreadexception in Andoid?
<p>I have following 2 class</p> <pre><code>class CallNetworkMethod extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected Void doInBackground(Void... params) { if (TwitterUtils.isAuthenticated(prefs)) { sendTweet(); } else { Intent i = new Intent(getApplicationContext(), TwPrepareRequestTokenActivity.class); i.putExtra("tweet_msg",getTweetMsg()); startActivity(i); } return null; } @Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub super.onPostExecute(result); //updateLoginStatus(); loginStatus.setText("Logged into Twitter : " + TwitterUtils.isAuthenticated(prefs)); } } </code></pre> <p>====================================================</p> <pre><code>public class TwitterUtils { static ArrayList&lt;String&gt; friens=null; public static boolean isAuthenticated(SharedPreferences prefs) { String token = prefs.getString(OAuth.OAUTH_TOKEN, ""); String secret = prefs.getString(OAuth.OAUTH_TOKEN_SECRET, ""); AccessToken a = new AccessToken(token,secret); Twitter twitter = new TwitterFactory().getInstance(); twitter.setOAuthConsumer(TwConstants.CONSUMER_KEY, TwConstants.CONSUMER_SECRET); twitter.setOAuthAccessToken(a); try { **twitter.getAccountSettings();** return true; } catch (TwitterException e) { return false; } } } </code></pre> <p>I got the exception when running this code(networkonmainthreadexception).I debug this code and found the location where exception come out. It is <strong>twitter.getAccountSettings();</strong> .I think this method should run inside a AsynTask but i dont know how to do that.</p>
android
[4]
4,936,783
4,936,784
Export operation from specific calendar
<p>there is an open source calendar called DayPilot open source . (you can reach from <a href="http://www.daypilot.org/" rel="nofollow">http://www.daypilot.org/</a>)</p> <p>I want to export the data to excel from calendar <a href="http://www.daypilot.org/demo/Calendar/" rel="nofollow">http://www.daypilot.org/demo/Calendar/</a> (you can see the demo)</p> <p>But I could not. Have you got any idea?</p> <p>I use C# and MSSQL for data.</p>
c#
[0]
2,869,529
2,869,530
android programming
<p>every one, I'm preparing a game on android,consisting of 6 game levels which have over ridden ,and overloaded methods in it.... Untill Gamelevel3 everything was fine,but in gamelevel4 I'm using the same methods which I have used before in gamelevel 1,2 &amp; 3,but it's giving an error that I can't use the same method's name ,defined earlier in my gamelevels. The weird thing is in gamelevel 5 again I'm using the same methods and redefining them as per my requirements and there it's all right, no issues with the method names... I don't understand this weird behaviour... I'm using Eclipse helios... Help.. </p>
android
[4]
559,882
559,883
Javascript: getElementById() wildcard
<p>I got a div, and there i got some childnodes in undefined levels.</p> <p>Now I have to change the ID of every element into one div. How to realize?</p> <p>I thought, because they have upgoing IDs, so if the parent is id='path_test_maindiv' then the next downer would be 'path_test_maindiv_child', and therefore I thought, I'd solve that by wildcards, for example:</p> <pre><code>document.getElementById('path_test_*') </code></pre> <p>Is this possible? Or are there any other ways?</p>
javascript
[3]
176,578
176,579
PHP PDO + copy out Array
<p>I have a PDO Query that returns what appears to be an array $pds. I can loop through this array as follows:</p> <pre><code>foreach ($pds as $row) { } </code></pre> <p>I need to loop through the same array a second time but when I do this there doesn't appear to be any data in the array. Also I've tried to copy the array as follows:</p> <pre><code> $pds2 = $pds; </code></pre> <p>Is there a trick I'm missing to use this array twice?</p> <p>thx</p> <p>Code:</p> <pre><code> // Remove Duplicate Locations where words are in a different order $cityArray = $pds; foreach ($cityArray as $data) { $words = explode(' ', $data['city'] . ' ' . $data['region1'] . ' ' . $data['region2'] . ' ' . $data['region3']); sort($words); $cityWordsArray[$data['id']] = implode(' ', $words); } $cityWordsArray = array_unique($cityWordsArray); foreach ($pds as $row) { echo 'hi'; foreach($cityWordsArray as $key=&gt;$value) { if($row['id'] == $key) { </code></pre>
php
[2]
1,227,865
1,227,866
C# Collection was modified; enumeration operation may not execute
<pre><code>List&lt;String&gt; employeeTimings; public string[] sTime = {"0000", "0030", "0100", "0130", "0200", "0230", "0300", "0330", "0400", "0430", "0500", "0530", "0600", "0630", "0700", "0730", "0800", "0830", "0900", "0930", "1000", "1030", "1100", "1130", "1200", "1230", "1300", "1330", "1400", "1430", "1500", "1530", "1600", "1630", "1700", "1730", "1800", "1830", "1900", "1930", "2000", "2030", "2100", "2130", "2200", "2230", "2300", "2330"}; employeeTimings = new List&lt;String&gt;(sTime); int i=0; DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Location", typeof(string))); dt.Columns.Add(new DataColumn("Station", typeof(string))); foreach (DataColumn dc in dt.Columns) { dt.Columns.Add(employeeTimings[i], typeof(string)); i++; } SchedulingTableDGV.DataSource = dt; </code></pre> <p>i get an error "Collection was modified; enumeration operation may not execute." how can i solve this?</p>
c#
[0]
637,576
637,577
how can we call a method in super class from subclass's subclass?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/586363/why-is-super-super-method-not-allowed-in-java">Why is super.super.method(); not allowed in Java?</a> </p> </blockquote> <p>In the following code I have done inheritance. Now I want to call the method in one from class <code>Exp</code>. I want to implement this without creating an object of <code>One</code> in <code>Exp</code> </p> <pre><code>class One { public void calculate (int x) { System.out.println("the square value is"+(x*x)); } } class Two extends One { public void calculate (int x) { super.calculate(x); System.out.println("the cube value is"+(x*x*x)); } } public class Exp extends Two { public void calculate (int x) { System.out.println("the forth value is"+(x*x*x*x)); super.calculate(x); } public static void main(String[] args) { Exp a = new Exp(); a.calculate(2); } } </code></pre>
java
[1]
2,344,260
2,344,261
Asp.net 3.0 and 64 bit sqlite dll file
<p>Greetings!</p> <p>I am developing Asp.net application, in which i need to use sqlite as database, i tried to add reference to 64 bit dll file System.Data.SQlite file. When i run my application it shows as below error Error 1 Could not load file or assembly 'SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format. </p> <p>What will be the reason for this, and how can i fix this.I am using visual studio 2010.</p> <p>Thanks in advance sangita</p>
asp.net
[9]
2,635,442
2,635,443
PHP script being interrupted at random time
<p>I have a php script that does a lot of stuff, produces a lot of output and can take a few minutes to complete.</p> <p>I have already placed a set_time_limit(999999) at the beginning.</p> <p>Before that, it obviously exceeded the time limit of 30 seconds and got interrupted. When that happened, a fatal error was logged indicating just that.</p> <p>Now, from the browser I call that script, I observe as the browser receive the output from the script almost in real time, but at a random point, the script just is interrupted. It does <em>not</em> exceed the time limit (obviously), and NO ERROR at all is logged. Actually, if I try it a second time it gets interrupted at a different point.</p> <p>The question is, if no error is encountered, and the time limit is not reached, what else can cause the script to be interrupted? Perhaps a disconnection from the client (browser) due to timeout? (not timeout waiting for data, though, as data is constantly being output). Perhaps the browser may have a maximum size for an html page? </p> <p>But if it's one of these two cases, how comes this is not logged as an error?</p>
php
[2]
4,283,733
4,283,734
Combine 3 strings into one
<p>I've been trying to combine 3 strings into one and having trouble doing so.</p> <p>the strings are below.</p> <pre><code>$from="/2/3/4/5/6/"; $to="/30/31/32/33/34/"; $sub="/2/3/4/5/6/7/8/9/10/11/12/";#this is dynamic, ever changing past &gt; (/2/3/4/5/6/) </code></pre> <p>the output must look like this below.</p> <pre><code>$output="/30/31/32/33/34/6/7/8/9/10/11/12/"; </code></pre> <p>else if <code>$sub</code> changes like below then.</p> <pre><code>$from="/2/3/4/5/6/"; $to="/30/31/32/33/34/"; $sub="/2/3/4/5/6/7/8/"; $output="/30/31/32/33/34/6/7/8/"; </code></pre> <p>and else if <code>$to</code> changes then this.</p> <pre><code>$from="/2/3/4/5/6/"; $to="/30/31/"; $sub="/2/3/4/5/6/7/8/"; $output="/30/31/6/7/8/"; </code></pre> <p>the <code>$to</code> needs to be first, then the <code>$sub</code> at the end, minus the <code>$from</code> before the end <code>/*/(eg./6/)</code> to be combined into 1 string.</p> <p>how is this possible?</p>
php
[2]
3,470,643
3,470,644
How to make sure the program is running for long time and not shut down by the system?
<p>To be more specific, in my app there are recorder and accelerometer running in 2 services to record sleep cycle, and I need to make sure these 2 components stay up all night long (8 hours for example), how do I make sure they will not be killed or shut by the android system itself? Although I doubt it will, because they are not memory/CPU intensive anyway, but just in case if this really happen. </p>
android
[4]
629,553
629,554
How to use Proximity Alerts to trigger a Notification?
<p>Is it possible?<br> I mean when I get close some specific place,I get a Notification.<br> Proximity Alerts will fire a Intent,but I don't know how to start a Notification with a Intent.<br> Someting like Intent(String action) and IntentFilter?</p>
android
[4]
1,824,843
1,824,844
Android: How can i put an image as a point style in a line graph?
<p>I have a line graph in which i need to put an image as a point style. How can i do that? Please help me?</p>
android
[4]
2,700,455
2,700,456
Respak database connection with PHP
<p>How to connect with Respak database from PHP. I need to insert a user in respak database if it is not already existing there..</p> <p>Is there any documentation available for this ? I didnt find anything in internet.</p>
php
[2]
3,970,064
3,970,065
Assign a value to a struct value-type
<p>I want to be able to create a struct, and use it like a normal built-in. For example, say I decide that the Bool should also have a FileNotFound value (as a silly example!), so I create a struct to include that - what would it take to be able to use it as a normal struct in code (ie. assign to it), as in bool b = true; or b = FileNotFound;</p> <p>The Bool is a struct, right? And you can do it with the other built-ins: int i = 32; or byte b = 123;</p> <p>I want to do my own! Anyone got any ideas...?</p> <p>Cheers - Richard</p>
c#
[0]
1,678,894
1,678,895
where can I find 'pkunzip.cpp and pkunzip.h"?
<p>somewhere, I found a simple source to read something, and that source includes "PkunZip.cpp" and "Pkunzip.h" to read zip-file.</p> <p>However, I could not find the website about PkunZip.cpp ( sourceforge or codeproject etc ).</p> <p>where can I find the website that describe 'pkunzip.cpp' and a manual about it?</p>
c++
[6]
4,762,901
4,762,902
jQuery effect goes once but I need it to recur
<p>I'm using .fadeIn and .fadeOut and can get the effect to happen once, the problem is getting it to happen each time the link is moused over. I've tried dripping in .deQueue() and .stop() to no avail. (newb here, so please be patient and thorough in your explanation - much is still over my head)</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; p { position:relative; width:400px; height:90px; } div { position:fixed; padding-top:25px; top:300px; left:300px; display:none; } span { display:none; } &lt;/style&gt; &lt;script type="text/javascript" src="jQuery.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a href="#"&gt;MouseOver!&lt;/a&gt; &lt;h3&gt;&lt;div&gt;&lt;span&gt;Sample Text&lt;/span&gt;&lt;/div&gt;&lt;/h3&gt; &lt;script&gt; $("a").mouseover(function () { $("div").fadeIn(0, function () { $("span").fadeIn(3000); }); return false; }); $("a").mouseout(function () { $("h3").fadeOut(3000); }); &lt;/script&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
jquery
[5]
1,307,305
1,307,306
Is it legal to write code like C#?
<p>Example:</p> <p>H</p> <pre><code>class MyClass { int x,y,z; public: MyClass(int,int,int); void X(); void Y(); void Z(); }; </code></pre> <p>CPP</p> <pre><code>class MyClass { int x,y,z; public: MyClass(int x,int y,int z) { this-&gt;x=x; this-&gt;y=y; this-&gt;z=z; } void X() { printf("x = %d;\n",x); } void Y() { printf("y = %d;\n",y); } void Z() { printf("z = %d;\n",z); } }; </code></pre> <p>Make it C#-like. Don't include the header, re-declare the class in the CPP but with method-bodies. When file include the header then he gets the extern fields\methods and etc from CPP.</p> <p>It's legal? I can't predict problems from it. There is?</p>
c++
[6]
2,450,971
2,450,972
locking the object inside a property, c#
<pre><code>public ArrayList InputBuffer { get { lock (this.in_buffer) { return this.in_buffer; } } } </code></pre> <p>is this.in_buffer locked during a call to InputBuffer.Clear?</p> <p>or does the property simply lock the in_buffer object while it's getting the reference to it; the lock exits, and then that reference is used to Clear?</p>
c#
[0]
5,173,142
5,173,143
Post on facebook wall without any dialogs from an android app?
<p>I would like to post on the facebook wall from android app.But I don't want any dialog boxes to come up.</p> <p>(1)The user login prompts should also be prevented.I will be storing the username and password in shared Preferences.Is there some way to pass the user id and password so that authentication happens without the dialogs.</p> <p>(2)It should just post the content on wall and return a response message so that i can display on the screen as "Post Successful".</p> <p>Can you let me know what all things that i have mentioned above are possible and how it can be done.I would be good if someone can provide links which explains the concepts and It would be even better if someone could post a bit of code.</p> <p>P.S:I have already gone through <a href="http://stackoverflow.com/questions/4213767/how-to-post-on-facebook-wall-using-facebook-android-sdk-without-opening-dialog-b">How to post on facebook wall using Facebook android SDK, without opening dialog box</a> but it doesn't mention anything of user login prompt and frankly haven't quiet grasped the entire thing.</p>
android
[4]
3,727,922
3,727,923
Displaying divs using JQuery in sequence
<p>I am trying to display 3 divs one after another. I want them to be displayed in the sequence 1,2,3,1,2,3,.... and so on..</p> <p>This is the code I am using</p> <pre><code>//Initially setting the divs to be hidden $(document).ready(function(e) { $(".1").css("visibility","hidden"); $(".2").css("visibility","hidden"); $(".3").css("visibility","hidden"); myFun(); }); var x=1; function myFun(){ switch(x) { case 1: $(".3").css("visibility","hidden"); $(".2").css("visibility","hidden"); $(".1").css("visibility","visible"); x++; break; case 2: $(".1").css("visibility","hidden"); $(".3").css("visibility","hidden"); $(".2").css("visibility","visible"); x++; break; case 3: $(".1").css("visibility","hidden"); $(".2").css("visibility","hidden"); $(".3").css("visibility","visible"); x=1; break; } //this might be wrong $(this).delay(1000,myFun()); } </code></pre> <p>This displays the three divs but without delay. How do I go about giving delays and calling the same function again. Is there a better way to do that.</p>
jquery
[5]
3,367,189
3,367,190
web form in mvc, jquery and ajax
<p>Struggling with this issue:</p> <p>I have a form filled out and submit the form. Once I click on the browser's back button I get to the original pre-filled form, but noticed a field isnt populated anymore.</p> <p>Can we retain information/data on a form using the browser's back button ?</p> <p>Or is this a jqeruy limitation ?</p> <p>Any ideas come in handy, Thanks</p>
jquery
[5]
1,124,409
1,124,410
How to Merge calls using android api
<p>I am building an android app for quick conference call. User should be able to conference a list of three numbers by click of one button. So programatically i want to call each number and once the other person picks up i want to merge the calls. </p> <p>In the program I call the first person using Intent.CALL_ACTION , wait till the call is connected then put the user on hold. Then do the same for the second number. Now when second call is connected i want to merge it with the first call.</p> <p>Are there any android apis which can do the call merge?</p> <p>-Thanks Srao</p>
android
[4]
867,199
867,200
Why is the rowIndex property of a jQuery returned element.parents("tr") row undefined?
<p>If i get a reference to an elements parent as follows:</p> <pre><code>function findParentRow(srcElement) { var curElement = srcElement; while (curElement &amp;&amp; (curElement.tagName != "TR")) { curElement = curElement.parentElement; } return (curElement.tagName == 'TR' ? curElement : null); } </code></pre> <p>I can:</p> <pre><code>var parentRow = findParentRow(someElement); alert(parentRow.rowIndex); </code></pre> <p>and I will get a rowIndex alert. But if i:</p> <pre><code>var parentRow = $(chkBox).parents("tr"); </code></pre> <p>I can </p> <pre><code>alert(parentRow); </code></pre> <p>and get an object but if i </p> <pre><code>alert(parentRow.rowIndex); </code></pre> <p>I get undefined. Instead i have too:</p> <pre><code>alert($(pRow).attr("rowIndex")); </code></pre> <p>to get an index. </p> <p>Why is this?</p>
jquery
[5]
847,760
847,761
JavaScript and 'this' inside immediately executed functions
<p>I have been reading up on the intricacies of 'this' in JavaScript. Given this code:</p> <pre><code>$(document).ready(function() { console.dir(this); (function foo() { console.dir(this); })(); }); </code></pre> <p>In Chrome, the console shows the first 'this' as an 'HTMLDocument' (as I expected), but the second 'this' is 'undefined'. Can someone point me to a good explanation of why?</p>
javascript
[3]
554,987
554,988
File Download dialogue is not displayed when we download a file
<pre><code>&lt;asp:HyperLink ID="Download" runat="server" NavigateUrl="~/ExcelFile.xls" TabIndex="1"&gt;Click to download Excel File&lt;/asp:HyperLink&gt; </code></pre> <p>I am using the above hyper link in my application to allow the users to download an Excel file.When I click on the hyperlink button it is displaying a file download dialogue box, but when I do the same thing in the server it is opening the Excel file as a web page.</p> <p>What would be the reason for this issue?</p> <p>Please help.</p>
asp.net
[9]
920,439
920,440
scrollToRowAtIndexPath scroll inside the header section
<p>When I use the indexpath.row = 0 ,it is working fine and showing below the header</p> <p>But when I use the indexpath.row =1 , the row 1 will move inside the header section of the table view .</p> <p>Please help me , i want the first row should be hidden at lauch .</p> <p>[alltweettableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];</p>
iphone
[8]
2,607,514
2,607,515
fiscal year related leave calculation
<p>i'm creating a webpage showing the quarterly leaves available for an employee in a company. There is a dropdownlist for selecting the quarter of a financial year(April 1 to March 31).Dropdown contains the 4 quarters present in the corresponding ongoing finacial year(ie.for the 2012-2013 fiscal year,the dropdown list shows:</p> <ul> <li>1/April/2012-30/June/2012(* 1st quarter) </li> <li>1/July/2012-30/September/2012(* 2nd quarter) </li> <li>1/October/2012-31/December/2012(* 3rd quarter) </li> <li>1/January/2013-31/March/2013(* 4th quarter)) </li> </ul> <p>when i select 1st quarter it shows the casual leave, sick leave, earned leave of the logged in employee in instantly creating textboxes.casual leave and sick leave added are constant for each quarter.but earned leave is different.earned leave calculated by toalworkedday in that quarter divided by 20.(ie,totalworkeddayinpreviousquarter/20).The quotient is earned leave and the reminder is the balance day.And the balance day is added with the next quarter's worked day when we selecting that quarter.and it continues in each quarters. I need to get the balance day value of each quarter after earned leave calculation of that quarter,in that page in hidden mode.</p> <p>How can i implement it?</p>
c#
[0]
4,197,633
4,197,634
DHL Rate calculation
<p>In my website(php based) I want implement a rate calculator of DHL. I want to add 3 fields-1.Origin, 2.Destination and 3.Weight. These 3 values will be sent to DHL server and in return I want to have the RATE. How can I do that? </p> <p>In another section, I will add more field (address, product hts code, etc.) with those 3 to get the RATE. How can it be done also??</p>
php
[2]
5,834,203
5,834,204
Custom Uninstalling menu android
<p>I have an android app that's related to security. </p> <p>My need is authenticate user before uninstallation. ie; if anyone tries to uninstall my app it pops up a window and read some password/id or something and if its valid uninstallation proceeds else not.</p> <p>I have root access</p>
android
[4]
996,996
996,997
Setting the file and Video permission... so, as to use the content only by the application
<p>How can we accomplished the task to avoid copy paste and read the content that we store in sdcard or phone memory, only my application can use it. Thank you for your concern.</p>
android
[4]
717,332
717,333
network programming in python
<p>how do i run a python program that is received by a client from server without writing it into a new python file?</p>
python
[7]
600,248
600,249
Highlight current url in menu ith jquery
<p>I have a menu but I want to highlight current link with jquery. </p> <pre><code>var loc = window.location; var lochref = $("#topNavigation li a").attr("href"); if(lochref == loc){ $('#topNavigation li a').addClass('currenthover'); } </code></pre> <p>With above script, there is no any change in "a" class. How can I do this with jquery? Thanks in advance</p>
jquery
[5]
125,389
125,390
Java Pointer vs C# IntPtr
<p>Hi have to use a dll. In Java we use this :</p> <pre><code>Public interface CLibrary extends Library { CLibrary INSTANCE = (CLibrary) Native.loadLibrary("are32.dll", CLibrary.class); Pointer ENCRYPT(String a, int ai, String b, int bi); } ... Pointer ptr1 = CLibrary.INSTANCE.ENCRYPT("TEST",5,"TEST",5); for (int i=0;i&lt;6;i++) System.out.println((ptr1.getByte(i)&amp; 0xFF)); </code></pre> <p>Can you help me to find the equivalent in C# please? I used IntPtr but I can't find a ReadByte like Java.</p> <pre><code> [DllImport("are32.dll",)] public static extern IntPtr ENCRYPT(string p1, int p2, string p3, int p4); ... var retPtr = ENCRYPT("TEST", 5, "TEST", 5); </code></pre> <p>How Can I <code>ReadByte</code> from <code>retPtr</code>? <code>IntPtr</code> is it equals to <code>Pointer</code>?</p> <p>Thanks for your help</p>
c#
[0]
5,894,954
5,894,955
java class initialization explanation
<p>I kind of new to java and will be happy if anybody could explain the following code samples to me.This is just a sample java code snippet for illustration. But the main question is that if the class Learn initializes another class Smart with a parameter which is also a class Object , then the addition of the dot class to the class Object Sample is kind of confusing to me. Any explanation will be appreciated. I apologize if it is a basic question. thanks.</p> <pre><code>class Learn { //some codes Smart smart = new Smart(Sample.class); //some codes } </code></pre>
java
[1]
287,963
287,964
functionality of void operator()()
<p>I am confused about the functionality of void operator()(),</p> <p>could you tell me about that, for instance:</p> <pre><code>class background_task { public: void operator()() const { do_something(); do_something_else(); } }; background_task f; std::thread my_thread(f); </code></pre> <p>Here, why need operator()()? what is the meaning of the first and second ()? Actually I know the operation of normal operator, but this operator is confusing.</p>
c++
[6]
791,722
791,723
Python: interrupt execution with key and run again
<p>how can I interrupt python execution with a key and continue to run when the key is pressed again ?</p> <p>thanks</p>
python
[7]
1,108,080
1,108,081
How do you edit text messages/urls on HTC Desire
<p>So I've been asked this question by another developer in work and I couldn't figure it out. Now having a Desire myself, how the hell do you edit a text message that you are composing? The same for a URL you may have made a typo in? On the iPhone you would hold down on the area where you want to edit and a little zoom bubble would appear and the cursor would be where you want it allowing you to retype. Can this even be done on Android devices?</p>
android
[4]
535,533
535,534
What does *array[] mean?
<p>What does this mean? I see it all the time in programs and I don't get it:</p> <pre><code>int *array[9]; </code></pre> <p>Why is the asterisk there. What is the difference between this declaration and this:</p> <pre><code>int array[9]; </code></pre>
c++
[6]
3,310,750
3,310,751
Android BitmapFactory.decodeStream(...) doesn't load HTTPS URL on emulator
<p>App doesn't load an Image from an HTTPS URL when run on the emulator. </p> <p>Sample code:</p> <pre><code>URL url = new URL("https://someserver.com/photo.jpg"); mImageView.setImageBitmap(BitmapFactory.decodeStream(url.openStream())); </code></pre> <p>The image loads just fine when run on an actual device. Also the emulator loads the image if it's accessed via HTTP instead of HTTPS.</p> <p>Am I doing something wrong or is this a known issue?</p>
android
[4]
1,073,307
1,073,308
var myFunction = function() {}; vs fuction myFunction() {};
<p>What do you think, which one is the better, faster, nicer solution to declare a function?</p> <p>First:</p> <pre><code>(var) myFunction = function(){ //Stuff to do }; </code></pre> <p>or Second:</p> <pre><code>function myFunction() { //Stuff to do }; </code></pre> <p>Both will work in JavaScript and JQuery. But what do you think is better?</p> <p>Regards</p>
javascript
[3]
5,803,223
5,803,224
Click asp link button manually which have added attribute "onclick"
<p>anyone have idea to fire click event of link button on code behind in any user define function. this link button have added "onclick" Attributes on load event. </p> <p>eg </p> <pre><code>lbAddPayment.Attributes["onclick"] = "return OnClickAddPaymentDetail(event, 'Paid');"; </code></pre> <p>I want to fire event in void type of method. Meanse I want to fire click event manually</p>
c#
[0]
1,162,572
1,162,573
Intent <data> definition - host, pathPrefix?
<p>I'm trying to capture a url like the following in an intent:</p> <pre><code>https://example.com/apple/orange?key=value </code></pre> <p>I've got the following, but it doesn't seem to work:</p> <pre><code>&lt;activity&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;data android:scheme="https" android:host="example.com" android:pathPrefix="/apple/orange.*" /&gt; ... </code></pre> <p>how should I modify this so the url gets captured?</p> <p>Thanks</p>
android
[4]
1,248,044
1,248,045
Can I make it so when I select in a select box the title is updated using jQuery?
<p>I have:</p> <pre><code>&lt;select name="TopicID" id="TopicID"&gt; &lt;option value="00"&gt;XX&lt;/option&gt; &lt;option value="02"&gt;YY&lt;/option&gt; &lt;/select&gt; </code></pre> <p>How can I make it so that when a user selects a new value such as "YY" that the title of the select gets updated like this:</p> <pre><code>&lt;select title="YY" name="TopicID" id="TopicID"&gt; &lt;option value="00"&gt;XX&lt;/option&gt; &lt;option value="02"&gt;YY&lt;/option&gt; &lt;/select&gt; </code></pre>
jquery
[5]
746,472
746,473
A strange print function bug
<p>I'm working on a InterviewStreet problem <a href="https://www.interviewstreet.com/challenges/dashboard/#problem/4fcf919f11817" rel="nofollow">https://www.interviewstreet.com/challenges/dashboard/#problem/4fcf919f11817</a>, the algorithm is correct but I still get several wrong answers, after several hours I find the problem is related with a print function:</p> <pre><code>void printHalf(int64_t x) { if (x % 2 == 0) printf("%lld\n", x / 2L); else printf("%lld.5\n", x / 2L); } </code></pre> <p>This function takes a 64-bit integer, and print its half. If I change this function to the following code, my solution works on all test cases:</p> <pre><code>void printHalf(int64_t x) { if (x % 2 == 0) printf("%lld\n", x / 2L); else printf("%.1f\n", x / 2.0); } </code></pre> <p>It looks a little weird to me, since in my opinion the two functions have the same results.</p>
c++
[6]
1,749,195
1,749,196
Adding empty point C# charts
<p>I'm using C# charts to display/compare some data. I changed the graph scale to logarithmic (as my data points have huge differences) but since logarithmic scaling doesn't support zero values, I want to just add an empty point (or skip a data point) for such cases. I have tried the following but non works and all crashes:</p> <pre><code>if(//the point is zero){ // myChart.Series["mySeries"].Points.AddY(null); // or // myChart.Series["mySeries"].Points.AddY(); // or just skip the point } </code></pre> <p>Is it possible to add an empty point or just skip a point??</p>
c#
[0]
4,293,135
4,293,136
What does it mean when you pass a variable={} into a function?
<p>What does something like this achieve?</p> <pre><code>function myFunction(foo, bar={}, boo){ //? } </code></pre>
javascript
[3]
453,011
453,012
Build an extension system for my android application
<p>I'm trying to build an extension system for my application, basically to add different protocols in it (facebook and twitter connection for example) and be able to configure them from my main application. I want it to be pretty similar to how dolphin browser extensions work. But I haven't any idea how to start it. Do anyone have any interesting links or suggestions about the conception and the technical part ? I don't know where to start. </p> <p>Thanks </p>
android
[4]
3,685,699
3,685,700
Design of android activity
<p>Alice has to answer three questions. After she answered the questions she gets a dialog that lists the question and answers and there's a button to save the answers to a database.</p> <p>At the moment I think that the design should be three classes: Master, Question, Summary.</p> <p>Master calls Question with an intent that includes the question text of question 1. After Alice inputs her answer the Question returns the answer to master via an intent.</p> <p>Repeat two times.</p> <p>Then Master does processing of the questions and calls Summary via an intent.</p> <p>Is this kind of design recommendable in Android? Is it possible to have such an Master activity. If so, how can I allow a running master activity to listen to intents?</p>
android
[4]
1,491,308
1,491,309
php error on basic php
<p>Im trying to do the following but keep getting a error.</p> <pre><code>&lt;?php echo '&lt;a href="'javascript:toggle5'" id.'imageDivLink'('profilebar', 'imageDivLink');"&gt;' .$USER-&gt;firstname.' '.$USER-&gt;lastname.'&lt;/a&gt;'; ?&gt; </code></pre>
php
[2]
4,932,465
4,932,466
What is the difference between Dispose and setting reference to null in C#?
<p>I have two code samples and I want to know what is the deifference between them and which is better to use as best practice and performance wise:</p> <pre><code>using (TestForm test = new TestForm()) { test.ShowDialog(); } </code></pre> <p>and the other is:</p> <pre><code>TestForm test = null; try { test = new TestForm(); test.ShowDialog(); } catch(Exception ex) { } finally { test = null; } </code></pre>
c#
[0]
5,908,966
5,908,967
Class instance declaration in C++
<p>Let's say I have ClientList class and I have declared like this.</p> <pre><code>class ChatMgr { private: ClientList _userlist; ClientList *_userlist; } </code></pre> <p>Then what is the difference? I know that the second one is the address of the instance and I need to initialize it using new to use it. Then for the first one, can I just access to the all the data members inside of the class without initializing it?</p> <p>Thanks in advance....</p>
c++
[6]
1,720,673
1,720,674
anybody recommend several html or dom parsers in php with good performance?
<p>anybody recommend several html or dom parsers in php with good performance?</p>
php
[2]
1,044,400
1,044,401
$("#MyForm").submit(function () { Does not work in IE8 but FireFox 8?
<pre><code>$(document).ready(function () { $("#MyForm").submit(function () { alert("Hello"); return true; }); }); </code></pre> <p>Hi, I have a very simple code above, when I submit the form in IE8 nothing happens, but it works fine in FireFox 8.</p> <p>I am using jQuery 1.5.1. So is it a problem from old version of jQuery?</p>
jquery
[5]
540,881
540,882
PHP validation for registration form
<p>I have the problem I created a registration form and given database connection and database field values to enter the values in table. Here I am able to enter all field values in tables. If the field is empty, the empty value is entered, so I need to validate the registration form. If user enters empty value it should show the errors. If all the fields entered then only then should the data be submitted to the database. I also need to show if user already exists or not.</p>
php
[2]
4,656,293
4,656,294
Non-object when adding code into html
<p>I am getting the following error:</p> <blockquote> <p>Fatal error: Call to a member function error() on a non-object in /home/gamepla3/public_html/football/result.php on line 177</p> </blockquote> <p>The line for this is</p> <pre><code>&lt;?php echo $form-&gt;error("homescore"); ?&gt; </code></pre> <p>I'm failing to see how this could be the case? The thing worked fine before I added working code into my html document so it looked better.</p> <p>Now I can't get it working??</p> <p>EDIT. When the code is not within HTML, it works fine. Once I have it within the HTML, it throws back an error? Has anyone seen anything like this before?</p>
php
[2]
1,999,768
1,999,769
Padding bars remain when scrolling GridView
<p>I have this <code>GridView</code> (see screenshot) that contains items that all need about 12 dip spacing. However, when I set padding on the <code>GridView</code>, it seems that I can't scroll across this paddingm which I do want to do. How do I achieve this?</p> <p>Note the slice of space above the top two pictures that I want to scroll away from:</p> <p><img src="http://i.stack.imgur.com/ry2ZN.png" alt="screenshot while scrolling"></p> <p>Code:</p> <pre><code>&lt;GridView android:id="@+id/feed_grid" android:layout_width="fill_parent" android:layout_height="wrap_content" android:columnWidth="96dp" android:gravity="center" android:horizontalSpacing="@dimen/grid_view_margins" android:numColumns="auto_fit" android:padding="@dimen/grid_view_margins" android:stretchMode="columnWidth" android:scrollbarStyle="outsideInset" android:verticalSpacing="@dimen/grid_view_margins" /&gt; </code></pre>
android
[4]
1,249,574
1,249,575
C++ - avoiding the implicit inlining of a function defined in the class definition
<p>In my implementation files (.cc files), I often find that it's convenient to define member functions in class definitions (such as the functions of a Pimpl class). For example:</p> <pre><code>struct X::Impl { void DoSomething() { ... } }; </code></pre> <p>instead of</p> <pre><code>struct X::Impl { void DoSomething(); }; void X::Impl::DoSomething() { ... } </code></pre> <p>I think this is preferable to implementing the function outside of the class definition for several reasons. It enhances readability and facilitates the practice of keeping methods small (by making it easy to add them). The code is also easier to maintain since you never have to update method declarations.</p> <p>The only downside I see is that methods defined in the class declaration are implicitly inlined, which is not usually desirable because of the increase in the size of the object code.</p> <p>My questions are:</p> <ol> <li><p>Do I have this right? Are there other downsides to this practice that I'm missing?</p></li> <li><p>Is the implicit inlining something to worry about? Is the compiler smart enough to reject my implicit request to inline methods that shouldn't be inlined?</p></li> <li><p>Is it possible (via compiler extensions or otherwise) to declare that a method defined in the class definition not be inlined?</p></li> </ol>
c++
[6]
5,048,334
5,048,335
std::max - expected an identifier
<p>I'm having a problem with std::max. I can't figure it out.</p> <pre><code>int border = 35; int myInt = 2; int myOtherInt = 3; int z = std::max(myInt + 2 * border, myOtherInt + 2 * border); </code></pre> <p>I've included the algorithm standard header. When I mouse over max, I am getting:</p> <p>Error: expected an identifier</p> <p>And a compile errors of:</p> <p>error C2589: '(' : illegal token on right side of '::' error C2059: syntax error : '::'</p> <p>What is wrong?</p>
c++
[6]
3,953,662
3,953,663
UIButton move animated problem
<p>how to make a UIButton when moving (animated) without shadow? i tried the code but cannot make it can someone modifify or point out the problem</p> <pre><code>-(IBAction)move{ point=CGPointMake(0,1); for(int i=0;i&lt;50;i++){ NSLog(@"fdfafa"); CATransition *animation = [CATransition animation]; [animation setType:@"push"]; [animation setSubtype:@"fromBottom"]; [animation setDuration:0.5]; //[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [testButton.layer addAnimation:animation forKey:kAnimationKey]; testButton.center = CGPointMake(testButton.center.x, testButton.center.y + point.y); } NSLog(@"%f",testButton.center.y); } </code></pre> <p>or have other better method to make a object move animated?</p>
iphone
[8]