Unnamed: 0
int64 65
6.03M
| Id
int64 66
6.03M
| Title
stringlengths 10
191
| input
stringlengths 23
4.18k
| output
stringclasses 10
values | Tag_Number
stringclasses 10
values |
---|---|---|---|---|---|
2,505,230 | 2,505,231 |
Export Captured Movie Only plays in Landscape Mode, and is Rotated
|
<p>Before I post a lot of code here is the scenario:</p>
<ol>
<li>Using code based on AVEditDemo from WWDC, I capture a movie using the standard control in portrait.</li>
<li>I post process the video using code identical to that in AVEditDemo which uses Core Animation.</li>
</ol>
<p>When I play the resultant video using the Camera App, it is rotated 90 degrees and is not longer "portrait" (it is now in landscape) and squashed. (The aspect ratio seems to have been swapped, width -> height & height -> width.</p>
<p>Have spent many hours on this and am at a loss.</p>
<p>The desired result is a movie identical to the captured original. (With an animated overlay eventually).</p>
<p>To see this in action just download and run the AVEditDemo from Apple, turn Title "ON" and export the movie.</p>
|
iphone
|
[8]
|
2,001,110 | 2,001,111 |
Simple PHP. Try to get rid of nested if's
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4106382/compare-multiple-values-in-php">Compare multiple values in PHP</a> </p>
</blockquote>
<p>Will someone help me to find a better way of writing this, please. I feel as if there has to be something better than nested ifs. I have tried searching, but I don't know what I am looking for.</p>
<p>The code says that if the session variable "auth" is not exactly equal to 0, 1, 2, or 3 then redirect to the login page.</p>
<pre><code>if($_SESSION['auth']!=0){
if($_SESSION['auth']!=1){
if($_SESSION['auth']!=2){
if($_SESSION['auth']!=3){
header("location:login.php");
}
}
}
}
</code></pre>
<p>My initial thought was to do something like this.</p>
<pre><code>if($_SESSION['auth']<=0 || $_SESSION['auth']>=3){
header("location:login.php");
}
</code></pre>
<p>But that doesn't account for fractions of the integer value. Which I only want to allow integer values. My next thought was this.</p>
<pre><code>if($_SESSION['auth']!=0 && $_SESSION['auth']!=1 && $_SESSION['auth']!=2 && $_SESSION['auth']!=3){
header("location:login.php")
}
</code></pre>
<p>But this way is not much different than all the nested ifs. Let me know if I am just attempting to fix something that isn't broken. Thank you in advance. A link to the relevant topic (PHP manual preferably) is all I'm looking for, not the solution.</p>
|
php
|
[2]
|
2,249,528 | 2,249,529 |
No provisioned iOS devices are available with a compatible iOS version,Why i am getting this error?
|
<p>I'm trying to test my app on an iPhone 4, however I'm getting this error:</p>
<p>No provisioned iOS devices are available with a compatible iOS version. Connect an iOS device with a recent enough version of iOS to run your application or choose an iOS simulator as the destination.</p>
|
iphone
|
[8]
|
2,675,492 | 2,675,493 |
In android how should i get phone number of sms sender?
|
<p><strong>In android how should i get phone number of sms sender?</strong></p>
<p>I make application which sends sms but takes money charges for that, <strong>so can i send sms without charging money?</strong> please tell me</p>
|
android
|
[4]
|
2,455,273 | 2,455,274 |
Unable to store value in stack
|
<p>In this code, the <code>subKeys</code> has some values which is extract from cookie, the message prompt <code>cval: 3</code> but I could not push store each <code>subKeys</code> values into <code>stack</code> array which is the <code>stack</code> is always empty.</p>
<pre><code>var stack = new Array();
var temp = document.cookie;
//alert("cookie: "+temp);
function upSelect() {
temp = temp.replace("tutorSelect=","");
subKeys=temp.split(",");
for(var i=0;i<subKeys.length;i++) {
alert("cval: "+subKeys.length);
//push to stack?
stack.push(String(subKeys[i]));
alert("stack: ",stack.length);
document.getElementById("t"+subKeys[i]).src="tta/rem.png";
}
}
</code></pre>
|
javascript
|
[3]
|
1,497,221 | 1,497,222 |
Php mailer error: SMTP error
|
<p>I am using php mailer class. I am getting :
SMTP Error: The following recipients failed: s_deshmukh88@hotmail.com </p>
<pre><code>$mail = new phpMailer();
$body = "Hello, this is a test mail.";
//$body = preg_replace('/\\\\/','', $body); //Strip backslashes
$mail->IsSMTP(); // tell the class to use SMTP
//$mail->SMTPAuth = true; // enable SMTP authentication
//$mail->Port = 25; // set the SMTP server port
$mail->Host = "localhost"; // SMTP server
$mail->Username = "localhost"; // SMTP server username
$mail->Password = "password"; // SMTP server password
//$mail->SMTPSecure = "tls";
//$mail->IsSendmail(); // tell the class to use Sendmail
$mail->AddReplyTo("name@domain.com","First Last");
$mail->From = "name@domain.com";
$mail->FromName = "First Last";
$to = "s_deshmukh88@hotmail.com";
$mail->AddAddress($to);
$mail->Subject = "First PHPMailer Message";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
if($mail->Send()){
echo 'Message has been sent.';
}
</code></pre>
<p>What can be the reason ?</p>
|
php
|
[2]
|
888,435 | 888,436 |
Is there something like a macro in PHP? Or: How to make an own include function?
|
<p>What I want to do is this:</p>
<p>When I write a class and the class instantiates another class, I want to import that class with an require_once. Just the way I do so in Objective-C. But instead of using plain require_once function and messing around with paths and string concatenation, I would prefer something like:</p>
<pre><code>importClass('myclass');
</code></pre>
<p>but I'm afraid that it's impossible to write a function that will include code. If I would do that in the importClass() function, I would include the class code into the implementation block of the function, which of course is nonsense. So what options do I have here?</p>
|
php
|
[2]
|
2,786,864 | 2,786,865 |
iPhone sdk basic element\button animation
|
<p>I just wanna know if there exists simple drawer (move up and down certain pixels)like animation for generic iPhone button as animated action or not?</p>
<p>How one can approach to implement that.</p>
<p>Can someone guide me.Thanks for your effort in advance.</p>
|
iphone
|
[8]
|
4,125,208 | 4,125,209 |
how to find the word with max count in several text files in java?
|
<p>now i have two arrays. one is string array with words in it. and a count array with corresponding counts in it. below i have printed them together....</p>
<p>ex: </p>
<pre><code>gladiator 8
yamaha 6
gladiator 4
bike 6
brake 4
long 4
time 6
gladiator 35
yamaha 39
bike 17
gladiator 16
ss 19
type 16
yamaha 21
gladiator 15
india 8
yamaha 17
bike 7
gladiator 15
shine 9
yamaha 9
bike 8
gladiator 14
india 8
yamaha 18
bike 7
gladiator 9
</code></pre>
<p>so now i have first "gladiator" "8" then "gladiator" "4"... so on....
finally i want it as "gladiator" "12"..... like wise </p>
|
java
|
[1]
|
1,575,518 | 1,575,519 |
Javascript input.files[i].url?
|
<p>I'm using a javscript that grabs the file name of the file the user chooses in a upload form. However, I want to grab the URL on their PC where the file is located - how do I do so?</p>
<p>My code: </p>
<pre><code>for (var i = 0; i < input.files.length; i++) {
var li = document.createElement("li");
li.innerHTML = input.files[i].name;
ul.appendChild(li);
}
</code></pre>
<p>It shows input.files[i].name but I don't want the name - I want the URL of where its located. How do I do so?</p>
|
javascript
|
[3]
|
1,280,642 | 1,280,643 |
What the struct "zend_ptr_stack" means in Zend of PHP?
|
<p>At line 29 of "Zend/zend_globals.h" in PHP-5.2.17.</p>
<p>What the struct "zend_ptr_stack" means and what's the use of this struct?</p>
<pre><code>typedef struct _zend_ptr_stack {
int top, max;
void **elements;
void **top_element;
} zend_ptr_stack;
</code></pre>
|
php
|
[2]
|
1,561,104 | 1,561,105 |
How Read Users Of A Remote Linux Server with PHP ( Finger Protocol)
|
<p>How can i read users of a remote linux server with PHP?
(like LDAP in windows)</p>
<p>If <code>finger</code> server has been runned on the remote linux server,<strong>Now what?</strong></p>
|
php
|
[2]
|
5,642,528 | 5,642,529 |
Unresolved externals error during compilation
|
<p>I am getting two unresolved externals error while trying to compile the following c++ program in Visual Studio 2010-
<a href="http://codepad.org/5ZS4gtfP" rel="nofollow">http://codepad.org/5ZS4gtfP</a> </p>
<p>I tried cross checking everything but cant seem to find the problem. Can someone plz compile it in VS 2010 and try to find out the solution?</p>
|
c++
|
[6]
|
4,093,767 | 4,093,768 |
how to access a variable and called a class method at the same time
|
<p>Hmmm,not sure how to do this</p>
<p>i have a public variable</p>
<pre><code>public $meta;
</code></pre>
<p>I'm calling the method in my application like this</p>
<pre><code>$auth->meta_data('rental_access');
</code></pre>
<p>Now I'm curious is to how I can get the information from it. How can I access the $meta variable information based on the switch logic from the method?</p>
<p>In my application I want to use the information from the $meta variable to make some more logic statements hmmm something like</p>
<pre><code>if ($auth->meta-data('rental_access') == 1) { //or maybe have it look for a true/false thing
//do this
} else {
// then do this
}
</code></pre>
|
php
|
[2]
|
2,113,080 | 2,113,081 |
How to stop PHP while applying a terminal command using system() or passthru()?
|
<p>I am trying to make a application which will check it can ping outside but it never stop. How can i apply a command to terminal and stop the action? Example in following case:</p>
<pre><code>$ php -r "echo system('ping 127.0.0.1');"
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.073 ms
64 bytes from 127.0.0.1: icmp_req=2 ttl=64 time=0.073 ms
64 bytes from 127.0.0.1: icmp_req=3 ttl=64 time=0.072 ms
64 bytes from 127.0.0.1: icmp_req=4 ttl=64 time=0.074 ms
64 bytes from 127.0.0.1: icmp_req=5 ttl=64 time=0.071 ms
64 bytes from 127.0.0.1: icmp_req=6 ttl=64 time=0.073 ms
64 bytes from 127.0.0.1: icmp_req=7 ttl=64 time=0.074 ms
64 bytes from 127.0.0.1: icmp_req=8 ttl=64 time=0.073 ms
64 bytes from 127.0.0.1: icmp_req=9 ttl=64 time=0.074 ms
64 bytes from 127.0.0.1: icmp_req=10 ttl=64 time=0.081 ms
64 bytes from 127.0.0.1: icmp_req=11 ttl=64 time=0.072 ms
64 bytes from 127.0.0.1: icmp_req=12 ttl=64 time=0.075 ms
</code></pre>
<p>Note: ctrl+c was applied to stop but this will be executed via web browser.</p>
|
php
|
[2]
|
597,340 | 597,341 |
Conditional or in C#
|
<p>I've been programming in JAVA and C all my years at Uni, but now I'm learning C# and building a small application, and I've found troubles with this:</p>
<pre><code>if (taxonType.Equals(null) ¦¦ taxonID == -1)
</code></pre>
<p>I get a red underline for this conditional, and I don't really know why, because according to what I've seen that should be ok, but it is not. Is there something I'm missing?</p>
<p>thank you all in advance,
Victor</p>
<hr>
<p>Thank you all!!! I was getting mad about this. The thing is that I'm Spanish and I'm used to have the pipe key | exactly in the same place where ¦ is in the American configuration... I was seeing this ¦ strange, but I thought it was the same...</p>
<p>Thanks for the fast reply!!
Victor</p>
|
c#
|
[0]
|
3,955,582 | 3,955,583 |
Javascript parameter help needed
|
<p>I've this function:</p>
<pre><code>$(function() {
$(window).scroll(function(e) {
var sl = $(this).scrollLeft();
var lbl = $("#waypoints");
if (sl > 0) {
lbl.show('');
}
else {
lbl.hide();
}
if (sl > 750) {
lbl.html("<p>now passed 750</p>");
}
if (sl > 1000) {
lbl.html("<p>now passed 1000</p>");
}
});
</code></pre>
<p>});</p>
<p>Which work when i scroll the browser window. But I need to adjust it, so that it is set for a div (#main) which scrolls inside another div (.content) which has a fixed width and css overflow enabled.</p>
<p>I've tried <code>$(#main).scroll(function(e) {</code> no joy ...</p>
<p>thanks for reading, any help would be awesome.</p>
|
javascript
|
[3]
|
2,372,158 | 2,372,159 |
IllegalArgumentException: connection is null, startActivity
|
<p>I am using a tab host that I got from github for my project and it has recently broke. This only happens when I load the tab that has my google map in it and works fine for all the other tabs. I get the error IllegalArgumentException: connection is null when calling</p>
<pre><code>View view = activityManger.startActivity(id, intent).getDecorView();
</code></pre>
<p>I have checked both id and intent and neither are null when being passed in. What else could be causing this error? The activityManager is a LocalActivityManager and is set to the return of getLocalActivityManager() in onCreate. Is this not being set up correctly? Also, I am only seeing this problem on my Galaxy Nexus 4.2.2 so far. Thanks.</p>
|
android
|
[4]
|
1,472,705 | 1,472,706 |
permission denied with shell.application
|
<p>I have following java script code to run notepade.exe:</p>
<pre><code>enter code here <SCRIPT type="text/javascript" LANGUAGE="JavaScript">
function executeCommands()
{
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun ="C:\WINDOWS\notepad.exe";
oShell.ShellExecute(commandtoRun,"","", "open", "1");
}
</SCRIPT>
</code></pre>
<p>The problem is that, when i run the script then it give error..."Permission denied."</p>
<p>Can anybody help me on this matter?</p>
|
javascript
|
[3]
|
5,208,492 | 5,208,493 |
How to preserve const-ness of typedef'd types
|
<p>Every once in a while I get hung up by this and no one has really been able to give a satisfying answer.</p>
<p>In a (admittedly contrived) example like this...</p>
<pre><code>typedef std::string _str;
class MyClass
{
public:
MyClass(const _str &s) : m_str(s) { }
private:
const _str &m_str;
}
</code></pre>
<p>... Things work pretty much as expected. The member <code>m_str</code> can only be assigned in the constructor initializer list and cannot be reassigned later on, and non-const iterators are unavailable. Okay, then. But if we do this instead...</p>
<pre><code>typedef std::string _str;
typedef std::string &_strref;
class MyClass
{
public:
MyClass(const _strref s) : m_str(s) { }
void test() { m_str.append(std::string("why am I not const?")); }
private:
const _strref m_str;
}
</code></pre>
<p>... The const gets dropped. Non-cost methods may be called on <code>m_str</code> and it may be reassigned, which is misleading considering it has <code>const</code> written next to it.</p>
<ul>
<li>Can the second example be corrected to maintain const-ness?</li>
<li>Where/why does the c++ spec indicate that this is correct behavior?</li>
<li>What do best practices have to say on the matter?</li>
</ul>
|
c++
|
[6]
|
3,662,977 | 3,662,978 |
How to set configuration parameters using an array table?
|
<p>Following situation: I have an array with some constant values, which represent ranges.<br>
A range is always between two values in the array, e.g.: 10 - 20 = range1<br>
20-30 = range2 and so on...</p>
<pre><code>const int arr[] = {10, 20, 30, 40, 50, 60};
</code></pre>
<p>With a Search function, I search for the number(val) between those ranges in arr[] and return the range index where val was found.<br>
For example: if val = 15 → return value would be 1<br>
if val = 33 → return value would be 3</p>
<pre><code>int Search(const int arr[], int n, int val)
{
int i = 0;
while (i < n) {
if (val > arr[i])
++i;
else
return i;
}
return -1;
}
</code></pre>
<p>OK, this works out so far...</p>
<p>Now following problem:
I have some parameters let's call them x, y, z which are simple integers and they depend on the value of val.
The parameter values for x, y, z I know already before compilation, of course they are different for every range.<br>
How can I now set x, y and z using the range index?
How can I make an array for example with the constant parameter values for x, y, z and set them depending on the returned range index? Or should it be a struct?
How would that look like...?</p>
<p>Thx</p>
|
c++
|
[6]
|
1,489,131 | 1,489,132 |
what precautions should be taken while looping
|
<p>Please clarify me:
what precautions I have to take during looping condition ex. in while loop or for loop</p>
<ol>
<li><p>minimize creation of new variable.</p></li>
<li><p>ensure that the loop has a definite exit condition.
3.loop should not be more then 10 lines.</p></li>
<li>do not check size() in loop conditon.</li>
</ol>
|
java
|
[1]
|
5,880,739 | 5,880,740 |
Multiple CKEditor instances in one form?
|
<p>I have a form where i need to use the code for attach more rows.</p>
<p>I have a name field(textbox)and a description field(ckeditor) </p>
<p>and an add more link below that . Clicking on the add more will append a row with the above fields .</p>
<p>is it possible to add ckeditor using the attach more option?</p>
|
php
|
[2]
|
2,751,159 | 2,751,160 |
PHP + User Edit Button
|
<p>Sorry for my ignorance. Does anyone have any input to help me here. </p>
<p>I'm trying to create a page that queries a database and shows open entries. I want the users to be able to click inline, or by a seperate page and edit the field. </p>
<pre><code><?php
$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("maint", $con);
$result = mysql_query("SELECT * FROM Maintenance WHERE status='open'");
while($row = mysql_fetch_array($result))
{
echo "<center><div style='top: 10px; left: 3px; width: 500px; height: 250px; border: dotted; padding: 5px'>";
echo "<br><b>Name: </b> " . $row['name'] . "<br>";
echo "<b>Issue: </b> " . $row['detailed'] . "<br>";
echo "<b>Status: </b>" . $row['status'] . "<br>";
echo "<b>Comments: </b>" . $row['comments'] . "<br>";
echo "<br/><br/>";
echo "<input type='submit' name=button /><br>";
echo "</div><br>";
}
mysql_close($con);
?>
</code></pre>
<p>Can someone just lead me in the correct direction. I'm only a noob programmer so I apologize if this is basic stuff. </p>
|
php
|
[2]
|
750,904 | 750,905 |
PHP string inception manipulation
|
<p>I cant get this to work and its driving me mad, pls help</p>
<pre><code>echo "<a href='#' onclick='javascript:$.jGrowl
(\"".$_SESSION['product_description'][$i]."\")' >?</a>";
</code></pre>
<p>the problem comes down to the 'product_description' - those single ' marks are breaking it, what should i do sigh</p>
<p>EDIT: if i replace the .$_SESSION['product_description'][$i]. with a bunch of charecters it works, its not a problem with anything but PHP and those ''</p>
|
php
|
[2]
|
5,060,982 | 5,060,983 |
PHP Cronjob In Windows 7
|
<p>Hye alls..
this is my code that cronjob will do..</p>
<pre><code>$query = "UPDATE program SET status_penilaian = 1 WHERE tarikh_buka = CURDATE()";
$hasil = mysql_query($query);
</code></pre>
<p>question is.. how to setting to cronjob this php file in task schedule?</p>
<p>i'm using PHP Version 5.2.8</p>
|
php
|
[2]
|
358,568 | 358,569 |
Programmatically checking item in ListView
|
<p>I need the way to check an item in ListView with choice mode SINGLE from my code. Simply cant't find the method needed. </p>
<p>Thanks.</p>
|
android
|
[4]
|
3,141,515 | 3,141,516 |
How to include static library in another ndk project?
|
<p>I have created static library of one of my project say libABC.a. Now i want to use this static library in another android project at jni layer. The second project would also have its own .cpp files inside jni folder, which would be using the functions of libABC.a static library. Now my question is what are the steps through which i can include static library into another project at jni layer ? </p>
|
android
|
[4]
|
4,782,660 | 4,782,661 |
Can I put a breakpoint in a running Python program that drops to the interactive terminal?
|
<p>I'm not sure if what I'm asking is possible at all, but since python is an interpreter it might be. I'm trying to make changes in an open-source project but because there are no types in python it's difficult to know what the variables have as data and what they do. You can't just look up the documentation on the var's type since you can't be sure what type it is. I want to drop to the terminal so I can quickly examine the types of the variables and what they do by typing help(var) or print(var). I could do this by changing the code and then re-running the program each time but that would be much slower.</p>
<p>Let's say I have a program:</p>
<pre><code>def foo():
a = 5
my_debug_shell()
print a
foo()
</code></pre>
<p>my_debug_shell is the function I'm asking about. It would drop me to the '>>>' shell of the python interpreter where I can type help(a), and it would tell me that a is an integer. Then I type 'a=7', and some 'continue' command, and the program goes on to print 7, not 5, because I changed it.</p>
|
python
|
[7]
|
1,206,933 | 1,206,934 |
Simulate click on select element with jQuery
|
<p>I use this code for simulate <code>click</code> on <code>select</code> element:</p>
<pre><code>$(function(){
$("#click").click(function(){
$("#ts").click();
//$("#ts").trigger("click");
});
});
</code></pre>
<p>and HTML code is:</p>
<pre><code><select id="ts">
<option value="1">1</option>
<option value="2">Lorem ipsum dolor s.</option>
<option value="3">3</option>
</select>
<input type="button" id="click" value="Click"/>
</code></pre>
<p>I test <code>click</code> and <code>trigger</code> but both not work.</p>
<p>Thanks for any help.</p>
|
jquery
|
[5]
|
3,904,581 | 3,904,582 |
How to get random and unique values from a vector?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/196017/unique-random-numbers-in-o1">Unique random numbers in O(1)?</a><br>
<a href="http://stackoverflow.com/questions/1608181/unique-random-numbers-in-an-integer-array-in-the-c-programming-language">Unique random numbers in an integer array in the C programming language</a> </p>
</blockquote>
<p>I have a <code>std::vector</code> of unique elements of some undetermined size. I want to fetch 20 unique and random elements from this vector. By 'unique' I mean that I do not want to fetch the same index more than once. Currently the way I do this is to call <code>std::random_shuffle</code>. But this requires me to shuffle the entire vector (which may contain over 1000 elements). I don't mind mutating the vector (I prefer not to though, as I won't need to use thread locks), but most important is that I want this to be efficient. I shouldn't be shuffling more than I need to.</p>
<p>Note that I've looked into passing in a partial range to <code>std::random_shuffle</code> but it will only ever shuffle that subset of elements, which would mean that the elements outside of that range never get used!</p>
<p>Help is appreciated. Thank you!</p>
<p>Note: I'm using Visual Studio 2005, so I do not have access to C++11 features and libraries.</p>
|
c++
|
[6]
|
455,481 | 455,482 |
Substring go to End of String
|
<p>I am trying to get have one Substring go from the beginning of a string to a certain position and another Substring go from the end of the last position to the end of the string. But I don't know what the end will be. it will be multiple lengths. Is there a way to just go to the end of the string without giving a specific character position, something like below?</p>
<pre><code>StartVariable.Substring(0, 14)
EndVariable.Substring(15, Substring.Length)
</code></pre>
<p>Thanks!</p>
|
c#
|
[0]
|
1,329,479 | 1,329,480 |
randomizing two lists and maintaining order in python
|
<p>Say I have two simple lists,</p>
<pre><code>a = ['Spears', "Adele", "NDubz", "Nicole", "Cristina"]
b = [1,2,3,4,5]
len(a) == len(b)
</code></pre>
<p>What I would like to do is randomize <code>a</code> and <code>b</code> but maintain the order. So, something like:</p>
<pre><code>a = ["Adele", 'Spears', "Nicole", "Cristina", "NDubz"]
b = [2,1,4,5,3]
</code></pre>
<p>I am aware that I can shuffle one list using:</p>
<pre><code>import random
random.shuffle(a)
</code></pre>
<p>But this just randomizes <code>a</code>, whereas, I would like to randomize <code>a</code>, and maintain the "randomized order" in list <code>b</code>.</p>
<p>Would appreciate any guidance on how this can be achieved.</p>
|
python
|
[7]
|
611,518 | 611,519 |
How do i get resized image of external site?
|
<p>I am trying to display resized images for thumbnail view in my website.</p>
<p>I am creating a page of gallery list where there will be list of thumbnails of images from external site. i.e if my images are located in xyz.com/images/abc.jpg [600 x 400] then i would like to show its resized form of 150 x 100 in my website.</p>
<p>How much it is effective and good in case of performnance and bandwdith too?</p>
|
php
|
[2]
|
3,299,968 | 3,299,969 |
Android Connection Presistence
|
<p>Does Android keep the connection between the server/socket when it moves from EDGE to WIFI and vice versa?</p>
|
android
|
[4]
|
2,863,101 | 2,863,102 |
Get type instance from string in Python
|
<p>So, I need to cast a value to a given type:</p>
<pre><code>if 'int' == type_name:
value = int(value)
elif 'str' == type_name:
value = str(value)
...
</code></pre>
<p>Is there a way to do that generically? E.g.:</p>
<pre><code>type_instance = get_type_instance(type_name)
value = type_instance(value)
</code></pre>
<p>I'm using Python 2.7, but would be interested in a Python 3.X solution as well.</p>
<p><strong>Update:</strong></p>
<p>Here's the solution I'm using:</p>
<pre><code>class Token:
def __init__(self, type_name, value):
self.type = type_name
self.value = __builtins__[type_name](value) # not safe
</code></pre>
<p>This is just a toy parser. <strong>Don't use in production!</strong></p>
|
python
|
[7]
|
944,865 | 944,866 |
how to give the fade in and fade out effect in embed tag and object Tag in jquery?
|
<p>how to give the fade in and fade out effect in embed tag and object Tag?</p>
<pre><code>'<object width="140" height="185"><param name="movie" value="http://www.youtube.com/v/blsg_rRAg0I?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/blsg_rRAg0I?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="140" height="185"></object>').appendTo('#VideoWrp')
</code></pre>
<p>whn i open this VideoWrp container , its not c</p>
|
jquery
|
[5]
|
2,220,289 | 2,220,290 |
I cannot make regexp and preg_replace work
|
<p>Any ideas why this wouldn't output anything?</p>
<p>I just want to remove /page/* part of the url.</p>
<p>My aim is to get always <a href="http://www.sandrophoto.com/category/car-photography/" rel="nofollow">http://www.sandrophoto.com/category/car-photography/</a> even if string contains longer url.</p>
<p>I tried:</p>
<pre><code><?php
$url1 = "http://www.sandrophoto.com/category/car-photography/page/1/";
$url2 = "http://www.sandrophoto.com/category/car-photography/page/2/";
$url3 = "http://www.sandrophoto.com/category/car-photography/";
$cleaned1 = preg_replace('/page/*', '', $url1);
$cleaned2 = preg_replace('/page/*', '', $url2);
$cleaned3 = preg_replace('/page/*', '', $url3);
echo "$cleaned1 <br>";
echo "$cleaned2 <br>";
echo "$cleaned3 <br>";
?>
</code></pre>
|
php
|
[2]
|
2,872,546 | 2,872,547 |
Format Exception
|
<p>The below snipets are from my Form1 code. I keep getting a Format Exception because of my MessageBox.Show(…); declaration in my Stop() method. Why? What am I doing wrong?
...</p>
<pre><code> private TimeSpan iterationDuration = TimeSpan.Zero;
...
public void Stop()
{
IsGameOver = true;
MessageBox.Show(String.Format("Game Over\n\nScore = {0}\n\n Time Duration = {l}", score, iterationDuration));
Application.Exit();
}
public void Start()
{
score = 0;
IsGameOver = false;
currentRedLightX = 0;
currentRedLightY = 0;
currentGreenLightX = width / 2;
currentGreenLightY = height / 2;
double minIterationDuration = SPEED; // 50 frames / sec
//game loop
while (!IsGameOver)
{
if (IsCollision())
{
score += 10;
}
DateTime startIterationTime = System.DateTime.Now;
UpdateGameState();
Render();
DateTime endIterationTime = System.DateTime.Now;
TimeSpan iterationDuration = endIterationTime - startIterationTime;
if (iterationDuration.TotalMilliseconds < minIterationDuration)
Thread.Sleep(Convert.ToInt32(minIterationDuration - iterationDuration.TotalMilliseconds));
Application.DoEvents();
}
}
</code></pre>
|
c#
|
[0]
|
5,385,118 | 5,385,119 |
Sort SparseArray in Android
|
<p>How can I sort <a href="http://developer.android.com/reference/android/util/SparseArray.html" rel="nofollow">android.util.SparseArray</a>?
E.g. I have SparseArray with:<br>
1 - 2.33<br>
5 - 1.5<br>
Result:<br>
5 - 1.5<br>
1 - 2.33</p>
<p>Thanks!!!</p>
<p>-- EDITED</p>
<p>I've used the Map. Thanks for help.</p>
|
android
|
[4]
|
5,509,524 | 5,509,525 |
how to separate clicks with jquery
|
<p>I have a div like this...</p>
<pre><code><div class="user">
<div class="info">
.....
</div>
<div class="edit">
Edit
</div>
</div>
</code></pre>
<p>ON jquery I have something like this:</p>
<pre><code> $('user').click(function(){...});
$('edit').click(function(){...});
</code></pre>
<p>If I click on "edit" both functions execute, I dont want that, if I click on "edit" only his function should happen.
Any ideas on how to separate this 2 functions?</p>
<p>Thanks</p>
|
jquery
|
[5]
|
668,450 | 668,451 |
Do <cctype> functions work with Unicode?
|
<p>Page 601 of the C++ Special Edition says...</p>
<p><code>In <ctype.h> and <cctype>, the standard library provides a set of useful functions for dealing with ASCII and similar character sets.</code></p>
<p>Would Unicode fall under this "similar character sets" category?</p>
|
c++
|
[6]
|
4,789,971 | 4,789,972 |
How to put Char** into _stprintf
|
<p>I have this code. I would like to put argv[1] as prefix to fileName. How do I do that?</p>
<pre><code>int _tmain(int argc, char** argv)
{
...
_stprintf(fileName, _T("%04d-%02d-%02d-%02d-%02d-%02d-%03d.jpeg"), lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds);
</code></pre>
|
c++
|
[6]
|
3,681,210 | 3,681,211 |
Convert an image to Color object which can be added to background of a Layout
|
<p>I am having the following requirement.</p>
<p>1> I have a background image(png) (containing various shades) of color with stripes.</p>
<p>Is there any class which is already available on Android using which I can convert the image to Color object & set on the layout as background color?
Will the ColorMatrix class help ? I want to avoid using the image as background , as with different screen resolutions , even after having separate drawable folders , there can be cases when the background image can get stretched , giving a wrong view .</p>
<p>Kindly provide your inputs/sample code. If my approach is incorrect , kindly provide the correct logic.</p>
<p>Thanks in advance.</p>
<p>Warm Regards,</p>
<p>CB</p>
|
android
|
[4]
|
3,975,888 | 3,975,889 |
jQuery rating not working on live
|
<p><a href="http://qa.ukatn.com/totallydriven/feedback/feedback-form.php?fid=1&rno=TA20021" rel="nofollow">rating</a></p>
<p>This is my URL, I am using jquery.ratings.js.</p>
<p>But when I run the page, it is saying </p>
<pre>("#test-2").ratings is not function</pre>
|
jquery
|
[5]
|
626,464 | 626,465 |
How is this "object expected" JavaScript error possible?
|
<p>Apparently this line of code is triggering "Object expected":</p>
<pre><code>var bPid = (b != null && typeof (b.processId) == "number") ? b.processId : 0;
</code></pre>
<p>Unfortunately I can't step through the code in the debugger since this is an intermittent error that shows up in a Windows SideShow gadget that I'm writing. But, I'd imagine someone should be able to tell me how it's even possible to get object expected given all the checks that I'm doing to attempt to prevent something like that.</p>
|
javascript
|
[3]
|
578,103 | 578,104 |
Prototype Constructor Call
|
<p>Instead of using the call method, would it be applicable to utilize the following, e.g:</p>
<pre><code>var A = function(height,weight) {
this.height = height;
this.weight = weight;
};
var a = new A("6ft","500lbs");
A.prototype.foo = {
setup: function() {
this.height.set();
this.weight();
},
height: {
set: function() {
var constr = a;
var self = this;
console.log(constr);
console.log(self);
}
},
weight: function() {
var constr = a;
var self = this;
(function() {
console.log(constr);
})();
}
};
a.foo.setup();
</code></pre>
<p>Any suggestions are welcome.</p>
<p>Cheers</p>
|
javascript
|
[3]
|
4,131,033 | 4,131,034 |
InAPPBilling -- How can we set the specific validity time period for appbilling page or application
|
<p>I am implementing my app using InappBilling. I did the sample. In this how can we set the validity time period for appbilling page or application.</p>
<p>Example: In my application, i set the one button for launch the second page. for this i set the Appbilling. I need to set up the second page paid validity up to one month only. For this any options in AppBilling SDK?</p>
<p>Kindly let me know, if any queries.</p>
<p>Suresh A
sureshalapati81@gmail.com</p>
|
android
|
[4]
|
5,001,672 | 5,001,673 |
How to send an image and display it in email using php instead of a url or attachment?
|
<p>In writing a web srevice, how can i send image to email and display it.I am able to send email with all content except the image. I think there is some mistake in the image code . Can any one help me out with this ? my code is</p>
<pre><code><?php
$title=$_REQUEST['title'];
$location=$_REQUEST['location'];
$contactname=$_REQUEST['contactname'];
$contactnumber=$_REQUEST['contactnumber'];
$description=$_REQUEST['description'];
$image=$_REQUEST['image'];
if($title)
{
$Image=basename($_FILES['file']['name']);
$Image=str_replace(' ','|',$Image);
$date=date('YmdHis');
$date=str_replace('%20',' ',$date);
$Image=$date.".jpg";
$tmppath="images/".$Image;
move_uploaded_file($_FILES['file']['tmp_name'],$tmppath);
$message1 = ?><html><head></head><body>
<? $message1 .= ?><img src="http://www.website.com/appinstaller/ramaraju/images/<?= $Image ?>" /></body></html>
<?php
$headers = "From: support@";
$headers .= "Content-type: text/html";
//mail($to, $subject, $message, $headers);
//$mailimg = '<img src="http://www.myappdemo.com/appinstaller/ramaraju/services/images/$file"</a>';
$to = "ramaraju.d@stellentsoft.com";
$subject = "Hi!";
$message="Title : $title\r\n Location:$location\r\n Contact name:$contactname\r\n Contact:$contactnumber\r\n Description:$description\r\n file:$Image";
if (mail($to, $subject, $message, $headers))
{
$message=array("messsage"=>"Message successfully sent!");
} else {
$message=array("message"=>"Message delivery failed.");
}
}
else
{
$message=array("message"=>"provide values");
}
echo json_encode($message);
?>
</code></pre>
|
php
|
[2]
|
4,083,497 | 4,083,498 |
Android - ImageView selected state without an additional image?
|
<p>I want imageview to become brighter when an user presses (clicks) it, but without an additional image for that state. Is it possible?
We know we have selectors where 2 different images can be used, but I would like to have a selector, a drawable from XML, and one real image.</p>
|
android
|
[4]
|
4,593,692 | 4,593,693 |
Using onNewIntent in ListActivity to update a ListView
|
<p>Can any body elaborate with sample code how to use <code>onNewIntent</code> inside of a <code>ListActivity</code> class so that I can dynamically update my <code>ListView</code> while it is displaying? </p>
|
android
|
[4]
|
3,608,120 | 3,608,121 |
jQuery: Form slideDown() at load
|
<p>How can I have my form load with a <code>slideDown()</code> effect rather than normal rendering?</p>
<p>Also, how do I know when a particular div or element has been loaded?</p>
|
jquery
|
[5]
|
3,032,348 | 3,032,349 |
Automatic form-positioning
|
<p>I want my application to have an auto form-positioning behaviour, similar to the WinAmp MP3 player. I'd like windows to stick to each other, so that if you move one window the other windows follow the movement. How can I do that?</p>
<p>I tried something like this.</p>
<pre><code>if (this.Size.Width + this.Location.X >= 1270)
this.Location = new Point(1280 - this.Width, this.Location.Y); } //right x
if (this.Size.Height + this.Location.Y >= 750)
this.Location = new Point(this.Location.X, 760 - this.Width); } // bottom y
if (this.Location.X <= 5)
this.Location = new Point(0, this.Location.Y); } //left x
if (this.Location.Y <= 5)
this.Location = new Point(this.Location.X, 0); } // top y
</code></pre>
|
c#
|
[0]
|
3,613,925 | 3,613,926 |
Random movement of star on the screen
|
<p>i want to write a ' * ' to center of the screen and than it can move random to rigth,left,up or down every 100 milisecond.if ' * ' is on the end of row it must be at start of that row and if it is on the end of column it must be at start of that column(and also their reverse scenerio is valid).I wrote thats code but the problem is that i can't delete the old movement(so there are ' * ' for every movement)i solved it to put ' _ ' to its old movement.is there any other solution to make just one ' * ' on screen ? And also i can't delete the old movement if ' * ' is at the end of the row.Here is the source code : </p>
<pre><code>private static void MovementOfStar()
{
int row = 40, col = 12;
Console.CursorVisible = false;
Console.SetCursorPosition(row, col);
int direction = 0;
Random r = new Random();
for (int i = 0; i < 1000; i++) // count of movement
{
Console.Write("*");
System.Threading.Thread.Sleep(100);
Console.Write('\b');
Console.Write("_");
direction = r.Next(5);
while (direction== 0)
direction = r.Next(5);
switch (direction)
{
case 1:
if (row + 1 >= 80)
row = 0;
Console.SetCursorPosition(row++, col);
break;
case 2:
if (row - 1 <= 0)
row=79;
Console.SetCursorPosition(row--, col);
break;
case 3:
if (col + 1 >= 25)
col = 0;
Console.SetCursorPosition(row, col++);
break;
case 4:
if (col - 1 <= 0)
col = 24;
Console.SetCursorPosition(row, col--);
break;
}
}
</code></pre>
|
c#
|
[0]
|
396,590 | 396,591 |
Size of Widget Image
|
<p>I have an image that I do not want to scale, I am using fitStart. What size do I need to make it to ensure that it covers a 4x2 widget? I currently have an image that is 1024x768 and it doesn't cover. </p>
<p>UPDATE:
Here is the xml and screen shot:</p>
<pre><code><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget_bg_rl"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/widget_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitStart" />
<LinearLayout
android:id="@+id/current_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:weightSum="8">
<RelativeLayout
android:id="@+id/city_time_rl"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2.5"
android:background="@drawable/rounded_corners_top">
<TextView
android:id="@+id/city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="MECHANICSBURG"
android:textSize="16dp"
android:textColor="@color/dk_blue"
/>
</code></pre>
<p><img src="http://i.stack.imgur.com/Xn9ot.png" alt="enter image description here"></p>
|
android
|
[4]
|
4,586,503 | 4,586,504 |
Python: pass more than one keyword argument?
|
<p>is there possible to pass more than one keyword argument to a function in python?</p>
<pre><code>foo(self, **kwarg) # Want to pass one more keyword argument here
</code></pre>
|
python
|
[7]
|
4,403,777 | 4,403,778 |
How to change the background colour?
|
<p>I want to design a identical screen like messaging screen.Iam using the below xml code for designing the screen. I want to change the background colour as gray for the edittext <code>@+id/txtMessage</code> and for the button as like the messaging screen of android.How can i done that?</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical" >
<EditText
android:id="@+id/txtTO"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:hint="To" />
<requestFocus />
<EditText
android:id="@+id/txtMessage"
android:layout_width="235dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:ems="10"
android:hint="Type the message" />
<Button
android:id="@+id/btnSend"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="Send" />
</RelativeLayout>
</code></pre>
|
android
|
[4]
|
5,985,583 | 5,985,584 |
Finding out what Javascript will run and when
|
<p>What's the best way of finding out what Javascript will run and when? I've outgrown placing functions inside setTimeouts to delay running code to when I <em>think</em> the dependencies have already loaded, etc.</p>
|
javascript
|
[3]
|
4,045,287 | 4,045,288 |
custom checked listview
|
<p>I am New to Android. My Requirement is to check an item of list view and i want show the selected items in next activity.</p>
<p>can anyone help me..</p>
|
android
|
[4]
|
1,969,812 | 1,969,813 |
C++ is blowing my mind
|
<pre><code>#include <iostream>
int main() {
int x = 1;
for(int i = 0; i < 100; ++i);
// What will the next line do? Increment???????????/
++x;
std::cout << x << std::endl;
}
</code></pre>
<p>Why does the code print 1 and not 2?</p>
|
c++
|
[6]
|
265,733 | 265,734 |
C++ class conversion possible?
|
<p>I have the following code:</p>
<pre><code>class B {
public:
B(const std::string& str):m_str(str) { }
B(const B& b):m_str(b.m_str) { }
B& operator=(const B& b) { m_str = b.m_str; return *this; }
private:
std::string m_str;
};
main()
{
std::string a = "abc";
B b(a);
}
</code></pre>
<p>class B belongs to the client. I can't change it and I may not even know its specific name ("B" is simply an example); all I know is there's a client class that accepts a std::string for its constructor. Now I want to change the type of "a" in main() from std::string to A, as defined below:</p>
<pre><code>class A {
public:
A(const std::string& str):m_str(str) { }
A(const char *str):m_str(str) { }
A(const A& a):m_str(a.m_str) { }
A& operator=(const A& a) { m_str = a.m_str; return *this; }
private:
std::string m_str;
};
</code></pre>
<p>So now I have a new main():</p>
<pre><code>main()
{
A a = "abc";
B b(a);
}
</code></pre>
<p>This can't compile properly as it is. Is there anything I can do without changing the new main()? I can't change class B, and class A should not reference class B in any way.
Thanks!</p>
|
c++
|
[6]
|
2,959,758 | 2,959,759 |
Exporting the projects in my solution file to another solution file
|
<p>I have included all my projects, about 42 projects in my solution so when I open the solution file it opens all my projects too, now I have checked out another copy of SVN trunk and I would like to be albe to still use my previous solution file and open them all. So can I just copy-paste my solution file to the new folder that I have checked out code and open it? does it hurt the SVN fille? Is there a more native way for VisualStudio to do that rather than me copy pasting the file?
They look like this in the .sln file:</p>
<pre><code>Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ucmkaryotypebuilder", "..\UCMKaryotypeBuilder\ucmkaryotypebuilder.csproj", "{77D441DF-5D4D-4F89-BE6D-594C18B46229}"
EndProject
</code></pre>
|
c#
|
[0]
|
4,194,530 | 4,194,531 |
Javascript needed for finding a box in a html page then setting contents
|
<p>Can anyone show me how to get to a text edit box in a html page and set its value using Java script please?</p>
|
javascript
|
[3]
|
2,620,974 | 2,620,975 |
why this code call general template function in GCC?
|
<pre><code>#include<iostream>
using namespace std;
// define the general compare template
template <class T>
int compare(const T& t1, const T& t2) {
cout<< "Common_T"<<endl;
return 0;
}
template<>
int compare<const char*>( const char * const& s1,
const char * const& s2)
{
cout<< "Special_T"<<endl;
return 0;
}
typedef const char char6[6];
template<>
int compare<char6>(const char6& s1,const char6& s2)
{
cout << "Special_Char6_T" << endl;
return 0;
}
int main() {
int i = compare("hello" , "world");
}
</code></pre>
<p>the result is:</p>
<pre><code>Common_T
</code></pre>
<p>My question is: why don't output "Special_Char6_T"???</p>
|
c++
|
[6]
|
1,604,275 | 1,604,276 |
getElementById not playing nice with Radio Buttons
|
<p>I am guessing getElementById doesn't work with radio buttons when you want to get the value of it or to find out if it is checked? I say this because I did this:</p>
<pre><code><input id="radio1" type="radio" name="group1" value="h264" checked="checked" />
<input id="radio2" type="radio" name="group1" value="flv" />
</code></pre>
<p>To get the value of the selected one I did this:</p>
<pre><code>function getRadioValue() {
if(document.getElementById('radio1').value=='h264'){
return 'h264';
}
else{
return 'flv';
}
}
</code></pre>
<p>However, firebug keeps telling me:</p>
<pre><code>document.getElementById("radio1") is null
[Break on this error] if(document.getElementById('radio1').checked==true){
</code></pre>
<p>What am I doing wrong?</p>
<p>Thanks all</p>
|
javascript
|
[3]
|
2,594,021 | 2,594,022 |
how can i display voilet color in imageview
|
<p>I need to display a image view that is filled with violet color picture as shown below<img src="http://i.stack.imgur.com/cLNpF.jpg" alt="alt text">,
but there us no UIColor color violet for this.</p>
<p>How can i display it?</p>
|
iphone
|
[8]
|
186,057 | 186,058 |
how can you take an ArrayList of chars and return all those elements from the ArrayList into a String
|
<p>This is the code for trying to answer my question. I'm kind of new with ArrayLists. I used a for loop trying to read every element from the Arraylist and put it in the new String "full" but this won't compile. I need some editing. I don't think this code properly works. I used .add so that I can try adding the elements from the String List to String full. This is what tried to do so far.</p>
<pre><code>public void String() {
ArrayList<Character> StringList = new ArrayList<Character>();
String full;
for(int i = 0; i < arr.length; i++) {
full.add(StringList[i]);
}
return full;
}
</code></pre>
|
java
|
[1]
|
2,027,561 | 2,027,562 |
Virtual function output?
|
<p>I was just doing some stuff and wrote this program. I got the following output. I know that function resolution happens at run time while binding of the variable takes place during compile time, but what I could not understand was the first output I got (<code>this->n</code>). Can anyone explain this to me? </p>
<pre><code> # include <iostream>
# include <stdio.h>
# include <conio.h>
using namespace std;
class A
{
int n;
public:
virtual void Fun1(int no=10)
{
int n=no;
cout<<"A::Fun1() "<<n <<"\n";
}
};
class B :public A
{
int n;
public:
virtual void Fun1(int no=20)
{
int n=no;
cout<<"B::Fun1() " << this->n << "\n"; // WHY SO ? gives B::Fun1() 40
cout<<"B::Fun1() " << n << "\n";
}
};
int main()
{
B b;
A &a =b;
a.Fun1();
A a1=b;
a1.Fun1();
getch();
return 0;
}
</code></pre>
<p>The output I got was</p>
<pre><code> B::Fun1() 40
B::Fun1() 10
A::Fun1() 10
</code></pre>
|
c++
|
[6]
|
5,784,976 | 5,784,977 |
Card Deck Using ENUM, and Boolean Array to create the Deck. Java
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/10592817/how-to-create-a-deck-of-cards-constructor">how to create a deck of cards constructor</a> </p>
</blockquote>
<p>Im trying to create a "deck of cards" using <code>enums</code>. I already have my enum declared, but I'm stuck in how exactly to create the deck of cards using a boolean array. </p>
<p>So far I tried to initialize my constructor, but I don't know what direction to take now. Any help would be greatly appreciated it. </p>
<pre><code> package Cards;
//Class to represent a standard Deck of 52 Playing-Cards
// The following functionality is provided
// Default Constructor - creates a complete deck of cards
// shuffle() - collects all 52 cards into the deck
// deal() - returns a randomly selected card from the deck
//
import java.util.Random;
public class DeckOfCards
{
public static final int DECK_SIZE = 52;
//Instance Variables
private boolean[] deck; //An implicit set of 52 Playing-Cards
private int cardsInDeck;//Number of cards currently in the deck
private Random dealer; //Used to randomly select a card to be dealt
//Constructor
public DeckOfCards()
{
deck = new boolean[ DECK_SIZE ];
for(PlayingCard.CardSuit suit : PlayingCard.CardSuit.values())
for(PlayingCard.CardRank rank : PlayingCard.CardRank.values())
deck[ cardsInDeck++ ] = true;
}
//Collect all 52 Playing-Cards into the deck
public void shuffle()
{
}
//Simulate dealing a randomly selected card from the deck
//Dealing from an empty deck results in a RuntimeException
public PlayingCard deal()
{
return null;
}
</code></pre>
|
java
|
[1]
|
350,881 | 350,882 |
I want to rewrite url through .htaccess rule?
|
<p>Hi guys actually my url is "http://collection.com/alok/ranjan/dubey.php?pid=12" i want to remove two folder in between this url and my output will be "http://collection.com/dubey.php?pid=12" please help me.
i am writing as shown below</p>
<pre><code>Options +FollowSymLinks
RewriteEngine On
RewriteRule ^dubey.php?pid=([a-zA-Z0-9\-]+)$ alok/ranjan/dubey.php?pid=$1
</code></pre>
|
php
|
[2]
|
3,214,190 | 3,214,191 |
set multiple select list options to selected from query
|
<p>I have a field named 'majors' which contains a string of integers seperated by commas. This field is populated from a multiple select list on insert query using the following variable:</p>
<pre><code>$majors_string = implode(",", $majors);
</code></pre>
<p>Now on the edit page, I want to have those values set the options in the same list. Part of the problem is that the list is generated dynamically using:</p>
<pre><code><select name="majors[]" size="9" multiple="multiple" id="majors">
<?php
$query = mysql_query("SELECT * from major ORDER BY title ASC");
for($i=0;$i<mysql_num_rows($query);$i++) {
$row=mysql_fetch_assoc($query);
?>
<option value="<?php echo $row['major_pk']; ?>"><?php echo $row['title']; ?></option>
<?php
}
?>
</select>
</code></pre>
<p>On the initial query on the edit page, I have:</p>
<pre><code>$query_topic = "SELECT * FROM topic WHERE topic_pk = '$topic_pk'";
$result_topic = mysql_query($query_topic, $connection) or die(mysql_error());
$row_topic = mysql_fetch_assoc($result_topic);
$retrieved_majors = explode(",", $row_topic['majors']);
</code></pre>
<p>But I'm unsure as to set the options in the multiple list to the values in array $retrieved_majors. </p>
<p>Thanks for any help!</p>
|
php
|
[2]
|
5,927,527 | 5,927,528 |
make static buttons dynamic
|
<p>I have added 10 custom buttons using interface on view. Now I want to make visible that no of buttons only whenever user put value. e.g If user put 5 then on button click 5 buttons get visible. Can it be possible? If anyone know please give me the solution.</p>
<p>Thanks alot.</p>
|
iphone
|
[8]
|
5,265,576 | 5,265,577 |
Basic Android Licensing Enquiry
|
<p>I am going to be sending off press-kits to various reviewers in regards to my new Android game and I am wondering how I should go about sending them an APK they can test? The game is paid and licensed.</p>
<p>If I send them the licensed version of the game they won't be able to run it on their phones without buying it. However, if I send them an unlicensed version and someone leaks it then everyone will just be able to get my game for free. What should I do?</p>
|
android
|
[4]
|
900,676 | 900,677 |
duplicate folder with secure pages in it
|
<p>why am i getting a duplicate PhotoAdmin instead of just one?This folder is were the secure pages reside. Look at the error below:</p>
<p>The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. </p>
<p>Requested URL: /living_to_please_god_world/PhotoAdmin/PhotoAdmin/forum.aspx</p>
|
asp.net
|
[9]
|
1,999,677 | 1,999,678 |
showing 3 Images in a table row from a list of 10 images or more - PHP
|
<p>in a database there are some images [of unknown number], i need to show them 3 in a row
here is my code, but it does not work [in some row it shows 2 or 4 photos] :(</p>
<pre><code><?php
$temp=0;
$stmt = mysqli_prepare($con,"select PicName from Pic_Details");
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt,$picName);
while(mysqli_stmt_fetch($stmt))
{
if ($temp % 3==0)
echo '<tr>';
echo '<td valign="top" width="150px"><img src="'.$picName.'"/></td>';
if ($temp % 3==0)
echo '</tr>';
++$temp;
}
?>
</code></pre>
<p></p>
|
php
|
[2]
|
2,621,409 | 2,621,410 |
How do I convert an OctetString into a readable String(C#)?
|
<p>I'm using a SNMP library for C# and it doesn't have a good documentation.
When I request a Date it's returning me a OctetString and I'm not sure what to do with it.</p>
<p>When I convert it to String it become this:
07 DC 02 17 0F 14 0E 00 2D 02 00</p>
|
c#
|
[0]
|
5,486,103 | 5,486,104 |
Consuming data from WikiNews
|
<p>I have been scouring the net but I can't seem to find any examples of consuming data from <a href="http://en.wikinews.org/wiki/Main_Page" rel="nofollow">WikiNews</a>. They have an RSS feed with links to individual stories as HTML, but I would like to get the data in a structured format such as XML etc.</p>
<p>By structured format I mean an XML file for each story that has a defined XML schema (XSD) file. See: [http://www.w3schools.com/schema/schema_intro.asp][2]</p>
<p>Has anyone written a program that consumes stories from WikiNews? Do they have a documented API?</p>
<p>I would like to use C# to collect selected stories and store them in SQL Server 2008.</p>
<p>[2]: By "structured format" I mean something like an XML schema (XSD) file. See: <a href="http://www.w3schools.com/schema/schema_intro.asp" rel="nofollow">http://www.w3schools.com/schema/schema_intro.asp</a></p>
|
c#
|
[0]
|
5,065,240 | 5,065,241 |
How to show the information from the link without leaving the site? PHP
|
<p>I got the site fully working and returning the information from the rss feed since the it return with website link how can i display the information from the link instead of redirect the user back to the original site?</p>
<pre><code><?php
$query = 'http://query.yahooapis.com/v1/public/yql?q=Select%20*%20from%20rss%20where%20url%3D%22http%3A%2F%2Fnestor.sunderland.ac.uk%2F~bf71wx%2FphpTest%2Fjquery.mobile-1.0.1%2520-%2520%25E8%25A4%2587%25E8%25A3%25BD%2Fjquery.mobile-1.0.1%2Fdemos%2Fdocs%2Frss%2FNews.xml%22%20&diagnostics=true';
$xml = simplexml_load_file($query);
//var_dump($xml);
echo '<h2>World of Tank News</h2>';
//iterate over query result set
$results = $xml->results;
foreach ($results->item as $r){
echo $r->title . "<br />";
echo "<a href=\"" . $r->link . "\">" . $r->link . "</a><br /><br />";
echo 'Publish Date - ';
}
?>
</code></pre>
|
php
|
[2]
|
2,473,130 | 2,473,131 |
decimal to binary on c++
|
<pre><code>#include <iostream>
using namespace std;
int main()
{
int q, r, x;
cout << "enter #: ";
cin >> x;
q=x;
while (q != 1)
{
r = (q % 2);
cout << r << endl;
q = (q/2);
if (q==1)
cout << q;
break;
}
return 0;
}
</code></pre>
<p>*I dk how to make it so it works with the length of input</p>
|
c++
|
[6]
|
2,708,886 | 2,708,887 |
java class cast Exception Error
|
<p>I'm developing my website in struts, hibernate and jsp. I had called a function which is in my DAO page from my action page like this:</p>
<pre><code>private List<Order> salesDetails = new ArrayList();
salesDetails = doctorDao.getInstance().getDoctorSalesDetails(SessionObj.getId(),activityGraph);
</code></pre>
<p>and in my dao function I write the code like this</p>
<pre><code>public List getDoctorSalesDetails(int id,int activityGraph){
List<Order> doctorSalesDetails=new ArrayList();
try{
SessionFactory sessionFactory =
(SessionFactory) ServletActionContext.getServletContext().getAttribute(HibernateListener.KEY_NAME);
Session Hibernatesession = sessionFactory.openSession();
Hibernatesession.beginTransaction();
doctorSalesDetails = Hibernatesession.createSQLQuery("SELECT total_amount,created_at FROM `order` WHERE created_at > DATE_SUB(curdate(),INTERVAL "+activityGraph+" DAY) AND doctor_id = "+id+" GROUP BY created_at").list();
Hibernatesession.getTransaction().commit();
}catch(Exception e){
e.printStackTrace();
}
return doctorSalesDetails;
}
</code></pre>
<p>The query result is successfully working here. The problem is when I access the the return variable from my action page like this:</p>
<pre><code> try{
for( Order o: salesDetails) {
System.out.println("Total amount="+o.getCreatedAt());
}
}catch(Exception e){
e.printStackTrace();
}
</code></pre>
<p>it causes following error :</p>
<pre><code>java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.myDrDirect.hbmobj.Order
at com.myDrDirect.doctor.action.DoctorDashBoardActivity.getDashBoardActivityDetails(DoctorDashBoardActivity.java:36)
</code></pre>
<p>What might be the issue?</p>
|
java
|
[1]
|
61,736 | 61,737 |
can i handle UK errors in aspx?
|
<p>Server Error in '/' Application.
Cannot insert duplicate key row in object 'dbo.Articles' with unique index 'UK_Articles'.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.</p>
<p>Exception Details: System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object 'dbo.Articles' with unique index 'UK_Articles'.
The statement has been terminated.</p>
<p>can i instead of internal server error 500 show UK error? can i catch the error and show it somehow?</p>
<p>EDIT:</p>
<pre><code> try
{
NHibernateSession.Save(entity);
}
catch (SqlException sex )
{
if (sex.Message.Contains("with unique index"))
throw new UniqueConstraintException("UK ERROR");
throw;
}
</code></pre>
<p>but NHibernateSession.Save(entity) always trow GenericADOException and never SqlException. I want to catch insert at nhibernate so that i can ctach it globally.</p>
|
c#
|
[0]
|
3,048,054 | 3,048,055 |
Passing string into Onchange
|
<p>I am having a hard time passing a string constant into an onchange event.
code example which i am trying:</p>
<pre><code>var rvalue = "hi";
var r1 = '<label style="vertical-align:2px;">Group by: </label>' +
'<select id="pwx_documents_range_groupby" onchange="ravi('+rvalue+');">' +
'<option value="listview" selected="selected">List View</option><option value="notetype">Note Type</option><option value="author">Author View</option>'+
'<option value="cat">Cat</option></select>'
</code></pre>
<p>This is just sample code.. But the question is once drop down change it will call ravi function and throw me the error 'hi' is undefined. If i am passing 0 instead of hi it works great. I am totally surprise why it will not accept the string.</p>
<p>Anybody have any idea that would be great help.</p>
|
javascript
|
[3]
|
248,040 | 248,041 |
Accessing Sort column AND direction
|
<p>I have a nice jQuery datatable happening with sortable columns. A request came in to capture 1) The column that was clicked on and 2) the sort direction at the time of the click. I've looped through various sort related objects in the datatables object but cannot seem to get those two singular values.</p>
<p>For the purpose of this question, I would like the end result to be something like alert('You clicked the column ' + column) and alert('The sort direction when you clicked was ' + sort direction).</p>
<p>How do I accomplish this? As always, thanks in advance.</p>
|
jquery
|
[5]
|
4,479,009 | 4,479,010 |
error C2036: 'Agent *const ' : unknown size in 'vector' class
|
<p>I'm getting an error occurring in the <code>vector</code> class, as in, the class which you access when you <code>#include < vector ></code></p>
<p>I it get only once, and I don't have a clue why it would be occurring:</p>
<blockquote>
<p>error C2036: <code>'Agent *const '</code> : unknown size</p>
</blockquote>
<p>This is also occurring in vector, and the code that has the error is here:</p>
<pre><code>size_type size() const
{ // return length of sequence
return (this->_Mylast - this->_Myfirst); // error on this line
}
</code></pre>
|
c++
|
[6]
|
332,298 | 332,299 |
in-app purchase creation in apstore ?
|
<p>I have an application with some in-app purchase in IPhone. Now i want to add a new version of my application with an extra in-app purchase. I need to keep the existing one as same. But to add an extra subscription type in place. How i can add this with in my itunes account. Can anybody provide the step by step procedure for that. Any help will be greatly appreciated.?</p>
|
iphone
|
[8]
|
3,295,890 | 3,295,891 |
How to get a Number key Pad with a point in iPhone
|
<p>Hi I am using the following code for a text box</p>
<p>UITextField *txt_field = [[UITextField alloc] initWithFrame:frame];</p>
<p>[txt_field setKeyboardType: UIKeyboardTypeNumberPad];</p>
<p>Now When I click on the text field, a number pad comes up which dont have a decimal point option. I want a text field with just number pad where user can enter the number in decimal point also. I know I can use other pads but I dont want to allow user to have access to any other character keys other than number and a point. Is it possible.</p>
<p>tnx</p>
|
iphone
|
[8]
|
5,644,225 | 5,644,226 |
Why does Func and Action Delegates only take 4 arguments?
|
<p>Why 4? I know its in the documentation as 4, but that just seems strange.</p>
|
c#
|
[0]
|
2,410,952 | 2,410,953 |
PHP Error. I don't know how to do, hope someone can help me
|
<pre><code>NOTICE
Message: unserialize() [function.unserialize]: Error at offset 311 of 355 bytes
File: /includes/classes/class.php
Line: 369
URL: ****
PHP-Version: 5.3.10
PHP-API: cgi-fcgi
MySQL-Cleint-Version: 5.1.49
Debug Backtrace:
#0 [internal function]: errorHandler(8, 'unserialize() [...', 'FILEPATH ...', 369, Array)
#1 /includes/classes/class.PlanetRessUpdate.php(369): unserialize('a:5:{i:0;a:5:{i...')
#2 /includes/classes/class.PlanetRessUpdate.php(358): ResourceUpdate->CheckPlanetBuildingQueue()
#3 /includes/classes/class.PlanetRessUpdate.php(95): ResourceUpdate->BuildingQueue()
#4 /includes/pages/game/class.AbstractPage.php(44): ResourceUpdate->CalcResource()
#5 /includes/pages/game/class.ShowOverviewPage.php(35): AbstractPage->__construct()
#6 /game.php(49): ShowOverviewPage->__construct()
#7 {main}
</code></pre>
|
php
|
[2]
|
3,314,088 | 3,314,089 |
any way to have std::unordered_set<Base>::count(Derived c)?
|
<p>Lets say I have an abstract base class and a derived class with some unique functionality:</p>
<pre><code>class Shape
{
public:
Shape();
};
class Circle : public Shape
{
public:
Circle(int radius) : radius(radius);
int getRadius() { return this->radius; };
private:
int radius;
};
</code></pre>
<p>Now I can put Circle*:s in std::vector and check afterwards if vector has Shape*</p>
<pre><code>std::vector< Circle* > v;
Circle* circle = new Circle(1);
v.push_back(circle);
// ...
Shape* someShape = ...; // I know it's a Circle but the pointer comes from class that only knows about Shapes
for(std::vector< Circle* >::iterator it = v.begin(); it != v.end(); ++it)
{
Circle* c = *it;
if((Shape)c == someShape)
{
// found
}
}
// ...
delete c;
</code></pre>
<p>But I want to use std::unordered_set (applies also to std::unordered_map, std::set, std::map) because it has faster-than-linear find() and count()</p>
<pre><code>std::unordered_set< Circle* > u;
Circle* circle = new Circle(1);
u.insert(circle);
// ...
Shape* someShape = ...; // I know it's a Circle but the pointer comes from class that only knows about Shapes
if(u.count(someShape) == 1)
{
// found
}
</code></pre>
<p>Instead of the obivious I get "undefined function" as there only exists std::unordered_set< Key >::count(Key& k);</p>
<p>Is there any way I can find() or count() from std::unordered_set using base class?</p>
|
c++
|
[6]
|
5,180,720 | 5,180,721 |
How are `and` and `or` statements in Python different with each other?
|
<p>If you look at this:-</p>
<pre><code>>>>a = "hello"
>>>b = "world"
>>>print a and b
world
>>>print b and a
hello
</code></pre>
<p>and this:-</p>
<pre><code>>>>a = "hello"
>>>b = "world"
>>>print a or b
hello
>>>print b or a
world
</code></pre>
<p>Both are almost similar. So how are they different?</p>
|
python
|
[7]
|
3,673,241 | 3,673,242 |
Filter an array in PHP
|
<p>I'm trying to write a sort/filter script using an array filter function in PHP using the lambda syntax.</p>
<p>This achieves what I want to do, but it looks like it can be optimised:</p>
<pre><code>$offersReceivedProcessedByItem = array();
foreach ($this->currentSessionUser->items as $item) {
$receivedOffersOnItem = array();
foreach ($offersReceived as $offerReceived) {
if ($offerReceived->item->id === $item->id) {
$receivedOffersOnItem[$offerReceived->id] = $offerReceived;
}
}
offersReceivedProcessedByItem[$item->id] = $receivedOffersOnItem;
}
</code></pre>
<p>(for each item a user has, filter through the offersReceived array and add the offer to a new array if it has an equal id, if that makes sense?!).</p>
<p>Here's what I'm trying:</p>
<pre><code>$offersReceivedProcessedByItem = array();
foreach ($this->currentSessionUser->items as $item) {
$receivedOffersOnItem = array_filter($item->offers, function($offer){
return $offer->item->id === $item->id;
});
$offersReceivedProcessedByItem[$item->id] = $receivedOffersOnItem;
}
</code></pre>
<p>But i'm getting that $item is undefined, I expect it's closed scope so I tried passing $item as another argument but then i'm getting 'missing argument 2'.</p>
<p>I tried this using the relational approach built into Fuel but PHP eats too much memory and fails.</p>
<p>Any help? What am I getting wrong?</p>
|
php
|
[2]
|
1,426,408 | 1,426,409 |
better way to code recursive if statements
|
<p>I find myself in this position occasionally, and I'm sure there is a better way to do it than I am currently.</p>
<p>In this example, I'm trying to sort a group of times where I have conflicting items. I need to know what times are high-priority,can't be moved, vs low priority, can be moved.
But I'm pretty sure this code is very inefficient. </p>
<pre><code>var holdLowPriorities = [];
for (conflict = 0; conflict < sortedTimes.length - 1; conflict++) {
var firstConflictTimeStart = sortedTimes[conflict][0];
var firstConflictTimeEnd = sortedTimes[conflict][1];
var secondConflictTimeStart = sortedTimes[conflict + 1][0];
var secondConflictTimeEnd = sortedTimes[conflict + 1][1];
if (firstConflictTimeStart < secondConflictTimeEnd &&
firstConflictTimeEnd > secondConflictTimeStart) {
// are either of the conflicts a high priority
var firstContactPriority = sortedTimes[conflict][2];
var secondContactPriority = ortedTimes[conflict + 1][2]
if (firstConflictPriority == 2) {
//this is high priority, can't move
}
if (secondConflictPriority == 2) {
// this is also a priority, but has to move
}
// are either of the conflicts a low priority?
if (firstConflictPriority == 0) {
// this is a low priority so I can adjust the time
} else if (secondConflictPriority == 0) {
// this is a low priority so I can adjust the time
}
}
}
</code></pre>
<p>Unfortunately, I don't even know what to call this type of a problem, and therefore don't know what to look for, though I'm sure the answer isn't overly complicated (I hope not anyway). </p>
|
javascript
|
[3]
|
663,952 | 663,953 |
loading items from index
|
<p>i am trying to get a random number of items from an an array of dictionaries that contains 2 items. one item is at index 1 and the other is at index 0. i want to randomly alternate between the two or have the able to be viewed in a random order each item. (i know i have just 2 items ill increase the amount)
this is the code im trying to get to randomize with the index 0 and index 1 files.</p>
<pre><code> - (UIImage *)imageAtIndex:(NSInteger)index
{
NSDictionary *dict = [data_ objectAtIndex:0];
UIImage *image = [dict objectForKey:@"fullsize"];
return image;
}
</code></pre>
|
iphone
|
[8]
|
3,650,848 | 3,650,849 |
Intent to launch marketplace app, show all apps by publisher?
|
<p>Is there a way to get the marketplace app to open to a page showing all your apps? I was hoping this would have done it:</p>
<pre><code> https://market.android.com/developer?pub=My+Company+Name
</code></pre>
<p>but it doesn't. Basic idea is to have a button in my game to take users to a page of other apps I've written.</p>
<p>Thanks</p>
|
android
|
[4]
|
3,210,882 | 3,210,883 |
Can't write text into textbox in ASP.NET web app
|
<p>I have an ASP.NET web application.</p>
<p>In the codebehind for the .ascx page (which I embed as below), I attempt to write a string to a textbox in a method like this:</p>
<p>Code for embedding control:</p>
<p>Control ctrl = Page.LoadControl("/RackRecable.ascx");
PlaceHolder1.Controls.Add(ctrl);</p>
<p>Method to make string for inserting into textbox:</p>
<pre><code> string AppendDetails()
{
StringBuilder sb = new StringBuilder();
sb.Append("msg" + " " + textbox1.Text etc etc );
return sb.ToString();
}
</code></pre>
<p>Called as (in codebehind event handler for button click):</p>
<pre><code> this.TextBox4.Text = AppendDetails();
</code></pre>
<p>I call it by using ATextBox.Text = AppendDetails (in the button click event handler). The textbox TextBox4 is in the designer file so I am confused why the text does not get written into this textbox (it is readonly and enabled).</p>
<p>When stepping through, the textbox4 control will successfully show the text I want it to display in quick watch but not in the actual page, it won't.</p>
<p>Any ideas?</p>
<p>Thanks</p>
|
asp.net
|
[9]
|
1,510,909 | 1,510,910 |
What's an efficient way to test if a player has clicked on one of many objects in a Java game?
|
<p>This is a basic question, but since I haven't been coding Java for long I'd like to get an opinion from someone with more experience. Let's say I have a game in Java in which there are many objects (on the order of 30) on the screen. The player can click on an object and each object handles a mouse click differently.</p>
<p>My question is: if the player clicks on the game window, what's a good way to test if he clicked one of the objects, and if so, trigger that object's mouse click event handler?</p>
<p>Here's what I've come up with so far: my applet has a mouse listener and it could also have a list of all game objects currently in existence. The applet's event handler could traverse the list of objects and see if the coordinates of the click are inside that object's bounding box through something like <code>gameObject.isInsideBBox(int mouseX, int mouseY)</code>.</p>
<p>This would be simple to set up, but I feel like it would be inefficient. If the number of objects is large then the program would have to traverse the list every time a user clicks. Couldn't this become a performance issue?</p>
<p>One alternative would be to have each object have its own MouseListener and add all the objects to some sort of global container. Would this method be more efficient in terms of performance than the above? One other concern is that these Component and Container objects seem to be defined in Java's Swing library, but I'm not using Swing for any other purposes. I have the feeling that would be a misuse of the library.</p>
<p>Any feedback/comments?</p>
<p>(I'd be interested to know if these methods would port over to Android. I realize that's a different topic, but if you have any insight on that, I'd appreciate if you could let me know.)</p>
|
java
|
[1]
|
4,654,544 | 4,654,545 |
Checking strings as valid integers
|
<p>i wan to split a string and then check if every part that i splitted is a number or an identifier this is what i did so far :)</p>
<pre><code>public class splitest {
public void splitfunc() {
String str = "A:25";
String[] temp = null;
temp = str.split(":");
run(temp);
}
public void run(String[] s) {
for (int i = 0; i < s.length; i++) {
if (s[i].equals(" ")) { // <<< checks if the splitted string is a digit ot not??
System.out.println(s[i]+" is a number");
} else
System.out.println(s[i]+" is an Identfier");
}
}
public static void main(String args[]) throws Exception {
splitest ss = new splitest();
ss.splitfunc();
}
}
</code></pre>
<p>is there a way to convert the string into a digit then check or something?</p>
<p>the output should be like this:
this is an identifier
this is a number</p>
|
java
|
[1]
|
18,586 | 18,587 |
Parsing a stdout in Python
|
<p>In Python I need to get the version of an external binary I need to call in my script.</p>
<p>Let's say that I want to use <a href="http://en.wikipedia.org/wiki/Wget" rel="nofollow">Wget</a> in Python and I want to know its version.</p>
<p>I will call </p>
<pre><code>os.system( "wget --version | grep Wget" )
</code></pre>
<p>and then I will parse the outputted string.</p>
<p>How to redirect the stdout of the os.command in a string in Python?</p>
|
python
|
[7]
|
2,965,731 | 2,965,732 |
Creating symbolic links from an Android java app
|
<p>I'm developing a small android java app - i'm a real newbie with android.
I'm looking for a way to create a symbolic link from my application on a certain directory.</p>
<p>I need to execute this as root - this assume the owner of the phone has root permissions on his file system.</p>
<p>Can someone pls help me?
I couldn't find it... if there isn't an API for this is there an alternative, like running a native script or something? </p>
<p>Thanx!
Gili</p>
|
android
|
[4]
|
1,795,734 | 1,795,735 |
What does this function do? And what is the odd syntax?
|
<p>Can someone explain what this piece of code does. what is the test function testing for?</p>
<pre><code>temp = "blah"
if ( /from_url=$/.test(temp) ) {
//do something
}
test : function(s, p) {
s = s.nodeType == 1 ? s.value : s;
return s == '' || new RegExp(p).test(s);
}
</code></pre>
<p>Also in the initial condition what does the syntax if(/from_url=$/) do?</p>
|
javascript
|
[3]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.