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 |
|---|---|---|---|---|---|
1,837,407 | 1,837,408 | new popup window on every click | <p>I've a pop up window which i'm opening using below script. On every click, i want to open new pop up.
I understand, having unique name for the window will solve the problem (In this case "SampleWindow").
What's the best way to maintain the uniqueness of the window ? Is there any other way to manage javascript popup ?</p>
<pre><code>window.open(url, 'SampleWindow', 'WIDTH=300,HEIGHT=250');
</code></pre>
| javascript | [3] |
4,987,282 | 4,987,283 | javascript variable is undefined | <p>First , let's see the code.</p>
<pre><code>var a=0;
b=1;
document.write(a);
function run(){
document.write(b);
var b=1;
}
run();
</code></pre>
<p>I think the result is <code>01</code> .but in fact , The result is <code>0undefined</code>. </p>
<p>Then I modify this code.</p>
<pre><code>var a=0;
b=1;
document.write(a);
function run(){
document.write(this.b); //or document.write(window.b)
var b=1;
}
run();
</code></pre>
<p>Yeah, this time it runs as expected. <code>01</code> . I can't understand, WHY?</p>
<p>More interesting, I modify the code again .</p>
<pre><code>var a=0;
b=1;
document.write(a);
function run(){
document.write(b);
//var b=1; //I comment this line
}
run();
</code></pre>
<p>The result is 01.</p>
<p>So , Can anyone explain this?</p>
<p>Thanks for share your viewpoints.
I simplify this code </p>
<pre><code>b=1;
function run(){
console.log(b); //1
}
</code></pre>
<p>two:</p>
<pre><code>b=1;
function run(){
var b=2;
console.log(b); //2
}
</code></pre>
<p>three:</p>
<pre><code>b=1;
function run(){
console.log(b); //undefined
var b=2;
}
</code></pre>
| javascript | [3] |
4,874,137 | 4,874,138 | Adding border div pushing other divs out of box | <p>I am adding a div border on the mouseover of the div, but its pushing other divs out of the box.</p>
<p>I have fixed height and width and have 4 divs for row. finally there are two rows with 8 divs and with fixed height.
When i mouseover any div , it pushes all the divs below it outside the main box.</p>
<p>I tried to increase the height of the main box , but still it pushes out.
can anyone help me with this issue.</p>
| jquery | [5] |
4,663,688 | 4,663,689 | Selecting select fields in jQuery 1.4 not working | <p>This works in jQuery 1.3.2, but not in 1.4</p>
<pre><code>$("#container").children().map(function() {
var child = $(this);
if (child.is(":select")) {
//do something with child
}
});
</code></pre>
<p>What is the right way to do this in jQuery 1.4?</p>
| jquery | [5] |
2,327,702 | 2,327,703 | flash player it is supported on the emulator | <p>I want to install the flash player into the emulator. It's possible??</p>
| android | [4] |
3,861,893 | 3,861,894 | Moving the Expandable List view indicator top or bottom | <p>The indicator can be moved right side of the screen but how to move it top or bottom. I have given the screenshot i want to move the indicator parallel to the texts.</p>
<p><img src="http://i.stack.imgur.com/GLsog.png" alt="enter image description here"></p>
| android | [4] |
1,697,168 | 1,697,169 | Proxy for URL request on iPhone | <p>I'm trying to make a URL request to my server but the request needs to go through a proxy (IP address, not used for authentication). Can anyone get me any pointers on how to achieve this?</p>
<p>Can I programatically set a proxy for an URL request?</p>
<p>thanks</p>
<p>Thomas</p>
| iphone | [8] |
2,775,466 | 2,775,467 | Send ArrayList<GeoPoint> array in putExtra method | <p>I have created Intent and I put data using <code>putExtra</code>method.</p>
<p>Now I want to put my <code>geoPointsArray</code>type variable to my intent object, here is type of geoPointsArray :</p>
<pre><code>List<GeoPoint> geoPointsArray = new ArrayList<GeoPoint>();
</code></pre>
<p>In existing methods <code>putExtra</code>I can't find how to put my custom type.</p>
<p>Can someone help me with this?</p>
<p>Thanks</p>
| android | [4] |
3,427,282 | 3,427,283 | Is there a way to detect whether the apk is stored on SD-card or not? | <p>Is there a way to detect whether the apk is stored on SD-card or not?
How?</p>
| android | [4] |
2,259,179 | 2,259,180 | Direct backwards with PHP | <p>How do you direct back with <code><?php include("./php/content/index.php"); ?></code>?</p>
<p>Asin, if you are already on the page:</p>
<blockquote>
<p>www.address.com/about/index.php</p>
</blockquote>
<p>how do you link it to the file:</p>
<blockquote>
<p>www.address.com/php/menu.php</p>
</blockquote>
<p>I know it works if you put <code><?php include("www.address.com/php/content/index.php"); ?></code> but I was told not to use that methods as it is very bad practice.</p>
| php | [2] |
2,035,218 | 2,035,219 | Filter contentresolver query by date and time - Android | <p>I'm using the "MediaStore.Images.Media.EXTERNAL_CONTENT_URI" to query for photos stored on the sd-card. Now I only want photos that were added after some specific date. I'm using the "contentResolver.query()" method to query but I don't understand how to filter by Date_ADDED or DATE_MODIFIED. Can this be done?</p>
<p>Thanks for help!</p>
| android | [4] |
5,316,439 | 5,316,440 | Implementing a framework with static methods or non-static methods? | <p>I know that at first you want to say we should use all static or non-static. I've read two books about PHP (Professional PHP design patterns & PHP5 social networking). The first one most of the time has used static methods, but the second one there is no static method. If you were me and wanted to implement a efficient framework which approach would you choose, why? </p>
| php | [2] |
1,273,678 | 1,273,679 | Logic in if/else (javascript) | <p>Have a small if/else problem in javascript. i don't see the logic...</p>
<p>The function should check if two dates are present and give alerts if it's not present. If everything is OK, it should say so...</p>
<pre><code>function update_booking() {
//from_date = The date of arrival
//to_date = The date of departure
var alert = ""; //reset alerts
//get variables from booking form input
var from_date = new Date(document.getElementById('from').value);
var to_date = new Date(document.getElementById('to').value);
//if arrival and departure date is present
if(from_date && to_date) {
var alert = "Everything is OK";
}
//if one or two dates are missing
else {
//if arrival and departure dates are missing
if(from_date == 'undefined' || to_date == 'undefined'){
var alert = "Arrival date and departure date are missing";
}
//if from_date is missing update with value from to_date
if(from_date == 'undefined') {
var alert = "Arrival date are missing";
}
//if to_date is missing update with value from from_date
if(from_date == 'undefined') {
var alert = "Departure date are missing";
}
} //end else if one or more date(s) missing
//write alerts
document.getElementById('alert').innerHTML = alert;
}
</code></pre>
| javascript | [3] |
5,580,080 | 5,580,081 | Trying to format a string and it is not working! Android/Java | <p>Here is the XML: </p>
<pre><code><string name="feature3_intro">You shot %1$d pounds of meat!</string>
</code></pre>
<p>Here is the java code: </p>
<pre><code>int numPoundsMeat = 123;
String strMeatFormat = getResources().getString(R.string.feature3_intro);
String strMeatMsg = String.format(strMeatFormat, numPoundsMeat);
</code></pre>
<p>All that is appearing is: <code>You shot %1$d pounds of meat!</code></p>
<p>help?</p>
<p>Thanks!</p>
| android | [4] |
2,909,673 | 2,909,674 | Can anyone recommend a query graph plugin that does this | <p>I am trying to create a graph using query (or any other javascript solution) that can graph raw web traffic data over a period of time at 1 hour intervals. The problem with the graphs I've looked at, is that they map every single hit at the exact time, like this:</p>
<pre><code>12:17 - 1 hit
12:30 - 1 hit
12:34 - 1 hit
12:34 - 1 hit
12:50 - 1 hit
1:13 - 1 hit
1:45 - 1 hit
3:43 - 1 hit
</code></pre>
<p>However, I need to graph that raw data as:</p>
<pre><code>Hour | # of hits
12 5 hits
1 2 hits
2 0 hits
3 1 hit
</code></pre>
<p>I need a plugin that automatically adds hits that happen within each hour, rather than plotting a bunch of single hits. Anyone know of a graphing plugin that handles this?</p>
| jquery | [5] |
3,020,915 | 3,020,916 | Javascript href link counter | <p>I need to make a button that increments and decrements a variable. When you click a link it increments a variable in the link href.When you click another link it decrements a variable in the link href.The variable can only go up to the last number in a specified array.PHP will be embedded around it. Any ideas?</p>
<pre><code><script type="text/javascript">
var counter = 0;
document.write('<button onclick="counter++">Increment</button>');
document.write(counter);
</script>
</code></pre>
<p>This is an abomination I know, and it uses a button.</p>
| javascript | [3] |
4,036,482 | 4,036,483 | rdlc in asp.net | <p>I want to create rdlc report at run time. I don't want to fix the columns b'coz every time my query has been changed.................
And also i wan to set the report layout at runtime..........
How is it possible............
plz help me !!!!!!!! </p>
<p>Thanx in advance............ </p>
| asp.net | [9] |
2,285,695 | 2,285,696 | Retrieve characters from a string | <p>What is the best way to get a list of characters [a-z] from a string ignoring any other special character or number?</p>
| java | [1] |
4,337,225 | 4,337,226 | fadeout time slipping jquery | <p>I've been having a bit of trouble getting the following fadeout code to work as i'd like. </p>
<p>Both temporary divs ($tempBackgroundTop, $tempBackground) should fadeout at the same time but one is fading out at just before the other.</p>
<p>Any ideas?</p>
<p>Cheers!</p>
<pre><code>jQuery(document).ready(function () {
jQuery("a.trigger").click(function (event) {
event.preventDefault();
var speed = 1e3,
$body = jQuery("body"),
$background = jQuery("#background"),
$page = jQuery("#page"),
$tempBackgroundTop = jQuery("<div/>").attr("id", "tempBackgroundTop").addClass("blueTop"),
$tempBackground = jQuery("<div/>").attr("id", "tempBackground").addClass("blue");
$page.after($tempBackgroundTop).after($tempBackground);
$body.removeClass("blue").addClass("turquoise");
$background.removeClass("blueTop").addClass("turquoiseTop");
jQuery.when($tempBackgroundTop.fadeOut(speed), $tempBackground.fadeOut(speed)).done(function () {
$tempBackgroundTop.remove();
$tempBackground.remove();
});
});
});
</code></pre>
| jquery | [5] |
1,197,832 | 1,197,833 | Save WebSQL database as .sqlite | <p>I am using WebSQL for a web project. I can view WebSQL databases using SQLite Manager. I learnt the database itself is saved in the browser's app data folder somewhere (using a funny file extension).</p>
<p>I was wondering if there was a way to save the WebSQL database as a .sqlite file and to specify the location where the file is saved(possibly).</p>
| javascript | [3] |
1,187,593 | 1,187,594 | how to call another function in javascript? | <p>how do i call the doSubmit() function from the conFirmUpload() when the confirm msg box is true? </p>
<pre><code><script type="text/javascript">
function confirmUpload() {
if (confirm("Are you sure want to upload '" + document.getElementById("txtWS").value + "' ?") == true) {
return true;
}
else
return false;
}
function doSubmit(btnUpload) {
if (typeof(Page_ClientValidate) == 'function' && Page_ClientValidate() == false) {
return false;
}
btnUpload.disabled = 'disabled';
btnUpload.value = 'Processing. This may take several minutes...';
<%= ClientScript.GetPostBackEventReference(btnUpload, string.Empty) %>;
}
</script>
</code></pre>
| javascript | [3] |
4,413,660 | 4,413,661 | Android Layout doesn't fit into contiguous rectangles | <p>I am a new Android developer, and though I have spent a LOT of time reading through the official developer guide/reference (as well has hours of guessing/checking), I'm still stumped about the best way to do my layout. I am creating a board game, and here is an image of <a href="http://techfeed.net/gameBoard.png" rel="nofollow">the game board</a>. On that board, the game pieces live on (and move between) the small inner hexes. From my limited understanding of Android development, I'm thinking I need to make each small hex a view. And the overall board layout would be a stacking together of these small hex images to form the board shape. The end result would look exactly like the gameBoard image I linked above. IMPORTANT: I want the game board to be on the bottom of the screen, with game info (players, scores, etc.) at the top. For now I am focusing on a portrait layout...I'll deal with landscape mode later.</p>
<p>The trouble I'm having is figuring out how to do the layout. I want to use XML tags for this portion of the layout, because the board itself will never change during the game play. Only the game pieces will move around on the static board. I have spent hours so far researching and trying different layout types, and combinations of different layouts...nothing I've tried gives me that board design. As you can see from the board image, the hexes don't line up into nice rows/columns. I think this is why I am struggling to get my small hex views to look like the board. Any ideas? Or am I going about this in the wrong way altogether?</p>
| android | [4] |
3,063,302 | 3,063,303 | SMS type TEXT or MMS or other? | <p>How to capture incoming MESSAGE type whether it is Text or MMS or something else in Android programmatic ally?</p>
| android | [4] |
562,532 | 562,533 | invalid characters in a file name | <p>As per the MSDN , the following characters cannot be part of the file name:</p>
<blockquote>
<p>Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following:</p>
<p>◦The following reserved characters:</p>
<ul>
<li><code><</code> (less than)</li>
<li><code>></code> (greater than)</li>
<li><code>:</code> (colon)</li>
<li><code>"</code> (double quote)</li>
<li><code>/</code> (forward slash)</li>
<li><code>\</code> (backslash)</li>
<li><code>|</code> (vertical bar or pipe)</li>
<li><code>?</code> (question mark)</li>
<li><code>*</code> (asterisk)</li>
</ul>
</blockquote>
<p>In .net an api is provided to find the what are the characters not allowed in a filename</p>
<pre><code>char[] invalidFileChars = Path.GetInvalidFileNameChars();
</code></pre>
<blockquote>
<h2>Remarks</h2>
<p>The array returned from this method is not guaranteed to contain the complete set of characters that are invalid in file and directory names. The full set of invalid characters can vary by file system. For example, on Windows-based desktop platforms, invalid path characters might include ASCII/Unicode characters 1 through 31, as well as quote ("), less than (<), greater than (>), pipe (|), backspace (\b), null (\0) and tab (\t).</p>
</blockquote>
<p>But in the remark section it is said that it is depend on the file system. </p>
<p>Is it safe to use this api for the windows based os like XP and windows 7?</p>
| c# | [0] |
459,817 | 459,818 | jQuery jPicker colorpicker: How to convert from 8 digit (w Transparency) to standard 6 digit hex? | <p>I've got a jPicker installed and running fine; its a pretty sweet script.</p>
<p>However, the value it returns to my input box is 8 digit hex. I need it to return 6 digit hex.</p>
<p>Rather than post-process the 8 digit into 6, I'd rather just hack into the script and force 6 digit. Alternately, I'd be ok with hooking into the change event of the jPicker to intercept the value its sending to the input element and doing the conversion there just before it updates the input with the hex.</p>
<p>Here's my code:</p>
<pre><code>$(function() {
$('#myThemeColor').jPicker(); /* Bind jPicker to myThemeColor input */
$("#carousel").jCarouselLite({
btnNext: ".next",
btnPrev: ".prev",
visible: 6,
speed: 700
});
</code></pre>
<p>And here's the code I'm working with to intercept the myThemeColor input's change event, but its not firing at all.</p>
<pre><code>$('#myThemeColor').change(function()
{
alert(this.val()); /* does not fire on any action */)
if($(this).val().length == 8)
{
$(this).val(function(i, v)
{
return v.substring(0, 6);
});
}
});
</code></pre>
| jquery | [5] |
3,164,785 | 3,164,786 | creating textbox at runtime | <p>how to create as many textbox at runtime on button click. And also what will be the id's of textboxes created at runtime and send the value of textbox to next page through session</p>
<p>please someone help me. I've stucked at this point for many days but could not solve it.</p>
<p>thanks</p>
<p>prasanna</p>
| asp.net | [9] |
1,461,163 | 1,461,164 | Clarification needed in static methods in Collections in java? | <p>I know generics but I am not clear on this syntax. For instance, in Collections.sort() :</p>
<pre><code>public static <T> void sort(List<T> list, Comparator<? super T> c)
</code></pre>
<p>What is the significance of static <code><T></code> before return type void ?</p>
| java | [1] |
2,600,040 | 2,600,041 | Cannot update php.ini in Mac OS Lion | <p>Something is very wrong in my php/apache setup in Mac OS Lion.</p>
<p>If I change <code>/private/etc/php.ini</code> then I do <code>sudo apachectl -k restart</code>, the changes are not reflected.</p>
<p>After I do <code>sudo apachectl -k stop</code>, I can still connect to <code>localhost</code> in browser, and my php runs as usual.</p>
<p>I've even tried emptying <code>/private/etc/php.ini</code> and restart the apache server, but still nothing happened.</p>
<p>In phpinfo, value of Loaded Configuration File is <code>/private/etc/php.ini</code></p>
<p>Did I miss anything?</p>
| php | [2] |
898,746 | 898,747 | ASP.Net Fileupload progressbar | <p>Well the title say is all, is there any tutorial out there on how to write a FileUpload in asp.net with a progress bar? i cant find any of if there is a free component that would also work!</p>
| asp.net | [9] |
3,992,179 | 3,992,180 | What is the use of __threshold__ in Python? | <p>I was going through some Python automation scripts and I saw the new (for me) keyword of <code>___threshold__ = 0.6</code>. What it indicate? What it is used for?</p>
| python | [7] |
4,183,257 | 4,183,258 | How do I call a function without the Main function in C sharp? | <p>trying to run a function without putting it in the Main() when the program is run.
how do I start the new created function?
trying to call RunMix() in the Main() but get an error because of the lable1</p>
<pre><code>namespace mixer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int i = 0;
public void RunMix()
{
while (i == 0)
{
label1.Text = knob1.Angle.ToString();
Application.DoEvents();
}
}
private void Form1_Load(object sender, EventArgs e)
{
RunMix();
}
}
}
</code></pre>
| c# | [0] |
141,989 | 141,990 | In Android User Interface Button not set Text? | <p>I am developing an UI(Home screen) just like this screen
given in this link<br>
<a href="http://www.flickr.com/photos/78431491@N07/7023063473/" rel="nofollow">http://www.flickr.com/photos/78431491@N07/7023063473/</a></p>
<p>but in ldpi text of button is showing properly in mdpi and hdpi its not show and padding is not same for all devices please anyone help me I am using this code right now</p>
<pre><code>Button objwidgetbutton = new Button(HomeScreen.this);
btnimg = objButton.getImage();
btnwidth = Integer.parseInt(objButton.getWidth());
btnheight = Integer.parseInt(objButton.getHeight());
LinearLayout.LayoutParams objlayoutbtnparams = new LinearLayout.LayoutParams(btnwidth,btnheight); // Verbose!
//btntextcolor = Integer.parseInt(objButton.getTextColor().replace("#","0x"));
btnAction = Integer.parseInt(objButton.getAction());
btntextvalue = objButton.getButtonText();
String buttonimage[] = btnimg.split("\\.");
int imgresourceId = getResources().getIdentifier(
"com.correlation.edumationui:drawable/" +buttonimage[0], null, null);
objwidgetbutton.setBackgroundResource(imgresourceId);
objwidgetbutton.setText(btntextvalue);
objlinear.addView(objwidgetbutton,objlayoutbtnparams);
}
objviewgroup = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
</code></pre>
| android | [4] |
1,477,774 | 1,477,775 | Python object conversion | <p>Greetings,</p>
<p>let assume that we have a an object <code>k</code> of type <code>class A</code>. We defined a second <code>class B(A)</code>. What is the best practice to "convert" object <code>k</code> to <code>class B</code> and preserve all data in <code>k</code>?</p>
<p>Thanks,</p>
<p>Shakov</p>
| python | [7] |
704,069 | 704,070 | Process.start in c#, not firing | <p>I am trying to create some files using fsutil, but no files are getting created with the following loop, neither is an error getting generated, any suggestions?</p>
<pre><code>foreach (string extension in extensions)
{
Process.Start("fsutil", @"file createnew e:\attachments\" + DateTime.Now.ToString() + extension);
}
</code></pre>
| c# | [0] |
1,853,704 | 1,853,705 | Best (free) online C++ tutorial? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/909323/what-are-good-online-resources-or-tutorials-to-learn-c">What are good online resources or tutorials to learn C++</a> </p>
</blockquote>
<p>I've just started programming in C++ and am looking for a nice online C++ tutorial targeted at programmers with a solid understanding of C.</p>
<p>So far, I've found</p>
<p><a href="http://www.cplusplus.com/doc/tutorial/" rel="nofollow">http://www.cplusplus.com/doc/tutorial/</a></p>
<p>and </p>
<p><a href="http://www.cprogramming.com/tutorial/lesson1.html" rel="nofollow">http://www.cprogramming.com/tutorial/lesson1.html</a></p>
<p>but both seem to be targeted at total beginners.</p>
<p>Any suggestions? </p>
| c++ | [6] |
5,137,512 | 5,137,513 | javascript window.open() to a html file opens the browser download dialog | <p>I'm creating a print (preview)window, for which I want to load the core html from the site assets:</p>
<p>The code:</p>
<pre><code>window.open('/SiteAssets/reportingPrintBase.html','_blank','width=1250,height=800,menubar=yes,scrollbars=yes,resizable=yes');
</code></pre>
<p>The html: </p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:o="urn:schemas-microsoft-com:office:office" lang="en-us" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Expires" content="0" />
<link rel="stylesheet" type="text/css" href="/SiteAssets/reporting.css" />
<title>Untitled 1</title>
</head>
<body>
<div id="printHeader">Reporting</div>
<div id="printBody"></div>
<div id="printFooter">Reporting Footer</div>
</body>
</html>
</code></pre>
<p>The popup opens, but I'm then asked if want to download the file. This doesn't happen in a normal asp.net env. So I'm assuming it has something to do whith the way sharepoint sets headers.. </p>
<p>So how can I get the popup window to simply render the html?</p>
| javascript | [3] |
5,963,621 | 5,963,622 | android Call Forwarding programatically | <p>I want to forward any calls received to another predefined phone number. I have searched forums and found some contradictary answers. so i m confused.</p>
<p>First I looked at this post <a href="http://stackoverflow.com/a/5735711">http://stackoverflow.com/a/5735711</a> which suggests that it is not possible through android.
But another post has some solution. <a href="http://stackoverflow.com/a/8132536/1089856">http://stackoverflow.com/a/8132536/1089856</a></p>
<p>I tried this code from second post, but i m getting the following error message: "Call Forwarding connection problem or Invalid MMI Code." </p>
<pre><code>String callForwardString = "**21*5556#";
Intent intentCallForward = new Intent(Intent.ACTION_CALL);
Uri uri2 = Uri.fromParts("tel", callForwardString, "#");
intentCallForward.setData(uri2);
startActivity(intentCallForward);
</code></pre>
<p>Where 5556 is the number of emulator (for testing) where i want to forward call. </p>
<p>plz help.</p>
| android | [4] |
5,744,383 | 5,744,384 | Is there a better approach for dealing with mulitple processes reading/writing to a file | <p>I have 3 processes each of which listens to a data feed. All the 3 processes need to read and update the same file after receiving data. The 3 processes keep running whole day. Obviously, each process needs to have exclusive read/write lock on the file.</p>
<p>I could use "named mutex" to protect the read/write of the file or I can open the file using FileShare.None. </p>
<p>Would these 2 approaches work? Which one is better?</p>
<p>The programe is written in C# and runs on Windows.</p>
| c# | [0] |
5,927,543 | 5,927,544 | Weird FileNotFoundException exception from Android app in the wild | <p>I'm working on an Android app which is now in production, and am occasionally seeing exceptions (reported via airbrake) with stuff like this:</p>
<pre><code>[1.0.4] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.android/com.mycompany.android.activities.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
... cut lots of stuff ...
### CAUSED BY ###: java.io.FileNotFoundException: res/drawable-hdpi/tab_active.9.png:
AssetManager.java:-2:in `android.content.res.AssetManager.openNonAssetNative'
AssetManager.java:406:in `android.content.res.AssetManager.openNonAsset'
Resources.java:1706:in `android.content.res.Resources.loadDrawable'
... cut lots more stuff ...
</code></pre>
<p>In testing, this view definitely worked on multiple HDPI devices, so that resource was fine there. Before building the final APK, I did a full clean/rebuild, and of course sent the APK out for internal testing. The fact that I get 1-2 exceptions like this per version instead of 10,000 would indicate that this resource is definitely packaged correctly for most users.</p>
<p>I'm completely stumped and unsure why it wouldn't load on certain phones. Has anyone seen something like this in their apps?</p>
| android | [4] |
1,303,474 | 1,303,475 | How to duplicate a table row when a button is clicked | <pre><code> <tr id="myid">
<td><input type=textbox id="myid-1" name="myid-1" value="" /></td>
<td><img src="/images/add.png" /></td>
</tr>
</code></pre>
<p>I have a row in a table, that has a textbox and an image that is an icon of a '+' sign.</p>
<p>When the user clicks on the '+' icon, I want to create a new duplicate row under this row.
I have to then make sure the id and name attributes are unique.</p>
<p>What's the best way to do this?</p>
| jquery | [5] |
3,060,356 | 3,060,357 | Module framework other than OSGI, EJB(not really) and Impala | <p>I am interested in looking at module frameworks that support many of the goals of OSGI such as:</p>
<ul>
<li>a module can be restart/replaced</li>
<li>a module can hide classes and control what is exported.</li>
</ul>
<p>Impala: </p>
<p>Seems quite interesting but seems tightly coupled to the Spring Framework which amonst other things means i am sucking in a lot of dependencies which become globally shared ( could be wrong about the last point).</p>
<p>Are there any other frameworks or libraries that offer the above features with minimal dependencies ? </p>
<p>It would be great if any supported the ability to set a security manager for that module so each module has different abilities.</p>
| java | [1] |
564,332 | 564,333 | How to get lyrics from here? | <p>How can I read lyrics from here ; </p>
<p><strong>api.chartlyrics.com/apiv1.asmx?WSDL</strong></p>
<p>I have worked with visual studio ,but I do not know how can I use that in android , I only need a class that read from WSDL in android and show result , everything will be ok after that .</p>
<p>thanks.</p>
| android | [4] |
1,777,531 | 1,777,532 | Image uploading concept in PHP | <p>how to take image from one folder and rename and re-size the images and move to another folder?
I need to get image from one folder and rename and re-size the same image and move into another folder using php </p>
| php | [2] |
3,832,936 | 3,832,937 | Can't make distribution provisioning profile | <p>Does anyone know what causes this? I get this each time I try to make a Distribution provisioning profile, and on both my <code>Apple Developer Accounts</code>. Can anybody tell me what I do wrong or is this a error caused by Apple.</p>
<blockquote>
<p>We are unable to process your request.</p>
<p>Please go back to the previous page,
or quit your browser and try your
request again. If you require
assistance, please contact Apple
Developer Support.</p>
</blockquote>
| iphone | [8] |
1,524,362 | 1,524,363 | Basic Authentication : Inactivity Session I need to close the window with confirmation | <p>My application is with basic authentication so in that session is not invalidating without closing window.So if my application is idle for 10 mins then by using setTimeout() giving alert with confirm box ,if i press it OK its reloading the page CANCEL means i am redirecting the page to JSP page where in that page LOGIN option is there, as i am not closing the browser so it is not asking LOGIN credentials username password (as Basic Authentication is used) it is directly logging in to the application with the current user(even i invalidated the session using session.invalidate()).So i need a solution such that it should asks Login credentials or confirm box wid timer so that i need to close that window after 60 sec if i didnt press any thing OK or CANCEL Otherwise alternative solution such that after inactivty session of 10 mins is over it should asks some confirmation with an alert and that alert should close within 60 secs if we didnt respond to that
Thanks,
Nani</p>
| javascript | [3] |
1,054,035 | 1,054,036 | How to add a period at end of print | <p>Basic stuff, I am getting a syntax error for this. How do I include a period at the end of the printed line?</p>
<pre><code>first_name = raw_input("Enter your first name: ")
last_name = raw_input("Enter your last name: ")
print "Enter your date of birth"
month= raw_input("Month? ")
day= raw_input("Day? ")
year= raw_input("Year? ")
print "Here's your information"
print first_name, "was born on", month, day+',', year.
</code></pre>
| python | [7] |
4,434,238 | 4,434,239 | Can one have client-side and server-side code invoked from an Asp:RadioButtonList? | <p>I am currently invoking client-side functions and server-side functions from the same button click thus...</p>
<pre><code><asp:Button id="myButton"
runat="server"
cssclass="myButtonClass"
text="Do Stuff"
onclick="Do_Foo"
OnClientClick="Do_Bar();"/>
</code></pre>
<p>I was wondering if something analagous was possible for a radio button list...</p>
<pre><code><asp:RadioButtonList id="myRadioButtonList"
runat="server"
AutoPostBack="True"
onselectedindexchanged="Do_Fum"
...er...something here?>
<asp:ListItem ...or here perhaps?... Value="0">First Button</asp:ListItem>
.
.
</code></pre>
| asp.net | [9] |
174,322 | 174,323 | Android Licensing Verification Library server response codes | <p>To anyone who has implemented Android Licensing Verification Library</p>
<p>When you tested the following server response codes, did you get these two individual responses or did you get the NOT_LICENSED response code?
ERROR_CONTACTING_SERVER and ERROR_CONTACTING_FAILURE</p>
<p>It appears that I am not getting ERROR_CONTACTING_SERVER and ERROR_CONTACTING_FAILURE.</p>
<p>Please tell me about your experience testing these two codes.</p>
<p>Thanks!</p>
| android | [4] |
5,664,276 | 5,664,277 | Regarding joining of threads | <p>I have developed the below program on java threads , I have two threads which are executing and accessing the method inside run() now if I want to first thread to begin first and then second thread that I have done through synchronization mechanism but if I want first thread to end first and then began with second thread that could be achievable through join() , please advise me how this can be done by implementing join, </p>
<pre><code>public class MyThread2 extends Thread {
public void run()
{
//synchronized (this)
//{
//System.out.println(Thread.class);
for(int i=0;i<20;i++)
{
try{
Thread.sleep(500);
System.out.println(Thread.currentThread().getName());
System.out.println(i +"\n"+ "..");
}catch(Exception e)
{e.printStackTrace();
}
}
//}
</code></pre>
<p>}</p>
<pre><code>public static void main(String... a )
{
MyThread2 obj = new MyThread2();
Thread x = new Thread(obj);
x.setName("first");
x.start();
Thread y = new Thread(obj);
y.setName("second");
y.start();
}
</code></pre>
| java | [1] |
2,595,256 | 2,595,257 | ASP.Net: Eval Format for money expressions | <p>how I can format my database-query in a list view with 2 signs after comma?</p>
<p>Now: 100
Should be: 100,00</p>
<p>Now: 75,3
Should be: 75,30</p>
<p>How I get it when I insert the data in the list view with Eval(xxx)?</p>
| asp.net | [9] |
3,759,068 | 3,759,069 | Why enhanced for loop is not performing the null checking | <p>Why the enhanced for loop is not performing null checking before iterating over the collection.</p>
| java | [1] |
5,745,168 | 5,745,169 | Undefined test not working in javascript | <p>I'm getting the error <code>'foo' is undefined.</code> in my script when i test my function with an undefined parameter. As far as I understand, This shouldn't be happening.</p>
<p>My calling code:</p>
<pre><code>//var foo
var test = peachUI().stringIsNullOrEmpty(foo) ;
</code></pre>
<p>My function (part of a larger framework).</p>
<pre><code> stringIsNullOrEmpty: function (testString) {
/// <summary>
/// Checks to see if a given string is null or empty.
/// </summary>
/// <param name="testString" type="String">
/// The string check against.
/// </param>
/// <returns type="Boolean" />
var $empty = true;
if (typeof testString !== "undefined") {
if (testString && typeof testString === "string") {
if (testString.length > 0) {
$empty = false;
}
}
}
return $empty;
}
</code></pre>
<p>Any ideas?</p>
<p>Please note. I've had a good read of other similar questions before posting this one.</p>
| javascript | [3] |
5,410,642 | 5,410,643 | Caller function in PHP 5? | <p>Is there a PHP function to find out the name of the caller function in a given function?</p>
| php | [2] |
2,662,274 | 2,662,275 | Open gridview inside another gridview | <p>I have a gridview which contains columns <code>vacancy id</code> and <code>vacancy title</code> and a few image buttons. </p>
<p>When the user clicks on button <kbd>show criteria</kbd>, another gridview should open inside existing gridview.</p>
<p>This inner gridview should show criteria for that vacancy. </p>
<p>Again, when user clicks on the same button, it should hide the child gridview. </p>
<p>I tried this by adding child gridview in item template part of the template field of the parent gridview, but it shows the inner gridview in another column.</p>
<p>However, I want to open child grid below the row whose button is clicked. </p>
<p>How is this accomplished?</p>
| asp.net | [9] |
3,371,260 | 3,371,261 | How to show dialog during the Receiver? | <p>I want to show the dialog during the Receiver , i used this code but it's not true, can anyone help me?</p>
<pre><code>public class Call_Sevice extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
String number = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
if (TelephonyManager.EXTRA_STATE_RINGING.equals(state)){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Message");
builder.setMessage("Its Ringing [" + number + "]");
builder.setNeutralButton("Confrim", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id){
System.exit(0);
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
}
</code></pre>
<p>Thanks</p>
| android | [4] |
4,648,496 | 4,648,497 | How to dismiss previous activities in android at a certain point? | <p>I have activities A -> B -> C where A and B are for login and verification purpose. When a user reaches activity C, A and B are not necessary any more. That means if a user press BACK in C, the application should not go thru A and B, instead it should go back to HOME screen.</p>
<p>What's the conventional way to implement this in android? Thanks.</p>
<p>EDIT: to clarify a bit, user should be able to go back to A from B during login/verification phase, but not from C to A or B once the user reaches C.</p>
| android | [4] |
4,700,992 | 4,700,993 | Array Not Resizing | <p>I'm trying to resize an Array[] using a method named resize(). I think I've coded the method correctly, however the original array does not resize after running it through the method, and I'm not sure what I'm doing wrong.</p>
<p>I've tested that the newArr[] is in fact twice the length of the oldArr[] and contained the values of the oldArr[], but I can't figure out why it's not taking affect to the wordList[] in the main method.</p>
<p>My assignment is to use Arrays and not Arraylists, so using that is out of the question.</p>
<pre><code>infile = new BufferedReader( new FileReader(infileName) );
while (infile.ready()) {
String s = infile.readLine();
System.out.println(wordList.length);
System.out.println(count);
wordList[count] = s;
if(s.length() > lenOfLongest)
lenOfLongest = s.length();
if(s.length() < lenOfShortest)
lenOfShortest = s.length();
count++;
if(count == wordList.length)
resize(wordList);
}
private static String[] resize( String[] oldArr ) {
String[] newArr = new String[oldArr.length * 2];
System.out.println(newArr.length);
for(int i = 0;i < oldArr.length; i++) {
newArr[i] = oldArr[i];
}
return newArr;
}
</code></pre>
| java | [1] |
1,458,818 | 1,458,819 | how to add a link of other apps in a current app | <p>I have a bunch of similar apps which the user might be interested in downloading.
I have a button 'get more of this' so when the user clicks on this button , it shows a link of other apps. Clicking on that link should take him to the download page in the
android market. I tried google but couldn't find any answers. </p>
<p>Can someone help? </p>
<p>Thanks</p>
| android | [4] |
3,183,391 | 3,183,392 | Java: Is there a shortcut for doing this (simple accessors/getters stuff) | <p>Suppose I have a class called Person:</p>
<pre><code>public class Person
{
private String name, ID, location;
}
</code></pre>
<p>Instead of writing individual accessors for name, ID, and location, is there anyway to do something like this:</p>
<pre><code>public String get%s
{
return this.%s
}
</code></pre>
<p>Where "%s" stands as a sort of place holder for the name of the String which I want to "get". This way, for the sake of convenience and efficiency, I will be able to write one method to access all three Strings. Thanks.</p>
| java | [1] |
5,883,912 | 5,883,913 | array_multisort to sort several arrays | <p>I've searched for this but can't seem to find the exact answer. I want to use array_multisort to simultanously sort 3 arrays based on numeric values in 3 of the arrays. Basically I want to make a "standings" table similar to what you'd see for NFL/NHL standings etc. I have 3 arrays, tempIDs (string), tempWins (numeric), tempWinPercentage (numeric). I need all 3 to be sorted at the same time based first on wins, and then if there is a tie, win percentage.</p>
<p>I can't seem to get array_multisort to work with more than just 2 arrays, so maybe I'm misunderstanding the terminology when they say that it can work with "several" arrays. Thank you!</p>
| php | [2] |
110,142 | 110,143 | Why can't I get this value from the next dropdown with jQuery? | <p>I am attempting to get the value of a dropdown menu. I have several on the page.</p>
<p>The way it works is there is a radio button before each dropdown and ideally, on selecting the radio button, we simply get the current value displayed on the next select -> option.</p>
<p>What I have so far is:</p>
<p><strong>html:</strong></p>
<pre><code><input type="radio" class="ticketOption" value="30.00" />
<select>
<option value="1">1</option>
<option value="2">2</option>
</select>
</code></pre>
<p><strong>jquery:</strong></p>
<pre><code>$j(document).ready(function(){
$j('.ticketOption').click(function(){
var price = $j(this).attr('value');
var tickets = $j(this).next('select option:selected').text();
alert(tickets);
});
})
</code></pre>
<p>Yet my alert is coming up blank? I'm not sure if I'm doing my next() correctly. It seems pretty straight forward but I seem to be like thomas edison when it comes to getting my light bulb working.</p>
<p>Any ideas?</p>
| jquery | [5] |
5,333,075 | 5,333,076 | how to convert xls to xml in android | <p>Recently i am working with reading excel file and need to show it on android view.
I have even tried with both the java libraries say apache poi and jexcel api which helps
in parsing excel sheet in java but failed to parse in android when i tried.</p>
<p>I am even tried with converting excel to xml,than parse the xml and show the contents
on android view but for this i have needed convertor which converts .xls to .xml.
Can anybody help me in parsing excel file in android.</p>
<p>Thanks And Regards
Pinkesh Gupta</p>
| android | [4] |
2,659,476 | 2,659,477 | how to make sure that the value in a dynamic textbox is not empty using javascript | <p>I have nearly 80 textbox controls being created dynamically on the change of a dropdownlist item.</p>
<p>I need to make sure that none of these textboxes are empty when the user clicks on add item button.</p>
<p>I am aware of document.getElementbyid , however it does not serve my purpose as I will not know the id of the textboxes. The ids of the textboxes created start with "txt".</p>
<p>Can anyone paste a sample code of how to achieve this.</p>
<p>Thanks in advance.</p>
| asp.net | [9] |
4,952,680 | 4,952,681 | jQuery Drop Menu Click Function with Parent Disabled | <p><strong>I'm currently using:</strong></p>
<pre><code>$(".navigation ul ul, .shoppingbasket ul ul").css({display: "none"});
$(".navigation ul li, .shoppingbasket ul li").click(function(){
$(this).find('ul:first').slideToggle(400);
});
</code></pre>
<p><strong>I'm wanting to disable parent li if has child items</strong></p>
<pre><code>$(".navigation ul li:has(ul)").hover(function () {
$(this).children("a").click(function () {
return false;
});
});
</code></pre>
<p><strong>But they seem to be stopping each other from working together, does anyone have any idea how to fix this problem?</strong></p>
<p><strong>See link to see my problem
<a href="http://www.media21a.co.uk/clientlogin/benaiahmatheson/benaiah-matheson/profile/" rel="nofollow">http://www.media21a.co.uk/clientlogin/benaiahmatheson/benaiah-matheson/profile/</a></strong></p>
| jquery | [5] |
4,022,267 | 4,022,268 | Android getTargetFragment().getView() returning null | <p>I have an issue with orientation changes and a retained Fragment.</p>
<p>In the retained Fragment in <code>onActivityCreated()</code> I use <code>getTargetFragment().getView().find...</code></p>
<p>Sometimes the method returns null. I do not know why. I use the compatibility library v.4.</p>
| android | [4] |
1,789,355 | 1,789,356 | Drag and drop in API level 9 | <p>Can I implement drag and drop in android API level 9.Is there any jar file so that I can use it in Api level 9 and above.Please help me.</p>
| android | [4] |
106,279 | 106,280 | Display occurrence of number based off user input... array, java | <p>I am trying to have a user enter in any amount of numbers they like then based upon their input use an array to count each occurrence of the numbers entered by the user. I know where i have my occurrence counter per say i am missing my return statement as that was one of the things i am confused on, basically i am kind of stumped, yes this is homework and i do want to learn so i do not expect the full answer, just some input , thanks</p>
<p>package chapter_6;</p>
<p>import java.util.Scanner;</p>
<p>/**
*
* @author jason
*/
public class Six_Three {</p>
<pre><code>public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int[] num = createArray();
// prompt user for numbers
System.out.println("Enter integers between 1 and 100: ");
int data = input.nextInt();
}
// create array based off user input
public static int[] createArray() {
int[] num = new int[data];
return num;
}
// count each occurence of input numbers from user
public static int[] countNumbers(int[] data) {
for (int i = 0; i < data.length; i++)
return ?
}
</code></pre>
<p>}</p>
| java | [1] |
2,519,017 | 2,519,018 | Tips on where to go for PyOpenGL communication with wxPython? | <p>Tips on where to go for PyOpenGL communication with wxPython?
How do i communicate amongst panels and canvasses?</p>
<p>Ignore the following:</p>
<pre><code>from OpenGL.GLU import *
from OpenGL.GL import *
import sys,math
name = 'ball_glut'
class myGLCanvas(wxGLCanvas):
def __init__(self, parent):
wxGLCanvas.__init__(self, parent,-1)
EVT_PAINT(self, self.OnPaint)
self.init = 0
return
def main():
app = wxPySimpleApp()
frame = wxFrame(None,-1,'ball_wx',wxDefaultPosition,wxSize(400,400))
canvas = myGLCanvas(frame)
frame.Show()
app.MainLoop()
if __name__ == '__main__': main()
## end of http://code.activestate.com/recipes/325392/ }}}
</code></pre>
| python | [7] |
2,003,717 | 2,003,718 | __defineSetter__ replacement for firefox 3.5.x and up | <p>It seems that <code>__defineSetter__</code> no longer works in firefox latest version. It works in Chrome. </p>
<p>do you know Any replacement function that does the same thing and also works in other browsers like IE, Opera,Safari?</p>
| javascript | [3] |
1,317,765 | 1,317,766 | Java AES/CBC/PKCS7Padding missing one part of decrypt code | <p>Im new of Cryptography and BouncyCastle and i want to encrypt/decrypt with AES/CBC/PKCS7Padding ; maybe Encrypt is ok , but when ill decrypt the first part of sms3 is missing . somebody can help me?
Thanks</p>
<pre><code>String sms3 = "allora i Saiyan atterrarono sulla Terra e Napa disse";
byte iv2 [] = new byte [16] ;
random.nextBytes(iv2);
IvParameterSpec spec2 = new IvParameterSpec (iv2) ;
cipher = Cipher.getInstance("AES/CBC/PKCS7Padding", "BC");
cipher.init(Cipher.ENCRYPT_MODE, key,spec2 ) ;
boolean finish = false ;
int i = 0 ;
byte [] cText3 = new byte [cipher.getOutputSize(sms3.getBytes().length)];
//int cLenght2 = cipher.update(iv, 0, iv.length, cText3,0);
int cLenght2 = 0 ;
System.out.println("size of sms3" + " " + cText3.length);
while (finish == false)
{
if ((sms3.getBytes().length)- i < 16 ) // last block
{
cLenght2 += cipher.doFinal(cText3, cLenght2);
finish = true ;
}
else
{
cLenght2 = cipher.update(sms3.getBytes(), 0, sms3.getBytes().length, cText3, 0);
}
}
// DECRYPT MODE
cipher.init(Cipher.DECRYPT_MODE, key,spec2 ) ;
byte [] plain4 = new byte [cipher.getOutputSize(cLenght2)];
int buf = cipher.update(cText3, 0,cLenght2,plain4,0);
buf += cipher.doFinal(plain4, buf);
byte [] fin = new byte [buf - spec2.getIV().length];
System.arraycopy (plain4 ,spec2.getIV().length ,fin ,0, fin.length);
</code></pre>
| java | [1] |
378,553 | 378,554 | passing values across classes | <p><br>
I am doing a Java application in which i have two .java files (Connect.java and Handler.java).In Connect.java i have a function where i am getting some values from some other Response.java file . Now i need to pass these values as input parameters to a function in Handler.java . Following is my java file.Can any one help me please...?</p>
<h3>Connect.java:</h3>
<pre><code>public class Connect
{
private Response obj_response;
public String UserId;
public String LocationIpAddress;
public String PassWord;
public Connect(Response p_response)
{
obj_response=p_response;
}
public ConnectResponse handleConnect()
{
try
{
//values got from Response.java file
String UserId=obj_response.getUserId();
String LocationIpAddress=obj_response.getLocationIpAddress();
String PassWord=obj_response.getPassWord();
}
catch(IOException e)
{
System.out.println("IO Exception");
}
return null;
}
}
</code></pre>
<p>How can i implement my Handler.java?</p>
| java | [1] |
2,798,348 | 2,798,349 | how to call a file from back end through asp.net | <p>i want to open a file in front end which is located at different location and the location is mentioned in a different file at the backend through asp.net
in details it will be
on clicking a link at front end it will open a file (stored at backend and the path and address of the original file location is mentioned in this file) read the file and open the original file (stored at different location). </p>
| asp.net | [9] |
6,018,672 | 6,018,673 | How should onClick Listener by defined and instantiated for an Activity | <p>My Activity has multiple lists so I have defined MyClickListener as below:</p>
<p>My question is how I should instantiate this class:</p>
<pre><code> MyClickListener mMyClickListener = new MyClickListener();
</code></pre>
<p>Or maybe it is better to instantiate inside the onCreate(Bundle) and just define above. Whats considered the better way? I don't want too much in onCreate() its already full of stuff. Any thoughts on the declaration and instatiation? Whats the best way?</p>
<pre><code>private class MyClickListener implements OnClickListener
{
@Override
public void onClick(View view) {
}
}
</code></pre>
| android | [4] |
2,252,107 | 2,252,108 | Android: Separate intents for email & SMS | <p>I have an app that has two buttons – one for email & one for SMS. Depending on the button pressed I want to email or else SMS a certain text. I have coded the email button and it is working fine. The problem is that the dialog box that pops-up gives an option of e-mail or Messaging the text. I want to separate out the two, so that when the user presses email, only the options of email is there, and when the user presses SMS, only the option of Messaging is there.</p>
<p>Here is the code that I have tried.</p>
<pre><code>private void sendEmail(){
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "Subject of the message");
i.putExtra(Intent.EXTRA_TEXT , "Body of the message");
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
}
</code></pre>
<p>Basically there seems to be a single intent Intent.ACTION_SEND for both emails & Messaging. </p>
<p>Any way to separate them out?</p>
| android | [4] |
5,678,418 | 5,678,419 | JavaScript New Date() | <p>I have the following JavaScript code but for some reason time is not including minutes:</p>
<pre><code>var austDay = $("#<%= hiddenFieldTime.ClientID %>").val().split(" ");
var year = austDay[0];
var months = austDay[1];
var days = austDay[2];
var time = austDay[3];
var timeUntil = new Date(parseInt(year), parseInt(months),
parseInt(days), parseInt(time));
</code></pre>
<p>When I debug using firebug these are my value:</p>
<pre><code>$("#ctl00_hiddenFieldTime").val() = "2011, 5, 6, 14:20:00"
year = "2011,"
months = "5,"
days = "6,"
time = "14:20:00"
timeUntil = Date {Mon Jun 06 2011 14:00:00 GMT-0400 (Eastern Daylight Time)}
</code></pre>
<p>As you can see, timeUntil is set to <code>14:00:00</code> instead of <code>14:20:00</code></p>
| javascript | [3] |
555,609 | 555,610 | Determine if begindate is weekend | <p>I need to check if the selected date from a datepicker is not on a weekend. The function needs to keep checking if the new startdate is a weekend. Also it need to add days to the startdate if a weekend occurs.</p>
<p>Code should be something like this:</p>
<pre><code>int startday = Datepicker1.SelectedDate;
if (startdate = weekendday, startdate++)
{
startdate++ //or if a sunday +2
}
else
{
return startdate
}
</code></pre>
<p>Thank you for your help.</p>
| c# | [0] |
2,234,262 | 2,234,263 | java script array | <pre><code>Array
(
[0] => giri
)
Array
(
[0] => ramya
)
Array
(
[0] => sangeetha
)
Array
(
[0] => hemalatha
)
Array
(
[0] => umar
)
</code></pre>
<p>How to convert this php array like the below java script array?</p>
<pre><code>var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
</code></pre>
| php | [2] |
4,525,977 | 4,525,978 | File data changed after encrypting then decrypting | <p>I encrypted a file using DES then After decrypting it successfully at the server and using </p>
<pre><code>System.IO.File.WriteAllBytes(@"c:\test\" + fileName, decryptedFile);
</code></pre>
<p>method the file data changed a little it the text is "Encrypting and Decrypting usind DES blah blah blah blah"
the text in the end file after decrypting is " k$nlng and Decrypting usind DES blah blah blah blah"
and i also tried this:</p>
<pre><code>using (BinaryWriter binWriter =
new BinaryWriter(File.Open(@"C:\Test\" + fileName, FileMode.Create)))
{
binWriter.Write(decryptedFile);
}
</code></pre>
<p>the text still not the same
encrypting by :</p>
<pre><code>public byte [] DESEncrypt(byte [] fileBytes)
{
CryptoStreamMode mode = CryptoStreamMode.Write;
// Set up streams and encrypt
MemoryStream memStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memStream,
cryptoProvider.CreateEncryptor(cryptoProvider.Key, cryptoProvider.Key), mode);
cryptoStream.Write(fileBytes, 0, fileBytes.Length);
cryptoStream.FlushFinalBlock();
// Read the encrypted message from the memory stream
byte[] encryptedMessageBytes = new byte[memStream.Length];
memStream.Position = 0;
memStream.Read(encryptedMessageBytes, 0, encryptedMessageBytes.Length);
MessageBox.Show("encrypted DES");
return encryptedMessageBytes;
}
</code></pre>
<p>decrypting by:</p>
<pre><code>static public byte[] DESdecrypt(byte [] fileBytes)
{
ICryptoTransform decryptor = cryptoProvider.CreateDecryptor();
byte[] originalAgain = decryptor.TransformFinalBlock(fileBytes, 0, fileBytes.Length);
return originalAgain;
}
</code></pre>
<p>Thanks</p>
| c# | [0] |
4,845,555 | 4,845,556 | alternative to maps | <p>Since maps dont allow duplicate values . Are there any other containers that are part of C++ standard library that allow duplicates that store values by key value pair?</p>
| c++ | [6] |
4,700,613 | 4,700,614 | Displaying phone number in US format in iPhone application | <p>In my iphone app i have a text field to accept phone number. I need to display the number
in US Phone number format .That is like (000) 000-0000. Typically like iPhone Contact phone
number entry. How can i do this . Any idea will be greatly appreciated.</p>
<p>Thanks in advance!!!</p>
| iphone | [8] |
4,017,254 | 4,017,255 | Why are textwrap.wrap() and textwrap.fill() so slow? | <p>Why are <a href="http://docs.python.org/library/textwrap.html#textwrap.wrap" rel="nofollow"><code>textwrap.wrap()</code></a> and <a href="http://docs.python.org/library/textwrap.html#textwrap.fill" rel="nofollow"><code>textwrap.fill()</code></a> so slow? For example, to wrap a string of 10000 characters on my laptop takes nearly two and a half seconds.</p>
<pre><code>$ python -m timeit -n 10 -s 's = "A" * 10000; import textwrap' 'textwrap.fill(s)'
10 loops, best of 3: 2.41 sec per loop
</code></pre>
<p>Compare that to this code adapted from <a href="http://stackoverflow.com/a/2657733/38140">an answer to a related Stack Overflow question</a></p>
<pre><code>#!/usr/bin/env python
# simplewrap.py
def fill(text, width=70):
return '\n'.join(text[i:i+width] for i in
range(0, len(text), width))
</code></pre>
<p>which wraps the text orders of magnitude faster than <code>textwrap</code>:</p>
<pre><code>$ python -m timeit -n 10 -s 's = "A" * 10000; import simplewrap' 'simplewrap.fill(s)'
10 loops, best of 3: 37.2 usec per loop
</code></pre>
| python | [7] |
4,321,786 | 4,321,787 | Configuring proxy from code | <p>I have a requirement like as following</p>
<pre><code>if(condition){
//configure the proxy
}
</code></pre>
<p>Now I am able to browse the web from the emulator after I configure the proxy from </p>
<blockquote>
<p>settings -> wireless network -> Mobile network -> Access Point name -> Telkila -> proxy.</p>
</blockquote>
<p>Now I came to know that proxy configuration can also be done by inserting (99,'http_proxy',':') in <code>/data/data/com.android.providers.settings/settings.db.system</code> table.So I inserted the following row (99,'http_proxy','10.203.227.227:80').But after inserting this I am unable to browse the web through the emulator.My strategy was like inserting this row from my code.But this doesn't seem to be working.Is there any other way that I can configure proxy settings from code.Please help me on this as I am struggling a lot on this.And sorry for repeating the same post.But it is very urgent need.</p>
| android | [4] |
1,954,064 | 1,954,065 | What extension to enable in order to use scandir() in php? | <p>I read from the php documentation that since 5.1.0 scandir() is by default not usable in php. </p>
<p>How can i enable it? </p>
| php | [2] |
2,191,844 | 2,191,845 | jQuery - remove select option :selected attribute on click | <p>I'm working on a multiselect that pops up in a modal dialog. When the dialog closes, I'm populating a <code><ul></code> with <code><li></code>'s that contain text from the <code>:selected</code> options. When each individual <code><li></code> is clicked, I want the <code><li></code> to fade away and the corresponding <code>:selected</code> <code><option></code> to become unselected. I have everything working except unselecting the <code><option></code>.</p>
<p>Here's my code:</p>
<pre><code>$('.control-finished').click(function(){
$('ul.multiselect-dropdown-options-'+name+'').empty();
$('option:selected', select).each(function(index, value) {
var livalue = $(this).attr('value');
$('ul.multiselect-dropdown-options-'+name+'').append('<li class="dropdown-option '+livalue+'">'+$(value).text()+'<!-- <a class="remove-option '+livalue+'"> -->x</li>');
$('li.dropdown-option').click(function(){
$(this).fadeOut(500, function() { $(this).remove(); });
$('option:selected', this).removeAttr('selected');
});
});
});
</code></pre>
<p>Any help is greatly appreciated!</p>
| jquery | [5] |
3,461,255 | 3,461,256 | Simple PHP Login does not work | <p>This is my script:</p>
<pre><code>session_start();
include "../inc/conn.php";
if ($_GET['login']=="yes") {
echo 'test2';
$username=$_POST('username');
$password=$_POST('password');
echo $username.' '.$password;
$userq=mysql_query("SELECT * FROM members WHERE username='$username' AND password='$password'") or die(mysql_error());
if (mysql_num_rows($userq)=="1") { $_SESSION['chkuser']="confirmed"; $_SESSION['username']=$user; }
else { echo 'Потребителското име и/или паролата са грешни. Моля опитайте отново.'; }
}
echo $user.' '.$pass;
if ($_SESSION['chkuser'] <> "confirmed") {
echo '<div align="center"><strong>Моля въведете име и парола</strong>:<br/><br/><br/>';
?>
<form name="form1" method="post" action="?login=yes">
Потребител: <input type="text" name="username" />
Парола: <input type="password" name="password" /><br/><br/>
<p><input type="submit" name="Submit" value="Вход" /></p>
</div>
</form>
<?
exit();
}
</code></pre>
<p>Test 2 is echoed, but username and password are not sent via POST - scripts breaks after $_POST is used.. Do you guys see where my error is ?</p>
| php | [2] |
4,401,611 | 4,401,612 | singleton-early initialization ,static field initialization and class loading | <p>Conside this code:</p>
<pre><code>class MyClass {
private static MyClass myobj = new MyClass();
private MyClass() {
}
public static MyClass getMyobj() {
return myobj;
}
}
</code></pre>
<p>1)IN above code when will <code>myobj</code> get initialiazed-when <code>Myclass</code> gets loaded OR when <code>getMyobj()</code> will be called first time as <code>MyClass.getMyobj();</code>?</p>
<p>2) Suppose we call twice as:</p>
<pre><code>MyClass.getMyobj();
MyClass.getMyobj();
</code></pre>
<p>will it create new <code>MyClass()</code> object on second call? </p>
| java | [1] |
3,176,479 | 3,176,480 | jquery binding to a form submit | <p>I'm doing the following:</p>
<pre><code> // Post to the server
$.ajax({
type: 'POST',
url: $("form.edit_item").attr("action"),
data: $("form.edit_item").serialize(),
success: function(e) {
}
});
$(".edit_item")
.bind('ajax:loading', function() {
alert('go');
})
.bind('ajax:success', function(data, status, xhr) {
alert('going');
})
});
</code></pre>
<p>On the form:</p>
<pre><code><form accept-charset="UTF-8" action="/xxxxx/18" class="edit_item" id="edit_item_31" method="post"><div
</code></pre>
<p>While the form posting works fine.the ajax binds are not working. Suggestions?</p>
<p>Thank you</p>
| jquery | [5] |
4,911,663 | 4,911,664 | android aidl nullpointer | <p>Are there anyone knows why I always get null pointer in the "myService.getMountPoint();"?</p>
<p>I think I do it almost as the same as the example on the Internet.</p>
<pre><code>public class mainActivity extends Activity {
/** Called when the activity is first created. */
private IMountService myService = null;
private ServiceConnection conn = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) {
// TODO Auto-generated method stub
myService = IMountService.Stub.asInterface(service);
}
public void onServiceDisconnected(ComponentName name) {
// TODO Auto-generated method stub
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bindService(new Intent(mainActivity.this, DeviceStatusService.class), conn,
Context.BIND_AUTO_CREATE);
startService(new Intent(mainActivity.this, DeviceStatusService.class));
try {
myService.getMountPoint();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
</code></pre>
<p>}</p>
| android | [4] |
5,910,262 | 5,910,263 | cycle through four list elements, applying an "active" class | <p>I would like to cycle through four li elements that all contain tags, setting the appropriate class to "active" and remove the "active" class. I'm having a bit of trouble figuring out how to achieve this via jQuery.
HTML:</p>
<pre><code><ul class="liveMenu">
<li id="leftScroll"></li>
<li id="liveButton_1"><a class="buttons" href="#featured_1"></a></li>
<li id="liveButton_2"><a class="buttons" href="#featured_2"></a></li>
<li id="liveButton_3"><a class="buttons" href="#featured_3"></a></li>
<li id="liveButton_4"><a class="buttons" href="#featured_4"></a></li>
<li id="rightScroll"></li>
</ul>
</code></pre>
<p>jquery:</p>
<pre><code>var index = 0;
$("#rightScroll").click(function(){
if(index != 3){
index++;
} else {
index = 0;
}
//this part is untested, it should work though
$("a.active").removeClass("active");
//this is where I am getting hung up
//I need something like...
$.each("li.buttons", function(i){
if(i == index){
$(this).addClass("active");
}
});
});
$("#leftScroll").click(function(){
if(index != 0){
index--;
} else {
index = 3;
}
$.each("li.items", function(i){
if(i == index){
$(this).addClass("active");
}
});
});
</code></pre>
<p>any help would be greatly appreciated. Thankyou.</p>
| jquery | [5] |
4,192,455 | 4,192,456 | How can I create a character array in Java without a specified length? | <pre><code> char ret[] = {};
</code></pre>
<p>Doesn't work seem to work and I'm not sure what the best way to do this is.</p>
<p>Any help would be greatly appreciated.</p>
| java | [1] |
5,076,821 | 5,076,822 | ChangePassword control, Text required error message does not appear | <p>I have a ChangePassword control on a page like thus:</p>
<pre><code><asp:ChangePassword ID="ChangePassword1" runat="server"
NewPasswordRegularExpressionErrorMessage="Password must be atleast 8 characters, containing upper & lowercase, numeric and special characters."
ConfirmPasswordRequiredErrorMessage="Confirm Password is Required."
PasswordLabelText="Current Password:" OnChangedPassword="ChangePassword1_ChangedPassword">
</asp:ChangePassword>
</code></pre>
<p>When the page runs if the user leaves the Confirm Password textbox blank, then the page displays a red * next to the textbox but no error message. Same thing happens for the other textboxes.</p>
<p>However if the user doesn't meet the Regular Expression rule then the error message set at NewPasswordRegularExpressionErrorMessage is displayed (I'm setting the regex value in the code behind).</p>
<p>I've tried adding a ValidationSummary and pointing it at ChangePassword1 control but no change.</p>
<p>How do I get an error message to display if the user leaves textboxes empty?</p>
| asp.net | [9] |
1,706,964 | 1,706,965 | Random in python 2.5 not working? | <p>I am trying to use the import random statement in python, but it doesn't appear to have any methods in it to use.</p>
<p>Am I missing something?</p>
| python | [7] |
3,678,988 | 3,678,989 | dynamic drop down - user selection used for table creation. Is it possible? | <p>ok I've gotten this far with your wonderful help, just trying to work out where I'm going wrong still?</p>
<pre><code> <script>
function disp_text()
{
var w = document.myform.mylist.selectedIndex;
var selected_text = document.myform.mylist.options[w].text;
location.href="By_regions_report2.php?selected_text=" + selected_text; //loading a seperate php page to catch result
alert(selected_text);
}
</script>
<?php
$dropdown_sql="SELECT DISTINCT `2010 RSG Code` AS codes FROM locations";
$dropdown_result=mysql_query($dropdown_sql);
$options="";
while ($row=mysql_fetch_array($dropdown_result)) {
$codes=$row["codes"];
$options.="<OPTION VALUE=\"codes\">$codes</option>";
}
?>
<form NAME="myform">
<SELECT NAME="mylist" onchange="disp_text()">
<OPTION VALUE=0>Select a region
<?php echo $options ?>
</SELECT>
</form>
</code></pre>
<p>this is the second .php file:</p>
<pre><code><?php
$selectedCode = $_GET[selected_text];
?>
</code></pre>
<p>getting error Use of undefined constant selected_text - assumed 'selected_text' when the onchange() function is invoked</p>
<p>edit:
is there a way to reload the original page automatically with the new variables in it?</p>
| php | [2] |
1,928,654 | 1,928,655 | jQuery Toggle Checkbox state | <p>I have a table with each row containing a checkbox as well as some other cells. To make the entire row clickable so that it can be used to toggle the state of the checkbox I used this piece of code: </p>
<pre><code> $('#eoiTable tr').click(function(){
var $checkbox = $(this).find('input[type=checkbox]');
$checkbox.prop('checked', !$checkbox.is(':checked'));
});
</code></pre>
<p>This works great for all cells in the row, except when I click directly on the checkbox itself. It re-toggles to its old state. I can understand what's going on here, but how I can make sure that the table onclick event doesn't work when you click on the checkbox itself?</p>
<p>Thanks a ton! </p>
| jquery | [5] |
3,797,455 | 3,797,456 | mysqli->prepare('Update') | <p>is this code ok? because I don't get my db updated and I get no errors. Thank you.</p>
<pre><code>//connect to db
$email = $mysqli->real_escape_string($_POST['email']);
$bo = $mysqli->real_escape_string($_POST['bo']);
$p1 = $mysqli->real_escape_string($_POST['p1']);
$p2 = $mysqli->real_escape_string($_POST['p2']);
$dt = $mysqli->real_escape_string($_POST['dt']);
$dt = new DateTime("2012-07-01 13:13:13", new DateTimeZone('Europe/Paris'));
//more validation code...
$stmt = $mysqli->prepare('UPDATE table SET Password=?, R_P=?, R_T=? WHERE E_mail=?')
$stmt->bind_param("ssss", $p2, $p2, $dt, $email);
$stmt->execute();
$stmt->close();
$mysqli->close();
//send email
</code></pre>
<p><strong>I had no errors because I forgot to add on my page a thing that I always add on all my pages:</strong></p>
<pre><code>// check for errors
require_once('check_all_errors.php');
</code></pre>
| php | [2] |
4,941,393 | 4,941,394 | Why does console.log inside this self invoking function not get executed? | <p>The following code prints "true". I can understand why ff.f is equal to undefined, but I don't understand why console.log("Hi") is not executed inside ff.f when checking this value. Isn't f immediately executed upon definition?</p>
<pre><code>var ff = function(){
var f = function(){
console.log("Hi");
}();
};
console.log(ff.f === undefined);
</code></pre>
<p>[Edit] I guess a better way to ask this question is "When does this f function inside ff get executed?". I think it's weird that ff.f's value is "undefined" if it doesn't get executed until ff gets executed. Shouldn't it be the function instead?</p>
| javascript | [3] |
5,618,392 | 5,618,393 | jQuery combine toggle with click | <p>here is the code: <a href="http://jsfiddle.net/sxqwp/1/" rel="nofollow">http://jsfiddle.net/sxqwp/1/</a></p>
<p>My question is when I press 'close' then press 'toggle' nothing happens, after second click shows text. When I click 'toggle' it hides text then I click 'open' it shows text but when click again 'toggle' it still shows etc. How can I fix this</p>
<p>what if something like this?</p>
<p><a href="http://jsfiddle.net/sxqwp/6/" rel="nofollow">http://jsfiddle.net/sxqwp/6/</a></p>
<pre><code>$("a").toggle(
function () {
$('p').animate({width: "200px"});
},
function () {
$('p').animate({width: "100px"});
}
);
$("a.openA").click(function() {
$('p').stop().animate({width: "200px"});
});
$("a.closeA").click(function() {
$('p').stop().animate({width: "100px"});
});
</code></pre>
| jquery | [5] |
1,193,964 | 1,193,965 | C++ cout pointer | <p>Hello
Can somebody explain why second <strong>cout</strong> in func(char *p) doesn't work:</p>
<pre><code>#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
char *strhex(char *str);
char *func(char *p);
int main()
{
char *ptr;
char *p=strhex("d");
cout<<"main:"<<p<<endl;
cout<<func(p)<<endl;
system("PAUSE");
return 0;
}
char *func(char *p)
{
cout<<"func1:"<<p<<endl;
char buffer[500]="";
char *zbuffer = buffer;
cout<<"func2:"<<p<<endl; ///doesn't work
return zbuffer;
}
char *strhex(char *str)
{
char buffer[500]="";
char *pbuffer = buffer;
int len = strlen( str );
for( int i = 0; i < len ;i++ )
{
itoa(str[i],pbuffer,16);
pbuffer +=2;
};
*pbuffer = '\0';
pbuffer=buffer;
return pbuffer;
}
</code></pre>
<p>Edit:
i'm using DEV C++ 4.9.9.2 on Windows</p>
| c++ | [6] |
3,857,078 | 3,857,079 | object to xml serialization error | <p>There was an error generating the XML document. Can anyone help?? The code is below. thanx in advance</p>
<pre><code> Public Shared Function toXml(ByRef objectToConvert As Object) As String
Dim ns As New XmlSerializerNamespaces()
Dim ms As New System.IO.MemoryStream()
Dim xs As New System.Xml.Serialization.XmlSerializer(objectToConvert.GetType())
Dim xtw As New System.Xml.XmlTextWriter(ms, System.Text.Encoding.UTF8)
xs.Serialize(xtw, objectToConvert, ns)
ms = DirectCast(xtw.BaseStream, System.IO.MemoryStream)
Return New UTF8Encoding().GetString(ms.ToArray())
End Function
</code></pre>
| asp.net | [9] |
5,834,295 | 5,834,296 | smiley to image - optimized PHP code | <p>is it a good code or it can be optimized ?</p>
<pre><code> $tempmsg = str_replace("[:)]","<img src='img/smiley0.png' title='Smile' height='100' width='100'>",$tempmsg);
</code></pre>
| php | [2] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.