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
3,569,541
3,569,542
How to make sure that recently created area points to NULL?
<p>How can I make sure that, for each allocated new space on heap area, the recently created element of vector of pointers points to NULL ?</p> <pre><code> Ex: vector &lt; Sometype* &gt; vector ---------------------- | | | | ... | ---------------------- new element is pushed back but no available area so double space index x x+1 y vector ------------------------------------------- | | | | ... | | | ... | ------------------------------------------- ^^^^^^^^^^^^^^^^^^^^^ recently created x, x+1, ... y all points to the NULL </code></pre> <p>I want each space on recently created part point to NULL ? </p>
c++
[6]
3,130,569
3,130,570
Android format data
<p>I have a textView in the layout. The data I am displaying is a huge text with "tabs" in them. I would like to diaplay it in readable format. How do I format that in android ? Is that a right direction or it can be formatted using something else... </p>
android
[4]
3,797,397
3,797,398
XML parser for 4.0.3 version is not displaying images which is working in 2.1
<p>I have done a app by using DOM parser its working fine for me 2.1 and 2.2 .But I cann't get the value from service with 4.0.3 . so please suggest anything you may feel like.</p> <pre><code>NodeList thumbNodeList=imgElement.getElementsByTagName(Key_Bike_thumbnail); Element thumbElement = (Element)thumbNodeList.item(0); ArrayList&lt;String&gt; thumnbnailImages=new ArrayList&lt;String&gt;(); NodeList thumbImageElement=thumbElement.getElementsByTagName("image"); Log.i("thumbImageElement list name",""+thumbImageElement.toString()); Log.i("thumbImageElement values",""+thumbImageElement.getLength()); for(int i=0;i&lt;thumbImageElement.getLength();i++){ Element imagElement = (Element)thumbImageElement.item(i); Log.i("element list name"," "+imagElement.toString()); String images =getTextValue(imagElement,"image"); bikeDetailsResultIdentifier.setThumbnails(images); thumnbnailImages.add(images); System.out.println("Thumbnail images "+ bikeDetailsResultIdentifier.getThumbnails()); System.out.println("Thumbnail images "+images); } bikeDetailsResultIdentifier.setThumbnailImages(thumnbnailImages); MY Xml : &lt;images&gt; &lt;thumbnails&gt; &lt;image&gt;http://www.1000ps.at//images/gebrauchtmotorrad/g_811067.jpg&lt;/image&gt; &lt;image&gt;http://www.1000ps.at//images/gebrauchtmotorrad/g_811067_2.jpg&lt;/image&gt; &lt;/thumbnails&gt;&lt;/images&gt; </code></pre>
android
[4]
1,639,174
1,639,175
PHP Warning: preg_match() expects & PHP Warning: strip_tags()
<p>I got this error log, do you know what is this and how can i fix this?</p> <pre><code>[31-Jan-2013 22:01:25 UTC] PHP Warning: preg_match() expects parameter 2 to be string, array given in /home/xxx/public_html/wp-includes/formatting.php on line 608 [31-Jan-2013 22:01:25 UTC] PHP Warning: strip_tags() expects parameter 1 to be string, array given in /home/xxx/public_html/wp-includes/formatting.php on line 968 </code></pre>
php
[2]
1,451,736
1,451,737
C++ syntax question, use of the class keyword
<p>Can any one explain "class X x;" what actually it mean ...in the program...Please give me some example also? Ex:</p> <pre><code>#include &lt;iostream&gt; using namespace std; class X { public: X() {} }; class Y { public: Y() {} }; int main() { class X x; //what is this? explain it class Y y; //what is this? explain it class Z z; //what is this? explain it //error return 0; } </code></pre> <p>Edited: May i know the exact difference between "Class Z z" and "Z z".Because While compiling this program in 2 ways</p> <pre><code> class Z Z; //here iam getting as Error: error: incomplete type is not allowed Z z; //error: identifier "Z" is undefined </code></pre> <p>Since iam asking the exact difference.</p>
c++
[6]
3,965,666
3,965,667
Simplify this PHP?
<p>I was copy/pasting some PHP to get the outcome I wanted but I believe this could be simplified in a much better way. Could any developers help a designer out?</p> <pre><code>&lt;?php $url = dirname(__FILE__); $id = substr( $url, strrpos( $url, '/' )+1 ); echo '&lt;img src="../i/'; echo $id; echo '.png" alt="'; echo $id; echo '" /&gt;'; ?&gt; </code></pre> <p><strong>Result:</strong> <code>&lt;img src="(name of $id)" alt="(name of $id)" /&gt;</code></p>
php
[2]
576,897
576,898
Remove all elements with specific class from a span element
<p>HTML:</p> <pre><code>&lt;script src="../../Scripts/notificator.js" type="text/javascript"&gt;&lt;/script&gt; &lt;span id="popUpMessageBoard"/&gt; &lt;button onclick="success('message', 'popUpMessageBoard')"&gt;Add&lt;/button&gt; &lt;button onclick="remove('popUpMessageBoard')"&gt;Remove&lt;/button&gt; </code></pre> <p>javascript:</p> <pre><code>success = function (messageToApply, elementIdToApplyMessages) { $('#' + elementIdToApplyMessages).append('&lt;strong class="notification" style="color:blue"&gt;' + messageToApply + ' &lt;/strong&gt;'); }; remove = function (elementId) { $('#' + elementId).remove('.notification'); } </code></pre> <p>The <code>Add button</code> appends elements to the <code>popUpMessageBoard span element</code>. On clicking the delete button I want all elements with the <code>.notification class</code> to be removed from the parent span element. What am I missing ?</p>
jquery
[5]
5,050,424
5,050,425
jQuery Error - Option/Value selected from Drop-Down List
<p>I have code which has a drop down list. And when a certain option of the drop-down list is selected, its assigned DIV is shown with the other div's hidden. If another option is selected, then the existing DIV is hidden and its assigned div is shown.</p> <p>But, the div's being shown/hidden isn't working properly.</p> <p>Firebug reports the following (arrow points to the '$'):</p> <pre><code>missing ( before switch expression [Break On This Error] switch $(this).val(){ </code></pre> <p>Below is the jQuery code:</p> <pre><code>$('#ddlOptions').change(function(){ $('div.Results').hide(); switch $(this).val(){ case '1': $('#divResults1').show();break; case '2': $('#divResults2').show();break; case '3': $('#divResults3').show();break; } }); </code></pre>
jquery
[5]
3,661,284
3,661,285
My background image got distorted if my app is run on small screen or when emulator at run time is set to lanscape mod
<p>I have already tried by placing my images in hdpi mdpi and ldpi, so please give some effective answer i am in the mid of my project so please give me answer as soon as.</p>
android
[4]
5,482,353
5,482,354
How to change current the language?
<pre><code>defs = [NSUserDefaults standardUserDefaults]; languages=[[NSMutableArray alloc]init]; languages= [defs objectForKey:@"AppleLanguages"]; NSString* preferredLang = [languages objectAtIndex:14]; NSString *chn=@"zh-Hans"; NSString *eng=@"en"; [languages replaceObjectAtIndex:0 withObject:chn]; [languages replaceObjectAtIndex:14 withObject:eng]; defs=(NSUserDefaults*)languages; </code></pre> <p>And I can change the content of NSUserDefaults defs. But it doesn't have an effect on applelanguage. Can anyone help me? I need to store the first object of defs as the current language.</p>
iphone
[8]
3,151,697
3,151,698
PHP Array compare using loops
<p>I am using this piece of code to compare two php arrays, I got all matched items rightly but unfortunately i am not succeeding in getting non matched items. Here is my code.</p> <pre><code>&lt;?php $filter1 = "blueberries,abc,cornstarch,sugar"; $cval = strtoupper($filter1); $parts1 = explode(',',$cval); $filter2 = "water,blueberries,sugar,cornstarch"; $values = strtoupper($filter2); $parts2 = explode(',', $values); $m=0; $nm=0; for($i = 0; $i&lt; count($parts1); $i++) { for($j = 0; $j&lt; count($parts2); $j++) { if($parts1[$i] == $parts2[$j]) { $m++; $p[] = $parts1[$i]; } else{ $nm++; $q[] = $parts1[$i]; } } } echo $m; echo "&lt;br /&gt;"; echo $nm; echo "&lt;br /&gt;"; print_r($p); echo "&lt;br /&gt;"; print_r($q); ?&gt; </code></pre> <p>Can someone help me sorting out this problem, As i <strong>dont want to use builtin array comparison functions.</strong> </p>
php
[2]
5,383,796
5,383,797
Embed an image in response to be opened by Excel
<p>I created an HTML table with an image spanning a few cells (first portion) then attempt to export that image to excel (second portion (ExportReport Method)). I currently have two lines which show the image, both work fine in the HTML table. The commented out portion shows as a red X when exported to excel, the non-commented out line shows the image in Excel however the image is floating and not cemented into an Excel cell. </p> <p>I would like to know what I'm missing in order to get the image to show in the Excel export while having that image cemented in a cell (not being able to drag it all over the report.)</p> <pre><code>//Create Table Table tbl = new Table(); TableRow tr; TableCell tc; tc = new TableCell(); tr = new TableRow(); //tc.Text = "&lt;center&gt;&lt;imj src=\"images/logo_PROD.gif\" alt=\"Logo\" /&gt;&lt;/center&gt;"; tc.Text = "&lt;center&gt;&lt;imj src=\"http://chwf1/portalsite/images/logo_PROD.gif\" alt=\"Logo\" /&gt;&lt;/center&gt;"; tc.ColumnSpan = 3; tr.Cells.Add(tc); tbl.Rows.Add(tr); //Export Table public static void ExportReport(string fileName, Table table) { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader( "content-disposition", string.Format("attachment; filename={0}", fileName)); HttpContext.Current.Response.ContentType = "application/ms-excel"; using (StringWriter sw = new StringWriter()) { using (HtmlTextWriter htw = new HtmlTextWriter(sw)) { table.RenderControl(htw); HttpContext.Current.Response.Write(sw.ToString()); HttpContext.Current.Response.End(); } } } </code></pre>
c#
[0]
3,649,419
3,649,420
How to view the request from android client?
<p>i am a .net developer,one android developer use my webservice,he pass the request and get response from my weservice.But ,How to view the request ??advance thanks..</p>
asp.net
[9]
4,276,606
4,276,607
PHP redirecting with custom headers
<p>I'm pretty sure this isn't possible and I need to set headers on login.php <code>if $_GET['reason']</code> isset but can someone clarify that I can't set response code then change location?</p> <pre><code>header('HTTP/1.1 403 Forbidden'); header("Location: http://domain.com/login.php?reason=ipbanned"); </code></pre>
php
[2]
286,462
286,463
gridview formatting
<p>Can anybody help on this?</p> <p>I have a grid populated with data from Database.Now to format the grid,I want some columns text alone to made Center(text alignment).How to do this dynamically?</p>
c#
[0]
1,556,661
1,556,662
Launch Event Only Once Every 60 Seconds (JavaScript)
<p>I have a video that is 60 seconds long. I am working on adding some JavaScript to send data from my video player to Google Analytics. What I am looking to do is to launch an event no more than once every 60 seconds for a range of time.</p> <p>So for example, a user watches 21 to 40 seconds into a video, I want only one event launched (rather then 19 times for the 19 seconds of time). Then the user watches 41 to 60 seconds into the video, I want only one event launched. I actually have figured this part out already.</p> <p><strong>The problem is when it comes to time.</strong> So if a user watches the 21 to 40 seconds it launches an event. They watch the rest of the video and mentally process it and decide "hey I want to watch the video again". If they watch the video again, that one event at 21 to 40 seconds won't launch again unless they refresh the page.</p> <p>How can I edit my script so an event is launched only once every 60 seconds for a specific range?</p> <pre><code>&lt;script type="text/javascript"&gt; function Follow( minimum, maximum ) { this.min = minimum; this.max = maximum; this.done = false; } var following = [ new Follow( 1, 20 ), new Follow( 21, 40 ), new Follow( 41, 60 ) ]; player().Time( function(event) { var gone = Number(event.secondspassed); for ( var t = 0; t &lt; following.length; ++t ) { var Follow = following[t]; if ( gone &gt;= Follow.min &amp;&amp; gone &lt; Follow.max ) { if ( ! Follow.done ) { var range = Follow.min + " Seconds Watched "; _gaq.push(['_trackEvent', range, 'Play', 'Title']); Follow.done = true; } break; } } } ); &lt;/script&gt; </code></pre>
javascript
[3]
1,242,001
1,242,002
Can my asp.net application make a call to a linux server, speficially some shell script?
<p>If I have a asp.net web app on a windows box (obviously!), and I need to execute a shell script that is on a linux server, is that possible?</p> <p>How can I do this safely?</p>
asp.net
[9]
4,584,976
4,584,977
How to check if Handler has an active task?
<p>If I have a <code>Handler handler = new Handler()</code> and run a delayed task for it <code>handler.postDelayed(xxx, xxx)</code>, is that possible to check has the <code>postDelayed()</code> was called or not?</p>
android
[4]
4,509,492
4,509,493
Is there any advantage to define function name in "var new_function = function name(){};" in javascript?
<p>I was running a program to change some parts of my javascript code when it bugged in the declaration of a var as a function like this:</p> <pre><code>var some_function = function name(args){ //do stuff }; </code></pre> <p>The code itself works, but I was just wondering if it's ok to remove the "name" for all functions that i find like this (for it doesn't break it in the other problem that analyzes my javascript) or if it could be any use for it that I can't see.</p> <p>removing the "name":</p> <pre><code>var new_function = function(){/*do stuff*/}; </code></pre> <p>Note: the original file where it first happen it was in <a href="http://code.jquery.com/jquery-1.6.4.js" rel="nofollow">jquery-1.6.4.js</a> in:</p> <pre><code>jQuerySub.fn.init = function init( selector, context ) { if ( context &amp;&amp; context instanceof jQuery &amp;&amp; !(context instanceof jQuerySub) ) { context = jQuerySub( context ); } return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); }; </code></pre> <p>ty for any help in advance :)</p>
javascript
[3]
4,909,579
4,909,580
Lost client side javascript validation
<p>I seems to have lost my client side validation and I'm not sure why. I'm loading these and the server side it working fine. I'm using Ajax.BeginForm with the TextBoxFor in the form. Is this ehough to tell what might be going on?</p> <pre><code>&lt;script src="@Url.Content("~/scripts/jquery-1.4.4.min.js")" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <pre><code>&lt;script src="@Url.Content("~/Scripts/jquery.blockUI.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jqury.unobtrusive-ajax.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="&lt;@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"&gt;&lt;/script&gt; </code></pre>
javascript
[3]
5,028,611
5,028,612
How to start application as par fix time in android mobile phone
<pre><code> I have to make one application which is start in android phone as par user given </code></pre> <p>time automatically.</p> <pre><code> If is there any intent which i used my application to start it by user given time. </code></pre>
android
[4]
791,706
791,707
String to byte conversion
<p>How can I convert a string to byte? For example, <code>Byte.parseByte("255");</code> causes <code>NumberFormatException</code> since (for some weird reason) <code>byte</code> is <code>signed</code> in java so the maximum value it can have is <code>127</code>.</p> <p>So I need a function such that </p> <pre><code>public static byte toByte(String input) { ... } </code></pre> <p>And for example <code>toByte("255");</code> should return <code>-1</code>(ie bits: 11111111)</p> <p>Something like implementation of <a href="http://en.wikipedia.org/wiki/Two%27s_complement" rel="nofollow">2s complement</a></p>
java
[1]
2,966,186
2,966,187
JQuery - show multiple select boxes on clicking a link
<p>I have written a small function in JQuery, took me a little while but I got there. You click a link and a dropdown shows. But I need to click the link and show the dropdown, but upon clicking it again I want the same dropdown again, up to a maximum or 4.</p> <p>Now I'm stuck with this a bit, this is how far I got.</p> <p>HTML:</p> <pre><code>&lt;a class="toggle" href="#"&gt;Add another Location&lt;/a&gt; </code></pre> <p>insert more locations dropdownbox​</p> <p>JQuery:</p> <pre><code>$(function() { $("a.toggle").click(function(e) { $(this).next().toggle(); e.preventDefault(); }); });​ </code></pre> <p>CSS:</p> <pre><code>.toggleDiv { display: none; } .toggle { font: 14px black Tahoma; } </code></pre> <p>Can anyone point in the right direction. My JSFiddle is here:</p> <p><a href="http://jsfiddle.net/Painstar/bkVNk/" rel="nofollow">http://jsfiddle.net/Painstar/bkVNk/</a></p> <p>Thanks!</p> <p>​</p>
jquery
[5]
5,871,792
5,871,793
Using this to change value within a nested function ($.get)
<p>I'm trying to use jQuery to change the value of <code>button.kill</code>. However I don't know how to access button.kill from within the get callback.</p> <pre><code>$("button.kill").click(function(){ $.get("file.php",{ nbRandom: Math.random() }, function(data){ //set button.kill text to data }); }); </code></pre> <p>There will be more than one button named kill and I want to ensure that I only update the one that the user has clicked.</p> <p>Any pointers?</p>
jquery
[5]
5,801,229
5,801,230
replacing letters of a given word in java
<p>I have problem in the following program- "Reverse all the letters of any sentence. Input- This is a cat Output will be- tac a si siht"</p> <p>what will be the java code of this program..anyone can help me pls?</p>
java
[1]
3,194,226
3,194,227
an issue about Admob
<p>I just want to ask that is <code>setGoneWithoutAd()</code> function available in Android. I tried to use it but it showed:</p> <pre><code>The method setGoneWithoutAd(Boolean) is undefined for the Type AdView </code></pre> <p>Please help if you had experienced it before.</p>
android
[4]
5,484,782
5,484,783
How to convert chained static class names and a property value to a string?
<p><strong>Context:</strong> Suppose one has the following class structure:</p> <pre><code>public static class SomeStaticClass { public static class SomeInnerStaticClass { public static readonly string SomeProperty = "someStringValue"; } } </code></pre> <p><strong>Question:</strong></p> <p>Is there an easy way to convert the reference <code>SomeStaticClass.SomeInnerStaticClass.SomeProperty</code> to string value of "SomeStaticClass.SomeInnerStaticClass.someStringValue"?</p>
c#
[0]
4,966,971
4,966,972
How to subtract x amount of days from todays date
<p>I need to count back 90 days, 120 days and 160 days for a few items. How would I code this? I keep finding java code but that brings up errors when I am developing for android. </p> <p>I need to take todays date and subtract the x amount of days and have it result be displayed on the screen nothing else. Thanks</p>
android
[4]
5,411,270
5,411,271
Passing a qualified non-static member function as a function pointer
<p>I have a function in an external library that I cannot change with the following signature:</p> <pre><code>void registerResizeCallback(void (*)(int, int)) </code></pre> <p>I want to pass in a member function as the callback, as my callback needs to modify instance variables.</p> <p>Obviously this isn't possible with a simple:</p> <pre><code>registerResizeCallback(&amp;Window::Resize); </code></pre> <p>so I'm not really sure how to solve the problem.</p>
c++
[6]
3,968,463
3,968,464
how do i get the collection of components placed on the form to change their font
<p>i want to get the collection of all components in the form and change the font through code. how to do this?</p>
c#
[0]
31,510
31,511
What is the Pythonic way to write this loop?
<pre><code>for jr in json_reports: jr['time_created'] = str(jr['time_created']) </code></pre>
python
[7]
3,812,101
3,812,102
Autocompletetextview with custom adapter and filter
<p>I am trying to set a custom arrayadapter for my autocompletetextview like this </p> <pre><code>public class AutoCompleteContactArrayAdapter extends ArrayAdapter&lt;Map&lt;String, String&gt;&gt; implements Filterable { private Context mContext; private List&lt;Map&lt;String, String&gt;&gt; mContactList; public AutoCompleteContactArrayAdapter(Context context, List&lt;Map&lt;String, String&gt;&gt; objects) { super(context, R.layout.auto_contact_list, objects); mContext = context; mContactList = objects; // TODO Auto-generated constructor stub } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.auto_contact_list, parent, false); TextView nameView = (TextView) rowView.findViewById(R.id.ccontName); TextView phoneView = (TextView) rowView.findViewById(R.id.ccontNo); TextView typeView = (TextView) rowView.findViewById(R.id.ccontType); Map&lt;String, String&gt; contactMap = mContactList.get(position); nameView.setText(contactMap.get("name")); phoneView.setText(contactMap.get("phone")); typeView.setText(contactMap.get("type")); return rowView; } @Override public Filter getFilter() { return new Filter() { @Override protected void publishResults(CharSequence constraint, FilterResults results) { if (results.count &gt; 0) { notifyDataSetChanged(); } else { notifyDataSetInvalidated(); } } @Override protected FilterResults performFiltering(CharSequence constraint) { ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;(); result.add("test"); result.add("another"); result.add("last"); FilterResults r = new FilterResults(); r.values = result; r.count = result.size(); return r; } }; } } </code></pre> <p>In debug the application is entering the filter methods both publishResults and performFiltering but the result set that is being displayed is not my test array [test,another,last] instead it just shows all the results ignoring my filter</p>
android
[4]
592,259
592,260
Selecting java Automation testing tools for web application
<p>I am new to java web automation testing, I wanted to test functionality testing, please any one can suggest me to select from tools this site and good features <a href="http://java-source.net/open-source/web-testing-tools" rel="nofollow">http://java-source.net/open-source/web-testing-tools</a></p>
java
[1]
5,589,160
5,589,161
Compare different length char arrays in c++ without string library
<p>I have 2 char arrays, one with length 50, other whose length varies from 1...50. I need to compare these.</p> <p>The problem is, that the array containing 50 chars, usually contains less chars, but when comparing, it also takes them into account. So if I have 2 array, whose value is <code>U2</code>, length of first will be 50, the second - 2. </p> <p>So, how do I check this, without using the standard string library? I must not use the string library, that is a prerequisite.</p>
c++
[6]
498,440
498,441
how to integrate LINQ
<p>I am working on three tier application. 1.UI 2.BUZ 3.SQL</p> <p>I want to integrate LINQ in existing application , can any body suggest what should i have to do for integration LINQ.</p> <p>Could any body send code or example for that.</p>
asp.net
[9]
4,434,053
4,434,054
How to find last day of week in iphone
<p>In my application I m using following codes to retrieve current date and day :-</p> <pre><code>NSDate *today1 = [NSDate date]; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"dd/MM/yyyy :EEEE"]; NSString *dateString11 = [dateFormat stringFromDate:today1]; NSLog(@"date: %@", dateString11); //[dateFormat release]; NSCalendar *gregorian11 = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];   NSDateComponents *components1 = [gregorian11 components:NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:today1]; [components1 setDay:([components1 day]-([components1 weekday]-1))]; NSDate *beginningOfWeek1 = [gregorian11 dateFromComponents:components1]; NSDateFormatter *dateFormat_first = [[NSDateFormatter alloc] init]; [dateFormat_first setDateFormat:@"dd/MM/yyyy :EEEE"]; NSString *dateString_first = [dateFormat_first stringFromDate:beginningOfWeek1]; NSLog(@"First_date: %@", dateString_first); [components1 setDay:([components1 day]-([components1 weekday]-1) + 6)]; now =[gregorian dateFromComponents:components1]; [format setDateFormat:@"dd/MM/yyyy :EEEE"]; dateString = [format stringFromDate:now]; NSLog(@" week Last_date: %@", dateString); </code></pre> <p>but using above code I only got the current day and Date and first day of week but I need to get last day of week. but it give wrong output plz told me where i m wrong Where I m wrong in my code and what modification is needed to get last day/date of week. Please help me out its urgent.</p>
iphone
[8]
5,723,248
5,723,249
Orientation problem
<p>I developed one application it supports both landscape and portrait.but when i launch my application from another application(Using Intents)orientation is not working(its not rotating when device changes orientation) calling application is supports one orientation(Portrait) is it possible to make my application work in both orientations even it is called from different application which won't support orientation?</p> <p>Thanks Shiv</p>
android
[4]
4,040,678
4,040,679
Subclassing UITableViewCell and make a custom cell programmatically
<p>I want to make a custom <code>UITableViewCell</code> programmatically.</p> <pre><code>- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { } return self; } </code></pre> <p>However could I make another initializer without the style-parameter? Or should I just pass nil when I am using the custom cell in the <code>UITableView-delegate</code> method? And the reuse Identifier....I do not need to set it in <code>self.reuseIdentifier = reuseIdentifier</code> because that is already done by the superclass right?</p> <p>Thanks.</p>
iphone
[8]
966,143
966,144
GET Variable Problem
<p>The table below works well. However, I am trying to pass $row["username"] along as a GET variable on the second hyperlink (the hyperlink in the second row that is class "sitename2" below). When I hover over this hyperlink, everything is blank after the "profile="... there is no $row["username"] to be passed along. Any idea why the $row["username"] is not being appended to the end of this URL?</p> <p>Thanks in advance,</p> <p>John</p> <p>EDIT: Sorry, I missed a simple mistake here. Thanks for the help... sorry for taking your time.</p> <pre><code>&lt;?php $sqlStr = "SELECT s.loginid, s.title, s.url, s.displayurl, l.username FROM submission AS s, login AS l WHERE s.loginid = l.loginid ORDER BY s.datesubmitted DESC LIMIT 10"; $result = mysql_query($sqlStr); $arr = array(); echo "&lt;table class=\"samplesrec\"&gt;"; while ($row = mysql_fetch_array($result)) { echo '&lt;tr&gt;'; echo '&lt;td class="sitename1"&gt;&lt;a href="http://www.'.$row["url"].'"&gt;'.$row["title"].'&lt;/a&gt;&lt;/td&gt;'; echo '&lt;/tr&gt;'; echo '&lt;tr&gt;'; echo '&lt;td class="sitename2"&gt;&lt;a href="http://www..../sandbox/members/index.php?profile="&gt;'.$row["username"].'&lt;/a&gt;&lt;/td&gt;'; echo '&lt;/tr&gt;'; } echo "&lt;/table&gt;"; ?&gt; </code></pre>
php
[2]
5,025,134
5,025,135
A function that will loop through span class and add text at the end
<p>I'm trying to do a function, used some pieces of other functions, to loop through the class with a specific name using JS and adding a '*' at the end of whatever is inside those HTML tags. It's not working perfectly, so what do I need to change? The class name is "price".</p> <pre><code>function insertAfter(referenceNode, newNode) { referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); } function getValues(objName) { var arr = new Array(); var el = document.createElement("span"); el.innerHTML = "*"; arr = document.getElementsByClassName(objName); for(var i = 0; i &lt; arr.length; i++) { var obj = document.getElementsByClassName(objName).item(i); insertAfter(obj, el) } }; getValues("price"); </code></pre>
javascript
[3]
1,840,874
1,840,875
ProcessStartInfo.WindowStyle c#
<p>I use the following to start one of my applications</p> <pre><code> // Start the process ProcessStartInfo startInfo = new ProcessStartInfo(this.exeName); startInfo.WindowStyle = ProcessWindowStyle.Minimized; controlProcess = System.Diagnostics.Process.Start(startInfo); </code></pre> <p>The behavior that I see is that if there are no items in my task bar, the above starts my standalone application, by using the property this.exeName to get the path of the application, and the standalone application is seen on the task bar.</p> <p>If my taskbar has only a few items, the above situation does not happen and my stand alone application is only known when i find it in the task manager, which is what i want and not the scenario described in the above para.</p> <p>Essentially, I want to start an application and keep it running without displaying its UI, more like pre-load the application, and when user clicks on certain actions, bring the application to focus and enable it so that the user can perform actions</p> <p>My sample code is from here, to see if this is a feasible solution for my own experimental project</p> <p><a href="http://www.codeproject.com/KB/miscctrl/AppControl.aspx" rel="nofollow">link text</a></p>
c#
[0]
658,251
658,252
console.log showing contents of array object
<p>I have tried using console.log so I can see the content of my array that contains multiple objects but I get an error saying console.log is not an object etc Im using jquery 1.6 and my array is like this Im using jquery 1.6.2</p> <pre><code>filters = {dvals:[{'brand':'1', 'count':'1'}, {'brand':'2', 'count':'2'}, {'brand':'3', 'count':'3'}]} console.log(filters); </code></pre> <p>What I want to todo is write out the contents of the array(filters) to a alert box(thats what I thought console.lod did) in the filters format. How do I do that.</p>
javascript
[3]
3,634,391
3,634,392
Parse error: syntax error, unexpected T_STRING in /home/a2847095/public_html/logout.php on line 7
<pre><code>&lt;?php session_start(); if (isset($_SESSION['logged-in'])) { unset($_SESSION['logged-in']); } header('Location: login.php'); ?&gt; </code></pre> <p>i am very new to php , and learning to create a simple php login/logout system everything was going smoothly until i pressed the logout button, wherein the error occurred, any help would be appreciated</p>
php
[2]
6,003,626
6,003,627
Why is the result of adding two empty arrays in JavaScript a string?
<p>Adding two empty arrays: [] + [] results in an empty string. Why?</p> <p>And any links on a collection of strange features like this?</p>
javascript
[3]
4,930,414
4,930,415
How can I make this method more general?
<p>I have this method called LoadToDictionary. It accepts a dictionary and a filepath. Currently, it would look something like this: <code>void LoadToDictionary(Dictionary&lt;string, string&gt; dict, string filePath</code>. Then inside, it would have a lot of code to extract the contents of the file in filePath to a dictionary. I want to make it more general, so it could, say, take a dictionary with int's instead, and the ability to change the parsing code in the method. Should I mark this method and later override it? Is there any other way?</p>
c#
[0]
4,829,800
4,829,801
How to convert HTML to image with PHP
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/834445/screenshot-of-current-page-using-php">Screenshot of current page using PHP</a> </p> </blockquote> <p>How to convert HTML to image with PHP , have idea!!!</p>
php
[2]
1,176,418
1,176,419
Add onto an array with the key and value
<p>I've looked for days and to no avail. I can't find a function which could add to an array with the key and value. Here's why I need it: I need an array to store both the name of the owner and the type of the car. I'd like for the key to be the name of the owner and the type of the car to be the value and not have to use two arrays to contain something which one array can.</p> <p>Here's my current code:<br /> <strong>Function used to get $vehicleName</strong></p> <pre><code>function carName($nakedCarString) { $cars=(separateString($array, $vehicleString)); return $cars[0]; } </code></pre> <p>The above code uses a vehicle string, gets the name of the car with an array and returns the name of the car in a string. Not an array.<br /> <strong>Code(which requires code to add to array with key and value) which will be adding info to array</strong></p> <pre><code>while($row = mysql_fetch_array($result)) { $vehicleString = $row['Vehicle']; $vehicleName = carName($vehicleString); $seller = steamID2CommunityID($row['Auctioneer']); $name = new SteamAPI($seller); $sellername = $name-&gt;getFriendlyName(); } </code></pre> <p>The above code gets each row in a mysql table and foreach row it'd get the vehicle string, the name of the car from vehicle string using function above, the seller and the sellers name(in string, not array) <br /> I'd need it so that it could add to an array($carIndex) with the key($sellername) and value($vehicleName). Any help?</p>
php
[2]
5,446,130
5,446,131
Launch android application from a browser link
<p>I have a problem trying to launch my application from the browser using my own scheme.<br> Code is as follow:<br> Manifest file:</p> <pre><code> &lt;activity android:name=".MainActivity" android:label="@string/title_activity_main" android:exported="false"&gt; &lt;intent-filter&gt; &lt;data android:scheme="allplayer" /&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre> <p>Html file:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;a href="allplayer://site.com"&gt;Test link&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>If I click on the link, my application wont start. I did a lot of researches, but couldn't find an answer.<br> If I change <strong>allplayer</strong> with <strong>http</strong> everything works fine.<br> From <a href="http://stackoverflow.com/a/6139783/1503155">this link</a>, I learnt that it is not recommended to use your own schemes.<br> Does that mean your own schemes wont work?<br> The person <a href="http://stackoverflow.com/q/3469908/1503155">here</a> is using his own scheme, and from his feedback it seems that it is working.<br> Am I missing something. Need your help.<br> Thanks in advance.</p>
android
[4]
3,087,570
3,087,571
Passing a Param to System.EventHandler in c#
<p>Since google has failed me for the past 5-10 minutes I have a quick question. I wish to pass a param value into a function that I call from a button.click Event Handler. The event is currently added using </p> <pre><code>MyButton.Click = new System.EventHandler(MyButton_click); </code></pre> <p>But I want the function to recieve:</p> <pre><code>private void MyButton_click(int ID) { ... } </code></pre> <p>How can I change my EventHandler declaration so that this can be accomplished?</p>
c#
[0]
3,852,129
3,852,130
jQuery - How to check if an element is an array or single
<p>Query 1.7.1</p> <p>Sometimes I have an element as an array, </p> <pre><code>&lt;tr&gt;&lt;td&gt;&lt;input type="hidden" class="p" name="it" value="1"/&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;input type="hidden" class="p" name="it" value="2"/&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre> <p>The below jQuery code works,</p> <pre><code>$(".p").each(function(i){ alert($('.p')[i].value); }); </code></pre> <p>Sometime I have that element as a single element</p> <pre><code>&lt;tr&gt;&lt;td&gt;&lt;input type="hidden" class="p" name="it" value="1"/&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre> <p>I want to make sure if the hidden input is an array or a single element before trying to execute the above jQuery code. How can I do that using jQuery?</p>
jquery
[5]
3,610,990
3,610,991
JQuery's $("#div").html() opens new page
<p>I frequently use JQuery's $("#div").html() function to insert code into a specific div but this time, at the point the code has been inserted into the div, it displays a whole new page with the content that should be inside the div, new head, new body, etc.</p> <p>The code I insert contains some html+javascript. Is it probably caused by a referrer or something like that? any suggestions on how to overcome this problem?</p> <p>Thanks a lot for your help! Best regards</p>
jquery
[5]
5,689,227
5,689,228
PHP redirect_to not working
<p>I am having an issue with PHP redirect_to. I have a form where a user can select an image to upload. Upon succussful upload I'd like the user to be redirected to a page that lists all images in the database. The following code comes from a PHP file called upload_image.php. It is in the same directory as the page I'd like to redirect to, list_images.php. I've narrowed down the problem area to the following code:</p> <pre><code>if(isset($_POST['submit'])){ $image = new Image(); //User defined class $image-&gt;caption = $_POST['caption']; //Places caption text field in the database $image-&gt;attach_file($_FILES['file_upload']); //Copies image to images folder if($image-&gt;save()){ //Success $session-&gt;message("Image uploaded successfully!"); redirect_to('list_images.php'); //PROBLEM AREA. Page never redirects. }else{ //Failure $message = join("&lt;br /&gt;", $image-&gt;errors); }} </code></pre> <p>My function for redirect_to() is the following:</p> <pre><code> function redirect_to($location = NULL){ if($location != NULL){ header("Location: {$location}"); exit; }} </code></pre> <p>The uploaded image is always successfully copied to the correct location and its information gets stored in the database. After submitting however I am always left with a blank page and the url of upload_image.php in the browser. Through countless echo tests I've determined that the problem happens at redirect_to('list_images.php'); I am able to echo text onto the blank page just before redirect_to, but anything after redirect_to does not get executed.</p> <p>Does anyone have any ideas to advice?</p> <p>Thank you!</p>
php
[2]
695,802
695,803
How to display an image in Image Control as soon i browse?
<p>My Scenario,</p> <p>Im using asp.net in vb. I need to see the image in Image control as soon as i browse.and when i submit and it has to locate to the folder in server side.Is it possible through javascript.Please guide me.</p>
asp.net
[9]
5,612,573
5,612,574
Separating a string in Python
<p>How would I separate characters once I have a string of unseparated words? </p> <p>For example to translate "take the last character of the suffix and add a space to it every time (<code>"aSuffixbSuffixcSuffix"</code> --> <code>"aSuffix bSuffix cSuffix"</code>).`</p> <p>Or, more generally, to replace the x-nth character, where x is any integer (e.g., to replace the 3rd, 6th, 9th, etc. character some something I choose).</p>
python
[7]
2,476,013
2,476,014
Does Python come with a function to split a list using a delimiter?
<p>Having a <code>list</code> that contains <code>string</code>s, I want to split the <code>list</code> at each point where it contains the empty <code>string</code> (<code>''</code>), e.g. </p> <pre><code>['this', 'is', '', 'an', 'example'] </code></pre> <p>should become</p> <pre><code>[['this', 'is'], ['an', 'example']] </code></pre> <p>I wrote a generator that does this:</p> <pre><code>def split(it, delimiter): it = iter(it) buffer = [] while True: element = next(it) if element != delimiter: buffer.append(element) elif buffer: yield buffer buffer = [] </code></pre> <p>Since this looks pretty general, I was wondering if I missed some similar function or related pattern in <code>itertools</code> or somewhere else...?</p>
python
[7]
5,600,275
5,600,276
which is the cleaner way to do this simple while?
<p>I'm learning C++ and I want to make clean and readable code. I was wondering which way is better? (this is supposed to make the factorial of 9)</p> <p>First Method: </p> <pre><code>int main(){ int i = 1,r = i; while (i &lt; 10) { r *= ++i; } } </code></pre> <p>Second Method: </p> <pre><code>int main(){ int i = 1,r = i; while (i &lt; 10) { i++; r *= i } } </code></pre> <p>The first may be harder to understand but it's one less line. Is it worth it? What about performance? Obviously it wouldn't matter in such a trivial example but it would be a good practice to make fast code from the beginning.</p>
c++
[6]
2,987,063
2,987,064
ASP.net with SQL query
<p>I am working with ASP.net. In that in one sql query my output is 21,22,23, which is a string. I want to remove those commas and store them as separate integer values...I want to use an array. Plese help. How to do that ?</p>
asp.net
[9]
3,793,417
3,793,418
browser starts , then closes quickly in Android Simulator
<p>I started the Android Emulator in Windows 7.</p> <p>The emulator windows pops up. I can see the menu. I can see the icon of the browser. I click on it. It starts up. The screen changes. I can see a white screen and the black stripe at the top. Then it closes quicly after 1 second. The same happens with Google Search.</p> <p>What can be wrong?</p>
android
[4]
1,713,749
1,713,750
Pausing JavaScript execution for animation of code
<p>I'm having an interesting but difficult problem with my JavaScript code. Basically, I'm trying to create an animation of a simple algorithm using JavaScript (a sorting algorithm, if you're wondering) for educational reasons. I've already got all of the animation code written (using RaphaelJS), and it all works fine. The trouble is getting the animations of the algorithm to happen at the right time. JavaScript doesn't really have any way to "pause" execution, so I can't really step through the algorithm slowly, playing animations at each step. It's obviously much more valuable from an educational perspective if the algorithm proceeds at a pace the student can comprehend.</p> <p>There are two ways to solve this problem that I can think of, and both suck. The first is to use some crazy setTimeout() code. This would probably be very difficult -- lots of strange code transformations would be needed to associate the different parts of the algorithm with correct timeouts. I've already tried to do this a little bit, and it gets very complicated for a non-trivial algorithm.</p> <p>The second is to busy-wait. This would probably also work. The problem is that busy waiting is a pretty bad idea in JavaScript code -- I actually crashed Firefox when I was testing out this alternative. Basically, I'm wondering if there's another solution here that I'm overlooking. Bonus points if the solution is client-side only, since the amount of freedom I have to serve stuff other than static html and javascript on the school server is questionable.</p>
javascript
[3]
4,702,599
4,702,600
Different results when using WebRequest vs WebClient
<p>We have a text file that gets generated automatically and put in a web server. The task is to read the file line by line and insert the records in a database. The following code is in C#:</p> <pre><code> WebRequest request = WebRequest.Create(url); WebResponse response = request.GetResponse(); StreamReader r = new StreamReader(response.GetResponseStream()); while (r.Peek() &gt; -1) { string s = r.ReadLine().Trim(); //insert string into a db. } </code></pre> <p>When I do this I constantly get the entire file which ranges from 9000 - 10000 lines. On the other hand when I use the following sometimes I get a truncated file (less lines)</p> <pre><code> WebClient client = new WebClient(); StreamReader r = new StreamReader(client.OpenRead(url)); while (r.Peek() &gt; -1) { string s = r.ReadLine().Trim(); //insert string into a db. } </code></pre> <p>Can anyone explain the difference? Why would the results be different? I was under the impression that WebClient was just a wrapper of HttpWebRequest.</p>
c#
[0]
2,745,170
2,745,171
Android Htc Eris
<p>Hi i have developed an application and it smoothly running in all phones except Htc Eris, in Htc Eris i get out of memory exception, null pointer exception etc, but these problem i never see in my samsung galaxy or motrolloz milestone or spice mobile, i need to know any problem in Htc Eris, like low memory ,low processing power etc</p>
android
[4]
5,543,339
5,543,340
Updating array based on key and value pair
<p>I have a table of records such as <strong>IP Addr,Rx Bytes and TX Bytes</strong>. Need to update the TX bytes and RX bytes value if an entry for IP Addr already exists in the array otherwise just add the IP addr,Rx bytes &amp; TX bytes to the array using PHP.</p>
php
[2]
3,907,817
3,907,818
for the query of methods of rotation
<p>I have 1 UIViewController.</p> <p>in that i wrote,</p> <pre><code>- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { NSLog(@"A"); } in UIViewController. - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { NSLog(@"b"); } </code></pre> <p>but this method is not called why is it so?</p>
iphone
[8]
3,741,929
3,741,930
Absolute/outer and inner namespace confusion in C#
<pre><code>using Foo.Uber; namespace MyStuff.Foo { class SomeClass{ void DoStuff(){ // I want to reference the outer "absolute" Foo.Uber // but the compiler thinks I'm refering to MyStuff.Foo.Uber var x = Foo.Uber.Bar(); } } } </code></pre> <p>How could I solve this? Just moving the using statement inside my namespace doesn't help.</p>
c#
[0]
2,590,154
2,590,155
Seeting the Calendar Object in Java
<p>I have the respective name of the month e.g JANUARY or FEBRUARY in a String variable.</p> <p>Now how do I set the month of a Calendar object in java using this String variable.</p> <p>I tried setting via calendar.set method but it takes only int values.</p>
java
[1]
4,355,830
4,355,831
python files run fine when executed from different directory
<p>I have a very wierd problem. When i run the file from a different directory it runs fine. but other wise i get this error</p> <pre><code> from textprocessor import * File "/home/mohit/Documents/analysis/categorization/textprocessor.py", line 2, in &lt;module&gt; import nltk File "/usr/local/lib/python2.7/dist-packages/nltk/__init__.py", line 101, in &lt;module&gt; import ccg File "/usr/local/lib/python2.7/dist-packages/nltk/ccg/__init__.py", line 15, in &lt;module&gt; from chart import * File "/usr/local/lib/python2.7/dist-packages/nltk/ccg/chart.py", line 33, in &lt;module&gt; from nltk.parse.api import * File "/usr/local/lib/python2.7/dist-packages/nltk/parse/__init__.py", line 46, in &lt;module&gt; from featurechart import * File "/usr/local/lib/python2.7/dist-packages/nltk/parse/featurechart.py", line 24, in &lt;module&gt; import nltk.data File "/usr/local/lib/python2.7/dist-packages/nltk/data.py", line 41, in &lt;module&gt; import zipfile File "/usr/lib/python2.7/zipfile.py", line 460, in &lt;module&gt; class ZipExtFile(io.BufferedIOBase): AttributeError: 'module' object has no attribute 'BufferedIOBase' </code></pre> <p>I am tryin to import nltk module </p>
python
[7]
5,950,541
5,950,542
Creating a simple name value mapper class in C#
<p>I want to create a class (static?) that simply maps a name to a value (1 to 1). What's a clean way of doing something like this:</p> <pre><code>public static class FieldMapper { public static GetValue(string Name) { if (Name == "abc") return "Value1"; if (Name == "def") return "Value2"; } } </code></pre> <p>I might be having a mind block today. I am unable to think of a clean solution for a simple problem like this :(</p> <p><strong>Edit: All the values are known at compile time (There is no uniqueness - different keys can map to same value). I shouldn't be creating a datastructure that adds values at runtime. Also, I would like to avoid using a XML file</strong></p>
c#
[0]
1,201,197
1,201,198
jquery function replaces all iframes with the same thing
<p>I have multiple iframes on my page and this jQuery replaces them all with the same thing an <strong>example here</strong> <a href="http://jsfiddle.net/yusaf/g6Mdq/4/" rel="nofollow">http://jsfiddle.net/yusaf/g6Mdq/4/</a> as you will see the iframe src for both are different I have tried to implement <code>.each</code> but I have not been successfull :/</p> <pre><code>&lt;script&gt; $(function (){ if($(".vid-wrap iframe").length){ var youtubeid = $(".vid-wrap iframe").attr("src").match(/[\w\-]{11,}/)[0]; $(".vid-wrap iframe").replaceWith('&lt;a onclick="window.open(&amp;#39;http://www.youtube.com/watch_popup?v=' + youtubeid +'&amp;vq=medium&amp;#39;,&amp;#39;Video&amp;#39;,&amp;#39;width=560, height=315&amp;#39;); return false;"&gt;&lt;img style="width:480px;height:360px;background-image:url(http://i1.ytimg.com/vi/' + youtubeid +'/hqdefault.jpg);" class="someClass" src="http://3.bp.blogspot.com/--0FurTdrYzg/Tsj3RPXGz4I/AAAAAAAAAGI/mm_4UvmoD-A/s1600/standard.png"/&gt;&lt;/a&gt;'); } }); &lt;/script&gt; </code></pre>
jquery
[5]
2,373,602
2,373,603
How do I write text over a picture in Android and save it?
<p>How can I write text on an image and then save it in Android?</p> <p>Basically I want to let user write something on the images which my camera app will click for them. I can write and show it to them using the onDraw method on the preview of the camera. But after the user has clicked the picture I want to write the text over the picture and then save it.</p>
android
[4]
61,617
61,618
foreach($items as &$item) considered harmful?
<p>Is it considered bad practice to pass items in a PHP array by reference instead of by value?</p> <p>Relevant documentation: <a href="http://php.net/manual/en/control-structures.foreach.php" rel="nofollow">http://php.net/manual/en/control-structures.foreach.php</a></p>
php
[2]
3,954,637
3,954,638
closing child window automatically when the parent window is closed
<p>I want the code so that the chilld window closes as soon as the parent window is closed in asp.net.?</p> <p>How can this be achieved?</p>
javascript
[3]
670,037
670,038
Passing variable in Javascript
<p>What is wrong with this code?</p> <pre><code>&lt;script type="text/javascript"&gt; var urlquery = location.href; var urlparts = urlquery.split('='); var urlplan = (urlparts[1]); $(document).ready(function() { $('#LDF a').click(function() { $.ajax({ url: 'src/ldf_dpd_list.php?search-n=urlplan', success: function (data) { $('#dpd').html(data); } }); }); }); </code></pre> <p>Hi I am new to javascript and Ajax and trying to pass the variable urlplan, what is the correct way to pass the variable.</p>
javascript
[3]
2,228,346
2,228,347
ASP.NET putting website online
<p>I'm new to ASP.NET and have a problem when I am trying make the website online. My website works wonderfully when I run the website in Visual Studio 2012.</p> <p>I already put the website online so you can go and check: <a href="http://keowns.bebbosoft.co.za/" rel="nofollow">http://keowns.bebbosoft.co.za/</a></p> <p>In the bottom left you will see Username, a textbox, and a add button.</p> <p>when you type some text, the text in that add button adds a new record in a Access database.</p> <p>as I said, this works when I debug, but when I put the website online, you will see this error in the content: </p> <pre><code>"Operation must use an updateable query." </code></pre> <p>the folder in the web server is set correctly(for the permissions):</p> <p><img src="http://i.stack.imgur.com/6qyUC.jpg" alt="enter image description here"></p> <p>what am I doing wrong?</p>
asp.net
[9]
160,456
160,457
get rss feeds for weather forecast
<p>I am trying to get weather forecast details for 3 days for user location. I cant find any content providers providing weather forecast details with weather code. So, anyone please suggest me which api can i use to get this information. I will ready also to pay for the feeds. Thanks in advance.</p>
android
[4]
4,883,176
4,883,177
Backslashes added to ' on work server but not on local
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/10837148/why-are-my-characters-turned-into-when-posted-to-my-server">Why are my &#39; characters turned into \&#39; when POSTed to my server?</a> </p> </blockquote> <p>Just put my site live. For some reasons backslashes are added ' signs even though I only do escape them before inserting to db. This only happens on the work server, not my local server. Where should I look? I don't think this is a script issue. </p>
php
[2]
1,002,765
1,002,766
Read & Write Writelog
<p>How do I write the error faced into the log.txt?</p> <p>Firstly, I get error file name from web config as follows:</p> <pre><code>string Errorlog = System.Configuration.ConfigurationManager.AppSettings["Errorlog.txt"]; </code></pre> <p>Next, I try to get the full path of the text file; but i do not know which one will pull it out. This is a few. I want to get the full path by not making it static.</p> <pre><code> //string path = Global.getLogFilePath(); //string path = Path.GetFileName(directoryFullPath); //string path = openFileDialog.FileName; //string path = Path.Combine(System.Environment.CurrentDirectory); //string path = Path.GetFullPath("Errorlog.txt"); //string path = Directory.GetCurrentDirectory(); //string path = System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName()); //string path = System.AppDomain.CurrentDomain.BaseDirectory.ToString(); //string path = Environment.CurrentDirectory.ToString(); //string path = System.Environment.GetEnvironmentVariable("TEMP"); //if (!path.EndsWith("\\")) path += "\\"; </code></pre>
c#
[0]
2,287,833
2,287,834
Camera.Preview Callback not generating Camera Frames
<p>I have created a customized System Service, and i want my service to capture Camera frames in the background without Preview. I have followed the steps in developer.android website and implemented the following code, but it is not generating any frames. Here is the code:</p> <pre><code> public void startCapture() { //Start The camera int openCamera = 0;//default camera to be opened mCamera = Camera.open(openCamera); Camera.Parameters p = mCamera.getParameters(); setPreviewSize(p.getPreviewSize());//method to get Camera size mCamera.getParameters().setPreviewFpsRange(1, 2); try{ Camera.PreviewCallback mPreviewCallback = new Camera.PreviewCallback() { @Override public void onPreviewFrame(byte[] data, Camera camera) { // public void cameraPreview(byte[] data, Camera camera) { // TODO Auto-generated method stub decodeYUV420SP(rgb, data, width, height);//method for processing the image bitmap.setPixels(rgb, 0, width, 0, 0, width, height); String newFolder = "/Pictures"; String extStorageDirectory = Environment.getExternalStorageDirectory().toString(); File myNewFolder = new File(extStorageDirectory + newFolder); if (!myNewFolder.exists()) myNewFolder.mkdir(); File file = new File(path, "/Pictures/Frame-"+count+".jpg"); boolean fileCreated = file.createNewFile(); FileOutputStream out = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 90, out); out.flush(); out.close(); }; }catch (Exception e) { e.printStackTrace(); } } mCamera.setPreviewCallback(mPreviewCallback); mCamera.startPreview(); } </code></pre> <p>I wanted the frames to be captured and Stored in the SD Card in the Mentioned path.but i am not getting it done. what am i doing wrong here. Need some Help! </p> <p>Thanks to the Replier in Advance.</p>
android
[4]
3,677,358
3,677,359
Deleting from SQLite
<p>Hy!</p> <p>I always get e sql error. I log the id of the choosen item and then i want to remove it from the ListView and from the db</p> <p>My code:</p> <pre><code>public boolean onItemLongClick(final AdapterView&lt;?&gt; arg0, final View arg1, final int arg2, long arg3) { final Pizza pizza = (Pizza)arg0.getItemAtPosition(arg2); Log.e("xxx",String.valueOf(pizza.id)); AlertDialog.Builder builder = new AlertDialog.Builder(Main.this); builder.setMessage("Are you sure you to delete " + pizza.title + "?") .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { aa.notifyDataSetChanged(); list.remove(pizza); aa = new CustomAdapter(Main.this, R.layout.customlistitem,list); lv.setAdapter(aa); myDB = Main.this.openOrCreateDatabase(MY_DB_NAME, MODE_PRIVATE, null); myDB.execSQL("DELETE FROM "+MY_DB_TABLE+ " WHERE ID="+pizza.id); } </code></pre> <p>Log:</p> <p>xxx is 1 so the id of the pizza is 1</p> <pre><code>10-03 09:23:13.135: ERROR/AndroidRuntime(640): android.database.sqlite.SQLiteException: no such column: ID: DELETE FROM Pizza WHERE ID=1 </code></pre>
android
[4]
5,921,212
5,921,213
Flickering Page
<p>when i am refreshing the page Flickering happens. I can see the resizing effect in page.How can i avoid this? I am using master page in my Project. In body tag i am using this(<code>&lt;body onload="return SetContentHeight();" onresize="return SetContentHeight();"&gt;</code>) to call the function. My content page inside a table. So i am setting up height and width for this table. <code>SetContentHeight(){//Assigning Height and width of content page}</code></p>
javascript
[3]
3,143,310
3,143,311
jQuery click on touch device only works once
<p>I have a drop down list and when I click on it to scroll to a section it stops working, I have to scroll the page to activate it again...any ideas on how I can fix this please?</p> <pre><code>if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { $('#menu ul li').click(function(){ var id = "#"+$(this).attr('rel')+"_anchor"; $('html, body').animate({ scrollTop : $(id).offset().top }, 'slow', 'easeInCubic'); $(this).slideUp(); }); }); </code></pre>
jquery
[5]
2,327,335
2,327,336
Android click button populate textview
<p>This is week one of Android for me! </p> <p>I'm programmatically creating a textview, two labels and a button in the same activity. The idea is that the textview receives a string from the user. The user clicks the button and the textview string is passed to a proc which returns a string result, and the string result is assigned to one of the labels.</p> <pre><code>public void onClick(View view) { sresults = showPP(ttsymbol.getText().toString().trim()); } </code></pre> <p>But this doesn't work, because "the final local variable sresults cannot be assigned, since it is defined in an enclosing type"</p> <p>I think I understand what is going wrong, but is there an alternative way of returning the results so that they can be displayed in the label? Or is it necessary to create a new dialog inside the onClick function to show them?</p> <p>Thanks!</p>
android
[4]
5,435,112
5,435,113
loading xml without invalid character errors
<p>at the moment im loading xml and i am getting error:</p> <blockquote> <p>System.Xml.XmlException: ' ', hexadecimal value 0x17, is an invalid character. Line 2762, position 16.</p> </blockquote> <p>it is easy to fix. just open xml and remove the character.</p> <p>but I need to know is it possible to load xml even with invalid characters and use it for parsing. and is there any downside?</p> <p>xml example:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;all&gt; &lt;sub&gt; &lt;summary&gt;this is summary and it might have some invalid chars&lt;/summary&gt; &lt;/sub&gt; &lt;sub&gt; &lt;summary&gt;this one is ok&lt;/summary&gt; &lt;/sub&gt; &lt;/all&gt; </code></pre>
c#
[0]
2,776,040
2,776,041
NSArray Memory Management
<p>For some reason when I release the NSArray I get the EXC_BAD_ACCESS exception. Here is the implementation: </p> <pre><code>-(void) loadAllAlphabets { NSBundle *bundle = [NSBundle mainBundle]; NSArray *imagesPath = [[NSArray alloc] init]; imagesPath = [bundle pathsForResourcesOfType:@"png" inDirectory:@"Images"]; alphabets = [[NSMutableArray alloc] init]; NSString *fileName = [[NSString alloc] init]; for(int i=0; i&lt;= imagesPath.count -1 ; i++) { fileName = [[imagesPath objectAtIndex:i] lastPathComponent]; CCSprite *sprite = [CCSprite spriteWithFile:fileName]; sprite.userData = [[fileName stringByDeletingPathExtension] uppercaseString]; [alphabets addObject:sprite]; } // release fileName [fileName release]; fileName = nil; [imagesPath release]; // this causes the application to crash with EXC_BAD_ACCESS // imagesPath = nil; </code></pre> <p>}</p> <p><strong>UPDATE 1:</strong></p> <p>So, the problem was that although I was responsible for releasing the imagesPath object since I used alloc that soon become irrelevant when pathsForResourcesOfType returned an autorelease object. This means I should not release the imagesPath object manually. </p> <p>The following line should be used: </p> <pre><code>NSArray *imagesPath = [bundle pathsForResourcesOfType:@"png" inDirectory:@"Images"]; </code></pre> <p><strong>UPDATE 2:</strong> </p> <p>Another question which is related to this post. In the following code I initialize a new NSMutableArray manually. </p> <pre><code>alphabets = [[NSMutableArray alloc] init]; </code></pre> <p>Later I insert CCSprite (Cocos2d objects) into alphabets array. CCSprite are autorelease objects. Do I still have to release alphabets manually? Since, after some time all objects are released and memory will be returned but then what will be left inside alphabets NSMutable array? </p>
iphone
[8]
4,524,321
4,524,322
Hide a div to subscribers(user role) in one page (is_page)
<p>Hello have been looking at this for quite a while and cant seem to resolve it was hoping someone more familiar with the wordpress core and php could share some idea.</p> <p>What I want to accomplish essentially is to Hide a div that permits buddypress users (the subscrivers) from adding new topics to a group forum. But I dont want this to be hidden from all the forums just 1 of them. So I need 2 pieces 1 that determines whether someone is a subscriber or an admin. so its only hidden to the subscriber. and 2 that it hides it from only 1 page.</p> <p>Example of potential code just need to fit it together (all code would go in the functions.php unless there is another way)</p> <pre><code>&lt;?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?&gt; have info link or whatever in here &lt;?php } ?&gt; </code></pre> <p>Thats for the frontpage but similarly you can get the page by ID </p> <p>For role I saw this </p> <pre><code>is_admin() </code></pre> <p>I would assume there is a </p> <pre><code>is_subscriber() </code></pre> <p>and from there you can do an if in the php something like if is_subscriber() and is_page( 42 ) call .js file and from there add a class that hides the div I want to hide by jquery</p> <p>Thats as far as I got from what I know and looking around. I would greatly appreciate any and all assistance.</p>
php
[2]
26,547
26,548
Sort multidimensional array in JavaScript
<p>I need to sort an array containing arrays in ascending numerical order. The data structure looks like this</p> <pre><code>array = [[escalation],//integer [name], [email], [blackberry]]; </code></pre> <p>I try to sort the array using this function (sorting by escalation)</p> <pre><code>function sortfcn(a,b){ if(a[0]&lt;b[0]){ return -1; } else if(a[0]&gt;b[0]){ return 1; } else{ return 0; } } </code></pre> <p>But my output still looks incorrect... </p> <p>0 0 10 12 14 16 18 20 20 8</p> <p>Any advice on how to fix this?</p>
javascript
[3]
4,113,277
4,113,278
How can you reduce the 'current' time in setTimeOut?
<p>How can you reduce the 'current' time in setTimeOut? For example I have a countdown going from 100s, after 40s (so at 60s) I click a button and it instantly reduces to 50s (-10s).</p> <p>The link in the example below enables after 100 seconds. Basically I'm looking for a way to reduce 10 seconds from the (current position in the) countdown every time a button is pressed.</p> <pre><code>function enableLink() { setTimeout('enableAnchor( "anchor0", "mylink.php" )', 100000); } </code></pre> <p>If this isn't possible, is there any language or library (JQuery or AJAX perhaps?) that would allow me to do this?</p>
javascript
[3]
1,392,273
1,392,274
PHP appends localhost to out-going email
<p>Here's a PHP code that I'm using to test email sending for one of my forms. Although it works well, but for some reason it appends @localhost.mydomain.com to the sender email address. Here's an example:</p> <pre><code>From: James &lt;james.bond@hotmail.com@localhost.mydomain.com&gt; </code></pre> <p>Here's the full code below.</p> <pre><code>&lt;?php $email = sqlEscape($_POST['email']); $name = sqlEscape($_POST['name']); $to = 'me@yahoo.com'; $subject = 'Email From website'; $message = 'The message here'; $headers = 'From: "'.$name.'" &lt;"'.$email.'"&gt;' . "\n"; $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n"; if(mail($to, $subject, $message, $headers)){ echo('Message sent successfully'); }else{ echo('&lt;a href="contact.php"&gt;Click here&lt;/a&gt; to try again.'); } ?&gt; </code></pre> <p>Is there a way to make it not to append it? Thanks</p>
php
[2]
199,307
199,308
Assign a bunch of animations to a variable in jquery?
<p>I'm fairly new to jQuery so that's why I ask:</p> <p>I have 3 conditional animations operating on three divs:</p> <pre><code>var viewport = $(window).width(); if ( viewport &lt; 1400 ) { $("#panel").animate({marginLeft:"-175px"}, 500 ); $("#colleft").animate({width:"0px", opacity:0}, 400 ); $("#showPanel").show("normal").animate({width:"28px", opacity:1}, 200); $("#colright").animate({marginLeft:"50px"}, 500); }else{ $("#colright").fadeIn('slow').animate({marginLeft:"200px"}, 200); $("#panel").fadeIn('slow').animate({marginLeft:"0px"}, 400 ); $("#colleft").fadeIn('slow').animate({width:"190px", opacity:1}, 400 ); $("#showPanel").animate({width:"0px", opacity:0}, 600).hide("slow"); } </code></pre> <p>As you can see, this is performing the animations based on viewport.</p> <p>I have to repeat these conditionals on <code>$(window).resize(function() {</code> and <code>$("#hidePanel").click(function(e){</code>. </p> <p>Do I have to repeat the code or can I assign them to a variable?</p> <p><strong>EDIT</strong></p> <p>The following function fails to work in the conditional.</p> <pre><code>function collapseMenu(){ $("#panel").animate({marginLeft:"-175px"}, 500 ); $("#colleft").animate({width:"0px", opacity:0}, 400 ); $("#showPanel").show("normal").animate({width:"28px", opacity:1}, 200); $("#colright").animate({marginLeft:"50px"}, 500); } if ( viewport &lt; 1400 ) { collapseMenu(); } </code></pre>
jquery
[5]
4,490,053
4,490,054
html print to two/more printer
<p>I have developed a Restaurant Order Punching software that prints Kitchen Order Ticket (KOT) &amp; Bar Order Ticket (BOT) in one html page in two parts. But in one print click KOT part should go to kitchen printer &amp; BOT part should go to bar printer. Printer can be more than two if some items are available at some other counters like ice cream etc. I can do it by using CSS &amp; 'two/three/no_of_sections' but customer needs it in one click. I am stuck please help.</p> <p>Bilal </p>
javascript
[3]
5,227
5,228
scrolling the whole view up and down on appearance of keyboard on iPhone
<p>How can I scroll the whole view up and down on appearance/disappearance of keyboard on iPhone?</p> <p>Thanks.</p>
iphone
[8]
850,418
850,419
Calling varargs method mixing elements and array of elements does not work
<p>I have a method with the following signature:</p> <pre><code>public void foo(String... params); </code></pre> <p>So all of these calls are valid:</p> <pre><code>foo("Peter", "John"); foo(new String[] { "Peter", "John" }); </code></pre> <p>But why is this one not valid?</p> <pre><code>foo("Peter", new String[] { "John" }); </code></pre>
java
[1]
1,426,493
1,426,494
Launch app or file with android app
<p>How can i launch a process from with my android app? I am wanting to launch the default music player to play a selected song. I can play the song from within my own app, but i want to let the default player play the song. How would i go about doing this? </p> <p>Thanks. This is what i got to work using your example.</p> <pre><code>Intent intent = new Intent(android.content.Intent.ACTION_VIEW); Uri data = Uri.parse("file://" + pathtofile); intent.setDataAndType(data,"audio/mp3"); try { startActivity(intent); } catch (ActivityNotFoundException e) { e.printStackTrace(); } </code></pre>
android
[4]
4,418,001
4,418,002
Get voice from Mic
<p>I am trying to start recording when there is voice is coming in mic end automatic stop when there is no voice.(i.e Talking Tom Application in android).</p> <p>I can record voice and play them. I have also tried to in service start recording after every particular period of time but it's not good idea.</p> <p>Can any one tell me the solution?</p> <p>Thank You.</p>
android
[4]
5,997,711
5,997,712
Application lifecycle. How to run something only when application starts
<p>I have a dialog popup to indicate how long I want an activity to run. Seems simple enough, but its difficult to determine when the activity is really starting. If the user opens the keyboard on a G1 and thereby goes into landscape, that reruns the activities onCreate method.</p> <p>I can't have a static for the class or even create an application class, because I can't determine when the 'application' goes away. Even after destroying the only activity, the application is apparently still alive.</p> <p>Is there a way to determine that onCreate has been called because of the keyboard being extended or landscape mode invoked?</p> <p>Thanks</p>
android
[4]
1,627,809
1,627,810
On the usage of Java equality operator
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java">How do I compare strings in Java?</a> </p> </blockquote> <pre><code>class StringTest { public static void main(String[] args) { String str1 = "Hi there"; String str2 = new String("Hi there"); System.out.println(str1 == str2); System.out.println(str1.equals(str2)); } </code></pre> <p>The output is coming out: </p> <pre><code> False true </code></pre> <p>Why the first output is false even when the str1 and str2 appear to be equal? </p>
java
[1]
3,581,832
3,581,833
simple email validation using PCRE to validate the end of a string
<p>Im just trying to validate an email ending with a particular string. Im using PCRE for this...but cant seem to get it to work. The email needs to end in either boisestate.edu or u.boisestate.edu. I've been stabbing at this one for awhile...some help would be really appreciated! </p> <p>This is what I have so far:</p> <pre><code>if (preg_match("/[a-zA-Z]+[a-z0-9A-Z_-]+@[\.u]?\.boisestate\.edu$/", "melissa@boisestate.edu", $matches)){ echo "Match was found &lt;br /&gt;"; print_r($matches); } </code></pre>
php
[2]
2,267,730
2,267,731
Grab the ID of a SPAN tag and add some value to a Text Box Field according to which tag has been clicked
<p>I was trying to grab the ID of the SPAN tag when a user clicked it.<br/> Since the ID of each tag contains two digits, they would be used for referring<br/> to the value of their corresponding hidden text box field,<br/> but I am stuck over this question.<br/></p> <p>Here is part of the code that I have written.<br/> I need your help to finish it because I don't know how to move on.<br/></p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#^=content").click(function(event){ // var digit = extract the last two digit of the id var id_of_the_hidden_field = "hidden"+digit; $("#show").val()=$("#hidden").val(); }); }); &lt;/script&gt; &lt;div id="test22"&gt; &lt;span id="content22"&gt;Click to add the value&lt;/span&gt; &lt;input type="hidden" id="hidden22" value="hello"&gt; &lt;/div&gt; &lt;div id="test33"&gt; &lt;span id="content33"&gt;Click to add the value&lt;/span&gt; &lt;input type="hidden" id="hidden33" value="world"&gt; &lt;/div&gt; &lt;input type="text" id="show"&gt; </code></pre>
jquery
[5]
716,584
716,585
callback javascript
<p>I write a browser game (php, javascript) and I do not know how to make a callback. necessary that the server itself found a client and call the function (only had one)</p>
javascript
[3]
4,954,516
4,954,517
tableLayout strechcolumns doesn't work
<p>I have a TablLayout, it has 1 row and 2 columns.</p> <p>The first column is a text, and I want it as big as possible, the second one is another table with 2 rows and 1 column:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="1" &gt; &lt;TableRow&gt; &lt;TextView android:id="@+id/parkingDataText" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" /&gt; &lt;TableLayout&gt; &lt;TableRow&gt; &lt;ImageButton android:id="@+id/buttonStar" android:layout_marginLeft="10dip" android:background="@null" /&gt; &lt;/TableRow&gt; &lt;TableRow&gt; &lt;ImageButton android:id="@+id/buttonRent" android:layout_marginLeft="10dip" android:background="@null" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/TableRow&gt; </code></pre> <p> </p> <p>I thought I had to use strechColumns="1" and the first column occupied the space that the second one doesnt use, but it doesn't work. Any idea?</p> <p>Thank you in advance</p>
android
[4]
879,578
879,579
str_pad with a float in php?
<p>I am looking for the best way to <code>str_pad</code> floats in php.</p> <p>The problem I am having is that <code>str_pad</code> takes into account the string length but with a float there is the decimal point. If I want a number padded with zeros this becomes a little bit of a nightmare.</p> <p>For example if I need the number to always have at least 6 numbers after the decimal point I cannot do it with <code>str_pad</code> as the results change.</p> <pre><code>$i = 1.0; echo str_pad($i, 8, '0'); // 1.000000 $i = 10.5 echo str_pad($i, 8, '0'); // 10.50000 ## ONLY PADDED WITH 5 NUMBERS AFTER DECIMAL </code></pre> <p>I know I can <code>explode</code> then <code>str_pad</code> and do it that way but just wondered if there was a php built in function for this or any better ways.</p>
php
[2]