Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
5,248,872
5,248,873
divs hide correctly on page load, but need to show when back button is clicked
<p>I have several divs that are to be hidden on page load on a html form I am designing. Some contain text fields, some contain dropdown boxes. The are shown based on when certain radio buttons are clicked in the form. I am using javascript to hide the divs. Here is the code I am using:</p> <pre><code>&lt;script language="JavaScript"&gt; function start() { hide('hideablearea'); hide('nontenant'); hide('conftype'); hide('rec_roomlayout'); hide('req_roomlabel'); hide('req_roomdrpdwn'); } window.onload = start; &lt;/script&gt; </code></pre> <p>It works perfectly. My problem is...when the form is submitted and there is an error (for example, the user forgets to complete a required field) and clicks the back button, this function fires again and hides everything..and I want the hidden divs which have info inthem to show at this point. Any idea on how to achieve this?</p> <p>Thanks in advance!</p> <p>K </p>
javascript
[3]
2,948,509
2,948,510
Paypal Api Guideness
<p>Let me explain it in a simple way.<br> My Client want to use his customer Credit Card information for Paypal refrence transaction. Example : Customer "A" buy Product "X". Now after somedays the Customer "A" called to the client that please shipped another one more piece of product "X" and billed from my Credit CArd (keep in mind we didn't have his credit card password). Now in this situation my Client want to Enter his credit CArd number and do a refrence transaction. Can any one have a paypal api guideness for this. Thanks</p>
php
[2]
2,767,047
2,767,048
webview is not able to show any url
<p>I want to show webpage by webview.i already set internet permission but i am not able to see when i run this program.it show me "the web page at 'url' might be temporarily down or it may have moved permanently to a new web address".when i directly go to emulator browser it show me perfectly.please help me.i use Android 2.2. </p> <pre><code>public class TestActivity extends Activity { WebView webview; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); System.setProperty("http.proxyHost","192.168.0.2"); System.setProperty("http.proxyPort","8080"); URL url; webview = (WebView) findViewById(R.id.webview); webview.getSettings().setJavaScriptEnabled(true); webview.setHorizontalScrollBarEnabled(false); webview.setVerticalScrollBarEnabled(false); webview.loadUrl("http://www.google.com"); } </code></pre> <p>}</p> <p>Thanks in advance</p> <p>Regards</p> <p>Arpit</p>
android
[4]
1,203,687
1,203,688
Can i extract Chinese text from PDF and convert into english language?
<p>I have chinese ebook in PDF format in iphone. So i want to extract chinese words from PDF and convert into english, it is possible in iphone using objective-C</p> <p>Thanks</p>
iphone
[8]
4,802,035
4,802,036
Varying iPhone deployment target: Handling Framework constants
<p>I am building an app that needs to work on multiple versions of iPhone OS and makes use of increased accuracy for Core Location in iOS4. </p> <p>I have code that does the following: <code> if ([m_locationManager respondsToSelector:@selector(startMonitoringSignificantLocationChanges)]) { m_locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; } else { m_locationManager.desiredAccuracy = kCLLocationAccuracyBest; } </code></p> <p>in this case, kCLLocationAccuracyBestForNavigation is a constant introduced in iOS 4, and startMonitoringSignificantLocationChanges is a method of m_locationManager only introduced in iOS4. </p> <p>My problem is, that this code is failing on an iPhone 3.1.3 device. It is trying to link to kCLLocationAccuracyBestForNavigation, but it can't find the symbol. My question is, how do I only link to this symbol in the iOS4 version, but not the iPhone 3.1.3 version?</p> <p>Thanks, C</p>
iphone
[8]
3,495,513
3,495,514
PHP when writing to file, How to prepend and append text to a file with existing text?
<p>I'm creating a xml file with PHP here is some sample code.</p> <pre><code> $myFile = "example_file.xml"; $fh = fopen($myFile, 'w'); while($row = mysql_fetch_array($result)) { $stringData = "&lt;field name=\"id\"&gt;$page_id&lt;/field&gt; &lt;field name=\"url\"&gt;http://myfundi.co.za/a/$page_url&lt;/field&gt; &lt;field name=\"title\"&gt;$pagetitle&lt;/field&gt; &lt;field name=\"content\"&gt;$bodytext&lt;/field&gt; &lt;field name=\"site\"&gt;Myfundi&lt;/field&gt;"; fwrite($fh, $stringData); } fclose($fh); </code></pre> <p>What I need to do is when the first content is written to the text file, I need to prepend and append some more text. </p> <p>I need to prepend and append to the data that already exists.</p> <p>How can I do that?</p> <p>Thanks</p>
php
[2]
802,054
802,055
Interview query. 'Difference between a php abstract and interface class'
<p>I'm not sure that this question is in the correct place. If not can someone move it there?</p> <p>Should all php developers know how to answer this question correctly in a technical interview? </p> <p>What is the difference between a abstract and interface class. What weight should it be given? I always thought this question was more suited for java developers.</p>
php
[2]
2,106,193
2,106,194
Javascript function which does not return a value in every case
<p>If I have a javascript function, it is possible that I do not return a value from every code path, e.g:</p> <pre><code>function f() { if (checkSomething()) { return 42; } // no return statement here } </code></pre> <p>Is this valid javascript or does it only work by chance (i.e. might there be problems when run in some browsers)?</p>
javascript
[3]
1,711,723
1,711,724
After orientation switch, TextView is no longer updating
<p>I have an <code>Activity</code> with a <code>TextView</code>, created in the usual <code>findViewById</code> method, using the definition from my xml layout file.</p> <p>I'm updating the text in the TextView using a handler, created in the <code>onCreate()</code> method.</p> <p>When I switch orientation, the <code>TextView</code> no longer updates from the same <code>Handler</code>. <br><Br>If my xml definition states a value for <code>android:text="blabla"</code>, then I see <code>"blabla"</code> in the view, but cannot update it anymore.</p> <p>What's happening?!</p>
android
[4]
2,920,792
2,920,793
checking for some extension and it's not working
<p>So i have the following problem, this is not working:</p> <pre><code>if any(x in pageName for x in ('.jpg','.gif','.txt','pdf','.msi','print' '.ppt','.pptx','javascript:', '.xls','#','.xlsx','.doc', 'ftp' '.docx','mailto:','.xml','.tar.gz','.png' )): print pageName return [] </code></pre> <p>And this is working, so what is the problem in my code, any ideas:</p> <pre><code>if any(x in pageName for x in ('print')): print pageName return [] </code></pre>
python
[7]
5,825,967
5,825,968
Store object array into Arraylist
<p>I have an array of objects named x (that is Object[] x).</p> <p>When I call x[0], it give me a bunch of (double) numbers, like:</p> <pre><code>1.111 1.344 433.22... </code></pre> <p>How could I store these numbers into a new ArrayList? Thanks. </p>
java
[1]
301,252
301,253
example of linked list storing and retreiving through NSUserDefault class
<p>I have 1 Linked list object and i want to use that object as for storing and retriving through any class for state maintainance in objective-c. Is there any example for that???</p>
iphone
[8]
5,265,016
5,265,017
PHP: Displaying a value dependent on input
<p>In my view I have the following select menu that states what type of form types are available:</p> <pre><code>&lt;label for="add_fields_type"&gt;Type: &lt;/label&gt; &lt;select name="add_fields_type" id="add_fields_type"&gt; &lt;option value="input"&gt;Input&lt;/option&gt; &lt;option value="textarea"&gt;Text Area&lt;/option&gt; &lt;option value="radiobutton"&gt;Radio Button&lt;/option&gt; &lt;option value="checkbox"&gt;Check Box&lt;/option&gt; &lt;/select&gt; </code></pre> <p>In my controller I currently have the following but I am unsure how to make is so that if <code>$_REQUEST['add_fields_type']</code> is <code>=</code> to lets say <code>radiobutton</code> then it will display that respective code.</p> <p><strong>Controller:</strong></p> <pre><code>if (isset($_REQUEST['add_fields_type'])) { echo $_REQUEST['add_fields_type']; } </code></pre>
php
[2]
5,176,611
5,176,612
Developing Python Module
<p>I'd like to start developing an existing Python module. It has a source folder and the setup.py script to build and install it. The build script just copies the source files since they're all python scripts.</p> <p>Currently, I have put the source folder under version control and whenever I make a change I re-build and re-install. This seems a little slow, and it doesn't settle well with me to "commit" my changes to my python install each time I make a modification. How can I cause my import statement to redirect to my development directory?</p>
python
[7]
283,699
283,700
Using jquery's on in place of live - how can I get the filtered elements
<p>Using jQurey, I am replacing my old .live() event bindings with .on(), like this:</p> <pre><code>$(document).on(event, selector, function () { console.log($(this)); //$(this) refers to the $(document) element, not the selector }); </code></pre> <p>What I want to do is get access to the element that this event is being applied to. Any ideas?</p> <p>This works:</p> <pre><code>$(selector).on(event, function () { console.log($(this)); //$(this) refers to the selector }); </code></pre> <p>But it doesn't work the same way as live - new elements added to the document that match the selector won't be bound...</p> <p>Thanks!</p>
jquery
[5]
5,968,680
5,968,681
How to locate restaurants,hospitals near user on google maps in andoid?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8428209/show-current-location-and-nearby-places-and-route-between-two-places-using-googl">Show Current Location and Nearby Places and Route between two places using Google Maps API in Android</a> </p> </blockquote> <p>In my application i am able to detect user but further now I need to locate and show restaurants and hospitals on the map near user's location. So how shall i proceed with that now?</p>
android
[4]
6,030,509
6,030,510
Replace jQuery from div to id
<p>Is there any way to replace a content using jQuery from - let's say,</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div class="information1"&gt; This is the information. &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>to</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div id="information"&gt; &lt;div class="information1"&gt; This is the information. &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
jquery
[5]
1,984,871
1,984,872
how to make a text as selectable?
<p>I have some TextViews for phone no. These are not editable. So I have made them as TextView. I want to perform click action on phone no, i.e. on clicking phone no i have to make a call. How to implement that? Anyone any idea?</p>
android
[4]
4,129,861
4,129,862
Like timeago, but in the future
<p>There is this cool jQuery plugin called <a href="http://timeago.yarp.com/" rel="nofollow">timeago</a> which converts time from the past into a human readable format.</p> <p>I would like a similar thing for the future. (I am working on a TV programme scheduler.)</p>
jquery
[5]
1,520,080
1,520,081
PHP: Getting contents of a file that is newer than a time
<p>Currently I have a PHP scripts that serves a medium amount (200 lines) of text. What I was wondering if it were possible to get the contents of a text file that is newest than a time, perhaps PHP's filemtime() for its last modification.</p> <p>Is it possible to get the contents of a text file in this manner?</p> <p>Edit: filemtime() is illogical since it wouldn't have any updates past that time.</p> <p>To clear it up, I'm trying to get all the inner contents of a text file that is newer than a time.</p> <p>Example: line1 was posted at time1, line2 was posted at time2, so on. I would want to be able to specify time2 and get the contents of the file that is newer than time2.</p>
php
[2]
2,488,611
2,488,612
Interpret Code - Non PHP Programmer
<p>What is this code doing?</p> <pre><code>&lt;?php if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'; $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name']; move_uploaded_file($tempFile,$targetFile); echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile); } ?&gt; </code></pre>
php
[2]
1,299,599
1,299,600
how to start this process
<p>I want to know how can I start this process wiht C# :</p> <pre><code>TestFile.exe -i "c:\Program Files\My App\MyContextMenuExtension.dll" "c:\Program Files\My App\LogicNP.EZShellExtensions.dll" </code></pre> <p>How can I send that two argumant toprocess ?</p>
c#
[0]
5,946,094
5,946,095
how to execute command on cmd from c#
<p>i want to run commands on the cmd from my c# app. i try : </p> <pre><code> string strCmdText = "ipconfig"; System.Diagnostics.Process.Start("CMD.exe", strCmdText); </code></pre> <p>result: the cmd window pop but the command didnt do nothing... :(<br> why?</p>
c#
[0]
5,593,370
5,593,371
simulate ipad click sound with mp3/ogg (web development)
<p>I am simulating a "click" sound on every anchor tag and submit button click on the mobile website that I'm working on using the following code:</p> <pre><code> &lt;audio id="mySoundClip" style=" display:none; visibility:hidden;"&gt; &lt;source src="@Url.Content("~/Content/audio/Click.ogg")" type="audio/ogg"&gt; &lt;source src="@Url.Content("~/Content/audio/Tock.mp3")" type="audio/mpeg"&gt; Your browser does not support the audio element. &lt;/audio&gt; &lt;script type="text/javascript"&gt; var homeURL = '@Url.Action("Index", "Home")'; var audio = $("#mySoundClip")[0]; $("[href]").click(function () { //alert("a clicked"); audio.play(); }); $(":submit").click(function () { //alert("submit button clicked"); audio.play(); }); &lt;/script&gt; </code></pre> <p>It's working as expected but there is a slight delay in when the sound file actually plays while clicking the anchor tags/submit buttons. Is there a way to play the sound file a little sooner than when it actually plays so it will seem like a native click?</p>
jquery
[5]
2,838,007
2,838,008
Java: standard library to convert field name ("firstName") to accessor method name ("getFirstName")
<p>Is there a standard library (such as org.apache.commons.beanutils or java.beans) that will take a string field name and convert it to the standard method name? I'm looking all over and can't find a simple string conversion utility.</p>
java
[1]
5,306,545
5,306,546
Call a function without knowing it's name
<p>I want to create a function in PHP and to call it without knowing the function's name.</p> <p>Is this possible?</p> <p>Example:</p> <pre><code>&lt;?php $functionName = "someName"; $this-&gt;$functionName(); function someName(){ echo("Print Message"); } ?&gt; </code></pre>
php
[2]
4,674,830
4,674,831
Create List in Jquery
<p>I used to create List in APS.net : </p> <pre><code>&lt;% List&lt;Item&gt; list = new List&lt;Item&gt;(); %&gt; </code></pre> <p>I want to create in jquery like this. How can I do that? Anyone have any idea? Thanks.</p>
jquery
[5]
583,298
583,299
Script with which I can change the font dynamically when the page is live using JavaScript
<p>I want a JavaScript with which I can change the font dynamically when the page is live (Arial to Times). But when I click Arial or Times, the page should not get refreshed. Can anyone please help me in this? Or can anyone please provide a script for this?</p>
javascript
[3]
2,098,540
2,098,541
Access Spinner in Activity without define in Layout
<pre><code>Spinner spinner = new Spinner(this); String option[]={"By Date","By Transaction ID","By Customer Phone"}; ArrayAdapter&lt;String&gt; spinnerArrayAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item,option); spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item ); spinner.setAdapter(spinnerArrayAdapter); spinner.performClick(); spinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parentview, View v,int position, long id) { Log.d("in select","yes"); } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { Toast.makeText(MainMenu.this,"no",Toast.LENGTH_LONG).show(); Log.d("In No select","No"); } }); </code></pre> <p>This all are done very fine, a new pop up display of Spinner view is generate on the previous view and previous view still display but dim, all focus on this current Spinner</p> <p>But the problem is when I select any item in this spinner then onItemSelected() should be called but it is not called.</p> <p>but if I write</p> <p><code>setContentView(spinner);</code> </p> <p>then onItemSelected() is called, but then previous view is not displayed now.</p> <p>so how can i access spinner without this line <code>setContentView(spinner);</code></p> <p>I want to get the position of the selected Item in Spinner</p> <p>Please provide me code or example</p> <p>i am waiting for your kind reply</p>
android
[4]
3,365,209
3,365,210
Android : cacerts.bks is not found in the repository
<p>The defined path for cacerts.bks is not found in the Android device at system/etc/security/cacerts.bks - I want to verify whether my device owns it or not , how to check this ?</p> <p>Regards SS</p>
android
[4]
4,922,790
4,922,791
PHP how do I set the date to one week in advance?
<p>I have the day and the month from the database, stored in seperate variables. But if today is the 7th and I minus one week, it would be 0 same case for the month. And I want to add the <code>lo_date</code> to <code>lockin_period_date</code> and minus 3 months, as I want it to send an email to me 3 months in advance. How do I set the values I have from the database to the date I want? Please help. </p> <pre><code>&lt;?php include"connect_mysql.php"; $reminder_dates = mysql_query("SELECT*FROM registration_form"); while($row = mysql_fetch_array($reminder_dates)){ $main_dob_day = $row['main_dob_day']; $main_dob_month = $row['main_dob_month']; $main_dob_year = $row['main_dob_year']; $joint_dob_day = $row['joint_dob_day']; $joint_dob_month = $row['joint_dob_month']; $joint_dob_year = $row['joint_dob_year']; $loan_lo_day = $row['loan_lo_day']; $loan_lo_month = $row['loan_lo_month']; $loan_lo_year = $row['loan_lo_year']; $lockin_period_day = $row['lockin_period_day']; $lockin_period_month = $row['lockin_period_month']; $lockin_period_year = $row['lockin_period_year']; $legal_fee_clawback_day = $row['legal_fee_clawback_day']; $legal_fee_clawback_month = $row['legal_fee_clawback_month']; $legal_fee_clawback_year = $row['legal_fee_clawback_year']; date_default_timezone_set('UTC'); $m = date("n"); $d = date("j"); $y = date("Y"); $time = time(); $today = date('n-j-Y', $time); //main applicant birthday - reminder 7days in advance $main_day = $main_dob_day-7; if($main_day == $d &amp;&amp; $main_dob_month == $m){ echo "Mail Sent!"; } // } ?&gt; </code></pre>
php
[2]
2,068,658
2,068,659
How do I assign a random colour to links?
<p>Just wondering why my code isn't working. Am I doing this completely wrong?</p> <pre><code>window.onload = function random() { var links = document.getElementsByTagName('a'); var colours = new Array("green","red","blue"); var randomColour = colours[Math.floor(colours.length * Math.random())]; for (a = 0; a &lt; links.length; a++) { links[a].style.color = 'randomColour'; } } </code></pre>
javascript
[3]
5,176,505
5,176,506
setStreamVolume sound notification
<p>When I use setStreamVolume or physical sound buttons to adjust the volume on my device, it produces short sound notifications(beeps) - how do I remove it ?</p> <p>Right now I have something like:</p> <pre><code>_audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, (int) ((_maxVolume / 100) * progress),AudioManager.FLAG_PLAY_SOUND); </code></pre>
android
[4]
3,634,076
3,634,077
When to use Parasitic Constructor Pattern
<p>Why should Parasitic constructor pattern be used with caution and when it would be appropriate to use that pattern?</p>
javascript
[3]
3,040,349
3,040,350
jQuery: passing value of a select radiobutton
<p>How can I pass the value of the radio button below to the copy_select_val() function?</p> <pre><code>&lt;input type="radio" name="selected_invoice" value="35" onclick="copy_select_val(); return false;"&gt; </code></pre>
jquery
[5]
5,274,021
5,274,022
c# getting ALL the properties of an object
<p>i have object like this:</p> <pre><code>some_object </code></pre> <p>this object has like 1000 properties.</p> <p>i would like to loop through every property like this:</p> <pre><code>foreach (property in some_object) //output the property </code></pre> <p>is there an easy way to do this?</p>
c#
[0]
1,921,115
1,921,116
Proper use of new/delete
<p>As a sequel of my <a href="http://stackoverflow.com/questions/7104889/how-to-properly-define-destructor">previous question</a>, I would like to ask what I am doing wrong in the following code.</p> <p>The code is, for example</p> <pre><code>void myclass1::myfun() { myclass2* newVar = new myclass2(); /* other code and stuff */ myvector.push_back(newVar); // myvector is a member of myclass1 and is a std::vector&lt;myclass2*&gt; delete newVar; } </code></pre> <p>but when I run it, myvector returns empty, unless I comment out the <code>delete</code> line.</p> <p>What am I doing wrong?</p>
c++
[6]
5,649,950
5,649,951
The name XXXX does not exist in the current context
<p>I have the following code:</p> <pre><code>public Form1() { InitializeComponent(); string strRadio = Utils.ReadFile(strTemp + @"\rstations.txt"); string[] aRadio = strRadio.Split(new string[] { "#" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i &lt; aRadio.Length; i += 2) { listBox.Items.Add(aRadio[i]); } } private void listBox_SelectedIndexChanged(object sender, EventArgs e) { int index = listBox.SelectedIndex; MessageBox.Show(aRadio[(index+1)]); } </code></pre> <p>Now the error is <code>The name 'aRadio' does not exist in the current context</code>. Which comes from <code>MessageBox.Show(aRadio[(index+1)]);</code>. Do I need to declare the <code>aRadio</code> as public or something? If so, how would this be done?</p>
c#
[0]
3,696,343
3,696,344
How to check if the number of lines in the file equal the number of characters in each of the lines?
<p>Reads the specified file and treats its contents as a list of strings (one per line). Checks for the following conditions in the input file:</p> <p>The file must exist and be available for reading. In other words, the call to open should not raise an exception.</p> <p>The file must contain between 3 and 10 lines of text. That is, 3 is the minimum acceptable number of lines, and 10 is the maximum number of lines.</p> <p>All lines must contain exactly the same number of characters.</p> <p>Each line must contain between 3 and 10 characters. That is, 3 is the minimum acceptable number of characters, and 10 is the maximum. The number of characters per line does NOT have to equal the number of lines in the file.</p> <p>The only acceptable characters are <code>'x'</code>, <code>'X'</code>, <code>'y'</code>, <code>'Y'</code>, and <code>'_'</code>.</p> <pre><code>correct_string = False while correct_string is False: string = input("Enter a string? ") if len(string) != len(string): print("Error: string must have the same number of characters.") else: incorrect_char = False for i in string: if i != "X" and i != "x" and i != 'Y' and i != 'y' and i != "_": incorrect_char = True if incorrect_char is False: correct_string = True else: print("Invalid Character. Contains characters other than 'X', 'x', 'Y' 'y',and '_'") </code></pre>
python
[7]
5,208,494
5,208,495
Android: Button not showing after dynamic view
<p>I'm trying to dynamically put a bitmap in between a Textview and a Button:</p> <pre><code>&lt;TextView android:text="TextView" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;&lt;/TextView&gt; &lt;LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:orientation="vertical"&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="fill_parent" android:id="@+id/linearLayout2" android:layout_height="fill_parent" android:orientation="vertical"&gt; &lt;Button android:layout_width="fill_parent" android:layout_gravity="fill_vertical" android:text="Button" android:layout_height="fill_parent" android:id="@+id/button1"&gt; &lt;/Button&gt; &lt;/LinearLayout&gt; </code></pre> <p>In my Main Activity I create my custom view and add it to the LinearLayout1</p> <pre><code>mView = new myView(this); LinearLayout ll = (LinearLayout)findViewById(R.id.linearLayout1); ll.addView(rView); </code></pre> <p>My problem is, that myView consumes all available space below of it.</p> <p>What am I missing?</p> <p>Thnx in advance.</p>
android
[4]
2,342,434
2,342,435
Cannot find web project item
<p>I am trying to create a webform. I added a button control on the web form but when i switched to the design mode i got the error: Error creating Button1 Cannot create web project item E:\MyProjects\C#\WebApplication1</p> <p>Can somebody suggest a solution</p>
c#
[0]
4,395,828
4,395,829
DropDownList SelectedIndexChanged event fails over the internet
<p>I have two ASP.net DorpDownLists in a web page. When the selection changes on the first drop down list, the client is expected to do a postback and the the server will populate the second drop down list based on the selection.</p> <p>I have this page working as expected on the intranet but when it is accessed from the internet, the postback happens(I have verified the __EVENTTARGET with Burp Proxy and it is working) but the server is not calling the SelectedIndexChanged event. </p> <p>Anybody ever faced something similar? Any suggestions or recommendations on how to resolve?</p>
asp.net
[9]
1,908,079
1,908,080
C# winform delete folders and files on uninstall. Permission Error
<p>I am getting the below error.</p> <p>I need to uninstall the app and delete all files and folders created either by the application or users in the program files/myapp.</p> <p>How can I resolve this issue? Thanks.</p> <pre><code>Access to the path 'C:\Program Files (x86)\DefaultProgram\Application\app.exe' is denied. </code></pre> <p>My Code:</p> <pre><code>protected override void OnAfterUninstall(IDictionary savedState) { string sFolder = Path.GetDirectoryName(Context.Parameters["assemblypath"]); string sUsername = "NT AUTHORITY\\LOCALSERVICE"; DirectoryInfo myDirectoryInfo = new DirectoryInfo(sFolder); DirectorySecurity myDirectorySecurity = myDirectoryInfo.GetAccessControl(); myDirectorySecurity.AddAccessRule( new FileSystemAccessRule( sUsername, FileSystemRights.Read | FileSystemRights.Write | FileSystemRights.Modify, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow)); myDirectoryInfo.SetAccessControl(myDirectorySecurity); base.OnAfterUninstall(savedState); string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); DeleteDirectory(Path.Combine(appPath, "DB")); DeleteDirectory(appPath); } public static void DeleteDirectory(string target_dir) { string[] files = Directory.GetFiles(target_dir); string[] dirs = Directory.GetDirectories(target_dir); foreach (string file in files) { File.SetAttributes(file, FileAttributes.Normal); File.Delete(file); } foreach (string dir in dirs) { DeleteDirectory(dir); } Directory.Delete(target_dir, false); } </code></pre>
c#
[0]
1,651,747
1,651,748
Execute scripts later in time
<p>For a personal game I'm working on, I'd like to have a php function work over a certain period of time.</p> <p>For example, right now it's set so that if the user wishes to purchase soldiers in the game, he fills out the form and when it's submitted, the user's database entry is instantly updated to reflect the change in soldiers.</p> <p>What I would like is to have a time delay between the form submission and when the soldiers actually appear (to simulate training time, etc.). </p> <p>I thought of one possible approach, but I hope it isn't the best one. I could create a new database table, "actions" that contains the type of action (i.e. the task to execute, in this case training soldiers), a parameter (the number of soldiers), and the action's start/end times. Whenever the user loads the page, the page checks to see if any actions have been completed and executes them if they are.</p> <p>The key problem with this is that actions only execute when the user loads the page. He could buy soldiers and have them not appear until whenever he happens to log in, potentially leaving him vulnerable for large amounts of time.</p> <p>I could resolve this by checking all user's actions whenever anyone loads the page, but I believe this would be unnecessarily taxing on the server, in addition to being fairly difficult to implement.</p> <p>Does anyone have better ideas, or is my train of thought the best approach there is? Thank you!</p>
php
[2]
4,029,865
4,029,866
Uploading a bitmap to the server with http protocol
<p>i have a camera Activity after which i take a picture and saving it to gallery and uploading to the server My upload code is not working, i need help on this?</p> <p>// image capture</p> <pre><code> Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); startActivityForResult(intent, 0); </code></pre> <p>//image Saving</p> <pre><code> if (requestCode == 0 &amp;&amp; resultCode == RESULT_OK) { Bundle extras = data.getExtras(); Bitmap b = (Bitmap) extras.get("data"); ImageView mImg; mImg = (ImageView) findViewById(R.id.head); mImg.setImageBitmap(b); // save image to gallery Shot = "HeadShot"; //Long.toString(System.currentTimeMillis()); MediaStore.Images.Media.insertImage(getContentResolver(), b, Shot, NAME); } </code></pre> <p>//Upload to the server</p> <pre><code> public void Upload(String url, HttpEntity imgdata) throws Exception, Exception { DefaultHttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(url); post.setHeader("Content-Type", "bitmap; charset=utf-8"); post.setURI(new URI(url)); post.setEntity(imgdata); HttpUriRequest request = post; HttpResponse response = client.execute(request); HttpEntity entity = response.getEntity(); return entity.getContent(); } </code></pre>
android
[4]
5,119,533
5,119,534
how to get raw folder uri path and save in internal memory in android?
<p>here my code.where is my errors errors.the errors is file not found exception.</p> <pre><code>Uri video = Uri.parse("android.resource://com.ring.app/raw/"+a[i]+".mp3"); file= new File(video.toString()); try { inputStream= new FileInputStream(file); fos = super.openFileOutput("output"+i+".mp3", MODE_WORLD_READABLE); byte buffer[]=new byte[1024]; while((len=inputStream.read(buffer))&gt;0) fos.write(buffer,0,len); fos.close(); } </code></pre>
android
[4]
5,963,601
5,963,602
Strange PHP output buffering
<p>PHP:</p> <pre><code>header('Content-type: text/plain'); for ($i=0; $i&lt;10; $i++){ echo "$i\r\n"; ob_flush(); flush(); sleep(1); } </code></pre> <p>I tried script above on 2 different servers. Both respond numbers 0...9 in every line. In case of first server each number is received every second. In case of second server there is no output for 10 seconds and entire output is displayed at once. What might be wrong int second case? I tried various uutput control Functions but it didn't help.</p> <p>Set of response headers in both cases is pretty much the same:</p> <pre><code>HTTP/1.1 200 OK Date: Mon, 03 Jan 2011 19:21:21 GMT Server: Apache X-Powered-By: PHP/5.2.14 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/plain </code></pre>
php
[2]
1,324,294
1,324,295
Implementing a wrapping check box list or a tag list in Android
<p>A standard list of check boxes takes up a lot of vertical real estate:</p> <pre><code>[ ] Option 1 [X] Opt 2 [X] Loooooong option 3 [ ] Option 4 </code></pre> <p>What I would like to do is either wrap them:</p> <pre><code>[ ] Option 1 [X] Op 2 [X] Loooooong option 3 [ ] Option 4 </code></pre> <p>Or something like the stackoverflow Tags field:</p> <pre><code>[X] Loooooong option 3 [X] Opt 2 Tags: [ Optio ] Option 1 Option 4 </code></pre> <p>I've not been able to find a suitable class to do that, and I'd rather not reinvent the wheel. As each field will have different lengths (for example, contact names) using a TableLayout or GridView doesn't make sense.</p>
android
[4]
5,260,715
5,260,716
Python: split float after 3rd decimal place
<p>I have a series of strings, which are two numbers:</p> <pre><code>1.782-100.799 -18.107-102.016 -17.504104.059 </code></pre> <p>How do I split my string after the 3rd decimal place of the first number in each string? so it looks as follows:</p> <pre><code>1.782 -100.799 -18.107 -102.016 -17.504 104.059 </code></pre>
python
[7]
5,811,024
5,811,025
Problem with a large CSV file
<p>I have a very large CSV file. 51427 lines to be exact.</p> <p>Is there not a way where I can only read the required lines into an array? That would speed things up significantly.</p>
php
[2]
3,619,999
3,620,000
Android How to implement monthly Calender in Activity programmatically
<p>im a new user for android development. i need to show the monthly calendar when button click. how to do it.</p> <pre><code>Calendar cal = Calendar.getInstance(); Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("beginTime", cal.getTimeInMillis()); intent.putExtra("allDay", true); intent.putExtra("rrule", "FREQ=YEARLY"); intent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000); intent.putExtra("title", "A Test Event from android app"); startActivity(intent); </code></pre> <p>is their any method avail for monthly calendar</p>
android
[4]
2,673,084
2,673,085
how to export data to csv from html table
<p>Hi can any one tell me how to write the code to export csv file from html page.</p> <p>I am trying to use the code as follows</p> <pre><code>var doc =document.open("text/csv",replace); </code></pre> <p>the doc element i am sending to a function where I am getting all my table data. and i am writing data into doc "document.write(data);</p> <p>but i am not able to get the data into csv file by asking some pop-up like open or save, just it is printing the data into my current page.</p> <p>can any one help me how to achieve it?</p> <p>Regards, kamesh</p>
javascript
[3]
603,542
603,543
What is the fastest way to check if a class has a function defined?
<p>I'm writing an AI state space search algorithm, and I have a generic class which can be used to quickly implement a search algorithm. A subclass would define the necessary operations, and the algorithm does the rest. </p> <p>Here is where I get stuck: I want to avoid regenerating the parent state over and over again, so I have the following function, which returns the operations that can be legally applied to any state: </p> <pre><code>def get_operations(self, include_parent=True): ops = self._get_operations() if not include_parent and self.path.parent_op: try: parent_inverse = self.invert_op(self.path.parent_op) ops.remove(parent_inverse) except NotImplementedError: pass return ops </code></pre> <p>And the invert_op function throws by default. </p> <p>Is there a faster way to check to see if the function is not defined than catching an exception? </p> <p>I was thinking something on the lines of checking for present in dir, but that doesn't seem right. hasattr is implemented by calling getattr and checking if it raises, which is not what I want. </p>
python
[7]
2,398,924
2,398,925
Where should I locate my baseActivity class?
<p>Say i have com.mydomain.myappname. Is it a good idea to put my baseActivity class (from which all my other activity classes inherit) into com.mydomain? Or is that asking for trouble? I'm worried my other apps could then conflict if installed on the same phone.</p> <p>Also, if not in com.mydomain, where should I place them?</p>
android
[4]
1,786,837
1,786,838
Understanding a large Java program
<p>I am working on a java project and I have to extend (add more functionality) it. But I don't know how should I learn the existing one before incorporating them. Is there any specific path I should follow? Can I run it in a way so that I can see, statement by statement, the execution of the program?</p> <p>I am a kind of stuck in understanding it, thanks.</p>
java
[1]
2,905,377
2,905,378
Best Practice - Allow offline use of android app?
<p>currently I'am developing an Android native app which have to communicate with a server (for ex. via REST) to load, save data etc.</p> <p>Now I'm considering the offline scenario. I also want the user to save data if the mobile phone has currently not network connection. If the network connection is up again I want to sync the user data with my server. </p> <p>Do anyone know some best practice to achieve this. I'm considering using a couchdb for replication, but I'm wondering if there are other nice ways to support offline use of my app.</p> <p>Thx a lot.</p>
android
[4]
1,780,641
1,780,642
Display array in UITableView when in UIViewController
<p>I have a tableview in my viewcontroller. But i have an error which say that [tableview:numberofrowinsection:]:unrecongized selector sent to instance. Can someone please tell me how cna i solve this.</p>
iphone
[8]
5,762,119
5,762,120
How to connect to MSSQL in PHP using sqlsrv api?
<p>I am trying to connect to MSSQL in PHP using sqlsrv api. When I run <strong>phpinfo()</strong>, it shows an a section for <strong>sqlsrv</strong>. But while actually writing code, I cannot connect to MSSQL. I am using SQL Server R2. I connect to the database from the Management Studio using the specified hostname. Here is the code:</p> <pre><code>&lt;?php $serverName = "TEST-PC\SQLEXPRESS"; $databaseName = "TestDB"; $connectionInfo = array("Database"=&gt;"$databaseName"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ){ echo "Could not connect.\n"; die( print_r( sqlsrv_errors(), true)); } else{ echo "Connection created"; } $tsql = "SELECT * FROM Test"; $result = sqlsrv_query($conn, $tsql); echo "Rows returned: ".sqlsrv_num_rows($result); sqlsrv_close(); ?&gt; </code></pre> <p>The code prints NOTHING on the page, not even any error message. Here is the entries in php.ini file:</p> <pre><code>extension=php_sqlsrv_53_ts_vc9.dll extension=php_pdo_sqlsrv_53_ts_vc9.dll </code></pre> <p>Any help please?</p>
php
[2]
4,586,107
4,586,108
Replacing hyphen with space, but space hyphen space should not be replaced
<p>can we replace all hyphen with blank spaces but if space is followed by hypen and then another space it should not be removed, for example if i get "to-be-or-not - to-be" output should be "to be or not - to be" .is it possible</p>
php
[2]
2,061,549
2,061,550
C++ -- how to call user defined operator?
<p>I saw the following code snippet:</p> <pre><code>class WindowHandle { public: WindowHandle(WINDOW_HANDLE handle) : w(handle) {} ~WindowHandle() { destoryWindow(w); } operator WINDOW_HANDLE() { return w; } ... private: WINDOW_HANDLE w; ... } </code></pre> <p>Here is the question: how do I use operator WINDOW_HANDLE() to get the raw pointer? I list my guess as follows:</p> <pre><code>WindowHandle win(createWindow()); WINDOW_HANDLE winPtr = win.operator WINDOW_HANDLE(); // I am not sure whether this is correct. </code></pre> <p>Thank you</p>
c++
[6]
4,897,784
4,897,785
put the form information onclick to another page in android
<p>i am new in android i develop a demo project in it i want to create a form and the form information on click the mea new page open </p>
android
[4]
1,617,059
1,617,060
While accessing the assembly in otherAppdomain ,how to reflect the changes done in assembly in Other appdomain Referred
<p>I am accessing one assembly in other application by loading that assembly in Another Appdomain,its working fine.</p> <p>My Question is : If I make changes in the Assembly and build it,the changes are not getting reflected in the application where I have created the another appdomain for accessing it unless i build the application .</p> <p>Plz let me know how can I access the assembly in this case without building the application.</p> <p>Thanks, Gagan dhamija</p>
c#
[0]
4,347,806
4,347,807
Javascript NULL Values
<p>I am getting the following javascript error:</p> <pre><code>'value' is null or not an object </code></pre> <p>Can someone please let me know what is the best way to check whether an object's value is NULL in javascript as I have been using:</p> <pre><code>if ((pNonUserID !== "") || (pExtUserID !== "")){ </code></pre> <p>Is this correct or is there a better way?</p> <p>Thanks.</p>
javascript
[3]
3,881,237
3,881,238
Python: Obtain edge end points of the graph
<p>I need the edge end points from a graph. I have installed networkx. I have some idea how to proceed.</p> <p>networkx.Graph.edges_iter() returns all the edges in the graph</p> <pre><code>[e for e in G.edges_iter()] [(0, 1), (1, 2), (2, 3)] </code></pre> <p>What I want is a list [0,1,1,2,2,3]</p> <p>How do I get this from the above data?</p>
python
[7]
3,558,802
3,558,803
PHP 'global variable'
<p>I am creating a game in PHP, and am having a problem with global variables. Depending on which button is pressed in my HTML page, a corresponding PHP script is run and a function is called depening on the <code>isset</code> function.</p> <p>My question is this: I want to keep a score variable, and I would like to have access to this variable in the future after multiple <code>post</code> statements have been issued.</p> <p>I have tried using the <code>global</code> keyword but this does not seem to do what I am expecting.</p> <p>Can I please have some help with this?</p>
php
[2]
4,794,388
4,794,389
Error when using HttpContext.Current.Server.Execute more than one
<p>I have templates like cart.aspx, mail.aspx.I am passing them some variable and get the result view with this code</p> <p><code>MySession2.Current.customer = customer;</code></p> <p><code>StringWriter _writer = new StringWriter();</code></p> <p><code>HttpContext.Current.Server.Execute("mail.aspx", _writer);</code></p> <p><code>modal_info_text.InnerHtml = _writer.ToString();</code></p> <p>In first line i put the variable to the session.In my mail.aspx file i get this variable.In other lines i get the result view of my mail.aspx and put it to my div.</p> <p>So, there is no problem if i only use this. But i need to use an another template -cart.aspx-. so if i use same code for cart.aspx and put it to my cart div it gives an error.This is error:</p> <p><code>The state information is invalid for this page and might be corrupted.</code></p> <p>What is the problem when i use this more than one? Thanks.</p>
asp.net
[9]
2,270,964
2,270,965
What constitutes "Proper use" of the javascript Eval feature?
<p>Eval is a notoriously controversial language feature. Douglas Crockford flat out rejects it. I'm wondering what specific risks Eval brings about. According to <a href="http://stackoverflow.com/questions/86513/why-is-using-javascript-eval-function-a-bad-idea">this</a> question, <code>Improper use of eval opens up your code for injection attacks</code>.</p> <p>What are some improper uses of the Eval command, and what security holes do they open up?</p>
javascript
[3]
4,321,892
4,321,893
unable to display images from database via php array
<p>Learning php!</p> <p>I have a sql database which contains a table called 'images' which stores image paths that users would upload. The problem I am having is pulling the image paths from the database to a PHP array, then using the paths to display the images on the screen as a , list item. However when I run the page nothing is displayed.</p> <p>code for database connection:</p> <pre><code>include('Database.php'); class Images extends Database{ private $_images = array(); public function __construct(){ $conn = $this-&gt;create_connection('read'); $sql = "SELECT image_path FROM 'items' WHERE catagory='tshirt'"; $result = $conn-&gt;query($sql)or die(mysql_error()); while($paths = mysql_fetch_array($result)) { $this-&gt;_images[] = $paths['catagory']; } } public function getItems() { return $this-&gt;_images; } </code></pre> <p>code for the view:</p> <pre><code>&lt;ul&gt; &lt;?php require ('../model/Images.php'); $imageArray = array(); $images = new Images(); $imageArray[] = $images-&gt;getItems(); foreach($ImageArray as $value){ echo '&lt;li&gt;&lt;img src="'.$value.'"&gt;&lt;/li&gt;'; } ?&gt; &lt;/ul&gt; </code></pre> <p>I executed the SQL query using phpmyadmin, which query's correctly. Also I have simulated the database data by adding the image paths manually to test looping through array.</p> <pre><code>private $_images = array('./images/tshirt1.jpg', etc, etc); </code></pre> <p>so I know the foreach loop and query work. The 'create_connection' function I have used before, connecting to the same database without any issues, I am a bit stumped, but I think it may be connected to the mysql_fetch_array section?</p> <p>Am I using the correct approach? or is there a better way to solve this issue?</p> <p>Hope someone can point me in the right direction!</p> <p>Thanks</p>
php
[2]
4,196,989
4,196,990
How to disable an item in a Spinner
<p>Is it possible to display particular entries in a Spinner list as disabled? i.e. I want to always display a spinner with 4 entries (North, South, East and West, say), but I want to be able to disable any one of these so that is appears greyed out and not selectable.</p> <p>Is this possible, or will I have to recreate the list each time, leaving out the invalid entries?</p> <ul> <li>Frink</li> </ul>
android
[4]
4,119,273
4,119,274
Adding <tr> from repeater's ItemDataBound Event
<p>My repeater's templates generate a table, where each item is a table row.<br> When a very very specific condition is met (itemdata), I want to add an additional row to the table from this event.</p> <p>How can I do that? </p> <pre><code>protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { bool tmp = bool.Parse(DataBinder.Eval(e.Item.DataItem, "somedata").ToString()); if (!tmp &amp;&amp; e.Item.ItemIndex != 0) { //Add row after this item } } } </code></pre> <p>I can use e.Item.Controls.Add() and add TableRow but for that I need to locate a table right?<br> How can I solve that?</p>
asp.net
[9]
6,007,130
6,007,131
How do I define fire_event, undefined fire_event error
<p>I'm cleaning up all the errors in an old script and I'm getting one that says <code>undefined function fire_event</code>. How do I define fire_event. everything works fine but i've turned on error_reporting(E_ALL); to fix all hidden errors</p> <p><strong>Fatal error: Call to undefined function fire_event() in /home/social/public_html/includes/dologin.php on line 96</strong></p> <pre><code> if (strpos($en['redirect'],'index.php?req=login')) unset($en['redirect']); $redirect = (isset($en['redirect']) &amp;&amp; $en['redirect']!='' ? $en['redirect'] : constant('dir').'members.html'); fire_event('member_login',$line['m_id']); header('Location: '.$redirect); exit; } </code></pre>
php
[2]
1,630,577
1,630,578
Getting info out of an array as a variable
<p>Basically i'm trying to get some IPTC data from an image when a user uploads it. </p> <p>Here's my code:</p> <pre><code> $size = getimagesize($image_file, $info); if(isset($info['APP13'])) { $iptc = iptcparse($info['APP13']); $iptc_description = $iptc['2#120']; $caption = $iptc_description["0"]; var_dump($caption); } </code></pre> <p>I did a var_dump, it dumps out:</p> <blockquote> <p>string(13) "caption data here blah blah"</p> </blockquote> <p>How can I get the $caption variable to just contain the caption data, without the string. I need the caption data as a variable so I can insert it into a db. </p> <p>I don't really use arrays a lot so i'm a bit stuck! </p> <p>Thanks!</p>
php
[2]
216,082
216,083
client-side application vs web application in WebView for android
<p>what is better approach in developing simple apps for android,</p> <p>simple apps - i mean apps like task managment or bug report.</p> <p>i found a good answer <a href="http://stackoverflow.com/questions/5092699/factors-to-consider-to-choose-among-client-side-application-or-web-application">here</a></p>
android
[4]
5,126,760
5,126,761
"this" in JavaScript
<p>I'm trying to understand the syntax of how to put together a JavaScript function as an object.</p> <p>Q: Is this the right way to do it?</p> <p>The reason why I ask is because I'm looking at it in Firebug and I was hoping to be able to drill down and see the value of myVar and myVariable, but instead Firebug only says that "this" is an object Object.</p> <pre><code>var myObject = { init: function() { var myVar = 1; myObject.myVariable = 2; console.log('"this" when called as an object: ' + this); } } myObject.init(); </code></pre> <p>Also, what's the funny little syntax to call it directly upon declaration? Something about (), but when I remove the last line and put () at the end of the declaration, I get a syntax error.</p>
javascript
[3]
3,169,986
3,169,987
C#- Console Program Ideas for Noob
<p>So, Im a beginning C# programmer. I know basic syntax and simple things like if statements and loops(methods and classes too). I've only used console apps right now havent bothered with windows forms yet. </p> <p>So any simple app ideas that introduce new things important for C# programming.</p> <p>Also, NO tutorials. I want to make all by myself.</p>
c#
[0]
5,395,989
5,395,990
Pop-up bar on selected list item
<p>I'm trying to find out how I can create a pop-up menu bar, after I press on a checkbox item, so I can do multiple things like delete..</p> <p>I've taken this idea from the <a href="http://en.wikipedia.org/wiki/Android_%28operating_system%29" rel="nofollow">Android</a> videos:Google I/O 2009 -...Interaction &amp; Visual Design with Android (link: <a href="http://developer.android.com/videos/index.html#v=wdGHySpipyA" rel="nofollow">http://developer.android.com/videos/index.html#v=wdGHySpipyA</a>) , the 25:58 min.</p> <p>Here is a screen shot I've made: <a href="http://photos-c.ak.fbcdn.net/hphotos-ak-snc3/hs196.snc3/20366_322904078985_613608985_4870141_6451460_n.jpg" rel="nofollow">http://photos-c.ak.fbcdn.net/hphotos-ak-snc3/hs196.snc3/20366_322904078985_613608985_4870141_6451460_n.jpg</a></p> <p>If anyone know about any tutorial, or article it will be fully estimated!</p>
android
[4]
5,785,384
5,785,385
Error in formatting the POST URL,because of spaces inside the parameter
<p>Hi All I am building an URL which is stored as varible to be available for a tab on clicking as below.</p> <p>The parmeters of the URL are some constants and strings. So in one param the user has entered in the Textarea coulmn as</p> <pre><code>This is to be removed immediately </code></pre> <p>and so on build of URL the browser is throwing 'unterminated string literal'</p> <p>Below is the URL as seen in 'view source'</p> <pre><code>&lt;script type="text/javascript"&gt;var tab3700Action = "/PM/action/showTaskCompletionStatus?preventSTIES= &amp;deadlinedate=4/22/2005&amp;date=4/21/2005&amp;orggroup=27&amp;effectivedate=4/22/2005&amp;taskid=2 &amp;comments=This is to be removed immediately&amp;selected_taskid=2&amp;orgfilterDISP=&amp;taskname=Recall Meat &amp;equation=&amp;tasktypeid=283&amp;successRedirectAction=showTaskCompletionSummary &amp;estimatedduration=2:00&amp;org=545"; &lt;/script&gt; </code></pre>
javascript
[3]
3,731,822
3,731,823
working with dropdown controls
<p>i have dropdown controls in my application namely ddlmonth and ddlday respectively and i added months(january,february ect in ddlmonth) and days added to ddldays(1,2,.....31) when i run my page i display current month and date this is my code </p> <pre><code> public void getMonth() { ddlmonth.SelectedIndex = DateTime.Now.Month -1; ddldate.SelectedIndex = DateTime.Now.Day - 1; } </code></pre> <p>and i place this in page load even. like this</p> <pre><code>protected void Page_Load(object sender, EventArgs e){ getMonth(); } </code></pre> <p>it is working fine, but when i keep getMonth() in ispostback it is not displaying current month and day.</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if(!isPostback) { getMonth(); } } </code></pre> <p>present i place without ispostback in pageload when i select ddlmonth (dropdown) diffent month and ddlday(dropdwon) diffent day (not current month and day) when i press button in database it is inserting current month and day, actually i select diffent month and day and this is my code.</p> <pre><code> protected void btnEvent_Click(object sender, EventArgs e){ clsevents.Month = ddlmonth.SelectedValue.ToString(); clsevents.Day = ddldate.SelectedValue.ToString(); } </code></pre> <p>but in database it is inserting current mont and day when i select diffent mont and day in ddlmont(dropdwon) and ddlday please help me some one.</p>
asp.net
[9]
5,195,554
5,195,555
i want to know what i need to create simple game 3D game?
<p>This is only worry!</p> <p>First question: I want to give a example Mario (simple or more simple). What we need create game similar to mario with java? And What i need for 3D games? </p> <p>Second question: Java have a swing library but i think this is not enough. <br/> Can we create web browser but web browser's scene must like firefox or internet explorer etc. ?</p>
java
[1]
1,837,676
1,837,677
Remove "empty" paragraphs with jQuery
<p>My writers have a bad habit of creating empty paragraphs. (I.e., paragraphs that have nothing inside them, like: </p> <pre><code>&lt;p&gt;&lt;/p&gt; </code></pre> <p>Is there a jQuery function that removes "empty" paragraphs. Here's what I've tried: </p> <pre><code>$('p').remove(":contains(' ')"); // nope! bad logic, all p's have empty spaces $("p:empty").remove() // nope, doesn't work, doesn't remove any p's </code></pre> <p>Anything else I should try? </p>
jquery
[5]
2,272,623
2,272,624
Programming for specific Android versions
<p>I have a question concerning Android programming. I intend to programm an application for Androiod 2.2 and above (including tablets). Problem, I am facing, is, that various version have different API news, e.g. Download Manager is fully implemented for the first time in 2.3, in 2.2 I have to programm it manually. I am thinking of building my app from modules, where each of them would be for particular Android OS version. You can imagine it as main app and depending on actual OS, it triggers Android 2.3 API Download Manager or (in case of 2.2) it starts my custom download manager, I have made. </p> <p>Problem is, how to solve it in code? Because, when I enter to my 2.2 project .java file with Download manager import and code with it's usage, I cannot build application. I have found DexClassLoader solution, where I install only core of an app and other "modules" I will read from external sources depending on API level of current device. It sounds to me like "dirty" approach, isn't there anything "cleaner" how to solve particular pieces of code, which differs according to API level?</p> <p>Thank ya</p>
android
[4]
3,421,506
3,421,507
Error received when updating the SDK with the SDK Manager
<p>I'm completely frustrated with the Android SDK Manager.</p> <p>I'm running Win 7 Home edition and have the SDK installed in its own top level directory on my D:\ drive. </p> <p>When I run SDK Setup.exe from the command line (and I've even opened the prompt as an administrator), I get an error when trying to update the packages.</p> <p>The SDK manager is telling me that I need to install the SDK Tools rev 7. But when I accept the license, I get an error message stating:</p> <p>"A folder failed to be renamed or removed" yada yada yada. The Installing Archives window says "Failed to rename directory D:\android-sdk-windows\tools to D:\android-sdk-windows\temp\ToolPackage.old01."</p> <p>I looked here for help: </p> <p><a href="http://groups.google.com/group/android-developers/browse_thread/thread/4b784f3eb1e096fd/ecadfb28ce5daf5f?lnk=gst&amp;q=cannot+rename+folder#ecadfb28ce5daf5f">http://groups.google.com/group/android-developers/browse_thread/thread/4b784f3eb1e096fd/ecadfb28ce5daf5f?lnk=gst&amp;q=cannot+rename+folder#ecadfb28ce5daf5f</a></p> <p>but the content there didn't help.</p> <ol> <li><p>I DO have my antivirus (AVG) disabled.</p></li> <li><p>I DO NOT have any other programs running -- just the command prompt to launch the SDK Manager.</p></li> <li><p>I have even given the everyone group, for the D:\android-sdk-windows\ folder, full control.</p></li> <li><p>I tried to rename the tools directory before starting the SDK Manager but then I get an error that a batch file cannot be found when I try to launch SDK Setup.exe. Grrrr.</p></li> </ol> <p>None of this works.</p> <p>Suggestions how to get the package to update without error are greatly appreciated.</p> <p>Thanks!</p>
android
[4]
5,800,673
5,800,674
long press event in grid view in android
<p>I am using gridview in my android project to show images. I use 15 columns in gridview to show 20x20 small image. I want to show animation on long press event on gridview item. When i press any image in gridview then similar big image show on screen on same position. </p>
android
[4]
2,652,736
2,652,737
How to call an Activity in Android
<p>I have the following scenario. I have 2 packages in my application. com.example.package1; org.otherexample.package2;</p> <p>I declare in manifest like this:</p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.package1" android:versionCode="1" android:versionName="1.0" &gt; &lt;activity android:name=".ActivityfromPackage1"/&gt; &lt;activity android:name="org.otherexample.package2.ActivityFromPackage2"/&gt; &lt;/manifest&gt; </code></pre> <p>This being the manifest, now I want to Call From ActivityFromPackage1 ActivityFromPackage2 I've done like this:</p> <pre><code>import org.otherexample.package2.ActivityFromPackage2 .......... Intent intent = new Intent(this,ActivityFromPackage2.class); startActivity(intent); </code></pre> <p>I receive following error:</p> <pre><code>Unable to start Activity com.example.package1/org.otherexample.package2.ActivityFromPackage2: JavaLang nullpointer exception </code></pre> <p>How to call the Activity? Thanks a lot.</p>
android
[4]
1,046,627
1,046,628
Purpose of char in java
<p>I'm seeing both char and short are two bytes each, also the following is valid:</p> <pre><code>char a = 'x'; int b = a; long c = a; </code></pre> <p>However when I do short d = a; I'm getting an error that cannot convert from char to short. even though both are two bytes.</p> <p>One use of char I can see is when you print it, it displays the character. Is that the only use of char?</p>
java
[1]
1,870,275
1,870,276
Is it bad form to return Arrays in C#? Should I return List<T>?
<p>I have a function which returns a variable number of elements, should I return an array or a List? The "collection's" size does not change once returned, ie for all purposes the collection is immutable. I would think to just return an array, but some people have said to not return variable sized arrays from a function as it is "poor form". Not sure why?</p> <p>Does it matter that this needs to be .NET 2.0 compliant?</p>
c#
[0]
2,694,995
2,694,996
Controller wrapping in panel
<p>I have a panel with buttons. my buttons are create dynamically. I want to have 4 rows with 4 buttons each. but I only get one row.</p> <pre><code> foreach (CategoriesDataSet.CategoriesRow category in DataRepository.Categories.Categories) { if (!category.CategoryName.Equals("ROOT")) { SimpleButton button = new SimpleButton(); button.Text = category.CategoryName; button.Tag = category.CategoryId; button.Size = new Size(82, 70); if (lastButton != null) button.Left = lastButton.Right + 1; lastButton = button; button.Click += CategoryButtonClick; categoriesPanel.Controls.Add(button); } } </code></pre> <p>Desired result : </p> <pre><code>x x x x X x x x x x x x </code></pre>
c#
[0]
833,655
833,656
Using PHP force download for all files
<p>My question is, is there a way to use the header download PHP method for all files type;</p> <pre><code> &lt;?php $fileid = $_GET['fid']; $filename = $_GET['fn']; $auth_code = $_GET['dlauth']; $folder = $_GET['fi']; echo $file = $folder."/".$filename; if (empty($fileid) || empty($filename) || empty($auth_code) || empty($folder)) { echo "Malformed ID, please go back and try to download again"; } else { if (strlen($auth_code) &gt; 25) { echo "Download session has expired or is malforned"; } else { header("Content-Disposition: attachment; filename=$filename"); header('Content-Length: ' . filesize($file)); header("Pragma: no-cache"); header("Expires: 0"); readfile($file); } } ?&gt; </code></pre> <p>Because this downloads zipped files etc, perfectly fine. However when it comes to anything else, it just corrupts.</p> <p>Anyone got any clues without using switch statements to detirmine the content type with file extensions.</p> <p>Thanks!</p>
php
[2]
5,275,686
5,275,687
How to write message to client from server
<p>for example,in a website or software on the pc,you could write some news or other things,and then it will update in your android</p> <p>is there any example of this,or tutorial related about it</p>
android
[4]
5,164,133
5,164,134
PHP include practices
<p>Does anyone here know when PHP executes include and include_once calls?</p> <p>I'm wondering because I come from a Flash and Desktop development background where you have to import your classes at the beginning of each class.</p> <p>But now that I am starting to build more complex PHP code, it seems like it would be better to just include classes when I actually need them to save on loading time. For example, look at the following psuedo code:</p> <pre><code>if (I_need_to_check_login) { include_once "Class.class.php"; $C = new Class(); } </code></pre> <p>If I do this, is the file Class.class.php going to be included everytime the code is run or only when I execute the include_once.</p> <p>I'm a bit of a Class freak and usually build a class for just about any functionality used by my apps, so I often have lots of class files.</p> <p>take care, lee</p>
php
[2]
791,147
791,148
forse close when click button for open google map
<p>in my app when i click the button it opens a Google map it is running well when i open it in android emulator and when i install this application on my device after making .apk folder it install successful and also other functions are going well but when i click button of open Google map it force close.. <strong>is api key should be registered for using in mobile???</strong></p> <p>my manifest file are given beow</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.androidpeople.tab" android:versionCode="1" android:versionName="1.0"&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable= "true"&gt; &lt;uses-library android:name="com.google.android.maps" /&gt; &lt;activity android:name=".SplashScreen" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; </code></pre> <p> </p>
android
[4]
4,545,849
4,545,850
A very simple error in subtraction program
<p>I am facing a very simple error in the following program at the last print statement. But I dont know the exact reason behind it. Even the logic is correct and syntax too.</p> <p>Please let me know the exact reason for the error.</p> <p>Thanks</p> <pre><code>import java.util.Scanner; public class main { public static void main(String args[]) { int c,d; Scanner s = new Scanner(System.in); System.out.print("Enter the first number : "); c = s.nextInt(); System.out.print("Enter the second number : "); d = s.nextInt(); System.out.println("The sub is : "+ c-d); } } </code></pre>
java
[1]
1,044,769
1,044,770
Why is my jQuery generated dropdown not posting back the selected value?
<p>I think I'm missing something simple, but I'm just not seeing it. I have an ASP.NET MVC app that is dynamically building a dropdown based on the value of another dropdown. The dropdown list is being populated correctly but when the form posts back the value of the combo isn't posted back for some reason. </p> <pre><code> $(document).ready(function () { PopulateList(); $("#List").change(GetSelectedItem); }); function PopulateList() { var timeSlot = $("#Timeslot").val(); var options = []; var list = 0; $.getJSON("GetList/" + timeSlot, "", function (data, textStatus) { for (var i = 0; i &lt; data.length; i++) { options.push('&lt;option value="', data[i].ID, '"&gt;', data[i].Name, '&lt;/option&gt;'); } $("#List").html(options.join('')); if (data.length &gt; 0) list = data[0].ID; GetSelectedItem(timeSlot, list); }); </code></pre> <p>Further down in the view I have this:</p> <pre><code>&lt;% Html.BeginForm(); %&gt; &lt;select id="List" style="width:120px"&gt;&lt;/select&gt; (lots of HTML removed) &lt;% Html.EndForm(); %&gt; </code></pre> <p>I've double-checked the markup generated by displaying $("#List").html() and it looks OK. I've also checked to make sure the dropdown is enclosed in the form and that there isn't any other unterminated strings around this dropdown that might be interferring with it. I can check the value of the dynamically built dropdown and the value is set correctly. I've watched was is being posted back via Fiddler and Firebug and this field is missing (so it's not MVC filtering it).</p> <p>What am I missing?</p>
jquery
[5]
4,271,698
4,271,699
how do I restrict this loop to a specific number?
<p>how do I restrict this loop to get only 6 values?</p> <pre><code> $countries = array(); foreach ($my_data as $node) { foreach($node-&gt;getElementsByTagName('a') as $href) { $countries[] = strip_tags(trim($href-&gt;nodeValue)); } } </code></pre>
php
[2]
2,979,343
2,979,344
Python - 'import' or pass modules as paramaters?
<p>I was wondering if passing module objects to a class or object which requires it rather than using <code>import</code> might not be a bad idea, as it avoids hard dependencies on those modules.</p> <p>I was wondering if someone more aware of the Python Zen than I might be able to explain why this is a terrible/not terrible idea?</p>
python
[7]
2,557,095
2,557,096
Initialize MediaScanner at Beginning of Android Program
<p>I have an Android program that starts off by loading some of the user's media. Occasionally the program crashes -- both on an emulator and on an actual phone. I've found this is because sometimes media only become available to the program after the activity has been running for a while. </p> <p>When this happens, here is the order of the typical log output:</p> <ol> <li>DEBUG/MediaScanner(166): opendir /system/media/ failed, errno: 2 &lt;--PROGRAM ERROR HERE</li> <li>DEBUG/MediaScannerService(166): done scanning volume internal</li> <li>DEBUG/MediaScannerService(166): start scanning volume external</li> <li>VERBOSE/MediaProvider(166): /sdcard volume ID: 45454545</li> <li>VERBOSE/MediaProvider(166): Attached volume: external</li> <li>DEBUG/MediaScannerService(166): done scanning volume external &lt;-- THIS IS IN MIDDLE OF PROGRAM</li> </ol> <p>The program has an error at #1 because it tried to load media that wasn't available until #6.</p> <p>Is there any way to force Android to finish the MediaScannerService at the beginning of the program?</p> <p>Alternatively, is there any way to check when the MediaScannerService has finished scanning?</p> <p>Thank you.</p>
android
[4]
1,040,419
1,040,420
stripping the << tag for c++ in php
<p>I want to keep <code>&lt;&lt;</code> tag in string but because of strip_tags, it is also removed from string.</p> <pre><code>$str = "#include&lt;iostream&gt; using namespace std;int main () { int a, b=3; a = b; a-=10; cout&lt;&lt; a; return 0; }"; $newtext = htmlspecialchars((strip_tags(($str),'&lt;iostream&gt;,&lt;'))); echo "&lt;br&gt;" . $newtext; </code></pre> <p>Output:</p> <pre><code>-#include&lt;iostream&gt; using namespace std;int main () { int a, b=3; a = b; a-=10; cout </code></pre> <p>Suggest me solution.</p>
php
[2]
4,744,748
4,744,749
splash screen gets error when going to the main activity
<p>My splash screen gets error and it is going to force close the app. in Logcat is says Permission Denied. What should i do to fix this problem. Can anyone help me with that matter, Thanks a lot</p> <pre><code>import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.MotionEvent; public class SplashScreen extends Activity { protected boolean _active = true; protected int _splashTime = 4000; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); // thread for displaying the SplashScreen Thread splashTread = new Thread() { @Override public void run() { try { int waited = 0; while(_active &amp;&amp; (waited &lt; _splashTime)) { sleep(100); if(_active) { waited += 100; } } } catch(InterruptedException e) { // do nothing } finally { finish(); startActivity(new Intent("com.droidnova.android.splashscreen.BodyPartsGameActivity")); stop(); } } }; splashTread.start(); } @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { _active = false; } return true; } } </code></pre>
android
[4]
2,057,135
2,057,136
How do I get rid of the "u" from a decoded JSON object?
<p>I have a dictionary of dictionaries in Python:</p> <pre><code>d = {"a11y_firesafety.html":{"lang:hi": {"div1": "http://a11y.in/a11y/idea/a11y_firesafety.html:hi"}, "lang:kn": {"div1": "http://a11y.in/a11ypi/idea/a11y_firesafety.html:kn}}} </code></pre> <p>I have this in a JSON file and I encoded it using <code>json.dumps()</code>. Now when I decode it using <code>json.loads()</code> in Python I get a result like this:</p> <pre><code>temp = {u'a11y_firesafety.html': {u'lang:hi': {u'div1': u'http://a11y.in/a11ypi/idea/a11y_firesafety.html:hi'}, u'lang:kn': {u'div1': u'http://a11y.in/a11ypi/idea/a11y_firesafety.html:kn'}}} </code></pre> <p>My problem is with the "u" which signifies the Unicode encoding in front of every item in my temp (dictionary of dictionaries). How to get rid of that "u"?</p>
python
[7]
919,369
919,370
iPhone-SDK:Thumbnail images in iPhone view controller view
<p>I have 8 images in my project which has 320 * 480 pixels(full screen image). I need to show all the images in thumbnail format in a view (same like how we see in built-in Cameral Roll). When user selects one, it should display that image with the same actual size (320 * 480) as background of my first view.</p> <p>May i know how to achieve this? Could someone please help me on this?</p> <p>thank you.</p> <p>Anyone Please?</p> <p>Priya.</p>
iphone
[8]