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,892,511
1,892,512
How to make my app support for multiple screen with unique alignment of all elements present on screen?
<p>i am doing a android application that having the table layout and buttons i want to support my app to multiple screens what is the precautions i have to take any help,thanks in advance</p>
android
[4]
2,338,784
2,338,785
Downloading Android source code
<p>I am new to Android. I wanted take a look at the Andriod source and started the download process. I am having a problem in initialising the repo. I am getting a below error:</p> <pre><code>$ repo init -u https://android.googlesource.com/platform/manifest Traceback (most recent call last): File "/bin/repo", line 685, in &lt;module&gt; main(sys.argv[1:]) File "/bin/repo", line 652, in main _Init(args) File "/bin/repo", line 184, in _Init _CheckGitVersion() File "/bin/repo", line 209, in _CheckGitVersion proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) File "/usr/lib/python2.6/subprocess.py", line 633, in __init__ errread, errwrite) File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory </code></pre>
android
[4]
758,972
758,973
Redefine a method
<p>I have a class A which holds a collection of objects. Every instance of the class fills the collection according a different logic. From time to time I need to update all the collections. I was thinking this could be done maybe if the class has a method that holds the logic for filling the collection and I can set this logic at the time of the creation of the object. Like this:</p> <pre><code>MyClass instance = new MyClass(); instance.updateCollection = { logic for filling the collection } // </code></pre> <p>The logic will be different for each object.</p> <p>Thanks</p>
c#
[0]
657,911
657,912
Optimizing the load time of presentModalViewController:
<p>In my NiB, I have several View controllers. When the app launches, all their corresponding ViewDidLoad() calls are called.</p> <p>in ViewControllerA, I have ViewA that contains a UiScrollView with 100 pictures. In initalize these pictures in ViewdidLoad. So on app launch, all pictures are initalized.</p> <p>In my Main Menu View Controller, I have a button that when pressed calls presentModalViewController:ViewControllerA </p> <p>That call is taking 20 seconds. </p> <p>I thought the pre loading in ViewDidload would optimize this. However, once the call returns and recalled (bringing up this VC the second time, its really quick and instant).</p> <p>So what is causing this? Why is it taking so long the first time calling presentModalViewController. Internally, is it trying to arrange all the images? Any way of optimizing this? If not, whats the best way to show UiActivityIndicator</p> <p>Thank you in Advance </p>
iphone
[8]
3,482,240
3,482,241
Working with Bundles in Android
<p>I have an app containing many functions, of course. On of my functions is returning two variables, one <code>int</code> and one <code>String</code>. I've figured out that the easiest way to return this variables is to put them in a <code>Bundle</code>, e.g like this:</p> <pre><code>private Bundle returnInfo() { Bundle result = new Bundle(); String something = "This is a test"; int number = 15; result.putInt("number", number); result.putString("string", something); return result; } </code></pre> <p>And in another function like this:</p> <pre><code>private void getInfo() { Bundle gotcha = returnInfo(); String gotSomething = gotcha.getString("string"); int gotNumber = gotcha.getInt("number"); } </code></pre> <p>This is just a part of my app, in fact this is just a mockup to show you my problem. Cause when I debug my app, the variables <code>gotSomething</code> and <code>gotNumber</code> contains <code>null</code>, but my Bundle <code>gotcha</code> contains <code>Bundle[{string=This is a test, number=15 }]</code> isn't this the way to solve my problem? </p>
android
[4]
1,010,371
1,010,372
threads reagarding notification
<p>I was going through threads and I read that ..The notify() method is used to send a signal to one and only one of the threads that are waiting in that same object's waiting pool. The method notifyAll() works in the same way as notify(), only it sends the signal to all of the threads waiting on the object.</p> <p>Now my query is that if Lets say I have 5 threads waiting and through Notify() , i want to send to notification to thread 3 only, what logic should be there that notification is sent to thread 3 only ..!!</p>
java
[1]
704,999
705,000
Alarm Not Working
<p>I write the following code. I declared BroadcastReciever in manifest still it is not working. I am a begginer and stucked for 2 hours. What problems could be here?</p> <pre><code>// My launcher activity public class AlarmMainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); AlarmManager am=(AlarmManager)getSystemService(Context.ALARM_SERVICE); GregorianCalendar gc=new GregorianCalendar(); gc.set(2012, 1, 14, 11, 28); Intent intent=new Intent(this, AlarmService.class); gc.set(Calendar.AM_PM, 0); PendingIntent sender=PendingIntent.getBroadcast(this, 1, intent, 0); am.set(AlarmManager.RTC_WAKEUP, gc.getTimeInMillis(), sender); System.out.print(gc); } } // broadcast reciever class public class AlarmService extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context, "Alarm started", 2000).show(); } } </code></pre>
android
[4]
3,765,593
3,765,594
I need a correction for my php codings of the following?
<pre><code>&lt;?php $ip = $_SERVER['REMOTE_ADDR']; $isptc = gethostbyaddr($ip); $ispoh = preg_split("/./", $isptc); $xy = count($ispoh); $x = $xy - 1; $y = $xy - 2; $i = $xy - 3; $ispp = $ispoh[$i]; $isp = $ispoh[$y] . "." . $ispoh[$x]; echo"&lt;b&gt;ip: $ip&lt;/b&gt;&lt;br&gt;"; echo"&lt;b&gt;isp: $ispp$isp&lt;/b&gt;"; ?&gt; </code></pre> <p>In this above mentioned codings, i didn't get the output from $ispp and $isp... If you got any answer from it.,Please advice me...Thanks in Advance... </p>
php
[2]
3,651,610
3,651,611
time difference count in javascript
<p>Does anyone how can I do a time difference count in Javascript?</p> <p>Example:</p> <p>If I have the following time (24H format)</p> <pre><code>startTime = 0615 endTime = 1530 breakTime = 0030 </code></pre> <p>how can I get the following output?</p> <pre><code>diffB4Break = 7.15 hours afterBreak = 6.45 hours </code></pre>
javascript
[3]
2,091,691
2,091,692
Nested C++ class outer members' access
<p>This code does not work (MS VS 2005),</p> <pre><code>b-&gt;funcA(); B::iterator iter; </code></pre> <p>cant access protected members declared in class A.</p> <p>If I remove class D, everything compiles nicely.</p> <p>I wonder if it's just a bug or standard?</p> <pre><code>class A { protected: void funcA() { } class iterator { }; }; class D { class B : public A { class C { B* b; public: void funcC() { b-&gt;funcA(); B::iterator iter; } }; public: void funcB() { funcA(); } }; }; </code></pre> <p>Thanks!</p>
c++
[6]
2,478,278
2,478,279
How to detect whether the phone is in sleep mode in the code?
<p>Is there any way to detect whether an android phone is in sleep mode (screen is black) in the code? I wrote a home screen widget. I don't want the widget gets updated when the screen is black to save the battery consumption.</p> <p>Thanks.</p>
android
[4]
6,029,120
6,029,121
How to convert an array to a double so big array?
<p>I have an element type:</p> <pre><code>public class FieldInfo { public string Label { get; set; } public string Value { get; set; } } </code></pre> <p>And I have an array filled with <code>FieldInfo</code> objects.</p> <pre><code>FieldInfo[] infos = new FieldInfo[] { new FieldInfo{Label = "label1", Value = "value1"}, new FieldInfo{Label = "label2", Value = "value2"} }; </code></pre> <p>Now I want to convert that array to a new one that contains following values:</p> <pre><code>string[] wantThatArray = new string[] {"label1", "value1", "label2", "value2"}; </code></pre> <p>Is there a short way to do the conversion from an array like <code>infos</code> to an array like <code>wantThatArray</code>?<br> Maybe with LINQ's Select?</p>
c#
[0]
4,665,365
4,665,366
how to Typecast File object into InputStream
<p>How to Typecast File object into InputStream.</p> <pre><code>File file=new File("c:\\abc.txt"); </code></pre> <p>Thanks</p>
java
[1]
3,309,280
3,309,281
registered user area package
<p>I want to create a new service which needs a registered user area. I need to customize the fields and look of this rua. I am writing cause I don't want to reinvent the wheel. Is there an opensource php script I can use in a project that simply handles the security issues which I can access with something like: </p> <pre><code>if ($registered) { // things } </code></pre>
php
[2]
3,897,263
3,897,264
Substitute multiple whitespace with single whitespace in Python
<p>I have this string:</p> <pre><code>mystring = 'Here is some text I wrote ' </code></pre> <p>How can I substituate the double, triple (...) whitespaces to just one whitespace so that I get:</p> <pre><code>mystring = 'Here is some text I wrote' </code></pre> <p>Thanks.</p>
python
[7]
3,720,011
3,720,012
javascript true and true returning false in if statement?
<p>In the plain javascript function. Both the values, min_chk and max_chk are true, but the if function still shows the alert. not able to figure why?</p> <pre><code>function Checkit(m,n){ return m&gt;n; } var min_chk = Checkit(a,X); var max_chk = Checkit(b,Y); if ((min_chk === 'true') &amp;&amp; (max_chk === 'true')){ ... } else { alert('invalid range'); } </code></pre>
javascript
[3]
5,664,265
5,664,266
Is it possible to get an xpath element using javascript, without using document.evaluate()?
<p>The reason I wish to do this is because document.evaluate() does not work in IE. Is there an alternative?</p>
javascript
[3]
5,985,882
5,985,883
NSString scanning?
<p>i am having NSString* str = @"1223.2212311"; i want to convert it as 1223.22(after floating point two chars),is it possible through NSString?i have to use NSScanner? any help please?</p>
iphone
[8]
5,490,359
5,490,360
Jquery, Onclick, and Ajax
<p>I have fiddled with this with absolutely no progress or luck. If I take out the .ajax it works fine but with the .ajax nothing fires, not even the random testing alerts. Can you see what I have done wrong with this? I have tried to follow the Jquery doc's. The PHP works. </p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(document).ready(function ($) { // wait until the document is ready $('div#chatroom').click(function(){ $.ajax({ type: 'GET', url: 'chatget.php', data: { chatroomid: = '&lt;?php echo $chatroomid; ?&gt;'}, datatype: 'html', cache: 'false', success: function(response) { $('#chatroom').append(response); alert('Load was performed.'); }, error: function(){ alert('Fuuuuuuuuuuuuuu'); } }); // End Ajax alert('Fail'); }); // End onclick }); &lt;/script&gt; </code></pre>
jquery
[5]
4,297,699
4,297,700
Why the Allocation of an array with int.MaxValue fails and the allocation of two arrays with the size int.MaxValue / 2 does not?
<p>Why the allocation of a byte array with the size <code>int.MaxValue</code> fails </p> <pre><code> byte[] array1 = new byte[int.MaxValue]; // throws an OutOfMemoryException </code></pre> <p>and the allocation of two arrays with the size <code>int.MaxValue / 2</code> does not?</p> <pre><code> byte[] array2 = new byte[int.MaxValue / 2]; byte[] array3 = new byte[int.MaxValue / 2]; </code></pre>
c#
[0]
2,279,320
2,279,321
Javascript displaying dynamic content
<p>I wanted to display a different message in the same <code>&lt;div&gt;</code> when the user makes a selection from a radio button. It works, but it's not as clean as I'd like. Here's the code:</p> <pre><code>&lt;script type="text/javascript"&gt; function showhide(t) { var target = document.getElementById('bankingdetails'); if (target.style.display == 'none') { var text = 'Please effect payment to the following account:&lt;br /&gt;'; var accountnum = 'Account Number: 39485620346&lt;br /&gt;'; var branchcode = 'Branch Code: 34985&lt;br /&gt;'; var branchname = 'Branch: F00 Bank Whoville'; if (t == 0) { // User opted for Online Payment target.style.display = 'block'; target.innerHTML = 'Please click here to go to PayPal:&lt;br /&gt;&lt;a href="http://www.paypal.com"&gt;Go to PayPal&lt;/a&gt;'; } else { target.style.display = 'block'; target.innerHTML = text + accountnum + branchcode + branchname; }; } else { target.style.display = 'none'; }; }; &lt;/script&gt; &lt;input type="radio" name="radPayment" onclick="showhide(0);" /&gt;Pay Online &lt;input type="radio" name="radPayment" onclick="showhide(1);" /&gt;EFT </code></pre> <p>Right now, I can click either radio button to display it's message, but... I have to click it again, or click on the other one to hide the visible message.</p> <p>What I'd like is to change the text that displays on the page so that if the EFT text is visible, if I click on the Pay Online button, the text will change immediately.</p> <p>Thanks in advance!</p>
javascript
[3]
1,294,675
1,294,676
Android mediaplayer play a Songs as orderly
<p>I am new to Android. In my app MediaPlayer plays groups of songs in order. The songs are stored in one arraylist and the song names are stored in another arraylist.. </p> <pre><code>for(i=0;i&lt; songarray.sizeof();i++) { mp=MediaPlayer.create(this,(Integer) songarray.get(i)); sname.setText(songname.get(i)); mp.start } </code></pre> <p>The problem is that the songs play only one then print one song name.</p>
android
[4]
3,224,554
3,224,555
Get all child div values in jquery AJAX response
<p>I need to get all child div values from the AJAX response which contains the following format.</p> <pre><code>var jqxhr = $.post('&lt;%= url_for :action =&gt; :friend_list %&gt;', { id: fid }, function(data){ var stripped_data = $(data).html().trim(); var top_name = $(stripped_data).find('div.toppings_name').html(); }); </code></pre> <p>In the alert of stripped_data contains the following format.</p> <pre><code>&lt;div id="toppings&gt; &lt;div class="toppings_name"&gt;a&lt;/div&gt; &lt;div class="toppings_name"&gt;b&lt;/div&gt; &lt;div class="toppings_name"&gt;c&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I tried using <code>.find()</code> method but getting the first child value only. How to get all the values from the parent div.</p>
jquery
[5]
68,932
68,933
Checking if sys.argv[x] is defined
<p>Dear All What would be the best way to check if a variable was passed along for the script:</p> <pre><code>try: sys.argv[1] except NameError: startingpoint = 'blah' else: startingpoint = sys.argv[1] </code></pre> <p>Thanks!</p>
python
[7]
5,438,379
5,438,380
using jquery to dynamically create div
<p>I am trying to add a background image to a dynamically generated div. When I add the CSS property for the background, like below, it breaks my plugin:</p> <pre><code>$("&lt;div&gt;", { 'class': "iviewer_image_mask", css: "background: url('http://somesite.com/path/to/image.jpg');" }).appendTo(this.container); </code></pre> <p>Anybody know what I am doing wrong to add the background image?</p>
jquery
[5]
5,889,010
5,889,011
jQuery fadeTo delay in Webkit browsers
<p>I've implemented what I feel is a rather simple script on my menu. It works in Firefox and IE, but in Chrome and Safari, there is a delay of about a half-second. All it is doing is setting the opacity 60%, and then 100% on hover. Here's the code:</p> <pre><code> $(document).ready(function() { $(".NavMenu a").fadeTo('200', 0.6); $(".NavMenu a").hover(function() { $(this).fadeTo('200', 1.0); }, function() { $(this).fadeTo('200', 0.6); }); }); </code></pre> <p>Has anyone else experienced this, or know of a workaround? I've tested other sites in Webkit browsers and the fadeTo effect seemed fine.</p> <p>Thanks for your time.</p> <p>Patrick</p>
jquery
[5]
5,379,782
5,379,783
How to remove all whitespace and newlines?
<p>Assuming I have a file that contains the following:</p> <p>Assume <code>&lt;tab&gt;</code> is actually a tab and <code>&lt;space&gt;</code> is actually a space. (ignore quotes)</p> <pre><code>" &lt;tab&gt;&lt;tab&gt; &lt;space&gt; &lt;tab&gt; The clothes at the superstore are at a discount today. " </code></pre> <p>Assume this is in a text file. How do I remove all the spaces such that the resulting text file is (ignore the quotes:</p> <pre><code>" The clothes at the superstore are at a discount today. " </code></pre>
python
[7]
2,132,275
2,132,276
java builds with different JDK versions : same artifacts?
<p>here is my scenario:</p> <ul> <li>workstation A : Sun JDK 1.6</li> <li>workstation B : Sun JDK 1.5</li> </ul> <p>I build on A and B with Ant 1.7 </p> <pre><code>&lt;javac srcdir="${foo}" destdir="${bar}" source="1.5" target="1.5"&gt; &lt;include name="**/*.java"/&gt; &lt;exclude name="**/test/**/*.java"/&gt; &lt;/javac&gt; </code></pre> <p>yet the <strong>.class</strong> files are different size on A &amp; B, let alone CRC. is it supposed to be this way? or am I missing something obvious?</p>
java
[1]
4,834,455
4,834,456
iOS 5 keyboardWasShown
<p>I add a negative and a period button through the code to the basic numeric keyboard for text fields that accept decimal values. i call this code from the keyboardWasShown method and it seems to add these two keys to the keyboard in iOS 4 series, but does nothing in iOS 5. The code is called and the method is executed but the keys are not added to the keyboard. any help is appreciated. thanks.</p>
iphone
[8]
3,803,093
3,803,094
how to hide selection on UITableview?
<p>i want to disable click on particular Cell.it means, <strong>i want not to show highlight color(selection indication) when we touch on particular cell?</strong> any help please?</p>
iphone
[8]
3,234,838
3,234,839
IE8 write during a loop
<p>My cgt prog on www.stonebanks.co.uk displays the output on Opera as the javascript program runs. IE8 appears to have stopped until all the calcs are done then displays the lot.</p> <p>I added a textbox to show progress. It works fine with Opera (I don't need it there), but only writes the progress report when IE8 has finished. Is there any way to tell IE8 to write during a loop?</p> <pre><code>.... .... document.f.progress.value = "Company : " + company + " Record count = " + numrecds.toString(); } // end of loop document.f.progress.value = "Finished"; </code></pre> <p>Thanks</p>
javascript
[3]
1,535,552
1,535,553
jQuery and reference to js and vsdoc.js files
<p>Within vs.net I need to set references to both js and vsdoc.js files for jQuery. Things work great if the script files are within the project HOWEVER I really want to reference a standard folder on our server i.e. <a href="http://www.domain.com/script/jQuery" rel="nofollow">http://www.domain.com/script/jQuery</a> for the location of these files. On our local workstation we have these files located in <a href="http://localhost/script/jQuery" rel="nofollow">http://localhost/script/jQuery</a> </p> <p>How can I reference both consistent location as well as get the benefits of intellsense and F5 (development server) references working well?</p> <p>thx</p>
jquery
[5]
3,967,128
3,967,129
Why getHeight() of a Viewgroup does not change
<p>I have a LinearLayout (ViewGroup). And in my code, I have added a child view (another linear layout) to the LinearLayout. My question is why the LinearLayout 's getHeight() return the SAME value? On the phone, I do see my child linear layout is visible and is displayed correctly. But why the getHeight() does not return me the right value?</p> <p>And I have looked at the source code of add() in ViewGroup. It does call 'requestLayout()' so I expect the getHeight() of the ViewGroup does get update correctly. Am I correct?</p>
android
[4]
638,005
638,006
how to use javascript to open only ie window
<p>I want a java script or j query script that opens internet explorer window. with a new page. that page from which we call this script running on any browser.</p>
javascript
[3]
769,862
769,863
open new page in new window in gridview buttonfield
<p>i have gridview in my asp.net page.</p> <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" CssClass="Gridview" OnRowCommand="GridView1_RowCommand"&gt; &lt;Columns&gt; &lt;asp:ButtonField Text="VIEW" ButtonType="link" CommandName="view" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre> <p>I want to open new page in new window.</p> <p>for that i have used below code.(this code is not working !- please check if any error) </p> <pre><code>protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("view")) { int index = Convert.ToInt32(e.CommandArgument); GridViewRow gvrow = GridView1.Rows[index]; String id= gvrow.Cells[1].Text; string url = "~/Mypage.aspx?myid=" + id; Response.Write("&lt;script&gt;window.open( 'www.google.com' , '-blank' );&lt;/script&gt;"); } } </code></pre> <p><strong>I am binding data at runtime in GRIDVIEW</strong> please keep this in mind.</p> <p>so that i can not use hyperlink field.</p> <p>Suggest me ways to open new page in new window using coding in gridview. </p>
asp.net
[9]
4,548,858
4,548,859
'repo' is not recognized as an internal or external command
<p>whenever i try to execute "$ repo init -u git://git.android-x86.org/manifest.git -b $branch" command on cmd it gives an error that 'repo' is not recognized as an internal or external command, operable program or batch file.</p> <p>how do i fix that problem?</p> <p>for more information go to this site: <a href="http://www.android-x86.org/getsourcecode" rel="nofollow">http://www.android-x86.org/getsourcecode</a> and "Getting Android-x86 source code" there you'll find out this command in 3rd line. Thanks in advance :)</p>
android
[4]
2,786,910
2,786,911
Which jQuery function is there to hide an element by making it transparent?
<p>Which jQuery function is there to hide an element by making it transparent instead of drawing it out (which is provided in <a href="http://api.jquery.com/show/" rel="nofollow">show</a>/<a href="http://api.jquery.com/hide" rel="nofollow">hide</a> jQuery functions).</p>
jquery
[5]
627,970
627,971
flash mode torch not found in motorola fire xt-530
<p>I am trying to create a flash torch app for my motorola fire xt-530. check this code which responds to a toggle button.</p> <pre><code>public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { if (getApplicationContext().getPackageManager().hasSystemFeature( PackageManager.FEATURE_CAMERA_FLASH)) { camera = Camera.open(); params = camera.getParameters(); List&lt;String&gt; flashModes = params.getSupportedFlashModes(); if (flashModes == null) { Toast.makeText(getApplicationContext(), "No Flash Found", Toast.LENGTH_SHORT).show(); } else { camera.startPreview(); if (flashModes.contains(Parameters.FLASH_MODE_TORCH)) { Toast.makeText(getApplicationContext(), "Torch Mode Found", Toast.LENGTH_SHORT).show(); params.setFlashMode(Parameters.FLASH_MODE_TORCH); camera.setParameters(params); camera.takePicture(null, null, null); } else { Toast.makeText(getApplicationContext(), "Torch Mode Not Found", Toast.LENGTH_SHORT).show(); } } } else { Toast.makeText(getApplicationContext(), "Not Available", Toast.LENGTH_SHORT).show(); } } else { camera.stopPreview(); camera.release(); Toast.makeText(getApplicationContext(), "Not Checked", Toast.LENGTH_SHORT).show(); } </code></pre> <p>which toasts torch mode not found. not rooted. please help me.</p>
android
[4]
4,581,534
4,581,535
Fix Javascript Value to 0 decimals
<p>I have this script which is working in formatting my currency but now its not fixing my value to 0 decimal places, Im new to javascript so could anybody explain where and hwo I'd do this? Thanks</p> <pre><code>function FormatNumberBy3(num, decpoint, sep) { // check for missing parameters and use defaults if so if (arguments.length == 2) { sep = ","; } if (arguments.length == 1) { sep = ","; decpoint = "."; } // need a string for operations num = num.toString(); // separate the whole number and the fraction if possible a = num.split(decpoint); x = a[0]; // decimal y = a[1]; // fraction z = ""; if (typeof(x) != "undefined") { // reverse the digits. regexp works from left to right. for (i=x.length-1;i&gt;=0;i--) z += x.charAt(i); // add seperators. but undo the trailing one, if there z = z.replace(/(\d{3})/g, "$1" + sep); if (z.slice(-sep.length) == sep) z = z.slice(0, -sep.length); x = ""; // reverse again to get back the number for (i=z.length-1;i&gt;=0;i--) x += z.charAt(i); // add the fraction back in, if it was there if (typeof(y) != "undefined" &amp;&amp; y.length &gt; 0) x += decpoint + y; } return x; } </code></pre>
javascript
[3]
1,332,127
1,332,128
How to activate functionality only in developer mode
<p>I have application with in app billing. I'm using the <a href="https://github.com/robotmedia/AndroidBillingLibrary" rel="nofollow">AndroidBillingLibrary</a> to manage the purchase.</p> <p>I would like to be able to have access to all the buyable option when i run the app in debug mode.</p> <p>Currently when i need to test an option i replace something like this : </p> <pre><code>bool option = BillingController.isPurchased(this,OPTION_NAME); </code></pre> <p>by</p> <pre><code>bool option = true;//BillingController.isPurchased(this,OPTION_NAME); </code></pre> <p>Clearly not a good solution !</p> <p>Is it safe todo something like this ? :</p> <pre><code>public class MyApp extends Application { public static final bool DEBUG = true; } if(MyApp.DEBUG) option = true; else option = BillingController.isPurchased(this,OPTION_NAME); </code></pre> <p>Is there any better solution ? Thanks</p>
android
[4]
509,805
509,806
updating the gridview with the button on the same gridview
<p>I want to develop a book store Application in Asp.Net. For that one of my page contains a text box and search button, if you write some book name and search for it , it will show result(title,author,no.of copies,button"add to cart") in gridview , i have button on each row as Add to cart. if we click on it ,it will open a new gridview with selected book details ( title,author,copies purchased )at the same time i want to decrement the no.of copies in first gridview. if i click the same button again i want to increment the copies purchased and again to decrement the no.of copies. till now am not saving anything to DB.the thing is if i click on search button now i want the details with affected "no.of copies" in first gridview. </p> <p>I think you guys understood my Question. </p>
c#
[0]
1,237,592
1,237,593
Mixing inline attributes with an attribute object
<p>I should get 3 images here but I get 2. The last one fails:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.1.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $().ready(function() { var img = $('&lt;img src="icon.next.gif" url="/" /&gt;'); $("body").append(img); img = $('&lt;img /&gt;', { src: "icon.next.gif", url: "/" }); $("body").append(img); var img = $('&lt;img src="icon.next.gif" /&gt;', { url: "/" }); $("body").append(img); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I could swear I've mixed these before but now it seems like the second parameter replaces all tags. I really need it to add because I've got a string generated (which comes with inline attributes) and I need to add to it.</p> <p>Here's [<a href="http://jsfiddle.net/x2qSz/" rel="nofollow">fiddle</a>] for anyone who'd like to play with it.</p> <p>Using IE9 and it breaks with:</p> <blockquote> <p>SCRIPT438: Object doesn't support property or method 'createDocumentFragment' jquery-1.5.1.js, line 5450 character 3</p> </blockquote>
jquery
[5]
5,692,702
5,692,703
android Not allowed to load local resource:file:///android_asset
<p>i come across a strange issue that when load html page from server, in the page contains a script that links to android sdcard js file. and it fails.</p> <p>code like below :</p> <p>java part code :</p> <pre><code>String url ="http://192.168.84.86:8080/test/maw/js_load_test.html"; this.loadUrl(url); </code></pre> <p>complements: I use phonegap develop android web application.</p> <p>js_load_test.html file part code :</p> <pre><code>&lt;script src="file:///sdcard/test.js"&gt;&lt;/script&gt; and i also try : &lt;script src="file:///android_asset/www/js/test.js"&gt;&lt;/script&gt; test.js file exists, and js file path is correct. but in logcat shows: when load first script: 03-18 13:01:12.467: E/Web Console(26189): Not allowed to load local resource: file:///sdcard/test.js at :0 and second script: 03-18 13:01:53.467: E/Web Console(26189): Not allowed to load local resource: file:///android_asset/www/js/test.js at :0 </code></pre> <p>thanks so much.</p>
android
[4]
4,624,906
4,624,907
Check if all List Items have the same member value in C#
<p>I'm searching for a simple and fast way to check if all my Listitems have the same value for a member.</p> <pre><code>foreach (Item item in MyList) { Item.MyMember = &lt;like all other&gt;; } </code></pre> <p><strong>EDIT:</strong> I forgot one thing: If one of this members (its a string) is String.Empty and all other items have the same string it should be true too! Sorry i forgot this.</p>
c#
[0]
2,859,435
2,859,436
printf function in PHP
<p>I'm from a C background and understand basics of printf function. </p> <p>I came across the follwing code </p> <pre><code>&lt;?php printf('%4$d %2$s code for %3$3.2f %1$s', "hours", "coders", 9, 99); ?&gt; </code></pre> <p>which prints:</p> <pre><code>99 coders code for 9.00 hours </code></pre> <p>Can anyone help me in understanding the call to the printf function.</p>
php
[2]
773,417
773,418
is it possible to use html code in android?
<p>i would like to add a widget that i found from a website into my android app.is that possible?this is the code,as i get it from the site:</p> <pre><code>&lt;iframe src="http://www.mykosmos.gr/loc_mk/wforecast_widget.asp?city_code=0032&amp;bcolor=F0F0F0&amp;fcolor=000000&amp;font=Trebuchet MS&amp;pos=hor" frameborder="0" height="180" width="430" marginheight="0" marginwidth="0"&gt;&lt;/iframe&gt; </code></pre>
android
[4]
2,991,952
2,991,953
segmentation fault in while loop
<p>I have a program takes inputs from 2 files in c++. Then identify Is the second input file is topological sort? but somehow if i use the list.empty() in a while loop statement, it gives me a segmentation fault, but the for loop doesnt give me any error; however, the for loop only loop once, since i might need to go throught twice.</p> <pre><code>#include &lt;list&gt; #include &lt;iostream&gt; #include &lt;vector&gt; using namespace std ; list&lt;unsigned&gt; output; list&lt;unsigned&gt; &amp; testSort ( istream &amp; idata , istream &amp; sdata ) { unsigned n,x1,x2; vector&lt; list&lt;unsigned&gt; &gt; successor(n); vector&lt;unsigned&gt; count(n,0); vector&lt;bool&gt; marks(n,false); idata &gt;&gt;n; for(int i=0;i&lt;n;i++) { idata&gt;&gt;x1&gt;&gt;x2; count[x2]++; successor[x1].push_back(x2); if(idata.eof()) break; } for(int i=0;i&lt;n;i++) { sdata&gt;&gt;x1; if(count[x1]==0) { marks[x1]=true; //for(int j=0;j&lt;successor[x1].size();++j) { while(!successor[x1].empty()) { count[successor[x1].front()]--; successor[x1].pop_front(); } } else { for(int i=0;i&lt;n;i++) { if(marks[i]==false) output.push_back(i); } break; } } return output; } </code></pre>
c++
[6]
143,698
143,699
Android: extending PhoneBase?
<p>I know it is possible to use TelephonyManager to get information like: service state, device ID, Sim Operator, etc... Is it possible to edit some of this information?</p> <p>Couldn't find .set() functions on Android.com documentation but I've found the <a href="http://www.netmite.com/android/mydroid/frameworks/base/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java" rel="nofollow">GSMPhone.java</a> source code which includes functions like .setNumber1Number() (used to set/edit the number?).</p> <p>I basically want to know if it's possible to edit the phone number located on Sim card (Settings->About->Status->My Phone Number).</p> <p>Appreciate any answer, even a simple "NO", if it's indeed impossible.</p> <p>Thank you!</p>
android
[4]
4,758,943
4,758,944
fstream's getline() works for a little bit...and then breaks
<p>I have a text file with a bunch of numbers separated by newlines, like this: 123.25 95.12 114.12 etc...</p> <p>The problem is, when my program reads it, it only copies the number to the array up to the second number and then fills the rest of the elements with zeroes. I've tried using delimiters and ignore statements but nothing has worked. Here's the code.</p> <p>Edit(here's the whole program:)</p> <pre><code>#include &lt;iostream&gt; #include &lt;string.h&gt; #include &lt;iomanip&gt; #include &lt;fstream&gt; using namespace std; struct utilityInfo { char utility[20]; double monthlyExpenses[12]; }; int main(){ utilityInfo Utility[3]; char charray[100]; fstream inFile; inFile.open("expenses.txt"); inFile.getline(charray, 7); cout&lt;&lt;charray&lt;&lt;endl; if(inFile.fail()) cout&lt;&lt;"it didnt work"; for(int i=0; i&lt;12; i++) { inFile.getline(charray,20); Utility[0].monthlyExpenses[i]=atof(charray); } for(int z=0; z&lt;12; z++) { cout&lt;&lt;Utility[0].monthlyExpenses[z]&lt;&lt;endl; } inFile.close(); return 0; } </code></pre> <p>Here's what the text file looks like:</p> <pre><code>207.14 177.34 150.55 104.22 86.36 53.97 52.55 58.77 64.66 120.32 153.45 170.90 </code></pre> <p>And here's what the output looks like:</p> <pre><code>207.14 177.34 0 0 0 0 0 0 0 0 0 0 </code></pre>
c++
[6]
4,342,105
4,342,106
How can I get exception code in C#?
<p>Is there anything like exception code? that i can know that on different languages operation system i can recognize the same exception?</p> <p>I need to recognize 'Acces to the COMn Port is denied' and then do some action, is that possible? has this exception any specified type?</p>
c#
[0]
4,146,151
4,146,152
The correct way to modify an object that is being passed as a parameter into the modifying class
<p>What is the best way of the following 2 suggestions to modify a property on an object that is being modified by a class that accepts the object as a parameter?</p> <ol> <li>Have the class work on the object and a return a value which you then assign to the object</li> </ol> <p>or.</p> <ol> <li>Pass the object in using the ref keyword and have the class amend the object without actually returning anything.</li> </ol> <p>For example, I have a Person object with a First Name and Last Name and 2 different ways to create the Full Name.</p> <p>Which is the best way? </p> <pre><code>public static void Main() { Person a = new Person { FirstName = "John", LastName = "Smith" }; Person b = new Person { FirstName = "John", LastName = "Smith" }; NameProcesser np = new NameProcesser(); // Example A a.FullName = np.CreateFullNameA(a); // Example B np.CreateFullNameB(ref b); } public class Person { public string FirstName { get; set; } public string LastName { get; set; } public string FullName { get; set; } } public class NameProcesser { public string CreateFullNameA(Person person) { return person.FirstName + " " + person.LastName; } public void CreateFullNameB(ref Person person) { person.FullName = person.FirstName + " " + person.LastName; } } </code></pre>
c#
[0]
193,615
193,616
Jquery's appendTo causes script blocks to be executed again
<p>If I use <strong>appendTo</strong> to move parts of the DOM tree around script blocks being moved are rerun, i.e. they run twice.</p> <p>Example: <a href="http://jsfiddle.net/EHDqE/" rel="nofollow">http://jsfiddle.net/EHDqE/</a></p> <p>Is there a better way to move DOM sections around without script blocks within them being executed again?</p>
jquery
[5]
4,519,177
4,519,178
How do I make my program take 5 float values from a user and sort them in increasing order?
<p>What I exactly want my program to do is ask user to enter 5 values, output those 5 values to the screen, sort them from lowest to highest and output the sorted order to the screen. I have the following code: </p> <pre><code>void sort(float[], int); int main() { const int SIZE = 5; float a[SIZE]; cout &lt;&lt; "Enter " &lt;&lt; SIZE &lt;&lt; "numbers:\n"; for(int i = 0; i&lt;SIZE; i++); cin &gt;&gt; a[i]; sort(a,5); cout &lt;&lt; "In sorted order: "; } void sort (float a[], int n) { for (int i=1; i &lt; n; i++) for (int j=0; j &lt; n-i; j++) if (a[j] &gt; a[j+1]) swap (a[j], a[j+1]); } </code></pre>
c++
[6]
3,215,886
3,215,887
Private Set or Private member?
<p>I was wondering what's considered the C# best practice, private/protected members with public getters, or public getters with private/protected setters?</p> <pre><code> public int PublicGetPrivateSetter { get; private set; } </code></pre> <hr> <pre><code> private int _privateMember; public int PublicGetPrivateMember { get { return _privateMember; } } </code></pre> <p>I feel that using a private member is more explicit in your code that it's a private setter (using naming conventions). On the other hand using private setters gives you an option to use virtual (protected), write less code, has less room for mistakes and can give you an option to add a side effect later on if you need to.</p> <p>I couldn't find what's considered a best practice, or even if one is considered better than the other. From what I've seen usually 80% of the time (from code that I'VE seen) people DONT use private setters... I'm not sure if this is because people don't know about private setters, or because it's considered better to actually use private members.</p> <p>EDIT:</p> <p>Indeed, other benefits which I forgot about when using private members is default values and the use of readonly.</p>
c#
[0]
4,048,045
4,048,046
jquery append on muliply array
<p>this my code with in a array i supposed to make tree menu in a table</p> <pre><code>$myqueryPO-&gt;magGrp = array("[grp] =&gt; MAIN, [grp] =&gt; P1, [grp] =&gt; P3") foreach ( $myqueryPO-&gt;magGrp as $dataArray) { $myGroup = $dataArray[] = $dataArray['grp']; &lt;tr class="'.$myGroup.'"&gt; &lt;td&gt;&lt;a href="#" id="'.$myGroup.'" class="clickMEdata"&gt;'.$myGroup.'&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; } $(function($) { $(".clickMEdata").click(function(){ var eleMent = $(this); var mySelected = eleMent.attr("id"); var info = "myID=" + mySelected; $.ajax({ type: "POST", url: "ScheduleOfManPower.php", data: info, success: function(data){ var loadUrl = "ScheduleOfManPower.php"; $("."+mySelected).append().load(loadUrl, info); } }); $("."+mySelected).toggle("slow"); }); }); </code></pre> <p>supposed to be the ScheduleOfManPower.php is <code>&lt;tr&gt;&lt;td&gt;hi&lt;/td&gt;&lt;td&gt;foo&lt;/td&gt;&lt;/tr&gt;</code> my problem it seem my append function doesnt work my table not fit what i expected its only query in the 1st <code>&lt;td&gt;&lt;/td&gt;</code> my second problem is the <code>$("."+mySelected).toggle("slow");</code> it seem i need to double click in order from me to show my query.. :(</p>
jquery
[5]
346,014
346,015
Get Cookie information of a url (when browsed)and display it on another aspx page
<p>I have a url which is when clicked and browsed,we set some lead capture cookie value.Now for this url,i want to get all the lead capture cookies and their values and display it on another aspx page in a tabular form,so as to get the information of all leads collected.How can i do this,Any help.</p>
asp.net
[9]
1,020,353
1,020,354
How do I make this only print the last value?
<p>I have the fallowing code to encrypt a massage:</p> <pre><code>massage= raw_input("Enter message to be encrypted: ") spec = chr(0b1010101) key = ord(spec) encrypt = "" for i in range(0, len(massage)): encrypt = encrypt + chr(ord(massage[i]) ^ key) print encrypt </code></pre> <p>say I give "yo yo" to it</p> <p>it will give me :</p> <p>,</p> <p>,:</p> <p>,:u</p> <p>,:u,</p> <p>,:u,:</p> <p>I only need the final answer which is the ,:u,:</p> <p>what do i have to do?</p>
python
[7]
4,474,013
4,474,014
how to get the Locale list in en_<COUNTRY> format
<p>I want to return a list of all the countries in <code>&lt;lang&gt;_&lt;Country&gt;</code> format where <code>&lt;lang&gt;</code> should be english, So I need a list like en_GB,en_US,en_JP etc. Looking at the Locale's api is returning <code>&lt;lang&gt;_&lt;Country&gt;</code> but it is not restricting it to language as en. Am I missing something here?</p>
java
[1]
6,019,777
6,019,778
Radio Buttons with javascript
<p>I have the following coded radio buttons, which retrieve value(s) in the code below. Is it possible to create hyperlink references from these retrieved values e.g., google.com and/or yahoo.com for the selected radio buttons?</p> <pre><code>&lt;script language="javascript"&gt; &lt;!-- function RadioCheck() { var selection = document.quiz.colour; for (i=0; i&lt;selection.length; i++) if (selection[i].checked == true) alert(selection[i].value); } //--&gt; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="quiz"&gt; &lt;input type="radio" name="colour" value="red"&gt;red&lt;br&gt; &lt;input type="radio" name="colour" value="orange"&gt;orange&lt;br&gt; &lt;input type="radio" name="colour" value="yellow"&gt;yellow&lt;br&gt; &lt;br&gt; &lt;input type="submit" value="Check Answer" onClick="RadioCheck()"&gt; &lt;/form&gt; </code></pre> <p>thanks in advance.</p>
javascript
[3]
1,041,339
1,041,340
jquery: strange behavior with contextmenu
<pre><code>$("b").bind("contextmenu",function(e){ thiselementselected = e.target $("#add").bind("click",function(e){ thiselementselected.css("font-color", "red"); return false }); $("#remove").bind("click",function(e){ thiselementselected.css("font-color", ""); return false }); return false }); </code></pre> <p>when i click on a b> element and click 'add', it will make the font color red.</p> <p>I do this for several b> elements.</p> <p>then when i click on one of them and click remove, it will remove colors from ALL b> elements... its supposed to remove from only one given element b></p> <p>when i click on another b> and click 'add', now all previously selected b> elements will turn red !</p> <p>i dont understand why this is happening....</p>
jquery
[5]
1,360,629
1,360,630
checking for some extension and it's not working
<p>So i have the following problem, this is not working:</p> <pre><code>if any(x in pageName for x in ('.jpg','.gif','.txt','pdf','.msi','print' '.ppt','.pptx','javascript:', '.xls','#','.xlsx','.doc', 'ftp' '.docx','mailto:','.xml','.tar.gz','.png' )): print pageName return [] </code></pre> <p>And this is working, so what is the problem in my code, any ideas:</p> <pre><code>if any(x in pageName for x in ('print')): print pageName return [] </code></pre>
python
[7]
817,995
817,996
Using Mediaplayer to replay the same file
<p>Im hoping you can provide some guidance. I created a 'final' instance of a mediaplayer (mp1) and on a button click it plays a mp3 file. I then need to stop the file when I click a second button. This works fine until I try to play the file again - nothing happens. I think that because the mp1 instance is 'final', when I stop it, it stops for good until I relaunch the app. I dont want to pause the file, I want to stop it and then restart it afresh. Any ideas welcome. I tried putting the mp1 creation within the button. This worked until the app crashed - probably because multiple mediaplayer creations used all the device memory?</p> <p>Thanks!!!</p> <pre><code>// const mediaplayer mp1 = MediaPlayer.create(getApplicationContext(), R.raw.mysound); ... // in button 1 if (radSound1.isChecked()) { radSound2.setChecked(false); // ...set radiobutton 2 to false mp1.start(); // ...play the mp3 file } ... // in button 2 if (mp1 != null){ mp1.reset(); //mp1.setDataSource(); // mp1.prepare(); } </code></pre>
android
[4]
5,178,968
5,178,969
From month to month and year
<p>For example, I have the month 13 and I want to convert it to 1 year and 1 month with php. 26 - 2 years and 2 months. How to "convert" it?</p>
php
[2]
3,908,670
3,908,671
Android - Rotate image around center point?
<p>How can I rotate a bitmap (not a view or canvas) around its center point when the user touches it and drags it?</p> <p>I have tried loads of examples on stack overflow and none appear to work.</p> <p>So far I have:</p> <pre><code>double r = Math.atan2(posX - dial.getWidth() / 2, dial.getHeight() / 2 - posY); rotation = (int) Math.toDegrees(r); </code></pre>
android
[4]
5,021,242
5,021,243
Can I change the temp folder path?
<p>I have an asp.net app that uses <code>System.IO.Path.GetTempFileName()</code> for temporary files. In the production IIS environment (W2K3), the temp folder (<code>System.IO.Path.GetTempPath()</code>) points to <code>C:\Windows\Temp</code>. But on my XP dev machine it's <code>C:\documents and settings\machinename\ASPNET\temp</code>. </p> <p>Is it possible to change this folder without affecting other accounts on my machine?</p>
asp.net
[9]
1,947,966
1,947,967
Is there a way for my PHP code to be reviewed?
<p>I am new to the world of coding as well as PHP. As I am looking at putting together a minor web application for a small client, how do I get my code reviewed without giving away what the client considers to be private to them so that I know my code is well-written, adheres to standards and is secure?</p>
php
[2]
5,894,492
5,894,493
android programming question
<pre><code>dy_path = Environment.getExternalStorageDirectory() + "\5.jpg"; </code></pre> <p>Instead of that i want how to give dynamic path automatically picture saved based on current time.</p> <p>I am new to Android. Plz answer my question</p>
android
[4]
2,662,851
2,662,852
where to import the jquery.js file
<p>I was wondering where I should write the <code>&lt;script src="jquery.js"&gt;&lt;/script&gt;</code> in a php project. I wrote it in the main file menu.phpm in the head and I then include this file in other files but if I do that the jquery functions I use don't work in the other files while if I add again <code>&lt;script src="jquery.js"&gt;&lt;/script&gt;</code> in the other file, it work. Do I have to write that in every file in which I use jquery functions?</p> <p>thank you</p>
jquery
[5]
2,553,095
2,553,096
jquery Have same div show on multiple hovers
<p>I have several divs of the same class that I want to show the same div whenever any of them are hovered over. I only want to create this second div once. I have tried creating it within the document and then cloning and appending it whenever I need it. This isn't working. In the example below, I main_item is the class being hovered over and optionbar is the div to show. Note that any main_item class is assigned an id of 9999 when you hover over it and the id is removed when you hover away from it.</p> <pre><code>$(function(){ $(".main_item").hover(function(){ $('.optionbar').clone().appendTo("#9999"); } ,function(){ $("#9999").remove('.optionbar'); } ); }); </code></pre>
jquery
[5]
48,823
48,824
access android global setting via code
<p>i am working on a simple home launcher, but a cant find a way to access global android setting like wireless,application etc, i've alredy read <a href="http://developer.android.com/reference/android/provider/Settings.System.html" rel="nofollow">http://developer.android.com/reference/android/provider/Settings.System.html</a> but couldnt find the answer,please someone tell me how to do that, sorry for my bad english</p>
android
[4]
2,115,807
2,115,808
show linux process [Python]
<p>Guy how i can read all process work in my computer and print it</p> <p>i want process read then print ?</p>
python
[7]
718,855
718,856
How do I insert a new div before the last div using jQuery?
<pre><code>&lt;div id="one"&gt;test test&lt;/div&gt; &lt;div id="two"&gt;test test&lt;/div&gt; &lt;div id="three"&gt;test test&lt;/div&gt; &lt;div id="four"&gt;test test&lt;/div&gt; &lt;div id="five"&gt;test test&lt;/div&gt; </code></pre> <p>If I want to insert a div dynamically with jQuery in between divs "four" and "five", how would I go about doing that?</p> <p>I tried this but it didn't work:</p> <p><code>$("&lt;div id='four-point-five'&gt;&lt;/div&gt;").before("#five");</code></p>
jquery
[5]
882,151
882,152
Converting from Structured English to Python
<p>It is easy, yes. But I'm stuck on a line which doesn't seem to work for what it should do. The structured English line is:</p> <pre><code>FOR NoOfGamesPlayed &lt;- 1 TO NoOfGamesInMatch Do </code></pre> <p>I know this should be a for loop but can't seem to make a valid one. Any help?</p> <p>This needs to be converted to Python code.</p>
python
[7]
5,364,041
5,364,042
Test for empty nested array
<p>I have the following array:</p> <pre><code>array(4) { [29] =&gt; NULL [31] =&gt; NULL [33] =&gt; NULL [35] =&gt; NULL } </code></pre> <p>I would like to test all keys if all keys contain NULL values. </p>
php
[2]
4,045,883
4,045,884
Why are exceptions named checked and unchecked?
<p>Why is the two exception types in Java named "checked" and "unchecked"? What is the reason behind those names?</p>
java
[1]
2,586,235
2,586,236
how to post secure data via iPhone?
<p>For example, I want to sent information like credit card number, password etc so what's the best way to do the same?</p>
iphone
[8]
5,534,620
5,534,621
stand alone application unable to connect to database
<p>We have a web based application which has web services (say user.asmx) which communicate with application database using generic credentials. In order to provide access to a user, we have an automation tool which uses the above web services and uses same credentials (as web application is using) and insert/update records in the application database.</p> <p>Here, we have a concern that there is a logon trigger on the database and is preventing the tool to communicate to database. While investigating the error log on database, we found the below error message:</p> <p>LOGON_TRIGGER: oerr, unhandled exception occurred</p> <p>LOGON_TRIGGER: user =>abcdef</p> <p>LOGON_TRIGGER: machine=></p> <p>LOGON_TRIGGER: program=>W3WP.EXE</p> <p>LOGON_TRIGGER: osuser =>IUSR_<strong><em>*</em>**<em>*</em></strong></p> <p>LOGON_TRIGGER: -20001</p> <p>LOGON_TRIGGER: ORA-20001: abcdef@W3WP.EXE You are not allowed to login</p> <p>DBA want us to investigate and get the machine name populated so that they can alter the trigger to allow this tool.</p> <p>Can experts please advise what could be the reason that machine name is not populating at the database level.</p>
asp.net
[9]
4,271,856
4,271,857
jquery curvy corners not working in IE
<p>I have jquery cury corners working great in firefox, this includes on a div and table. The div content is empty, but has a height and width vaule...this causes problems in IE as only the top of the div tag is cornerd, the table isnt at all.</p> <pre><code> &lt;div id="content" class="content"&gt; &lt;table id="nav_links" class="nav_links" cellpadding="7"&gt; &lt;tr&gt; &lt;td class="nav_background"&gt;&lt;a href="index.html"&gt;Home&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p></p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready( function() { $('.content').corners(); $('.nav_links').corners("bottom"); }); &lt;/script&gt; </code></pre> <p>This isnt a duplicate post, as the first wasnt due to the IE problem</p> <p>Cheers</p>
jquery
[5]
1,172,671
1,172,672
interface variables are final and static by default and methods are public and abstract
<p>The question is why it's been decided to have variable as final and static and methods as public and abstract by default.</p> <p>Is there any particular reason for making them implicit,variable as final and static and methods as public and abstract.</p> <p>Why they are not allowing static method but allowing static variable?</p> <p>We have interface to have feature of multiple inheritance in Java and to avoid diamond problem. But how it solves diamond problem,since it does not allow static methods.</p> <p>In the following program, both interfaces have method with the same name..but while implementing only one we implement...is this how diamond problem is solved?</p> <pre><code>interface testInt { int m = 0; void testMethod(); } interface testInt1 { int m = 10; void testMethod(); } public class interfaceCheck implements testInt, testInt1{ public void testMethod() { System . out . println ( "m is"+ testInt.m ); System . out . println ( "Hi World!" ); } } </code></pre>
java
[1]
3,875,222
3,875,223
NSString to NSArray
<p>i get the following value as a string format.</p> <pre><code> getcommands=( { "created_time" = "2011-01-18T10:44:14+0000"; from = { id = 100001511725982; name = "ABC Welcomes U"; }; id = "100001511725982_158433587542247_1658635"; message = Nice; }, { "created_time" = "2011-01-18T10:44:22+0000"; from = { id = 100001511725982; name = "ABC Welcomes U"; }; id = "100001511725982_158433587542247_1658637"; message = "Gud One"; } ) </code></pre> <p>Now, i need to get ""Message"" only from this string. </p> <p>Please any one knows the code please help me.</p> <p>Thanks.</p>
iphone
[8]
2,808,217
2,808,218
Python: "TypeError: __str__ returned non-string" but still prints to output?
<p>I have this piece of code which creates a new note..WHen I try to print I get the following error even though it prints the output</p> <pre><code>Error: C:\Python27\Basics\OOP\formytesting&gt;python notebook.py Memo=This is my first memo, Tag=example Traceback (most recent call last): File "notebook.py", line 14, in &lt;module&gt; print(firstnote) TypeError: __str__ returned non-string (type NoneType) </code></pre> <p>note.py</p> <pre><code>import datetime class Note: def __init__(self, memo, tags): self.memo = memo self.tags = tags self.creation_date = datetime.date.today() def __str__(self): print('Memo={0}, Tag={1}').format(self.memo, self.tags) if __name__ == "__main__": firstnote = Note('This is my first memo','example') print(firstnote) </code></pre>
python
[7]
2,391,141
2,391,142
Can I make "not original looking" buttons for Android in Eclipse?
<p>I think, e.g. Curved buttons, or a circle button. If I can how? </p>
android
[4]
5,747,648
5,747,649
Better way to get Page Name
<p>I'm using this to get the current page name..so this returns for example MyPage.aspx</p> <pre><code>public string GetCurrentPageName() { string urlPath = Request.Url.AbsolutePath; FileInfo fileInfo = new FileInfo(urlPath); string pageName = fileInfo.Name; return pageName; } </code></pre> <p>There has to be an easier way? Meaning there's got to be an existing method or property in the .NET framework one would think.</p>
asp.net
[9]
4,303,551
4,303,552
Email or Database?
<p>I`m making a site where users have to sign up. They will be contacted later once the site is ready.</p> <p>Right now, I have a simple plugin that creates a form and sends me the contact info via email of anyone who signs up. </p> <p>Is this a stupid plan? Should I have a form that submits the information to a database? or can the contact info be easily exported from gmail later when needed?</p> <p>If you think a database is a better solution, can you recommend a simple PHP script with the necessary filters.</p> <p>I`m building the initial site with WordPress. Want to be prepared in the event that a lot of people sign up. </p>
php
[2]
4,620,255
4,620,256
Android XML Composite View
<p>I'm new to Android development, and am having a tough time working something out. I want to make a composite view (called SkillDiceGroup) of a TextView, EditText, and SkillDiceButton (which is an extension of the Button class). I have it working when declaring my SkillDiceGroup as pure code, and putting this in my XML layout:</p> <pre><code> &lt;com.jeremybush.d20.SkillDiceGroup android:id="@+id/skillDiceTest" android:title="Foobar!" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;/com.jeremybush.d20.SkillDiceGroup&gt; </code></pre> <p>And I have this code:</p> <pre><code>public class SkillDiceGroup extends LinearLayout { // The View components private TextView mTitle; private EditText mSkill; private SkillDiceButton mDice; public SkillDiceGroup(Context context, AttributeSet attrs) { super(context); this.setOrientation(HORIZONTAL); mTitle = new TextView(context); mTitle.setText("foobar"); addView(mTitle, new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT )); mSkill = new EditText(context); addView(mSkill, new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT )); mDice = new SkillDiceButton(context, attrs); mDice.setText("d20"); addView(mDice, new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT )); } private class SkillDiceButton extends DiceButton { public SkillDiceButton(Context context, AttributeSet attrs) { super(context, attrs); } public void onClick(View view) { modifier = Integer.parseInt(mSkill.getText().toString()); super.onClick(view); } } } </code></pre> <p>This works how I want it, but I would like to declare the three items in the xml view on their own. How can I do this?</p>
android
[4]
2,113,364
2,113,365
Best Way to Avoid Errors due to Settings/Configuration BEFORE Runtime
<p>A common problem is that programs may compile ok, but external (user/environment) settings may cause applications to crash during runtime.</p> <p>Aside from performing checks all over the code, (alas actually performed during Runtime), I would like to have rule sets to assert <strong>during build</strong> that, at least default values settings, are coherent.</p> <p>The simplest case may be, if default settings are hardcoded : </p> <pre><code>Directory defaultDir = new Directory("D:\\Data"); UserLogin usr1 = "Jesse"; UserLogin usr2 = "James"; </code></pre> <p>(yeah, "Booh"; this is an example, please <strong>DO NOT</strong> comment/answer on that unsignificant detail... I know it's hard for some of you, but please REFRAIN ! :-) )</p> <p>So, is there a SIMPLE way to check DURING Build, that "D:\Data" exists, and that usr1 and usr2 do have different login strings etc...</p> <p>I am sure there are assertion mechanisms in .Net, and maybe Unit Testing (I'd rather avoid the latter cause it may be oversized for the very light usage/need in this particular case. But I guess that's what Unit Tests are designed for too...)</p>
c#
[0]
2,736,909
2,736,910
Java simplify the syntax
<p>What would be the most terse way in Java to check for the following condition </p> <pre><code>int m, n; </code></pre> <p>The condition to check is whether either m or n are negative but both shouldn't be negative. I'm looking for a terse yet simple syntax</p>
java
[1]
4,438,576
4,438,577
Can't put hyperlink in PHP echo statement
<p>In the code below I'm adding <code>&lt;a href=\"member.php\"&gt;&lt;/a&gt;</code> in the echo statement. But, I'm getting a syntax error when I add any hyperlink in my PHP. Is there something I'm missing here? Thank you.</p> <pre><code>if ($username==$dbusername &amp;&amp; $password==$dbpassword) { echo "You're in! &lt;a href=\"member.php\"&gt;&lt;!--I'm getting the sytax error in the hyper link here.--&gt;Click here&lt;/a&gt; to enter the member area"; } else echo "Incorrect username/password"; } else die('That user does not exist'); } else die('Please enter a username/password'); ?&gt; </code></pre> <p><strong>UPDATE</strong></p> <p>Updated with escape tags.</p>
php
[2]
3,582,731
3,582,732
Error with methods and while loop in java
<p>I have problem with "compareMethod" and with the while loop, so if anyone has any idead how to help me i would be grateful thank you. I am using Eclipse as an Ide.</p> <p>I want to enter three values and then to print the smallest one.</p> <p>Here is my code:</p> <pre><code>import java.util.Scanner; public class CompareValues { public static void main( String[] args ) { System.out.println(); System.out.println( "The smallest number is: " ); int first; int second; int third; checkMethod( first, second, third ); } static int checkMethod( int firstNumber, int secondNumber, int thirdNumber ) { Scanner input = new Scanner( System.in ); System.out.println( "Enter three nubmers between 1 - 100: " ); firstNumber = input.nextInt(); secondNumber = input.nextInt(); thirdNumber = input.nextInt(); if ( ( 0 &lt; firstNumber ) || secondNumber || ( thirdNumber &gt; 100 ) ) { System.out.println( "Invalid entry: enter numbers between 1 and 100 only: " ); } } static int compareMethod( int first, int second, int third ) { if ( ( first &lt; second ) &amp;&amp; ( first &lt; third ) ) { return first; } else if ( ( second &lt; first ) &amp;&amp; ( second &lt; third ) ) { return second; } else { return third; } } } </code></pre> <p>When I compiled the code I got this message:</p> <blockquote> <p>Exception in thread "main" java.lang.Error: Unresolved compilation problems: The local variable first may not have been initialized The local variable second may not have been initialized The local variable third may not have been initialized at CompareValues.main(CompareValues.java:11) </p> </blockquote>
java
[1]
1,291,250
1,291,251
Why the use of cin,cout or %I64d is preferred over %lld specifier in C++?
<p>Why many of the Online Judges advises "do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier." ? </p>
c++
[6]
3,273,932
3,273,933
How can I solve a PHP syntax error that I receive when parsing html code?
<p>Trying to print out some html forms but I get a parsing syntax error. I believe it gets stuck on the SERVER[PHP_SELF] but I'm not sure. How can I get this to echo correctly?</p> <p>Error occurs on the SERVER[PHP_SELF] line</p> <p>Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING</p> <pre><code>function drawbuttons() { echo &lt;&lt;&lt;EOT &lt;table&gt; &lt;tr&gt;&lt;td&gt; &lt;form action="&lt;?=$_SERVER['PHP_SELF'];?&gt;" method="post"&gt; &lt;input type="submit" name="previous" value="Previous" STYLE="font-size:12pt; background-color:00BFFF; color:ffffff"&gt;"; &lt;/form&gt; &lt;/td&gt; &lt;td&gt; &lt;form action="&lt;?=$_SERVER['PHP_SELF'];?&gt;" method="post"&gt; &lt;input type="submit" name="next" value="Next"STYLE="font-size:12pt; background-color:00BFFF; color:ffffff"&gt; &lt;/form&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; EOT; } </code></pre>
php
[2]
645,752
645,753
Cannot convert from View to Button
<p>Very frustrating problem I have here. I have this code:</p> <pre><code>Button b = findViewById(android.R.id.button1); </code></pre> <p>And I'm getting this error on it:</p> <blockquote> <p>Type mismatch: cannot convert form View to Button</p> </blockquote> <p>But button1 <strong>is</strong> a button!! In my XML layout document the button has been declared like this:</p> <pre><code>&lt;Button android:id = "@+id/button1" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:text = "Next Activity" /&gt; </code></pre> <p>And in my R.java:</p> <pre><code>public static final class id { public static final int button1=0x7f050000; } </code></pre> <p>Why I get and error saying that my button is a view when it actually is indeed a button... is a mystery.</p>
android
[4]
2,251,436
2,251,437
In PHP, how do we return a large array?
<p>Say if this is the code:</p> <pre><code>function bar() { $result = array(); for ($i = 0; $i &lt; 1000; $i++) { $result[] = $i * 10; } return $result; } $ha = bar(); print_r($ha); </code></pre> <p>Is it not efficient to return a large array like that since it is "return by value"? (say if it is not 1000 but 1000000). So to improve it, would we change the first line to:</p> <pre><code>function &amp;bar() { </code></pre> <p>that is, just by adding an <code>&amp;</code> in front of the function name -- is this a correct and preferred way if a large array is returned?</p>
php
[2]
5,080,536
5,080,537
asp.net controls for MAP based Applications
<p>I am new to stackoverflow, I am creating an .net web map applications similar to google maps. But my 1st requirement is to create my own map. please suggest tools to create shapefiles,index files and dbfiles.</p> <p>2nd requirement is that i need to know controls in asp.net for implementing it.</p> <p>I have a jpg image of my map can i use that image as my map or do i need to create the shape files for this. I want to include all the features shown in google map in my application.</p> <p>Note .net 3.5 framework is where i have to implement this application. And also i can not use any existing map such as bing, google maps.</p>
asp.net
[9]
4,482,255
4,482,256
Can't be resolved to a type
<p>I have a service interface that reads thus</p> <pre><code>package services; import domain.Items; public interface IItemsService extends IService { public final String NAME = "IItemsService"; /** Places items into the database */ public void storeItem(Items items); /** Retrieves items from the database * * @param category * @param amount * @param color * @param type * @return * @throws ClassNotFoundException */ public Items getItems (String category, float amount, String color, String type) throws ItemNotFoundException, ClassNotFoundException; } </code></pre> <p>And a factory that looks like this...</p> <pre><code>package services; public class Factory { public Factory(){} @SuppressWarnings("unchecked") public IService getService(String name) throws ServiceLoadException { try { Class c = Class.forName(getImplName(serviceName)); return (IService)c.newInstance(); } catch (Exception e) { throw new ServiceLoadException(serviceName + "not loaded"); } } private String getImplName (String name) throws Exception { java.util.Properties props = new java.util.Properties(); java.io.FileInputStream fis = new java.io.FileInputStream("properties.txt"); props.load(fis); fis.close(); return props.getProperty(serviceName); } } </code></pre> <p>This should be really simple - but I keep getting two errors - IService cannot be resolved to a type (on both the factory and the service) and also an serviceName cannot be resolved into a variable error in the factory. I know I am missing something simple...</p>
java
[1]
1,034,701
1,034,702
Passing String array between two class in android application
<p>I am new to android. i dont know how to pass string array between two class. I tried Intent, by sharing string array between the class, but i get only one string, the rest of the string will not displayed. Some of my friend said, using Bundle we can access string array between the class, but i dont know how to use the bundle function. can anyone guide me how to pass the string array. </p>
android
[4]
1,628,438
1,628,439
What is a pseudo-virtual function in C++?
<p>What is a pseudo-virtual function in C++?</p>
c++
[6]
959,866
959,867
setting the datetime in jquery datetime picker with database datetime
<p>i am developing a multi language site.My problem is i need to set the date and time in the datepicker from the database as the user may have choose the different timezone while registering in the site.At present i am getting the server time on my jquery datepicker.</p> <p>Thanks in advance.</p> <p>Technology used:Asp.net mvc,Jquery. Database:Sql server2005. O/s :winxp.</p>
jquery
[5]
784,747
784,748
CompleteWizardStep not working as should be - Why?
<p>I am trying to create a website which will allow users to register, log in, change password, etc.</p> <p>Currently i am creating the register process, and i am doing this by using a custom CreateUserWizard in order to avoid the default buttons that it inserts. I have successfully created the custom CreateUserWizardStep and when i run the page from VS 2010, i see all the controls on the webpage, that is, Username, email, password, etc textbox-controls. Everything looks as supposed to look.</p> <p>I didn't want to use the default Create User button that the CreateUserWizard control inserts, and so i put an asp button with ID="Next" Text=Create User and CommandName=MoveNext</p> <p>Note that I still haven't written code to store the user's credentials in the database yet. I don't want to do that yet. </p> <p>I also have created the CompleteWizardStep,which follows the CreateUserWizardStep, containing an asp Literal saying that the account was created successfully, when the account will be created, that is when i will also implement the storing of user's credentials into the database that i have created, cause i don't want to use the default one that the .NET framework provides. I will use SQLMembership Provider, but my own database.</p> <p>When i click the Create User button (i remind that is not the default button of the CreateUserWizard , but an asp button that i inserted), the message in the CompleteWizardStep control doesn't show up at all on the browser. So i assumed that the CompleteWizardStep control is not working. </p> <p>**And my question is why is this happening? Is it because i haven't implemented yet the storing of data into the database and that way the CreateUserWizard control detects this fact and doesn't move to the CompleteWizardStep ? If so, how the CreateUserWizard control detects that the data were stored successfully into the databse? Shouldn't the CompleteWizardStep control run immediately after the Create User button is clicked?</p> <p>If not so, what am i doing wrong?**</p> <p>If you need code sample i can provide it, but i didn't do so because this is more like a general question i am putting here.</p> <p>Thank you in advance ! </p>
asp.net
[9]
5,401,635
5,401,636
Need Excel writer for php4
<p>can anyone tell me where to find an <strong>"excel writer"</strong> which supports <strong>"PHP4"</strong> . I have been searching on the web from the past few days and all I can get is Excel writer which supports PHP5 . </p> <p><strong>We need an excel writer which supports PHP4 as it is one of our clients requirements</strong> . </p> <p>Any help on this is very much appreciated . </p> <p>Thanks in advance.</p>
php
[2]