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,775,293 | 1,775,294 | Can anyone explain the following PHP Code? | <p>Can anyone explain the following PHP Code ?</p>
<pre><code>function get_param($param_name, $param_type = 0)
{
global $HTTP_POST_VARS, $HTTP_GET_VARS;
$param_value = "";
if (isset($_POST)) {
if (isset($_POST[$param_name]) && $param_type != GET)
$param_value = $_POST[$param_name];
elseif (isset($_GET[$param_name]) && $param_type != POST)
$param_value = $_GET[$param_name];
} else {
if (isset($HTTP_POST_VARS[$param_name]) && $param_type != GET)
$param_value = $HTTP_POST_VARS[$param_name];
elseif (isset($HTTP_GET_VARS[$param_name]) && $param_type != POST)
$param_value = $HTTP_GET_VARS[$param_name];
}
return strip($param_value);
}
function strip($value)
{
if (get_magic_quotes_gpc() == 0) {
return $value;
} else {
return stripslashes($value);
}
}
</code></pre>
<p><hr /></p>
<p><strong>UPDATE</strong></p>
<p>It is used like this: </p>
<pre><code>$xml = get_param('xml');
</code></pre>
| php | [2] |
381,945 | 381,946 | noticed variations of %1$s being used in code, cannot google escaped charecters. Please link a resource | <pre><code>String.format("com.dummy.%1$s.", strVarName)
</code></pre>
| java | [1] |
5,325,356 | 5,325,357 | Convert a C# string array to a dictionary | <p>Is there an elegant way of converting this string array:</p>
<pre><code>string[] a = new[] {"name", "Fred", "colour", "green", "sport", "tennis"};
</code></pre>
<p>into a Dictionary such that every two successive elements of the array become one {key, value} pair of the dictionary (I mean {"name" -> "Fred", "colour" -> "green", "sport" -> "tennis"})?</p>
<p>I can do it easily with a loop, but is there a more elegant way, perhaps using LINQ?</p>
| c# | [0] |
3,575,810 | 3,575,811 | if explodable / else | <p>I have a string which may or may not contain commas. If it does, I want it exploded into an array; if it doesn't, I still want the string saved to the new identifier. My code clearly doesn't work. Anyone have any better ideas?</p>
<pre><code>if(explode(",", $_SESSION['shoparea']))
{
$areas = explode(",", $_SESSION['shoparea']);
} else {
$areas = $_SESSION['shoparea'];
}
</code></pre>
<p>What is the correct syntax for this operation?</p>
| php | [2] |
3,418,740 | 3,418,741 | How can I maintain state in browser JavaScript across different page loads from the same site? | <p>I need to do something very simple, i.e. maintain which panel bar item is highlighted, across different page loads. I'm using this as a menu, and it looks good with the selected menu item highlighted as soon as I click it, when when the link (page) for that menu item returns, the menu is reloaded and I lose this.</p>
<p>I don't really want to use ajax calls to manage session variables just for this if I can keep in local, but where else can I store this menu state?</p>
| javascript | [3] |
4,124,058 | 4,124,059 | java.nio.channels.* | <p>What is up with nio channels ? There were some nice talks when it was added to java but I still don't see people using it in their applications.</p>
<p>Is there something wrong with it, or am I just not encountering people who use it? </p>
<p>Any nice examples as to why I should bother using it at all ?</p>
<p>Thanks</p>
| java | [1] |
56,269 | 56,270 | return by value assigned to const reference | <p>I was fixing another bug in some code and came across some code that I would have thought was a bug; however, this code compiles under gcc 4.4, 4.5, and 4.6 and appears to function as "expected". Can anyone tell me if this is valid c++?</p>
<pre><code>struct foo {
int bar;
};
foo myfunction(foo const &orig) {
foo fooOnStack = orig;
fooOnStack.bar *= 100;
return fooOnStack;
}
void myOtherFunction(foo const &orig) {
foo const &retFoo = myfunction();
// perhaps do some tests on retFoo.bar ...
}
</code></pre>
<p>If this is valid c++, does anyone know the rationale behind this being legal?</p>
| c++ | [6] |
663,933 | 663,934 | My ASP.NET application is not working on the server, but it works in my development environment. | <p>My ASP.NET application is not working on the server, but it works in my development environment. </p>
<p>How do I go about debugging this? </p>
| asp.net | [9] |
2,847,838 | 2,847,839 | JAVA Getting a nullpointer exception in an "if" statement? | <pre><code>public void display(Date date) {
boolean loop = true;
System.out.println("Events on " + date.toString());
for (int i = 0; i < schedule.length; i++) {
while (loop) {
Date tmp = schedule[i].nextOccurrence();
if (tmp.compareTo(date) == 0) {
System.out.println(schedule[i].nextOccurrence().toString());
}
}
schedule[i].init();
}
}
</code></pre>
<p>The above is supposed to print out an occurrence of an event if it falls on the date given to the method. The method nextOccurrence grabs the next occurrence of an event (if its weekly or daily). nextOccurence looks like this for a DailyEvent:</p>
<pre><code>public Date nextOccurrence() {
if (timesCalled == recurrences) {
return null;
}
else {
Calendar cal = Calendar.getInstance();
cal.setTime(startTime);
cal.add(Calendar.DATE, timesCalled);
timesCalled++;
return cal.getTime();
}
}
</code></pre>
<p>I call schedule[i].init() to reset the number of times called to 0 (daily events have a limit of number of times they can be called, denoted as an int with the variable recurrences).</p>
<p>Basically, my problem is that I'm getting a NullPointerException for this line:</p>
<pre><code>if (tmp.compareTo(date) == 0) {
</code></pre>
<p>I've tried everything and I'm completely lost.
Any help would be great!</p>
| java | [1] |
4,232,533 | 4,232,534 | Python 2to3 windows CMD | <p>I have installed python 32 package to the </p>
<blockquote>
<p>C:\python32</p>
</blockquote>
<p>I have also set the paths:</p>
<blockquote>
<p>PYTHONPATH | C:\Python32\Lib;C:\Python32\DLLs;C:\Python32\Lib\lib-tk;</p>
<p>PATH ;C:\Python32;</p>
</blockquote>
<p>I would like to use the "2to3" tool, but CMD does not recognize it.</p>
<pre><code>CMD: c:\test\python> 2to3 test.py
</code></pre>
<p>Should i add an extra path for "2to3" or something? </p>
<p>Thanks</p>
| python | [7] |
641,995 | 641,996 | java miliseconds find closest to current time | <p>I have following code </p>
<pre><code>for(int i=0; i<a.length; i++){
diff[i] = a.getTime() - b.getTime();
}
a.getTime() = time in array.
b.getTime() = current time on computer.
</code></pre>
<p>What would be the best way to find which one of a.getTime is nearest to current time?</p>
<p>Output diff:</p>
<pre><code>-143214521
32942394
-132931
-21340
</code></pre>
<p>Thank you!</p>
| java | [1] |
3,400,285 | 3,400,286 | Trying to close window after alert | <p>Ok so I have a page that will post info to the database then it returns to a different page. The only thing is now they want the page to auto close once the alert comes up telling them the database stuff has been saved. I have it on a php page under the conditional if statement and then running javascript from there. The only thing that isnt working it the close. I have tried window.close and self.close and just close() but nothing seems to be working any ideas. Also trying this in Chrome.</p>
<pre><code>if( $_POST['finished'] == 'Send' )
{
(this is just DB stuff here)
echo "<script type='text/javascript'>ConfirmStatus = confirm('Thank you for entering the information.')
if (ConfirmStatus == true) {
self.close();
}</script>";
}
</code></pre>
| javascript | [3] |
4,245,797 | 4,245,798 | What is the quickest way to randomize a data set? | <p>For a multiple choice quiz application i would like to show the dummy answers with the correct answer. But with the correct answer being in a different position at each different question.</p>
<p>This is what i've tried but it doesn't seem to be working:</p>
<pre><code>if ($question->type == 1)
{
echo "<div id='dummy_answers'>";
//Show Dummy
echo '<h3>Dummy Answers</h3>';
//Get Dummy Answers
$query = $this->test_model->getDummyAnswers($question->id);
$dummy_num = 1;
foreach ($query->result() as $row)
{
$rand_number = rand(1, 3);
if ($dummy_num == $rand_number)
{
$dummy_num = $rand_number + 2;
echo '<h4>Answer '.$dummy_num.'</h4>';
echo '<p>';
echo $row->option;
echo '</p>';
//Now echo the real answer
echo '<h4>Answer '.$rand_number.'</h4>';
echo '<p>';
echo $row->option;
echo '</p>'; //Get id's for each.echo $row->id;
}
else
{
echo '<h4>Answer '.$dummy_num.'</h4>';
echo '<p>';
echo $row->option;
echo '</p>';
$dummy_num++;
}
}
echo '</div>';
echo ' <hr/>';
}
?>
</code></pre>
| php | [2] |
2,744,951 | 2,744,952 | Android handle HTML links and typed links in a TextView | <p>I am trying to handle both HTML and typed links in TextViews and I am unable to find a combination of the built in tools to do this. I can make one or the other work but not both.</p>
<p>Given the following formats</p>
<pre><code>http://google.com
<a href="http://google.com/">Google!</a>
</code></pre>
<p>Using .setMovementMethod(LinkMovementMethod.getInstance()) I can make the anchor tag turn into a link and open a webpage on click. Using .setAutoLinkMask(Linkify.ALL) I can make the typed link work as expected. The problem is setAutoLinkMask disables the setMovementMethod functionality and removes the highlighting it creates on the html link as well as its clicking functionality.</p>
<p>I tried searching for others with this issue and I believe I am being blocked by a lack of proper terms for this situation. Has anyone else come across a solution to handle both cases seamlessly?</p>
<p>This is what I have currently, only the typed link is linked in the TextView, the anchor just displays the text it wraps.</p>
<pre><code>mTextViewBio.setText(Html.fromHtml(htmlstring));
mTextViewBio.setAutoLinkMask(Linkify.ALL);
mTextViewBio.setMovementMethod(LinkMovementMethod.getInstance());
mTextViewBio.setLinksClickable(true);
</code></pre>
<p>TextView output:</p>
<p><a href="http://google.com" rel="nofollow">http://google.com</a><br />
Google!</p>
| android | [4] |
633,405 | 633,406 | javascript date.parse difference in chrome and other browsers | <p>I have a date string "2011-11-24T09:00:27+0000" fetched from the graph.facebook API.</p>
<p>When I run </p>
<pre><code>var timestamp = Date.parse(facebookDate);
</code></pre>
<p>in chrome. I get a timestamp that relates to the date! perfect!</p>
<p>But in EVERY other major browser... I get "NaN" !!! ?</p>
<p>Surely all these browsers use the same javascript parse function right?</p>
<p>Can anybody explain why the same javascript function give different results?</p>
<p>And can anybody also tell me how to fix this issue...</p>
<p>Thanks in advance</p>
<p>Alex</p>
| javascript | [3] |
5,319,805 | 5,319,806 | Show multiple RoutePaths from same GeoPoint in Android | <p>I wanted to show two Route Paths from same GeoPoint means from A-B and A-C.<br/><br/>
Route1 contains GeoPoints from A-B and Route2 contains GeoPoints from A-C. Please help me.</p>
| android | [4] |
5,680,870 | 5,680,871 | Change website language | <pre><code>string text = "我喜欢跑步。";
TranslateClient client = new TranslateClient(/* Enter the URL of your site here */);
string translated = client.Translate(text, Language.ChineseSimplified, Language.English);
Console.WriteLine(translated); // I like running.
</code></pre>
<p>It is working fine. But I want to pass whole site as an input and convert into selected language. How can I do this?</p>
<p>Ex : <a href="http://translate.google.com/#" rel="nofollow">http://translate.google.com/#</a></p>
| c# | [0] |
2,475,883 | 2,475,884 | Unmodifiable Vector in Java | <p>I need to manage data in my program where Java-Vector suits the purpose as it is synchronized,provides dynamic size and fast random access through index.</p>
<p>But I want to make my Vector Read Only for other Program Classes and Read Write for my own Class.</p>
<p>I read about <code>Collections.unmodifiableList()</code> ,but if I make my <code>Vector</code> unmodifiable, it will become read-only to my class as well.</p>
<p>How can I solve this problem?</p>
| java | [1] |
4,238,370 | 4,238,371 | Error when I try to add styles with jquery | <p>I get this error:</p>
<blockquote>
<p>Uncaught SyntaxError: Unexpected token ILLEGAL</p>
</blockquote>
<p>When I run this code:</p>
<pre><code>$('.field table[border!="0"] td').css({
border: 1px solid black,
color: red
});
</code></pre>
<p>I can't see what the error is.</p>
<p>UPDATE:</p>
<pre><code>$('.field table[border!="0"] td').css({
border-width: '1px',
border-style: 'solid'
});
</code></pre>
<p>the error is: </p>
<blockquote>
<p>Uncaught SyntaxError: Unexpected token -</p>
</blockquote>
| jquery | [5] |
5,885,428 | 5,885,429 | how to nest if and else statement using ternary operator in PHP? | <p>am confused with using this ternary operator, i can easily get 1 level if and else
e.g</p>
<pre><code>($blah == $blah) ? blahblah : blahblahblah;
</code></pre>
<p>but what if the condition is like this?</p>
<pre><code>if($blah == blah1)
{
echo $blah1;
}
else if($blah == blah2)
{
echo $blah2;
}
else
{
echo $blah;
}
</code></pre>
<p>how to convert this using ternary operator ?</p>
| php | [2] |
2,193,533 | 2,193,534 | canvas not redrawing correctly | <p>I am writing a simple view that will show a dot, after some action, show the next dot. The dots are on a vertical strip. so I create a function that'll clear the strip. then draw a circle at the position where I want the dot. the code segment is as followed.</p>
<pre><code>private void clear_strip(){
paint.setColor(Color.BLACK);
paint.setStyle(Paint.Style.FILL_AND_STROKE);
m_canvas.drawRect( 0, 0,width/8, height, paint);
paint.setColor(Color.GREEN);
}
private void set_dot(){
clear_strip();
m_canvas.drawCircle(width/10, (int) (font_height*(scoreboard.current_batter_position()+0.5))/1, font_height/4, paint);
}
@Override
protected void onDraw(Canvas canvas) {
set_dot();
canvas.drawBitmap(m_bitmap, 0, 0, paint);
}
</code></pre>
<p>but one of the dot is just not updating. It'll keep the old dot, skip that dot, then move to the next dot. I tried to print out the position to logcat right before the drawCircle call, and the position is right, it's just not drawing (and not clearing as well)....please advise.</p>
| android | [4] |
2,998,453 | 2,998,454 | How do I develop a large whitelist of pages for a PHP include? | <p>It's clear that for any reasonable-sized website, building it in modules using PHP includes has great advantages, so I chose to dynamically create the page content using includes. I was against the idea of including the header and footer, so I did the inverse like this (index.php):</p>
<pre><code> if(isset($_GET['page']))
{
$whitelist = array("contact","about","access", etc.);
if(in_array($_GET['page'], $whitelist))
{
include($_GET['page'].".php");
}
}
else
{
include('home.php');
}
</code></pre>
<p>Some people object to this on security grounds (although they never give an alternative), but I find it to be a neat solution. My question is, what happens when my site has hundreds or even thousands of pages? Do I just keep adding variables to the whitelist array until it becomes huge, or is there a better way?</p>
| php | [2] |
5,013,721 | 5,013,722 | how to check the content of a variable on submit | <p>I have a form that takes some post code, I'm trying to check the given post code by the user with the pre-defined post-code variable</p>
<pre><code> <form id="post_code">
<input name="textfield" type="text" id="postcode" size="8" maxlength="8" />
<input type="image" id="submit_postcode" src="images/B_go.png" alt="Submit Postcode" width="59" height="24" border="0" />
</form>
var districtPostcodes = ['B1', 'B2', 'B3','B4'];
$("#submit_postcode").submit(function(){
var userPostcode = $("#postcode").val().replace(/[^a-zA-Z0-9]/gi,'').toUpperCase();
$.grep(districtPostcodes , function(val, i){
if(userPostcode.indexOf(val) === 0){
alert("Users postcode is part of district: "+val);
return true;
}else{
return false;
});
});
</code></pre>
<p>Thanks for your help.</p>
| jquery | [5] |
5,577,108 | 5,577,109 | Java new Date() in print | <p>just learning Java and I know this may sound stupid but I have to ask. </p>
<pre><code>System.out.print(new Date());
</code></pre>
<p>I know that whatever is in the argument is converted to a string, the end value that is,
<code>new Date()</code> returns a reference to a Date object. So how is it that it prints this?</p>
<pre><code>Mon Aug 29 13:22:03 BST 2011
</code></pre>
<p>The only thing I can think of is somehow the function parses through all the data members gets their values converts them to a String and prints them.</p>
<p>If not how does it work? </p>
<p>Thanks</p>
| java | [1] |
995,567 | 995,568 | referencing class variable by a string | <p>This is some pseudo code represents my code which you wouldn't inderstand scope.</p>
<p>Class Tester has private vars, hold classes.
Array holds the base name of var.
Function bar attempts to contruct the variable in string from, then use it.
If this can't be done I understand, but i'm just constructing a variable name.</p>
<pre><code>Class Tester{
private $preClass1post = new TestClass1();
private $preClass2post = new TestClass2();;
private $preClass2post = new TestClass2();;
public $classBasicNames = array('Class1','Class2','Class3');
function Bar(){
foreach($classBasicNames as $classBasicName){
$fullClassName = 'PreText'.classBasicName.'PostText';
$fullClassName->DoWork();
//always throws object does not exist
}
}
}
//actual code for context
$mapperName = 'mapper'.$entityName.'Stat';
echo $mapperName;
$dbos = $this->{$mapperName}->fetchAll($options);
</code></pre>
| php | [2] |
4,291,644 | 4,291,645 | Jquery plugin help | <p>Looking for a Fixed header, frozen column, sortable table plugin for jquery any pointers will be helpful.</p>
| jquery | [5] |
2,897,422 | 2,897,423 | The timer works fine if it's coded inside a button_click event handler, but it doesn't work if it is inside a method | <p>I found timer code from a web site and used it in my application and it works fine if I use the timer code inside a button_click handler, but I need to use the timer when I call a method, so I did copy and paste the same code from the button_click into the method but the timer always gives me zero. How do I fix it?</p>
<p>The following is the timer code.</p>
<pre><code>public partial class Form1 : Form
{
//Timer decleration
DateTime startTime, StopTime;
TimeSpan stoppedTime;
bool reset;
bool startVariabl = true;
// The rest of the code..
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
if (startVariable) startMethod();
//
//The rest of the code...
}
private void startMethod()
{
//Timer
tmDisplay.Enabled = true;
// Reset display to zero
reset = true;
lblElapsed.Text = "00:00.00.0";
// Start timer and get starting time
if (reset)
{
reset = false;
startTime = DateTime.Now;
stoppedTime = new TimeSpan(0);
}
else
{
stoppedTime += DateTime.Now - StopTime;
}
}
private void tmDisplay_Tick(object sender, EventArgs e)
{
DateTime currentTime;
//Determine Ellapsed Time
currentTime = DateTime.Now;
// Display Time
lblElapsed.Text = HMS(currentTime - startTime - stoppedTime);
}
private string HMS(TimeSpan tms)
{
//Format time as string; leaving off last six decimal places.
string s = tms.ToString();
return (s.Substring(0, s.Length - 6));
}
</code></pre>
<p>I am new C# learner.</p>
| c# | [0] |
4,443,488 | 4,443,489 | How to get and disect the query string appended into a url? PHP | <p>I am trying to develop a PHP class which would enable me to get the query string appended into a url and process it according to the variables passed. How can this be done?</p>
<p>Eg</p>
<pre><code>www.example.com?var1=a&var2=b&var3=c
</code></pre>
<p>now I want to get <code>?var1=a&var2=b&var3=c</code> section and process it based on the variables.</p>
<p>Thanks for your responses</p>
<p>but I want a means by which I can get the whole query string since I wont be sure of the variable names that will be sent into the URL thus the $_GET method wont work properly.</p>
<p>Thanks</p>
| php | [2] |
1,852,377 | 1,852,378 | Android - Basic question - link TextView to open new page (internal) | <p>Probably a really basic answer to this but google is throwing up nonsense. </p>
<p>Ok, so i have a bunch of nested linear layouts, each one contains a textview and an imageview. What i want is my textview to be linked so that when a user clicks on the text, it will take the user to a new page that is in the same project. Not a website or anything.</p>
<p>Appreciate any help!!</p>
| android | [4] |
1,571,258 | 1,571,259 | Memory address of reference variable | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1950779/is-there-any-way-to-find-the-address-of-a-reference">Is there any way to find the address of a reference?</a> </p>
</blockquote>
<p>When we print the address of actual variable and reference variable it shows same address why?</p>
| c++ | [6] |
1,151,974 | 1,151,975 | JavaScript check if start button is clicked | <p>I have a problem with my button. I'd like to keep playing my opening sound if the button has not been clicked; otherwise pause the sound and load the game. How can I achieve this? I've tried this so far to no avail.</p>
<pre><code>function showStartScreen(launch) {
//SHOW SPLASH SCREEN
var screen = document.getElementById("splash");
removeClass(screen, SPLASHSTATES.SPLASH_OFF);
addClass(screen, SPLASHSTATES.SPLASH_ON);
if(document.getElementById('startButton').click = false){
playSound(sndOpening);
}
else{
//CONFIGURE START BUTTON
var start = document.getElementById("startButton");
if (launch) {
start.innerText = "Start Game";
stopSound(sndOpening);
start.addEventListener("click", loadGame, false);
} else {
start.innerText = "Resume Game";
start.addEventListener("click", reloadGame, false);
}
} // end of outer if-else
//ANIMATE SPLASH SHOW
animatePanel(splash);
}
</code></pre>
<p>Any help is appreciated. thanks</p>
| javascript | [3] |
3,089,248 | 3,089,249 | Hide backend code from frontend dev in PHP | <p>Say I have domain.com/php/ with all my php functions, then I share a ftp account with the front-end developers for domain.com/frontend/, now the frontend can do their work and call "../php/" functions. Is this safe to assume my php code are protected? Or another way of asking, is there anyway for them to see the php source code or somehow copy/include those files then display them?</p>
| php | [2] |
5,002,679 | 5,002,680 | Leading zeros on JQuery Countdown Clock plugin | <p>I'm using a JQuery <a href="http://keith-wood.name/countdown.html" rel="nofollow">Countdown Clock plugin from here</a>.</p>
<p>Unfortunately I need to have leading 0 where there are single digits. For example 1:1:22 should display as 01:01:22.</p>
<p>Can anyone help with this?</p>
<p>Thanks</p>
| jquery | [5] |
835,767 | 835,768 | I am defining actionbars in android. How do I add new actions and on click listener to each action? | <p>I am working with action bars for the first time and would like to know for certain examples that show how to add new actions/buttons to the action bar and an intent on each button to load other classes. </p>
<p>A small code snippet with an xml layout would be of much help. </p>
| android | [4] |
4,301,065 | 4,301,066 | Capture the previous value when onkeydown is executed | <p>Need help in event handling. In my scenario, I have a textbox with default value 35 and cursor is set to before the 3. There is a event for this text box which is onkeydown. When I press 4, IE and Safari captures the previous value of the text which is 35. But Mozilla and Chrome captures the new value which is 435.</p>
<p>I need the javascript code which can capture the previous value of the textbox when onkeydown is fired. </p>
<p>Need your hands :(</p>
| javascript | [3] |
3,869,551 | 3,869,552 | Ant: not able to find tools.jar | <p>when I type Ant in command line..
I get following error.. </p>
<p>Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
Buildfile: build.xml does not exist!
Build failed</p>
| java | [1] |
2,232,080 | 2,232,081 | Printing a variable in PHP does not work | <p>I've got this piece of code:</p>
<pre><code><?php
$userid = $me['id'];
function showifuserexists() {
?>
<html>
<head></head>
<body>
<a href="file.php?element1=aaa&userid=<?php print $userid; ?>">
</body>
</html>
<?php
}
?>
</code></pre>
<p>For some reason I can't get the php <code>$userid</code> to show up in the html link. I've tried <code>echo</code> too. Help?</p>
| php | [2] |
1,213,443 | 1,213,444 | jQuery ajax error is always "timeout" even when i'm giving wrong user/pwd | <p>I'm calling a SOAP webservice with jQuery ajax method. It works fine if there isn't a problem, but now I'm doing some tests, for example giving a wrong user name/password and the error that I receive is not the expected 401: Unauthorized. The call waits until the timeout is exceeded and then returns a timeout error...</p>
<p>I've tried my web service with wrong credentials on SOAPUI and I get the Unauthorized instant error message. My javascript call is the following:</p>
<pre class="lang-js prettyprint-override"><code>$.ajax({
url : soapURL,
type : 'POST',
username : settings.get('user'),
password : settings.get('pwd'),
timeout : '30000',
dataType : 'xml',
data : soapReq,
success : soapSuccess,
error : soapError,
contentType : 'text/xml; charset=\"utf-8\"',
beforeSend : function() {
$('#loader').show();
},
complete : function() {
$('#loader').hide();
}
});
</code></pre>
<p>And here the error callback function:</p>
<pre class="lang-js prettyprint-override"><code>function soapError(jqXHR, textStatus, errorThrown) {
alert('Ajax error: ' + textStatus);
}
</code></pre>
| jquery | [5] |
3,058,690 | 3,058,691 | Variable in a while($row loop | <p>Can i put a variable inside this </p>
<pre><code>while($row = mysql_fetch_array($result))
</code></pre>
<p>ie </p>
<pre><code>while($row = mysql_fetch_array($result) and color = '$color')
</code></pre>
<p>I basically am calling a query but want to report on it in sections - in this case color by color. So i'd like to loop around all my colors variables running the while loop for each one</p>
| php | [2] |
570,391 | 570,392 | Android Development: set a program as default | <p>How do i make my program load as default example for a url link?</p>
<p>Thank you!</p>
<p>PS* sorry for last missunderstanding Question! </p>
| android | [4] |
253,586 | 253,587 | removing html tags using a for loop in Java | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/240546/removing-html-from-a-java-string">Removing HTML from a Java String</a> </p>
</blockquote>
<p>I am having a problem removing htmls tags from a text file in java. I know it would be easy to use something like</p>
<pre><code>str=str.toString().replaceAll("\\<.*?>","");
</code></pre>
<p>However I want to know if I could split the string and go throught and replace everything srarting from < to > with "". </p>
<p>I tried </p>
<pre><code>String [] str= "<tag>with some string </tag>";
String s="";
for (i=0; i < str.length; i++)
{
if (str[i].toString()=="<")
{
str[i]="";
}
else if (str[i].toString()==">")
{
s=s+str[i+1];
}
}
</code></pre>
<p>when i try printing the new string s, it just prints out with just white space.
thanks for the help</p>
| java | [1] |
45,461 | 45,462 | asp.net add value to form method | <p>Basically I want to place a url in the form action method.</p>
<p>The ltlUrl.text value is added on the server side in pageLoad.
How do i use the ltlUrl as the action method?</p>
<pre><code> <form action="<%# ltlurl.text%>" enctype="multipart/form-data">
<input type="text" name="title" value="test" />
<input type="file" name="file" />
<input type="submit" />
</form>
</code></pre>
<p></p>
| asp.net | [9] |
3,838,223 | 3,838,224 | cant create array with STRING key | <p>Im trying to create an <strong>associative</strong> array with objects, the key should always be a <strong>string</strong> (but they are always numbers).
This is how i store them (recording user clicks):</p>
<pre><code>App.Recording[currentTime.toString()] = {sound: buttonName.toLowerCase() };
</code></pre>
<p>When trying to do this:</p>
<pre><code>var save = {};
save.recording = App.Recording;
console.log(JSON.stringify(save));
</code></pre>
<p>I get this:</p>
<pre><code>{"recording":[null, null,{"sound":"e"},null,null,null,.......,null,null,null,null,{"sound":"e"},....,null, null...]}
</code></pre>
<p>So, the <code>toString()</code> doesnt work on <code>currentTime.toString()</code>, which make my array store <code>currentTime</code> as numbers instead...</p>
<p>How can I save the objects and have an associative array?</p>
| javascript | [3] |
4,286,323 | 4,286,324 | click() event doesn't need full class name? | <p>I have these input objects as follows,</p>
<pre><code> <input type='radio' class="but option" value='Yesterday'>
<input type='radio' class="but option" value='Last Week'>
<input type='radio' class="but option" value='Last Month'>
<input type='radio' class="but option" value='All Time'>
</code></pre>
<p>and I have a jquery click event handler that says <code>$(".but").click(function() {</code></p>
<p>These input objects are getting caught in this event handler and I'm wondering why when their class names are not "but"</p>
| jquery | [5] |
3,668,209 | 3,668,210 | What does num>>1 mean in c++? | <p>I know this is a very simple question, but I'm having trouble finding the answer on google as it ignores the "<<" characters. If you have any advice for how I should search for things like this in the future that would also be much appreciated. I seem to recall its some kind of bitshift or something? But I don't really know what that means or how it works whether its just -1 or something else as if it is I don't know why the person wouldn't just use -1. Thanks</p>
| c++ | [6] |
3,780,089 | 3,780,090 | Have huge prob how to move in Canvas | <p>I have a Android program which you type in equation and them program display you in "new" layout a graph, its like coordinate system.You have function line, x line, y line... like school basic, you know, easy one.
But if your equation numbers are to hight like: "x*x*40" your graph line is to big to be on display. So here i need yur help.
In android you can move picture up, down, left, right, zoom,... and i what to do same with a graph.I found a tutorails like this one:http://obviam.net/index.php/displaying-graphics-with-android/
,but this contains picture and i dont have picture!I have no picture or what so ever. Program works in Canvas and draw lines with command like this:"g.drawLine(x1, y1, x2, y2, color);" and the and it looks somethink like this in full screen:</p>
<p><a href="http://grockit.com/blog/collegeprep/files/2009/12/14.JPG" rel="nofollow">http://grockit.com/blog/collegeprep/files/2009/12/14.JPG</a></p>
<p>So here is problem how to move like picture but its not a picture. In a lot of examples you must have a picture like R.drawable.image, but here are just calculated lines.
I have one idea how to do it, but its probably stupid:
-if you made a graph bigger than your screen (much bigger) and than do a screenshot, save like picture and than move like picture as in example</p>
<p>(if you need more explanation i can do it) sry if my English was bad :(</p>
<p>Thank you</p>
| android | [4] |
5,161,497 | 5,161,498 | Make a div or list element select/trigger a radio input button on click with jQuery? | <p>I'm not sure if this possible but probably is fairly simple.</p>
<p>I've made a fiddle <a href="http://jsfiddle.net/WTSWP/1/" rel="nofollow">http://jsfiddle.net/WTSWP/1/</a> or the kind of situation I'm in.</p>
<p>I've got multiple radio inputs, each contained by a div/li, and what the containing element to select the radio button when clicked.</p>
<p>I'm using jQuery to so if anyone has ideas using jquery that would be great thanks.</p>
<p><br /></p>
<p>I started this but isn't working right.</p>
<pre><code>$(".select-area").click(function() {
$(this).find('input').trigger('click');
});
</code></pre>
<p><br /></p>
<pre><code><li class="select-area">
<input type="radio" name="colour" value="black">
</li>
</code></pre>
<p><br /></p>
<p><img src="http://i.stack.imgur.com/Yo0eb.png" alt="enter image description here"></p>
<p><br /></p>
<p>Fiddle here <a href="http://jsfiddle.net/WTSWP/1/" rel="nofollow">http://jsfiddle.net/WTSWP/1/</a></p>
| jquery | [5] |
4,061,797 | 4,061,798 | Is it possible to configure an Android install to run a single app? | <p>Is it possible to configure the Android OS to run only a single app?</p>
<p>Basically what I want to do is customize an Android device so that it boots up and runs one application only, and for that application to be switched to the front of the screen automatically. Also, when it gets closed, to be started up and switched to again. Any ideas?</p>
<p>Thanks,
-David</p>
| android | [4] |
2,019,412 | 2,019,413 | Dynamic query with varying variables? | <p>Sorry if the title seems misleading, I wasn't sure of the best way to put it.</p>
<p>I have a 2 column table, in the table there's a list of USER_ID's and INTEREST's. </p>
<p>On my page I have a query which calls all interests and puts them into a jquery marquee. </p>
<p>I would like to make each value link to a page that then runs a query and displays all USER_ID's with the same INTEREST. </p>
<p>In my head the only way (I know how) is to have a list of IF statements that contain queries, so </p>
<pre><code>if($value = 'soccer'){run query that gets all users with soccer as interest}
elseif($value = 'tennis'){run query that gets all users with tennis as interest}
and so on...
</code></pre>
<p>as the values wont be set its impossible for me to write this page, Whats the best way to build this? </p>
<p>Im still a brginner with PHP so any helps greatly appreciated!
Thanks</p>
| php | [2] |
1,870,942 | 1,870,943 | Defining a constant/declaring an array | <p>I am trying to declare two arrays, one 2D and one 1D. I know the dimensions need to be const values. So the const value is assigned from the return value of a function call. That goes well, but when I use the derived value to declare the array, COMPILE errors! WHY???</p>
<p>Here is my code:</p>
<pre><code>int populateMatrixFromFile(string fname) {
std::ifstream fileIn;
int s = determineDimensions(fname); // return value (CONST INT)
const int size = s; // assign to const
cout << "Value returned from determineDimensions(): " << size << endl;
if (size > 10){
cout << "Maximum dimensions for array is 10 rows and 10 columns. Exiting" << endl;
return 1;
}
fileIn.open(fname.c_str(), ios::in); //opened for reading only.
float aMatrix[size][size]; // ERROR
float bMatrix[size]; // ERROR
</code></pre>
<p>BUT it works here:</p>
<pre><code> // assign the pth row of aMatrix to temp
const int alen = sizeof (aMatrix[p]) / sizeof (float);
float temp[alen]; // WORKS!!!
for (size_t i = 0; i < alen; i++) {
temp[i] = aMatrix[p][i];
}
</code></pre>
<p>Thanks for all help.</p>
| c++ | [6] |
4,705,585 | 4,705,586 | Math.Round vs String.Format | <p>I need double value to be rounded to 2 digits.
What is preferrable?</p>
<pre><code>String.Format("{0:0.00}", 123.4567); // "123.46"
Math.Round(123.4567, 2) // "123.46"
</code></pre>
| c# | [0] |
621,549 | 621,550 | Windows Forms: how to drag and drop a .xml file on a TextBox? | <p>I have a Windows Forms TextBox in which I want to allow the user to drag and drop a file from Windows Explorer.
I would like to allow only for dropping an .xml file (path) on the TextBox.
The way of testing the file format to be dropped, on the DragEnter event, is:</p>
<pre><code>private void DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text))
e.Effect = DragDropEffects.Move;
else
e.Effect = DragDropEffects.None;
}
</code></pre>
<p>The DataFormats above doesn't contain Xml. If I use DataFormats.FileDrops, I allow any types of files to be dropped, as far as I understood.
Any ideas?
Thanks in advance!</p>
| c# | [0] |
1,608,092 | 1,608,093 | Java ArrayList problem (involves valueOf()) | <p>So I have this function, combinations, which adds to an arraylist all permutations of a string.</p>
<pre><code> public static void combinations(String prefix, String s, ArrayList PermAttr) {
if (s.length() > 0) {
PermAttr.add(prefix + s.valueOf(s.charAt(0)));
combinations(prefix + s.valueOf(s.charAt(0)), s.substring(1), PermAttr);
combinations(prefix, s.substring(1), PermAttr);
}
}
</code></pre>
<p>Now, I have this arrayList tryCK which let us say is {"A","B"}.</p>
<p>I have another arrayList CK which is also {"A","B"}, but it was derived from the combinations function above.</p>
<p>When I do tryCK.equals(CK) it returns true.</p>
<p>But when I put it through a another function I have on both tryCK and CK, for tryCK it returns true and CK it returns false, even though they are exactly the same lists.</p>
<p>So, my question is, does using .valueOf(s.charAt()) change some inner type?</p>
<p>This is super hard to explain but I do not want to post the full code.</p>
| java | [1] |
4,458,413 | 4,458,414 | Can parent and child class in Java have same instance variable? | <p>Consider these classes:</p>
<pre><code>class Parent {
int a;
}
class Child extends Parent {
int a; // error?
}
</code></pre>
<p>Should the declaration of <code>a</code> in <code>Child</code> not give compilation error due to multiple declarations of <code>int a</code>?</p>
| java | [1] |
949,449 | 949,450 | Non-aligned pointer being freed, in Java? | <p>This would be simple to track down in Objective-C, but in Java I thought this kind of thing was impossible. The error I'm seeing is:</p>
<pre><code>java(7198,0x124a13000) malloc: *** error for object 0x1003109c1: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
</code></pre>
<p>How would I set a breakpoint of this type in Java? Or, how would I track down the object in question? That memory address is NOT the hashCode, right?</p>
| java | [1] |
4,418,170 | 4,418,171 | Closest textarea w/ jQuery | <p>I am trying to select a value from a drop-down and on select enter its value in the textarea that follows this selector. I tried defining my var but failed:</p>
<pre><code>var input = $(this).closest("input")
</code></pre>
<p>I don't want to assign IDs since I have the same combination repeat on the page more than once, i.e. selector -> textarea. </p>
| jquery | [5] |
4,491,660 | 4,491,661 | Is it possible to load MainWindow programatically | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/809898/loading-a-view-controller-view-hierarchy-programatically-in-cocoa-touch-withou">Loading a view controller & view hierarchy programatically in Cocoa Touch without xib</a> </p>
</blockquote>
<p>I know it can load via set MainWindow in Target Summary.
It show as</p>
<p><img src="http://i.stack.imgur.com/KLMwW.png" alt="enter image description here"></p>
<p>Is it possible to load MainWindow programatically</p>
<p>Welcome any comment</p>
| iphone | [8] |
3,777,731 | 3,777,732 | As java doesn't have referencing, how does one pass information between two separate classes? | <p>Sorry for the extremely vague/confusing, I really didn't know how to name this issue. If someone has a better one please feel free too edit it. Onto my issue,</p>
<pre><code>public class Foo()
{
String name;
public Foo()
{
Bar temp = new Bar();
}
}
public class Bar()
{
public Bar()
{
setFooName("newName");
}
public void setFooName(String name)
{
// Is it possible call a method in Foo?
}
}
public class test {
static public void main(String[] args)
{
Foo foobar = new Foo();
}
}
</code></pre>
<p>I'm still new to java so I'm not sure if this is even possible, but using C++ I'd normally have a local variable of the 'Foo' inside the 'Boo' class and then pass a reference to the object into the constructor of Bar and then assign it to the local variable in Bar.</p>
<p>As java doesn't have referencing I'm stuck on the matter. The reason I want to do this is the example I have is I need to create a GUI object inside of a class and then have information from the GUI object sent back to the class it was created in.</p>
<p>I do hope this all makes sense, if it doesn't, sorry.</p>
| java | [1] |
1,074,513 | 1,074,514 | cannot assign return value from fetch_assoc() | <p>I write the php </p>
<pre><code>$query = "SELECT privilege , no, userName FROM $tableName WHERE userName =
'$inputAccount' and password = '$inputPassword'";
$result = $mysqli->query($query);
if($result){
while ($row = $result->fetch_assoc()) {
printf ("%s %s %s\n", $row["privilege"], $row["no"], $row["userName"]);
}
}
</code></pre>
<p>the result is <code>user 2 test</code></p>
<pre><code>session_start();
$_SESSION["privilege"]=$row["privilege"];
$_SESSION["no"]=$row["no"];
$_SESSION["userName"]=$row["userName"]
echo $_SESSION["privilege"] ;
echo $_SESSION["no"];
echo $_SESSION["userName"];
</code></pre>
<p>but the result comes to none things and I have fix it for a long time and cannot find why?</p>
<p>Thx in advance. </p>
| php | [2] |
4,404,053 | 4,404,054 | PHP Simple HTML DOM - Access values that has no identifiers | <p>Say I have this in the html</p>
<pre><code><strong class="top">Contact Person: </strong>
<br>
Shan
<strong class="top">Email-id: </strong>
<br>
<span>abshanai@gmail.com</span>
<br>
<strong class="top">Website:</strong>
www.absgym.co.in
</code></pre>
<p>is it possible to get the values using simple html DOM?</p>
| php | [2] |
1,016,435 | 1,016,436 | JQuery Chrome and Firefox Compatibility Issue ($.each, $.click) | <p>The following code does absolutely nothing in Safari or Chrome (I've checked the error console too, and there's nothing), but it does work on Firefox. I just need to hide and show certain elements (<code><tr></code>'s on a table) whenever a <code><select></code> option is pressed.</p>
<p>Sample code: <a href="http://jsfiddle.net/bHjpM/7/" rel="nofollow">http://jsfiddle.net/bHjpM/7/</a></p>
<p>Any thoughts? Thanks in advance.</p>
<p>EDIT: Updated to show the <code><select></code> in the HTML</p>
<p>EDIT2: I need to hide/show the <code><tr></code>'s on the table, not <code><div></code>'s.</p>
<p>FINAL EDIT: Problem has been fixed, lesson is don't use click event if you want to know when an option on a select tag is changed.</p>
| jquery | [5] |
4,133,029 | 4,133,030 | transparent socks redirector Apache License | <p>I'm currently creating an Android application thaw will set http, https, socks and ftp transparent proxy configuration. I found existing application and I tried to use their socks redirector but lately I found out that it is under GNU license.</p>
<p>Are they any socks redirector under Apache License? I researched and I found some but under GNU/GPL.</p>
| android | [4] |
2,849,351 | 2,849,352 | Will Application_Start also be triggered on page update? | <p>If I upload a new version of my site to my live server by using FTP and the "Replace existing files" option, will the "Application_Start" event in my Global.asax file be triggered once its uploaded? </p>
<p>If not, when does it trigger? Do I have to restart the server after an upload to do it?</p>
<p>Thanks in advance.</p>
| asp.net | [9] |
1,689,813 | 1,689,814 | Solution: Android INSTALL_FAILED_INSUFFICIENT_STORAGE error | <p>The INSTALL_FAILED_INSUFFICIENT_STORAGE error is the bane of every Android developer's life. It happens regardless of app size, or how much storage is available. Rebooting the target device fixes the problem briefly, but it soon comes back. There are hundreds (if not thousands) of message board posts from people asking why the problem occurs, but the folks at Google are frustratingly silent on the issue.</p>
<p>There is a simple workaround. If your test device is running Android 2.2 or later then add the <strong>android:installLocation</strong> attribute to your application's manifest file, with the value "<strong>preferExternal</strong>". This will force the app to be installed on the device's external storage, such as a phone's SD card.</p>
<p>For example:</p>
<pre><code> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.andrewsmith.android.darkness"
android:installLocation="preferExternal"
</code></pre>
<p>This is more of a band-aid than a fix, and it may not be ideal if you want your finished app to install on the device's internal memory. But it will at least make the development process a lot less frustrating.</p>
| android | [4] |
782,454 | 782,455 | Passing an array through url in php | <p>I wish to pass an array through url. I checked at <a href="http://stackoverflow.com/questions/1763508/passing-arrays-as-url-parameter">passing arrays as url parameter</a>. Isnt there any other way? Below is my code</p>
<pre><code>$result=Users.LoggedInUsers();
header('Location: http://localhost/Campus/Users.php?id='.$result.'');
</code></pre>
| php | [2] |
3,382,758 | 3,382,759 | Fastest way to increment a BitArray (binary number) by one? | <p>The following "Increment" method is working perfectly. But I wanted to know is there any faster way to do this in less steps.</p>
<pre><code> public BitArray Increment(BitArray bArray)
{
carry = true;
for (i = 0; i < 32; i++)
{
if (carry)
{
if (bArray[i] == false)
{
bArray[i] = true;
carry = false;
}
else
{
bArray[i] = false;
carry = true;
}
}
}
return bArray;
}
</code></pre>
<p>Thanks....</p>
| c# | [0] |
141,194 | 141,195 | with asp.net webform, how to have many login url? | <p>in the webconfig you normally have something like</p>
<pre><code> <authentication mode="Forms">
<forms loginUrl="Logon.aspx" name=".ASPXFORMSAUTH">
</forms>
</authentication>
</code></pre>
<p>is there a way to have many pages in the loginUrl ?</p>
| asp.net | [9] |
5,306,339 | 5,306,340 | List Scroll issue 2.1 vs 2.2 | <p>i have a listview L2 in a Linear layout L1, Now i think if the height of layout L1 containing the listview is less than the height of the Listview L2, and L1.height fits in the display i.e. L1.height < display screen height then my list would scroll, But my list srolls only in 2.1 avd and not in 2.2 avd! I am perplexed at this behaviour, anybody any idea, what could be causing this?</p>
<p>Thanks</p>
| android | [4] |
4,086,759 | 4,086,760 | Replace words dynamically with JavaScript | <p>With this line of code</p>
<pre><code>$("body").html($("body").html().replace(/1800/g,'6:00pm'));
</code></pre>
<p>I can replace the word, but how can I make it more dynamic with this script?</p>
<pre><code>var getFormattedTime = function (fourDigitTime){
var hours24 = parseInt(fourDigitTime.substring(0,2));
var hours = ((hours24 + 11) % 12) + 1;
var amPm = hours24 > 11 ? 'pm' : 'am';
var minutes = fourDigitTime.substring(2);
return hours + ':' + minutes + amPm;
};
</code></pre>
<p>My HTML code is e.g</p>
<pre><code>Your class will start at 1900, please be there by 1845.
</code></pre>
<p>Which will be counted to</p>
<pre><code>Your class will start at 07:00pm, please be there by 06:45pm.
</code></pre>
<p>I tried this:</p>
<pre><code>$("body").html($("body").html().replace(fourDigitTime, getFormattedTime(fourDigitTime)));
var fourDigitTime = document.getElementById('fourDigitTime').value;
var getFormattedTime = function (fourDigitTime){
var hours24 = parseInt(fourDigitTime.substring(0,2));
var hours = ((hours24 + 11) % 12) + 1;
var amPm = hours24 > 11 ? 'pm' : 'am';
var minutes = fourDigitTime.substring(2);
return hours + ':' + minutes + amPm;
};
</code></pre>
<p>It does not work..</p>
| javascript | [3] |
5,644,564 | 5,644,565 | im getting this error, how can i find out what is this error for | <p>help with this error please.</p>
<pre><code>java.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.OutOfMemoryError: Java heap space
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at com.genalytics.datapipe.rmi.SamplerServer_Stub.generateSampledMetaData(Unknown Source)
at com.genalytics.datapipe.rmi.SamplerClient.generateSampledMetaData(SamplerClient.java:143)
at com.genalytics.gui.modeling.GuiInfoPanel_Datapipe_SampleTab$GuiThread_GenerateSample.construct(GuiInfoPanel_Datapipe_SampleTab.java:757)
at com.genalytics.gui.common.GuiThread$2.run(GuiThread.java:97)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Java heap space
</code></pre>
| java | [1] |
1,257,449 | 1,257,450 | PHP using an HTML template | <p>I am having trouble reading in a file and using it as a template in PHP. A portion of my code is pasted below. For some reason it never finds $$USER_NAME$$ in the string so it never replaces. I also pasted the beginning part of my template below. </p>
<pre><code>$filename = "email/templates/welcome.txt";
$file = fopen($filename, "r")
$body = fread($file, filesize($filename));
fclose($file);
$body = str_replace("$$USER_NAME$$", "John Doe", $body);
print($body);
</code></pre>
<p>Template: </p>
<pre><code><p>
<img src="emailPic" alt="Logo" />
</p>
<p>Dear $$USER_NAME$$,</p>
<p>Thank you for registering to attend $$EVENT_NAME$$. We look forward to helping you reach your networking goals at $$EVENT_SHORT_NAME$$.
</p>...
</code></pre>
<p>Any ideas about why it wouldn't find $$USER_NAME$$ in the template?</p>
| php | [2] |
1,897,570 | 1,897,571 | Building a Mobile Device: Possible to use XHTML/CSS/JS? | <p>I'm building a general mobile device that will operate on Ubuntu x86. Is it at all possible, and decently scored in performance, to build said system from HTML/CSS/Javascript? I'm currently a frontend and backend web developer and designer. At this point, I'm writing the device in C++, but was thinking about converting it into a HTML/CSS/JS/Webkit combination.</p>
<p>It's very, very early stage (I'll have to rewrite probably 10 lines of code, literally) and is very graphics-based.</p>
<p>My device is kind of complex: it's a social messaging device that communiciates over wifi.</p>
<p>Thanks!</p>
<p><strong>EDIT:</strong> Clarification: there will be a C++-based foundation device API that will allow stuff to communicate to the device itself.</p>
| c++ | [6] |
2,344,034 | 2,344,035 | Error: [4] syntax error, unexpected T_LNUMBER occurred on line | <p>I am getting an error on this line in my php file. </p>
<pre><code>$output='<script>(function(){var cx = '000527094198246294321:3mrje2vs63g';var gcse = document.createElement(\'script\');gcse.type = 'text/javascript';gcse.async = true;gcse.src = (document.location.protocol == \'https:\' ? \'https:\' : \'http:\') + \'//www.google.com/cse/cse.js?cx=\' + cx;var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(gcse, s);})()
</script><gcse:searchbox></gcse:searchbox><gcse:searchresults></gcse:searchresults>';
</code></pre>
| php | [2] |
4,683,776 | 4,683,777 | Change Keyboard input language | <p>I am developing one android app in two different languages. When user click on "Change language" button it ask to choose language from two different languages option and change keyboard according to that language.</p>
<p>For example : User choose "Arabic" language then keyboard input language should automatically change from English to Arabic.</p>
<p>Please help me to resolve this issue. It's urgent for me.</p>
<p>Thanks in advance.</p>
| android | [4] |
3,171,245 | 3,171,246 | Generate Random Color distinguishable to Humans | <p>I am trying to randomly generate a color in hex in javascript.</p>
<p>However the colors generated are almost indistinguishable from eachother.
Is there a way to improve it?</p>
<p>Here is the code I am using:</p>
<p><pre><code>
function randomColor(){</p>
<p>var allowed = "ABCDEF0123456789", S = "#";</p>
<pre><code> while(S.length < 7){
S += allowed.charAt(Math.floor((Math.random()*16)+1));
}
return S;
}
</code></pre>
<p></pre></code></p>
<p>I heard something about HSL and HSV color model but can't get
it to work in my code. Please help.</p>
<p>Thanks in Advance</p>
| javascript | [3] |
1,602,733 | 1,602,734 | Why does JavaScript (or ECMAScript) not allow var(x)=1? | <p>This might not be the most obvious question, but it seems to me that variable declaration has the only enforced semantic whitespace in JavaScript. Is this correct? You can avoid it in other constructs, like these.</p>
<pre><code>new(XMLHTTPRequest)
typeof(x)
'a'in(x)
(a)in(x)
</code></pre>
| javascript | [3] |
134,534 | 134,535 | Should I worry about javascript support? | <p>I've developed a ajax enabled site. However, the site does not currently work without javascript. The site works well on any browser that I've tested as well as iPhone/Nokia phones. </p>
<p>However, should I still worry about javascript support?</p>
<p>I know there are techniques that would get my site to work both with or without javascript, but the refactoring would require some time.</p>
<p><strong>Edit</strong>: This application is targeted for our customers that will be using the the system to fill in and handle forms. Professional use mostly.</p>
| javascript | [3] |
3,968,704 | 3,968,705 | How to write local notification in iOS 3.1.3? | <p>I am developing one application in iOS 3.1.3. But there is no facility to write code for local notifications.</p>
<p>Is there any alternative for local notifications in iOS 3.1.3?</p>
| iphone | [8] |
1,897,205 | 1,897,206 | PHP including files | <p>What's the difference between</p>
<pre><code>$_SERVER['DOCUMENT_ROOT'];
</code></pre>
<p>and</p>
<pre><code>dirname(__FILE__);
</code></pre>
<p>I wonder what's the difference because when I 'echo' them, they're returning same path. Which do you prefer should I use and why?</p>
<p>Thanks!</p>
| php | [2] |
1,482,438 | 1,482,439 | fail-safe iterator | <p>CopyOnWriteArrayList produce fail-safe iterator because everytime the "structure is modified" , the modification mean a new array is produced. the iterator iterate over the old copy of array? So, fail-safe mean it is safe from failing?</p>
| java | [1] |
798,283 | 798,284 | Can you make addTextChangedListner wait? | <p>Is there any way to make a addTextChangedListner wait for a specified amount of time before launching the next intent.
My problem is coming when it is reading from an input, it only reads the first character, then immediatly launches. If it could something like ".wait(100); this would be time to read all input.</p>
<p>Many Thanks</p>
<p>Input is coming from scanning device, and i would prefer not to use a button to say when to launch for speed.</p>
<pre><code>final EditText name = (EditText)findViewById(R.id.editText1);
name.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
String results = name.getText().toString();
Intent one= new Intent("com.test.testing");
one.putExtra("key", results);
startActivityForResult(one, 1);
</code></pre>
| android | [4] |
2,783,222 | 2,783,223 | How do I tell the Android launcher to create a folder with specified applications in it? | <p>The question about says it all. I want to programmatically tell the default launcher/home screen to add a folder with a specific name and a specific set of apps in it. Is this possible?</p>
| android | [4] |
4,861,140 | 4,861,141 | references in c++ problem | <p>I heard references in c++ can be intitalized only once but this is giving me 1 is my output and not returning any error!</p>
<pre><code> struct f {
f(int& g) : h(g) {
h = 1;
}
~f() {
h = 2;
}
int& h;
};
int i() {
int j = 3;
f k(j);
return j;
}
</code></pre>
| c++ | [6] |
2,112,286 | 2,112,287 | Using .one() for some elements not yet created (like .live()) | <p>Is there a way to use <code>one()</code> with event delegation? like <code>on()</code> or <code>live()</code> so that it will be applied to DOM elements that are not created at the binding time?</p>
| jquery | [5] |
1,941,341 | 1,941,342 | How to count how many checkboxes has been checked | <p>I have a HTML table first column consists of check boxes etc when the user clicks a button i want to check if any of the check boxes have been checked before going to the code behind etc.</p>
<p>This is what i have but it keeps throwing an error
"Microsoft JScript runtime error: Syntax error, unrecognized expression: input.checkbox:checked"]"</p>
<p>This is my code i just want to return the count of how many checkboxes are actually checked.
<code></p>
<pre><code> $('#BtnExportToExcel').click(function () {
var check = ('#gvPerformanceResult').find('input.checkbox:checked"]').length;
alert(check);
return false;
}):
</code></pre>
<p></code></p>
<p>Thanks for your help.</p>
| jquery | [5] |
4,247,801 | 4,247,802 | java script refresh page after getting value from excel | <p>i have this code in javascript</p>
<pre><code> a= Excel.Workbooks.open("C:/work/ind12.xls").ActiveSheet.Cells.find("value");
if(a == null)
document.getElementById('dateValid').innerText = "Date not Valid";
Excel.close();
</code></pre>
<p>its just connecting with my excel sheet and finding some value, it works perfectly fine But as as its done it refresh my page and all the values in text boxes and other just lost . is there any way to stop refreshing the page or retain my values </p>
<p>Thanks </p>
| javascript | [3] |
5,920,442 | 5,920,443 | SQLite or something else? | <p>I am trying to decide on what data storage methods to implement. Here is the situation. Whatever method I choose, it is going to be updated once week (can I update a SQLite db without putting out an update in the market?). The user cannot add or remove items from this ListActivity, they can only pick the ones they want. This data method should be able to remember the selected items during any given week. Let me know what method you would use and why. Thanks so much in advance.</p>
| android | [4] |
5,909,108 | 5,909,109 | jQuery, bind - change | <p>Good afternoon.</p>
<p>I have a little problem with triggering the change of a select box in jQuery.</p>
<p>I have juts built a plugin that takes a select box with it's options and turns it into an iPhone style (what I call) roller - basically a fixed height element with an up and down arrow on the right that makes the list in the box go up and down.</p>
<p>I have all this working correctly and the corresponding select element setting the correct selectedIndex and it's all peachy.</p>
<p>The one trouble I have is that I need to trigger a change when the selectedIndex changes. At first I just hid the select element hoping that I could trigger it with it hidden - but this doesn't work, then I just made the z-index -100 again hoping it would work but to no avail. Does the select element have to be visible for the change to take place or is there another way I can get round it. I would like it to be chainable in true jQuery spirit but that no worky either.</p>
<p>Kind regards</p>
<p>Alex</p>
| jquery | [5] |
3,988,435 | 3,988,436 | Sum possibilities, one loop | <p>Earlier I had a lot of wonderful programmers help me get a function done. however the instructor wanted it in a single loop and all the working solutions used multiple loops.</p>
<p>I wrote an another program that almost solves the problem. Instead of using a loop to compare all the values, you have to use the function has_key to see if that specific key exists. Answer of that will rid you of the need to iter through the dictionary to find matching values because u can just know if they are matching or not.
again, charCount is just a function that enters the constants of itself into a dictionary and returns the dictionary.</p>
<pre><code>def sumPair(theList, n):
for a, b in level5.charCount(theList).iteritems():
x = n - a
if level5.charCount(theList).get(a):
if a == x:
if b > 1: #this checks that the frequency of the number is greater then one so the program wouldn't try to multiply a single possibility by itself and use it (example is 6+6=12. there could be a single 6 but it will return 6+6
return a, x
else:
if level5.charCount(theList).get(a) != x:
return a, x
print sumPair([6,3,8,3,2,8,3,2], 9)
</code></pre>
<p>I need to just make this code find the sum without iteration by seeing if the current element exists in the list of elements.</p>
| python | [7] |
1,609,857 | 1,609,858 | Inline & not-inline | <p>Suppose I have:</p>
<pre><code>struct Vec3 {
double x;
double y;
double z;
} ;
inline double dot(const Vec3& lhs, const Vec3& rhs) {
return lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z ;
}
</code></pre>
<p>Is it possible to have "dot" also exist in a non-inlined version, so that it can be in the *.so , so that when I dl open it I can call it?</p>
<p>I.e. I want files that include the above header to use the inlined version, but I also want the function to exist in a *.so, so I can dl open it and call it dynamically.</p>
| c++ | [6] |
1,306,468 | 1,306,469 | Executing a list of imported functions | <p>I have a file with functions:</p>
<p>modules.py:</p>
<pre><code>def a(str):
return str + ' A'
def b(str):
return str + ' B'
</code></pre>
<p>I want to perform these functions in cycle. Something like:</p>
<p>main.py:</p>
<pre><code>import modules
modules_list = [modules.a, modules.b]
hello = 'Hello'
for m in modules_list:
print m(hello)
</code></pre>
<p>The result should be:</p>
<pre><code>>>> Hello A
>>> Hello B
</code></pre>
<p>This code is work. I do not want to use decorators, because too much functions in <code>modules.py</code>.
What is the best way? Thanks.</p>
| python | [7] |
940,523 | 940,524 | Is returning a temp-object by reference possible | <p>is it possible to return a reference from a function like in this example code:</p>
<pre><code>string &erase_whitespace(string &text)
{
text.erase(**etc.**);
return text;
}
</code></pre>
<p>Call:</p>
<pre><code>string text = erase_whitespace(string("this is a test"));
cout << test;
</code></pre>
<p>Does this code work? On Visual C++ it does not crash but it looks wrong.</p>
<p>Thanks</p>
| c++ | [6] |
3,531,798 | 3,531,799 | Convert unsigned char array with int to unsigned char | <p>Can somebody help me out with below error. Shall I cast <code>len</code> before I try to pass <code>buf</code>?</p>
<pre><code>int len=2;
unsigned char tmp[len + 1];
unsigned char * buf = &tmp;
</code></pre>
<p>The error is:</p>
<pre><code>error: cannot convert 'unsigned char (*)[(((unsigned int)((int)len)) + 1)]' to 'unsigned char*' in assignment
</code></pre>
| c++ | [6] |
5,879,579 | 5,879,580 | How to use zxing qrcode-reader API | <p>Hi everyone I'm new to android I'm doing on some project that needs scanning qr codes using mobile(Android OS)<br>
I have tried a lot to do it. I have already integrated zxing API and use this code:</p>
<pre><code>Intent data = new Intent("com.google.zxing.client.android.SCAN");
</code></pre>
<p>And getting the result with this code:</p>
<pre><code>String contents = data.getStringExtra("SCAN_RESULT");
String format = data.getStringExtra("SCAN_RESULT_FORMAT");
</code></pre>
<p>But when I run this code, the app will ask to close by force.
please help </p>
| android | [4] |
393,823 | 393,824 | PHP Get URL Contents And Search For String | <p>In php I need to get the contents of a url (source) search for a string "maybe baby love you" and if it does not contain this then do x.</p>
| php | [2] |
4,866,939 | 4,866,940 | Where can I find a good explanation of C++ stateful virtual base? | <p>Where can I find a good explanation of C++ stateful virtual base?</p>
<p>I looked in the <a href="http://www.jsf.mil/" rel="nofollow">JSF</a> <a href="http://www.jsf.mil/downloads/down_documentation.htm" rel="nofollow">C++ Coding Standard</a> and read their explanation, but was looking for some additional information. </p>
<p>Thank you for any additional details provided. </p>
| c++ | [6] |
566,704 | 566,705 | Clipboard can copy a few words? | <p>I'm weak in English so I hope you will understand this.</p>
<p>I learned yesterday that Clipboard is copy.</p>
<pre><code>//textBox1.Text = "My name is not exciting";
Clipboard.SetText(textBox1.Text);
textBox2.Text = Clipboard.GetText();
</code></pre>
<p>This code copies your everything from the textbox1 and paste it in textbox2 right?</p>
<p>So it's possible to copy only a few words from textbox1 and paste it in textbox2?</p>
<p>If you don't understand, I'm want copy only a few words not all the line.</p>
<p>Even if this high level code still bring me :)</p>
| c# | [0] |
970,482 | 970,483 | Split string based on Roman Numerals C# | <p>I want to Find roman numbers inside string (numbers below 20 is enough) and split the string based on roman numbers</p>
<p>eg:user input is : </p>
<pre><code>Whats your name?i)My name is C# ii)My name is ROR iii)My Name is Java
</code></pre>
<p>i want to do something like </p>
<pre><code>Whats your name?
i)My name is C#
ii)My name is ROR
iii)My Name is Java
</code></pre>
<p>Edit:this is to format the optional questions..so options wont go no more than 5 or 6..</p>
| c# | [0] |
5,591,991 | 5,591,992 | Can't load IA 32-bit .dll on a AMD 64-bit platform JMyron.dll | <p>i have imported the entire code for the example given at the <a href="http://webcamxtra.sourceforge.net/download.shtml" rel="nofollow">http://webcamxtra.sourceforge.net/download.shtml</a> for the java example, but the error given above is coming.
Can please anyone give clear guidelines on how to start a webcam through java on eclipse juno?
Whether to choose the .dlls given in the Processing Library or the ones in Java section on thr abovementioned site?
I recently posted a program earlier but that program refused to work
Here is the link to the previous question
<a href="http://stackoverflow.com/questions/15577002/cant-run-webcam-in-eclipse">Can't run webcam in Eclipse</a>
My machine is 64 bit, Windsows 7</p>
| java | [1] |
1,498,109 | 1,498,110 | Interrupting or stopping a sleeping thread | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4264341/interrupting-or-stopping-a-sleeping-thread">Interrupting or stopping a sleeping thread</a> </p>
</blockquote>
<p>How to stop or interrupt a sleeping thread in java.? I have a thread that syncs data and sleeps for 10 minutes in run() method, if i want to stop the sync by stopping the thread when it is sleeping.? How can this be achieved?</p>
| java | [1] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.