Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10
values | Tag_Number stringclasses 10
values |
|---|---|---|---|---|---|
1,315,081 | 1,315,082 | Image storage as byte code locally from XML parsing & display if it is stored Otherwise go for parsing. | <p>I am having an app in which at the time of launcing the app XML parsing is giving Main category from URL like hp, dell, etc...I am displaying it in the Tableview.</p>
<p>Then on click of particular cell i can get the detail of main category means its subcategory like <a href="http://www.dealsbell.com/findcoupon.php?store=hp" rel="nofollow">http://www.dealsbell.com/findcoupon.php?store=hp</a></p>
<p>Here also i am getting data properly after parsing.</p>
<p>But my concern over here is, in ( <a href="http://www.dealsbell.com/findcoupon.php?store=hp" rel="nofollow">http://www.dealsbell.com/findcoupon.php?store=hp</a> ) this link i am getting images.</p>
<p>Each particular subcategory will have a same image. So i want to do something like that the image if first time loaded from the URL then it will display image from parsing otherwise i would like to store that <strong>image as its byte code</strong> in folder / file / in any way in my device on first parsing.</p>
<p>If once the image is stored to the particular way in my device next time when i will go to see the subcategory it will first check this image is stored locally to my device or not.</p>
<p>If yes then it should go to the particular location to fetch this local image & display it to each cell otherwise will parse & display image.</p>
<p>I hope you are getting, what i want to ask.</p>
<p>Please guide me, how can this be possible & what is the way to get result.</p>
<p>If any example or link you can suggest, then it will be more efficient to me.</p>
<p>Thanks in advance.</p>
| iphone | [8] |
2,101,430 | 2,101,431 | Multiple distribution provisioning profile allowed? | <p>What happen when you install multiple distribution provisioning profile on the same system? Can you still code sign your app?
I don't quite understand how the provisioning profile works, can someone explain?</p>
| iphone | [8] |
1,546,094 | 1,546,095 | Refactoring for each statement | <p>Hi I have written a function that is used to change text in a table cell, the table displays members of a team but is not in a readable format, so i have to convert the string output into a readable format. </p>
<p>This all works fine however I was wondering if anyone could help me re-factor this function as it seems abit crude ? </p>
<p>Jquery Code:</p>
<pre><code>$(".membersName").each(function() {
var memberName = $(this).text();
var splitmemberName = memberName.split("=");
var finalNameSplit = splitmemberName[1].split(",");
$(this).empty();
$(this).append(finalNameSplit[0]);
});
</code></pre>
<p>Any help or tips would be greatly appreciated. Cheers in advance </p>
| jquery | [5] |
5,971,480 | 5,971,481 | No scrolling effect with ScrollView in PopupWindow | <p>I want to implement a popup menu with complex effects, one of them is to support scrolling. It seems PopupMenu and AlertDialog can not meet the requirement what I need. So I tried PopupWindow with ScrollView.</p>
<p>Firstly, I prepared a layout which has a simple strcture just like what ApiDemo shows:</p>
<pre><code>ScrollView
LinearLayout with Vertical attribute
TextView
TextView
TextView
...
</code></pre>
<p>Secondarily, I new a PopupWindow with this layout and 200width/300height, show it at somewhere with showAtLocation().</p>
<p>I can make scrollbar displayed and has scroll effect, but TextViews in LinearLayout do NOT scroll(they are in fixed position)!</p>
<p>Something is wrong but I have no sense on it.
(android3.0)</p>
<p>Thanks for any warm-heart man who can give me some tips.</p>
<p>-_-!!</p>
| android | [4] |
3,965,263 | 3,965,264 | Javascript - object key->value | <pre><code>var obj = {
a: "A",
b: "B",
c: "C"
}
console.log(obj.a); // return string : A
</code></pre>
<p>but i want to get by through a variable like this</p>
<pre><code>var name = "a";
console.log(obj.name) // but return undefined
</code></pre>
<p>How to do this?</p>
| javascript | [3] |
4,144,972 | 4,144,973 | Do I need the "Android unlocked dev phone" to test my android projects? | <p>I bought an Android phone to use Flash. But to my surprise, Flash does not run on Android devices with arm v6. But I do want to make something useful and develop for it. Does it need to be "unlocked" for this purpose?</p>
| android | [4] |
1,985,633 | 1,985,634 | Sorting a particular column of datatable of string type that contains numeric data | <p>I have a datatable (.Net) with multiple columns. One of the columns say RollNo is of string type but contains numeric data. Eg. <strong>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14</strong>. I am trying to sort using the following:</p>
<pre><code>string sql =
"Select StudentID, RollNo, AdmissionID,(FirstName + Space(1) + Isnull(MiddleName,'') + Space(1) + Isnull(LastName,'')) as Name," +
" PermState as State from Students where ClassId = '" + ddlClass.SelectedValue + "'" +
" order by RollNo";
DataTable dt = bl.GetDataSet(sql);
dt.DefaultView.Sort = "RollNo";
</code></pre>
<p>But after sorting I get the result as <strong>1, 10, 11, 12, 13, 14, 2, 3, 4, 5, 6, 7, 8, 9.</strong></p>
<p>How to solve it? </p>
| c# | [0] |
5,577,657 | 5,577,658 | Android onDestroy callback | <p>I have activity one that calls activity 2
When user close activitie 2 and gets back to activity 1 i want to do some proccess only when activity 2 onDestroy is finished</p>
<p>I thouht to pass some interface to do a callback from the end of onDestroy</p>
<p>Not sure what is the best way to do it</p>
<p>Any suggestions?</p>
| android | [4] |
2,962,142 | 2,962,143 | Null reference exception | <p>I have a function like this</p>
<pre><code>public bool CheckMentorAccess()
{
bool blnAllow = false;
try
{
string strSelectMentorQuery = "SELECT COUNT(DISTINCT MLL.LED_ID) FROM M_USER_DETAILS MUD INNER JOIN M_LEADERLED MLL " + "ON MLL.LED_ID = MUD.PK_ID WHERE MLL.LEADER_ID = '" + Session["UserID"].ToString() + "' AND MUD.ACTIVE = 1 AND MLL.START_DATE <= Getdate() AND" + " MLL.END_DATE > Getdate()";
int intNoOfMembers = Convert.ToInt32(cSQLHelper.myExecuteScalar(strSelectMentorQuery));
if (intNoOfMembers > 0)
{
blnAllow = true;
}
}
catch (Exception ex)
{
ExceptionLogger.LogException(ex);
blnAllow = false;
}
// Return the value
return blnAllow;
}
</code></pre>
<p>And then I use if like this </p>
<pre><code>if ((Int32.Parse(Session["ROLE_ID"].ToString()) == 3) && (CheckMentorAccess() == true))
{
cmbempList.Visible = true;
}
</code></pre>
<p>but it is throwing a null reference exception on the first line of the sample above</p>
<p>Can anyone help me out..</p>
| asp.net | [9] |
2,903,420 | 2,903,421 | Python google search explicit phrase | <p>I am trying to define a google search with the AJAX interface using the very good function described here (A Martelli)
<a href="http://stackoverflow.com/questions/1657570/google-search-from-a-python-app">Google Search from a Python App</a></p>
<pre><code>........
query = urllib.urlencode({'q': searchfor})
....
</code></pre>
<p>If I define the variable <code>searchfor = "big car"</code>, the query generated is big+car. However I want to generate the query "big car" (those two words ocurring together).</p>
<p>Q1) That is, I would like to define an explicit phrase in my query (in google I would enter the "phrase" within double quotes). </p>
<p>Q2) How can I define a query where I wxclude a certain term. (In google you enter the "-" sign).</p>
| python | [7] |
5,491,919 | 5,491,920 | Base class destructor is not virtual and child class destructor is virtual, program crash | <p>Why does following program crash, I have <code>base</code> class whose destructor is not virtual but <code>child</code> class destructor is <code>virtual</code></p>
<pre><code>#include <iostream>
class Base {
public:
Base() {
std::cout << "Base::Base CTOR " << std::endl;
}
~Base() {
std::cout << "Base::Base DTOR " << std::endl;
}
private:
protected:
};
class Child : public Base {
public:
Child(){
std::cout << "Child::Child CTOR " << std::endl;
}
virtual ~Child(){
std::cout << "Child::Child DTOR " << std::endl;
}
private:
protected:
};
int main ( int argc, char **argv) {
Base *ptr = new Child;
delete ptr;
}
</code></pre>
| c++ | [6] |
5,632,918 | 5,632,919 | What does "DataView is not marked as serializable in System.data" mean? | <p>When I store dataview in viewstate,.net shows the error "Dataview is not marked as serializable in system.data but when I store it in session, then it works perfectly?
What is the reason behind it?? Which are the other objects that are not marked as
"serializable " ?</p>
| asp.net | [9] |
5,802,079 | 5,802,080 | How to flush the input stream in python? | <p>I'm writing a simple alarm utility in Python.</p>
<pre><code>#!/usr/bin/python
import time
import subprocess
import sys
alarm1 = int(raw_input("How many minutes (alarm1)? "))
while (1):
time.sleep(60*alarm1)
print "Alarm1"
sys.stdout.flush()
doit = raw_input("Continue (Y/N)?[Y]: ")
print "Input",doit
if doit == 'N' or doit=='n':
print "Exiting....."
break
</code></pre>
<p>I want to flush or discard all the key strokes that were entered while the script was sleeping and only accept the key strokes after the raw_input() is executed. </p>
<p>EDIT: I'm running this on windows xp.</p>
| python | [7] |
3,124,110 | 3,124,111 | purpose of interface in classes | <p>what is the purpose of interface when writing a class?</p>
<p>heres an example i've seen online.</p>
<pre><code><?php
interface Chargeable {
public function getPrice();
}
class Employee implements Chargeable {
protected $price;
public function getPrice() {
return $this->price;
}
}
$product = new Employee();
?>
</code></pre>
| php | [2] |
3,674,365 | 3,674,366 | Why is appended radio button is not clickable? | <p>I have done a small mistake in my code that is not allowing me to click on the appended radio button. </p>
<pre><code>var ToBeRadio=NoneElementsArray[i]*1-1;
$(this).children('td:eq('+ToBeRadio+')').find('input:checkbox').hide();
$(this).children('td:eq('+ToBeRadio+')').append("<input type='radio'>");
</code></pre>
<p>Where's the error?</p>
| jquery | [5] |
1,256,768 | 1,256,769 | Difference dynamic static 2d array c++ | <p>Im using opensource library called wxFreeChart to draw some XY charts. In example there is code which uses static array as a serie :</p>
<pre><code>double data1[][2] = {
{ 10, 20, },
{ 13, 16, },
{ 7, 30, },
{ 15, 34, },
{ 25, 4, },
};
dataset->AddSerie((double *) data1, WXSIZEOF(dynamicArray));
</code></pre>
<p>WXSIZEOF ismacro defined like: sizeof(array)/sizeof(array[0]) </p>
<p>In this case everything works great but in my program Im using dynamic arrays (according to users input).</p>
<p>I made a test and wrotecode like below:</p>
<pre><code>double **dynamicArray = NULL;
dynamicArray = new double *[5] ;
for( int i = 0 ; i < 5 ; i++ )
dynamicArray[i] = new double[2];
dynamicArray [0][0] = 10;
dynamicArray [0][1] = 20;
dynamicArray [1][0] = 13;
dynamicArray [1][1] = 16;
dynamicArray [2][0] = 7;
dynamicArray [2][1] = 30;
dynamicArray [3][0] = 15;
dynamicArray [3][1] = 34;
dynamicArray [4][0] = 25;
dynamicArray [4][1] = 4;
dataset->AddSerie((double *) *dynamicArray, WXSIZEOF(dynamicArray));
</code></pre>
<p>But it doesnt work correctly. I mean point arent drawn. I wonder if there is any possibility that I can "cheat" that method and give it dynamic array in way it understands it and will read data from correct place</p>
<p>thanks for help </p>
| c++ | [6] |
5,131,641 | 5,131,642 | Server to Server > Retrieve and extract a remote zip file to local server directory | <p>I have a wp plugin file on server B who's purpose is to retrieve a zip file from a remote server A. </p>
<p>Once Server B receives the zip file, it should extract the contents and copy the files into a specific folder on server B overwriting any existing files.</p>
<p>I have some code below that I've borrowed from a file that uses and uploader to do the same thing and I'd just like to redo it for the automated server to server procedure described above. But I'm getting a fatal error when trying to Activate this plugin.</p>
<pre><code>function remote_init()
{
openZip('http://myserver.com/upgrade.zip');
$target = ABSPATH.'wp-content/themes/mytheme/';
}
function openZip($file_to_open, $debug = false) {
global $target;
$file = realpath('/tmp/'.md5($file_to_open).'.zip');
</code></pre>
<p>//$file is always empty. can't use realpath in this case. What to do?</p>
<pre><code> $client = curl_init($file_to_open);
curl_setopt(CURLOPT_RETURNTRANSFER, 1);
$fileData = curl_exec($client);
file_put_contents($file, $fileData);
$zip = new ZipArchive();
$x = $zip->open($file);
if($x === true) {
$zip->extractTo($target);
$zip->close();
unlink($file);
} else {
if($debug !== true) {
unlink($file);
}
die("There was a problem. Please try again!");
}
}
add_action( 'init','remote_init');
</code></pre>
| php | [2] |
4,076,609 | 4,076,610 | .NET Console Applications, possible to create labels and regions? | <p>Is it possible to have a C# console application output text to labels already drawn?
I've seen some native win 32 console apps that can do this. </p>
<p>So onscreen the user sees:</p>
<p>Progress: 1% or Progress: 50% depending on when the label is updated (and the label progress stays in the same place, while only the value of the progress percentage gets updated. </p>
<p>Rather than the only way I know how to do it currently which is console.writeLine which would produce a seperate line for each Progress update. </p>
<p>EG:</p>
<p>Progress: 1%</p>
<p>Progress: 2%</p>
| c# | [0] |
3,894,358 | 3,894,359 | if else-if making code look ugly any cleaner solution? | <p>I have around 20 functions (is_func1, is_fucn2, is_func3...) returning boolean</p>
<p>I assume there is only one function which returns true and I want that!</p>
<p>I am doing:</p>
<pre><code>if is_func1(param1, param2):
# I pass 1 to following
abc(1) # I pass 1
some_list.append(1)
elif is_func2(param1, param2):
# I pass 2 to following
abc(2) # I pass 1
some_list.append(2)
...
.
.
elif is_func20(param1, param2):
...
</code></pre>
<p>Please note: param1 and param2 are different for each, abc and some_list take parameters depending on the function.</p>
<p>The code looks big and there is repetition in calling abc and some_list, I can pull this login in a function! but is there any other cleaner solution?</p>
<p>I can think of putting functions in a data structure and loop to call them.</p>
| python | [7] |
1,766,976 | 1,766,977 | C# - Open a file with the associated program without invoking the command line | <p>Is it possible to open a file with the default program without invoking the command line? I want to run a unit test and have the unit test open the file (PDF) at completion for visual inspection.</p>
| c# | [0] |
4,775,477 | 4,775,478 | Why does a python descriptor __get__ method accept the owner class as an arg? | <p>Why does the <code>__get__</code> method in a <a href="http://docs.python.org/reference/datamodel.html#implementing-descriptors">python descriptor</a> accept the owner class as it's third argument? Can you give an example of it's use?</p>
<p>The first argument (<code>self</code>) is self evident, the second (<code>instances</code>) makes sense in the context of the typically shown descriptor pattern (ex to follow), but I've never really seen the third (<code>owner</code>) used. Can someone explain what the use case is for it?</p>
<p>Just by way of reference and facilitating answers this is the typical use of descriptors I've seen:</p>
<pre><code>class Container(object):
class ExampleDescriptor(object):
def __get__(self, instance, owner):
return instance._name
def __set__(self, instance, value):
instance._name = value
managed_attr = ExampleDescriptor()
</code></pre>
<p>Given that <code>instance.__class__</code> is available all I can think of is that explicitly passing the class has something to do with directly accessing the descriptor from the class instead of an instances (ex <code>Container.managed_attr</code>). Even so I'm not clear on what one would do in <code>__get__</code> in this situation.</p>
| python | [7] |
1,176,702 | 1,176,703 | What IPhone OS do you build for when releasing? | <p>There are currently 3 options. 2.0, 2.1,2.2. My app only needs 2.0. Do I build for 2.0 or 2.2? What is the best option?</p>
| iphone | [8] |
5,563,976 | 5,563,977 | How can I check a parameter matches a value in my enum in C#? | <p>I have this enum:</p>
<pre><code>public enum ContentKey {
Menu = 0,
Article = 1,
FavoritesList = 2
};
</code></pre>
<p>This action method:</p>
<pre><code>public ActionResult Edit(string pk, string rk, int row = 0) {
try {
var content = _contentService.Get(pk, rk);
</code></pre>
<p>The following class <code>Content</code> which is based on the <code>TableServiceEntity</code>. Note that <code>TableServiceEntity</code> is common to all my data classes. </p>
<pre><code>public class Content : TableServiceEntity
{
public abstract class TableServiceEntity
{
protected TableServiceEntity();
protected TableServiceEntity(string partitionKey, string rowKey);
public virtual string PartitionKey { get; set; }
</code></pre>
<p>Is there a way I can check the value of <code>pk</code> matches one of the enum values? What I am not sure about is how I can check this. I assume I need to have the check in the <code>Content</code> class but I am not sure how to override the <code>virtual string</code> and throw an exception when there's no match.</p>
<p><strong>Update</strong>: If possible I would like to do this in the Content class get set but I am not sure how to add a get set to this class.</p>
| c# | [0] |
4,167,946 | 4,167,947 | EditText borders SDK >11 | <p>I've an activity with few EditTexts, it shows the underlying borders until no background is set. When I set a background for the whole LinearLayout, the EditText's highlighting gray borders go away. Only blue highlights appear when focussed.</p>
<p>How do I get those gray borders like in the screenshot below:
<img src="http://i.stack.imgur.com/IkroB.jpg" alt="enter image description here"></p>
| android | [4] |
611,121 | 611,122 | C# code for Search button | <p>I have a (Sql Server 2008) table called Courses with course_id,course_name and course_description as its fields
In the front end, I have a text box and a search button. In the text box, when I give a course name (even a part of it)..in the button click event, all the course names should show up.</p>
<p>How do I code this in C#? Any help would be appreciated..</p>
| c# | [0] |
3,803,130 | 3,803,131 | edit text with accent issue | <p>I'm writing an android application and I have issue with edit text.
When the user adds text with accent (sp: "Nous sommes en été");
The string isn't correct. It convert my accent symbole to utf-8 I guess.
How can I deal with it ? </p>
<p>ps: my application is a french app and I really need to use accent.</p>
<p>MY CODE : </p>
<pre><code>String description = ((EditText) findViewById(id.description)).getText().toString();
Log.i("UTF8",description.toString());
description = description.replace("\n", "");
Log.i("UTF8",description.toString());
</code></pre>
| android | [4] |
2,081,634 | 2,081,635 | Is it possible to wait for a file to be created to continue in c# asp.net | <p>im currently working on a report builder for the buisness I work for. </p>
<p>I have a little problem with the big files generation.
The code just ignores it when crystal reports and CSLA has been working for too long. I changed settings in iis and it didnt changed anything. </p>
<p>Now i wish to know if there is a way to stop the code until the file i create is present. </p>
<p>I hope my uestion is clear. (My english is not as good as it should be ).</p>
| c# | [0] |
330,892 | 330,893 | jQuery .wrap() isn't working | <p>I'm probably doing something wrong but I've tried all sorts of things and can't seem to get a collection of jQuery objects wrapped. The following just outputs the link HTML, unwrapped. Any ideas?</p>
<pre><code>$.each(sitemapSections, function(i) {
var $sitemapSection = $(sitemapSections[i]);
var $primary = $sitemapSection.find('a[data-level="1"]').wrap('<h3></h3>');
$dropdownSections[i].html($primary);
});
</code></pre>
<p>EDIT - here's the markup (cleaned up):</p>
<pre><code><li id="product-solutions"><a href="#link" class="alpha grid-6">Products &amp; Solutions</a>
<div id="ps-dropdown" class="dropdown-menu grid-20">
<div class="ps-dropdown-section">
</div><!-- .ps-dropdown-section -->
<div class="ps-dropdown-section">
</div><!-- .ps-dropdown-section -->
<div class="ps-dropdown-section">
</div><!-- .ps-dropdown-section -->
</div><!-- .dropdown-menu -->
</li>
</code></pre>
<p>UPDATE - I got it! The comments who mentioned parent() is what I was missing. Here's the final code:</p>
<pre><code>$.each(sitemapSections, function(i) {
var $sitemapSection = $(sitemapSections[i]);
var $primary = $sitemapSection.find('a[data-level="1"]').wrap('<h3></h3>').parent();
$dropdownSections[i].html($primary);
});
</code></pre>
| jquery | [5] |
932,697 | 932,698 | Debug Macro for code block | <p>I am trying to create a macro that executes blocks of code only if it's a debug build. I've managed to make one that executes one line only if debug is enabled, but i cannot figure out how to do a whole block of code.</p>
<p>the one line macro is below:</p>
<pre><code>#include <iostream>
//error checking
#if defined(DEBUG) | defined(_DEBUG)
#ifndef DBG_ONLY
#define DBG_ONLY(x) (x)
#endif
#else
#ifndef DBG_ONLY
#define DBG_ONLY(x)
#endif
#endif
int main () {
DBG_ONLY(std::cout << "yar" << std::endl);
return 0;
}
</code></pre>
| c++ | [6] |
2,803,875 | 2,803,876 | How to check for {} value in JavaScript? | <p>For some reason in the code below the currentRow.cells returns {}. How can I check for that? I do not want to execute lines if the currentRow.cells returns {}. </p>
<pre><code> currentRow = document.createElement("TR");
if(currentRow.cells.length > 0) { .. do something }
</code></pre>
<p>UPDATE 1: </p>
<p>All I want is to check for empty object. if the currentRow.cells is an empty object then do nothing. </p>
| javascript | [3] |
3,402,899 | 3,402,900 | Autopostback textbox not retaining the values across postbacks with nested form tags | <p>Here the textbox with id as "a" retains the value after postbacks while textbox with id as "b" not retains the value.Why this happens? </p>
<pre><code><form id="form1" runat="server">
<div>
<asp:TextBox ID="a" runat="server" AutoPostBack="true" ></asp:TextBox>
<form action="javascript:myFunc();">
<p>
<input type="text" id="city-field" name="city" " />
<input type="submit" value="Find" /></p>
</form>
</div>
<asp:TextBox ID="b" runat="server" AutoPostBack="true" ></asp:TextBox>
</form>
</code></pre>
| asp.net | [9] |
4,669,693 | 4,669,694 | How Google Docs hook the Ctrl-F hotkey? | <p>In google docs, if you press Ctrl+F, the browser will not pop up the "Find" dlg, but the google docs will get this event, how to make it technology?</p>
| javascript | [3] |
3,357,195 | 3,357,196 | Web Deployment | <p>We had an asp.net 1.1 application that we recently migrated to 3.5. We are facing some problems when we do code modification on the migrated application. Here is what is happening</p>
<ol>
<li>In the asp.net 1.1 application we have the page directive codebehind="ePC.aspx.cs". This migrated fine.</li>
<li>We made some code changes to the .cs file. Say for example, we added a button and added the event handler to the button.</li>
<li>This new functionality was not getting executed properly.</li>
<li>We changed the codebehind directive to codefile directive</li>
<li>Now it is working fine. But during deployment, it asks that the .cs file also be deployed along with the aspx page. We are not sure why this is happening.</li>
</ol>
<p>I have attached an example page directive</p>
<p>In VisualStudio with CodeFile</p>
<pre><code><%@ Page language="c#" Codefile="ePC.aspx.cs" AutoEventWireup="True" Inherits="SPUniversal.Web.ePC" %>
</code></pre>
<p>After publishing the website</p>
<pre><code><%@ page language="c#" autoeventwireup="True" inherits="SPUniversal.Web.ePC, App_Web_eu_mdesx" %>
</code></pre>
<p>The *App_Web_eu_mdesx* got generated automatically in the published website. I don't understand what is going on here. Can you explain?</p>
| asp.net | [9] |
4,688,942 | 4,688,943 | Need help finding bug in this if statement | <p>Disclaimer: this is a (frustrating) homework related problem.</p>
<p>I'm having odd results when I draw my objects on screen. I want this...I draw first object then draw second object when I select third object to draw the screen clears and I have to start the process again....what i get is...I draw first object, I draw second object, I go to draw third object screen clears...I select third object but SECOND object is what appears on screen. Please help point me in right direction.</p>
<pre><code>package ui.panels;
import java.awt.Choice;
import java.awt.Panel;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import model.Model;
import interfaces.Resettable;
public class ChoicePanel extends Panel implements Resettable{
public int i = 0;
/**
*
*/
private static final long serialVersionUID = 1L;
Model model;
Choice selection;
public ChoicePanel(Model mdl) {
model = mdl;
selection = new Choice();
for (String msg : Model.selections) {
selection.add(msg);
}
selection.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(i==1) {//drop down clicked three times)
System.out.println("ChoicePanel says i == "+i);
model.setMessage(selection.getSelectedItem());
model.setCurrentShapeType(selection.getSelectedItem());
//model.repaint();
++i;
}else if(i==2){
System.out.println("ChoicePanel says i == "+i);
model.setMessage(selection.getSelectedItem());
//model.setCurrentShapeType(selection.getSelectedItem());
model.resetComponents();
//--i;
}else{
model.setMessage(selection.getSelectedItem());
//this line is what sends a value to shape that is drawn on screen
model.setCurrentShapeType(selection.getSelectedItem());
//model.repaint();
++i;
}
}
});
this.add(selection);
}
public void resetComponents() {
System.out.println("resetComponents from ChoicePanel");
//this resets the drop down list selection array to the first choice on the list
selection.select(0);
//this sets selected item in the selection array set in the above line
//model.setMessage(selection.getSelectedItem());
i=0;
model.repaint();
}
}
</code></pre>
| java | [1] |
331,263 | 331,264 | asp.net connection open and close | <p>Let say i have one asp.net application that is having some page that uses the connection continuesly.....</p>
<p>i have open the connection in class file in construscter ......</p>
<p>and i m accessing it using the object of the class....when ever database operation are required...</p>
<p>in start the application is running fine....but after some operation with database in datagrid(ex. sorting,paging,other).... it's gets slow...and again start working after some time....</p>
<p>do you guys have any solution or any suggession for that.....</p>
<p>i have used the connection in following way....</p>
<pre><code>public class student_operation
{
public SqlConnection cn = new SqlConnection();
public SqlCommand cmd = new SqlCommand();
public SqlDataAdapter ad = new SqlDataAdapter();
public DataSet rs = new DataSet();
public DataSet rs1 = new DataSet();
public student_operation()
{
//
// TODO: Add constructor logic here
//
try
{
cn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myconnection"].ConnectionString);
cn.Open();
}
catch (Exception)
{
if (cn.State != ConnectionState.Closed)
{
cn.Close();
cn.Open();
}
}
}
}
</code></pre>
| asp.net | [9] |
2,369,522 | 2,369,523 | UItableview header flicker when we reuse the cell Identifier | <p>I have created cell as</p>
<p>static NSString *CellIdentifier = @"TweetListUserName";</p>
<p>CustomTableViewCell *cell = (CustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[CustomTableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier]autorelease] ;
}</p>
<p>and for header I wrote </p>
<ul>
<li><p>(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {</p>
<pre><code>UIView* customView = [[[UIView alloc] initWithFrame:CGRectMake(0.0, -4.0, 320.0, 67.0)]autorelease];
[customView setOpaque:YES];
UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(-2.0, -4.0, 328.0, 67.0)];
[image setImage:[UIImage imageNamed:@"header-msg.png"]];
[image setOpaque:YES];
[customView addSubview:image];
UILabel *label1 =[[UILabel alloc] initWithFrame:CGRectMake(10, 5, 100, 12)];
label1.text =@"TWEETS MATCHING:";
label1.textAlignment=UITextAlignmentLeft;
[label1 setTextColor:[UIColor grayColor]];
[label1 setFont:[UIFont fontWithName:@"Helvetica" size:9]];;
[label1 setBackgroundColor:[UIColor clearColor]];
[customView addSubview:label1];
[label1 release];
UILabel *label2 =[[UILabel alloc] initWithFrame:CGRectMake(10, 6, 315, 50)];
label2.text =usernametag;
label2.textAlignment=UITextAlignmentLeft;
[label2 setTextColor:[UIColor blackColor]];
[label2 setFont:[UIFont fontWithName:@"Helvetica-Bold" size:20]];
[label2 setBackgroundColor:[UIColor clearColor]];
[customView addSubview:label2];
[label2 release];
return customView;
</code></pre>
<p>}</p></li>
</ul>
<p>But when I scroll the table fast the header flicker in almost all cases?</p>
<p>How to resolve this case </p>
| iphone | [8] |
5,496,685 | 5,496,686 | refering the app after each time it closes | <p>I am have an app in which I draw shape. When I close and open the application the drawn shapes remains. I want to know is there any way I could clear the contents on each launch.</p>
<p>Thanks</p>
| iphone | [8] |
4,300,683 | 4,300,684 | java socket can't send message using BufferedWriter | <p>I am trying to use <code>BufferedWriter</code> to send a message to the server from the client or server to client. However nothing will send, but it will listen if you send a message to it. I am not sure what I am doing wrong but I think the problem is from here.</p>
<pre><code>ActionListener buttonActive= new ActionListener(){
public void actionPerformed(ActionEvent e) {
messageTextArea.append(textMessage.getText()+ "\n");
sendText = textMessage.getText();
}
};
sendButton.addActionListener(buttonActive);
private void startSending(){
SwingWorker <Void, Void> sendingThread = new SwingWorker <Void, Void>(){
protected Void doInBackground() throws Exception {
BufferedWriter writer = null;
writer = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
while(connected){
writer.write(sendText);
writer.flush();
}
return null;
}
};
sendingThread.execute();
}
</code></pre>
<p>@trashgod and @madProgrammer gave me a solution using printWriter which works but I want me to make a few more version using <code>BufferedWriter</code>+<code>BufferedReader</code>, <code>OutputStream+ InputStream</code> and <code>BufferedWriter</code>+<code>PrintWriter</code>, however i want to make the <code>BufferedWriter</code>+<code>BufferedReader</code>.</p>
| java | [1] |
791,752 | 791,753 | How to extract "sub-domain name" from a url presence in a long text containing multiple url | <p>I have a long long text contains multiple url. <strong>BUT</strong> there is <strong>only one</strong> url which is of blogspot.com . That url will be like <a href="http://xxxxx.blogspot.com" rel="nofollow">http://xxxxx.blogspot.com</a> . How could i get the value of xxxx and store in a variable.</p>
<p>So if I have the whole text store in <strong>$foo</strong>. Can any one write the code to extract the subdomain out. </p>
<p>I guess it should be of only 1 or 2 line using <strong>preg_match</strong> . But i'am not getting it to work. Rejex are confusing me.</p>
<p>Thank you</p>
| php | [2] |
5,953,945 | 5,953,946 | Learning / Revising Java | <p>So I'm learning Java and I was hoping to get a little help on how to perfect / enhance a small app I made to calculate the area of a triangle.</p>
<pre><code>import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("What's the base?");
int base = in.nextInt();
System.out.println();
System.out.println("What's the height?");
int height = in.nextInt();
System.out.println();
int area = base * height / 2;
System.out.println("The area of the triangle is: " +area+ ".");
}
}
</code></pre>
<p>Mind you, I am BRAND NEW to programming in Java, or any language for that matter. If you wouldn't mind, can you explain in the utmost detail on how I can perfect this / make it an easier process?</p>
<p>Thanks a lot!</p>
| java | [1] |
187,591 | 187,592 | Create an instance using a subset of properties from another instance in a type safe manner? | <p>I have a data source to which I wan't to bind a collection of X's. X should contain a subset of a certain type Y's properties (let's say Y has properties PropOne, PropTwo, PropThree)
This can of course be done with an anonymous type:</p>
<pre><code>void DoBind()
{
myGrid.DataSource = myCollectionOfYs.Select(y => new {y.PropOne, y.PropTwo});
}
</code></pre>
<p>How can I modify this method so that the caller of it can specify which properties to use in the projection in a type safe way? I.e. something along the lines:</p>
<pre><code>var expressions = new List<Expression<Func<Y, object>>>();
expressions.Add(y => y.PropOne);
expressions.Add(y => y.PropTwo);
DoBind(expressions);
</code></pre>
| c# | [0] |
487,633 | 487,634 | ASP.NET FileUpload: how to automatically post back once a file is selected? | <p>I am working on a ASP.NET app and i have a need to post back to the server after a file is chosen in a FileUpload control without having to have the user explicitly click a 'submit' button. Is this possible? and if so, how?</p>
| asp.net | [9] |
1,490,263 | 1,490,264 | PHP retrieve external program data | <p>what I want to do is have a PHP script run a program and have it retrieve data somehow from it. For instance the program would parse data from a file and return the data for the PHP script to display.</p>
<p>So far I know to call <code>exec("Program.exe");</code> but would I have to make it create a file with the data then have the PHP script call fopen and get it that way? Is there a better way to do it? Thanks</p>
| php | [2] |
4,515,932 | 4,515,933 | 'live' responses on time consuming php scripts? | <p>Many times i run time consuming PHP scripts that echo status updates like 'batch 1 finished', 'batch 2 finished' etc. </p>
<p>i've noticed that sometimes the server responds in a 'live' manner and you can see these status updates as the 'jobs' finish, printed on the browser.</p>
<p>But in other times you have to wait for the script to end, and the browser displays all the status updates at once.</p>
<p>When does the first happen? Is it the browser? Is it PHP setup? The way the script is coded? </p>
| php | [2] |
5,993,243 | 5,993,244 | No-Parameter Constructor v/s Constructor with params | <p>which one of below is better or to be prefered</p>
<pre><code>new Object();
Object.setValue1("1");
Object.setValue2("2");
Object.setValue3("3");
</code></pre>
<p>or </p>
<pre><code>new Object("1","2","3");
</code></pre>
| java | [1] |
4,269,582 | 4,269,583 | Is it good style to hide shared_ptr behind a typedef? | <p>I'd like to reduce some visual noise in the code and hide <code>shared_ptr</code> behind a typedef like this:</p>
<pre><code>typedef boost::shared_ptr<SomeLongClass> SomeLongClassPtr;
</code></pre>
<p>So this:</p>
<pre><code>void foo(const boost::shared_ptr<SomeLongClass>& a,
boost::shared_ptr<SomeLongClass>& b);
</code></pre>
<p>becomes this:</p>
<pre><code>void foo(const SomeLongClassPtr& a, SomeLongClassPtr& b);
</code></pre>
<p>On the other hand I'm worried that I'm reducing the explicitness of the code.</p>
<p>Which is a better style?</p>
| c++ | [6] |
4,775,511 | 4,775,512 | ClassNotFoundException after package renaming | <p>hy!</p>
<p>Exception:</p>
<pre><code>10-05 15:36:36.609: ERROR/AndroidRuntime(237): Caused by: java.lang.ClassNotFoundException: com.korn.gpv.Main in loader dalvik.system.PathClassLoader@44e836b8
</code></pre>
<p>after changing the package name.</p>
<p>Please help </p>
<p>new package: com.android.korn.gpv</p>
| android | [4] |
4,567,328 | 4,567,329 | Update application which is already in google play | <p>I can't find this information and I already start my journey with android. I have a question to you. If I create application and add to google play, can I upgrade this same application after some time. For example. I add application to google play and after 1 month I want to add the same application with some new functions. This is possible?</p>
| android | [4] |
1,860,314 | 1,860,315 | how to add element within an element in html | <p>i need to add a element div and within that div i need to add a label element how to do that.....??</p>
<pre><code>var dd=document.getElementById("sample");
var d=document.createElement("div");
d.id="s";
d.innerHTML="welcome"
dd.appendChild(d);
var e=document.createElement("label");
e.innerHTML="success";
var f=dd.getElementById("div");
f.appendChild(e);
</code></pre>
<p>i have a div element sample in html..<code><div id="sample"></div></code> within that div element i add another div element with id "s" then i need to a label within the div id="s" how to do that????????</p>
| javascript | [3] |
5,845,614 | 5,845,615 | How to update the progress bar in runtime using c# | <p>I am using the below code to update my progress bar.</p>
<pre><code> ProgressBar.Visible = true;
ProgressBar.Minimum = 1;
ProgressBar.Maximum = PortCount;
ProgressBar.Value = 1;
ProgressBar.Step = 1;
int intdata = 5;
for (int x = 1; x <= intdata; x++)
{
ProgressBar.PerformStep();
}
MessageBox.Show("Done");
</code></pre>
<p>But, it is not getting updated during runtime. Is it because the progress bar is in the same thread. If so, how to update this progress from another thread. Help...</p>
| c# | [0] |
2,587,832 | 2,587,833 | Warning: date() expects parameter 2 to be long | <p>Getting the following error:</p>
<blockquote>
<p>Warning: date() expects parameter 2 to be long, string given in /home/15063/brooks/www.brooks-shopping.co.uk/public_html/wp-content/themes/sandbox/functions.php
on line 546</p>
</blockquote>
<p>Which points to the line:</p>
<pre><code>$day = date("l, F jS", get_post_meta($post->ID, 'date_value', true));
</code></pre>
<p>Can someone suggest, what changes are required to the above line to resolve this please?</p>
| php | [2] |
5,769,114 | 5,769,115 | What is @ in an object property? | <p>I have the following object:</p>
<pre><code>[Suppliers] => stdClass Object
(
[@size] => 1
[name] => Supplier Name
[Supplier] => stdClass Object
(
[@chainCode] => EP
[@id] => 13
)
)
</code></pre>
<p>I know how to get the <code>name</code> property and display it, but I don't know how to get the properties that start with an '@' sign ... What is it and how can I get its value?</p>
| php | [2] |
3,310,551 | 3,310,552 | how to dynamically declare an array of objects with a constructor in c++ | <p>I was wondering if it was possible to create an array of objects when the object needs things passed into it for the constructor. I want something like this:</p>
<pre><code>MyClass *myVar;
myVar = new MyClass[num]; // I would like to specify the array size after declaration
int i = 0;
for(i = 0;i < num;i++)
myVar[i] = new MyClass(0,0); // I would also like to populate the array with new objects
</code></pre>
<p>I know that this works:</p>
<pre><code>MyClass *myVar;
myVar = new MyClass[num];
</code></pre>
<p>but this only works when the constructor has nothing passed into it. Is what I am trying to do possible? If so, how do I do it?</p>
<p>EDIT: I found out how to do it with using arrays. Here is how I did it:</p>
<pre><code>MyClass **myVar;
myVar = new MyClass *[num];
for(i = 0;i < num;i++)
myVar[0] = new MyClass(0,0);
</code></pre>
<p>I would use vectors and such but my teacher has told us to use basic arrays whenever possible. The above solution I actually got from some code my teacher wrote. Thank you all for your help!</p>
| c++ | [6] |
4,052,843 | 4,052,844 | how can i update my dynamic ip with curl php | <p>i have registered a domain and now i want to host it on my own home server ...</p>
<p>i want to setup a system with php curl so that i login to my domain website and update my name servers i.e</p>
<p><a href="http://mycompany.com/webhosting/domain/manage.php?action=showNS&domain_id=10003489" rel="nofollow">http://mycompany.com/webhosting/domain/manage.php?action=showNS&domain_id=10003489</a></p>
<p>i want to login to that site and auto update my dynamic ip address...</p>
| php | [2] |
2,208,538 | 2,208,539 | Is it possible to skip one activity in startActivityForResult? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1580558/how-do-you-skip-parts-of-an-activity-stack-when-returning-results-in-android">How do you skip parts of an Activity stack when returning results in Android?</a> </p>
</blockquote>
<p>I have the following activity stack A->B->C.
A activity has a ui element which starts activity B.
B - is an activity which displays a list and starts activity C. In the activity C user selects some info which should be returned to activity A(B should be dismissed).
Is it possible to call startActivityForResult so that the result will be returned from Activity C to activity A?</p>
| android | [4] |
2,642,689 | 2,642,690 | My bit-wise swapping isn't working | <p>i am trying a simple insertion sort. But the swapping I am trying isn't working when I use bit-wise operation.</p>
<p>But when I use another temporary variable the swapping works. When I compile this code I always get some extra 0s. </p>
<p>Can you help me to figure out what is wrong with my code?</p>
<pre><code>#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<algorithm>
using namespace std;
void swap(int* a, int* b)
{
*a=*a^*b;
*b=*a^*b;
*a=*a^*b;
}
int main(void)
{
int arr[size];
int i,j,min;
for(i=0; i<size; i++)
arr[i]=rand()%100;
for(i=0; i<size; i++)
printf("%d ",arr[i]);
putchar('\n');
for(i=0; i<size;i++)
{
min=i;
for(j=i+1;j<size;j++)
if(arr[j]<arr[min])
min=j;
swap(&arr[i],&arr[min]);
}
for(i=0; i<size; i++)
printf("%d ",arr[i]);
putchar('\n');
return 0;
}
</code></pre>
| c++ | [6] |
923,633 | 923,634 | Getting Aperture from Android Camera in preview mode? | <p>I need to get the F-Stop from the Camera in preview mode to determine focus distance (the api function doesn't work at all). I have an algorithm to compute it but I need focal length and F-stop. I can get Focal Length fine, but I can't seem to get the Aperture. I know it is in the exif, does anyone know of how to get it through Camera.getParameters()?</p>
| android | [4] |
904,499 | 904,500 | help with my logic for building a query from inputs | <p>I have 4 input fields and its driving me crazy because i can't figure out when to dynamically add the AND condition</p>
<p>right now my raw query looks like this:</p>
<pre><code>SELECT *
FROM `staff`
" . $where . $location . "
" . $and_1 . $expertise . "
" . $and_2 . $education . "
" . $and_3 . $salary . "
ORDER BY
`created_on` DESC LIMIT " . $limit;
</code></pre>
<p>because I want to allow for blank fields to add less conditions to the query I have been trying to figure out the logic that would add <code>WHERE</code> and <code>AND</code> to each condition depending on the amount of conditions being requested.</p>
<p>My attemps:</p>
<pre><code>($location == '' ? $location = '' : $location = '`location` = "'.$location.'"');
($expertise == '' ? $expertise = '' : $expertise = '`expertise` = "' . $expertise . '"');
($education == '' ? $education = '' : $education = '`education` = "' . $education . '"');
($location != '' && ($expertise != '' || $education != '') ? $and_1 = 'AND ' : $and_1 = '');
($location != '' && ($and_1 != '') ? $and_2 = 'AND ' : $and_2 = '');
($and_1 != '' || $and_2 != '' && $salary != 'no preference' ? $salary : '');
($and_1 == '' || $and_2 == '' && $salary != 'no preference' ? '' : $salary);
</code></pre>
<p>I think I'm just getting lost in my own mental logic as I'm coding that I'm not even understanding my own code logic lol ;(</p>
| php | [2] |
870,885 | 870,886 | python deleting the start of the string if beginning with " " or "," | <p>I want to make a function check if a string starts with " " or "," and then delete those until it reaches a letter for example</p>
<p>I want to turn the string</p>
<pre><code>" , , abcd" into
"abcd"
or ",,,,, abcd" into
"abcd"
</code></pre>
| python | [7] |
2,757,496 | 2,757,497 | How do I extract a number from an HTML span using jQuery? | <p>Using jQuery, I would like to extract a number from a <code><span></code> and use it to calculate a new value.</p>
<pre><code><div class="post-100" data-postid="100">
<span class="score">3</span>
</div>
</code></pre>
<p>I've got the general Idea, but I can't figure out how to reference the existing span value:</p>
<pre><code>if (response.newvoteid == null)
{
$(".post-" + $(this).data("postid") + " .score").text(
parseInt( **EXISTING VALUE + 1 OR -1**));
}
</code></pre>
<p><strong>Update:</strong> I am now using the following which fails to calculate the new value, but simply adds a number to the text. For example, <code><span class="score">3</span></code> becomes <code><span class="score">31</span></code></p>
<pre><code>var number = $(".post-" + $(this).data("postId") + " .score").text();
$(".post-" + $(this).data("postId") + " .score").text(number + 1);
</code></pre>
| jquery | [5] |
1,218,546 | 1,218,547 | flatten array from single dimensional array | <p>hi my array is like this </p>
<pre><code>Array(['a1','aa1','1'],['a2','aa2','2'],['a3','aa3','3'],['a4','aa4','4'])
</code></pre>
<p>my required array</p>
<pre><code> Array(['a1','1'],['aa1',[1]],['a2','2'],['aa2','2'],['a3','3'],['aa3','3'],
['a4','4'],['aa4','4'])
</code></pre>
<p>my requirement is i'll get the array with the combination of 1 & 3,2 & 3 </p>
<p>please help me</p>
<p>Thank you</p>
| php | [2] |
935,122 | 935,123 | How do I create a "check all" link for a web form? | <p>I've got a form with a bunch of checkboxes on it, and I'd like to provide a "check all" link/button.</p>
<p>I'm using the code below, but when it runs, it picks up some radio buttons on the page, and checks/unchecks those too. How do I fix this?</p>
<pre><code>var check = 0;
function doNow()
{
void(d=document);
void(el=d.getElementsByTagName('INPUT'));
for(i=0;i<el.length;i++)
{
if(check == 0)
void(el[i].checked=1)
else
void(el[i].checked=0)
}
if(check == 0)
check = 1;
else
check = 0;
}
</code></pre>
| javascript | [3] |
2,173,822 | 2,173,823 | How to create apklib for a project in android | <p>I have a question that I want to make an apklib file for an facebook sdk. But I don't know how to create that but I need to use Facebook Sdk via Maven Repository, how this can be achieved? Please help me out about this problem.</p>
| android | [4] |
4,637,530 | 4,637,531 | adding your own SQLite database to an android application | <p>how can we add our own SQLite database to an android project??</p>
| android | [4] |
2,596,992 | 2,596,993 | Security digit java multiplication | <p>Say the user inputs an int <code>123214</code></p>
<p>I have managed to separate the digits however how can i multiply the digits by one and other. </p>
<p>E.g. I want <code>1*2*3*2*1*4</code></p>
<p>I put all the single digits into an array but I can't multiply them by one and other as I want.</p>
| java | [1] |
4,904,505 | 4,904,506 | jQuery onload function | <p>I m using the following script to call a onload function but it does not works in IE</p>
<p><code>("#body").attr({onload : "calFact();"});</code></p>
| jquery | [5] |
1,471,999 | 1,472,000 | More than one password | <p>Good Day.
I'm using a 'pasuser form' as a password protectant for a website page.
The script below only allows the use of ONE password and username.
Does anyone know how to change the script for multiple password/username use? Basically, I would prefer each user to have his unique password/username.
THANK YOU very much for your time and help.</p>
<pre><code>function pasuser(form) {
if (form.id.value != "user") return alert("Invalid UserID");
if (form.pass.value != "pass") return alert("Invalid Password");
location = "http://tempuri.org/";
}
</code></pre>
| javascript | [3] |
5,805,979 | 5,805,980 | Are these things still in use in asp.net? | <p>I am undergoing training in asp.net and the topics which are being taught there these days are repeater and datalist control. I want to know that whether these things are used frequently in the companies. The other thing i want to know is that what are the topics which i should learn in depth so as to get a job. I don't want to go through out dated topics.</p>
<p>I am not aware of what's most demanding in asp.net job sector. Please guide me through.</p>
| asp.net | [9] |
1,563,647 | 1,563,648 | javascript IFrame permissions | <p>I know that for protection of the client you can do very little on the contentWindow and contentWindow.document property of the iframe, but what exactly <em>is</em> possible?</p>
<p>Edit: I should have clarified that it's cross-domain.</p>
| javascript | [3] |
1,598,150 | 1,598,151 | take time to execute .bat file through java? | <p>i have written a code to run .dat file using Java. but when is run that application then it take time to execute means it give half result and then after some time after gives complete result.</p>
<p>here is my code:</p>
<pre><code>String file = config.getOutPath() + "run_doxygen.bat";
BufferedWriter out = new BufferedWriter(
new FileWriter(file));
String cmd = "doxygen " + config.getOutPath() + "Doxyfile";
runtime.exec(cmd);
System.out.println("cmd_doxy:"+cmd);
out.write(cmd);
out.newLine();
out.close();
</code></pre>
<p>the doxygen generate xml file. let suppose it generate 10 xml file . when i launch that *.bat file it generate 5 file and to generate rest 5 file it take time.
and *.bat file contain : doxygen "path" </p>
<p>path is location of config file. it work fine when i run it with cmd or double click.</p>
<p>anybody have any idea
.
thanks</p>
| java | [1] |
5,797,188 | 5,797,189 | Is there anyway I can ask python to explicitly treat all floats as 32bits even on a 64bit machine? | <p>Is there anyway I can ask python to explicitly treat all floats as 32bits even on a 64bit machine?</p>
<p>I don't want to change the codes...</p>
| python | [7] |
3,797,882 | 3,797,883 | Solving a programming-contest using Python | <p>I found this problem, which I thought would be interesting to solve but couldn't really come up with a correct solution- </p>
<blockquote>
<p>Inside a room, there is a monster with
N heads, and a human (with 1 head).
The human has two laser guns. The
first gun, A destroys C1 heads when
fired and the second gun,B destroys C2
heads when fired [The guns may destroy
both the monster's as well as human
heads, but the guns prioritize monster
heads over human ones].</p>
<p>Also, if after the firing of the gun
the monster has a positive non-zero
number of heads left, the monster will
grow additional heads. The monster
grows G1 heads when gun A is used and
it grows G2 heads when gun B is used.</p>
<p>The problem is to input N, C1, C2, G1
and G2, then find out what would be
the shortest combination of
gun-choice(A or B) the human must use
to kill the monster(the monster dies
when No. of heads=0).
[Note- this problem is from a programming contest that has already ended]</p>
</blockquote>
<p>I tried approaching this problem using recursion but found myself clueless about how to actually come up with the solution. So, if you could give some hints how to approach the problem, that'd be great. </p>
| python | [7] |
4,929,391 | 4,929,392 | double alignment using string.format | <p>I was trying to align doubles using string.format and display them on a tooltip.</p>
<p>I used:
string.Format("{0,15:N2}", number);</p>
<p>but the results come out as:</p>
<pre>
1234.56
00.00
</pre>
<p>It seems some of the numbers are narrower than the space. Does anyone know how to solve this problem?</p>
<p>Thanks!</p>
| c# | [0] |
5,284,876 | 5,284,877 | Open select link in a new window | <p>I have an unordered list that is being converted into a select list with jQuery. Code I am using is pasted below:</p>
<pre><code>$("<select />").appendTo(".region .links");
// Create default option "Go to..."
$("<option />", {
"selected": "selected",
"value": "",
"text": "Links"
}).appendTo(".links select");
$(".links .menu li a").each(function () {
var el = $(this);
$("<option />", {
"value": el.attr("href"),
"text": el.text()
}).appendTo(".region select");
});
$(".region select").change(function () {
window.location = $(this).find("option:selected").val();
});
</code></pre>
<p>This code then generates the following:</p>
<pre><code><select>
<option selected="selected" value="">Links</option>
<option value="http://www.linkvalue.com">Link1</option>
<option value="http://www.linkvalue2.com">Link2</option>
</select>
</code></pre>
<p>I need to change javascript so that all links open in new window. How would i go about it?</p>
| jquery | [5] |
4,127,176 | 4,127,177 | how to make a list of lists in to dictionary of tuples | <p>I had <strong>list of lists</strong> for example</p>
<pre><code>res = [[None,'A','B'],[19980228, 'd1', 't1'],[19980302, 'd2', 't2'],[19980303, 'd3', 't3']]
</code></pre>
<p>Now i need to frame the above result as <strong>dictionary of list of tuples</strong> like</p>
<pre><code>{'A': [(19980228, 'd1'), (19980302, 'd2'), (19980303, 'd3')],
'B': [(19980228, 't1'), (19980302, 't2'), (19980303, 't3')]}
</code></pre>
<p>Please let this me know this concept, Thanks in advance.</p>
| python | [7] |
5,425,980 | 5,425,981 | Only the original thread that created a view hierarchy can touch its views. Exception occurs when _trd1 starts | <p>Exception occurs when _trd1 starts.
Why it is giving an exception.
I have an imageView on which i have set an Animation.
Same as i did on _imageCard2 they working both fine...
but when i added a new thread it gives an exception after its completion.</p>
<pre><code>public void AnimFunction() {
TranslateAnimation animation2 = new TranslateAnimation(0, -50, 0, 0);
animation2.setDuration(100); // duration in ms
animation2.setRepeatCount(1);
animation2.setRepeatMode(Animation.REVERSE);
animation2.setFillAfter(false);
_imageView.startAnimation(animation2);
_imageView.setImageResource(R.drawable.b1fv);
// Animation
TranslateAnimation animation = new TranslateAnimation(0, 150, 0, 0);
animation.setDuration(400); // duration in ms
animation.setRepeatCount(1);
animation.setRepeatMode(Animation.REVERSE);
animation.setFillAfter(false);
_imageCard2.startAnimation(animation);
Thread _trd1 = new Thread() {
public void run() {
try {
sleep(2000);
_imageCard2.setImageResource(R.drawable.sk);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
_trd1.start();
}
</code></pre>
| android | [4] |
2,789,221 | 2,789,222 | Any good place to learn Javascript Browser Object Model? | <p>I'm currently reading <a href="http://rads.stackoverflow.com/amzn/click/1118026691" rel="nofollow">Professional Javascript for web developers</a> and in the section for BOM, there's a lot of talking and it's really not helping reading lots of paragraphs and tiny snippets of code every now and then. </p>
<p>I'm looking for a good website, tutorial that demonstrates the BOM well. I've searched a lot but all i'm getting is the DOM stuff.</p>
| javascript | [3] |
2,323,116 | 2,323,117 | which is the example of type selector | <p>I have a question regarding jQuery.</p>
<p>What is an example of type selector?</p>
<p>1) h1</p>
<p>2) .h1</p>
<p>3) #h1</p>
<p>4) div h1</p>
<p>5) div>h1</p>
<p>Can anybody tell me what would be the correct answer?</p>
<p>Thanks</p>
| jquery | [5] |
321,417 | 321,418 | use icu4c in Android Application | <p>there is one "icu4c" project at android platform (external/icu4u)
any one know how to use this in my android application?
I want to do some conversion, ec. unicode->big5, ...?</p>
| android | [4] |
41,420 | 41,421 | Insert function name with php | <p>I'm trying to do a simple task, insert a second function name under "onmouseover" but probably something is wrong with the syntax.</p>
<pre><code>echo '<div onmouseover="changeText(); <?php if($title==""){echo changeViz();}; ?> ">';
</code></pre>
<p>I probably need to escape some quotes and add some, but i can't figure out the correct solution.
Thanks</p>
<p>Nothing it's working. Let me give you the complete code...: </p>
<pre><code>echo '<div class="frame" onmouseover="changeText(\''.$text[$i].'\'); <?php if($title[$i]==""){echo changeViz();}; ?>">';
</code></pre>
| php | [2] |
58,360 | 58,361 | Adding documentation for rxtx in eclipse | <p>I downloaded the jar file for rxtx but I am unable to add the documentation. I have looked at <a href="http://stackoverflow.com/questions/6201621/how-to-add-rxtx-serial-apis-javadoc-to-eclipse-or-netbeans">How to add RXTX serial API's javadoc to eclipse or netbeans?</a> question but it doesnt show the documentation . Any ideas?</p>
| java | [1] |
2,819,006 | 2,819,007 | set one field equal to another | <p>I have:</p>
<pre><code><form>
<input id="A" name="B">
<input id="C" name="D">
</form>
</code></pre>
<p>And I need to set the second input equal to the first whenever the first input is changed.
Something like:</p>
<pre><code>$(function() {
$('input#A').change(function() {
$('input#C').val(this.text);
});
});
</code></pre>
| jquery | [5] |
4,479,438 | 4,479,439 | jQuery-Select list option hover | <p>I want to alert an option when the mouse-cursor is over it. I use this code:</p>
<pre><code>$("select > option").hover(function ()
{
alert($(this).attr("id"));
});
</code></pre>
<p>Unfortunately, this is neither working in IE nor in FF.</p>
<p>Can someone give me a hint please?</p>
| jquery | [5] |
5,387,461 | 5,387,462 | how can i solve binary system in c++? | <p>how can i see the answer when i need to solve the decimal code to binary code?</p>
| c++ | [6] |
579,812 | 579,813 | Is it a idiomatic to implicitly make a class convertible to bool? | <p>For some reason a lot of types are implicitly convertible to boolean values, despite Python's "be explicit" guideline. Anyway...</p>
<p>Is it idiomatic to make custom classes also implicitly convertible to bool, where appropriate? If yes, what function should I (re)define? In my specific case, I have an <code>Image</code> class; I want to make it convertible to bool such that it is <code>True</code> when it is holds data loaded from somewhere (a file), and <code>False</code> otherwise.</p>
| python | [7] |
1,293,775 | 1,293,776 | Should I prefer purchasing a commercial framework or creating my own version of the same functionality? (classic "Create vs Buy") | <p>I have mixed views about commercial class libraries. Am I better off using a commercial class library or starting from scratch? If buying a library is the way forward which one for a C# developer?</p>
| c# | [0] |
1,945,382 | 1,945,383 | free hosting support mail function or not? | <p>i ask are the free hostingf support this function
and if not >>>any one know free hosting support
or way to run this function on localhost for testing only</p>
| php | [2] |
1,703,439 | 1,703,440 | changing the onblur attribute with jQuery | <p>I am trying to change the onblur attribute of a text field with jQuery</p>
<p>But it's not working</p>
<p>The input field already has some onblur code like this:</p>
<pre><code><input id="emp" type="text" onblur="func1('abc');">
</code></pre>
<p>Using jQuery I want to change it to this:</p>
<pre><code><input id="emp" type="text" onblur="func2('abc','def');">
</code></pre>
<p>I am trying this code:</p>
<pre><code>$('#emp').attr('onblur',"func2('abc','def')")
</code></pre>
<p>But it does nothing ..</p>
| jquery | [5] |
5,526,883 | 5,526,884 | Same session variable for different systems | <p>i have a huge problem with a system i have been assigned to maintain.</p>
<p>In reality it is many systems over an intranet.</p>
<p>The problem is, the original programmer created many systems for the intranet which all of them connect to the database through a script, where the user name, pass,db params,etc are stored in $_SESSION variables.</p>
<p>The problem arises when a user logs into one system, in a tab, then opens another tab for the other system, and because the session variable are overwritten he is unable to continue operating in the first one. </p>
<p>Take into account that there are dozens of apps... how do you think i could solve this without changing each and every existing app.?</p>
<p>Thanks!</p>
| php | [2] |
1,531,811 | 1,531,812 | Play default soft keyboard sound when buttons are pressed in android | <p>I have developed an app which uses my own <code>custom keyboard</code> (well, a view that looks like a keyboard and behaves like a keyboard anyway). One thing I've yet to figure it out is how to make it play the <code>default soft keyboard 'click'</code> sound when the buttons are pressed.
Is there any easy way to do this?</p>
<p>I would like to use the <code>keyboard click</code> sound that comes with the phone rather than providing my own. As different phones might have different keyboard click sounds, I would like to keep my application consistent. Ultimately, I want to reflect the same settings the user has chosen in their <em>global</em> keyboard settings (play/not play sounds, vibrate/not vibrate, etc).</p>
| android | [4] |
186,153 | 186,154 | PHP call variable | <p>i am using dreamweaver for my php. how do i get a variable called username from another page and display it to greet the user by name. i can login to the welcome page but getting and error when calling the variable i.e </p>
<pre><code><?php $_POST['username'] ?>
</code></pre>
<p>Error is Undefined index: username </p>
| php | [2] |
5,132,408 | 5,132,409 | getting distance on roads between 2 locations | <p>Hello how can an iphone user find the distance on roads between two locations using an in app solution preferably using two text fields?</p>
<p>I tried google maps. However, I'm not sure if there is a mapkit tool to do this build in or a google maps api?</p>
<p>I am trying to use this value in order to do some calculations afterwards.</p>
| iphone | [8] |
5,076,132 | 5,076,133 | Accessing functions from within a Javascript Object (Javascript) | <p>I am attempting to create a basic Hangman program. It's an array of tags which are assigned into an array of Objects (called Buttons). Each image is an image of a letter, so for example you would press the 'L' button, it would check whether this was in an WordArray (which is an array of chars), then it would act accordingly (to hide the letter, then update the gallows image if it needed to).</p>
<p>I cannot get the onclick method of the images to access the checkinarray function. What am i doing wrong?</p>
<pre><code>var LetterAmount = 3; //make this 26. checked.
var WordArray = new Array();
var Buttons = new Array();
function checkinarray(num){
var z = 0;
while (z<4){
document.write("looping through word now");
if (num == WordArray[z]){
document.write("<br/>it is in the word");
}
z++;
}
}
function ButtonClicked(){
this.Image.src = "images/blank.jpg";
checkinarray(this.Number);
}
function Button(Image, Number) {
this.Image = Image;
this.Number = Number;
this.ButtonClicked = ButtonClicked;
}
function initialiseletters(){
var x;
//set up empty img tags for use
for(i = 0; i < LetterAmount; i++) {
document.write("<img id=" + i + ">");
}
for(x = 0; x < LetterAmount; x++) {
document.images[x].src = "images/" + x + ".jpg";
document.getElementById(x).onclick =function(){
Buttons[this.id].ButtonClicked();
}
Buttons[x] = new Button(document.images[x], "" + x);
}
}
function initialiseword(){
//WordArray = new Array();
WordArray[0] = 0;
WordArray[1] = 1;
WordArray[2] = 2;
WordArray[3] = 3;
}
function initialise(){
initialiseword();
initialiseletters();
document.write("testing overall");
}
</code></pre>
| javascript | [3] |
5,566,076 | 5,566,077 | Is there any really good video or screencast showing how to develop Android apps? | <p>I am for training video or screencast showing how to program for Android phones. I don't mind paying for it as long as it is a really good learning materials.</p>
<p>Thanks </p>
| android | [4] |
2,842,377 | 2,842,378 | jQuery quote rotator using slideUp and slideDown | <p>I have a quote rotator set up that is displaying two quotes at a time and kind of jumping around all over the place when it should just be rotating smoothly between each one.
I can't figure out what is going wrong. See it in action here - <a href="http://jsfiddle.net/RF3xK/1/" rel="nofollow">http://jsfiddle.net/RF3xK/1/</a></p>
<p>Code is below,</p>
<pre><code><div id="quotes">
<div class="textItem">
testing the quotes testing the quotes
</div>
<div class="textItem">
asdfdsaf sdf sdf sdf sf sd fsdaf sdf sdaf sdfsd f ds f dsf asdfsdafdsaf asdfdsaf sdf sdf sdf sf sd fsdaf sdf sdaf sdfsd f ds f dsf asdfsdafdsaf
</div>
<div class="textItem">
and another one
</div>
</code></pre>
<p></p>
<p>and the jQuery</p>
<pre><code>$(document).ready(function() {
$('#quotes .textItem').hide();
InOut($('#quotes .textItem:first'));
function InOut(elem) {
elem.delay().slideUp(800).delay(0).slideDown(0, function() {
if (elem.next().length > 0) {
InOut($(this).next());
}
else {
InOut($(this).siblings(':first'));
}
});
}
$('#quotes .textItem').mouseover(function() {
$(this).stop(true, true);
});
$('#quotes .textItem').mouseout(function() {
if ($(this).is(":visible") == true) {
InOut($(this));
}
});
});
</code></pre>
| jquery | [5] |
5,540,347 | 5,540,348 | jQuery image hover menu picture overlaps nearby pictures | <p>I am developing a small web app that uses jQuery quite a lot. In my app, a user can hover an image, which becomes bigger after a few seconds, giving him more details.</p>
<p>The problem is that when the image enlarges the image, it takes over the area of the nearby images as well. Now, if the user goes over the second red square (numbered as 2) I would like the currently enlarged image to disappear and instead enlarge the image pictured below as square two.</p>
<p>I am not much of a painter, but I have attached a small image to help illustrate the problem.</p>
<p>In short, How can I tell jQuery to detect when the mouse is over red square number two, yet not raising the event if the mouse is over green square.</p>
<p>[in my demo picture, hovering on point]</p>
<p><img src="http://i46.tinypic.com/3y1x5.png" alt="Hovered menu sample"></p>
| jquery | [5] |
2,703,914 | 2,703,915 | How to sort the dates and time in android? | <p>I need to know how to sort the dates and time and storing it in to SQ Lite .
Please give me an example or some link.</p>
| android | [4] |
871,015 | 871,016 | javascript for-in loop in an Array | <p>If the code is this:</p>
<pre><code>arr=Array("a","b","c");
for(i in arr);
{
alert(i);
}
</code></pre>
<p>there is no any alert,but if it is this:</p>
<pre><code>arr=new Array("a","b","c");
for(i in arr)
{
alert(i);//alerts 0,1,2
}
</code></pre>
<p>What is the reason?</p>
| javascript | [3] |
5,377,002 | 5,377,003 | How to change YAF(yetanotherforum) theme | <p>Please tell me about some tutorials or any easy way to change(customize) the YAF.
Change page layout .
Thanks.</p>
| asp.net | [9] |
2,567,509 | 2,567,510 | how to implement elastic search using Java? | <p>I want to implement elastic search using Java in windows environment.please provide me some implementation details.</p>
| java | [1] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.