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 |
|---|---|---|---|---|---|
5,117,591 | 5,117,592 | JavaScript array on multiple lines | <p>I made an array with several strings as values so it becomes one really long line that takes a while to scroll through. To put it on multiple lines I searched and found that I can use a + sign to link the lines, but I'm having a problem. Here's a small example:</p>
<pre><code><script type="text/javascript">
var x;
var colorArr=["Red","Orange","Yellow",+
"Green","Blue","Purple"];
for(x=0;x<6;x++)
document.write(colorArr[x]+"<br/>");
</script>
</code></pre>
<p>This outputs:</p>
<pre><code>Red
Orange
Yellow
NaN
Blue
Purple
</code></pre>
<p>Basically whichever element is the first on the line becomes undefined for some reason. How do I do this the correct way?</p>
| javascript | [3] |
3,088,576 | 3,088,577 | Python won't print after smtplib.SMTP | <p>I was trying to write a python sendmail class, I like to print sent mail info, but after smtplib.SMTP it won't print anything, even an error, here is my code: </p>
<p>main.py:</p>
<pre><code>import MailServer
from Mailler import Mailler
mail_server = MailServer.Server()
mailler = Mailler( mail_server )
mailler.sender = 'test@gmail.com'
mailler.receiver = 'test@ymail.com'
mailler.subject = 'test'
mailler.send_text( 'test' )
</code></pre>
<p>Mailler.py:</p>
<pre><code>import email
import smtplib
class Mailler():
sender = ''
receiver = ''
def __init__( self, target_server ):
self.target_server = target_server
print 'host:' + target_server.host + ' port:' + str( target_server.port )
self.server = smtplib.SMTP( target_server.host, target_server.port )
self.server.set_debuglevel( 1 )
print 'test 2'
def __enter__( self ):
return self
def send_text( self, subject, message ):
mail = email.mime.text.MIMEText( message )
mail[ 'Subject' ] = subject
mail[ 'From' ] = self.sender
mail[ 'To' ] = self.receiver
self.server.sendmail( self.sender, [self.receiver], mail.as_string )
print 'Mail sent:' + subject + ' sender:' + self.sender + ' receiver:' + self.receiver
def __exit__( self, type, value, traceback ):
self.server.quit()
</code></pre>
<p>the output:</p>
<pre><code>host:127.0.0.1 port:22223
</code></pre>
| python | [7] |
3,469,618 | 3,469,619 | large size data transfer from intent service to UI | <p>In my project i need to transfer large size data recieved via network operation in intentservice to uithread or any other thread.</p>
<p>I am just wondering which will be the best option for this ,it seems i cannot use parcelable or bundle due to large size of data.And the size is not predictable</p>
<p>it will helpful if anyone suggest an idea or example which handles this type of cases.</p>
| android | [4] |
1,449,446 | 1,449,447 | unable to get the updated value of textarea using ajax and php | <p>I have a problem:</p>
<p>I have a textarea on my page that is created on a button click using javascript.
Now i want to update the database with the value of this textarea, but unable to do. m not getting the updated value of textarea while callin ajax.</p>
| php | [2] |
215,761 | 215,762 | How do I know if was require_once? | <p>I have two files</p>
<p><strong>1 - index.php
2 - main.php</strong></p>
<p><strong>index.php</strong> call to <strong>main.php</strong> by <code><?php require_once("../../includes/main.php"); ?></code></p>
<p>How do I know from <strong>main.php</strong> when it Execute,</p>
<p>if <strong>index.php</strong> call to him or same user Execute it Standalone?<br>
what I should ask inside main php to continue run the program if was require_once ?
Thx</p>
| php | [2] |
2,727,052 | 2,727,053 | Open jQuery WYSIWYG in a jQuery dialog | <p>Is there a way to load jquery wysiwyg plugin inside a jquery dialog box.</p>
<p>I tried but the editor is somehow disabled when the dialog box opens.</p>
| jquery | [5] |
1,069,794 | 1,069,795 | jQuery display message | <p>How to with jQuery display message after clicking submit button, delay message box for example 10 secund and then send the data form.</p>
<p>Or send the data form after clicking "ok" button in message box.</p>
| jquery | [5] |
454,223 | 454,224 | Problems trying to assign **varname to *varname[]. c++ | <p>In my .h, I have a variable, <code>Texture ** skyboxTextures</code>. I assign some texture pointers in one method, and use them right away:</p>
<pre><code>Texture *skt[] = {
tleft,
tright,
tfront,
tback,
tup,
tdown
};
skyboxTextures = skt;
for(int i = 0; i < 6; i++)
{
skyboxTextures[i]->load();
}
</code></pre>
<p>Then later in another method I try to use the textures again.</p>
<pre><code>Texture *skt[] = skyboxTextures;
// Render the front quad
skyboxTextures[0]->activate();
</code></pre>
<p>This is my issue I cannot access my objects any more. This will not compile because of this error:</p>
<pre><code>error C2440: 'initializing' : cannot convert from 'Texture **' to 'Texture *[]'
</code></pre>
<p>If I comment out the line <code>Texture *skt[] = skyboxTextures;</code>, all I get are invalid texture pointers.</p>
| c++ | [6] |
1,467,552 | 1,467,553 | Cascade window programmatically using C# application | <p>Hi folks <br />
I'm programming c# application I have a parent form and others are childs I want to cascade all windows which are open as child form in my parent form how I can cascade windows or close all or minmize them I mean functionality for child window that can calls form parent window.</p>
| c# | [0] |
3,073,263 | 3,073,264 | Javascript Source to textarea value | <p>I am creating some JSON on the fly, serializing it and saving it to the DB.
To run it, i create a script element, and load it that way.
Is there a way to load the script source to a textarea?</p>
| javascript | [3] |
469,760 | 469,761 | Input Validity checks in C# console base application | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4804968/how-can-i-validate-console-input-as-integers">How can I validate console input as integers?</a> </p>
</blockquote>
<p>I am developing a console base application in C#. In which i want when a user prompt to enter the integer then user can type only integer and when an user prompt to enter string, he can only type string. Please help me.</p>
<p>Thanks in advance and regards.</p>
| c# | [0] |
3,926,217 | 3,926,218 | Cannot instantiate non-existent class: ziparchive | <p>I've a code that works correctly on test server but fails on live one (due to PHP version).</p>
<p>I'm getting this error:</p>
<p><code>Fatal error: Cannot instantiate non-existent class: ziparchive in /home/sites/www.example.com/web/zip.php on line 123</code></p>
<p>and the code is:</p>
<pre><code>$zip = new ZipArchive;
$zip->open($_FILES['uploadedfile']['tmp_name']);
$zip->extractTo('unzipped/' . $id . '/');
$zip->close();
</code></pre>
<p><strong>How to make it working without ZipArchive class being available?</strong></p>
<hr>
<p>Edit: I've used Mighty Google:</p>
<pre><code><?php
$zip = zip_open("zip.zip");
if ($zip) {
while ($zip_entry = zip_read($zip)) {
$fp = fopen("zip/".zip_entry_name($zip_entry), "w");
if (zip_entry_open($zip, $zip_entry, "r")) {
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
fwrite($fp,"$buf");
zip_entry_close($zip_entry);
fclose($fp);
}
}
zip_close($zip);
}
?>
</code></pre>
<p>Works great.</p>
| php | [2] |
3,797,704 | 3,797,705 | How to set MSB of a UShort Variable? | <p>i'm having a UShort variable <code>Temp</code> and which has a value <code>1</code>.</p>
<p>How to set the most-significant bit of this value as 1.</p>
| c# | [0] |
4,905,239 | 4,905,240 | How to write a program in java reading doubles from a txt file and store them on 2 dimension arrays? | <p>**I should make a program that reads double numbers with this format(8,77) from a text file and then store them to arrays. The output of the program should look like this:<br>
3,55 232,22 32,50<br>
3,00 3,01 3,88<br>
2344,87 43,93 43,00 </p>
<p>453,24 24,24 242,43<br>
24,42 34,43 4,40<br>
43,43 43,22 43,22 </p>
<p>5,45 545 5,44<br>
4,55 45,45 45,55<br>
45,45 2,43 43,43<br>
I had done this so far but it doesnt looks like this, and its on integer.. can anybody fix it or help me?**</p>
<pre><code>import java.io.File;
import java.util.*;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class ReadFile {
public static void main(String[] args) {
Scanner file = null;
ArrayList<Integer> list = new ArrayList<Integer>();
int[][] board = new int[3][3];
int counter;
counter = 0;
try {
file = new Scanner(new File("file.txt"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
if (file.hasNext()) {
for (int a = 0; a < board.length; a++) {
for (int k = 0; k < board[a].length; k++) {
if (file.hasNextInt()) {
list.add(file.nextInt());
} else {
file.next();
System.out.println();
}
}
System.out.println();
}
System.out.println();
}
for (Integer i : list)
System.out.println(i);
}
}
</code></pre>
| java | [1] |
2,674,696 | 2,674,697 | jQuery find img tag and get SRC from it | <p>Hey all i have this js code:</p>
<pre><code>var imgJPG = jQuery('img[src$=".jpg"]', '<div>' +
fullCode + '</div>').attr('href');
</code></pre>
<p>However, it does not seem to pick up the src of the image?? fullCode is the HTML source code.</p>
<p>The HTML:</p>
<pre><code><strong><span style="font-size: small;">
<img class="alignleft" title="ASHE" src="http://www.website.org/san-logo.jpg"
alt="" width="198" height="192" />Design (D) is an at the Annual Conference,
held July 15-18, 2012 in San, Florida.</span></strong>
</code></pre>
<p>Am i missing something?</p>
| jquery | [5] |
4,034,788 | 4,034,789 | Impact on memory usage - const strings or resource strings? | <p>Is there an advantage in terms of heap memory footprint when we define string constants in a resource file instead of declaring as const inside a claass?</p>
| c# | [0] |
3,855,897 | 3,855,898 | How to make a buffer stream for storing strings in memory? | <p>I have following task: to make application for uploading data into FTP server using apache.commons.net.FTPClient, etc. There is method client.storeFile() which allows to upload file (it requires InputStream as 1 of method parameters). But I want to make txt file into server which should contain array of strings - array is variable of program. Should I make file, put strings into it and transfer this file into method, or there is stream which allow to store strings in memory without making file? Thank you, anyway. </p>
| java | [1] |
924,061 | 924,062 | Split string based on a series of characters | <p>I want to know how i can split a string in php based on a series of characters.
Like for example, i have a string as: a^b^^c^^^d^^^^e</p>
<p>Now how i can break this string into an array as: a,b,c,d,e ?
The php explode function does not seem to work here....</p>
<p>Please help..</p>
| php | [2] |
3,351,892 | 3,351,893 | how keep the radio button position at selected one when changes from portrait to landscape | <p>how andrid radio button code but when changes from portait to landscape selected possition appear plz help me any one</p>
| android | [4] |
3,623,296 | 3,623,297 | Small modification to the limit of a textarea characters counter | <p>The code below counts the chars typed in a textarea. If you reach the 250 limit you can not add more. How can I let people to type more than 250? </p>
<p>Like ok, you have 250 minimum but it doesn't mind if you put more than this. Thanks!</p>
<pre><code><script type='text/javascript'>
var maxLength=250;
function charLimit(el) {
if (el.value.length > maxLength) return false;
return true;
}
function characterCount(el) {
var charCount = document.getElementById('charCount');
if (el.value.length > maxLength) el.value = el.value.substring(0,maxLength);
if (charCount) charCount.innerHTML = maxLength - el.value.length;
return true;
}
</script>
<form>
<textarea onKeyPress="return charLimit(this)" onKeyUp="return characterCount(this)" rows="8" cols="40"></textarea>
</form>
<p><strong><span id="charCount">250</span></strong> more characters available.</p>
</code></pre>
| javascript | [3] |
5,899,345 | 5,899,346 | how does google voice do this | <p>When you select new message, you have the option to go to google voice, this is also present when you look at something in your inbox and hit reply. How do they do that? I'm talking about the google voice android app.</p>
| android | [4] |
1,771,683 | 1,771,684 | Regarding Session Timeout | <p>I have a problem regarding Session Time Out.How can we store a user Session for 1 day.So that if the user Logout.It doesn't affect the user session and User session continues for one day.</p>
| asp.net | [9] |
3,959,624 | 3,959,625 | Disable right click on form field level | <p>I am need of generic function which can disable right click on the form fields.</p>
| javascript | [3] |
2,791,266 | 2,791,267 | JQuery FCKeditor how to install? | <p>i want add FCKEditor into JSP
i found plugin for FCKEditor by Jquery
But i was do the same guide but not work
The plugin here:</p>
<pre><code>http://www.fyneworks.com/jquery/FCKEditor/
</code></pre>
<p>the following guide:</p>
<pre><code>http://www.fyneworks.com/jquery/FCKEditor/#tab-Usage
</code></pre>
<p>i choose method 3 but when i view the jsP it just text area isn't FCKEditor</p>
<p>i wonder with the config path</p>
<pre><code>$.fck.config = {path: '/path/to/fck/directory/', height:300 };
</code></pre>
<p>thi fck in the path it mean fckeditor or fckeditor plugin?</p>
| jquery | [5] |
4,039,640 | 4,039,641 | jQuery on ( ) , why does 'click' on another unattached element take place? | <p>html snippet :</p>
<pre><code><p>add more</p>
<div class="display_box_ppl_tag" style="border:1px solid red; width:120px; text-align:center;">
this is the display box text
</div>
</code></pre>
<p>js snippet :</p>
<pre><code>$(document).ready(function() {
$(document).on('click', $(".display_box_ppl_tag"), function(e) {
//$(".display_box_ppl_tag").on('click',function(){
e.stop Propagation();
alert("yes clicked");
});
$('p').click(function() {
$('.display_box_ppl_tag:last').after('<div class="display_box_ppl_tag">this is display box ppl tag</div>');
});
});
</code></pre>
<p>What is intended through the code is, clicking on <code></p></code> will add a new element with the class 'display_box_ppl_tag' after the existing ones with the same class name, and clicking on any of the divs with class 'display_box_ppl_tag' will launch an alert box. But when ever <code></p></code> is clicked , the alert box is launched without any click on the said div.</p>
<ol>
<li><p>Why does this happen?</p>
<p>Again if change the following line</p>
<pre><code>$(document).on('click',$(".display_box_ppl_tag"),function(e){
</code></pre>
<p>to </p>
<pre><code>$('.display_box_ppl_tag').on('click',function(){,
</code></pre>
<p>the 'click' event is not attached to the newly created elements. But from the <a href="http://api.jquery.com/on/" rel="nofollow">API</a> , I find 'If the selector is null or omitted, the event is always triggered when it reaches the selected element.'</p></li>
<li><p>Why does not the later coding work as expected ?</p></li>
</ol>
| jquery | [5] |
4,760,851 | 4,760,852 | Could not load file or assembly 'PcapDotNet.Core after build the new source code (Pcapdot.net project) | <p>because Pcapdot.Net forum is not so active i will ask here.</p>
<p>Recently the developer of the project solved bug that causes crash after a few iteration each opening files but didn't publish new DLLs but said it would be possible to download the new source code and build it, so i did it.</p>
<p>i downloaded the source code and because it made with VS2010 and i am use VS2012 i installed VS2010 and build the code for x64 like my machine.
the application works fine and it crash after 509 iterations solved but after take my application to machine with VS2012 i cannot open it and it crash and after installed on this machine VS2010 it works so i double checked and on each machine without VS2010 it doesn't work and after VS2012 installations it works fine. </p>
<p>edit:</p>
<p>with the old DLLs its work fine even if i have on my machine only VS2012 and in both ways (works and not works) i have this warning:</p>
<p><strong>Warning 1 Referenced assembly 'mscorlib.dll' targets a different processor</strong> </p>
| c# | [0] |
1,897,017 | 1,897,018 | How do i hide the tables created in visual studio 2010 C#? | <p>How do i hide the tables created in visual studio 2010 C#? What i am trying to do is to hide the table (somewhat like timetable) and only let it appear when user click on one of the calendar dates. I tried using Visibility: hidden; but the whole table disappeared when i view on the design view. I need help! Thanks in advance.</p>
| c# | [0] |
1,009,305 | 1,009,306 | What is a good way to represent (programatically) graphs/networks? | <p>SO I have made this program dealing with cities and the roads linking them, and I am wondering if anyone could point me towards a way to represent this "network" graphically (in 3 or 2Ds).</p>
<p>Could be either a specific programming friendly file format (which I could easily generate an instance of programatically), or a specific language's api or library for such representation.</p>
<p>My current work is in Java, but if there's a solution in an other language it's not a problem.</p>
| java | [1] |
3,173,910 | 3,173,911 | disable (grey out) the previous row(s) | <p>I would like to grey out (disable) the previous row(s), every time I add a new one. Right now I could only disable the first one. Many thanks in advance. Following is what I could do so far:</p>
<pre><code><head>
<SCRIPTTYPE="text/javascript">
varcount="1";
functionaddRow(in_tbl_name){
vartbody=document.getElementById(in_tbl_name).getElementsByTagName("TBODY")[0];
varrow=document.createElement("TR");
vartd1=document.createElement("TD")
varstrHtml1="<SELECTNAME=\"sel_1\"><optionvalue=\"a\">a<optionvalue=\"b\">b<optionvalue=\"c\">c<optionvalue=\"d\">d</SELECT>";
td1.innerHTML=strHtml1.replace(/!count!/g,count);
row.appendChild(td1);
count=parseInt(count)+1;
tbody.appendChild(row);
myform.sel1.disabled=true;
}
functiondelRow(){
varcurrent=window.event.srcElement;
while((current=current.parentElement)&&current.tagName!="TR");
current.parentElement.removeChild(current);
}
</SCRIPT>
</head>
<body>
<div>
<formaction="#"method="POST"name="myform">
<divstyle="">
<TABLEID="mytable"name="mytable"border="1"STYLE="border-width:1pxorangedashed;background-color:#F0E68C;table-row-width:2;">
<TR>
<TD>
<selectsize="1"name="sel1">
<optionvalue="a">a</option>
<optionvalue="b">b</option>
<optionvalue="c">c</option>
<optionvalue="d">d</option>
</select>
</TD>
</TR>
</TABLE>
</div>
<div>
<INPUTTYPE="Button"onClick="addRow('mytable')"VALUE="Add">
</div>
</form>
</div>
</body>
</code></pre>
| javascript | [3] |
1,270,527 | 1,270,528 | How can I get control over the result of ldap_bind function | <p>I am working with symfony 2.1 and authenticating with active directory. The thing is that when the parameters of the ldap function are rigth everything is fine, but when user or password are wrongs I get a this:
<strong>Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials in C:\wamp\www\tesis\src\Usuarios\userBundle\Controller\DefaultController.php line 56</strong></p>
<p>This is my code:</p>
<pre><code> if ($ldapconn){
if(ldap_bind($ldapconn, $ldapuser, $ldappass)){
$ldapBase = 'OU=Usuarios UNISS,DC=cuss,DC=suss,DC=co,DC=cu';
$filter="sAMAccountName=$use";
$sr = ldap_search($ldapconn, $ldapBase, $filter);
$ent= ldap_get_entries($ldapconn,$sr);
...
return $this->render('userBundle:Default:index.html.twig',array('sum' =>$tipo));
}
else
return $this->render('userBundle:Default:index.html.twig', array("msj" => "Usuario o Contraseña incorrectos"));
}
</code></pre>
<p>Before all Thanks for your help</p>
| php | [2] |
4,941,726 | 4,941,727 | Get the cellphone number from a sms in adroid | <p>I'm new in Android and I did a tutorial from the AppInventor.</p>
<p>What it does is when you get a SMS, the app read it for you and sent an automatic response.</p>
<p>I want to do the same in Java, but I can't figure out how to get the numer and the text from the SMS.</p>
<p>I hope you can help, thaks.</p>
| android | [4] |
2,311,827 | 2,311,828 | Moving image from scrollView to View | <p>I have created a <code>scrollview</code> and have added it to my view controller class. Now I have items in <code>scrollview</code>. On touch I want to move image to the main view. I am trying using <code>touchesBegin</code> and <code>touchesMoved</code> but it's not working. How can I do it?</p>
<pre><code>-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"touch moved");
dummyDress.frame=CGRectMake(location.x, location.y , 80, 120);
}
</code></pre>
| iphone | [8] |
3,147,461 | 3,147,462 | Time with minutes and Hours wheel type in android | <p>I am developing wheel type piker in android which should show Min figure with Min text and hour figure with hour text but it is displaying same text Min or hour what should I do to separate Min and hour.
I got code from following link.</p>
<pre><code>android-wheel Android Picker widget
http://code.google.com/p/android-wheel/source/browse/trunk/wheel-demo/src/kankan/wheel/demo/CitiesActivity.java
http://code.google.com/p/android-wheel/downloads/list*
</code></pre>
| android | [4] |
5,630,544 | 5,630,545 | Thread or services | <p>I'm confused between thread and service on android.
If I have to download some file form server. It may be multiple files at a time.
What i should choose in this situation thread or services?</p>
| android | [4] |
4,733,208 | 4,733,209 | jQuery - Not this or prev or next? | <p>How can I select all divs of a class except 'this', and also not the next and previous div? The code below selects everything except for 'this':</p>
<pre><code>$(".image-div").not(this).each(function() {
$(this).animate({
width: '250px'
}, 500, function() {
// Animation complete.
});
}
});
</code></pre>
<p>Thanks </p>
<p>UPDATE - Here is my full code: </p>
<pre><code>$(".image-div").click(function () {
if ($(this).css('width') != '500px') {
$(this).animate({
width: '500px'
}, 500, function() {
// Animation complete.
});
$(this).prev().animate({
width: '125px'
}, 500, function() {
// Animation complete.
});
$(this).next().animate({
width: '125px'
}, 500, function() {
// Animation complete.
});
} else {
$(this).animate({
width: '250px'
}, 500, function() {
// Animation complete.
});
}
$(".image-div").not(this).each(function() {
$(this).animate({
width: '250px'
}, 500, function() {
// Animation complete.
});
});
});
</code></pre>
<p>All div.image-div's start out 250px wide. I need it so when you click on a div, it expands to 500px and its neighbors on both sides (also div.image-div's) shrink to 125px.</p>
<p>When you click on the div again it and its neighbors re-size to 250px. Also if you click on another div, all the divs (except for the clicked on div and its neighbors) re-size to 250px.</p>
<p>Thanks </p>
| jquery | [5] |
2,266,635 | 2,266,636 | 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] |
5,062,838 | 5,062,839 | setting html select with jquery val() with its innerhtml | <p>I am trying to set the selected attribute on a select pull down with jquery val(). I only have the caption (aka innerhtml) of the element I want the selected, but not the value.
For example:</p>
<p>A pulldown of states. I want the "New york" option to be selected. I want to write a jquery statement which does</p>
<pre><code>$("#pull-down").val([get value of the option tag which has "New York" as its innerhtml])
</code></pre>
<p>Is this possible?</p>
| jquery | [5] |
1,041,561 | 1,041,562 | Add global try/catch to JavaScript | <p>Is there some way to wrap the entire page in a try/catch, so that I can catch any error from any script that is executing?</p>
| javascript | [3] |
1,791,906 | 1,791,907 | fopen() can't write with error "HTTP wrapper does not support writeable connections" | <p>I have a file with url: <code>http://localhost:8080/cache/a66b311547bf3da88f01139271d5bb50.txt</code>
And in php I using code:</p>
<pre><code>$file = "http://localhost:8080/cache/a66b311547bf3da88f01139271d5bb50.txt"
$output = serialize($data);
$fp = fopen($file, "w");
fputs($fp, $output);
fclose($fp);
</code></pre>
<p>When run code, is error</p>
<blockquote>
<p>Warning: fopen(http://localhost:8080/cache/a66b311547bf3da88f01139271d5bb50.txt): failed to open stream: HTTP wrapper does not support writeable connections ...</p>
</blockquote>
<p>How to fix it?</p>
| php | [2] |
2,416,289 | 2,416,290 | how to make login script from multiple table? | <pre><code>> i ve got 4 separate tables to store login data.
>>> tables are **admin_login staff_login >tutor_login student_login**.
>>>>>> my php registration form is storing data into this fields.
</code></pre>
<ol>
<li>now i need some suggestion how i can make login script?. </li>
<li>I've got the login form ready.</li>
</ol>
| php | [2] |
3,917,355 | 3,917,356 | Can anybody explain me the flow of below program? | <p>Can anybody explain the below program flow ? </p>
<pre><code>public class Sample {
public static void main(String[] args) {
new OuterClass();
}
}
class OuterClass {
private int x = 9;
public OuterClass() {
InnerClass inner = new InnerClass();
System.out.println("2");
}
class InnerClass {
public void innerMethod() {
System.out.println(x);
}
}
}
</code></pre>
| java | [1] |
3,924,209 | 3,924,210 | how to access components of system application protected with "signatureOrSystem" permission? | <p>I want to access the components of system application(present in the source code - ICS) protected with "signatureOrSystem" permission, in other application(not present in source code). Is it possible? If yes then please provide some reference.</p>
| android | [4] |
386,293 | 386,294 | Accessing SQL Server remotely and generate report | <p>Actually I am bit of confused right now and need some guidance. I have been offer a project to create web portal to generate report. Scenario is something like this,</p>
<p>Client has a business and he need to check the report of hourly sale. What should I do, should I put the SQL Server online or is there any other way to excess server database remotely. I have no experience in creating web portal, how should I start doing it. </p>
<p>Can anyone guide me in proper manner? I have experience in C#.NET using Visual Studio 2010. </p>
<p>Thanks.</p>
| c# | [0] |
4,938,674 | 4,938,675 | GeoTagging Videos in Android | <p>In Android it is possible to add <code>Geolocation</code> (lat and long) information to a picture. Under <code>Camera</code> settings, there is an option for it.</p>
<p>But for videos this is missing. Is there any other way to add <code>Geolocation</code> to video files?</p>
<p>Is it possible to use the <code>ExifInterface</code> class's <a href="http://developer.android.com/reference/android/media/ExifInterface.html" rel="nofollow">setAttribute</a> method for this?</p>
<p>Thanks In Advance,
Perumal</p>
| android | [4] |
3,944,995 | 3,944,996 | explicitly casting generics in C# 4 | <p>Can anyone help me in casting generic collection in c# 4. </p>
<p>Here is the code snippet.</p>
<p>GridView1.DataSource = dataServiceColl.Select(t => t.product_desc="EdibileItem")</p>
<p>It is throwing up runtime error at the below line,</p>
<p>Gridview1.Databind(); </p>
<p>Saying it is a HTTP Exception.</p>
<p>I think it should be a simple type cast.</p>
<p>Thanks,
Kris.</p>
| c# | [0] |
5,478,269 | 5,478,270 | Using windows.h, remove text from chat box upon mouse click (C++) | <p>Sorry, title was a bit vague.</p>
<p>Basically, I am making a chat program in C++ and using windows.h API. I have most of the program working, just small things are not working correctly. I have a box that a user types what they wish to say in, and in that box it says "Enter text here" in italics. I want to set it so that when the user clicks in that box, those words disappear and the user can freely type. As it is set now, if they click within the box it goes to the end of the word "here" and they must manually delete the words.</p>
<p>Is there a simple way to do this? Possibly when creating the box or text? Or must I add logic of my own in order to accomplish this?</p>
<p>Attached is the code where I create both the box, and where I set the font:</p>
<p>Box:</p>
<pre><code>hwSendEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", "Enter Text Here",
WS_CHILD|WS_VISIBLE, 2, 215, 790, 22, hwMain, 0, hInst, 0);
</code></pre>
<p>Font:</p>
<pre><code>chFont = CreateFont(12, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Tahoma");
SendMessage(hwSendEdit, WM_SETFONT, reinterpret_cast<WPARAM>(chFont), 0);
</code></pre>
<p>Thank you for any help you can provide.</p>
| c++ | [6] |
1,425 | 1,426 | if passowrd and username matches(in action form) then how to navigate to further page on the succesful if statement | <p>Friends i am a newbie in php and trying to learn it more and more...</p>
<p>I am telling you my problem what i am facing</p>
<p>i have a employee signinform which have one username box and one password box with signin button..Now on the action page of this signinform i have given adress of signinvarification form..which matches the entered username and password with the database record.If username and password matches then it shows you have successfully login..otherwise not login...</p>
<p>NOw i have one page in which i have employee pictures..</p>
<p>Now what i want....????</p>
<p>i want that as the employee signin then that login successfully msj does not display and directly the page which have employee pictures displayed..if sign in is successfull(means if password and usermae are matching).</p>
<p>what i can do in this...</p>
<p>i am thinking that on the if condition if username and password matches then after this i have to write the whole code which i have written for employee picture page on the signinvarification form...</p>
<p>is there any possiblitye that simply i give the adress of that employee picture page and as password are matches it directly navigate to that picture page..</p>
<p>plz tell me...I have given u full information which i can give</p>
| php | [2] |
321,500 | 321,501 | multiple preg_replace on the same variable | <p>While delving into some old code I've stumbled upon a function which is used to clean up special characters using <a href="http://de3.php.net/manual/en/function.preg-replace.php" rel="nofollow"><code>preg_replace</code></a> very excessively. Unfortunatly there's no way to avoid this cleanup, the messed up data arrive from outside.</p>
<pre><code>/* Example 1: current code */
$item = preg_replace('/' . chr(196) . '/',chr(142),$item);
$item = preg_replace('/' . chr(214) . '/',chr(153),$item);
$item = preg_replace('/' . chr(220) . '/',chr(154),$item);
</code></pre>
<p>Alot of those lines are in there, and all do the same (using different characters), so there should be a better way to do this. My first iteration to optimize this would be to use an indexed array, like this:</p>
<pre><code>/* Example 2: slightly optimized code */
$patterns = array();
$patterns[0] = '/'.chr(196).'/';
$patterns[1] = '/'.chr(214).'/';
$patterns[2] = '/'.chr(220).'/';
$reps = array();
$reps[0] = chr(142);
$reps[1] = chr(153);
$reps[2] = chr(154);
$item = preg_replace($patterns,$reps,$item);
</code></pre>
<p><em>It does the job</em>, but I guess there's somewhere a better and/or faster way of doing this alot easier and smarter - maybe even without preg_replace. Due to the early morning and/or the lack of good coffee, I was unable to find it myself so far.</p>
<p>Any suggestions?</p>
| php | [2] |
3,342,707 | 3,342,708 | Date difference between two date variables with AM PM format. | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1770564/getting-the-difference-between-two-time-dates-using-php">Getting the difference between two time/dates using php?</a> </p>
</blockquote>
<p>I have two dates variable
let $arrival_time="7.30 AM";
$departure_time="8.30 PM";</p>
<p>Then how can I calculate the time difference between these two variables in php ? </p>
| php | [2] |
4,913,081 | 4,913,082 | jquery append and remove element problem | <p>i have this code</p>
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Test jQuery</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function() {
$(".add").click(function() {
$("#demos").append("<input type='text' size='20' name='txt[]'> <a href='#' onClick='removeFormField(); return false;'>Remove</a>");
return false;
});
});
function removeFormField() {
$(this).prev("input").remove();
}
</script>
<body>
<a class="add" href="#">add</a>
<div id="demos"></div>
</body>
</html>
</code></pre>
<p>and when i press add its work good but when click remove its not remove anything</p>
| jquery | [5] |
3,366,749 | 3,366,750 | jQuery jrac and jQuery .hide() .show() conflict error | <p>I am using <a href="http://www.trepmag.ch/z/jrac/example/" rel="nofollow"> jQuery Resize and Crop (jrac) </a>. Every thing work fine in my sample code <a href="http://jsfiddle.net/KpFwb/5/" rel="nofollow">jsfiddle</a>.</p>
<p>But when I try to hide Div area which is showing Image Editor, I found error.<br>
I use below code to hide my div.</p>
<pre><code> $('#ImageZone').hide();
</code></pre>
<p>Upper code actually work, it hide what i want to hide. But after I call below code, error start happen.</p>
<pre><code>$('#ImageZone').show(some int value);
</code></pre>
<p>It display <a href="http://jsfiddle.net/SMTDc/5/" rel="nofollow">incorrect value</a> like below</p>
<p><img src="http://i.stack.imgur.com/YLxeT.png" alt="enter image description here"></p>
<p>But after I remove below code, <a href="http://jsfiddle.net/KpFwb/5/" rel="nofollow">everything work fine</a> again.</p>
<pre><code>$('#ImageZone').hide();
</code></pre>
<p><img src="http://i.stack.imgur.com/fvmUz.png" alt="enter image description here"></p>
<p>So let me know what is that error.
Is that jquery error ?
or somthing esle ?</p>
| jquery | [5] |
4,150,901 | 4,150,902 | Replacing FileInputStream with getResourceAsStream | <p>I am currently reading in a public key file using the following code:</p>
<pre><code> // Read Public Key.
File filePublicKey = new File(path + "/public.key");
FileInputStream fis = new FileInputStream(path + "/public.key");
byte[] encodedPublicKey = new byte[(int) filePublicKey.length()];
fis.read(encodedPublicKey);
fis.close();
</code></pre>
<p>However, I wish to include the key files in with my jar. I have dragged the key files into my project in eclipse and I am trying to load the public key using the following to replace what is above:</p>
<pre><code> InputStream is = getClass().getResourceAsStream( "/RSAAlgorithm2/public.key" );
byte[] encodedPublicKey = new byte[(int) 2375];
is.read(encodedPublicKey);
is.close();
</code></pre>
<p>However I keep getting a NullPointerException. </p>
<blockquote>
<p>java.lang.NullPointerException at RSA.LoadKeyPair(RSA.java:122) at
RSA.main(RSA.java:31)</p>
</blockquote>
<p>Is this because I am incorrectly loading in the file? Can files be dragged into eclipse and loaded like this or is it a requirement to have them seperate from the JAR?</p>
| java | [1] |
4,131,397 | 4,131,398 | Adding a namespace method to the object prototype | <p>I am trying to add a namespace method to the Object prototype in javascript.</p>
<p>What I would like to be able to do is this:</p>
<pre><code>var myObj = {}
myObj.namespace('nested.objects.are.created.if.not.present')
</code></pre>
<p>But I am getting lost. It seems quite easy to do a generic function, but not to add it to the protoype.</p>
<p>Here is what I have:</p>
<pre><code>Object.prototype.namespace = function(ns_string) {
var parts = ns_string.split('.');
var parent = this;
var i;
var length = parts.length
for (i = 0; i < length; i++) {
// Create a property if it doesnt exist
if (typeof parent[parts[i]] === "undefined") {
parent[parts[i]] = {};
}
parent = parent[parts[i]];
}
}
</code></pre>
<p>It appears that the value of parent is not being set correctly each time. Im sure its something very basic that I am missing, but Im not sure what it is.</p>
<p>Thanks in advance.</p>
<p>Richard</p>
| javascript | [3] |
3,693,177 | 3,693,178 | How I get URL from webview on click | <p>How can I get "clicked URL" from <code>webview</code> on its click event??</p>
<p><code>@Override</code>
<code>public void onClick(View v) {</code></p>
<pre><code> if( v.getId() == R.id.webview) {
//Here i want to get clicked url
}
}
</code></pre>
<p>Thanks in advance. </p>
| android | [4] |
884,954 | 884,955 | Changing captured image color | <p>I want to capture an image from the camera and then I want to change this image color, I want to know that is it possible in iOS to change the captured image color or not? And if it is possible than where I can found its tutorial?</p>
| iphone | [8] |
1,836,925 | 1,836,926 | Not getting focus on list rows in android | <p>I have a list with some rows which define some transaction. When i select the row, particular transaction details is showing in another list. Now when i am selecting a row in the first list, corresponding details is showing in the second list but the first list's selected row is not getting the focus. How can i get the focus?? I am doing this for android tablet and OS is 2.2.</p>
<p></p>
| android | [4] |
5,963,501 | 5,963,502 | switch between multi viewcontroller's view | <p>I have a project in which, there is root viewcontroller and multi sub viewcontrollers.
In root viewcontroller I call and switch between 2 sub viewcontrollers</p>
<p>codes as:</p>
<pre><code>//root view controller controller button at front of all subviewcontrollers'view
[vViewController2.view removeFromSuperview];
[self.view insertSubview:vViewController1.view atIndex:0];
</code></pre>
<p>in this mode the sub view/viewcontroller in the memory will be unload, when it is loaded later, it will prompt the event of viewDidload.</p>
<p>But I prefer to after the sub viewcontroller is loaded and when switch, it stores in memory rather than unload from memory.</p>
<p>If did as this, I have to increate the value of atIndex.</p>
<p>When I try to return to the sub viewcontroller with low value of atIndex, I do not knwo how to do.</p>
<p>Welcome any comment</p>
<p>Thanks
interdev</p>
| iphone | [8] |
5,387,890 | 5,387,891 | How to write a custom solution using a python package, modules etc | <p>I am writing a packacge foobar which consists of the modules alice, bob, charles and david.</p>
<p>From my understanding of Python packages and modules, this means I will create a folder foobar, with the following subdirectories and files (please correct if I am wrong)</p>
<pre><code>foobar/
__init__.py
alice/alice.py
bob/bob.py
charles/charles.py
david/david.py
</code></pre>
<p>The package should be executable, so that in addition to making the modules alice, bob etc available as 'libraries', I should also be able to use foobar in a script like this:</p>
<p>python foobar --args=someargs</p>
<p><strong>Question1:</strong></p>
<p>Can a package be made executable and used in a script like I described above?</p>
<p><strong>Question 2</strong></p>
<p>The various modules will use code that I want to refactor into a common library. Does that mean creating a new sub directory 'foobar/common' and placing common.py in that folder?</p>
<p><strong>Question 3</strong></p>
<p>How will the modules foo import the common module ?
Is it 'from foobar import common' or can I not use this since these modules are part of the package?</p>
<p><strong>Question 4</strong></p>
<p>I want to add logic for when the foobar package is being used in a script (assuming this can be done - I have only seen it done for modules)</p>
<p>The code used is something like:</p>
<pre><code>if __name__ == "__main__":
dosomething()
</code></pre>
<p>where (in which file) would I put this logic ?</p>
| python | [7] |
1,744,977 | 1,744,978 | Need advise on using maps within an Android App that I want to develop | <p>I'm considering building an Android app for my HTC phone that contains tour guides to attractions in London. An Example, a guide that shows information about Jack The Ripper area, where the killings took place, having a start and a finish marker on a map, and a route showing areas of interest. The user would look at the map, and follow the route from start to finish.</p>
<p>Question for the more experience developer - as I've zero Android app dev experience, how easy an app does this sound?</p>
<p>I was considering getting maps off the net, cropping them and customising them for each of the tour. Can you get free maps off the web, legally? </p>
<p>Or use Google Map (or something similar), and customising them to each tour.</p>
<p>I hope that I've described my idea as clearly as possible, I look forward to your replies.</p>
<p>Kind Regards
T</p>
<p>p.s. this app is what I'm thinking about minus the audio at every waypoint: <a href="https://market.android.com/details?id=hu.pocketguide.bundle.London_lite&feature=also_installed" rel="nofollow">https://market.android.com/details?id=hu.pocketguide.bundle.London_lite&feature=also_installed</a></p>
| android | [4] |
5,185,534 | 5,185,535 | When Connecting to the MDB through Android application | <p>I have written a program to connect the android application to the MDB and I am using Eclips as a editor. I have created One Activity inside that Their is one Button which will call the java class file inside the Class file I have written the MDB Connectivity code. But when Click on the Button It Will give me the java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver. What I have add any external jar/API file for this.</p>
| android | [4] |
5,826,561 | 5,826,562 | Downloading images from the gallery in android | <p>I am developing an app in which i need to import images from the default gallery to the storage in sd card that I use for the app. Is it possible?</p>
| android | [4] |
743,832 | 743,833 | Displaying dynamic data on a form | <p>I have created a form that contains various Jtextfields to display data. The data comes from an internet source and changes very frequently (every few seconds). I'm not sure the best way about doing it.</p>
<p>So far I have a class that retrieves the data upon request and stores the data locally. The data then can be retrieved using the getters and a timer.</p>
<p>eg.</p>
<pre><code> class Grabber(){
static String data;
static void update(String source){
//update data from source
}
static String getData(){
return data;
}
}
</code></pre>
<p>Then in the form file, MyForm.java I have:</p>
<pre><code> Timer timer = new Timer(2000, performUpdate);
timer.start();
....
ActionListener performUpdate = new ActionListener(){
public void actionPerformed(ActionEvent evt){
Grabber.update();
jTextField1.setText(Grabber.getData());
}
};
</code></pre>
<p>I believe this would work, but I'm not sure if this is the best way to do it and I just want to check I'm not doing something stupid. I thought about having the timer inside the Grabber function, and then calling a function inside MyForm <code>updateData(String data)</code> I think this would be nicer, but then it adds a dependency on the GUI which doesn't seem right.</p>
<p>Another issue is that I intend to have a few sources. Performing the updates in my proposed manner would require serial internet requests which may be better done in parallel? I would like the data to be as up to date as possible. </p>
<p>Apologies if this is not a typical question, but I'm just looking for other ideas on how to implement this.</p>
| java | [1] |
3,979,311 | 3,979,312 | Escaping in eval's argument | <p>I'm using <code>eval</code> to assign dynamic object's properties.</p>
<pre><code>property_name_1 = property1;
property_name_2 = property2;
property_value_1 = 1;
property_value_2 = 2;
var obj = new Object;
eval("obj."+property_name_1+"='"+property_value_1+"'");
eval("obj."+property_name_2+"='"+property_value_2+"'");
</code></pre>
<p>then I'm using this object as post data during ajax request.</p>
<p>Everything is ok, but as well known eval is not safe function and I should escape <code>property_value_1</code>, <code>property_value_2</code>. For example, <code>property_value_2 = "<a href=''>Yahoo!</a>"</code> will cause error.</p>
<p>What is the best way to do it?</p>
<p>Thank you</p>
| javascript | [3] |
1,139,255 | 1,139,256 | How server side events are called in .NET | <p>I am a beginner to .NET, I have some doubts in my mind. Can anybody help me to sort out?</p>
<ol>
<li><p>When a user requests for a file(*.ASPX), The request first goes to IIS server and with the help of Handlers and modules it finds the type of file that need to be processed and sent back to the client. But while displaying on the cilent machine the content of the .ASPX file will be displayed as HTML controls. How are the events generated at the client side and sent back to the server?</p></li>
<li><p>I know runat=server tells the control will be processed at serverside.
But every time why we need to write "runat=server". Is there any ASP.NET control which runs at client side?</p></li>
</ol>
| asp.net | [9] |
2,266,174 | 2,266,175 | About memory and delete object in c++ | <p>I will give some examples and explain. First, I declare some object like</p>
<p><code>CString* param = new CString[100]</code></p>
<p>And when I declare this one, my memory would increase a little bit because it's some implemented string. Then I store this object in some list of CString just like</p>
<pre><code>List<CString> myList = new List<CString>; // new list of CString
myList.add(param);
</code></pre>
<p>This is my question: I wanna know, when I delete myList, my param isn't deleted, right? And memory in param still exists. </p>
<p>Do I misunderstand?</p>
| c++ | [6] |
2,994,553 | 2,994,554 | Change text in file with php | <p>How would I go about doing this, preferably without mysql.
I just want to display the value inserted on a form on a text file.</p>
| php | [2] |
504,935 | 504,936 | I keep getting the Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException error | <p>I get the runtime error:</p>
<pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
at Series.series(Series.java:10)
at Series.main(Series.java:21)
</code></pre>
<p>in lines 10 and 21 and can't figure out what's wrong. I am trying to make the program sum the series 1 - 2x + 3x^2 + 4x^3... n*x^(n-1). Any help I can get would be much appreciated!</p>
<pre><code>public class Series {
public static double series (double x, int n) {
int increase = n;
double sign = Math.pow(-1.0, increase+1);
double exponent = Math.pow(x, increase-1);
double[] A = new double[n];
for (int i = 0; i <= n; i++) {
A[i] = (sign) * ((increase + 1) - A.length) * (exponent); increase = increase + 1;
}
double sum = 0;
for (int i = 0; i < A.length; i++) {
sum = sum + A[i];
}
return sum;
}
public static void main (String[] args) {
System.out.print("series(0.5, 1) should be 1.0");
System.out.println(" : " + series(0.5, 1));
}
}
</code></pre>
| java | [1] |
415,238 | 415,239 | JQuery element + class + selector syntax | <p>I would like to select the last visible <code><span class="delimiter'></span></code> element. The following syntax does not work:</p>
<pre><code>$('span.delimiter:visible');
</code></pre>
<p>How can I achieve this?</p>
| jquery | [5] |
321,684 | 321,685 | C# DATASET RELATIONS | <p>I have two table </p>
<pre><code>Parent Table STUDENT ====> ID,NAME SqlCommand==>Select * from Student
Child Table Lessons ====> ID,STUDENTID,LESSON SqlCommand==>Select * from Lessons
</code></pre>
<p>I create DataRelation for two table with ID and StudentId</p>
<p>I add 2 datagridview to my form.</p>
<p>First Table <code>DataSource=Dataset.Relations[0].ParentTable;</code></p>
<p>Second Table <code>DataSource=Dataset.Relations[0].ChildTable;</code></p>
<p>its not working like relational.How can I MAke child table StudentId defaultvalue parent table ID value</p>
| c# | [0] |
4,957,568 | 4,957,569 | Best way to display/format SQL 2005 money data type in ASP.Net | <p>I am attempting to set an asp.net textbox to a SQL 2005 money data type field, the initial result displayed to the user is 40.0000 instead of 40.00.
In my asp.net textbox control I would like to only display the first 2 numbers after the decimal point e.g. 40.00</p>
<p>What would be the best way to do this?
My code is below:
this.txtPayment.Text = dr["Payment"].ToString();</p>
| asp.net | [9] |
1,092,321 | 1,092,322 | How to run ffmpeg command in background from java | <p>I am running a ffmpeg command from java Runtime.getRuntime().exec.
ffmpeg command basically cut the images from live stream.
Actually when i run this command without & then it works fine for five minutes after that it stops cutting images.</p>
<p>but when i use "&" in ffmpeg command it does not work at all.</p>
<p>there is no problem in live stream as when i ran this ffmpeg command from linux its working fine.</p>
<p>My main question is how to run a ffmpeg command in background from java.</p>
| java | [1] |
5,369,712 | 5,369,713 | algorithm to list all possible paths | <p>I have dynamic 2D array </p>
<p>Example with Javascript</p>
<pre><code>var arr = new Array();
arr[0] = [1];
arr[1] = [2,3];
arr[2] = [4];
arr[3] = [5,6];
</code></pre>
<p>Now i want output all paths from begin to end :</p>
<p>path 1: 1->2->4->5</p>
<p>path 2: 1->3->4->5</p>
<p>path 3: 1->2->4->6</p>
<p>path 4: 1->3->4->6</p>
<p>..................</p>
| javascript | [3] |
3,956,381 | 3,956,382 | Reading an app.config in class library | <p>I have a class library and I would like to have some of the configurations stored in an App.config, which would be placed in the same project. I tried reading the configuration using:</p>
<p>ConfigurationManager.AppSettings["ABC"];</p>
<p>and it doesnt fetch me any value.</p>
<p>It would be great if you can let me know how I can read my App.config. I don't want to do this using xml. Would be great if you can post come code samples in C#.</p>
<p>Thanks in advance</p>
| c# | [0] |
1,273,618 | 1,273,619 | Not able to remove from an ArrayList | <pre><code> import java.util;
class Driver{
public static void main(String[] args) {
ArrayList<String> lstStr = new ArrayList<String>();
lsstStr.add("A");
lsstStr.add("B");
lsstStr.add("C");
for(Iterator<String> it = lstStr.Iterator(); it.hasNext();)
{
str = it.next();
if(str.equals("B")){lstStr.remove(str);}
}
for(Iterator<String> it = lstStr.Iterator(); it.hasNext();)
{
System.out.println(it.next());
}
}
}
</code></pre>
<p>This is not removing "B" from the list. Why Str is not equal to "B" when loop runs second time.Why?</p>
| java | [1] |
2,285,090 | 2,285,091 | Book for .Net Web Services | <p>Can any one suggest me a good book for .Net Web Services beginers (C#)</p>
| c# | [0] |
5,727,763 | 5,727,764 | Why do both of these line return the same results | <p>Both of these return true. Is one boolean where the other is text. Shouldnt the one with no .value error as it is refering to the object and not the objects value attribute?
Please help me understand this a bit more.</p>
<pre><code><input type="text" name="sigstatus1" id="sigstatus1" style="display:none;" size="40" fieldlength="50"></input>
<input type="text" name="sigstatus2" id="sigstatus2" style="display:none;" size="40" fieldlength="50"></input>
var sigStatus1 = document.getElementById("sigstatus1").value;
var sigStatus2 = document.getElementById("sigstatus2");
sigStatus1 = true;
sigStatus2 = true;
alert("Sig1 " + sigStatus1 + "\nSig2 " + sigStatus2);
</code></pre>
<p>fiddle <a href="http://jsfiddle.net/Xp7jX/" rel="nofollow">http://jsfiddle.net/Xp7jX/</a></p>
| javascript | [3] |
3,617,851 | 3,617,852 | jQuery find/hide matching option value from 2 select menus | <p>I have 2 select menus with matching options e.g </p>
<pre><code><select id="select-one">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select id="select-two">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</code></pre>
<p>What I need to do inside the change function is if an option is selected from either menu, hide/remove the matching option from the other list. I need to show it again when a different option is selected.</p>
<p>I hope that's enough info but please ask if you need any more.</p>
<p><strong>EDIT</strong></p>
<p>Sorry I missed it out but I am using the <a href="http://harvesthq.github.com/chosen/" rel="nofollow">chosen plugin</a></p>
| jquery | [5] |
167,867 | 167,868 | Making put request in php curl | <p>I know many people have already asked this question but unfortunately that answers doesn't help me.</p>
<p>I am trying a put request to the rest api using curl so for i am making my curl request like </p>
<pre><code> $GLOBAL_REST_URL = $GLOBAL_REST_URL.$meetinID;
$json = array2json($ages);
print $json;
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,$GLOBAL_REST_URL);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,20);
curl_setopt($curl_handle, CURLOPT_PUT, 1);
curl_setopt($curl_handle, CURLOPT_INFILE, $json);
// curl_setopt($curl_handle, CURLOPT_POSTFIELDS,$json);
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
$getit = json_decode($buffer, true);
</code></pre>
<p>$json is the request body and $GLOBAL_REST_URL is the RESTurl </p>
<p>The body and url that i am passing here is working fine when i am using it on mozila rest client but in programming i am getting error that body is not define .. </p>
<p>Help Plz .....?</p>
| php | [2] |
551,212 | 551,213 | Javascript object reference linked to object in array? | <p>If I have an object:</p>
<pre><code>var array = [];
var theobject = null;
array.push({song:"The Song", artist:"The Artist"}, {song:"Another Song", artist:"Another Artist"});
</code></pre>
<p>and I do:</p>
<pre><code>for(var i = 0; i < array.length; i++)
if(array[i].song == "The Song") {
theobject = array[i];
break;
}
</code></pre>
<p>If I then change theobject by doing:</p>
<pre><code>theobject.song = "Changed Name";
</code></pre>
<p>I am having problems where despite myself trying to set ONLY "theobject.song" to be equal to "Changed Name", array[0].song becomes set to "Changed Name" also. </p>
<p>What I want is "theobject.song" to become "Changed Name" while array[0].song remains "The Song".</p>
<p>What is the best way to accomplish this?</p>
| javascript | [3] |
1,138,424 | 1,138,425 | Php bin2hex Parse Error | <p>I dont understand why this keeps throwing a "PHP Parse error":</p>
<pre><code>$salt = bin2hex(mcrypt_create_iv(size)(32, MCRYPT_DEV_URANDOM));
</code></pre>
<p>Any ideas?</p>
| php | [2] |
4,403,790 | 4,403,791 | How to make a <div> adjust horizontally by the user | <p>I have a vertical side navigation bar and i would like its width to be horizontally adjustable. May someone please direct me to a tutorial or plugin that would help achieve this?</p>
<p>Thanks</p>
| javascript | [3] |
2,612,860 | 2,612,861 | Where is Object reflective information stored? | <ol>
<li><p>What use could someone have to override this (getClass()) method? What purpose could it solve practically.</p></li>
<li><p>The java documentation says this: <code>By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().</code> Why would this be true? What does this truth hold? Where is the information being stored that knows what type of object it is? How does this work?</p></li>
</ol>
<p>Sorry this question I deleted and I shouldn't have. I meant to edit it. Won't happen again.</p>
<p>EDIT: I misread the documentation, it is final X-(, but I still would like to ask the second question</p>
| java | [1] |
5,046,328 | 5,046,329 | Range Validator - alphabet entered when integer range checked | <p>I have a Range Validator as follows. It is for restricting values between 1900 and 2070. However, it fires error when I enter a alphabet also. I want this to be fired only if the user enters integer values. How do I overcome it? Please help..</p>
<pre><code> <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtYear"
ValidationGroup="report" ErrorMessage="EM1|Year" MaximumValue="2079" MinimumValue="1900"
SetFocusOnError="True" Display="Dynamic" Type="Integer">
<img src="../../Images/error.gif" alt="Format" />
</asp:RangeValidator>
</code></pre>
| asp.net | [9] |
3,618,538 | 3,618,539 | Variables in python os.path | <p>I am new to python and I'm trying to create a program that creates a directory with todays date, create a sandbox into that directory and run the make file in the sandbox. I am having trouble getting the variables to be picked up in the os.path lines. The code is posted below:</p>
<pre><code>#!/usr/bin/python
import mks_function
from mks_function import mks_create_sandbox
import sys, os, time, datetime
import os.path
today = datetime.date.today() # get today's date as a datetime type
todaystr = today.isoformat() # get string representation: YYYY-MM-DD
# from a datetime type.
if not os.path.exists('/home/build/test/sandboxes/'+todaystr):
os.mkdir(todaystr)
else:
pass
if not os.path.exists('/home/build/test/sandboxes/'+todaystr+'/new_sandbox/project.pj'):
mks_create_sandbox()
else:
pass
if os.path.exists('/home/build/test/sandboxes/'+todaystr+'/new_sandbox/Makefile'):
os.system("make >make_results.txt 2>&1")
</code></pre>
<p>Any help would be appreciated,
Thanks</p>
| python | [7] |
34,240 | 34,241 | double-buffer from different class? | <p>This in my class that is added to my JFrame. can anyone help me with how I can draw graphics from anouther class using this classes offScreen? for example have a Player class (Player.java) and draw an image and other things from that class but still buffer the image without making new double buffering methods in each class im drawing from? </p>
<pre><code>package Display;
import Graphics.Player1;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class DrawArea extends JPanel implements Runnable{
Thread drawLoop = new Thread(this);
BufferedImage image = new BufferedImage(1000, 700, BufferedImage.TYPE_INT_RGB);
public Graphics offScreen = image.getGraphics();
public DrawArea() {
setSize(1000, 700);
drawLoop.start();
}
public void update(Graphics g) {
paint(g);
}
public void paint(Graphics g) {
offScreen.setColor(Color.yellow);
offScreen.fillRect(0, 0, 1000, 700);
g.drawImage(image, 0, 0, null);
}
public void run() {
while(true) {
repaint();
try {
drawLoop.sleep(90);
} catch (InterruptedException ex) {
Logger.getLogger(DrawArea.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
</code></pre>
| java | [1] |
1,583,712 | 1,583,713 | String replace method is not working | <pre><code>public static String capitalise(String str)
{
if (str != null || !"".equals(str))
{
char chr=str.charAt(0);
String check= Character.toString(chr);
String check1= check.toUpperCase();
char chr1=check1.charAt(0);
str.replace(chr, chr1);
return str;
}
else
{
System.out.println("Not a valid String");
}
return str;
}
</code></pre>
| java | [1] |
2,538,470 | 2,538,471 | xml button link to for loop | <p>I am trying to get a button in an XML doc to add new textfields and checkboxes, I have the for loop that does what I want, but I don't understand how I am suposed to link my button to access a specific part of a java file. </p>
<p>How do i implement?</p>
<p>edit.</p>
<p>Here is my forloop that I want my button to access when pressed (generate textfields)</p>
<p>And Generally I want to know if it is possible to link a xml button to a loop in java and
If not, what can I do in order to get my button to generate textfields?</p>
<pre><code> for(int i = 0; i <5; i++){
CheckBox cb = new CheckBox(this);
cb.setText("I'm an egg!");
EditText et1 = new EditText(this);
et1.setText("Listitemz!");
ll.addView(et1);
ll.addView(cb);
</code></pre>
| android | [4] |
292,378 | 292,379 | Efficient searching for case insensitive ascii substring | <p>I was actually optimizing Regex transformations of large strings. As some calls to Regex.Replace took significant time I inserted conditional calls - something along the lines</p>
<pre><code>if (str.IndexOf("abc", 0, StringComparison.CurrentCultureIgnoreCase) > 0)
str1 = Regex.Replace(str, "abc...", string.Empty, RegexOptions.IgnoreCase);
</code></pre>
<p>To my surprise the results were not convincing. Sometimes better, sometimes not. Or even worse. So I measured performance of case insensitive IndexOf (I tried also StringComparison.OrdinalIgnoreCase) and found that it may be slower than Regex.Match, i.e. this test:</p>
<pre><code>if( Regex.Match(str,"abc", RegexOptions.IgnoreCase).Success )...
</code></pre>
<p>Particularly for a large string that did not match (ascii) string "abc" I found that Regex.Match was 4x faster.</p>
<p>Even this procedure is faster than IndexOf:</p>
<pre><code>string s1 = str.ToLower();
if( s1.IndexOf("abc") ) ...
</code></pre>
<p>Anybody knows a better solution? </p>
| c# | [0] |
5,569,779 | 5,569,780 | Access derived class' functions through pointer (C++) | <p>Here's an example of the situation:</p>
<pre><code>CAnimal *poTest = new CDog();
</code></pre>
<p>When I write "poTest->" All I can see are functions from the base class (in example: CAnimal) and not the ones in the derived one. How can I access these?</p>
| c++ | [6] |
4,781,950 | 4,781,951 | Converting server data as Sqlite Database | <p>i am developing android app, here i am having an huge no of data approximately 10000 records with 10 fields in the server, i need to get this data and store it in the my local db, so for this i tried to implement by getting the data in the form of json parsing it and inserting in db one by one, it is taking less time to download the data but more time to insert to the db, after some time i get to know that i am inserting to the db one by one, so insertion operations looping based on the total no of records which had been got. i tried to look for the alternatives i could not get the way for this, so i request you to give me suggestions and snippets to me achieve this.</p>
<p>Thanking you</p>
| android | [4] |
4,790,955 | 4,790,956 | jquery - creating a generic ajax function | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3203283/jquery-ajax-always-returns-undefined">jQuery Ajax always returns “undefined”?</a> </p>
</blockquote>
<p>I'm trying to come up with a generic jquery ajax function which takes the url & parameters and returns the result. I'm trying to avoid using <code>async:false</code> as it locks up the browser. If I use <code>success</code> callback in the ajax call, the data returned is null due to the timing issue (success doesn't wait until the data is returned). If I use <code>complete</code>, the <code>persons</code> object is still null in the <code>LoadPersons</code> method as it doesn't wait for the data to be returned from the ajax call. If place an <code>alert(persons)</code> in the <code>complete</code> callback, I get <code>[object][Object]</code> so I'm getting the data back. How do I "fix" this issue? Am I talking sense? I would also ideally like to show a "loading.." image while it's doing this.</p>
<p>Here's my code -</p>
<pre><code> <script type="text/javascript">
$(function() {
var persons;
var urlGetPersons = "Default.aspx/GetPersons";
LoadPersons();
function LoadPersons() {
persons = CallMethod(urlGetPersons, { });
if (persons != null) {
// do something with persons.
}
}
function CallMethod(url, parameters) {
var data;
$.ajax({
type: 'POST',
url: url,
data: JSON.stringify(parameters),
contentType: 'application/json;',
dataType: 'json',
success: function(result) {
data = result.d;
}, // use success?
complete: function(result) {
data = result.d;
} // or use complete?
});
return data;
}
});
</script>
</code></pre>
| jquery | [5] |
2,355,369 | 2,355,370 | Selector on a variable content with jQuery | <p>I have this code :</p>
<pre><code>jQuery('#btSave').click(function (event) {
var jqxhr = $.post("Controller/Action", {
lastName: $("#LastName").val()
},
function (data) {
//here
})
});
</code></pre>
<p>I'd like to know if in the "data" variable the id "Mydiv" exist</p>
<p>How can I don this ?</p>
<p>Thanks,</p>
| jquery | [5] |
2,350,561 | 2,350,562 | jQuery: $j('body').append(...) doesn't work? | <pre><code>function floatymessage(message){
if (!$j('.floatymessage')){
$j('body').append("<div class='floatymessage'>HERRO</div>");
}
$j(".floatymessage").html(message)
$j(".fleatymessage").css('display', 'block')
}
</code></pre>
<p>When the following is executed (tested with alert('hi'))
i do not see the div at the bottom in webkit's inspector... I don't see the text 'HERRO' either =\</p>
<p>did I do something wrong?</p>
| jquery | [5] |
5,553,384 | 5,553,385 | Could extra imports in Java slow down code loading time? | <p>Is it possible that adding more import statements to your java code could slow down the time it takes to load your classes into the JVM?</p>
| java | [1] |
1,465,131 | 1,465,132 | working map suddenly display crosses | <p>I was during developing my map based android app, then after running it couple of times in emulator, suddenly map gone and shows crosses. I had obtained a new key yesterday.</p>
<p>I'm using android 2.2 V8.
thanks all.</p>
| android | [4] |
1,181,263 | 1,181,264 | Asp.net yellow code <% vs Explicit asp control | <p>I have a literal in my aspx called xxx.</p>
<p>Now lets go into the JS world.</p>
<p>I always used :</p>
<pre><code> alert('audit.aspx?claim_id=<%= xxx.Text%>');
</code></pre>
<p>But Ive seen a code like this : </p>
<pre><code> alert('audit.aspx?claim_id=<asp:Literal id="xxx" runat="server" />');
</code></pre>
<p>This is also working.</p>
<p>Can I conclude that the <code><asp:Literal</code> is equal to <code><%=</code> syntax ? </p>
<p>I know that he is a RUNAT server Item...</p>
<p>but again - I want to see the differences.</p>
| asp.net | [9] |
5,546,277 | 5,546,278 | Select Value of List of KeyValuePair | <p>How can i select the value from the List of keyvaluepair based on checking the key value</p>
<pre><code>List<KeyValuePair<int, List<Properties>> myList = new List<KeyValuePair<int, List<Properties>>();
</code></pre>
<p>Here I want to get the </p>
<pre><code>list myList[2].Value when myLisy[2].Key=5.
</code></pre>
<p>How can i achieve this?</p>
| c# | [0] |
81,932 | 81,933 | Show DIV when text is entered | <p>I have tried everything to get this to work on ALL platforms. What am I doing wrong?</p>
<p>JS--</p>
<pre><code>$(document).ready(function(){
$('#gname').keypress(function() {
if ($(this).val() == "Toys")
$('#number').slideDown('fast')
else
$('#number').hide();
});
});
</code></pre>
<p>CSS--</p>
<pre><code>#number { display: none; height: 100px; border: solid 1px #ddd; }
</code></pre>
<p>HTML--</p>
<pre><code>Type here:<input type="text" id="gname">
<div id="number">
Test
</div>
</code></pre>
| jquery | [5] |
507,859 | 507,860 | where should I close a cursor? | <p>I have an activity with a spinner which loads a simpleCursorAdaptor. I call another class to return the cursor which is used by the simpleCursorAdaptor. I don't keep a class level variable of the cursor or adaptor.</p>
<p>When this activity closes down I want to close the cursor. Should I:</p>
<p>a) in the activitie's onDestroy() event, get the cursor from the spinner via the adaptor and close it there or</p>
<p>b) In the data handler class which generates the cursor in the first place </p>
| android | [4] |
5,828,583 | 5,828,584 | How to save the contents of a plain text file on the phones storage to a variable in Android? | <p>I have some plain text data in the external storage of an android device and I want to save that plain text to a variable how could I do that?</p>
<p>I tried:</p>
<pre><code>Scanner in;
try {
in = new Scanner(openFileInput("aspw.dat"));
String password = in.nextLine();
} catch (FileNotFoundException e1) {
errortoast.show();
e1.printStackTrace();
}
</code></pre>
<p>And I get a file not found exception even though the file aspw.dat is right there in the root of the SD card.</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.