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
5,007,422
5,007,423
JavaScript: Detect Object Property Deletion
<p>Is there a way to detect object property deletion?</p>
javascript
[3]
3,604,239
3,604,240
Use eval() with different local scope
<p>I would like to know how it is possible to call eval() with data from a different local scope.</p> <p>Something like:</p> <pre><code>function doSomething() { var y = 1; print_and_eval('y+1'); } function print_and_eval(data) { print(data); eval(data); } </code></pre> <p><strong>Edit:</strong> - It is safe to use eval() in my case. Please do not recommend this as a solution. - The main problem is, that I have local variables in doSomething() which are not defined in print_and_eval(). The evaluation then leads to an 'ReferenceError: y is not defined' error.</p> <pre><code>js&gt; print_and_eval('var a = {x:1}') var a = {x:1} js&gt; print_and_eval('print(a.x)') print(a.x) typein:3012: TypeError: a is null </code></pre> <p>I would like to receive the output '1' in this case.</p>
javascript
[3]
4,475,512
4,475,513
session in class. how can i access?
<p>i have a doubt i added a class in my project when i type for session it is not coming in intelliscense. Is session can available in classes.</p>
asp.net
[9]
3,423,617
3,423,618
I am getting the error .class expected but can not find a solution to change the line! Any ideas?
<p>The method is-</p> <pre><code>private class DisplayNum implements ActionListener { public void actionPerformed(ActionEvent e) { intInput = String.valueOf(array[]); finalArea.setText("\n" + intInput); } } </code></pre> <p>Now the problem is with the <code>intInput</code> line, I am getting a .class expected and have been told I need to change the line in general but do not know what to make it.</p>
java
[1]
3,441,767
3,441,768
How to clear current activities in the stack?
<p>Support App starts activity A, then A starts activity B and finishes itself. After that activity B starts activity C.</p> <p>Now the stack contains B and C, with C at the top. </p> <p>Then I click a button in activity C, and want it to clear B and C and start activity A, i.e. I want activity A to be the only activity in the stack. How can I make it?</p> <p>Thanks!</p> <p>Edit: I made a test to use FLAG_ACTIVITY_CLEAR_TOP. But it didn't work in my case, because activity A is not running when button in activity C is clicked.</p>
android
[4]
1,900,313
1,900,314
Puting contact number into field
<p>I have this code that has one button that let's me choose an entry from contacts, and passes that choesn contact to onActivityResult function. My question is how do I select data of that single contact when all that is passed is an Intent in data variable. That data variable, if converted to string shows something like "dat: content://contacts/people/4" so I see that selected contact is somehow passed, but what now? How to get that data?</p> <p>And also all I found by googling was examples with deprecated class People, so I don't know how too use new classes.</p> <p>Please help.</p> <p>Thank you.</p> <pre><code>public class HelloAndroid extends Activity { private static final int CONTACT_ACTIVITY = 100; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button contactButton = (Button) findViewById(R.id.pick_contact_button); contactButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Uri uri = Uri.parse("content://contacts/people"); Intent contacts_intent = new Intent(Intent.ACTION_PICK, uri); startActivityForResult(contacts_intent, CONTACT_ACTIVITY); } }); } public void onActivityResult(int requestCode, int resultCode, Intent data){ super.onActivityResult(requestCode, resultCode, data); switch(requestCode){ case(CONTACT_ACTIVITY): { if(resultCode == Activity.RESULT_OK) { alertText(data.toString()); } break; } } } } </code></pre>
android
[4]
4,615,843
4,615,844
How to open website link with parameter instead using of Form in jquery?
<p>"cmd" and "hosted_button_id" are name of input box.</p> <p>I don't like to use Form then change to jquery</p> <p>$.post('https://www.paypal.com/cgi-bin/webscr',{cmd:'_s-xclick',hosted_button_id:'LWFDKCLKLEE'});</p> <p>Hi, I can't fingure out this way. I like to open new link with parameter in jquery. I check something before this line. Thanks. Please help me out.</p>
jquery
[5]
40,261
40,262
jquery form change detection
<p>nice script. Can someone please explain to me how to implement it with other form tag like radio and also with file upload.</p> <p>have Dream Day</p>
jquery
[5]
4,161,328
4,161,329
C# release version has still .pdb file
<p>HI All I want to deploy the release version of my application done in C#.</p> <p>When I build using the RELEASE config I still can see that the .pdb file is produced meaning that my application can be still debugged; this means also that still some debug information is present somewhere in my code slowing it down a little bit.</p> <p>If this is true how to completely suppress any debug information produced in the code? Do you know also the reason of this .pdb? The RELEAASE configuration has the OPTIMIZED code checked and only the TRACE constant defined, not the DEBUG. Thanks for the help</p> <p>AFG</p>
c#
[0]
453,628
453,629
printf issue with array
<p>So i have a problem with taking an array and looping through the values and outputing with a foreach statement.</p> <p><strong>code</strong></p> <pre><code>&lt;?php $example = array("test" =&gt; "hello world" ); foreach ($example as $arr) { printf("&lt;p&gt;what do you have to say for yourself?&lt;/p&gt;&lt;p&gt;%s!&lt;/p&gt;",$arr["test"]); } ?&gt; </code></pre> <p><strong>hoping to get the output:</strong></p> <p>what do you have to say for yourself?</p> <p>hello world!</p> <p><strong>Instead get</strong></p> <p>what do you have to say for yourself?</p> <p>h!</p> <p>why just the single character?</p> <p>Any help would be great</p> <p>thanks</p>
php
[2]
582,551
582,552
How do I add transition effects to table rows with jQuery
<p>The following jQuery code swaps table rows when some buttons are clicked. I would like to know how to add a transition effect so that there's a fade-in or fade-out transition effect when a row is moved (instead of the change happening instantaneously). I'm not sure where or how to apply the transition!</p> <pre><code>// Move item to top or up/down by one $(".top,.up,.down").click(function(){ // This row var row = $(this).parents("tr:first"); // When up is pressed if ($(this).is(".up")) { row.insertBefore(row.prev()); } // When top is pressed else if ($(this).is(".top")) { var firstRow = row.parent().find("tr:first").not(row); row.insertBefore(firstRow); } // When down is pressed else { row.insertAfter(row.next()); } </code></pre>
jquery
[5]
1,666,585
1,666,586
php code md5 hashing explanation
<p>I am working with the moodle system, but it turns out that it uses md5 salt hashing. I found some come, so maybe you could explaint it to me because I am have only basic knowledge of php.</p> <pre><code>function validate_internal_user_password($user, $password) { global $CFG; if (!isset($CFG-&gt;passwordsaltmain)) { $CFG-&gt;passwordsaltmain = ''; } $validated = false; if ($user-&gt;password === 'not cached') { // internal password is not used at all, it can not validate } else if ($user-&gt;password === md5($password.$CFG-&gt;passwordsaltmain) or $user-&gt;password === md5($password) or $user-&gt;password === md5(addslashes($password).$CFG-&gt;passwordsaltmain) or $user-&gt;password === md5(addslashes($password))) { // note: we are intentionally using the addslashes() here because we // need to accept old password hashes of passwords with magic quotes $validated = true; } else { for ($i=1; $i&lt;=20; $i++) { //20 alternative salts should be enough, right? $alt = 'passwordsaltalt'.$i; if (!empty($CFG-&gt;$alt)) { if ($user-&gt;password === md5($password.$CFG-&gt;$alt) or $user-&gt;password === md5(addslashes($password).$CFG-&gt;$alt)) { $validated = true; break; } } } } if ($validated) { // force update of password hash using latest main password salt and encoding if needed update_internal_user_password($user, $password); } return $validated; </code></pre> <p>}</p> <p>Would it be hard to change it that after entering simple text it would became hashed?</p>
php
[2]
5,679,407
5,679,408
compare arraylist with string
<p>I want to compare two variables the first arraylist and the second is string</p> <p>How can i convert the String to arrayList to compare those values in the variables</p> <p>thank you in advance</p>
android
[4]
3,406,444
3,406,445
i am developing stock management system in java but i am new in java
<p>I am developing stock management system in java and I am new in java.I started coding but stucked.i would like to make a login form and there will be username JTextfield and password JPasswordfield, login button, cancel and register button.login button for login if user name and password is correct,if not will not authenticated. cancel button to cancel login and erase user name and password in the textbox. and register button for registering new user.</p> <p>I need to code connect Database also and I am using MS SQL 2005. can anyone please help me?</p>
java
[1]
4,070,076
4,070,077
change label text in usercontrol at run time
<p>hello i m new to c# and im working on a project,in which i made a usercontrol1 as *<em>label textbox datepicker</em>*now i wnt to change the label text,i m trying this code but it is not working</p> <pre><code>using System; using System.Windows.Forms; namespace library_system { public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } // private string DateLabel public string DateLabel { **get { return DateLabel.Text; }//error when i write dateLabel.Text set { DateLabel.Text= value;//error datelabel.Text }** } </code></pre> <p>i m using this code in usercontrol for is it right to do this way??</p> <p>and in the main form i m writing code as <code>userControl11.DateLabel="From Date</code>";//on for load event??Is this Right Thanks in advance!!</p>
c#
[0]
3,651,954
3,651,955
how to create a calculating property
<p>say i have a some properties</p> <pre><code>public int redBalls { get; set; } public int blueBalls { get; set; } </code></pre> <p>I now want to have a totalBalls property which will add the two.</p> <p>Would I do this?</p> <pre><code>public int totalBalls { get { return redBalls + blueBalls; } } </code></pre> <p>I'm trying this but the result is 0</p> <p>*edit, i've spoken to my lead developer and it's because whatever accesses totalBalls isn't notified of the changes of redBalls or blueBalls so it wont recalculate those values</p> <p>So I have to do <code>OnPropertyChanged("total")</code></p>
c#
[0]
4,351,020
4,351,021
Compilation of Java jar or War to native
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file">How can I convert my Java program to an .exe file?</a> </p> </blockquote> <p>Is there any way to compile the Java jar or War file to the Native executable? I want to compile the Java jar file to native executable in windows or executable in linux. How can I do that?</p>
java
[1]
4,952,112
4,952,113
Change ImageView image inside onClick event
<p>I have an ImageView working as a button in my program. I need it to be an ImageView since I want just the image to be shown, not the borders.</p> <p>This button is a lamp, if the data in database says it's visible, the lamp must be "on", when you click the button, it will check the data from bank and change it to "off" if it's on and vice-versa.</p> <p><strong>So, the change of image will happen inside a onClick event.</strong></p> <p>Here is my code:</p> <pre><code>btnVisualizar.setClickable(true); btnVisualizar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { if (visivelBanco.getText().equals("Y")) { btnVisualizar.setImageResource(this.getResources().getIdentifier( "drawable/visible_off", null, this.getPackageName())); } else { btnVisualizar.setImageResource( this.getResources().getIdentifier("drawable/visible_on", null, this.getPackageName())); } } catch (Exception e) { Toast.makeText( getBaseContext(), "Falha ao modificar visibilidade do item!", Toast.LENGTH_SHORT).show(); } } }); </code></pre> <p>However the compiler doesn't recognize the method getResources() and getPackageName().</p> <p>What am I doing wrong?</p> <p>Any help is appreciatted.</p>
android
[4]
1,227,395
1,227,396
How to implement this UI
<p>Just curious if the tab bar UI element in screenshots is some built in class or customized. If it is customized, then please give me a hint on what classes I might check to have something like that.</p> <p>The first screenshot is initial tab bar. When I tap on the last icon the tab bar smoothly(animated) resize itself as on second screenshot. If I press the edit button the icons are shaking(as on iPhone home) and I'm able to arrange them.</p> <p>first</p> <p><img src="http://img686.imageshack.us/img686/3899/photo2aw.jpg" alt="tab bar"></p> <p>second</p> <p><img src="http://img38.imageshack.us/img38/5673/photo3kq.jpg" alt="more buttons"></p>
iphone
[8]
2,924,493
2,924,494
How to change device volume from seek bar in android
<p>I know how to control volume of media player from seekbar.But how can i do to change system volume from seekbar in android. </p>
android
[4]
5,087,469
5,087,470
How to change value of a variable in php by clicking a link or radio button or checkbox
<p>I am creating a system in php to get user's feedback on solutions. I am using MySQL to get the solution and store the feedback. The feedback are integers. There are two columns for feedback- Yes and No. I want to increase the value of them when a user clicks on a text link/radio button or checkbox. Like- .................Solution.............. Did this help you? Yes / No</p> <p>When user clicks on Yes, it should increase value of yes column by one and if it clicks on No, it should increase value of no column by one. The main difficulty is this that the page contains numbers of solution and feedback options.. Can you help me??</p>
php
[2]
362,842
362,843
compare two dates using compare validator
<p>I am trying to compare two date textboxes to make sure one date is greater than the other. I am getting errtatic response where it is rejecting this rule eventhough the date is greater. Anything wrong with this code? Here is my definition</p> <pre><code> &lt;asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtStDt" ControlToValidate="txtEdDt" ErrorMessage="End date must be later than the start date!" Operator="GreaterThan" Type="Date" ValidationGroup="VG1"&gt; &lt;/asp:CompareValidator&gt; </code></pre> <p>The date format I'm using with the calendar extender in both the dates' textboxes is 'dd/MMM/yyyy'. Thank you for any help!</p>
asp.net
[9]
5,297,235
5,297,236
Replace string if specific characters found in php
<p>I want to replace the characters if specific characters found.<br> for example my text having below value :</p> <pre><code>$text = "@abc hi there!! @jkl,@xyz how are you?"; </code></pre> <p>Here I want to replace all words which starts with '@' and output should be like </p> <pre><code>$text = "&lt;a href='abc'&gt;@abc&lt;/a&gt; hi there!! &lt;a href='jkl&gt;@jkl&lt;/a&gt;,&lt;a href='xyz'&gt;@xyz&lt;/a&gt; how are you?"; </code></pre> <p>words may seperate with blank space or comma (with/without space). I want to replace <code>"@abc"</code> with <code>"&lt;a href='abc'&gt;@abc&lt;/a&gt;"</code>.</p> <p>Thanks in advance</p>
php
[2]
4,591,513
4,591,514
How can I get the ID and title of a post in PHP?
<p>How can I get the ID and title of a post in PHP? Each post has an ID and a title, and I need to be able to get both.</p> <pre><code>ID# Title 1013 Name 1025 Name </code></pre>
php
[2]
849,264
849,265
Passing Arguments in javascript
<p>I want to understand the following behaviour because the explanation on this site <a href="http://bonsaiden.github.com/JavaScript-Garden/" rel="nofollow">javascript garden</a> is not enough for me.</p> <p>It would be much appreciated if you could give me a clear explanation about the questions which are in the inline comments.</p> <p>Here the example:</p> <pre><code>function Foo() {} Foo.prototype.method = function(a, b, c) { console.log(this, a, b, c); }; Foo.method = function() { Function.call.apply(Foo.prototype.method, arguments); }; Foo.prototype.method(1,2,3) // Foo { method=function()} 1 2 3 //this output is obvious Foo.method(1,2,3) // Number {} 2 3 undefined // I want understand why the first argument is a number and the last one is undefined </code></pre>
javascript
[3]
5,818,666
5,818,667
Problem with jQuery add() issue
<p>I have a quick question. My brain is fried and I cannot think :(.</p> <p>Why the following code is not adding tag to MyDivClass: </p> <pre><code>$("div.MyDivClass").add("&lt;a href='' id='test'&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;"); $("div.MyDivClass a#test").attr("href","www.test.com"); $("div.MyDivClass a#test span").html("text1"); </code></pre>
jquery
[5]
2,581,204
2,581,205
$_POST Array from html form
<p>I am trying to send data from multiple checkboxes (id[]) and create an array "info" in php to allow me to run a script for each value (however the quantity of values may change each time) however first I am trying to display the content of each array value. I am not quite sure how to put my array populating line to save all the content to the array.</p> <p>HTML</p> <pre><code>echo("&lt;input name='id[]' type='checkbox' value='".$shopnumb."'&gt;"); </code></pre> <p>my hopeful processing code currently is -</p> <pre><code>$info=$_POST['id[]']; Echo(array_values($info)); </code></pre> <p>what do I need to do to make the content sent by post from the form checkboxes populate the array info</p> <p>any help is greatly appreciated</p> <p>edited for clarification.</p>
php
[2]
5,820,654
5,820,655
Android ANR Debug help
<p>So my app has been immediately giving an ANR when one of my classes is run. Ive been looking through the debugger and trying to understand what is going on. I'm new to android, and have zero experienced debugging. So if anyone could help me make sense of what is going on that would be great.</p> <p>My onCreate(): <a href="http://pastebin.com/QzT5KA0L" rel="nofollow">http://pastebin.com/QzT5KA0L</a></p> <p>My GuiThreader(used in onCreate): <a href="http://pastebin.com/VCp7KegY" rel="nofollow">http://pastebin.com/VCp7KegY</a></p> <p>Here is what shows up on my Debug tab when the app fails:</p> <pre><code>ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord) line: 2268 ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord) line: 2284 ActivityThread.access$1800(ActivityThread, ActivityThread$ActivityRecord) line: 112 ActivityThread$H.handleMessage(Message) line: 1692 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 ActivityThread.main(String[]) line: 3948 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 521 ZygoteInit$MethodAndArgsCaller.run() line: 782 ZygoteInit.main(String[]) line: 540 NativeStart.main(String[]) line: not available [native method] </code></pre>
android
[4]
2,234,155
2,234,156
Target div using URL's href value
<p>I have a simple site where each "page" is actually a <code>section</code>. The sections are layered on top of each other using <code>position:absolute</code> and <code>z-index</code>; when a navigation item is clicked, the section with an id matching the class name of the navigation item is promoted to the top of the stack, changing the "page".</p> <p>What's got me stuck now, though, is figuring out how to target a particular section from a link within the content of another section. I know the gist of what I have to do, but I'm lost as far as the execution goes.</p> <p>How I imagine it needs to go is this:</p> <pre><code>$('section a[href^=#]').click(function(){ var target = $(this).attr(href).(strip the hashtag from the beginning of the link and output the resulting value); $('body').find('section[id='+target+']').addClass('active').css('z-index', '2') $('body').find('section[id!='+target+']').removeClass('active').css('z-index', '1') }); </code></pre> <p>I imagine this involves RegEx somehow, which I know nothing about. Any thoughts?</p>
jquery
[5]
1,409,504
1,409,505
How to quickly try out Java code?
<p>When I'm coding in Python and I want to try something out, I open IDLE of Python on the command line and am able to quickly try something out. Is there a similar way I could do that for Java?</p> <p>I have heard about Java "shells" (e.g. <a href="http://www.beanshell.org/" rel="nofollow">http://www.beanshell.org/</a>). Has anyone tried them?</p>
java
[1]
2,619,948
2,619,949
how do i make hazelcast to store in my database using MapStore implementation
<p>I implemented MapStore and configured hazelcast so that it would know that when calling map.put it has to call in background .store from my implementation, at least that`s what i read.</p> <p>If i use my implementation directly it stores what i what but if i call map.put it doesn't. Can someone tell me why it doesn't or if i`m doing something wrong?</p> <p>here is my MapStore implementation:</p> <pre><code>public class MyMapStore implements MapStore&lt;String, Object&gt; { private Session session = HibernateUtil.openSession(); @Override public Object load(String key) { // TODO Auto-generated method stub return null; } @Override public Map&lt;String, Object&gt; loadAll(Collection&lt;String&gt; keys) { // TODO Auto-generated method stub return null; } @Override public Set&lt;String&gt; loadAllKeys() { // TODO Auto-generated method stub return null; } @Override public void store(String key, Object value) { Transaction tx = session.beginTransaction(); session.save((MyObject)value); tx.commit(); } @Override public void storeAll(Map&lt;String, Object&gt; map) { // TODO Auto-generated method stub } @Override public void delete(String key) { // TODO Auto-generated method stub } @Override public void deleteAll(Collection&lt;String&gt; keys) { // TODO Auto-generated method stub } } </code></pre> <p>and here is how i configure hazelcast:</p> <pre><code>h.getConfig().getMapConfig("default").setMapStoreConfig( new MapStoreConfig().setEnabled(true).setClassName( MyMapStore.class.getName()).setWriteDelaySeconds(0)); </code></pre> <p>if i print the hazelcast configuration it tells that all i setted is there so i don't know what`s wrong. P.S. i'm using hazalcast 2.2</p>
java
[1]
482,005
482,006
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,406,975
4,406,976
How to open a selected file in android?
<p>In windows text files are displayed with notepad icon. When we double click the particular file it open’s the notepad and displays the file. Like that I need to open the file from the download folder in android. I have used the intent-filter for register my ics file’s mime type. When I select the file in the download folder it just opens my application only. At that time I need to open / read the selected file. How to do this? I am new to android Can anyone help me?</p>
android
[4]
1,864,561
1,864,562
Android where to store credential info like url, username, passcodes?
<p>I have an app which will connect to server and provide some basic connection credential information like server url, userer, application id etc What is the best option for storing this information within the android app? Should it be a preference? not sure where to store these items. I should clarify this question a bit. There are different levels of security requirements, so I am interested in hearing about how to encrypt the password etc, but there are also items which are generally not encrypted like connection urls etc, so I am also interested in how to store such information as well. I am basically looking for a better solution</p>
android
[4]
166,011
166,012
write output of print_r in a txt file. PHP
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2628798/print-array-to-a-file">Print array to a file</a> </p> </blockquote> <p>How can I write the ouput (for example when I use an array), in a file?, I was trying with this:</p> <pre><code> ... print_r($this-&gt;show_status_redis_server()); $status_redis = ob_get_contents(); fwrite($file, $status_redis); ... </code></pre>
php
[2]
1,488,304
1,488,305
jquery find immediate parent of current element
<p>how can i get immediate parent of a given element ?</p> <p>$(e.target).parent() ?</p>
jquery
[5]
2,975,437
2,975,438
Persian Calendar Problem with CultureInfo
<p>What's wrong with this code?</p> <pre><code> //Error(Exception) Message : Not a valid calendar for the given culture. System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("fa-Ir"); ci.DateTimeFormat.Calendar = new System.Globalization.PersianCalendar(); Application.CurrentCulture = ci; </code></pre> <p>and what's its solution? Can i add a Calendar type to windows XP regional option ? :)</p>
c#
[0]
2,876,642
2,876,643
Javascript setInterval question
<p>I noticed something that I can't quite explain. I made this javascript code that grows or shrinks a blue box. The script is here:</p> <pre><code>var animated = { timer : null, el : document.getElementById("divNavyBox"), startGrowAnimation : function() { this.stopAnimation(); this.timer = setInterval( animated.doAnimation(5), 10); }, startShrinkAnimation : function() { this.stopAnimation(); this.timer = setInterval(function() { animated.doAnimation(-5); }, 10); }, stopAnimation : function() { clearInterval(this.timer); }, doAnimation : function(amount) { var size = this.el.offsetWidth; if ((amount &gt; 0 &amp;&amp; size &lt; 200) || (amount &lt; 0 &amp;&amp; size &gt; 0)) { this.el.style.width = size + amount + "px"; this.el.style.height = size + amount + "px"; } else { this.stopAnimation(); } } }; </code></pre> <p>When the startGrowAnimation method of the animated class is called, the box visually grows until it reaches a certain width and height. It then stops. The startGrowAnimation code is located below:</p> <pre><code>startGrowAnimation : function() { this.timer = setInterval(function() { animated.doAnimation(5); }, 10); } </code></pre> <p>This code WORKS just fine. However, I don't understand WHY it's necessary to put an anonymous function in the parameter instead of just the normal call function. So, I replaced the code above with the code below:</p> <pre><code>startGrowAnimation : function() { this.stopAnimation(); this.timer = setInterval(animated.doAnimation(5), 10); }, </code></pre> <p>When I use this code, for some reason, the box only increases in size by five pixels each time the startGrowAnimation method is called. </p> <p>So, why is it necessary to include the startGrowAnimation method inside of an anonymous function call in this case? </p>
javascript
[3]
3,905,674
3,905,675
Creating singleton factory
<pre><code> String fullName = PATH + "." + name; Class cl= Class.forName(fullName); if(name.equalsIgnoreCase("MobileSearch")){ if(msearchType==null){ msearchType=(SearchInterface)cl.newInstance(); } return msearchType; } if(name.equalsIgnoreCase("BookSearch")){ if(bsearchType==null){ bsearchType=(SearchInterface)cl.newInstance(); } return bsearchType; } </code></pre> <p>How do I get rid of the <code>if</code> statements here.<br /> I am using reflection.<br /> Please help. Thanks in advance.</p>
java
[1]
2,915,387
2,915,388
Feedback that a slow php script is working?
<p>Running a PHP script that is doing a huge mysql query plus some crunching on the results. Because of this the script takes a long time to execute and may appear to be not working to the user.</p> <p>Is there a way to provide feedback to the user that the script is running? Perhaps way to print to the browser with each loop - indicating what record it's on... kind of a "live output buffer" or something?</p>
php
[2]
5,679,836
5,679,837
Change the width of images with same class uniformly using jQuery?
<p>I have multiple images that have the same class attribute and I want to resize all the images uniformly even though they all have different original widths - how can I do this using jQuery?</p> <pre><code>&lt;img id=img1 class="ResizeMe" src="img1.gif" width="100" height="100" /&gt;&lt;br /&gt; &lt;img id=img2 class="ResizeMe" src="img2.gif" width="200" height="200" /&gt;&lt;br /&gt; &lt;img id=img3 class="ResizeMe" src="img3.gif" width="150" height="150" /&gt;&lt;br /&gt; &lt;input id="Button1" type="button" value="Shrink Images by 10%" /&gt; &lt;input id="Button2" type="button" value="Grow Images by 10%" /&gt; </code></pre> <p>TIA!</p> <p>UPDATE: Here's the final working code I used for anyone hitting this in the future...</p> <pre><code> function OnClientValueChanging(sender, args) { var zoomPercentage = args.get_newValue() / 100; $(".ApplyZoomEffect").each(function () { var newWidth = parseFloat($(this).attr('OriginalWidth')) * zoomPercentage; var newHeight = parseFloat($(this).attr('OriginalHeight')) * zoomPercentage; $(this).css('width', newWidth + "px").css('height', newHeight + "px"); }); } </code></pre>
jquery
[5]
4,860,946
4,860,947
how to use tab view in android
<p>how to use tab view in android applcation,..</p>
android
[4]
2,644,050
2,644,051
Simple loop/repeat on hover in jQuery?
<p>I have a function that animates when a div is hovered on:</p> <pre><code>$('.left_scroll_button').hover(function(){ $(".scrolling_list").stop().animate({scrollLeft: '-=5px'}, 1); }); </code></pre> <p>This just animates the thing once. I want to repeat the animation continuously.. Is there some easy way to loop this? I tried to do this:</p> <pre><code>$('.left_scroll_button').hover.everyTime(10,function(){ $(".scrolling_list").stop().animate({scrollLeft: '-=5px'}, 1); }); </code></pre> <p>But this didn't work. If anyone can hep, that would be great!</p>
jquery
[5]
2,405,225
2,405,226
Looking for a good approach and data structure to solve this
<p>C# WinForms:</p> <p>A Combobox with some items in in.<br> A spread sheet with some items in it. Each row also has a check-box so users can select them.</p> <p>User picks an items in the combobox and clicks a Save button. It means associate that Combobox item to those selected items in the spreadsheet.</p> <p><strong>Q1:</strong> What's a good structure I can use to keep track of which combobox item is associated with which items from the spreadsheet?</p> <p>NOTE: User can also Move up or Mode Down the items in the spreadsheet. So it gets a little tricky here, they might have associated some items, then they change the order or those items but we still need to know what items are selected for each combobox item</p> <p><strong>Q2:</strong> What's a good approach to keep track of that?</p>
c#
[0]
5,586,519
5,586,520
Where is DEBUG defined in the code?
<p>I looked at a sample code to create a log system on my server... And I found this</p> <pre><code>#if DEBUG printf("something here"); #endif </code></pre> <p>I know what it does. It prtins something only if DEBUG has been defiend. But where is DEBUG defined? I looked at the all the header files but I could't find DEBUG.. </p> <p>Also, Could you please provide me a good example or tutorial about designing logging system? </p> <p>Thanks in advance..</p>
c++
[6]
2,619,827
2,619,828
WebResponse and WebRequest
<p>I Have this code</p> <p>// Web request section</p> <pre><code>private static WebRequest Web_request(string ip) { WebRequest request = WebRequest.Create("http://website/"); request.Method = "POST"; string postData = "a=1&amp;b=2"; byte[] byteArray = Encoding.UTF8.GetBytes(postData); request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = byteArray.Length; Stream dataStream = request.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); return request; } </code></pre> <p>// Web response section</p> <pre><code>private static string Web_response(WebRequest request) { WebResponse response = request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); reader.Close(); dataStream.Close(); response.Close(); return responseFromServer; } </code></pre> <p>and main program </p> <pre><code>void Main() { for (int ii = 0; ii &lt; counter; ii++) { req[ii] = Web_request(ip_ext[ii]); } for (int ii = 0; ii &lt; counter; ii++) { string domen = Web_response(req[ii]); } } </code></pre> <p>But on the 3rd step of Web_request loop program show back the Form1 and freezes. Probably i should close something on web_request section.. any suggestions?</p>
c#
[0]
3,817,571
3,817,572
Looping through hidden fields
<p>I was wondering how i would loop through hidden fields with jquery to get their values. The hidden fields are in a php while loop.</p>
jquery
[5]
3,821,405
3,821,406
PHP Comments every x hours
<p>I am a beginner at PHP, but I am wanting it that a user is able to post a comment 10 times, in the period of 24 hours. If they reach 10 comments before this 24 hours is up, they will get a message saying something like "You can not post any more comments", and after the 24 hours, they are able to post again.</p> <p>Any ideas on how I can do this?</p> <p>Thanks.</p>
php
[2]
2,963,672
2,963,673
Highlight current url in menu ith jquery
<p>I have a menu but I want to highlight current link with jquery. </p> <pre><code>var loc = window.location; var lochref = $("#topNavigation li a").attr("href"); if(lochref == loc){ $('#topNavigation li a').addClass('currenthover'); } </code></pre> <p>With above script, there is no any change in "a" class. How can I do this with jquery? Thanks in advance</p>
jquery
[5]
419,730
419,731
Android timer problem
<p>I am using timer in my application for the background process and the timer runs successfully. But the problem is that i have to stop timer when logout button is clicked , the logout button is in different Activity. i have used timer.cancel() but As the Both Activity different it does't work. so give some hint to stop timer.</p>
android
[4]
5,059,370
5,059,371
How do you select all inputs inside a div with variables in its ID?
<p>I want to target all input fields inside of this DIV. But I can't seem to target it correctly. I keep getting: <strong>SyntaxError: missing ) after argument list</strong></p> <pre><code>var nameid= $.parseQuery(url_string).nameid; var deleteuserid = $.parseQuery(url_string).deleteuserid; $('#memberRow_' + nameid + '_' + deleteuserid).attr("disabled", true); //works $('#memberRow_' + nameid + '_' + deleteuserid :input).attr("disabled", true); //doesn't work </code></pre> <p>The div ID I want to target basically looks like "#memberRow_33_32" or whatever the two variables end up being.</p>
jquery
[5]
1,796,678
1,796,679
Regarding a byte condition
<p>I am stuck in an issue. I have the following method:</p> <pre><code>public byte determineCardType(final IInput inputData) { byte cardType = UNKNOWN_CARD; try { if (isWagRewardsLoyaltyCard(inputData)) cardType = WAG_LOYALTY_CARD_TYPE; else if (isDRCard(inputData)) //checking that card scanned and swiped is a DR Card cardType = DR_CARD_TYPE; else if (isWagRewardsPartnerCard(inputData)) cardType = AARP_CARD_TYPE; return cardType; } catch (Exception e) { return UNKNOWN_CARD; } } } </code></pre> <p>Then, I have another piece of code in which I am checking the card type that is returned from the above method.</p> <pre><code>if((aarpCardSupport.isAARPCard(input))||(determineCardType(input)==DR_CARD_TYPE)) { return true; }else if((isDRCard(input))&amp;&amp;(isDRLoayltyEnabled())) //would return 1 for DR card only when isDRLoayltyEnabled returns true { return true; } return false ; } </code></pre> <p>But in the above code as shown determinecardtype is showing an error since it's return type is byte and I cannot compare using </p> <pre><code>if((aarpCardSupport.isAARPCard(input))||(determineCardType(input)==DR_CARD_TYPE)) , </code></pre> <p>Please advise.</p>
java
[1]
4,565,889
4,565,890
Java charAt() Error
<p>I am new to java and don't know why I am getting this error or how to fix it. Any help please?</p> <blockquote> <p>Word.java:42: cannot find symbol</p> <p>symbol : method length()</p> <p>location: class char[]</p> <pre><code> char finalLetter = letters.charAt(letters.length()-1); ^ ^ </code></pre> <p>Thanks~~</p> </blockquote>
java
[1]
2,295,824
2,295,825
merging lists with lists
<p>I have a list packets=[['B', 'A'], ['B', 'C'], ['A', 'D'], ['C', 'D'], ['C', 'E'], ['D', 'E'], []]. I have two for loops on the same list something like:</p> <pre><code>for a in packets[:]: for b in packets[:]: </code></pre> <p>i.e., each time a=['B','A'] b iterates from ['B','A'] all the way to ['D','E']. This is what I want to do...if the last element of a is equal to the first element of b i.e., when a=['B','A'] and b=['A','D'] I must have ['B','A','D']. Again the last element of ['B','A','D'] is equal to the first element of ['D','E']. So, now I must have ['B','C','D','E']. Similarly, when A=['B','C'] and b=['C','E'] I must have ['B','C','E']. When A=['B','C'] and b=['C','D'] and b=['D','E'] I must have ['B','C','D','E'] and so on.</p>
python
[7]
2,151,162
2,151,163
I am getting this error when I run the web application
<p>I am getting error when I run the application,</p> <blockquote> <p>Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.</p> </blockquote> <p>This is the error I am getting when I run the application, I added the new dll and increased the trust level. Can you help me please.</p>
asp.net
[9]
825,744
825,745
window.moveTo not working in Google Developer Tool
<p>Originally, I was trying to use <code>JavascriptExecutor</code> in <code>Java</code> to maximize a browser window. It wasn't working so I decided to try something simpler, do it using <code>Javascript</code> directly.</p> <p>I'm experiencing something weird and would like some insight.</p> <ol> <li>Open up Google Developer Tool on this page for example.</li> <li>Move this page away from the top left corner of your computer screen, and un-maximize the window.</li> <li><p>Try the following code:</p> <p><code>window.moveTo(0, 0);</code></p> <p><code>window.resizeTo(screen.width, screen.height);</code></p></li> <li><p>Does your window move to the top left corner and maximize? Because mine doesn't.</p></li> </ol>
javascript
[3]
6,013,155
6,013,156
Limit Speed Download in Java
<p>i dont want use the Sleep method to limit speed upload download in my program. My teacher say there was another way to do this, please help me! Thanks!</p>
java
[1]
3,935,591
3,935,592
ASP.net , how display an alert box from server side code?
<p>I have a asp:button onclick... What I would like to do is display a JS alert should a condition not be met. I'm wondering how can I call or create the simple JS function from server side code?</p>
asp.net
[9]
2,597,978
2,597,979
preg_replace all spaces
<p>I'm trying to replace all spaces with underscores and the following is not working:</p> <pre><code>$id = "aa aa"; echo $id; preg_replace('/\s+/', '_', $id); echo $id; </code></pre> <p>prints</p> <pre><code>aa aaaa aa </code></pre>
php
[2]
4,869,548
4,869,549
TimePickerDialog.onTimeSetListener not called
<p>I'm using the following code to display a <code>TimePickerDialog</code>:</p> <pre><code>TimePickerDialog dialog = new TimePickerDialog(this, new OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { System.out.println("onTimeSet"); } }, 20, 15, true); dialog.setTitle("Test"); dialog.setButton(TimePickerDialog.BUTTON_POSITIVE, "Done", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { System.out.println("Done"); } }); dialog.setButton(TimePickerDialog.BUTTON_NEGATIVE, "Cancel", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { System.out.println("Cancel"); } }); dialog.show(); </code></pre> <p>On a device running Android 2.3.7, the <code>onTimeSet</code> method doesn't get called (the <code>onClick</code> methods do). On a device running 4.2.2 the <code>onTimeSet</code> does get called like it should. </p> <p>What is happening here?</p>
android
[4]
19,085
19,086
array count() problm
<pre><code>$nialiakhirpraktikum = $ntugasakhir+$ratarata; //from other process if ($nialiakhirpraktikum&gt;79) { $grade="A"; } else if ($nialiakhirpraktikum&lt;=79 AND $nialiakhirpraktikum&gt;67) { $grade="B"; } else if ($nialiakhirpraktikum&lt;=67 AND $nialiakhirpraktikum&gt;55) { $grade="C"; } else if ($nialiakhirpraktikum&lt;=55 AND $nialiakhirpraktikum&gt;44) { $grade="D"; } else { $grade="E"; } $array = array($grade); print_r(array_count_values($array)); </code></pre> <p>I have some result in array like this:</p> <pre><code>Array ( [B] =&gt; 1 ) Array ( [B] =&gt; 1 ) Array ( [C] =&gt; 1 ) Array ( [C] =&gt; 1 ) Array ( [B] =&gt; 1 ) Array ( [B] =&gt; 1 ) Array ( [B] =&gt; 1 ) Array ( [B] =&gt; 1 ) Array ( [B] =&gt; 1 ) Array ( [B] =&gt; 1 ) </code></pre> <p>how to get result as following:</p> <pre><code>score for B = 8 score for C = 2 </code></pre>
php
[2]
4,616,904
4,616,905
How to create a hardcoded lookup that would be reused by different parts of the program?
<p>I have what seems to me a basic issue that confuses me.</p> <p>Right now I have the following bad design (it seems to me it is bad design). I have a util class which looks something like this:</p> <pre><code>public class Countries { public boolean isCountryPresent ( String c ) { //public static final http://en.wikipedia.org/wiki/ISO_3166-1 Set&lt;String&gt; myStrings = new HashSet&lt;String&gt;(); myStrings.add("us"); // Afghanistan myStrings.add("af"); // Afghanistan myStrings.add("dz"); // Algeria myStrings.add("ao"); // Angola myStrings.add("az"); // Azerbiajan ... if ( myStrings.contains(c)) return true; else return false; } </code></pre> <p>And then I check for the existance of the item like this:</p> <pre><code>Countries co = new Countries ( ); boolean isPresent = co.isCountryPresent( countryISOCode ); </code></pre> <p>But I am thinking that instantiating the object each time wastes resources, no? Is there a more efficient way for doing this given that the country data does not need to be compiled more than once and does not change?</p>
java
[1]
676,305
676,306
How to get native source code of send a mail in andorid?
<p>I am new to android.</p> <p>I want to get the native source code of send email.</p> <p>For example in our android we have a icon like email.</p> <p>Then any one click the email icon the mail application will open.</p> <p>so I want that source code.</p>
android
[4]
1,919,246
1,919,247
Binding a form variable in jQuery
<p>I'd like to compute a value and carry that computation in the form post, so what I do is:</p> <pre><code>&lt;form&gt; &lt;input name="myID" id="myID" type="hidden" /&gt; &lt;/form&gt; $('#myID').attr('value',myCalculation); </code></pre> <p>What I would like to do is display it as well, so I've added:</p> <pre><code>&lt;div id="myIDdisplay"&gt;&lt;/div&gt; $('#myIDdisplay').text(myCalculation); </code></pre> <p>Is there a better, more elegant way than duplicating the assignment of myCalculation to both the hidden form field and the displayed area?</p> <p>I don't want the user to get confused in thinking that it's an input field, so I'd rather not display the input tag. And I just can't trust CSS enough to think that CSS will remove the input border on every version of every browser.</p>
jquery
[5]
5,931,970
5,931,971
NO such file or directory for the files -----stdarg.h and float.h?
<p>HI all </p> <p>I am using some files on .mm extension in the xcode project for compiling these files we have added the LLVM-GCC 4.2 in the build setting after adding this compiler this showing the error </p> <blockquote> <p><code>/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory</code></p> <p><code>/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/include/float.h:8:24: error: float.h: No such file or directory</code></p> </blockquote> <p>i have no idea how to remove this error any help to remove this error.</p> <p>thanks </p> <p>Balraj </p>
iphone
[8]
2,572,204
2,572,205
jquery click on a child ignore parent click
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7696098/prevent-click-event-from-affecting-parent-jquery">Prevent click event from affecting parent jquery</a> </p> </blockquote> <p>I have a DOM structure similar to this:</p> <pre><code>&lt;div class="parent"&gt; &lt;div class="child"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I have the following jQuery:</p> <pre><code>$('.parent').click(function(){ $(this).hide(); }); </code></pre> <p>When <code>.child</code> is clicked I don't want the parent to hide but obviously because <code>.child</code> is a child of <code>.parent</code> this naturally happens. I've tried adding this:</p> <pre><code>$('.child').click(function(e){ e.stopPropagation(); }); </code></pre> <p>But it still doesn't work. I've also tried replacing <code>e.stopPropagation</code> with <code>return false;</code> </p> <p>any suggestions?</p> <p><a href="http://jsfiddle.net/mPUTe/" rel="nofollow">JSFiddle</a></p>
jquery
[5]
756,010
756,011
Use PHP to change the order of elements
<p>I have some markup like so:</p> <pre><code>&lt;div class="list"&gt; &lt;article&gt; content... &lt;/article&gt; &lt;article&gt; content... &lt;/article&gt; &lt;article&gt; content... &lt;/article&gt; &lt;article&gt; content... &lt;/article&gt; &lt;article&gt; content... &lt;/article&gt; &lt;/div&gt; </code></pre> <p>What I want to do is make the order of what these articles appears on the page random. What would be the best and easiest way to do this?</p> <p>I thought about doing some sort of length count and storing it in an array and then spitting them back out again in a random order. e.g.</p> <pre><code>$numbers = range(1, 20); shuffle($numbers); foreach ($numbers as $number) { echo "$number "; } </code></pre> <p>Can anyone offer ideas etc? Thanks</p> <p><strong>NOTE: These are not coming from a database!</strong></p>
php
[2]
3,465,478
3,465,479
Python to filter a comma-separated list on another csv list
<p>I have two strings:</p> <pre><code>s1 = "Brendon, Melissa, Jason, , McGuirk" #the gauranteed string in format "x, y, z" s2 = "brandon,melissa,jxz ,paula,coach" #the messy string </code></pre> <p>and would like to create a Python (2.7) list that uses the value in l1 if it exists, otherwise pass through the value in l2. I have working code, but even with the list comprehensions, I feel like there may be a more Pythonic way of doing this. Any ideas what that might be?</p> <pre><code>l1 = [x.strip() for x in s1.split(',')] l2 = [x.strip() for x in s2.split(',')] f = lambda s: s[1] if s[1] else s[0] final = [f(x) for x in zip(l2, l1)] </code></pre> <p>The list "final" now contains:</p> <pre><code>['Brendon', 'Melissa', 'Jason', 'paula', 'McGuirk'] </code></pre> <p>Which is correct.</p> <p>------- edit So, looking at Jon's answer below, a or b seems like the simplest, most readable approach. I moved the string cleaning to a small function, and ended up with this. Any further improvements to make?</p> <pre><code>trim_csv = lambda csv: [s.strip() for s in csv.split(',')] print [a or b for a, b in zip(trim_csv(s1), trim_csv(s2))] </code></pre>
python
[7]
4,704,026
4,704,027
onCreateDialog() not taking two cases
<p>I want to display timePicker 2 times. for retriving start time n for stop time. THis code is showing error as "Duplicate case". I tried alot but am unable to find answer for this silly question. Please guide me. </p> <pre><code> protected Dialog onCreateDialog(int id) { switch (id) { case TIME_DIALOG_ID1: // return new TimePickerDialog(this, // mTimeSetListener, startHour, startMinute, true); Toast.makeText(getApplicationContext(),"hr:"+startHour+"min:"+startMinute, Toast.LENGTH_LONG).show(); break; case TIME_DIALOG_ID2: // return new TimePickerDialog(this, // mTimeSetListener, startHour, startMinute, true); Toast.makeText(getApplicationContext(),"hr:"+stopHour+"min:"+startMinute, Toast.LENGTH_LONG).show(); break; } return null; } </code></pre>
android
[4]
555,670
555,671
What is equivalent of RequestDispatcher#forward() Of Java in PHP?
<p>RequestDispatcher basically dispatches a request to some other resource i.e it doesn't do a redirect but simply forwards the page to some page(resource). Thus browser's history etc is not updated and the parameters that are available in <code>request</code> are still available on another page since we are not creating a new request using redirect.</p> <p>What is equivalent of this in PHP? And also which function is used to redirect a page?</p> <p>Thanks in advance :)</p>
php
[2]
6,920
6,921
calling array in main class
<p>I have two classes and one class contain string array and its constructor how to call it in main with its object?</p>
android
[4]
4,055,874
4,055,875
Constructor is not initializing a Scanner object
<p>In the following code the constructor is not initializing the numFile Scanner. I added the contents of the constructor to the main method to make it work. If I do not do this a java.lang.NullPointerException is thrown. Would someone mind explaining why? Also, do I need to throw an IOException on the constructor?</p> <p>Thanks for any helpful advice.</p> <p>Tony</p> <pre><code>import java.io.*; import java.util.Scanner; public class CountPositiveIntegers { static Scanner numFile; static String fileName; // the name of the file in which the integers are stored static int number; // holds the current number being read static int counter; // a counter used to sum the number of positive integers public CountPositiveIntegers() throws IOException { fileName ="D:\\Java\\Source\\numFile.dat"; System.out.println("File Name: " + fileName); numFile = new Scanner(new FileReader(fileName)); number = 0; counter = 0; } public static void main(String[] args) throws FileNotFoundException { // numFile is not being initializing in the constructor fileName = "D:\\Java\\Source\\numFile.dat"; numFile = new Scanner(new FileReader(fileName)); number = 0; counter = 0; if (numFile.hasNext()) { // check to see if there are any values in the file while (numFile.hasNextInt()) { // reads in integers number = numFile.nextInt(); if (number % 2 == 0 &amp; number != 0) { counter++; } } numFile.close(); // close the file // print to screen the number of even integers stored in the file System.out.println("There are " + counter + " even numbers in this file"); } else { System.out.println("The file is empty."); } System.exit(0); // cleanly exit the program } } </code></pre>
java
[1]
3,944,800
3,944,801
Web Browser in JAVA
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3064732/using-java-to-create-a-web-browser">Using java to create a web browser</a> </p> </blockquote> <p>Hello, I am last year computer science student wanted to create web browser same as google chrome or as epic browser. Is it possible to create it in java</p>
java
[1]
5,428,510
5,428,511
dynamically adding and removing buttons with jquery
<p>New to javascript and jQuery, but I'm trying to dynamically add buttons and then remove them when they are clicked. If a button is there already (in the same class I am creating new buttons), it can be removed. If a new button gets added by the user, that button has no control. I also tried the <code>.live</code> method that was mentioned in a similar post to no avail. Any help is appreciated. Thanks.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt; test &lt;/title&gt; &lt;script src="jquery-1.6.2.js"&gt;&lt;/script&gt; &lt;script&gt; /* $(document).ready(function(){ $(".btn :button").click(function(){ $(this).remove(); }); */ $(".btn :button").live("click", function(){ $(this).remove(); }); function add() { // $(".btn").append("&lt;button&gt; new one &lt;/button&gt;"); $("&lt;button&gt; new one &lt;/button&gt;").insertAfter(".btn"); }; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="btn"&gt; &lt;button&gt; test &lt;/button&gt; &lt;/div&gt; &lt;br /&gt;&lt;br /&gt; &lt;div class="adding"&gt; &lt;button onclick='add()'&gt; add &lt;/button&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
jquery
[5]
5,006,982
5,006,983
What makes a button change color on mouseclick?
<p>Why is this button changing color to orange when clicked: </p> <pre><code>&lt;Button android:background="@android:drawable/btn_plus" ...&gt; </code></pre> <p>but this one is not? </p> <pre><code>&lt;Button android:background="@drawable/ic_btn_round_plus" ...&gt; </code></pre> <p>Edit:<br> Found another type of button (text and image) that changes color to orange when clicked<br> without having to create a selector: </p> <pre><code>&lt;Button android:text="List" android:drawableTop="@drawable/list" ...&gt; </code></pre>
android
[4]
688,710
688,711
C# "Cannot have instance field initializers in Struct" error
<p>Well, I am relatively new in C#, and I have a 2 classes. The first class has a public struct and the second one is trying to declare the struct. I am not good enough in english, but this is the code so that you may understand :</p> <p>First Class :</p> <pre><code>class PE{ #region NT Headers [StructLayout(LayoutKind.Explicit)] public struct IMAGE_NT_HEADERS32 { [FieldOffset(0)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public char[] Signature; [FieldOffset(4)] public IMAGE_FILE_HEADER FileHeader; [FieldOffset(24)] public IMAGE_OPTIONAL_HEADER32 OptionalHeader; } [StructLayout(LayoutKind.Explicit)] public struct IMAGE_NT_HEADERS64 { [FieldOffset(0)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public char[] Signature; [FieldOffset(4)] public IMAGE_FILE_HEADER FileHeader; [FieldOffset(24)] public IMAGE_OPTIONAL_HEADER64 OptionalHeader; } #endregion } </code></pre> <p>Second Class :</p> <pre><code>class Main { struct NT_Header { Namespace.PE.IMAGE_NT_HEADERS32 INTSIGN = new Namespace.PE.IMAGE_NT_HEADERS32(); //HERE IS THE ERROR! } } </code></pre> <p>It always raises the error... Thanks for helps!</p>
c#
[0]
3,918,619
3,918,620
Why does the increment/decrement in a for loop not end with a statement?
<p>Everywhere else I write a statement in Java I need to end it with a semi-colon. However, that doesn't apply to the i++ of a for loop.</p> <p>How comes?</p>
java
[1]
4,610,671
4,610,672
Reading Html Code and finding <div> text. C#
<p>i am useing this code to read html pages :</p> <pre><code> WebClient client = new WebClient(); String htmlCode = client.DownloadString(@"C:\checkemails\check.html"); // Replace all html breaks for line seperators. htmlCode = htmlCode.Replace("&lt;br&gt;", "\r\n"); MessageBox.Show(htmlCode); </code></pre> <p>the html page is on C:\ but lets say i am loading yahoo.com.. or what ever page.</p> <p>i need to find a div named who got the id of </p> <pre><code>&lt;div id ="say"&gt; </code></pre> <p>how can i do so?</p>
c#
[0]
5,484,455
5,484,456
generate 1024 bit hashes on android
<p>I am currently looking into ways of generating one way hashes to share sensitive information like passwords to a web application backend.</p> <p>Based on the documentation I cannot find any hashing algorithms that are supported by android OS that are larger than 512.</p> <p>Are there any 1024 bit hashing algorithms for android? </p>
android
[4]
2,257,157
2,257,158
how to implement the foldout animation view like the original iPhone google map app?
<p>all coder , I see the foldout animation view in the original iPhone google map app, I want the same effect in my view , but I have not find solution ...</p> <p>how to do the same animation via iPhone sdk ? any tip will be much appreciated...</p> <p>thanks...</p> <p>iRobin</p>
iphone
[8]
4,483,321
4,483,322
WebView enhancements for android for resource utilization
<p>Android's webview is heavy objects which are the enhancements I can do to reduce it's weight to save memory and battery?</p>
android
[4]
87,461
87,462
iPhone to PC data transfer
<p>I need to transfer data from iPhone to PC using USB from My App. How can i do this. </p> <p>Thanks,</p>
iphone
[8]
330,665
330,666
Efficient way to circle through an array?
<p>I'm wondering if there is a more effective way of circling through an array. For my purposes, the array is holding image sources. When the last image is shown and the next button is pushed it circles back to the first image. If the previous button is pushed on the first image it circles to the last image.</p> <p>This is what I was able to come up with, but I feel there's a more efficient way to go about it.</p> <pre><code>var marker = 0; // Circle through an array. function moveMarker(array, action, direction) { if (!direction) { if(marker == array.length - 1) marker = -1; marker += 1; action(); } else { if (marker == 0) marker = array.length; marker -=1; action(); } } </code></pre>
javascript
[3]
3,316,047
3,316,048
How to properly set UIRequiredDeviceCapabilities?
<p>I have had an app rejected by Apple stating that I need to implement <code>UIRequiredDeviceCapabilities</code> in my info.plist due to my app requiring a camera flash. I understand the issue but I am not sure how to properly set this key. Do I create <code>UIRequiredDeviceCapabilities</code> as a dictionary or array? and camera-flash as a bool or string? Any help is appreciated! Thanks!</p>
iphone
[8]
4,390,249
4,390,250
how to send a http request in the background in javascript?
<p>I have a button, the event would be onclick and then the javascript function will send to server the request(for example a rating button on an item), the page should not be redirected, basically I want the event to happen in the background. How to do that? Please give me some idea or code. </p>
javascript
[3]
1,103,155
1,103,156
Logging in with Sha5
<p>I'm writing a sign up script, the users password is encrypted like so</p> <pre><code>$pword = hash('sha512', $_POST['password']); </code></pre> <p>when the log in I use the same post script about to encrypt the password then look for a match in the database</p> <pre><code>$result = mysql_query("SELECT * FROM $table WHERE email = '$email' AND password = '$pword' "); if(mysql_num_rows($result)) { //do something $return['error'] = false; $return['msg'] = 'Logging In.'; } else { // Invalid username/password $return['error'] = true; $return['msg'] = 'Wrong Email Or Password Try Again'; } </code></pre> <p>The problem is I keep getting an error message, it's like the password's don't match.</p> <p>I changed it to this script </p> <pre><code>$query_wins ="SELECT * FROM `users` WHERE `email` = \"$email\" AND `password`=\"$pword\" AND `active`='Y'"; $result=mysql_query($query_wins) or die(mysql_error()); $result= mysql_query($query_wins); $row = mysql_fetch_array($result); $memid= $row['id']; if($memid==""){ $return['error'] = true; $return['msg'] = 'Wrong Email Or Password Try Again'; } </code></pre> <p>And now it just giving me the "Wrong Email Or Password Error"</p>
php
[2]
4,993,210
4,993,211
need help in loading activity
<p>I have created following activity</p> <pre><code> package com.ali.test; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class Test extends Activity implements OnClickListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* OnClickListener onClickListener = new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent i = new Intent(this, Second.class); startActivityForResult(i, ACTIVITY_CREATE); } }; */ Button button = (Button) findViewById(R.id.button1); button.setOnClickListener(this); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub startActivity(new Intent(this, Second.class)); } </code></pre> <p>}</p> <p>and want to load</p> <pre><code> package com.ali.test; import android.app.Activity; import android.os.Bundle; public class Second extends Activity{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } </code></pre> <p>but when i press the buttons app closes unexeptionaly</p>
android
[4]
5,620,247
5,620,248
Files Drag and drop using jquery
<p>I am creating a website in php. Client demanded for drag and drop feature in image gallery so that he can just drag and drop images in gallery from anywhere. </p> <p>Please suggest me some good site or code ?</p>
jquery
[5]
4,507,705
4,507,706
AND operator behavior with/without brackets
<pre><code>$a = true and false; //true $b = true &amp;&amp; false; //false $c = (true and false); //false $d = (true &amp;&amp; false); //false </code></pre> <p>Why gives case 'a' true?</p> <p>I thought that and and &amp;&amp; has the same precedence but <a href="http://www.php.net/manual/en/language.operators.precedence.php" rel="nofollow">they don't</a>. </p>
php
[2]
3,889,928
3,889,929
Displaying a note when focus comes over a text box
<p>I want to display a note to the user whenever the focus comes to a particular textbox i have written the note in a div and set its visibility to false what to do next </p>
asp.net
[9]
5,800,752
5,800,753
How to upload file from app loader after getting status prepare for upload
<p>Thanks in advance. I have entered the info in itunesconnect and get the app status Prepare for upload. But to upload the app distribution file from app loader i didn't get the file name in App loader.Then how can i choose the file name to upload. If any one know please help me.</p>
iphone
[8]
4,567,237
4,567,238
Javascript object erroring in IE8
<pre><code> stages = { "1": { id: "1", div: "foo" }, "2": { id: "2", div: "bar" }, "3": { id: "3", div: "foobar" } }; </code></pre> <p>When I run this in Firefox, it's fine. But when run in IE8, I get this error:</p> <blockquote> <p>Message: Object doesn't support this property or method</p> </blockquote> <p>Is this a known bug / is there a workaround or is it my syntax?</p>
javascript
[3]
3,232,546
3,232,547
Print variable above
<p>Not the best name for a thread but still...</p> <p>I got</p> <pre><code>&lt;?php include('inc/nav_bar.php'); ?&gt; ... &lt;?php main code block ?&gt; </code></pre> <p>I need to print one variable from "main code block" to "nav_bar" block, is there is any good way to do this ?</p> <p>The only solution I've found so far is to use javascript.</p>
php
[2]
5,605,224
5,605,225
how to override a javascript function
<p>I'm trying to override a built in parseFloat function in js. How would I go about doing that?</p>
javascript
[3]
4,550,725
4,550,726
Cannot find symbol?
<p>When I try to compile my code I am getting the error: </p> <blockquote> <p>1 error found:</p> <p>File: C:\Users\Matthew\Documents\engr 103\cpu.java [line: 13]</p> <p>Error: C:\Users\Matthew\Documents\engr 103\cpu.java:13: cannot find symbol</p> <p>symbol : class BufferReader</p> <p>location: class cpu</p> </blockquote> <p>I've been trying to fix this for a while now, but it's been a while since I used Java, and I have no idea what to do. </p> <pre><code>import java.io.*; import java.util.Scanner; class cpu{ public static void main(String []args) throws Exception { Runtime r =Runtime.getRuntime(); String f,temp,res=""; int i=0,j=0; f="sensors"; Process p=r.exec(f); BufferedReader pin=new BufferReader(new InputStreamReader(p.getInputStream())); while((temp=pin.readLine())!=null) { System.out.println(temp); } } } </code></pre>
java
[1]
1,166,444
1,166,445
how to show the data in list using cursor in android
<p>I am getting the from the database using cursor but when i am trying to show the data in list, it is not showing..</p> <p>the below code is for accessing the data using cursor from database:</p> <pre><code>protected void showCustomerdetails() { try { Cursor cursor = m_dbManager.getValues("customer", new String[]{"name","mobile_phone" }, null, null, null, null); if(cursor != null) { cursor.moveToFirst(); int i = 0; while(cursor.isAfterLast() == false) { m_uname = cursor.getString(cursor.getColumnIndex("name")); Log.d("debug","getting the name from cursor"); m_mobnum = cursor.getString(cursor.getColumnIndex("mobile_phone")); cursor.moveToNext(); i++; } } cursor.close(); } catch(SQLException e) { e.printStackTrace(); } } </code></pre> <p>now the below code is for adding the data in the list---</p> <pre><code>class IconicAdapter extends ArrayAdapter&lt;String&gt; { Activity context; IconicAdapter(Activity context) { super(context, R.layout.custoemrs_list); this.context=context; } public View getView(int position, View convertView, ViewGroup parent) { View row = null; try { LayoutInflater inflater=context.getLayoutInflater(); row=inflater.inflate(R.layout.custoemrs_list, null); TextView des=(TextView)row.findViewById(R.id.custusername); des.setText(m_uname); TextView qty=(TextView)row.findViewById(R.id.custmobnum); qty.setText(m_mobnum); } catch(Exception e) { e.printStackTrace(); } return row; } } </code></pre>
android
[4]
748,527
748,528
Pow and mod function optimization
<p>I need to create an optimized function to count <strong>Math.pow(a,b) % c;</strong> in Javascript; <br /> There's no problems while counting small numbers like: <br /> <code>Math.pow(2345,123) % 1234567;</code> <br /> But if you try to count:<br /> <code>Math.pow(2345678910, 123456789) % 1234567;</code><br /> you'll get incorrect result because of Math.pow() function result that cannot count up "big" numbers; <br />My solution was: </p> <pre><code>function powMod(base, pow, mod){ var i, result = 1; for ( i = 0; i &lt; pow; i++){ result *= base; result %= mod; } return result; </code></pre> <p>Though it needs a lot of time to be counted;<br /> Is it possible to optimized it somehow or find more rational way to count up <strong>Math.pow(a, b) % c;</strong> for "big" numbers? (I wrote "big" because they are not really bigIntegers);</p>
javascript
[3]
4,990,701
4,990,702
Track number of times radio button is selected and store in text file for PHP
<p>Hey this is my first post so I hope I am approaching this properly but anyway, I have a survey in which a user is presented with 8 questions and they are supposed to rate how they feel about each question by clicking the radio buttons valued from 1(strongly disagree)-5(strongly agree). So what I need to do is record the frequency in which each radio button is selected. Something like this:</p> <pre><code>$filename = "Results.txt"; $lines = file($filename); $q1 = $_POST['q1']; $q2 = $_POST['q2']; $q3 = $_POST['q3']; $q4 = $_POST['q4']; $q5 = $_POST['q5']; $q6 = $_POST['q6']; $q7 = $_POST['q7']; $q8 = $_POST['q8']; foreach($lines as $line) { echo $line; if (isset($q1)){ echo $line[$q1]; echo $lines; } } </code></pre> <p>Where q represents question#. Lastly this needs to keep a running calc and the results.txt should look something like this:<br/> 0,0,5,0,0 <br/> 0,0,0,0,0 <br/> 0,0,0,0,0 <br/> 0,0,0,0,0 <br/> 0,0,0,0,0 <br/> 0,0,0,0,0 <br/> 0,0,0,0,0 <br/> 0,0,0,0,0 <br/> The 5 in line one means 5 users submitted a neutral radio button option (value 3). Each line represents the tally for each question.</p> <p>Please help!</p>
php
[2]
2,525,720
2,525,721
Load ajax data NOT in a div or other element
<p>first of all, sorry for my bad english, I speak spanish. Well, I need some help in this case:</p> <p>I made a microsoft excel POI report using java, this report is in a servlet that I call when do a clic in a href, por example:</p> <pre><code>&lt;a href="ServeletReport"&gt;Report&lt;/a&gt; </code></pre> <p>Until here, all ok, but I need to call this report using an event (it could be .load()) from jQuery, but this event only works assigning the data result to a div or other element. I not need assign the result to any element because my report is generated and open through in excel, if I assign it to a div, in this div appears rare simbols.</p> <p>I need too add a loading imagen until my report is ready and opened.</p> <p>I have a bad code, please I need some help.</p> <pre><code>$("#mylink").click(function(){ $("#contenidoo").empty().html('&lt;img src="images/loading-icon.gif"/&gt;'); $("#result").load("ServletReport"); }); </code></pre> <p>I not need to put the result in a div $("#result"), I dont need to put the result in any place, I want to do clic and wait until my report is generated but viewing the loading image.</p>
jquery
[5]
463,956
463,957
python zipfile basename
<p>I have some homework that I am trying to complete. I don't want the answer. I'm just having trouble in starting. The work I have tried is not working at all... Can someone please just provide a push in the right direction. I am trying to learn but after trying and trying I need some help.</p> <p>I know I can you <code>os.path.basename()</code> to get the basename and then add it to the file name but I can't get it together.</p> <p>Here is the assignment</p> <p>In this project, write a function that takes a directory path and creates an archive of the directory only. For example, if the same path were used as in the example <code>("c:\\xxxx\\Archives\\archive_me")</code>, the zipfile would contain <code>archive_me\\groucho</code>, <code>archive_me\\harpo</code> and <code>archive_me\\chico</code>.</p> <p>The base directory (<code>archive_me</code> in the example above) is the final element of the input, and all paths recorded in the zipfile should start with the base directory.</p> <p>If the directory contains sub-directories, the sub-directory names and any files in the sub-directories should not be included. (Hint: You can use <code>isfile()</code> to determine if a filename represents a regular file and not a directory.)</p> <p>Thanks again any direction would be great.</p>
python
[7]