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
23,599
23,600
Timer class and C#
<p>I have a program written in C#. I want the Timer class to run a function at a specific time.</p> <p>E.g : run function X at 20:00 PM</p> <p>How can I do that using the Timer class?</p>
c#
[0]
618,064
618,065
Java Script 2 D Arrays allocation
<p>I want to allocate a 2 D Array in Java Script. </p> <p>I want do some thing similar to this in JavaScript</p> <pre><code>typedef struct { int itemA, int itemB, string testC } myStruc; myStruct MyArray [100]; </code></pre> <p>How to do this ? </p>
javascript
[3]
351,403
351,404
Going to the previous state after using fillAfter
<p>In my application. when the user presses a button, the button dissappears (a layout animation is used) and another activity is launched. For keeping the button invisible I've used the fillAfter attribute. If the used presses the BACK key, the previous activity will be displayed with the invisible button. Is there a way to avoid this without re-building the layout in onResume? </p> <p>Thanks, Gratzi</p>
android
[4]
4,884,971
4,884,972
How to deny the use of dangerous PHP functions?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1865020/php-how-to-disable-dangerous-functions">PHP: How To Disable Dangerous Functions</a> </p> </blockquote> <p>Hi, this is my situation: I must let my clients enter PHP code, but only safe functions like string function, date function etc. So I need the danger PHP functions list to remove them by using string replace before save to PHP file. Any suggestion?</p>
php
[2]
4,628,751
4,628,752
error: /usr/include/objc/objc-class.h: No such file or directory
<p>I am currently using blocks in my UIButton category. However I have come across this error which I cannot solve:</p> <blockquote> <p>error: /usr/include/objc/objc-class.h: No such file or directory</p> </blockquote> <p>This is the line of code that uses blocks:</p> <pre><code>FTButtonBlock block = objc_getAssociatedObject(self, "buttonBlock"); </code></pre>
iphone
[8]
1,916,189
1,916,190
Android: launch new activity when it not exist
<p>I have a service that work in foreground, and when the Main activity launch it the notification is launched with the following code:</p> <pre><code>private void showNotification() { Log.i(TAG, LocalService.class.getName() + "showNotification()"); Intent notificationIntent = new Intent(getApplicationContext(), NotificationActivity.class); //notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, 0); nm = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); // Set the icon, scrolling text and timestamp int icontouse = R.drawable.icon; if (app.prefs.getBoolean("prefs_useprivacyicon", false)) { icontouse = R.drawable.icon_privacy; } n = new Notification(icontouse, getString(R.string.voice_pro_ready), System.currentTimeMillis()); n.contentView = getRemoteView(); n.contentIntent = contentIntent; startForeground(myID, n); nm.notify(myID, n); } </code></pre> <p>my problem is the PendingIntent, if the Main activity was in pause status, then this become in front when click on notify in statusbar, but if the Main activity was closed by finish() this don't become visible.</p> <p>I need to make possible that if the Activity is in memory than become visible, if not available in memory, then launch a new instance.</p>
android
[4]
5,887,852
5,887,853
how to add a jquery load.gif during in jquery.load process?
<p>I want to use use <code>jQuery.load()</code> to load some content. How do I add a spinner during the load process?</p> <p><img src="http://i.stack.imgur.com/vmrR2.jpg" alt="load.gif"></p> <pre><code>$("#content").load("b.php #abc"); </code></pre>
jquery
[5]
2,249,629
2,249,630
how to get key from value in hash table
<p>I have hashtable with key and values and in my code I am iterating hashtable through values like below : </p> <pre><code>foreach (Object clientObject in ClientList.Values) { // code to perform operation based on value ...... } </code></pre> <p>Where ClientList is hashtable. Now I want to get key of perticualar value from hashtable in my code. is there any way to achieve that ?</p> <p>Thanks </p>
c#
[0]
1,854,517
1,854,518
Can a DataBinder.Eval be nested within another DataBinder.Eval?
<p>Can you do something like </p> <pre><code>&lt;%# DataBinder.Eval(Container.DataItem,"Column1").ToString().Replace("_",&lt;%# DataBinder.Eval(Container.DataItem,"Column2") %&gt; %&gt; </code></pre>
asp.net
[9]
1,822,725
1,822,726
PHP - Is this a good method to prevent re-submission?
<p>This is related to preventing <a href="http://stackoverflow.com/questions/542284/preventing-webform-resubmission-on-browser-refresh-without-losing-viewstate">webform resubmission</a>, however this time the context is a web-based RPG. After the player defeats a monster, it would drop an item. So I would want to prevent the user from hitting the back button, or keep refreshing, to 'dupe' the item-drop.</p> <p>As item drop is frequent, using a DB to store a unique 'drop-transaction-id' seems infeasible to me. I am entertaining an idea below:</p> <ol> <li><p>For each combat, creating an unique value based on the current date-time, user's id and store it into DB and session. It is possible that given a userid, you can fetch the value back </p></li> <li><p>If the value from session exists in the DB, then the 'combat' is valid and allow the user to access all pages relevant to combat. If it does not exist in DB, then a new combat state is started</p></li> <li><p>When combat is over, the unique value is cleared from DB.</p></li> <li><p>Values which is 30mins old in the DB are purged.</p></li> </ol> <p>Any opinions, improvements, or pitfalls to this method are welcomed</p>
php
[2]
5,745,490
5,745,491
Print using for loop - Python
<p>I am fairly very new to Python or any programming language for that matter. I am finding it challenging to print arbitrary text along with with iterated values from a list, using for loop. What I need is to print the whole first item of the list with arbitrary text "shutdown" and repeat the same for new text "no shutdown". Also, I want to be able to insert any text statements between the two separate outputs: Please advise. Here is more information..</p> <p><strong>CURRENT OUTPUT: Which is not desired</strong></p> <pre><code>interface Vlan100 shut no shut interface Vlan108 shut no shut </code></pre> <p><strong>EXPECTED OUTPUTS:</strong></p> <p><em># First time printing:</em></p> <pre><code>********* THIS IS INTERFACE OUTPUT WITH "SHUTDOWN" ********** interface Vlan100 shutdown interface Vlan108 shutdown </code></pre> <p><em><strong></em>**<em></strong> THIS IS INTERFACE OUTPUT WITH "NO SHUTDOWN" <strong></em>**<em>*</em></strong></p> <pre><code>*# Second time printing:* interface Vlan100 no shutdown interface Vlan108 no shutdown </code></pre> <p><strong>CODE EXTRACT, Snipped for brevity reasons.</strong></p> <pre><code>for i in servicetypes: &lt;snip&gt; &lt;snip&gt; elif "ipv4 address" in i or "ipv4 address 8" in i or " ipv4 address 213" in i: i = re.sub(r'encapsulation dot1Q \d+\n\s','',i) i = re.sub(r'TenGigE[0-9]/[0-9]/[0-9]/[0-9].','Vlan',i) internet = i.split("\n") print internet[1] print " shut" print " no shut" </code></pre>
python
[7]
4,182,854
4,182,855
Display details in a textbox
<p>I have a list box.Whenever I search a person from the database, the result will be displayed in a listbox. Then what I want is whenever I click on the name of the person from the listbox is that the persons detail will be displayed in textboxes. I have my code but the problem is that only the details of the person I first click are displayed in the textboxes.</p> <pre><code>private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { connection.Open(); OleDbCommand select = new OleDbCommand(); select.Connection = connection; select.CommandText = "Select * From Accounts"; OleDbDataReader reader = select.ExecuteReader(); while (reader.Read()) { if (reader[0].ToString() == listBox1.Tag.ToString()) { fnametb.Text = reader[1].ToString(); lnametb.Text = reader[2].ToString(); agetb.Text = reader[3].ToString(); addresstb.Text = reader[4].ToString(); coursetb.Text = reader[5].ToString(); } } connection.Close(); } </code></pre>
c#
[0]
2,292,228
2,292,229
add -100px to jquery (body).height();
<p>If i use <code>(body).height();</code> to calculate a windows height, is there a way to calculate the height -100px. </p> <p>Is there a way to do this as part of the <code>(body).height();</code> queriy rather than calculating it later on ?</p>
jquery
[5]
3,862,222
3,862,223
Not getting desired output while Locating Descendent Elements in jQuery
<p>I am not getting the colored output by the given code. </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;the title&lt;/title&gt; &lt;script type="text/javascript" src="/jquery/jquery-1.3.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" language="javascript"&gt; $(document).ready(function() { $("p").find("span").addClass("selected"); }); &lt;/script&gt; &lt;style&gt; .selected { color:red; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;This is 1st paragraph and &lt;span&gt;THIS IS RED&lt;/span&gt;&lt;/p&gt; &lt;p&gt;This is 2nd paragraph and &lt;span&gt;THIS IS ALSO RED&lt;/span&gt;&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Is there anything that I am missing? Thanks,</p>
jquery
[5]
5,903,038
5,903,039
Working against the full framework implementation
<p>Anyone ever had any exprience with working against the full framework implementation, not the SDK. where could I find any examples/libraries or any other information about that?</p> <p>thanks, ray.</p>
android
[4]
5,462,318
5,462,319
PHP Undefined variable error
<p>I have this class ( it is simple card class):</p> <pre><code> class Card{ private $suit; private $rank; public function __construct($suit, $rank){ $this-&gt;$suit = $suit; $this-&gt;$rank = $rank; } public function get_suit(){ return $this-&gt;$suit; } public function get_rank(){ return $this-&gt;$rank; } } </code></pre> <p>I instance every card ( with suit and rank) for deck :</p> <pre><code> $tmp_deck = array(); foreach ($SUITS as $suit){ foreach($RANKS as $rank){ array_push( $tmp_deck, new Card($suit, $rank) ); } } echo $tmp_deck[0]-&gt;get_suit(); </code></pre> <p>And error it gives me :</p> <pre><code>Notice: Undefined variable: suit in card.php on line 13 </code></pre> <p>I really cant get what is wrong. Can any one help me ?</p>
php
[2]
5,962,248
5,962,249
c# comparing strings, one from an array other from an entered value
<p>Basically comparing a string that is entered, and trying to get that position from the array.</p> <p>If I initialize position to 0 then it returns the position zero of the array, if I initialize to 1 then it gives me the item in slot 1, so it's skipping the compare statement.</p> <p>I also tried using <code>(custStatus == cardStatus[i])</code></p> <pre><code>public static int discount(string []cardStatus, int []pDiscount, string custStatus) { int position= 0; int discount; for(int i = 0; i &lt; 2; i++) { if (string.Equals(custStatus, cardStatus[i])) position = i; } discount = pDiscount[position]; return discount; } </code></pre>
c#
[0]
752,357
752,358
PHPmailer sending HTML CODE
<p>I am using PHPmailer to send email.</p> <p>I have also used HTML = True content type</p> <pre><code> $mail = new PHPMailer(); $mail-&gt;IsSMTP(); // send via SMTP $mail-&gt;Host = $Host; $mail-&gt;SMTPAuth = true; // turn on SMTP authentication $mail-&gt;Username = $Username; $mail-&gt;Password = $Password; $mail-&gt;From = $From; $mail-&gt;FromName = $FromName; $mail-&gt;AddAddress($To , $ToName); $mail-&gt;WordWrap = 50; // set word wrap $mail-&gt;Priority = 1; $mail-&gt;IsHTML(true); $mail-&gt;Subject = $Subject; $mail-&gt;Body = $Body; </code></pre> <p>Once the email is sent i see the actual HTML code instead of the contents please check below</p> <p><img src="http://i.stack.imgur.com/s7IPc.jpg" alt="enter image description here"> </p> <p>*<em>Not sure what is the issue *</em></p>
php
[2]
5,976,467
5,976,468
cookieless with [System.Web.Services.WebMethodAttribute(),System.Web.Script.Services.ScriptMethodAttribute()]
<p>I have a function which is is a Web Services as the following:</p> <pre><code> [System.Web.Services.WebMethodAttribute(),System.Web.Script.Services.ScriptMethodAttribute()] public static string GetDynamicContent(string contextKey) { //Return a string value base on from the Database } </code></pre> <p>In my GridView I have the following PopupControlExtender:</p> <pre><code> &lt;asp:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="Panel1" TargetControlID="Image1" DynamicContextKey='&lt;%# Eval("ID") %&gt;' DynamicControlID="Panel1" DynamicServiceMethod="GetDynamicContent" Position="Bottom"&gt; &lt;/asp:PopupControlExtender&gt; </code></pre> <p>Before working perfectly, get the pop up strings</p> <p>However, it stop works, when I changed the Web Config which is adding the following code:</p> <pre><code>&lt;sessionState mode="InProc" cookieless="true" timeout="20"/&gt; </code></pre> <p>which means I will not use cookies(session) instead of using queryString. It made some thing else work good, but the above function is not working and return the Web Service 401 Error. </p> <p>any body know what's going and how to make it work with the cookies is set to be true?</p> <p>Thanks,T</p>
asp.net
[9]
3,855,455
3,855,456
Why this function return Nan error?
<p>When I click "+ 1", then in the "0" appears "NaN". Why ?</p> <p>HTML:</p> <pre><code>&lt;table&gt; &lt;tr&gt;&lt;td id="run"&gt;0&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;a href="#" onclick="plus();"&gt;+ 1 &lt;/a&gt; </code></pre> <p>JS:</p> <pre><code>function plus(){ document.getElementById("run").innerHTML = ( document.getElementById("run").value + 1 ); } </code></pre>
javascript
[3]
5,214,075
5,214,076
Issue splitting comma delimited String, creates a new line?
<p>I'm trying to pass both the value and key from an option box as a comma delimited String to a Java class, which will then parse the String into two different Strings. Below, I demonstrate a Java iterator combining the value and key into one string:</p> <pre><code>while(i.hasNext()) { Entry&lt;String,String&gt; currentData = i.next(); String value=currentData.getValue() + "," + currentData.getKey(); String key=currentData.getKey(); out.println("&lt;option value=\""); out.println(value); out.println("\"&gt;"); out.println(key); out.println("&lt;/option&gt;"); System.out.println(value + " is the value!"); } </code></pre> <p>This works well, as it outputs the key-value pairs in the following format:</p> <pre><code>valuehere,KeyHere </code></pre> <p>Then, I parse the String on the server side using a Java class:</p> <pre><code>String[] tempContainer = request.getParameter("container").split(","); String containerValue = tempContainer[0]; String containerKey = tempContainer[1]; </code></pre> <p>When I print containerKey, it prints as expected:</p> <pre><code>containerKeyHere </code></pre> <p>However, when I print containerValue, it prints a new line before actually printing the value. So, when I try to pass this variable into a function, the function fails because of the new line. Am I using the split() function incorrectly? Or is there a better way to handle this parsing?</p> <p>Thanks!</p>
java
[1]
486,939
486,940
Automate 3 different click events on a timer using javascript/jQuery
<p>I need to automate the click events defined below on a timer. Say every 5-6 seconds or so. So the page starts out on 'longevity' and a user click is simulated using javascript on a loop. The loop should stop running once a user has manually clicked on a tab as well. Any ideas ?</p> <pre><code> &lt;script type="text/javascript"&gt; $("document").ready(function(){ $("#integrity").click(function(){ $('#home_image').removeClass('bg2 , bg3').addClass('bg1'); }); }); $("document").ready(function(){ $("#quality").click(function(){ $('#home_image').removeClass('bg1 , bg3').addClass('bg2'); }); }); $("document").ready(function(){ $("#longevity").click(function(){ $('#home_image').removeClass('bg1 , bg2').addClass('bg3'); }); }); &lt;/script&gt; </code></pre>
jquery
[5]
2,836,582
2,836,583
Respond to change in variable
<p>I have made a service that displays a toast showing the current time . The toast should be displayed when the value of "minute" changes. What should i do ? Here is the code. Is it necessary to create a listener to listen to change of the minute variable? Please help me.</p> <pre><code>public class Servicedemo extends Service{ @Override public void onCreate() { super.onCreate(); Toast.makeText(this, "Service Started", Toast.LENGTH_SHORT).show(); String str; Calendar c=Calendar.getInstance(); int hour=c.get(Calendar.HOUR); int min=c.get(Calendar.MINUTE); str=String.valueOf(hour)+":"+String.valueOf(min); Toast.makeText(this, str , Toast.LENGTH_SHORT).show(); } @Override public void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); Toast.makeText(this, "Service Stopped", Toast.LENGTH_SHORT).show(); } @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } } </code></pre>
android
[4]
5,316,406
5,316,407
Grid View To Excel
<p>Hi I am trying to convert the contents of a grid View to an excel file and I am doing it using this code</p> <pre><code> string attachment = "attachment; filename= " + FileName; Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/excel"; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); gv.RenderControl(htw); Response.Write(sw.ToString()); Response.End(); </code></pre> <p>The problem is I am getting some sort of html in an excel style format , theres java script in the page links etc what I want is to turn the results of my query into a comma seperated file Is that do-able for free or do I have to run the query myself get the data and write out a csv stream Thanks </p>
asp.net
[9]
3,272,567
3,272,568
running apschduler in python script as daemon?
<p>I have a <code>job.py</code> which has following code </p> <pre><code>import datetime import logging import sys import os from apscheduler.scheduler import Scheduler from src.extractors.pExtractor import somejob def run_job(): start = datetime.datetime.now() logging.debug('Proposal extraction job starting') somejob.main() end = datetime.datetime.now() duration = end - start logging.debug('job completed , took ' + str(duration.seconds) + ' seconds') def main(): logging.basicConfig(filename='/tmp/pExtractor.log', level=logging.DEBUG,format='%(levelname)s[%(asctime)s]: %(message)s') sched = Scheduler() sched.start() sched.add_interval_job(run_job, minutes=2) if __name__ == '__main__': main() </code></pre> <ul> <li>When I run this on command prompt it exits immediately </li> </ul> <blockquote> <p>INFO[2012-04-03 13:31:02,825]: Started thread pool with 0 core threads and 20 maximum threads INFO[2012-04-03 13:31:02,827]: Scheduler started INFO[2012-04-03 13:31:02,827]: Added job "run_job (trigger: cron[minute='2'], next run at: 2012-04-03 14:02:00)" to job store "default" INFO[2012-04-03 13:31:02,828]: Shutting down thread pool</p> </blockquote> <ul> <li>How can I makde this run as daemon? </li> </ul> <p>Thank you</p>
python
[7]
4,714,836
4,714,837
Calling other classes using command line arguments?
<p>I am writing a program where I use 2 command line arguments - the first one to choose 1 of the 3 support classes, and the second would be the int input value.</p> <p>This has me very confused on many levels, but the main thing I'd like to learn is how to refer to/call the support method from the App class.</p> <p>So far, my plan is to: Use an if-else (that is, if args[0] = 1 then this&that; if args[0] = 2 then this&amp;that, etc)</p> <p>Am I on the right track? At the moment, I don't even know what "this&amp;that" will be. I'm guessing it will be the statement where I call the other classes - how will I do that?</p> <p>I am teaching myself, and it's really not easy :)</p> <p>Thank you for your time and knowledge!</p>
java
[1]
1,854,784
1,854,785
How to make an element live() by an element's event that doesn't yet exist in jQuery
<pre><code>// for example $('#text').die('focusout'); //then I try to make it live() with a button that just exist $('#button').live('click', function(){ $('#text').live('focusout'); }); </code></pre> <p>When I click on the #button, firebug tells me that something's worng in the jQuery.js. How to accomplish something like that?</p>
jquery
[5]
1,323,383
1,323,384
Is website MUST to publish android app?
<p>Almost all android apps have links to 'developer's website'. Typically websites are used in assigning name spaces.</p> <p>How can I assign unique package namespace if I don't have any website? Or to put it other words, is website a parameter in assigning the namespace</p> <p>If yes, can you please guide me how to get own site?</p> <p>Dharma</p>
android
[4]
1,644,836
1,644,837
How do I use group by in LINQ?
<p>How do I use group by in LINQ? I want to group by tow filed of table in C# by linq.</p>
c#
[0]
5,170,194
5,170,195
how to show only month and year in datapicker using datapicker dialog box
<p>please tell me how to show only month and year in datapicker using datapicker dialog box</p> <pre><code>private DatePickerDialog.OnDateSetListener mDateSetListener2 = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { try { Log.e("","myear"+mYear_1+","+"myear"+mMonth_1+","+mDay_1); Field f[] = mDateSetListener2.getClass().getDeclaredFields(); for (Field field : f) { if (field.getName().equals("mDatePicker")) { field.setAccessible(true); Object dayPicker = new Object(); dayPicker = field.get(mDateSetListener2); ((View) dayPicker).setVisibility(View.GONE); } } } catch (SecurityException e) { Log.e("ERROR", e.getMessage()); } catch (IllegalArgumentException e) { Log.e("ERROR", e.getMessage()); } catch (IllegalAccessException e) { Log.e("ERROR", e.getMessage()); } } }; </code></pre>
android
[4]
577,612
577,613
To pass an event while uninstalling an app
<p>i am developing an app, in which some data is written in a file during a process in the app. Now what i need to do is to delete that data from that same file during uninstallation and want that same file to be there in the mobile. Can anybody tell me,, is it possible ? </p>
android
[4]
284,468
284,469
undo a .css(property, value) call?
<p>How can I undo a <code>.css('display', 'block')</code> call so that it falls back to class-based behavior? I think I'm looking for something like <code>.css('display', null)</code>.</p>
jquery
[5]
3,786,203
3,786,204
How to Create a class dynamically with its variables and methods in Java?
<p>How to Create a class dynamically with its variables and methods in Java without using Reflections.</p> <p>I want that the class should be created at runtime with variables like age, name and method like display(String age,String name). </p>
java
[1]
5,082,827
5,082,828
Change the value in app.config file dynamicallay
<p>I want to modify a value in appSetting section in app.config. So i wrote,</p> <pre><code>Console.WriteLine(ConfigurationManager.AppSettings["name"]); Console.Read(); Configuration config=ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings["name"].Value = "raja"; config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); Console.WriteLine(ConfigurationManager.AppSettings["name"]); Console.Read(); </code></pre> <p>after the execution of above code, i verified the app.config whether the value of "name" element has been changed or not. but no change.</p> <p>what is the wrong with my code? or is there any other way to do this?</p>
c#
[0]
2,104,036
2,104,037
Android code to connect ftp server
<p><strong>I am new to android, i want to verify connection from FTPs server, On emulator please help step by step on this</strong></p>
android
[4]
3,559,476
3,559,477
How to use dynamic keywork to work with entity framework
<p>I am using .net framework 3.5 framework &amp; for database operations entity framework. So, to fetch the data i am using LINQ queries &amp; returns a resultset in a list. e.g</p> <pre><code>public class Emp { public int CD{get;set;} public string Name{get;set;} } public List&lt;Emp&gt; GetServTypeForPromotionDue() { return (from a in Context.TableName select new Emp{ a.CD, a.NAME }); } </code></pre> <p>I am planning to migrate from 3.5 to 4.0. I have heard about dynamic keyword in .net 4.0. Can i make use of 'dynamic' keyword in order to remove the Class Emp &amp; without creating Anonymous methods? </p>
asp.net
[9]
4,606,035
4,606,036
PHP preg_match dies/crashes in PHP Version 5.3.6 with following input
<p>I'm having an issue with <code>preg_match</code>, it dies on a certain input. I'm using PHP 5.3.6 .</p> <pre><code>$regEx = '/^([a-z]|.|\s)*$/i'; $subject = 'Korting van op de aankoopprijs van fietsen en bromfietsen korting van op de aankoopprijs van alle accessoires. Sed posuere consectetur est at lobortis. Nullam quis risus eget urna mollis ornare vel eu leo. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Morbi leo risus, porta ac '; preg_match($regEx, $subject); // function runs normal $subject .= ' consectetur'; preg_match($regEx, $subject); // function crashes/dies no error report. </code></pre> <p>Could someone tell my why <code>preg_match</code> dies?</p>
php
[2]
1,040,067
1,040,068
How to compile c++ program with pngwriter
<p>I'm trying to make a png file using <a href="http://pngwriter.sourceforge.net/" rel="nofollow">"pngwriter"</a>. I'm using Ubuntu as my OS. I've put these following files in /home/ediamin/png/ folder 1.png.h, 2.pngconf.h, 3.pngwriter.h, 4.test.cpp, 5.zconf.h, 6.zlib.h</p> <p>my test.cpp contains this codes</p> <pre><code>#include&lt;iostream&gt; #include "pngwriter.h" using namespace std; int main() { int i; int y; pngwriter png(300,300,0,"test.png"); for(i = 1; i &lt; 300;i++) { y = 150+100*sin((double)i*9/300.0); png.plot(i,y, 0.0, 0.0, 1.0); } png.close(); return 0; } </code></pre> <p>Now I'm trying to compile with this command,</p> <pre><code>g++ -o test test.cpp -DNO_FREETYPE </code></pre> <p>and it gives me following errors,</p> <pre><code>/tmp/ccLr9Szo.o: In function `main': test.cpp:(.text+0x30): undefined reference to `pngwriter::pngwriter(int, int, double, char const*)' test.cpp:(.text+0x72): undefined reference to `pngwriter::filledcircle(int, int, int, double, double, double)' test.cpp:(.text+0x7e): undefined reference to `pngwriter::close()' test.cpp:(.text+0x8f): undefined reference to `pngwriter::~pngwriter()' test.cpp:(.text+0xa4): undefined reference to `pngwriter::~pngwriter()' collect2: ld returned 1 exit status </code></pre> <p>What should I do? Please note that, I don't want to install any library file, that's why I put the header files in the same folder.</p>
c++
[6]
5,211,609
5,211,610
Split by comma and strip whitespace in Python
<p>I have a simple piece of code:</p> <pre><code>&gt;&gt;&gt; string = "blah, lots , of , spaces, here " &gt;&gt;&gt; mylist = string.split(',') &gt;&gt;&gt; print mylist ['blah', ' lots ', ' of ', ' spaces', ' here '] </code></pre> <p>I would rather end up with this:</p> <pre><code>['blah', 'lots', 'of', 'spaces', 'here'] </code></pre> <p>I am aware that I could loop through the list and strip() each item but, as this is Python, I'm guessing there's a quicker, easier and more elegant way of doing it.</p>
python
[7]
944,959
944,960
My app is not running but there are no errors
<p>My app was running perfect until i added a new graphic background in a button.From this time i m getting a message when i m trying to rum my app <code>"You project contains error(S), please fix them before running your application"</code>. I have tried to clean my app, refresh it but nothing changes.Also,in the package explorer there is no red sign nowhere in that project....I import the same project in my Macbook and its running with no problem.So,where is the problem in that pc eclipse?Thanks</p>
android
[4]
4,619,333
4,619,334
How to get the querystring of a page with JavaScript?
<p>I wanna to get the query string of a page within a JavaScript block. for example:</p> <p>The page has a URL like <code>localhost:1234/Test/page1.aspx?ID=10</code></p> <p>How can I get '10' with JavaScript?</p>
javascript
[3]
1,462,654
1,462,655
managing solutions/references
<p>I would like to create utils class library (eg, logging, etc).<br> I want to use the utils solution in several indepandent applications.</p> <p>I'm using source control of course...</p> <ul> <li><p>does that mean I should manage utils solution (holding the utils class library) and also seperate solution for each application ?</p></li> <li><p>what do I have to do to use the utils class library from ApplicationA solution</p></li> <li><p>can ApplicationA solution also include the utils solution (eg, go to definition works ?)</p></li> <li><p>if that is possible, does that mean that any change proggrammerA apply to utils library via ApplicatioA solution, also affects ApplicationB solution using the same utils class libray </p></li> <li><p>what do we to do when we fix a bug in utils solution ? how does the fix bubbles to ApplicationA and B .</p></li> </ul>
c#
[0]
3,868,752
3,868,753
Why an input button created dynamically through a literal tag doesn't work?
<p>I have created button 2 below:</p> <pre><code>&lt;input id="Button1" type="button" value="Stop" onclick="alert('hello world');"/&gt; &lt;input id="Button2" type="button" value="button" OnClik="alert('hello world');"/&gt; </code></pre> <p>using a litteral tag on page load like this:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { Literal1.Text = "&lt;input id=\"Button2\" type=\"button\" value=\"button\" OnClik=\"alert('hello world');\"/&gt;"; } </code></pre> <p>Incredibly when testing in browser, click on button 1 works, not click on button 2 whereas the codes are the same !</p> <p>Am I missing something ?</p>
asp.net
[9]
462,268
462,269
On div hover with some class, find the last class and add class to a link element with the same last class. How in jQuery?
<p>How to add a class to an element(link) when hovering a div with the last class? Here is what I mean:</p> <p>I have this code:</p> <pre><code>&lt;a href="http://google.com" class="menu nice menu-2"&gt;Google&lt;/a&gt; &lt;a href="http://yahoo.com" class="menu nice menu-10"&gt;Yahoo&lt;/a&gt; &lt;a href="http://facebook.com" class="menu nice menu-20"&gt;Facebook&lt;/a&gt; </code></pre> <p>. . .</p> <pre><code>&lt;div class="pretty fixed menu-20"&gt;Some text here&lt;/div&gt; </code></pre> <p>IMPORTANT! I do not know the name of div class. I only know that it will be always the last one! So when I have classes like pretty, fixed and menu-20, I need menu-20.</p> <p>Now, I have to find the last class of the div and somehow find the same class in link element and add class to that link element e.g. "awesome" so it look like:</p> <pre><code>&lt;a href="http://google.com" class="menu nice menu-2"&gt;Google&lt;/a&gt; &lt;a href="http://yahoo.com" class="menu nice menu-10"&gt;Yahoo&lt;/a&gt; &lt;a href="http://facebook.com" class="menu nice menu-20 awesome"&gt;Facebook&lt;/a&gt; </code></pre> <p>.</p> <p>How to do this?</p> <p>Thanks in advance.</p>
jquery
[5]
3,974,027
3,974,028
how to update multiple users location and update markers also on google map after 15 seconds
<p>hi friends i want to get location of other users from the web service i did it and now i want to locate this new latitue and longitue to google map and update its location</p>
android
[4]
2,956,448
2,956,449
Copyright issues with combining JavaScript files?
<p>Say my web application uses jQuery, and I combine jQuery's source file with my own JavaScript files into a single file.</p> <p>Now, I still have to put jQuery's copyright header at the top of the combined file, right? But do I also have to add a notice that I "modified" this file as I have added my own code?</p> <p>What if I'm using multiple JavaScript libraries and have combined all of them, as well as my own code, into a single file? Do I dump all their copyright headers at the top and add a modification notice? Would it be legal?</p> <p>And a related question, do I have to also include a copy of all the related licenses in my website? If so, how are major websites handling this? For example, StackOverflow uses jQuery, where is its page containing the MIT or GPLv2 license?</p>
javascript
[3]
217,680
217,681
Is there any way to force reload a page with a JavaScript query?
<p>The title might be a bit misleading, but I don't know how else to explain it.</p> <p>Basically I'm at this URL:</p> <pre><code>www.mysite.com/shop/6-dresses#filter=[manufacturer:4] </code></pre> <p>And I want to make a link that would change it to </p> <pre><code>www.mysite.com/shop/6-dresses#filter=[manufacturer:5] </code></pre> <p>(e.g. like <code>&lt;a href="www.mysite.com/shop/6-dresses#filter=[manufacturer:5]"&gt;&lt;/a&gt;</code>)</p> <p>But it doesn't seem to load <strong>unless</strong> I click on it and <strong>refresh</strong> the page after.</p> <p>Is there anyway I can alter the link code so that it forces to reload the page fully?</p>
javascript
[3]
5,623,511
5,623,512
Python O(1) member data access possible?
<p>In C++, for access to 'named' member data, we constantly do:</p> <pre><code>const unsigned int CHEESE_CAKE = 0; const unsigned int CHOCOLATE_CAKE = 1; ... const unsigned int CHERRY_PIE = 1050; </code></pre> <p>Then, when we want to access some specific resource matched to the string, we can simply do:</p> <pre><code>mResource[MyClass::CHEESE_CAKE]; // constant time O(1) access </code></pre> <p>I was attempting to do this in python in a similar fashion:</p> <pre><code>class MyClass: MY_CLASS_DATA1 = someData(1) MY_CLASS_DATA2 = someData(1) </code></pre> <p>But from my understanding, python's member functions are stored in <code>__dict__</code>, which is essentially a hash map giving O(logn) lookup time.</p> <p>Is there a way achieve O(1) performance in python as in C++, or is this impossible due to python's dynamic nature?</p>
python
[7]
2,284,444
2,284,445
How do I keep the infinite timer that triggers JS function on html page?
<p>I need to call a function that updates some JS objects on the page every 2 minutes. How would I do that?</p> <p>I created a onload function and a countdown function that refreshes a whole page and therefore resets the timer until next page refresh, but this is not the way I want it. Is there a way to keep an infinite time loop?</p> <p>I assume, if I could create a an infinite loop and do something like this:</p> <pre><code>if (currentSeconds%120==0){ callFunction(); } </code></pre>
javascript
[3]
1,946,024
1,946,025
Howto replace different values with tags in string?
<p>I have string:</p> <pre><code>Lorem ipsum dolor [mytag]something[/mytag]sit amet, ipsum [mytag]something else[/mytag]a laoreet ultricies </code></pre> <p>and I want to get values "something" and "something else" and replace it.</p> <p>How to do it?</p>
python
[7]
3,168,785
3,168,786
variables declared outside function
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/855493/referenced-before-assignment-error-in-python">referenced before assignment error in python</a><br> <a href="http://stackoverflow.com/questions/8934772/local-var-referenced-before-assignment">local var referenced before assignment</a> </p> </blockquote> <p>Ok, i was just trying some to see how variables scopes work and ran in the following situation. All ran form terminal:</p> <pre><code> x = 1 def inc(): x += 5 inc() Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; File "&lt;stdin&gt;", line 2, in inc UnboundLocalError: local variable 'x' referenced before assignment </code></pre> <p>So I was thinking well maybe I don't have access to x in my method, so I tried:</p> <pre><code> def inc(): print x 1 </code></pre> <p>So this works. Now I know I could just do: </p> <pre><code> def inc(): global x x += 1 </code></pre> <p>And this would work. But my question is why does the first example fail. I mean I would expect since <code>print x</code> worked that x is visible inside the function so why would the x += 5 fail ?</p>
python
[7]
3,320,186
3,320,187
Get data from Gallerific onSlideChange
<p>Hello trying to get the current image data from gallerific</p> <pre><code>onSlideChange:function(prevIndex, nextIndex) { this.find('ul.thumbs').children() .eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end() .eq(nextIndex).fadeTo('fast', 1.0); var image_id = this.find('img').eq(nextIndex)[0].id; jQuery.ajax({ type: "POST", data: { image: image_id }, url: 'my_shares.php', success: function(msg){ jQuery("#my_shares").html(msg) } }); }, </code></pre> <p>I got this line </p> <pre><code> var image_id = jQuery('ul.thumbs').children().find('img').eq(nextIndex)[0].id; </code></pre> <p>from <a href="http://stackoverflow.com/questions/9592161/gelleriffic-how-to-get-the-imagedata-onslidechange-event">this post</a> but it's not capturing any of my data.</p> <p>Any help would be greatly appreciated.</p> <p>EDIT** Getting closer. I'm able to retrieve the hash by using </p> <pre><code>var image_id = this.data[nextIndex].hash; </code></pre> <p>but still no luck getting the image title and src.</p>
jquery
[5]
1,225,275
1,225,276
Make Android app undeletable
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6415304/uninstallable-app-for-android">uninstallable app for Android</a> </p> </blockquote> <p>I need to install an Android app on a number of phones - the phones are only for using this app, so the user should not be able to uninstall it.</p> <p>Have you got an idea how to block uninstalling the app?</p> <p>I thought that creating an own system image would work, so that even when the user resets the phone the app would still be there (although that's not required; not having the "uninstall" option is enough) - but I also hoped there would be an easier way?</p> <p>Thanks!</p>
android
[4]
882,307
882,308
missing ; after for-loop initializer
<pre><code>var nodeWordsString = document.getElementById("nodeWordsTextArea").value.trim(); var nodeWordsStringArray=nodeWordsString.split(" "); var strLength = nodeWordsStringArray.length; for(int i = 0; i &lt; nodeWordsStringArray.length; i++)-----&gt;****** { for(int j = 0; j &lt; nodeWordsStringArray.length; j++) { if(nodeWordsStringArray(i) == nodeWordsStringArray(j)) { alert("Node duplication occurred at:"+nodeWordsStringArray(i)); return false; //break; } } } </code></pre> <p><strong>*</strong>*showing error like <code>missing ; after for-loop initializer</code> in java script console(firebug). please help me. </p>
javascript
[3]
3,780,274
3,780,275
Jquery everything correct but not executing
<p>What's wrong with the following jquery code? Why is it not working? I am trying to count the number of columns in a table and set the width of this div with id "eDiv" but its not working</p> <pre><code>$(document).ready(function () { reset(); function reset() { w = $("#eDiv tr:first td").length * 200; $('.container1').width(2000); alert('i'); } }); </code></pre>
jquery
[5]
5,948,207
5,948,208
How to show Spanish Text in TextView?
<p>I have the following code and i try to show text in text-view which in Spanish. When I run app then it showing ? at some places. Can anyone tell me detailed procedure for showing Spanish. </p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.information); textview=(TextView) findViewById(R.id.information); textview.setText(readTxt()); } private String readTxt(){ InputStream inputStream = getResources().openRawResource(R.raw.info); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); int i; try { i = inputStream.read(); while (i != -1) { byteArrayOutputStream.write(i); i = inputStream.read(); } inputStream.close(); } catch (IOException e) { e.printStackTrace(); } return byteArrayOutputStream.toString(); } </code></pre>
android
[4]
1,811,104
1,811,105
Evaluating postfix expressions in java
<p>I have a problem i can't find the wrong in this function it sometimes do well with some inputs but sometimes no for examle this Input "6 2 / 3 – 4 2 * +" can any one help.</p> <pre><code>public static double Evaluating_postfix_expressions(String postfix) throws Exception{ StringTokenizer st = new StringTokenizer(postfix); int numOF_tokens = st.countTokens(); for (int i = 1; i &lt;= numOF_tokens; i++) { Object term = st.nextToken(); try { // if it is an operand there is no problem float x = Float.parseFloat((String)term); stack.push(x); } catch (Exception e) { // it is an operator float v1 = (float) stack.pop(); float v2 = (float) stack.pop(); switch ((String) term) { case "+": stack.push(v2 + v1); break; case "-": stack.push(v2 - v1); break; case "*": stack.push(v2 * v1); break; case "/": stack.push(v2 / v1); break; } } } return (float) stack.pop(); } </code></pre>
java
[1]
3,916,842
3,916,843
Round up from .5 in a %
<p>Ceiling rounds up no matter if you get .1, .3, .5, .7. or whatever the value is for the decimal.</p> <p>I need to know how to only round up if you have .5. So for example [number].5 round up.</p> <p>Anyone know how to do this?</p>
c#
[0]
4,148,639
4,148,640
ImageButtons don't appear when filename starts with an a or b
<p>I'm running into a completely bizarre problem and am wondering if anyone has experienced something similar.</p> <p>I couldn't figure out why an ImageButton was not appearing on a screen, when several similar ones worked just fine. I discovered that other images worked just fine when used for the same ImageButton XML... and that the image appeared if I changed the filename.</p> <p>After a few dozen tests, I discovered that I could give the file a short name, a long name, any sort of name... but if the filename started with an "a" or a "b" that the image did not appear. If it started with a "c" or "d" or "e" or a few other letters, it would appear (I did not test every possibility). However, other similarly named images had no trouble. Just this one image.</p> <p>Then recently it happened again with another image and ImageButton I had added to the app. Once again, changing the first letter to something else made it work... but other very similar buttons and images had no trouble. </p> <p>Does anyone know why this is happening and how I can fix it to eliminate this bizarre behavior?</p> <p>Max OS X 10.7.1 Eclipse 3.7.0 Targeting Android 2.2</p> <p>Yes, I have cleaned the project, uninstalled the app from the phone, restarted Eclipse, restarted the computer and so on. Yes, I am absolutely certain that the name of the file matches what I set in the XML file.</p>
android
[4]
3,225,124
3,225,125
Web View HTML in Android
<p>I'm using <code>Web View</code> in my app. I want to pass a value to HTML. For example, I'm making an online payment system; I want to pass a variable that holds the amount to the HTML that will display in my web view.</p> <p>Any thoughts?</p>
android
[4]
230,020
230,021
Login Control - Response.Redirect
<p>I have a usercontrol on a page that has a login control in it. This controls the display of another user control (if the user is not logged in they get the login control user control). I have some authentication code (see below) that runs when the user clicks the "Login" button. Basically I want it to post back to the same page so they will be logged in and able to now see the other protected user control. This code is not working. Perhaps there is something going on in another page that is making this not work, but does this code itself seem like it should work?</p> <p>string userName = Membership.GetUserNameByEmail(Login1.UserName);</p> <pre><code> if (userName != null) { e.Authenticated = Membership.ValidateUser(userName, Login1.Password); } else { e.Authenticated = false; } if (e.Authenticated) { Login1.UserName = userName; ImageButton loginButton = (ImageButton)Login1.FindControl("LoginButton"); if (loginButton != null) { //loginButton.PostBackUrl = Request.Url.ToString(); Response.Redirect(Request.Url.ToString()); } } </code></pre>
asp.net
[9]
3,538,350
3,538,351
KeyDown in jquery not updating when pressed
<p>I am trying to get the div to change the font size and update it on the screen. The following code works but there is a problem when you press a key you need to press another key to register the last key was pressed i dont know want that to happen. How would i make it update as soon as you press a key? </p> <pre><code> $('#font_size_title').keydown(function() { var font_size_title = $(this).val(); $('#preview_title').css("font-size",font_size_title); }); </code></pre>
jquery
[5]
1,413,260
1,413,261
Javascript error in IE 7
<p>Hoping you can help me... I'm getting the following javascript error in IE7:</p> <blockquote> <p>Expected Identifier, String, or Number</p> </blockquote> <p>This is my code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function(){ $('#container').masonry({ // options itemSelector : '.full', }); }); &lt;/script&gt; </code></pre>
javascript
[3]
3,279,400
3,279,401
python: iterator from a function
<p>What is an <a href="http://stackoverflow.com/questions/302459/what-is-a-programming-idiom">idiomatic</a> way to create an infinite iterator from a function? For example</p> <pre><code>from itertools import islice import random rand_characters = to_iterator( random.randint(0,256) ) print ' '.join( islice( rand_characters, 100)) </code></pre> <p>would produce 100 random numbers</p>
python
[7]
1,263,536
1,263,537
Can a DOM object be an index/key in Javascript array?
<p>Would like to maintain a map/hash of DOM objects. Can they serve as key objects? If not, what are the alternatives, please? If there are better ways - kindly enlist them as well.</p>
javascript
[3]
3,019,918
3,019,919
Creating an N by N grid of letters so that no two adjacent letters are the same
<p>I need to print out a N by N grid containing the letters A to F, so that no two adjacent letters are the same. The code below prints out an N by N grid, however I can only get the letters on the left and right to be different. I can't find a way to get the letters above and below to be different as well. I need to solve this problem without the use of arrays. The letters have to be randomized.</p> <pre><code>public static void main(String[] args) { int N = StdIn.readInt(); for (int column = 0; column &lt; N; column++) { int x = 0; for (int row = 0; row &lt; N; row++) { int c = (int) (Math.random() * 6 + 1); while (x == c) { c = (int) (Math.random() * 6 + 1); } if (c == 1) { System.out.print("A "); } if (c == 2) { System.out.print("B "); } if (c == 3) { System.out.print("C "); } if (c == 4) { System.out.print("D "); } if (c == 5) { System.out.print("E "); } if (c == 6) { System.out.print("F "); } x = c; } System.out.println(); } </code></pre>
java
[1]
2,656,067
2,656,068
touchesBegan doesnt get detected
<p>I have a viewcontroller like the following. But the touchsBegan doestnt get detected. Can anyone plz tell me what is wrong.</p> <pre><code>- (id)init { if (self = [super init]) self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease]; return self; } -(void) viewWillAppear:(BOOL)animated { overlay = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"overlay.png"]] autorelease]; [self.view addSubview:overlay]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // Detect touch anywhere UITouch *touch = [touches anyObject]; // Where is the point touched CGPoint point = [touch locationInView:self.view]; NSLog(@"pointx: %f pointy:%f", point.x, point.y); // Was a tab touched, if so, which one... if (CGRectContainsPoint(CGRectMake(1, 440, 106, 40), point)) NSLog(@"tab 1 touched"); else if (CGRectContainsPoint(CGRectMake(107, 440, 106, 40), point)) NSLog(@"tab 2 touched"); else if (CGRectContainsPoint(CGRectMake(214, 440, 106, 40), point)) NSLog(@"tab 3 touched"); } </code></pre>
iphone
[8]
2,135,970
2,135,971
Javascript create variable from its name
<p>In PHP we can do this:</p> <pre><code>$variable = "name_of_variable"; $this-&gt;{$variable} = "somevalue"; </code></pre> <p>how to do this in javascript?</p> <p>where use case should look like:</p> <pre><code>function Apple(){ var name = "variable_name"; this.(name) = "value"; } console.log(new Apple()); </code></pre> <p>to output</p> <pre><code>[Apple: {variable_name:"value"}] </code></pre>
javascript
[3]
2,236,100
2,236,101
iphone:significant location update not finding
<p>I am using a significant location, but showing update after a long distance.any clue please share.</p> <p>In <code>didfinishlaunching</code> I am starting significant changes and then storing from <code>didupdatelocation</code> delegate method of <code>locationmanager</code>;</p> <pre><code>id locationValue = [launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey]; if(locationValue) {NSLog(@"location value is%@",locationValue); // create a new manager and start checking for sig changes m_locManager = [[CLLocationManager alloc] init] m_locManager.delegate = self; [m_locManager startMonitoringSignificantLocationChanges]; //[m_locManager startUpdatingLocation]; [self.window addSubview:tabBarController.view]; [self.window makeKeyAndVisible]; [self showSplash]; return YES; </code></pre>
iphone
[8]
3,007,493
3,007,494
The Microsoft.Jet.OLEDB.4.0 provider is not registered on the local machine
<p>I had developed a web application using Visual Studio 2010 which one of the function is to import Excel file(.xls).However when I deployed the web application over the Server(Windows Server 2003) the following error will occurred:</p> <blockquote> <p>"The Microsoft.Jet.OLEDB.4.0 provider is not registered on the local machine".</p> </blockquote> <p>This problem doesn't exist when I deployed it in Windows 7.</p> <p>Please advice me regarding how to solve this problem.Thanks.</p>
asp.net
[9]
1,957,278
1,957,279
How to install my application on mobile
<p>I want to directly install my application after dowloading it from android market place is it possible ?</p> <p>and i also want to know about How android market install Update version of product </p>
android
[4]
508,311
508,312
link button implementation
<p>I have a page, main.aspx page. I need to add a link to the main.aspx page. So that when employees clicks on the link, I have to show the employee profile (profile.aspx) page as a pop up. In order to do this can I use link button. I am working on .NET version 1.1. when I use link button I could not find the postbackurl.</p>
asp.net
[9]
4,493,000
4,493,001
Android Camera PictureCallback data seems corrupted on HTC Desire S
<p>I'm using PictureCallback to capture an image. And its working fine. But In HTC Desire S its not returning proper data. It returns a corrupted image like the following one</p> <p><img src="http://i.stack.imgur.com/XPGhh.jpg" alt="enter image description here"></p> <p>Here is the code that i used</p> <pre><code> PictureCallback cameraPictureCallbackJpeg = new PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { FileOutputStream outStream = null; try { // write to local sandbox file system // outStream = // CameraDemo.this.openFileOutput(String.format("%d.jpg", // System.currentTimeMillis()), 0); // Or write to sdcard outStream = new FileOutputStream(String.format( "/sdcard/%d.jpg", System.currentTimeMillis())); outStream.write(data); outStream.close(); Log.e("error", "onPictureTaken - wrote bytes: " + data.length); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { } } </code></pre> <p>I must tell you that I've used other methods to convert the data into a bitmap. Thanks in advance. I'm stuck here. Any help will be appreciated. </p>
android
[4]
852,966
852,967
stack trace and variable values
<p>Is it possible to get variable values included in a stack trace? I have just started using bugsense which emails the stacktrace to me and I wonder if there is some way in my code to put the variable values into the stacktrace output</p>
android
[4]
5,014,979
5,014,980
Drop down list appears after the page loads, how to access this new DOM element?
<p>I need to attach a 'change' event to a dropdownlist.</p> <p>This dropdown list is dynamically added to the page AFTER it has loaded.</p> <p>So this curretnl doesn't work:</p> <p>$("#mydropdown") </p> <p>Since it wasn't in the DOM when the page finished loading.</p>
jquery
[5]
5,614,396
5,614,397
Jquery highlight words in editable div
<p>I have an editable div and would like to highlight (apply a css class) to certain words WHILE the user is still typing in the div.</p> <p>How would I do this using Jquery? </p> <p>I tried using the <code>div.html().replace()</code> etc but it replaces it and then moves the cursor all the way back to the beginning.</p>
jquery
[5]
2,630,497
2,630,498
at any time map view contains only one location marker.Can anyone help me to do so?
<p>I am doing a project in which, when the user clicks at a particular location, a location marker should come there.If the user clicks at another location the location marker should go and marker should appear at new location, ie..at any time map view contains only one location marker.Can anyone help me to do so programatically???</p> <p>Thanks in advance</p>
android
[4]
3,754,329
3,754,330
How to make a seperate list based on certain numbers from a previous list?
<p>Hey guys trying to finish my program. Here is my code:</p> <pre><code>lists = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] #I want to make a new list consisting of only numbers above 50 from that list if any(list &gt; 50 for list in list): newlists = list </code></pre> <p>I don't know how to do it. I'm doing something wrong, can anyone help me?</p>
python
[7]
1,032,635
1,032,636
How to bind a dynamic DIV to Jquery Masonry plugin?
<p>I have some DIV's in my HTML that I load dynamically using AJAX.</p> <p><code>$("#workPanel").load("ex.html");</code></p> <p>I also have some static links that onclick, call the JQUery masonry to shuffle these dynamic DIV's..</p> <pre><code> $('#filtering-nav li.1 a, li.2 a, li.3 a').click(function(){ $('#primary').masonry(); return false; }); $('#primary').masonry({ columnWidth: 100, itemSelector: '.box:not(.invis)', animate: true, animationOptions: { duration: speed, queue: false } }); </code></pre> <p>The shuffling works fine after the first time the page loads, but when the dynamic DIV's are updated, the shuffling does not work anymore. I am guessing the live() or bind() function needs to be called somewhere, but I don't know how and where the binding needs to be done. Please help me out here.</p> <p>Thanks in advance!</p>
jquery
[5]
5,894,378
5,894,379
jquery - Fancy Product Designer not working on localhost but working on local full path
<p>I am working to embed fancy product designer jQuery plugin into my site but when I open on localhost this plugin is not working but when I directly open this file from the destination where it is located on my pc then it is working...</p> <p>plugin link : - <a href="http://fancyproductdesigner.com/" rel="nofollow">http://fancyproductdesigner.com/</a> Can anyone suggest why it is working with full local path but not on localhost ?</p> <p>Thanks in advance</p>
jquery
[5]
4,563,330
4,563,331
In C# what is the difference between the upper and lower case String/string?
<p>Newbie here, in C# what is the difference between the upper and lower case String/string?</p> <p>Thanks</p>
c#
[0]
1,909,900
1,909,901
A tutorial or serialization example in Android
<p>Can someone help me with tutorial or an example of serializable in Android?</p>
android
[4]
440,542
440,543
unrecognizable email address from javascript validation
<p>I have a script written long ago by a freelancer that's worked fine until now. The script simply checks the email address from a form against some matching rules and returns true/false. Problem is for some reason it isn't recognizing an email address that has a very simple firstInitialLastName@domain.com syntax (no extra periods or characters, etc).</p> <p>I don't understand javascript as well as I understand PHP so if someone could tell me why this script would return false against an email address formatted like I indicated above, I'd greatly appreciate it.</p> <pre><code>function check_email(str) { var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/; if (!str.match(re)) { return false; } else { return true; } } </code></pre>
javascript
[3]
866,701
866,702
Javascript :: Syntax - variable assignment
<p>Let's have the following functionality:</p> <pre><code>function transformMatrix(a, b, c, d, e, f) { this.data = [a, c, e, b, d, f, 0, 0, 1]; } transformMatrix.prototype.inverse = function() { //.. this.data = newdata; return this.data; } </code></pre> <p>and</p> <pre><code>var m1 = new transformMatrix(1, 0, 0, 1, 10, 20); // translate (10, 20) </code></pre> <p>Now, when I call</p> <pre><code>m1.inverse(); </code></pre> <p>variable <code>m1</code> is changed.</p> <p>But when I call</p> <pre><code>var m2 = m1.inverse(); </code></pre> <p>variable <code>m1</code> is changed and such changed is copied to variable <code>m2</code>. Great!</p> <p>Is there a way to assign result of <code>inverse</code> to a new variable without change of the original one? </p> <p>I can do that by:</p> <pre><code>var m2 = m1; m2.inverse(); </code></pre> <p>But I would like to know, if there is some other way, without prior assignment, something like</p> <pre><code>var m2 = {m1}.inverse(); // incorrect syntax </code></pre> <p>that would not change <code>m1</code>.</p> <p>Please note that functionality of <code>inverse</code> function should not be changed.</p> <p>Any help will be appreciated. Thank you...</p>
javascript
[3]
3,399,191
3,399,192
How to handle and use the default application of android programatically
<p>Can anyone explain me, how can I handle and use the default applications of my Android device programatically. Also how can I get all the app information installed on my device and also unistalling them progromatically. If possible kindly give me fews links to understand and using these things properly. </p>
android
[4]
1,896,540
1,896,541
Validating read-only date field on multi-stage jquery form
<p>How would I validate the "Third Step" on my multi-stage jQuery form?</p> <p>It can be found here: <a href="http://jsfiddle.net/methuselah/xSkgH/22/" rel="nofollow">http://jsfiddle.net/methuselah/xSkgH/22/</a></p> <p>I want to prevent the user from going onto the next step without entering a value so ideally an error message would pop up if they try.</p> <p>So far the field is <strong>readonly</strong> so the user cannot edit any entries but this alone doesn't prevent the user from completely skipping the step and carrying on.</p> <p>Thanks in advance!</p>
jquery
[5]
5,171,101
5,171,102
Datepicker and timepicker not working on appended elements
<p>I'm using <code>datepicker</code> and <code>timepicker</code> for my fields like this:</p> <pre><code>&lt;input class="datepicker" name="sugg_date[]" type="text" value="" /&gt; &lt;input class="tp" name="sugg_time[]" type="text" value="" /&gt; </code></pre> <p>I'm also using this function to add more rows: </p> <pre><code>&lt;script&gt; function add_next_row(e, row_a) { curr_row = $(row_a).prev('p'); curr_row.append('&lt;input class="datepicker" name="sugg_date[]" type="text" value="" /&gt;'); curr_row.append('&lt;input class="tp" name="sugg_time[]" type="text" value="" /&gt;'); if (e.preventDefault) { e.preventDefault(); } else { e.returnValue = false; } } &lt;/script&gt; </code></pre> <p>But the new rows don't work with the <code>timepicker</code> and <code>datepicker</code>. Can someone please tell me why.</p>
jquery
[5]
2,989,976
2,989,977
Add a ExpandableListView into a fragment
<p>I am developing an app for honeycomb, and I have put some tabs in the action bar, but now I don't know how to put an ExpandableListView in one of the tabs, or, in one of the fragments.</p>
android
[4]
156,080
156,081
Use Android device as a simple server
<p>I need a very simple server that listens for connections, retrieves a question and simply answers yes or no. Then the connection is broken.</p> <p>As my Android device is the only device that is powered on and connected to the internet 24/7, I'm thinking of using it as the server.</p> <p>Is this possible, and how could I achieve this? The biggest problems that I'm facing is the ip-address, as it could be changing a lot. I'm thinking of storing it in a public dropbox file, so the client can retrieve the address from that</p>
android
[4]
5,980,776
5,980,777
Most efficient way to find the count of matches a string has against an array of words?
<p>let's say I have a string</p> <pre><code>String test = "This is a test string and I have some stopwords in here"; </code></pre> <p>and I want to see how many times the words in the array below match against my string</p> <p>psudocode</p> <pre><code>array = a,and,the,them,they,I </code></pre> <p>so the answer would be "3"</p> <p>just curious what the most efficient way to do that in java is?</p>
java
[1]
4,931,058
4,931,059
How to cancel UITableview reloaddata function in iphone
<p>In my application, I have pushed from oneviewcontroller to anotherviewcontroller. In that page I have started a timer and updated <code>UITableview</code> for every 1 sec (using <code>UITableview reloaddata</code>).</p> <p>I have start the timer in <code>viewwillappear</code> function and invalidate timer in <code>viewwilldisappear</code>.</p> <p>But when timer is running, when I came back to my viewcontroller my application crashed rapidly.</p> <p>Please help me? Thanks in advance...</p> <p>My guess is when i push back to viewcontroller that time tablereloads in previous viewcontroller that time it make crashes. I am using try catch but nothing makes any difference. Can we stop tableview reloads when we are not in that page?</p>
iphone
[8]
5,008,084
5,008,085
how to navigate for a new window[IE] using datalist control
<p>i using a datalist control i am binding with hyperlink control</p> <pre><code>&lt;asp:Hyperlink ID="lbURL" runat="server" Text='&lt;%# Eval("URL") %&gt;' /&gt; </code></pre> <p>so now this hyperlink would contain an url that points to some web site so once user click on this link a new <strong>IE</strong> window should be opened like if the url contains" <a href="http://stackoverflow.com/questions/ask">http://stackoverflow.com/questions/ask</a>", yahoo.com any thing like is<br> so once user clicks open the web site</p> <p>any help would be great . looking forward for a solution thank you</p>
asp.net
[9]
2,642,961
2,642,962
Jquery - Selecting circular area of an image
<p>I need to be able to select both rectangular and circular areas within an image, not to crop them, but to create dynamic mapped areas inside an image. So far, I know how to enable the selection of rectangular areas but haven't found a way to do circular selections and be able to save geometry values of the created circle within an image. Any library or plugin I could use?</p>
jquery
[5]
3,110,454
3,110,455
JQuery 1.5 and new "Text JSON" datatype
<p>I have just updated to JQuery 1.5 and all my ajax calls that return JSON and a number of plugins instantly broke.</p> <p>In my pre-1.5 code, I specified the dataType like:</p> <pre><code>dataType: "json" </code></pre> <p>Changing the dataType to:</p> <pre><code>dataType: "text json" </code></pre> <p>Fixes the problem but I do not want to manually change the plugins as this will affect upgrades.</p> <p>Is there a way of handling this better with less disruption?</p>
jquery
[5]
436,504
436,505
OnClickListener and OnTouchListener
<p>I have an 2 adapters extending BaseAdapater. The first Adapter (let's call it imageAdapter) loads an image base on an ID, the second adapter (pageAdapter) builds grids of images from the first adapter. I set the second adapter to a gallery. The idea is that I can sort have pages in an album where there are multiple pictures on each album. </p> <p>Now I want to the imageViews to fire off clicks, so I set an onClickListener for each of the imageViews from the imageAdapter. The problem is that after I set the onClickListener, I cannot scroll the gallery by touch/fling/scrolling on the images anymore. I think it's an issue of parent/children event pass through thing.. but I am not sure how to fix it exactly. Please help.</p>
android
[4]
1,706,124
1,706,125
How to use Explode in my case?
<p>I have a variable that contains text with values according to an example below:</p> <pre><code>$data = "5:7|4:1|504:2|1:3|" </code></pre> <p>And I would like to achieve results like this:</p> <pre><code>$data[5] = 7; $data[4] = 1; $data[504] = 2; $data[1] = 3; </code></pre> <p>I tried with explode:</p> <pre><code>$data = explode("|", $data); //but it makes $data[0]="5:7"; $data[1]="4:1"; and so on. </code></pre> <p>Should I use explode again? Is it has any sense, or is there another way? I would like to ask for a hint or help.</p>
php
[2]
5,815,077
5,815,078
jQuery Accordion
<p>I have the jQuery Accordion set up on a page of mine, and the first div is automatically expanded.</p> <p>Is there a way to have that first accordion closed on page load?</p> <pre><code>$(function() { $( '#accordion' ).accordion({ collapsible: true, autoHeight:false }); }); </code></pre>
jquery
[5]
2,152,515
2,152,516
JavaScript does not execute
<p>So in my head> I have the following piece of code:</p> <pre><code>function dynamicPhoneAddon(){ while(true){ var phone = document.myform.phone.value; document.getElementById('writeme').innerHTML ='&lt;input type="hidden" name="retURL" value="http://URLREMOVED/thankyou.php?customer=' + phone + '"&gt;'; } } </code></pre> <p>Then I have a body onload="dynamicPhoneAddon()" to call this script. It's supposed to constantly modify the contents of a div id="writeme" by using the value from the phone field of form myform.</p> <p>However, the script doesn't run. I haven't done any work with javascript before, so I think it's probably something obvious... is it because I'm calling an infinite loop? Or am I trying to do something impossible?</p> <p>The end result I'm trying to achieve is to make a hidden value that has a link to a URL with a variable (the phone number) at the end.</p>
javascript
[3]
2,556,838
2,556,839
How to find two same text nodes
<p>I have a table with data in in. For simplicity lets say it has only one column and no header. I want JQuery to iterate over all rows to see if the text in any of the cells in the same column is repeated in another row. Is there a simple way to do this?</p> <pre><code>&lt;tr&gt;&lt;td&gt;one&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;two&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;three&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;four&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;five&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;one&lt;/td&gt;&lt;/tr&gt; &lt;!--It is doubled--&gt; &lt;tr&gt;&lt;td&gt;six&lt;/td&gt;&lt;/tr&gt; </code></pre>
jquery
[5]
5,300,010
5,300,011
how to apply watermark property on string value?
<p>i am using following line for printing <code>DB value</code> if true or <code>Not Applicable</code> if false using ternary operator. </p> <pre><code>dReader = cmd_last.ExecuteReader(); if (dReader.HasRows == true) { while (dReader.Read()) { jms_final = ((dReader["jms"].ToString().Equals("") || dReader["jms"].ToString().Equals(string.Empty) || dReader["jms"].ToString().Equals(null)) ? (SetWatermark("Not Applicable")) : (dReader["jms"].ToString())); } } </code></pre> <p>but here i want to print the Not Applicable word in faded color like watermark property. so how can i apply directly on string? please help me out.</p>
c#
[0]