Unnamed: 0
int64 65
6.03M
| Id
int64 66
6.03M
| Title
stringlengths 10
191
| input
stringlengths 23
4.18k
| output
stringclasses 10
values | Tag_Number
stringclasses 10
values |
---|---|---|---|---|---|
2,697,135 | 2,697,136 |
Displaying dynamic data on a form
|
<p>I have created a form that contains various Jtextfields to display data. The data comes from an internet source and changes very frequently (every few seconds). I'm not sure the best way about doing it.</p>
<p>So far I have a class that retrieves the data upon request and stores the data locally. The data then can be retrieved using the getters and a timer.</p>
<p>eg.</p>
<pre><code> class Grabber(){
static String data;
static void update(String source){
//update data from source
}
static String getData(){
return data;
}
}
</code></pre>
<p>Then in the form file, MyForm.java I have:</p>
<pre><code> Timer timer = new Timer(2000, performUpdate);
timer.start();
....
ActionListener performUpdate = new ActionListener(){
public void actionPerformed(ActionEvent evt){
Grabber.update();
jTextField1.setText(Grabber.getData());
}
};
</code></pre>
<p>I believe this would work, but I'm not sure if this is the best way to do it and I just want to check I'm not doing something stupid. I thought about having the timer inside the Grabber function, and then calling a function inside MyForm <code>updateData(String data)</code> I think this would be nicer, but then it adds a dependency on the GUI which doesn't seem right.</p>
<p>Another issue is that I intend to have a few sources. Performing the updates in my proposed manner would require serial internet requests which may be better done in parallel? I would like the data to be as up to date as possible. </p>
<p>Apologies if this is not a typical question, but I'm just looking for other ideas on how to implement this.</p>
|
java
|
[1]
|
329,955 | 329,956 |
PHP code to be executed only once
|
<p>I have a php code I want to execute only once, that is it it should get loaded when it is getting installed for the first time, and the second time it should not execute. I tried with <code>for</code> and <code>if</code> condition but it didn't work for me.</p>
<p>This is my code: </p>
<pre><code>$table = self::checkTablesExist();
if(empty($table)) {
self::createTables();
self::createRootUser(self::$preflight_config);
if(self::$preflight_config->sample_data == 1) {
self::installSampleData();
}
}
</code></pre>
|
php
|
[2]
|
467,851 | 467,852 |
load another html into div with jquery
|
<p>can aynyone tell me what i'm doing wrong? The demo page, only with: "hello" word, cant show inside <code>#container</code></p>
<pre><code><div id="galeria_oculta">
<div id="container">
</div>
</div>
<div id="wrapper">
<a href="#" id="exibe_galeria">click here</a>
</div>
</code></pre>
<p>here the jquery code:</p>
<pre><code>$(document).ready(function() {
$('#galeria_oculta').hide();
$('#exibe_galeria').click(function(e) {
$('#galeria_oculta').show();
$('#container').load('demo.html');
e.preventDefault;
return false;
});
$('#close_galeria').click(function(e) {
$('#galeria_oculta').hide();
e.preventDefault;
return false;
});
});
</code></pre>
|
jquery
|
[5]
|
676,543 | 676,544 |
How to display an image when pressing a button in html?
|
<p>I thought doing something like this would have worked, but I'm confused as to why it isn't when the style is hiding the image to begin with, but not showing it when the button is pressed. Here's the code:</p>
<pre><code>function showImg() {
x=document.getElementById("map_img")
x.style.visibility="visible";
}
<body>
<img id="map_img" src="map.jpg" style="visibility:hidden" width="400" height="400"/>
<form id="form1" name="form1" align="center">
<input type="submit" id="Map" value="Map" onclick="showImg()"/>
</form>
</code></pre>
<p>I've also tried this in both situations:</p>
<pre><code><input type=button id="Map" value="Map" onclick="showImg()"/>
</code></pre>
<p>and:</p>
<pre><code><style>
.hidden{display:none;}
.show{display:block;}
</style>
function showImg() {
x=document.getElementById("map_img")
x.class="show";
}
<body>
<img id="map_img" src="map.jpg" class="hide" width="400" height="400"/>
<form id="form1" name="form1" align="center">
<input type="submit" id="Map" value="Map" onclick="showImg()"/>
</form>
</code></pre>
<p>I'm really lost as to how neither of these worked, could I get some help on this please?</p>
|
javascript
|
[3]
|
1,960,208 | 1,960,209 |
Find out what stage of the life cycle a control is up to in ASP.NET WebForms
|
<p>From the outside of a control, is it possible to find out what stage of the Page LifeCycle (Init, Load, PreRender etc), a particular control or page is up to?</p>
<p>For example, in pseudo code:</p>
<pre><code>if myControl.CurrentLifeCycle == Lifecycle.Init
{ do something }
</code></pre>
|
asp.net
|
[9]
|
4,123,747 | 4,123,748 |
Error in Calculating sum of particular column
|
<p>i am here with another problem in my code since i am new to java. my task is to read a text file that contains some 300 records and record has 13 fields . i am trying to calculate the sum of each field for example, if age is my first field them sum of the age of all 300 people and then store it in an array index. </p>
<pre><code>import java.io.*;
import java.util.Vector;
public class Mean
{
private static Vector contents;
private static BufferedReader br;
private static FileInputStream inputstream;
private static FileOutputStream outputstream;
public Mean()
{
contents = new Vector();
}
public void doDuplicationRemoval(String filename)
{
try{
inputstream = new FileInputStream(filename);
br = new BufferedReader(new InputStreamReader(inputstream));
String string = "";
while((string = br.readLine())!= null)
{
String[] split = string.split(",");
Vector vector = new Vector();
for(int i=0; i<split.length; i++)
vector.add(split[i].trim());
if(!vector.contains("?"))
{
contents.add(split);
}
}
}
catch(Exception err){
System.out.println(err);
}
}
public void doDataConv(String filename)
{
DataConversion.readFile(contents);
DataConversion.writeFile(filename);
}
public static void doDataConversion(Vector contents)
{
DataConversion.readFile(contents);
for(int i=0; i<contents.size(); i++)
{
String string = "";
String[] split = (String[])contents.get(i);
split[0] += getAge(split[0]);
System.out.println(split[0]);
}
}
private static String getAge(String src)
{
String age = src;
return age;
}
public static void main(String [] args) {
Mean dr;
dr = new Mean();
dr.doDuplicationRemoval("input.txt");
dr.doDataConv("inp_out.txt");
dr.doDataConversion(contents);
}
}
</code></pre>
<p>the input is<br>
63<br>
67<br>
50 </p>
<p>my aim is to get output as 180</p>
<p>but am getting<br>
6363<br>
6767<br>
5050 </p>
<p>can someone help me to fix the problem.</p>
|
java
|
[1]
|
2,207,098 | 2,207,099 |
Making my application crash more gracefully
|
<p>I have an app that is running pretty stably (no more crashes actually), but as everybody knows your program crashes as soon as it gets in the hands of somebody else :D</p>
<p>What I would like is to find a(all) the place(s) where I can put a try{}catch(){} to be able catch and control what happens when the app crashes unexpectedly (display a better message, send log, possible recovery...)</p>
<p>I know its surely not that simple but still it would be good if there was a way to catch most of them.</p>
<p>(for example there is a small bug in GLSurfaceView that when it is being closed causes sometimes to crash because of an EGL swap buffer)</p>
<p>any ideas? </p>
|
android
|
[4]
|
2,288,395 | 2,288,396 |
flush out buffer into file
|
<pre><code>int main()
{
string line;
char buff[10];
for(int i=0; i<10;i++)
{
cin.get(buff[i]);
cout.put(buff[i]);
if(i==10)
{
ofstream file;
file.open("TEXT",ios::out);
for (i=0 ; i<10 ;i++)
file << buff[i] << endl;
file.close();
}
}
}
</code></pre>
<p>this code is not flushing the data from array to file and even file is also not created...</p>
|
c++
|
[6]
|
3,393,140 | 3,393,141 |
Free memory from process space
|
<p>following is the code:</p>
<pre><code>class x
{
int k;
};
int main()
{
x *p=new x[1000000];
return 0;// can be 1 too
}
</code></pre>
<p>now question is when we come out of the main function the memory allocated is freed by compiler calling destructor or it is freed by the operating system as process will no longer exist.?</p>
|
c++
|
[6]
|
2,561,270 | 2,561,271 |
How do I make links in a textview clickable inside a listview
|
<p>How can I make links in a textview clickable inside a listview When I use auto link ="web" I cant click the list item . It goes directly to the web url .I am fetching online contents. How can I resolve this issue. Any help please.. </p>
|
android
|
[4]
|
91,466 | 91,467 |
rating system without reloading a page
|
<p>i have a page on which i have some rating function like people who like the post can rate up or who don't can rate down.</p>
<p>on that link im calling a php file with some parameters passed in the anchor tag. Then in that php file im saving that rating with +1 or -1 (whichever is the case) in the database and after doing that im redirecting to that first page from where we have rated.
Now this whole function is reloading my whole page which i dont want.Is there any way with which i can do this rating without reloading the page,i want that when a person clicks on rate then just after click the rating should be shown according to what the user just did(+ or -) and that too without reloading the whole page.Is there any way to do that in php???????</p>
|
php
|
[2]
|
4,769,508 | 4,769,509 |
Get co-ordinates touch screen in a background service
|
<p><br>
I'm just wondering to know if a can with a background service have co-ordinates of a touch screen event in all activities.<br>
Such like that<br>
<pre><code>
*final TextView textView = (TextView)findViewById(R.id.textView);
final View touchView = findViewById(R.id.touchView);
touchView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
textView.setText("Touch coordinates : " +String.valueOf(event.getX()) + "x" + String.valueOf(event.getY()));
return true;}</pre></code>
but without any view by default.<br>
Thanks</p>
|
android
|
[4]
|
4,442,133 | 4,442,134 |
Error "Phones cannot be resolved or is not a field" while developing sms sending application in android?
|
<pre><code>import android.app.Activity;
import android.database.Cursor;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Contacts;
import android.widget.SpinnerAdapter;
import android.widget.SimpleCursorAdapter;
class OldContactsAdapterBridge extends ContactsAdapterBridge {
SpinnerAdapter buildPhonesAdapter(Activity a) {
String[] PROJECTION=new String[]
{
Contacts.Phones._ID,Contacts.Phones.NAME,Contacts.Phones.NUMBER
};
String[] ARGS={String.valueOf(Contacts.Phones.TYPE_MOBILE)};
Cursor c=a.managedQuery(Contacts.Phones.CONTENT_URI,PROJECTION,Contacts.Phones.TYPE+"=?", ARGS,Contacts.Phones.NAME);
SimpleCursorAdapter adapter=new SimpleCursorAdapter(a,android.R.layout.simple_spinner_item,c,new String[]
{
Contacts.Phones.NAME
},new int[]
{
android.R.id.text1
});
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
return(adapter);
}
}
</code></pre>
<p>this is my code OldContactsAdapterBridge class.but it gives error like
"Phones cannot be resolved or is not a field"...i am not getting this error,please help me to remove this. at every .phone it gives me error..</p>
<p>Thanks in Advance----</p>
|
android
|
[4]
|
1,754,852 | 1,754,853 |
Delete confirmation button in UITableView overlaps the content
|
<pre><code>- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *LogCellId = @"LogCellId";
UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:LogCellId];
UILabel *lblSummary;
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:LogCellId] autorelease];
lblSummary = [[[UILabel alloc] initWithFrame:CGRectMake(10.0, 10.0, 320.0, 30.0)] autorelease];
lblSummary.font = [UIFont fontWithName:@"Helvetica-Bold" size:14];
lblSummary.tag = SUMMARY_TAG;
lblSummary.lineBreakMode = UILineBreakModeTailTruncation;
lblSummary.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
[cell.contentView addSubview:lblSummary];
} else {
lblSummary = (UILabel *)[cell viewWithTag:SUMMARY_TAG];
}
lblSummary.text = [self.logList objectAtIndex:[indexPath row]];
return cell;
}
</code></pre>
<p>What I have there is just a simple cell with one label. I have added swipe-to-delete functionality but the delete button overlaps the label, not pushing it to side.</p>
<p>So I need help. I would appreciate an answer on how I would do this one and also how the autoresizing masks work. I do not feel comfortable with them at all, neither when or where I should use the autoresizing subviews. </p>
<p>Thank you for your time. </p>
|
iphone
|
[8]
|
2,372,357 | 2,372,358 |
Name of PHP function
|
<p>Is there a PHP function that replaces <code>-</code> with <code>_</code> (underscores) ?</p>
<p>Like </p>
<pre><code>my-name
</code></pre>
<p>with </p>
<pre><code>my_name
</code></pre>
|
php
|
[2]
|
4,778,033 | 4,778,034 |
How to count elements inside an element specified by object?
|
<p>I bet this has a simple answer.</p>
<p>I want to count the number of TD elements inside a row, yet i can't seem to find the right syntax.</p>
<pre><code>var row = $('#album_cell'+currentCell).parent();
var n = $("td",row).length();
</code></pre>
<p>This returns an error obviously as i don't know how to specify that. Any help?</p>
|
jquery
|
[5]
|
2,758,217 | 2,758,218 |
how to change ListPreference default starting position
|
<p>I have a <code>ListPreference</code> that allows a user to select from a long list of items. (Only one item can be selected). When I re-open the list, the view defaults to showing the previously selected item at the top of the screen.</p>
<p>I was wondering if it was possible to enforce that the default position is always the top of the list, regardless of what item has been chosen.</p>
<p>edit - it seems like I will have to use a <code>ListActivity</code> and implement the preference changing capabilities myself?</p>
|
android
|
[4]
|
1,752,938 | 1,752,939 |
resize iframe dynamically in ASP
|
<p>I want to display my page inside another page via Iframe.<br />
The problem is that the iframe doesn't resize automatically (height).</p>
<p>How can I resize it automatically? Or maybe there is better way to display one page inside another?</p>
|
asp.net
|
[9]
|
4,913,988 | 4,913,989 |
Object could not be converted to string
|
<p>The global variable is a class (object) already defined earlier</p>
<pre><code>class Users
{
private $sql;
public function __construct() {
global $sql;
$this->$sql = $sql;
}
}
</code></pre>
<p>I'm trying to assign the object to a private variable in my other class (Users) so I don't have to use this line <code>global $sql;</code> through all the functions in <code>Users</code> but it's giving me this error:</p>
<p><code>Catchable fatal error: Object of class Bdcon could not be converted to string in /home/<<NAME>>/public_html/<<NAME>>/classes/class.users.php on line 8</code></p>
|
php
|
[2]
|
2,748,311 | 2,748,312 |
How to create a separate time picker class
|
<p>I created the time picker. But in my project, I have required to insert four time picker into the EditText fields.When clicking on the EditText,It will prompt thedailog to set the time.Its so lengthy to create the time picker in the Activity class.So I want to create a separate time picker class. I created the TimePickerClass, but it shows error.
Please help me. </p>
<pre><code>package com.sample.uiscreen;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.view.View;
import android.widget.EditText;
import android.widget.TimePicker;
public class TimePickClass {
private int mHour;
private int mMinute;
EditText time;
public static final int TIME_DIALOG_ID = 0;
MyActivity ma=null;
// the callback received when the user "sets" the time in the dialog
public TimePickerDialog.OnTimeSetListener mTimeSetListener =
new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
mHour = hourOfDay;
mMinute = minute;
time.setText(
new StringBuilder()
.append(pad(mHour)).append(":")
.append(pad(mMinute)));}
//pad method
private String pad(int c) {
if (c >= 10)
return String.valueOf(c);
else return "0" + String.valueOf(c); } };
protected Dialog onCreateDialog(int id) {
switch (id) {
case TIME_DIALOG_ID:
return new TimePickerDialog(ma,
mTimeSetListener, mHour, mMinute, true); }
return null; }
}
</code></pre>
|
android
|
[4]
|
455,092 | 455,093 |
CGContext Draw Line slowly responding to fast finger movement
|
<p>I am using CGContext to draw lines on finger touch.
If the finger is moved slowly on the screen , it worked perfectly...but the problem is that if the finger is moved fastly , the line lags the finger. I mean the line draws at a point one second after the finger is touched at that point ( so annoying- it is not the problem on simulator but only on device).
Secondly if i draw a curve with that, the curve comes very angular - i mean curve is not very smooth
Please help ( I dont want to use OpenGL, is there any other solution)</p>
<p>EDIT:-</p>
<p>Sorry but I am a noobe...dont know too much about what hotpaw has said below...but this is my code</p>
<pre><code>-(void) draw rect{
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, beginpointX, beginpointY);
CGContextSetStrokeColorWithColor(ctx, CGColor);
CGContextAddLineToPoint(ctx,currentpointX,currentpointY);
CGContextSetLineCap(ctx, kCGLineCapRound);
CGContextStrokePath(ctx);
CGContextSetLineJoin(ctx, kCGLineJoinRound);
CGContextClosePath(ctx);
</code></pre>
<p>and in my <code>touchesBegan</code> and <code>touchesmoved</code> method i am calling view's <code>setNeedsDisplay</code> method.</p>
<p>dont know how many frames/second or touches event are there...please help its very urgent</p>
|
iphone
|
[8]
|
3,602,382 | 3,602,383 |
Range Numbers PHP
|
<p>Hy, I'm trying to print the numbers using php Like this:</p>
<pre><code>1=1 5=1 1=1
1=2 5=2 1=2
1=3 5=3 .. etc
2=1 6=1
2=2 6=2
2=3 6=3
3=1 7=1
3=2 7=2
3=3 7=3
4=1 8=1
4=2 8=2
4=3 8=3
</code></pre>
<p>Thank's.</p>
|
php
|
[2]
|
1,294,758 | 1,294,759 |
get image size in bytes
|
<p>I want to get image size in bytes what should i do..</p>
<p>// this code switch me in gallery where we can select any existing images </p>
<pre><code>Intent i = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
i.setType("image/*");
startActivityForResult(i, 2);
</code></pre>
<p>// this code of snippet return the uri of selected images from gallery but i want to image //size in bytes also from here</p>
<pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 2) {// 2 for selectimage
// Get the data of the image selected? and upload to server
if (resultCode == Activity.RESULT_OK) {
ImageURI = data.getData();
Log.d("IMAGE PATH",""+ImageURI);}}}
</code></pre>
<p>thanks..</p>
|
android
|
[4]
|
1,857,229 | 1,857,230 |
Keep only first n characters in a string?
|
<p>Is there a way in JavaScript to remove the end of a string?</p>
<p>I need to only keep the first 8 characters of a string and remove the rest. </p>
|
javascript
|
[3]
|
2,478,879 | 2,478,880 |
Download video from AmazonS3 with ProgressBar in Android
|
<p>Here i developed one application which download big size of videos from <code>AmazonS3Bundle</code> with <code>HorizontalProgressBar</code> but when i go to home screen by pressing home key and when i get back to my application's download screen, my download is restarting from beggining.</p>
<p>I want my application to keep downloading in background even if i go to any other application.</p>
|
android
|
[4]
|
3,508,686 | 3,508,687 |
php search array for string, then if found, move that string to first item of array
|
<p>so let's say i have an array:</p>
<pre><code>$people[0] = "Bob";
$people[1] = "Sally";
$people[2] = "Charlie";
$people[3] = "Clare";
if (in_array("Charlie", $people)) {
//move Charlie to first item in array
}
</code></pre>
<p>What would be the most efficient way to get Charlie to the first item in the array?</p>
|
php
|
[2]
|
5,735,332 | 5,735,333 |
`this` in callback functions
|
<p>I used to use</p>
<pre><code>MyClass.prototype.myMethod1 = function(value) {
this._current = this.getValue("key", function(value2){
return value2;
});
};
</code></pre>
<p>How do I access the value of this within the callback function like below?</p>
<pre><code>MyClass.prototype.myMethod1 = function(value) {
this.getValue("key", function(value2){
//ooopss! this is not the same here!
this._current = value2;
});
};
</code></pre>
|
javascript
|
[3]
|
1,828,590 | 1,828,591 |
asp.net: How to get a button to affect the page contents
|
<p>In Page_Load I populate an asp:Table with a grid of images. I have a button that when pressed I would like it to repopulate the page with different images.</p>
<p>However it appears that when the button is pressed Page_Load is called again, followed by the script specified by the button. I thought that I could simply set a variable in the button script which is checked during Page_Load, but this will not work.</p>
<p>What is the most asp.netish way to approach this? Should I be populating my table somewhere other than in Page_Load, or should my button be doing something different?</p>
|
asp.net
|
[9]
|
2,531,536 | 2,531,537 |
Int can not hold the value of int.MaxValue
|
<p>I have the following two methods:</p>
<pre><code>public int Average (params int[] array)
{
if (array.Length > 0)
{
double avg = Sum(ints) / arr.Length;
return (int)avg;
}
return 0;
}
public int Sum(params int[] array2)
{
int total = 0;
for (int n = 0; n < array2.Length; n++)
{
total += arr[n];
}
return total;
}
</code></pre>
<p>But for testing purposes I tried adding the <code>int.MaxValue / 2</code> and <code>int.MaxValue / 2 + 4.</code> in the array. But why does the unit test fail, although the sum of the two values will be less than <code>int.MaxValue</code>?</p>
|
c#
|
[0]
|
4,240,294 | 4,240,295 |
Check MI for Python
|
<p>Is there an application similar to Java's CheckMI for Python?</p>
|
python
|
[7]
|
90,831 | 90,832 |
A question about PSChildPaneSpecifier [iPhone SDK]
|
<p>i am using PSChildPaneSpecifier on Setting bundle to show Acknowledgements about my application on setting bundle ,so how can handle my plist file to show many texts ? like iwork apps Acknowledgements
thank you </p>
<p>i mean something like this :</p>
<p><img src="http://i.stack.imgur.com/u4EVF.png" alt="alt text"></p>
|
iphone
|
[8]
|
4,518,684 | 4,518,685 |
how to debug "function is not defined" error in javascript
|
<p>I'm a newbie to javascript. I'm using firebug to debug my program and I got a "function is not defined" error. I searched online, and people said this is because of syntax error in the function. But that function is very big and I can't use firebug now (because it only gives me "not defined" error), is there any good way to debug it? Any tools to use? Thanks! </p>
|
javascript
|
[3]
|
2,744,440 | 2,744,441 |
jQuery: using live() with each()
|
<p>I have this function here:</p>
<pre><code>$("a.fancybox_vid").each(function(){
$(this).fancybox({
titleShow : false,
width: 640,
height: 395,
autoDimensions: false,
overlayOpacity: 0.6,
href: "misc/mc.php?v="+$(this).attr('id')
});
});
</code></pre>
<p>Now a link with c lass .fancybox_vid gets appended, and then this will not work. Only if it is there from the beginning. How can I have live() in this each().</p>
|
jquery
|
[5]
|
5,491,920 | 5,491,921 |
Can we see the template instantiated code by C++ compiler
|
<p>is there a way to know the compiler instantiated code for a template function or a class in C++</p>
<p>Assume I have the following piece of code</p>
<pre><code>template < class T> T add(T a, T b){
return a+b;
}
</code></pre>
<p>now when i call</p>
<pre><code>add<int>(10,2);
</code></pre>
<p>I would like to know the function that compiler creates for int specific version.</p>
<p>I am using G++, VC++. It will be helpful if some can help me point out the compiler options to achieve this.</p>
<p>Hope the question is clear. Thanks in advance.</p>
|
c++
|
[6]
|
2,705,421 | 2,705,422 |
GConf Error: Failed to contact configuration server
|
<p>I have got this error while running in server.
<strong><em>GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See <a href="http://projects.gnome.org/gconf/" rel="nofollow">http://projects.gnome.org/gconf/</a> for information. (Details - 1: Not running within active session)</em></strong>. How to fix this?</p>
<p>Regards</p>
<p>Linda</p>
|
java
|
[1]
|
2,315,876 | 2,315,877 |
Python module database configuration?
|
<p>I have a python module which contains a few objects, one of which uses a MySQL connection to persist some data. What's the best way to allow for easy configuration of the MySQL connection information without making the user go into the installed module location and edit files?</p>
|
python
|
[7]
|
4,069,681 | 4,069,682 |
object returns not defined in javascript
|
<p>Hi i am trying to get my head around some basic stuff in javascript, i want to create the equivalent to a class
see below:</p>
<pre><code>var myTest = {
myTester:"testing",
testCode:function(){
return myTester;
}
};
</code></pre>
<p>when i call <code>alert(myTest.testCode());</code> i get error myTester is undefined;</p>
<p>i also have similar trouble when trying to set the value of myTester too, what i am trying to achieve here is something along the lines of this:</p>
<pre><code>var myObj = myTest.testCode();
var tester = myObj.myTester;
</code></pre>
<p>as myObj is an object i should once created be able to access its values but i dont usually do javascript just jQuery and i am
trying to create an application in pure javascript just for brain feed and would appreciate a little guidence, especially on what do you actually call this, is it a class????</p>
<p>thanks</p>
|
javascript
|
[3]
|
5,713,351 | 5,713,352 |
"Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function." keeps popping
|
<p>I have a datagridview which takes datasource from a datatable
one of the columns is an int</p>
<p>i wish the program to display an error whenever the user tries to enter a string into that column</p>
<p>i add this to the DataError event</p>
<pre><code> private void dataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
MessageBox.Show("Incorrect data type was entered");
e.Cancel = true;
}
</code></pre>
<p>First of all the messagebox shows up twice in a row instead of just once<br>
Secondly i get an irritating error after the 2 messageboxes:<br>
Unhandled Exception with the error:</p>
<blockquote>
<p>System.InvalidOperationException: Operation is not valid because it
results in a reentrant call to the SetCurrentCellAddressCore function.</p>
</blockquote>
|
c#
|
[0]
|
1,711,597 | 1,711,598 |
Strings memory model
|
<p>What I read about strings is when a string object is created in Java it is immutable. For example:</p>
<pre><code>String s=new String();
s="abc";
s="xyz";
</code></pre>
<p>Does the <code>String s</code> no longer point to <code>"abc"</code>?</p>
<p>And another thing: what is size of s;
Is the <code>String</code> object analogous to a <code>char*</code> pointer in C in terms of the memory model?</p>
|
java
|
[1]
|
2,198,880 | 2,198,881 |
How to navigate from one screen to another screen automatically?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1979524/android-splashscreen">Android SplashScreen</a> </p>
</blockquote>
<p>I am new to android application development.</p>
<p>I developed one android application using android sdk. i install .apk file in samsung tab,and it is working properly.</p>
<p>But my requirement is before my application home page launching i have to display my company logo in one screen and my application title in another screen each 5sec after that my application home page have to display automatically.</p>
<p>please help me go forward.</p>
|
android
|
[4]
|
4,100,203 | 4,100,204 |
Post data using $.post fails with empty data
|
<p>I want to send some data using jQuery</p>
<pre><code>var uri = "some url";
$.post(uri,
{ message: "test"},
{"format" : "json"},
'html');
return false;
</code></pre>
<p>When the php script gets the request the message field is empty. Why?</p>
<hr>
<p>Edit: I use zend framework to read the post data</p>
<pre><code>$this->getRequest ()->getPost ( 'message' );
</code></pre>
<p>The js code from above workes on localhost but on the server message is empty. I check with <code>isPost()</code> which says that there is no post.</p>
|
jquery
|
[5]
|
3,017,495 | 3,017,496 |
Android how to create runtime thumbnail
|
<p>I am having image large size image, at run time i want read image from storage and scale it so that its weight and size will be reduce and i can use it as thumbnail when user click on thumbnail i will display full size image.</p>
|
android
|
[4]
|
2,453,707 | 2,453,708 |
ArrayList returns same element for every index
|
<p>I suspect that the value being returned is the last one I have added to my arraylist.</p>
<p>I've got a class <code>Game</code> where the following function gets executed...</p>
<pre><code> public List<M> compute() throws CloneNotSupportedException{
G chil = (G) this.clone();
List<Move> Pm = new ArrayList<M>();
Point p;
for(/*condition*/){
//p is defined up here.basically loops through all possible values of p.
M m = pud.genM(chil, p);
Pm.add(m);
}
return Pmoves;
}
</code></pre>
<p>The strange thing is I'm doing a print on the values being returned for <code>m</code> and they are as expected (different) but when I loop through the List that has been created each and every element is equal to the last element that was added. It appears that this last to be added element is overriding all previous children...</p>
<p>The variable <code>pud</code> is of type <code>User</code>. The function being called is...</p>
<pre><code>public M genM(GameState g, boardPoint p){
M m; // a move
for(/*condition*/){
m = new M(/*parameters*/);
return m;
}
return null;
}
</code></pre>
<p>I've simplified this class down a fair bit, there's some if else conditions and an additional for loop but I took them out of this example because they're kind of messy and most likely irrelevant.</p>
<p>The object <code>M</code> is defined as...</p>
<pre><code> public M(String type, Point fPos, Point tPos, String input, G g){
this.type = type;
this.toPos = toPos;
this.fromPos = fromPos;
this.uInput = uInput;
result = new G(g);
//value of G gets edited here.
}
</code></pre>
|
java
|
[1]
|
5,942,974 | 5,942,975 |
How can I see if a child exists in Python?
|
<p>I have an <code>lxml</code> object called <code>item</code> and it may have a child called <code>item.brand</code>, however it's possible that there is none as this is returned from an API. How can I check this in Python?</p>
|
python
|
[7]
|
4,991,119 | 4,991,120 |
How to send message through dialog box?
|
<p>In my application I am clicking one share image button and four options facebook, twitter, mail and messaging are showing through alert Dialog box. I want to send message throuh fourth option(Messaging). How to do that. I have created dialog box like this. What will be the code to send the message to any mob no. </p>
<p>Here is my code.....</p>
<pre><code>sharebuton.setOnClickListener(new View.OnClickListener() {
@Override`enter code here`
public void onClick(View v) {
// TODO Auto-generated method stub
final CharSequence[] items = {"Facebook","Twitter", "E-Mail", "Messaging"};
AlertDialog.Builder builder = new AlertDialog.Builder(ProgramInfoActivity.this);
builder.setTitle("Share the Program");
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
//Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
}});
AlertDialog alert = builder.create();
alert.show();
}
});
</code></pre>
|
android
|
[4]
|
4,891,209 | 4,891,210 |
How can I iterate over an object and assign all it properties to a list
|
<p>From</p>
<pre><code>a = []
class A(object):
def __init__(self):
self.myinstatt1 = 'one'
self.myinstatt2 = 'two'
</code></pre>
<p>to</p>
<pre><code>a =['one','two']
</code></pre>
|
python
|
[7]
|
4,704,390 | 4,704,391 |
How do I use JQuery to access and loop through all drop-downs of a specific class?
|
<p>Have a potentially infinite collection of drop downs, giving them all the same class, need to be able to access, loop through, and collect the selected value on the option of all the drop downs regardless of how many there could be. The final form should be something like 5,6,7,6,4,2,3,4,3,4 as a comma delimited list of the selected values from all drop downs.</p>
|
jquery
|
[5]
|
4,993,296 | 4,993,297 |
How to create language pack for Android?
|
<p>I need to create language package for supporting a Regional language in my device, which is Currently not available in Android os. How can I create that ?</p>
<p>I don't know where to start, please point me to right direction.</p>
|
android
|
[4]
|
193,443 | 193,444 |
How to access the Forms Authentication Ticket in Authenticated pages
|
<p>I have used the Forms Authentication for logging in and in that i have created the Forms Authentication Ticket and in that ticket i have passing the data with comma seperated values.
how can i get the data which is in the ticket to access in the Authenticated user pages</p>
<p>How can i do this?</p>
<p>Thanks & Regards,
Vara Prasad.M</p>
|
asp.net
|
[9]
|
3,347,821 | 3,347,822 |
access of an array inside another array in javascript
|
<p>i have two arrays defined like these</p>
<pre><code>var theory= new Array();
var first;
var second;
function arrTheory () {
this.first= first;
this.second= second;
}
var subject= new Array();
...
function arrSubject () {
...
this.theory= theory;
...
}
</code></pre>
<p>how can i access to the elements in the theory array inside the bigger one?
I've tried</p>
<pre><code>subject[0].theory.first;
</code></pre>
<p>but it doesn't work while</p>
<pre><code>subject[0].name;
</code></pre>
<p>which is another field of the big array works fine. what i've missed?</p>
|
javascript
|
[3]
|
2,515,695 | 2,515,696 |
Instance variables, default being atomic
|
<p>I'm not quite sure if I understand atomic correctly. From what I read, it says that atomic is the default for the iPhone. Now is that for properties only, or any instance variable. For example, if I have an instance variable that I am going to write my own setters/getters, and do not declare it as a property, does that make that instance variable atomic? Is the downside mainly that it is optimized for threading, which my instance variable / application might not even need? Thanks.</p>
|
iphone
|
[8]
|
1,943,901 | 1,943,902 |
Searching LPSTR string
|
<p>I want to find some words after i get the whole file to char*. I know how to do it using the string class functions but i don't want to copy the data again to a string variable. is there any similar functions available to use for char* strings or should i still use string class?</p>
|
c++
|
[6]
|
5,292,319 | 5,292,320 |
What is the best way to convert any primitive data type to string
|
<p>I am using the following approach to convert any primitive data type to string</p>
<p><strong>Example</strong></p>
<pre><code>int i = 5;//
String convertToString = ""+i;// convert any primitive data type to string
</code></pre>
<p>To convert int data type to string i can use <code>Integer.toString()</code> but what is the better way to convert any type of primitive data (not only int) types to string </p>
|
java
|
[1]
|
3,605,704 | 3,605,705 |
Why does my Properties object ignore the defaults when I do a get?
|
<pre><code>Properties defaults = new Properties();
defaults.put("color", "black");
Properties props = new Properties(defaults);
// This prints "null, black"
System.out.println(props.get("color") + ", " + props.getProperty(color));
</code></pre>
|
java
|
[1]
|
5,637,867 | 5,637,868 |
Selection sort ascending
|
<p>That is my function:</p>
<pre><code>int main() {
double data[100];
int num;
cout<<"num= ";
cin>>num;
for(int i = 1; i <= num; i++) {
cout<<i<<" element = ";
cin>>data[i];
}
Sort(data, num);
for (int i = 1; i <= num; i++) {
cout<<data[i]<<endl;
}
return 0;
}
void Sort(double data[], int n) {
int i,j,k;
double min;
for(i = 0; i < n-1; i++) {
k = i;
min = data[k];
for(j = i+1; j < n; j++)
if(data[j] < min) {
k = j;
min = data[k];
}
data[k] = data[i];
data[i] = min;
}
}
</code></pre>
<p>if I write for exp. three elements: 8,9,1 again cout 8,9,1?</p>
|
c++
|
[6]
|
4,322,159 | 4,322,160 |
Android - button text from up to down?
|
<p>is there any way how to set text on button not from left to right, but from top to down?</p>
<p>Thanks</p>
|
android
|
[4]
|
5,893,843 | 5,893,844 |
Slice vs Stride while reversing string
|
<p>Normally to reverse a list one should do the following:</p>
<pre><code>>>>>l = [1, 2, 3, 4, 5]
>>>>l[::-1]
[5, 4, 3, 2, 1]
</code></pre>
<p>But isn't the exact syntax like this:</p>
<pre><code>list[<start>:<end>:<stop>]
</code></pre>
<p>and if I don't give an optional parameter the defaults are as follows(Correct me if I am wrong:</p>
<pre><code><start> = 0(Beginning of list)
<end> = 5(Length of list)
<step> = 1
</code></pre>
<p>So if I give the optional parameters, it should in effect produce the same result:</p>
<pre><code>>>>>l[0:5:-1]
>>>>[]
</code></pre>
<p>But instead I get an empty list(and I know why this happening), but what are the default values being taken by python in the 1st case?It should take 0 and 5 as default and produce nothing, or is <strong>[::-1]</strong> different from <strong>list[start:end:stop]</strong></p>
|
python
|
[7]
|
2,494,348 | 2,494,349 |
Not able to locate Current Location in Map in HUAWEI C8650. I am using MapQuest for Map in Android
|
<p>I used MapQuest for Map in Android ,but in HUAWEI C8650 its not able to locate the current location in the map. Same problem with in Lenovo handset. Its working fine in Some Samsung, LG and Sony Ericcson devices.</p>
<p>Any idea will be highly appreciated.</p>
<p>Thanks in advance.</p>
|
android
|
[4]
|
567,829 | 567,830 |
AABB in Frustum Defined by 8 corners
|
<p>It seems like every example I can find has to do with using DirectX or OpenGL and it is confusing the snot out of me... I am not using either of these so i do not have any sort of view or clipping matrix.</p>
<p>I have a view frustum shaped element(i have the 8 corner coordinates) and i need to see if an axis aligned box is intersecting it.</p>
<p>Could someone please post a quick snippet with comments?</p>
|
c++
|
[6]
|
717,654 | 717,655 |
Converting .doc Format to Pdf file in iphone
|
<p>How do i Convert .doc format to pdf file from iphone .
i Want same layout as .doc format.
i Tried with html format but did not get any success.</p>
<p>anyone suggest any solution would be appreciated.</p>
<p>Thank you.</p>
|
iphone
|
[8]
|
472,272 | 472,273 |
Unable to save GPSTimeStamp
|
<pre><code>timeGPS=location.getTime();
exif.setAttribute(ExifInterface.TAG_GPS_TIMESTAMP, String.valueOf(timeGPS));
</code></pre>
<p>Result is always <code>106:41:34</code>. I don't know why so, please help me.</p>
<p>Thanks</p>
|
android
|
[4]
|
331,562 | 331,563 |
Bug in Eclipse Emulator DDMS?
|
<p>I originally asked this question as a possible bug in Eclipse Helios :
<a href="http://stackoverflow.com/questions/3738526/possible-bug-in-eclipse-ddms-emulator-control">link text</a></p>
<p>I accepted that it was bug in Helios but I now find that I'm now getting the same error under Eclipse 3.5</p>
<p>When I send a location from the DDMS perspective using the emulator control tab. I have a standard listener:</p>
<p>onLocationChanged(Location location){...}</p>
<p>If I break on the first line of this, having sent the lat/lon pair of 53.5/-3.0 from the DDMS tab, then the mLatitude/mLongitude in the location argument have changed to 53.508833/-3.005000 (6 dec places only shown). </p>
<p>The Android SDK is 2.2 in both and the target is Google APIs level 7.
Does anybody else experience this or could offer a possible explanation? (It amounts to quite a big error in terms of metres on the map.)</p>
|
android
|
[4]
|
5,537,357 | 5,537,358 |
How can i debug my app with my private key
|
<p>Can anybody explain me how can i publish my app on android market or how can i debug my app with the private key.</p>
<p>Thanks,</p>
|
android
|
[4]
|
5,581,408 | 5,581,409 |
display context menu for position "2" click in list view only android
|
<p>I want to display context menu for list position clicked means only for 2 nd position clicked in list view so how to do it.</p>
<p>I had implemented the code for displaying context menu for each position clicked. So how to make it specific for any position in <code>ListView</code>.</p>
<p>my code for displaying context menu for each position in list view ..pls do required modification on my code thanks...</p>
<pre><code>public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainmenulist);
// registerForContextMenu(getListView());
CustomAdapter adapter = new CustomAdapter(
this, R.layout.listitem,R.id.title, data
);
setListAdapter(adapter);
getListView().setTextFilterEnabled(true);
}
@Override
public void onCreateContextMenu(ContextMenu menu,
View v,ContextMenuInfo menuInfo)
{
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("Context Menu");
menu.add(0, v.getId(), 0, "Gallery");
menu.add(0, v.getId(), 0, "Camera");
menu.add(0, v.getId(), 0, "Cancel");
}
@Override
public boolean onContextItemSelected(MenuItem item) {
if(item.getTitle()=="Gallery"){
function1(item.getItemId());
} else if(item.getTitle()=="Camera"){
function2(item.getItemId());
} else return false;
return true;
}
public void function1(int id){
Toast.makeText(this, "Gallery function called",
Toast.LENGTH_SHORT)
.show();
}
public void function2(int id){
Toast.makeText(this, "Camera function called",
Toast.LENGTH_SHORT)
.show();
}
</code></pre>
|
android
|
[4]
|
719,476 | 719,477 |
iphone- Push a view after poping earlier view
|
<p>I have one view pushed on navigation.
Now I do following on click of button.</p>
<pre><code> [self.navigationController popViewControllerAnimated:YES];
FreeStuffViewController * freeStuffVC=[[FreeStuffViewController alloc]initWithNibName:@"FreeStuffViewController" bundle:nil];
[self.navigationController pushViewController:freeStuffVC animated:YES];
[freeStuffVC release];
</code></pre>
<p>It only pops a view, but dint push new FreeStuffVc.
Please help.</p>
|
iphone
|
[8]
|
900,872 | 900,873 |
Changing cell height in table view Objective C
|
<p>I wnat my cell's height to change depending on the text being displayed in it. The text will vary and I'm basically wanting the cells to change size. Here is what I have so far:</p>
<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DefaultCell1"];
CGRect cellRectangle;
if (cell == nil) {
cellRectangle = CGRectMake(0.0, 0.0, 300, 110);
cell = [[[UITableViewCell alloc] initWithFrame:cellRectangle reuseIdentifier:@"DefaultCell1"] autorelease];
}
UILabel *label;
cellRectangle = CGRectMake(10, (40 - 20) / 2.0, 280, 110);
//Initialize the label with the rectangle.
label = [[UILabel alloc] initWithFrame:cellRectangle];
label.lineBreakMode = UILineBreakModeWordWrap;
label.numberOfLines = 20;
label.font = [UIFont fontWithName:@"Helvetica" size:11.0];
label.text = [[self.person.statusMessages objectAtIndex:indexPath.row] valueForKey:@"text"];
CGFloat height = [label.text sizeWithFont:label.font].height;
//So right here is where I think I need to do something with height and
//see it to something tied to he cell
[cell.contentView addSubview:label];
[label release];
return cell;
}
</code></pre>
|
iphone
|
[8]
|
2,789,801 | 2,789,802 |
Building command line applications
|
<p>How can I move away from (in c++) the annoying menus like:</p>
<p>(a) Do something
(b) Do something else
(c) Do that 3rd thing
(x) exit</p>
<p>Basically I want to be able to run the program then do something like "calc 32 / 5" or "open data.csv", where obviously I would have written the code for "calc" and "open". Just a shove in the right direction would be great, I am sure I can figure it all out, I just need something to google-fu.</p>
|
c++
|
[6]
|
4,616,957 | 4,616,958 |
Decimal point appearing in a textbox, should not be allowed to delete (in Jquery)
|
<p>I have a textbox containing value 1234.567, the user is allowed to edit the digits, but the decimal point should not be removed in any case.How do i achieve this in Jquery??? (I want to avoid using plug-ins for this)</p>
|
jquery
|
[5]
|
3,345,936 | 3,345,937 |
JS object access
|
<p>I have a js object and i'm trying to access it directly without having to do something like :</p>
<pre><code>for(i in data) { obj = data[i] }
</code></pre>
<p>is there a better way to access this object without looping ? (i'll always have 1 result)</p>
<p>here is the firebug result for console.log(data) :</p>
<p><img src="http://i.stack.imgur.com/Ypk7c.png" alt="enter image description here"></p>
|
javascript
|
[3]
|
3,984,904 | 3,984,905 |
Elegant way to add metainformation to char array
|
<p>I wanna pack some information plus some metadata in a byte array. In the following
I have 3 bytes of information which have a certain offset plus 4 bytes of metadata added
at the beginning of the packet in the end. Solution 1 I came up is pretty obvious to do
that but requires a second tmp variable which I do not really like.</p>
<pre><code>int size = 3;
int metadata = 4;
unsigned char * test = new unsigned char[size];
unsigned char * testComplete = new unsigned char[size+metadata];
test[offest1] = 'a';
test[offest2] = 'b';
test[offest3] = 'c';
set_first_4bytes(testComplete, val );
memcpy(&testComplete[metadata], test, size);
</code></pre>
<p>Another straightforward solution would be to do it the following way:</p>
<pre><code>unsigned char * testComplete = new unsigned char[size+metadata];
testComplete[offest1+metadata] = 'a';
testComplete[offest2+metadata] = 'b';
testComplete[offest3+metadata] = 'c';
set_first_4bytes(testComplete, val );
</code></pre>
<p>However, I don not like here the fact that each time I have the metadata offset to add so that I get the right index in my final packet. Is there another elegant solution which DOES not have the drawbacks of my approaches?</p>
<p>Thanks!</p>
|
c++
|
[6]
|
2,825,471 | 2,825,472 |
timepicker: when to choose 24 or am/pm modes
|
<p>I have a few timepickers in my app.</p>
<p>In my country (Spain) we are used to displaying time in 24 hours mode... but in other countries are used to am/pm.</p>
<p>I know how to set a Timepicker to 24 or am/pm mode...
But what is the best approach to show am/pm or 24 depending of the device locale or country? How can I know to select one or another mode?</p>
<p>Thank you very much</p>
<p>(Sorry for my poor english)</p>
|
android
|
[4]
|
4,477,153 | 4,477,154 |
How to transform this link into jquery.load()?
|
<p>I need to transform this <code><a></code> link into <code>jquery.load()</code> - how to do that?</p>
<p>This is the link:</p>
<pre class="lang-html prettyprint-override"><code><a href="exibelinha.asp?linha=<%= rs_linhas("linha")%>" class="whatever">
<img src="produtos/linhas/pequeno/<%= rs_linhas("foto_inicial")%>" alt="">
<h3><%= rs_linhas("linha")%></h3>
</a>
</code></pre>
<p>I need to implement this with this jQuery script:</p>
<pre><code>$('#exibe_galeria').click(function(e) {
$('#galeria_oculta').show();
$('#container').load('exibelinha.asp?xxxx'); //here i need to call the link
e.preventDefault();
});
</code></pre>
<p>Inside my load, I need to call another page (exibelinha.asp) with this strings <code>?linha=<%= rs_linhas("linha")%></code></p>
|
jquery
|
[5]
|
4,379,525 | 4,379,526 |
trace keyboard inputs
|
<p>I hope to create application in c# to trace the keyboard raw inputs and replace that inputs
ex: if keydown > crtl+A then output> B
or input AB then out put > C</p>
<p>this is for support to local language typing.</p>
|
c#
|
[0]
|
2,142,485 | 2,142,486 |
Why does Java not permit the use of headers as in C++
|
<p>I have a question that I did not find an answer for except the following answer that does not meet my requirements:</p>
<blockquote>
<p>"Because James Gosling didn't want to"</p>
</blockquote>
<p>I know that Java can have interfaces (only pure virtual functions, no attributes), but it is not the exact same thing as class definitions.</p>
|
java
|
[1]
|
3,066,413 | 3,066,414 |
Implementing Support Vector Machines in Android
|
<p>I am trying to implement SVM classification for text in Android . Can anybody suggest me that from where I can get the Idea about implementing in Android . i.e. Some books or some online reading material related to it . </p>
<p>Thanks in Advance :)</p>
|
android
|
[4]
|
2,941,087 | 2,941,088 |
this pointer as a pointer to objects
|
<p>suppose employee is a class....print is its non-static member function which prints the value of its private data member x...now i read that if print is a constant function the this pointer passed to it by the compiler is of the type </p>
<blockquote>
<p>const employee* const </p>
</blockquote>
<p>and if print is a non-constant function the type of this pointer is </p>
<blockquote>
<p>employee* const </p>
</blockquote>
<p>....now the problem is that i have not declared the object of class employee as constant so how can 'this' point to a constant employee object if print is declared a constant function....</p>
|
c++
|
[6]
|
3,154,172 | 3,154,173 |
jQuery: difficult to add a symbol
|
<p>I do not know much about jQuery, that`s why I would like to ask you to help me to a add to my script the symbol of DOLLAR ($) as text. Need to mention that the script is working without dollar.</p>
<pre><code><script>
$(document).ready(function($){
var money = parseFloat($("#INSERTMONEY").val());
$('#costline').val((money).toFixed(2).text("$"));
})
</script>
</code></pre>
<p>In my opinion I do something wrong by adding this - <strong>.text("$")</strong>. I would much appreciete your contribution. Thank in advance.</p>
|
jquery
|
[5]
|
2,303,299 | 2,303,300 |
Writing jQuery functions that allow chaining
|
<p>I want to write some code that allows me to replace jQuery's animate function with one that does different things, but still allows me to call a secondary function on completion.</p>
<p>At the moment, I'm writing lots of code like this;</p>
<pre><code>if (cssTransitions) {
$("#content_box").css("height",0);
window.setTimeout(function() {
secondFunction();
}, 600);
} else {
$("#content_box").animate({
height:0
}, 600, function() {
secondFunction();
});
}
</code></pre>
<p>I'd much rather write a function that looks like this:</p>
<pre><code>function slideUpContent(object) {
if (cssTransitions) {
object.css("height",0);
// Not sure how I get a callback here
} else {
$("#content_box").animate({
height:0
}, 600, function() {
});
}
}
</code></pre>
<p>That I could use like this:</p>
<pre><code>slideUpContent("#content_box", function(){
secondFunction();
});
</code></pre>
<p>But I'm not sure how to get the functionality I need - namely a way to run another function once my one has completed.</p>
<p>Can anyone help my rather addled brain?</p>
|
jquery
|
[5]
|
1,696,654 | 1,696,655 |
C# referring to object variable with string
|
<p>Hi in Actionscript I may refer to a variable within an object thusly</p>
<pre><code>objectName["variableName"] = "Some value";
</code></pre>
<p>How would I do the equivalent in c#</p>
<p>thanks</p>
|
c#
|
[0]
|
2,554,860 | 2,554,861 |
JPA Criteria Group By
|
<p>I have got the following problem, maybe somebody can help me.</p>
<p>I wrote a SQL query:</p>
<pre><code>SELECT v.bezeichnung, count(*) as total
FROM veranstaltung v
JOIN auffuehrung a ON v.id = a.veranstaltung_id
JOIN platz p ON p.auffuehrung_id = a.id
JOIN transaktion t ON t.id = p.transaktion_id
WHERE t.status = 2 AND (a.datumuhrzeit + 30 DAY) >= CURRENT_DATE
GROUP BY v.bezeichnung
ORDER BY total DESC
</code></pre>
<p>I have to implement it in JPA but everything works except GROUP BY... it can't be grouped..</p>
<pre><code>CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
CriteriaQuery<Veranstaltung> query = builder.createQuery(Veranstaltung.class);
Root<Veranstaltung> rootVeranstaltung = query.from(Veranstaltung.class); query.where(builder.equal(rootVeranstaltung.join("auffuehrungen").join("plaetze").join("transaktion").<Transaktionsstatus>get("status"), Transaktionsstatus.BUCHUNG));
query.groupBy(rootVeranstaltung);
List<Veranstaltung> result = this.entityManager.createQuery(query).getResultList();
return list;
</code></pre>
<p>I haven't finished the code yet, e.g. the COUNT..
should i write <code>COUNT</code> already before <code>GROUP BY</code> or would it work without <code>COUNT</code>?</p>
|
java
|
[1]
|
5,613,438 | 5,613,439 |
jQuery - Why I can't change color with append div
|
<p>Why I can't edit color with append div.</p>
<p>Click button and add new div call 'block2',if using $(this), it will not work.
How to fix it ?</p>
<p>HTML</p>
<pre><code><div id="btn"><input name="click" type="button" value="Click" /></div>
<div class="block1" style=" width:100px; height:100px; background:orange;">I am Block1</div>
</code></pre>
<p>JS</p>
<pre><code> $('#btn').click(function(){
var $newDiv=$('<div class="block2" style=" width:100px; height:100px; background:green;">I am Block2</div>');
$( "#btn").parent().append($newDiv);
});
$('.block1').click(function(){
$(this).css('background', 'blue');
});
$('.block2').click(function(){
$(this).css('background', 'blue');
});
</code></pre>
|
jquery
|
[5]
|
160,389 | 160,390 |
How to load images just when are needed? (jquery and js)
|
<p>like in this site: <a href="http://www.1stwebdesigner.com/resources/57-free-image-gallery-slideshow-and-lightbox-solutions/" rel="nofollow">http://www.1stwebdesigner.com/resources/57-free-image-gallery-slideshow-and-lightbox-solutions/</a></p>
<p>it only loads the image when you are rally seeing it. This is something i would want to implement in my website. thanks</p>
<p>and a preloader if possible. i use jquery</p>
|
jquery
|
[5]
|
4,667,564 | 4,667,565 |
Controlling PHP's output stream
|
<p>I want to keep errors out of my PHP output stream. I only want output of things I explicitly echo.</p>
<p>Looking at my php.ini, is "display_errors" the only configuration I need to change?</p>
|
php
|
[2]
|
31,441 | 31,442 |
retain array into NSDefault?
|
<p>HI all,</p>
<p>can we retain an array in NSDefualt?</p>
<p>regards
shishir</p>
|
iphone
|
[8]
|
2,883,524 | 2,883,525 |
access the rowlistview programmatically
|
<p>I am trying to change the alignment of the text in <code>ListView</code> programmatically instead of changing the xml file.</p>
<p>Here is my <code>row_listview.xml</code></p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textViewRowList"
android:layout_height="?android:attr/listPreferredItemHeight"
android:layout_width="fill_parent"
android:textSize="20sp"
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:gravity="left"
android:textColor="#330033"
android:textStyle="bold"/>
</code></pre>
<p>And <code>activity_main.xml</code> has following <code>ListView</code> defined there</p>
<pre><code><ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:dividerHeight="0dp"
tools:listitem="@android:layout/simple_list_item_1"
android:background= "#FF6600">
</ListView>
</code></pre>
<p>So in my <code>mainactivity.java</code> I am trying to change the alignment of the text in listview at runtime when user clicks a button on my activity</p>
<pre><code>private ListView lv;
private TextView tvRowListView;
lv.setAdapter(new ArrayAdapter<String>(this,R.layout.row_listview, sampleStringArray));
tvRowListView = (TextView) findViewById(R.id.textViewRowList);
tvRowListView.setGravity(Gravity.CENTER);
</code></pre>
<p>The last line above is however throwing nullpointerexception. I am not sure why. Can someone throw some ideas/solutions here.</p>
|
android
|
[4]
|
4,497,628 | 4,497,629 |
PHP error wrapper?
|
<p>I don't know if the term I'm using is right, but what I'm looking for is something similar to what you get with zend server. Take a look at <a href="http://static.zend.com/topics/zend-server-event-details-scr.jpg" rel="nofollow">this</a>.</p>
<p>It looks like on an error, it dumps the request along with a stack trace and function parameters as well as some other info. It lets you view it in a nice interface. I know this wouldn't be hard to make myself as you can always do error callbacks, but if something like this exists (for free) I'd prefer to use it instead of reinventing the wheel.</p>
|
php
|
[2]
|
2,451,385 | 2,451,386 |
Eclipse doesn't recognize android SDK
|
<p>I set android SDK on centos(linux)
<img src="http://i.stack.imgur.com/eYBIj.png" alt="enter image description here">
but then I get
<img src="http://i.stack.imgur.com/oPsbF.png" alt="enter image description here">
when I'm trying to get to Android SDK and AVD Manager in Window menu.
Why??
I have the latest ADT plugin, I've tried android_sdk revision 13 and 12, both didn't work. WHY?</p>
|
android
|
[4]
|
1,008,728 | 1,008,729 |
Which One is Best OLEDB Or Excel Object Or Database
|
<p>I need to work with Excel 2007 File for reading the data. for that which one is the best way to do that:</p>
<ol>
<li>Using OLEDB Provider</li>
<li>Excel Interop Object</li>
<li>Dump the Excel data to Database and Using Procedure</li>
</ol>
<p>kindly guide me to choose.</p>
|
c#
|
[0]
|
3,990,613 | 3,990,614 |
How are Messengers garbage collected?
|
<p>Consider this code:</p>
<pre><code>Message message = Message.obtain(null, MSG_REQUEST_QUOTE, symbol);
message.replyTo = new Messenger(new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case StockMessengerService.MSG_QUOTE_VALUE:
callback.onQuote(symbol, msg.arg1);
break;
case StockMessengerService.MSG_QUOTE_FAILURE:
callback.onFailure(symbol, msg.obj.toString());
break;
default:
super.handleMessage(msg);
}
}
});
mService.send(message);
</code></pre>
<p>How is the JVM able to garbage collect the replyTo Messenger? In the Android javadocs, they only have a single Messenger, bound to the Activity. But this code works, but I'm quite curious how it is the JVM doesn't GC the Messenger before it gets its message, OR, whether this code is quite risky and will leak memory?</p>
<p>Edit2:
mService is like:</p>
<pre><code>private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
mService = new Messenger(service);
</code></pre>
<p>This is based on the sample code in the Service javadoc at <a href="http://developer.android.com/reference/android/app/Service.html" rel="nofollow">http://developer.android.com/reference/android/app/Service.html</a></p>
<p>Thanks,
Eric</p>
|
android
|
[4]
|
1,231,195 | 1,231,196 |
Get the clicked link text in wordpress using javascript
|
<p>I have website with a side bar links like this</p>
<pre><code>Budget
NAM
Rules
Contacts
</code></pre>
<p>I want the link name
When user clicks the link for example he clicked (Rules) JavaScript grabs the link name for me further compare it with an if or switch statement and open the specific page the user clicked.</p>
|
javascript
|
[3]
|
5,514,397 | 5,514,398 |
Script printing Blob works on one hosting site, not on another
|
<p>I've a script that prints images (Blobs from mysql DB). It works fine on Godaddy but when I move it to a UK hosting company it fails to print the image - prints the alt text instead (everything else works fine). GD is PHP 5.3 and the UK company is PHP 5.2. Both mysql DBs are 5. I have checked that the scripts are the same, correct data is in the DB etc.
I am at a loss as to where to look now.</p>
<p>The script is called with</p>
<pre><code>echo "<img src = 'printimage1.php?recipetableID=$recipetableID' alt='Picture does not display.'>";
</code></pre>
<p>and the printimage1.php script looks like</p>
<pre><code><?php
header("Content-type: image/jpg");
$recipetableID=$_GET['recipetableID'];
include("connect.inc");
$connection = mysql_connect($host,$user,$password)
or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");
$query = "SELECT * FROM RecipeTable WHERE recipetableID = '$recipetableID'";
$result = mysql_query($query)
or die ("Couldn't execute query.");
while($row=mysql_fetch_array($result,MYSQL_ASSOC))
{
echo $row['Picture1content'];
}
?>
</code></pre>
<p>Any suggestions appreciated.
John.</p>
|
php
|
[2]
|
5,105,609 | 5,105,610 |
Changed the database and datagrid has stopped working
|
<p>I changed a field that was my mysql varchar to decimal. So now the datagrid no longer displays the data. I tried deleting the datagrid and dataset, Ja created another with another name yet no longer works. It is not the first time I change a field in the table and the datagrid to work, anyone know what I do when I change the structure of my database and datagrid not to crash</p>
|
c#
|
[0]
|
3,218,328 | 3,218,329 |
php sqlite pdo is not working with jetty querques
|
<p>I have used jetty8 with querques for supporting php on it. Normal php works fine but when i try using pdo with sqlite on jetty. it says </p>
<blockquote>
<p>Fatal Error: 'sqlite3:test.db' is an unknown PDO data source.</p>
</blockquote>
<p>though i have installed php5 and configured the php.ini file properly,
find below the php.ini</p>
<pre><code>[php]
extension=php_pdo_sqlite.dll
extension=php_sqlite3.dll
[php]
</code></pre>
<p>Let me know if anyone has worked on this. I need to make sure sqlite with pdo works fine with jetty.</p>
|
php
|
[2]
|
2,483,193 | 2,483,194 |
What does this line return?
|
<pre><code>int lf = ((t.left==null) = (t.right==null)) ? 1:0;
</code></pre>
<p>it returns 1 if the statement in the bigger parenthesis is true, but in the middle, whats the point of assigning right value to lefT?</p>
|
java
|
[1]
|
3,378,526 | 3,378,527 |
error in using BtnSubmit.Attributes("onclick") in asp.net
|
<p>can anybody tell me what is problem in</p>
<p>BtnSubmit.Attributes("onclick") = string.Format("document.getElementById(\'{0}\').value= document.getElementById(\'{1}\').value;", this.HiddenField1.ClientID, this.FileUpload1.ClientID);</p>
<p>it is giving me error 'Non invocable memberusing System.Web.UI.WebControls.Attributes cannot be used like method.'</p>
|
asp.net
|
[9]
|
192,654 | 192,655 |
Python:how to replace string by index
|
<p>I am writing a program like unix tr, which can replace string of input.
My strategy is to find all indexes of source strings at first, and then replace them by target strings. I don't know how to replace string by index, so I just use the slice.
However, if the length of target string doesn't equal to the source string, this program will be wrong. I want to know what's the way to replace string by index.</p>
<pre><code>def tr(srcstr,dststr,string):
indexes = list(find_all(string,srcstr)) #find all src indexes as list
for index in indexes:
string = string[:index]+dststr+string[index+len(srcstr):]
print string
</code></pre>
<p>tr('aa','mm','aabbccaa')<br>
the result of this will be right: mmbbccmm<br>
but if tr('aa','ooo','aabbccaa'), the output will be wrong: </p>
<p>ooobbcoooa</p>
|
python
|
[7]
|
5,559,809 | 5,559,810 |
how to close pdf activity from my activity in android
|
<p>I open pdf file using following code</p>
<pre><code> Uri pathsd = Uri.fromFile(outputfile);
intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(intent);
</code></pre>
<p>Now i want to close the pdf reader after predefined time.</p>
<p>Thanks a lot for any help</p>
|
android
|
[4]
|
1,786,385 | 1,786,386 |
Confirmation dialog in jquery
|
<p>How can I put the confirmation dialog box to notify the user if is sure to delete the selected data in jquery .
I want the user to be asked if he wants to delete or not .
The code below works perfectly but I want it to be with that functionality .</p>
<pre><code><script type="text/javascript">
$(document).ready(function () {
$('a.delete').click(function (e) {
e.preventDefault();
var parent = $(this).parent();
$.ajax({
type: 'POST',
url: 'delete.php',
data: 'ajax=1&delete=' + parent.attr('id').replace('record-', ''),
beforeSend: function () {
parent.animate({
backgroundColor: '#fbc7c7'
}, 300)
},
success: function () {
parent.slideUp(300, function () {
parent.remove();
});
}
});
});
});
</script>
</code></pre>
|
jquery
|
[5]
|
1,276,118 | 1,276,119 |
Android: handle onItemClick() in listView-based app
|
<p>I'm new to Android. I'm working on a listView-based app: you have a main menu, when you click an item, a new activity starts with another menu; when you click again, a new activity starts with the content you selected. Since I've quite a lot of menu items, I've to create a listener which handles all possible cases, so I've something similar:</p>
<pre><code> @Override public void onItemClick(AdapterView<?> listAdapter, View v, int position, long id) {
String text = ((TextView)v).getText().toString();
//main menu
if (text.equals(K.getStringById(K.ID_MAIN_THEORY))) {
...
} else if (text.equals(K.getStringById(K.ID_MAIN_EXERCISE))) {
...
}
else if (text.equals(K.getStringById(K.ID_MAIN_TABLES))) {
...
}
//here other menus' items: lots of items
...
//back item
else if (text.equals(K.getStringById(K.ID_BACK))) {
activity.finish();
}
Intent i = new Intent(...);
startActivity(i);
}
* K is a class that holds ids' references
</code></pre>
<p>There's a way I can avoid hard-coding listener behavior?</p>
<p>** PS: the lists' TextViews don't render properly: text appears light grey, not black! O.o</p>
|
android
|
[4]
|
5,089,864 | 5,089,865 |
Why is 'false' used after this simple addEventListener function?
|
<p>What is the false for at the end? Thanks.</p>
<pre><code>window.addEventListener("load",
function() { alert("All done"); },
false);
</code></pre>
|
javascript
|
[3]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.