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,299,864 | 2,299,865 | Get file name of a URL in PHP | <p>I want to get the file name from a URL. But the problem is it's not ending with an extension.</p>
<p>For example, <a href="http://something.com/1245/65/" rel="nofollow">http://something.com/1245/65/</a>. On clicking this URL, we will get a PDF file. How do I store the file name of that file in a variable?</p>
| php | [2] |
3,757,879 | 3,757,880 | Convert a number from string to integer without using inbuilt function | <p>I am trying this technique but error is coming. Please help me to convert a number from string to integer.</p>
<pre><code>#include<iostream>
using namespace std;
int main()
{
char *buffer[80];
int a;
cout<<"enter the number";
cin.get(buffer,79);
char *ptr[80] = &buffer;
while(*ptr!='\0')
{
a=(a*10)+(*ptr-48);
}
cout<<"the value"<<a;
delete ptr[];
return 0;
}
</code></pre>
<p>Errors are:</p>
<ol>
<li>error C2440: 'initializing' : cannot convert from 'char <em>(</em>)[80]' to 'char *[80]'</li>
<li>error C2440: '=' : cannot convert from 'char *' to 'int'</li>
</ol>
| c++ | [6] |
4,838,679 | 4,838,680 | Interactive php | <p>I looking for interactive php appliaction like linqpad for c# where i can test code snippets.</p>
<p>Thanks in advice</p>
| php | [2] |
4,206,717 | 4,206,718 | Python subtract two dates in minutes | <pre><code>date1 = datetime.datetime(2012, 10, 10, 10, 15, 44)
date2 = datetime.datetime(2012, 10, 17, 8, 45, 38)
roundedA = date2.replace(second = 0, microsecond = 0)
print roundedA
roundedB = date1.replace(second = 0, microsecond = 0)
print roundedB
minutes = (roundedA - roundedB).min
print minutes
</code></pre>
<p>Result is:</p>
<pre><code>-999999999 days, 0:00:00
</code></pre>
<p>I want to count 2 different dates differences. I subtracted above, but it does not give me what I want. How to do subtract two dates and get the result in minutes or hours. </p>
| python | [7] |
393,045 | 393,046 | Php syntax problem | <pre><code><input type="radio" name="ques1" value="op4">Jingles<br>
</code></pre>
<p>just a part of the code.....
when i am checking this...
iam doing this as </p>
<pre><code>$selected=$_POST['ques1'];
</code></pre>
<p>now when i am doing this with for loop....</p>
<pre><code>for($i=0;$i<...;$i++)
$selected=$_POST['ques'.{$i+1}];
</code></pre>
<p>NEW SYSNTAX ADDED...............................</p>
<pre><code>$sql='UPDATE Reg_Stud SET Result=$perc WHERE RegID="$_SESSION['id']"';
</code></pre>
<p>//Whats wrong with this one???</p>
<p>....//whts the correct syntax??</p>
| php | [2] |
3,955,954 | 3,955,955 | wipe off effect in iphone game | <p>I am developing an iphone game, which needs to wipe off the brain goo splashed on the screen by fingers. </p>
<p>When I wipe the screen with my finger, it works well on simulater, but when I test it on my device, the track on the screen is totally different from the track of my finger. </p>
<p>It seems that they are in opposite direction. </p>
<p>For example, If I wipe the the upper half of the screen, the track I got is on the bottom half of the screen. </p>
<p>Anybody can help me? Does CCRenderTexture performs different on Simulater and real device? </p>
| iphone | [8] |
3,739,763 | 3,739,764 | Scale Animation on an EditText .. help | <p>i'm trying to animate an EditText when i touch it using scale animation , i managed to do that by creating my own editText (extends EditText) .The animation works , but after it the EditText size(width) does not change it still the same . How can i change that ? I tried to call
this.setWidth() after the animation , but it does not work so well. Which is the best approach for my problem ?</p>
<pre><code>@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
focus = true;
this.setText("");
this.setTextColor(Color.parseColor("#000000"));
if (firstTime) {
animate();
}
break;
case MotionEvent.ACTION_UP:
text = this.getText().toString();
break;
}
return super.onTouchEvent(event);
}
private void animate() {
Log.i("teste", "ed width: " + this.getWidth());
Log.i("teste", "parent width: " + parent.getWidth());
float x = ((float) parent.getWidth() / this.getWidth());
Log.i("teste", "x: " + x);
ScaleAnimation sc = new ScaleAnimation(1, x, 1, 1, 0.5f, 0.0f);
sc.setStartOffset(100);
sc.setInterpolator(new AccelerateInterpolator());
sc.setFillAfter(true);
sc.setDuration(1000);
this.startAnimation(sc);
invalidate();
firstTime = false;
}
</code></pre>
| android | [4] |
3,973,088 | 3,973,089 | How to maintain the checkbox state in Activity which is on of the Activity of Tab Host? | <p>How to maintain the checkbox state in Activity which is on of the Activity of Tab Host in Android 2.2?</p>
| android | [4] |
910,539 | 910,540 | CSS not pulling in for jQuery UI dialog | <p>I want to add a jQuery dialog modal to a form page. When the dialog box is triggered I see the the text content but with no CSS. I'm pulling in the jquery in the functions.php for the page:</p>
<pre><code>wp_enqueue_script('jquery-ui-dialog');
</code></pre>
<p>The jquery css (jquery-ui-dialog.css) is under my wp-includes/css directory.
I tried adding</p>
<pre><code>wp_enqueue_style('jquery-ui-dialog');
</code></pre>
<p>but it not work. Does anybody know the proper way to enable jQuery Dialog.</p>
| jquery | [5] |
455,285 | 455,286 | How can i get a string and return each time a string from array? | <p>I have this function :</p>
<pre><code>private string offline(string targetDirectory)
{
string directory = "";
try
{
string[] dirs = Directory.GetDirectories(targetDirectory,"*.*",SearchOption.TopDirectoryOnly);
for (int i = 0; i < dirs.Length; i++)
{
directory = dirs[i];
}
}
catch
{
}
return directory;
}
</code></pre>
<p>For example if targetDirectory is c:\ then i get in the array 14 directories.
Now i want that each time i call the function offline it will return me once the first string c:\$Recycle.Bin
Then it will return c:\test
and each time i call the function it will return the next string from the array.
Since im using a recrusive function and calling this offline function from a recrusive i want it to return each time the next string from the array.</p>
<p>Now as it is now it will return the last directory in the array only and thats it.</p>
<p>How can i do it ?</p>
| c# | [0] |
2,255,486 | 2,255,487 | How do use the LayoutInflater inflater? | <p>I just create the Layout design using java code only not from the XML Layout Designs.
Like the following </p>
<pre><code> LinearLayout llay=new LinearLayout(this);
TextView tv1=new TextView(this);
tv1.setText("New Layout");
llay.addView(tv1);
</code></pre>
<p>How do use the LayoutInflater inflater for my LinearLayout ??? I am new to Android </p>
| android | [4] |
2,312,657 | 2,312,658 | C# Color of listbox item continued | <p>I'm trying to find a way to highlight the background of list box items with different colors, and came across this four year old closed thread that almost answers the question here:</p>
<p><a href="http://stackoverflow.com/questions/91747/background-color-of-a-listbox-item-winforms#91758">Background color of a ListBox item (winforms)</a></p>
<p>I'm not following how to use his method. So if I created an object named listBox1 and a string variable named strSomeString, what would be the exact code for adding strSomeString to listBox1 with a red background?</p>
<p>Using Shadow Wizard's code here:</p>
<pre><code> private void lbReports_DrawItem(object sender, DrawItemEventArgs e)
{
e.DrawBackground();
bool selected = ((e.State & DrawItemState.Selected) == DrawItemState.Selected);
int index = e.Index;
if (index >= 0 && index < lbReports.Items.Count)
{
string text = lbReports.Items[index].ToString();
Graphics g = e.Graphics;
Color color = (selected) ? Color.FromKnownColor(KnownColor.Highlight) : (((index % 2) == 0) ? Color.White : Color.Gray);
g.FillRectangle(new SolidBrush(color), e.Bounds);
// Print text
g.DrawString(text, e.Font, (selected) ? reportsForegroundBrushSelected : reportsForegroundBrush,
lbReports.GetItemRectangle(index).Location);
}
e.DrawFocusRectangle();
}
</code></pre>
<p>-Thanks</p>
| c# | [0] |
3,594,067 | 3,594,068 | Delete blank spaces after "$ " in JS? | <p>I want to eliminate blank spaces after '$'. E.g:</p>
<pre><code>"$ 1000" > "$1000"
</code></pre>
<p>I'm trying to do it like this to eliminate at least one space:</p>
<pre><code>text = text.replace(/^($%20)+/, '$');
</code></pre>
<p>But it's not working, how can it be done?</p>
| javascript | [3] |
4,216,235 | 4,216,236 | Response.Redirect() Turns Response.RedirectLocation NULL | <p>I have a group of Asp.Net applications that all share a common HttpModule that contains some code like this:</p>
<pre><code>public class MyModule : IHttpModule
{
public void Dispose()
{
}
public void Init( HttpApplication context )
{
context.Error += new EventHandler( context_Error );
}
private void context_Error( object sender, EventArgs e )
{
var lastError = HttpContext.Current.Server.GetLastError();
doSomeStuffWithError(lastError);
var response = HttpContext.Current.Response;
var redirect = GetErrorRedirect(lastError);
response.Redirect(redirect, true);
}
}
</code></pre>
<p>This works totally fine for all of my applications except for one. In the case of the one that doesn't work correctly, response.Redirect(...) doesn't seem to work. Instead of the redirect I expect, Asp.Net is redirecting to its standard error page. I've checked the configuration of this application and don't see anything wrong or significantly different from the other applications.</p>
<p>While investigating this issue, I modified the error handler with one more line of code as follows:</p>
<pre><code>private void context_Error( object sender, EventArgs e )
{
var lastError = HttpContext.Current.Server.GetLastError();
doSomeStuffWithError(lastError);
var response = HttpContext.Current.Response;
var redirect = GetErrorRedirect(lastError);
//setting a break point here, i've verified that 'redirect' has a value in all cases
response.Redirect(redirect, true);
var wtf = response.RedirectLocation;
//inspecting the value of 'wtf' here shows that it is null for one application, but equal to 'redirect' in all others.
}
</code></pre>
<p>When I set a break point on 'wtf' I'm seeing some strange behavior. For applications that work, wtf contains the same value as redirect. However, for my app that isn't working, wtf is null.</p>
<p>Anyone have any ideas on what would cause wtf to be null in this way?</p>
| asp.net | [9] |
3,618,881 | 3,618,882 | How do i generate a link + valid content that link points to, on the fly | <p>id like to do the following:</p>
<p>User clicks on link -> Link name used to fetch content form SQL -> Generate Content based on that -> Re-direct user there</p>
<p>A good example would be <a href="http://www.newone.org/" rel="nofollow">http://www.newone.org/</a>, its clear that the content of the links/posts are not set as a html document which is the user is sendt to.</p>
<p>How is that accomplished?</p>
<p>I assume they use a template, saved as a html file, and the values of the template is filled with data from the SQL on request.</p>
<p>Am i completly wrong or ?</p>
| php | [2] |
1,790,199 | 1,790,200 | Execute non-blocking task after blocking tasks | <p>In my application I have <em>n</em> blocking tasks, once all blocking tasks are done executing, I want to finally execute my non-blocking task (which relies on data from these blocking tasks).</p>
<p>My current solution is to have a variable <em>i</em> getting incremented by one in the blocking callback, afterwards it checks if <em>i</em> is <em>n</em>, if so, it executes the dependent, non-blocking task.</p>
<p>However, I feel this is nowhere near perfect; I assume it's a fundamental issue with async programming with a good solution (although I've been unable to find a better one).</p>
<pre><code>var i;
var result_one = null;
var result_two = null;
function render() {
if (i == 2) {
// do something with result_one and result_two
}
}
blocking.call(function(result) {
result_one = result;
i++;
render();
});
blocking.call2(function(result) {
result_two = result;
i++;
render();
});
</code></pre>
| javascript | [3] |
4,525,948 | 4,525,949 | Allow or deny copying my app to SD card? | <p>I've written two apps and I enabled copy-protection but my users keep asking me to let them copy it to their SD card. One is a totally free app, the other app is trialware that can be bought via an in-app purchase.</p>
<p>Should I copy-protect my apps? My main concerns about disabling copy-protection are:</p>
<ol>
<li><p>It might make it easier to reverse-engineer my source code (both apps)</p></li>
<li><p>It might make it easier to pirate my paid app.</p></li>
</ol>
<p>Besides, Android has warned that copy-protection will be disabled soon! Should I still bother with it?</p>
<p>Thanks in advance,</p>
<p>Barry</p>
| android | [4] |
3,514,287 | 3,514,288 | PHP array question | <p>I have a array called $A which contains only non zero positive numbers. </p>
<p>Now I need to find any number of distinct consecutive subarrays that have a given sum.</p>
<p>I will explain with example</p>
<pre><code>$A = array(1,2,3,4,5);
</code></pre>
<p>and the sum I am looking for is <code>5</code>.</p>
<p>Then there are <code>(2, 3)</code> and <code>(5)</code>.</p>
<p>I tried searching and got a python code. I've translated it to PHP below but it refuses to work</p>
<pre><code>$s = 0;
for($i = 0; $i < count($A); $i++){
for($j=$i; $j < count($A); $j++){
$s = $s + $A[$j];
if($s == $sum) {
echo "[" . $i . " " . $j . "]";
}
}
}
</code></pre>
<p>Please help.</p>
| php | [2] |
1,481,446 | 1,481,447 | Brief Howto Augmented Reality idea on iPhone | <p>I am currently developing an ar-iphone game as a hobby project. At the moment the user can click through some UIViews (e.g. main menu view) and start the game. I used the UIImagePickerController class and cameraoverlayview to achieve this. So when he presses the start button of the game the camera starts and an imageview is layed over it. </p>
<p>Now I want more ;-) I want to make a little coin game. The user should stand still and see little flying coins at the screen. when he touches one he gets a point.</p>
<p>Do I have to go into 3D space here? What do you recommend? </p>
<p>Thanks ;-)</p>
| iphone | [8] |
1,366,751 | 1,366,752 | How to get the values from string to textview? in Android | <p>In my application I want to display some items in a list, I kept all items in String array and brought by using code </p>
<pre><code> String[] activities = getResources().getStringArray(R.array.Contents);
</code></pre>
<p>Now my task is assign these string array values to my <code>TextView</code>.</p>
<p>Any suggestions?</p>
| android | [4] |
3,497,417 | 3,497,418 | What does the "|" (single pipe) do in JavaScript? | <p>alert(0.5 | 0);</p>
<p>Why does this return zero, but any integer (including negative) returns that int? I must not be clear on what a single pipe does...</p>
| javascript | [3] |
2,619,660 | 2,619,661 | QuickPDF library for converting local html pages to pdf | <p>I want to use QUICKPDF library in my C# windows form project. I want to convert the local HTMl pages to PDF . Is it possible to convert 'local html' pages using quickpdf dll.</p>
<p>Thanks.</p>
| c# | [0] |
5,531,918 | 5,531,919 | Remove underscore from list of enums? | <p>I'm using a enum with countries in a comboBox. All enums are in a class called Countries. Some of them has underscores like United_States_of_America. I need to remove those underscores before it shows in the comboBox?</p>
<p>My thought was to use <code>Replace("_", " ")</code>, simple if it was a common string, but not so simple with a combobox! Therefore I would preciate some help to solve this? Thanks!</p>
<pre><code>private void InitializeGUI()
{
// Fill comboBox with countries
cmbCountries.Items.AddRange(Enum.GetNames(typeof(Countries)));
}
</code></pre>
| c# | [0] |
815,349 | 815,350 | Automatically choose a file location before loading it in php | <p>I need to create a simple file overloading system like symfony does with php files and templates. I will give an example to explain what I need:</p>
<p>Given this folder structure:</p>
<pre><code> - root_folder
- modules
-module1
-file1.php
-file2.php
-file3.php
- specific_modules
-module1
-file2.php
</code></pre>
<p>I would like to find a way that automatically loads a file if it is found inside the specific_modules folder (file2.php) when called, if it is not found, it should load file2.php normally from the modules directory.</p>
<p>I would like to do it unobstrusively for the programmer, but not sure if it's possible!!</p>
<p>Any help or advice is welcome, thanks in advance!</p>
<p>skarvin</p>
| php | [2] |
5,533,726 | 5,533,727 | how can we switch on landscape mode from portrait on mac os in android | <p>How can we switch on landscape mode from portrait on Mac OS in andriod? </p>
<p>I already tried with <kbd>7</kbd>, <kbd>9</kbd>, <kbd>CTRL</kbd><kbd>F12</kbd>, <kbd>CTRL</kbd><kbd>F11</kbd> but they didn't work.</p>
| android | [4] |
3,224,290 | 3,224,291 | calculating user defined formulas (with c++) | <p>We would like to have user defined formulas in our c++ program.
e.g. The value <em>v = x + ( y - (z - 2)) / 2</em>. Later in the program the user would define x,y and z -> the program should return the result of the calculation. <br />Somewhen later the formula may get changed, so the next time the program should parse the formula and add the new values. <br/><br/> Any ideas / hints how to do something like this ? <br/><br/> So far I just came to the solution to write a parser to calculate these formulas - maybe any ideas about that ?</p>
| c++ | [6] |
281,104 | 281,105 | singleton and classic constructor | <p>This question is fairly fundamental.I gave a simple and straighfoward test on my cygwin:</p>
<pre><code> class Example {
public:
Example(){ cout<<"dude..."<<endl; }
~Example(){ cout<<"see ya"<<endl; }
public:
static Example *GetInstance(){
if(m_instance==NULL){
m_instance = new Example();
cout<<"watch out bro"<<endl;
}
return m_instance;
}
public:
void exp(){cout<<"greetings"<<endl;}
private:
static Example *m_instance;
};
int main(){
Example a;
return 0;
}
</code></pre>
<p>Obviously,the output is:</p>
<pre><code> dude...
greetings
see ya
</code></pre>
<p>Technically singleton and typical constructor are pretty much different stories in c++ programming since singleton puts constructor as private while typical way is opposite.In my recent internship experiences I have noticed that most coders implement APIs in this manner.</p>
<p>I just wonder if that is the case or unnecessary when both class construction approaches exist in parallel.</p>
<p><em><strong>UPDATE</em></strong></p>
<p>Is constructor & singleton existing in one program practically nonsense cuz singleton stuff in this scope would become useless codes like unhazardous trash?</p>
<p><em><strong>SUMMARY</em></strong>
This is quite a nonsense question...
and what's more,thanks to all of you brilliants
constructor and singleton design pattern are "mutually exclusive" and in terms of vulnerbility,it is the same story as global variables kill our debug time...</p>
| c++ | [6] |
1,845,674 | 1,845,675 | Traffic API focused in north america | <p>I am working on a project, in which i need traffic data (Mainly focused on north america)
I am unable to get any information regarding traffic delay.</p>
<p>I had gone through the google traffic overlays and map quest traffic api. but they are not providing me the traffic delay.</p>
| android | [4] |
1,255,667 | 1,255,668 | JavaScript Platform Independent Line separator | <p>Does something similar to Java's <code>System.getProperty("line.separator");</code> exist in JavaScript? </p>
<p>Edit: I am using the non-browser JavaScript environment Node.js</p>
| javascript | [3] |
3,166,362 | 3,166,363 | Regarding method overloading in java | <p>I was going through the method overloading in java and I was trying the output of the below program in eclipse , the program is ..</p>
<pre><code>public class OverloadingTest {
public static void main(String args[]){
List abc = new ArrayList();
List bcd = new LinkedList();
ConfusingOverloading co = new ConfusingOverloading();
co.hasDuplicates(abc); //should call to ArryList overloaded method
co.hasDuplicates(bcd); //should call to LinkedList overloaded method
}
}
class ConfusingOverloading{
public boolean hasDuplicates (List collection){
System.out.println("overloaded method with Type List ");
return true;
}
public boolean hasDuplicates (ArrayList collection){
System.out.println("overloaded method with Type ArrayList ");
return true;
}
public boolean hasDuplicates (LinkedList collection){
System.out.println("overloaded method with Type LinkedList ");
return true;
}
}
</code></pre>
<p>and the output is ..</p>
<pre><code>Output
overloaded method with Type List
overloaded method with Type List
</code></pre>
<p>Now in the explanation it was told ..method overloading is resolved at compile time using static binding in Java, so please advise how can I achieve the same through method overriding.</p>
| java | [1] |
1,798,119 | 1,798,120 | Android layout folder organization | <p>I am developing an Android app and I currently have about 8 layout xml files in the <code>layout</code> folder. The need for organizing this folder is increasing with each additional layout resource file. However, when I create a folder inside of the layout folder and move a resource to it via the refactor operation, it breaks my project.</p>
<p>For example, my resource is being refernced here:</p>
<pre><code>setContentView(R.layout.login);
</code></pre>
<p>After moving the <strong>login.xml</strong> file to a newly created folder called <code>"test"</code>, it breaks my build.</p>
<p>If I update the reference to:</p>
<pre><code>setContentView(R.layout.test.login);
</code></pre>
<p>It still doesn't compile.</p>
<p>Any help would be greatly appreciated.</p>
| android | [4] |
5,475,133 | 5,475,134 | Php, DirectoryIterator | <p>I am trying to understand part of the output I get from this code:</p>
<pre><code><?php
class DirectoryReader extends DirectoryIterator
{
function __construct($path)
{
parent::__construct($path);
}
function current()
{
return parent::getFileName();
}
function valid()
{
if(parent::valid())
{
if (!parent::isDir())
{
parent::next();
return $this->valid();
}
return TRUE;
}
return FALSE;
}
}
try
{
$it = new DirectoryReader('C:\wamp\www');
while($it->valid())
{
echo $it->current().'<br />';
$it->next();
}
}
catch(Exception $e)
{
echo 'No files Found!<br />';
}
?>
</code></pre>
<p>At the code you can see that I pass this path to the constructor: <code>C:\wamp\www</code>,</p>
<p>What I don't understand: before I can see all the folders the first line is <code>.</code>, the second is <code>..</code>, and then I can see the folder names for example:</p>
<pre><code>.
..
someFolder
someOtherFolder
</code></pre>
<p>I know that <code>.</code> present the current folder and <code>..</code> is getting back at the folders hierarchy, but I can't understand why does it print the <code>.</code> then <code>..</code> and then the folders?
I really want to understand the action of this iterator, if can some one please help me understand I will be very thankful.</p>
| php | [2] |
5,260,687 | 5,260,688 | Steps to create inhouse distribution in iphone | <p>I am having enterprise account. Can anyone tell the clear steps to distribute the package via URL.</p>
<p>Thanks in Advance</p>
| iphone | [8] |
2,964,134 | 2,964,135 | HTC wildfire HTC 2.2 device not found | <p>I have HTC wildfire HTC 2.2. I have connected in PC using usb cable.When I run the application , It didn't show any android device in my computer. Then I tried through command prompt also.I also say like this: </p>
<pre><code> C:\android-sdk-windows>adb shell
error: device not found
</code></pre>
<p>Please help me how can I install my apk? I have database also want to setup.</p>
| android | [4] |
4,930,242 | 4,930,243 | SimpleDateFormat Unparseable date Exception | <p>I am trying to parse datetime string with SimpleDateFormat.parse() but I keep receiving Unparseable date exceptions.</p>
<p>Here is the date format I am trying to parse: <code>2011-10-06T12:00:00-08:00</code></p>
<p>Here is the code I am using:</p>
<pre><code>try {
String dateStr = "2011-10-06T12:00:00-08:00";
SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
SimpleDateFormat dateFormatter = new SimpleDateFormat("MMM d, yyyy");
Date date = dateParser.parse(dateStr);
System.out.println(dateFormatter.format(date));
} catch(Exception e) {
System.out.println(e.getMessage());
}
</code></pre>
<p>Which returns this error: <code>java.text.ParseException: Unparseable date: "2011-10-06T12:00:00-08:00"</code></p>
<p>As far as I know this is the correct way to use the SimpleDateFormat class but I'm not fluent in Java so I could be mistaken. Any one know what my issue is?</p>
| java | [1] |
547,700 | 547,701 | Activity class does not exist | <p>Aaaargh! I don't know what's going on, but suddenly I can't launch my app. I'm using IntelliJ and I keep getting this error. I thought maybe there was a typo somewhere in the manifest, but there doesn't seem to be. Heres' the error: </p>
<pre><code>Launching application: com.foo.app/com.foo.app.main.
DEVICE SHELL COMMAND: am start -n "com.foo.app/com.foo.app.main"
Starting: Intent { cmp=com.foo.app/.main}
Error type 3
Error: Activity class {com.foo.app/com.foo.app.main} does not exist.
</code></pre>
<p>And here's my Manifest:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.foo.app">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".main">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".NoBellsActivity"/>
</application>
</manifest>
</code></pre>
<p>And the strange thing is that ADB shows me that the ActivityManager is starting the intent just fine...</p>
| android | [4] |
485,390 | 485,391 | What is the correct class modifier to pass through an object without allowing a user to create one | <p>So I have a Board User Control </p>
<pre><code> public partial class BoardController : UserControl
{
List<HotSpot> _hotSpots;
List<Area> _areas;
public BoardController()
{
InitializeComponent();
InitializeHitSpots();
InitializePlacementArrays();
}...
</code></pre>
<p>And a Game Controller</p>
<pre><code>public class GameController
{
private BoardController _board;
private List<PlayerController> _players;
public GameController()
{
_board = new BoardController();
_players = new List<PlayerController>();
}
public BoardController Board
{
get
{
return _board;
}
}...
</code></pre>
<p>Now even though I have a public property Board if I make the BoardController class internal I throw an error on the next line </p>
<pre><code> private void Form1_Load(object sender, EventArgs e)
{
game = new GameController();
this.Controls.Add(game.Board); //<-- this line
}
</code></pre>
<p>.</p>
<pre><code> Error: GameController.Board' is inaccessible due to its protection level
</code></pre>
<p>What is the proper class modifier declaration so that classes in the same assembly can use the BoardController but other assemblies can not create a BoardController object nor modify
BoardController outside of the assembly?</p>
| c# | [0] |
5,532,775 | 5,532,776 | Show an image on whole page | <p>How can i show an image on whole page when user click a button?
(means i have several controls on page and want to show this image over all of them)</p>
| asp.net | [9] |
2,639,064 | 2,639,065 | Controlling Camera Controls Via GUI | <p>I'm writing a desktop (J2SE) application that will take photographs with a digital camera. The camera can be connected to the PC via cable or wireless and will be any of the available digital cameras in the market. </p>
<p>I will get the video feed using the Java Media Framework (JMF).</p>
<p>The camera will have pan, zoom, and tilt controls and other controls.</p>
<p>My question is, do these camera controls have an Application Programming Interface (API) in JMF?</p>
<p>I couldn't find anything with an Internet search. </p>
<p>Can i use JMF to mimic these camera controls? If not what is the work around?</p>
<p>Thanks for your answer.</p>
| java | [1] |
2,586,933 | 2,586,934 | Can anyone explain the difference between closure and anonymous functions? | <p>I am relatively new to Javascript. I understand the concept of anonymous functions - but closures seem less clear. The similarity between the two (in my mind atleast), is confusing.</p>
<p>Could someone explain the difference? (preferrably, with some code snippet, to illustrate the points clearer).</p>
| javascript | [3] |
4,872,403 | 4,872,404 | How to compare in Android SDK 2 identical pictures but with different resolutions | <p>I have to make a junit test for an application.
My application displays 2 pictures.
I have extracted from the apk the 2 pictures as PNG using bitmap.compress, at the resolution my android emulator was running.
I build a junit apk using also robotium so i can run it using instrumentation.
Now i have a problem. My test works if i run it with emulator configured at the resolution when the picture were taken. I compare the pictures pixel by pixel.
It seems that in the apk that i need to test the 2 picture are generated dynamically depending on the device resolution</p>
<p>Now my question is: is there any way to compare 2 pictures and see if they are identical if they have different sizes, resolutions?</p>
| android | [4] |
4,497,875 | 4,497,876 | Java URLConnection Error | <p>This error is from a PC connected to a comcast modem. Is port blocking an issue when a person is trying to make an outbound TCP channel with a Java URL . . . the relevant code is :</p>
<pre><code>URL u = new URL("mailto:someguy@gmail.com"); // make a mailto: url
URLConnection c = u.openConnection(); // make its urlconnection
c.connect(); // connect to mail host
catch (Exception e) { // handle any exceptions, print error message
System.err.println(e);
}
</code></pre>
<p>The console returns the message :</p>
<p>connect. Timeout = -1
java.net.UnknownHostException: mailhost</p>
| java | [1] |
3,068,428 | 3,068,429 | What exactly happens in the Bellman-Ford Algorithm if there is a negative weigth cycle? | <p>I'm trying to understand exactly why the Bellman-Ford Algorithm would not work with a negative weight cycle. I do understand that negative weight cycles will prevent the program from giving the right answer. But what exactly happens in the program if there is negative weight cycle?</p>
<p>Thanks for your help</p>
| java | [1] |
3,417,963 | 3,417,964 | Android Progress Bar is not dismissed | <p>I am using Progress Dialog to show progress while loading web page, but sometimes it does not work properly. Progress Dialog never get dismissed though page is loaded.</p>
<p>I have added Progress Bar like this</p>
<pre><code>public boolean shouldOverrideUrlLoading(WebView view, String url) {
//Added progress dialog
}
public void onPageFinished(WebView view, String url) {
if(progressdialog.isShowing())
progressdialog.dismiss(); //Dismissed the progress, but sometimes never dismiss it
}
</code></pre>
| android | [4] |
2,278,219 | 2,278,220 | Android just in list | <p>I heard that when you publish your app, it gets into the just in list of the market. I also heard that after two weeks it gets into that list again. Is that right? Does it get into that list again every time i publish an update?</p>
<p>Thanks</p>
| android | [4] |
1,001,784 | 1,001,785 | C# Excel result comparation | <p>I have never learned this aspect of programming, but is there a way to get each separate result of a excel query(using OleDB) or the likes.</p>
<p>The only way I can think of doing this is to use the INTO keyword in the SQL statement, but this does not work for me (SELECT attribute INTO variable FROM table).</p>
<p>An example would be to use the select statement to retrieve the ID of Clients, and then compare these ID's to clientID's in a client ListArray, and if they match, then the clientTotal orders should be compared.</p>
<p>Could someone prove some reading material and/or some example code for this problem.
Thank you.</p>
| c# | [0] |
4,459,354 | 4,459,355 | What is this error message mean and how to fix it | <p>I receive the following error message:</p>
<blockquote>
<p>Windows has triggered a breakpoint in GDIMario.exe</p>
<p>This may be due to a corruption of the heap, which indicates a bug in GDIMario.exe or any of the DLLs is has loaded.</p>
<p>This my also be due to the user pressing F12 while GDIMario.exe has focus.</p>
<p>The output window may have more diagnostic information.</p>
</blockquote>
<p><img src="http://img20.imageshack.us/img20/1936/123oz.png" alt="Here is an image hosted in imageshack"></p>
<p>I really don't know why I've this caution, I don't F12. thanks for reading this ;)</p>
| c++ | [6] |
3,907,819 | 3,907,820 | Input outside form are selected | <p>I have a little problem. I think I make a big noob mistake but I can't find it. In the following code I try to get input of my form, but it gets input outside of form too. Why is that ?</p>
<p>Here my JS code :</p>
<pre><code>function selectAll(bool){
var form = document.forms['selectMailing'];
for(var i=1; i<=form.length; i++) {
form.elements['select'+i].checked = bool;
}
}
</code></pre>
<p>And HTML :</p>
<pre><code><input type=button value="Select All" onclick="selectAll(true)"/>
<form method=post action="" id="selectMailing" onsubmit="return checkSelect()">
<input type=checkbox name="select1" value="1" />
<input type=checkbox name="select2" value="1" />
<input type=submit value="Spammer" />
</form>
</code></pre>
<p>So when i try this, JS return error 'Cannot set property 'checked' of undefined' on line where there is my input button. Why this stuff happens ? I select form and only his elements and input button has no name which can be confused with the name form.</p>
<p>Thanks for your help !</p>
<p>I know about jquery but I want to learn JavaScript before, so if your only anwser is 'use jQuery', please go help someone else :)</p>
| javascript | [3] |
4,912,647 | 4,912,648 | how to do the each function for all to checked checkboxes | <p>I am using this code to check if the checkbox is checked or not.. </p>
<pre><code> $('#nextpage').click(function() {
var result = $('#Details input[type=checkbox]').attr('checked');
if (result == true) {
$("#tabs").tabs('enable', 3).tabs('select', 3);
}
else {
$().ShowDialog('please select atleast one');
}
});
</code></pre>
<p>Using this I can check only for one checkbox. If I need to check for multiple checkboxes in the Details page how do I need to loop throw?</p>
<p>thanks</p>
| jquery | [5] |
2,195,759 | 2,195,760 | Python - Should one start a new project directly in Python 3.x? | <p>What Python version can you please recommend for a long-term (years) project? Should one use 2.6+ or 3.x is already stable? (only standard libraries are required)</p>
<p>UPDATE: according to the answers below, Python 3.x still has critical bugs. Please also see <a href="http://bugs.python.org/" rel="nofollow">Python's list of bugs</a>.</p>
| python | [7] |
2,224,172 | 2,224,173 | How to reinstall the iPhone app in ad hoc distribution | <p>I am using ad hoc distribution for my iPhone app. It works very well. The only problem is when I update my app or create a new binary and want to install this new version on device, I need to delete the old version. Like although I drag and drop the new version in iTunes application, it does not over write the previous version even after I do sync. It might be becoz the app already exists in the device. So I need to delete it to reinstall it. How do I make sure the app gets updated to the new version and I dont loose the data from the previous app. Data I mean the database. Please note I am just formating the UI and not even touching the database.</p>
| iphone | [8] |
5,916,189 | 5,916,190 | Javascript Document.bgColor does not work | <p>In the below code, I get the two dialog boxes, but the bgColor of the page is never changed. Is there any standard that font / color changes are not honored in JavaScript ?</p>
<pre><code> <html>
<head>
</head>
<body bgColor="GRAY">
<script type="text/javascript">
document.write("This message is written by JavaScript");
alert('Am here');
alert('Am here again');
document.bgcolor="WHITE";
</script>
</body>
</html>
</code></pre>
| javascript | [3] |
5,372,167 | 5,372,168 | How can I get member names from an object? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3068534/getting-javascript-object-key-list">Getting JavaScript object key list</a><br>
<a href="http://stackoverflow.com/questions/4233354/how-to-iterate-json-data-in-jquery">How to iterate json data in jquery</a> </p>
</blockquote>
<p>I have a json like this one:</p>
<pre><code>var myJSONObject = {
"flowers": [
{"id":"1","name":"Red Flower","url":"flower_1.png"},
{"id":"2","name":"Purple Flower","url":"flower_2.png"},
{"id":"3","name":"Yellow Flower","url":"flower_3.png"},
{"id":"4","name":"Violet Flower","url":"flower_4.png"},
{"id":"5","name":"Purple Flower","url":"flower_5.png"}
],
"bouquet": [
{"first":[1,2,3,4,5,6]},
{"second":[1,2,3,4,5,6]},
{"third":[1,2,3,4,5,6]}
]
};
</code></pre>
<p>Now my questin is how can I pull only the names of members of "bouquet"...into array.
Something that will look like that : ["first","second","third"]?</p>
| javascript | [3] |
4,005,820 | 4,005,821 | how to dynamically change height of text area jquery? | <p>I have a text area which gets populated by jquery dynamicaly when a user clicks on a button.</p>
<p>What i would like to happen is once the text area is populated is for the height of it to expand so all the text inside it can be seen?</p>
<p>this is the text area: </p>
<pre><code><textarea type="text" id="notes" name="notes" value="" class="txt" style="width: 97%;"></textarea>
</code></pre>
| jquery | [5] |
5,430,759 | 5,430,760 | C# 3.0 Targeting 2.0 | <p>I do not understand how this works - I am using VS2008 and using 3.0 language features like the var keyword.</p>
<p>Yet I can compile and run against a 2.0 framework version </p>
<p>How is that possible?</p>
<p>EDIT: Is there a website which defines the CLR, Framework and language features and backward compatability - I am quite confused by all that</p>
| c# | [0] |
1,583,521 | 1,583,522 | jQuery .load from another page that contains Javascript | <p>I've been using jQuery .load() to load content into a div. The content being .loaded occasionally has a document.ready() function which is called, and works, correctly (i.e. the ready() function is called). However, when I use an element ID in the .load(), such as: .load ("test.php #content"), the Javascript is no longer executed even if I put the script tag inside of the element that is being loaded. Does anyone have a solution to this other than to not use the element ID in the .load()? Thanks in advance.</p>
<p>Here is the dynamic content (loadDialogTest.php):</p>
<pre><code> <div id="test">
<div>
Hello, World!
</div>
<script type="text/javascript">
$(document).ready (function () {
alert ("ready");
});
</script>
</div>
</code></pre>
<p>and here is the page (where the element ID is NOT specified) that loads it (shortened as much as possible while maintaining the form:</p>
<pre><code> <head>
<script type="text/javascript">
$(document).ready (function () {
$("#openDialog").click (function () {
$("<div></div>")
.load ("loadDialogTest.php")
.appendTo ($("#containingDiv"))
.dialog ({
autoOpen: 'false',
title: 'Test This!',
close: function () {
$(this).dialog ('destroy').remove ();
}
});
});
});
</script>
</head>
<body>
<a href="#" id="openDialog">Open it</a>
<div id="containingDiv">
</div>
</body>
</code></pre>
<p>If I put #test after the .php file as the div to load, the jQuery ready() function is no longer called.</p>
| jquery | [5] |
5,358,423 | 5,358,424 | uploading a file from iphone to server | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3465361/how-to-upload-a-file-to-the-server-in-iphone-sdk">How to upload a file to the server in iPhone SDK?</a> </p>
</blockquote>
<p>hi </p>
<p>i am a beginner in iphone applications i want to make an application for transfering a file from iphone to server to later print it .how can i perform it can anyone tell me the code for this .</p>
<pre><code>#import <UIKit/UIKit.h>
@interface printerapplicationAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UILabel *display;
UILabel *display1;
IBOutlet UIButton *print;
IBOutlet UIButton *cancel;
IBOutlet UITextField *addres;
IBOutlet UITextField *name;
}
-(IBAction) print: (id) sender;
-(IBAction) cancel: (id) sender;
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UILabel *display;
@property (nonatomic, retain) IBOutlet UILabel *display1;
@property (nonatomic, retain) IBOutlet UITextField *name;
@property (nonatomic, retain) IBOutlet UITextField *address;
@end
</code></pre>
| iphone | [8] |
3,270,682 | 3,270,683 | jquery disabled=disabled not working in safari | <p>I have some code that disabled a button, using jquery it does:</p>
<pre><code>$('#fishID').attr('disabled', 'disabled');
</code></pre>
<p>This seems to work in every browser (IE6, IE7, 8, 9, Chrome, Firefox) except Safari where it does not disable the button.</p>
<p>Should I be setting it to <code>'disabled', 'true'</code> ? What's the difference?</p>
<p>Is there a quirk with Safari that might explain this not working?</p>
| jquery | [5] |
2,987,253 | 2,987,254 | Calculate speed using javascript | <p>In the below code what am am i doing wrong.I get the speed as infinity </p>
<pre><code>var imageAddr = "/images/image.jpg" + "?n=" + Math.random();
var startTime, endTime;
var downloadSize = 200000;
var download = new Image();
download.onload = function () {
endTime = (new Date()).getTime();
showResults();
}
startTime = (new Date()).getTime();
download.src = imageAddr;
function showResults() {
var duration = Math.round((endTime - startTime) / 1000);
var bitsLoaded = downloadSize * 8;
var speedBps = Math.round(bitsLoaded / duration);
var speedKbps = (speedBps / 1024).toFixed(2);
var speedMbps = (speedKbps / 1024).toFixed(2);
alert("Your connection speed is: \n" +
speedBps + " bps\n" +
speedKbps + " kbps\n" +
speedMbps + " Mbps\n" );
}
</code></pre>
| javascript | [3] |
2,113,259 | 2,113,260 | Instance of custom class as a member of another class | <p>I have a class Game, and a class Player, and an instance of Player called "player" is a member of the Game class.</p>
<pre><code>Game::Game() : player(screen, player_image, 390, 290) { }
</code></pre>
<p>I was told by friends to do that, but I hate doing that, for two reasons:
1. When I pass the variable "screen" to Player on that line, screen hasn't been properly initialized, so I have to pass it again later.
2. It looks bad, I had never seen code like that until today when I was told to do this.</p>
<p>So, is there a way around it? Thank you.</p>
<p>On my .hpp file I have:</p>
<pre><code>public: Player player;
</code></pre>
| c++ | [6] |
1,478,231 | 1,478,232 | How can I activity close in Android? | <p>I have three <code>classActivity</code> created. One is super class and other sub class and third is HomeActivity.</p>
<p>Code for super class is :</p>
<pre><code>public class MyActivity extends Activity {
Button btnHome = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public void onHomeClick(View view) {
String LOG_TAG = "Akshar";
System.out.println("Hello11111");
btnHome = (Button) view;
Log.v(LOG_TAG, "index=" + btnHome);
}
}
</code></pre>
<p>and my subclass code is :</p>
<pre><code>public class ChooseIsland extends MyActivity {
Button btn_home = null;
MyActivity ob1 = new MyActivity();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chooseiland);
addListenerOnButton();
}
private void addListenerOnButton() {
// TODO Auto-generated method stub
ob1.onHomeClick(btn_home);
}
}
</code></pre>
<p>Now I want to go on Home page when click so when I write ?</p>
<pre><code>Intent intent = new Intent(this, HomeActivity.class);
</code></pre>
| android | [4] |
4,029,079 | 4,029,080 | Calling function using post inside another jquery post in jquery | <p>I want to call function using post inside another jquery post like below,</p>
<pre><code><script type="text/javascript">
$.post("/testcall1",
function(data){
$('#testDiv1').html(data);
$.post('/testcall2',function(data){$('#testDiv2').html(data);});
});
</script>
</code></pre>
<p>From the above piece of code, I have to call one after another not at the same time, Will that work first, if yes will that work in all kind of browser like IE7, IE8, FF,Safari, Chrome</p>
| jquery | [5] |
2,950,528 | 2,950,529 | php trim function | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7082295/replacing-excess-whitespaces">Replacing excess whitespaces</a> </p>
</blockquote>
<p>When I trim using PHP It just trim left and right side of PHP. Isn't their any function that remove more than 2 white spaces between a string? </p>
<p>Suppose I have this </p>
<pre><code>"Stack Overflow"
</code></pre>
<p>and I want this</p>
<pre><code>"Stack Overflow"
</code></pre>
| php | [2] |
4,340,981 | 4,340,982 | Javascript tabifier not working in Chrome, but works fine on Firefox | <p>I have little knowledge of javascript so I hope someone here could help me. The problem occurs on <a href="http://www.bestfreeandroidapps.com/" rel="nofollow">http://www.bestfreeandroidapps.com/</a> if you look on the right side there are 3 tabs with Categories, Comments and Recent Posts. When you click on them from Chrome, nothing happens (no errors in the console, just nothing), however it works fine in Firefox.</p>
<p>This theme uses a script calle Javascript tabifier from <a href="http://www.barelyfitz.com/projects/tabber/" rel="nofollow">http://www.barelyfitz.com/projects/tabber/</a>, however I even replaced the script on the theme with what was included in the original project and still doesn't work on Chrome. Does anyone have an idea of what might be wrong and why is this happening?</p>
<p>Thank you very much!</p>
| javascript | [3] |
6,003,336 | 6,003,337 | Javascript to add delivery fee based on certain price | <p>I have website where I am implementing a checkout solution.</p>
<p>The customer has 2 prices:</p>
<p>Installed price</p>
<p>and</p>
<p>Not Installed price</p>
<p>Both buttons have the same name "sub_amount".</p>
<p>I need a javascript that:</p>
<p>When the user clicks whichever price (button, installed or not installed) , the javascript needs to do two things :</p>
<ol>
<li>Calculate a sales tax of 6% (to be sent to final order page)</li>
<li>add a delivery cost of $10 unless the amount is over $50. (before tax price is added)</li>
</ol>
<p><strong>So, I have two objectives</strong> </p>
<ul>
<li>add a sales tax of 6%</li>
<li>on click (of installed or not installed button) add a delivery charge of $10 if over $50</li>
</ul>
<p>tax should be on initial price only (<strong>not</strong> price once the delivery is added)</p>
<p>I looked here and this is similar what I need, but I don't want the on window alert and I don't know the proper syntax for my specific need. </p>
<p><a href="http://stackoverflow.com/questions/4606296/in-javascript-doing-a-simple-shipping-and-handling-calculation">In JavaScript doing a simple shipping and handling calculation</a></p>
<p>Can anyone tell me the correct syntax for what I am trying to do?</p>
| javascript | [3] |
466,475 | 466,476 | Can a main() method of class be invoked in another class in java | <p>Can a main() method of class be invoked in another class in java</p>
| java | [1] |
3,487,872 | 3,487,873 | User Controls and JavaScript and Master Pages | <p>Consider the following situation:</p>
<p>There is a master page with a contentPlaceHolder for all javascript...</p>
<p>for speed issuses this section is at the bottom of the page.</p>
<p>my user control generates some javascript that make use of some references in the master page javascript (Jquery library)</p>
<p>so, if my user control is rendered before the master page javascript, it won't work.</p>
<p>and this is my question:</p>
<p>how do I make some javascript code block inside my .ascx file to be rendered to the asp:Content JavaScript in the .aspx page</p>
<p>or maybe my all thinking is worng?</p>
<p>Thanks!</p>
| asp.net | [9] |
3,757,372 | 3,757,373 | Are C++ libs created with different versions of Visual Studio compatible with each other? | <p>I am creating a open-source C++ library using Visual Studio 2005. I would like to provide prebuilt libs along with the source code. Are these libs, built with VS2005, also going to work with newer versions of Visual Studio (esp VS Express Edition 2008)? Or do I need to provide separate libs per VS version?</p>
| c++ | [6] |
5,061,703 | 5,061,704 | Detect slow Javascript | <p>Is there any way to detect if Javascript code is taking more time to execute than it should? I don't want to run code, then determine the time it took, I want to determine if actively running code is going slower than it should, and stop that whole script.</p>
| javascript | [3] |
4,517,026 | 4,517,027 | Loading Different Views With Segmented Control | <p>I am using a segmented control with 2 segments on one of the tab bar items on my iPhone app. Essentially, I would like to display two different views when each segment is selected - one segment shows a tableview and the other segment shows a mapview.</p>
<p>So, when segment 1 is tapped, a tableview is displayed. And on tap of segment 2, a mapview is displayed. Each view has its own controller and is loaded from its own nib file. Is this possible? </p>
<p>I successfully created the two views (and controllers) and the two segment controls (on the navigation bar) via XCode but have no idea how to proceed next. Any suggestions and sample code to would be most appreciated.</p>
| iphone | [8] |
1,368,700 | 1,368,701 | Can I initialize a value to a pointer? | <pre><code>int *p;
*p=100;
cout<<*p;
</code></pre>
<p>Is this correct or it should give some error?</p>
| c++ | [6] |
4,689,171 | 4,689,172 | Select value of nested element | <p>I have nested elements:</p>
<pre><code><ul class="level-1">
<li class="item-i">I</li>
<li class="item-ii">II
<ul class="level-2">
<li class="item-a">A</li>
<li class="item-b">B
<ul class="level-3">
<li class="item-1">1</li>
<li class="item-2">2</li>
<li class="item-3">3</li>
</ul>
</li>
<li class="item-c">C</li>
</ul>
</li>
<li class="item-iii">III</li>
</ul>
</code></pre>
<p>How to get value (it's '1') from <code>li class="item-1">1</li></code> when clicked? I have problem with defining right selector... How to end with something like this:</p>
<pre><code>$(all children of level-1).click(function() {
alert($(this.item-1").val(););
}
</code></pre>
| jquery | [5] |
1,247,439 | 1,247,440 | Which should I use Handler, AsyncTask or Thread? | <p>This may be a common question but I couldn't find my exact scenario. I understand that its down to developer choice in a lot of ways but I don't know enough to choose best. </p>
<p>I have my initial app splash screen which will just display a logo whilst checking the user is logged in. If their login details are already stored in a sharedPreference then I want to check those details against my online database of details for verification. Once this is all checked I'll either pass the user through to the main app screen or a registration screen. </p>
<p>So when doing this check of user details, and then verifying them. Should I do this in a separate or use a handler? I don't think AsyncTask is needed as I'm not wanting to pass any progress details back to the UI? </p>
<p>TIA </p>
| android | [4] |
2,506,735 | 2,506,736 | Send mail From Localhost using PHP | <p>how to send Mail from localhost using PHP?</p>
<p>sending mail from localhost to remote server</p>
<p>i am using wamp server,OS windows Xp.</p>
<p>can anyone tell me about this issue</p>
<p>thank u in advance</p>
| php | [2] |
4,328,236 | 4,328,237 | Showing a list of errors in MessageBox show method | <p>I'm trying to figure out a way to show a listing of validation errors in my app using MessageBox.Show. So far I have this:</p>
<pre><code> private bool FormIsValid()
{
bool isValid = true;
List<string> strErrors = new List<string>();
if (!(txtFirstName.Text.Length > 1) || !(txtLastName.Text.Length > 1))
{
strErrors.Add("You must enter a first and last name.");
isValid = false;
}
if (!txtEmail.Text.Contains("@") || !txtEmail.Text.Contains(".") || !(txtEmail.Text.Length > 5))
{
strErrors.Add("You must enter a valid email address.");
isValid = false;
}
if (!(txtUsername.Text.Length > 7) || !(pbPassword.Password.Length > 7) || !ContainsNumberAndLetter(txtUsername.Text) || !ContainsNumberAndLetter(pbPassword.Password))
{
strErrors.Add("Your username and password most both contain at least 8 characters and contain at least 1 letter and 1 number.");
isValid = false;
}
if (isValid == false)
{
MessageBox.Show(strErrors);
}
return isValid;
}
</code></pre>
<p>But alas, you cannot use a List of type String inside the Show method. Any ideas?</p>
| c# | [0] |
2,354,313 | 2,354,314 | Why are the textviews invisible? | <p>I use the following layout (shortened): </p>
<pre><code><TableLayout xmlns:android="http://schemas.android.com/apk/res/android" ...>
<TableRow ...>
<TextView
android:id="@+id/sell_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/sell" />
<SeekBar
android:id="@+id/sell"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</TableRow>
</TableLayout>
</code></pre>
<p>Like this (shortened also):</p>
<pre><code>LayoutInflater inflater = parent.getLayoutInflater();
View layout = inflater.inflate(R.layout.merger_sale, null);
AlertDialog.Builder builder = new AlertDialog.Builder(parent);
builder.setTitle(R.string.sell_stock_after_merger)
.setView(layout)
.setPositiveButton(R.string.sell_all, new OnClickListener() {...
.setNeutralButton(R.string.trade_sell, new OnClickListener() {...
.setNegativeButton(R.string.trade_all, new OnClickListener() {...
AlertDialog dialog = builder.create();
dialog.show();
</code></pre>
<p>The layout has no errors, nor does the code. The layout shows exactly as it should in Eclipse's layout editor.
The dialog appears when it should appear, buttons behave how they should, except for the texview (@+id/sell_text) [and the other textviews in the shortened <TableRow>s], which don't appear.</p>
<p>What am I overlooking? Thanks!</p>
| android | [4] |
1,559,824 | 1,559,825 | Android : How to get the dirty(changed) properties | <p>How to get the dirty(changed) properties(any controls subclasses of view) amongst a number of properties on a layout. Does android has a dirty flag to mark if the layout has any field that has a changed content??</p>
<p>Actually, i have a layout that has a few edittexts,spinners,datewidgets.Now doing a save should make request to the server only if the user has modified anything .I wanted to know that how can i check if the user has changed anything in that layout or not.Does android has any flag or something that sets itself when the user modifies any input control?</p>
<p>Hmm..Blckberry Does have isDirty(){boolean net.rim.device.api.ui.Manager.isDirty()}method. </p>
| android | [4] |
611,460 | 611,461 | Developing call/vocie recording app (iphone)? | <p>I want to make an iphone application to record the incoming and outgoing calls. If I can't develop such app , What are the technology and hardware hindrance in doing so ? BTW i was thinking to run my app in background while call, Hence recording the input and output voice through my app .</p>
| iphone | [8] |
3,291,785 | 3,291,786 | Return value of the 'return_var' if exec function is successful in PHP? | <p>I need some basic information regarding the return values when the <code>exec()</code> function is successfully executed. Especially what should be the value of the 'return_var' when <code>exec</code> is successful and at the same time what would be in the output array as well and vice-versa.</p>
<p>In my case I am getting a value of <code>return_var = -6</code>.</p>
<p>Does it have any proper meaning?</p>
<p>Thanks</p>
| php | [2] |
4,522,162 | 4,522,163 | Android - Turn by turn Navigation | <p>how can I provide navigational turn-by-turn in the android application which I am making?
i didnt use google maps for this, i wanna build my own application which provide users with turn-by-turn navigation.</p>
<p>thx for helping me.</p>
| android | [4] |
456,635 | 456,636 | How to get rid of whitespace in a string, php | <p>So, I've tried using trim and str_replace, and I just can't figure it out. I've googled it, and nothing seems to be working.</p>
<p>here is my code:</p>
<pre><code>function convertcurrency($euro){
if (is_numeric($euro)) {
$currency = file_get_contents("http://www.google.com/ig/calculator?hl=en&q=".$euro."EUR%3D%3FUSD");
$contents = array_map('trim', explode(" ", $currency));
$getint = array_map('trim', explode("\"", $contents[3]));
unset($getint[0]);
$usdollar = implode(" ", $getint);
echo "$euro Euro's is equal to $usdollar U.S. Dollars";
}
else{
echo "$euro is not a number, please enter a number.";
}
}
convertcurrency(123123);
?>
</code></pre>
<p>Thanks!</p>
<p>Edit:</p>
<p>I apologize, I should have posted my output, and expected output.</p>
<p>Output: 123123 Euro's is equal to 162 362.3 U.S. Dollars
Expected output: 123123 Euro's is equal to 162362.3 U.S. Dollars </p>
<p>Once I get rid of the whitespace, I can use the money_format function to display it properly.</p>
| php | [2] |
2,841,908 | 2,841,909 | android : trigger method of a running service to act | <p>I have a service that keeps running, and a Timer in there to execute a certain function every X minutes. </p>
<p>From an activity, I'd like this function to be called immediately when something happens, so we don't need to wait untill the function is called by the Timer. Is that possible?</p>
<p>If you like a less 'general' question: </p>
<ul>
<li>I have a database with queued messages (queuing is done in case no network is available). </li>
<li>Every X minutes, my service checks if network is available, and flushes the queue to the server</li>
<li>Now, what I'd like to achieve is that I can trigger this "flushing" of the queue as soon as I've added an item to it (from within an activity). </li>
</ul>
<p>Is that possible?</p>
| android | [4] |
3,644,701 | 3,644,702 | How to display the min and max values of integers read from a file? | <p>Below is my code. I have a problem in my alogrithm. It displays the last value of the integer from the input file for both the max and min. values. Would someone please take a look and tell me what I'm doing wrong?</p>
<pre><code>#include "cstdlib"
#include "iostream"
#include "fstream"
using namespace std;
int main()
{
fstream instream;
ofstream outstream;
instream.open("num.txt");
if(instream.fail())
{
cout<<"The input file failed to open\n";
exit(1);
}
outstream.open("output.txt");
if(outstream.fail())
{
cout<<"The output file failed to open";
exit(1);
}
int next, largest, smallest;
largest = 0;
smallest = 0;
while(instream>>next)
{
largest = next;
smallest = next;
if(largest<next)
{
largest = next;
}
if(smallest>next)
{
smallest = next;
}
}
outstream<<"The largest number is: "<<largest<<endl;
outstream<<"The smallest number is: "<<smallest<<endl;
instream.close();
outstream.close();
return 0;
}
</code></pre>
| c++ | [6] |
3,101,395 | 3,101,396 | Why does the following PHP code fail? | <pre><code>define('test',2);
if(isset(test))echo 'hi';
</code></pre>
| php | [2] |
5,937,849 | 5,937,850 | C# why isnt my StreamReader working? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/13172171/c-sharp-streamreader-input-files-from-labels">C# StreamReader input files from labels?</a> </p>
</blockquote>
<p>Okay I am working on a Roller Dice program still, I need the program to show the previous High Score everytime the game starts over. However when I type in the code. Its giving me errors staying. The name 'File' does not exist and namespace name StreamReader could not be found?
Please help</p>
<pre><code>private void button2_Click(object sender, EventArgs e)
{
try
{
int scores;
int highscore = 0;
StreamReader inputFile;
inputFile = File.OpenText("HighScore.txt");
while (!inputFile.EndOfStream)
{
scores = int.Parse(inputFile.ReadLine());
highscore += scores;
}
inputFile.Close();
highscoreLabel.Text = highscore.ToString("c");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
</code></pre>
| c# | [0] |
1,878,100 | 1,878,101 | How would I do a proper fadein for dynamic content refreshing with jquery? | <p>I have a .txt file that I need to include into a page, that gets dynamically updated every 5 seconds, so I need to refresh it via ajax, so that the updated content can be seen without refreshing the page. I want to do it so it fades into the div, with every 5 second update.</p>
<p>Currently Im doing it like this, which is pretty ugly looking</p>
<pre><code>function getSearches() {
$("#latest_searches").animate({
opacity: 0.3
}, 1000 );
$("#latest_searches").load("_latest_searches.php", '', callback);
}
function callback() {
$("#latest_searches").animate({
opacity: 1
}, 1000 );
setTimeout("getSearches();", 5000);
}
$(document).ready(getSearches);
</code></pre>
| jquery | [5] |
2,583,210 | 2,583,211 | Can I use open_basedir or is it deprecated? | <p>Excuse me in advance for the strange question :-)</p>
<p>I'm using the last stable php version, and I want to "jail" php scripts. (I tried to chroot, but it is boring.</p>
<p>I would like to use open_basedir directive on php.ini, but I don't know with it's deprecated or not. I searched on Google and 99% times the page redirect to <a href="http://php.net/manual/en/features.safe-mode.php" rel="nofollow">http://php.net/manual/en/features.safe-mode.php</a> (DEPRECATED).</p>
<p>So my question is, Can I use this directive or not? is it sure?</p>
<p>Thank you really much</p>
| php | [2] |
2,958,829 | 2,958,830 | How can I toggle between 2 images | <p>Im trying to use this code to toggle between a play and pause button but it doesn't seem to be working. How can I get it toggle between the 2 images when the are clicked </p>
<p><a href="http://jsfiddle.net/aFzG9/1/" rel="nofollow">http://jsfiddle.net/aFzG9/1/</a></p>
<pre><code>$("#infoToggler").click(function()
{
if($(this).html() == "<img src="http://tympanus.net/PausePlay/images/play.png" width="60px" height="60px"/>")
{
$(this).html("<img src="http://maraa.in/wp-content/uploads/2011/09/pause-in-times-of-conflict.png width="60px" height="60px"/>");
}
else
{
$(this).html("<img src="http://tympanus.net/PausePlay/images/play.png" width="60px" height="60px"/>");
}
});
</code></pre>
<p>Thanks</p>
| jquery | [5] |
302,705 | 302,706 | How can I identify the source of a cyclic dependency in C++ | <p>Can anyone tell me how I can identify which classes are causing the cyclic dependency issues that I am seeing?</p>
| c++ | [6] |
3,757,106 | 3,757,107 | how to detect encoding of text file before inputStream in java? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/499010/java-how-to-determine-the-correct-charset-encoding-of-a-stream">Java : How to determine the correct charset encoding of a stream</a> </p>
</blockquote>
<p>i'm trying to read an ANSI text file in java but, i don't know the encoding of the text inside , is there any way to detect the encoding of text file before getting it using FileInputStream ?</p>
| java | [1] |
5,562,987 | 5,562,988 | javascript to create process | <p>I want to execute a process named notepad.exe or any exes in javascript and i want to handle the process in javascript by giving input and so on. I think there is a shell command used in javascript to create process can anybody brief me or help me with the example how to work with process in javascript?</p>
| javascript | [3] |
170,346 | 170,347 | How do you remove unicode characters in javascript? | <p>Im trying to remove some unicode characters[E000-F8FF] from a string.How do I go about doing this in javascript?
For example I looking to strip E018 from this string : </p>
<p>The IT Crowd </p>
| javascript | [3] |
1,023,305 | 1,023,306 | jquery show and hide problem | <p>I have a set of records with an "edit" button next to them.
I also have a div that has a form inside of it. </p>
<p>when I click on "edit" I show the div. Inside the div, I have a "close" button which simply closes the div via jquery.hide(). when I then click the "edit" button for another record, the div does not get displayed at all.</p>
<p>I use other show and hide within my code for other elements and they work quite fine. Only this one I can't get working.</p>
<p>Is there a specific usage of the show() and hide() methods in my case ?</p>
<pre><code> $('.edit').live('click', function() {
var theid = $(this).attr('id');
$('#' + theid).empty().append($('.rec_edit').show());
if ($('#txt_nowediting_id').val() > 0) {
load_single_rec($('#txt_nowediting_id').val());
};
$('#txt_nowediting_id').val(theid);
return false;
});
$('#btnCancelEdit').click(function() {
$('.rec_edit').hide();
load_single_rec($('#txt_nowediting_id').val());
return false;
});
</code></pre>
<p>here .rec_edit is the div that gets hidden and shown...</p>
| jquery | [5] |
5,067,431 | 5,067,432 | recurrently copy a file from one directory to another after every 30 minutes or 1 hour automatically | <p>How can I automatically copy files from a source directory to the destination directory after some time say like after every 30 minutes?</p>
| php | [2] |
3,000,238 | 3,000,239 | How to call another PHP script from a PHP script? | <p>I have a PHP script that has a runtime of 34 seconds. But it dies after 30 seconds. I guess my webhost a time limit of 30 seconds.</p>
<p>I am thinking of splitting the script into two parts say PHP-1 and PHP-2.</p>
<p>Can I call PHP-2 from PHP-1 and kill PHP-1?
Both scripts have to run in sequence, so calling both of them using cron is not possible. [ My host provides cron with interval 5 mins and does not allow to change the start time]</p>
<p>-Will this circumvent the time limit set by host?</p>
| php | [2] |
1,590,499 | 1,590,500 | Shortened namespace alias in aspx | <p>I have a using statement defined like this in codebehind:</p>
<pre><code>using Name = Extremely.Long.And.Unwieldy.Namespace
</code></pre>
<p>I want to be able to do this in my aspx page:</p>
<pre><code><%=Name.Type %>
</code></pre>
<p>So far the best I have come up with is this:</p>
<pre><code><%=Namespace.Type %>
</code></pre>
<p>using the technique shown <a href="http://stackoverflow.com/questions/1697169/is-it-possible-to-use-the-using-statement-in-my-aspx-views-asp-net-mvc">here</a>.</p>
<p>Can I do any better?</p>
| asp.net | [9] |
521,595 | 521,596 | Got -1 from HttpURLConnection getResponseCode() | <p>In my code I use</p>
<pre><code>mHttpConnRespCode = mConnection.getResponseCode();
</code></pre>
<p>to get http response code, where mConnection is HttpURLConnection type.</p>
<p>Sometimes I got -1 as response code. Under what circumstances, mConnection.getResponseCode() returns -1?</p>
<p>Thanks.</p>
| java | [1] |
2,442,053 | 2,442,054 | How to implement a general Mime type correctly in PHP? | <p>If you click view,you'll open that file in browser,</p>
<p>I've tried :</p>
<pre><code>readfile('test.jpg');
</code></pre>
<p>But seems it fails in firefox.</p>
| php | [2] |
3,802,004 | 3,802,005 | JQuery: Showing / Hiding html tags if another tag is empty or not | <p>this is my first time posting here, I have a question which I have searched high and low for and so far cannot find a working answer.</p>
<p>The HTML would be as follows:</p>
<p><code><span class="label">Label:</span></code><br>
<code><span class="value">{{Value}}</span></code></p>
<p>Basically, {{Value}} is a variable inserted (or not) via php/mysql.<br>Of course if {{Value}} is empty, you get the following when the page is rendered:</p>
<p><code><span class="label">Label:</span></code><br>
<code><span class="value"></span></code></p>
<p>The idea is for Label: to be hidden if there is nothing in {{Value}}.</p>
<p>I have tried various examples using $(.value:empty) & if statements but it hides .label regardless.</p>
<p>Any suggestions are welcome.<br>
Thanks in advance,<br>
Rob</p>
| jquery | [5] |
3,307,428 | 3,307,429 | document.elementById returns null after jQuery loads external content with .load() or .post() | <p>I am using jQuery to load some data inside a div, after posting some options. The returned data also contains a dynamically generated form. After the data has loaded, I need to get the form values using getElementById(name), but it does not work (returns null).</p>
<p>I have tried sending and loading the results with .load() and .post()</p>
<p>Example code:</p>
<pre><code>//function to load data
function loadProductPrices(var1)
{
//#thisProductPrices is the data container
$('#thisProductPrices').load('filename.php', { 'var1': var1});
}
//function to get element value after previous function has been called
//(this one is called by a button that is part of the content that has
//been generated by the previous call)
function getAndSaveValue(elementID)
{
var thisValue = document.getElementById(elementID).value; // this returns null (?)
// after I have the new value I will post and save, using jquery again.
}
</code></pre>
<p>The html generated by loadProductPrices() returns a list of items</p>
<pre><code>PriceValue
<input type="text" id="price_productID" value="PriceValue" />
<input type="button" value="save new price" onclick="getAndSaveValue(price_productID)" />
// the above button calls getAndSaveValue, in order to retrieve the new price
//and save it...
//however it returns null.
</code></pre>
<p>Any suggestions? thnx!</p>
| jquery | [5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.