Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
4,942,890
4,942,891
Adding objects to a ListView row at runtime
<p>I am trying to add elements to a ListView dynamically at runtime. Here is my code.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/category_row" android:orientation="horizontal" &gt; &lt;!-- Contents will be added at Runtime --&gt; &lt;/LinearLayout&gt; </code></pre> <p>The getView function overridden by my adapter</p> <pre><code>@Override public View getView(final int position, final View convertView, final ViewGroup parent) { View searchResultsRow = convertView; LinearLayout linearLayout; TextView e1,e2,e3,e4; if (searchResultsRow == null) { LayoutInflater layoutInflator = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); searchResultsRow = layoutInflator.inflate( R.layout.categories_row_object, null); linearLayout = (LinearLayout) searchResultsRow.findViewById(R.id.category_row); } e1 = new TextView(context); e2 = new TextView(context); e3 = new TextView(context); e4 = new TextView(context); e1 = new TextView(context); e1.setText("Fashion"); linearLayout.addView(e1); e2 = new TextView(context); e2.setText("Men"); linearLayout.addView(e2); e3 = new TextView(context); e3.setText("Casual Wear"); linearLayout.addView(e3); e4 = new TextView(context); e4.setText("Jeans"); linearLayout.addView(e4); return searchResultsRow; } </code></pre> <p>Now what happens that the first couple of rows seem at jumbled up. Like multiple rows have been added to the same row. What am i doing wrong ? </p> <p>Kind Regards,</p>
android
[4]
5,673,849
5,673,850
How can i send message to handler from a static function?
<p>I know, this is again a repeated question but my case it is different question.</p> <p>I have a class abc with a static function &amp; a Handler. Earlier i couldn't able call handler from a static function. Then i googled for <strong>Access a non-static function from a static function</strong> &amp; found an solution is to create an instance of class &amp; access non-static variable. But now, why, i m getting this error.</p> <p><strong><code>E/AndroidRuntime(13343): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()</code></strong></p> <pre><code>public class abc { static public void Instantiate() { abc xyz = new abc(); xyz.handler.sendEmptyMessage(1); **//GETTING ERROR IN THIS LINE** } public Handler handler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { } } } } </code></pre> <p><strong>My Question: How can i send message to <em>handler</em> from a static function?</strong></p> <p><strong>Thankx.</strong></p>
android
[4]
1,643,300
1,643,301
PHP, select a string between two strings, then get one value from the selected string
<p>I have a file, with many parts of code. Each part starts with <code>&lt;form&gt;</code> and ends with <code>&lt;/form&gt;</code>. Between each form, there is something like this: <code>&lt;input type='text' name='date' value='2010-01-01'&gt;&lt;input type='text' name='username' value='test'&gt;</code></p> <p>I want to parse each part of the code with php and get the value of input username, where the value for input date is '2010-01-01'</p> <p>Any solutions please?</p> <p>example:</p> <pre><code>&lt;form&gt; &lt;input type='text' name='date' value='2010-01-01'&gt; &lt;input type='text' name='username' value='test'&gt; &lt;!-- How can I get this value ('test')? --&gt; &lt;/form&gt; &lt;form&gt; &lt;input type='text' name='date' value='2010-01-02'&gt; &lt;input type='text' name='username' value='test2'&gt; &lt;/form&gt; . . . </code></pre>
php
[2]
2,954,050
2,954,051
jQuery array validation
<p>Is there any way to accept number from 10 to 50 along with 'AB' and 'NF'-</p> <p>Following code accepts 0 to any number along with 'AB' and 'NF'</p> <pre><code> &lt;script&gt; $.validator.addMethod("custom_number", function(value, element) { return this.optional(element) || value == "AB" || value == "NF" || value.match(/^[0-9,\+-]+$/); }, "Please enter a valid number, or 'AB'"); $(document).ready(function(){ $("#form").validate({ rules: { 'hd[]': { required: false, custom_number: true } } }); }); &lt;/script&gt; </code></pre> <p>Thanks in advance.</p>
javascript
[3]
374,430
374,431
Handling an interactive script from another script , using python
<p>I have a shell script and this one is interactive and I am creating some automation to provide inputs to this shell scripts. The automation is done using Python. example,</p> <p>the shell script waits for an input like, "what is the domain name?" now the python should be able to provide the input and press ENTER. </p> <p>Please provide solutions to handle this kind of session with some example.</p> <p>Thanks, OpenFile</p>
python
[7]
3,641,193
3,641,194
Effective way how to break add new line in String after x chars
<p>I have some long String which containt 500 row. each row has over 300 chars. How I can add new line in the row after x chars ?</p>
java
[1]
27,675
27,676
How to delete files from directory based on creation date in php?
<p>I have a cache folder that stores html files. They are overwritten when needed, but a lot of the time, rarely used pages are cached in there also, that just end up using space (after 5 weeks, the drive was full with over 2.7 million cache files). </p> <p>Whats the best way to loop thru a directory that contains several hundreds of thousands of files, and remove files that are older than 1 day?</p>
php
[2]
162,745
162,746
How does one use Javascript to select a value from a drop down list and pass that value as a var to another function?
<p>I know this is simple, but I can't get it working. I'm hoping someone here can help.</p> <p>First off, this is part of a web app for iOS.</p> <p>Okay, I have a list of items:</p> <pre><code>Room Type: &lt;select id="isoList" name="isoList"&gt; &lt;option&gt;&lt;/option&gt; &lt;option value="20"&gt;ISO 8 Life Sciences Low Use&lt;/option&gt; &lt;option value="25"&gt;ISO 8 Life Sciences Med Use&lt;/option&gt; &lt;option value="30"&gt;ISO 8 Life Sciences High Use&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I need to have the user select the room type, then pass the option value - as a var - to another function that uses the var in a calculation.</p> <p>Here's the script I have to far. My form is named airflow...</p> <pre><code>function isoChange() { var isoChange = document.airflow("isoList"); var airChanges = isoChange.options[isoList.selectedIndex].value; } </code></pre> <p>Now I want to pass airChanges to this function...</p> <pre><code>function calcAF(airChanges) { var length = document.airflow.length.value; //length var width = document.airflow.width.value; //width var height = document.airflow.height.value; //height var changes = airChanges; // hourly air changes } </code></pre> <p>From there the calcAF function will use the var in various math formulae.</p> <p>I've got it to work if I get the user to tell me airChanges, but it breaks when I try to get the airChanges from a drop down list.</p>
javascript
[3]
1,417,675
1,417,676
Dynamically added views in linearlayout
<p>dynamically i am creating the linear layout and adding the views to linear layout every 5 sec i need to update data to linear layout from db when i check logger output it is adding to linear layout but gui it is not updating for every 5 sec updation i am using scheduleatfixed timer task </p>
android
[4]
2,281,730
2,281,731
Custom textfield in uitableviewcontroller
<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //static NSString *CellIdentifier = @"Cell"; NSString *CellIdentifier = [NSStringstringWithFormat:@"S%1dR%1d",indexPath.section,indexPath.row]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } if (indexPath.section==0) { if (indexPath.row==0) { UILabel *Name=[[UILabel alloc]initWithFrame:CGRectMake(10, 10, 100, 20)]; [Name setText:@"First Name "]; Name.tag=kViewTag; [cell.contentView addSubview:Name]; //cell.textLabel.text=@"First Name"; UITextField *textName=[[UITextField alloc]initWithFrame:CGRectMake(140, 10, 150, 30)]; textName.placeholder=@"Enter First Name"; textName.tag=kViewTag; [textName setBorderStyle:UITextBorderStyleRoundedRect]; //textName.tag=0; textName.clearButtonMode = UITextFieldViewModeWhileEditing; textName.keyboardType=UIKeyboardTypeDefault; textName.returnKeyType=UIReturnKeyDone; textName.delegate=self; textName.clearsOnBeginEditing=YES; [cell.contentView addSubview:textName]; } } return cell; } </code></pre> <p>in this code there are some more textfields also.</p> <p>my problem is that when i am scrolling my table value in the textfield removes automatically.. can anyone help me???</p>
iphone
[8]
4,469,148
4,469,149
Android gallery item jerks when it comes to focus
<p>I am inflating a listview in one of the item in gallery. When I scroll through gallery and when my list view is in focus I observe a slight jerk in the gallery.</p> <p>How to avoid the jerk?</p> <p>Please let me know the solution if any.</p> <p>Thanks.</p>
android
[4]
4,571,534
4,571,535
An array of objects as an argument of a function error in c++
<p>I have a templated class Node and I want to create an array of its object and pass it to a function. How do I do that?</p> <pre><code>Node&lt;char&gt; w1, w2, w3, w4; Node&lt;char&gt; **s1 = new Node&lt;char&gt;* [3]; s1[0] = &amp;w1; s1[1] = &amp;w2; s1[2] = &amp;w3; w4.meet_neighbors(s1); </code></pre> <p>where I have the following prototype before:</p> <pre><code>template&lt;typename T&gt; void Node&lt;T&gt;::meet_neighbors(Node&lt;T&gt;**); </code></pre> <p>Probing to do it that way results in the following error:</p> <pre><code>error: no matching function for call to ‘Node&lt;char&gt;::meet_neighbors(Node&lt;char&gt;**&amp;) note: candidates are: void Node&lt;TW&gt;::meet_neighbors(const Node&lt;TW&gt;**) [with TW = char] &lt;near match&gt; </code></pre> <p>which outcome I do not understand. Please help.</p>
c++
[6]
1,114,923
1,114,924
How to remove automatic picture rotation?
<p>I have a problem with pictures; after I take a picture, it automatically rotates 90-degrees. How I can remove this? I need a portrait picture.</p> <pre><code> public void surfaceCreated(SurfaceHolder holder) { try { camera.setPreviewCallback(this); camera.setPreviewDisplay(holder); Camera.Parameters p = camera.getParameters(); p.setPictureSize(1024, 768); p.setPictureFormat (PixelFormat.RGB_565); camera.setParameters(p); } catch (IOException e) { e.printStackTrace(); } if (this.getResources().getConfiguration().orientation != Configuration.UI_MODE_TYPE_CAR) { camera.setDisplayOrientation(90); } else { camera.setDisplayOrientation(0); } preview.setLayoutParams(lp); camera.startPreview(); } public void onPictureTaken(byte[] paramArrayOfByte, Camera paramCamera) { FileOutputStream fileOutputStream = null; try { File saveDir = new File("/sdcard/CameraExample/"); if (!saveDir.exists()) { saveDir.mkdirs(); } BitmapFactory.Options options = new BitmapFactory.Options(); Bitmap myImage = BitmapFactory.decodeByteArray(paramArrayOfByte, 0,paramArrayOfByte.length, options); Bitmap bmpResult = Bitmap.createBitmap(myImage.getWidth(), myImage.getHeight(),Config.RGB_565); Paint paint = new Paint(); Canvas myCanvas = new Canvas(bmpResult); myCanvas.drawBitmap(myImage, 0, 0, paint); fileOutputStream = new FileOutputStream("/sdcard/CameraExample/"+ sdf.format(new Date())+".bmp"); BufferedOutputStream bos = newBufferedOutputStream(fileOutputStream ); bmpResult.compress(CompressFormat.PNG, 100, bos); bos.flush(); bos.close(); </code></pre>
android
[4]
2,785,186
2,785,187
How to solve this problem without the use of if-else statements?
<p>I have just started my C++ lecture class. And the teacher has given us the following assignment.</p> <blockquote> <p>Write a program that determines whether a number is even or odd.</p> </blockquote> <p>The logic I would use for the program is.</p> <ol> <li>Get input <code>a</code>.</li> <li>Store <code>a % 2</code> as <code>b</code>.</li> <li>If <code>b</code> is 0, then <code>a</code> is even, else <code>a</code> is odd.</li> </ol> <p>The catch though, is that we have to write the program without the use of a <code>if-else</code> statement.</p> <p>I have been thinking on how to approach the problem for the past few hours, but I have no clue what to do. Any hints or suggestions?</p>
c++
[6]
5,986,818
5,986,819
Why does PHP syntax uses $ symbol to define vars?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2257460/why-does-php-have-a-sign-in-front-of-variables">Why does PHP have a $ sign in front of variables?</a> </p> </blockquote> <p>Why php uses $ symbol to define vars? </p> <p>I there a reason why? </p>
php
[2]
4,631,459
4,631,460
SMSlog backup in android
<p>please help me to find the code to store sms logs in android.I have to work on the app to store calllog and smslog.I got code for calllog but smslog I couldnt get the proper code. I only need to get the name, number ,msgtext,date and time of smslog from the phone.please help me to get some code.Thanks for any help.</p>
android
[4]
1,489,958
1,489,959
mt940 reader for php
<p>I'm looking for a mt940 reader for PHP. Does anyone have experience with this? An mt940 file is an electronic file with bank transactions.</p> <p>I already found this script but i don't get it working.</p> <p><a href="http://www.kingsquare.nl/php-mt940" rel="nofollow">http://www.kingsquare.nl/php-mt940</a></p> <p>I hope someone can put me in the right direction.</p> <p>Thanks in advance</p>
php
[2]
1,253,065
1,253,066
String date to date object in python
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1713594/parsing-dates-and-times-from-strings-using-python">Parsing Dates and Times from Strings using python</a> </p> </blockquote> <p>I'm reading a string</p> <pre><code>"2011-06-11" </code></pre> <p>How can I cast this to a <strong>date</strong> object?</p> <p>thanks</p>
python
[7]
1,414,155
1,414,156
include javax.sound.midi in my android application
<p>facing problem to work with midi file in android </p> <pre><code>i am unable to find the javax.sound.midi jar file .. any where in google.. from where do i find this jar. and how do i include this jar i want the sheet music from midi files but i did'nt get any sample or solution ..in android plz help me </code></pre>
android
[4]
1,932,859
1,932,860
How can i restore the messages in android
<p>I am able to getting all messages with its data, type ,address,status etc. but i am not able restore these messages.I tried the following way.it insert correctly but it show current date not date of message recieved or send.Please help me how can i restore messages.</p> <pre><code> ContentValues values = new ContentValues(); values.put("address", "9878782944"); values.put("body", "foo bar"); values.put("date", "1322039220502"); values.put("type", "1"); values.put("status", "-1"); values.put("read", "1"); values.put("protocol", "0"); getContentResolver().insert(Uri.parse("content://sms"), values); </code></pre>
android
[4]
1,139,427
1,139,428
Export gridview to MS word preserving formatting
<p>Is there a way to export a gridview to MS word and keep the formatting from the gridview. The code below works to export the gridview but I cannot figure out how to keep the formatting. (I cannot use any 3rd party software)</p> <pre><code> Response.Clear() Response.Buffer = True Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.doc") Response.Charset = "" Response.ContentType = "application/vnd.ms-word" Dim sw As New StringWriter() Dim hw As New HtmlTextWriter(sw) GridView1.RenderControl(hw) Response.Output.Write(sw.ToString()) Response.Flush() Response.End() </code></pre>
asp.net
[9]
3,623,682
3,623,683
Javascript Opera + Safari issue
<p>For some reason this page won't work in Opera + Safari <a href="http://dev.reggi.com/clients/mike2/" rel="nofollow">http://dev.reggi.com/clients/mike2/</a></p> <p>this is the main code I wrote that I believe is failing:</p> <pre><code>/*this script finds the multiples of the box_width and makes that the with of the container so the grid can be centred*/ /*sets variables*/ var box_width= 250 + 5 + 5 + 5 + 5; /*loads the width when page starts*/ $(document).ready(function(){ var w= $(window).width(); w-= (w-10) % box_width; if (w&lt;box_width) w= box_width; $('.variable_window_width').width(w); }); /*loads the new with onpage resize*/ $(window).bind('load resize', resizeFrame); function resizeFrame() { var w= $(window).width(); w-=((w-10) % box_width); if (w&lt;box_width) w= box_width; $('.variable_window_width').width(w); }; $(function(){ $("#grid div").corner("4px"); }); </code></pre>
javascript
[3]
3,794,887
3,794,888
get Double.NOTANUMBER from default(T) when T=double, is it possible?
<p>I need help for a problem in my application. In my application , I need to use double.NotANumber when I make Default(T) and the type of my generic is double. But what I get is "0.0". Is they a way to get the value I need????</p>
c#
[0]
3,008,608
3,008,609
ASP.Net: Get page url from inside a frame
<p>How can I get the top page URL from inside a frame?</p> <p>(in javascript it's implemented using : window.top.location)</p>
asp.net
[9]
814,962
814,963
Check all $_POST Variable at once
<p>instead of checking all my post variables from a form one at a time is there any way to run one check to atleast verify that they are not empty something like</p> <pre><code>if(!isset(ALL $_POST)){ echo "one of your fields is not completed."; } </code></pre>
php
[2]
3,099,347
3,099,348
Weird Python behavior
<p>I wrote a code in python which looks like:</p> <pre><code>maplist=[{}]*11 mylist=[0]*11 maplist[0]['this']=1 print maplist </code></pre> <p>When I print maplist the output is :</p> <pre><code>[{'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}] </code></pre> <p>Expected is:</p> <pre><code>[{'this': 1}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}] </code></pre> <p>rather than only the first element of the list should have this key in the map. What is causing this problem?</p>
python
[7]
3,081,754
3,081,755
What are the most important things to learn about Java Programming?
<p>I have a good understanding of object oriented programming but it's been a while since I programmed. I want to learn it again. What are the most important aspects of Java programming that are important to learn so I can identify myself as a programmer. I had trouble learning Swing before and I gave up but I want to try it again to learn it. How many years does it takes to be a good programmer?</p>
java
[1]
1,511,071
1,511,072
screen launching in anrdoid
<p>hai....i got a question...</p> <p>Suppose Screen1 is the main screen of an Android application MyAndroid. Now if another screen, Screen2 has to be opened from Screen1, then which of the following are true?</p> <ol> <li>Screen2 has to be a part of MyAndroid.</li> <li>Screen2 can exist in any other Android application installed on the device.</li> <li>Screen2 will always be launched asynchronously.</li> <li>Screen2 can be launched synchronously.</li> <li>Screen2 can return a result code to Screen1 if launched with startActivity.</li> <li>Screen2 can return a result code to Screen1 if launched with startSubActivity.</li> </ol> <p>plz tell me which will be correct.... thanz</p>
android
[4]
4,384,104
4,384,105
Java Bit Operation Issue
<p>I have incoming bits like, 0, 1, 11, 10 etc. Which I store in a string. Then I convert the string to an Int.</p> <p>Now, suppose Int A = "011" and Int B = "00". Is it possible in java to know, how many bits was there in the string which I have converted to the Int. Thanks.</p>
java
[1]
644,002
644,003
passing parameters to the java program while running it through php
<p>i wanted to pass parameters to the java program when i run it through php script could anyone tell me how to do that</p>
php
[2]
2,105,123
2,105,124
how to resize image in javascript or jquery
<p>i am trying to resize a image by 50% how would i be able to do that can some one lead me the the right path please</p> <p>Thank You</p>
jquery
[5]
3,812,818
3,812,819
Get Root Directory Path of a PHP project
<p>I have this folder structure in my PHP project. (this is as shown in eclips) </p> <pre><code>-MySystem +Code +Data_Access -Public_HTML +css +js +Templates -resources </code></pre> <p>When I try this code</p> <pre><code>echo $_SERVER['DOCUMENT_ROOT'] </code></pre> <p>output is</p> <blockquote> <p>D:/workspace</p> </blockquote> <p>How can I get the path to RootDirectory of the system (<code>MySystem</code>), without hardcoding the Folder Name?</p>
php
[2]
3,872,758
3,872,759
Export Credit Card Data from Volusion
<p>We have a client using Volusion as a storefront/e-commerce solution. We need to export purchase data, including credit card information, from it into a fulfillment provider who will then run a customer's credit card only when/if the item they ordered ships.</p> <p>We have access to the server running IIS, we have the API on the fulfillment provider side to send this data over HTTPS, and we can build a simple polling ASP.Net app that runs on the same PCI-certified server that holds the CC data that moves data from Volusion to the fulfillment provider securely.</p> <p>What remains is how to get the data out of Volusion. We've had several answers and none have panned out:</p> <ul> <li>Use the API. The API documentation is very light, and doesn't make clear how to get CC data out.</li> <li>Fill out a verification form and you can "view" it. This came from their customer service department, but they were very shaky on details.</li> <li>Query the database directly. It's not clear whether this is feasible.</li> </ul> <p>If someone here has handled external credit card processing on Volusion before, we're interested in how to get this done. What the process is to get these fields enabled in the XML API and the format of those fields would be enough, or some other approach - whatever gets us to the finish line.</p>
asp.net
[9]
3,158,595
3,158,596
How to write a function that checks if a variable is defined and is a number?
<p>In the past when I needed to check if a variable was set <strong>and also</strong> a number, I would do:</p> <pre><code>if( isset($_GET['var']) &amp;&amp; is_numeric($_GET['var']) ) </code></pre> <p>But I think that's kind of ugly, especially when I need to check a bunch of variables in the same if statement, so I made a function:</p> <pre><code>function setAndNum($var) { if(isset($var) &amp;&amp; is_numeric($var)) return 1; else return 0; } </code></pre> <p>The problem is that when I pass an undefined variable to the function, like this (supposing the variable in the GET array is undefined):</p> <pre><code>if( setAndNum($_GET['var']) ) </code></pre> <p>I get the php error:</p> <blockquote> <p>Notice: Undefined index: ...</p> </blockquote> <p>So the whole purpose of the function is basically defeated (or half the purpose, at least ;) ). </p> <p>One thing that confuses me is how the isset() function works, and why I can pass an undefined variable to it but not to my own function?</p> <p>Is it possible to make my setAndNum() function work? </p>
php
[2]
5,181,520
5,181,521
javascript add rel facebox
<p>i want to enable facebox jquery using javascript.</p> <p>here in normal html </p> <pre><code>&lt;a href="stairs.jpg" rel="facebox"&gt;text&lt;/a&gt; </code></pre> <p>how do in javascript ?something like this?</p> <pre><code>document.location.href="stairs.jpg"; document.location.rel="facebox"; </code></pre>
javascript
[3]
2,164,967
2,164,968
Displaying corresponding content panels when table row is hovered
<p>I need to display 2 sets of content when a table row is hovered. The pre-hovered state displays generic information in the two target areas <a href="http://i.stack.imgur.com/OfyE6.png" rel="nofollow">1</a> Explanation and [2] Actions. When user hovers a table row, the Explantation and Actions content are replaced with the relevant content relating to the hovered row. By way of illustration, this is what I'm looking to achieve:</p> <p><img src="http://i.stack.imgur.com/OfyE6.png" alt="enter image description here"></p> <p>Thanks for any pointers.</p>
jquery
[5]
632,874
632,875
How and When does JVM becomes out of memory
<p>I was asked in a interview : How to make JVM run out of memory?</p> <p>I answered saying it may be done by having an infinite loop. I am pretty sure it was not a right answer.</p> <p>What was the answer he might be expecting for?</p>
java
[1]
3,564,091
3,564,092
book mistake php
<p>helo everyone</p> <p>This is a code from a book i have bought. It gives me the following error.</p> <p>syntax error, unexpected T_STRING, expecting T_PAAMAYIM_NEKUDOTAYIM in </p> <pre><code>preg_match (‚#&lt;!-- START ‚. $tag . ‚ --&gt;(.+?)&lt;!-- END ‚.$tag . ‚ --&gt;#si', $this-&gt;content, $tor); $tor = str_replace (‚&lt;!-- START ‚. $tag . ‚ --&gt;', „", $tor[0]); $tor = str_replace (‚&lt;!-- END ‚ . $tag . ‚ --&gt;', „", $tor); </code></pre> <p>preg_match is the line. Can anyone help me fix this?</p>
php
[2]
726,846
726,847
Trigger right click using pure Javascript
<p>How can I manually <strong>trigger</strong> a <strong>right</strong> click using Javascript?</p> <p>I can do this with jQuery but I can only use pure Javascript in this case.</p>
javascript
[3]
1,441,503
1,441,504
PHP header shows blank page - how to trace it sent any other header before this?
<p>I tried with making <code>display_errors</code> to 1 and <code>error_reporting(E_ALL)</code> to check whether any error or something. Code looks fine but it fails to redirect the page. It shows just blank page . If I use echo <code>'&lt;script&gt; window.location = 'someusrl'; &lt;/script&gt;'</code> it works.</p> <p>How can I trace the code where it exactly sends a header already ? Its a huge code and it includes thousands of files </p> <p>When I do header_list() i am getting </p> <pre><code>array(6) { [0]=&gt; string(23) "X-Powered-By: PHP/5.3.5" [1]=&gt; string(38) "Expires: Mon, 26 Jul 1997 05:00:00 GMT" [2]=&gt; string(44) "Last-Modified: Wed, 07 Nov 2012 13:00:58 GMT" [3]=&gt; string(50) "Cache-Control: no-store, no-cache, must-revalidate" [4]=&gt; string(40) "Cache-Control: post-check=0, pre-check=0" [5]=&gt; string(16) "Pragma: no-cache" } </code></pre> <p>Here anything that blocks redirection ?</p> <p><code>header_remove()</code> also didn't worked. I have added this function just before the redirection call.</p>
php
[2]
2,980,321
2,980,322
Achieving easing functions with smaller values
<p>I am using some easing functions in C# which give <code>Ease In</code> and <code>Ease out</code> effects. However, what I am trying to achieve with these easing functions does not give an observable effect.</p> <p>For eg:</p> <pre><code>int x=2; while(x&lt;200) SetSomething(x = EaseIn(x, 1, EasingType.Quadratic)); </code></pre> <p>The speed with which SetSomething executes doesn't give enough time to notice the effect of <code>SetSomething</code>. For eg: The value starts from 2 -> 4 -> 16 -> 256</p> <p>I was trying to achieve the following kind of graphs, but with smaller values (not greater than 200): <a href="http://theinstructionlimit.com/wp-content/uploads/2009/07/easing.png" rel="nofollow">http://theinstructionlimit.com/wp-content/uploads/2009/07/easing.png</a><br/></p> <p>Easing functions implementation is here: <a href="http://theinstructionlimit.com/wp-content/uploads/2009/07/Easing.cs" rel="nofollow">http://theinstructionlimit.com/wp-content/uploads/2009/07/Easing.cs</a> <br/></p> <p>Even if I get the quadratic values in a smaller range &lt; 200, I need atleast a very small pause-like effect in each iteration of the loop to notice the effect easing. This small pause can also be follow a quadratic curve (i.e for easing: the pause duration might be more first and then lesser pause durations)</p> <p>What should I do for the same? How do I get quadratic graph in range &lt; 200 and this pause like effect in each iteration?</p>
c#
[0]
4,214,070
4,214,071
Adding stored procedures back up to the existing file
<p>Hi my application does back up of table structure and table data and exports data into a text file . To that existing test file i am trying to export stored procedures backup data as well . I mean i am trying to append this .</p> <p>Let say if my test file is 120202.txt which has table structure in it and now for stored procedure i am trying to append sproc data as well to the same file the following code :</p> <pre><code> if (SPBackupcheck.Checked) { Server server = new Server(serveName); Database db = server.Databases[dbName]; List&lt;SqlSmoObject&gt; list = new List&lt;SqlSmoObject&gt;(); DataTable dataTable = db.EnumObjects(DatabaseObjectTypes.StoredProcedure); foreach (DataRow row in dataTable.Rows) { string sSchema = (string)row["Schema"]; if (sSchema == "sys" || sSchema == "INFORMATION_SCHEMA") continue; StoredProcedure sp = (StoredProcedure)server.GetSmoObject( new Urn((string)row["Urn"])); if (!sp.IsSystemObject) list.Add(sp); } Scripter scripter = new Scripter(); scripter.Server = server; scripter.Options.IncludeHeaders = true; scripter.Options.SchemaQualify = true; scripter.Options.ToFileOnly = true; scripter.Options.FileName = **fileToWrite;** // this is the file i am trying to append . How can i achieve this ? } </code></pre>
c#
[0]
1,929,716
1,929,717
How to include file from another directory
<p>In the root (www) I have two folders.</p> <p>In the first folder, "folder1", I put a file called register.php.</p> <p>In the next folder, "folder2", I put files called header.php and footer.php.</p> <p>I need to include the header and footer files from folder2 in the register.php file.</p> <p>How can i do this? I tried to use this include ../folder2/header.php<br> ..but it does not work</p>
php
[2]
4,992,191
4,992,192
listview and round corner doesn't work
<p>What I want: I'am using a Listview and I want to use this view with round corners.</p> <p>Situation: A listview without round corners :-( .</p> <p>I use different examples to define a customShape</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;corners android:radius="30dp"/&gt; &lt;stroke android:width="1dp" android:color="#000000" /&gt; &lt;/shape&gt; </code></pre> <p>If I apply this customShape to the listview items(Textview) every entry in Listview have round corners. It is crazy!!! So the customShape.xml works but not with the border of the listview.</p> <p>Any idea???</p> <p>regard marcel</p>
android
[4]
442,430
442,431
(C#) How to read all files in a folder to find specific lines?
<p>I'm very new to C# so please have some extra patience. What I am looking to do is read all files in a folder, to find a specific line (which can occur more than once in the same file) and get that output to show onscreen.</p> <p>If anyone could point me in the direction to which methods I need to use it would be great. Thanks!</p>
c#
[0]
2,548,545
2,548,546
How do I stop setNeedsDisplayInRect / drawRect coalescence?
<p>When programming my app, I get to the point where I have to update two rectangles on the screen. So I call [self setNeedsDisplayInRect:rect1] and then [self setNeedsDisplayInRect:rect2]. When my drawRect method is called, the rectangle parameter is the smallest rectangle which contains both rect1 and rect2.</p> <p>I can handle this with no problem, but when the two rectangles are far apart, then I am updating a lot of real estate with no gain. In this case, I would just like to repaint my two small rectangles.</p> <p>So my question is how can I prevent the underlying system from coalescing my two calls into one?</p>
iphone
[8]
3,017,915
3,017,916
How does PHP Work?
<p>We have all seen many question on StackOverflow that are founded upon the idea that PHP works like Javascript. Where the person clearly does not understand that PHP is a <em>Preproccessor</em> and only works before the page is sent out. </p> <p>A clear example of this is in the following code, where <code>runCommand()</code> will not run when the user presses the button.</p> <pre><code>&lt;a href="&lt;?php runCommand(); ?&gt;"&gt;Click Me!&lt;/a&gt; </code></pre> <p>as it would in Javascript</p> <pre><code>&lt;a href="javascript:runCommand();"&gt;Click Me!&lt;/a&gt; </code></pre> <p>I've seen many questions like this that are from new people that just simply don't realize 'how' PHP works. </p> <p>My question is: <strong>Where is a great resource that explains how PHP works?</strong>. </p> <p>I want to be able to redirect people to a page that can get them going on the correct track and know what being a <em>Preproccessor</em> means.</p> <p><em>(This also allows me to be lazy and not have to write an explanation every time it comes up, but don't tell anyone!)</em></p> <p>If you don't know of a place that describes this well, feel free to provide your own interpretation.</p> <p>As <strong>Carl Smotricz</strong> points out, there is a part of PHP that can be used outside of the browser. But I'm mainly talking about in a Apache enviorment where a user requests a web page, and expects to get something back, usually in HTML.</p>
php
[2]
5,636,655
5,636,656
Android: How to Saparate the Movable(Phone to SD) app and Phone Only app effectively
<p>As I am trying to separate the android app whether it is movable to SD or not by its manifest specified attribute such as <code>installLocation</code>. if it is "auto" or "preferExternal" then the given app is movable to SD else not. this is working fine. but the problem is that some app are displayed in movable app list because its manifest attribute is specified as above but in real this app is not movable.</p> <p>The same thing is happenning with phone only list. e.g "Google play service" app is displayed in phone only list but it founds as Movable in real. ,"Kies air" app is displayed in movable list but in real I cant move it.there are also many other app. I do this by parsing the "<code>Android menifest.xml</code>". Also tried grepcode's "package info" class but I cant solve this problem.</p> <p>Can u give me the particular way to saparate this kind of app effectively as same as "App2Sd" app in market?</p> <p>Thanking You.</p>
android
[4]
2,782,929
2,782,930
pyhook in linux
<p>I want to create my keylogger for learning purpose and it is for linux in Python,I had made some research in google and i found pyhook and pythoncom will do my job in windows and for linux i found simplekeylogger from sourceforge.net but it uses Xlib but i need some thing from command line to do,if you people find any existing code in internet do let me know the link.</p>
python
[7]
5,644,216
5,644,217
php setting text
<p>I'm working on a site in php. Originally I had a lot of html pages but they were all very similar in that they had a heading, an image, and some text. I was able to consolidate my pages into one php page and pass in the heading and image name as GET variables. I wouldn't want to pass a lot of text this way though. What's the best way to do this? I was thinking of including the text from a text file but then I'd have a text file for every item. I also thought that I could have a database and read the text from there. What do you guys think?</p>
php
[2]
4,984,551
4,984,552
Max connections
<p>What is max connections in a web.config?</p> <p>If it is 40, does it mean only 40 users can be connected at a time?</p> <p>Thanks.</p>
c#
[0]
3,258,711
3,258,712
C# .net Get FullName from Process ID
<p>how to get FullName(path) from Process ID</p> <p>For example if int id = 234</p> <p>how to find the location of id;</p> <pre><code>int Id = Convert.ToInt32(lvprocesslist.SelectedItems[0].SubItems[1].Text); string s = Process.GetProcessById(Id).MainModule.FileName; Console.WriteLine(Path.GetFullPath(s)); </code></pre> <p>its not working under a windows PID, (notepad with 3704) not working</p> <p>thankyou.</p>
c#
[0]
5,343,228
5,343,229
Garbage Collection in java
<p>While isolating reference (islands of isolating) a class objects say like the below code</p> <pre><code>public class Island { Island i; public static void main(String [] args) { Island i2 = new Island(); Island i3 = new Island(); Island i4 = new Island(); i2.i = i3; // i2 refers to i3 i3.i = i4; // i3 refers to i4 i4.i = i2; // i4 refers to i2 i2 = null; i3 = null; i4 = null; // do complicated, memory intensive stuff } } </code></pre> <p>will these objects be garbage collected? How is that possible then what makes the program run if they are garbage collected?</p>
java
[1]
940,879
940,880
Preventing users from abusing an image deletion script
<p>Basically the following for the core part:</p> <pre><code>$file = basename($_GET['f']); $directory = "/var/www/site/"; $file = $directory . $file; $hash = $_GET['h']; $md5check = md5($file); $md5check = substr($md5check, 0, 5); if ($md5check == $hash) { if (file_exists($file)) { unlink($file); } else { die('error'); } } else { header('Location: error'); exit; } </code></pre> <p>I realise using the users input is asking for trouble, but how can I get the server to 'locate' the file to delete? Am I somehow able to escape injections?<br /> The user would be loading <a href="http://site.com/?f=test.jpg&amp;h=hashc" rel="nofollow">http://site.com/?f=test.jpg&amp;h=hashc</a></p> <p>Also is there any other hash systems besides MD5 which is separate for each location of a file? <br /> eg. <br /> file1.rar downloaded at 12:00am = differenthash <br /> file1.rar downloaded at 11:00pm = randomhash<br /> file1.rar is the same file in both scenarios. </p> <p>versus md5:<br /> file1.rar downloaded at 12:00am = randomhash <br /> file1.rar downloaded at 11:00pm = randomhash<br /> file1.rar is the same file in both scenarios. </p>
php
[2]
1,821,403
1,821,404
Android images confusion?
<p>I have say 30 images in my android app. And as per android's documents I should have images for all screen resolution i.e. I should have drawable, drawable-mdpi, drawble-hdpi etc. </p> <p>Does this mean that I will end up having and asking the user to download 30*4=120 images, or does the android platform check before uploading and only uploads the images supported for that particular phone?</p> <p>Is there any nice and easy way to handle these images?</p>
android
[4]
1,085,099
1,085,100
How do I use Linq Sum After grouping by
<p>I have a list of records i.e.</p> <pre><code>Id, Activity, Marks 1, A, 12 1, B, 14 1, B, 15 2, A, 1 2,A,100 </code></pre> <p>I want to group the records by Id and Activity and then return the sum of the records.</p> <p>How do I achieve that using LINQ? E.g. result should be:</p> <pre><code>Id, Activity, TotalMarks 1, A, 12 1, B, 29 2, A, 101 </code></pre>
c#
[0]
5,773,219
5,773,220
how to search in array and return all values or keys of element that contains the value searched for
<p>I want to create a function that returns all the values that contains the value searched for.</p> <hr> <p>for example: I have an array of these values: "red", "green", "blue"</p> <hr> <p>if I searched for "re" the result would be: "red", "green" or the keys 0, 1</p>
javascript
[3]
4,026,511
4,026,512
changing label value in background?
<p>i am changing the label's value through timer(having interval of 1 second) by incrementing the count of an integer variable... I close the app....label starts incremented its value from where it was stopped...so app resumes it self from where it was stopped...but is there any way to take the labels value to the time for which it is closed i.e. if I close the app at the labels value 23...and close the app for 10 seconds...so when i open the app the labels starts incrementing itself from 33?? Thanks...</p>
iphone
[8]
3,879,716
3,879,717
App is running on galaxy tab 2 7.0 but not running on galaxy tab 7.0 plus
<p>I have developed an app for kids and uploaded it on Google Play. It's working well on Galaxy Tab 10.1, Galaxy Tab 2 7.0, Galaxy Nexus, Galaxy Note and Galaxy S3. I've changed the api level from 2.2 to 4.1. A user downloaded the app on Galaxy Tab 7.0 Plus ICS and complained of an issue: the app hanged and was not responsive. At this time I do not have Galaxy Tab 7.0 Plus so cannot test it and figure out the error which hangs the app and makes it not responsive. Any help regarding this issue will be appreciated.</p>
android
[4]
5,243,267
5,243,268
Using doctests from within unittests
<p>I typically write both unittests and doctests in my modules. I'd like to automatically run all of my doctests when running the test suite. I think this is possible, but I'm having a hard time with the syntax.</p> <p>I have the test suite</p> <pre><code>import unittest class ts(unittest.TestCase): def test_null(self): self.assertTrue(True) if __name__ == '__main__': unittest.main() </code></pre> <p>I'd like to add to this suite all of the doctests in module <code>module1</code>. How can I do this? I've read the <a href="http://docs.python.org/library/doctest.html#unittest-api" rel="nofollow">python docs</a>, but I'm not any closer to success, here. Adding the lines</p> <pre><code>import doctest import module1 suite = doctest.DocTestSuite(module1) </code></pre> <p>doesn't work. <code>unittest.main()</code> searches through the current file scope and runs every test <strong>case</strong> it finds, right? But DocTestSuite produces a test <strong>suite</strong>. How do I get <code>unittest.main()</code> to run the additional cases in the suite? Or am I just confused and deluded??</p> <p>Once again, I'd be grateful for any help anyone can offer.</p>
python
[7]
1,779,286
1,779,287
Android: Trying to make a simple slide show app
<p>I'm trying to make a slide show app, but cannot figure out how to get the pictures to display in the background. This is what I was going to do</p> <p>I was going to use the background property of a <code>LinearLayout</code>. The problem is that the <code>setBackgound</code> takes in a resourceid, </p> <p>From previous experience, you cannot have a lot of images stored as resoucrs, so I was going to store them in the asset folder and load them in using the following code</p> <pre><code>try { String FileName=new String("background"); AssetManager assetManager= getAssets(); InputStream inputStream; inputStream=assetManager.open(FileName); Bitmap Background=BitmapFactory.decodeStream(inputStream); } catch( IOException e) { </code></pre> <p>Is there a way to load a asset into the background property?</p> <p>I have used a ImageView before, but I wanted the images to be in the background so I could draw the controls ontop of the image. I'v seen this done in other Gallery programs.</p> <p>Does anybody now a way to load pictures from assets and have them in the background with the controls on top, or another way to do this?</p>
android
[4]
5,102,097
5,102,098
How to use another layout id?
<p>In my application I have used one alert box.. In this alert box, I give another layout to be show.. using <code>setView()</code> method.. I have a problem. How to use layout elements id in my activity?</p> <pre><code>LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.volume, null); builder.setTitle("Volume"); builder.setView(layout); builder.setPositiveButton("OK", null); builder.setNegativeButton("Cancel", null); AlertDialog alert1 = builder.create(); alert1.show(); </code></pre>
android
[4]
1,395,325
1,395,326
Customview like tableview in iphone SDK?
<p>I want to do custom tableview which scrolls horizontally.If you see this <a href="http://www.roambi.com/roambi_on_iphone.html" rel="nofollow">URL</a></p> <p>If you go to SUPERLIST tab in flash iphone simulator,you can see one column is differed from other columns which scrolls horizontally.any idea to do this?any help please?</p>
iphone
[8]
466,098
466,099
How right add image in div?
<p>Good day</p> <p>Script:</p> <pre><code>var img_src="../Images/" + data; $("#div_yui_img").html(\'&lt;img src="img_src" id="yui_img" height="100" width="100"&gt;\'); </code></pre> <p>but after add in html i see:</p> <pre><code>&lt;div id="div_yui_img"&gt;&lt;img src="img_src" id="yui_img" height="100" width="100"&gt;&lt;/div&gt; </code></pre> <p>tell me please how right add image in div, that get(example):</p> <pre><code>&lt;div id="div_yui_img"&gt;&lt;img src="../Images/test.jpg" id="yui_img" height="100" width="100"&gt;&lt;/div&gt; </code></pre> <p>Thanks!</p>
jquery
[5]
5,174,371
5,174,372
calling chain method in javascript
<p>I am using the following code but it is constantly giving me errors :</p> <blockquote> <p>TypeError: container("accounts").atPosition("#left-top") is undefined</p> </blockquote> <p>the code is :</p> <pre><code>function container(name, position) { return { pos: null, atPosition: function(position) { $(position).html(this.newContainer()); //$(position+" .main").html("yes"); this.pos = position; }, populateData: function(rdata) { $("#left-top .main").html(rdata); }, newContainer: function() { //alert(this.pos); return '&lt;h3&gt;' + name.toTitleCase() + '&lt;/h3&gt;\ &lt;div class="main"&gt;\ &lt;/div&gt;'; } }; } container('accounts').atPosition('#left-top').populateData("yahoo!!!!");​ </code></pre> <p>Why am I receiving this error and how can I fix it? </p>
javascript
[3]
2,757,600
2,757,601
Android Launcher Icon Size
<p>For HDPI and XHDPI what is the ideal size of the launcher icon respectfully? Will i have to create 9Patch images for the icon to scale automatically, or would it be better to create separate icons ? </p> <p>Kind Regards, </p>
android
[4]
2,583,581
2,583,582
How many max timers can an android application create
<p>Anybody know How many max timers can an android application create?</p>
android
[4]
3,531,450
3,531,451
How to manage xmlns to be able to execute an xpath query?
<p>I would like to get some specific values in a (x)html file using an xpath statement.<br> I read the html file like an xml file using the xmlDocument class.<br> Problem is that my xpath query doesn't work because of the namespace defined in the html tag:</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; </code></pre> <p>If I remove the xmlns in the html tag, it works fine.<br> What's wrong? (I don't want to use the Html Agility Pack)<br> Thanks!<br> Here's my code:</p> <pre><code>XmlDocument readDoc = new XmlDocument(); System.Xml.XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(readDoc.NameTable); readDoc.XmlResolver = null; xmlnsManager.AddNamespace("html", "http://www.w3.org/1999/xhtml"); readDoc.Load("myHTML.html"); int count = readDoc.SelectNodes("//html/body/div/span[@class='layout']",xmlnsManager).Count; </code></pre>
c#
[0]
3,770,600
3,770,601
How do I initialize a PHP variable?
<p>I am fairly new to PHP (less than a year), and to improve my development environment, I recently started using NetBeans IDE.</p> <p>A warning keeps popping up everywhere stating that <strong>"Variable might not have been initialized"</strong>. </p> <p>I'll give an example of a variable that results in this hint/warning:</p> <pre><code>$start = $per_page * $page; </code></pre> <p><strong>My question is: How can I initialize a PHP variable? Also, how important is it that a variable is initialized in PHP?</strong> </p> <p>I appreciate any advice you can provide.</p> <p><em>Note: I tried to place the following code above my variable, to no avail.</em></p> <pre><code>$start = ''; </code></pre>
php
[2]
223,454
223,455
Edit MP4 metadata using Python
<p>I need to give attributes (meta data) to a file in python code on Linux, specifically Ubuntu.</p> <p>Specifically I need to set the author, title, album, etc. on MP4 files.</p>
python
[7]
1,866,015
1,866,016
var vs explicit declaration
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/41479/use-of-var-keyword-in-c">Use of var keyword in C#</a> </p> </blockquote> <p>Hi, Just moved job and I make large use of var. Previous job we were doing lots of TDD and using resharper.</p> <p>In this job they hate third party tools and the developers there say that var is not good to use all the time and is not as efficient.</p> <p>Some time ago I thought the same but now I got so used to it and makes my code look neater.</p> <p>I have read some posts and there seems to be confusion whether is as efficient or not. I read that produces the same IL code.So should be the same no? somewhere else I read that even though produces the same IL code it has to find out what type it is. So what does Inferred really mean then?</p> <p>Some clarification whether performance wise is the same would be fantastic.</p> <p>Thanks a lot</p>
c#
[0]
1,864,855
1,864,856
How to make create a dependency between a Jar and a project using only commandline?
<p>I made two projects P1 and P2 in eclipse IDE. P2 depends on P1. I did not create any dependency between P1 and P2. I want to convert P1 to Jar and then make P2 use that Jar.</p> <p>How do I do this using the commandline ? Is there a commandline inside eclipse which I could use ? If not, I will use the good old commandline.</p> <p><strong>EDIT -</strong> both p1 and p2 have a main method. </p>
java
[1]
3,524,896
3,524,897
Is there any wrapper for gecko in gtk#
<p>Is there any wrapper for gecko in gtk#? I couldn't find any, despite I could find a wrapper for WinForms, which apparently aren't useable cross plaform. (They can be compiled cross platform, but my experience with WinForm in linux is more than horrible)</p>
c#
[0]
4,000,172
4,000,173
How to draw a ring using canvas in android?
<p>Can anybody suggest me how to draw a ring using canvas methods. I may draw to circles using <code>canvas.drawCircle()</code> but how should I feel a space between them?</p>
android
[4]
4,694,468
4,694,469
constructors in python
<p>i need help in writing code for a constructor that takes the parameters x, y and angle. can anyone show me how to write it.</p>
python
[7]
3,960,390
3,960,391
Sorting a tuple in python
<p>How to sort a tuple based on the first value i.e,in dictionary we can use sorted(a.keys())</p> <p>How to do it in a tuple</p> <p>if these are the tuple values </p> <pre><code> t = [('2010-09-11','somedata',somedata),('2010-06-11','somedata',somedata),('2010-09-12','somedata',somedata)] </code></pre> <p>tuple should be sorted based on date,first field</p>
python
[7]
5,763,687
5,763,688
ObjectDataSource Filtering on DateTime
<p>I am currently using <code>ObjectDataSource</code> filtering on my gridview control. The <code>ObjectDataSource</code> filtering works well with Date. However, if there is a column with timestamp, the <code>ObjectDataSource</code> filtering doesn't work at all.</p> <p>For Example, if the column only contains the <code>DateTime</code> like '02/01/2011', the <code>ObjectDataSource</code> filtering works fine with the data. If the column contains the <code>Datetime</code> with the timestamp, '02/01/2011 10:30 AM', the user tried to filter it by entering '02/01/2011 10:30 AM' to filterexpression. the <code>ObjectDataSource</code> filter doesn't work at all. I was wondering if anyone can give me a hint on this one.</p>
asp.net
[9]
1,809,677
1,809,678
clear cache mwmory when will i start my application in android
<p>I want to program for clear cache memory when will i start my application in android,Anybody knows coding please give me.</p> <p>Thanks All</p>
android
[4]
3,792,406
3,792,407
PHP Multiple Object Dereference
<p>How can I do multiple levels of de-referencing? For instance, in C#, we can keep appending a '.' to access the next objects properties: <code>string s, s.ToString(), s.ToString().ToUpper()</code>. With PHP, I get to around <code>$this-&gt;someobject</code>, but <code>$this-&gt;someobject-&gt;somethingelse</code> does not appear to work. </p> <p>Any ideas? </p>
php
[2]
3,633,324
3,633,325
Cannot reset OpenFlow
<p>I'm using OpenFlow on IPhone to create a "slideshow" of images. My problem is that I cannot reset the OpenFlow view, when I want to add a new set of images. Can anybody help?</p>
iphone
[8]
5,619,799
5,619,800
Display html text in uitextview
<p>How to display html text in textview </p> <p>for example</p> <p>string &lt;h1&gt;Krupal testing &lt;span style="font-weight: bold;"&gt;Customer WYWO&lt;/span&gt;&lt;/h1&gt;</p> <p>Suppose text is bold so it display in textview as bold string but i want display normal text.is this possible in iphone sdk.</p> <p>Thanks you,</p>
iphone
[8]
2,772,335
2,772,336
JQuery traverse table
<p>How to traverse table in JQuery?</p> <p>Code is as follows,</p> <pre><code>&lt;table id="tblData"&gt; &lt;tr id="tr_1"&gt; &lt;td&gt;&lt;input type="text" id="txtData1" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="tr_4"&gt; &lt;td&gt;&lt;input type="text" id="txtData4" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="tr_10"&gt; &lt;td&gt;&lt;input type="text" id="txtData10" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>How to get html of each row?</p>
jquery
[5]
2,008,719
2,008,720
Java output file doesnt recognise \n as linebreak
<p>for a Java project for a University Class I have a method that saves ASCII images as a uniline string and another method called toString rebuilds this ASCII image and returns as a string. When I run my program on the Eclipse my output looks on console alright and multiline, and there are line breaks where they should be. But when I run it with the command line with a redirected outputfile </p> <p>java myprogram &lt; input > output </p> <p>the text in the output is uniline without line breaks</p> <p>Here is the code of the method </p> <pre><code>public String toString(){ String output = ""; for(int i=0; i&lt;height; i++){ output=output+image.substring(i*width, i*width+width)+"\n"; } return output; } </code></pre> <p>What should I do so I can get a multiline output text file</p>
java
[1]
2,351,627
2,351,628
Android Gallery and ImageSwitcher First Image
<p>I have implement Gallery and Image Switcher in Eclipse Android Development.</p> <p>On click of thumbnail, it loads the image and on click of Set Wallpaper, it sets the wallpaper as well. But as soon as the application loads, I want to display the first image from the Gallery to Image Switcher. Other wise if you click on Set Wallpaper, it will throw an exception. After you select an image from the Gallery, it will work fine.</p> <p>Can anyone please help me how to show the first image of the gallery in Image Switcher so that when I click Set Wallpaper without selecting an image, it should work fine</p> <p>One more thing, after image switcher initialization, I have set the first image but it takes the entire window in Emulator? If you select an image it show the preview.</p> <p>Thanks in advance.</p>
android
[4]
1,071,397
1,071,398
Renaming file in same directory using Python
<p>So I'm trying to iterate through a list of files that are within a subfolder named <code>eachjpgfile</code> and change the file from <code>doc</code> to the subfolder <code>eachjpgfile</code> mantaining the file's name but when I do this it adds the file to directory before <code>eachjpgfile</code> rather than keeping it in it. Looking at the code below, can you see why is it doing this and how can I keep it in the <code>eachjpgfile</code> directory?</p> <p>Here is the code:</p> <pre><code>for eachjpgfile in filelist: os.chdir(eachjpgfile) newdirectorypath = os.curdir list_of_files = os.listdir(newdirectorypath) for eachfile in list_of_files: onlyfilename = os.path.splitext(eachfile)[0] if onlyfilename == 'doc': newjpgfilename = eachfile.replace(onlyfilename,eachjpgfile) os.rename(eachfile, newjpgfilename) </code></pre>
python
[7]
4,950,569
4,950,570
python.exe is getting crashed at time of frame close
<p>I am making an application using wxpython in which i have imported some modules and added the some widgets but when i am closing the application window ie Frame(wxFrame) python.exe getting crashed and showing the following message "python.exe get encountered a problem and need to be close... Tell microsoft donttell smt smt".</p> <p>My app is working fine but this msg is coming while closing the app there is no message coming why its occur. Should i do something like deleting the wxwindows or bitmap of wxpython (i think some handle or some obj of wxpython/python like dict or list are in memory so manually i shd delete that, its my perception only may be wrong or right) if i am right then what thing of wxpython shd be deleted manually so this message shd not be appear.</p> <p>Any help really appreciable. Thanks in advance!</p>
python
[7]
1,162,318
1,162,319
Book, tutorials or sources for creating rich/complex interface (android)
<p>Pretty much the title. I'm new in android development. So, I'm interesting about developing rich application, but cannot find a good tutorials. I would be realy appreciated if someone guide me some resources for start. </p> <p>Maybe there is some open source project where I can find helpful information?</p> <p>Thank you</p> <p>UPD1 Is there some guide from start to end where explained how to make an application such a twitter app? Or any other kind of complex and start to end described application?</p>
android
[4]
1,412,007
1,412,008
open a file from a website in java
<p>Specifically I am trying to open a file from SharePoint, but it's really just a website, and I have the proper access so that' not an issue. I am trying to use the desktop api in java to open it, but it gives me an error message "File does not exist!" Does desktop only work locally? If it does work for websites, what am I doing wrong?</p> <p>new code based on stephen c's suggesttions, it still does not work however. What am I missing?</p> <pre><code>public class ParseURL { public static void main(String[] args) throws Exception { try { URL url = new URL("http://wss/is/sites/itsd/network/Remote%20Access/Soft%20Tokens/Your%20new%20RSA%20Soft%20Token%20for%20Android%20-%20INC%20XXXXXXX.oft"); InputStream is = url.openStream(); is.close(); } catch(IOException err) { } } } </code></pre> <p>old code </p> <pre><code> public static void main(){ try { File oftFile = new File("http://wss/is/sites/itsd/network/Remote%20Access/Soft%20Tokens/Your%20new%20RSA%20Soft%20Token%20for%20Android%20-%20INC%20XXXXXXX.oft "); if (oftFile.exists()) { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open(oftFile); } else { System.out.println("Awt Desktop is not supported!"); } } else { System.out.println("File does not exist!"); } System.out.println("Done"); } catch (Exception ex) { ex.printStackTrace(); } } } </code></pre>
java
[1]
1,313,265
1,313,266
Enable Disable JQuery Drag-able
<p>Hi all I am working on a print form that will enable Admin user Change the lay out of the print form so i select JQuery Dragable for the job and its working fine but their is one problem when Enable or Disable the first Element in HTML that is dragable take the Disable Style when Dragable is Disabled the other element keep there original look I am using IE 8 . I run the code on Fierfox and Chrome and the result was that all the Element change their style to disable style. I need the Elemnet to Keep there original Stayl</p> <p>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PrintablePassportDesigner.ascx.cs" Inherits="CSPDPassportPrintingPOC.UserControls.PrintablePassportDesigner" %></p> <p></p> <pre><code>function EnableDragAndDrop(cBox) { $("#divDoB").draggable({ disabled: cBox.checked }); $("#divNationalNo").draggable({ disabled: cBox.checked }); $("#divSex").draggable({ disabled: cBox.checked }); $("#divPlaceOfBirth").draggable({ disabled: cBox.checked }); $("#divIssueDate").draggable({ disabled: cBox.checked }); $("#divMotherName").draggable({ disabled: cBox.checked }); $("#divExpDate").draggable({ disabled: cBox.checked }); $("#divAuthority").draggable({ disabled: cBox.checked }); $("#divPassportHolderName").draggable({ disabled: cBox.checked }); } </code></pre>
jquery
[5]
124,034
124,035
(solved) JQuery: Getting data from child elements
<p>Markup:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="#" class="item-list" data-id="1"&gt;Link 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="item-list" data-id="2"&gt;Link 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="item-list" data-id="3"&gt;Link 3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>In JQuery, i would select link 1 and it should be able to fetch the data-id of link1. I tried</p> <pre><code>$('.item-list').click(function(){ var link = $(this); alert($(this).data('id')); }); </code></pre> <p>It doesn't have any result. </p> <p>Oh. the list gets generated after the page is loaded. I am querying the DB to get the list. Also, it is also possible for the list to change, depending on how the user filters the dB.</p> <p>Thanks.</p>
jquery
[5]
5,060,127
5,060,128
Why is a default ctor needed for this inner (nested) struct?
<p>I am trying to compile code similar to the snippet below:</p> <pre><code>class System { private: struct Configuration { Configuration(/*params*/); Configuration(const Configuration&amp;); Configuration&amp; operator=(const Configuration&amp;); ~Configuration(); /* member variables */ } m_config; explicit System(const Configuration&amp; cfg); // Non copyable constructable, non assignable System(const System&amp;); System&amp; operator= (const System&amp;); public: System(); ~System(); } //Implementation System::System() { m_config = Configuration(/*default params*/); // .... } </code></pre> <p>Compiler error: <strong>no matching function for call to ‘System::Configuration::Configuration()’</strong></p> <p>When I provide (even merely a declaration not a definition of) a default constructor for the nested struct, the error dissapears - WHY?!</p> <p>Misc Details: gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)</p>
c++
[6]
4,533,931
4,533,932
glpk err , import glpk module not found
<p>I am not able to Run glpk module based programs, on python 2.7.1 , Mac OS platform.</p> <p>I am not sure if glpk module is installed successfully.</p> <p>kindly help me, i am new to this.</p>
python
[7]
3,254,048
3,254,049
How to create a global shortcut while using JQuery noconflict
<p>How to declare a global window object while using jQuery.noConflict().</p> <p>I am using following way to avoid Jquery conflict with Mootools</p> <pre><code> var $j = jQuery.noConflict(); </code></pre> <p>Now I would like to create global shortcut in jquery and tried as </p> <pre><code> window.cc = function() {// code} </code></pre> <p>But fails and return error as cc not deined.</p>
jquery
[5]
5,066,551
5,066,552
How can you set a default checkbox value C#?
<p>How can you set a default checkbox value? Yes i'm new at all this. But I'm learning well. </p>
c#
[0]
4,576,947
4,576,948
jQuery function to check classes between two divs?
<p>I've got a page with two sets of <code>div</code> like so</p> <pre><code>&lt;div id="set1"&gt; &lt;div class="1"&gt;&lt;/div&gt; &lt;div class="2"&gt;&lt;/div&gt; &lt;div class="3"&gt;&lt;/div&gt; ..... &lt;div class="n"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="set2"&gt; &lt;div class="1"&gt;&lt;/div&gt; &lt;div class="2"&gt;&lt;/div&gt; &lt;div class="3"&gt;&lt;/div&gt; ..... &lt;div class="n"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>"set2" is hidden on page load but each div needs to appear when the corresponding div in "set1" is clicked. For example, when "div#set1.1" is clicked, "div#set2.1" will show up. How can I do this with jQuery?</p> <p>Thanks</p>
jquery
[5]
1,742,959
1,742,960
PHP & WLM web toolkit
<p>im looking for a method to connect to windows live web messenger without leaving my current page (like Ebuddy , Meebo ..) .</p> <p>let us take an example :</p> <p>my page is : <a href="http://wlm.com/wlm-web/index.php" rel="nofollow">http://wlm.com/wlm-web/index.php</a></p> <p>in this page i have a signin form with two inputs : Windows Live ID and Password and a button to Sign in .</p> <p>so i want when the user fill the form and click on "Sign in" button i want to connect him with Windows Live without leaving the current page (http://wlm.com/wlm-web/index.php) .</p> <p>is microsoft provide any api to use in this situation ?</p> <p>I can do it with Ajax but my question is where should i send the information of the user ? and how can i receive the wlm connect response : sucess[Setting Cookies] or failed[return error msg] ?</p> <p>my project is when the user login i'll refresh the page and Playing with wlm web toolkit Controls .</p> <p>thanks ..</p>
php
[2]
6,027,471
6,027,472
I am getting a syntax error on line 42(4th last line) and I cant fix it can someone please help?
<pre><code>def main(): # This code reads in data.txt and loads it into an array # Array will be used to add friends, remove and list # when we quit, we'll overwrite original friends.txt with # contents print"Welcome to the program" print "Enter the correct number" print "Hockey fan 1, basketball fan 2, cricket fan 3,Numbers of favorite players-4" choice = input("Select an option") while choice!=3: if choice==1: addString = raw_input("Who is your favorite player??") print "I love Kessel" elif choice==2: remInt = raw_input("Do you think that the Cavaliers will continue ther loosing ways?") print "I think they can beat the Clippers" else: inFile = open('data.txt','r') listNumbers = [] for numbers in inFile: listNumbers.append(numbers) print numbers inFile.close() print "Cricket is a great sport" def quit(): Print "Quitting Goodbye!" if __name__ == '__main__': main() </code></pre>
python
[7]
257,783
257,784
Python Convert fraction to decimal
<p>I want to convert 1/2 in python so that when i say print x (where x = 1/2) it returns 0.5</p> <p>I am looking for the most basic way of doing this, without using any split functions, loops or maps</p> <p>I have tried float(1/2) but I get 0... can someone explain me why and how to fix it?</p> <p>Is it possible to do this without modifying the variable x= 1/2 ??</p> <p>Thanks</p>
python
[7]
4,160,819
4,160,820
Access Control for objects
<p>Is it Possible to limit the functionality of class to certain objects only (in C++). What that would mean is, suppose there are 10 methods in a class and this class has 10 objects. Is it possible to have object1 &amp; object2 access only 3 functions. Object3, object4,object5, object6 access 6 functions. and rest of the objects access all functions?</p> <p>I am trying to implement an access control system, where general users can see only some limited functionality. Previlaged users can have little bit more access and administrators have access to all functions. </p> <p>One approach is to use inheritance, something like this:</p> <p>class PublicFeatures { public:</p> <p>// add some methods here; };</p> <p>class ProtectedFeatures:public PublicFeatures { public:</p> <p>// add some more methods here; };</p> <p>class AdminFeatures:public ProtectedFeatures { public:</p> <p>// add rest of the methods here; };</p> <p>In this case, we instantiate objects of any of three classes depending on the kind of access level we want. But what i am thinking is having just one class, and somehow restrict the access to some methods for that particular object.</p> <p>Is it possible to do such a thing? or i have to follow a different approach for implementing access control?</p>
c++
[6]
4,780,041
4,780,042
Error when forward declaring a struct: "has a previous declaration here"
<p>When building my small C++ project, I get the following 2 errors, can't figure out the cause: </p> <ul> <li><p>error: using typedef-name 'TTF_Font' after 'struct'.<br> Points to the following line of code: <code>struct TTF_Font;</code> in Foo.h. </p></li> <li><p>error: 'TTF_Font' has a previous declaration here.<br> Points to the following line of code: <code>typedef struct _TTF_Font TTF_Font;</code> in SDL_ttf.h.</p></li> </ul> <p>I've narrowed it down to the following files in a new test project: </p> <p>Foo.h:</p> <pre><code>#ifndef FOO_H #define FOO_H struct TTF_Font; class Foo { TTF_Font* font; }; #endif // FOO_H </code></pre> <p>Foo.cpp:</p> <pre><code>#include "Foo.h" #include "SDL/SDL_ttf.h" // No implementation, just testing </code></pre> <p>Main.cpp:</p> <pre><code>#include "Foo.h" int main(int argc, const char* argv[]) { Foo a; return 0; } </code></pre> <p>Do you guys know what I'm doing wrong?</p> <p>My goal is to forward declare TTF_Font, so I can use it in my header file without including the SDL_ttf header file. I read that including header files in other header files was kinda bad practice, so I switched to forward declarations. All my other forward declarations work fine except this single struct.</p> <p>When I replace the forward declaration <code>struct TTF_Font;</code> with the header include <code>#include "SDL/SDL.ttf.h"</code>, it compiles without errors. So I can use that, but I want to know WHY, dammit :-).</p> <p>Extra info: I'm using the Code::Blocks IDE with mingw32 compiler. Project uses the SDL graphics library. Not much C++ experience yet, come from C# background.</p>
c++
[6]