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
4,199,483
4,199,484
Why does it throws error like this?
<p>I do import the data from Excel sheet to Sql database..everything is fine,when i run this code,my access engine could not find mt sheet,it throws like this error.. my error is</p> <blockquote> <p>The Microsoft Jet database engine could not find the object 'Sheet1$'. Make sure the object exists and that you spell its name and the path name correctly.</p> </blockquote> <p>but i already checked with my designation folder,its correct..then i don't know why it's repeated</p> <p>my C# code below..</p> <pre><code>public partial class _Default : System.Web.UI.Page { string constr = @"Data Source=VIS1-B12\SQLEXPRESS;Initial Catalog=Sql_Excel;Integrated Security=True providerName=System.Data.SqlClient" ; protected void btn_okClick(object sender, EventArgs e) { string path = Fup_Excel.PostedFile.FileName; string exconstr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+path+";Extended Properties=Excel 8.0"; OleDbConnection excelcon = new OleDbConnection(exconstr); excelcon.Open(); OleDbCommand cmd = new OleDbCommand("select * from [Sheet1$]", excelcon); OleDbDataReader dbreader; OleDbDataAdapter dap = new OleDbDataAdapter(cmd); DataSet ds = new DataSet(); //dap.Fill(ds,"sheet1"); dbreader = cmd.ExecuteReader(); SqlBulkCopy bcpy = new SqlBulkCopy(constr); bcpy.DestinationTableName = "Excel_Details"; bcpy.WriteToServer(dbreader); //GridView1.DataSource = ds.Tables[0].DefaultView; //GridView1.DataBind(); excelcon.Close(); } } </code></pre>
asp.net
[9]
4,996,728
4,996,729
set sleep time in iphone app
<p>Can anyone suggest me how to set sleep time in iphone application? so that after that time iphone goes in sleep mode.</p> <p>Thanks in advance.</p>
iphone
[8]
3,768,017
3,768,018
Draw Path jquery with the following coords
<p>i have to draw a path, i get the following coordinats!</p> <p><a href="http://i.stack.imgur.com/h1Sw3.gif" rel="nofollow">http://i.stack.imgur.com/h1Sw3.gif</a></p> <p>i think s = startpoint, f = finishpoint. my problem are the attributes (ax, ay, bx and by)</p> <p>may someone could show me an example (with jquery svg or raphael?)</p> <p>Thanks</p>
jquery
[5]
845,314
845,315
Calculation of words, sentences and paragraphs from text entered by the user
<p>I need to write a program to take an entry 'essay' from the user. This essay can contain any characters (special characters, quotation marks, etc.). It then has to calculate the total number of words, sentences and paragraphs, and the total number of special characters. How should I go about doing this?</p>
c#
[0]
364,511
364,512
Is it possible to programmatically change the Default.png launch image?
<p>Is it possible to programmatically change the Default.png launch image?</p> <p>For example, could I replace it by an other image that fits better? My app has a tab bar and every tab has a very different screen, and I want to recover to that particular tab after a hard launch from scratch when the app got terminated in the background.</p>
iphone
[8]
2,174,338
2,174,339
disable text input history
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2530/how-do-you-disable-browser-autocomplete-on-web-form-field-input-tag">How do you disable browser Autocomplete on web form field / input tag?</a> </p> </blockquote> <p>I am building an application which will be accepting credit card data. I would like to make sure that the browser does NOT remember what has been type into the text inputs for credit card number. I tried passing the following headers:</p> <pre><code>header("Expires: Tue, 03 Jul 2001 06:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); </code></pre> <p>Still, once the page reloads, I can click the credit card text input field and it will let me see what I wrote in it before. How can I prevent this?</p>
php
[2]
4,306,141
4,306,142
how to obtain browser url in javascript from an iframe
<p>Whilst inside an iframe, can you please let me know how I can obtain main/parent window browser url using javascript?</p> <p>Thanks.</p>
javascript
[3]
4,047,489
4,047,490
To add a node at a particular place in tree view in C#
<p>I have a Tree view and has a project and there are so many files and folders in this project. I have a Tabcontrol also in this form. When I click a file which is in the project then it will be open in the tab control. So My problem is this when I SaveAs this open file and want to save in a another folder which is in the project, then it is saving and adding as a node but it will see to me when I refresh or again reopen the project. So I want, that there is no need to refresh or reopen this project, It should be add as a node just now and see to me frontly.</p> <p>Thanks a lot in Advance</p>
c#
[0]
646,120
646,121
c# Compilation Error
<p>I'm doing image steganography and visual cryptography project using RSA algorithm. While compiling the project I'm getting these errors:</p> <blockquote> <p>ArgumentException was unhandled</p> </blockquote> <p>and also </p> <blockquote> <p>Empty path name is not legal</p> </blockquote> <p>This error shown in:</p> <pre><code>FileStream outStream = new FileStream(stegoFileName, FileMode.Create, FileAccess.Write); </code></pre>
c#
[0]
2,512,153
2,512,154
Switch case - else condition
<pre><code>&lt;script type="text/javascript"&gt; //You will receive a different greeting based //on what day it is. Note that Sunday=0, //Monday=1, Tuesday=2, etc. var d=new Date(); var theDay=d.getDay(); switch (theDay) { case 5: document.write("Finally Friday"); break; case 6: document.write("Super Saturday"); break; case 0: document.write("Sleepy Sunday"); break; default: document.write("I'm looking forward to this weekend!"); } &lt;/script&gt; </code></pre> <p>If the <code>theDay = 5</code>, then we display <code>Finally Friday</code>. I want if theDay !=5, then display 'Finally Something'.. similarly for others too... </p> <p>Is it possible without an If/else condition. <strong>If the case 5 does not execute, can i do something else in that place?</strong></p>
javascript
[3]
165,223
165,224
How to find substring of href with javascript
<p>I have the following output.</p> <pre><code>&lt;tr id='row_27' valign='top'&gt; ... ... &lt;td width="5%"&gt;&lt;a href="http://localhost/daikon2/index.php/projects/admin/delete_log/6/6/27" class="deleteme"&gt;&lt;img src="http://localhost/daikon2/assets/icons/delete.png" alt="delete" title="Delete Log" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I want to get the last segments 27 in the href with javascript.</p> <p>I tried the following but nothing happened.</p> <pre><code>var id =href.substring(href.lastIndexOf("/") + 1); alert (id); </code></pre> <p>Could anyone help me please?</p> <p>Thanks in advance.</p>
javascript
[3]
4,842,062
4,842,063
How can I loop through a list changing the list elements at each time step, adding or subtracting input values that are in the txt files?
<p>Why don´t I get the following result, in this order? [-2.0, -1.0, 0.0, 1.0, 2.0] [-1.0, 0.0, 1.0, 2.0, 3.0] [-2.0, -1.0, 0.0, 1.0, 2.0], instead i get the second list in the wrong place. Can I edit list elements in a more consistent way, considering this form of input data? My objective is to change a initial list (V) at each time step, adding or subtracting the input values that are in the txt files.</p> <pre><code>V = [1,2,3,4,5] f = open('Qin.txt') # values in Qin.txt: 1, 3, 2 g = open('Qout.txt') # values in Qout.txt: 4, 5, 5 for line in f: Z=float(line) for line in g: G=float(line) c = [] for i in range(len(V)): c.append(V[i]+Z-G) print c </code></pre>
python
[7]
5,818,018
5,818,019
Preventing javascript generated clicks on link
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6674669/in-jquery-how-can-i-tell-between-a-programatic-and-user-click">In Jquery, how can I tell between a programatic and user click?</a> </p> </blockquote> <p>Depending on the browser, there are several methods by which a link can be "clicked" using javascript.</p> <p>IE (pre IE9)</p> <p>element.click(); element.fireEvent('click');</p> <p>Other browsers use:</p> <p>element.dispatchEvent(evt) where evt is a mouseclick event.</p> <p>I want to make sure that actual end user action was the originator of the event on particular links. The technique I use now is to override these methods and filter out click events, but it is easily defeated by reverting the methods back to the prototype versions before using them.</p> <p>Is there any reliable, cross browser way to determine whether or not a click event is firing as a result of direct user action (they actually clicked the element).</p>
javascript
[3]
3,012,397
3,012,398
What are the benefits of comma's compared to semicolons in jquery?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/694102/declaring-multiple-variables-in-javascript">Declaring Multiple Variables in JavaScript</a> </p> </blockquote> <p>I was setting some variables in jQuery and someone suggested I do it this way:</p> <pre><code>var $wrapper = that.parents(".wrapper"), $prettyCheckBox0 = $wrapper.find(".prettyCheckbox small:eq(0)"), $prettyCheckBox1 = $wrapper.find(".prettyCheckbox small:eq(1)"), $prettyCheckBox2 = $wrapper.find(".prettyCheckbox small:eq(2)"), standard = $prettyCheckBox0.parents("span").parents("label").prev("input").val(), professional = $prettyCheckBox1.parents("span").parents("label").prev("input").val(), premium = $prettyCheckBox2.parents("span").parents("label").prev("input").val(); </code></pre> <p>instead of the semicolons and though this works, I was wondering if anyone has a reason on why to pick one over the other and how this works? It seems like it would cause syntax errors. Also, why is there one one "var"</p>
jquery
[5]
5,579,174
5,579,175
Differences that may occur between Debug and Release builds?
<p>I was asked today in an interview to list four differences that <em>may</em> occur between debug and release builds. I suppose they meant differences in behavior and not differences such as debug information and whatnot. I was only able to name two:</p> <ol> <li>Debug builds are generally much slower due to some functions not being inlined.</li> <li>Due to the difference in speed, in multi-threaded programs that have race conditions, these race conditions may become apparent in only one of the two builds.</li> </ol> <p>What other differences could I have named? </p>
c++
[6]
2,852,244
2,852,245
Bind a label in array of labels
<p>I have an array of labels. I use these command lines to bind the Label's text to a column in my table, but it is not binding properly.</p> <p>Here is the applicable code:</p> <pre><code>Label[] LL = new Label[26]; for (int i = 0; i &lt; LL.Length; i++) { LL[i] = new Label(); LL[i].Text = null; } LL[0].DataBindings.Add(new System.Windows.Forms.Binding("Text", this.table_010_UserInfoBindingSource, "Column07", true)); </code></pre>
c#
[0]
5,923,195
5,923,196
Where to put containers of user defined types?
<p>Consider one has some user defined types, and containers of those types that are often manipulated because there are often multiple instances of those types on screen at a time.</p> <p>Currently I have a header with an associated source file and a namespace to hold these containers, but should I create a separate class to hold them? Should I put the containers in the same header file as the class that they contain (but obviously outside the class)? What is the standard practice for situations like this?</p>
c++
[6]
80,659
80,660
how to bring the control out of the sql statement once the where condition is met in C#
<pre><code> Stream stream = SystemStreams.Where(st =&gt; st.getName().Equals(s.OBJECT_NAME)) .Single(); </code></pre> <p>in the above query in C# even if my condition of where clause is met my program reads all the records. due to which its becoming really slow. Can anyone help?</p>
c#
[0]
389,449
389,450
How I can change time to users timezone with javascript?
<p>I'm trying to find out how to make function on javascript that takes time on UTC timezone and converts it to the users timezone. Can you guys help me out?</p>
javascript
[3]
5,708,387
5,708,388
how to go default calendar in android?
<p>I am making calendar based app and I am trying to go to my application to default calendar and also searching on internet but i can't it so is it possible to open default calendar using intent advance in thanks.</p>
android
[4]
3,843,900
3,843,901
How to fix an error with adding integers in Java?
<p>In given example:</p> <pre><code>int a, b, c; a = 2111000333; b = 1000222333; c = a + b; System.out.println("c= " + c); </code></pre> <p>will return: <code>c= -1183744630</code> , why?</p> <p>How to fix that? </p>
java
[1]
4,508,268
4,508,269
retry/cancel popup while refreshing the page-ASP.NET C#
<p>I'm having an image button as a templatefield inside a gridview.On clicking of the image button i will retrieve a pdf document from a folder location as byte array.The method will return null if the document is not available.after that if we try to refresh the page ,it throws retry/cancel popup.</p> <p>The grid is inside an update panel and the update panel is having postback trigger for that image button.</p> <p>Please help me on this.</p> <p>Thanks.</p>
c#
[0]
2,731,917
2,731,918
JQuery background color
<p>I am using JQuery Autocomplete on my ASP.net page. I am not sure how to change the backgroud color of the AutoComplete. Right now, it displays the list with "Clear" background. </p> <p>Where can i change the background color? (And, I am wondering why it's not taking the default settings. I downloaded the JQurey from JQueryUI website).</p> <p>Thanks.</p>
jquery
[5]
5,694,637
5,694,638
How to call php function from button?
<p>I've got an easy php script :</p> <pre><code>&lt;?php $command = "git pull"; $output = shell_exec($command); echo "&lt;pre&gt;$output&lt;/pre&gt;"; ?&gt; </code></pre> <p>And I want to call it by pressing button : </p> <pre><code>&lt;form metod="post" action="/pull.php"&gt; &lt;button type="submit"&gt;Pull changes&lt;/button&gt; &lt;/form&gt; </code></pre> <p>And I want to get output right under the button or replace button with output but I don't want to go to /pull.php I just want to run script and get output. How can I make it ?</p>
php
[2]
398,261
398,262
filter list in python by another list of stop-words (substrings)
<p>I'm looking for nice pythonic way of filtering one list by another stop-list, but I want to match substrings from second list in first. </p> <p>To be specific: I have list1 of URLs and list2 like:</p> <pre><code>['microsoft.com', 'ibm.com', 'cnn', '.ru'] etc </code></pre> <p>First list of URLs is huge (thousands of items), second list is smaller, like 500-1000. But simple match using "in" or sets is not enough, because second list items should be used as substring search. All I could think is two "for" loops, but they don't seem to by pythonic :)</p> <p>PS Purpose is to remove matched items from first list.</p>
python
[7]
4,959,656
4,959,657
logging exception in c#
<p><strong>logging exception</strong> this is below code which is used for logging exception in a text file. here i am getting only the decription of the error.</p> <p><strong>but it is not telling me where the exception occured at which line.</strong> would any onr tell me howi can achive that so that i get even the line number where the exception occured.</p> <pre><code> try { } catch (Exception ex) { Console.WriteLine(ex.Message); } #region WriteLogError /// &lt;summary&gt; /// Write an error Log in File /// &lt;/summary&gt; /// &lt;param name="errorMessage"&gt;&lt;/param&gt; public void WriteLogError(string errorMessage) { try { string path = "~/Error/" + DateTime.Today.ToString("dd-mm-yy") + ".txt"; if (!File.Exists(System.Web.HttpContext.Current.Server.MapPath(path))) { File.Create(System.Web.HttpContext.Current.Server.MapPath(path)).Close(); } using (StreamWriter w = File.AppendText(System.Web.HttpContext.Current.Server.MapPath(path))) { w.WriteLine("\r\nLog Entry : "); w.WriteLine("{0}", DateTime.Now.ToString(CultureInfo.InvariantCulture)); string err = "Error in: " + System.Web.HttpContext.Current.Request.Url.ToString() + ". Error Message:" + errorMessage; w.WriteLine(err); w.WriteLine("__________________________"); w.Flush(); w.Close(); } } catch (Exception ex) { WriteLogError(ex.Message); } } #endregion </code></pre>
c#
[0]
4,780,329
4,780,330
jQuery nth-child exclude other elements
<p>I have some floated div's and I want to select the third with jquery. Also, after each 3 elements I have a hr tag in my html and this hr is also included by jquery in the nth-child count. Can I select only the divs and exclude the other elements inserted in html?</p> <p>This is my code</p> <pre><code>$('.col:nth-child(3n)').addClass('third'); </code></pre> <p>Thank you!</p>
jquery
[5]
4,385,864
4,385,865
Are class declarations that are initially set, internally the same as setting them in the constructor?
<p>Are class declarations that are initially set, internally the same as setting them in the constructor?</p> <p>example:</p> <pre><code>class test { int test1 = 5; } </code></pre> <p>Is there any difference between that and</p> <pre><code>class test { int test1; public test() { test1 = 5; } } </code></pre> <p>If there is no difference, which is more correct to do? </p>
c#
[0]
1,310,852
1,310,853
Any Issues if I use toLong instead of new Long() to convert string Long
<p>Can any one tell me the difference between <code>toLong()</code> and <code>new Long(String)</code>? Are there any differences in performance between the two?</p> <p>Example : <code>String str="1236";</code></p> <p><code>Long val=str.toLong();</code></p> <p>OR</p> <p><code>Long val=new Long(str);</code></p> <p>Which one is better usage and give me the differences?</p>
java
[1]
1,889,270
1,889,271
Convert Object to Boolean[][]
<p>How I can convert an Object to Array of Boolean Arrays?</p> <pre><code>Boolean[][] mass; mass = (Boolean[5][5])Object; </code></pre>
java
[1]
704,971
704,972
how to implement application purchase from the iphone?
<p>I am implementing application purchase application using apple payment gateway.but how to integrate with iphone i dont know.can u give me some advice for that.</p>
iphone
[8]
2,022,494
2,022,495
Add animation when changing tabs
<p>Hello I have a TabHost activity with two child activities. What would be the best solution to add a "left - right" animation for the child activities?</p> <p>Best regards!</p>
android
[4]
5,695,848
5,695,849
Trying to add/subtract variable
<p>I am trying to have something where when it is enabled it adds to a variable and when it is disabled it subtracts from the variable but when I <code>alert</code> the value of the variable is just comes up saying <code>NaN</code> Here is my code:</p> <p>This is for enabling/disabling the button</p> <pre><code>var speedrating; function onoffButton(i, g, r) { $(i).click(function () { if ($(i).html() == '&lt;a class="onoffswitch" id="' + g + 'ON"&gt;&lt;/a&gt;') { $(i).html('&lt;a class="onoffswitch" id="' + g + 'OFF"&gt;&lt;/a&gt;'); speedrating -= r; } else { speedrating += r; $(i).html('&lt;a class="onoffswitch" id="' + g + 'ON"&gt;&lt;/a&gt;'); } updateSpeedRate(); }); } </code></pre> <p>Here is where it checks the variable to see which thing to do:</p> <pre><code>function updateSpeedRate() { if (speedrating &lt; 34) { $('.speedmeter').css('background-position', '0px -30px'); } else { if (speedrating &lt; 67) { $('.speedmeter').css('background-position', '0px -15px'); } else { $('.speedmeter').css('background-position', '0px 0px'); } } alert(speedrating); } </code></pre> <p>Then using the enable/disable object (the third number is the number I'm trying to work with):</p> <pre><code>onoffButton("#switchRating", "rating", 10); onoffButton("#switchFavicon", "favicon", 30); onoffButton("#switchClock", "clockswitch", 10); onoffButton("#switchWeather", "weatherswitch", 30); onoffButton("#switchNotepad", "notepadswitch", 15); onoffButton("#switchLinks", "linksswitch", 5); </code></pre>
javascript
[3]
523,791
523,792
Change events execution order using jQuery.live()
<p>I have the following piece of code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="myplugin.js" /&gt; &lt;script&gt; $(document).ready(function() { $('#mytable tbody tr').live('click', function() { alert('Hi'); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; $('#mytable').myplugin(); &lt;/script&gt; &lt;table id="mytable"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Something&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; myplugin.js code ..... return this.each(function(index, id) { $(id + ' tbody tr').live('click', function() { alert('Hello'); }); }); ..... </code></pre> <p>Under that circustances, the order of executiong would be:</p> <pre><code>alert('Hi'); alert('Hello'); </code></pre> <p>but I want to be the inverse. It's possible to change the execution order for this? thank you</p>
jquery
[5]
221,708
221,709
Basic decrement loop - PYTHON
<p>Newbie to python and hit a snag in my latest program. Simply put, I'm trying to code up a decrement loop for a user input variable if possible. Essentially I have a global constant set to value e.g. 13, each time the program loops it prompts the user to input a value then that user value is shaved off 13 until it reaches 0. Problem is that it does shave it off but when it reiterates it resets the value to 13 and only removes the current iterate value entered. So if you enter 2 each iteration it just takes it down to 11... But I'm aiming for a result using 2 as an example again, 11, 8, 5, etc etc or using 3 as an example 10, 7, 4.... Any help guys will be much appreciated, cheers :)</p> <pre><code>a = 13 def main(): runLoop() def runLoop(): while other_input_var &gt; 0: # guys this is my main score accumulator # variable and works fine just the one below b=int(input('Please enter a number to remove from 13: ')) if b != 0: shave(a, b) def shave(a, b): a -= b print 'score is %d ' % a if a == 0: print "Win" main() </code></pre>
python
[7]
3,009,496
3,009,497
How do I convert an integer to decimal in JavaScript?
<p>I have a number in JavaScript that I'd like to convert to a money format:</p> <pre><code>556633 -&gt; £5566.33 </code></pre> <p>How do I do this in JavaScript?</p>
javascript
[3]
3,560,184
3,560,185
Time-based movement question
<p>I am reading about time-based movement, but I can't seem to fully understand what's going on. In the game, I have this code:</p> <p>About the deltaTime:</p> <pre><code>long startTime = System.nanoTime(); while(running) // some code here float deltaTime = (System.nanotime()-startTime) / 1000000000.f; startTime = System.nanoTime(); // more code here </code></pre> <p>In the framework implementation:</p> <pre><code>float tickTime = 0 static float tick = 0.5f; //update method() { tickTime += deltaTime; while (tickTime &gt; tick) { // do some stuff </code></pre> <p>What I am trying to do is to move my character every 0.5 seconds. I don't know what we check in the while loop, or why we add deltaTime to tickTime (the original coder said something about accumulating). Please also give me an example of deltaTime's value.</p> <p>I am not sure if I forgot to mention something. Thank you very much!</p>
android
[4]
2,433,235
2,433,236
Reading lines from a file in PHP
<p>I'm having problems reading lines from a text file in PHP.</p> <p>I have this code:</p> <pre><code>$a_path = "./data/answers.txt"; $answers = fopen($a_path); $line_num = 1; while ($line = fgets($answers)) { for ($i = 0; $i &lt; count($common_q_line_nums); $i++) { if ($line_num == (int)$common_q_line_nums[$i]) { echo $line; } } $line_num++; } </code></pre> <p>I am using Macintosh, however I updated the php.ini file with <code>auto_detect_line_endings = On</code></p> <p>The <code>$common_q_line_nums</code> sorted array contains numbers in the range of the lines in the text file.</p> <p>Any idea why I'm getting nothing back? The file is opening ok, and the <code>$common_q_line_nums</code> is good.</p> <p>Appreciated, Alex</p>
php
[2]
2,455,581
2,455,582
jQuery live not firing on resize and scroll
<p>Can someone let me know why the following code isnt firing the console.log on resize and scroll? (jquery 1.7 is definately loaded).</p> <pre><code>&lt;script&gt; $(window).live('scroll resize', function () { console.log('am i working?'); }); &lt;/script&gt; </code></pre> <p>Thanks.</p>
jquery
[5]
3,895,333
3,895,334
jquery two select connects
<p>I am trying to connect two HTML <code>select</code> elements. What I want is that when item is <code>select1</code> select disable or remove in <code>select2</code>. I tried so</p> <pre><code>var selector = "#select2 option [value = '" + id_familia + "']"; $(selector).remove(); </code></pre> <p>but as may be updated <code>#select2</code>? ie selected item <code>#item1</code> and item <code>#select2</code> remove but when i select again any item <code>#select1</code> item1 no show in <code>#select2</code>.</p> <p>Can somebody help?</p>
jquery
[5]
342,079
342,080
What's wrong with the Thread?
<pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Thread thread = new Thread(){ public void run() { try { sleep(50); Toast toast = Toast.makeText(getApplicationContext(), "Logged In", 100); toast.show(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; thread.start(); } </code></pre> <p>This code don't work why?</p>
android
[4]
5,106,676
5,106,677
Is there a risk in running file_put_contents() on the same file from different PHP threads?
<p>I know <a href="http://us.php.net/file_put_contents" rel="nofollow">file_put_contents()</a> makes it really easy to append data to a file in PHP. I'd like to try using PHP "<a href="http://www.funkynerd.com/knowledgebase/articles/2" rel="nofollow">threads</a>" to <code>file_put_contents()</code> to the same log file from different PHP threads. Is there a risk in running file_put_contents() on the same file from different PHP threads or will these threads happily block if the file is locked or being accessed by another thread?</p> <p>EDIT: Found <a href="http://stackoverflow.com/questions/4682533/two-users-write-to-a-file-at-the-same-time-php-file-put-contents">a similar question</a> that recommends <a href="http://www.php.net/manual/en/function.flock.php" rel="nofollow">flock()</a>, but the risk question does not seem to be fully addressed. Are these "atomic" write operations?</p>
php
[2]
1,929,677
1,929,678
Strange javascript addition problem
<p>I have this code:</p> <pre><code>var totalAmt=0; for (i in orders) { order=orders[i]; if (order.status !='Cancelled') totalAmt=totalAmt + order.amount; } </code></pre> <p>But if i have 3 orders with amounts 3, 1, and 5, then instead of <code>totalAmt</code> being 9, i get <code>0315</code>. So I think its adding the amounts together as strings instead of integars.</p> <p>How do I fix this?</p>
javascript
[3]
5,349,409
5,349,410
How to find all image tags using Regular Expressions
<p>I need to find all the image html tags that are included in a page using PHP regular expressions</p> <p>Example</p> <pre><code>&lt;img src="images/image.jpg" /&gt; </code></pre> <p>My code</p> <pre><code>preg_match('/&lt;img src=\"images\/.*/',$tags,$matches); </code></pre> <p>The strange thing is it only finds the first occurence, not the rest of the tags in the page</p>
php
[2]
4,858,164
4,858,165
JQuery, Ajax and Internet Explorer - callback only works when response is blank
<p>My code works perfectly in FF, Safari and Chrome... just in IE 7 and 8 this happens...</p> <p>My JQuery AJAX post looks like this:</p> <pre><code>$.post( 'page.php', { test: 'testing' }, function(r){ alert('Data: ' + r); }); </code></pre> <p>Now, in IE, if the response (r) comes back blank, it will display the alert. However, if there is anything returned in the r (even if it's just a digit such a 1), it doesn't show the alert. No errors come up, it just doesn't show the callback...</p> <p>Any ideas what might be wrong?</p>
jquery
[5]
3,594,865
3,594,866
Heap Memory Size Increases While Adding Bitmaps in Arraylists in Android?
<p>I am making a painting application in which I have to add bitmaps of images in an Arraylist when drawing many lines. Unfortunately, I got an out of memory exception. I am unable to fix the issue, though I have increased the size of heap.</p> <p>I am adding current bitmaps in an Arraylist like this:</p> <pre><code>linesbitmap.add(Bitmap.createBitmap(mBitmap)); </code></pre>
android
[4]
3,506,156
3,506,157
code showing prime number (c++) using recursive function and without using any loop
<p>Thats all in title.<br> In simple i had write this.</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main() { int a,i; cout&lt;&lt;"Enter a number: "; cin&gt;&gt;a; for (i=2;i&lt;=a/2;i++) { if (a%i==0) { cout&lt;&lt;"Its not Prime Number."; system ("pause"); return 0; } } cout&lt;&lt;"Its a Prime number."; system ("pause"); } </code></pre> <p>The main thing is WITHOUT using loop and with recursive function.</p>
c++
[6]
5,494,075
5,494,076
How to use location manager as a service
<p>i am doing a project in which i want use the location manager as a service instead of an activity.Can anyone tell me how can i do it programatically?</p>
android
[4]
3,677,901
3,677,902
Switching on non-Ints in Java
<p>I'm having trouble figuring out the inner workings of switches in Java I'm told that for all primitives, the value is promoted to a Integer. </p> <p>However, in the following example, I'm testing on a byte variable, and any case larger than 127 will not compile:</p> <pre><code>byte k = 5; switch(k){ case 128: //fails to compile, possible loss of precision </code></pre> <p>I realize this is an error and have no issue with that. My question is:<br> How does the JVM track that it's switching on a byte if it takes the value of "k" and promotes it to an integer before testing each case?</p>
java
[1]
5,213,590
5,213,591
How to add "quoted text" content to email?
<p>I have a webview which shows a mail . I need to forward the content of this webview in an email using the Intents. Now I am able to get the content of the webview but how do I add this content to the outgoing email as "Quoted text " as the native Gmail app does when you try to forward something.</p>
android
[4]
511,051
511,052
How to find minimum date from 3 dates using javascript function?
<p>I want to find minimum date from 3 dates (8/1/2011,6/1/2011,7/1/2011) format is (mm/dd/yyyy) using java script.</p> <p>Thanks in advance.</p> <p>Kanak Vaghela</p>
javascript
[3]
2,698,354
2,698,355
Why should we use <?php for embedding php code?
<p>I once posted a question here with php code embedded using <code>&lt;?</code>. Someone told me I should NOT do that and I should use <code>&lt;?php</code></p> <p>The person did not tell me why it is so. Can someone please explain why it is unsafe to use <code>&lt;?</code>?</p>
php
[2]
4,038,745
4,038,746
Locally parsing PHP in the browser
<p>I'm looking for a recommendation as to the best way of parsing PHP locally. Is there an add-on for Google Chrome that would mean I don't have to host a file in order to run the PHP?</p>
php
[2]
5,257,519
5,257,520
jQuery - code working partialy when changing Select, why?
<p>I have this in html code:</p> <pre><code>&lt;select name="t" id="t"&gt; &lt;option value="6"&gt;test2&lt;/option&gt; &lt;option value="0"&gt;Overall&lt;/option&gt;&lt;/select&gt; &lt;select name="m" id="m"&gt; &lt;option value="9"&gt;something to change&lt;/option&gt; &lt;option value="0"&gt;back to Overall&lt;/option&gt;&lt;/select&gt; &lt;div id="main"&gt;&lt;/div&gt; </code></pre> <p>I would like change automatically Select "t" to Value "0" when user change Value of Select "m" to "0". So I have a jQuery script:</p> <pre><code>$(function(){ $('#m, #t').change(function(){ if($('#m').val() == '0') { $('#t').val('0').change(); $("&lt;div&gt;succes!&lt;/div&gt;").appendTo("div#main"); } }); }); </code></pre> <p>But this script working only partialy. Script doesn't display the information "succes!" after changing Select. Why?</p> <p>Also you can see this here: <a href="http://jsfiddle.net/SQvua/" rel="nofollow">http://jsfiddle.net/SQvua/</a></p>
jquery
[5]
3,427,585
3,427,586
Iphone & Web App synch
<p>I am trying to build an Iphone App client for our CRM solution so our sales people would be able to access the information available in our CRM through an Iphone App. </p> <p>I am trying to find out what is the recommended approach to architect the application when it comes to the database. I am not sure where should the data reside, should I save a subset of the data on the iPhone, or should I just rely on webservices and pull the information I need from the database whenever I need it. Also, is there any best practices or frameworks to build such applications on the Iphone.</p>
iphone
[8]
3,508,991
3,508,992
Javascript type of custom object
<p>How can I check if my javascript object is of a certain type.</p> <pre><code>var SomeObject = function() { } var s1 = new SomeObject(); </code></pre> <p>In the case above <code>typeof s1</code> will return "object". That's not very helpful. Is there some way to check if s1 is of type SomeObject ?</p>
javascript
[3]
2,253,666
2,253,667
Problem comparing arrays of Strings with nested loops
<p>This is the problem I am trying to solve: I have two arrays of Strings ("matches" and "visibleObjects"). I would like to search through all the words in the array "matches" to see if there is at least one word from the array "visibleObjects". If this condition is satisfied, I'd like to search through the words in "matches" again this time looking for at least a word from the array "actionWords". This is what I have, where "testDir" is just a debug string that gets printed:</p> <pre><code>protected void Action(){ boolean actionWord = false; String target = null; testDir = "first stage"; firstLoop: for(String word : matches) { testDir += " " + word; for(String hint : visibleObjects) { testDir += " " + hint; if(word.equals(hint)) { target = word; //found a matching word testDir = "Hint found"; break firstLoop; } } } if(target != null) { testDir = "stage two"; secondLoop: for(String word : matches) { for(String action : actionWords) { if(word.equals(action)) { actionWord = true; //found one word from the actionWords array testDir = "Acion OK"; break secondLoop; } } } } if(actionWord){ testDir = target; performAction(target); } } </code></pre> <p>All I get printed is the first word from the array matches and all the words from the array visibleObject once, so it doesnt get past the second loop....</p> <p>Is this code right? Can anyone spot the bug?</p> <p>Thanks for your help!</p>
java
[1]
5,301,544
5,301,545
Can I combine variables into a javascript object?
<p>I have the following code:</p> <pre><code>var submitHandler = function ($link, $form, close) { var val = $form.valid(); var action = $form.attr('data-action') var entity = $form.attr('data-entity') var href = $form.attr('data-href'); var rownum = $link.attr('data-row'); var $row = $('#row_' + rownum); var $submitBt = $('.block-footer button:contains("Submit")'); ..... ..... jsonSuccessModal(action, rownum, close, $form, $submitBt, $row); } function jsonSuccessModal(action, rownum, close, $form, $submitBt, $row) { ... } </code></pre> <p>Rather than have many parameters is there a way I could combine variables in the first code block and then just send an object that represents the combination to the jsonSuccessModal. Something like an anonymous object ?</p>
javascript
[3]
3,787,976
3,787,977
Show warning message with OK button before close window in Java Script
<p>I know that by using this function in java script:</p> <pre><code>window.onbeforeunload = function(e) { return 'Please press the Logout button to logout.'; }; </code></pre> <p>It will show the warning message when I press the close window button. But the warning message will ask user to choose between 'stay on the page' or 'leave the page'. </p> <p>I don't want the user to choose when close window. How do we create the warning message with just OK button?</p>
javascript
[3]
5,376,086
5,376,087
How to add functions to prototype of inner function in the global scope in JavaScript?
<pre><code>function A() { this.B = function() { var bla; }; } A.B.prototype.foo = function() {console.log("Do whatever");}; </code></pre> <p>I get this: </p> <blockquote> <p>TypeError: Cannot read property 'prototype' of undefined</p> </blockquote> <p>How to add a function to the prototype of B in this case? </p>
javascript
[3]
1,016,997
1,016,998
how can i specify the resources that can be used for particular resolution
<p>I need to provide specific resources say images for Particular resolution say 240 * 432</p> <p>How can i do that without using -large extension(is der something like layout 240*432 ??)</p> <p>regards, Kariyachan</p>
android
[4]
547,471
547,472
multiple replace of a letter
<p>I have a string variable <code>var str = 'this is eeeeeeee';</code>. I want to replace each letter e in this string. When I do <code>str.replace('e', 'E');</code> it does it only to the first e</p>
javascript
[3]
2,695,823
2,695,824
exporting data from mysql to ms excel
<p>I have the following code which I am using to export data from mysql database to microsoft excel</p> <pre><code> $result = $this-&gt;db-&gt;query($sql); $num_fields = mysql_num_fields($result); $header = ""; for($i = 0; $i &lt; $num_fields; $i++ ) { $header .= mysql_field_name($result,$i)."\t"; } $data = ""; while($row = mysql_fetch_row($result)) { $line = ''; foreach($row as $value) { if((!isset($value)) || ($value == "")) { $value = "\t"; } else { $value = str_replace( '"' , '""' , $value ); $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim( $line ) . "\n"; } /*if($code=="M"||$code=='m'){ $value="\n Total \t $total \t"; $data .=trim($value)."\n"; }*/ $data = str_replace("\r" , "" , $data); if ($data == "") { $data = "\n No Record Found!n"; } header("Cache-Control: "); header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"$label.xls\""); header("Pragma: "); header("Expires: 0"); print "$header\n$data"; </code></pre> <p>where $result is a mysql resource.</p> <p>When I run the program, before opening, excel issues a warning "the file you are trying to open, filename.xls, is in different format than specified by the extension, verify that the file is not corrupted and is from a trusted source before opening. Do you want to open the file now?"</p> <p>I am stranded because after accepting to open the file, I see the data that I require, what I want is a way of making the format of data sent match the xls extension format. What should I do?. I am using ms office 2007</p>
php
[2]
2,402,437
2,402,438
How to pass a string as sdtin to python script from command line interface
<p>Currently iam using following command to do this</p> <p>python scriptName.py <p>This command uses "&lt;" to stdin the file to script. and it works fine, I can use sys.stdin.read to get the file data.</p> <p>But, what if i want to pass file data as a string, I dont want to pass file path in operator "&lt;".</p> <p>Is there is any way, where I can pass String as stdin to a python script.</p> <p>Thanks, Kamal</p>
python
[7]
5,974,119
5,974,120
C# Interface casting... dictionary lookup?
<p>Does C# do a dictionary lookup every time you cast an Object to an interface? I'd think it'd have to. </p> <p>Generic object that could implement hundreds of interfaces -> GetType() -> Get interface by name (or numeric ID, not going to be in a predictable location) -> Get method pointers from array and save to the casted object</p>
c#
[0]
5,726,657
5,726,658
How create a showdialog?
<p>I customize a dialog as: </p> <pre><code>dialoge3 = new Dialog(this); dialoge3.setContentView(R.layout.layoutdialoge003); Button btnCacnel = (Button) dialoge3.findViewById(R.id.btnE3Cancel); btnCacnel.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub dialoge3.cancel(); } }); dialoge3.show(); </code></pre> <p>When I click show dialog, I still can click on activity. I want that when the dialog is showing, that I can't click on the activity.</p> <p>The same In C#:</p> <pre><code>Form frm=new Form (); frm.showDialog(); </code></pre>
android
[4]
3,123,953
3,123,954
Form of fbrequest
<p>I'm using fbconnect in my app to connect to Facebook. Whenever i code a feature, I must google to find the form like below:</p> <pre><code>////// NSString *event = @"{\"name\":\"A party\",\"start_time\":\"1215929160\",\"end_time\":\"1215929160\",\"location\":\"Somewhere\"}"; NSDictionary *params = [NSDictionary dictionaryWithObject:event forKey:@"event_info"]; [[FBRequest requestWithDelegate:self] call:@"facebook.events.create" params:params]; ///// </code></pre> <p>I wonder how can I know the format of string "event", or key @"event_info", or @"facebook.events.create". I try to find document of fbconnect that talk about format above but ... Anybody can help me about this. Thanks</p>
iphone
[8]
5,585,310
5,585,311
change live wallpaper when idle?
<p>Hi I'm just wondering is there an option or an app in android that will control the android live wallpaper when it's idle? For instance I have a live wallpaper that consumes a tremendous amount of battery and 90% of the time I don't even see the live wallpaper since my phone is in my pocket idle. Is there something that can control this? Like an app that automatically changes the background to an image instead when it's idle and as soon as it comes out of idle mode changes back to the live wp?</p>
android
[4]
4,341,273
4,341,274
Adding use to the home button
<p>When you press the home button, what does it do by default?</p> <p>I want to keep what it does by default, but make sure it ends my music as well. </p> <p>For example:</p> <p>public void onBackPressed() { return;</p> <p>I disabled my back button.</p> <p>I want to make it so the home button does what it does, but i want to call my this.stopService(new Intent(this, Music.class)); in the method too.</p>
android
[4]
937,872
937,873
How to use GetAsyncKeyState without calling it multiple times?
<p>This is how my code currently looks like:</p> <pre><code> if (GetAsyncKeyState(VK_CONTROL) &amp;&amp; GetAsyncKeyState(0x31)) { //... } if (GetAsyncKeyState(VK_CONTROL) &amp;&amp; GetAsyncKeyState(0x32)) { //... } if (GetAsyncKeyState(VK_CONTROL) &amp;&amp; GetAsyncKeyState(0x33)) { //... } if (GetAsyncKeyState(VK_CONTROL) &amp;&amp; GetAsyncKeyState(0x34)) { //... } if (GetAsyncKeyState(VK_CONTROL) &amp;&amp; GetAsyncKeyState(0x35)) { //... } </code></pre> <p>Is there some more efficient way of doing this without calling GetAsyncKeyState multiple times per loop? Maybe store the function value into an integer and then use a switch statement?</p> <p>Also, I do not want to use RegisterHotKey.</p>
c++
[6]
3,403,462
3,403,463
drop down list changed
<p>in my application I need to check if a drop down list has changed or not. can you please let me know how I should write it? </p> <pre><code>if (document.form.dropdownlist.???) </code></pre> <p>I don't know what to write instead of ????</p>
javascript
[3]
125,269
125,270
JS looping a folder of images, preload them and assign to an array?
<p>I have a folder named "img" and i want to use js to look up the folder and find all the image files (jpg,JPG or png) and preload them and assign them to an array.</p> <p>Can this be done in terms of looking up a folder like that on my server? Or does client code not allow you to loop through files in a folder?</p>
javascript
[3]
1,085,092
1,085,093
Getting data from two different arrays for the same index
<p>I created an array like this:</p> <pre><code>string mobs [5] = {"Skeleton", "Dragon", "Imp", "Demon", "Vampire"}; int mobHP[5] = {10, 11, 12, 13, 14, 15}; </code></pre> <p>I created a random number generator for getting the mob number that i want, but I failed. Supposing, the generated number is 4, how will I equate or equalize it to string mob number 5, and mob hp number 5?</p>
c++
[6]
3,728,775
3,728,776
How to create datalist dynamically
<p>In my application I want to create a dynamic datalist and bind the database values. please help me this is my code</p> <pre><code>protected void btn_Click(object sender, EventArgs e) { DataList datlst = new DataList(); da = new SqlDataAdapter("select emname from emp", con); ds = new DataSet(); da.Fill(ds, "emp"); datlst.DataSource = ds.Tables[0]; datlst.DataBind(); //this.Controls.Add(datlst); form1.Controls.Add(datlst); } </code></pre>
asp.net
[9]
3,814,515
3,814,516
Turn off register_globals through a php file
<p>I want to know how can I turn off the register_globals for a single php file? Like is there any code which is capable of turning off the register_globals feature in configuration file?</p>
php
[2]
2,597,716
2,597,717
Android: ICS Spell-Checking not working
<p>I've just tried out my application on a physical device running ICS for the first time and much to my surprise and dismay the spell check that underlined misspelled words in the emulator is not working. The device in question is a HTC One S. The spelling correction does appear to be there in other applications. It's always been there in my application when running on the emulator. </p> <p>I've found nothing to suggest there is anything I need to turn on to get the spell check to work and the fact it works in the emulator but not in a real device is quite alarming. Is there something else I am missing?</p>
android
[4]
4,169,735
4,169,736
Jquery fade in not working
<p>I am trying to change an img src then set opacity to 0 then fade in.</p> <pre><code> $("#featureImg").attr('src','07.jpg').css({opacity:0}).fadeIn("slow"); </code></pre> <p>This works up to the </p> <pre><code>.css({opacity:0}) </code></pre> <p>Meaning it does set the opacity to 0,but the fade never happens.</p>
jquery
[5]
2,348,326
2,348,327
How to achieve a flash/strobe effect?
<p>I want to create an effect of camera flash similar to one from cuttherope.ie (the moment when you replay level) and I am stuck at the beginning: I want to use animate() with document to switch its background and font colors and then animate again removal of set properties. However even I can't get the first part working. The code's below: </p> <p><a href="http://jsfiddle.net/aM23f/3/" rel="nofollow">http://jsfiddle.net/aM23f/3/</a></p> <p>P.S: I know I can use jquery UI's effect("highlight") but because I am learning jQuery I want to achieve this effect by myself. </p>
jquery
[5]
1,431,684
1,431,685
Javascript functions, how can I start beginning to understand them?
<p>I totally understand that in order to learn javascript I need to know how functions work, I understand the basics of passing in parameters and then calling the function with the values to maybe add something together, etc. I've read countless articles about functions as well as books, etc., but I just dont get how they are used and when they should be used, etc., the more advanced functions that have maybe 4 parameters and are doing different calculations and returning various values that get fired back into the script just totally confuses me. </p> <p>What I would like to know is first of all how can I overcome this confusion and also any words of wisdom you may have? I will also add that I have no prior programming experience and have spent the last 2 months frequently hitting my head off a brick wall as I just cant understand javascript.</p>
javascript
[3]
1,048,584
1,048,585
C++ template and ODR Rule
<p>Why does following works in <code>C++</code>, I thought <code>ODR</code> rule will come into picture for following code</p> <pre><code>typedef char int8; class Sample { public: template &lt;typename T&gt; void test( T param){ } }; int main() { Sample s; s.test&lt;char&gt;('a'); s.test&lt;int8&gt;((int8)'b'); return 0; } </code></pre>
c++
[6]
2,988,732
2,988,733
How can I add an image to the title bar in android 3.0?
<p>I am learning android 3.0. Can any one tell How can add Image in Title bar in android 3.0? In developer site they are telling by default it will come.but for me it is not coming. Thanks in advance.</p>
android
[4]
5,465,110
5,465,111
change img src with jQuery
<p>There are many answers on SO that show how to set an img src with .attr in jQuery. For some reason this is not working.</p> <pre><code>&lt;img id="imgMap" style="position:absolute;bottom:7px;right:7px;width:250px;height:250px;" /&gt; &lt;script&gt; $(function () { $("#imgMap").attr( 'src', 'http://maps.googleapis.com/maps/api/staticmap?center=41.886456,-87.62325&amp;zoom=14&amp;size=250x250&amp;sensor=false&amp;markers=color:blue%7Clabel:S%7C41.886456,-87.62325'); }); &lt;/script&gt; </code></pre> <p>But the exact same url put inline in the HTML works fine</p> <pre><code>&lt;img id="imgMap2" runat="server" src="http://maps.googleapis.com/maps/api/staticmap?center=41.886456,-87.62325&amp;zoom=14&amp;size=250x250&amp;sensor=false&amp;markers=color:blue%7Clabel:S%7C41.886456,-87.62325" style="position:absolute;bottom:7px;right:7px;width:250px;height:250px;" /&gt; </code></pre>
jquery
[5]
1,135,165
1,135,166
Android ICS 4.0 OS
<p>I am a new Android developer starting out.</p> <p>I hope that someone from the androids developers team can answer this question: if I have a tablet with android ICS 4.0 OS, given that this OS is UNIX-based, can I install the Android Developer Kit and related platform+ packages on it, so that I might study development on the go whilst traveling with my tablet?</p> <p>I understand that one of the requisite OSes for the android development kit is UNIX - GNU C Library (<code>glibc</code>) 2.7 or later. Is ICS 4.0 compatible with this?</p>
android
[4]
665,323
665,324
How to check element is not null in java
<pre><code>filterItems = null; filterItems = new ArrayList&lt;SelectItem&gt;(); Iterator&lt;String&gt; it = RefListMap.keySet().iterator(); while (it.hasNext()) { String s = (String) it.next(); filterItems.add(new SelectItem(s, s)); } </code></pre> <p>Now i am getting filterItems size=1 but that value is null.How to check array element is not equal to null.</p> <pre><code>if(filterItems != null) { code } </code></pre> <p>but this condition is not working...Please help me.</p>
java
[1]
2,240,256
2,240,257
Removing the Title bar of external application using c#
<p>My application starts up another application. whereby, i want to remove the title bar of the application which is started using c#.</p> <p>What is the feasibility and how ?</p> <p><strong>After all comments, i got some idea to implement. The below code works fine :</strong></p> <p>//Finds a window by class name [DllImport("USER32.DLL")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);</p> <pre><code>//Sets a window to be a child window of another window [DllImport("USER32.DLL")] public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); //Sets window attributes [DllImport("USER32.DLL")] public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); //Gets window attributes [DllImport("USER32.DLL")] public static extern int GetWindowLong(IntPtr hWnd, int nIndex); [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)] static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName); //assorted constants needed public static int GWL_STYLE = -16; public static int WS_CHILD = 0x40000000; //child window public static int WS_BORDER = 0x00800000; //window with border public static int WS_DLGFRAME = 0x00400000; //window with double border but no title public static int WS_CAPTION = WS_BORDER | WS_DLGFRAME; //window with a title bar public void WindowsReStyle() { Process[] Procs = Process.GetProcesses(); foreach (Process proc in Procs) { if (proc.ProcessName.StartsWith("notepad")) { IntPtr pFoundWindow = proc.MainWindowHandle; int style = GetWindowLong(pFoundWindow, GWL_STYLE); SetWindowLong(pFoundWindow, GWL_STYLE, (style &amp; ~WS_CAPTION)); } } } </code></pre>
c#
[0]
419,159
419,160
android - notifications without alerting the user
<p>I currently have an ongoing notification that displays some information about my app. While this information is useful, there's no need for the user to actually see that I've created the notification. Its basically there to tell them that "hey, my app is doing stuff in the background, click here to go back to it".</p> <p>My notification works correctly, however whenever I call ".notify()" my notification shows the text from my notification in the notification bar at the top of the screen, like a text message does.</p> <p>I want to to do it silently, so when I call notify it doesn't show my notifications text in the small notification bar before doing the "roll up" animation.</p> <pre><code> Context context = getApplicationContext(); Intent notificationIntent = new Intent(this, AudioPlayer.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); Notification notification = new Notification(R.drawable.ic_launcher, title, System.currentTimeMillis()); RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.note_layout); ~~~ remote views stuff ~~~ contentView.setTextViewText(R.id.notification_title, title); contentView.setTextViewText(R.id.notification_text, author); notification.contentView = contentView; notification.contentIntent = contentIntent; notification.flags |= Notification.FLAG_ONGOING_EVENT; mNotificationManager.notify(8675309, notification); </code></pre>
android
[4]
2,597,590
2,597,591
iPhone SDK: Why is my view not lining up?
<p>When I run my app, for some reason the view is pushed up too far. The space it is pushed up too far appears to be the height of the status bar. (</p> <p>I am using a NIB. I have verified that both MainWindow and this view has the simulated status bar checked. </p> <p>I'm not sure what could be wrong?</p> <p>Any help appreciated.</p>
iphone
[8]
4,897,089
4,897,090
create an automatic update RSS feed out of .txt file
<p>i have a .txt file consist of number of text lines, i want some PHP script to create an RSS feed and update it with line by line out of the .txt file every some amount of time, say 2 minutes [say, i have a .txt file consists of 100 text lines, the script will create an RSS Feed and update it every 2 minutes with an text line in order so it will be line N1, line N2, line N2,....., line N100 then it stop updating the RSS feed], i hope i made it clear, is it doable, (i'm not good in PHP or XML programming, i searched all over the internet for something like this but i couldn't find any solutions, i hope you can help me) thanks in advance.</p>
php
[2]
3,085,207
3,085,208
HttpWebRequest timeout in Windows service
<p>I am getting a timeout error while starting my Windows service. I am tring to download an XML file from a remote system which causes a timeout during the service OnStart.</p> <p>This is the method I am calling from OnStart:</p> <pre><code>public static StreamReader GetResponseStream() { try { EventLog.WriteEntry("Epo-Service_Retriver", "Trying ...", EventLogEntryType.Information); CookieContainer CC = new CookieContainer(); HttpWebRequest request = (HttpWebRequest)WebRequest.Create( Utils.GetWeeklyPublishedURL()); request.Proxy = null; request.UseDefaultCredentials = true; request.KeepAlive = true; //THIS DOES THE TRICK request.ProtocolVersion = HttpVersion.Version10; // THIS DOES THE TRICK request.CookieContainer = CC; WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); EventLog.WriteEntry("Epo-Service_Retriver", "Connected to Internet...", EventLogEntryType.SuccessAudit); return reader; } } </code></pre> <p>Is there any possibility to avoid this timeout?</p>
c#
[0]
282,114
282,115
How to drag webview onTouch in android
<p>I have the following layout:</p> <pre><code>|===================================| | webview-1 | | | | | |===================================| |-----------------------------|-----| | imageview | &gt; |----&gt; ImageButton seton ImageView |-----------------------------|-----| |===================================| | webview-2 | | | | | |===================================| </code></pre> <p>Upon touching <code>ImageButton</code>:</p> <ol> <li>When I drag up then <code>webview-2</code>' height increases and <code>webview-1</code>'s height decreases</li> <li>When I drag down then <code>webview-2</code>s height decreases and <code>webview-1</code>'s height increases</li> </ol> <p>In both cases <code>imageview</code>'s height and width remain the same. Is this possible to do?</p>
android
[4]
1,838,167
1,838,168
Android Back button code never executed
<p>I have the following code in my Activity. I have Breakpoints set to all of these methods. When I press the Menu button, it enters onKeyDown and onKeyUp. When I press the back button, the app closes and phone goes back to home screen without passing any of my breakpoints.</p> <p>EDIT: This could should work according to most sources:</p> <pre><code>@Override public void onBackPressed() { SwitchToMenuState(); } </code></pre> <p>However, it doesn't. I have tried all permutations of the following code blocks, and neither of them ever get called:</p> <pre><code>@Override public void finish() { SwitchToMenuState(); } public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { SwitchToMenuState(); } return true; } public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { SwitchToMenuState(); } return true; } </code></pre> <p>I am using Android 2.3 and Processing, although it doesn't seem to be related to Processing at all. Eclipse tells me that I am overriding android.app.Activity.onBackPressed.</p>
android
[4]
324,058
324,059
Android Library Project - can't find class from library project at runtime?
<p>I'm trying to create an android library project so I can make a lite and full version of my app with shared code. Following the directions here:</p> <pre><code>http://developer.android.com/guide/developing/projects/projects-eclipse.html http://blog.donnfelker.com/2010/08/05/howto-android-full-and-lite-versions/ </code></pre> <p>Running my lite version throws a ClassNotFoundException at runtime because it cannot find the activity class from the shared project. It's as if the project linking (properties -> java build path -> projects -> add) isn't actually including any of the .class files at runtime.</p> <p>Anyone else running into this problem? I don't want to export a .jar from my library project because with this other method we can share activities and such which is ideal. The manifest of my "lite" project, which references the library project activity:</p> <pre><code>&lt;application android:name="com.me.test.lib.App"&gt; &lt;activity android:name="com.me.test.lib.ActivityMain" &gt; </code></pre> <p>It can't find either the App class or the ActivityMain class which are part of the library project.</p> <p>Thanks</p> <hr> <p>The exception - the path in the ComponentInfo looks wrong, should it be nested like that?</p> <pre><code>04-29 16:49:01.759: ERROR/AndroidRuntime(2349): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{ com.me.test.lite/com.me.test.lib.ActivityMain}: java.lang.ClassNotFoundException: com.me.test.lib.ActivityMain in loader dalvik.system.PathClassLoader[/data/app/com.me.test.lite-2.apk] </code></pre>
android
[4]
5,957,298
5,957,299
Define statement being printed in output
<p>I'm trying to define a constant for deployment proposes so that we know that we are on a development environment.</p> <ol> <li><p>I've created a PHP file with:</p> <pre><code>define('LDEV', true); </code></pre> <p>And name it, for example: <strong>devEnv.php</strong></p> <p>I've placed somewhere: ex: <em>/home/user/Sites/devEnv.php</em></p></li> <li><p>In <code>php.ini</code>, I set my auto_prepend_file attribute to my file, like so:</p> <pre><code>auto_prepend_file = "/Users/user/Sites/devEnv.php" </code></pre></li> <li><p>I restarted Apache to see the changes</p> <pre><code>sudo /etc/init.d/apache2 restart </code></pre></li> </ol> <p>Now I see this <code>define('LDEV', true);</code> echoed on my local site and it shouldn't be there.</p> <p>What am I doing wrong ?</p>
php
[2]
5,346,564
5,346,565
How to call any webservices in phone gap application
<p>My application is phonegap template based i am understand about Javascript,CSS,HTML all is fine but i want call any webservices in my javascript code so how can i do if anybody know so please reply me answer to this question</p> <p>Thank You To ALL </p>
iphone
[8]
2,831,137
2,831,138
When to use parentheses with javascript function
<p>I have a function called <code>showText()</code> which copies some text from form textbox to a paragraph elsewhere. It is called with the following:</p> <pre><code>document.getElementById("mybutton").onclick = showText; </code></pre> <p>It will not work if I add the () to the end of showText, which I understand from reading similar answers here is the only way to call a function. </p> <p>Later in the script it requires the () to work:</p> <pre><code>window.addEventListener("keypress", function(e) { var keycode = e.keyCode; if (keycode == 13 ) { showText(); } }, false); </code></pre> <p>I'm not sure what is going on here.</p>
javascript
[3]
1,634,688
1,634,689
how to play my images in java script
<p>can you look this page <a href="http://www.itheatrep.com/" rel="nofollow">http://www.itheatrep.com/</a> how to auto movement in java script </p>
javascript
[3]
5,220,580
5,220,581
How can I make this function with substr work when rk is null or ""
<p>I have the following function in C#:</p> <pre><code> public string getRowKey(string topic, string rk) { return string.Join("", from s in topic.Split('.') select s.PadLeft(2, '0')).PadRight(4, '0') + rk.Substring(4); } </code></pre> <p>I have a problem because if rk is null or equal to "" then the function is failing. Can someone explain how I can fix this. I am getting an error about index values. Note that if rk is null or "" then I just don't want that last part with rk.Substring(4) added.</p>
c#
[0]
1,119,508
1,119,509
programmatically create TABBAR
<p>i created TAb bar programatically in this manner</p> <pre><code>UITabBarController *tabBarController = [[UITabBarController alloc] init]; contacts *vc1 = [[contacts alloc]init]; vc1.tabBarItem.image=[UIImage imageNamed:@"contacts.png"]; search* vc2 = [[search alloc] init]; vc2.tabBarItem.image=[UIImage imageNamed:@"search.png"]; a1* vc3 = [[a1 alloc] init]; a2 *vc4 = [[a2 alloc] init]; a3 *vc5 = [[a3 alloc] init]; NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2,vc3,vc4,vc5, nil]; tabBarController.viewControllers = controllers; [self.view addSubview:detailNavCont]; // Add the tab bar controller's current view as a subview of the window [self.view addSubview:tabBarController.view]; </code></pre> <p>What i want to accomplish is, i want to assign images to tab bar, firstly i tried on first 2 tabs, is showing a blue block instead of image. secondly, when we create tab bar through Interface builder, there are custom tab bar item, like, contacts, search, bookmark ,compose etc.</p> <p>so, if i want to assign contacts or search image to my tab bar items,which looks like the one in IB, how can i do it??</p> <p>regards</p>
iphone
[8]
4,487,750
4,487,751
Select element client side modification?
<p>I use tools like Firebug pretty routinely, and often build SPA style dynamic forms where DOM manipulation with user inputs is routine. Are there any safeguards against a user inserting options into a select box using a tool like Firebug or any sort of javascript CLI?</p> <p>As a simple example, consider this select box for you to choose whether you are married or unmarried (My actual select boxes have MANY more options, and are populated via AJAX from XML files. This will be important later.):</p> <pre><code>&lt;select name="mstatus" id="mstatus"&gt; &lt;option value="" selected&gt;Specify marital status&lt;/option&gt; &lt;option value="Married"&gt;Married&lt;/option&gt; &lt;option value="Single"&gt;Single&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Currently I can easily insert another option thusly (I have Mootools on the page):</p> <pre><code>$('mstatus').innerHTML+="&lt;option value='Rebel'&gt;I won't play by the rules&lt;/option&gt;" </code></pre> <p>Now of course for this example, I can check server side whether the selected option is valid without too much grief. But generally I would have to compare the user submission to the original XML source for each select in order to confirm its validity. </p> <p>Is there another way to ensure the integrity of returned values? Is this enough of a non issue for me to take user selection at face value? Is the best practice here really just to treat all select inputs as text inputs until you have confirmed they are selected from within their valid range of values?</p> <p>Thanks for your help.</p> <p>Note: There is no danger of code injection, since all values entered are thoroughly vetted and are pretty inert by the time they get popped into the database.</p>
javascript
[3]
2,053,881
2,053,882
Substituting class name by variable in PHP
<p>Since which version of PHP is it possible to use the following:</p> <pre><code>$class::method()-&gt;something($val); </code></pre> <p>I need to use this but in 5.2.11 I get a T_PAMAAYIM_whatever error, and I just wanted to determine whether it's version related or bad coding.</p> <p>If it's version related, what's a valid alternative?</p> <p>Thank you.</p>
php
[2]