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,711,998 | 1,711,999 | How to get file name from full path using javascript | <p>Just wondering, is there any way that I can get the last value (based on the '\' symbol) from a full path? Example:</p>
<pre>
C:\Documents and Settings\img\recycled log.jpg
</pre>
<p>With this case, I just want to get <code>recycled log.jpg</code> from the full path in JavaScript. </p>
| javascript | [3] |
4,866,429 | 4,866,430 | How do I get offline voice detection on my tablet running JB(4.1.1)? | <p>I just got myself a budget tablet(halo value) from "swipe telecom", and I was wondering how I can get offline speech recognition on it, since JB should support it. My language is set to English(US), and I can't seem to find any option to download offline voice recognition files. I looked under settings>language & input>google voice typing settings, and it has just one option, to block offensive words. And under voice search settings, I have "speech output","block offensive words" and "Hotword Detection".</p>
<p>Any ideas how to get offline voice recognition on the tab?</p>
| android | [4] |
2,652,268 | 2,652,269 | cloning interfaces in Java | <p>I have a problem in Java:</p>
<p>I have an interface:</p>
<pre><code>public interface I extends Cloneable {
}
</code></pre>
<p>and an abstract class:</p>
<pre><code>public abstract class AbstractClass {
private I i;
public I i() {
return (I)(i).clone();
}
}
</code></pre>
<p>but the usage of clone() yields the following error:</p>
<blockquote>
<p>The method clone() is undefined for
the type I</p>
</blockquote>
<p>does anybody have any Idea how to get around this issue? the only fix I found is to add to I a new method: (I newI() ) that will clone I. is there a cleaner solution?</p>
<p>thanks.</p>
| java | [1] |
3,856,142 | 3,856,143 | Fast ascii block to integer | <p>Is there any command in stl that converts ascii data to the integer form of its hex representation? such as: "abc" -> 0x616263.</p>
<p>i have the most basic way i can think of: </p>
<pre><code>uint64_t tointeger(std::string){
std::string str = "abc";
uint64_t value = 0; // allow max of 8 chars
for(int x = 0; x < str.size(); x++)
value = (value << 8) + str[x];
return value;
}
</code></pre>
<p>as stated above: <code>tointeger("abc");</code> returns the value <code>0x616263</code></p>
<p>but this is too slow. and because i have to use this function hundreds of thousands of times, it has slowed down my program significantly. there are 4 or 5 functions that rely on this one, and each of those are called thousands of times, in addition to this function being called thousands of times</p>
<p>what is a faster way to do this?</p>
| c++ | [6] |
2,245,313 | 2,245,314 | If I run a stored procedure that takes 5 minutes to complete, will my code sequence continue before the stored procedure is complete? | <p>If I have a program that runs a stored procedure that takes about 5 minutes to run, for example:</p>
<pre><code>Database.RunJob(); -- takes 5 mins to complete
MessageBox.Show("Hi");
</code></pre>
<p>Question - is the message box going to show "Hi" <strong>BEFORE</strong> Database.RunJob() is complete?</p>
<p>If it does, how do I make sure a query is complete before proceeding to the next line of code?</p>
| c# | [0] |
3,858,717 | 3,858,718 | show js array in html table | <p>I have a javascript array and I want to show parts of it in HTML.</p>
<p>For example what html code would I use in the body to show a table of just the info from QR4 - the number and the country? There are other parts to the array so to show the whole QR4 array would be fine, but Id also like to know how to select specific parts</p>
<pre><code>QR4[25] = "China";
QR4[24] = "39241000";
QR8[25] = "China";
QR8[24] = "39241000";
QR8L[25] = "China";
QR8L[24] = "39241000";
QR4L[25] = "China";
QR4L[24] = "39241000";
</code></pre>
<p>I have this code making a table in php using csv which works fine but I want it client side, not server side. A table like this would be fine...</p>
<pre><code><?php
echo "<table>\n\n";
$f = fopen("csv.csv", "r");
while (!feof($f) ) {
echo "<tr>";
$line_of_text = fgetcsv($f);
echo "<td>" . $line_of_text[10] . "</td>";
echo "<tr>\n";
}
fclose($f);
echo "\n</table>";
?>
</code></pre>
| javascript | [3] |
2,918,181 | 2,918,182 | Javascript split to split string in 2 parts irrespective of number of spit characters present in string | <p>I want to split a string in Javascript using split function into 2 parts.</p>
<p>For Example i have string:</p>
<pre><code>str='123&345&678&910'
</code></pre>
<p>If i use the javascripts split, it split it into 4 parts.
But i need it to be in 2 parts only considering the first '&' which it encounters.</p>
<p>As we have in Perl split, if i use like:</p>
<pre><code>($fir, $sec) = split(/&/,str,2)
</code></pre>
<p>its splits str into 2 parts, but javascript only gives me:</p>
<pre><code>str.split(/&/, 2);
fir=123
sec=345
</code></pre>
<p>i want sec to be:</p>
<pre><code>sec=345&678&910
</code></pre>
<p>How can i do it in Javascript.</p>
| javascript | [3] |
2,187,029 | 2,187,030 | How to remove $ from javascript variable? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4846978/remove-characters-from-a-string">Remove characters from a string</a> </p>
</blockquote>
<p>I have a variable <code>p</code> which I would like to remove the <code>$</code> from. This variable will be a number such as <code>$10.56</code>. How can I do this? I thought it could be done using <code>.replace('$','')</code> but i'm not quite sure how to implement this. </p>
<p>Here is my javascript code:</p>
<pre><code>function myFunction() {
var p = parseFloat(document.getElementById('p_input').value);
var q = parseFloat(document.getElementById('q_input').value);
if (!q){
document.getElementById('t').value = '';
}
else {
var t = q * p;
document.getElementById('t_output').value = t;
}
}
</code></pre>
| javascript | [3] |
984,697 | 984,698 | How to show SaveFileDialog | <p>How to show <code>SaveFileDialog</code> to user that can select path for save file?</p>
| asp.net | [9] |
307,671 | 307,672 | Can someone provide the URL for obtaining a Provisioning Profile? | <p>I downloaded a new SDK version and now I get this error.</p>
<p>Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain</p>
<p>I don't need to deploy to the device just get my project running in XCode.</p>
<p>Thanks in advance.
jpc</p>
| iphone | [8] |
5,061,428 | 5,061,429 | Jquery Determine if there are changes in the value of select box | <p>How can i determine the value is changed in the select box without clicking the select box itself.</p>
<p>My code is as follows:</p>
<p>JQUERY</p>
<pre><code> $("select").each(function() {
$(this).change(function() {
if ($(this).val() === "-Select-"){
this.parent().addClass("highlightSelect");
this.parent().sibling().show();
} else{
this.parent().removeClass("highlightSelect");
this.parent().sibling().hide();
}
});
});
</code></pre>
<p>HTML</p>
<pre><code><div id="wwctrl_add_savedAddressId" class="wwctrl styled-select">
<select id="add_savedAddressId" class="storedPaymentInput_size4 required savedAddress checkDropdown valid" onchange="changeSavedAddressType();generateSavedAddressAdd();" name="summaryData.usedAddress">
<option value="-Select-">-Select-</option>
<option value="O">Enter New Address</option>
<option value="3041">Home - 116 Parrot...</option>
<option value="22268">Other - rwara, aw...</option>
<option value="21372">Other - 1040..</option>
</select>
</div>
<div class="error" for="add_savedAddressId" generated="true" style="display: none;"> Select item</div>
</code></pre>
<p>Note: I have other buttons which affects the change of the value of the above select box</p>
| jquery | [5] |
5,067,308 | 5,067,309 | Google support for enterprise Android development | <p>Does Google offer any support program for enterprise Android development?</p>
<p>Something similar to Apple's <a href="http://developer.apple.com/programs/ios/enterprise/" rel="nofollow">iOS Developer Enterprise Program</a>?</p>
<p>A search on Internet didn't yield any results, so I'm wondering if anyone here know of such an existing/future program?</p>
| android | [4] |
5,933,137 | 5,933,138 | How to write files to assets folder or raw folder in android? | <p>I am working on some a application where I have to update some files present in assets / raw folder runtime from some http location.</p>
<p>Can anyone help me to by sharing how to write files in assets or raw folder?</p>
| android | [4] |
1,362,824 | 1,362,825 | Reapply style after adding content with JavaScript | <p>I will try to expand my problem:</p>
<p>I have a link:</p>
<pre><code><a href="#" onClick="Display(); return false;">Display</a>
</code></pre>
<p>I have some styles:</p>
<pre><code><style type="text/css">
p {
background-color: #AFA99B;
}
</style>
</code></pre>
<p>And the folowing js code:</p>
<pre><code>function printf(MyHtml){
document.write(MyHtml);
}
function Display(){
printf("<p>some html code<p>");
//...
}
</code></pre>
<p>So when the user click the link, I must add some html content to the body & the new added elements must use the styles defined.
That's all.</p>
| javascript | [3] |
3,908,269 | 3,908,270 | Run code if not being included | <p>page1.php:</p>
<pre><code>include 'page2.php';
echo $info;
</code></pre>
<p>page2.php:</p>
<pre><code>$info = "some info";
if(!included){
echo 'Why are you on this page?';
}
</code></pre>
<p>How can I get the value of <code>included</code> to see if the page is viewed by a user?</p>
| php | [2] |
2,794,201 | 2,794,202 | View.js doesn't show images | <p>The view.js plugin (<a href="http://finegoodsmarket.com/view/" rel="nofollow">finegoodsmarket.com/view/</a>) isn't showing any images on my test site: </p>
<p><a href="http://davidthunander.se/wordpress/" rel="nofollow">davidthunander.se/wordpress/</a></p>
<p>The viewer opens, but the images are hidden... Any ideas on how to fix this?</p>
| jquery | [5] |
2,395,429 | 2,395,430 | In android project R.java is not created | <p>I am using android sdk on Linux Ubuntu but when I try to create my new android project there is a problem - R.java is not created.</p>
<p>I am getting confused why it's showing such a problem. </p>
| android | [4] |
178,286 | 178,287 | i need a jquery command to change background-image: url() content | <p>i an a newbie. i have this code:</p>
<pre><code><div id="cloud-zoom-big" class="cloud-zoom-big" style="position: absolute; left: 342px; top: -10px; width: 390px; height: 390px; background-image: url(http://kato-shoes.ro/image/cache/data/balerini/balerini1234verde-750x750.jpg); z-index: 99; background-position: -359px -359px;">
<div class="cloud-zoom-title" style="opacity: 0.5;">Balerini Prada 1234</div>
</div>
</code></pre>
<p>i need a jquery command that changes the <strong>background-image: url()</strong> content(what is inside () ), with another link. this another link is something like this ('href'.data.data.pop)</p>
<p>here is the line with comment that should be changed:</p>
<p>Image swapping for variant</p>
<pre><code>if(data.data.image !='') {
$('#image').attr('src', data.data.thumb);
$('#wrap a').attr('href', data.data.pop);
$('.image a').attr('href', data.data.pop); // this line to be fixed
}
</code></pre>
<p>HOW should the bold line look like?
can someone please help, i am stuck in this for 3 weeks... :)</p>
| jquery | [5] |
1,829,437 | 1,829,438 | Recording(VIDEO) CamCoder not Support | <p>I need to capture Video and Store in <code>SDCARD</code>, I got help from here::: </p>
<p><a href="http://stackoverflow.com/questions/1817742/android-video-recording-sample"><h3>http://stackoverflow.com/questions/1817742/android-video-recording-sample</h3></a></p>
<p>And i found That <strong>CamcorderProfile</strong> (<code>
CamcorderProfile cpHigh = CamcorderProfile
.get(CamcorderProfile.QUALITY_HIGH);</code>) is Since From API level 8 and My project are buld in 1.5. so What is Alternative Way to Encounter this Problem?</p>
| android | [4] |
5,413,110 | 5,413,111 | Simulating Horizontal Scrolling of GridView using Gallery but scrolling Tables not Images android | <p>I've come to the conclusion there is no Horizontal Scrolling for gridView. The work-around solutions online are to use Gallery in a multi-row format.</p>
<p>However, from what I understand, Gallery requires image files. (Please correct me if I'm wrong.)</p>
<p>I want a work around that can scroll tables (aka a grid view) . I'm basically making a Calendar where I'd like to scroll horizontally. It doesn't have to be as fluid where scrolling vertically shows each additional week that comes into view. Horizontal scrolling can simply scroll month by month. </p>
<p>Nevertheless, I'm wondering if there is some sort of work-around with Gallery? Or does Gallery absolutely require images?</p>
| android | [4] |
4,627,676 | 4,627,677 | Python calling a module | <p>Im trying to call module but some reason its giving me error.
The data.py contains a list of items and in the main.py Im trying to iterate and print over the items.but I get the below error.</p>
<p>Error</p>
<pre><code>Import error: No module named Basics
</code></pre>
<p>Both data.py & main.py are located in c:/python27/basics/</p>
<p>data.py</p>
<pre><code>bob={'name':'bobs mith','age':42,'salary':5000,'job':'software'}
sue={'name':'sue more','age':30,'salary':3000,'job':'hardware'}
people=[bob,sue]
</code></pre>
<p>main.py</p>
<pre><code>from Basics import data
if __name__ == '__main__':
for key in people:
print(key, '=>\n ', people[key])
</code></pre>
<p>If I just give import data, then I get the below error</p>
<p>Name error:name 'people' is not defined.</p>
<p><strong>Update:</strong></p>
<p>New code:</p>
<pre><code>from Basics import data
if __name__ == '__main__':
for key in data.people:
print(key, '=>\n ', data.people[key])
</code></pre>
<p>TypeError:list indices must be integers, not dict</p>
| python | [7] |
331,235 | 331,236 | Javascript using different configurations for different outputs | <p>Hi being a complete and utter idiot at the moment, where I have staring at this stuff for hours and now have no clue what I am doing.</p>
<p>Basically in one which I will name here as product.js I have Global Variables fixed</p>
<pre><code>var AREA_MAX_MAXX = 1000;
var AREA_MAX_MINX = 60;
</code></pre>
<p>these are being then being used within another js which I will call library.js with the following:</p>
<pre><code>this.area_max_maxx = AREA_MAX_MAXX;
this.area_max_miny = AREA_MAX_MINX;
this.calcPos = function() {
var areaMaxWidth = this.area_max_maxx - this.area_max_minx;
</code></pre>
<p>What I want to do is remove the Global Variables and instead have it set up with arrays, so that whatever the array is the values will be set for<code>area_max_maxx</code></p>
<p>Can anyone help me out there??? Am I making sense?</p>
| javascript | [3] |
1,320,281 | 1,320,282 | world clock widget in social engine | <p>Can anybody tell me how to add world clock widget in social engine 4.1.5. Basically i want several digital watches showing time of different countries. I made a widget to show the clock but there is problem in the world clock, it is showing the time of only some countries but not to all. I would highly appreciate any help from your side. Thanks in advance.</p>
| php | [2] |
5,611,574 | 5,611,575 | how to use foursquare API in android application? | <p>I want to use foursqaure API in my android application.
In my app i want to fetch nearby place</p>
<p>plz help me?</p>
| android | [4] |
4,343,675 | 4,343,676 | get files located on computer | <p>Is java able to access directories and their contents located on the computer it's run from? I know that there is a JFileChooser (Where the user can select files), and I know that you can store/open files with direct paths. But can java get all files and directories conntained with a folder?</p>
<p><strong>Can java list file contents of directories stored on a hard drive?</strong></p>
| java | [1] |
2,115,471 | 2,115,472 | how to retrieve binary image in database? ASP.net C# | <p>How to retrieve image(binary data) in database? i'm creating eCommerce website i also want to ask if someone knows how to display the products like this</p>
<p><a href="http://pcx.com.ph/components/processors.html" rel="nofollow">product list</a></p>
| asp.net | [9] |
15,139 | 15,140 | bitwise AND with if statement | <p>Can I use bitwise & in C++ code like below. The method returns a boolean based on results of the bitwise operation.</p>
<pre><code>bool SetValue( myType a )
{
if( a & notMyType == notMyType )
{
return false;
}
if( a & newMyType == newMyType )
{
SendNew(a);
return true;
}
if( a & oldMyType == oldMyType )
{
SendOld(a);
return true;
}
}
</code></pre>
| c++ | [6] |
3,787,378 | 3,787,379 | Where does PHP save temporary files during uploading? | <p>I am using XAMPP on Windows. By printing <code>$_FILES["file"]["tmp_name"]</code>, it seems that the temporary file was saved at C:\xampp\tmp\phpABCD.tmp. But I cannot see it on the filesystem of the server. However, the file can be moved or copied via <code>move_uploaded_file()</code>, <code>rename()</code>, or <code>copy()</code>. So where does PHP actually save temporary files during uploading?</p>
| php | [2] |
1,105,342 | 1,105,343 | Why don't we have ArrayAdapter's notifyDataSetChanged(row) | <p>When I am doing Swing programming, <code>javax.swing.table.AbstractTableModel</code> is having <code>fireTableCellUpdated(row, col)</code>, to let me specific which row and col of GUI I want to update.</p>
<p>However, when comes to <code>ArrayAdapter</code>, I realize they only provide <code>notifyDataSetChanged</code>. I was expecting I am having access to <code>notifyDataSetChanged(row)</code>, to let me update the item I am interested in. I do not want to update the entire list.</p>
<p>I was wondering why don't we have ArrayAdapter's notifyDataSetChanged(row). Or, am I missing something?</p>
| android | [4] |
2,382,091 | 2,382,092 | Practice examples | <p>I hold a bachelors in CS, but generaly, i call myself a beginner in programming. With an emphasis in focusing on learning to code and make Android Apps. I have gone through this common (<a href="http://developer.android.com/training" rel="nofollow">http://developer.android.com/training</a>) tutorial. Read through, and close to the end so as to get a general understanding. Done their example of Hello world. The next i want is a set of codes that i can go through, practice with them so as to build my skill to a harder level. I really want this so bad, and i want to do App development as a carrier. I appreciate any advice given.</p>
| android | [4] |
3,873,153 | 3,873,154 | jQuery using .html & then window.scrollTo | <p>I'm doing the following:</p>
<p>First, inject HTML into the page (a lot) which then increases the window scrollbar:</p>
<pre><code>$("#XXXX").html("LOTS OF HTML").show();
</code></pre>
<p>Then i want to scroll down to the end of the page:</p>
<pre><code>window.scrollTo(0,$(document).height());
</code></pre>
<p>Problem is the page never scrolls down. I did some console.logging and the scrollTo is running before the HTML from the inject html() is run. I tried this in the JS which injects the HTML, I then tried doing the scroll inside the HTML inject but that made no difference.</p>
<p>Any ideas?</p>
| jquery | [5] |
5,828,146 | 5,828,147 | Override Dialog's OnBackPressed | <p>How can I specifically override just the back button while within a dialog to finish the entire activity and not just the dialog.</p>
<p>Using setOnCancelListener and setOnDismissListener do not work because there are other times that I simply close the dialog without closing the whole activity behind it.</p>
<p>Edit</p>
<p>Thanks Shubayu that may work!</p>
<p>I was also able to access just the back button in a dialog through this function.</p>
<pre><code>dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK){
finish();
}
return false;
}
});
</code></pre>
| android | [4] |
2,506,698 | 2,506,699 | If someone says Android message API what it related to? What classes it consists in? | <p>Recently started Android programming. Developed 3 apps using threads, UI API, telephony API.
My quesion is if someone says Android message API what it related to? What classes it consists in?</p>
<p>"Actually I have seen this in an Android job post"</p>
<p>Thanks</p>
| android | [4] |
4,177,357 | 4,177,358 | I dont want the jquery effect to be repeating | <p>I have a jquery effect that delays a particular image for 5seconds and then slides in. But i want when a user reloads the page, the image will not repeat the effect.</p>
<p>Here is my current code: </p>
<pre><code>$(window).load(function () {
setTimeout(function () {
$("#alex").show("slide", {
direction: "down"
}, 1000);
}, 3000);
});
</code></pre>
| jquery | [5] |
1,075,727 | 1,075,728 | Problem in updating contact email address | <p>I am trying to update contact email address using this code</p>
<pre><code>String selectEmail = ContactsContract.Data.CONTACT_ID + "=? AND " + ContactsContract.Data.MIMETYPE + "='" +
ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE + "'";
String[] emailArgs = new String[]{Id};
ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
.withSelection(selectEmail, emailArgs)
.withValue(ContactsContract.CommonDataKinds.Email.DATA, email)
.build());
</code></pre>
<p>I am getting "Id" using this code</p>
<pre><code>String[] returnVals = new String[] {ContactsContract.CommonDataKinds.Phone.CONTACT_ID};
this.cur = this.cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
returnVals,
ContactsContract.CommonDataKinds.Phone.NUMBER + " = \"" + phoneNumber + "\"",
null,
null);
</code></pre>
<p>My questions are</p>
<p>1) Am I using correct way for getting Contact_ID using Phone number?
2) Contacts are not updating correctly, it is changing all fields like email, name and number.Am I doing some thing wrong?</p>
<p>Need help</p>
| android | [4] |
3,564,399 | 3,564,400 | FindControl ERROR | <p>need to store additional userinfo in CUW steps</p>
<p>//register.aspx
</p>
<pre><code> <p>
<b>HomeTown:</b><br /> <asp:TextBox ID = "HomeTown" runat ="server"></asp:TextBox>
</p>
<p>
<b>HomepageUrl:</b><br /> <asp:TextBox ID = "HomepageUrl" runat ="server"></asp:TextBox>
</p>
<p>
<b>Signature:</b><br /> <asp:TextBox ID = "Signature" runat ="server"></asp:TextBox>
</p>
</asp:WizardStep>
<asp:CompleteWizardStep runat="server" />
</WizardSteps>
</asp:CreateUserWizard>
</code></pre>
<p>//THIS is part of code behind
WizardStep UserSettings = NewUserWizard.FindControl("UserSettings") as WizardStep;</p>
<pre><code> // Programmatically reference the TextBox controls
TextBox HomeTown = UserSettings.FindControl("HomeTown") as TextBox;...ERROR Object reference not set to an instance of an object.
</code></pre>
<p>thanks for help</p>
| asp.net | [9] |
2,479,567 | 2,479,568 | php call class function by string name | <p>How can I call a normal (not static) class function by its name?</p>
<p>The below gives an error saying param 1 needs to be a valid callback. I don't want the function to be static, I want it to be a normal function, and all the examples I've seen so far had them static.</p>
<pre><code>class Player
{
public function SayHi() { print("Hi"); }
}
$player = new Player();
call_user_func($Player, 'SayHi');
</code></pre>
| php | [2] |
5,757,736 | 5,757,737 | Jquery: on click table row, find value of contained input text? | <pre><code> <table class="container">
<tr>
<td><input type="text" class="foo"></td>
</tr>
<tr>
<td><input type="text" class="foo"></td>
</tr>
<tr>
<td><input type="text" class="foo"></td>
</tr>
</table>
<script>
$(".container tr").click(function(){
alert($(this).find("foo").val());
});
</script>
</code></pre>
<p>What it's supposed to do:<br>
When I click on a table row it will find the input inside this element and alert it's value. </p>
<p>Thank You!</p>
| jquery | [5] |
3,112,410 | 3,112,411 | Why asp.net runtime execution timeout is 110 seconds default? | <p>Why asp.net runtime execution timeout is 110 seconds default?
why not 120 seconds (2 minutes), is there any specific reason to keep the odd value or any performance issue?</p>
| asp.net | [9] |
4,795,351 | 4,795,352 | Storing multiple files uploaded in different folders | <p>I'm able to call out all my multiple files in an array and it can be able to be stored in a specific folder for eg. "./documents/". </p>
<pre><code>Code for my form:
<form id="Student" name="Student" method="post" action="uploaded.php" enctype="multipart/form-data">
<input name="upload[]" id="Assign" type="file"/>
<input name="upload[]" id="Testpapers" type="file"/>
<input name="upload[]" id="others" type="file"/>
<input type="submit" name="submit" value="Submit">
Code for uploaded.php:
$number_of_uploaded_files = 0;
for ($i = 0; $i < count($_FILES['upload']['name']); $i++)
{
if ($_FILES['upload']['name'][$i] != '')
{
$dir = "documents/";
$number_of_uploaded_files++;
$uploaded_files[] = $_FILES['upload']['name'][$i];
move_uploaded_file($_FILES['upload']['tmp_name'][$i], $dir. $_FILES['upload']['name'][$i])
}
</code></pre>
<p>Is it possible to store them in different folders respectively? Like store them inside "documents/assign" then "documents/testpapers". I can't think of an idea to detect array index belongs to assign or testpapers, others.</p>
| php | [2] |
5,400,295 | 5,400,296 | getting the selected html element offset related to the html source code with js | <p>Can I get the offset of a selected html element in the html source code?</p>
<p>for example:</p>
<p><code><html>
<body>
<a href="http://google.com">google</a>
</body>
<html></code></p>
<p>if the user would select the google text, I would want to get 40 as this is the offset from the start of the source.</p>
<p>I tried with Range object but couldn't find something helpful with this one. </p>
<p>Thanks!</p>
| javascript | [3] |
1,668,697 | 1,668,698 | How to detect leading double-quote in a string in Java? | <p>I'm writing a tokenizer that reads code from a file and am having difficulty with the - seemingly - trivial task of getting it to branch into the case that handles string constants (any token that starts and ends with a double quote).</p>
<p>The conditional I wrote for the branch is </p>
<p><code>if (token.charAt(0) == '"') { // Do some stuff }</code></p>
<p>where <code>token</code> is the string that was read in.</p>
<p>Alternatively, I've also tried</p>
<p><code>if (token.startsWith("\"")) { // Do some stuff }</code></p>
<p>I've checked the debugger and it still refuses to enter the branch even for valid cases such as the string <code>"Paris"</code> with value field <code>[”, P, a, r, i, s, ”]</code></p>
<p>Any suggestions would be appreciated.</p>
| java | [1] |
4,243,508 | 4,243,509 | How do I force ASP.Net to invalid (and thus reload) the current application instance? | <p>Basically I want the effect that would occur if I were to edit the web.config file. The application basically completely unloads itself and starts again, thus re-firing Application_Start and also ditching any dynamically created Types created by the now-defunct AppDomain.</p>
<p><strong>EDIT</strong></p>
<p>I need to do this in my C# code inside my web application. I know it can be done; I did it ages ago but have since lost the code and forgotten how I did it.</p>
| asp.net | [9] |
2,677,718 | 2,677,719 | Jquery lightbox with carasol | <p>Hi wonder if someone can point me in the right direction.</p>
<p>I am looking at creating a lightbox with carasol inside</p>
<p>to explain a little more.</p>
<p>There are 4 images on the home page, which when clicked launch a lightbox which then displays X div.</p>
<p>the usr can then click left or right on the pop up and it will in turn slide through all the div.</p>
<p>suppose what i am asking is does anyone know if a plug in to do such a thing, i know there are many for lightbox and many for carasol but im after one that does both</p>
<p>Cheers</p>
| jquery | [5] |
3,027,893 | 3,027,894 | jQuery show specific div animated only on click of link | <p>I have to display the content in following way</p>
<pre><code>Total Sales: 12345 Show Details
</code></pre>
<p>When someone click "Show Details" (which is <a> tag), another div should show up which will contain other data (and show details should toggle to hide details, reversing the functionality to hide div)</p>
<p>Need to be done using jQuery, with some animations (if possible).</p>
<p>How can I achieve this</p>
<p>Help appreciated</p>
<p>Thanks</p>
| jquery | [5] |
4,140,301 | 4,140,302 | C# Using colors in console , how to store in a simplified notation | <p>The code below shows a line in different colors.<br>
But thats alot of code to type just for one line and to repeat that all over a program again.<br>
How exactly can i simplify this , so i dont need to write the same amount of code over and over?</p>
<pre><code> Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write(">>> Order: ");
Console.ResetColor();
Console.Write("Data");
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.Write("Parity");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write(" <<<");
</code></pre>
<p>Is there any way to store ... = Console.ForegroundColor = ConsoleColor.Cyan; ?</p>
<p>"text" + color? + "text"; etc...</p>
<p>Any input appreciated
regards.</p>
| c# | [0] |
3,799,470 | 3,799,471 | How to show text on ImageButton on mouse over by css | <p>I have an image button inside the div. I am increasing the image size and z-index on the hover on div. but I want to add some text over the image button when the hover is calling. how can I do ?</p>
<p>my css:</p>
<pre><code>.HoverImageClass input[type=image]:hover
{
position: relative;
z-index: 10000;
height: 274px;
width: 226px;
margin-top: -67px;
margin-left: -14px;
padding-bottom: 13px;
background-color: #F7F6EB;
}
</code></pre>
<p>my html:</p>
<pre><code><div id="divImageDisplay" class="HoverImageClass" runat="server">
<asp:ImageButton runat="server" CssClass="course_img" ID="imgbtnCourse" AlternateText='<%#Eval("LevelName") %>' ToolTip='<%#Eval("LevelName") %>' ImageUrl='<%#Eval("CourseImagePath") %>' CausesValidation="False" CommandName="AddToCart" CommandArgument='<%# String.Format("{0},{1},{2},{3},{4},{5}",Eval("ID"),Eval("LevelID"),Eval("CurrencyWithValue"),Eval("CourseImagePath"),Eval("CategoryID"),Eval("MRP")) %>'></asp:ImageButton>
</div>
</code></pre>
| asp.net | [9] |
650,744 | 650,745 | Unable to run HelloWorld.java from command prompt | <p>I got a strange problem in my windows 7 system running jdk1.6.0_33</p>
<p>When I try to run a simple java program from command prompt, it opens a new window (something like java frame) and suddenly disappears. There is no result shown on command prompt also I am unable to terminate the process (using Ctrl+C) or close command prompt after this. A java process is created each time I do this. I tried to kill process using Task Manager, but that too didn't work.</p>
<p>I am able to run the same program using eclipse.
Here is my program</p>
<pre><code>class HelloWorld{
public static void main(String [] args)
{
System.out.println("Hello World");
}
}
</code></pre>
<p>Environment variables are set as follows:</p>
<pre><code>Path=C:\Program Files\Java\jdk1.6.0_33\bin
classpath=.
</code></pre>
<p>Commands I used are,</p>
<pre><code>javac HelloWorld.java
java HelloWorld
</code></pre>
<p>Why is this happening? Thanks in Advance.</p>
| java | [1] |
1,927,728 | 1,927,729 | Finding multiple occurrences of dictionary? | <p>I'm trying to use most simple way to count all occurrences of x dictionary but without result.
I cant import any library, nor use other statments than: for var in, if x, if not, if is.</p>
<p>Result of script should look like this:
example:</p>
<pre><code>list = [1,2,1,'a',4,2,3,3,5,'a',2]
code
print occurrences(list)
result
1 = [0, 2]
2 = [1, 5, 10]
a = [3, 9]
and so on
</code></pre>
<p>@edited
corrected text</p>
| python | [7] |
2,610,288 | 2,610,289 | What is $this->? | <p>What I think I know so far:</p>
<p>so <code>$this-></code> is to access a function/var outside its own function/var ?</p>
<p>but how does <code>$this-></code> know if its a function or a variable ?</p>
<p>why we refer to a var like this <code>$this->data</code> instead of this <code>$this->$data</code> ?</p>
| php | [2] |
3,963,339 | 3,963,340 | Android application | <p>Whenever i login to application i need to enter the password.But next time when i enter the password it shows me complete password over the soft keyboard of android.I need to clear this
data from android memory. </p>
| android | [4] |
1,812,004 | 1,812,005 | The remote server returned an error: (405) Method Not Allowed. c# | <p>So i works in a project to send data from an c# application to Asp web application, the problem is when i want to send the data i got this error :<strong>The remote server returned an error: (405) Method Not Allowed.</strong>, here is my c# code:</p>
<pre><code> static void Main(string[] args)
{
using (var wb = new WebClient())
{
var data = new NameValueCollection();
string url = "http://localhost:4241/HtmlPage2.html";
data["Text1"] = "Anas";
data["Text2"] = "Anas";
var response = wb.UploadValues(url, "POST", data);
}
}
</code></pre>
<p>and here my Asp code <strong>(**it just a HTML page for testing, the code is implemented in *<em>HtmlPage2.html</strong> and when i submit the button it passed the data to <strong>HtmlPage2.html</em>*</strong>)**</p>
<pre><code> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form method="Post" action="HtmlPage2.html">
<input id="Text1" type="text" name="Text1" />
<input id="Text2" type="text" name="Text2" />
<input id="Button1" type="submit" value="button" />
</form>
</body>
</html>
</code></pre>
<p>NB:My IIS is already enabled :)
So plz plz if someone can help me i will be very appreciate :)</p>
| asp.net | [9] |
325,996 | 325,997 | fwrite not same as ftp upload | <p>Im using a txt file which contains a variable:</p>
<pre><code>var latest_version = "1.0.8";
</code></pre>
<p>i load the txt file and compare latest_version with my number:</p>
<pre><code>if(latest_version == "1.0.8") alert('same number');
else alert('NOT same number');
</code></pre>
<p>it works fine if i uploaded the txt file with ftp program.
Now when i write the txt file per PHP, this is also done. the file is written and permissions are also same like its done with ftp program. The only problem is, when i compare again i dont get same results and javascript alerts "NOT same number!!!</p>
<p>Any idea what is the difference between uploading per ftp program and writing the file per php??</p>
| php | [2] |
4,068,263 | 4,068,264 | Timer and timerTask small issue | <p>i am a noob at java. This is my first time use timer and timerTask class in java. </p>
<p>Purpose of my app: </p>
<p>It is multi client app that implemented with MySQL. My app is to read my database data repeatly. If database updated, then i want every client's panel updated as well. so I assume i need a timer class that can automatically perform repeating query that read my database and then make some change on the component of the client side. </p>
<p>Problem:</p>
<p>I look thought some tutorial and i found this way to do it. Since this.updateTableStatus() method is in my Table class, how can i use that method in my MyTimer(timerTask) class.</p>
<pre><code>public class Table extends javax.swing.JFrame {
public Table() {
initComponents();
MyTimer myTime = new MyTimer();
}
public void updateTableStatus(){
// this is where I refresh my table status which is reading database data and make some change.
}
class MyTimer extends TimerTask{
public MyTimer() {
Timer timer = new Timer();
timer.scheduleAtFixedRate(this, new java.util.Date(), 1000);
}
public void run(){
this.updateTableStatus(); // this is not working!!!, because they r not in the same class. I need help to solve this problem.
}
}
}
</code></pre>
<p>Help me out guys. thank you so much.</p>
| java | [1] |
4,531,303 | 4,531,304 | ComboBox isnt displaying information from database | <p>I have to create an automated teller machine app to access a database that contians sample customer records. I am having a problem displaying the account numbers from the accountInformation table (database), in my comboBox. I am pretty sure that I created the database connection correctly, and I thought that the code I have would dispay the numbers in the comboBox, so I'm not sure what the problem is. Is there something in comboBox properties that I need to change?
Here is my code:</p>
<pre><code>using SQLDll;
namespace WindowsFormsApplication14
{
public partial class Form1 : Form
{
private Connection myConnection;
private Statement myStatement;
private ResultSet myResultSet;
String databaseURL = "http://www.boehnecamp.com/phpMyAdmin/razorsql_mysql_bridge.php";
public Form1()
{
InitializeComponent();
try
{
//connect to database
SQL sql = new SQL();
myConnection = sql.getConnection(databaseURL);
//create Statement for executing SQL
myStatement = myConnection.createStatement(databaseURL);
}
catch (Exception)
{
Console.WriteLine("Cannot connect to database server");
}
//close statement and database connection
myStatement.close();
myConnection.close();
}
private void Form1_Load(object sender, EventArgs e)
{
loadAccountNumbers();
}
public void setText(string text)
{
}
//load account numbers to ComboBox
private void loadAccountNumbers()
{
//get all account numbers from database
try
{
myResultSet = myStatement.executeQuery("SELECT accountNumber FROM accountInformation");
// add account numbers to ComboBox
while (myResultSet.next())
{
accountNumberComboBox.Items.Add(myResultSet.getString("accountNumber"));
}
myResultSet.close(); // close myResultSet
}//end try
catch (Exception)
{
Console.WriteLine("Error in loadAccountNumbers");
}
}//end method to loadAccountNumbers
</code></pre>
| c# | [0] |
1,558,752 | 1,558,753 | How do I find out the which Android devices will run my application? | <p>Is there a standard way in Java to find out which Android devices (like tablet or phone) my application will run on?</p>
| android | [4] |
332,368 | 332,369 | C++ Get Current date output weird result | <p>My output is unreadable, all i wanted to do is assign the day month year into a string.</p>
<p>if i cout them by now->tm_year+1900 , it works, but if i assign it to a string and cout later, it output like this. how do i change my code so i can assign the value to string without losing reference later on cout.</p>
<p>Terminal:</p>
<pre><code>Date is
</code></pre>
<p>My code:</p>
<pre><code>int main()
{
//get today date
string year,month,day;
/* Output 6 month frame for appointment booking*/
time_t t = time(0); // get time now
struct tm * now = localtime( & t );
year = now->tm_year + 1900;
month = now->tm_mon + 1;
day = now->tm_mday;
cout << "Date is " << year << month << day << endl;
return 0;
}
</code></pre>
| c++ | [6] |
2,422,780 | 2,422,781 | iphone full display of image in other view | <p>I have view with imageview with small size and image is set to imageview in MainClass. I am providing a option to view full image.</p>
<p>What i need is whenever fullview option is clicked an other view named NextClass should navigate with the image of MainClass </p>
<p>How should i do?</p>
| iphone | [8] |
2,418,088 | 2,418,089 | Handling multiple accounts in Android app | <p>I would like to build an application that caters for multiple accounts (eg. home, work) and account types (e.g. ISP, VoIP, Mobile). Essentially, I would like to get the user to create the accounts they want and then have all the accounts listed on the start page grouped by type. For example:</p>
<p>ISP:
- Home
- Work</p>
<p>Mobile:
- Mum
- Dad</p>
<p>When you click on the account, it would take you to another screen where I do a bunch of calcs and display the results.</p>
<p>I currently do this via multiple apps but am looking at consolidating into the one app. I am just not sure where to start or how I go about achieving this? The way the Contacts app works is a good example of what I am wanting to do.</p>
| android | [4] |
3,776,319 | 3,776,320 | Is it possible to check that a list is not empty before grabbing the first element using as few lines as possible in Python? | <p>I keep having to do this operation all over the place in my python code. I'm willing to bet there is an easier (aka one-line) way to do this. </p>
<pre><code>results = getResults()
if len(results) > 0:
result = results[0]
</code></pre>
<p>I actually don't need "results" anywhere else, and I should only run "getResults" once.</p>
<p>Any ideas?</p>
| python | [7] |
2,821,966 | 2,821,967 | when I run this program, and type in the command line: run BinarySearch tinyW.txt<tinyT.txt. It returns a memory location, I do not know why | <pre><code>import java.util.Arrays;
public class BinarySearch
{
public static void main(String[] args)
{
int[] whitelist = In.readInts(args[0]);
Arrays.sort(whitelist);
StdOut.println(whitelist);
while(!StdIn.isEmpty())
{
int key = StdIn.readInt();
if (rank(key, whitelist) < 0)
StdOut.println(key);
}
}
public static int rank(int key, int[] a)
{
return rank(key, a, 0, a.length-1);
}
public static int rank(int key, int[] a, int low, int high)
{
if (low > high) return -1;
int mid = low + (high - low)/2;
if (key < a[mid]) return rank(key, a, low, mid - 1);
else if (key > a[mid]) return rank(key, a, mid + 1, high);
else return mid;
}
}
</code></pre>
| java | [1] |
3,713,375 | 3,713,376 | Error Correction For The Code | <pre><code>int i = 0;
Float[] arr =null;
Float arr2 [] = null;
Iterator itr = minMaxVal.keySet().iterator();
while(itr.hasNext()){
arr = minMaxVal.get(i);
arr2[i] = (float) arr[0];
i++;
}
java.util.Arrays.sort(arr2);
return arr2[0];
</code></pre>
<p>It throws an NulPointException at <code>arr2[i] = (float) arr[0];</code></p>
<p>How can overcome this. Thank You in advance....</p>
| java | [1] |
3,800,691 | 3,800,692 | How do I create a file at a specific path? | <p>In python I´m creating a file doing:</p>
<pre><code>f = open("test.py", "a")
</code></pre>
<p>where is the file created? How can I create a file on a specific path?</p>
<pre><code>f = open("C:\Test.py", "a")
</code></pre>
<p>returns error.</p>
| python | [7] |
3,992,791 | 3,992,792 | ICLRRuntimeInfo into my dll - possible? | <p>I have a mixed mode 2.0 dll, and a 4.0 dll. I want to supply this </p>
<pre><code><configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
</code></pre>
<p>to my dll. Without an app.config (or changing machine.config) is this even possible?</p>
| c# | [0] |
5,494,345 | 5,494,346 | How to audit log member.createuser | <p>My ASP.NET application is Membership enabled and users with Administration Role can create other user with different roles.
Is there an way that i can maintain an audit log of user creation, so i can keep a track that which Administrator created which user.</p>
<p>Thanks in advance.</p>
| asp.net | [9] |
1,005,663 | 1,005,664 | Clearing notifications from any of the activities in my android app | <p>Suppose there are 2 activities in my app named Act1 and Act 2. Now, Act1, when closes, sends a status notification, which invokes Act2. Using Act2, I can clear that notification. Now suppose that user doesn't clicks on the notification and invokes Act1 again, the notification doesn't gets cleared. I want that to happen. How could I do that?</p>
<p>Thanks,
Rohit</p>
| android | [4] |
2,342,033 | 2,342,034 | Good sites for basic class design? | <p>I am switching java to c++ and there is some fundamental difference that I am missing. If you guys know any good sites that have class design tutorial, please let me know. Stuff such as memory deallocation, things to avoid, etc.. I have also been googling this stuff but I just want more information. Maybe you guys can help. Thanks</p>
| c++ | [6] |
4,566,809 | 4,566,810 | Making a php library, how to make it independent? | <p>Hi I'm developing a library for guitar chords. In some files on the library I have something like this:</p>
<pre><code>require_once "lib/GuitarChord.php";
require_once "lib/Chord.php";
require_once "lib/Key.php";
require_once "lib/Tuning.php";
</code></pre>
<p>How can I make this library so it doesn't need to know <strong>where</strong> the other library files are?</p>
<p>This way a person could have the library files in any directory?</p>
<p>Edit: Removed second question.</p>
| php | [2] |
2,452,865 | 2,452,866 | why tab button(Keyboard) not working on fields | <p>I have many fields i.e(checkbox,edittext,date,radia button etc) in my app.</p>
<p>After coming on that particular screen , i press tab button from keyboard.</p>
<p>Cursor should go on fields like:-</p>
<p>Field1,</p>
<p>Field2,</p>
<p>Field3,</p>
<p>Field4</p>
<p>but Now cursor is not behaving like that.</p>
<p>It is behaving like:-</p>
<p>Field1</p>
<p>Field4</p>
<p>Field6...</p>
<p>why it is not coming on left fields.</p>
<p>any solution. </p>
| android | [4] |
4,987,541 | 4,987,542 | document.getElementById(id).focus() is not working for firefox or chrome | <p>When ever I do onchange event, its going inside that function its validating, But focus is not comming I am using <code>document.getElementById('controlid').focus();</code></p>
<p>I am using Mozilla Firefox and Google Chrome, in both its not working. I don't want any IE. Can any one tell me what could me the reason.</p>
<p>Thanks in advance</p>
<p>Here's the code:</p>
<pre><code>var mnumber = document.getElementById('mobileno').value;
if(mnumber.length >=10) {
alert("Mobile Number Should be in 10 digits only");
document.getElementById('mobileno').value = "";
document.getElementById('mobileno').focus();
return false;
}
</code></pre>
| javascript | [3] |
2,371,914 | 2,371,915 | jquery checkbox problem | <p>Im having a problem with a piece of jquery code. Every time this piece of code is executed, it disables all the links in my page :( if i click on a link on a page... it doesn't to nothing.</p>
<pre><code>// listen to every click on a checkbox
$('input[type="checkbox"].status').bind('click', function(e){
e.stopPropagation();
// if the checkbox is checked
if($(this).is(':checked'))
{
// increase counter
statusCounter++;
return;
}
// if the checkbox is unchecked
if($(this).is(':not(:checked'))
{
// decrease counter
statusCounter--;
return;
}
</code></pre>
<p>Any help? thanks</p>
| jquery | [5] |
4,045,572 | 4,045,573 | return copy of an instance of a class, not a pointer in c++ | <p>First; am I mistaken to assume that the <code>this</code> keyword is a <strong>pointer</strong> to the instance of the object I am working with, not a copy?</p>
<p>So if I had:</p>
<pre><code>class someClass {
private:
int _number;
public:
someClass method(int number) {
_number = number;
return this;
}
};
</code></pre>
<p>I would be returning a pointer to that instance?</p>
<p>If that is the case, how can I return a copy of that instance? I found a way but I think it's extremely awkward.</p>
<pre><code>class someClass {
private:
int _number;
public:
someClass method(int number) {
_number = number;
someClass someClassObj;
someClassObj._number = number;
return someClassObj;
}
};
</code></pre>
| c++ | [6] |
33,171 | 33,172 | innerHTML by node id | <p>In javascript, when I replace content of node of <code>id="demo"</code> by using <code>getElementById("demo").innerHTML="SOME TEXT";</code> I get a strange problem that it's effect is lasting for only a few seconds. When I add a alert box for the same along with the above, the effect can be seen on background screen untill the alertbox is closed by clicking on 'OK'. Can someone suggest a solution to How I can make it remain there without getting changed untill I refresh the page ..)</p>
<p>Hi all,my code is a simple sort program as follows: </p>
<pre><code> <script type="text/javascript">
var num=new Array(12,5,8,23,1);
var len;
function sort(){
len= num.length;
for(i=0; i<len-1; i++){
for(j=0; j<len-i; j++){
if(num[j]>num[j+1]){
var tem=num[j];
num[j]= num[j+1];
num[j+1]= tem;
}
}
}
var x=document.getElementById("demo");
x.innerHTML=num;
alert(num);
}
</script> <form>
<p id="demo">Click the button</p>
<input type="submit" onclick="sort();" value="Click"></input>
</form>
</code></pre>
| javascript | [3] |
4,785,564 | 4,785,565 | How to Extract the key from unnecessary Html Wrapping in python | <p>The HTML page containing the key and some \n character .I need to use only key block i.e from -----BEGIN PGP PUBLIC KEY BLOCK----- to -----END PGP PUBLIC KEY BLOCK-----
and after putting extracting key in a file can i pass it in any function.... </p>
| python | [7] |
1,997,156 | 1,997,157 | How to custom sort php objects (elegantly)? | <p>I have a list of ids [1,500,7] and a list of entities with corresponding id properties, but in a different order (1 -> 7, 500). In php, how can I sort them according to the list of ids?</p>
<p>Php version is 5.3.2</p>
| php | [2] |
1,446,321 | 1,446,322 | Figuring out the class of an inheriting object | <p>I have a linked list of <code>Foo</code> objects. Foo is a base class, which has several classes inherit from it. Say, classes <code>A, B, and C</code>.</p>
<p>I am cycling through this linked list and calling a method <code>some_method</code>, which has 3 definitions; one for each child class:</p>
<pre><code>some_method(A a);
some_method(B b);
some_method(C c);
</code></pre>
<p>The linked list is generic, so it is of type <code>Foo</code>, as it has an assortment of A, B and C objects. </p>
<p>When I'm cycling through the linked list at <code>current_element</code>, calling <code>some_method(current_element);</code>, how can I make it call the right method? The compiler complained until I wrote a some_method that took the generic <code>Foo</code>, and it only calls into that method.</p>
| c++ | [6] |
1,951,433 | 1,951,434 | Java: checkError() for PrintWriter(OutputStreamWriter(System.out)) | <p>Trying to change the encoding of System.out, I created a PrintWriter with
<pre>PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out, ENCODING));</pre>
so</p>
<pre>out.format("some text");</pre>
<p>worked fine as for the encoding. But <pre>out.checkError()</pre> didn't return true
when the output stream was closed, e.g. by Unix 'head' command.</p>
<p>I've found that PrintStream offers a constructor with encoding</p>
<pre>PrintStream out = new PrintStream(System.out, true, ENCODING);</pre>
<p>and the checkError()
worked fine for this class.</p>
<p>I doubt the PrintWriter case is a bug, or am I missing something?</p>
| java | [1] |
923,134 | 923,135 | "parent directory is not writable" error in Android | <p>I want to create a directory in <code>data/data</code> directory to host my files, but when I want to do this, I get an error: <strong>directory of file is not writable: data/</strong></p>
<p>I can no do anything even creating <code>data/data/</code></p>
<p>I am using Android level 7</p>
<pre><code>File myFile = new File(Enviroment.getDataDirecotry() + "/" + "someFile.txt");
FileOutputStream stream = FileOutputStream (myFile);
stream.createFile();
</code></pre>
<p>I got problem after createfile , also I am not sure about correct code text used here .</p>
| android | [4] |
2,448,616 | 2,448,617 | basic Javascript if/else statement question | <p>I'm looking at the following Javascript code, trying to port it to another language: </p>
<pre><code>if (x>n) {return q} {return 1-q)
</code></pre>
<p>I don't know what the code is doing, but can someone tell me based on syntax what occurs? Is there an implied 'else' before the last set of {}? That is, if x>n then return q otherwise return 1-q?</p>
<p>If it helps, here's the line of code it was embedded within:</p>
<pre><code>if(x>9000 | n>6000) { var q=Norm((Power(x/n,2/5)+1/(8*n)-1)/Sqrt(9/(2*n)))/3; if (x>n) {return q}{return 1-q} }
</code></pre>
<p>thanks</p>
| javascript | [3] |
5,803,423 | 5,803,424 | Android SingleTask activities started in same task | <p>I have 3 activities: A, B, C. I've assigned the launchMode for each activity to singleTask in the Manifest. The documentation of the singleTask lanuchMode says:</p>
<blockquote>
<p>The system creates a new task and instantiates the activity at the root of the new task. However, if an instance of the activity already exists in a separate task, the system routes the intent to the existing instance through a call to its onNewIntent() method, rather than creating a new instance. Only one instance of the activity can exist at a time.</p>
</blockquote>
<p>If I understand this correctly, each Activity must be launched in a separate task and each activity will be the root of the newly created task. However, this is not the case. I've added the following line to the <em>onCreate</em> method:
<code>Log.i(TAG, "taskId: " + getTaskId());</code>
and each activity has the same taskId number.</p>
<p>Am I missing something?</p>
| android | [4] |
4,627,780 | 4,627,781 | The return type of the members on an Interface Implementation must match exactly the inferface definition? | <p>According to CSharp Language Specification. </p>
<blockquote>
<p>An interface defines a contract that can be implemented by classes and
structs. An interface does not provide implementations of the members
it defines—it merely specifies the members that must be supplied by
classes or structs that implement the interface.</p>
</blockquote>
<p>So I a have this:</p>
<pre><code>interface ITest
{
IEnumerable<int> Integers { get; set; }
}
</code></pre>
<p>And what I mean is. "I have a contract with a property as a collection of integers that you can enumerate".</p>
<p>Then I want the following interface Implementation:</p>
<pre><code>class Test : ITest
{
public List<int> Integers { get; set; }
}
</code></pre>
<p>And I get the following compiler error:</p>
<blockquote>
<p>'Test' does not implement interface member 'ITest.Integers'.
'Test.Integers' cannot implement 'ITest.Integers' because it does not
have the matching return type of
'System.Collections.Generic.IEnumerable'.</p>
</blockquote>
<p>As long as I can say my Test class implement the ITest contract because the List of int property is in fact an IEnumerable of int.</p>
<p>So way the c# compiler is telling me about the error?</p>
| c# | [0] |
4,291,012 | 4,291,013 | How to extract "sub-domain name" from a url presence in a long text containing multiple url | <p>I have a long long text contains multiple url. <strong>BUT</strong> there is <strong>only one</strong> url which is of blogspot.com . That url will be like <a href="http://xxxxx.blogspot.com" rel="nofollow">http://xxxxx.blogspot.com</a> . How could i get the value of xxxx and store in a variable.</p>
<p>So if I have the whole text store in <strong>$foo</strong>. Can any one write the code to extract the subdomain out. </p>
<p>I guess it should be of only 1 or 2 line using <strong>preg_match</strong> . But i'am not getting it to work. Rejex are confusing me.</p>
<p>Thank you</p>
| php | [2] |
97,109 | 97,110 | compare two files' contents extracting different contents in python | <p>I have two files, file1 contains contents as </p>
<blockquote>
<p>aaa </p>
<p>bbb </p>
<p>ccc</p>
</blockquote>
<p>and file 2 contains contents as </p>
<blockquote>
<p>ccc</p>
<p>ddd</p>
<p>eee</p>
<p>aaa</p>
<p>rrr</p>
<p>bbb</p>
<p>nnn</p>
</blockquote>
<p>I would like to do like this, if file2 contains file1's line, then that line would be removed from file2. At last, file2 will be as ddd
eee
rrr
nnn
Besides, my code is </p>
<pre><code>f1 = open("test1.txt","r")
f2 = open("test2.txt","r")
fileOne = f1.readlines()
fileTwo = f2.readlines()
f1.close()
f2.close()
outFile = open("test.txt","w")
x = 0
for i in fileOne:
if i != fileTwo[x]:
outFile.writelines(fileTwo[x])
x += 1
outFile.close()
</code></pre>
<p>Thank you.</p>
| python | [7] |
2,789,181 | 2,789,182 | How to add a new NOTE with an existing CONTACT in ANDROID | <p>i successfully updated the existing NOTE in a contact using
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);</p>
<p>this method doesn't work for adding a new NOTE..
How to add a new NOTE with an existing CONTACT in ANDROID?</p>
| android | [4] |
5,524,046 | 5,524,047 | How to set text on status bar notification in Android | <p>i dont know how to set status bar notifaction in android please give some idea</p>
| android | [4] |
1,642,465 | 1,642,466 | Count how often the word occurs in the text in PHP | <p>In php I need to Load a file and get all of the words and echo the word and the number of times each word shows up in the text,
(I also need them to show up in descending order most used words on top) ★✩</p>
| php | [2] |
5,118,733 | 5,118,734 | Enthought's EPD example tutorials | <p>I installed EPD fron Enthought and I am trying out some Chaco built in examples based on the instructions @ <a href="http://docs.enthought.com/chaco/quickstart.html" rel="nofollow">http://docs.enthought.com/chaco/quickstart.html</a>. I ran into 2 [newbie] problems in IPython interpreter:</p>
<p>1.</p>
<hr>
<pre><code>In [3]: python lines.py
File "<ipython-input-3-75ced467f885>", line 1
python lines.py
^
SyntaxError: invalid syntax
</code></pre>
<hr>
<p>Invalid syntax?</p>
<p>2.</p>
<hr>
<pre><code>In [6]: import lines
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
C:\Windows\system32\<ipython-input-6-8ce26194a7ce> in <module>()
----> 1 import lines
C:\Python27\lines.py in <module>()
7
8 from numpy import linspace, pi, sin, cos
----> 9 from chaco.shell import plot, hold, title, show
10
11 # Create some data
C:\Python27\chaco.py in <module>()
1 import numpy as np
----> 2 from chaco.shell import *
3
4 x = np.linspace(-2*pi, 2*pi, 100)
5 y = np.sin(x)
ImportError: No module named shell
</code></pre>
<hr>
<p>No module named shell?</p>
<p>I am very new at this and wanted to try out these examples after seeing the presentation video from Pycon 2012 by Peter Wang. I greatly appreciate any help on what I did wrong and what can I do to get it to work; I did not find anything on google or similar at the quicksart.</p>
<p>Thank you for your time. </p>
<p>Oli Long</p>
| python | [7] |
2,687,860 | 2,687,861 | how to give time gap between two activities in android? | <p>this is my code.I used one one popup message while clicking on button for that i used Toast after that i want to move next screen</p>
<pre><code>Button Replybutton = (Button) findViewById(R.id.Reply);
Replybutton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
EditText ReplysubjeditText=(EditText)findViewById(R.id.ReplysubjeditText);
EditText ReplymsgeditText=(EditText)findViewById(R.id.ReplymsgeditText);
String temp_string=ReplysubjeditText.getText().toString();
try
{
ReplysubjeditText.setText("");
ReplymsgeditText.setText("");
}
catch(Exception e)
{
Log.v("Add",e.toString());
}
Toast.makeText(EmailReply.this, "Sending....",
Toast.LENGTH_SHORT).show();
Intent myNewMail = new Intent(EmailReply.this,EmailForm.class);
myNewMail.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(myNewMail);
}
});
</code></pre>
| android | [4] |
5,306,716 | 5,306,717 | Prevent onCreateDialog being called when process is killed then relaunched | <p>I have an Activity with ProgressDialog being updated by an AsyncTask. I am using onCreateDialog to setup the dialog. The AsyncTask is writing to the SDCard. During normal scenarious (rotation, going to background, etc.) I have no issues.</p>
<p>The problem is that the dialog gets recreated if the process gets killed. Thus, I end up with a "newly" opened activity and a dialog that is not supposed to be shown at all because there is no AsyncTask set up to update it.</p>
<p>For example in case when SD card gets ejecter then the Reaper comes and kills the process (no onDestroy, noPause, noResume has been called by the framework). When, however, the application is resumed (for example from the recently used applications) there is no clue that there is no AsyncTask and I am forced to show the dialog. I cannot return null in onCreateDialog, because the app will crash.</p>
<p>How can I prevent a dialog to be recreated after the process is killed?</p>
<p>Example:</p>
<pre>
- Activity gets shown
- onCreateDialog/onPrepareDialog show a progress dialog
- AsyncTask gets started exporting to SD card
=> SD card gets unmounted
- Process is killed
- User selects the application from task switched
- Activity gets created as new
=> Android calls onCreateDialog/onPrepareDialog with the previously shown dialog ID
</pre>
<p>By the time the activity is recreated as new there is no AsyncTask, there is even no SD card. Still, Android insist that I show a dialog.</p>
<p>How can I prevent onCreate/PrepareDialog methods to be called during the recreate? Or the only choice is to bring up an error dialog instead.</p>
| android | [4] |
1,522,876 | 1,522,877 | How get name parent activity in child activity | <p>How I can get name of parent activity in child activity. I have two activities where I can start the same activity. For better understanding: I have activity ONE, TWO, THREE. From activity ONE I can start activity THREE and from activity TWO I can start activity THREE. Now I have a question. How I can get in activity THREE, name of parent activity.So when I start activity THREE from activity ONE how I can get this information. I want to implement simple loop <code>if()</code> where I add objects to the ArrayList due to which activity starts my activity THREE. How I can do that?</p>
| android | [4] |
1,374,977 | 1,374,978 | How to upload my webpage (ASPX) to IIS server | <p>I created a webpage in aspx and i want use it over LAN using IIS. But i m not getting a way upload it to IIS. Please anybody tell step by step process to uploading my website to IIS.</p>
| asp.net | [9] |
3,934,747 | 3,934,748 | move text in a view from one position to other | <p>i am goggling from previous 2 days, how to move text from one position to other in a view mean s if we have set text through <code>TextView.setText()</code> to any specified position initially and after that using my finger touch i want to change the position of text in view means as drag and drop or text move on my finger motion and stop or set where i put off my finger from screen ..can any one have any idea about this ,..i will greatly thanks full to all of u...</p>
<pre><code>TextView textView = (TextView)findViewById(R.id.textView);
// this is the view on which you will listen for touch events
View touchView = findViewById(R.id.touchView);
touchView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
}}
}
</code></pre>
| android | [4] |
1,551,240 | 1,551,241 | create asp.net a-z list | <p>I could do this myself given time but does anyone have a nice asp.net implementation of an a-z list coming from a sql query. I would like it to come in the form:</p>
<p>A<br />
aardvark<br />
anagram<br />
apple</p>
<p>B<br />
barry<br />
brown....</p>
<p>That is with each entry being a link.</p>
| asp.net | [9] |
335,699 | 335,700 | Download files in one directory using multiple instances Python | <p>I need to make multiple instances of script where it would be able to download files in same directory at the same time.</p>
<p>How do I avoid downloading the same file from those multiple instances.</p>
<p>eg if instance 1 is downloading file1, instance2 should not be able to download it.</p>
<p>Thanks</p>
| python | [7] |
4,638,235 | 4,638,236 | Strip Tags and everything in between | <p>How can i strip <code><h1>including this content</h1></code></p>
<p>I know you can use strip tags to remove the tags, but i want everything in between gone as well.</p>
<p>Any help would be appreciated. </p>
| php | [2] |
3,137,032 | 3,137,033 | Javascript eval | <p>I am trying to get the following working. It seemed to work initially, but somehow it stopped working</p>
<pre><code>var setCommonAttr = "1_row1_common";
var val = document.getElementById("abc_" + eval("setCommonAttr")).value;
</code></pre>
<p>what is wrong with above?</p>
<p>The above code is little different from what I am trying to accomplish. I gave the above example just not to make things complicated here. Below is what I am trying to accomplish:</p>
<p>First I am getting an existing element as follows. The element is a </p>
<pre><code><tr id="row_1_4_2009_abc" class="rowclick">
<td></td>
</tr>
</code></pre>
<p>I am using jquery to get the id on click of a row:</p>
<pre><code>$(".rowclick").click(function() {
var row_id = $(this).attr("id");
var getAttributes = row_id.split("_");
var setCommonAttr = getAttributes[1] + "_" + getAttributes[2] + "_" + getAttributes[3] + "_" + getAttributes[4];
var new_row_id = document.getElementById("new_row_" + setCommonAttr).value;
});
</code></pre>
| javascript | [3] |
4,048,417 | 4,048,418 | About unsynchronized & synchronized access in Java Collections Framework? | <p>Can anyone explain what is unsynchronized & synchronized access in Java Collections Framework? Thanks in advance.</p>
| java | [1] |
178,867 | 178,868 | how to change property of color..font...datetimepicker | <p>how to change property of color..font...datetimepicker...</p>
<p>i remember that it can do with set and get.... </p>
<p>can i get any sample ?</p>
<p>thank's</p>
| c# | [0] |
4,993,582 | 4,993,583 | Microsoft JScript runtime error: FindControl requires that controls have unique IDs | <p>I'm programmatically adding a row to a System.Web.UI.WebControls.Table inside an UpdatePanel. I then add cells to the row and controls to the cells. </p>
<p>Once the controls have been added I get Microsoft JScript runtime error:</p>
<p>"Sys.WebForms.PageRequestManagerServerErrorException: Multiple controls with the same ID 'txtValue' were found. FindControl requires that controls have unique IDs."</p>
<p>Because the controls are in seperate rows, should then not get their own client IDs, making them unique?</p>
| asp.net | [9] |
1,671,481 | 1,671,482 | concatenation output problem (toString Array) - java | <p>I am trying to display the output as "1(10) 2(23) 3(29)" but instead getting output as "1 2 3 (10)(23)(29)". I would be grateful if someone could have a look the code and possible help me. I don't want to use arraylist.</p>
<p>the code this </p>
<pre><code>// int[] Groups = {10, 23, 29}; in the constructor
public String toString()
{
String tempStringB = "";
String tempStringA = " ";
String tempStringC = " ";
for (int x = 1; x<=3; x+=1)
{
tempStringB = tempStringB + x + " ";
}
for(int i = 0; i < Group.length;i++)
{
tempStringA = tempStringA + "(" + Groups[i] + ")";
}
tempStringC = tempStringB + tempStringA;
return tempStringC;
}
</code></pre>
| java | [1] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.