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
2,031,672
2,031,673
jQuery Get Height of Responsive Image
<p>I have a set of images that are responsive to the page (i.e. max-width set to 100% ).</p> <pre><code>&lt;div class="exh"&gt; &lt;img src="#" /&gt; &lt;/div&gt; &lt;div class="exh"&gt; &lt;img src="#" /&gt; &lt;/div&gt; &lt;div class="exh"&gt; &lt;img src="#" /&gt; &lt;/div&gt; </code></pre> <p>with</p> <pre><code>.exh img { max-width:100%; } </code></pre> <p>How do I retrieve the height of the image after the window is resized and whenever the page is loaded? When I use the following, I get a height of 0.</p> <pre><code>$(".exh img").each(function() { var $this = $(this); console.log( $this.height() ); }); </code></pre>
jquery
[5]
5,131,194
5,131,195
How can i add inline onclick event to hyper links using jquery?
<p>I need to generate nearly 80 hyperlinks using jQuery. I did that, all are fine. Now my client wants me to add a click event on to the hyperlinks? How can i do that?</p> <p>my present link is :</p> <pre><code>&lt;a href="#" class="removed purchase-btn"&gt;Long Sleeve Breton Top&lt;/a&gt; </code></pre> <p>but i need to add this :</p> <pre><code>$('&lt;a onclick="site.exec('page', 'openInternal', {'url': 'http://www.site.in/en-GB/Products/quickshop.aspx?qsi=AM154YEL&amp;amp;});" href="#"&gt;link'+i+'&lt;/a&gt;').appendTo('#hello'); } </code></pre> <p>for that, i used this function but there is no use:</p> <pre><code>$(function (){ for(i=0;i&lt;80;i++){ $('&lt;a onclick="site.exec('page', 'openInternal', {'url': 'http://www.site.in/en-GB/Products/quickshop.aspx?qsi=AM154YEL&amp;amp;});" href="#"&gt;link'+i+'&lt;/a&gt;').appendTo('#hello'); } }) </code></pre> <p>But it's not working. Any ideas to make this work?</p> <p>This links i need to generate and put in to application. so directly a click event from jquery i can't use. Strictly i need to place this code in inline..</p>
jquery
[5]
2,990,673
2,990,674
How to make python program extensible
<p>So I have a bunch of line of codes like these in a row in my program:</p> <pre><code>str = str.replace('ten', '10s') str = str.replace('twy', '20s') str = str.replave('fy', '40s') ... </code></pre> <p>I want to make it such that I don't have to manually open my source file to add new cases. For example ('sy', '70'). I know I have to put all these in a function somehow, but I'd like to map cases that are not in my "mapper lib" from the command line. Configuration file maybe? how? </p> <p>Thanks!</p>
python
[7]
5,074,169
5,074,170
Android MapView with High Res tiles?
<p>I have created a simple map app that shows the local garage sales in my town. It was simple enough to create and I parse out the Google Maps (html) xml doc that the local paper uses on their google maps mashup on their website.</p> <p>I have noticed that the Map Tiles used in the MapView class are not as high-res as the tiles used in the real Android Google Maps app (I have a Droid). I have searched the docs and google, but I cannot find any info on this. Actually, I can't even find anyone mentioning this, which surprises me and makes me think I am missing something simple. Is this a case of Google making the APIs available, but at a lower quality, or am I missing some setting that enables higher quality map tiles?</p>
android
[4]
5,072,474
5,072,475
JQuery: Remove 20th+ item
<p>I am prepending a li to a ul every few seconds. I want to set the limit to 20 items. Once there are 20 items I want to remove the oldest item so that there is never more than 20 items. How can I do this in JQuery?</p>
jquery
[5]
4,175,503
4,175,504
Jquery menu with less code
<p>I'm using Jquery for menu created like:</p> <pre><code>&lt;div class="prof_info1"&gt;home&lt;/div&gt;&lt;div class="prof_info2"&gt;info2&lt;/div&gt;&lt;div class="prof_info3"&gt;info3&lt;/div&gt; </code></pre> <p>And Jquery code like:</p> <pre><code>$(document).ready(function(){ $(".prof_info1").unbind("click").click(function(event) { $("#main").html('&lt;img src="img/spin.gif" class="spin"&gt;'); location.replace("?&amp;id=&lt;?=$id?&gt;") return false; }); $(".prof_info2").unbind("click").click(function(event) { $("#main").html('&lt;img src="img/spin.gif" class="spin"&gt;'); $("#main").load('?a=2&amp;id=&lt;?=$id?&gt;'); return false; }); $(".prof_info3").unbind("click").click(function(event) { $("#glavni").html('&lt;img src="img/spin.gif" class="spin"&gt;'); $("#glavni").load('?a=3&amp;id=&lt;?=$id?&gt;'); return false; }); }); </code></pre> <p>Is there any easier way to do write this Jquery code and make it with less code? Something like </p> <pre><code>if click somethind{ ... }elseif{ ....} </code></pre>
jquery
[5]
4,329,228
4,329,229
C#: Is there an "Optional" keyword or alike in C#?
<p>Is there a way in C# to mark a parameter as optional like VB.net's Optional keyword?</p>
c#
[0]
292,648
292,649
Android tabactivity - how to change icon image on selecting a tab
<p>In my tabactivity, I display icon that I get from the database, by creating an ImageView and passsing this to the setIndicator method. I have only one image for each tab, so I was wondering if there is way to just change the color of the image alone (as opposed to changing the tab's color) when a tab is selected? Also is it possible to hide the gray line that is being drawn at the bottom of the tabs when a tab is selected? Any help is appreciated..thanks</p>
android
[4]
3,127,729
3,127,730
ProgressDialog: change text size
<p>I create a ProgressDialog from java code:</p> <pre><code>mProgressDialog = ProgressDialog.show(this, ..., ... , true); </code></pre> <p>I want to change the message text size and its color how can I do it?</p>
android
[4]
5,270,281
5,270,282
how to split json format string in order to Deserialize is into .net object?
<p>The subject sounds unclear, but the logic is very simple. I have a returned response data that is in json format. I want to Deserialize it into .net object which I defined already. I use JavaScriptSerializer class Deserialize method, it requires the parameter to be string. Now my response data is in json format, and has <strong>more than one</strong> roots. </p> <p>My code is </p> <pre><code> WebRequest request = WebRequest.Create ("https://xxx.xxxxxx.com/xxxxx"); request.Method = "GET"; request.ContentType = "application/json"; var response = (HttpWebResponse)request.GetResponse(); using (var streamReader = new StreamReader(response.GetResponseStream())) { var responseText = streamReader.ReadToEnd(); } </code></pre> <p>The responseText value is</p> <pre><code>[ { "webinarKey":5303085652037254656, "subject":"Test+Webinar+One", "description":"Test+Webinar+One+Description", "organizerKey":73563532324, "times":[{"startTime":"2011-04-26T17:00:00Z","endTime":"2011-04-26T18:00:00Z"}] }, { "webinarKey":9068582024170238208, "name":"Test+Webinar+Two", "description":"Test Webinar Two Description", "organizerKey":73563532324, "times":[{"startTime":"2011-04-26T17:00:00Z","endTime":"2011-04-26T18:00:00Z"}] } ] </code></pre> <p>I use following code to deserialize responseText to a .net object that I defined.</p> <pre><code>JavaScriptSerializer ser = new JavaScriptSerializer(); Webinar w=ser.Deserialize&lt;Webinar&gt;(responseText); </code></pre> <p>Error comes out says responseText is an array, not string. Then how to split responseText? I don't think it is appropriate to use string.split() method here.</p>
c#
[0]
981,886
981,887
How to pass values from html page to .aspx page?
<p>i have </p> <pre><code>&lt;input type ="text" id ="ID" value="" /&gt; &lt;input type ="text" id="Name" value ="" /&gt; &lt;input type="button" id="Submit" name="Submit" value="Submit" size ="45" /&gt; </code></pre> <p>when i click Submit button to pass values to .aspx page. </p>
c#
[0]
5,567,696
5,567,697
Cookies in subdomain doesnt work
<p>I got the following code:</p> <pre><code>&lt;?php $id = $_GET['id']; $vote = $_GET['vote']; $month = 2592000 + time(); $cookie = "votez" . $id; $cookiez = "viewz" . $id; if(isset($_COOKIE[$cookiez])) { if(!isset($_COOKIE[$cookie])) { setcookie($cookie, "voted", $month, '/', ".mywebsite.co.il"); } } else { setcookie($cookiez, "viewed", $month, '/', ".mywebsite.co.il"); } </code></pre> <p>?></p> <p>lets assume that I go to > www.mywebsite.co.il/example.php?id=1&amp;vote=1 on the first time > it will set the first cookie. on the second time > it will set the second cookie. on the third time > nothing will happen</p> <p>this is how it should work.</p> <p>but if I go to > www.mywebsite.co.il?/example.php?id=1&amp;vote=2 (after I was at www.mywebsite.co.il/example.php?id=1&amp;vote=1) it will set the first cookie again.</p> <p>if I will go to > www.mywebsite.co.il?/example.php?id=1&amp;vote=3 (after I was at www.mywebsite.co.il/example.php?id=1&amp;vote=1) it will set the first cookie again.</p> <p>and so on..</p> <p>what do I need to do so no matter what the vote equal, as long as its the same ID, the cookie will be the same?</p> <p>(this is not the full code and you dont need the full code in order to understand the problem or to solve it).</p> <p>thanks!.</p>
php
[2]
3,196,284
3,196,285
C# DLL noob, how to get functions
<p>I've been given a dll to talk to a device, I have little to no experience in C# and I'm supposed to get the device initialized by the end of the week. The dll has methods to open ports and send messages, but I have no idea how to get access to the functions</p> <p>I know its a bit ridiculous to ask but im running out of time. Thanks,</p>
c#
[0]
2,030,065
2,030,066
What is the $$ function in JavaScript?
<p>What is the $$ function in JavaScript or what library does it come from? </p> <p>Example code I have encountered:</p> <pre><code>$$('input_id') </code></pre> <p>I cannot locate any information regarding this function.</p>
javascript
[3]
367,123
367,124
How to read/write from/to an unknown java application build on swt/swing/awt?
<p>Suppose you have an application might be third party,build on swt/awt/swing comprises one text field. You do not know about the application i mean the class name of the application , text filed name of the application etc.. So how do you able to read from and write into that application if the application has opened already through java? How to build a java code performing this task automatically means take the desired application in the foreground and then automatically write into it ?</p>
java
[1]
5,457,278
5,457,279
Adding button on top of Imageview at runtime
<p>I am creating a imageview at runtime and now want a add a button on top of the Imageview dynamically at run time and if I pan the image in the imageview the button in it should also pan accordingly. The problem is that Imageview does not allow to add subviews in it. </p> <p>I am able to add the button on top of the imageview but when I pan the imageview the button remains constant in the screen. Any idea on how to do this? Here is what I did:</p> <pre><code> panImageView = new PanView(this); //Custom Imageview class to handle panning panImageView.setScaleType(ImageView.ScaleType.CENTER); //panimg.setAdjustViewBounds(true); FrameLayout mainRL = (FrameLayout) findViewById(R.id.mainRelativeLayout); mainRL.addView(panImageView); ImageWorker imgTask = new ImageWorker(panImageView, is); imgTask.execute(2000, 2000); //Start button Button startButton = new Button(this); int iRndBtn = R.drawable.round_button; startButton.setBackgroundResource(iRndBtn); startButton.getBackground().setColorFilter(Color.GREEN,PorterDuff.Mode.MULTIPLY); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(50, 50); //layoutParams.setMargins(intialPage.mapStartX, intialPage.mapStartY, 0, 0); layoutParams.setMargins(200, 200, 0, 0); startButton.setLayoutParams(layoutParams); //startButton. mainRL.addView(startButton,layoutParams); </code></pre>
android
[4]
40,519
40,520
Pointer type without delete operator
<p>Is it possible to construct a pointer type that acts and behaves (in terms of syntax) like a normal pointer, except that you can't call delete on it (perhaps with preprocessor macros)?</p> <p>Example usage:</p> <pre><code>borrowed_ptr&lt;int&gt; ptr = new int[42]; ptr[12] = 1; cout&lt;&lt;ptr[12]&lt;&lt;endl; //prints 1 delete ptr; //error: no operator delete for borrowed_ptr&lt;int&gt; borrowed_ptr&lt;int&gt; ptr2 = new int(2); delete ptr2; //error </code></pre> <p>Also this should work too</p> <pre><code>template&lt;typename t&gt; void func(borrowed_ptr&lt;t&gt; *arg) { delete arg; //error } //somewhere else int *t = new *int; func(t); </code></pre> <p>However, "reverse assignement" shouldn't work.</p> <pre><code>borrowed_ptr&lt;int&gt; foo = new int(2); int* bar = foo; //error </code></pre> <p>Whether or not the * is required when declaring a borrowed_ptr doesn't matter to me. It's just important that code like</p> <pre><code>template &lt;typename T&gt; void foo(T* whatever) { //do something with whatever delete whatever; } template &lt;typename T&gt; void bar(T* whatever) { //do something with whatever } </code></pre> <p>can be called with this borrowed_ptr like this:</p> <pre><code>borrowed_ptr&lt;int&gt; a = new int(2); foo(a); //error, function tries to delete bar(a); //fine, and has the same semantics as handing over a raw int* </code></pre> <p>Note: i don't want the data deleted when the pointer type is delete itself. it should just be a borrowed ptr that can not be deleted because it belongs to someone else.</p>
c++
[6]
5,966,442
5,966,443
Link should be open in same web view in Android
<p>I am new in Android and I am trying to open a Link in webview using this code</p> <pre><code>WebView myWebView = (WebView) findViewById(R.id.webinfo); myWebView.loadUrl("http://oslobokfestival.netteam.no/artical.php?articalid=93"); myWebView.setBackgroundResource(R.drawable.lbg); myWebView.setBackgroundColor(Color.TRANSPARENT); myWebView.getSettings().setJavaScriptEnabled(true); </code></pre> <p>and in this HTML page contains some links and I want that when user click that link should be open in same webview, at this point its opening in mobile browser, please give me appropriate solution.. Thanks. </p>
android
[4]
1,492,643
1,492,644
change css style on click with jquery
<p>I have the following click event. I would also like to toggle the background-position: between top and bottom on click. </p> <pre><code>$('.close').click(function () { $('.banner-inner-content').slideToggle('slow', function () { }); }); </code></pre> <p>So how can i toggle between? </p> <pre><code>.close{background-position:top} </code></pre> <p>and </p> <pre><code>.close{background-position:bottom;} </code></pre>
jquery
[5]
5,578,021
5,578,022
Can someone explain this piece of php code to me
<p>I understand the first half but am struggling with the second half. In particular the line "(key($a) !== $i)" is where I stop understanding. It is saying that if the key of the array $a is not equal to the index counter $i then the boolean vairable $isList is assigned false but I don't understand the signifigance of this statement. What does key($a) !== $i tell us usefully about the array $a? The lines following that statement also elude me. Please explain to me? Thank you</p> <pre><code>function getJsCode($a) { if (is_null($a)) return 'null'; if ($a === false) return 'false'; if ($a === true) return 'true'; if (is_scalar($a)) { $a = addslashes($a); $a = str_replace("\n", '\n', $a); $a = str_replace("\r", '\r', $a); return "'".$a."'"; } $isList = true; for ($i=0, reset($a); $i&lt;count($a); $i++, next($a)) if (key($a) !== $i) { $isList = false; break; } $result = array(); if ($isList) { foreach ($a as $v) $result[] = getJsCode($v); return '[ ' . join(',', $result) . ' ]'; } else { foreach ($a as $k=&gt;$v) $result[] = getJsCode($k) . ': ' . getJsCode($v); foreach ($a as $k=&gt;$v) $result[] = $k . ': ' . getJsCode($v); return '{ ' . join(', ', $result) . ' }'; } } </code></pre>
php
[2]
4,958,479
4,958,480
Get day names between two date in PHP
<p>How to get name of days between two dates in PHP?</p> <p><strong>Input:</strong></p> <blockquote> <p>Start Date: 01-01-2013<br> End date: 05-01-2013</p> </blockquote> <p><strong>Output:</strong></p> <blockquote> <p>Tuesday<br> Wednesday<br> Thursday<br> Friday<br> Saturday </p> </blockquote> <p><strong>Tried code</strong></p> <pre><code>$from_date ='01-01-2013'; $to_date ='05-01-2013'; $number_of_days = count_days(strtotime($from_date),strtotime($to_date)); for($i = 1; $i&lt;=$number_of_days; $i++) { $day = Date('l',mktime(0,0,0,date('m'),date('d')+$i,date('y'))); echo "&lt;br&gt;".$day; } function count_days( $a, $b ) { $gd_a = getdate( $a ); $gd_b = getdate( $b ); $a_new = mktime( 12, 0, 0, $gd_a['mon'], $gd_a['mday'], $gd_a['year'] ); $b_new = mktime( 12, 0, 0, $gd_b['mon'], $gd_b['mday'], $gd_b['year'] ); return round( abs( $a_new - $b_new ) / 86400 ); } </code></pre> <p>I saw the post <a href="http://stackoverflow.com/questions/10015136/finding-date-of-particular-day-between-two-dates-php">Finding date of particular day between two dates PHP</a></p> <p>But I don't got my result<br> Please help me</p>
php
[2]
63,645
63,646
How to call the function in this file?
<p>I pasted the code given in this link to a file called md5.js.</p> <p><a href="http://www.webtoolkit.info/javascript-md5.html" rel="nofollow">http://www.webtoolkit.info/javascript-md5.html</a></p> <p>I am not able to call the function in my below code. Please assist me.</p> <p><pre><code></p> function inc(filename) { var body = document.getElementsByTagName('body').item(0); script = document.createElement('script'); script.src = filename; script.type = 'text/javascript'; body.appendChild(script) } function CheckCaptcha() { var CaptchaWord=""; CaptchaWord = document.getElementById('studentusername').value; inc("md5.js"); //Add MD5 function here. } <p></pre></code></p>
javascript
[3]
2,605,080
2,605,081
How does AVAudioPlayer load audio data?
<p>Does it load the entire file at a time? Or does it act lazy and load a chunk at a time? I'm primarily interested in knowing how much memory my audio uses.</p>
iphone
[8]
2,657,140
2,657,141
jquery setting the order of handlers
<p>I have a class of div MyClass I want to hook up to two handlers. This class is generated dynamically and this is what I'm doing:</p> <pre><code>$('#MainDiv').on({ click: function () { Handler1($(this)); } }, '.MyClass'); $('#SpecialChildDiv').on({ click: function () { Handler2($(this)); } }, '.MyClass'); </code></pre> <p><strong>How do I control which handler is called first?</strong> Handler2 does some additional work but it's not called on every MyClass because it's not in the SpecialChildDiv. I want Handler 2 to be called AFTER Handler1.</p> <p>Thanks.</p>
jquery
[5]
4,728,904
4,728,905
Time difference between unix timestamps
<p>I have to try and work out if a unix timestamp is between 21 days and 49 days from the current date. Can anyone help me to work this out? Thanks!</p>
php
[2]
4,208,010
4,208,011
Problem with java on Windows
<p>I had installed jdk-6u18-windows-i586 on my machine. Later on I uninstalled it and installed jdk 1.5.0_13 instead.</p> <p>Now when I do javac -version I get</p> <pre><code>jdk 1.5.0_13 </code></pre> <p>But when I do java -version I get</p> <pre><code>java version "1.6.0_19" </code></pre> <p>How do I fix this?</p>
java
[1]
821,655
821,656
Remove lines from files
<p>I have a lot of files which have comments beginning with ! and I need to remove all of those, then replace the #Mhz with # Mhz on the next line and keep the file name same. What is an efficient way of doing this? I can read the file and write to a new file in a different directory and manually delete them later i guess but is there a better way?</p>
python
[7]
5,600,170
5,600,171
how to develop a cross platform application?
<p>I wanted to create application to be deployed in Android Mobile Devices, Web and Desktop application. Is it possible? Or can you suggest tools to achieve this?</p>
java
[1]
3,074,271
3,074,272
jquery on the fly new element
<p>Once a user click on a button it creates new input text on the fly. </p> <p>Lets assume those 2 input are created on the fly.</p> <pre><code>&lt;input id="txtImageSource_1" type="text"&gt; &lt;input id="txtImageSource_2" type="text"&gt; </code></pre> <p>Now to simplify my problem. I need to show the id of the input when they enter text inside it. Again those 2 elements have been created on the fly.</p> <p>I tried the following but don't work.</p> <pre><code> $('#' + $(this).attr('id')).live('keyup', function(){alert($(this).attr('id'))); }); </code></pre> <p>Creating the text box</p> <pre><code>$("#add_image").click(function() { var i = ($('p.fields').length); $('&lt;p class="fields" id="field_' + i + '"&gt;&lt;input type="text" id="txtImageSource_' + i + '"/&gt;"&lt;input type="button" value="Delete" class="btnDelete" id="' + i + '"&gt;&lt;/p&gt;').appendTo('#formelement'); }); </code></pre>
jquery
[5]
808,893
808,894
Intent to play a video always plays the same one
<p>I am creating an intent to play videos stored in the sdcard. It happens that I play the first one, everything is OK. But when I play another one, it just plays everytime the first one I played. Here is my code:</p> <pre><code> package com.remote; import java.io.File; import java.io.IOException; import com.remote.R.drawable; import android.app.Activity; import android.content.Intent; import android.graphics.PixelFormat; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.MediaController; import android.widget.VideoView; public class MyVideos extends Activity{ private String path="/sdcard/Movies/Telmex"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.myvideos); createLinks(new File(path)); } public void createLinks(File path) { LinearLayout layout = (LinearLayout) findViewById(R.id.myvideoslayout); if( path.exists() ) { File[] files = path.listFiles(); for(int i=0; i&lt;files.length; i++) { if(files[i].getName().toString().charAt(0)!='.') { String videoName; Button video=new Button(this); video.setBackgroundColor(2); video.setTextSize(23); video.setCompoundDrawablesWithIntrinsicBounds(0,0,drawable.videoicon,0); videoName=new String(files[i].getName()); video.setText(videoName); createListener(video,videoName); LinearLayout.LayoutParams p = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT ); layout.addView(video,p); } } } } public void createListener(Button video, final String name) { video.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { videoPlayer(path,name,true); } }); } public void videoPlayer(String path, String fileName, boolean autoplay) { Intent intent = new Intent(android.content.Intent.ACTION_VIEW); Uri data = Uri.parse(path+"/"+fileName); intent.setDataAndType(data, "video/mp4"); startActivity(intent); } } </code></pre>
android
[4]
3,710,944
3,710,945
working with Adrotator in asp.net
<p>how to work with Adrotator? i placed a Adrotator in my web application then i don't have any idea from here can u help me please</p>
asp.net
[9]
198,353
198,354
ASP .Net with C#(want to disable edit button of the gridview control after updating record only once)
<p>Hello Please anyone help me for, I want to make a program through which gridview edit command button disable once i update the record. I have Drop-downlist control and through selection of which gridview display data. While after updating a row in gridview i have error like that "Argument Exception was handled by user code and as <strong>Flag is neither a DataColumn nor a DataRelation for table DefaultView.</strong>"</p> <p>in .cs file i written in the gridview1_rowdatabound event as </p> <pre><code>switch (e.Row.RowType) { case DataControlRowType.DataRow: DataRowView myDataRowView = (DataRowView)e.Row.DataItem; if (Convert.ToInt32(myDataRowView["Flag"]) &gt; 0) { LinkButton EditLink = e.Row.FindControl("LinkEdit") as LinkButton; if (EditLink != null) { EditLink.Visible = false; //EditLink.Enabled = false; } } break; } </code></pre> <p>Flag is the my column value in database. After updating row in gridview its value becomes change and depends on them i can disable edit link for that perticular row of gridview. But i receive above error.</p>
asp.net
[9]
4,539,382
4,539,383
Unordered list styling with HTML markup
<p>In the link <a href="http://developer.android.com/guide/topics/resources/string-resource.html" rel="nofollow">String Resource</a> I came to know that Android supports only Bold, Italic and Underline styling with HTML markup, and I have seen some Application that displays Unordered list inside the AlertDialog, so tried to implement that in my application as</p> <p>in my String.xml, I've given</p> <pre><code>&lt;String name="unorderedlist"&gt;Different Types &amp;lt;ul&gt; &amp;lt;li&gt;T ype 1 &amp;lt;/li&gt; &amp;lt;li&gt; Type 2 &amp;lt;/li&gt; &amp;lt;/ul&gt; &lt;/String&gt; </code></pre> <p>in my activity, I tried to display it inside my AlertDialog as follows</p> <pre><code>String formatedString=String.format(getResources().getString(R.string.unorderedlist), ""); myAlertDialogBuilder.setMessage(Html.fromHtml(formatedString)); </code></pre> <p>Its not working, So is there any other way to do this, give me some guidance. Thanks in Advance.</p>
android
[4]
4,647,487
4,647,488
Android App will not function properly in production, but not receiving any errors or hints as to what is wrong
<p>I have been developing an app over the past 3-4 months. I am using eclipse with the Android SDK plugin. I have tested and tested and tested before releasing the app on the market. I finally decided that the app was ready and created a production certificate using the SDK tools through eclipse. Exported the project as an android app and submitted it to the market. The app needs to access a remote server to receive the information for the content of the app. I am not sure why, but for some reason the apk that is produced by exporting the project from eclipse always returns a login failure message. If I connect my device and install/run from eclipse using the same login credentials everything works just fine. What have I forgotten or done wrong?</p>
android
[4]
4,572,113
4,572,114
defining an inline default constructor C++
<pre><code>public: A(); A(int B){*C = B - 1;}; private: int *C; </code></pre> <p>I believe this is how to correctly call two default constructors but visual studio is giving me errors. What is wrong with this code?</p>
c++
[6]
5,448,446
5,448,447
How do a debug an exception on python shutdown
<p>When my process ends, I get output to stderr that looks like:</p> <pre><code> Exception exceptions.TypeError: "'NoneType' object is not callable" in &lt;function &lt;lambda&gt; at 0x5507d70&gt; ignored </code></pre> <p>My understanding is that this is caused by exceptions being generated during garbage collection (<strong>del</strong>() ?) or the weakref callback which I know is being used in this application. </p> <p>What are some methods for finding out where this is coming from ?</p>
python
[7]
5,840,813
5,840,814
How to use these array in php
<p>Can someone explain what is happening in these codes? I don't understand how cols and rows are being used. Thank you</p> <pre><code>$chartdata['cols'][] = array('label'=&gt;'Days Range','type'=&gt;'string'); $chartdata['rows'][] = array('c'=&gt;array(array('v'=&gt;$month),array('v'=&gt;$prevyearbal))); </code></pre> <p>how these associative arrays get saved in the two dimensional array? Is <code>$chardata['cols'][]</code> going from row <em>0</em> to row <em>n</em>?</p>
php
[2]
3,984,907
3,984,908
beginner: python subprocess.call with hundreds of args
<p>Disclaimer: I am a beginner in python but have Drupal programming experience.</p> <p>I have this:</p> <pre><code>f = ['/path/1.jpg', '/path/2.jpg', '/path/3.jpg'] #less than 1500 files </code></pre> <p>and I need to do this</p> <pre><code>call(['c:/program files/ABBYY FineReader 10/finereader.exe'] + f) </code></pre> <p>BUT, there is an argument limit (http://stackoverflow.com/questions/2381241/what-is-the-subprocess-popen-max-length-of-the-args-parameter) of 32K characters, so I need to drop the /path first. How can I proceed, allowing the .exe to locate the files?</p> <p>Thanks!</p>
python
[7]
1,780,451
1,780,452
why POST method is not working?
<p>I have do post some information in cross domain . And i am achieving this thing by below code</p> <pre><code>&lt;?php function do_post_request($sendingurl, $data, $optional_headers = null) { $params = array( 'http' =&gt; array( 'method' =&gt; 'POST', 'url' =&gt; $data ) ); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($sendingurl, 'rb', false, $ctx); if (!$fp) { throw new Exception("Problem with $sendingurl, $php_errormsg"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problem reading data from $sendingurl, $php_errormsg"); } return $response; } $response = do_post_request('http://mag16.playtrickz.com/testing.php','http%3A%2F%2Fwww.facebook.com'); echo $response; </code></pre> <p>But it is not working . On successful POST Request : It will display its value otherwise it will show : <strong>nodata found</strong>. Why it is not working and how to make them work . </p>
php
[2]
1,301,033
1,301,034
Prompting the user for login authentication
<p>ASP.NET: I have created a website with login authentication. Before the user can visit any of the pages in it he needs to login first. How do I prompt the user to login first before he can view any of the contents of the website?</p>
asp.net
[9]
4,439,775
4,439,776
Disconnected Network Drive Issue After mounting FTP Drive
<p>I have created a Driver for FTP mounting but when i mount any folder it comes as "Disconnected Network Drive " , I am able to see the contents of the mounted folder and when i restart my system that mounted drive goes off. When i look into net use command for system CIFS(SMB) moiunting it works fine i dont know what i am missing in my driver code . I am not able to find any good document on net use also which describes how it is implemented and how it works . My application is in C++.</p> <p>Any help is highly appreciated.</p>
c++
[6]
4,780,861
4,780,862
Asynctask from non ui thread
<p>Is it a must that we have to initiate and execute asyctask from UI thread.Is it correct if i use asynctask for a webservice access(long running) from a non ui thread. sorry if my query is wrong.</p> <p>In my app i have to run around 10 webservices and have to show the result on ui .i am confused which approach will be good asynctask,intentservice or creating thread for each webservice call and making it to run parallel.</p>
android
[4]
1,959,243
1,959,244
Spinner selection resulting in a specific layout
<p>I am wondering, if I want to create sort of a form in which there is a spinner at the top that you can choose from. Depending on what you choose, the rest of the Textview/Edit text will be displayed.</p> <p>For example, you choose item 1 then a certain layout is displayed, and item 2 will lead to a different layout and so on.</p> <p>What would be the best design for that? I know Iwould have an item listener and based on the selection, I would "do something". Would I create layout with spinner and empty "linearlayout" below, then based on selection I would inflate another xml file into a view and add it to that layout? Or would create all the forms in one XML file and set all layout to hidden and show only the one corresponding to selection?</p> <p>How would you do it? Thank you</p>
android
[4]
200,424
200,425
handling new line in java
<p>i have written this small code </p> <pre><code>ResultSet rs=stmt.executeQuery(my_query); ResultSetMetaData md=rs.getMetaData(); int numColumns =md.getColumnCount(); for (int i=1; i&lt;numColumns+1; i++) { String columnName = md.getColumnName(i); Final+=columnName; } while (rs.next()) { for (int i=1; i&lt;numColumns+1; i++) { String output=rs.getString(md.getColumnName(i)); Final+=output; } } </code></pre> <p>here i want to add tab space in String columnName = md.getColumnName(i);</p> <p>and new line after Final+=output;</p> <p>I have tried <code>\n</code> <code>\t</code> and <code>newLine()</code> but nothing worked properly, </p> <p>since i want to have the <code>Final</code> string with all the column_names Plus data into one variable <code>Final</code>. </p> <p>I am able to get that easily into <code>Final</code> but the issue is that its all in one line so i need to add tab space(columnName) between column and line space (Final) between rows. Please suggest. </p> <p>thanks in advance. </p>
java
[1]
33,340
33,341
Does the inaccessible `.0` variable in `locals()` affect memory or performance?
<p>I maintain a project that has a function definition similar to this:</p> <pre><code>def f(a, (b1, b2), c): print locals() </code></pre> <p>While debugging the code I discovered that a <code>.1</code> key appeared in <code>locals()</code>, with the value <code>(b1, b2)</code>. A quick check revealed that a function definition like the following:</p> <pre><code>def f((a1, a2)): print locals() </code></pre> <p>will have a <code>.0</code> key in <code>locals()</code> with the value <code>(a1, a2)</code>. I was surprised by this behavior, but could find no information in the Python documentation.</p> <p>My questions are: do these otherwise-inaccessible positional variables affect memory or performance? Are they documented anywhere? What purpose do they serve?</p> <p>The project in question is feedparser, which is SAX-based and could potentially have dozens or hundreds of function calls that would be affected by this behavior.</p>
python
[7]
5,326,172
5,326,173
passing a php function a variable amount of parameters*
<p>Here is a php function: </p> <pre><code> mysqli_stmt_bind_param($statement, "s", ...variable amount of parameters...); </code></pre> <p>It will accept a variable amount of paramters you can review the documentation here - <a href="http://us3.php.net/manual-lookup.php?pattern=mysqli_stmt_bind_param&amp;scope=quickref" rel="nofollow">php.net</a>. Obvioiusly I can't type in $param1, $param2, $param3... because I don't know many there will be..it is decided after run-time.</p>
php
[2]
415,267
415,268
print and format output
<p>I have a simple script:</p> <pre><code>now = datetime.datetime.now() print "%d%d%d%d%d" % ( now.year, now.month, now.day, now.hour, now.minute ) </code></pre> <p>result:</p> <pre><code>20111124149 </code></pre> <p>How to get result:</p> <pre><code>201111241409 </code></pre> <p>?</p>
python
[7]
1,504,937
1,504,938
What about the types int2, int3, float2, float3 etc
<p>I've seen different code snippets using these types, but I haven't seen if they are defined in some &lt;standard header file&gt; or just defined in a "local header file" or even at file level.</p> <p>So what Im wondering is: Is there any standard header file that defines these types? Or is there some standard definitions that everyone uses that I should copy?</p> <p>I guess that a possible and common use to these types are representing coordinates, am I wrong?</p> <p>Is there anything else I should think about if I want to use these to represent positions in a grid? Any reasons why or why not to use them?</p> <p>EDIT:</p> <p>Clarification: int2 means a pair of ints, float3 means a triplet of floats.</p> <p>If these types were predefined somewhere it would be nice to use them instead of having to write it from scratch including the standard algebraic functions (operator+, operator-, etc.).</p>
c++
[6]
1,503,048
1,503,049
Jquery .on() not working on dynamic content
<p>I have a tag A in which when clicked on, it appends another tag B to perform an action B on click. So when I click on tag B, action B is performed. However, the .on method does not seems to be working on the dynamically created tag B. </p> <p>My html and jquery for tag A is as below</p> <pre><code>&lt;a id="address" class="add_address btn btn-inverse btn-medium pull-right push-top"&gt;Add Shipping address&lt;/a&gt; $('.add_address').click(function(){ //Add another &lt;a&gt; $(document).append('&lt;a id="address" class="pull-right update btn btn-inverse btn-medium push-top"&gt;Update&lt;/a&gt;'); }) </code></pre> <p>When tag B is clicked, some action B is performed. My jquery as below</p> <pre><code>$('.update').on('click',function(){ //action B }); </code></pre> <p>I have some non dynamic which has class ".update" as well and the on event above works fine for the non dynamic content, but not for the dynamic content. Any guys can help? Thanks in advance</p>
jquery
[5]
994,490
994,491
what is session and cookies in php and where it stored
<p>what is session and cookies in php and where it stored</p> <p>i googled. But i can't find the exact answer.</p> <p>kindly clarify</p> <p>thanks in advance</p>
php
[2]
111,584
111,585
JQuery, I need to drag images to doppable and record individual image name
<p>I am new to JQuery and would like to know if the following is possible!</p> <p>I have an array of images in php which I would like to display in a specific area. From here I would like to drag individual images to a droppable area and record the image name (path) to another php array.</p> <p>I have experimented by creating an image, and have been able to drag it to a droppable area using clone() which works successfully. However this only seems to work within a "div" tag and does not record the filename. Also my array can vary in size and image sources, if this cannot be achieved in JQuery what else could I look at?</p> <p>Hope someone can advise?</p> <p>Thanks</p>
jquery
[5]
2,674,956
2,674,957
PHP : How to optimize the multiple conditional
<p>I have a loop with multiple conditionals</p> <pre><code>foreach ($fields as $field_key =&gt; $value) { if ($field_key !== 'a' &amp;&amp; $field_key !== 'b' &amp;&amp; $field_key !== '10200' &amp;&amp; $field_key !== 'z' &amp;&amp; $field_key !== 'y') { ... //display $value; } } </code></pre> <p><em>How to optimize the code to avoid the multiple conditionals in the if clause?</em></p> <p>I am thinking of filing an array with <code>{a, b, y, z}</code> an search against it for a value to not be found there, using <strong>e.g</strong> <code>in_array</code>, <code>search_array</code></p>
php
[2]
730,076
730,077
ASP.NET Form Authenticaion
<p>I have created ASP.NET project and connect it to database. After I just added Login and Register control. Something like:</p> <pre><code> &lt;asp:Login ID="Login1" runat="server" DestinationPageUrl="~/Users/UserAccount.aspx"&gt; &lt;/asp:Login&gt; </code></pre> <p>Actually it works! It does registration and login operation. But HOW? Where is a code, where is SQL statement? I don't see anything related to that. Could you please explain me how it works? and how do I modify say registration control if I need extra information.</p> <p>Thanks!</p>
asp.net
[9]
3,489,370
3,489,371
why fullscreen functionality is not working in chrome?
<p>I need to open the window in fullscreen using javascript. I suceeded in mozilla. but in google chrome its not working. Why is it so.? anybody help me. I use this javascript for mozzilla.</p> <pre><code>&lt;INPUT type="button" value="Progress window!" onClick="window.open('divs.htm','mywindow', 'fullscreen=yes,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no')"&gt; </code></pre>
javascript
[3]
4,798,452
4,798,453
Mediaplayer works on Verizon 3g, but not Sprint
<p>I have a simple app that connects to a shout cast stream. It works fine on wifi. It also works fine on Verizon 3g/4g but will not connect on Sprint 3g. I have an onError listener and it shows error 1 and 503 for the extra tag. Any ideas? I get the same result on a Samsung Epic 4g and Epic 4g touch.</p>
android
[4]
2,759,675
2,759,676
Menu not showing up
<p>I have added a simple menu but its not showing up.</p> <p>this is menu.xml file-</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;item android:id="@+id/settings" android:alphabeticShortcut="@string/settings_shortcut" android:title="@string/settings_label"&gt;&lt;/item&gt; &lt;/menu&gt; </code></pre> <p>this is main.java file- </p> <pre><code> @Overridek public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return true; } </code></pre> <p>I just wanted to keep it simple.</p>
android
[4]
634,676
634,677
exec() cause an infinite loop of starting requested program
<p>OS: Linux.</p> <p>WHM, cpanel used.</p> <p>PHP 5.3.2 (cli) (built: Jun 11 2010 02:25:31) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies</p> <pre><code>&lt;?php exec("php xyz.php"); ?&gt; </code></pre> <p>starts calling the xyz.php innumerable times. the server hangs after sometime.</p> <p>calling 'php xyz.php' from the console works fine. </p>
php
[2]
2,563,826
2,563,827
Listbox1 to Listbox2 with button click
<p>I have some information stored in a listbox (listBox1) and want to do something like this:</p> <ul> <li>Click on an item in listBox1</li> <li>Click a button</li> <li>All information is transferred in listBox1 to transferred to listbox2</li> </ul> <p>BUT, I also want to have something else added at the end of the transferred information: numbers in the format of hh:mm:ss.</p> <p>Any help would be very much appreciated! </p>
c#
[0]
2,448,612
2,448,613
Java method overload
<p>I have 2 alternatives to implement a calculation method, and I am wondering what would be the better approach.</p> <p>The method needs some int and double parameters and (in some cases) a special flag to do some different calculation. </p> <p>In the first example, I could call the method with 'calculateFoo(1, 2.0d)' to have the boolean flag == FALSE.</p> <p>In the second example, I always have to set the boolean flag (even if I do not need it)</p> <p>Method 1: (here I'm using the '...' as an 'method overloading' parameter)</p> <pre><code>public SomeObject calculateFoo(int pIntValue, double pDoubleValue, boolean... pDoSpecialStuff) { if (pDoSpecialStuff.length == 0 || pDoSpecialStuff[0] == false) { // method was called without boolean flag or boolean flag was set to FALSE // do some calculation stuff // ... } else { // mehtod was called with boolean flag == TRUE // do some other calculation stuff // ... } return SomeObject; } </code></pre> <p>Method 2: (this is the 'common' approach)</p> <pre><code>public SomeObject calculateFoo(int pIntValue, double pDoubleValue, boolean pDoSpecialStuff) { if (pDoSpecialStuff == false) { // mehtod was called with boolean flag == FALSE // do some calculation stuff // ... } else { // mehtod was called with boolean flag == TRUE // do some other calculation stuff // ... } return SomeObject; } </code></pre>
java
[1]
5,543,825
5,543,826
If statement in google charts array
<p>Im trying to figure out how can I go about adding a if statement in a js array, i was thinking maybe a shorthand conditional would work but I am having no luck, this is what I have.</p> <p>I am trying to only include the arrays if the values are not empty.</p> <pre><code>gross1 = document.getElementById('gross1').value; profit1 = document.getElementById('profit1').value; gross2 = document.getElementById('gross2').value; profit2 = document.getElementById('profit2').value; gross3 = document.getElementById('gross3').value; profit3 = document.getElementById('profit3').value; function drawVisualization() { var wrapper = new google.visualization.ChartWrapper({ chartType: 'ColumnChart', dataTable: [['', 'Sales', 'Cost of Goods'], ['Product 1', parseInt(gross1), parseInt(profit1)], if(gross2 != '' &amp;&amp; profit2 != ''){ ['Product 2', parseInt(gross2), parseInt(profit2)], }elseif(gross3 != '' &amp;&amp; profit != ''){ ['Product 3', parseInt(gross3), parseInt(profit3)] }], </code></pre>
javascript
[3]
5,728,013
5,728,014
Compiling a C program that was entered into a textbox and received via PHP?
<p>I have this problem: I want to pass a whole C code from a php textbox onto server and want to compile it with gcc and want the output back on php page. Is it possible?</p> <p>Sample code:</p> <pre><code>php page input &lt;textarea&gt; #include&lt;stdio.h&gt; void main() { printf("hello world"); } </code></pre> <p>Compiled on server terminal/shell</p> <p>php page output:</p> <pre><code>hello world </code></pre>
php
[2]
2,169,127
2,169,128
Shopping cart suggestions
<p>I have a shopping cart and items are added to a session as follows. </p> <pre><code>array_push($_SESSION['cart'],sanitize($id)); </code></pre> <p>This is fine for single options that have no sub-options. But if you had and order like, Espresso with milk and an English muffin it would look a bit like this.</p> <pre><code> $_SESSION['0'] is 'Espresso' $_SESSION['1'] is 'Milk' $_SESSION['2'] is 'English Muffin' </code></pre> <p>or a deli menu</p> <pre><code> $_SESSION['0'] is 'sandwich' $_SESSION['1'] is 'ham' $_SESSION['2'] is 'cheese' $_SESSION['3'] is 'tomato' $_SESSION['4'] is 'Coke' </code></pre> <p>and then the user wanted to delete the <code>sandwich</code> and keep the <code>coke</code> how would I delete all of the sandwich and it's options <code>sandwich</code>, <code>ham</code> , <code>cheese</code>, <code>tomato</code> when the user choses to delete sandwich? keeping in mind the sandwich options could vary.</p>
php
[2]
5,343,478
5,343,479
Updating a part of the object works but it updates even before I update it
<p>Im updating a part of an object and the update works fine.Its when I did a console.log on the object before the I called the update functio,n the object was already updated.I was expecting to see the old copy of the object,i know Im doing something really silly.I just want to understand why this is happening.Here is my code</p> <pre><code>function updateObject(o){ o.a='oneHundred'; o.b='twoHundred' } var obj={ a : 'one', b : 'two', c : { a : '', b : '' } } console.log(obj);//outputs the updated object before I call updateObject() var upObject = obj.c ; updateObject(upObject); console.log(obj); </code></pre>
javascript
[3]
946,399
946,400
Refresh a TAB of a Tabhost listadapter from within a list of another adapter
<p>Sorry for my bad English.....</p> <p>i need refresh a TabHost (Tab2) from a ListAdapter include in this tab2....</p> <p>I have a TabHost and in tab2 i have an ListAdapter and in this i have other listAdapter. i need refresh this tab2 from this second ListAdapter.</p> <p>It is the plan:</p> <pre><code>[ Tab 1 ] [ Tab 2 ] ------------------------------------------ [05:00 am] - in first ListAdapter ------------------------------------ [ node 1 ] in second ListAdapter [ node 2 ] in second ListAdapter [06:00 am] - in first ListAdapter ------------------------------------ [ node 1 ] in second ListAdapter [ node 2 ] in second ListAdapter [ node 3 ] in second ListAdapter [06:30 am] - in first ListAdapter ------------------------------------ [ node 1 ] in second ListAdapter </code></pre> <p>If I click in buttons on Second ListAdapter I show a custom dialog and in this a need refresh the Tab2. For make for example the node 2 in 06:00 am not show more.</p> <p>How i can this be done? </p>
android
[4]
5,561,456
5,561,457
C++ -- Why not return Array1D&?
<pre><code>template&lt;class T&gt; class Array2D { public: class Array1D { public: T&amp; operator[](int index); const T&amp; operator[](int index) const; ... }; Array1D operator[](int index); // why not return Array1D&amp; const Array1D operator[](int index) const; // why not return Array1D&amp; ... }; </code></pre> <p>The above code is used to simulate a two-dimensional array with a class named as Array2D. Here is the question, why we should return Array1D rather than Array1D&amp;?</p> <p>Thank you</p>
c++
[6]
4,893,799
4,893,800
How to get "Internet Call" Information in Android
<p>Im working on android application in which i take backup of all contact information and then restore,i retreive all information of contact, For example:</p> <p>Display Name</p> <pre><code>Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,null,null, null, null) String name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME)); </code></pre> <p>Phone Number</p> <pre><code>Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,null, null); </code></pre> <p>Similary But i unable to get "Internet Call" value. Kindly anyone tell in which class i will get information about Internet Call information.</p> <p>Any help in this regards greatly appreciated.and it is urgent </p>
android
[4]
3,794,630
3,794,631
How to use readlines to read from file and return the abbreviation of item
<p>file looks like this:</p> <pre><code>BURGER KING BRG MCDONALDS MCDNLDS WENDYS WNDY </code></pre> <p>Example:</p> <pre><code>food('abbreviations.txt') Enter a fast food place: McDonalds Abbreviation: MCDNLDS Enter a fast food place: Thank you! </code></pre> <p>so far:</p> <pre><code>infile = open(filename, 'r') l = infile.readlines() infile.close() </code></pre> <p>but I don't know what to do after readlines</p>
python
[7]
4,517,250
4,517,251
Why don't list objects belong to a class?
<p>From the <a href="http://docs.python.org/tutorial/classes.html" rel="nofollow">classes tutorial</a>:</p> <blockquote> <p>In Python, the term method is not unique to class instances: other object types can have methods as well. For example, list objects have methods called append, insert, remove, sort, and so on.</p> </blockquote> <p>One implication I can find is this gives an error: <code>[].foo = 'bar'</code>. Are there other implications? Why isn't list implemented as a class? Is this because of historic reasons?</p>
python
[7]
2,127,745
2,127,746
Changing multiple image extension using jquery
<p>sorry, im new in jquery. I have this code on tag:</p> <pre><code>&lt;img class="fluidimage" src="img/picture1.jpg"/&gt; &lt;img class="fluidimage" src="img/goodimage1.jpg"/&gt; </code></pre> <p>and i want to change all src on fluidimage class if the user resize their web browser. so my desired output is : </p> <pre><code>&lt;img class="fluidimage" src="img/picture1_small.jpg"/&gt; &lt;img class="fluidimage" src="img/goodimage1_small.jpg"/&gt; </code></pre> <p>and my question is how to put string "_small" before ".jpg" in jquery? I've tried to write jquery function but it isn't work.</p> <pre><code>$(document).ready(function() { function imageresize() { var contentwidth = $('#container').width(); if ((contentwidth) &lt; '700'){ $('.fluidimage').attr('src','img/picture1.jpg'); $('.fluidimage').attr('src', $(this).attr('src').replace('.jpg', '_small.jpg')); } else { $('.fluidimage').attr('src','img/picture1.jpg'); } } imageresize(); $(window).bind("resize", function(){ imageresize(); }); }); </code></pre> <p>Please help!</p>
jquery
[5]
5,532,449
5,532,450
Alias to python module
<p>I have some python module, that I import as:</p> <pre><code>from mygraph.draw import pixel </code></pre> <p>The file structure looks like that:</p> <pre><code>mygraph/ __init__.py draw.py </code></pre> <p>and <code>draw.py</code> contains <code>def pixel()</code></p> <p>Now, I want to add another function, <code>line()</code>, and I want to import it as</p> <pre><code>from mygraph.draw import line </code></pre> <p>I can simply add <code>line</code> to <code>draw.py</code>. But, I would like to have <code>line()</code> in a separate file <code>line.py</code> and not mess with draw.py. But, if I place it in a separate file, it will be imported as</p> <pre><code>from mygraph.line import line </code></pre> <p>and that is not what I want...</p> <p>Is it possible to "alias" somehow the <code>line.py</code> so it is visible in <code>draw</code> module, but is in separete file? I thought about adding a dummy function in <code>draw</code> </p> <pre><code>def line(): return real_line.line() </code></pre> <p>but in this case I won't have a "docstring" from the original <code>line</code>, and I will loose some performance on calling the real line function.</p>
python
[7]
373,946
373,947
How to draw drop-down shadows in iOS
<p>A CAShapeLayer uses a CGPathRef to draw it's stuff. So I have a star path, and I want a smooth drop shadow with a radius of about 15 units. Probably there is some nice functionality in some new iPhone OS versions, but I need to do it myself for a old aged version of 3.0 (which most people still use).</p> <p>I tried to do some REALLY nasty stuff: I created a for-loop and sequentially created like 15 of those paths, transform-scaling them step by step to become bigger. Then assigning them to a new created CAShapeLayer and decreasing it's alpha a little bit on every iteration. Not only that this scaling is mathematically incorrect and sucks (it should happen relative to the outline!), the shadow is not rounded and looks really ugly. That's why nice soft shadows have a radius.</p> <p>The tips of a star shouldn't appear totally sharp after a shadow size of 15 units. They should be soft like cream. But in my ugly solution they're just as s harp as the star itself, since all I do is scale the star 15 times and decrease it's alpha 15 times. Ugly.</p> <p>I wonder how the big guys do it? If you had an arbitrary path, and that path must throw a shadow, how does the algorithm to do that work? Probably the path would have to be expanded like 30 times, point-by-point relative to the tangent of the outline away from the filled part, and just by 0.5 units to have a nice blending.</p> <p>Before I re-invent the wheel, maybe someone has a handy example or link?</p>
iphone
[8]
2,614,084
2,614,085
how to put local website in local browser?
<p>In Win Server 2003, I would like to set the default IE homepage to a local website. How do I accomplish this?</p>
asp.net
[9]
3,648,600
3,648,601
how to replace " char to ' with javascript?
<p>i want to replace <code>"</code> char to <code>'</code> with javascript. thank you for your help. regards</p>
javascript
[3]
2,903,235
2,903,236
retrieve quantity from dynamic js menu
<pre><code> function showNumber(selectId, divNumber) { //this takes value from select option and grabs div for displaying it var select = document.getElementById(selectId); var noItems = document.getElementById(divNumber); //loop for creating 0-20 drop down for (var i = 0; i &lt;= 20; i++) { var option = document.createElement('option'); option.innerHTML = i; option.value = i; select.appendChild(option); } //onchange shows in a div how many items were selected select.onchange = function () { var noZero = select.value; if (noZero &gt; 0) { noItems.innerHTML = noZero; } else noItems.innerHTML = " "; }; } //function takes parameters of the previous one and displays number of items of a particular product in a div function showDivs(){ showNumber('item1', 'div1'); showNumber('item2', 'div2'); showNumber('item3', 'div3'); showNumber('item4', 'div4'); } </code></pre> <p>My problem is that I would like to add quantities of all the products (item1, item2 etc.) in order to calculate the total number of them. I don't seem to be getting anywhere with that, any help greatly appreciated!...</p>
javascript
[3]
5,230,080
5,230,081
Javascript: Dynamic Generation of a Div
<p>I have several vertically stacks divs and I want to have a div appear when I click a button within each of these divs. The div that I want to appear will be the exact same for each appearance with the exception of an id associating it with the outer div. How do I do this in Javascript?</p> <p>I assume I should use the createElement() within Javascript, but how do I append it to the end of a specific element. Also, when creating an element, I have to hardcode the html in the Javascript file. Is there anyway to leave the element within the html design file. I want to seperate design from code as much as possible.</p>
javascript
[3]
2,968,828
2,968,829
Forms with large number of checkboxes no longer work on new server
<p>I know this question is really open-ended. Recently migrated from one server to another server at the same web host. The PHP version on the old server is 5.2.8 and the new server is 5.2.17. Everything works normally except for 2 pages. Both of them have a large number of checkboxes on the page to select different attributes for a product (200 checkboxes+). These pages no longer update products when the form is submitted. There are no errors, everything seems to be working correctly except the updates in the mysql db aren't being made. Other forms on the site are working correctly. </p> <p>Any ideas what this could be? I know there's not a lot to go off of here, but any ideas where to start would be very helpful.</p> <p>Thanks!</p>
php
[2]
5,056,298
5,056,299
Loop through collections
<p>I have two classes</p> <pre><code>class A { public string something { get; set; } public IList&lt;B&gt; b= new List&lt;B&gt;(); } class B { public string else { get; set; } public string elseelse { get; set; } } </code></pre> <p>I have populated an object of class A called obj. How can I loop through this object and print values. Do I have to use two foreach's like the one show here or is there a better way?</p> <pre><code> foreach (var z in obj) { // print z.something; foreach (var x in z.b) { // print x.elseelse; } } </code></pre>
c#
[0]
800,456
800,457
Learning java language
<p>Ten years before I started learning java language on self bases as Hobby. I was reading Ivor Horton book Begining java.</p> <p>That was my first programing language. I learned a lot of basics and advance stuff of language. I remembered making calculator window application in java when I stopped learning. I was using notepad for codeing.</p> <p>Reasons of stop learning was</p> <p>I was not having access to internet on that time so that I could asked questions. There was not any source of motivation. I was not able to implements the inheritance. Everyting I coded in one class or used compsition which demotivated me I used to think that it was useless code. Most of example which explaine inheritance I understand very clearly but can not think that way during codeing. Exercise was also not available. So major concepts was easy to remembor but for intricate details I had to consult book.</p> <p>Two month ago I bought NoteII and I started learning android which is basically java and made examples from books by using eclipse.</p> <p>And this time I donot want to discontinue learning.</p> <p>MY question is Is there a way or book which take me from basic of java language to advance level with plenty of excercises which not only shows language features but also make programmer implements that language features.</p> <p>Most of the books shows language features and its rules and regulation. All books lacks in excercises. Language features learnning is not problum. There impementaion learning is a problum.</p>
java
[1]
3,000,633
3,000,634
Dynamic 2D array: Space Issue
<p>I am using the following code to create dynamic 2D array.</p> <pre><code>uint32_t** arrays = new uint32_t*[1000]; uint32_t number = take input from console ; arrays[0] = new uint32_t[number]; number = take input from console ; arrays[1] = new uint32_t[number]; delete arrays[0] ; number = take input from console ; arrays[0] = new uint32_t[number] ; </code></pre> <p>I am using 64 bit Unix machine to execute above code.</p> <p>In the above code the machine is taking 64 bit pointer to point 2nd dimension array and that's why the code is taking more space.</p> <p>Can anyone help me, how to convert the code thus it takes 32 bit pointer ? Or another way to solve space complexity ? I don't want to use vector of vectors as it is not asked to do by my prof. </p>
c++
[6]
1,964,685
1,964,686
Issue reading String
<p>I have an issue with my basic addition program everything works such as typing the value and testing if its not wrong but an issue occurs when i open my program and leave the TextView blank and press button check , the program terminates.<br> Ive tried convert String =""; to an integer but then my program does not start.<br> I belive it only compares integers and not String but im unsure how to overcome it<br> Any help would be appreciated.</p> <pre><code>int one=1, two=2; ans = one + two; TextView = Value; TextView = i; Button one,check; i = (TextView) findViewById(R.id.display); Value = (TextView) findViewById(R.id.answer); one= (Button) findViewById(R.id.one); one.setOnClickListener(this); check= (Button) findViewById(R.id.check); check.setOnClickListener(this); public void onClick(View v) { switch(v.getId()){ case R.id.one: ans.append("1"); break; case R.id.check: if (answer ==(Integer.parseInt(Value.getText().toString()))) { display.setText(one+"+"+two); ans.setText(""); } else { i.setText("Invalid"); } break; } } </code></pre>
android
[4]
4,617,307
4,617,308
Dynamic table memory usage
<p>I use a dynamic table:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;button id="button"&gt;Build table&lt;/button&gt; &lt;div id="container"&gt; &lt;script type="text/javascript"&gt; window.onload=function(){ var table = null; var row = "&lt;tr&gt;&lt;td&gt;111111111111111111111111111111111111111111111111111111&lt;/td&gt;" + "&lt;td&gt;222222222222222222222222222222222222222222222222222222&lt;/td&gt;" + "&lt;td&gt;333333333333333333333333333333333333333333333333333333&lt;/td&gt;&lt;/tr&gt;"; var data = null; for (var i = 0; i &lt; 2000; i++){ data += row; } var obj = document.getElementById("button"); obj.onclick=function buildTable(){ document.getElementById("container").innerHTML = "&lt;div&gt;&lt;table&gt;&lt;tbody&gt;" + data + "&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;"; }; }; &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Using chromes task manager, each time new data is loaded the memory usage increases considerably and doesn't go down, so after some time the app consumes a lot of memory and requires the browser to be closed. Is there any change in the code I can use to solve this or is it a browser side problem?</p>
javascript
[3]
5,147,101
5,147,102
Non related activities
<p>Is there any way to suppress or kill all activities and non crucial applications and background processes not related to a current activity?</p> <p>I have an app that runs in real time and there are occasional intermittent timing hiccups which I am attributing to this.</p>
android
[4]
3,688,448
3,688,449
C#: Converting from Linq.Binary to Type in String
<p>I have a Linq.Binary object and I would like to convert it to the type contained within a string.</p> <pre><code>System.Data.Linq.Binary b = System.BitConverter.GetBytes(10.1); string Type = "System.Double"; double d = Something(b, Type); </code></pre> <p>How do I convert from Linq.Binary to "System.Double" or "System.String"? Do I just have to have a giant case statement or is their a slicker way?</p>
c#
[0]
3,838,023
3,838,024
Javascript : add string to iframe with window.opener form popup
<p>I use this code for add string to element of parent windows form popup :</p> <pre><code>window.opener.document.getElementById('myid').innerHTML += 'string'; </code></pre> <p>Now I want to add string to element of iframe form popup.Both of iframe and parent is in the same domain. I try this code but not work:</p> <pre><code>parent.myframename.window.opener.document.getElementById('iframeelementid').innerHTML += 'string'; </code></pre> <p>What is wrong? Is there any way to do this?</p> <p>Thanks for any help.</p> <p><em><strong></em>* UPDATE <em>*</em></strong> </p> <p>This is my complete code. Main page:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; function myPopup() { window.open( "pop.htm", "myWindow", "status = 1, height = 180px, width = 330px) } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;textarea id="input"&gt;&lt;iframe src="frame.html" name="myframe"&gt;&lt;/iframe&gt; &lt;/textarea&gt; &lt;a href="" onclick="myPopup()"&gt;Popup&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and pop.htm:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; function insert() { parent.myframe.window.opener.document.getElementById('inframe').innerHTML += 'asasasas'; window.close(); return false; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;input type="button" id="insert" onclick="insert()" value="insert" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and iframe.html:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;span id="inframe"&gt;&lt;/span&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript
[3]
7,378
7,379
Template variable in ASP.NET
<p>I have to add a Page's variable into a ItemTemplate but dont know how.</p> <p>For example:</p> <pre><code>&lt;rad:RadMenuItem ID="f" runat="server" Text="Products"&gt; &lt;ItemTemplate&gt; &lt;div class="pitem"&gt;&lt;%= MyText %&gt;&lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/rad:RadMenuItem&gt; </code></pre> <p>The MyText variable does exist in the context and has value but the text does not show up</p> <p>Another question: How can I add MyText to the ASP.NET page like the following?</p> <pre><code>&lt;asp:Button Text="&lt;%=MyText%&gt;" .../&gt; </code></pre> <p>I dont want to edit the code like btn.Text=MyText, just want to do that on the .aspx file as required.</p>
asp.net
[9]
754,236
754,237
How do you create a jQuery plugin?
<p>I have the following code, which I am following from the jQuery documentation on how to build a plugin.</p> <p>I'm just trying to create a simple isNot extension:</p> <pre><code>(function ($) { $.fn.isNot = function (selector) { return !this.is(selector); }; })(jQuery); $(document).ready(function () { $("#someButton").click(function (event) { alert($("#someCheckbox").isNot(":checked")); }); }); </code></pre> <p>When I run this the javascript file get's loaded properly, and I can step through the code in firebug. I see that jQuery is defined properly, and the click event gets wired up properly, too.</p> <p>However, I have added a watch in FireBug to track the isNot function, and it is <strong>always</strong> null. I can't get it to ever become defined.</p> <p>Is there something I'm not doing properly?</p>
jquery
[5]
5,309,315
5,309,316
Confused about when saving a variable using the $() function
<p>In jQuery, if I do this:</p> <pre><code>var a = $("#someid"); </code></pre> <p>Now when I need to further reference using jQuery, what should I be doing?</p> <pre><code>$(a).attr("id"); </code></pre> <p>or</p> <pre><code>a.attr("id"); </code></pre> <p>I'm testing things out and I'm getting confused, just want the official word so I can rule this out.</p>
jquery
[5]
1,093,172
1,093,173
Permission denied with uses-permission in AndroidManifest.xml
<p>I try to test my android application with <strong>MCE controller</strong> on my PC and defined <code>uses-permission android:name="android.permission.INTERNET</code> in AndroidManifestXML. Here is the manifest:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.ailtd.FrameworkClasses"&gt; &lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name" android:name=".GUI.UserApplication"&gt; &lt;activity android:name=".GUI.TemplateActivity" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>I have looked through some threads connected with the same problem and some people say that this problem could be caused by firewall. After I switched off firewall I still get the same effect. I test the application on emulator. </p> <p>Here is LogCat output:</p> <pre><code>07-15 09:54:45.580: DEBUG/CustomTCPSocket(924): Sending message 07-15 09:54:45.590: DEBUG/sendMessage(924): IOException: Permission denied (maybe missing INTERNET permission) </code></pre> <p>Any ideas?</p>
android
[4]
360,447
360,448
how to convert nsstring to uicolor?
<p>I have one string(NSString) in string there is one value like string=@"black" now i want to use textcolore using string.I have written below code. txtView.textColor=[UIColor string];</p> <p>But it not working can suggest me?</p>
iphone
[8]
4,040,955
4,040,956
When should I create a nested class? Does it make instantiation of the outer class consume more resources?
<p>Sometimes I found someone's codes having nested classes.</p> <p>When should I create a nested class? Does it make instantiation of the outer class consume more resources?</p> <p>Thank you in advance.</p>
c#
[0]
1,680,365
1,680,366
how to close activity from event
<p>I have the following code</p> <pre><code>public class DevClick implements OnItemClickListener { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { ... } </code></pre> <p>This is called from ListView from the activity. I want in that event that the caller activity will close. how can I get the activity from this event??</p> <p>Thanks</p>
android
[4]
2,918,275
2,918,276
Use 0 or BIND_AUTO_CREATE for bindService's flag
<p>By referring to <a href="http://developer.android.com/reference/android/content/Context.html#bindService%28android.content.Intent,%20android.content.ServiceConnection,%20int%29" rel="nofollow">bindService (Intent service, ServiceConnection conn, int flags)</a></p> <p>May I know, when should we use 0 for <code>flags</code>, and when should we should we use <code>BIND_AUTO_CREATE</code> for <code>flags</code>? The documentation doesn't explain what is the meaning of 0 for flags.</p> <h2>Example for using 0 as <code>flags</code></h2> <pre><code>// Start auto complete service. autoCompleteServiceIntent = new Intent(AutoCompleteService.class.getName()); startService(autoCompleteServiceIntent); bindService(autoCompleteServiceIntent, serviceConnection, 0); </code></pre> <h2>Example for using <code>BIND_AUTO_CREATE</code> as <code>flags</code></h2> <pre><code>mContext.bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"), mServiceConn, Context.BIND_AUTO_CREATE); </code></pre>
android
[4]
294,260
294,261
How to correctly represent a whitespace character
<p>I wanted to know how to represent a whitespace character in C#. I found the empty string representation <code>string.Empty</code>. Is there anything like that that represents a whitespace character?</p> <p>I would like to do something like this:</p> <pre><code>test.ToLower().Split(string.Whitespace) //test.ToLower().Split(Char.Whitespace) </code></pre>
c#
[0]
1,788,364
1,788,365
What is the best way to return items in Python that meet a specific condition
<p>The code I'm currently using is:</p> <pre><code>def f(*args): lst=[str(i) for i in args] if len(lst)==1:lst = lst[0] return lst </code></pre> <p>What I would like is:</p> <pre><code>a=f(1) #'1', not [1] a,b = f(1,2) #'1', '2' </code></pre> <p>Only one argument would be a list, which would be represented by <code>a</code>. </p> <p>What alternative exists aside from using an <code>if</code> statement?</p>
python
[7]
4,884,009
4,884,010
PHP: How to break an array into a specified number of smaller arrays?
<p>I have an array containing a lot of records. I need to split it into 4 smaller arrays. How can I do this?</p>
php
[2]
1,614,865
1,614,866
PHP click event handlers
<p>I'm new to PHP programming and I wanted to know that is it possible to handle PHP events as we do in ASP.NET</p> <p>I mean I've got a img and I want to perform some task on click event of this img.</p> <p>I know how to do it in ASP.NET but please help me in context of PHP</p> <p>Thanks, GURU</p>
php
[2]
1,339,345
1,339,346
Sending data to webservice without using querystring in jQuery
<p>I have the following jquery using which I send some data to a webservice.</p> <pre><code>var value1="This is val1"; var value2="This is val2"; $.ajax({ url: "Test.asmx/PostData", data: { data1: value1, data2: value2 }, success: function (html) { strReturn = html; }, async: false }); if (strReturn == "") { //some error occured or the data did not get send to webservice } else { //The data is send to the webservice } </code></pre> <p>Now the problem is that since the data is posted as query string. If the length of data in value1 &amp; value2 are very long, The data is not send to the webservice.</p> <p>How can I avoid sending the data using querystring. I've tried setting the ajax parameters "processData" as false and "type" as POST but still no luck.</p> <p>It would be great if anyone could send me the jquery code on how this can be done.</p> <p>Thanks in advance</p>
jquery
[5]
3,856,787
3,856,788
Download finished with wrong size
<p>I am installing Android SDK and AVD Manager in my eclipse, I am getting this in console:</p> <pre><code>Download finished with wrong size. Expected 96280271 bytes, got 24895488 bytes. Downloading ARM EABI v7a System Image, Android API 14, revision 2 Download finished with wrong size. Expected 99621822 bytes, got 49778688 bytes. </code></pre>
android
[4]
2,563,651
2,563,652
dynamic row inserts - mysql php - how?
<p>Hy to all, </p> <p>I have a misunderstanding regarding some dynamic row inserts in a mysql table...</p> <p>All I want to do is based on the EAV Model : </p> <ul> <li>I have a products table wich contains products</li> <li>A attributes table wich contains attributes (name) for products (group based - related to category)</li> <li>And a product_attribute wich cotains the value of the attribute ...</li> </ul> <p>And the user must create this attributes to be associated with a product, and I'm thinking to insert <code>&lt;input&gt;</code> elements with jquery's <code>append</code>.</p> <p>But how to track inserts and how to append them to have a specific name : <code>&lt;input name=''&gt;</code>.</p> <p>The result shoul do the following :</p> <pre><code>&lt;form action='attribute_insert.php' method='post'&gt; &lt;input name='field1' /&gt; &lt;input name='field2' /&gt; &lt;input name='field3' /&gt; .... &lt;input name='field20' /&gt; &lt;/form&gt; </code></pre> <p>and after processing in <code>attribute_insert.php</code> to insert like this :</p> <pre><code>('1', '12', 'manufacturer'); ('2', '12', 'freq'); ('3', '12', 'memory'); ('4', '12', 'ram'); .... ('20', '12', 'blablabla'); </code></pre> <p>How can i do this ... using <code>foreach</code> to scan the <code>$_POST[]</code> or there is a clever method ?</p> <p>Thank you very much ...</p>
php
[2]
2,954,596
2,954,597
Bar code library for Android
<p>Is there any Barcode library available for Android, which i can make of use for Scanning the products?</p>
android
[4]