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 |
---|---|---|---|---|---|
500,801 | 500,802 | set::find() doesn't find | <p>I have a problem with this code (cubeBoxData is a set of cubeBox):</p>
<pre><code>cubeBox temp(bx,by,bz);
cubeBoxData.insert(temp);
set<cubeBox>::iterator i = cubeBoxData.find(temp);
const_cast<cubeBox&>(*i).addCube(x,y,z);
</code></pre>
<p>The problem is that cubeBoxData.find(temp); doesn't find temp, then the program fails trying to call addCube(), and I don`t know why, because this code works fine (just change the third line):</p>
<pre><code>cubeBox temp(bx,by,bz);
cubeBoxData.insert(temp);
set<cubeBox>::iterator i = find(cubeBoxData.begin(),cubeBoxData.end(),temp);
const_cast<cubeBox&>(*i).addCube(x,y,z);
</code></pre>
<p>The operator < for cubeBox is:</p>
<pre><code>bool operator<(const cubeBox& c) const {
return x<c.x ? true : y<c.y ? true : z<c.z ? true : false;
}
</code></pre>
<p>And addCube doesn't change x, y or z.</p>
<p>I think my operator< is wrong and I'm missing something silly, but i can´t figure what is it.</p>
| c++ | [6] |
4,419,140 | 4,419,141 | Benefits of scoping blocks? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/690711/when-do-you-use-code-blocks">When do you use code blocks?</a> </p>
</blockquote>
<p>Ok, this might be a stupid question and I might be missing something obvious but as I slowly learn C# this has kept nagging me for a while now.</p>
<p>The following code obviously compiles just fine:</p>
<pre><code>public void Foo()
{
{
int i = 1;
i++;
}
{
int i = 1;
i--;
}
}
</code></pre>
<p>I understand that <code>{}</code> blocks can be used for scoping. The question is why would you want to do this? What problems does this feature solve?</p>
<p>There is no harm that I can see in using them barring that it does add to a more confusing code as these kind of scopes can be more easily overlooked compared those "tied" to flow controls, iterations, etc.</p>
| c# | [0] |
5,109,902 | 5,109,903 | Need Solution to reduce object creation, used spring - but have a problem , method explained in detail | <p>I am using spring to reduce new objects creation, for the number of resultset available, I will create a row object inside and add the row object in a rowset object, which maintains a list of rows.</p>
<p>My code goes like this.</p>
<pre><code> while(rs.next()) {
Row r = new Row();
//Logic
rowset.addRow(r);
}
</code></pre>
<p>My rs will have atleast a minimum of 3000 rows, so there will be a 3000 row object injected, so to avoid it, I used spring injection like</p>
<pre><code> while(rs.next()) {
Row r = (Row)getApplicationContext().getBean("row");
//Logic
rowset.addRow(r);
}
</code></pre>
<p>but the problem here is when the second row object is added to the rowset, the first row object's values are overriden with second row object and when last row is added , all the 1 to last-1 row objects values are updated as last row object values. </p>
<p>This is my rowset calss</p>
<pre><code>public class RowSet {
private ArrayList m_alRow;
public RowSet() {
m_alRow = new ArrayList();
}
public void addRow(Row row) {
m_alRow.add(row);
}
}
</code></pre>
<p>I need a solution , such that the new row object creation is avoided inside the while loop with the same logic involved.</p>
| java | [1] |
3,468,055 | 3,468,056 | C# WinForms ListBox SelectedIndex Equivalent in ListView? | <p>What is ListBox SelectedIndex Equivalent in ListView ?
How i can write the below code in ListView ?</p>
<pre><code>if(listbox.SelectedIndex == -1)
{
}
</code></pre>
| c# | [0] |
5,802,925 | 5,802,926 | Is there any true point to the Java interface? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/504904/how-are-java-interfaces-actually-used">How are Java interfaces actually used?</a> </p>
</blockquote>
<p>I'm not talking from an accademic buzzword point of view but from a pratical developer point of view.</p>
<p>So taking the example:-</p>
<pre><code> Class1 implements Interface
public String methodOne() {
return "This is Class1.methodOne()";
}
public String methodTwo() {
return "This is Class1.methodTwo()";
}
}
Class2:
Class2 implements Interface
public String methodOne() {
return "This is Class2.methodOne()";
}
public String methodTwo() {
return "This is Class2.methodTwo()";
}
}
</code></pre>
<p>Using the Interface:-</p>
<pre><code> Client {
Interface intface = new Class1();
intface.methodOne();
intface.methodTwo();
Interface intface = new Class2();
intface.methodOne();
intface.methodTwo();
}
</code></pre>
<p>But what are the benefits over just writting:-</p>
<pre><code> Client {
Class1 clas1 = new Class1();
clas1.methodOne();
clas1.methodTwo();
Class2 clas2 = new Class2();
clas2.methodOne();
clas2.methodTwo();
}
</code></pre>
<p>And bypass the Interface altogether.</p>
<p>Interfaces just seem to be an additional layer of code for the sake of an additional layer of code,
or is there more to them than just "Here are the methods that the class you are accessing has"?</p>
| java | [1] |
4,650,812 | 4,650,813 | what's the relationship between function and Function in Javascript | <p>as known in javascript, a function defined as </p>
<pre><code>function somefunc(){
}
</code></pre>
<p>is an instance of its constructor <code>Function</code>. But <code>Function</code> itself is a function either which implies the <code>Function</code> is an instance of <code>Function</code>. Is that what they are? Or there is some other relations between them. </p>
| javascript | [3] |
4,717,451 | 4,717,452 | Get random value without creating `Random` object | <p>I'm writing a class constructor with a decimal field, that is need to be initialized by a random value. Just one little field and I need to create new <code>Random</code> object. In the first place it looks cumbersome, and in the second there is can arise a lot of equal values, in case of creating a lot of objects in one time slice (<code>new Random()</code> is euqal to <code>new Random(System.currentTimeMillis())</code>, and equal timeMillis entails equal random values).</p>
<p>What is the best way to avoid this?</p>
| java | [1] |
3,230,241 | 3,230,242 | how to handle an exception when using timer | <p>I want to use timer to run a method in a period of time delayed, but the method may throw an exception which cannot be handled by run(), what should I do in this situation? the code may like below</p>
<pre><code>Timer timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
method() throws an exception /*the method that I want to run, which throws an exception cannot be handled in run()
}
}, timeToRun);
</code></pre>
<p>This kind of code could not work because run() cannot handle exceptions, so what should I do to make my method() run with exception in this case? Could somebody helps me? </p>
| java | [1] |
784,546 | 784,547 | Python code won't run first line prompt | <p>Why won't the following python code immediately run the first line and prompt <code>how many years?</code> ? </p>
<pre><code>years=input('how many years?')
amount=input('how much money?')
if amount < 10000:
interest = 1.1
total = amount * interest
print total
else amount >= 10000:
interest = 1.2
total = amount * interest
print total'
</code></pre>
| python | [7] |
3,343 | 3,344 | Definition of friend inside class | <p>Can i put definition of friend function / class inside another class? I mean something like this:</p>
<pre><code>class Foo
{
friend void foo() {} // 1
friend class Bar {}; // 2
};
</code></pre>
<p>gcc compiles friend function, but can't compile friend class.</p>
| c++ | [6] |
644,943 | 644,944 | how to read .rtf file from the FTP server? | <p>I know how to read text file from the ftp server.I have used this logic for rtf file.But it gives wrong out put.Is it possible to read rtf file from the server?If possible then please help me.</p>
| iphone | [8] |
1,602,425 | 1,602,426 | Android update an app in the background | <p>This app is not on the google play. I can update in manually from a server, but I d like to update it automatic, like in the google play, it is updating automatically in the bg, and show it in Notification bar.</p>
<p>How can I do that?</p>
<p>Thanks</p>
| android | [4] |
2,111,069 | 2,111,070 | Making an easy way of getting the value I need in PHP? | <p>I am making a game in php as a personal project.</p>
<p>I can make items out of items that I have, the items I have are stored in an array called <code>$user</code></p>
<p>For now I am displaying how many of each item I can make by doing the following (let us say that to make a spade you need 1 wood and 1 metal and 1 energy)</p>
<pre><code>$amount = min($user['wood'], $user['metal'], $user['energy']);
// USER HAS ITEMS TO MAKE SPADE
if ($amount) {
echo '<form class="spacerTop" action="#" method="post">
<input type="hidden" name="itemPlus" value="spade" />
<select name="amount">';
$i = 1;
while ($i <= $amount) {
echo '<option value"' . $i . '">' . $i . '</option>';
++$i;
}
echo '</select>
<input type="submit" value="Make Spades" />
</form>';
}
</code></pre>
<p>Doing the above will only show the option to make a spade if the user has the minimum amount of items to make a spade. It will also show in a <code>form select</code> how many spades they can make in total using the <code>min</code> value from php.</p>
<p>What I cannot work out is say if it costs 2 energy, 10 wood and 5 metal? How can I get the same functionality as above even if the items it costs to make an item differs?</p>
| php | [2] |
3,888,292 | 3,888,293 | How can I call a static method from a class if all I have is a string of the class name? | <p>How would I get something like this to work?</p>
<pre><code>$class_name = 'ClassPeer';
$class_name::doSomething();
</code></pre>
| php | [2] |
1,706,654 | 1,706,655 | Closing a Activity on new Activity | <p>I have an activity that has a button with a intent as follows</p>
<pre><code>Intent i = new Intent(getApplicationContext(), MyMainActivity.class);
startActivity(i);
finish();
</code></pre>
<p>Once you move to the next activity <code>MyMainActivity.class</code> if you hit the back button it shows the last activity with the old resaults.</p>
<p>Is there a way to make the activity close or move back once the button is pushed? This way once the activity is done it is not my activity history.</p>
| android | [4] |
1,852,796 | 1,852,797 | Publishing All Project Files in Visual Studio | <p>Is there a security risk associated with using the option that copies "All project files" when publishing a web application into a production environment? I normally use the option "Only files needed to run this application" which does not copy the source code to the server. </p>
<p>I am the only person with access to the production server. There is also no issue with cluttering the production server as there isn't much on it. In fact I don't mind having all the source files be kept on the server together with the binaries. </p>
<p>Is there any security issue with this? </p>
| asp.net | [9] |
3,608,145 | 3,608,146 | What functions should I disable if I would allow users to type PHP? | <p>Let's say I want my users to allow to create PHP scripts on my page and I would save those pages in directory. What functions should I disable to not be hacked? Or what should I do? </p>
<p>Firstly, I would not allow people to upload files through PHP file (not sure how to do it yet), what else?</p>
| php | [2] |
1,775,835 | 1,775,836 | ASP.NET login control mysteriously stops working | <p>I'm using the ASP.NET Login control and have been doing so for a couple of years on a particular site with success. Out of the blue, in the dev environment, this control has stopped working and is now bouncing me back to the login page.</p>
<p>Using source control I've reverted recent changes that might have been the cause but no luck. I've stepped through the code and have checked that the e.Authenticated property is correctly being set to true and that the ReturnUrl is correctly specified on the params.</p>
<p>Any ideas about where to look next to try and figure this out?</p>
| asp.net | [9] |
616,927 | 616,928 | Creating jar file forcing the jvm to take the desired main method | <p>I have faced this question in the interview so that I am posting this here where I believe I can get answer.</p>
<p>this is what is the question.</p>
<ol>
<li><p>I have four Java files, each one has got a main class. while creating jar file combining all these four classes how to make the jvm to invoke the main method which is there in a particular Java file. say I want the jvm to run the main method from the Class A out of B, C, D class files.</p></li>
<li><p>Pen cost is $10 but I have only $9 with me, I have no credit card, debit card or money and I should not borrow money from any body, should not use mobile and the price also is fixed but I have to buy the pen. How?</p></li>
</ol>
| java | [1] |
3,076,276 | 3,076,277 | How to "tail -f" file from a remote Unix system in Java? | <p>I want to be able to get buffered input from a remote system (using SSH and username password encrytion from Java) and then "tail -f" a file, buffering the input. Is this possible?</p>
| java | [1] |
3,215,158 | 3,215,159 | how to use inbuild contact database? | <p>I am developing a contact application using android 2.2. I want to use the Contact Inbuild database. I have already access to the data in Listview. But when it inserts for adding a contact record which content uri should I use? Or how to insert record through my own UI?</p>
| android | [4] |
3,458,048 | 3,458,049 | What is the order of destruction for variables initialized through constructor initilization set? | <p>suppose i have class A,B and C</p>
<p>if i then have container as follows</p>
<pre><code>Container::Container()
:A(10),B(20),C(30)
{
//Do something specific
}
</code></pre>
<p>Now if i call the destructor of Container, i.e ~Container()
I notice that destructors are getting called in the reverse order
i.e ~C(), ~B() and then ~A()</p>
<p>Is this something always fixed order ?
Can anyone throw some more light on the order of destructors for construction initialization set ?</p>
| c++ | [6] |
5,651,186 | 5,651,187 | Request Help for reading a line of JS | <p>Can someone tell me what the ? means in the js below? I did not line wrap the JS code as I did not want to inadvertently change the meaning...</p>
<pre><code>errMess = t.origStatus != undefined && t.status != t.origStatus && t.statuseffective == null ? errMess + t.systemname + ": Status effective date invalid.\n" : errMess;
</code></pre>
<p>I read this as:<br>
errMess =<br>
t.original status not equal to undefined AND<br>
t.status not equal to original status AND<br>
statuseffective equals null <strong>?</strong> <-- don't know what this means</p>
| javascript | [3] |
1,987,794 | 1,987,795 | C# Get All file names without extension from directory | <p>Im looking for a way to read ALL txt files in a directory path without their extensions into an array. Ive looked through the path.getFileNameWithoutExtension but that only returns one file. I want all the *.txt file names from a path i specify</p>
<p>THanks</p>
| c# | [0] |
3,689,478 | 3,689,479 | Errors concerning depreciated eregi | <p>This is the error i am receiving </p>
<pre><code>Deprecated: Function eregi() is deprecated in /home/socia125/public_html/profile.php on
line231
</code></pre>
<p>This is my code</p>
<pre><code>// Loop through the array of user agents and matching operating systems
foreach($OSList as $CurrOS=>$Match) {
// Find a match
if (eregi($Match, $agent)) {
break;
</code></pre>
<p>any help is appreciated</p>
| php | [2] |
3,559,884 | 3,559,885 | How to convert from object to String? | <p>How to convert arraylist selectitem to string.I am getting as object.Please help me...</p>
<pre><code>List<SelectItem> DtlLst = new ArrayList<SelectItem>();
DtlLst.add(new SelectItem(DtlVO.getTrnId(),
DtlVO.getTrnId()));
---
---
String number =new String(DtlLst.get(0).toString());
System.out.println("number"+number.toString());
</code></pre>
<p>I am getting as object.How to get this list first value ?</p>
| java | [1] |
708,385 | 708,386 | How to display the images from server asynchronously in Android? | <p>I am displaying an image from a server in Android. For that I have gone through the tutorial <em><a href="http://www.androidpeople.com/android-load-image-url-example" rel="nofollow">Android Load Image From URL Example</a></em>. It is very helpful. But it is taking 5 minutes to display the image from the server. So I want to display the image asynchronously. How can I do that?</p>
| android | [4] |
5,464,096 | 5,464,097 | Putting a const in a header | <p>From everything I am reading and testing, there is no way (without a preprocessor macro) to define a constant in a shared header and ensure that each TU is not creating its own storage for that constant.</p>
<p>I can do this:</p>
<p><code>const int maxtt=888888;</code></p>
<p>Which is the same exactly as:</p>
<p><code>static const int maxtt=888888;</code></p>
<p>And if this header is shared, it will work but each TU gets its own copy of <code>maxtt</code>. I could also do this, to prevent that:</p>
<p><code>extern const int maxtt;</code></p>
<p>But then I cannot define <code>maxtt</code> here; that must be done in a CPP to avoid linker error.</p>
<p>Is my understanding correct?</p>
| c++ | [6] |
2,743,034 | 2,743,035 | Finding objects in JS array and storing names to new array? | <p>So, I have an array that contains X objects, all named by dates and containing useless data beyond their name.
I want to store these dates in an array for later use and objects are, apparently, not found in an array by array[i], so how do I iterate through the array and just save the names to a string in another array?</p>
<p>Edit: Ok this question was due to a major brainfart... The obvious answer would be</p>
<pre><code> var dP = $('#calendar').GetDate();
var dPTmp = [];
var i = 0;
for (var id in dP) {
dPTmp[i] = dP[id].toString();
i++;
}
console.log(dPTmp);
</code></pre>
| javascript | [3] |
5,535,226 | 5,535,227 | String functions to show a substring | <p>I have a string. If the length of the string is more than 90 characters i have to display only the 90 characters & concatenate it with a ".." can anyone tell me which string function i can use for this?</p>
| c# | [0] |
1,992,093 | 1,992,094 | Set cookie and update cookie problem - Php | <p>In an attempt to get more familiar with cookies I've decided to set up a simple cookie management system to have more control of the information that I can store and retrieve from a user.</p>
<p>The idea is to set a cookie if it does not exist, and update a cookie if it already exists on the user. </p>
<p>Once the cookie is set, it will also be stored in a database that will keep track on when the session started and when it was last accessed. </p>
<p>Creating a cookie worked well at first. But suddenly it stopped working and wouldn't set anything at all. This is the current code of the createSession() function:</p>
<pre><code>function createSession() {
// check to see if cookie exists
if(isset($_COOKIE["test"])) {
// update time
$expire = time()+81400;
setcookie("test","$cookiekey",$expire,"/",false,0);
} else {
// assign unique cookie id
list($msec,$sec)=explode(" ",microtime());
$cookiekey = preg_replace("/./","",($msec+$sec));
// set time
$expire = time()+81400;
// set cookie
setcookie("test","$cookiekey",$expire,"/",false,0);
// assign the unqiue id to $_COOKIE[]
$_COOKIE["test"]=$cookiekey;
unset($cookiekey);unset($msec);unset($sec);unset($expire);
}
</code></pre>
<p>}</p>
<p>Is my approach heading in the right direction or have I done something way wrong?</p>
| php | [2] |
2,433,112 | 2,433,113 | Javascript Arranging Images as Pile of Cards | <p>Im new to javascript so im sure there is a lot i am missing in its understanding.
What i am trying to do it create a layer of images so that it looks like a pile of cards.</p>
<p>have seen similar codes and have tried to follow their idea but i just cant get the images to position properly. All 10 or so images are place in the exact same location.</p>
<p>Can any help to see why they not positioning? Also what is "em". I cant find any literature on it but assume it is the measurement em like px ?? Why is it in "" ?</p>
<pre><code>function Display() {
var el;
var left = 0;
var top = 0;
var i=0;
var n = deck.length;
var cardNode;
var img = document.createElement("IMG");
img.src = "wendell7_back.png";
el = document.getElementById('deck');
el.appendChild(img);
while (el.firstChild != null) el.removeChild(el.firstChild);
for (i = 0; i < Math.round(n / 5); i++)
{
cardNode = document.createElement("DIV");
cardNode.appendChild(img);
cardNode.style.left = left + "em";
cardNode.style.top = top + "em";
el.appendChild(cardNode);
left += 0.1;
top += 0.1;
}
}
</code></pre>
| javascript | [3] |
3,707,366 | 3,707,367 | What's wrong with my sub-classed AVAudioPlayer? | <p>I sub-classed AVAudioPlayer like so:</p>
<pre><code>#import <AVFoundation/AVFoundation.h>
@interface AudioPlayer : AVAudioPlayer {
// irrelevant objects...
}
-(void) myMethod;
@end
</code></pre>
<p>I also placed myMethod in the implementation. In another class, I instantiate the sub-class (not AVAudioPlayer) and import the header.</p>
<p>When I attempt to call myMethod, I get the error:</p>
<p>[AVAudioPlayer myMethod]: unrecognized selector sent to instance</p>
<p>I'm certain I created an AudioPlayer class, not AVAudioPlayer, so what gives?</p>
| iphone | [8] |
4,169,167 | 4,169,168 | How do you create multiple variables from raw input in python? | <p>Beginner with python here. I've been doing some online tutorials and can't seem to find the solution to this question. What I'd like to do is this:</p>
<pre><code>hostname = raw_input("Type host name here: ")
</code></pre>
<p>Then the user inputs as many host names as they like, type done, then what they entered becomes variables for use in the script. So if they typed HOST1, HOST2, HOST3, done then the script would run commands for each entry. Example:</p>
<pre><code>def myhostsbecomevariables(*args):
arg1, arg2, arg3, etc etc etc = args
print "arg1: %r, arg2: %r, etc: %r, etc: %r" % (arg1, arg2, etc etc)
myhostsbecomevariables(HOST1, HOST2, HOST3)
</code></pre>
<p>If the user types in 3 host names then myhostbecomesvariables uses 3 arguments. If they had typed 5 host names then it would have 5 arguments. </p>
| python | [7] |
3,125,883 | 3,125,884 | Delegate handler for inner list? | <p>I have the following:</p>
<pre><code><ul id='foo'>
<li>
<ul class='a'>
<li class='animal'>goat</li>
<li class='animal'>horse</li>
<li class='animal'>pig</li>
</ul>
</li>
<li>
<ul class='a'>
<li class='animal'>zebra</li>
</ul>
</li>
</ul>
</code></pre>
<p>I want to make a delegate handler for the inner li items (the ones with class 'animal'):</p>
<pre><code>$('#foo li ul').delegate('li', 'click', function(event) {
...
});
</code></pre>
<p>I'm not sure how to define the selector though in the delegate definition - what's the right way to do it?</p>
<p>Thanks</p>
| jquery | [5] |
4,111,340 | 4,111,341 | php function to unset variables passed by reference | <p>currently i'm using this php function :</p>
<pre><code>function if_exist(&$argument, $default = '')
{
if (isset ($argument))
{
echo $argument;
}
else
{
echo $default;
}
}
</code></pre>
<p>i want this function to unset the variables $argument(passed by reference) and $default just after echoing their value, how can i do this?
Thanks in advance.</p>
| php | [2] |
727,357 | 727,358 | Accessing a 2D array between two friend classes | <p>My question is how to access and modify a 2D array defined in one class that is friends with another class. Below are some details on my question:</p>
<p>In <code>class A</code> I declare and allocate the appropriate space for my 2D array (pointer-to-pointer) u. </p>
<pre><code>Class A
{
public:
friend class B;
long double **u;
int fun;
void make();
};
void A::make()
{
long double **u = new long double *[nx];
for (int i=0;i<nx;i++)
u[i] = new long double [ny];
int fun = 9;
}
</code></pre>
<p><code>Class A</code> is friends with <code>Class B</code>; I need to use the array I declared in <code>Class A</code> in a function defined in <code>class B</code>. Below is my Class B:</p>
<pre><code>class B
{
public:
void get(A*);
};
void B::get(A *pt)
{
using namespace std;
cout << pt->fun;
cout << pt->u[0][0];
}
</code></pre>
<p>I get a Bus error on my second cout <code>pt->u[0][0]</code>. Is there a simple way to use this setup I have to access my u[][] array? I think that I get the error because the pointer points to the 1st entry of my array, thus my whole 2D array is saved in memory as a single row (thinking aloud here). I'm a Fortran guy so this stuff is a little new to me.</p>
<p>Any help or "pointers" to other helpful threads would be appreciated.</p>
<p>Thank you !</p>
<p>Alberto</p>
| c++ | [6] |
5,973,589 | 5,973,590 | ASP.NET membership data storage issue | <p>I have created a sample web application in Visual Studio 2010. It stores Membership data(users, roles etc) in a .mdf file in App_data folder. But I don't wanna do this. I wanna store data in SQL server database. </p>
<p>For that I Google a lot but could not find solution. Here is what I am doing so for. First I create application then by using Web configuration tool I set users, roles etc and when hit provider tab it throws following error:</p>
<p><strong><code>Could not establish a connection to the database. If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.</code></strong></p>
<p>Then I execute <code>aspnet_regsql</code> utility and created a database in SQL Server and again open web configuration tool but error is same, no change. </p>
<p>Please guide either i am going in right direction or not. If right then how can I store data in <code>aspnet_regsql</code> generated SQL server database? </p>
<p>Note that I am using .NET framework 4, SQL server 2008 R2, Visual studio 2010. In fact I was expecting that there will be connection string in <code>web.config</code> file just like other data driven controls do. But no entries go in <code>web.config</code> file.</p>
| asp.net | [9] |
517,951 | 517,952 | Returning and instance of a Class given its .class (MyClass.class) | <p>I have an enum that will hold my algorithms. I cannot instantiate these classes because I need the application context which is only available once the application has started. I want to load the class at runtime when I choose by calling getAlgorithm(Context cnx). </p>
<p><strong>How do I easily instantiate a class at runtime given its .class (and my constructor takes arguments)? All my classes are subclasses of Algorithm.</strong></p>
<pre><code>public enum AlgorithmTypes {
ALL_FROM_9_AND_LAST_FROM_10_ID(AlgorithmFactory.AlgorithmAllFrom9AndLastFrom10Impl.class),
ALL_FROM_9_AND_LAST_FROM_10_CURRENCY_ID(AlgorithmFactory.AlgorithmAllFrom9AndLastFrom10Impl.class),
DIVIDE_BY_9_LESS_THAN_100(AlgorithmFactory.AlgorithmAllFrom9AndLastFrom10Impl.class),
TABLES_BEYOND_5_BY_5(AlgorithmFactory.AlgorithmAllFrom9AndLastFrom10Impl.class);
private Class<? extends Algorithm> algorithm;
AlgorithmTypes(Class<? extends Algorithm> c) {
algorithm = c;
}
public Algorithm getAlgorithm(Context cnx) {
return //needs to return the current algoriths constructor which takes the Context Algorithm(Context cnx);
}
</code></pre>
<p>}</p>
| java | [1] |
2,664,547 | 2,664,548 | Can you extrapolate the "email address" from a websites std. contact us form? | <p>Trying to obtain the "path" that a websites contact form has.
Is there a way to "reverse engineer" the std. "contact us" form to find out the actualy email address that it goes to ?</p>
| android | [4] |
1,470,790 | 1,470,791 | function to profile / performance test PHP functions? | <p>I'm not experiencing any performance issues, however I'd like to take a look at what takes how long and how much memory cpu it uses etc.</p>
<p>I'd like to get a firsthand understanding of which things can be bottle necks etc and improve any code i might reuse or build upon... (perfectionist)</p>
<p>I'm looking to <strong>create a little function</strong> that i can call at the begining and end of each function that records:</p>
<ul>
<li>execution time</li>
<li>memory used</li>
<li>cpu demand</li>
</ul>
<p>any ideas?</p>
<p>i haven't used things like memory_get_usage(), or methods of recording time() before so would love to get some tips on their combined implementation</p>
| php | [2] |
5,102,914 | 5,102,915 | What are the troubleshooting steps to troubleshoot if jquery events are not firing off? | <p>If a jquery event is not firing off, what are troubleshooting steps to figure out what causing why the event is not firing off?</p>
| jquery | [5] |
997,267 | 997,268 | Save radio button status php | <p>Form table is introduced inside an echo and, for the texts fields, I use value=" ' .$_POST['name'] to set default value if form was already sent at least one time. It works properly.
However, how could I save radio buttons status when form was already sent? Thanks.</p>
<pre><code><tr>
<td colspan="2" align="left" valign="top"> <input type="radio" name="ambiente" value="si" />
Si
<input type="radio" name="ambiente" value="no" />
No</td>
</tr>
</code></pre>
| php | [2] |
2,437,032 | 2,437,033 | I want to replace all instances of {0} on a page with an image or run a function when that is printed out. can i do this with php? | <p>I am making a widget that shows images in places where the user puts a {0} or {5}. can this be done with php? i dont know where to start and i have worn out my fingertips searching for it on google because i dont know good keywords.</p>
| php | [2] |
4,786,338 | 4,786,339 | What does "!function () {}" mean/do in javascript? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3755606/what-does-the-exclamation-mark-do-before-the-function">What does the exclamation mark do before the function?</a><br>
<a href="http://stackoverflow.com/questions/5422585/preceding-function-in-javascript">! preceding function in javascript?</a><br>
<a href="http://stackoverflow.com/questions/5827290/javascript-function-leading-bang-syntax">javascript function leading bang ! syntax</a> </p>
</blockquote>
<p>I've been seeing this pattern a little bit recently in javascript:</p>
<pre><code>!function () {
// do something
}()
</code></pre>
<p>what does the bang in front of the <code>function</code> keyword supposed to do? I can't seem to find anything about it on the intertubez.</p>
| javascript | [3] |
645,008 | 645,009 | How to implement a union query using the SqliteDatabase query method | <p>I am developing an application when i retrieve a data from an sqlite database using rawQuery method because the query is a UNION query and the data is displayed on a listview . I would like to use a query method because i would also like to implement a content provider to handle the data retrieved from the database.
Is there any way someone can implement a union query using the query method.</p>
<p>I would only like to know of the structure since the query is already working using the rawQuery method how do i structure it using a query method</p>
| android | [4] |
5,420,688 | 5,420,689 | What's low level Javascript? | <p>I've seen the term "Low level Javascript" come up a few times but I've no idea what it means. Google shows no results surprisingly. Can someone shed some light on it?</p>
| javascript | [3] |
593,506 | 593,507 | Dropdown menu open on click close on click | <p>I have asked this question before but it was closed as I didnt ask it properly. My issue is that I have a wp photography site which is not live yet as I am customizing it..I am very new to jquery and css. It has a dropdown menu which when you click on an item eg Portfolio it will drop down a further sub menu which will then show galleries. Currently clicking on a main item with a sub menu will only drop it down or open it but if you click the same main item again it will not pull the sub menu back up or close it. As i have numerous galleries I would like to code it so that it pulls back up on a second click. The template was designed the way it is now but i would like change it to do this.</p>
<p>Please someone advice me and let me know what I need to provide.</p>
<p>Many thanks. </p>
| jquery | [5] |
5,397,444 | 5,397,445 | Determine which element comes first | <p>I have an array with objects id's:</p>
<pre><code>one
two
there
etc..
</code></pre>
<p>And i have quite a long object list:</p>
<pre><code><div id="container">
<input type="text" id="one" />
<input type="text" id="two" />
<input type="text" id="three" />
</div>
</code></pre>
<p>This is not the actual html code, just a simplified version.</p>
<p>Now my array with id's keeps changing, and my question would be
how can i find out which element from that array is the first element in <code>#container</code> div</p>
<p>For example if i have this order:</p>
<pre><code>{
email
name
date
}
</code></pre>
<p>And this list of html objects</p>
<pre><code><div id="container">
<input type="text" id="name" />
<input type="text" id="last_name" />
<input type="text" id="email" />
<input type="text" id="date" />
</div>
</code></pre>
<p><code>name</code> would be first, but in that array in some cases <code>name</code> item won't exist so it won't always be the name, i hope this makes any sense :)</p>
| jquery | [5] |
3,212,671 | 3,212,672 | Where to check the color android.R.color.holo_red_light | <p>I need to know what is the color exactly which is referred by <code>android.R.color.holo_red_light</code>. Where to check it? Please advice. Thank you.</p>
| android | [4] |
1,415,929 | 1,415,930 | How do I find the number of objects that are alive in C++? | <p>I want to find the objects of a class that are currently alive in C++.
Please tell me a solution for this.
Also, please correct if my logic is wrong!</p>
<ul>
<li>Declare a global variable.</li>
<li>Increment it during the constructor invocation.</li>
<li>Decrement during destructor invocation. </li>
</ul>
<p>Thanks in advance.</p>
<p>Sanjeev</p>
| c++ | [6] |
4,251,061 | 4,251,062 | language compatibility in asp.net | <p>I'm developing one web app and for that i need to use UNICODE connect in
asp.net,
my requirement is end user can enter text in any Indian language
like Marathi,Hindi,Gujarati etc.
for e.g like "orkut" has an option that user can write text in Hindi </p>
<p>How can i do this in asp.net
please suggest me the solution with some thread links</p>
| asp.net | [9] |
3,754,084 | 3,754,085 | Parser exception for /FadeInOut/AndroidManifest.xml: The markup in the document following the root element must be well-formed | <p>I hope this error is in manifest file ,here i am placing the manifest file.error is showing at last line.
thanks in advance</p>
<pre><code><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sri.fadeinout"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
</code></pre>
| android | [4] |
1,932,921 | 1,932,922 | Instruments chart for iphone | <p>i have a doubt ..i clicked on leaks and then i can see graph now <strong>should i run application to check memory leak or it will do on its own</strong>??
and the moment my apps start after 3 secs i can see blur bar of height 0.5 that keep going?? so what should i do??
is that leak permanent (cause blue bar is static ?? but my app is running good </p>
| iphone | [8] |
4,841,057 | 4,841,058 | Get values between DIV tags? | <p>How do I get the values in between a DIV tag?</p>
<p><strong>Example</strong></p>
<pre><code><div id="myOutput" class="wmd-output">
<pre><code><p>hello world!</p></code></pre>
</div>
</code></pre>
<p>my output values I should get is </p>
<pre><code><pre><code><p>hello world!</p></pre>
</code></pre>
| javascript | [3] |
5,773,523 | 5,773,524 | Having error message (Sorry this video can't play) to play online video in VideoView | <p>Can anyone suggest me, Why this code is not working.....</p>
<pre><code>public class VideoActivity extends Activity {
/** Called when the activity is first created. */
String Link="http://www.veoh.com/watch/v18571861xWT9d7yF";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView videoView = (VideoView) findViewById(R.id.videoView1);
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(Link);
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.start();
}
}
</code></pre>
| android | [4] |
1,949,667 | 1,949,668 | c++ std::string to boolean | <p>I am currently reading from an ini file with a key/value pair. i.e.</p>
<pre><code>isValid = true
</code></pre>
<p>When get the key/value pair I need to convert a string of 'true' to a bool. Without using boost what would be the best way to do this?</p>
<p>I know I can so a string compare on the value (<code>"true"</code>, <code>"false"</code>) but I would like to do the conversion without having the string in the ini file be case sensitive.</p>
<p>Thanks</p>
| c++ | [6] |
1,808,802 | 1,808,803 | C#: Fast way to check how many UTF-8 encoded bytes thats in a StringBuffer? | <p>I'm building sitemaps and I need a way to quickly check how many UTF-8 encoded bbytes StringBuilder currently contains?</p>
<p>The naive way to do this would be to:</p>
<pre><code>Encoding.UTF8.GetBytes(builder.ToString()).Length
</code></pre>
<p>But isn't this a bit bloated?</p>
<p>Using builder.Length doesn't work as certain charactes resolved to 2 bytes such as ÅÄÖ.</p>
| c# | [0] |
5,130,596 | 5,130,597 | Android - How to apply custom Logo/image with animation as circular progress dialog in Android application? | <p>I am using Progress Dialog to show progress/working. I want to replace default spinner dialog with my own image with animation. I created a layout that contains an image view.then i created a frame animation (i.e. frame_animation.xml) in res/anim (also tried with placing in drawable folder) directory. Finally applied the frame_animation to image view. The animation is not working. I tried it with creating a new sample project and start this animation on a button then its working fine but when i am showing in application it's not working. </p>
<p>Following is the code snippet where i am using this progress dialog.</p>
<p>showProgressDialog();
searchTask = new TimerTask() {</p>
<pre><code>public void run() {
handler.post(new Runnable() {
public void run() {
// my code ......
progressDialog.cancel();
}
});
}
};
</code></pre>
<p>t.schedule(searchTask, 6000);</p>
<p>// function showProgressDialog is as follows that is being called</p>
<p>public void showProgressDialog() {</p>
<pre><code>private ProgressDialog progressDialog;
progressDialog = ProgressDialog.show(MainScreen.this, "",
"", false, false);
progressDialog.setContentView(R.layout.progressbarlayout);
inflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
progressDialog.setContentView(inflater.inflate(R.layout.progressbarlayout,null));
imgViewLoading = (ImageView) inflater.findViewById(R.id.animationImage);
imgViewLoading.setBackgroundResource(R.drawable.frame_animation);
AnimationDrawable frameAnimation = (AnimationDrawable) imgViewLoading.getBackground();
frameAnimation.start();
}
</code></pre>
<p>Any idea where i am lacking? and Thanks in advance:p</p>
| android | [4] |
2,483,707 | 2,483,708 | Site that lists which cpus, used on mobile phones, have fpu | <p>I was wondering if there is a site that lists full cpu specifications for a wide variety of mobile phones, more specifically the ones that support android.</p>
<p>I am in the process of writing an android application that requires definitely <strong>fpu</strong> and armv6 compatibility</p>
<p>Thank you in advance</p>
| android | [4] |
3,592,705 | 3,592,706 | iPhone: receiving warning on clicking uialertview cancel or other button | <h2>warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.4 (8K2)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).</h2>
<pre><code>- (void)showReminder:(NSString *)text
{
NSLog(@"alert text>>%@",text);
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Reminder"
message:text delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:@"Snooze",nil];
[alertView show];
[alertView release];
}
-(void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
NSLog(@"alert title>>%@",title);
if(buttonIndex == 0)
{
NSLog(@"Button 1 was selected.");
}
else if([title isEqualToString:@"Snooze"])
{
NSLog(@"check")
}
}
</code></pre>
| iphone | [8] |
748,628 | 748,629 | Can we create temporary pass-in `std::vector<int>` parameter? | <pre><code>void PrintNow(const std::vector<int> &v)
{
std::cout << v[0] << std::endl;
}
std::vector<int>().push_back(20); // this line generates no complains
PrintNow(std::vector<int>().push_back(20)); // error
</code></pre>
<p>From VS2010 Sp1:</p>
<blockquote>
<p>eror C2664: 'PrintNow' : cannot convert parameter 1 from 'void' to
'const std::vector<_Ty> &'</p>
</blockquote>
<p>Q> Is it possible that we can pass a temporary vector to function?</p>
| c++ | [6] |
1,889,309 | 1,889,310 | how to get all information form aspnet_Membership table in membership . Asp.net | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/12716101/add-new-field-to-the-standard-aspnet-membership-table">add new field to the standard aspnet_Membership table</a> </p>
</blockquote>
<p>i have a id from aspnet_User table</p>
<pre><code> Userid = 7360c948-b54d-4ce5-a25c-6b64c95dec9e;
</code></pre>
<p>and i want get all in formation from aspnet_Membership table with user id above</p>
| asp.net | [9] |
2,282,444 | 2,282,445 | Removing line breaks in ordered lists using jquery | <p>Am getting data from a webservice which is being displayed in the format below</p>
<p><code><ol>\r\n<li>Combine garlic, mustard, chili powder, cayenne pepper, salt and thyme in a small bowl.</li>\r\n</ol></code></p>
<p>I've been tearing my hair out trying to remove the \r\n but i cant seem to do so. Because there in between elements and not in the content most jquery functions arent working. Am trying out something like:</p>
<pre><code>$("*").each(function () {
if ($(this).children().length == 0) {
$(this).html($(this).html().replace('<ol>\\r\\n<li>','<ol><li>'));
}
});
</code></pre>
<p>Doesn't work. Any ideas?</p>
| jquery | [5] |
5,255,819 | 5,255,820 | PHP echo code not returning '0' if no results | <p>Here is the query:</p>
<pre><code>$query = "SELECT name,deleted,COUNT(message) as message FROM guestbook_message WHERE name='".$name."' AND deleted=1 GROUP BY name";
$result = mysql_query($query) or die(mysql_error());
$deletedtotal_row = mysql_fetch_array($result);
</code></pre>
<p>Here when I use it:</p>
<pre><code>echo "You have had ".($deletedtotal_row['deleted']) ? $deletedtotal_row['deleted'] : '0'." messages deleted";
</code></pre>
<p>This errors, doesn't show an syntax error, but doesn't display any results.</p>
<p>But when I use:</p>
<pre><code>echo ".$totaldeleted_row['deleted'].";
</code></pre>
<p>It works fine. But if there is no messages deleted for that user, it returns nothing, but I want it to display '0'.</p>
<p>Any ideas where I'm going wrong?</p>
| php | [2] |
4,342,287 | 4,342,288 | Access Android spell check lists | <p>I would like to access the word lists used on android phones for spell checking (not including the user-defined-dictionary).</p>
<p>I am writing an app which i would like to be able to check if a word exists in the current phone users language. I imagine their is some API call or service i can use to access the build in word lists?</p>
<p>Any help would be great, thanks!</p>
| android | [4] |
3,301,809 | 3,301,810 | Hidden JavaScript error | <p>When i navigate across the application, i get a javascript error in my taskbar but gets disapperard immediately before i can identify what is the error about</p>
<p>The error appears in IE and i don't see anything in FireBug</p>
| javascript | [3] |
1,519,844 | 1,519,845 | logging in python | <p>i want to create separate logging file in python like info.log, debug.log, error.log i have a setting file(logging.conf) for logging as given below</p>
<pre><code>[loggers]
keys=root,simpleExample
[handlers]
keys=consoleHandler
[formatters]
keys=simpleFormatter
[logger_root]
level=DEBUG
handlers=consoleHandler
[logger_simpleExample]
level=DEBUG
handlers=consoleHandler
qualname=simpleExample
propagate=0
[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=simpleFormatter
args=(sys.stdout,)
[formatter_simpleFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=
</code></pre>
<p>and i have created logging.py file as given below</p>
<pre><code>import logging
import logging.config
logging.config.fileConfig('logging.conf')
# create logger
logger = logging.getLogger('simpleExample')
# 'application' code
logger.debug('debug message')
logger.info('info message')
logger.warn('warn message')
logger.error('error message')
logger.critical('critical message')
</code></pre>
<p>but when execute logging.py file i am getting following result in consol</p>
<pre><code>2012-12-10 13:30:20,030 - simpleExample - DEBUG - debug message
2012-12-10 13:30:20,031 - simpleExample - INFO - info message
2012-12-10 13:30:20,032 - simpleExample - WARNING - warn message
2012-12-10 13:30:20,032 - simpleExample - ERROR - error message
2012-12-10 13:30:20,033 - simpleExample - CRITICAL - critical message
</code></pre>
<p>as i have told i want to create separate file in log.info, debug.info, error.info.
thanks in advance</p>
| python | [7] |
2,682,843 | 2,682,844 | overload two methods with vararg and String[] parameter | <p>I want overload two method with one parameter, in a method <code>varargs</code> of String and another <code>String[]</code> but I achieve following compilation-time error:</p>
<pre><code>Duplicate method registerByName(String...)
</code></pre>
<p>My snippet code is:</p>
<pre><code>public void registerByName(String[] names)
{
}
public void registerByName(String...names)
{
}
</code></pre>
<p>Why?</p>
| java | [1] |
4,763,774 | 4,763,775 | java.lang.arrayindexoutofboundsexception array index out of range: 0 In Android | <p>I have a method to get data from webservice</p>
<pre><code>public String getCinema_Show(String mv){
final String SOAP_ACTION = "http://tempuri.org/getDataCinema_Show";
final String METHOD_NAME = "getDataCinema_Show";
final String NAMESPACE = "http://tempuri.org";
final String URL = "http://10.0.2.2:10658/dataphim/Service.asmx";
SoapObject table =null;
SoapObject client =null;
SoapObject tablerow=null;
SoapObject responeBody =null;
SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
//request.addProperty("movies",mv);
SoapSerializationEnvelope envelop = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelop.addMapping(NAMESPACE, "test",this.getClass() );
envelop.dotNet=true;
envelop.setOutputSoapObject(request);
HttpTransportSE httptran = new HttpTransportSE(URL);
try
{
client = new SoapObject(NAMESPACE, METHOD_NAME);
client.addProperty("movies",mv);
envelop.setOutputSoapObject(client);
envelop.bodyOut = client;
httptran.call(SOAP_ACTION, envelop);
responeBody = (SoapObject) envelop.getResponse();
responeBody = (SoapObject) responeBody.getProperty(1);
table = (SoapObject) responeBody.getProperty(0);
tablerow = (SoapObject) table.getProperty(0);
rap = tablerow.getProperty("CINEMASNAME").toString();
//Cinema_List.add(rap);
return rap;
} catch (Exception e)
{
System.out.print("Loi "+ e.toString());
rap=e.toString();
return rap;
}
}
</code></pre>
<p>"client.addProperty("movies",mv);" i try to send String to Webservice but i cant reci</p>
<p>When i run project, show "java.lang.arrayindexoutofboundsexception array index out of range: 0"
Please help me</p>
| android | [4] |
1,898,587 | 1,898,588 | Is it possible to read/edit shared preferences in native code? | <p>I have an Android app that includes a C library using NDK to execute some some code. Within the C library I would like to update the applications shared preferences. My question... is it possible to read/edit shared preferences in native code?</p>
| android | [4] |
4,420,421 | 4,420,422 | how to send text from textarea in to the HTML code while typing | <p>how to send text from textarea in to the HTML code while typing ?<br/>
i would like send text from textarea in to the HTML code and then send it to some div, i using this to live prev</p>
<pre><code>$("#par01par03text textarea").keyup(function(event) {
var stt=$(this).val();
$("#par01Text").text(stt);
});
</code></pre>
<p>sending from here</p>
<pre><code><div class="inputWraper clearfix">
<input type = "radio" name = "wykladzina" id = "par01par03" value = "" />
<label id="par01par03Label" for = "par01par03">Inne:</label>
<p id="par01par03text" class="formP"><textarea></textarea></p>
</div>
</code></pre>
<p>to here</p>
<pre><code><p id="par01Text"></p>
</code></pre>
<p>but i would like to send it in to the HTML code too<br/>
do help me pls</p>
| jquery | [5] |
1,298,743 | 1,298,744 | Problem separating .h and .cpp file | <p>I am writing a class and need to separate the declarations from the implementation, but I keep receiving "undefined reference" errors when compiling and linking my test program. It works fine when I include the implementation in the .h file, so I believe I am doing something wrong in there. I just can't figure out what.</p>
<p><strong>Huge_Integer.h</strong></p>
<pre><code>#ifndef HUGE_INTEGER_H
#define HUGE_INTEGER_H
#include <vector>
#include <string>
using namespace std;
class Huge_Integer
{
public:
Huge_Integer();
Huge_Integer(string);
void input();
string output();
void add(Huge_Integer);
void subtract(Huge_Integer);
bool is_equal_to(Huge_Integer);
bool is_not_equal_to(Huge_Integer);
bool is_greater_than(Huge_Integer);
bool is_less_than(Huge_Integer);
bool is_greater_than_or_equal_to(Huge_Integer);
bool is_less_than_or_equal_to(Huge_Integer);
private:
vector<int> value;
};
#endif
</code></pre>
<p><strong>Huge_Integer.cpp</strong></p>
<pre><code>#include<vector>
#include<string>
#include<iostream>
#include "Huge_Integer.h"
using namespace std;
// all stubs for now...
Huge_Integer::Huge_Integer()
{
cout << "object created\n";
}
Huge_Integer::Huge_Integer(string s)
{
cout << "object created\n";
}
//etc...
</code></pre>
<p>It also works if I put <code>#include "Huge_Integer.cpp"</code> in my test file, but I shouldn't have to do that, right?</p>
<p>I am using MinGW.</p>
<p>Thanks in advance!</p>
<p>Edit: Added stubs from my .cpp file</p>
| c++ | [6] |
3,863,339 | 3,863,340 | Getting php data from admin panel, without inserting in database and sessions | <p>I have a website and an administrator panel. I need to take some data from the administrator panel fields and show it on the homepage.</p>
<p>For example: on the homepage there is a <code>text block</code> and on the administrator panel there is a <code>input</code> form. I fill it in, press submit, it saves everything (shows current text on form and on homepage). With a database it would be very easy, but this time I can't use database. Is there any alternative choice that I could use instead of saving it to a database?</p>
| php | [2] |
1,303,541 | 1,303,542 | insert/delete query design of website | <p>I wonder what would be the professional way to handle insert/delete requests of a website?</p>
<p>Right now, what I have is I inserted two <code><input type = "hidden"/></code> on each form where one hidden's value correspond to a function it needs and the other is the parameter of this function. So when the form submits, I have a post.php file that handles ALL insert/delete requests that simply invokes the value of the hiddens via <code>call_user_func()</code> in PHP. Like so:</p>
<pre><code><input name = "arg" value = "{$id}" type = "hidden"/>
<input name = "call" value = "delete_member" type = "hidden"/>
call_user_func($_POST['call'], $_POST['arg']);
</code></pre>
<p>I'm having doubts on how sensible this solution is because I found out that the hiddens aren't actually hidden in the source on the client-side.</p>
<p>My first solution was to basically have a lot of conditionals checking for which function to invoke but I really hated that a lot so I changed it with this solution.</p>
<p>I wonder what are the better ways I can do this, or maybe how the professionals do it? Handling insert/delete queries.</p>
| php | [2] |
3,346,792 | 3,346,793 | sending email to users contact list? | <p>i have an application to retrieve an users contact list in a gridview...how do i send email to all the users from the users contact list??</p>
<p>Steps:-</p>
<p>1.User enters hi/her email id and password.
2.Clicks on send invites.
3.The button click event should send invitation email to all the contacts in users contact list.[ how to do the 3rd step??] </p>
| asp.net | [9] |
2,800,104 | 2,800,105 | How to get UIButton Target, Action and Control events? | <p>I am using UIImageView's with UIButtons a whole bunch. So, I created a custom class to permanently marry these two an make things a little simpler. It all works well until I decided to implement -(id)initWithObject:(AUIImageViewButton *) imageViewButton.</p>
<p>Clearly I need to copy all relevant properties from the imageViewButton object being passed. The UIImageView is not problematic at all. Something like this deals with it:</p>
<pre><code>imageview = [[UIImageView alloc] initWithFrame:imageViewButton.imageview.frame]; // Copy all relevant data from the source's imageview
[imagebutton.imageview setBackgroundColor:imageViewButton.imageview.backgroundColor]; //
[imagebutton.imageview setImage:imageViewButton.imageview.image]; //
</code></pre>
<p>Most of the button stuff is also readily available:</p>
<pre><code>button = [UIButton buttonWithType:imageViewButton.button.buttonType]; // Copy all relevant data from the source's button
button.frame = imageViewButton.imageview.frame; //
[button setTitle:imageViewButton.button.titleLabel.text forState:UIControlStateNormal]; //
button.tag = imageViewButton.button.tag; //
</code></pre>
<p>I am having a little trouble figuring out how to get all the data for the addTarget:action:forControlEvents method.</p>
<p>Looking at the docs I can see that I might be able to use UIControl's allControlEvents and allTargets methods. I'll dig into that right now and see how much trouble I can get into. The one I am not sure about is the action. </p>
<p>Can anyone give me a shove in the right direction?</p>
<p>Thanks,</p>
<p>-Martin</p>
| iphone | [8] |
2,280,417 | 2,280,418 | How to develop a PDF viewer without using third party libraries in android | <p>I want to develop a PDF viewer in android.I dont want to use any 3rd party libraries like PDFBox,iText...Is it possible in android?</p>
| android | [4] |
1,893,068 | 1,893,069 | About Limiting Rss Feed | <p>I want only the latest 5 feeds to be shown on my website.<br>
I am using the following code to fetch rss feed... Can any one help to limited feeds to be shown... Thank You In ADVANCE :)</p>
<p>CODE THAT AM USING</p>
<pre><code><?php
require_once('rss_fetch.inc');
$url = 'http://news.google.com/news?ned=us&topic=h&output=rss';
$rss = fetch_rss($url);
echo "Site: ", $rss->channel['title'], "<br>\n";
foreach ($rss->items as $item ) {
$title = $item['title'];
$url = $item['link'];
$desc = $item['description'];
$category = $item['category'];
echo "<a href=$url>$title</a>$desc <br/>CATEGORY : $category <br/><br/> ";
}
?>
</code></pre>
| php | [2] |
527,627 | 527,628 | Detecting horizontal swipe in ListView | <p>I need to detect a horizontal swipe within a list view. Should I use a gesture detector or onTouch event. I need to support Android 2.1+</p>
<p>One post indicated the need to override onInterceptTouchEvent in the ListView like below:</p>
<pre><code> @Override public boolean onInterceptTouchEvent(MotionEvent ev) {
switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: // reset difference values mDiffX = 0; mDiffY = 0;
mLastX = ev.getX();
mLastY = ev.getY();
break;
case MotionEvent.ACTION_MOVE:
final float curX = ev.getX();
final float curY = ev.getY();
mDiffX += Math.abs(curX - mLastX);
mDiffY += Math.abs(curY - mLastY);
mLastX = curX;
mLastY = curY;
// don't intercept event, when user tries to scroll vertically
if (mDiffX > mDiffY) {
return false; // do not react to horizontal touch events, these events will be passed to your list item view
}
}
return super.onInterceptTouchEvent(ev);
}
</code></pre>
<p>Not sure if this works or is the best way however. It did not help that the question was mindlessly closed 8 days ago: <a href="http://stackoverflow.com/questions/11647276/swipe-gesture-inside-listview-android?rq=1">Swipe Gesture inside ListView - Android</a></p>
| android | [4] |
4,692,950 | 4,692,951 | Scrolling a ListView changes everything from White to Black | <p>I have a custom list view and I want the background of the list to be white, so I do something like this which works great.</p>
<pre><code>listView = (ListView) this.findViewById(R.id.listview);
listView.setBackgroundColor(Color.WHITE);
</code></pre>
<p>The problem is when you scroll the list the background of all the list items changes to black, which looks horrible.</p>
<p>I tried in my list view setting the background color to white. When I inflate the view I also tried setting the background color to white:</p>
<pre><code>view.setBackgroundColor(Color.WHITE);
</code></pre>
<p>Both of these fix the problem of the scrolling background color, but now the item doesn't appear to be clickable even though it is. What I mean by that is the onClick still works fine, but the background doesn't flash to orange to let the user know he clicked it.</p>
<p>How can I have a white background in a list view, that stays white while scrolling, and does the normal list acitvity orange click background?</p>
<p>Thanks!</p>
| android | [4] |
3,910,116 | 3,910,117 | How i can use a static field to keep track of how many objects have been created from a particular class | <p>iam using c# and have a question,how the static field is used to count the number of instances in a class,please calrify in terms of memory,thanks in advance.</p>
| c# | [0] |
412,620 | 412,621 | How to add numbers in an editText | <p>I am new to java dev. I want to add numbers in an editText.
i.e if user types in 15 in editText, it should add the numbers 1 + 5 giving the result 6.
Is there a function for it in java. In C# it is ToCharArray() but I don't know what it's called in java.
Thanks</p>
| java | [1] |
3,435,889 | 3,435,890 | Intensive PHP script failing w/ "The timeout specified has expired" error / ap_content_length_filter | <p>Running a MySQL intensive PHP script that is failing. Apache log reports this:</p>
<pre><code>[Wed Jan 13 00:20:10 2010] [error] [client xxx.xx.xxx.xxxx] (70007)
The timeout specified has expired:
ap_content_length_filter: apr_bucket_read() failed,
referer: http://domain.com/script.php
</code></pre>
<p>Tried putting <code>set_time_limit(0)</code> at the top.</p>
<p>Also tried <code>set_time_limit(0)</code></p>
<p>Neither fixed the timeout. </p>
<p>Is there some specific timeout limit I can up in <code>http.conf</code> (or elsewhere) to prevent this? </p>
| php | [2] |
5,345,630 | 5,345,631 | communication between javascript and C++ code through web sockets? | <p>I have javascript (client - executed through node.js) and C++ (server) code running on Ubuntu (Linux) and I want this client-server to communicate with each other. Can somebody tell me how I can make C++ code work like a server or client using web socket? Basically, I want javascript code to send some data to C++ code, the C++ code will process on the data and return the result back to javascript code. I'm not sure if I this communication between javascript and C++ code can happen with out web socket. Any pointers in this direction would be of great help!</p>
<p>Thanks,
pats</p>
| c++ | [6] |
5,285,174 | 5,285,175 | how to convert timestamp string to java.util.Date | <p>I need to convert a timestamp string to <code>java.util.Date</code>. E.g.:</p>
<p><code>MMDDYYHHMMSS</code> to <code>MM-DD-YY HH-MM-SS</code></p>
<p>Where <code>MM</code> is month, <code>DD</code> is date, <code>YY</code> is year, <code>HH</code> is hours, <code>MM</code> is minutes and <code>SS</code> is seconds.</p>
| java | [1] |
5,300,584 | 5,300,585 | sjquery scroll+animation | <p>I have a problem with jQuery vertical scroll.</p>
<p>I have to add some animation on this example : </p>
<pre><code>$(document).ready(function() {
var timeoutId = 0;
function scrollIt(amount) {
$('#scroller').scrollTop($('#scroller').scrollTop()+amount);
}
$('#down').mousedown(function () {
timeoutId = setTimeout(scrollIt(5), 1000);
}).bind('mouseleave', function () {
clearTimeout(timeoutId);
});
$('#up').mousedown(function () {
timeoutId = setTimeout(scrollIt(-5), 1000);
}).bind('mouseleave', function() {
clearTimeout(timeoutId);
});
});
</code></pre>
<p>Here is a fiddle : <a href="http://jsfiddle.net/TPKDG/1/" rel="nofollow">http://jsfiddle.net/TPKDG/1/</a></p>
<p>and I don't know how :(</p>
<p>where I have to add .animation()?</p>
<p>Thank's a lot for help</p>
| jquery | [5] |
989,305 | 989,306 | whether meta tag will support phonegap using android | <p>I am new to phonegap .I am developing application using android using phone gap.I had given meta tag in html .In landscape mode its coming properly but potrait mode some spaces are coming can anybody help to solve problem? </p>
<pre><code><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
</code></pre>
<p>Thanks</p>
| android | [4] |
3,763,099 | 3,763,100 | Check whether a path is valid in Python | <p>Is there any easy way to check whether a path is valid? The file doesn't have to exist now, I'm wondering if it could exist.</p>
<p>my current version is this:</p>
<pre><code>try:
f = open(path)
except:
<path invalid>
</code></pre>
<p>I'm considering simply checking whether the path contains any of <a href="http://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words" rel="nofollow">these</a> characters.</p>
| python | [7] |
2,988,333 | 2,988,334 | javascript function | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1639180/how-does-the-function-construct-work-and-why-do-people-use-it">How does the (function() {})() construct work and why do people use it?</a> </p>
</blockquote>
<p>Hi, </p>
<p>Learning javascript I came across with this function.</p>
<pre><code><script language = "javascript">
(function( window, undefined ) {
})(window);
</script>
</code></pre>
<p>Wondering what type of funcion is this one and how I can call it.</p>
<p>Thanks.</p>
| javascript | [3] |
1,618,958 | 1,618,959 | How to make this auto-sliding effect on iOS | <p>I'm new on iPhone. Could you please tell me how to make an auto-sliding effect like this? Thanks.
Pic: <a href="http://i.stack.imgur.com/5rDBJ.png" rel="nofollow">http://i.stack.imgur.com/5rDBJ.png</a></p>
| iphone | [8] |
3,191,068 | 3,191,069 | how to send an activation code to the user in create user wizard? | <p>I wanted to verify the user who is registering on My Website(using Create User Wizard ) by sending them a code on their E-Mail ID given at registration time...and they will have to use that code to activate his account.
could u please help me with this
Thanks</p>
| asp.net | [9] |
636,687 | 636,688 | How to pass the value for one aspx to another aspx page | <pre><code><form id="form1" runat="server">
<div>
<asp:TextBox ID="txtFirstName" runat="server">
</asp:TextBox>
<asp:TextBox ID="txtLastName" runat="server">
</asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="RedirectPage" PostBackUrl="~/TestAjaxControls.aspx?FirstName=txtFirstName&LastName=txtLastName" />
</div>
</form>
</code></pre>
<p>I need to access the firstname & lastname value to the next page</p>
| asp.net | [9] |
3,842,636 | 3,842,637 | Array contents equality in C++ | <p>Is there a way to get the equality operators to work for comparing arrays of the same type?</p>
<p>For example:</p>
<pre><code>int x[4] = {1,2,3,4};
int y[4] = {1,2,3,4};
int z[4] = {1,2,3,5};
if (x == y) cout << "It worked!"
</code></pre>
<p>I'm aware that as is, it's just comparing pointer values - but I was hoping there's some kind of typedef trick or something like that so it wouldn't need a loop or a memcmp call.</p>
| c++ | [6] |
216,481 | 216,482 | Java: generics type | <p>Class B extends from class A, and G is generics class. Now -</p>
<pre><code>G<X> g = new G<B>();
</code></pre>
<p>If I'm not wrong, then X can be:</p>
<pre><code>? extends A
</code></pre>
<p>or</p>
<pre><code>? super B
</code></pre>
<p>My question: Why X can't be simply <code>A</code>. B extends from A, so that seems correct. Where am I wrong?</p>
| java | [1] |
5,610,235 | 5,610,236 | How to use htmlspecialchars_decode in PHP | <p>I am a inserting a content in FCKEDITOR.</p>
<p><strong>EXAMPLE Content</strong> : TEST ~!@#$%^&*()_+| TEST</p>
<p><strong>But i get the output like this</strong>: TEST ~!@')</p>
<p>What should i do to get the exact output?</p>
<p>I am using ajax to do this.</p>
<p>Thanks.</p>
<p>Fero</p>
| php | [2] |
2,179,380 | 2,179,381 | How to compare two 24 hour time | <p>I have two 24-hour time values and want to compare them using PHP. </p>
<p>I have tried the following:</p>
<pre><code>$time="00:05:00"; //5 minutes
if($time1<='00:03:00')
{
//do some work
}
else
{
//do something
}
</code></pre>
<p>Is this the correct way to compare 2 time values using PHP?</p>
| php | [2] |
2,557,302 | 2,557,303 | jQuery: get inline style top position value into a variable | <p>The style attribute always stumps me, because there are many values in the style attribute. Anyway, please see below my markup I'm trying to adjust...</p>
<pre><code><div class="fancybox-wrap fancybox-default fancybox-opened" tabindex="-1" style="width: 798px; height: 542px; position: fixed; top: 82px; left: 20px; display: block; ">
</code></pre>
<p>As you can see I am trying to adjust the style: top: 82px; value. How can I get this value so I can add a value onto of it? Please see below the instance in how I am using this.</p>
<p>I would like the <code>currentTop</code> variable to some how get the current top inline position of the <code>.fancybox-wrap</code> div?</p>
<pre><code>$("a.gallery-thumb").fancybox({
afterLoad : function() {
FB.Canvas.getPageInfo(function(info) {
var scrollPosition = info.scrollTop,
currentTop = /* how can I get the current top inline position? */ ;
$('.fancybox-wrap').css('top', (scrollPosition + currentTop) + 'px');
});
}
});
</code></pre>
| jquery | [5] |
1,883,870 | 1,883,871 | Java : Storing Data in Array Of Object from JOptionPane Dialog | <p>I need to know how I can insert data inside objects inside an array of objects using my already made Set methods.</p>
<p>i need to know how should i do it through user , i mean JOptionPane input dialog</p>
<pre><code>student[] s = new student[5];
for (int i=1 ; i <= s.length ;i++) {
s[i] = new student(i,"AAA","Ecommerce",0.0);
}
for (int i=1; i<=s.length;i++) {
name = JOptionPane.showInputDialog("Please Write Name for student n " + i);
major = JOptionPane.showInputDialog("Please Write Major for student n " + i);
gpa = Double.parseDouble(JOptionPane.showInputDialog("Please Write GPA for student n " +i));
s[i] = new student(i,name,major,gpa);
}
</code></pre>
<p>I tried to do vars here that get data from user by JOptionPane, but it seems that i only use my already made constructor , not the Set methods.</p>
<p>I need to use the methods because it has some validation code inside it.</p>
<p>Any ideas?</p>
| java | [1] |
5,502,983 | 5,502,984 | Dynamically add checkBoxPreference to PreferenceFragment | <p>I need to display a directory listing of files and folders that I get of an API. Once a user clicks on one of the directories I look for its sub directories and list them under the parent one just to the right, and so it goes on. <strong>Not Sure what the best way is for this?</strong></p>
<p>I made a settings view and Have a "Directories" setting. Once you click on it I need to load the sub directories in the PreferenceScreen. And the user must be able to drill down into the sub directories and select the ones he wants with something like a <strong>checkBoxPreference</strong></p>
<p>So In the end I can make up a list of Checked Directories.</p>
<p><strong>MY IDEAS</strong></p>
<ol>
<li>Show folders, once user clicks on a folder, slide the sub folders into view, and so on.</li>
<li>Show folders, once user clicks on a folder, show the subfolders just below the parent folder, moving the children little to the right.</li>
<li>Show the folders that was selected as <strong>checkBoxPreferences</strong>, and have a button to start a new view that the user selects the folders from</li>
</ol>
<p>I am really new to Android dev and not sure how I would implement any of these?</p>
<p>Can you please direct my in some direction so I may try it? Im not asking for a code example, just a logical explanation of some possible methods or ideas?</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.