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 |
|---|---|---|---|---|---|
4,730,951 | 4,730,952 | Why do I get this compile error in Java? | <p>In java why is the following code not allowed by the compiler?</p>
<pre><code>public class Test {
public static void main(String[] args) {
int x;
int x = 4;// the error is generated here
}
}
</code></pre>
| java | [1] |
1,799,068 | 1,799,069 | PHP Pattern searching | <p>Im trying to search for nn/nnnnnn/nn in a file..</p>
<p>I have this</p>
<pre><code>if (preg_match_all("([0-9]{6})", $file, $out)) {
echo "Match was found <br />";
print_r($out);
</code></pre>
<p>which deals with the centre 6 numbers but how do I get it to search for the whole pattern?
I get a little confused when i have to add the search strings together.
I know I have to do the following</p>
<p>([0-9]{2}) and / and ([0-9]{6}) and / and ([0-9]{2})</p>
<p>HOw do I add the search string as one?
Thanks in advance
Cheers
Mat</p>
| php | [2] |
4,161,360 | 4,161,361 | .Net Assemblies Decompiler that Convert Assemblies into C# Source Code | <p>I am well aware that one can use reflector to browse the content inside an assembly, and one can use <a href="http://www.denisbauer.com/NETTools/FileDisassembler.aspx" rel="nofollow">FileDisassembler</a> to convert the content into the c# source code with cs projects. But the source code outputted by <code>FileDisassembler</code> may not be able to compile if it has interface with property. </p>
<p>Is the other similar applications that do what <code>FileDisassembler</code> does?</p>
| c# | [0] |
2,929,791 | 2,929,792 | Add multiple events to calendar without opening calendar ..? | <p>I have searched through the forum for my answer,</p>
<p>But all the calendar questions seem to get the same answer.</p>
<p>It appears that the answers given, allows the user to</p>
<p>select the calnder, then the calendar opens for the user</p>
<p>to enter event using the calendar app, then returns to the user's </p>
<p>app once event has been created.</p>
<p>What i'm attempting to do is create a shift planner for my</p>
<p>workmates.</p>
<p>I need the user to be able to enter start date, start time</p>
<p>and shift pattern into edit text, and then my app will </p>
<p>add a event to calendar for each day the shift falls on.</p>
<p>I would like my App to do this without opening the calendar</p>
<p>for each single event, because this would make the app pointless.</p>
<p>Can anyone please point me in the right direction, with regards</p>
<p>to parsing a single event to calendar, without calendar opening.</p>
<p>I will work out the multiple events myself..(easy part :) )</p>
<p>Many thanks</p>
| android | [4] |
3,426,702 | 3,426,703 | Getting the id of a table row when a checkbox is checked | <p>I have a checkbox inside a table row</p>
<pre><code><tr id="1">
<td><input type="checkbox" /></td>
<td>lorem</td>
<td>ipsum</td>
<td>css</td>
</tr>
</code></pre>
<p>I want to get the id when the checkbox is checked</p>
<p>I have tried this</p>
<pre><code>var closestTr = $(':checkbox:checked').closest('tr').attr('id');
alert(closestTr);
</code></pre>
<p>I also tried this <a href="http://jsfiddle.net/AbfJk/3/" rel="nofollow">http://jsfiddle.net/AbfJk/3/</a></p>
<p>Why doesn't it get the id?</p>
| jquery | [5] |
3,618,098 | 3,618,099 | Navigation and Toolbar customized background image is not working in IOS 5 | <p>I have implemented customized navigation and toolbar in our project using xcode 4(ios 4.3) and its working fine there but now i have updated my xcode 4.2(ios 5), here its not working. things to be strange please help on this one</p>
<p>Here is my app delegate code</p>
<pre><code>@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"TopBg_with_logo.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
@implementation UIToolbar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"btmbar_Bg.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
</code></pre>
| iphone | [8] |
5,016,652 | 5,016,653 | Quick and easy jQuery effect | <p>Hi I'm looking for a quick and easy solution to the following:</p>
<p>I have a division tag that is three times the width of the cell (so my visible cell/div will be 200px but the content will be 600px) it needs to be displayed in and I would like it to do the following:</p>
<pre><code>--------------------------
| | | |
| 1 | 2 | 3 |
| | | |
--------------------------
</code></pre>
<p>Initially I would like to see 1 then when the user clicks on a link in 1 it should slide to 2. When on 2 the user would be presented with a simple 2 field form for name and phone number. When the user clicks the submit button I would like it to send the form then slide across to 3 which will be a thank you message before sliding back to 1 after X number of seconds.</p>
<p>I feel that it should be easy and feel that it should be very simple to implement but only started using jQuery recently so still getting my head around it all!</p>
<p>Any help would be appreciated.</p>
| jquery | [5] |
2,131,340 | 2,131,341 | Program does not contain a static ‘Main’ method suitable for an entry point | <p>What do I do if I just want to create a project which contains a bunch of library functions? In other words no Main method is required. It seemed to be compiling a minute ago and then I added another .cs file and now I am confronted with this error message.</p>
| c# | [0] |
1,861,791 | 1,861,792 | Substituting missing values in Python | <p>I want to substitute missing values (None) with the last previous known value. This is my code. But it doesn't work. Any suggestions for a better algorithm?</p>
<pre><code>t = [[1, 3, None, 5, None], [2, None, None, 3, 1], [4, None, 2, 1, None]]
def treat_missing_values(table):
for line in table:
for value in line:
if value == None:
value = line[line.index(value)-1]
return table
print treat_missing_values(t)
</code></pre>
| python | [7] |
447,525 | 447,526 | how can I get digits from the two digits? | <p>I want to get the single digits from two digits.for example if 36 I need to store 3 and 6 in different variables.Is it possible?</p>
| php | [2] |
6,001,711 | 6,001,712 | converting char to unsigned char | <p>How the conversion works ? For example:
Scope of char[-128, 127],
scope of unsigned char[0, 255]</p>
<pre><code>char x = -128;
unsigned char y = static_cast<unsigned char>(x);
cout<<y; //128
</code></pre>
<p>Why not 0 ?</p>
| c++ | [6] |
2,357,720 | 2,357,721 | call JS function via url | <p>i got a got a little embedded system that can be controlled via a webinterface.</p>
<p>the page looks like:</p>
<pre><code>...
<a href="javascript:foo(bar)">foo</a>
...
</code></pre>
<p>is there a way to call this function just by http? like</p>
<pre><code>http://<the-devices-ip>:80/javascipt:foo(bar) //wrong
</code></pre>
<p>thank you</p>
| javascript | [3] |
4,981,314 | 4,981,315 | ChangePassword control, Text required error message does not appear | <p>I have a ChangePassword control on a page like thus:</p>
<pre><code><asp:ChangePassword ID="ChangePassword1" runat="server"
NewPasswordRegularExpressionErrorMessage="Password must be atleast 8 characters, containing upper & lowercase, numeric and special characters."
ConfirmPasswordRequiredErrorMessage="Confirm Password is Required."
PasswordLabelText="Current Password:" OnChangedPassword="ChangePassword1_ChangedPassword">
</asp:ChangePassword>
</code></pre>
<p>When the page runs if the user leaves the Confirm Password textbox blank, then the page displays a red * next to the textbox but no error message. Same thing happens for the other textboxes.</p>
<p>However if the user doesn't meet the Regular Expression rule then the error message set at NewPasswordRegularExpressionErrorMessage is displayed (I'm setting the regex value in the code behind).</p>
<p>I've tried adding a ValidationSummary and pointing it at ChangePassword1 control but no change.</p>
<p>How do I get an error message to display if the user leaves textboxes empty?</p>
| asp.net | [9] |
3,810,701 | 3,810,702 | How to use AsyncTask for updating the data for Custom ListView | <p>How to create and update listview using AsyncTask getting data from server.Actually i am facing the problem for updating the listview i am using the handler and after some second i got update listview but the hadler class continue and when i start new activity related to my app same time if handler is called then my app is being crashed.</p>
| android | [4] |
1,671,746 | 1,671,747 | Compare length of three lists in python | <p>Is there a nicer way to compare the length of three lists to make sure they are all the same size besides doing comparisons between each set of variables? What if I wanted to check the length is equal on ten lists. How would I go about doing it?</p>
| python | [7] |
4,254,557 | 4,254,558 | php file uploads' size | <p>do we have any size issue with the file uploads that we perform in php using
$_file[upload][name]? is there any restriction for the file upload using this ??? juz need to know ..</p>
| php | [2] |
2,816,208 | 2,816,209 | How get references on <include> elements from code? | <p>How can I get reference to <code><include></code> elements(Can I get reference by id to an element in layout that I add through <code><include></code> tag)?</p>
| android | [4] |
3,199,613 | 3,199,614 | loop through elements with jquery? | <p>i've never looped through elements with jquery and it would be great with some help.</p>
<p>my DOM looks like:</p>
<pre><code><div class="section">
<div class="group">
<div class="comment">
<input class="comment" type="text" />
<br />
</div>
<div class="link">
<input class="link" type="text" />
<input class="link" type="text" />
<br />
</div>
</div>
<div class="group">
<div class="comment">
<input class="comment" type="text" />
<input class="comment" type="text" />
<br />
</div>
<div class="link">
<input class="link" type="text" />
<br />
</div>
</div>
</div>
</code></pre>
<p>how do i write the code to get all values in text input fields (class=comment and class=link). there will be lot of groups with different numbers of text input fields.</p>
<p>thanks!</p>
| jquery | [5] |
5,395,953 | 5,395,954 | Add quote in javascript generated links | <p>How do i fix this link in javascript.</p>
<pre><code><a href="javascript:clientGalleryLink(Business)">Link</a>
</code></pre>
<p>Its missing single quotes around 'Business'</p>
<p>Javascript:</p>
<pre><code>html += "<option value='javascript:clientGalleryLink(" + titleArray[x] + ")'>" + titleArray[x] + "</option>";
</code></pre>
| javascript | [3] |
1,527,179 | 1,527,180 | Count how many digits in a var | <p>I'm trying to do frame by frame animation in html5, but the outputted files are numbered automatically like so 00010, 00011 etc.. </p>
<pre><code>var imgNumber = 00001;
var lastImgNumber = 00200;
</code></pre>
<p>Using the above and trying to increase the value by 1 removes the leading zeros. Perhaps, I can count how many digits are in the number, and depending on how many I can concatenate the extra zeros as a string? </p>
<p>What's the best way of approaching this?</p>
| javascript | [3] |
1,954,549 | 1,954,550 | Android - is there a way to tell which Intent the back button will take you to? | <p>I am overwriting this fuction:</p>
<pre><code> @Override
public boolean onKeyUp(int keyCode, KeyEvent event)
</code></pre>
<p>but is there a way to tell which Intent or screen the back button is about to take the user to?</p>
<p>Thanks!</p>
| android | [4] |
4,660,456 | 4,660,457 | Blocking a pull-down menu in Android | <p>We have an industrial app running on stock Samsung Android devices. Because it's an industrial app we are trying to have it "take over" the device. We've got this pretty well working by setting in the manifest</p>
<pre><code> <category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</code></pre>
<p>and by intercepting the Android "back" key via onBackPressed and doing nothing.</p>
<p>Our one remaining conundrum is that Samsung's UI layer, 'Touch Wiz', has a pull-down menu that the user can pull down over the top of our app and access other features from. We're trying to disable that.</p>
<p>Is there anything we can intercept that the way we did the the back button to block that? Any other way to block it?</p>
<p>(if someone suggests "rooting" the device, what could I do as root that would help here?)</p>
<p>Thanks in advance!! </p>
| android | [4] |
5,839,515 | 5,839,516 | get session id in asp.net | <p>how can i get id's of all current session.</p>
| asp.net | [9] |
954,932 | 954,933 | Filter phone numbers out of message | <p>I'd like to filter phone numbers out of the users message. The problem is ofcourse that a phone number can be written in different ways. Like:</p>
<p>0612345678
06 123 45 678
+31 (0)612345678
+31 (0)6 12 34 56 78</p>
<p>But I've got absolutely no clue how to do this and I'm pritty stuck. Can anyone help me a bit?</p>
<p>Thanks!</p>
<p>Edit:
In the meanwhile I came with this regular expression: "/(\d|\s){5,}/im". This filters every number of at least 5 characters and ignores the spaces. That way, all numbers from my previous example will be filtered.</p>
| php | [2] |
2,517,698 | 2,517,699 | Play youtube videos directly without prompting for Youtube app in an android app | <blockquote>
<p>Plz help<
i want to create an android app where i want to play youtube videos directly without asking for youtube app</p>
</blockquote>
<p>Thanks in advance </p>
| android | [4] |
2,896,362 | 2,896,363 | What would cause an uploaded image via PHP display in a browser but not in Windows Explorer? | <p>This PHP script uploads a file which is an image, when the image has been uploaded to the directory it is viewable in the browser, but when I navigate to the image in Windows Explorer I can not view it. What would be the cause of this and why is image behaving in this manner?
<pre><code>$valid_formats = array("jpg", "png", "gif", "bmp","jpeg");
if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") {
$name = $_FILES['photoimg']['name'];
$size = $_FILES['photoimg']['size'];
if(strlen($name)) {
list($txt, $ext) = explode(".", $name);
if(in_array($ext,$valid_formats)) {
if($size<(1024*1024)) {
$actual_image_name = time().".".$ext;
$tmp = $_FILES['photoimg']['tmp_name'];
//This is where the image upload is executed.
if(move_uploaded_file($tmp, $path.$actual_image_name)) {
chmod($path.$actual_image_name, 0777);
echo "<img src='".$path.$actual_image_name."' class='preview' width='306px'>";
}
else {
echo "failed";
}
}
else {
echo "Image file size max 1 MB";
}
}
else {
echo "Invalid file format..";
}
}
else {
echo "Please select image..!";
exit;
}
}
?>
</code></pre>
| php | [2] |
5,503,009 | 5,503,010 | What is the difference between php.ini and .htaccess? | <p>Assume if I want to change the value of </p>
<pre><code>php_value post_max_size 20M in .htaccess
post_max_size 20M in php.ini
</code></pre>
<p>Both will do same operation. So what is the difference between <code>php.ini</code> and <code>.htaccess</code>?</p>
| php | [2] |
1,975,234 | 1,975,235 | How to enable dataGridView inline editing ? | <p>I have a dataGridView I want to enable inline editing, I can make that by setting the value of ReadOnly to false but the editing is temporary when I close the form and re-open it the changes are missed </p>
| c# | [0] |
1,987,059 | 1,987,060 | How can I add a space between words in jQuery? | <p>I have a jQuery function that returns a row from a database table. When it is displayed in a textbox, the words all run together. For example: <code>Everyonepleasebecarefulwhenleavingthebuilding</code>. I would like to separate the words to read: <code>Every one please be careful when leaving the building</code>. This comes from user input, so the user clicks on whatever row he wishes to be displayed in the textbox. Each row contains different data. The code listed below is what triggers the event:</p>
<pre><code>$(document).ready(function() {
$("table tr").click(function(){
$("#txttread").val($(this).text());
});
});
$(document).ready(function() {
$('.pickme tr').not(':first').hover(
function() { $(this).addClass('highlight'); },
function() { $(this).removeClass('highlight'); }
).click( function() {
$('.selected').removeClass('selected');
$(this).addClass('selected').find('input').attr('checked','checked');
});
});
</code></pre>
| jquery | [5] |
2,535,959 | 2,535,960 | SMS gateways for iPhone | <p>I am developing an application for iPhone which need to send an SMS message to mutiple users at a time .Is there any third party solution to do this.Is there anyone previously done this.Looking for a solution.
Thanks in advance</p>
| iphone | [8] |
492,242 | 492,243 | Simple tips to reduce coupling | <p>I have a large .NET web application. The system has projects for different intentions (e.g. CMS, Forum, eCommerce), and I have noticed a (naive) pattern of calling on another project's class. For example, the ecommerce module needs functionality to generate a file on the fly for products, and I call and reference a method in the CMS to do this, because file handling is really a job for the CMS.</p>
<p>Obviously (and I know why), this is bad design and a case of high coupling.</p>
<p>I know a few ways to handle high coupling, like restructuring the project (although I don't really think this is a robust solution), but what else can I do to reduce high coupling? Any simple tips? Also, it would be good to know why/how they reduce coupling. I use .NET 3.5 and Sql Server 2005 so things like JMS (which I keep coming across in my search for tips on this design issue), are not applicable.</p>
<p>Thanks</p>
| c# | [0] |
2,683,540 | 2,683,541 | Python: Quick and dirty datatypes (DTO) | <p>Very often, I find myself coding trivial datatypes like</p>
<pre><code>def Pruefer:
def __init__(self, ident, maxNum=float('inf'), name=""):
self.ident = ident
self.maxNum = maxNum
self.name = name
</code></pre>
<p>While this is very useful (Clearly I don't want to replace the above with anonymous 3-tuples), it's also very boilerplate. Now for example, when I want to use the class in a dict, I have to add more boilerplate like</p>
<pre><code> def __hash__(self):
return hash(self.ident, self.maxNum, self.name)
</code></pre>
<p>I admit that it might be difficult to recognize a general pattern amongst all my boilerplate classes, but nevertheless I'd like to as this question: ** Are there any
popular idioms in python to derive quick and dirty datatypes with named accessors? ** Or maybe if there are not, maybe a Python guru might want to show off some metaclass hacking or class factory to make my life easier?</p>
| python | [7] |
5,686,035 | 5,686,036 | How to specify a method argument must be of certain class | <p>So I have a class like this:</p>
<pre><code> class Encoder(object):
movie = None
def __init__(self, movie_instance):
self.movie = movie_instance
def encode_profile_hd(self):
print "profile 1"
def encode_profile_sd(self):
print "profile 2"
</code></pre>
<p>How can I specify the movie_instance argument passed to the constructor must be of Movie class?</p>
<p>I tried:</p>
<pre><code>def __init__(self, Movie movie_instance):
</code></pre>
<p>But that doesn't work. Sorry if this is obvious.</p>
| python | [7] |
265,305 | 265,306 | PHP, html, image file permissions? | <p>In a typical PHP application what should the file permissions of .php, .html and image files be? I'm using PHP5 with Apache on a Linux box.</p>
<p>Thanks</p>
| php | [2] |
3,925,340 | 3,925,341 | Obtain current page's source using javascript and DOM | <p>How do I obtain the current page's source using javascript and DOM? Would I have to use AJAX?</p>
| javascript | [3] |
3,583,926 | 3,583,927 | ThreadLocal Initialization in Java? | <p>I'm building a singleton that has a ThreadLocal as an instance variable, this singleton has a method that may be accessed by multiple threads and it is lazily instantiated. Right now I'm thinking on something like this:</p>
<pre><code>static final ThreadLocal<HashMap> bindingContext = new ThreadLocal<HashMap>();
</code></pre>
<p>But I'm not sure if it is a good idea, I also have the option to make it an instance variable since I'm using it (as I said on a singleton).</p>
<p>So the question is, where is the best place to initialize that class variable or should it be a class variable at all?</p>
| java | [1] |
2,359,099 | 2,359,100 | How to open only external links in a new browser window via JavaScript? | <p>I know this is a common requirement and there are lots of answers out in the wild. I would really appreciate if someone can provide a correct script which opens only external links from an HTML file in a new window.</p>
| javascript | [3] |
5,811,361 | 5,811,362 | Can This Code Compile? | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/3652182/c-void-return-type-of-main">C++ void return type of main()</a><br>
<a href="http://stackoverflow.com/questions/4207134/what-is-the-proper-declaration-of-main">What is the proper declaration of main?</a> </p>
</blockquote>
<p>Simple question, really. </p>
<p>My friend and I are perusing the Powerpoint slides of a professor we are supposed to be hearing next semester. It will be a Java course. For some reason, he has this C++ code snippet</p>
<pre><code>#include <iostream.h>
main ()
{ cout << "Hello, World\n"; }
</code></pre>
<p>I have told my friend, "No, this won't work with any modern C++ compiler." </p>
<p>My question is now, can this compile at all?</p>
| c++ | [6] |
3,689,479 | 3,689,480 | Is there any way to close android app from last activity? | <p>Is there any way to close android app ? I cannot use finish because it shows previous activity and I have lot off activities behind ( for example from 1st to 2nd .. to 10th and on 10th I want to exit from app ). How to achieve this ?</p>
| android | [4] |
2,363,244 | 2,363,245 | what does "throw;" outside a catch block do? | <p>I just stumbled this code:</p>
<pre><code>void somefunction()
{
throw;
}
</code></pre>
<p>and I wonder: what does it mean?</p>
<hr>
<p>I tagged the question as C++ and Visual C++ because I did not know the answer. The answer could have been related to the standard or to a special Visual C++ extension or to Visual C++ ignoring the standard. That's why I thought both tags are justified.</p>
| c++ | [6] |
5,577,503 | 5,577,504 | Get attribute of a xml by comparing two xml data | <p>I`m trying to get the attribute value of a xml by comparing it to <strong>another xml</strong>,as follows:</p>
<p><strong>xmlData1</strong> variable has xml like---></p>
<pre><code><Root>
<RNA A="100" x="table1" y="car11"/>
<RNA A="101" x="table2" y="car12"/>
<RNA A="102" x="table3" y="car13"/>
<RNA A="103" x="table4" y="car14"/>
<RNA A="104" x="table5" y="car15"/>
<RNA A="105" x="table6" y="car16"/>
<RNA A="106" x="table7" y="car17"/>
<RNA A="107" x="table8" y="car18"/>
<RNA A="108" x="table9" y="car19"/>
</Root>
</code></pre>
<p><strong>xmlData2</strong> variable has xml like ---></p>
<pre><code><Ina>
<RNA B="100" x="table1" y="car11"/>
<RNA B="101" x="table2" y="car12"/>
<RNA B="102" x="table3" y="car13"/>
</Ina>
</code></pre>
<p>Here i `ve to compare like </p>
<pre><code>if(xmlData1.getAttribute(x)==xmlData2.getAttribute(x) then
//code goes
</code></pre>
<p>How to achive this???please help</p>
| javascript | [3] |
1,158,164 | 1,158,165 | ListView row highlight when data changes | <p>I have a <code>ListView</code> in which data is streaming (changing). I want to just highlight the row for a fraction of seconds when the data is changing and then comes back to old state.</p>
<p>any solution?</p>
| android | [4] |
898,758 | 898,759 | Open detailview of contact of address book and filled detail and save it | <p>I want to open detail view of contact and then. i want to save in adress book. please give me a hint.</p>
| iphone | [8] |
2,144,922 | 2,144,923 | Function to Function get variable array | <p>look below code:</p>
<pre><code>$myvar = array();
first();
function first()
{
global $myvar;
$array(apple, banana, orange);
}
second();
function second()
{
global $myvar;
print_r($array);
}
</code></pre>
<p>then in output, second function doesnt show up array... =/ i dont get how function get variable array from other function...</p>
| php | [2] |
4,089,366 | 4,089,367 | Prevent deadlock shared boost mutex | <p>I want to use a shared mutex so threads only get locked when a vector/map/whatever is written to rather than read from. But I think func2() will never get the uniqueue lock because func1() will never get to unlock. Is there any way to not count a same-thread lock on shared_mutex when trying to get the uniqueue lock? Or would the problem still occur even then? </p>
<p>I'm guessing I need to find a way to force-get the lock (one thread at a time) once all threads have reached func2() OR have released the lock.</p>
<pre><code>func2()
{
boost::unique_lock<boost::shared_mutex> lock_access3(shared_mutex);
/*stuff*/
lock_access3.unlock();
}
func1()
{
boost::shared_lock<boost::shared_mutex> lock_access1(shared_mutex);
func2();
lock_access1.unlock();
}
</code></pre>
| c++ | [6] |
5,133,840 | 5,133,841 | Android and onSaveInstance and Restore | <p>I have a big problem. I have a activity where I have two imageViews. In onCreate I have List pictures where I have 10 pictures. Every time when I start this activity both imageViews get random picture from List and shows them. For example: When I start activity I can see car and pencil and when I start this activity once again I get elephant and book.
Now this is my problem. When I start activity and block my phone and after that unlock I get other pictures. I think that onCreate is called again. I create </p>
<pre><code>@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
}
public void onRestoreInstanceState(Bundle savedInstanceState) {
if (savedInstanceState != null) {
pictureGameLeft.setImageResource(shapesPictures.get(game.getCurrentLevel().getCurrentPair().getImageLeft()));
pictureGameRight.setImageResource(shapesPictures.get(game.getCurrentLevel().getCurrentPair().getImageRight()));
}
}
</code></pre>
<p>pictureGameLeft and Right that is last images which is shows.
I write them after onCreate method.
How I can save last seen picture that if I lock and unlock phone I get the same pictures. Maybe onPause or onStop need called? </p>
<p>edit:
now: </p>
<pre><code>if (savedInstanceState == null) {
game = new Game();
game.initGame();
addElements(result);
game.getCurrentLevel().nextPair();
pictureGameLeft.setImageResource(shapesPictures.get(game.getCurrentLevel().getCurrentPair()
.getImageLeft()));
pictureGameRight.setImageResource(shapesPictures.get(game.getCurrentLevel().getCurrentPair()
.getImageRight()));
mRedrawHandler.sleep(1000);
}
else {
pictureGameLeft.setImageResource(shapesPictures.get(game.getCurrentLevel().getCurrentPair(
.getImageLeft()));
pictureGameRight.setImageResource(shapesPictures.get(game.getCurrentLevel().getCurrentPair()
.getImageRight()));
}
</code></pre>
<p>but I get NullPointerException.</p>
| android | [4] |
4,006,578 | 4,006,579 | NO such file or directory for the files -----stdarg.h and float.h? | <p>HI all </p>
<p>I am using some files on .mm extension in the xcode project for compiling these files we have added the LLVM-GCC 4.2 in the build setting after adding this compiler this showing the error </p>
<blockquote>
<p><code>/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory</code></p>
<p><code>/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/include/float.h:8:24: error: float.h: No such file or directory</code></p>
</blockquote>
<p>i have no idea how to remove this error any help to remove this error.</p>
<p>thanks </p>
<p>Balraj </p>
| iphone | [8] |
3,183,676 | 3,183,677 | How do I "break" out of an if statement? | <p>I have a if statement that I want to "break" out of. I understand that break is only really for loops. Can anyone help?</p>
<p>For those that require an example of what I'm trying to do:</p>
<pre><code>if( color == red )
{
...
if( car == hyundai ) break;
...
}
</code></pre>
<p><em>EDIT:</em> Thanks for all your replies. It looks like I'll use a second if statement inside the first. Something like: </p>
<pre><code>if( car != hyundai )
</code></pre>
| c++ | [6] |
1,787,706 | 1,787,707 | Is there a visualizer for jQuery selectors? | <p>No, I'm not talking about the visualizer plugin. </p>
<p>There are cheap or free tools to visualize the results of XPath queries, or Regex. </p>
<p>Example:<br>
<img src="http://i50.tinypic.com/2z4y439.jpg" alt="alt text"></p>
<p><img src="http://i46.tinypic.com/6xx26b.jpg" alt="alt text"></p>
<p>Is there a similar tool that helps one visualize the results of jQuery selectors?<br>
I know it wouldn't be difficult to build... Just wanna know if one exists yet. </p>
| jquery | [5] |
3,884,353 | 3,884,354 | File operation in android | <p>I am new to android platform. I need to create a text file in android. Please let me know how to perform this task in android. I have written a code that is working fine in java but not in android. Please help me on this....the sample code that ihave written is :-</p>
<p>try
{
DataOutputStream dos = new DataOutputStream(new FileOutputStream("test.txt", true));
dos.writeBytes(dataLine);
dos.close();
}
catch (FileNotFoundException ex) {}</p>
<p>the above code snippet is working fine in java but not in android :(</p>
<p>Thanks,
Ashish </p>
| android | [4] |
745,996 | 745,997 | STL map construction | <pre><code>class Garage {
string WorkerFirstName;
string WorkerLastName;
string WorkerNumber;
public:
Garage()
{
WorkerFirstName = "";
WorkerLastName = "";
WorkerNumber = "";
}
void SetFirstName(string FirstName) { WorkerFirstName = FirstName;}
void SetLastName(string LastName) { WorkerLastName = LastName; }
void SetNumber(string Number) { WorkerNumber = Number; }
string GetFirstName() { return WorkerFirstName; }
string GetLastName() { return WorkerLastName; }
string GetNumber() { return WorkerNumber; }
};
class GarageList {
Garage List[500];
int MaxSize;
int Size;
public:
GarageList()
{
MaxSize = 500;
}
... //list out functions
};
</code></pre>
<p>That is an abridged version of my setup. I can't figure out how to make a map with a reference id based on last name and a value which would contain all of the attributes of the garage class. I guess something like map< string, Garage List[500] > directory.</p>
| c++ | [6] |
1,044,616 | 1,044,617 | want single asynctask for whole project | <p>I have a 3 activity. all these three activity has same <code>AsyncTask</code>. I want the single AsyncTask for all activity so i can pass the activity as parameter to <code>AsyncTask</code> constructor. please guide me.</p>
| android | [4] |
1,463,937 | 1,463,938 | How can I find an option with a specific value using jQuery.find? | <pre><code>var prefix = document.getElementById("actionsum").value;
$('#actionsum')
.find('option')
.remove()
.end()
.append('<option value=""> </option>')
.val('')
.append('<option value="A0">A0</option>')
.val('A0')
.append('<option value="A1">A1</option>')
.val('A1')
.append('<option value="A2">A2</option>')
.val('A2')
.append('<option value="A3">A3</option>')
.val('A3')
.append('<option value="A4">A4</option>')
.val('A4')
.append('<option value="B0">B0</option>')
.val('B0')
.append('<option value="B1">B1</option>')
.val('B1')
.append('<option value="B2">B2</option>')
.val('B2')
.append('<option value="B3">B3</option>')
.val('B3')
.append('<option value="B4">B4</option>')
.val('B4')
.append('<option value="LD">LD</option>')
.val('LD')
.attr("selected","selected")
.append('<option value="SM">SM</option>')
.val('SM')
.append('<option value="SR">SR</option>')
.val('SR')
.find('<option value="'+prefix+'">'+prefix+'</option>')
.attr("selected","selected");
</code></pre>
| jquery | [5] |
3,964,018 | 3,964,019 | How do I find permutations or combinations for byte? | <p>A character (1 byte) can represent 255 characters but how do i actually find it?</p>
| c++ | [6] |
1,484,642 | 1,484,643 | How to display the address of the active cell in another cell on a google spreadsheet? | <p>I have a solution in excel that I would like to replicate in google spreadsheets. In excel I have spreadsheet of 1600 lines of sales and forecast data and have a graph in the frozen pain section that displays the data from which ever row the cursor is on.</p>
<p>The VBA code in excel is:</p>
<pre><code>Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Range("A1").Value = ActiveCell.Address
End Sub
</code></pre>
<p>I can get the google spreadsheet to display the value of a cell in another specific cell but I need the actual cell address rather that the value to be displayed in cell A1.</p>
| javascript | [3] |
4,437,812 | 4,437,813 | jquery fadein image moves | <p>I am using the jquery fadein function to make two images disappear and fade in two images on submit of an ajax php form. However, the images end up moving around on the screen before it finds its place and it looks like the div is jumping so it looks bad. Any help for a fix would be appreciated</p>
<pre><code>$.ajax({type : "POST",
url : "mlml/process.php",
data : datastring,
success : function()
{
$('#form').hide();
$("#message").fadeOut(function()
{
$(this).load(function() { $(this).fadeIn(3000); });
$(this).attr("src", "images/signup_message2.gif");
});
$("#links").fadeIn(3000);
return false;
}
});
</code></pre>
| jquery | [5] |
4,389,513 | 4,389,514 | is it possible in Javascript to tell an object to stop having reference behavior with another object | <p>Just getting back into doing a lot of Javascript and trying to understand Javascript objects better. I asked previous question earlier but this one is different. Can I disconnect a reference relationship that exists between objects?</p>
<p>For example:</p>
<pre><code>var objA={};
objA.my_name='Joe';
var objB=objA;
objB.my_name="jake"; // objA.my_name="jake"
objB.something="this is something";
objA.last_name="Jackson";
console.log(objA.something); // "this si something" can add to parent object at runtime
console.log(objB.last_name); // "Jackson" can add to child object at runtime
// now I'd like to cut off objB from objA such that:
objB.cell_phone='323-213-2323';
console.log(objA.cell_phone); // '323-213-2323' but would like undefined; would like this behavior
</code></pre>
<p>thx in advance</p>
| javascript | [3] |
5,752,817 | 5,752,818 | c# call method based on contents of a variable | <p>how do you call a method based on the contents of a variable</p>
<p>ex. </p>
<pre><code>String S = "Hello World";
String Format = "ToUpper()";
String sFormat = s.Format;
resulting in "HELLO WORLD"
</code></pre>
<p>This way I could at some other time pass <code>Format = "ToLower()"</code> or Format = "Remove(1,4)" which will delete 4 characters starting from pos 1 - in short I would like the ability to call any string method.</p>
<p>Could someone post a complete working solution.</p>
| c# | [0] |
2,142,516 | 2,142,517 | How to Load ID and Name parallely to One combo box at same time in C# .net | <p>I want answer in C# language and .Net framework </p>
| c# | [0] |
2,283,659 | 2,283,660 | Dynamically created private variables? | <p>I have a set of classes which hold state for the database. It's like a micro-ORM pattern. So for this solution I load in the structure of a few tables as dynamic properties to the class so that the class looks something like:</p>
<ul>
<li>Object
<ul>
<li>[tbl_name]
<ul>
<li>attribute1</li>
<li>attribute2</li>
<li>attribute3</li>
</ul></li>
<li>[tbl_name]
<ul>
<li>attribute1</li>
<li>attribute2</li>
<li>attribute3</li>
</ul></li>
</ul></li>
</ul>
<p>All of the attributes are public properties because I set them with something like this:</p>
<pre><code>$object->{$table_name}->{$attribute} = 'foobar';
</code></pre>
<p>What I'd like though is for these dynamically set properties to be private. Why? Well because, and please don't miss the irony here, I want to make them public again through an overloaded getter/setter using __get() and __set(). Again we come back to the question of why. Well actually for "getting" I would have been fine with a public property but for setting I want to apply some logic before allowing the setting. Here's my simplified __set() function which gives you an idea of what I'm trying to achieve:</p>
<pre><code>public function __set ( $property , $value ) {
if ( !in_array ($property , $blocked_properties) ) {
$this->property = $value;
$this->trigger_event ( $property );
}
}
</code></pre>
<p>Make sense? I'm happy to solve this problem other ways but this seems like a very graceful way to do this if only I could dynamically set private instance variables.</p>
| php | [2] |
3,957,317 | 3,957,318 | T_SL Error, Shoppying Basket System | <p>When running the code shown below I get this error: ( ! ) </p>
<pre><code>Parse error: syntax error, unexpected T_SL in D:\Program Files\wamp\www\Fatz\Fatz Shopping Cart.php on line 13
</code></pre>
<p>Code:
</p>
<pre><code><?php
$_Session['Basket'] = '';
$User = 'Username';
$Pass = 'Password';
$Database = 'database';
mysql_connect(localhost, $User, $Pass);
@mysql_select_db($Database) or die('Unable to select database');
$sql = <<<MySQL_Query; <!-- Error Line-->
CREATE TABLE IF NOT EXISTS Test
{
ItemID int(3) unsigned NOT NULL auto_increment,
Title varchar(128) NOT NULL default '',
Price decimal(3,2) NOT NULL default '',
PRIMARY KEY (ItemID)
} MySQL_Query;
mysql_query($sql);
INSERT INTO Test VALUES (1, 'What are we selling!', '10.00');
function ShoppingBaskItems()
{
$basket = $_Session['Basket'];
If(!isset($basket) || null($basket)) return '0 Items';
$Items = explode(',', $basket);
$Count = (count($Items) > 1) ? 'Count': '';
return '<p><a href="Basket.php">'.count($Items).' items'.$Count.' </a></p>';
}
echo ShoppingBaskItems();
?>
</code></pre>
| php | [2] |
1,313,840 | 1,313,841 | How to avoid a recursive loop with __setattr__ and a property settter? | <p>This causes an infinite recursive loop when setattr is called, when trying to set the value for some_prop, which is a property with a setter:</p>
<pre><code>class TypeSystem(object):
def __setattr__(self, key, value):
if the_special_case is True:
# do something
else:
super(TypeSystem,self).__setattr__(key,value)
class Entity(TypeSystem):
@property
def some_prop(self):
some_prop = self.data.get('some_prop')
if some_prop is None and hasattr(self,"some_prop"):
some_prop = self.some_prop
return some_prop
@some_prop.setter
def some_prop(self,value):
self.some_prop = value
>>> entity = Entity()
>>> entity.some_prop = 3
</code></pre>
<p>This works fine for normal attributes that aren't defined as properties because Super calls object's setattr to prevent the recursive loop. </p>
<p>But because some_prop isn't pre-defined, it looks like setattr is being invoked instead some_prop's setter so it gets pulled into a loop.</p>
<p>I have tried this as well....</p>
<pre><code>@some_prop.setter
def some_prop(self, value):
super(TypeSystem, self).__setattr__("some_prop", value)
</code></pre>
<p>But it still goes into a recursive loop. I'm not seeing how to avoid it.</p>
| python | [7] |
4,171,444 | 4,171,445 | What is the default path of debug.keystore on Mac? | <p>I am a new Mac user. I searched everywhere for <code>debug.keystore</code> file, but no luck. Is it possible that eclipse can't create the file?</p>
| android | [4] |
5,984,280 | 5,984,281 | Question of Development Methodology | <p>This is the 3rd web project I have been developing and I have been a sole developer in all projects. </p>
<p>Now I need to change my style and don't know how to do it, so I need your suggestions. </p>
<p>My setup is;</p>
<p>Netbeans for PHP development</p>
<p>Github for private repository (As I am developing on Windows I found very hard to integrate Git-Windows-Netbeans so I can change it if needed)</p>
<p>Basecamp for project management (Even if I use GIT, I might change my GIT provider (github) and select a one which can be integrated with Basecamp)</p>
<p>My needs are;</p>
<p>For my current project, I will setup a dev server and test the changes there first. Then I will commit them to the production server. So I should be able to use netbeans while I can easily commit to my repository and apply the changes to the production server. How can I do it easily? Should I first commit to the repository and get the changes from the dev. server via command line? It seems a bit work to do this for every change. Should I directly upload to the dev. server, then commit the final changes to the repository and get the changes from there to the production server?</p>
<p>So, what do you suggest as a repository which can be integrated into the netbeans and how should I manage these changes?</p>
<p>I also would like to use one of these providers (http://basecamphq.com/extras - SOFTWARE DEVELOPMENT TOOLS). So, if you have any suggestions from these companies too, that would be great</p>
<p>Thanks a lot,</p>
| php | [2] |
4,941,644 | 4,941,645 | Integrate auriotouch in another app | <p>excuse me to create again this question, but I have another problem. I'm trying to integrate the aurioTouch Apple sample in my app. I have put all the code that was in <code>aurioTouchAppDelegate</code> in my app delegate file. The code runs, but some methods, like methods in EAGView file doesn't run, I don't know whym they are not called.
Some help or hints are welcome...</p>
| iphone | [8] |
4,834,126 | 4,834,127 | Contact Us JavaScript help | <p>im trying to create a contact us web page, the obvious choice of posting the data would be to use the mailto function this obviously has some security flaws. i was wondering if there are any good javascript i can use to send the details from the contact us page to my email. i tutorial would be helpfull as i am really new to this.</p>
| javascript | [3] |
2,249,253 | 2,249,254 | jQuery: .load() invoked twice? | <p>I am really confused with what's happening. My code is very basic yet the result seems to be very complex :-\</p>
<pre><code>$j.ajaxSetup ({
cache: false
});
var $img = $j('.infiniteCarousel-vid ul li img:not(.noimg)');
var loadUrl = "http://shorelinerenovations.com/wp-content/themes/Narm/videos/load_vid.php";
$img.click(function(){
$j('.vid-preview').load(loadUrl);
});
</code></pre>
<p>Feel free to visit the page where I am implementing this: <a href="http://shorelinerenovations.com/project-1" rel="nofollow">http://shorelinerenovations.com/project-1</a> . The styling is very buggy as of the moment so forgive me. When you click on one of the image previews at the very bottom, you'll see the video is being loaded twice :-\</p>
| jquery | [5] |
5,993,805 | 5,993,806 | how to draw multiple png images in same page using php | <p>can anybody help me how to draw a multiple png images in a same page using image functions in php...where I can able to create a single image but not more than that....</p>
| php | [2] |
3,345,349 | 3,345,350 | making this $(this) work | <p>Ok I have a very basic function which moves the background position of a div to give it a 'sheen' effect and a second one which shifts it back. </p>
<p>If I get the div by its ID that works fine. But when I try to make the function a bit more universal by using 'this' - it breaks.</p>
<p>This works fine:</p>
<pre><code>function runsheen() {
$('#sheen').animate({backgroundPosition: '-400px 0px'},1000);
}
function resetsheen() {
$('#sheen').css({backgroundPosition: '-0px 0px'});
}
</code></pre>
<p>But this does nothing</p>
<pre><code>function runsheen() {
$(this).animate({backgroundPosition: '-400px 0px'},1000);}
function resetsheen() {
$(this).css({backgroundPosition: '-0px 0px'});}
</code></pre>
<p>Running it with the ID version means a new function for every button - rubbish. If I use 'this' I can reuse the code over and over, right? Can anyone help me make this work? </p>
| jquery | [5] |
3,325,534 | 3,325,535 | Problem with Checkbox text on Sony Xperia device | <p>I am displaying a Checkbox on a layout xml.</p>
<p>The Checkbox text contain around 10 characters. </p>
<p>The problem is specific to Sony Xperia where the the Checkbox text is coming to the second line , specifically last 2 characters of the text on the second line.</p>
<pre><code><CheckBox android:id="@+id/roundCheck" android:paddingLeft="25dip"
android:button="@drawable/ic_uncheck_rect" android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="20dip" android:text="abcdefghij"
android:textSize="16sp"
android:textColor="@color/white" android:typeface="serif"
android:singleLine="true" android:checked="false"
android:layout_centerVertical="true"></CheckBox>
</code></pre>
<p>I have tested the mobile application on HTC Hero , Google Nexus One , Motorola Droid ,etc , but its working fine without any problem.</p>
<p>The problem is not getting reflected on the Sony Xperia emulator too.</p>
<p>Is adding the code, <strong>android:singleLine="true"</strong> , solve the issue , if it means that after a certain no of characters "..." will be added but the text will be in a single line ?</p>
<p>I don't have a mobile device to currently test.</p>
<p>Thanks in advance.</p>
<p>Warm Regards,</p>
<p>CB</p>
| android | [4] |
2,146,775 | 2,146,776 | Trying to get the width of an h1 tag with Javascript | <pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type = "text/javascript">
var textHeadingArray = ["Bloom Defender", "Civilization Wars", "Flight", "Rebuild 2", "Wonderputt"];
var textHeadingIndex = 0;
function changeMainImage() {
textHeadingIndex++;
if (textHeadingIndex >= textHeadingArray.length) {
textHeadingIndex = 0;
}
var changeTheHeading = document.getElementById("slidehsowheading").innerHTML = textHeadingArray[textHeadingIndex];
var heading = document.getElementById("slidehsowheading").style.width;
var sizeOfHeading = heading;
alert(sizeOfHeading);
var subtraction = 75 - sizeOfHeading;
var changeTheHeadingAgain = document.getElementById("slidehsowheading").style.left = subtractionRounded + "px";
}
var mainTiming = setInterval("changeMainImage()", 5000);
</script>
</head>
<body>
<h1 id = "slidehsowheading">Bloom Defender</h1>
</body>
</html>
</code></pre>
<p>Im trying to use this code to change the heading for a slideshow, I am kinda new to javascript so my problem is that when the alert pops up it returns as null(the alert was just for debugging), so when i try to use the null width from the h1 in this equation it is wrong. The equation is supposed to get the width of the heading after it has been changed by the timer and divid by 2 and subtract that from the width of its background divided by 2 which is 75, with this formula you can center the heading in its background element</p>
| javascript | [3] |
5,318,659 | 5,318,660 | Removing redundancy when adding items to Python dictionaries | <p>Suppose you have a dictionary like:</p>
<pre><code>my_dict = {'foo' : {'bar' : {}}}
</code></pre>
<p>And you want to make the following sequence of assignments:</p>
<pre><code>my_dict['foo']['bar']['first'] = 1
my_dict['foo']['bar']['second'] = 2
</code></pre>
<p>Clearly there is some redundancy in the fact that <code>my_dict['foo']['bar']</code> is repeated. Is there any way to prevent this redundancy?</p>
<p>Thanks!</p>
| python | [7] |
1,137,136 | 1,137,137 | SurfaceView in android | <p>I think that it is like somewhat impossible or may be possible but android does not support this kind of functionality but still I think that I should share this with all you guys so we will have nice discussion.</p>
<p>Ok,as I know that surfaceview is z-ordered view that is, it will be placed behind window.Now I want to start one application(activity) from this surfaceview.
But as we all know that this thing will be in our ui-thread.What I want to do is opening application in z-order(surfaceview) so that I can view this new application in my surfaceview(I am not asking for any code just want some discussion).But as I said this seems impossible to achieve.</p>
| android | [4] |
3,082,254 | 3,082,255 | Trying to generate a HTML table (leaderboards) using PHP + MySQL, it's not displaying anything | <p>I am trying to create a leaderboards table using PHP + MySQL but it isn't displaying anything, here is my code:</p>
<p>It will not show anything though, this is what happens:</p>
<p>If I add more enteries to the database, more rows will appear but they are empty, as can be seen here: </p>
| php | [2] |
3,862,715 | 3,862,716 | Escape string from file | <p>I have to parse some files that contain some string that has characters in them that I need to escape. To make a short example you can imagine something like this:</p>
<pre><code> var stringFromFile = "This is \\n a test \\u0085";
Console.WriteLine(stringFromFile);
</code></pre>
<p>The above results in the output:</p>
<pre><code> This is \n a test \u0085
</code></pre>
<p>, but I want the text escaped. How do I do this in C#? The text contains unicode characters too.</p>
<p><strong>To make clear; The above code is just an example. The text contains the \n and unicode \u00xx characters from the file.</strong></p>
<p>Example of the file contents:</p>
<blockquote>
<p>Fisika (vanaf Grieks, \u03C6\u03C5\u03C3\u03B9\u03BA\u03CC\u03C2,
\"Natuurlik\", en \u03C6\u03CD\u03C3\u03B9\u03C2, \"Natuur\") is die
wetenskap van die Natuur</p>
</blockquote>
| c# | [0] |
379,943 | 379,944 | php function 'pcntl_exec' is undefined | <p>Would anyone know why my <code>pcntl_exec</code> is undefined? I have php 5.2.14 - the <a href="http://php.net/manual/en/function.pcntl-exec.php" rel="nofollow">manual</a> says it should be defined in php5. I need an alternative to exec as my hosting provider recently locked-down these: exec, passthru, shell_exec, system, proc_open, popen, curl_multi_exec</p>
<p>I got the list from: <code>ini_get("disable_functions")</code>. I see no reason for it to be undefined.</p>
| php | [2] |
3,978,768 | 3,978,769 | PHP split alternative? | <p>PHP is telling me that split is deprecated, what's the alternative method I should use?</p>
| php | [2] |
1,079,845 | 1,079,846 | maintain value of variable outside function in javascript? | <p>I try to manipulate a variable inside a function. But it seems to forget the values once I exit the function, eventhough the variable is declared outside the function.</p>
<p>The essential code:</p>
<pre><code>var posts = {};
// Perform a data request
// skjutsgruppens-page
$.oajax({
url: "https://graph.facebook.com/197214710347172/feed?limit=500",
*SNIP*
success: function(data) {
$.extend(posts, data);
}
});
// Gruppen
$.oajax({
url: "https://graph.facebook.com/2388163605/feed?limit=500",
*snip*
success: function(data) {
$.extend(posts, data);
}
});
</code></pre>
<p>The oajax retrievies data from facebook. I want to make a variable that contains the data from both oajax methods.</p>
<p>The actual code: <a href="http://eco.nolgren.se/demo/resihop/" rel="nofollow">http://eco.nolgren.se/demo/resihop/#</a></p>
| javascript | [3] |
1,193,811 | 1,193,812 | what is the equivalent of "-" in an url? | <p>How to change - in url.
I have got the same problem with space so i changed it with %20 and it worked:</p>
<pre><code>name = name.replaceAll(" ","%20");
</code></pre>
<p>What is the equivalent of "-" in an url?</p>
<p>I tried %2C and it doesn't word: %2C -> ","</p>
| android | [4] |
3,945,280 | 3,945,281 | Chrome doesn't work properly on keycode/keypress (JQuery) | <p>I'm developing a data insertion in excel-like environment (the idea is to upload the data copypasting from excel).</p>
<p>I'm using JQuery for this, and works pretty well in Firefox, but Chrome is a headache on keypress, I really don't get how to make it work.</p>
<p>Here's the example: <a href="http://jsfiddle.net/j6PgY/" rel="nofollow">http://jsfiddle.net/j6PgY/</a></p>
<p>What I'm doing is something like this:</p>
<pre><code>$(document).live('keypress', function(e){
if(e.keyCode==38 && y!=1){ // Up
y--;
}else if(e.keyCode==40 && y!=largo){ // Down
y++;
}
</code></pre>
<p>Take a look from line 67</p>
| jquery | [5] |
4,236,895 | 4,236,896 | ListView scroll to selected item | <p>I have a ListView with an edit text and a button below it. When I click on a listView item the keyboard appears and push up the edit text and the button. I want the list to scroll to the selected item. Any idea? Thanks</p>
| android | [4] |
4,317,560 | 4,317,561 | Concat'ing intergers to make a string | <p>This is what I am trying to do:</p>
<pre><code>int x = 0;
char toBuffer;
while (twenty_byte_buffer[x] != '\0') // While the string isn't at the end...
{
cout << int(twenty_byte_buffer[x]); // show me, works fine
//need to concat the int values from above into toBuffer as a string
//eg. "-62-8711097109" would have derived from this "©nam"
//this doesn't work:
//strcat ( toBuffer, reinterpret_cast<*????*>(twenty_byte_buffer[x]) );
x++;
}
</code></pre>
<p>Any help will be greatly appreciated!</p>
| c++ | [6] |
752,870 | 752,871 | Python writing to a linux /proc/mystats file | <p>Several articles show how to read data from a linux /proc/xxx file, such as: <a href="http://stackoverflow.com/questions/1052589/how-can-i-parse-the-output-of-proc-net-dev-into-keyvalue-pairs-per-interface-us">How can I parse the output of /proc/net/dev into key:value pairs per interface using Python?</a></p>
<p>How do I set up a Python application to create and write to my own /proc/mystats file so other processes can monitor it?</p>
| python | [7] |
3,265,320 | 3,265,321 | Is is possible to send different body content in PHPMAILER? | <p>Is is possible to send different body content in PHPMAILER?</p>
<p>For Example,</p>
<p>I like to send
<code>THis is To address" to TO EMAIL ID</code> and <code>This is CC ADDRESS" to CC EMAIL ID</code>.
I'm using SMTP method.</p>
<p>Please advise.</p>
| php | [2] |
4,526,155 | 4,526,156 | (jquery) .load and .live | <p>I've loaded content1.html into a div using .load (WHICH WORKS FINE).</p>
<p>Now I want to put a link in the content1.html content that when clicked would load content2.html into the div. Any ideas how I would do this? At the moment I've got: </p>
<pre><code>google.setOnLoadCallback(function() {
$('#howtoguide6').live('click', function() {
$("#howtoguide6").click(function(){
$("#hiw-content-area").load("pages/hiw/how_to.html");
return false;
});
});
});
</code></pre>
<p>Any ideas would be really appreciated, I've been pulling my hair out over this one!</p>
<hr>
<p><strong>Hi</strong> sorry it seems i havnt explained this very well</p>
<p>basicly I've already loaded</p>
<pre><code>google.setOnLoadCallback(function() {
$("#choose_design_service").click(function(){
$("#hiw-content-area").load("pages/hiw/what_we_need_from_you.html");
return false;
});
});
</code></pre>
<p>-which works fine, i now have want to add something to "pages/hiw/what_we_need_from_you.html"
that will load "pages/hiw/how_to.html" into the "#hiw-content-area". </p>
<p>i think where I'm having trouble is doing this from inside already loaded content </p>
<p>thanks for all the quick replys hopefully I've explained it better this time </p>
<p>Regards
Sam </p>
| jquery | [5] |
754,203 | 754,204 | How to get reference of activity object? | <p>Hi
i want to show messageBox or notification when connection lost in Static DB class but i cant use getApplicationContext() becouse its a static class and i tried to call other class called notification but i have error so how i could pass activity object to my new class .</p>
| android | [4] |
4,904,128 | 4,904,129 | Login with Vimeo using C# | <p>I am currently working on a project and in this I have to implement login using Vimeo account. Furthermore I get application key and other information by registering my application on Vimeo. But on the Vimeo site there is no help how to implement the login functionality, and I am new to it. Can anyone help?</p>
| c# | [0] |
4,717,013 | 4,717,014 | jQuery accordion-like menu with text replace | <p>I want to indicate a menu's expandability/collapsibility with a 'plus' sign. I want to replace the plus sign with a minus when the item has been expanded.</p>
<p>The only issue at the moment is returning the minus back to a plus when I click on another item. </p>
<p>Any suggestions? </p>
<p>Fiddle: <a href="http://jsfiddle.net/saltcod/Lg9Mn/" rel="nofollow">http://jsfiddle.net/saltcod/Lg9Mn/</a></p>
| jquery | [5] |
1,746,897 | 1,746,898 | php sending email | <p>mailer.php</p>
<pre><code><?php
if(isset($_POST['submit'])) {
$to = "abc@gmail.com";
$subject = "Contact via website";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
echo "1";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "0";
}
?>
</code></pre>
<p>jquery code</p>
<pre><code>$('.submit').click(function(){
$('span.msg').css({'visibility': 'visible'}).text('Sending...');
$.post("mailer.php", $(".contactPage").serialize(),
function(data){
$('span.msg').text((data == "1") ? 'Your Message has been received. Thank you' : "Could not send your message at this time").show();
});
return false;
});
</code></pre>
<p>I am always getting</p>
<pre><code>Could not send your message at this time
</code></pre>
<p>I have almost no knowledge in php, whats i am doing wrong?</p>
| php | [2] |
2,912,832 | 2,912,833 | jQuery: how to add an element after a text node? | <p>Say I have the following markup:</p>
<pre><code><h1>Hello</h1>
</code></pre>
<p>and now, I want to add <code><span id="foo" class="bar">world</span></code> after <code>Hello</code> so that I have I have the resulting markup:</p>
<pre><code><h1>Hello<span id="foo" class="bar">world</span></h1>
</code></pre>
<p>How do I do this in jQuery?</p>
| jquery | [5] |
1,909,355 | 1,909,356 | hold view for 3 seconds then push for another view | <p>I want to hold view for 3 seconds then view will be switch,What will i do?</p>
| iphone | [8] |
4,807,054 | 4,807,055 | jquery not trapping keyCode | <p>I have the following as part of some code - you can see it at <a href="http://jsfiddle.net/73c3X/1/" rel="nofollow">http://jsfiddle.net/73c3X/1/</a></p>
<pre><code> if (txt.val().length >= 10 && (event.keyCode != 46 || event.keyCode != 8 || event.keyCode != 9)) {
alert(txt.val().length + "keycode = " + event.keyCode);
event.preventDefault();
$('.onlynumbers').text("10 digits in mobile").show(200);
}
</code></pre>
<p>The idea is to prevent someone entering more than 10 digits and display a message.</p>
<p>I would have expected the line </p>
<pre><code>if(txt.val().length >= 10 && (event.keyCode != 46 || event.keyCode != 8 || event.keyCode != 9))
</code></pre>
<p>to allow a tab, backspace or delete to be used, however as you can see in the fiddle, they get past the if statement and trigger the alert - which will even show that that the length = 10 and the keyCode = 9.</p>
<p>It looks fine to me, obviously it isn't. Am I missing something or will this be a DOH! moment?</p>
| jquery | [5] |
3,118,904 | 3,118,905 | Force importing module from current directory | <p>I have package <code>p</code> that has modules <code>a</code> and <code>b</code>. <code>a</code> relies on <code>b</code>:</p>
<p><code>b.py</code> contents:</p>
<pre><code>import a
</code></pre>
<p>However I want to <em>ensure</em> that <code>b</code> imports my <code>a</code> module from the same <code>p</code> package directory and not just any <code>a</code> module from <code>PYTHONPATH</code>.</p>
<p>So I'm trying to change <code>b.py</code> like the following:</p>
<pre><code>from . import a
</code></pre>
<p>This works as long as I import <code>b</code> when I'm outside of <code>p</code> package directory. Given the following files:</p>
<pre><code>/tmp
/p
a.py
b.py
__init__.py
</code></pre>
<p>The following works:</p>
<pre><code>$ cd /tmp
$ echo 'import p.b' | python
</code></pre>
<p><strong>The following does NOT work:</strong></p>
<pre><code>$ cd /tmp/p
$ echo 'import b' | python
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "b.py", line 1, in <module>
from . import a
ValueError: Attempted relative import in non-package
</code></pre>
<p><strong>Why?</strong></p>
<p>P.S. I'm using Python 2.7.3</p>
| python | [7] |
3,198,442 | 3,198,443 | Is it possible to know which camera is currently using in android? | <p>In my application i want to know whether the camera application is On or not and also the type of camera(Front camera or back) ?</p>
| android | [4] |
1,363,960 | 1,363,961 | Click Function in JQuery | <p>$("#displayPanel #save #saveForm").live("click", function(){</p>
<pre><code> //Move to forms/homepage
});
</code></pre>
<p>What I'm trying is when clicking on the <code>saveForm</code> Button I want to move to a URL(homepage) Where ii had some list of saved forms.</p>
<p>I'm new to JQuery.
Note:</p>
<pre><code> Where my saveForm is like
<input id='saveForm' type='Submit' value='Save Form'>
</code></pre>
| jquery | [5] |
5,109,619 | 5,109,620 | Asp.net yellow code <% vs Explicit asp control | <p>I have a literal in my aspx called xxx.</p>
<p>Now lets go into the JS world.</p>
<p>I always used :</p>
<pre><code> alert('audit.aspx?claim_id=<%= xxx.Text%>');
</code></pre>
<p>But Ive seen a code like this : </p>
<pre><code> alert('audit.aspx?claim_id=<asp:Literal id="xxx" runat="server" />');
</code></pre>
<p>This is also working.</p>
<p>Can I conclude that the <code><asp:Literal</code> is equal to <code><%=</code> syntax ? </p>
<p>I know that he is a RUNAT server Item...</p>
<p>but again - I want to see the differences.</p>
| asp.net | [9] |
198,427 | 198,428 | Trying To Show A DIV In jQuery | <p>I have this java code:</p>
<pre><code><script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.2.6");
$("a#more").click(function() {
$("#info_box").show("blind", { direction: "vertical" }, 800);
});
</script>
</code></pre>
<p>And this link:</p>
<pre><code><a href="#" id="more">More Info...</a>
</code></pre>
<p>info_box is just a div with the properties:</p>
<pre><code>width: 30%;
position: absolute;
left: 35%;
top: 250px;
background-color: #FFFFFF;
border: 2px solid #000000;
visibility: hidden;
</code></pre>
<p>How can this not be working, been trying to figure it out for 20 minutes.</p>
| jquery | [5] |
765,424 | 765,425 | Viewpager horizontal scrollbar not showing up - Android- | <p>In my viewpager Ive enabled horizontal scrollbar by such featuredPager.setHorizontalScrollBarEnabled(true);</p>
<p>However it never shows up or does anything</p>
| android | [4] |
2,762,121 | 2,762,122 | Method 'slice' in IE8 | <p>Object doesn't support property or method 'slice' </p>
<pre><code>jquery.js?ver=1.4.4
</code></pre>
<p>I use slider "Coda-Slider". And It doesn't work in IE8.
But if I include jquery-1.3.2.min.js, it work and in IE8, and in all other browsers.
But I need exactly jQuery v.1.4.4.</p>
<p>What I should do?</p>
| jquery | [5] |
4,705,205 | 4,705,206 | Android Audio Control to forward and Reverse | <p>I am creating a custom Audio Player. So far I am able to add features such as Audio streaming, volume control, Duration, Progress bar etc. I have to add feature where user can touch a slider and jump audio to skip some part. Is there any way to do this?</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.