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,098,099
1,098,100
What is the different of parentView and superView
<p>I am wondering about the difference between superView and parentView.</p> <p>view.parentView view.superView</p> <p>Do the 2 codes access a same object?</p> <p>Thanks</p> <p>interdev</p>
iphone
[8]
1,858,256
1,858,257
How to open a office documents, pdf files in android?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2883355/how-to-render-pdf-in-android">How to render PDF in Android</a> </p> </blockquote> <p>Does any one know how to open a office documents(.doc,.xls) and pdf files in android? I have open a doc from my own app - any ideas?</p>
android
[4]
787,938
787,939
How can I make my android tablet app to look the same when it runs on phone in landscape mdoe
<p>I have a android app layout for tablet. Its layout is 'landscape' based (i.e. it looks the way i want when I run on tablet (by default landscape).</p> <p>But when I run the same app on a phone, android runs in portrait mode, (it squeeze my 'landscape' layout into a portrait ). </p> <p>I have tried putting 'android:screenOrientation='landscape' in my activity in my Manifest file. But that does not fix it.</p> <p>Basically, what I want is when I rotate the phone by 90 % (the width is > height), I want the phone layout looks the same as what i see on tablet (which is landscape by default).</p> <p>How can I do that? android:screenOrientation='landscape' does not work.</p> <p>Basically, I want some thing the game 'AngryBird', it always runs in landscape mode regardless it is phone or tablet and whether the phone is rotated.</p>
android
[4]
386,134
386,135
Proper way to declare a function in PHP?
<p>I am not really clear about declaring functions in php, so I will give this a try.</p> <pre><code>getselection(); function getselection($selection,$price) { global $getprice; switch($selection) { case1: case 1: echo "You chose lemondew &lt;br /&gt;"; $price=$getprice['lemondew'].'&lt;br&gt;'; echo "The price:".$price; break; </code></pre> <p>Please let me know if I am doing this wrong, I want to do this the correct way; in addition, php.net has examples but they are kind of complex for a newb, I guess when I become proficient I will start using their documentation, thank you for not flaming.</p> <p>Please provide links that might also help me clear this up?</p>
php
[2]
4,787,513
4,787,514
How to get data from a service thats already running?
<p>I have a service that runs once the app starts and I was wondering how can I get data from that service to an activity at anytime without having to restart the service</p>
android
[4]
4,965,690
4,965,691
JavaScript Rendering
<p>Why doesn't this HTML/script (from "Secrets of the JavaScript Ninja") render?</p> <p><a href="http://jsfiddle.net/BCL54/" rel="nofollow">http://jsfiddle.net/BCL54/</a></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; function outer(){ var a = 1; function inner(){ /* does nothing */ } var b = 2; if (a == 1) { var c = 3; } } outer(); assert(true,"some descriptive text"); assert(typeof outer==='function', "outer() is in scope"); assert(typeof inner==='function', "inner() is in scope"); assert(typeof a==='number', "a is in scope"); assert(typeof b==='number', "b is in scope"); assert(typeof c==='number', "c is in scope"); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript
[3]
1,496,536
1,496,537
Where to put functionality of serializing a custom class?
<p>I'm starting to work with the serialization now and I think I got my class serializable after asking <a href="http://stackoverflow.com/questions/15488330/storing-and-retrieving-data-from-an-xml-file">here</a>.</p> <p>Now I wonder if it's regarded a good, bad, depending or indifferent design to place the serialization methods <strong>inside</strong> the said class.</p> <p>Suppose I have my class like this.</p> <pre><code>[XmlRoot("Settings")] public class SerializableClass { public SerializableClass() { } [XmlElement("PropertyOne")] public String PropertyString { get; set; } [XmlElement("PropertyTwo")] public int PropertyInt { get; set; } public Object PropertyObject { get; set; } } </code></pre> <p>Would it make sense to add methods like these, to let the object (de)serialize itself?</p> <pre><code>public String SerializeMe() { XmlSerializer serializer = new XmlSerializer(typeof(SerializableClass)); StringWriter writer = new StringWriter(); serializer.Serialize(writer, this); return writer.ToString(); } public static SerializableClass DeSerialize(String input) { StringReader reader = new StringReader(input); XmlSerializer serializer = new XmlSerializer(SerializableClass); return xmlSerializer.Deserialize(reader) as SerializableClass; } </code></pre> <p>I would, of course, implement these with <em>try-catch</em>, <em>using</em> and some kind of file reader and only specify the path. Is it doable? Recommended? Common? (I've never used serialization implemented by me, so please bear with me if the question seems strange.)</p>
c#
[0]
4,166,242
4,166,243
Modifying App.Config file at the time of installation using c#
<pre><code>&lt;configuration&gt; &lt;configSections&gt; &lt;section name="ADMIN" type="System.Configuration.DictionarySectionHandler"/&gt; &lt;/configSections&gt; &lt;User&gt; &lt;add key="ExtendTime" value="20"/&gt; &lt;add key="Name" value="sss"/&gt; &lt;/User&gt; &lt;configuration&gt; </code></pre> <p>i have to remove first child element in user config section i.e . Reply me if you have any idea for this.</p> <p>i am using </p> <pre><code>Configuration config = ConfigurationManager.OpenExeConfiguration(Context.Parameters["assemblypath"]); ConfigurationSection section = config.GetSection("USER"); </code></pre>
c#
[0]
3,717,974
3,717,975
asp.net tabindex not working
<p>iam using tabindex in asp.net form 2.0in IE, it is not working at all....any idea how to make it right.. your help will be appreciated</p>
asp.net
[9]
2,991,753
2,991,754
Ternary if statement involving php class
<p>Can someone please explain to me the following line of php?</p> <pre><code>($myobjectfunction = object::function('letsgo')) ? eval($myobjectfunction) : false; </code></pre> <p>I understand objects and their functions. Is this php saying if <code>$myobjectfunction</code> is defined then <code>eval $myobjectfunction</code>, otherwise do nothing? Because in the code I am reading, <code>object</code> hasn't yet been defined before this line (sometimes).</p>
php
[2]
464,411
464,412
list.removeall argument null exception not thrown
<p>I have list of type struct in which i temporarily add data and delete them when data is being written either to database or to a file, I am using <code>list.RemoveAll</code> method to remove item from the list.</p> <p>The <code>list.RemoveAll</code> should throw <code>ArgumentNullException</code> if I call it on a list whose count is zero but it is not throwing any exception even if the count is zero.</p> <pre><code> _dataNotWrittenToDb.RemoveAll(item =&gt; item.ScopeId == _a2Data.ScopeId); _dataWrittenToDB.RemoveAll(item =&gt; item.ScopeId == _a2Data.ScopeId); </code></pre>
c#
[0]
877,288
877,289
How to relaunch updated table?
<p>In my application, I fetch contactInfo from address book and this info populate on the tableView. when i check row using checkMark, then data delete and send on server. Left some data, which is unchecked.</p> <p>Now After then I need unchecked data show me on tableView ,whenever i relaunch my application.</p> <p>Thanx</p> <p>Mishti</p>
iphone
[8]
2,594,810
2,594,811
Java path to follow
<p>I finished reading tutorials on Java and doing the sample exercises and I am ready to really get into coding Java, the only problem is I am a bit confused as to what I should do now. What path should I take at this point ? Should I join and start contributing to an open source project ? What suggestions would you give ? I'm not actually interested in something particular so anything will do.</p> <p>For the more advanced programmers, try to put yourself in my position. What would you do now? </p>
java
[1]
427,137
427,138
Is there a C++ lib for eMule protocol just like libtorrent for BT protocol
<p>I want to deploy a project that could simply down some file through the emule protocol. but I couldn't find any lib for emule (Only emule ,but it's hard for me)</p>
c++
[6]
4,575,315
4,575,316
Question about generic function parameter
<p>I'm just wondering why passing a <code>System.Collections.Generic.List&lt;string&gt;</code> into this function <code>test(ICollection&lt;object&gt; t)</code> will not work, why can't I pass it in like passing a <code>string</code> into <code>test2(object t)</code>?</p> <p>Doesn't make much sense to me!</p>
c#
[0]
1,359,097
1,359,098
iPhone-SDK:Call a function in the background?
<p>Is it possible to call my function in the background after certain interval programmatically in iPhone SDK development? I want to call one particular function in the background for certain time intervals(may be every 10 mins) during my app in on running.. </p> <p>Could you please share your ideas.</p> <p>thanks.</p> <p>Clave/</p>
iphone
[8]
2,278,506
2,278,507
Launch custom android application from android browser
<p>Can anybody please guide me regarding how to launch my android application from the android browser? </p>
android
[4]
511,500
511,501
JQuery make image invisible if outside div
<p>I'm trying to create a slider in JQuery. I have two images on top of eachother inside a div. When the right button is pressed I want to make the underlying image start left to it and slide it to the right on top of the other image. I use this code for that:</p> <pre><code>var position = $("#IMAGE1").position(); var width = position.left-1050; $("#IMAGE1").css('left', width); $("#IMAGE1").animate({"left": "+=1050px"}, "slow"); </code></pre> <p>Now I only want the part of the image visible that is INSIDE the div, not when its outside (it would look really sloppy because the div has a border). Question is, how?</p>
jquery
[5]
1,731,136
1,731,137
concat strings in array and other arrays
<p>I have three arrays:</p> <pre><code>htext[i], ptext[i], and ytext[i] </code></pre> <p>I was wondering how I can walk through these arrays and concat the strings stored in htext[i] and then take this glued string and concat it with strings in ptext[i], and ytext[i], while separating each string by a space. Right now they get merged without a space between them.</p>
php
[2]
1,574,652
1,574,653
How to fix auto newline PHP
<pre><code>$LINE = $User.",".$data[$k][10]; echo $LINE; $str=implode("",file('Friends.php')); $fp=fopen('Friends.php','w+'); $str=str_replace($User,$LINE,$str); fwrite($fp,$str,strlen($str)); </code></pre> <p>OK, this code is a bit weird but it just appends to a string of my choice. Out should come:</p> <pre><code>H4cKL0rD,9,1,2,3,4 </code></pre> <p>but when it writes it it outputs into the file as </p> <pre><code>H4cKL0rD,9 ,1,2,3,4 </code></pre> <p>it adds a <code>\n</code></p>
php
[2]
2,273,132
2,273,133
Doing shell backquote in python?
<p>I am translating bash scripts into python for some reasons.</p> <p>Python is more powerfull, nevertheless, it is much more harder to code simple bash code like this :</p> <pre><code>MYVAR = `grep -c myfile` </code></pre> <p>With python I have first to define a backquote function could be : </p> <pre><code>def backquote(cmd,noErrorCode=(0,),output=PIPE,errout=PIPE): p=Popen(cmd, stdout=output, stderr=errout) comm=p.communicate() if p.returncode not in noErrorCode: raise OSError, comm[1] if comm[0]: return comm[0].rstrip().split('\n') </code></pre> <p>That is boring !</p> <p>Is there a Python's flavor (IPython ?) where it is easy to spawn process and get back the output ?</p>
python
[7]
581,671
581,672
Use jQuery to Select Visited Links
<p>I'm trying to select all visited links via jQuery. Here is the HTML</p> <pre><code>&lt;div class="question-summary"&gt; &lt;a class="question-hyperlink"&gt;Stuff&lt;/a&gt; &lt;/div&gt; </code></pre> <p>If <code>question-hyperlink</code> has been visited, I was to select <code>question-summary</code>. Any ideas?</p>
jquery
[5]
2,945,322
2,945,323
Not able to understand the functionality of ToLookup linq extension method
<p>I am trying to figure out the functionality of ToLookup method here in the code.It's using grouping somehow to return a list. Can somebody just tell me how this is working or just guide me in the right direction: </p> <pre><code>.ToLookup( c =&gt; new { c.CoverageType.Code, c.CoverageType.Mnemonic, c.CoverageType.Description, c.CoverageType.CoverageLevel, c.CoverageType.CoveragePosition }) .Select( t =&gt; new CoverageOption { CoverageType = new CoverageType { Code = t.Key.Code, Mnemonic = t.Key.Mnemonic, Description = t.Key.Description, CoverageLevel = t.Key.CoverageLevel, CoveragePosition = t.Key.CoveragePosition }, Limits = (from Coverage c in t select c.Limit).GroupBy(l =&gt; l.Code) .Select(gr =&gt; gr.First()), Deductibles = (from Coverage c in t select c.Deductible).GroupBy(d =&gt; d.Code) .Select(gr =&gt; gr.First()) }) .OrderBy(t =&gt; t.CoverageType.CoveragePosition); </code></pre>
c#
[0]
4,149,840
4,149,841
PHP - preg_match - check if string contains year which is between 1950 and 2010
<p>How do I check with preg_match if string contains year which is between 1950 and 2010 ? </p> <p>example:</p> <p>$string = "I was born in 1986 year.";</p>
php
[2]
1,033,708
1,033,709
Convert date in php
<p>How to convert "Thu Oct 28 16:33:29 +0000 2010 " to like "Oct 28,2010 at 10:33PM"</p>
php
[2]
4,875,024
4,875,025
Execute unknown function name in PHP?
<p>I store a string in a database called "my_function". So to access this string, I'm in scenario where I call:</p> <pre><code>$row-&gt;theFunction </code></pre> <p>Furthermore, I am in a class where this function is define, and can ONLY be called like so:</p> <pre><code>$this-&gt;my_function($param1, $param2); </code></pre> <p>Now, my problem is, I need to execute my_function, using this. This DOES NOT work:</p> <pre><code>call_user_func( '$this-&gt;'.$row-&gt;theFunction, $param1, $param2 ); </code></pre> <p>What am I doing wrong?</p>
php
[2]
5,446,017
5,446,018
if :checked add class to this
<p>I have a small problem. I want to check if a checkbox is checked and if it is checked, I want to add a class to his first brother. HTML :</p> <pre><code> &lt;input class="box" type="checkbox"&gt; &lt;p class="red"&gt;Red text &lt;/p&gt; &lt;input class="box" checked type="checkbox"&gt; &lt;p class="red"&gt;I want this text in blue &lt;/p&gt; </code></pre> <p>JS :</p> <pre><code> if(jQuery(".box").is(":checked")) { jQuery(this).next().attr('class', 'blue'); } </code></pre> <p>Example here : <a href="http://jsfiddle.net/LVEqn/" rel="nofollow">http://jsfiddle.net/LVEqn/</a></p> <p>Thanks in advance !</p>
jquery
[5]
4,575,314
4,575,315
Get ArrayList element by custom text indexing
<p>What I'm doing is storing classes into an ArrayList and retrieve them by its index number. But are there any list classes in Java where I can retrieve a list element by, lets say, its name? Like this:</p> <pre><code>ArrayList&lt;string&gt; myArr = new ArrayList&lt;string&gt;(); myArr.add( "ID_name", "String to store" ); </code></pre> <p>ands then retrieve it by:</p> <pre><code>myArr.get( "ID_name" ); </code></pre> <p>Also, are there any other alternatives to ArrayList? I need a list class to be optimized for:</p> <ul> <li>Random access</li> <li>Only need to push items into the list</li> <li>Never need to delete anything from the list</li> </ul>
java
[1]
4,640,829
4,640,830
PHP URL verification and if not valid fix it
<p>I am trying to verify URLs. This is the code I have:</p> <pre><code>function isValidURL($url) { return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url); } </code></pre> <p>This code is working but now I am trying to work out how to add <code>http://</code> or <code>https://</code> if the URL is correct but is just missing the beginning <code>http://</code></p> <p>Please point me in the right direction.</p>
php
[2]
4,171,348
4,171,349
How do I convert from 8 bit byte to 7 bit byte (Base 256 to Base 128)
<p>How do I convert from 8 bit byte to 7 bit byte (Base 256 to Base 128)</p> <p>I am looking to do something like this:</p> <pre><code>public string BytesToString(byte[] in) { } public byte[] StringToBytes(string in) { } </code></pre> <p>I know base64 is available but it expands a byte array too much.</p>
c#
[0]
3,896,820
3,896,821
call a function, after a dialog box gets dismissed
<p>in my app, when the activity gets launched i am calling an AsynTask to load some details in the page. In between if the user clicks a button, an alert dialog builder used to appear. When the user clicks the Ok button i want the dialog to be dismissed and again i want to call the async task. how to do this.</p> <p>i tried calling the function within the alert box before dismissing the dialog box it gets crashed. </p> <p>and i tried calling the function after the <code>dialog.dismiss()</code> line, but then also the app get crashed.</p> <p>how to do this, pls help me friends....</p>
android
[4]
129,721
129,722
Changing server in SIPDROID
<p>I got the source code of sipdroid following the link <a href="http://code.google.com/p/sipdroid/source/checkout" rel="nofollow">http://code.google.com/p/sipdroid/source/checkout</a> using the command :: svn checkout <a href="http://sipdroid.googlecode.com/svn/trunk/" rel="nofollow">http://sipdroid.googlecode.com/svn/trunk/</a> sipdroid-read-only</p> <p>Sipdroid uses pbxes.org to tunnel voip calls. But I want to configure this and use different sipserver to make voip calls.</p> <p>As a new comer in this field I need help and suggestion about how to change this server.</p>
android
[4]
583,328
583,329
Javascript version needed by Jquery 1.9
<p>Please tell me javascript version needed by jQuery 1.9 Is it 1.4 or 1.5 javascript needed in the browser ?</p> <p>Thx :)</p>
jquery
[5]
3,980,538
3,980,539
How to know user is in Settings app?
<p>I would like my service to stop when the user enters the Android Settings app, then resume when the user leaves the Settings app.</p> <p>Is there a system-wide flag or a broadcast that I may use?</p> <p>Thanks. :)</p>
android
[4]
1,967,258
1,967,259
Android: got CalledFromWrongThreadException in onPostExecute() - How could it be?
<p>I have an app in production for a few weeks, using ACRA, and I had zero errors until one strange error reported today.</p> <p>I've got:</p> <pre><code> android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. </code></pre> <p>coming from this method in the stack trace (retraced):</p> <pre><code>at my.app.CountdownFragment$1.void onPostExecute(java.lang.Object)(SourceFile:1) </code></pre> <p>And this is the relevant source snippet:</p> <pre><code> private void addInstructionsIfNeeded() { if (S.sDisplayAssist) { new AsyncTask&lt;String, Void, String&gt;() { @Override protected String doInBackground(String... params) { return null; } /* * runs on the ui thread */ protected void onPostExecute(String result) { Activity a = getActivity(); if (S.sHelpEnabled &amp;&amp; a != null) { in = new InstructionsView(a.getApplicationContext()); RelativeLayout mv = (RelativeLayout) a .findViewById(R.id.main_place); mv.addView(in.prepareView()); } }; }.execute(""); } } </code></pre> <p>Where <code>addInstructionsIfNeeded()</code> is called from a handler dispatched message (the UI thead). </p> <ul> <li><code>onPostExecute()</code> runs on the UI thread, so why I've got "wrong thread"?</li> <li>This code ran already on more than 150 devices, and more than 100000 times (according to Flurry), and never had this error.</li> <li>The originating device is Samsung SGH-I997 running SDK 4.0.4</li> </ul> <p>My question is: How could it be?</p> <p><strong>EDIT</strong>: This all happens in a fragment</p>
android
[4]
2,415,628
2,415,629
ImportError: No module named numeric
<p>I get the following error ImportError: No module named numeric if I have the following import </p> <pre><code> from numeric import * </code></pre> <p>in my python source code. How do I get this running on my Windows box against a python 2.7.x compiler?</p>
python
[7]
5,294,824
5,294,825
Html encode in PHP
<p>What is the easiest way to Html encode in PHP?</p>
php
[2]
5,097,990
5,097,991
Is there any good way to see where a variable is coming from?
<p>I'm tracing back a variable, I can print out the value of that variable, but I don't know where(which page) this value has been passed to the variable. Is there any good way to print out where actually this value is coming from?</p>
php
[2]
5,258,871
5,258,872
Android - Custom App Themes that are freely available
<p>I want to make my Android app look a little bit sexier but as I don't have knack for design I was wondering if there are other themes that are available for importing into your Android app (like the Dark and Light themes that come with SDK)?</p> <p>I do not expect a Theme that would make Android app look like an iPhone app, but anything that would help me move in that direction is a welcome suggestion (and please don't go with "you can create theme on your own").</p>
android
[4]
706,554
706,555
taking time when going one activity to other by buton click
<p>when i am going from one activity to other by button click in my second activity i am displaying a advertisement in webview in top position .and it is coming from url so it takes time on navigate to other activity so i want to ask is there any solution for do it after i navigate to next activity and then download of image begins.</p> <p>in on create i write this code</p> <pre><code> SharedPreferences BannerPrefs = getSharedPreferences("BannerPref", 0); BannerLink = BannerPrefs.getString("BannerLink", ""); BannerUrl = BannerPrefs.getString("BannerUrl", ""); WebView wv=(WebView)findViewById(R.id.imv); wv.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { final Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(BannerLink)); startActivity(intent); return false; } }); wv.loadUrl(BannerUrl); thanks </code></pre>
android
[4]
5,317,696
5,317,697
Image not showing
<p>I have used this code for accessing image from database to web page. But after debugging there is no image in image tag. </p> <p>This code prints the correct path....but fails to return correct image in image tag...</p> <pre><code>echo $_SESSION['user_image']; </code></pre> <p>How do I get the image in image tag? plz help me.</p> <pre><code> while($row = mysql_fetch_assoc($result)) { $_SESSION['user_id'] = $row['user_id']; $_SESSION['user_name'] = $row['user_name']; $_SESSION['user_level'] = $row['user_level']; //$_SESSION['user_image'] = $row['image']; $image=$row['image']; $user_image= trim('C:/xampp/htdocs/source/img/' . $image); //$user_image = imagecreatefromstring($user_image); $_SESSION['user_image']=$user_image; echo $_SESSION['user_image']; } echo "&lt;img src='".$row['image']."'&gt;"; echo 'Welcome, &lt;img src= "'.$_SESSION['user_image'].'" alt="" width="50" height="40" /&gt; ' . $_SESSION['user_name'] . '. &lt;br /&gt;&lt;a href="index.php"&gt;Proceed to the forum overview&lt;/a&gt;.'; </code></pre>
php
[2]
205,148
205,149
Weird dash character in PHP
<p>I have a weird dash in my text, which isn't being detected in a <code>str_replace</code>.</p> <p>Here is an example:</p> <p><code>Sun: 10:00 – 3:00pm</code></p> <p>I don't know if the dash will show up on here.. but when it is inserted into my table, it is like a square box with the characters <code>0096</code></p> <p>It looks a lot like an <code>&amp;ndash;</code> - when viewing the source, there is no special characters, just the dash.</p> <pre><code>str_replace('–', '', $var); </code></pre> <p>The above replace doesn't seem to catch it, has anyone else had this trouble before?</p>
php
[2]
5,722,610
5,722,611
Is there a PHP function to pull out the string between two characters?
<p>Is there a PHP function that grabs the string in between two characters. For example, I want to know what is between the percent and dollar symbol:</p> <blockquote> <p>%HERE$</p> </blockquote> <p>What is the function for this?</p>
php
[2]
2,124,492
2,124,493
Add to a List from two Classes in C#
<p>I have a list in one class. And I need to populate the list from another class. Then I need to access the list one or two other classes. I don't want to use static list. How is this done in C#. I tried my best. But not successful. Can anybody show example?.</p>
c#
[0]
4,402,664
4,402,665
Parse DateTime From FileName
<p>Hi I'm trying to develop a utility to manage large sets of backup's: </p> <p>I have my backups structured like:</p> <pre><code>D:\SQLBACKUP\NOFAULT2010\Datatbase\LOG\NOFAULT2010_Datatbase_LOG_20110906_182000.trn D:\SQLBACKUP\NOFAULT2010\Datatbase\LOG\NOFAULT2010_Database_LOG_20110906_183000.trn </code></pre> <p>I can get rid of the static parts easily enough </p> <pre><code>Replace(@"D:\SQLBACKUP\NOFAULT2010\Datatbase\LOG\NOFAULT2010_Datatbase_LOG_", "").Replace(".trn", ""); </code></pre> <p>How can I consistently parse this part 20110906_182000 ... I'm open to any other suggestions. Thanks My brain is on vacation today something terrible. </p>
c#
[0]
266,150
266,151
iphone swdish changes from Julrea ö åä ä to this Julrea ö åä ä after getting response and parsing
<p>I m assigning these strings on some lables in my project but they are displaying wrong after getting response in requestfinished delegate, its also print wrong on log as mentioned like Julrea ö åä insteed of Julrea ö åä ä... if any one have solution then please..</p>
iphone
[8]
4,008,547
4,008,548
Propagating data among view controllers
<p>I've got a table view controller. Some of the rows of the table open new controllers to let the user enter more data or use pickers, etc. It's just like the built-in Calendar app. When the user taps "Save" on the second screen, I want the value from that screen to propagate back up into the table view controller, but I don't know how to do it. Since I'm using pushNavigationController to get to the second screen, there's no opportunity to provide a pointer back into the original object. (That seems like really bad design even if it were possible since the second controller would have to know stuff about its parent.)</p> <p>Also, from testing, it seems like pushNavigationController doesn't 'pause' the original controller so you don't just resume on the next line of code once the second screen is popped.</p> <p>Seems like I'm missing something really basic here.</p>
iphone
[8]
2,036,001
2,036,002
empty doesn't work
<p>I need to check five fields, but only one these fields must be filled and I need to make sure the other fields will be empty. unfortunately it's not working.</p> <pre><code>if(!empty($_POST['nome']) &amp;&amp; empty($_POST['area']) &amp;&amp; empty($_POST['profissao']) &amp;&amp; empty($_POST['cidade']) &amp;&amp; empty($_POST['estado'])) { die("ok"); } </code></pre>
php
[2]
4,526,791
4,526,792
How to store multiple key value, where value is an array of elements in javascript?
<p>I am looking for a quick way to crate a key values pair in JavaScript, where I have a key it's an ID, like 1, 2, 3, 4, 5, .... 100 and the values are an array composed by a reference, name and quantity. </p> <p>Is this an appropriate syntax?</p> <blockquote> <pre><code>var petfoodRefData = { "1": [ {"ref":5222, "description":"purina", "qtt":500}, {"ref":5322, "description":"hills", "qtt":500}, {"ref":6222, "description":"hills junior", "qtt":500} ], "2": {"ref":8022, "description":"fatcat", "qtt":60} } </code></pre> </blockquote> <p>Is there an easier better way to do this? I basically want to for every ID = 1 give me all pet food references, and add them to the document.</p>
javascript
[3]
1,989,281
1,989,282
How to make Google map zoom controls will appear automatically?
<p>I have developed a google map app and the zoom controls will not appear automatically and will disappear after they are used.</p> <p>So I want to see the zoom controls (_ , +) to appear with the map permanently.</p> <p>Thanx in adv </p>
android
[4]
2,303,423
2,303,424
How to change value of TextView of an activity depending on the different Activites calling the first activity?
<p>I need to create a logic which is going to decrease my code size in an Android Project.Suppose I have an Activity C. Activity C have a TextView whose value is "Hello". There are two another Activities A &amp; B. Now, if Activity A on button Click calls Activity C, the value of TextView must change to "How are You?" and if Activity B calls Activity C , TextView value will be "I am Fine".</p> <p>So, my question is , How to detect which Activity is calling Activity C and change the text of TextView accordingly at runtime ?</p> <p>Any kind of help will be appreciated.</p>
android
[4]
1,582,845
1,582,846
Customised Spinner
<p>I am making a project where I need to make a customised spinner where each option consists of an image view and a text box. I am new in Android. Any idea? A sample code will be of great help. Thank you.</p>
android
[4]
3,323,184
3,323,185
Loading javascript file based on cookie using jQuery
<p>I don't know why this code isn't working. This code should make sure that only one ad pop is presented in a user session. If I remove the two cookie lines then it works but not with the two cookie lines. Please help:</p> <pre><code>&lt;script type="text/javascript"&gt; var zflag_nid="1185"; var zflag_cid="3307"; var zflag_sid="823"; var zflag_width="1"; var zflag_height="1"; var zflag_sz="15"; if(!jQuery.cookie('myCookie1')) { jQuery.cookie('myCookie1','myValue'); jQuery.getScript("http://d8.zedo.com/jsc/d8/fo.js",function(){ alert("Loaded");}); } &lt;/script&gt; </code></pre>
jquery
[5]
3,885,767
3,885,768
Best way to set master page properties in content page in asp.net?
<p>There are different ways to set the title for content pages from Master page </p> <ol> <li>by findcontrol</li> <li>by creating property in master page and setting the value in content page</li> </ol> <p>As both method requires an object creation of master page which will be little heavy<br> <code>myMasterPage myMaster = (myMasterPage)this.Master;</code></p> <p>so I have tried it by creating a class and it worked -</p> <pre><code>public class clsmaster { public static clsmaster objmaster = new clsmaster(); public strtitle {get;set;} } </code></pre> <p>Now I just need to access this static object and set the property in the content page and in the master page I just need the controls to take the value from this class (clsmaster).</p> <p>I would like to know which one is the better approach and why with description please?</p>
asp.net
[9]
1,788,054
1,788,055
Line of code Ive never seen before
<p>This is in a piece of C++ code im looking through at the moment but ive never seen it before. Can someone tell me what it means? Is it just setting the bool to true if the searchText is found?</p> <pre><code>size_t startPos = searchString.find("searchText"); bool found = startPos != std::string::npos; </code></pre>
c++
[6]
5,164,115
5,164,116
select elements in list satisfying some conditions in python
<p>I want to get the list of elements satisfying some condition. This is my code</p> <pre><code> year=3.11E7 years=[year,5*year,10*year,20*year,30*year] for well in domain : if well.is_producer: location=well.center+well.radius for name in wellcontours.keys() : for tau in years: L=[filter(lambda tau: tau==[location], fronts)] print L </code></pre> <p>tau is list of points in contours, fronts is list of contours, I want to select points, which is equal for well location. It should be also list of points.(but NOT all points, that I already have ) and it give me </p> <pre><code>ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() </code></pre> <p>How can I fix it?</p>
python
[7]
1,781,217
1,781,218
aspnet command line tools location
<p>Microsoft provides a number of command line tools for working with asp.net applications. I haven't had any trouble using these tools. One thing that I can not understand though, is the location of these tools.</p> <p>Even for applications targeting newer versions of .net, these tools are located in the .net v2 directory. On my machine, that's <code>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727</code>. Why do these tools not exist in the <code>v3.0</code> or <code>v3.5</code> directories? And why do the ones in the older directory work on the newer framework?</p> <p>This is more of an idle curiosity than required knowledge for me, but I would like to know.</p> <h2>Update:</h2> <p>Thanks for the good answers everyone. These answers raise a new question though. I hope you will forgive me for asking it here, since it is so highly related. If .net 3.5 is really just using the CLR from 2.0, why is 2.0 compatible with Windows 2000, but not 3.5? It would seem to me that if the updates in 3.0 and 3.5 run inside the framework of the earlier version, then they must maintain compatibility with the same platforms as the earlier version too. Why is this wrong?</p>
asp.net
[9]
3,190,849
3,190,850
Android app does not start. Fails with a '...has stopped unexpectedly' message
<p>Hello i am new in Android i am trying to build a program but always when i wanted to start the program it gives me a message:"The application Traim Time (process timetrain.com )has stopped unexpectedly. Please try again." Ple Anyone can help me to solve problem Thank you</p> <p>this the code</p> <pre><code>package timetrain.com; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.EditText; public class timetrain extends Activity { private final static int REQUEST_TEXT=0; private EditText inputTime; private Button go1; int heure =0; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Hide the title bar requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); go1=(Button)findViewById(R.id.go1); inputTime=(EditText)findViewById(R.id.inputTime); heure= Integer.parseInt (inputTime.getText().toString()); go1.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { if(v==go1){ Intent intent = new Intent(timetrain.this,lirefile.class); intent.putExtra("enterTime",heure); startActivityForResult(intent,REQUEST_TEXT); } } }); } public static int getRequestText() { return REQUEST_TEXT; } </code></pre> <p>}</p>
android
[4]
5,615,613
5,615,614
how failed constructor roll over to destroy the completed objects?
<p>I know that when a constructor fails, the completed member objects will be destroyed. There is no memory leak.</p> <p>My question is that how does compiler do that? How can compiler know what member is constructed? Does it make any record of it? Does the compiler really destroy everything in this case? How does it guarantee this?</p>
c++
[6]
2,265,706
2,265,707
Generic Method Error
<p>I am trying to do something like:</p> <pre><code>public DataObjectBase GetCurrentSettings&lt;T&gt;(string path) where T : DataObjectBase { if (string.IsNullOrEmpty(path)) { throw new ArgumentException("Path cannot be empty."); } return _currentSettings[T].Invoke(path); } </code></pre> <p>but it won't compile. How can I achieve this? I basically import an IEnumerable of classes that can manipulate my DataObjects using MEF and the importmany attribute. Then in the constructor I turn each operation into a keyed dictionary just so I don't have to run the query every single call.</p> <p>_currentSettings is a <code>Dictionary&lt;Type, Func&lt;string, DataObject&gt;&gt;</code></p>
c#
[0]
1,842,515
1,842,516
Convert Hex to Decimal Value
<p>If I have a hex value of 53, what is the best way in Java to see what the values of bit 6 and bit 7 are? Bit 1 will be considered as the Least Significant Bit (or the rightmost bit within a byte). </p> <p>The goal is to take bit6 and bit7 and convert them to its combined decimal form. </p>
java
[1]
1,467,109
1,467,110
Get a stack trace of a hung PHP script
<p>I have a script that runs from a cron job every night. Recently, it has started totally freezing up after several minutes into the script, and I can't figure out why. If this was Java, I could simply run <code>kill -3 PID</code> and it would print a thread dump in stdout. Is there any equivalent in PHP, where I could get a dump of the current stack trace (and ideally memory info) on a running PHP script?</p>
php
[2]
778,139
778,140
Why does array === array equal true in PHP?
<p>In php <code>===</code> is the identical comparison operator i.e. checks if two variables have equal values and are of the same type. But why <code>array("asdf") === array("asdf")</code> returns true? I guess both of these create new arrays with same contents(please correct me if I am wrong).</p>
php
[2]
2,516,814
2,516,815
How to clone a whole tree without affecting the original one?
<p>i use the solution in this link not work <a href="http://stackoverflow.com/questions/78536/cloning-objects-in-c-sharp">Cloning objects in C#</a></p> <p>the following code, can not copy to a new tree, mutate will affect the original tree root(root)</p> <pre><code> foreach (Bag b in bag_list) { if (b.cards.Count() == 2) { Node original_root = new Node(); original_root = (Node)root.Clone(); // copy to a new tree target_list = choose_valid_target(target_list, b.cards, b.cards.Count() - 1); foreach (Target t in target_list) { Console.WriteLine("op:" + t.op + ", label:" + t.label); Node mutated_root = mutate(original_root, target_list); result = ""; result = inorder(mutated_root, result); // get inorder Console.WriteLine(result.Substring(1, result.Length - 2)); //print } } } public class Node : System.Object, ICloneable { public int priority; /* 7 alphabet 6 (,) 5 *,/,% 4 +,- 3 &lt;,&lt;=,&gt;,&gt;= 2 &amp;&amp;,|| 1 = */ public string Data; public Node Left; public Node Right; public string Label; public object Clone() { //return this as object; return this.MemberwiseClone(); //return new Node() as object; } } public Node mutate(Node root, List&lt;Target&gt; targets) // mutate { if (root != null) { if (!IsLeaf(root.Left.Data)) mutate(root.Left, targets); foreach (Target target in targets) { if (root.Label == target.label) { root.Data = target.op; } } if (!IsLeaf(root.Right.Data)) mutate(root.Right, targets); } return root; } </code></pre>
c#
[0]
191,545
191,546
Regular Expression: Finding String and digits
<p>I have a file with lines of string printet by my toString like this:</p> <blockquote> <p>[Name: <em>value</em>][age: <em>value</em>][cprNumber: <em>value</em>][group: <em>value</em>][Active: <em>value</em>][Average Grade: <em>float value</em>]</p> </blockquote> <p>I have a Class with a read method that reads the file and return each line as objects in an ArrayList.</p> <p>Now back in my Main Class, I'm trying to look at each object in the List and this is where I'm stuck. I'm trying to find the Objects that have Average Grade above 4. Can someone please help me with the correct regular expression?</p>
java
[1]
1,761,348
1,761,349
Convert a method from Java to C#
<p>I have follow methods in Java:</p> <pre><code>public abstract int AMRecoveryModeDeviceSetAutoBoot(am_recovery_device paramam_recovery_device, byte paramByte); public abstract int AMRecoveryModeDeviceReboot(am_recovery_device paramam_recovery_device);` </code></pre> <p>Both are imported from a DLL.</p> <p>How to use it in C#.net?</p> <p>I tried it with:</p> <pre><code>[DllImport(DLLPath, CallingConvention = CallingConvention.Cdecl)] unsafe public extern static void AMRecoveryModeDeviceSetAutoBoot(AMRecoveryDevice device, byte paramByte); </code></pre> <p>It didn't throw an error, but nothing happens (the USB Device, a iPhone, should be restart, in the Java Application with these 2 lines it workes, here not.</p>
c#
[0]
3,409,824
3,409,825
How to prevent initialization of arrays of value types in C#?
<p>All arrays of any types in .NET are initialized to 0 by default (or null for reference types). Is there any way to skip this initialization ? Just to save processor time. Say, i'm sure it will be initialized later again with different values:</p> <pre><code> Random rnd = new Random(); Int32[] nums = new Int32[666]; Array.ForEach(nums, n =&gt; rnd.Next()); </code></pre> <p>Why should CLR init the nums array to zeros ? When its 666*4 bytes length, its ok. But when its 10^6 bytes ? so it clears 1M bytes without a need ? </p>
c#
[0]
2,888,777
2,888,778
Cleaning up MicroSD/Storage
<p>Are there any tools for cleaning up the storage on Android phones? Apps seem to be making folders everywhere and even when they are removed the folders still stay... </p> <p>Can't tell which app uses or needs what directory, and manual removal feels like such a pain...</p>
android
[4]
4,585,319
4,585,320
What are the difference between helper and utils classes?
<p>How determine how call a class XHelper or XUtils ?</p> <p>To my mind :</p> <p><strong>Helper class</strong>, is a class that can be instantiate and do some business work</p> <p><strong>Utils class</strong>, is a static class that perform small and repetitive operations on a kind of instance (example of utils classes ArrayUtils or IOUtils from Apache)</p>
java
[1]
5,674,381
5,674,382
Google Drive API Error "The authenticated user has not installed the app" in android
<p>I'm trying to use Google drive api in android application, I'm using "google-api-java-client", from this library I've imported libs which are specific to android, also registered project to Google api console for Google drive api &amp; I'm able to do user authentication using OAuth2.0. But when executing insert http request call I'm getting following response from Google API</p> <pre><code>com.google.api.client.http.HttpResponseException: 403 Forbidden { "error":{ "errors":[ { "domain": "global" "reason": "appNotInstalled" "message": "The authenticated user has not installed the app with client id" } ], "code": 403, "message":"The authenticated user has not installed the app with client id " } } </code></pre> <p>Please Help!</p>
android
[4]
1,664,078
1,664,079
PHP Convert string from dd/mm/yyyy to YYYY-MM-DD HH:MM:SS string for use with ms sql server?
<p>I am hosting a php application on Windows server 2008 and using SQL Server 2008. I am having issues with inserting dd/mm/yyyy date strings in to the database.</p> <p>How can I manually convert my dd/mm/yyyy string into the MS SQL Server date format YYYY-MM-DD HH:MM:SS within PHP code?</p>
php
[2]
3,791,848
3,791,849
Detect which event finishes activity
<p>How to detect the what event causes activity finish/onstop called.In the case of back button pressed,home key pressed,user navigates from notification bar.How can i detect these three cases when the activity is called stop.</p>
android
[4]
1,237,931
1,237,932
Dictionary to lowercase in Python
<p>I wish to do this but for a dictionary:</p> <pre><code>"My string".lower() </code></pre> <p>Is there a built in function or should I use a loop?</p>
python
[7]
2,205,064
2,205,065
On Mouse Click call Key Event + JavaScript
<p>I wonna to create a Link and if you click on if it call a js script witch calls a Key combination CTRL+/ or CRTL+-</p> <p>thx</p>
javascript
[3]
3,862,260
3,862,261
java object type
<p>what is the type of object in exception class?</p>
java
[1]
5,823,161
5,823,162
csharp method word first and last letter
<p>i have method, which have parameter "word" returns Word first and the last letter with string. between first and last letter there is three points. example when you write "stackoverflow" it returns it like that "s...w"</p> <p>I have this code but i wont work.</p> <pre><code>namespace stackoverflow { class Program { static void Main(string[] args) { string word = "stackoverflow"; string firsLast = FirsLast(word); Console.WriteLine(firsLast); Console.ReadKey(); } private static string FirsLast(string word) { string firsLast = "..."; for (int i = 0; i &lt; word.Length; i += 2) { firsLast += word.ElementAt(i); } return firsLast; } } } </code></pre>
c#
[0]
76,494
76,495
searching for on screen tutorial javascript library
<p>I once stumbled upon a javascript library which is used to create interactive on screen tutorials which we may find on many games. I cannot find that library now. Has anyone heard or seen a library like that?</p> <p>I need it to help new users to learn how to use our site.</p> <p>Sincerely</p>
javascript
[3]
4,282,333
4,282,334
Checkbox to change font weight not working - Javascript
<p>I need to insert a checkbox into a form to change the font weight of text in a div. </p> <p>My javascript is as follows:</p> <pre><code>function boldText(checkBox,target) { if(checkBox.checked){ document.getElementById("lineOne").style.fontWeight = "bold"; } else { document.getElementById("lineOne").style.fontWeight = "normal"; } } </code></pre> <p>And my html like so:</p> <pre><code>&lt;input type="checkbox" onclick="boldText(this,textToBold)"&gt; &lt;div id="lineOne"&gt;Change text to bold&lt;/div&gt; </code></pre> <p>What is wrong here. I cant seem to get it to work.</p>
javascript
[3]
5,762,530
5,762,531
Generate a constant DESede secret key with messagedigest
<p>When I execute the following code, error will occur java.security.InvalidKeyException: Invalid key length: 20 bytes.</p> <pre><code>// Initialize constant symmetric key String constant = "ConstantPassword"; MessageDigest hash = MessageDigest.getInstance("SHA-1"); byte[] bHash = hash.digest(constant.getBytes()); SecretKey cSymmetricKey = new SecretKeySpec(bHash, "DESede"); // Encryption phase cipher = Cipher.getInstance("DESede"); cipher.init(Cipher.ENCRYPT_MODE, cSymmetricKey); byte[] output = cipher.doFinal(data.getEncoded()); </code></pre> <p>I understand that the recommended DESede key is 21 bytes. <br /> I realize there isn't any algorithm that will give me a 21 byte output according to <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#MessageDigest" rel="nofollow">this</a>.<br /> Is there any other way ?</p>
java
[1]
5,224,833
5,224,834
return an object using ObjectOutputStream
<p>I found a segment of java code that is claimed to return object using ObjectOutputStream</p> <pre><code> OutputStream outstr = response.getOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(outstr); oos.writeObject(process); oos.flush(); oos.close(); </code></pre> <p>response is a HttpServletResponse object. I would like to know how this segment of code works, and how to test it?</p>
java
[1]
3,391,449
3,391,450
How do I create a pseudo-color image in C++?
<p>I have an array of pixels with an associated intensity (as a float between 0 and 1) that I would like to convert to a RGB image.</p> <p>The easiest way would be to just multiply each value by 255 and assign it to R+G+B to obtain a greyscale image, but I think it would be better to use a whole range of colors to show finer differences.</p> <p>As far as I know this is called a pseudo/false color image, but I am having a hard time finding algorithms for it. Right now I am using this code, but I was wondering if there was a smarter/faster way to do it:</p> <pre><code> if(intensity &lt;= 0.25) { p-&gt;r = 0; p-&gt;g = 0; p-&gt;b = (intensity) * 4 * 255; return; } if(intensity &lt;= 0.5) { p-&gt;r = 0; p-&gt;g = (intensity - 0.25) * 4 * 255; p-&gt;b = 255; return; } if(intensity &lt;= 0.75) { p-&gt;r = 0; p-&gt;g = 255; p-&gt;b = (0.75 - intensity) * 4 * 255; return; } if(intensity &lt;= 1.0) { p-&gt;r = (intensity - 0.75) * 4 * 255; p-&gt;g = (1.0 - intensity) * 4 * 255; p-&gt;b = 0; return; } </code></pre> <p>Also, are there any standard color palettes I should use for this? </p>
c++
[6]
5,107,672
5,107,673
How to make this function return more than 1 value?
<pre><code>public Solution getReferenceSolution(Problem p) { int personalityVal = 1; int templateNameVal = 0; ... Solution personality = getComponentFactory().constructSolution(personalityVal); Solution templateName = getComponentFactory().constructSolution(templateNameVal); ... return personality,templateName,..; } </code></pre> <p>Here is the original code for class Solution:</p> <pre><code>public class Solution extends Object implements java.io.Serializable, edu.indiana.iucbrf.feature.Featured, Comparable, edu.indiana.util.xml.XMLRepresentable { private FeatureKey firstFeatureKey; private FeatureCollection features; /** Creates new Solution. */ protected Solution() { } public Solution(FeatureCollection features, Domain domain) { this.features = features; } public boolean getIsReferenceSolution() { return features.getIsReferenceSolution(); } public void setIsReferenceSolution(boolean isReferenceSolution) { features.setIsReferenceSolution(isReferenceSolution); } public boolean equals(Object other) { return (this.compareTo(other) == 0); } } </code></pre> <p>Here is inside Domain class code:</p> <pre><code>public Solution[] getReferenceSolution(Problem p) throws UnsupportedOperationException { Solution result; if (!haveReferenceSolution) throw new UnsupportedOperationException("Domain.getReferenceSolution: A getReferenceSolution() method has not been specified for this domain. If its use is required, please specify one using setEquivalenceClasses() or by overriding Domain.getReferenceSolution()."); else { if (haveBooleanSolutionCutoff) result = findNearestEquivalenceClass(p).applyTo(p, booleanSolutionCutoff); else result = findNearestEquivalenceClass(p).applyTo(p); } result.setIsReferenceSolution(true); return result; //&lt;---- error over here! } </code></pre>
java
[1]
2,690,699
2,690,700
Strip Html from Text in JavaScript except p tags?
<p>I need to change RichEditor and TextEditor modes with JavaScript, now I need to convert Html to Text which is actually still in Html editor mode, so I need just p tags, but other Html can be stripped off.</p>
javascript
[3]
4,770,565
4,770,566
Strange jQuery .prev() behaviour
<p>I have simple HTML code:</p> <pre><code>&lt;input type='hidden' name='cat_id' value='123'/&gt; &lt;a href='#' class='edit'&gt;Edit&lt;/a&gt; &lt;a href='#' class='delete delete-link'&gt;Delete&lt;/a&gt; </code></pre> <p>And simple JS code:</p> <pre><code>$("a.delete-link").click(function() { var id = $(this).prev($('input[name="cat_id"]')).val(); alert(id); }); </code></pre> <p>Everything simple and obvious, get a value of previous input with name 'cat_id'. But it just returns an empty string (value is really defined). I thought maybe selector is wrong:</p> <pre><code>var id = $(this).prev($('input[name="cat_id"]')).length; alert(id); </code></pre> <p>Returns 1. Working. I just didn't have a clue what' happening and tried</p> <pre><code>var id = $(this).prev($('input[name="cat_id"]')).attr('name'); alert(id); </code></pre> <p>Returns 'undefined'. Strange. Any ideas? Tried prevAll instead of prev, effect is the same. jQuery version is 1.6.4</p>
jquery
[5]
2,738,001
2,738,002
Launching an application using browser?
<p>I want to launch an application in the phone by clicking its link in the browser..How can I do this???</p>
android
[4]
4,918,088
4,918,089
How to handle dynamically returning values given by php with multiple lines?
<p>I'm trying to realize an indexhandler. Now I can click on a field in HTML and a second window appears. Then, by clicking one of several buttons on the second page, a value gets returned in the field of the first window. This works like this:</p> <pre><code>self.opener.document.getElementById('idOfFieldOnWindow1').value = 'myValue'; </code></pre> <p>The value here "<code>myValue</code>" gets read out of a database by php. This value can also be a text with more than one lines (it contains at least one or more linebreaks). If I write these values in the code, it gives me a JavaScript Exception:</p> <pre><code>ERROR: unterminated string literal setValue("Text on which a linebreak follows </code></pre> <p>How can I solve this that I can return the value so it gets shown in the first field including linebreaks?</p>
javascript
[3]
3,992,914
3,992,915
Problem with beginner Javascript
<p>This code doesn't work, is there any visible reason?</p> <p>the onClick is set as "doLogin();"</p> <pre><code>function doLogin() { var url = "doLogin.php"; var status = document.getElementById('statuslogin'); status.innerHTML = ""; var loginfield = document.getElementById('edtLogin'); var passfield = document.getElementById('edtSenha'); var chkremember = document.getElementById('chkRemeber'); if (loginfield.value.length == 0 || passfiel.value.length == 0) { status.innerHTML = "Por favor, preencha o login e a senha."; return; } else if (loginfield.value.length &lt; 5) { status.innerHTML = "O login deve possuir pelo menos 5 caracteres."; return; } else { url = url+"?login="+loginfield.value+"&amp;senha="+passfield.value+"remeber="+chkremember.value; xmlHTTP.onreadystatechange=stateChanged; xmlHTTP.open("GET",url,true); xmlHTTP.send(null); } } function stateChanged() { if (xmlHTTP.readyState == 4) { var resposta = xmlHTTP.responseText; var status = document.getElementById('statuslogin'); if (resposta == "Erro") { status.innerHTML = "Login ou senha incorretos! Tente novamente"; return; } status.innerHTML = "Login efetuado. Aguarde redirecionamento."; } } </code></pre>
javascript
[3]
785,791
785,792
Irc Server
<p>anyone interested in joining me in making it? Ive pretty much done alot in it and wasted alot of time doing these things. We can get to know each others via irc and/or msn :), just leave a message here and ill get back to you. My english is not my main language, so execuse me if i spelled something wrong.</p>
c++
[6]
3,548,176
3,548,177
How to add a user input number to the end of a string to select a specific object
<p>im struggling with abit of java code.</p> <p>Currently i have 8 rooms</p> <pre><code> room1 = new Room(1,1); room2 = new Room(2,1); room3 = new Room(3,1); room4 = new Room(4,1); room5 = new Room(5,2); room6 = new Room(6,2); room7 = new Room(7,3); room8 = new Room(8,3); </code></pre> <p>Now i need to make it so that the user inputs a number 1 to 8 regarding the room they require, then the system needs to add that number to the prefix room so that i can call methods of the desired room.</p> <p>I currently have this code to receive the selection</p> <pre><code>roomselect = scan.nextInt(); </code></pre> <p>and then this is where i get stuck as im unsure how to add roomselect integer onto the prefix 'room'</p> <p>thanks</p>
java
[1]
3,732,607
3,732,608
Compare two arrays ignoring only start element
<p>I have to compare if two arrays are equal ignoring only the first element. Is it possible to achieve the same without iterating</p>
java
[1]
3,951,921
3,951,922
Display array values not repeadly
<p>I have the following array</p> <pre><code>$ar = array ( 1,2,3,4,5,3,6,7,...) </code></pre> <p>i do a foreach to display elements like</p> <pre><code>$i = 0 foreach ($ar as $tab){ echo $tab[i]; $i++ } </code></pre> <p>I dont want to display twice the same value like 3. i just want <code>1 2 3 4 5 6 7...</code></p>
php
[2]
4,727,037
4,727,038
Problem In Adding an Icon to the Label of a JCheckBox Component
<p>I try to describe an image through HTML tag as follow :</p> <p><a href="http://www.exampledepot.com/egs/javax.swing/checkbox%5FAddIcon.html" rel="nofollow">http://www.exampledepot.com/egs/javax.swing/checkbox_AddIcon.html</a></p> <p>If I use the following HTML tag, it works</p> <pre><code>&lt;html&gt;&lt;table cellpadding=0&gt;&lt;tr&gt;&lt;td&gt;&lt;img src=file:C:\user\network-transmit-receive.png/&gt;&lt;/td&gt;&lt;td width=3&gt;&lt;td&gt;Hello World&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/html&gt; </code></pre> <p>However, when I use the following HTML tag, it doesn't work in Windows XP (I am not sure other Windows)</p> <pre><code>&lt;html&gt;&lt;table cellpadding=0&gt;&lt;tr&gt;&lt;td&gt;&lt;img src=file:C:\user directory with space\network-transmit-receive.png/&gt;&lt;/td&gt;&lt;td width=3&gt;&lt;td&gt;Hello World&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/html&gt; </code></pre> <p>Since there might be possibility user directory name contains space. However can I encode the directory name, so that it is recognized by JCheckBox?</p>
java
[1]
4,729,239
4,729,240
how to stop UIProgrssView?
<p>i have implemented UIProgressview in my application?But i dont know how to start and stop.Can u advice me for this question?</p>
iphone
[8]
4,917,910
4,917,911
Calculate exponent when not allowed to use Math.pow?
<p>I am a beginner in java and I am doing my practiceit exercises online. I am stuck at this question:</p> <blockquote> <p>Write a method named pow2 (a variation of the previous pow exercise) that accepts a real number base and an integer exponent as parameters and returns the base raised to the given power. Your code should work for both positive and negative exponents. For example, the call pow2(2.0, -2) returns 0.25. Do not use Math.pow in your solution.</p> </blockquote> <p>This is what i have came up with.</p> <pre><code>public double pow2(double x,int y){ double total=1; for(int i=1;i&lt;=y;i++){ total*=x; } return total; } </code></pre> <p>But the problem is when I try to call <code>pow(2.0, -2)</code>, it returns me 1.0 instead. How should I approach doing this question? Another inquiry - I dont understand how it even returns me 1.0. Shouldn't it have been the result of 2*(-2)*(-2)?</p>
java
[1]
3,651,086
3,651,087
how to reset GET variables
<p>Please pardon my PHP noobness! I want a single page to display a particular navigation based on the incoming link. It's set up as follows:</p> <p>page1.php list item: </p> <pre><code>&lt;li&gt;&lt;a &lt;?php if (strpos($_SERVER['PHP_SELF'], 'wood-species.php')) echo 'class="current"';?&gt;href="wood-species.php?name=standard"&gt;Wood Species&lt;/a&gt;&lt;/li&gt; </code></pre> <p>page2.php list item:</p> <pre><code>&lt;li&gt;&lt;a &lt;?php if (strpos($_SERVER['PHP_SELF'], 'wood-species.php')) echo 'class="current"';?&gt;href="wood-species.php?name=premium"&gt;Wood Species&lt;/a&gt;&lt;/li&gt; </code></pre> <p>So the first link will set the name variable to "standard" using the GET method, and the second link will set it to "premium". So what I want to happen is that 'wood-species.php' displays with the appropriate navigation, but I'm not sure how to destroy or unset the 'name' variable.</p> <p>Here's what I tried to use, obviously not getting it done...</p> <pre><code> &lt;?php $woodclass = $_GET['name']; if($woodclass="premium") { require("includes/premium-wide-navigation.php"); echo"premium"; clearit(); } else if($woodclass="standard") { require("includes/standard-wide-navigation.php"); echo"standard"; clearit(); } else { // } function clearit () { unset($GLOBALS['woodclass']); } ?&gt; </code></pre>
php
[2]
4,208,465
4,208,466
javascript weirdness with toFixed
<p>Comparing floats. According to the fist block of code, 5 is greater than 37.66. The second block claims that 5 is less than 37.66. What is toFixed() doing to these that makes the first block react the way it does? (This has only been tested on chrome in ubuntu)</p> <pre><code>amount = 5 total = 37.66 check = null if(parseFloat(amount).toFixed(2) &gt;= parseFloat(total).toFixed(2)){ check = "amount IS GREATER" } </code></pre> <p>check >> "amount IS GREATER"</p> <pre><code>amount = 5 total = 37.66 check = null if(parseFloat(amount.toFixed(2)) &gt;= parseFloat(total.toFixed(2))){ check = "amount IS GREATER" } </code></pre> <p>check >> null</p>
javascript
[3]
3,626,533
3,626,534
Modbus giving a exception PortInUseException
<p>i use IE view a application what use java and modbus protrol ,then throw a exception PortInUseException,But it is ok when I close the IE and open it agian. why?</p>
java
[1]
918,428
918,429
Referencing first child and getting object reference error
<p>I have two different XML responses that can be returned. They look like this:</p> <p>1) Gets returned if no user.</p> <pre><code>&lt;ArrayUser xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt; </code></pre> <p>2: Gets returned if user found.</p> <pre><code>&lt;ArrayUser xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;User&gt; &lt;Name&gt;&lt;/Name&gt; &lt;ID&gt;&lt;/ID&gt; &lt;/User&gt; </code></pre> <p>Here is my current code:</p> <pre><code> if (userLookupResponse.DocumentElement.FirstChild.Name.Equals("User")) { XmlNamespaceManager nsm = addXmlNamespaces(userLookupResponse); userLookupResponse.LoadXml(userLookupResponse.SelectSingleNode("//SSO:User", nsm).OuterXml); return userLookupResponse; } </code></pre> <p>My issue is that if a user isn't returned it errors on the <code>if</code> statement with an object reference not set to instance of an object error. How can I go inside the if statement only if number 2 is returned with user information?</p> <p>Thanks.</p>
c#
[0]
4,959,441
4,959,442
Segmentation fault on running created app into android from eclipse
<p>I am getting<br> "ActivityManager: Segmentation fault" while running one sample project from eclipse into my android device.</p> <p>One month before when my android version was JB 4.1 there were no issues. </p> <p>My phone is galaxy nexus<br> android version = JB 4.2.1 Rooted<br> drivers installed from Samsung site.</p>
android
[4]
3,334,377
3,334,378
use button to write text to the page
<p>I can do this with a alert but I want to print the results of a function directly to the web page. </p> <p>When the user clicks the car button I want the results from the <code>car()</code> function to write into my <code>id="mainContent"</code> div.</p> <p>if the user clicks the Ice Cream button I want the results from the ice cream button to replace what ever is in the <code>mainConten</code>t div with the results from the <code>iceCream()</code> function</p>
javascript
[3]