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
71,348
71,349
Can i listen android system settings change?
<p>I am writing app, that collects location data, based on GPS. And i have next problem: when i try to get GPS data and GPS is turned off, i show notification that ask for turning on GPS, and it starts(on click of course) intent with "ACTION_LOCATION_SOURCE_SETTINGS". Question: how can i know that user turned it on? is there some broadcasted actions, or i can set some listener, or something else?</p>
android
[4]
4,369,011
4,369,012
Combining frame and tween animations
<p>I'm new to the android development, and working my way through android tutorials available on Android website more specifically relating to animation. Now I know how to apply tween and frame by frame animations, but I can't figure out how to combine these two animations to run simultaneously example of which could be an animating character(frame by frame) walk across the screen(translate).</p> <p>I tried putting the both the animation-list for frame by frame animation and translate animation under the Set tag of my animation.xml, file and running using the following code.</p> <pre><code>ImageView iv = (ImageView) findViewById(R.id.imageView1); iv.setBackgroundResource(R.anim.animation); //where animation is the name of my animation xml AnimationDrawable anim = (AnimationDrawable) iv.getBackground(); anim.start(); </code></pre> <p>But it throughs an exception at setBackgroudResource.</p>
android
[4]
1,047,327
1,047,328
what is the difference between iphone device UDID , iphone device ID and iphone device Token?
<p>what is the difference between iphone device UDID , iphone device ID and iphone device Token ??</p> <p>Normally iphone device token is used when we are using apple push notification service.</p> <p>But my goal is to just identify unique iphone device ? So which of the above 3 is unique for iphone device ??</p>
iphone
[8]
5,460,481
5,460,482
How to set or export display variable through java code?
<p>We are required to add <code>export DISPLAY=:0.0</code> in tomcat's startup file and batch server's startup file. This is to make java see the X11 Display libraries on Unix and run our applet. Without this export in the startup files, the applet throws a Headless Exception.</p> <p>Though this explicit export makes the java applet run, it disrupts the other applications running on the server. Is there a way where I can make this <code>export DISPLAY=:0.0</code> run from within java code instead of adding it to startup files? And if it is possible, would that be a good approach?</p> <p>I have already tried setting the system property to <code>-Djava.awt.headless=true</code> , but it didn't work. As the link given above <a href="http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/" rel="nofollow">http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/</a> also says that setting headless=true would work only for few components like Canvas, Panel but it will not work for the top level components.</p> <p>So I feel the only option left for me is using <code>export DISPLAY=:0.0</code>. This is making my applet work when set in the startup files but causes problem for other applications running in the server. So if anybody could help me to make <code>export DISPLAY=:0.0</code> work such that it doesn't interfere with other applications in the server. One way I thought was to export the display through code. </p> <p>Any help would be highly appreciated.</p>
java
[1]
458,123
458,124
BaseAdapter or ArrayAdaptor - Android
<p>I am going to make a grid of images and I am trying to figure out whether to use an array adaptor or a baseadaptor. While the <a href="http://developer.android.com/resources/tutorials/views/hello-gridview.html">GridView example</a>, stores the data in an array, it uses a BaseAdapter rather than a ArrayAdaptor. I am curious why this is. One thing I noticed about an ArrayAdapter, is that its constructor takes a <code>textViewResourceId</code> for some unknown reason - although the documentation say the getView can be used to make it work with other kinds of views as well. So, if I want a fixed grid of images for a menu, which class would you recommend choosing?</p>
android
[4]
212,105
212,106
Fastest way to do a contains with string[]
<p>I am getting back a "string[]" from a 3rd party library. I want to do a contains on it. what is the most efficient way of doing this?</p>
c#
[0]
1,589,548
1,589,549
How to connect multiple custom login controls to single database different tables(sql)?
<p>There are 4 custom login controls on my web page. I need to connect them to different tables in a database. I have managed to connect one of the login controls to a table (below is the code for that). But now I'm not sure on how to connect the remaining controls to the database. If any one has any suggestions, I will be thankful.</p> <pre><code> protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { bool Authenticated = false; Authenticated = Authenticate(Login1.UserName, Login1.Password); e.Authenticated = Authenticated; if (Authenticated == true) { Response.Redirect("WebForm1.aspx"); } } private bool Authenticate(string UserName, string Password) { bool boolReturnValue = false; string strConnection = "server=HP-PC\\SQL2K8;database=gaurav;uid=sa;pwd=VINIMANIA;"; SqlConnection Connection = new SqlConnection(strConnection); String strSQL = "Select * From login"; SqlCommand command = new SqlCommand(strSQL, Connection); SqlDataReader Dr; Connection.Open(); Dr = command.ExecuteReader(); while (Dr.Read()) { if ((UserName == Dr["username"].ToString()) &amp; (Password == Dr["pass"].ToString())) { boolReturnValue = true; } } Dr.Close(); return boolReturnValue; } </code></pre>
asp.net
[9]
1,166,947
1,166,948
Cohesion Metrics
<p>Can someone give me the java code for LCOM(lack of cohesion) or any other cohesion metrics which takes a class as input and gives a numerical value for cohesion.</p>
java
[1]
3,949,747
3,949,748
How to open web application if it is hosted in non-ascii computername
<p>My computername is in non-ascii character like ÄÖßÜÄÖßÜ. I am opening the web application using the url <a href="http://localhost/test/login.aspx" rel="nofollow">http://localhost/test/login.aspx</a>. It opens with that url. But when i try to open with the url like http://ÄÖßÜÄÖßÜ/processmanager/login.aspx, it is not opening the page. Any idea to resolve this? </p>
asp.net
[9]
2,570,860
2,570,861
python regular expression
<p>I am newbie to python. I have an array of words and each word has to be checked to see whether it contains any special characters or digits. If it contains so then i have to skip that word. How should i do this?</p>
python
[7]
902,513
902,514
How make a java program wait until a batch file that is executed with a java process is terminated
<p>i am executing a sequence of batch files, i just need my java program to wait for the first batch file to exit and then execute the next. what happens is every thing got executed without the exit of the file that has been executed before it.</p> <p>This is my code, i am running it in a loop</p> <pre><code>String cmd = "cmd /c start /min file1.bat"; Process pr = Runtime.getRuntime().exec(cmd); pr.waitFor(); </code></pre>
java
[1]
2,028,909
2,028,910
How to get value of currently hovered anchor in jquery
<p>What I am trying to do here is to get the value of the current link that is hovered over by the mouse:</p> <pre><code> &lt;script type='text/javascript' src='jq.js'&gt;&lt;/script&gt; &lt;script type='text/javascript'&gt; $(function(){ $('a').hover(function(){ var imgName= $('a[href^=num]').val(); alert(imgName); }); }); </code></pre> <p>What do I need to do here in order to make that happen?</p> <pre><code> &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a href='numone'&gt;numone&lt;/a&gt; &lt;a href='numtwo'&gt;numtwo&lt;/a&gt; </code></pre>
jquery
[5]
5,299,392
5,299,393
jQuery Selector with :not Doesn't Work in IE7
<p>Can someone tell me why this doesn't work in IE7 please and how to to best refactor it to work in IE7 as well as the other major browser such as Chrome, Firefox and Safari?</p> <pre><code> var validTabSet = $('[tabindex]:not([tabindex=-1]):not([type=hidden]):not([disabled=true])'); </code></pre> <p>Thanks</p> <p>David</p>
jquery
[5]
5,104,207
5,104,208
Activity for each row in database table
<p>For an application which I am currently building in Java for Android I am looking for the following. I have a set with lets say 10 database records. For each row i want to show an activity (which is every time the same activity). The activity has some fields for each row to be updated.</p> <p>Lets say for example you have a record set with contacts and now you want to loop through al 10 contacts and update the data. </p> <p>Now I am not sure how this should work in android. Should I use fragments for this? How should i model this. Some pseudo code would help.</p> <p>Since this is a custom app I am developing for ICS</p> <p>Thanks very much</p>
android
[4]
4,477,582
4,477,583
change two buttons into one (toggle)
<p>I have this code, which swich 2 different external .css after click on one of two buttons and it works fine, but I need to change it and make only one button with toggling between these two .css files. Thank you</p> <pre><code>&lt;script type="text/javascript"&gt; function changeCSS(cssFile, cssLinkIndex) { var oldlink = document.getElementsByTagName("link").item(cssLinkIndex); var newlink = document.createElement("link") newlink.setAttribute("rel", "stylesheet"); newlink.setAttribute("type", "text/css"); newlink.setAttribute("href", cssFile); document.getElementsByTagName("head").item(0).replaceChild(newlink, oldlink); } &lt;/script&gt; &lt;a href="#" onclick="changeCSS('css/main.css', 1);"&gt;STYLE 1&lt;/a&gt; &lt;a href="#" onclick="changeCSS('css/main2.css', 1);"&gt;STYLE 2&lt;/a&gt; &lt;div class="box"&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.&lt;/div&gt; </code></pre>
javascript
[3]
3,940,980
3,940,981
javascript classes - is "this.varname" required for each use?
<p>I have a javascript class like this:</p> <pre><code>function Foo() { this.x = 5; this.y = x + 10; } </code></pre> <p>Does 'x' not get scoped to the instance of the class when I don't use '.this'? If so, how do we use callbacks then? I have something like:</p> <pre><code>function Foo() { this.x = 5; this.grok = function() { jQuery(blah).animate({ .., function(){ x = 55; } }); } } </code></pre> <p>so jquery gives a chance for a callback, but how do I access the 'x' member variable of the parent class in that context then?</p> <p>Thanks</p>
javascript
[3]
5,357,624
5,357,625
Android manifest configuration?
<p>What do I need to put in my android manifest file to:</p> <ol> <li>support all screen sizes.</li> <li>Hide the icons in the android bottom nav bar on 3.0, i know you cannot remove the bar, but you can hide the icons.</li> </ol>
android
[4]
5,242,369
5,242,370
How do I write a simple string to a file on the iphone?
<p>Simple question:</p> <p>I have a large string that I want to write to a file in the docs folder for an app. How do I do a simple file creation/write? </p>
iphone
[8]
635,153
635,154
what does this php expression regarding session variables mean?
<p>What does isset($_SESSION) mean? I found the following code snippet-</p> <pre><code>if (!isset($_SESSION)) { // php code } </code></pre> <p>EDIT:</p> <p>I found the following snippet in define.php of the facebook style chatting script <a href="http://evnix.com/drupal2/" rel="nofollow">freichat</a> :</p> <pre><code>if (!isset($_SESSION)) { $this-&gt;frm_id = $_SESSION[$this-&gt;uid . 'usr_ses_id']; $this-&gt;frm_name = $_SESSION[$this-&gt;uid . 'usr_name']; } </code></pre> <p>if $_SESSION was not set previously then, how can the two session variables be assigned to other variables?</p>
php
[2]
3,966,342
3,966,343
Securing Android Phone from stealing
<p>We are creating an enterprise android app that would be installed on several mobiles and distributed to agents who work for our clients. The mobiles are exclusively used for carrying out activities via our application.</p> <p>Now we need a way to secure the mobile from these agents either "losing" it or getting absconded by changing the mobile number, we should ideally be able to track them plus brick the mobile, if need be.</p> <p>I understand the tracking part, we have a broad cast service that starts another service to send GPS locations. However, there is a possibility that user could uninstall the app.</p> <ol> <li>Is it possible to make uninstall of an app password protected?</li> <li>Is it possible to prevent user from using any of the android apps / services unless he enters a secret code on our application screen?</li> </ol> <p>I understand despite all this the person could just go to a specialist and re install the ROM. </p> <p>Please do share any ideas / thoughts.</p>
android
[4]
1,771,173
1,771,174
Fading table cells with jQuery
<p>I found this code, it supposed to find the first cell in the visible row and when I click it the cell is supposed to fadeout or fadein.</p> <p>I want to adjust the code so that an input button will make this, How can I do this?</p> <pre><code>$('tr:visible').find('td:first').click(function () { $(this).parent().next().fadeToggle() </code></pre>
jquery
[5]
446,167
446,168
asp.net web.config to handle 2 SQL con string (dev/prod)
<p>whats a good way to be able to keep 2 connection strings to SQL server in the web .comfig and have the app pick the correct one when its in the prod and dev servers?</p> <p>i think i saw once some cool ways to keep variables like app settings holding two sets of values just like i am trying to do with my connection string to SQL... but i diont remmeber where i saw it..</p> <p>can anyone help me figure this out?</p> <p>my dev and prod servers vary by the port they use. so i have mysite.com and mysite.com:81</p>
asp.net
[9]
5,160,330
5,160,331
Explicit casting to uint when there is no such operator
<p>I have written a simple wrapper around a <code>ulong</code> with a private data member. I want to be able to cast the wrapper to <code>ulong</code> to retrieve the data. I want it to be illegal to cast to <code>uint</code> and lose data, so I did not write an explicit cast to <code>uint</code>. You can imagine my surprise when C# allowed me to cast to <code>uint</code> without complaint and did not throw an exception even though the high bits were lost. </p> <p>Here is my test code:</p> <pre><code>class Program { static void Main(string[] args) { ULongWrapper a = new ULongWrapper(0xfffffffffUL); ulong b = (ulong)a; uint c = (uint)a; Console.WriteLine("{0:x}", b); Console.WriteLine("{0:x}", c); } } class ULongWrapper { private ulong data; public ULongWrapper(ulong data) { this.data = data; } public static explicit operator ulong(ULongWrapper x) { return x.data; } } </code></pre> <p>Which prints:</p> <pre><code>fffffffff ffffffff </code></pre> <p>This seems like unwanted behavior, since I want casts to <code>uint</code> to fail at compile time! The compiler is using the <code>ulong</code> explicit cast operator and then somehow implicitly casting that result to a <code>uint</code> without bounds checking. Is this a bug in C#, and if not, why?</p>
c#
[0]
4,248,587
4,248,588
How to escape a string to be passed into DecimalFormat
<p>May I know how I can escape a string to be passed into decimal format?</p> <pre><code>// currencySymbolPrefix can be any string. NumberFormat numberFormat = new DecimalFormat(currencySymbolPrefix + "#,##0.00"); </code></pre> <p>How can I escape <code>currencySymbolPrefix</code>, so that it may contains any characters including '#', and will not be interpreted as one of the pattern.</p> <p>Please do not suggest</p> <pre><code>NumberFormat numberFormat = new DecimalFormat("#,##0.00"); final String output = currencySymbolPrefix + numberFormat.format(number); </code></pre> <p>as my vendor's method only accept single NumberFormat.</p>
java
[1]
4,431,451
4,431,452
Add close option to Jquery Color Picker
<p>Im using the color picker here: <a href="http://blog.meta100.com/post/600571131/mcolorpicker" rel="nofollow">http://blog.meta100.com/post/600571131/mcolorpicker</a></p> <p>Im using code shown in example 3. </p> <p>What I want to do is allow the user to close the colorPicker DIV if they choose not to pick a colour.</p> <p>I managed to add a close link in the top left corner and add a jquery.css command to display: none the div which does hide it fine. However, you will notice fron example 3 if you click the square (which is pink) to show the colour picker, hover inside the ipcker you will see the square changes to the color under your mouse. If you then hover out of the DIV it default to white. What I need it to do is default back to its original colour. </p> <p>When I click my added close button it also defaults back to white which isnt good for me.</p> <p>Anyone have any idea how I can alter the .js file supplied with this picker so it will go back to its starting colour if you hover out of the div or close it?</p> <p>Sorry for the long winded explaination.</p>
jquery
[5]
2,993,231
2,993,232
Class template function signature syntax
<p>I have a class defined like this:</p> <pre><code>template&lt; class TBoundingBox &gt; class BoundingBoxPlaneCalculator { typedef PlaneSpatialObject&lt; TBoundingBox::PointDimension &gt; PlaneSpatialObjectType; typedef typename PlaneSpatialObjectType::Pointer PlaneSpatialObjectPointer; std::vector&lt;PlaneSpatialObjectPointer&gt; GetPlanes() const{} } </code></pre> <p>If I call the function like:</p> <pre><code>std::vector&lt;PlaneCalculatorType::PlaneSpatialObjectPointer&gt; planes = planeCalculator-&gt;GetPlanes(); </code></pre> <p>It works fine. However, if I change the delcaration to simply</p> <pre><code> std::vector&lt;PlaneSpatialObjectPointer&gt; GetPlanes() const; </code></pre> <p>and then try to define the function outside of the header:</p> <pre><code>template&lt; class TBoundingBox &gt; std::vector&lt;BoundingBoxPlaneCalculator&lt; TBoundingBox &gt;::PlaneSpatialObjectPointer&gt; BoundingBoxPlaneCalculator&lt; TBoundingBox &gt;::GetPlanes() const { } </code></pre> <p>I get</p> <pre><code>itkBoundingBoxPlaneCalculator.txx:61:82: error: type/value mismatch at argument 1 in template parameter list for ‘template&lt;class _Tp, class _Alloc&gt; class std::vector’ itkBoundingBoxPlaneCalculator.txx:61:82: error: expected a type, got ‘itk::BoundingBoxPlaneCalculator&lt;TBoundingBox&gt;::PlaneSpatialObjectPointer’ </code></pre> <p>I also tried adding typename, but nothing changed:</p> <pre><code>template&lt; class TBoundingBox &gt; std::vector&lt;typename BoundingBoxPlaneCalculator&lt; TBoundingBox &gt;::PlaneSpatialObjectPointer&gt; BoundingBoxPlaneCalculator&lt; TBoundingBox &gt;::GetPlanes() const </code></pre> <p>Can anyone see what is wrong with this syntax?</p> <p>Thanks,</p> <p>David</p>
c++
[6]
4,251,516
4,251,517
Efficient data structure for Zobrist keys
<p>Zobrist keys are 64bit hashed values used in board games to univocally represent different positions found during a tree search. They are usually stored in arrays having a size of 1000K entries or more (each entry is about 10 bytes long). The table is usually accessed by <code>hashKey % size</code> as index. What kind of STL container would you use to represent this sort of table? Consider that since the size of the table is limited collisions might happen. With a "plain" array I would have to handle this case, so I thought of an unordered_map, but since the implementation is not specified, I am not sure how efficient it will be while the map is being populated. </p>
c++
[6]
3,738,299
3,738,300
What's wrong with my javascript?
<p>I have this code: <a href="http://jsfiddle.net/ZYZLT/2/" rel="nofollow">http://jsfiddle.net/ZYZLT/2/</a></p> <p>but when I put it live online <a href="http://bellated.us.lt/supersized/index.html" rel="nofollow">http://bellated.us.lt/supersized/index.html</a> it doesnt work. What I am missing here?</p> <p>My code:</p> <p>html:</p> <pre><code>&lt;div class="ball"&gt;Demo&lt;/div&gt; </code></pre> <p>css:</p> <pre><code>.ball{ -webkit-border-radius:250px; -moz-border-radius: 250px; border-radius: 250px; background: green; width : 200px; height : 200px; text-align: center; line-height: 200px; } </code></pre> <p>javascript:</p> <pre><code>&lt;script type="text/javascript"&gt; $('.ball').hover(function(){ $(this).animate({width : '250px', height : '250px', lineHeight : '250px'}, 300); }, function(){ $(this).stop().animate({width : '200px', height : '200px', lineHeight : '200px'}, 200) }); &lt;/script&gt; </code></pre>
javascript
[3]
5,061,985
5,061,986
java: is using a final static int = 1 better than just a normal 1?
<p>I just saw a class (an big API module), where there is alot of stuff like</p> <pre><code>readParamString(Object params, int index) </code></pre> <p>and they have in that class 10 fields</p> <pre><code>final static int PARAM1 = 1 ... final static int PARAM10 = 10 </code></pre> <p>which are being used with readParam functions</p> <p>but you can also use a normal int like <code>readParamString(o, 1);</code></p> <p>is final static int somehow better than using a normal int ?</p>
java
[1]
251,196
251,197
Adding some numbers using PHP
<p>Here is a situation:</p> <pre><code>race 1 = 7 race 2 = 3 race 3 = 1 race 4 = 2 race 5 = 6 race 6 = 2 race 7 = 7 race 8 = 3 </code></pre> <p>The smaller the number the better since these are race positions. race number 1 MUST be added, regardless of it's magnitude and must be added to any 5 others that are selected on merit. So basically I want to use PHP to add up 6 of the best races out of the 8 and the 6 must include 1, regardless of whether it is among the best</p> <p>I thoughtn of sorting the numbers by having them sorted from lowest to highest and adding the first 6. The problem is that if race 1, is not among the best 6, then this cannot work. </p> <p>Any help will be appreciated, I am still thinking so I cannot provide anything in terms of what i have tried as everything is still at thought level! </p>
php
[2]
2,534,974
2,534,975
read text from website
<p>i work with the emulator and try to get a text from a website.The error of the alertdialog: "the application mainactivity has stopped unexpectedly. Please try again".</p> <pre><code> public void testr(View view) throws IOException, URISyntaxException { URL websiteurl = new URL("http://test..."); BufferedReader in = new BufferedReader( new InputStreamReader( websiteurl.openStream())); String inputLine; AlertDialog alertbox = new AlertDialog.Builder(this).create(); while ((inputLine = in.readLine()) != null) alertbox.setMessage(inputLine.toString()); in.close(); alertbox.show(); } </code></pre>
android
[4]
5,948,938
5,948,939
javascript does not load with the jquery post method?
<p>Greeting to all !!!!!</p> <p>am new to jquery and using it well... it sounds good...</p> <p>the problem is when i using ajax post method and append to the original page, the javascript i loaded in the original page is not working the response(appended page some abc.php)...</p> <p>how to use those ? please help me</p> <p>success:</p> <pre><code> function(html) { $(html).hide().appendTo('#postcomnt').slideDown('slow'); $('.post_txt_area').val(""); //alert(html); } </code></pre>
jquery
[5]
5,446,415
5,446,416
How can I save a photo of part of the screen to the local iPhone's Photos?
<p>I have put a UILabel that the user has chosen over a UIImageView that was also chosen by the user. I would like to put these two into a picture, kind of like a screenshot of a small part of the screen. I have absolutely no idea how to do this and have no experience in this. Any help is appreciated!!</p>
iphone
[8]
133,753
133,754
Reading standard output from process, always empty
<p>Running this code:</p> <pre><code>Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = "tool.exe"; p.Start(); p.WaitForExit(); </code></pre> <p>Makes tool.exe run, and output some content on standard output. However, if I try to capture the content using:</p> <pre><code>Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.CreateNoWindow = true; p.StartInfo.FileName = "tool.exe"; p.Start(); string output = p.StandardOutput.ReadToEnd(); p.WaitForExit(); Console.WriteLine(output); Console.ReadLine(); </code></pre> <p>Then nothing gets outputted, i.e. my variable "output" is always empty.</p> <p>I've verified that tool.exe indeed outputs to standard output (and not standard error).</p> <p>Anyone have a clue of what's going on? Starting to feel stupid here, as it seems to be a real text book example...</p>
c#
[0]
3,846,282
3,846,283
Including into a variable
<p>You know how <code>print_r</code> accepts an optional 2nd parameter that if set to <code>true</code> will return the result instead of printing it?</p> <p>I wish <code>include</code> accepted a 2nd parameter that would work the same way.</p> <p>It doesn't so what are the available alternatives? How can I include a file into a variable?</p>
php
[2]
4,981,712
4,981,713
change uitableviewcell highlight does not work
<p>I used the codes below to change the highlight color of uitabelviewcell</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface KUITableViewCell : UITableViewCell -(void)setSelected:(BOOL)selected animated:(BOOL)animated; -(void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated; @end #import "KUITableViewCell.h" @implementation KUITableViewCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code } return self; } - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated { [super setHighlighted:highlighted animated:animated]; if (highlighted) { self.backgroundColor = [UIColor grayColor]; } else self.backgroundColor = [UIColor clearColor]; } } @end </code></pre> <p>setHighlighted was triggered, but does not change the hight color of the UITableviewCell</p> <p>Welcome any comment</p>
iphone
[8]
1,811,811
1,811,812
How to implement code like SomeObject.SomeFunction().SomeOtherFunction();
<p>Today, I searched a line of code which was written like:</p> <pre><code>SomeObject.SomeFunction().SomeOtherFunction(); </code></pre> <p>I am unable to understand this. I tried to search it on Google about this but no luck. </p> <p>Please help me to understand this.</p>
c#
[0]
2,441,304
2,441,305
Supporting iOS versions prior to 4.0/3.2 and problems with NSClassFromString
<p>I'm currently developing iPhone applications that -- for the time being -- need to be supported on versions prior to 4.x.</p> <p>When I want to use something 4.x or 3.2 specific, I would use the usual approach of checking if a given class exists, i.e.:</p> <pre><code>if(NSClassFromString(@"SomeClass")) { // do stuff here } </code></pre> <p>This mostly works, except when it doesn't. Let me explain:</p> <p>Classes like:</p> <ul> <li>UIMoviePlayerViewController (only available on 3.2+ according to the documentation)</li> <li>UIGestureRecognizer subclasses (like UIPanGestureRecognizer; UITapGestureRecognizer, etc.)</li> </ul> <p>Actually resolve to valid classes, as if they were already available on private APIs on earlier versions. Is this the case, or am I missing something?</p> <p>This is really bad, since the <code>NSClassFromString()</code> approach is actually recommended by Apple.</p> <p>To be on the safe side, I'm currently checking the OS version instead of doing runtime checking for the classes existence.</p> <p>Anyone else having this problem? Thanks.</p>
iphone
[8]
5,586,811
5,586,812
How to apply date now format in Create SubDirectory
<p>I want Date format as Folder Name(27-07-2010).. how to Name it? I want to make it as my sub directory</p>
c#
[0]
2,500,536
2,500,537
Android cannot find symbol
<p>I am working on porting in android, from Gingerbread to ICS, I am building my changes but getting lot of compilation errors saying that package com.something.something does not exist or cannot find some variable , although those missing files already exist in my repo. But the thing is these files have the same package as defined (com.something.something) but the root application or the root directory's name is little different For eg , previously it was Utils, now its CommonUtils</p> <p>I am getting all such errors although the files are present, Can someone tell me where should i make an entry of these file paths or how should I make the build compile these files by going through the new path</p>
android
[4]
4,181,479
4,181,480
Background process in android
<p>I would like read the file and upload to server in the background which is not require any interaction with the user.which concept is suitable for this? 1.IntentService 2.Async Task 3.Service</p> <p>please suggest me. Thanks</p>
android
[4]
3,489,323
3,489,324
What is ParcelFileDescriptor in android
<p>I read this <a href="http://developer.android.com/reference/android/os/ParcelFileDescriptor.html" rel="nofollow">http://developer.android.com/reference/android/os/ParcelFileDescriptor.html</a></p> <p>but I got know idea from it. What it is? and What can it do?</p> <p>Can anyone explain me.</p>
android
[4]
5,420,233
5,420,234
Python executable not finding libpython shared library
<p>I am installing Python 2.7 on CentOS 5. I built and installed Python as follows</p> <pre><code>./configure --enable-shared --prefix=/usr/local make make install </code></pre> <p>When I try to run /usr/local/bin/python, I get this error message</p> <pre><code>/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory </code></pre> <p>When I run ldd on /usr/local/bin/python, I get</p> <pre><code>ldd /usr/local/bin/python libpython2.7.so.1.0 =&gt; not found libpthread.so.0 =&gt; /lib64/libpthread.so.0 (0x00000030e9a00000) libdl.so.2 =&gt; /lib64/libdl.so.2 (0x00000030e9200000) libutil.so.1 =&gt; /lib64/libutil.so.1 (0x00000030fa200000) libm.so.6 =&gt; /lib64/libm.so.6 (0x00000030e9600000) libc.so.6 =&gt; /lib64/libc.so.6 (0x00000030e8e00000) /lib64/ld-linux-x86-64.so.2 (0x00000030e8a00000) </code></pre> <p>How do I tell Python where to find libpython?</p>
python
[7]
4,252,497
4,252,498
Custom HorizontalScrollView
<p>As the title says, I would like to create a custom HorizontalScrollView. My HSV will not have a scrollbar, but will have arrows on the sides. So, if there is something to be scrolled in the right side, the right arrow will be displayed. Otherwise it will be invisible. My problem is that I need a listener for the HSV so that I am aware when there's nothing to be scrolled. Otherwise I don't know when to set the arrows states. What would be the best approach for this feature?</p> <p>Thanks a lot,</p> <p>Gratzi</p>
android
[4]
4,121,497
4,121,498
Taking android screen shot of whole screen
<p>My application has a list view in relative layout. Now I need to take a screen shot of the entire layout including all the content available in the list view and also other contents like button and text view showing in the layout. But my code takes only the visible part of the screen. Here the view is parent layout.</p> <pre><code>public void screen(){ View v1 = findViewById(R.id.screenRoot); rel.layout(0, 0, rel.getMeasuredWidth(),rel.getMeasuredHeight()); View v = v1.getRootView(); v.setDrawingCacheEnabled(true); /* v.measure(MeasureSpec.makeMeasureSpec(w, w), MeasureSpec.makeMeasureSpec(h, h));*/ // v.layout(0, 0, rel.getWidth(), rel.getHeight()); v.buildDrawingCache(true); System.out.println("rel "+rel.getHeight()+" "+v.getHeight()); Bitmap b = v.getDrawingCache(); v.setDrawingCacheEnabled(false); String extr = Environment.getExternalStorageDirectory().toString(); File myPath = new File(extr, "tiket"+".jpg"); FileOutputStream fos = null; try { fos = new FileOutputStream(myPath); b.compress(Bitmap.CompressFormat.JPEG, 100, fos); fos.flush(); fos.close(); MediaStore.Images.Media.insertImage(getContentResolver(), b, "Screen", "screen"); System.out.println("my path "+myPath+" "+fos); }catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } Toast.makeText(getApplicationContext(), "Image Captured Successfully", 0).show(); } </code></pre>
android
[4]
2,596,989
2,596,990
Global variable in android
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1944656/android-global-variable">Android global variable</a> </p> </blockquote> <p>I am working with an Android project. I have two activities. I am designing a file uploader. The first activity is to choose a file. The second one is used to uploading the selected file. </p> <p>How can i make a global variable So the file path selected in the first activity can be used by the second activity.</p> <p>Is SharedPreference suitable for this or what's the best solution for this?</p>
android
[4]
1,221,245
1,221,246
C# Byte convertions
<p>I get very confused when it comes up to byte conversation.</p> <p>I need to do two convertions:</p> <p>1.We have a byte[] array { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 };</p> <p>How do I convert it to string so I get "30 31 32 33 34 35".</p> <p>2.We have the same byte[] array</p> <p>Now I need to convert it to ASCII(0x30 = 0, 0x31 = 1, 0x32 = 2 and so on)</p> <p>When done I should get "012345".</p> <p>How do I make both convertions?</p>
c#
[0]
721,673
721,674
Java Help: Using Classes
<p>Now I have read and on this but i am just stuck. Any help appreciated. I am looking for hints. The code compiles and runs fine but I don't think the variables are being stored in the employee class and I am not sure I am understanding my use of the constructor right.</p> <p>Requirements: I have completed:</p> <blockquote> <p>Values are checked to ensure they are positive numbers.</p> <p>Entering stop as the employee name end program.</p> </blockquote> <p>Having trouble on</p> <blockquote> <p>Uses a class to store </p> <ul> <li>name</li> <li>hourly rate</li> <li>hours worked</li> </ul> <p>Use a constructor to initialize the employee information and a method within that class to calculate the weekly pay.</p> </blockquote>
java
[1]
2,479,979
2,479,980
Wait for callback to complete with dialog
<p>I am very new to Android development, so please bare with me. I have a GPS class which returns the current GPS coordinates to the calling activity via a callback.</p> <p>The user either takes a picture or chooses one from the library and then returns to the main activity. After he returns to the main activity, I poll the gps class for the location data. Once the callback return, it updates two class properties, one for Lat and one for Lon.</p> <p>Sometimes it takes several second for the callback to be called and I want the activity to wait for the callback and display some kind of dialog to the user.</p> <p>Currently I am just useing a while loop to wait for the properties to update, but I'm sure there is a more graceful solution to this.</p> <p>Thanks!</p>
android
[4]
5,971,438
5,971,439
android help activity page
<p>I want to build a help page for my app so obviously it is gona be texty. Other than putting those texts inside my string.xml or in my layout xml, is there any other ways for me to do it? how do I include paragraphs in them? any help would be very much appreciated!</p>
android
[4]
891,042
891,043
best way to match these string or list?
<pre><code>main = ['123', '147', '159', '258', '369', '357', '456', '789'] match1 = 1374 match2 = 1892 </code></pre> <p>here <code>match1</code> has 1, 4 and 7 But main has '147' so it matches. <code>match2</code> has 1,8,9,2 so it doesn't matches to <code>main</code>. What is the optimize solution?</p>
python
[7]
576,676
576,677
right click jquery plugin
<p><a href="http://abeautifulsite.net/2008/09/jquery-context-menu-plugin/" rel="nofollow">http://abeautifulsite.net/2008/09/jquery-context-menu-plugin/</a></p> <p>its a great plugin but i dont know how to edit it so that it will work in my case</p> <p>i load all the js files from an iframe (it has to be this way, for my case...)</p> <p>i need to access all the elements outside it.</p> <p>i put the css and menu html on the document.</p> <p>so within the js file </p> <pre><code>$("b", window.parent.document).contextMenu({ menu: 'myMenu' }); </code></pre> <p>When i right-click on the link outside the iframe, nothing happens....its supposed to display the menu but it doesnt</p>
jquery
[5]
778,257
778,258
Jquery - Get the ID of an element using find()
<p>how can i get the id of an element by using the find method?</p> <p><strong>HTML</strong></p> <pre><code>&lt;div id="d1" class="line1"&gt;blib blab blub &lt;/div&gt; </code></pre> <p><strong>JS</strong></p> <pre><code>$(function() { // hit_id = $(".line1").find("blab").attr('id'); hit_id = $(".line1").match(/blab/).attr('id'); $('body').append(' - '+hit_id+' - '); }); </code></pre> <p><strong>Working example</strong> <a href="http://www.jsfiddle.net/V9Euk/496/" rel="nofollow">http://www.jsfiddle.net/V9Euk/496/</a></p> <p>Thanks in advance!</p> <p>Peter</p>
jquery
[5]
1,654,982
1,654,983
How can I read a text file with 200 lines of text, and identify identical string values?
<p>I have a text file that contains 200 lines of text. How can I compare each line of text and identify the same values with PHP. Is that even possible? Can I convert the lines to XML format? Can I convert the text file to HTML and append the duplicate values to an un-ordered list?</p>
php
[2]
2,933,266
2,933,267
elegant way to disorder a list
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/473973/shuffle-an-array-with-python">Shuffle an array with python</a> </p> </blockquote> <p>let's say I have a list <code>myList=[1,2,3,4,5]</code>,and I want to disorder it randomly:</p> <pre><code>disorder(myList) # myList is something like [5,3,2,1,4] or [3,5,1,2,4] now </code></pre> <p>the way I am using is</p> <pre><code>from random import randint upperBound = len(myList)-1 for i in range(10): myList.insert(randint(0, upperBound), myList.pop(randint(0, upperBound))) </code></pre> <p>this works, but I think it's obviously inelegant. I am wondering whether there is an elegant and efficient way to achieve my goal.</p>
python
[7]
2,277,455
2,277,456
Get the most recently updated file in PHP
<p>I need to get the latest updated file from number of files presen under that directory starting with name file_(random number).css? there are number of file present like this:</p> <pre><code>file_12.css file_34.css file_14.css </code></pre> <p>I want to get the most recently updated file. is there any readymade function available to retrieve such file in PHP?</p>
php
[2]
479,815
479,816
How to know how many objects will be created with the following code?
<p>I am bit confused in case of objects when it comes to Strings, So wanted to know how many objects will be created with following code, with some explanation about String objects creation with respect to String pool and heap. </p> <pre><code> public static void main(String[] args) { String str1 = "String1"; String str2 = new String("String1"); String str3 = "String3"; String str4 = str2 + str3; } </code></pre>
java
[1]
3,631,196
3,631,197
How can I add an image to the title bar in android 3.0?
<p>I am learning android 3.0. Can any one tell How can add Image in Title bar in android 3.0? In developer site they are telling by default it will come.but for me it is not coming. Thanks in advance.</p>
android
[4]
5,534,970
5,534,971
Python UnboundLocalError "Need help"
<pre><code>def rotate_word(word,number) for i in word: word_num = ord(i) new_word += chr(word_num + number) return new_word </code></pre> <p>Hi guys, the code above is not working. This is a python function. When i run the program i will return an error: "UnboundLocalError: 'new_word' referenced before assignment"</p> <p>what this means? Can anyone help me?</p> <p>the output of my function would be: </p> <p>print rotate_word('abc',5)</p> <p>output: fgh</p>
python
[7]
309,815
309,816
Android - how to make a button display on a condition?
<p>I have a button that basically looks like this:</p> <pre><code> &lt;Button android:id="@+id/admin_new_questions" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="See Asked Questions" /&gt; </code></pre> <p>and I try to display it only in some cases like this:</p> <pre><code>if ( clause ) { Button admin_see_questions = (Button)findViewById(R.id.admin_new_questions); admin_see_questions.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { .... } }); } </code></pre> <p>But for some reason, the button is displayed for all cases, but the listenter is not being listened to if the clause is an error.</p> <p>How can I make the button show up only when the clause is true?</p> <p>Thanks!</p>
android
[4]
3,143,579
3,143,580
Setting ContentType = "image/tiff" and sending an image is not working in IE
<p>I need to send an image (as a downloadable file) from an ASP web page. It is working correctly in every browser except for IE (all versions).</p> <p>Here is the server side code:</p> <pre><code>bool export = Request.QueryString["Export"] != null; if (export) { byte[] allBytes = File.ReadAllBytes(@"C:\MyImage.tif"); Response.ContentType = "image/tiff"; Response.AddHeader("content-disposition", "attachment; filename=\"MyImage.tif\""); Response.OutputStream.Write(allBytes, 0, allBytes.Length); Response.OutputStream.Flush(); Response.End(); return; } </code></pre> <p>And here is the JavaScript:</p> <pre><code>$('#ExportFrame').attr('src', 'Default.aspx?Export=true'); // ExportFrame is an iframe </code></pre> <p>In IE, I keep getting an error saying "Internet Explorer cannot download Default.aspx from localhost". I thought it might be an issue with loading it in an iframe element, but redirecting to the URL is not working either. The really odd thing is that going to the URL (/Default.aspx?Export=true) does not work the first time, but works every time after that. Again, this works in every browser I've tried except IE.</p> <p>Any ideas?</p> <p>Update: The aspx page has the following code to keep the page from getting cached:</p> <pre><code>// Never cache this page Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; </code></pre> <p>Removing the first 2 lines and leaving only <code>Response.Expires = -1</code> resolved the issue.</p>
asp.net
[9]
3,875,530
3,875,531
how to display alert by using serverside code in asp.net?
<p>I want to execute following code on button click but the follwing code executes when I refresh the page as well. I don't want that behaviour. Please help me.</p> <pre><code>string str = "Are you sure, you want to Approve this Record?"; this.ClientScript.RegisterStartupScript(typeof(Page), "Popup", "ConfirmApproval('" + str + "');", true); </code></pre>
asp.net
[9]
4,031,460
4,031,461
I cannot install android application after signing
<p>I have signed them using the export wizared but when i transfer them onto my phone they just wont install "application not installed" my log cat reads "no content provider found for: null" the really fustrating thing is i exported two or three last month just to test it and they still install no problem. Am i missing something?? If anyone has any idea what im doing wrong please help</p>
android
[4]
4,412,157
4,412,158
What does it mean to assign a constructor to something?
<p>Sometimes I see something like this which I quite don't understand:</p> <pre><code>// ... that.constructor = ... //... </code></pre> <p>I though the constructor property was not supposed to be something to assign something to, but a property that returned that which the object was an instance of. I thought that <code>.constructor</code> was a property like <code>.length</code> for strings that returns data and is not perferable to be changed. Is this true?</p>
javascript
[3]
3,414,115
3,414,116
How to get the double value of a big number using BigDecimal in java?
<p>I have a database column with Decimal(19,5) size, I want a BigDecimal in java to store the value but if I write</p> <pre><code> BigDecimal(999999999999999.9999); </code></pre> <p>the value is rounded to 1+E15 which I don't want it to be,So how can I get the complete precision of the number.</p> <p>One way I know is using</p> <pre><code>BigDecimal("999999999999999.9999"); </code></pre> <p>I thought there should be a better option to specify the precision.</p> <p>Thanks and Regards.</p>
java
[1]
5,168,630
5,168,631
Turning a Alt+D keyboard function in to a Button event
<p>Bear with me please I'm a little new to this!! I've been asked to add a button to a telephone directory I have made, the button needs to be able to dial an extension number which is the list. At the moment the user has to highlight the four digit code the press Alt + D on the keyboard the software will dial the number, but I want to add a button. How would I go and Create the code for this?????</p>
c#
[0]
1,754,081
1,754,082
How should I write a FindClosestMatching function?
<p>Of all objects matching a condition, find the one closest to a position. Supposedly a very common problem. The current code looks like this:</p> <pre><code>protected Foo FindClosestFooMatching (Vec pos, Func&lt;Foo, bool&gt; matches) { float bestDist = float.MaxValue; Foo bestFoo = null; foreach (Foo foo in AllFoos()) { if (matches (foo)) { float dist = pos.Dist (foo.Center); if (dist &lt;= bestDist) { bestDist = dist; bestFoo = foo; } } } return bestFoo; } </code></pre> <p>I'm thinking of several ways to refactor this code, but failed to find a really nice one yet. If you've got a minute, give it a shot. :-)</p> <p><b>Edit:</b> Regarding Eric's questions. It's a standard 3D space with Euclidian metric (= fast). Point clustering and junk query likelihood is unknown.</p>
c#
[0]
2,659,552
2,659,553
How to get screen width and height in motorola milestone, android
<p>I have used the followng ways to get screen width and height. When I run my application in motorola I got width= 320pixel and height = 533 pixel. But size of motorla milestone is 480 x 854 pixels. How to get height as 854 and width as 480 see <a href="http://www.gsmarena.com/motorola_milestone-3001.php" rel="nofollow">http://www.gsmarena.com/motorola_milestone-3001.php</a></p> <pre><code>Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int heightOfScreen = metrics.heightPixels; int widthOfScreen = metrics.widthPixels; System.out.println("...w1..."+width+"...h1..."+height+"....w2...."+widthOfScreen+"...h2..."+heightOfScreen); </code></pre> <p><strong>Output</strong> ...w1...320...h1...533....w2....320...h2...533</p>
android
[4]
4,397,414
4,397,415
Determine element left of cursor in JavaScript
<p>Is it possible determine the character on the left of the cursor's current position?</p> <p>Basically if the cursor is at, <code>x-45</code> I'd like to determine if it's prefixed by a <code>{</code> character.</p>
javascript
[3]
114,041
114,042
What does the function then() mean in JavaScript
<p>I've been seeing code that looks like:</p> <pre><code>myObj.doSome("task").then(function(env) { // logic }); </code></pre> <p>Where does then() come from?</p>
javascript
[3]
116,002
116,003
random use in app
<p>how can an array be created that randomizes results from 3 different values 0,1,2 and then makes 2 combinations of those </p> <p>for example : i have </p> <pre><code>int values[3] = {0,1,2} blah = values[arc4random() %3]; </code></pre> <p>i tried using this from the arc4random help post on this site however when i do the above the app crashes. Im a begginer to arc4random and cant figure a solution to this since there isnt enough documents online to help me. Furthermore how can i choose 2 items from blah to be displayed?</p>
iphone
[8]
3,573,221
3,573,222
Send email from Outlook Express in C#
<p>How do I open Outlook Express in C# 2008?</p> <p>How to attach a file from my application to Outlook?</p>
c#
[0]
188,250
188,251
Floating Point Numbers
<p>This seems like a real simple question but I just to want clear my doubt. I am looking at code which some other developer wrote. There are some calculations involving floating-point numbers.</p> <p>Example: <code>Float fNotAvlbl = new Float(-99);</code> Why is he creating a new object? What would happen if we do <code>Float fNotAvlbl = -99;</code>(-99 is used as flag here to indicate Not Applicable) Later down the code, we define: </p> <pre><code>fltValue1 = 0.00f; fltValue2 = 0.00f; </code></pre> <p>and populate these two values with a method call which returns float. After that we again convert these two values into Float Objects with:</p> <pre><code>fltVal1 = new Float(fltValue1); fltVal2 = new Float(fltValue2); </code></pre> <p>and than do a comparison <code>if(fltVal1.compareTo(fNotAvailable) == 0) do something.</code><br> Is it all because compareTo expects Wrapper Class Objects?</p> <p>I apologize if this is a real basic question.</p>
java
[1]
5,461,965
5,461,966
How has the C++ language changed over the years?
<p>How can I find a list of major changes that have been made to the language from since C++03 to C++0X? </p>
c++
[6]
4,880,306
4,880,307
how to drag an image by touching in android?
<p>how to drag an image by touching in android? Please Help me with a sample code.</p>
android
[4]
885,415
885,416
PHP MYSQL import excell serialized data
<p>I have a column with serialized data in mysql table.</p> <p>How to import excell file where I have column like colors where are stored serilized data for checboxes in mysql</p> <p>and need to import from excel file column </p> <p>colors colors colors white yellow blue -> serialized into 1 column in mysql</p> <p>structure of excell file can be different.</p> <p>thanks</p> <p>mysql table<br> id | name | colors<br> 1 | house | serialized(yelow,blue...) </p> <p>excell file<br> name | color | color<br> house| yellow | blue </p> <p>I'm not sure if is the right way to handle excell file maybe something like this:</p> <p>name | color<br> house| (yellow;blue)</p>
php
[2]
3,542,544
3,542,545
.prop() versus .data()
<p>With the new release of <a href="http://api.jquery.com/category/version/1.6/" rel="nofollow">jQuery v1.6</a> and the addition of the <code>.prop()</code> method.</p> <p>Is there an inherent difference in using <code>.prop()</code> over <code>.data()</code> ? </p> <p>I see in the documentation that not removing a property can result in memory leaks in versions of IE prior to IE9. But are there any other performance issues or other issues with using the new <code>prop()</code> method?</p> <p>Syntax from the site:</p> <pre><code>var $para = $("p"); $para.prop("luggageCode", 1234); </code></pre> <p>Over the following:</p> <pre><code>var $para = $("p"); $para.data("luggageCode", 1234); </code></pre>
jquery
[5]
1,338,871
1,338,872
Noob question about a statement in a Java program
<p>I am beginner to java and was trying out this code puzzle from the book head first java which I solved as follows and got the output correct :D</p> <pre><code>class DrumKit { boolean topHat=true; boolean snare=true; void playSnare() { System.out.println("bang bang ba-bang"); } void playTopHat() { System.out.println("ding ding da-ding"); } } public class DrumKitTestDriver { public static void main(String[] args) { DrumKit d =new DrumKit(); if(d.snare==true) { d.playSnare(); } //d.snare=false; d.playTopHat(); } } </code></pre> <p>Output is ::</p> <p>bang bang ba-bang ding ding da-ding</p> <p>Now the problem is that in that code puzzle one code snippet is left that I did not include..it's as follows</p> <p>d.snare=false;</p> <p>Even though I did not write it , I got the output like the book. I am wondering why is there need for us to set it's value as false even when we know the code is gonna run without it too !??</p> <p>I am wondering what the coder had in mind ..I mean what could be the possible future use and motive behind doing this ?</p> <p>I am sorry if it's a dumb question. I just wanna know why or why not to include that particular statement ? It's not like there's a loop or something that we need to come out of. Why is that statement there ?</p>
java
[1]
5,260,674
5,260,675
Made a website in ASP.NET 4.0, my web host is on ASP.NET 2.0
<p>I developed a website using Microsoft Visual Web Developer 2010. I'm not a serious programmer, but I can get by if the software is user-friendly enough. Anyway, I have come to learn that the website I developed was on <strong>ASP.NET 4.0</strong> -- I think it might be 4.0.30319, as I look in my computer-->c:/-->windows-->microsoft.net-->framework.</p> <p>Anyway, the webhosting company I'm with has <strong>ASP.NET 2.0</strong> installed on their servers. Consequently, when I uploaded my site, I get a runtime error, telling me that my web.config is wrong, or whatever. But I'm positive that it's because my website is in 4.0, and their servers are on 2.0.</p> <p>Well, this is a company website, so it needs to get up ASAP. I know I could switch hosts and all that, but does anybody know of an easier fix? I tried deleting the web.config and the site loaded, but it was all screwed up. The site works fine in my localhost. </p> <p><strong>So the long and short of it -- is there anything I can do to make my site work on a server that has only the ASP.NET 2.0 framework?</strong></p>
asp.net
[9]
12,469
12,470
C# managed dll call or unmanaged dll call?
<p>I was asking to do two <code>dll</code> calls from our application. These two <code>dlls</code> are from other group and other company. Have read a little about managed and unmanaged. I would prefer to do managed call. But whether use managed or unmanaged is the decision of the caller only or it also depends on the callee? All dlls can be called with managed code? If callee is also a factor, how can I know this dll can be called with managed code?</p>
c#
[0]
4,070,643
4,070,644
How to split a string into individual tokens without a delimiter
<p>For my current assignment I am supposed to take in a series of digits (without any spaces) as a string input. I then have to separate the string into individual tokens. The problem I'm running into is I'm having a hard time finding a method to use to split the string into individual tokens without using some kind of delimiter. For example, the string "1234" needs to be broken up into four individual ints (1, 2, 3, and 4).</p>
c++
[6]
1,758,942
1,758,943
Get Week Numbers between two dates in php
<p>I want to get the week numbers for given two dates i.e from 2012-01-01 to 2012-12-31.The week numbers should fall exactly in the range as specified above.Can u please give suggestions for doing this.</p>
php
[2]
2,388,036
2,388,037
Accesing Non Inherited members, via base class
<p>I have an Abstract class called <code>Function</code> which has 2 inheriting classes (actually 6, but for example 2).</p> <p>The first inheriting class will be called <code>Push</code>, the other <code>Lift</code>.</p> <p>The base class will have simple methods and members like <code>Execute(int Distance)</code>, <code>Direction</code> etc..</p> <p>But the child classes will have individual and unique members, for instance <code>Push</code> will have <code>int friction</code>, and <code>Lift</code> will have <code>int gravity</code> (My one is btw more complicated)</p> <p>So if I have a <code>List&lt; Function &gt;</code>, how would I edit the <code>gravity</code> member if the object were <code>Lift</code> or the <code>friction</code> if it were <code>Push</code>?</p> <p><em>Please do not say "Why not make Friction and gravity the same int, and put it in the base class."</em></p> <p>I was thinking that the base class could have <code>getData()</code> and <code>setData()</code>, which would take an Array and the child classes can use data in the array and handle it differently whilst being able to send different data too.</p> <p>EDIT: For people stuck with this problem, if possible use a property grid it works much better and is not error prone.</p>
c#
[0]
3,846,292
3,846,293
Make picture intent failed on Samsung Galaxy I9000
<p>I use the following codes to launch the camera from my app:</p> <pre><code>private void saveFullImage() { String storageState = Environment.getExternalStorageState(); if (storageState.equals(Environment.MEDIA_MOUNTED)) { String path = Environment.getExternalStorageDirectory().getName() + File.separatorChar + "Android/data/" + RegistrationDetails.this.getPackageName() + "/files/" + md5("filedummy") + ".jpg"; File photoFile = new File(path); try { if (photoFile.exists() == false) { photoFile.getParentFile().mkdirs(); photoFile.createNewFile(); } } catch (IOException e) { Log.e(TAG, "Could not create file.", e); } Log.i(TAG, path); Uri fileUri = Uri.fromFile(photoFile); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); startActivityForResult(intent, TAKE_PICTURE); } else { new AlertDialog.Builder(this) .setMessage( "External Storeage (SD Card) is required.\n\nCurrent state: " + storageState).setCancelable(true) .create().show(); } } </code></pre> <p>And I have the following codes in onActivityResult to show that the picture has been taken, so I can proceed the next step:</p> <pre><code> } else if (requestCode == TAKE_PICTURE) { if (data == null) { Toast toast = Toast.makeText(getApplicationContext(), "Take Picture finished", 10); toast.show(); } </code></pre> <p>And I have defined the following settings in AndroidManifest: android.permission.CAMERA and android.permission.WRITE_EXTERNAL_STORAGE</p> <p>The launch Camera intent works, but when I make a picture and click on Save, then it does not return to onActivityResult and my app crashes.</p> <p>Can someone help me with this?</p> <p>Thanks</p>
android
[4]
1,184,033
1,184,034
Android - shadow on text?
<p>I am wondering how to add shadow on text in android?</p> <p>I have the following code which is applied on a bitmap and I wanted to be shadowed...</p> <pre><code>paint.setColor(Color.BLACK); paint.setTextSize(55); paint.setFakeBoldText(false); paint.setShadowLayer(1, 0, 0, Color.BLACK); //This only shadows my whole view... </code></pre> <p>Thankful for any tips!</p>
android
[4]
2,964,980
2,964,981
How to get Array from user
<p>This program is working but I want take A[] array input from the user. Please somebody tell me how to take input from the user and use that input as an array in the program.</p> <pre><code> public class rough1{ public static int arrMajority1(int A[]){ int n = A.length; for(int i=0;i&lt;A.length;i++){ int c = 1; for(int j=i+1;j&lt;A.length;j++) if (A[i]==A[j]) c=c+1; if (c&gt;(A.length/2)){ return A[i]; } } return -1; } public static void main(String[] args){ int A[] = new int [] {1,1,7,5}; // int arrMajority1 = A[0]; if (arrMajority1(A) != -1) System.out.println("The majority element is " + arrMajority1(A)); else System.out.println("There is no majority element."); } } </code></pre>
java
[1]
3,841,692
3,841,693
asp.net-Online printing of the form
<p>I am developing an online application in which I need to take a printout of the data entered in the form,but on that printed page,at right corner I am getting my page url (e.g. <a href="http://www.growmoney.com/print.aspx" rel="nofollow">http://www.growmoney.com/print.aspx</a>) printed. I don't want it to be printed on the printout. Is there any solution for this?</p>
asp.net
[9]
377,790
377,791
listview for a single row?
<p>I've got an application which displays a field that can have multiple entries but I only wish to show the first entry and then give the user the option to expand that to display all items. I was thinking of making this a listview but once it's expanded I want it to retain the expansion. </p> <p>the text field in question is part of a viewpager not a view on it's own. </p> <p>Anyone got any good ideas or advice? Thanks, m</p>
android
[4]
5,888,452
5,888,453
Calculate Time Difference in Android
<p>I am new in Android.I can't find any way to calculate the time difference.So please help me. I designed a simple application. In this program I took 3 EditTexts and in these EditText I want to input the login time and logout time then store these values in the Database, And in the 3rd EditText I want to display the difference between these two time. </p>
android
[4]
1,422,557
1,422,558
C# Event subscription to method
<p>I am attempting to subscribe two events to an object. But the object is not instantiated before I try to add the events. Is there a way I can subscribe these two events and instantiate afterwards? I already have the delegates, event, event args and event handler working.</p> <p><strong>Sample Code:</strong></p> <pre><code>Ares a; public B() { a.up += new upEventHandler(doUp); a.down += new downEventHandler(doDown); a = new Ares(); } </code></pre>
c#
[0]
4,991,193
4,991,194
Adding text to an image file
<p>I need to add text to an image file. I need to read one image file (jpg,png,gif) and I need add one line text to it.</p>
c#
[0]
1,173,260
1,173,261
Export video iPhone SDK
<p>I want to change the FPS of a movie made with a iPhone to a higher FPS an export it. How can i do this?</p> <p>I found this code, but how can i use it in changing a video made by the iPhone?</p> <pre><code>self.playerItem = [[AVPlayerItem alloc] initWithAsset:anAsset]; AVMutableVideoComposition *composition = [AVMutableVideoComposition videoComposition];//self.playerItem.videoComposition; composition.frameDuration = CMTimeMake(1, 25); // 25 fps composition.renderSize = CGSizeMake(1024, 768); self.playerItem.videoComposition = composition; </code></pre>
iphone
[8]
2,315,820
2,315,821
RelativeLayout transparency with ListView below
<p>I have a relative layout with a transparent background. And a LinearLayout with a ListView below. The problem is, that I don't see my ListView below the transaprent RelativeLayout. Here's my xml:</p> <pre><code> &lt;RelativeLayout android:id="@+id/layoutabove" android:background="#55000000" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;Button android:id="@+id/loginbutton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="Login" /&gt; &lt;ImageView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:src="@drawable/myimage" /&gt; &lt;/RelativeLayout&gt; &lt;LinearLayout android:id="@+id/mainlayout" android:layout_width="fill_parent" android:background="#000000" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="fill_parent" &gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre> <p>It's just black background.</p>
android
[4]
2,021,961
2,021,962
What is the fastest way to copy a double[] in Java?
<p>Simple question, what's the fastest way of copying an array of doubles in Java. I currently do this...</p> <pre><code>public static double[] clone_doubles(double[] from) { double[] to = new double[from.length]; for (int i = 0; i &lt; from.length; i++) to[i] = from[i]; return to; } </code></pre> <p>which also does the allocation to avoid overflows, but if there is a quicker way I will separate the allocation from the copy.</p> <p>I have looked at <code>Arrays.copyOf()</code> and <code>System.arraycopy()</code> but I'm wondering if anyone has any neat tricks.</p> <p><strong>Edit:</strong> How about copying a <code>double[][]</code>?</p>
java
[1]
4,181,725
4,181,726
How to wait for user decision when downloading file
<p>I want to continue with this question: <a href="http://stackoverflow.com/questions/14947413/how-to-download-whole-file-from-website">How to download whole file from website</a>. I find out that downloading a file is an automatic process and it doesn't wait for user decision cancel/save. So for example user writes url to download file and wait 1 minute. The file automatically starts downloading (I am using firefox) probably to the memory of the browser and when file is download then it continues processing code where I have logger "file successfully download" but there is still pop up window with decision cancel/save. So my question how I can wait for this decision and react on this.</p>
java
[1]
1,761,068
1,761,069
Filtering grid view when binded using datasender in asp.net
<p>i have a gridview to which values are loaded by stored procedure. the grid view is binded to the data source in the aspx.cs file. Now i need to place a filter option for the grid view in aspx page based on the fields in the grid view.</p> <p>any one please help me out, thanks in advance</p>
asp.net
[9]
1,711,059
1,711,060
what does android.R.layout do? An overview
<p>Im trying to get an overview of what android.R.layout does in an android project.</p> <p>From the spinner tut at <a href="http://developer.android.com/resources/samples/Spinner/index.html" rel="nofollow">http://developer.android.com/resources/samples/Spinner/index.html</a></p> <pre><code> this.mAdapter = ArrayAdapter.createFromResource(this, R.array.Planets, android.R.layout.simple_spinner_dropdown_item); </code></pre> <p>I can see a private member</p> <pre><code>public static final int simple_spinner_dropdown_item </code></pre> <p>But what is this?</p>
android
[4]
1,323,266
1,323,267
Can you load a random file each time you click the same button with jQuery?
<p>I have 4 contact forms we would like to rotate for testing. I don't want to run these in separate campaigns and for such a simple thing its overkill. Is it possible to have a group of say 4 forms and load them randomly ( a different form ) each time you click a button?</p> <pre><code>$(function() { $("a.random")click.(function){ //? }); }); </code></pre>
jquery
[5]
1,598,304
1,598,305
how to upload selected contacts into a webserver
<p>I want to upload the selected contacts (phonebook-android)into webserver....can any one help me...please show me the code..thanks in advance</p>
android
[4]
5,295,528
5,295,529
Write uint16_t to binary file with ofstream
<p>I am trying to test writing some data to a file. </p> <pre><code>sixteenBitData = (uint16_t*) malloc(sizeof(uint16_t)*bufSizeX*bufSizeY); memset(sixteenBitData, 1, sizeof(uint16_t)*bufSizeX*bufSizeY); binfile-&gt;write((char *)&amp;sixteenBitData, sizeof(uint16_t)*bufSizeX*bufSizeY); </code></pre> <p>as you can see, sixteenBitData is an array of uint16_t</p> <p>I would expect my binary file to have a bunch of 1's it, but when I am loading it into matlab, it seems to have various numbers between 0 and 65535</p> <p>Am I doing something wrong?</p> <p>Thanks</p>
c++
[6]