PostId
int64 13
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 3
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -33
210k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
5.77k
| Title
stringlengths 10
250
| BodyMarkdown
stringlengths 12
30k
| Tag1
stringlengths 1
25
⌀ | Tag2
stringlengths 1
25
⌀ | Tag3
stringlengths 1
25
⌀ | Tag4
stringlengths 1
25
⌀ | Tag5
stringlengths 1
25
⌀ | PostClosedDate
stringlengths 19
19
⌀ | OpenStatus
stringclasses 5
values | unified_texts
stringlengths 47
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
814,133 | 05/02/2009 04:22:58 | 4,906 | 09/06/2008 14:21:25 | 1,150 | 35 | Do you ever make a code change and just test rather than trying to fully understand the change you've made? |
I'm working in a 12 year old code base which I have been the only developer on.
There are times that I'll make a a very small change based on an intuition (or quantum leap in logic ;-).
Usually I try to deconstruct that change and make sure I read thoroughly the code.
However sometimes, (more and more these days) I just test and make sure it had the effect I wanted. (I'm a pretty thorough tester and would test even if I read the code).
This works for me and we have surprisingly (compared to most software I see) few bugs escape into the wild.
**But what I'm wondering is whether this is just the "art" side of coding.** Yes, in an ideal world you would exhaustively read every bit of code that your change modified, but I in practice, if you're confident that it only affects a small section of code, is this a common practice?
I can obviously see where this would be a disastrous approach in the hands of a poor programmer. But then, I've seen programmers who ostensibly are reading the code and break stuff left and right (in their own code based which only they have been working on). | proramming | null | null | null | null | null | open | Do you ever make a code change and just test rather than trying to fully understand the change you've made?
===
I'm working in a 12 year old code base which I have been the only developer on.
There are times that I'll make a a very small change based on an intuition (or quantum leap in logic ;-).
Usually I try to deconstruct that change and make sure I read thoroughly the code.
However sometimes, (more and more these days) I just test and make sure it had the effect I wanted. (I'm a pretty thorough tester and would test even if I read the code).
This works for me and we have surprisingly (compared to most software I see) few bugs escape into the wild.
**But what I'm wondering is whether this is just the "art" side of coding.** Yes, in an ideal world you would exhaustively read every bit of code that your change modified, but I in practice, if you're confident that it only affects a small section of code, is this a common practice?
I can obviously see where this would be a disastrous approach in the hands of a poor programmer. But then, I've seen programmers who ostensibly are reading the code and break stuff left and right (in their own code based which only they have been working on). | 0 |
11,607,578 | 07/23/2012 06:43:18 | 1,500,550 | 07/04/2012 05:01:27 | 1 | 0 | PHP fuction using & operator. | `<?php
function zz(& $x)
{
$x=$x+5;
}
?>
$x=10;
zz($x);
echo $x; `
I used the above code, but i don't know what & symbol means? | php | null | null | null | null | 07/24/2012 00:49:04 | not a real question | PHP fuction using & operator.
===
`<?php
function zz(& $x)
{
$x=$x+5;
}
?>
$x=10;
zz($x);
echo $x; `
I used the above code, but i don't know what & symbol means? | 1 |
5,535,348 | 04/04/2011 06:43:05 | 674,673 | 03/24/2011 10:04:23 | 9 | 0 | response.sendredirect in post method | response.sendredirect can we use this in Post method .? | javascript | null | null | null | null | 04/04/2011 12:20:06 | not a real question | response.sendredirect in post method
===
response.sendredirect can we use this in Post method .? | 1 |
2,970,495 | 06/03/2010 23:22:41 | 110,637 | 05/21/2009 17:03:35 | 13 | 2 | Eclipse CDT Debugger Issue, v. .metadata does not exist | I am attempting to use the gdb/mi debugger in the Eclipse CDT version 6.02. While I am debugging I can step through the program with ease up until I reach the following snippet of a block of code.
ENUM_START_TYPE My_Class::some_function( const char * c, const char * e)
{
ENUM_START_TYPE result = GENERIC_ENUM_VALUE;
if ( c[0] == '<' )
{
result = do_something()
}
...
MORE CODE
...
return result;
}
When the debugger reaches this line.
if ( c[0] == '<' )
It starts exploring sections of code that it can not find until it opens a tab containing the /projectname/.metadata and simply declares:
"Resource '/project_name/.metadata' does not exist.
At which point the debugger terminates the program with no reason as to why.
All I wish to do is step over this line of code because it really is as trivial as comparing characters.
My question is: Why is this happening? Is it something to do with the debugger, or does it have something to do with my code, or what. Additionally, what is the .metadata and why can't the file be located and opened when it clearly exists.
Other info that may be pertinent: The files are located on a clearcase snapshot view, but are not checked into source control. I don't think that would cause an error like this, but clear case has caused so many random errors for me that I thought it would be worth mentioning.
Thanks in advance | gdb | debugging | clearcase | eclipse-cdt | null | null | open | Eclipse CDT Debugger Issue, v. .metadata does not exist
===
I am attempting to use the gdb/mi debugger in the Eclipse CDT version 6.02. While I am debugging I can step through the program with ease up until I reach the following snippet of a block of code.
ENUM_START_TYPE My_Class::some_function( const char * c, const char * e)
{
ENUM_START_TYPE result = GENERIC_ENUM_VALUE;
if ( c[0] == '<' )
{
result = do_something()
}
...
MORE CODE
...
return result;
}
When the debugger reaches this line.
if ( c[0] == '<' )
It starts exploring sections of code that it can not find until it opens a tab containing the /projectname/.metadata and simply declares:
"Resource '/project_name/.metadata' does not exist.
At which point the debugger terminates the program with no reason as to why.
All I wish to do is step over this line of code because it really is as trivial as comparing characters.
My question is: Why is this happening? Is it something to do with the debugger, or does it have something to do with my code, or what. Additionally, what is the .metadata and why can't the file be located and opened when it clearly exists.
Other info that may be pertinent: The files are located on a clearcase snapshot view, but are not checked into source control. I don't think that would cause an error like this, but clear case has caused so many random errors for me that I thought it would be worth mentioning.
Thanks in advance | 0 |
8,345,955 | 12/01/2011 17:54:05 | 738,811 | 05/04/2011 21:07:06 | 842 | 3 | Clang linker doesn't find libraries | Clang cannot compile simple program, because linker cannot find some files, altough these files are placed in library directory. How to make clang to find these files?
$ cat prog.c
int main(){return 0;}
$ clang -v
clang version 2.9 (tags/RELEASE_29/final)
Target: i386-pc-linux-gnu
Thread model: posix
$ clang prog.c
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ sudo find / -name crti.o
/usr/lib/crti.o
/usr/lib/i386-linux-gnu/crti.o
$ sudo find / -name crt1.o
/usr/lib/i386-linux-gnu/crt1.o
/usr/lib/crt1.o
$ gcc prog.c
$
| ubuntu | clang | null | null | null | null | open | Clang linker doesn't find libraries
===
Clang cannot compile simple program, because linker cannot find some files, altough these files are placed in library directory. How to make clang to find these files?
$ cat prog.c
int main(){return 0;}
$ clang -v
clang version 2.9 (tags/RELEASE_29/final)
Target: i386-pc-linux-gnu
Thread model: posix
$ clang prog.c
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ sudo find / -name crti.o
/usr/lib/crti.o
/usr/lib/i386-linux-gnu/crti.o
$ sudo find / -name crt1.o
/usr/lib/i386-linux-gnu/crt1.o
/usr/lib/crt1.o
$ gcc prog.c
$
| 0 |
682,356 | 03/25/2009 16:22:09 | 11,464 | 09/16/2008 08:13:57 | 291 | 10 | Best book for learning artificial neural networks | in your opinion, what are the best books to:
1. start with learning in neural network area, and
2. getting more in-depth knowledge in this domain?
Books/resources demanding mathematical prerequisites are ok.
Thanks | books | neural-network | null | null | null | 09/15/2011 07:23:02 | not constructive | Best book for learning artificial neural networks
===
in your opinion, what are the best books to:
1. start with learning in neural network area, and
2. getting more in-depth knowledge in this domain?
Books/resources demanding mathematical prerequisites are ok.
Thanks | 4 |
8,510,053 | 12/14/2011 18:51:17 | 587,021 | 01/24/2011 04:57:23 | 99 | 27 | ERP with Supply chain management (incl. POS) and Customer relationship management — What's available? | I am building a [ERP](http://en.wikipedia.org/wiki/Enterprise_resource_planning) with
Supply chain management (incl. POS and ecommerce) and Customer
relationship management.
Which Django libraries (or projects even) will provide the best base for building this off?
Thanks for all suggestions | django | e-commerce | point-of-sale | suggestions | erp | 12/15/2011 18:25:17 | not constructive | ERP with Supply chain management (incl. POS) and Customer relationship management — What's available?
===
I am building a [ERP](http://en.wikipedia.org/wiki/Enterprise_resource_planning) with
Supply chain management (incl. POS and ecommerce) and Customer
relationship management.
Which Django libraries (or projects even) will provide the best base for building this off?
Thanks for all suggestions | 4 |
8,934,803 | 01/19/2012 23:16:27 | 1,075,060 | 12/01/2011 09:11:36 | 13 | 3 | Pass modelstate error to partial view | I have a partial viewthat does some user validation. If there is a problem with the validation I add an error to the modelstate, but then I return the view (which loads the partial view) and the error is not shown in the summary. Any ideas on how to do this? | asp.net-mvc-3 | view | partial | modelstate | null | 01/20/2012 13:35:51 | not a real question | Pass modelstate error to partial view
===
I have a partial viewthat does some user validation. If there is a problem with the validation I add an error to the modelstate, but then I return the view (which loads the partial view) and the error is not shown in the summary. Any ideas on how to do this? | 1 |
11,393,548 | 07/09/2012 10:48:10 | 441,546 | 09/07/2010 14:39:35 | 92 | 9 | RevisionInformation or ChangeInformation on LineNumberChangeRulerColumn | I'm trying to show the author or the ChangeInformation on a LineNumberChangeRulerColumn.
Iterator<IVerticalRulerColumn> it = ruler2.getDecoratorIterator();
while(it.hasNext()){
IVerticalRulerColumn c = it.next();
if(c instanceof LineNumberChangeRulerColumn){
LineNumberChangeRulerColumn lnc = (LineNumberChangeRulerColumn)c;
lnc.showLineNumbers(false);
lnc.setDisplayMode(true);
lnc.setRevisionInformation(ri);
lnc.showRevisionAuthor(true);
System.out.println("ci"+lnc.isShowingChangeInformation());
System.out.println("ri"+lnc.isShowingRevisionInformation());
}
}
But where does the ri (RevisionInformation) come from?
I tried to create one without luck, since it does not allow me to create a Revision? Pls help. eac
visionInformation ri = new RevisionInformation();
Revision r = new Revision();
r.addRange(new LineRange(1,10));
ri.addRevision(r);
| java | eclipse | eclipse-plugin | eclipse-rcp | null | null | open | RevisionInformation or ChangeInformation on LineNumberChangeRulerColumn
===
I'm trying to show the author or the ChangeInformation on a LineNumberChangeRulerColumn.
Iterator<IVerticalRulerColumn> it = ruler2.getDecoratorIterator();
while(it.hasNext()){
IVerticalRulerColumn c = it.next();
if(c instanceof LineNumberChangeRulerColumn){
LineNumberChangeRulerColumn lnc = (LineNumberChangeRulerColumn)c;
lnc.showLineNumbers(false);
lnc.setDisplayMode(true);
lnc.setRevisionInformation(ri);
lnc.showRevisionAuthor(true);
System.out.println("ci"+lnc.isShowingChangeInformation());
System.out.println("ri"+lnc.isShowingRevisionInformation());
}
}
But where does the ri (RevisionInformation) come from?
I tried to create one without luck, since it does not allow me to create a Revision? Pls help. eac
visionInformation ri = new RevisionInformation();
Revision r = new Revision();
r.addRange(new LineRange(1,10));
ri.addRevision(r);
| 0 |
6,604,032 | 07/06/2011 22:57:34 | 564,446 | 01/05/2011 19:09:47 | 1 | 0 | Force Close Error | I am new to android app, in my gaming app When i trying to click on my home screen(home) easy, medium, hard buttons then i am able to play the game after finishing the game my score is displayed on another screen(Score screen) in that screen one home i con is displayed when i click on that icon i displayed dialog box with Yes & No button when i click on Yes Button i have to go to my home screen but some times it's working fine but some times it's giving force close error. So any one can help me to over come that problem.Below is my code and screen shots.
1) MainGamePanel in this class 640 to 657 line numbers giving error & some times
2) MainThread in this class 69 line number giving error
1)Class One Code
public class MainGamePanel extends SurfaceView implements
SurfaceHolder.Callback {
private static final String TAG = MainGamePanel.class.getSimpleName();
private MainThread thread;
/// private can[] can = new can[15];
private ArrayList<can> _cans = new ArrayList<can>();
private SoundManager mSoundManager;
private int CAN_CRUSHED; // no. of crushed cane (for score)
private Paint paint;
private Paint bon;
private Paint intro;
private Paint crushed;
private Paint l1;
private Paint l2;
private Paint earned;
private Paint buttontext;
private int alternate = 1;
private int CONTINUE_CAN_CRUSHED = 0;
private Map<Integer, Bitmap> _bitmapCache = new HashMap<Integer, Bitmap>();
private int LEVEL_RUNNING_IS ;
private int LEVEL_START_TIME=0;
private int LEVEL_ELAPSED_TIME=0;
private int LEVEL_CURRENT_TIME=0;
private boolean LEVEL_COMPLETE=false;
private boolean LEVEL_IS_PAUSED =false;
private boolean DIALOG_SHOWN=false;
private boolean HIGH_SCORE_DIALOG = false;
private int TIME_LEFT =0;
private boolean LEVEL_INITIALIZED = false;
playButton playagain;
playButton nextLevel;
private int RANDOM_BACKGROUND = 0;
Random random ;
homeButton home;
pauseButton pause;
yesButton yes;
noButton no;
private int SCORE;
private int LEVEL_SCORE =0;
private int PAUSED_ELAPSE_TIME;
private int PAUSE_START_TIME;
score core;
// all time related variables
int state = 0;
long startTime = 0;
long currentTime = 0;
long timeElapsed = 0;
long timeRemaining = 0;
long prevTimeRemaining = 0;
Context ct;
public MainGamePanel(Context context , int level) {
super(context);
this.ct = context;
LEVEL_RUNNING_IS = level;
getHolder().addCallback(this);
fillBitmapCache();
mSoundManager = new SoundManager();
mSoundManager.initSounds(context);
mSoundManager.addSound(1, R.raw.crush7);
mSoundManager.addSound(2, R.raw.crush6);
mSoundManager.addSound(3, R.raw.bad_can);
mSoundManager.addSound(4, R.raw.bonus2);
mSoundManager.addSound(5, R.raw.crush5);
core = new score();
CAN_CRUSHED = 0;
paint = new Paint(); // used to write scores and timer
bon = new Paint(); // used to write scores and timer
intro = new Paint();
crushed = new Paint();
l1 = new Paint();
l2 = new Paint();
random = new Random();
earned = new Paint();
buttontext = new Paint();
crushed.setColor(Color.parseColor("#d00800"));
crushed.setTextSize(28);
crushed.setFakeBoldText(true);
crushed.setAntiAlias(true);
l1.setColor(Color.parseColor("#167b18"));
l1.setTextSize(24);
Typeface font = Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD);
l1.setTypeface(font);
l1.setAntiAlias(true);
earned.setColor(Color.parseColor("#d00800"));
earned.setTextSize(28);
earned.setAntiAlias(true);
earned.setFakeBoldText(true);
buttontext.setColor(Color.parseColor("#ffffff"));
buttontext.setTextSize(18);
buttontext.setAntiAlias(true);
buttontext.setTextAlign(Align.CENTER);
playagain = new playButton(_bitmapCache.get(R.drawable.play),getWidth()/2,348);
nextLevel = new playButton(_bitmapCache.get(R.drawable.play),getWidth()/2,390);
pause = new pauseButton(_bitmapCache.get(R.drawable.pause), getWidth()/2, getHeight()-20);
home = new homeButton(_bitmapCache.get(R.drawable.home), 30, getHeight()-20);
no = new noButton(_bitmapCache.get(R.drawable.dnobutton), 120, 290);
yes = new yesButton(_bitmapCache.get(R.drawable.dyesbutton), 120, 290);
RANDOM_BACKGROUND = Math.abs(random.nextInt() % 9);
thread = new MainThread( this);
setFocusable(true);
}
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
}
public void surfaceCreated(SurfaceHolder holder) {
if (!thread.isAlive()) {
thread = new MainThread( this);
}
thread.setRunning(true);
thread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
synchronized (getHolder())
{
if (event.getAction() == MotionEvent.ACTION_DOWN) {
// delegating event handling to the droid
if(HIGH_SCORE_DIALOG)
{
yes.handleActionDown((int) event.getX(), (int) event.getY());
no.handleActionDown((int) event.getX(), (int) event.getY());
if(yes.isTouched())
{
thread.setRunning(false);
thread.killme();
_bitmapCache.clear();
Intent myIntent = new Intent(ct, savescore.class);
Bundle bundle = new Bundle();
bundle.putString("SCORE",LEVEL_RUNNING_IS+"&&"+LEVEL_SCORE);
myIntent.putExtras(bundle);
((Activity) getContext()).startActivity(myIntent);
yes.setTouched(false);
}
if(no.isTouched())
{
LEVEL_SCORE=-1;
HIGH_SCORE_DIALOG = false;
}
}
if(DIALOG_SHOWN&&!HIGH_SCORE_DIALOG)
{
yes.handleActionDown((int) event.getX(), (int) event.getY());
no.handleActionDown((int) event.getX(), (int) event.getY());
if(yes.isTouched())
{
thread.setRunning(false);
thread.killme();
_bitmapCache.clear();
((Activity) getContext()).finish();
yes.setTouched(false);
}
if(no.isTouched())
{
DIALOG_SHOWN = false;
pause.setBitmap(_bitmapCache.get(R.drawable.pause));
LEVEL_IS_PAUSED=false;
LEVEL_START_TIME= LEVEL_START_TIME+PAUSED_ELAPSE_TIME;
no.setTouched(false);
}
}
if(LEVEL_COMPLETE&&!HIGH_SCORE_DIALOG)
{
playagain.handleActionDown((int) event.getX(), (int) event.getY());
home.handleActionDown((int) event.getX(), (int) event.getY());
if(home.isTouched())
{
if(!LEVEL_IS_PAUSED&&!DIALOG_SHOWN)
{
LEVEL_IS_PAUSED=true;
DIALOG_SHOWN = true;
pause.setTouched(false);
PAUSE_START_TIME = (int) (System.currentTimeMillis()/1000);
}else if(LEVEL_IS_PAUSED&&DIALOG_SHOWN)
{
// pause.setBitmap(_bitmapCache.get(R.drawable.pause));
// LEVEL_IS_PAUSED=false;
// LEVEL_START_TIME= LEVEL_START_TIME+PAUSED_ELAPSE_TIME;
// pause.setTouched(false);
}
}
if(playagain.isTouched())
{
RANDOM_BACKGROUND = Math.abs(random.nextInt() % 9);
LEVEL_INITIALIZED=false;
LEVEL_ELAPSED_TIME=0;
LEVEL_CURRENT_TIME=0;
LEVEL_START_TIME=0;
playagain.setTouched(false);
playagain.setBitmap(_bitmapCache
.get(R.drawable.play));
CAN_CRUSHED=0;
SCORE =0;
CONTINUE_CAN_CRUSHED=0;
_cans.clear();
canadded=false;
Log.i("PLAY AGAIN IS TOUCHED","PLAY AGAIN IS TOUCHED ");
}
nextLevel.handleActionDown((int) event.getX(), (int) event.getY());
if(nextLevel.isTouched())
{
RANDOM_BACKGROUND = Math.abs(random.nextInt() % 9);
playagain.setBitmap(_bitmapCache
.get(R.drawable.play));
Log.i("next Level","Next level");
// nextLevel.setBitmap(_bitmapCache
// .get(R.drawable.play));
LEVEL_INITIALIZED=false;
LEVEL_ELAPSED_TIME=0;
LEVEL_CURRENT_TIME=0;
LEVEL_START_TIME=0;
LEVEL_SCORE=LEVEL_SCORE+CAN_CRUSHED;
SCORE =0;
CAN_CRUSHED=0;
CONTINUE_CAN_CRUSHED=0;
_cans.clear();
canadded=false;
Log.i("LEVEL RUNNING INSIDE NEXT CLICK",LEVEL_RUNNING_IS+"");
if(LEVEL_RUNNING_IS==11)
{
LEVEL_RUNNING_IS=12;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==12)
{
LEVEL_RUNNING_IS=13;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==13)
{
LEVEL_RUNNING_IS=21;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==21)
{
LEVEL_RUNNING_IS=22;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==22)
{
LEVEL_RUNNING_IS=23;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==23)
{
LEVEL_RUNNING_IS=31;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==31)
{
LEVEL_RUNNING_IS=32;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==32)
{
LEVEL_RUNNING_IS=33;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==33)
{
thread.killme();
_bitmapCache.clear();
((Activity) getContext()).finish();
nextLevel.setTouched(false);
}
nextLevel.setTouched(false);
}
}
if(!LEVEL_COMPLETE)
{
pause.handleActionDown((int) event.getX(), (int) event.getY());
home.handleActionDown((int) event.getX(), (int) event.getY());
if(home.isTouched())
{
if(!LEVEL_IS_PAUSED&&!DIALOG_SHOWN)
{
LEVEL_IS_PAUSED=true;
DIALOG_SHOWN = true;
pause.setTouched(false);
PAUSE_START_TIME = (int) (System.currentTimeMillis()/1000);
}else if(LEVEL_IS_PAUSED&&DIALOG_SHOWN)
{
// pause.setBitmap(_bitmapCache.get(R.drawable.pause));
// LEVEL_IS_PAUSED=false;
// LEVEL_START_TIME= LEVEL_START_TIME+PAUSED_ELAPSE_TIME;
// pause.setTouched(false);
}
}
if(pause.isTouched())
{
if(!LEVEL_IS_PAUSED)
{
pause.setBitmap(_bitmapCache.get(R.drawable.gplay));
LEVEL_IS_PAUSED=true;
pause.setTouched(false);
PAUSE_START_TIME = (int) (System.currentTimeMillis()/1000);
}else if(LEVEL_IS_PAUSED&&!DIALOG_SHOWN)
{
pause.setBitmap(_bitmapCache.get(R.drawable.pause));
LEVEL_IS_PAUSED=false;
LEVEL_START_TIME= LEVEL_START_TIME+PAUSED_ELAPSE_TIME;
pause.setTouched(false);
}
}
if(!LEVEL_IS_PAUSED&&LEVEL_INITIALIZED)
{
for (can Can : _cans){
Can.handleActionDown((int) event.getX(), (int) event.getY());
if(Can.getwheelstep()==0&&Can.getcrushedstep()==0)
{
int ct ;
Boolean isdud = null;
if (Can.isTouched()) {
// ct = i;
alternate++;
ct = _cans.indexOf(Can);
if (Can.canisdud() == 0) {
Can.setBitmap(_bitmapCache
.get(R.drawable.crushepgreen));
Can.setcrushedCanestep(2);
isdud = false;
mSoundManager.playSound(2);
CAN_CRUSHED++;
SCORE++;
CONTINUE_CAN_CRUSHED++;
if(CONTINUE_CAN_CRUSHED>6)
{
if(Can.getwheelstep()==0)
Can.sewheelrotatestep(1);
mSoundManager.playSound(4);
CAN_CRUSHED = CAN_CRUSHED+CONTINUE_CAN_CRUSHED;
}
}
if (Can.canisdud() == 1) {
Can.setBitmap(_bitmapCache
.get(R.drawable.crushover));
Can.setcrushedCanestep(2);
mSoundManager.playSound(3);
isdud = true;
CONTINUE_CAN_CRUSHED=0;
CAN_CRUSHED--;
}
enableCans(ct, isdud);
// can[i].setTouched(false);
}
}
}
}
}
}
if (event.getAction() == MotionEvent.ACTION_UP) {
if(playagain.isTouched())
{
playagain.setBitmap(_bitmapCache
.get(R.drawable.play));
RANDOM_BACKGROUND = Math.abs(random.nextInt() % 9);
LEVEL_INITIALIZED=false;
LEVEL_ELAPSED_TIME=0;
LEVEL_CURRENT_TIME=0;
LEVEL_START_TIME=0;
playagain.setTouched(false);
CAN_CRUSHED=0;
SCORE =0;
CONTINUE_CAN_CRUSHED=0;
_cans.clear();
canadded=false;
Log.i("PLAY AGAIN IS TOUCHED","PLAY AGAIN IS TOUCHED ");
}
// if(nextLevel.isTouched())
// {
//
// Log.e("LEVEL RRUNNING IS",LEVEL_RUNNING_IS+"");
// RANDOM_BACKGROUND = Math.abs(random.nextInt() % 9);
// Log.i("next Level","Next level");
// nextLevel.setBitmap(_bitmapCache
// .get(R.drawable.play));
//
// LEVEL_INITIALIZED=false;
// LEVEL_ELAPSED_TIME=0;
// LEVEL_CURRENT_TIME=0;
// LEVEL_START_TIME=0;
// SCORE =0;
//
// CAN_CRUSHED=0;
// CONTINUE_CAN_CRUSHED=0;
// _cans.clear();
// canadded=false;
// Log.i("LEVEL RUNNING INSIDE NEXT CLICK",LEVEL_RUNNING_IS+"");
//
//
// if(LEVEL_RUNNING_IS==11)
// {
// LEVEL_RUNNING_IS=12;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==12)
// {
// LEVEL_RUNNING_IS=13;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==13)
// {
// LEVEL_RUNNING_IS=21;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==21)
// {
// LEVEL_RUNNING_IS=22;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==22)
// {
// LEVEL_RUNNING_IS=23;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==23)
// {
// LEVEL_RUNNING_IS=31;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==31)
// {
// LEVEL_RUNNING_IS=32;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==32)
// {
// LEVEL_RUNNING_IS=33;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==33)
// {
//
//// _bitmapCache.clear();
//// ((Activity) getContext()).finish();
// pausegamepanel();
////
// nextLevel.setTouched(false);
// }
// nextLevel.setTouched(false);
// }
}
}
return true;
}
int levelstart;
int tensecond=0;
float co;
float scoy;
float timex;
float timey;
int[] gb = {R.drawable.gb1,R.drawable.gb2,R.drawable.gb3,R.drawable.gb4,R.drawable.gb5,R.drawable.gb6,R.drawable.gb7,R.drawable.gb8,R.drawable.gb9,R.drawable.gb10};
float money = 3.2f;
public void render(Canvas canvas) {
if(LEVEL_INITIALIZED)
{
if(LEVEL_ELAPSED_TIME==TIME_LEFT)
{
if(LEVEL_RUNNING_IS==13)
{
if(LEVEL_SCORE>core.getlowesteasy(ct))
{
HIGH_SCORE_DIALOG = true;
}
}
if(LEVEL_RUNNING_IS==23)
{
if(LEVEL_SCORE>core.getlowestmedium(ct))
{
HIGH_SCORE_DIALOG = true;
}
}
if(LEVEL_RUNNING_IS==33)
{
if(LEVEL_SCORE>core.getlowesthard(ct))
{
HIGH_SCORE_DIALOG = true;
}
}
switch(LEVEL_RUNNING_IS)
{
case 11 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level1c1), 0, 0, null);
break;
case 12 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level1c2), 0, 0, null);
break;
case 13 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level1c3), 0, 0, null);
break;
case 21 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level2c1), 0, 0, null);
break;
case 22 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level2c2), 0, 0, null);
break;
case 23 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level2c3), 0, 0, null);
break;
case 31 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level3c1), 0, 0, null);
break;
case 32 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level3c2), 0, 0, null);
break;
case 33 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level3c3), 0, 0, null);
break;
}
//canvas.drawBitmap(_bitmapCache.get(R.drawable.level1c1), 0, 0,
//null);
/*Paint p = new Paint();
Typeface font = Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD);
p.setTextSize( 18 );
p.setTypeface( font );
p.setAntiAlias(true); */
// p.getTextBounds( HELLO_WORLD, 0, HELLO_WORLD.length(), textBounds );
//c.drawText( HELLO_WORLD, x, y, p );
canvas.drawText(CAN_CRUSHED+"", 190, 100, crushed);
canvas.drawText("You Recycled "+CAN_CRUSHED+" Cans"+"", 38, 130, l1);
//money = (float) (Float.parseFloat(CAN_CRUSHED+"")*0.045); //*****
money = (float) (Float.parseFloat(CAN_CRUSHED+"")*0.045);
canvas.drawText(money+"", 215, 191, earned);
//canvas.drawte
playagain.setX(getWidth()/2);
nextLevel.setX(getWidth()/2);
playagain.draw(canvas);
if(LEVEL_RUNNING_IS==33)
{
}
else
{
nextLevel.draw(canvas);
}
canvas.drawText("Play Again", getWidth()/2, 354, buttontext);
home.setX(50);
home.setY(450);
home.draw(canvas);
switch(LEVEL_RUNNING_IS)
{
case 11 : canvas.drawText("Move to Easy Level 2", getWidth()/2, 397, buttontext);
break;
case 12 : canvas.drawText("Move to Easy Level 3", getWidth()/2, 397, buttontext);
break;
case 13 : canvas.drawText("Move to Medium Level 1", getWidth()/2, 397, buttontext);
break;
case 21 : canvas.drawText("Move to Medium Level 2", getWidth()/2, 397, buttontext);
break;
case 22 : canvas.drawText("Move to Medium Level 3", getWidth()/2, 397, buttontext);
break;
case 23 : canvas.drawText("Move to Hard Level 1", getWidth()/2, 397, buttontext);
break;
case 31 : canvas.drawText("Move to Hard Level 2", getWidth()/2, 397, buttontext);
break;
case 32 : canvas.drawText("Move to Hard Level 3", getWidth()/2, 397, buttontext);
break;
case 33 : canvas.drawText("Move to Easy 1", getWidth()/2, 397, buttontext);
break;
}
if(DIALOG_SHOWN)
{
canvas.drawBitmap(_bitmapCache.get(R.drawable.dialoghome), getWidth()/2-(_bitmapCache.get(R.drawable.dialoghome).getWidth()/2), getHeight()/2-(_bitmapCache.get(R.drawable.dialoghome).getHeight()/2), null);
no.setX(200);
no.draw(canvas);
yes.draw(canvas);
}
if(HIGH_SCORE_DIALOG)
{
canvas.drawBitmap(_bitmapCache.get(R.drawable.high), getWidth()/2-(_bitmapCache.get(R.drawable.dialoghome).getWidth()/2), getHeight()/2-(_bitmapCache.get(R.drawable.high).getHeight()/2), null);
no.setX(200);
no.draw(canvas);
yes.draw(canvas);
}
LEVEL_COMPLETE=true;
LEVEL_INITIALIZED=true;
}
2) Class 2 Code
public class MainThread extends Thread {
private static final String TAG = MainThread.class.getSimpleName();
// Surface holder that can access the physical surface
private SurfaceHolder surfaceHolder;
// The actual view that handles inputs
// and draws to the surface
private MainGamePanel gamePanel;
// flag to hold game state
private boolean running;
public void setRunning(boolean running) {
this.running = running;
}
//public MainThread(SurfaceHolder surfaceHolder, MainGamePanel gamePanel)
public MainThread( MainGamePanel gamePanel){
super();
//this.surfaceHolder = surfaceHolder;
this.gamePanel = gamePanel;
}
public void killme()
{
running=false;
System.gc();
}
@Override
public void run() {
Canvas canvas;
Log.d(TAG, "Starting game loop");
while (running) {
canvas = null;
// try locking the canvas for exclusive pixel editing
// in the surface
try {
canvas = gamePanel.getHolder().lockCanvas();
synchronized (gamePanel.getHolder())
{
// update game state
// this.gamePanel.update();
// render state to the screen
// draws the canvas on the panel
this.gamePanel.initialise(canvas);
this.gamePanel.render(canvas);
}
} finally {
// in case of an exception the surface is not left in
// an inconsistent state
if (canvas != null) {
gamePanel.getHolder().unlockCanvasAndPost(canvas);
}
} // end finally
}
}
}
| android | null | null | null | null | 12/19/2011 05:09:06 | too localized | Force Close Error
===
I am new to android app, in my gaming app When i trying to click on my home screen(home) easy, medium, hard buttons then i am able to play the game after finishing the game my score is displayed on another screen(Score screen) in that screen one home i con is displayed when i click on that icon i displayed dialog box with Yes & No button when i click on Yes Button i have to go to my home screen but some times it's working fine but some times it's giving force close error. So any one can help me to over come that problem.Below is my code and screen shots.
1) MainGamePanel in this class 640 to 657 line numbers giving error & some times
2) MainThread in this class 69 line number giving error
1)Class One Code
public class MainGamePanel extends SurfaceView implements
SurfaceHolder.Callback {
private static final String TAG = MainGamePanel.class.getSimpleName();
private MainThread thread;
/// private can[] can = new can[15];
private ArrayList<can> _cans = new ArrayList<can>();
private SoundManager mSoundManager;
private int CAN_CRUSHED; // no. of crushed cane (for score)
private Paint paint;
private Paint bon;
private Paint intro;
private Paint crushed;
private Paint l1;
private Paint l2;
private Paint earned;
private Paint buttontext;
private int alternate = 1;
private int CONTINUE_CAN_CRUSHED = 0;
private Map<Integer, Bitmap> _bitmapCache = new HashMap<Integer, Bitmap>();
private int LEVEL_RUNNING_IS ;
private int LEVEL_START_TIME=0;
private int LEVEL_ELAPSED_TIME=0;
private int LEVEL_CURRENT_TIME=0;
private boolean LEVEL_COMPLETE=false;
private boolean LEVEL_IS_PAUSED =false;
private boolean DIALOG_SHOWN=false;
private boolean HIGH_SCORE_DIALOG = false;
private int TIME_LEFT =0;
private boolean LEVEL_INITIALIZED = false;
playButton playagain;
playButton nextLevel;
private int RANDOM_BACKGROUND = 0;
Random random ;
homeButton home;
pauseButton pause;
yesButton yes;
noButton no;
private int SCORE;
private int LEVEL_SCORE =0;
private int PAUSED_ELAPSE_TIME;
private int PAUSE_START_TIME;
score core;
// all time related variables
int state = 0;
long startTime = 0;
long currentTime = 0;
long timeElapsed = 0;
long timeRemaining = 0;
long prevTimeRemaining = 0;
Context ct;
public MainGamePanel(Context context , int level) {
super(context);
this.ct = context;
LEVEL_RUNNING_IS = level;
getHolder().addCallback(this);
fillBitmapCache();
mSoundManager = new SoundManager();
mSoundManager.initSounds(context);
mSoundManager.addSound(1, R.raw.crush7);
mSoundManager.addSound(2, R.raw.crush6);
mSoundManager.addSound(3, R.raw.bad_can);
mSoundManager.addSound(4, R.raw.bonus2);
mSoundManager.addSound(5, R.raw.crush5);
core = new score();
CAN_CRUSHED = 0;
paint = new Paint(); // used to write scores and timer
bon = new Paint(); // used to write scores and timer
intro = new Paint();
crushed = new Paint();
l1 = new Paint();
l2 = new Paint();
random = new Random();
earned = new Paint();
buttontext = new Paint();
crushed.setColor(Color.parseColor("#d00800"));
crushed.setTextSize(28);
crushed.setFakeBoldText(true);
crushed.setAntiAlias(true);
l1.setColor(Color.parseColor("#167b18"));
l1.setTextSize(24);
Typeface font = Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD);
l1.setTypeface(font);
l1.setAntiAlias(true);
earned.setColor(Color.parseColor("#d00800"));
earned.setTextSize(28);
earned.setAntiAlias(true);
earned.setFakeBoldText(true);
buttontext.setColor(Color.parseColor("#ffffff"));
buttontext.setTextSize(18);
buttontext.setAntiAlias(true);
buttontext.setTextAlign(Align.CENTER);
playagain = new playButton(_bitmapCache.get(R.drawable.play),getWidth()/2,348);
nextLevel = new playButton(_bitmapCache.get(R.drawable.play),getWidth()/2,390);
pause = new pauseButton(_bitmapCache.get(R.drawable.pause), getWidth()/2, getHeight()-20);
home = new homeButton(_bitmapCache.get(R.drawable.home), 30, getHeight()-20);
no = new noButton(_bitmapCache.get(R.drawable.dnobutton), 120, 290);
yes = new yesButton(_bitmapCache.get(R.drawable.dyesbutton), 120, 290);
RANDOM_BACKGROUND = Math.abs(random.nextInt() % 9);
thread = new MainThread( this);
setFocusable(true);
}
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
}
public void surfaceCreated(SurfaceHolder holder) {
if (!thread.isAlive()) {
thread = new MainThread( this);
}
thread.setRunning(true);
thread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
synchronized (getHolder())
{
if (event.getAction() == MotionEvent.ACTION_DOWN) {
// delegating event handling to the droid
if(HIGH_SCORE_DIALOG)
{
yes.handleActionDown((int) event.getX(), (int) event.getY());
no.handleActionDown((int) event.getX(), (int) event.getY());
if(yes.isTouched())
{
thread.setRunning(false);
thread.killme();
_bitmapCache.clear();
Intent myIntent = new Intent(ct, savescore.class);
Bundle bundle = new Bundle();
bundle.putString("SCORE",LEVEL_RUNNING_IS+"&&"+LEVEL_SCORE);
myIntent.putExtras(bundle);
((Activity) getContext()).startActivity(myIntent);
yes.setTouched(false);
}
if(no.isTouched())
{
LEVEL_SCORE=-1;
HIGH_SCORE_DIALOG = false;
}
}
if(DIALOG_SHOWN&&!HIGH_SCORE_DIALOG)
{
yes.handleActionDown((int) event.getX(), (int) event.getY());
no.handleActionDown((int) event.getX(), (int) event.getY());
if(yes.isTouched())
{
thread.setRunning(false);
thread.killme();
_bitmapCache.clear();
((Activity) getContext()).finish();
yes.setTouched(false);
}
if(no.isTouched())
{
DIALOG_SHOWN = false;
pause.setBitmap(_bitmapCache.get(R.drawable.pause));
LEVEL_IS_PAUSED=false;
LEVEL_START_TIME= LEVEL_START_TIME+PAUSED_ELAPSE_TIME;
no.setTouched(false);
}
}
if(LEVEL_COMPLETE&&!HIGH_SCORE_DIALOG)
{
playagain.handleActionDown((int) event.getX(), (int) event.getY());
home.handleActionDown((int) event.getX(), (int) event.getY());
if(home.isTouched())
{
if(!LEVEL_IS_PAUSED&&!DIALOG_SHOWN)
{
LEVEL_IS_PAUSED=true;
DIALOG_SHOWN = true;
pause.setTouched(false);
PAUSE_START_TIME = (int) (System.currentTimeMillis()/1000);
}else if(LEVEL_IS_PAUSED&&DIALOG_SHOWN)
{
// pause.setBitmap(_bitmapCache.get(R.drawable.pause));
// LEVEL_IS_PAUSED=false;
// LEVEL_START_TIME= LEVEL_START_TIME+PAUSED_ELAPSE_TIME;
// pause.setTouched(false);
}
}
if(playagain.isTouched())
{
RANDOM_BACKGROUND = Math.abs(random.nextInt() % 9);
LEVEL_INITIALIZED=false;
LEVEL_ELAPSED_TIME=0;
LEVEL_CURRENT_TIME=0;
LEVEL_START_TIME=0;
playagain.setTouched(false);
playagain.setBitmap(_bitmapCache
.get(R.drawable.play));
CAN_CRUSHED=0;
SCORE =0;
CONTINUE_CAN_CRUSHED=0;
_cans.clear();
canadded=false;
Log.i("PLAY AGAIN IS TOUCHED","PLAY AGAIN IS TOUCHED ");
}
nextLevel.handleActionDown((int) event.getX(), (int) event.getY());
if(nextLevel.isTouched())
{
RANDOM_BACKGROUND = Math.abs(random.nextInt() % 9);
playagain.setBitmap(_bitmapCache
.get(R.drawable.play));
Log.i("next Level","Next level");
// nextLevel.setBitmap(_bitmapCache
// .get(R.drawable.play));
LEVEL_INITIALIZED=false;
LEVEL_ELAPSED_TIME=0;
LEVEL_CURRENT_TIME=0;
LEVEL_START_TIME=0;
LEVEL_SCORE=LEVEL_SCORE+CAN_CRUSHED;
SCORE =0;
CAN_CRUSHED=0;
CONTINUE_CAN_CRUSHED=0;
_cans.clear();
canadded=false;
Log.i("LEVEL RUNNING INSIDE NEXT CLICK",LEVEL_RUNNING_IS+"");
if(LEVEL_RUNNING_IS==11)
{
LEVEL_RUNNING_IS=12;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==12)
{
LEVEL_RUNNING_IS=13;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==13)
{
LEVEL_RUNNING_IS=21;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==21)
{
LEVEL_RUNNING_IS=22;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==22)
{
LEVEL_RUNNING_IS=23;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==23)
{
LEVEL_RUNNING_IS=31;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==31)
{
LEVEL_RUNNING_IS=32;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==32)
{
LEVEL_RUNNING_IS=33;
nextLevel.setTouched(false);
}
else if(LEVEL_RUNNING_IS==33)
{
thread.killme();
_bitmapCache.clear();
((Activity) getContext()).finish();
nextLevel.setTouched(false);
}
nextLevel.setTouched(false);
}
}
if(!LEVEL_COMPLETE)
{
pause.handleActionDown((int) event.getX(), (int) event.getY());
home.handleActionDown((int) event.getX(), (int) event.getY());
if(home.isTouched())
{
if(!LEVEL_IS_PAUSED&&!DIALOG_SHOWN)
{
LEVEL_IS_PAUSED=true;
DIALOG_SHOWN = true;
pause.setTouched(false);
PAUSE_START_TIME = (int) (System.currentTimeMillis()/1000);
}else if(LEVEL_IS_PAUSED&&DIALOG_SHOWN)
{
// pause.setBitmap(_bitmapCache.get(R.drawable.pause));
// LEVEL_IS_PAUSED=false;
// LEVEL_START_TIME= LEVEL_START_TIME+PAUSED_ELAPSE_TIME;
// pause.setTouched(false);
}
}
if(pause.isTouched())
{
if(!LEVEL_IS_PAUSED)
{
pause.setBitmap(_bitmapCache.get(R.drawable.gplay));
LEVEL_IS_PAUSED=true;
pause.setTouched(false);
PAUSE_START_TIME = (int) (System.currentTimeMillis()/1000);
}else if(LEVEL_IS_PAUSED&&!DIALOG_SHOWN)
{
pause.setBitmap(_bitmapCache.get(R.drawable.pause));
LEVEL_IS_PAUSED=false;
LEVEL_START_TIME= LEVEL_START_TIME+PAUSED_ELAPSE_TIME;
pause.setTouched(false);
}
}
if(!LEVEL_IS_PAUSED&&LEVEL_INITIALIZED)
{
for (can Can : _cans){
Can.handleActionDown((int) event.getX(), (int) event.getY());
if(Can.getwheelstep()==0&&Can.getcrushedstep()==0)
{
int ct ;
Boolean isdud = null;
if (Can.isTouched()) {
// ct = i;
alternate++;
ct = _cans.indexOf(Can);
if (Can.canisdud() == 0) {
Can.setBitmap(_bitmapCache
.get(R.drawable.crushepgreen));
Can.setcrushedCanestep(2);
isdud = false;
mSoundManager.playSound(2);
CAN_CRUSHED++;
SCORE++;
CONTINUE_CAN_CRUSHED++;
if(CONTINUE_CAN_CRUSHED>6)
{
if(Can.getwheelstep()==0)
Can.sewheelrotatestep(1);
mSoundManager.playSound(4);
CAN_CRUSHED = CAN_CRUSHED+CONTINUE_CAN_CRUSHED;
}
}
if (Can.canisdud() == 1) {
Can.setBitmap(_bitmapCache
.get(R.drawable.crushover));
Can.setcrushedCanestep(2);
mSoundManager.playSound(3);
isdud = true;
CONTINUE_CAN_CRUSHED=0;
CAN_CRUSHED--;
}
enableCans(ct, isdud);
// can[i].setTouched(false);
}
}
}
}
}
}
if (event.getAction() == MotionEvent.ACTION_UP) {
if(playagain.isTouched())
{
playagain.setBitmap(_bitmapCache
.get(R.drawable.play));
RANDOM_BACKGROUND = Math.abs(random.nextInt() % 9);
LEVEL_INITIALIZED=false;
LEVEL_ELAPSED_TIME=0;
LEVEL_CURRENT_TIME=0;
LEVEL_START_TIME=0;
playagain.setTouched(false);
CAN_CRUSHED=0;
SCORE =0;
CONTINUE_CAN_CRUSHED=0;
_cans.clear();
canadded=false;
Log.i("PLAY AGAIN IS TOUCHED","PLAY AGAIN IS TOUCHED ");
}
// if(nextLevel.isTouched())
// {
//
// Log.e("LEVEL RRUNNING IS",LEVEL_RUNNING_IS+"");
// RANDOM_BACKGROUND = Math.abs(random.nextInt() % 9);
// Log.i("next Level","Next level");
// nextLevel.setBitmap(_bitmapCache
// .get(R.drawable.play));
//
// LEVEL_INITIALIZED=false;
// LEVEL_ELAPSED_TIME=0;
// LEVEL_CURRENT_TIME=0;
// LEVEL_START_TIME=0;
// SCORE =0;
//
// CAN_CRUSHED=0;
// CONTINUE_CAN_CRUSHED=0;
// _cans.clear();
// canadded=false;
// Log.i("LEVEL RUNNING INSIDE NEXT CLICK",LEVEL_RUNNING_IS+"");
//
//
// if(LEVEL_RUNNING_IS==11)
// {
// LEVEL_RUNNING_IS=12;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==12)
// {
// LEVEL_RUNNING_IS=13;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==13)
// {
// LEVEL_RUNNING_IS=21;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==21)
// {
// LEVEL_RUNNING_IS=22;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==22)
// {
// LEVEL_RUNNING_IS=23;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==23)
// {
// LEVEL_RUNNING_IS=31;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==31)
// {
// LEVEL_RUNNING_IS=32;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==32)
// {
// LEVEL_RUNNING_IS=33;
// nextLevel.setTouched(false);
// }
// else if(LEVEL_RUNNING_IS==33)
// {
//
//// _bitmapCache.clear();
//// ((Activity) getContext()).finish();
// pausegamepanel();
////
// nextLevel.setTouched(false);
// }
// nextLevel.setTouched(false);
// }
}
}
return true;
}
int levelstart;
int tensecond=0;
float co;
float scoy;
float timex;
float timey;
int[] gb = {R.drawable.gb1,R.drawable.gb2,R.drawable.gb3,R.drawable.gb4,R.drawable.gb5,R.drawable.gb6,R.drawable.gb7,R.drawable.gb8,R.drawable.gb9,R.drawable.gb10};
float money = 3.2f;
public void render(Canvas canvas) {
if(LEVEL_INITIALIZED)
{
if(LEVEL_ELAPSED_TIME==TIME_LEFT)
{
if(LEVEL_RUNNING_IS==13)
{
if(LEVEL_SCORE>core.getlowesteasy(ct))
{
HIGH_SCORE_DIALOG = true;
}
}
if(LEVEL_RUNNING_IS==23)
{
if(LEVEL_SCORE>core.getlowestmedium(ct))
{
HIGH_SCORE_DIALOG = true;
}
}
if(LEVEL_RUNNING_IS==33)
{
if(LEVEL_SCORE>core.getlowesthard(ct))
{
HIGH_SCORE_DIALOG = true;
}
}
switch(LEVEL_RUNNING_IS)
{
case 11 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level1c1), 0, 0, null);
break;
case 12 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level1c2), 0, 0, null);
break;
case 13 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level1c3), 0, 0, null);
break;
case 21 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level2c1), 0, 0, null);
break;
case 22 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level2c2), 0, 0, null);
break;
case 23 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level2c3), 0, 0, null);
break;
case 31 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level3c1), 0, 0, null);
break;
case 32 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level3c2), 0, 0, null);
break;
case 33 : canvas.drawBitmap(_bitmapCache.get(R.drawable.level3c3), 0, 0, null);
break;
}
//canvas.drawBitmap(_bitmapCache.get(R.drawable.level1c1), 0, 0,
//null);
/*Paint p = new Paint();
Typeface font = Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD);
p.setTextSize( 18 );
p.setTypeface( font );
p.setAntiAlias(true); */
// p.getTextBounds( HELLO_WORLD, 0, HELLO_WORLD.length(), textBounds );
//c.drawText( HELLO_WORLD, x, y, p );
canvas.drawText(CAN_CRUSHED+"", 190, 100, crushed);
canvas.drawText("You Recycled "+CAN_CRUSHED+" Cans"+"", 38, 130, l1);
//money = (float) (Float.parseFloat(CAN_CRUSHED+"")*0.045); //*****
money = (float) (Float.parseFloat(CAN_CRUSHED+"")*0.045);
canvas.drawText(money+"", 215, 191, earned);
//canvas.drawte
playagain.setX(getWidth()/2);
nextLevel.setX(getWidth()/2);
playagain.draw(canvas);
if(LEVEL_RUNNING_IS==33)
{
}
else
{
nextLevel.draw(canvas);
}
canvas.drawText("Play Again", getWidth()/2, 354, buttontext);
home.setX(50);
home.setY(450);
home.draw(canvas);
switch(LEVEL_RUNNING_IS)
{
case 11 : canvas.drawText("Move to Easy Level 2", getWidth()/2, 397, buttontext);
break;
case 12 : canvas.drawText("Move to Easy Level 3", getWidth()/2, 397, buttontext);
break;
case 13 : canvas.drawText("Move to Medium Level 1", getWidth()/2, 397, buttontext);
break;
case 21 : canvas.drawText("Move to Medium Level 2", getWidth()/2, 397, buttontext);
break;
case 22 : canvas.drawText("Move to Medium Level 3", getWidth()/2, 397, buttontext);
break;
case 23 : canvas.drawText("Move to Hard Level 1", getWidth()/2, 397, buttontext);
break;
case 31 : canvas.drawText("Move to Hard Level 2", getWidth()/2, 397, buttontext);
break;
case 32 : canvas.drawText("Move to Hard Level 3", getWidth()/2, 397, buttontext);
break;
case 33 : canvas.drawText("Move to Easy 1", getWidth()/2, 397, buttontext);
break;
}
if(DIALOG_SHOWN)
{
canvas.drawBitmap(_bitmapCache.get(R.drawable.dialoghome), getWidth()/2-(_bitmapCache.get(R.drawable.dialoghome).getWidth()/2), getHeight()/2-(_bitmapCache.get(R.drawable.dialoghome).getHeight()/2), null);
no.setX(200);
no.draw(canvas);
yes.draw(canvas);
}
if(HIGH_SCORE_DIALOG)
{
canvas.drawBitmap(_bitmapCache.get(R.drawable.high), getWidth()/2-(_bitmapCache.get(R.drawable.dialoghome).getWidth()/2), getHeight()/2-(_bitmapCache.get(R.drawable.high).getHeight()/2), null);
no.setX(200);
no.draw(canvas);
yes.draw(canvas);
}
LEVEL_COMPLETE=true;
LEVEL_INITIALIZED=true;
}
2) Class 2 Code
public class MainThread extends Thread {
private static final String TAG = MainThread.class.getSimpleName();
// Surface holder that can access the physical surface
private SurfaceHolder surfaceHolder;
// The actual view that handles inputs
// and draws to the surface
private MainGamePanel gamePanel;
// flag to hold game state
private boolean running;
public void setRunning(boolean running) {
this.running = running;
}
//public MainThread(SurfaceHolder surfaceHolder, MainGamePanel gamePanel)
public MainThread( MainGamePanel gamePanel){
super();
//this.surfaceHolder = surfaceHolder;
this.gamePanel = gamePanel;
}
public void killme()
{
running=false;
System.gc();
}
@Override
public void run() {
Canvas canvas;
Log.d(TAG, "Starting game loop");
while (running) {
canvas = null;
// try locking the canvas for exclusive pixel editing
// in the surface
try {
canvas = gamePanel.getHolder().lockCanvas();
synchronized (gamePanel.getHolder())
{
// update game state
// this.gamePanel.update();
// render state to the screen
// draws the canvas on the panel
this.gamePanel.initialise(canvas);
this.gamePanel.render(canvas);
}
} finally {
// in case of an exception the surface is not left in
// an inconsistent state
if (canvas != null) {
gamePanel.getHolder().unlockCanvasAndPost(canvas);
}
} // end finally
}
}
}
| 3 |
10,784,842 | 05/28/2012 12:40:25 | 1,401,284 | 05/17/2012 14:56:41 | 45 | 0 | How to check if SqlDataSource.SelectCommand returned null | I have a gridview and sqldatasource.
I'm using : SqlDatasource1.SelectCommand = "Select Name from Table Where RowID=@RowID";
how can I check if the the selectedcommand returned null ( no value found )
Thanks | c# | asp.net | null | null | null | 05/29/2012 04:38:45 | not a real question | How to check if SqlDataSource.SelectCommand returned null
===
I have a gridview and sqldatasource.
I'm using : SqlDatasource1.SelectCommand = "Select Name from Table Where RowID=@RowID";
how can I check if the the selectedcommand returned null ( no value found )
Thanks | 1 |
11,423,871 | 07/11/2012 00:21:36 | 20,134 | 09/21/2008 23:48:40 | 801 | 26 | Google big query "required parameter missing" with ruby gem | I'm using Google's [ruby api client][1] to talk to big query and I have it all set up and working, except for queries where I'm getting this error:
{"error"=>
{"errors"=>
[{"reason"=>"required",
"domain"=>"global",
"message"=>"Required parameter is missing"}],
"code"=>400,
"message"=>"Required parameter is missing"}}
Here is what I'm calling:
bq = client.discovered_api("bigquery", "v2")
resp = client.execute(
bq.jobs.query,
{ "projectId" => "1234",
"query" => "SELECT count(*) FROM [api_logs.api_logs_week_28__Jul_2012] where timestamp >= 1341817200 and timestamp <= 1341903599"
}
)
The frustrating part is on the [query api docs][2], these same exact parameters work just fine. Any ideas?
[1]: http://code.google.com/p/google-api-ruby-client/
[2]: https://developers.google.com/bigquery/docs/reference/v2/jobs/query | ruby | google | google-bigquery | null | null | null | open | Google big query "required parameter missing" with ruby gem
===
I'm using Google's [ruby api client][1] to talk to big query and I have it all set up and working, except for queries where I'm getting this error:
{"error"=>
{"errors"=>
[{"reason"=>"required",
"domain"=>"global",
"message"=>"Required parameter is missing"}],
"code"=>400,
"message"=>"Required parameter is missing"}}
Here is what I'm calling:
bq = client.discovered_api("bigquery", "v2")
resp = client.execute(
bq.jobs.query,
{ "projectId" => "1234",
"query" => "SELECT count(*) FROM [api_logs.api_logs_week_28__Jul_2012] where timestamp >= 1341817200 and timestamp <= 1341903599"
}
)
The frustrating part is on the [query api docs][2], these same exact parameters work just fine. Any ideas?
[1]: http://code.google.com/p/google-api-ruby-client/
[2]: https://developers.google.com/bigquery/docs/reference/v2/jobs/query | 0 |
11,262,469 | 06/29/2012 13:13:21 | 1,021,581 | 10/31/2011 07:52:34 | 16 | 2 | how to install wamp server without MySQL? | I need to use a stand alone MySQL server with wamp,
how to install wamp without its embedded MySQL server? | php | mysql | wamp | null | null | 06/30/2012 09:24:24 | off topic | how to install wamp server without MySQL?
===
I need to use a stand alone MySQL server with wamp,
how to install wamp without its embedded MySQL server? | 2 |
7,860,039 | 10/22/2011 13:55:53 | 974,688 | 10/01/2011 17:15:14 | 1 | 0 | Control MediaWiki generated html | I would like to control the html generated by the application. In other words: When an user saves an article the html article generated would have some aditional html tags. For example the first section of the article would be within a div, with a specific ID. BUt this shouldn't change the text when editing the article, only the "article view" panel would have that div. Was I clear enough?
Is there any extension that can help me?
If no, should I develop my own extension? If so can you give some advises about the flow? I never develop an extension, and any highlights and insights you can give would probably save lots of research time.
Thanks in advance | mediawiki | null | null | null | null | null | open | Control MediaWiki generated html
===
I would like to control the html generated by the application. In other words: When an user saves an article the html article generated would have some aditional html tags. For example the first section of the article would be within a div, with a specific ID. BUt this shouldn't change the text when editing the article, only the "article view" panel would have that div. Was I clear enough?
Is there any extension that can help me?
If no, should I develop my own extension? If so can you give some advises about the flow? I never develop an extension, and any highlights and insights you can give would probably save lots of research time.
Thanks in advance | 0 |
5,821,463 | 04/28/2011 15:54:27 | 246,568 | 01/08/2010 17:08:16 | 1,081 | 103 | searching a class hierarchy in Xcode 4 | Is there an easy way to search a class and its subclasses in Xcode 4? | search | xcode4 | null | null | null | null | open | searching a class hierarchy in Xcode 4
===
Is there an easy way to search a class and its subclasses in Xcode 4? | 0 |
290,779 | 11/14/2008 17:27:23 | 34,895 | 11/05/2008 23:02:02 | 11 | 5 | What is more important, testability of code, or adherence to OOP principles? | My teams evolution of TDD includes what appear to be departures from traditional oop.
1. Moving away from classes that are self sufficient
We still encapsulate data where appropriate. But in order to mock any helper classes, we usually create some way to externally set them via constructor or mutator.
2. We don't use private methods, ever.
In order to take advantage of our mocking framework (RhinoMocks) the methods can't be private. This has been the biggest one to "sell" to our traditional devs. And to some degree I see their point. I just value testing more.
What are your thoughts?
| oop | tdd | opinion | mocks | null | 04/05/2012 13:33:27 | not constructive | What is more important, testability of code, or adherence to OOP principles?
===
My teams evolution of TDD includes what appear to be departures from traditional oop.
1. Moving away from classes that are self sufficient
We still encapsulate data where appropriate. But in order to mock any helper classes, we usually create some way to externally set them via constructor or mutator.
2. We don't use private methods, ever.
In order to take advantage of our mocking framework (RhinoMocks) the methods can't be private. This has been the biggest one to "sell" to our traditional devs. And to some degree I see their point. I just value testing more.
What are your thoughts?
| 4 |
10,421,760 | 05/02/2012 21:07:55 | 1,371,080 | 05/02/2012 21:02:03 | 1 | 0 | Eclipse Property view connect wit swt tree widget | I am trying to create eclipse plugin for my application. I am struck and googled a lot to get to the answer. But cant crack the problem. Problem: I am able to create a Swt Tree widget with all the treeItem inside that. Now for each treeitem in tree, I wanted to show different set of properties in eclipse property view. I found examples how to connect Property view with TreeViwer but not for swt Tree widget. Can anyone point me to location where I can find this.
Thanks in advance,
Tor | eclipse-plugin | null | null | null | null | 05/07/2012 19:38:38 | not a real question | Eclipse Property view connect wit swt tree widget
===
I am trying to create eclipse plugin for my application. I am struck and googled a lot to get to the answer. But cant crack the problem. Problem: I am able to create a Swt Tree widget with all the treeItem inside that. Now for each treeitem in tree, I wanted to show different set of properties in eclipse property view. I found examples how to connect Property view with TreeViwer but not for swt Tree widget. Can anyone point me to location where I can find this.
Thanks in advance,
Tor | 1 |
8,880,622 | 01/16/2012 13:23:57 | 1,386,886 | 03/30/2010 10:29:42 | 39,113 | 1,355 | jQuery - set Ajax handler priority | actually the question is as simple as the topic says. Is there any way to give different ajax handlers a higher/lower priority (which means here, that they will fire earlier) ?
What do I mean? Well, I have to deal with a fairly huge web-app. Tons of Ajax requests are fired in different modules. Now, my goal is to implement a simple session-timeout mechanism. Each request sends the current session-id as parameter, if the session-id is not valid anymore, my backend script returns the request with a custom responser-header set (value is a uri).
So I'm basically going like this
window.jQuery && jQuery( document ).ajaxComplete(function( event, xhr, settings ) {
var redirectto = xhr.getResponseHeader( 'new_ajax_location' );
if( redirectto ) {
location.href = redirectto;
}
});
This does work like a charm of course, but my problem is that this global ajax event actually needs to get fired first 100% of the time, which is not the case. Some of those original ajax-requests handlers will throw an error because of missing or unexpected data, in that case, the global handler never gets executed.
Now, I'd be kinda happy if I wouldn't need to go through every single request handler and make it failsafe for invalid session data responses. I'd much more prefer to do the job at one particular place. But how can I make sure my global handler will get executed first ? | javascript | jquery | ajax | null | null | null | open | jQuery - set Ajax handler priority
===
actually the question is as simple as the topic says. Is there any way to give different ajax handlers a higher/lower priority (which means here, that they will fire earlier) ?
What do I mean? Well, I have to deal with a fairly huge web-app. Tons of Ajax requests are fired in different modules. Now, my goal is to implement a simple session-timeout mechanism. Each request sends the current session-id as parameter, if the session-id is not valid anymore, my backend script returns the request with a custom responser-header set (value is a uri).
So I'm basically going like this
window.jQuery && jQuery( document ).ajaxComplete(function( event, xhr, settings ) {
var redirectto = xhr.getResponseHeader( 'new_ajax_location' );
if( redirectto ) {
location.href = redirectto;
}
});
This does work like a charm of course, but my problem is that this global ajax event actually needs to get fired first 100% of the time, which is not the case. Some of those original ajax-requests handlers will throw an error because of missing or unexpected data, in that case, the global handler never gets executed.
Now, I'd be kinda happy if I wouldn't need to go through every single request handler and make it failsafe for invalid session data responses. I'd much more prefer to do the job at one particular place. But how can I make sure my global handler will get executed first ? | 0 |
10,882,365 | 06/04/2012 13:41:43 | 1,229,257 | 02/23/2012 20:02:55 | 38 | 0 | How to refer to me html5 canvas drawing more than once? | I've created a drawing using canvas which I intend to use multiple times for various navigation links, my problem is that when I refer to it more than once it will only show 1. Obviously I could duplicate the code for each instance but I plan on using this quite a lot so this is not ideal. Please have a look at the code below and the linked jsfiddle. Many thanks.
http://jsfiddle.net/LTu2H/
//first reference
<canvas id="canvasId" width="50" height="50"></canvas>
//second reference
<canvas id="canvasId" width="50" height="50"></canvas>
<script>
var context = document.getElementById("canvasId").getContext("2d");
var width = 125; // Triangle Width
var height = 45; // Triangle Height
var padding = 5;
// Draw a path
context.beginPath();
context.moveTo(padding + width-125, height + padding); // Top Corner
context.lineTo(padding + width-90,height-17 + padding); // point
context.lineTo(padding, height-35 + padding); // Bottom Left
context.closePath();
// Fill the path
context.fillStyle = "#9ea7b8";
context.fill();
</script>
| javascript | html5 | canvas | html5-canvas | getelementbyid | null | open | How to refer to me html5 canvas drawing more than once?
===
I've created a drawing using canvas which I intend to use multiple times for various navigation links, my problem is that when I refer to it more than once it will only show 1. Obviously I could duplicate the code for each instance but I plan on using this quite a lot so this is not ideal. Please have a look at the code below and the linked jsfiddle. Many thanks.
http://jsfiddle.net/LTu2H/
//first reference
<canvas id="canvasId" width="50" height="50"></canvas>
//second reference
<canvas id="canvasId" width="50" height="50"></canvas>
<script>
var context = document.getElementById("canvasId").getContext("2d");
var width = 125; // Triangle Width
var height = 45; // Triangle Height
var padding = 5;
// Draw a path
context.beginPath();
context.moveTo(padding + width-125, height + padding); // Top Corner
context.lineTo(padding + width-90,height-17 + padding); // point
context.lineTo(padding, height-35 + padding); // Bottom Left
context.closePath();
// Fill the path
context.fillStyle = "#9ea7b8";
context.fill();
</script>
| 0 |
11,514,905 | 07/17/2012 01:34:00 | 568,503 | 01/09/2011 02:27:32 | 305 | 6 | Using UIAlert View To Let User Enter Title | I'm creating a a Master-Detail Splitview app and I'm using a `UIAlertView` in the `insertNewObject` method to let the user define a title for the new object being added to the master view. I've used the code and guide from this question [linky][1] by Warkst.
My problem is that when the alert view is called the rest of the insertNewObject function continues to run and therefore creates a new object with a blank title, as it finishes running before the AlertView even has a chance to appear.
The code I'm using is as follows, with the first method being `insertNewObject` and the second being the method the AlertView calls when the button is pressed. `newTitle` is a global variable.
- (void)insertNewObject:(id)sender
{
//Make sure clear before we start, also make sure initalized (double redundancy with clear statement at end)
newTitle = @"";
//New Title pop up UIAlert View
UIAlertView * alert = [[UIAlertView alloc]
initWithTitle:@"New Object"
message:@"Please enter a name for object"
delegate:self
cancelButtonTitle:@"Create"
otherButtonTitles:nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alert textFieldAtIndex:0];
alertTextField.keyboardType = UIKeyboardTypeDefault;
alertTextField.placeholder = @"Enter a new title";
[alert show];
//Create and enter new object.
if (!_objects)
{
_objects = [[NSMutableArray alloc] init];
}
[_objects insertObject:newTitle atIndex:0];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
//Clear newTitle for use next time
newTitle = @"";
}
UIAlertView button clicked method
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
newTitle = [[alertView textFieldAtIndex:0] text];
}
[1]: http://stackoverflow.com/questions/6319417/whats-a-simple-way-to-get-a-text-input-popup-dialog-box-on-an-iphone
| methods | uialertview | master-detail | null | null | null | open | Using UIAlert View To Let User Enter Title
===
I'm creating a a Master-Detail Splitview app and I'm using a `UIAlertView` in the `insertNewObject` method to let the user define a title for the new object being added to the master view. I've used the code and guide from this question [linky][1] by Warkst.
My problem is that when the alert view is called the rest of the insertNewObject function continues to run and therefore creates a new object with a blank title, as it finishes running before the AlertView even has a chance to appear.
The code I'm using is as follows, with the first method being `insertNewObject` and the second being the method the AlertView calls when the button is pressed. `newTitle` is a global variable.
- (void)insertNewObject:(id)sender
{
//Make sure clear before we start, also make sure initalized (double redundancy with clear statement at end)
newTitle = @"";
//New Title pop up UIAlert View
UIAlertView * alert = [[UIAlertView alloc]
initWithTitle:@"New Object"
message:@"Please enter a name for object"
delegate:self
cancelButtonTitle:@"Create"
otherButtonTitles:nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alert textFieldAtIndex:0];
alertTextField.keyboardType = UIKeyboardTypeDefault;
alertTextField.placeholder = @"Enter a new title";
[alert show];
//Create and enter new object.
if (!_objects)
{
_objects = [[NSMutableArray alloc] init];
}
[_objects insertObject:newTitle atIndex:0];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
//Clear newTitle for use next time
newTitle = @"";
}
UIAlertView button clicked method
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
newTitle = [[alertView textFieldAtIndex:0] text];
}
[1]: http://stackoverflow.com/questions/6319417/whats-a-simple-way-to-get-a-text-input-popup-dialog-box-on-an-iphone
| 0 |
8,022,761 | 11/05/2011 19:40:36 | 856,014 | 07/21/2011 13:14:14 | 32 | 0 | Rscript on ubuntu | Where can I install Rscript from? I need to run an R script from a php file using exec. However I need to install Rscript first. | r | ubuntu | null | null | null | null | open | Rscript on ubuntu
===
Where can I install Rscript from? I need to run an R script from a php file using exec. However I need to install Rscript first. | 0 |
7,867,602 | 10/23/2011 16:53:13 | 555,690 | 12/28/2010 06:15:35 | 881 | 3 | Declaring variables within interface or implementation? | In objective-c, I can declare an `int` or `bool` etc in the `.m` file, **outside** any function. That allows me to use such variable everywhere in the class.
I can also declare such variables in the `.h` file, inside the interface block, achieving the same result.
Well, my question is: what is the difference? Is there? Or is it all a matter of organization? | objective-c | variables | null | null | null | null | open | Declaring variables within interface or implementation?
===
In objective-c, I can declare an `int` or `bool` etc in the `.m` file, **outside** any function. That allows me to use such variable everywhere in the class.
I can also declare such variables in the `.h` file, inside the interface block, achieving the same result.
Well, my question is: what is the difference? Is there? Or is it all a matter of organization? | 0 |
8,695,425 | 01/01/2012 20:49:04 | 956,689 | 09/21/2011 10:27:33 | 553 | 1 | most efficient A* search algorithm | Is there a known 'most efficient' version of the A* search algorithm? I know some people write papers on the most efficient way to compute common operations, has this been done for A*? | c++ | null | null | null | null | 01/01/2012 22:13:28 | not constructive | most efficient A* search algorithm
===
Is there a known 'most efficient' version of the A* search algorithm? I know some people write papers on the most efficient way to compute common operations, has this been done for A*? | 4 |
9,494,475 | 02/29/2012 06:22:49 | 588,785 | 01/25/2011 09:41:32 | 30 | 2 | how to include pyenchant (enchant) to my py2app bundle? | I use this script for create bundle:
from setuptools import setup
APP = ['main.py']
OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui','PyQt4.QtNetwork','enchant'],
'excludes': ['PyQt4.QtDesigner', 'PyQt4.QtOpenGL', 'PyQt4.QtScript', 'PyQt4.QtSql', 'PyQt4.QtTest', 'PyQt4.QtWebKit', 'PyQt4.QtXml', 'PyQt4.phonon']}
setup(
app=APP,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
but enchant does not included in resulting bundle. | python | pyqt4 | py2app | null | null | null | open | how to include pyenchant (enchant) to my py2app bundle?
===
I use this script for create bundle:
from setuptools import setup
APP = ['main.py']
OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui','PyQt4.QtNetwork','enchant'],
'excludes': ['PyQt4.QtDesigner', 'PyQt4.QtOpenGL', 'PyQt4.QtScript', 'PyQt4.QtSql', 'PyQt4.QtTest', 'PyQt4.QtWebKit', 'PyQt4.QtXml', 'PyQt4.phonon']}
setup(
app=APP,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
but enchant does not included in resulting bundle. | 0 |
2,554,241 | 03/31/2010 15:29:16 | 298,537 | 03/21/2010 17:46:00 | 32 | 0 | How to change button background image on mouseOver? | I have img1, and img2 in my resources. I have easily set btn.backgroundImage as img1 in btn properties. Images paths are: c:\Project\Resources\...
Now I don't know how to set btn.backgroundImage to be img2, I want to do it on event "MouseEnter". So I would apreciate complete code, because I am pretty green about this...
I apreciate any given idea... | button | c# | image | null | null | null | open | How to change button background image on mouseOver?
===
I have img1, and img2 in my resources. I have easily set btn.backgroundImage as img1 in btn properties. Images paths are: c:\Project\Resources\...
Now I don't know how to set btn.backgroundImage to be img2, I want to do it on event "MouseEnter". So I would apreciate complete code, because I am pretty green about this...
I apreciate any given idea... | 0 |
2,253,583 | 02/12/2010 17:05:08 | 252,160 | 01/16/2010 13:27:17 | 39 | 2 | What PHP framework to choose for a Senior Project | I am working on my senior project, and the topic that we agreed on was a CMS that similarly to Drupal would make things easier by providing robust administration capabilities
Some of them include:
Content type and data field creation (CCK)
Views Creation
complex user management (tasks and roles)
the ability to add third party modules later on - hooks
templating capabilitites
Now the thing is, I would have to show sufficient knowledge and understanding of software architectures, and the development process. I will not start from scratch, for sure, but I can't demonstrate Drupal in my documentation either
I would like to use a framework that one could build skills on, one that is not overly complex, and one, that will still make me write code - the senior project is about my work, not about the work of the php community
I started with Kohana, yet, I didnt like it very much. Its poor documentation, and the frequent changes in the code base made me stop.
I am thinking of something very small and sweet, something that doesn't show up in every step and say : "hey you know what, I can do that better than you" Something like CakePHP, maybe.
I know that more or less, all the code I need is available out there. However, the point here is just a little bit more academical.
Any suggestions ? | drupal | php | content-management-system | kohana | cakephp | 07/12/2011 18:19:35 | not constructive | What PHP framework to choose for a Senior Project
===
I am working on my senior project, and the topic that we agreed on was a CMS that similarly to Drupal would make things easier by providing robust administration capabilities
Some of them include:
Content type and data field creation (CCK)
Views Creation
complex user management (tasks and roles)
the ability to add third party modules later on - hooks
templating capabilitites
Now the thing is, I would have to show sufficient knowledge and understanding of software architectures, and the development process. I will not start from scratch, for sure, but I can't demonstrate Drupal in my documentation either
I would like to use a framework that one could build skills on, one that is not overly complex, and one, that will still make me write code - the senior project is about my work, not about the work of the php community
I started with Kohana, yet, I didnt like it very much. Its poor documentation, and the frequent changes in the code base made me stop.
I am thinking of something very small and sweet, something that doesn't show up in every step and say : "hey you know what, I can do that better than you" Something like CakePHP, maybe.
I know that more or less, all the code I need is available out there. However, the point here is just a little bit more academical.
Any suggestions ? | 4 |
9,459,607 | 02/27/2012 03:14:46 | 1,234,700 | 02/27/2012 02:52:57 | 1 | 0 | How does Insertion Sort, Quick Sort, and Merge Sort work? Also what is the cost (Big Oh) of queue and stack operations? | My apologies if this is long.
***Insertion Sort***
Lets start with Insertion Sort. I understand how Insertion Sort works but would like to clarify if I am understanding it correctly. Insertion Sort "brute forces" the array or whatever it is sorting. It starts from the very left position and the position after that. It sorts those two and keeps continuing until the whole array has been sorted. Here is the example in my head:
[1] [5] [2] [58] [5] [27] [25]
^ ^
[1] [5] [2] [58] [5] [27] [25]
^ ^
[1] [2] [5] [58] [5] [27] [25]
[1] [2] [5] [58] [5] [27] [25]
^ ^
and so forth until it reaches
[1] [2] [5] [5] [25] [27] [58]
***Quick Sort:***
This is the one I understand the least and would like some clarification. The easiest way for me to understand this was watching this video: http://www.youtube.com/watch?v=ywWBy6J5gz8. From my understanding, a pivot point is chosen, most likely the median as it is the easiest and sorts. Choosing a bad pivot can lead to worse big oh behavior because of the number of inversions it has to make.
[1] [5] [2] [58] [5] [27] [25]
^
pivot
Sort the left side of the array
[1] [5] [2] [58]
^ ^
[1] [5] [2] [58]
^ ^
[1] [5] [2] [58]
^ ^
[1] [5] [2] [58]
^ ^
[1] [5] [2] [58]
^ ^
[1] [2] [5] [58]
^ ^
right side of the array
[5] [27] [25]
^ ^
[5] [27] [25]
^ ^
[5] [27] [25]
^ ^
[5] [25] [27]
merge the two arrays
Where does recursion take place? Sample code?
I believe this is how it works, PLEASE correct me if I am wrong.
***Merge Sort***
This one makes the most sense to me, split the array up until you you can't do it anymore. So array.length/2. Then this is where the confusing part sets in. You have the main array and you begin to sort, you start sorting from the very beginning through the array, two pieces at a time. Where do you determine how to iterate through the array, how do you determine your starting point and ending points when you are going through your array? Then you create a temp array and store it. This one is by far the hardest to explain so please forgive me. I looked at the wiki page for a better example for merge sort and it does a great job, but im just confused as to how it iterates through the main array and sorts it.
***Queue and Stack***
After researching for a bit, I understand what these are. The one thing I haven't been able to look up is, what kind of Big Oh behavior do each of its techniques use?
for a stack this is what I THINK it is: Enqueue is constant, Dequeue is constant, and peek is constant
for a queue: Enqueue is constant, Dequeue is linear, and peek is linear.
if someone could clarify any of these things, or have any picture examples, I would greatly appreciate it,
Thank you.
| java | null | null | null | null | 02/27/2012 13:18:03 | not a real question | How does Insertion Sort, Quick Sort, and Merge Sort work? Also what is the cost (Big Oh) of queue and stack operations?
===
My apologies if this is long.
***Insertion Sort***
Lets start with Insertion Sort. I understand how Insertion Sort works but would like to clarify if I am understanding it correctly. Insertion Sort "brute forces" the array or whatever it is sorting. It starts from the very left position and the position after that. It sorts those two and keeps continuing until the whole array has been sorted. Here is the example in my head:
[1] [5] [2] [58] [5] [27] [25]
^ ^
[1] [5] [2] [58] [5] [27] [25]
^ ^
[1] [2] [5] [58] [5] [27] [25]
[1] [2] [5] [58] [5] [27] [25]
^ ^
and so forth until it reaches
[1] [2] [5] [5] [25] [27] [58]
***Quick Sort:***
This is the one I understand the least and would like some clarification. The easiest way for me to understand this was watching this video: http://www.youtube.com/watch?v=ywWBy6J5gz8. From my understanding, a pivot point is chosen, most likely the median as it is the easiest and sorts. Choosing a bad pivot can lead to worse big oh behavior because of the number of inversions it has to make.
[1] [5] [2] [58] [5] [27] [25]
^
pivot
Sort the left side of the array
[1] [5] [2] [58]
^ ^
[1] [5] [2] [58]
^ ^
[1] [5] [2] [58]
^ ^
[1] [5] [2] [58]
^ ^
[1] [5] [2] [58]
^ ^
[1] [2] [5] [58]
^ ^
right side of the array
[5] [27] [25]
^ ^
[5] [27] [25]
^ ^
[5] [27] [25]
^ ^
[5] [25] [27]
merge the two arrays
Where does recursion take place? Sample code?
I believe this is how it works, PLEASE correct me if I am wrong.
***Merge Sort***
This one makes the most sense to me, split the array up until you you can't do it anymore. So array.length/2. Then this is where the confusing part sets in. You have the main array and you begin to sort, you start sorting from the very beginning through the array, two pieces at a time. Where do you determine how to iterate through the array, how do you determine your starting point and ending points when you are going through your array? Then you create a temp array and store it. This one is by far the hardest to explain so please forgive me. I looked at the wiki page for a better example for merge sort and it does a great job, but im just confused as to how it iterates through the main array and sorts it.
***Queue and Stack***
After researching for a bit, I understand what these are. The one thing I haven't been able to look up is, what kind of Big Oh behavior do each of its techniques use?
for a stack this is what I THINK it is: Enqueue is constant, Dequeue is constant, and peek is constant
for a queue: Enqueue is constant, Dequeue is linear, and peek is linear.
if someone could clarify any of these things, or have any picture examples, I would greatly appreciate it,
Thank you.
| 1 |
3,510,987 | 08/18/2010 10:14:20 | 423,848 | 08/18/2010 10:14:20 | 1 | 0 | what is the persistent c++ system? | plz Send me the answer of the following question.
what is the persistent c++ system? | c++ | null | null | null | null | 08/18/2010 10:27:40 | not a real question | what is the persistent c++ system?
===
plz Send me the answer of the following question.
what is the persistent c++ system? | 1 |
9,706,365 | 03/14/2012 16:52:37 | 1,020,779 | 10/30/2011 14:47:49 | 139 | 0 | How to edit in gridview? | How to edit in gridview? I have created on form,in that form i taking value from
user and inserting into table and again showing in grid.That grid has edit button,in that button click event,it fetch id from that row and perticular entry are shown in textbox and update that.?How to fetch the id from edit button?
| asp.net | null | null | null | null | 03/15/2012 13:39:47 | not a real question | How to edit in gridview?
===
How to edit in gridview? I have created on form,in that form i taking value from
user and inserting into table and again showing in grid.That grid has edit button,in that button click event,it fetch id from that row and perticular entry are shown in textbox and update that.?How to fetch the id from edit button?
| 1 |
11,026,461 | 06/14/2012 03:57:58 | 1,345,034 | 04/19/2012 20:22:07 | 1 | 0 | What is the standard way to implement dynamic content changes with hashes in the URL? | Is the [Dynamic page replacing content][1] article on CSSTricks still best practices?
[1]: http://css-tricks.com/dynamic-page-replacing-content/ | css | css3 | null | null | null | 06/14/2012 06:08:21 | not a real question | What is the standard way to implement dynamic content changes with hashes in the URL?
===
Is the [Dynamic page replacing content][1] article on CSSTricks still best practices?
[1]: http://css-tricks.com/dynamic-page-replacing-content/ | 1 |
6,793,632 | 07/22/2011 17:16:02 | 855,360 | 07/21/2011 07:01:42 | 30 | 0 | How to escape quotes in a MYSQL query? | Example: The follwing query give me Quotes error in the field -> GET['email']
mysql_query(" select * from user_info where user_mail = '$_GET['email']' ")
| php | mysql | html | null | null | null | open | How to escape quotes in a MYSQL query?
===
Example: The follwing query give me Quotes error in the field -> GET['email']
mysql_query(" select * from user_info where user_mail = '$_GET['email']' ")
| 0 |
5,872,243 | 05/03/2011 15:56:27 | 538,497 | 12/10/2010 23:19:58 | 6 | 1 | C# save changes in database | i have database in postgresql,i get data from table and show it in treeview (recursively), then i change some nodes text (selectednode.text = txtbox.text .... ) and then when i push button, i want to save these changes to database, how i can do that ? | c# | null | null | null | null | 05/05/2011 13:11:09 | not a real question | C# save changes in database
===
i have database in postgresql,i get data from table and show it in treeview (recursively), then i change some nodes text (selectednode.text = txtbox.text .... ) and then when i push button, i want to save these changes to database, how i can do that ? | 1 |
5,251,430 | 03/09/2011 19:58:42 | 307,006 | 04/01/2010 15:07:50 | 59 | 1 | Using Weka for Game Playing | I am doing a project where I have neural networks (or other algorithms) play each other in poker. After each win or loss, I want the neural network (or other algorithm) to update in response to the error of the loss (how this is calculated is unimportant here).
Weka is very nice and I don't want to reinvent the wheel. However, Weka's API seems primarily designed to train from a dataset. Game playing doesn't use a dataset. Rather, the network plays, and then I want it to update itself based on its loss.
Is it possible to use the Weka API to update a network instead of a dataset but on one instance and do this over and over again? I'm I thinking about this right?
The other idea I also want to implement is use a genetic algorithm to update the weights in a neural network, instead of the backpropogation algorithm. As far as I can tell, there is no way to manually specify the weights of a neural network in Weka. This, of course, is vital if using a genetic algorithm for this purpose.
Please help :) Thank you. | machine-learning | neural-network | genetic-algorithm | weka | null | null | open | Using Weka for Game Playing
===
I am doing a project where I have neural networks (or other algorithms) play each other in poker. After each win or loss, I want the neural network (or other algorithm) to update in response to the error of the loss (how this is calculated is unimportant here).
Weka is very nice and I don't want to reinvent the wheel. However, Weka's API seems primarily designed to train from a dataset. Game playing doesn't use a dataset. Rather, the network plays, and then I want it to update itself based on its loss.
Is it possible to use the Weka API to update a network instead of a dataset but on one instance and do this over and over again? I'm I thinking about this right?
The other idea I also want to implement is use a genetic algorithm to update the weights in a neural network, instead of the backpropogation algorithm. As far as I can tell, there is no way to manually specify the weights of a neural network in Weka. This, of course, is vital if using a genetic algorithm for this purpose.
Please help :) Thank you. | 0 |
10,757,500 | 05/25/2012 15:47:11 | 534,295 | 12/07/2010 22:14:15 | 1 | 1 | Collapse and deselect TFS pending changes hierarchy | The TFS pending changes view (VS2010) is annoying to use, especially the fact that the hierarchy view is always expanded. Further when I check in a few files, the pending changes view is refreshed and all the items are expanded and is selected. Considering there are multiple solutions in the workarea (which are functionally and logically disjoint) and at any time I could be working on multiple tracks, the auto refresh, expand and select forces me to go through each node and collapse and deselect it.
A bit of searching brought me to this [page][1] where there specify a workaround to have the Hierarichal view selected by default using macros. Extending this method to resolve the above issue didn't materialize as I believe the events of node collapse and deselection are not getting recorded.
Is there any solution to this issue similar to say the VS Power Tool which provided an exceptional feature 'Collapse All', that collapses all the projects in the solution!
Thank you in advance.
Regards.
[1]: https://connect.microsoft.com/VisualStudio/feedback/details/520449/window-pending-changes-does-not-remember-flat-or-hierarchical-view | visual-studio-2010 | view | tfs | hierarchical | pending-changes | null | open | Collapse and deselect TFS pending changes hierarchy
===
The TFS pending changes view (VS2010) is annoying to use, especially the fact that the hierarchy view is always expanded. Further when I check in a few files, the pending changes view is refreshed and all the items are expanded and is selected. Considering there are multiple solutions in the workarea (which are functionally and logically disjoint) and at any time I could be working on multiple tracks, the auto refresh, expand and select forces me to go through each node and collapse and deselect it.
A bit of searching brought me to this [page][1] where there specify a workaround to have the Hierarichal view selected by default using macros. Extending this method to resolve the above issue didn't materialize as I believe the events of node collapse and deselection are not getting recorded.
Is there any solution to this issue similar to say the VS Power Tool which provided an exceptional feature 'Collapse All', that collapses all the projects in the solution!
Thank you in advance.
Regards.
[1]: https://connect.microsoft.com/VisualStudio/feedback/details/520449/window-pending-changes-does-not-remember-flat-or-hierarchical-view | 0 |
5,565,626 | 04/06/2011 11:32:51 | 621,450 | 02/17/2011 13:21:11 | 1 | 0 | The function is just not working and everything seems right | $(document).ready(function(){
var curPage = $('#curPage').val();//current page
var totalNum = $('#totalNum').val();
totalNum = totalNum.toInt(10);
var perPage = 10;
var totalPages = totalNum/10;
createNavigation(totalPages){//stuff inside here}
getpageContents(curPage){//stuff inside here}
navigate(3);//for example
});
function navigate(index)
{
var curPage = $('#curPage').val();//current page
var totalPages = $('#pgNum').val();//
var totalNum = $('#totalNum').val();
$('#curPage').attr('value',index);
createNavigation(totalPages);
getpageContents(curPage);
} | javascript | jquery | html | null | null | 09/29/2011 22:09:54 | not a real question | The function is just not working and everything seems right
===
$(document).ready(function(){
var curPage = $('#curPage').val();//current page
var totalNum = $('#totalNum').val();
totalNum = totalNum.toInt(10);
var perPage = 10;
var totalPages = totalNum/10;
createNavigation(totalPages){//stuff inside here}
getpageContents(curPage){//stuff inside here}
navigate(3);//for example
});
function navigate(index)
{
var curPage = $('#curPage').val();//current page
var totalPages = $('#pgNum').val();//
var totalNum = $('#totalNum').val();
$('#curPage').attr('value',index);
createNavigation(totalPages);
getpageContents(curPage);
} | 1 |
11,727,765 | 07/30/2012 18:53:24 | 1,223,963 | 02/21/2012 17:25:47 | 1 | 0 | About Control meter | Can any body give me idea? Actually em working on Android Application in which i have to use
A meter like a general meter.In Which i Calculate some values then show ans and also control the needle of meter with respect to the result. e.g result is 45 and also show on a meter
like in this application
http://www.craziness.com/games/play-love-tester/
in which when i calculate the love among different people then this application show me result and also show result on the meter so i want to know what should i used in code to control the needle of the meter or you can say how to control the meter with respect to result.please any body give idea about the problem? | android | null | null | null | null | 08/01/2012 15:38:09 | not a real question | About Control meter
===
Can any body give me idea? Actually em working on Android Application in which i have to use
A meter like a general meter.In Which i Calculate some values then show ans and also control the needle of meter with respect to the result. e.g result is 45 and also show on a meter
like in this application
http://www.craziness.com/games/play-love-tester/
in which when i calculate the love among different people then this application show me result and also show result on the meter so i want to know what should i used in code to control the needle of the meter or you can say how to control the meter with respect to result.please any body give idea about the problem? | 1 |
11,356,015 | 07/06/2012 04:49:42 | 1,504,087 | 07/05/2012 13:05:07 | 1 | 0 | How to display folders with their downloadable files from server to a tree view in mvc3 using Razor |
I am very new to MVC3
Here I hav to show the folders with their downloadable files from server and display all in a tree view formate in view in MVC3 using Razor.
Please anyone can help me??
Thanks..... | c# | asp.net-mvc-3 | razor | using | null | 07/06/2012 08:26:31 | not constructive | How to display folders with their downloadable files from server to a tree view in mvc3 using Razor
===
I am very new to MVC3
Here I hav to show the folders with their downloadable files from server and display all in a tree view formate in view in MVC3 using Razor.
Please anyone can help me??
Thanks..... | 4 |
11,463,620 | 07/13/2012 03:11:43 | 1,346,673 | 04/20/2012 13:25:41 | 5 | 0 | php how to get specific data from the variable | i have a variable containing following data.
$cheers="<p>contant:op="This is apple"</p> <p>contant:op="This is school bus"</p> <p>contant:op="This is php code"</p> "
how i can get output like display below:
This is apple
This is school bus
This is php code
Thanks
| php | arrays | null | null | null | 07/13/2012 09:16:11 | too localized | php how to get specific data from the variable
===
i have a variable containing following data.
$cheers="<p>contant:op="This is apple"</p> <p>contant:op="This is school bus"</p> <p>contant:op="This is php code"</p> "
how i can get output like display below:
This is apple
This is school bus
This is php code
Thanks
| 3 |
6,306,360 | 06/10/2011 12:28:30 | 792,726 | 06/10/2011 12:17:36 | 1 | 1 | how to label " object " on an image ? Want Labeling algorithm code ? | How to write the connected component algorithm or some other algorithm where i can able to label the object in an image
Can any one please provide the coding in c++ / C ?
how to label " object " on an image ? Want Labeling algorithm code ?
| c++ | algorithm | null | null | null | 06/10/2011 12:35:29 | not a real question | how to label " object " on an image ? Want Labeling algorithm code ?
===
How to write the connected component algorithm or some other algorithm where i can able to label the object in an image
Can any one please provide the coding in c++ / C ?
how to label " object " on an image ? Want Labeling algorithm code ?
| 1 |
6,283,388 | 06/08/2011 18:22:49 | 267,702 | 02/06/2010 11:52:45 | 68 | 11 | graphic arts for software engineers | Can anyone recommend a good ebook, website, self-study course, etc. to help software engineers, programmers, etc. gain a basic knowledge of graphic arts. I'm interested in basic Photoshop/GIMP skills to help make and tweak icons, images, etc. when I don't have a professional graphic artist nearby to help out or if the job is too small to hire one.
Thanks,
gb | graphic | arts | null | null | null | 06/09/2011 22:17:14 | off topic | graphic arts for software engineers
===
Can anyone recommend a good ebook, website, self-study course, etc. to help software engineers, programmers, etc. gain a basic knowledge of graphic arts. I'm interested in basic Photoshop/GIMP skills to help make and tweak icons, images, etc. when I don't have a professional graphic artist nearby to help out or if the job is too small to hire one.
Thanks,
gb | 2 |
5,822,637 | 04/28/2011 17:29:43 | 107,694 | 05/15/2009 13:29:10 | 7,178 | 587 | Is there anything cool you can do with IPv6? | So, we've got us one of them fancy newfangled IPv6 connections to that intertube thing. And I've got the mission to stand up some sort of IPv6-only site to promote IPv6. But I'm at a loss as to what sort of cool, neat thing we could do to promote said protocol -- frankly the switch just isn't sexy.
So, crowd, what sorts of nifty things could you think up to do with an IIS box, ASP.NET 4 and IPv6? | asp.net | ipv6 | crazy-marketing-stunts | null | null | 04/28/2011 17:47:44 | not a real question | Is there anything cool you can do with IPv6?
===
So, we've got us one of them fancy newfangled IPv6 connections to that intertube thing. And I've got the mission to stand up some sort of IPv6-only site to promote IPv6. But I'm at a loss as to what sort of cool, neat thing we could do to promote said protocol -- frankly the switch just isn't sexy.
So, crowd, what sorts of nifty things could you think up to do with an IIS box, ASP.NET 4 and IPv6? | 1 |
4,211,424 | 11/18/2010 03:29:19 | 447,020 | 09/14/2010 05:41:11 | 6 | 1 | highlighting text as it is narrated(audio .mp3) | I'm using Cocos2d for all the animated sprite/transition stuff, but I'm not sure how to approach highlighting text as it is narrated.
Example: "Jack and Jill, drank their fill, and were too drunk to go for water." As the text is narrated (.mp3 plays on each page), the text would be highlighted.
If someone has a clue or sample code I'd really appreciate it.
Thanks
Shiva.
| ipad | null | null | null | null | null | open | highlighting text as it is narrated(audio .mp3)
===
I'm using Cocos2d for all the animated sprite/transition stuff, but I'm not sure how to approach highlighting text as it is narrated.
Example: "Jack and Jill, drank their fill, and were too drunk to go for water." As the text is narrated (.mp3 plays on each page), the text would be highlighted.
If someone has a clue or sample code I'd really appreciate it.
Thanks
Shiva.
| 0 |
3,336,777 | 07/26/2010 16:20:39 | 287,902 | 03/06/2010 19:50:00 | 62 | 3 | Can I limit an ASP.net HttpHandler scope? | I have an application that depends on a generic HttpHandler I created, and it works fine. The problem is that that there are many other applications under the same folder in IIS, and these other apps don't need to use and don't know (mustn't know) about this handler.
However, the Web.Config in which I register it ends up applying to all folders on the same level and all subfolders, and this is what I want to avoid.
Changing the structure of the apps inside IIS is not a possibility, unfortunately.
I thought of using the < location > tag on Web.config, but I'm under the impression it only changes rights to access and not visibility.
Any suggestions on how this can be overcome? | .net | asp.net | iis | httphandler | null | null | open | Can I limit an ASP.net HttpHandler scope?
===
I have an application that depends on a generic HttpHandler I created, and it works fine. The problem is that that there are many other applications under the same folder in IIS, and these other apps don't need to use and don't know (mustn't know) about this handler.
However, the Web.Config in which I register it ends up applying to all folders on the same level and all subfolders, and this is what I want to avoid.
Changing the structure of the apps inside IIS is not a possibility, unfortunately.
I thought of using the < location > tag on Web.config, but I'm under the impression it only changes rights to access and not visibility.
Any suggestions on how this can be overcome? | 0 |
2,623,585 | 04/12/2010 16:21:42 | 95,265 | 04/24/2009 01:28:43 | 436 | 5 | 1&1 web hosting and smtp configuration | Has anyone ever tried sending emails using 1&1 smtp host? I tried the following?
SmtpClient mailClient = new SmtpClient("smtp.1and1.com", 587);
But it always gives me a security exemption error...
I tried it using my local host and it works fine.. I tried using gmail's smtp and it worked fine as well... | smtp | web-hosting | asp.net | null | null | null | open | 1&1 web hosting and smtp configuration
===
Has anyone ever tried sending emails using 1&1 smtp host? I tried the following?
SmtpClient mailClient = new SmtpClient("smtp.1and1.com", 587);
But it always gives me a security exemption error...
I tried it using my local host and it works fine.. I tried using gmail's smtp and it worked fine as well... | 0 |
7,895,670 | 10/25/2011 20:49:23 | 618,283 | 02/15/2011 17:33:26 | 149 | 1 | Why am I getting a EXC BAD ACCESS error when I try to impliment this dynamic array? | Please let me know if I need to provide more/different parts of my program so far if what I've provided isn't enough.
I'm still working on my program with the Airline class. The Airline class contains a vairable to an array of dynamic Flight objects.
In the Airlines class I have (which can't be edited or changed, these are the header files given to me for the assignment):
//Airline.h
class Airline {
public:
Airline(); // default constructor
Airline(int capacity); // construct with capacity n
void cancel(int flightNum);
void add(Flight* flight);
Flight* find(int flightNum);
Flight* find(string dest);
int getSize();
private:
Flight **array; // dynamic array of pointers to flights
int capacity; // maximum number of flights
int size; // actual number of flights
void resize();
};
---
//Flight.h
class Flight {
public:
Flight();
// Default constructor
Flight(int fnum, string destination);
void reserveWindow();
void reserveAisle();
void reserveSeat(int row, char seat);
void setFlightNum(int fnum);
void setDestination(string dest);
int getFlightNum();
string getDest();
protected:
int flightNumber;
bool available[20][4]; //only four seat types per row; only 20 rows
string destination;
};
I'm trying to impliment the add() method.
for that, I have:
/* Flight **array; // dynamic array of pointers to flights
int capacity; // maximum number of flights
int size; // actual number of flights
*/
void Airline::add(Flight* flight){
if(size == capacity){
resize();
}
//Flight* newFlight = new Flight;
array[size] = flight; //This is where I get the EXC BAD ACCESS error
size++;
}
I don't understand why I'm getting this error. I'm assigning the address to the flight I created to the array. Am I not assigning it correctly?
Also, I'm not sure I created this resize method correctly:
void Airline::resize(){
Flight **temp = new Flight*[capacity * 2];
Flight **swapper;
for(int i = 0; i < capacity; i++){
temp[i] = array[i];
}
swapper = temp;
temp = array;
array = swapper;
delete [] temp;
capacity *= 2;
cout << "Capacity increased to " << capacity << endl;
}
// resizes the array if it exceeds capacity. New array is double size of old array.
| c++ | homework | dynamic-data | null | null | null | open | Why am I getting a EXC BAD ACCESS error when I try to impliment this dynamic array?
===
Please let me know if I need to provide more/different parts of my program so far if what I've provided isn't enough.
I'm still working on my program with the Airline class. The Airline class contains a vairable to an array of dynamic Flight objects.
In the Airlines class I have (which can't be edited or changed, these are the header files given to me for the assignment):
//Airline.h
class Airline {
public:
Airline(); // default constructor
Airline(int capacity); // construct with capacity n
void cancel(int flightNum);
void add(Flight* flight);
Flight* find(int flightNum);
Flight* find(string dest);
int getSize();
private:
Flight **array; // dynamic array of pointers to flights
int capacity; // maximum number of flights
int size; // actual number of flights
void resize();
};
---
//Flight.h
class Flight {
public:
Flight();
// Default constructor
Flight(int fnum, string destination);
void reserveWindow();
void reserveAisle();
void reserveSeat(int row, char seat);
void setFlightNum(int fnum);
void setDestination(string dest);
int getFlightNum();
string getDest();
protected:
int flightNumber;
bool available[20][4]; //only four seat types per row; only 20 rows
string destination;
};
I'm trying to impliment the add() method.
for that, I have:
/* Flight **array; // dynamic array of pointers to flights
int capacity; // maximum number of flights
int size; // actual number of flights
*/
void Airline::add(Flight* flight){
if(size == capacity){
resize();
}
//Flight* newFlight = new Flight;
array[size] = flight; //This is where I get the EXC BAD ACCESS error
size++;
}
I don't understand why I'm getting this error. I'm assigning the address to the flight I created to the array. Am I not assigning it correctly?
Also, I'm not sure I created this resize method correctly:
void Airline::resize(){
Flight **temp = new Flight*[capacity * 2];
Flight **swapper;
for(int i = 0; i < capacity; i++){
temp[i] = array[i];
}
swapper = temp;
temp = array;
array = swapper;
delete [] temp;
capacity *= 2;
cout << "Capacity increased to " << capacity << endl;
}
// resizes the array if it exceeds capacity. New array is double size of old array.
| 0 |
8,657,980 | 12/28/2011 15:47:23 | 884,778 | 10/18/2010 19:02:52 | 107 | 17 | How to make web service in PHP? | I want to make web service in php. Is there any php web service tutorial with example .
| php | web-services | web | null | null | 12/28/2011 15:56:48 | not a real question | How to make web service in PHP?
===
I want to make web service in php. Is there any php web service tutorial with example .
| 1 |
3,688,138 | 09/10/2010 20:32:59 | 444,723 | 09/10/2010 20:27:09 | 1 | 0 | Replace a number with another number. | So, I have a list of numbers:
1
2
3
17
8
9
23
...etc.
and I want to replace these numbers with another number, based on another list:
1001=1
1002=2
1003=3
1004=8
1005=23
1006=9
1007=17
What is the quickest way to do this, like using regular expression in Notepad++, etc.? | regex | null | null | null | null | 09/13/2010 01:27:41 | not a real question | Replace a number with another number.
===
So, I have a list of numbers:
1
2
3
17
8
9
23
...etc.
and I want to replace these numbers with another number, based on another list:
1001=1
1002=2
1003=3
1004=8
1005=23
1006=9
1007=17
What is the quickest way to do this, like using regular expression in Notepad++, etc.? | 1 |
7,551,267 | 09/26/2011 06:19:23 | 962,935 | 09/24/2011 19:06:31 | 1 | 0 | Can anyone please tell me how I can save anyone's location to my server? | Let me explain:
Just like Facebook how you can find people near your area who lives near you or miles away or if you know where they lived by using location to track down people. Still confuse? Here's another way of put it in simplest form.
Register to my site > Saves your location on my database > Finds people that lives near you > when you search for particular person you can find them easily > or by entering what school you enter (High School / College) > Friends
The reason is because I have ideas using this type for my future community, please help!
--------------------
What can I learn to make this happen? Think of it as a one gigantic map and you are somewhere and wherever you go you'll always be mark. | javascript | asp.net | database-design | web-applications | null | 10/07/2011 15:24:02 | not a real question | Can anyone please tell me how I can save anyone's location to my server?
===
Let me explain:
Just like Facebook how you can find people near your area who lives near you or miles away or if you know where they lived by using location to track down people. Still confuse? Here's another way of put it in simplest form.
Register to my site > Saves your location on my database > Finds people that lives near you > when you search for particular person you can find them easily > or by entering what school you enter (High School / College) > Friends
The reason is because I have ideas using this type for my future community, please help!
--------------------
What can I learn to make this happen? Think of it as a one gigantic map and you are somewhere and wherever you go you'll always be mark. | 1 |
10,914,321 | 06/06/2012 12:34:01 | 558,070 | 12/30/2010 08:23:03 | 61 | 7 | Delete statement in iphone not working | I am deleting all data from the table by using below code snippet
NSString *deleteStatementNS = [NSString stringWithFormat:
@"DELETE FROM %@",[tableNames objectAtIndex:i]];
const char *prepareDelete ="DELETE FROM '?'";
const char *tbleName = [[tableNames objectAtIndex:i] UTF8String];
if (sqlite3_prepare_v2(dBase, prepareDelete, -1, &dbpreprdstmnt, NULL) == SQLITE_OK)
{
dbrc = sqlite3_bind_text(dbpreprdstmnt, 1, tbleName, -1, SQLITE_TRANSIENT);
dbrc = sqlite3_step(dbpreprdstmnt);
sqlite3_finalize(dbpreprdstmnt);
dbpreprdstmnt = NULL;
} else {
NSLog(@"Error %@",[NSString stringWithCString:sqlite3_errmsg(dBase) encoding:NSUTF8StringEncoding]);
}'
But unfortunately the delete is not happening I am getting error as `Error no such table: ?`
I am not able to prepare the statement only. But if i use prepare statement like below
const char *prepareDelete =[deleteStatementNS UTF8String];
This is working absolutely fine. I am not able to bind the variable to stop SQL injection attacks.May I know the reason behind this error please. I found many places where this code snippet is reported as its is working fine.
| iphone | sql | ios | ipad | ios5 | null | open | Delete statement in iphone not working
===
I am deleting all data from the table by using below code snippet
NSString *deleteStatementNS = [NSString stringWithFormat:
@"DELETE FROM %@",[tableNames objectAtIndex:i]];
const char *prepareDelete ="DELETE FROM '?'";
const char *tbleName = [[tableNames objectAtIndex:i] UTF8String];
if (sqlite3_prepare_v2(dBase, prepareDelete, -1, &dbpreprdstmnt, NULL) == SQLITE_OK)
{
dbrc = sqlite3_bind_text(dbpreprdstmnt, 1, tbleName, -1, SQLITE_TRANSIENT);
dbrc = sqlite3_step(dbpreprdstmnt);
sqlite3_finalize(dbpreprdstmnt);
dbpreprdstmnt = NULL;
} else {
NSLog(@"Error %@",[NSString stringWithCString:sqlite3_errmsg(dBase) encoding:NSUTF8StringEncoding]);
}'
But unfortunately the delete is not happening I am getting error as `Error no such table: ?`
I am not able to prepare the statement only. But if i use prepare statement like below
const char *prepareDelete =[deleteStatementNS UTF8String];
This is working absolutely fine. I am not able to bind the variable to stop SQL injection attacks.May I know the reason behind this error please. I found many places where this code snippet is reported as its is working fine.
| 0 |
10,851,299 | 06/01/2012 13:34:38 | 1,384,441 | 05/09/2012 11:23:23 | 46 | 3 | Left floated div after the right floated div when small width | Example: http://jsfiddle.net/tkKth/
When I'm resizing my window (set `.container {width:200px;}`), the left div appears after the right div. Is there a way to do this with css, when the divs left/right change their position in the html doc?
->
`<div class="left">Left div</div> <div class="right">Right div</div>`
Thanks | html | css | responsive-design | null | null | null | open | Left floated div after the right floated div when small width
===
Example: http://jsfiddle.net/tkKth/
When I'm resizing my window (set `.container {width:200px;}`), the left div appears after the right div. Is there a way to do this with css, when the divs left/right change their position in the html doc?
->
`<div class="left">Left div</div> <div class="right">Right div</div>`
Thanks | 0 |
4,127,387 | 11/08/2010 19:44:38 | 452,047 | 01/16/2010 08:43:35 | 684 | 24 | Why doesn't SelectedValue Show Up In Intellisense For DropDownLists? | It doesn't show up in aspx pages, but it does in codebehind.
Are we not supposed to be using it?
Is it not there to make the intellisense list more manageable?
Did they screw up?
If I recall it wasn't there in previous versions as well... Anyone know the story? | c# | drop-down-menu | null | null | null | null | open | Why doesn't SelectedValue Show Up In Intellisense For DropDownLists?
===
It doesn't show up in aspx pages, but it does in codebehind.
Are we not supposed to be using it?
Is it not there to make the intellisense list more manageable?
Did they screw up?
If I recall it wasn't there in previous versions as well... Anyone know the story? | 0 |
5,755,129 | 04/22/2011 11:53:55 | 720,480 | 04/22/2011 11:53:55 | 1 | 0 | What is a "beautiful" software architecture criteria | I mean not simply a good or even excellent software architecture but something that makes you feel like watching some wonderfull piece of art, that produce emotional feelings. It's a matter of taste and up to some limit a philosophical question.
I would like to have your criterion about how to qualifie a piece of code, an algorithm, a software concept as **beautiful**, in its artistical meaning. | architecture | philosophy | art | null | null | 04/22/2011 12:11:11 | off topic | What is a "beautiful" software architecture criteria
===
I mean not simply a good or even excellent software architecture but something that makes you feel like watching some wonderfull piece of art, that produce emotional feelings. It's a matter of taste and up to some limit a philosophical question.
I would like to have your criterion about how to qualifie a piece of code, an algorithm, a software concept as **beautiful**, in its artistical meaning. | 2 |
7,215,675 | 08/27/2011 16:06:52 | 866,185 | 07/27/2011 19:44:41 | 18 | 1 | How to prevent resolving prefixes to namespaces in SOAP Request | I have a request XmlObject(got by calling toString):
<getEntitiesByKeysRequest xmlns="http://ossj.org/xml/Inventory/v1-2" xmlns:v1="http://ossj.org/xml/Common-CBECore/v1-5" xmlns:v11="http://ossj.org/xml/Common/v1-5" xmlns:soc="http://mycompany.com/messages">
<entityKeys>
<v1:item>
<v11:type>ID</v11:type>
<v11:primaryKey>
<soc:label>111111111111</soc:label>
</v11:primaryKey>
</v1:item>
<v1:item>
<v11:type>ptaAmOtoId</v11:type>
<v11:primaryKey>
<soc:label>222222222222</soc:label>
</v11:primaryKey>
</v1:item>
</entityKeys>
<attrNames/>
</getEntitiesByKeysRequest>
Before sending it Axis2 transforms it to:
<getEntitiesByKeysRequest xmlns="http://ossj.org/xml/Inventory/v1-2">
<entityKeys>
<item xmlns="http://ossj.org/xml/Common-CBECore/v1-5">
<type xmlns="http://ossj.org/xml/Common/v1-5">ID</type>
<primaryKey xmlns="http://ossj.org/xml/Common/v1-5">
<label xmlns="http://mycompany.com/messages">111111111111</label>
</primaryKey>
</item>
<item xmlns="http://ossj.org/xml/Common-CBECore/v1-5">
<type xmlns="http://ossj.org/xml/Common/v1-5">ptaAmOtoId</type>
<primaryKey xmlns="http://ossj.org/xml/Common/v1-5">
<label xmlns="http://mycompany.com/messages">222222222222</label>
</primaryKey>
</item>
</entityKeys>
<attrNames />
</getEntitiesByKeysRequest>
As you can see there is such a replacement of prefixes to namespaces leading by xmlns attribute.
How to avoid this replacement?
Thanks in advance
| axis2 | xmlbeans | null | null | null | null | open | How to prevent resolving prefixes to namespaces in SOAP Request
===
I have a request XmlObject(got by calling toString):
<getEntitiesByKeysRequest xmlns="http://ossj.org/xml/Inventory/v1-2" xmlns:v1="http://ossj.org/xml/Common-CBECore/v1-5" xmlns:v11="http://ossj.org/xml/Common/v1-5" xmlns:soc="http://mycompany.com/messages">
<entityKeys>
<v1:item>
<v11:type>ID</v11:type>
<v11:primaryKey>
<soc:label>111111111111</soc:label>
</v11:primaryKey>
</v1:item>
<v1:item>
<v11:type>ptaAmOtoId</v11:type>
<v11:primaryKey>
<soc:label>222222222222</soc:label>
</v11:primaryKey>
</v1:item>
</entityKeys>
<attrNames/>
</getEntitiesByKeysRequest>
Before sending it Axis2 transforms it to:
<getEntitiesByKeysRequest xmlns="http://ossj.org/xml/Inventory/v1-2">
<entityKeys>
<item xmlns="http://ossj.org/xml/Common-CBECore/v1-5">
<type xmlns="http://ossj.org/xml/Common/v1-5">ID</type>
<primaryKey xmlns="http://ossj.org/xml/Common/v1-5">
<label xmlns="http://mycompany.com/messages">111111111111</label>
</primaryKey>
</item>
<item xmlns="http://ossj.org/xml/Common-CBECore/v1-5">
<type xmlns="http://ossj.org/xml/Common/v1-5">ptaAmOtoId</type>
<primaryKey xmlns="http://ossj.org/xml/Common/v1-5">
<label xmlns="http://mycompany.com/messages">222222222222</label>
</primaryKey>
</item>
</entityKeys>
<attrNames />
</getEntitiesByKeysRequest>
As you can see there is such a replacement of prefixes to namespaces leading by xmlns attribute.
How to avoid this replacement?
Thanks in advance
| 0 |
2,270,528 | 02/16/2010 03:56:48 | 274,033 | 02/16/2010 03:19:35 | 1 | 0 | How can I set a value on a Linq object during the query? | I have a simple query i.e.
var trips = from t in ctx.Trips
select t;
The problem is that I have an extra property on the Trip object that needs to be assigned, preferably without iterating through the returned IQueryable.
Does anyone know how to set the value during the query? (i.e. select t, t.property = "value") | asp.net | c# | linq-to-sql | null | null | null | open | How can I set a value on a Linq object during the query?
===
I have a simple query i.e.
var trips = from t in ctx.Trips
select t;
The problem is that I have an extra property on the Trip object that needs to be assigned, preferably without iterating through the returned IQueryable.
Does anyone know how to set the value during the query? (i.e. select t, t.property = "value") | 0 |
9,516,408 | 03/01/2012 12:39:42 | 691,197 | 04/04/2011 13:41:10 | 9 | 0 | sorting in shell script | I have an array
arr=( x11 y12 x21 y22 x31 y32)
I need to sort this array to
x11
x21
x31
y12
y22
y32
So, I need to sort both alphabetical and numerical wise
How do I perform this in shell script ?
If I use [ $i -le $j ], it says "integer expression expected".
And the strings may contain other characters also 'x.1.1' or '1.x.1'.
How do I do this ?
| arrays | sorting | shell-scripting | null | null | null | open | sorting in shell script
===
I have an array
arr=( x11 y12 x21 y22 x31 y32)
I need to sort this array to
x11
x21
x31
y12
y22
y32
So, I need to sort both alphabetical and numerical wise
How do I perform this in shell script ?
If I use [ $i -le $j ], it says "integer expression expected".
And the strings may contain other characters also 'x.1.1' or '1.x.1'.
How do I do this ?
| 0 |
11,081,894 | 06/18/2012 11:31:10 | 478,144 | 10/16/2010 20:24:18 | 6,040 | 276 | Control scope of jQuery's index() function | I this: http://jsfiddle.net/ZP76c/
I'm trying to control the scope at which jQuery selects elements based off their index(), possible?
<div class="holder">
<div class="first">First</div>
<div class="second">Second</div>
<div class="first">First</div>
<div class="second">Second</div>
</div>
$('.holder div').click(function(){
alert($(this).index());
});
// desired behaviour: clicking the first 'first' div will alert: "0"
// clicking the second 'first' div, will alert: "1"
// so it takes the divs with a class of 'second' out of the index() calculation
// possible with jQuery .index()?
| jquery | null | null | null | null | null | open | Control scope of jQuery's index() function
===
I this: http://jsfiddle.net/ZP76c/
I'm trying to control the scope at which jQuery selects elements based off their index(), possible?
<div class="holder">
<div class="first">First</div>
<div class="second">Second</div>
<div class="first">First</div>
<div class="second">Second</div>
</div>
$('.holder div').click(function(){
alert($(this).index());
});
// desired behaviour: clicking the first 'first' div will alert: "0"
// clicking the second 'first' div, will alert: "1"
// so it takes the divs with a class of 'second' out of the index() calculation
// possible with jQuery .index()?
| 0 |
9,454,819 | 02/26/2012 16:30:26 | 1,002,902 | 10/19/2011 10:12:19 | 100 | 5 | How can I mock pirates in obfuscated source code? | I am working on a paying app which will have LVL enabled, which means that pirates will probably crack it - even if the app is worthless to them.
Given that I am planning on obfuscating code, is there a 'best practice' for inserting a message in the source code that will not be obfuscated ? | android | null | null | null | null | null | open | How can I mock pirates in obfuscated source code?
===
I am working on a paying app which will have LVL enabled, which means that pirates will probably crack it - even if the app is worthless to them.
Given that I am planning on obfuscating code, is there a 'best practice' for inserting a message in the source code that will not be obfuscated ? | 0 |
7,759,803 | 10/13/2011 20:05:00 | 994,207 | 10/13/2011 19:35:17 | 1 | 0 | Rendering part of a bitmap using Direct2D | I'm in the process of converting a custom CAD software from GDI to Direct2D. I'm having issues when panning the drawing. What I would like to do is to create a bitmap that's 3x as wide as the drawing window & 3x as high. Then, when the user begins to pan, I would render the part of the bitmap that should be visible.
Trouble is, it doesn't appear as though you can have bitmaps bigger than your render target. Here's approximately what I've done so far:
// Get the size of my drawing window.
RECT rect;
HDC hdc = GetDC(hwnd);
GetClipBox(hdc, &rect);
D2D1_SIZE_U size = D2D1::SizeU(
rect.right - rect.left,
rect.bottom - rect.top
);
// Now create the render target
ID2D1HwndRenderTarget *hwndRT = NULL;
hr = m_pD2DFactory->CreateHwndRenderTarget(
D2D1::RenderTargetProperties(),
D2D1::HwndRenderTargetProperties(hwnd, size),
&hwndRT
);
// And then the bitmap render target
ID2D1BitmapRenderTarget *bmpRT = NULL;
// We want it 3x as wide & 3x as high as the window
D2D1_SIZE_F size = D2D1::SizeF(
(rect.right - rect.left) * 3,
(rect.bottom - rect.top) * 3
);
hr = originalTarget->CreateCompatibleRenderTarget(
size,
&bmpRT
);
// Now I draw the geometry to my bitmap Render target...
// Then get the bitmap
ID2D1Bitmap* bmp = NULL;
bmpRT->GetBitmap(&bmp);
// From here I want to draw that bitmap on my hwndRenderTarget.
// Based on where my mouse was when I started panning, and where it is
// now, I can create a destination rectangle. It's the size of my
// drawing window
D2D1_RECT_U dest = D2D1::RectU(x1, y1, x1+size.width, y1+size.height);
hwndRT->DrawBitmap(
bmp,
NULL,
1.0,
D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
dest
);
So when I check the size of my bitmap, it checks out OK - it's the size of my bitmap render target, not my hwnd render target. But if I set x1 & y1 to 0, it should draw the top left-hand corner of the bitmap (which is some geometry off the screen). But it just draws the top left-corner of what **is** on the screen.
Does anyone have any experience with this? How can I create a fairly large bitmap, and then render a portion of it on a smaller-sized render target? Since I'm panning, the render will take place on every mouse-move, so it has to be reasonably performant. | c++ | direct2d | null | null | null | 10/20/2011 04:32:07 | too localized | Rendering part of a bitmap using Direct2D
===
I'm in the process of converting a custom CAD software from GDI to Direct2D. I'm having issues when panning the drawing. What I would like to do is to create a bitmap that's 3x as wide as the drawing window & 3x as high. Then, when the user begins to pan, I would render the part of the bitmap that should be visible.
Trouble is, it doesn't appear as though you can have bitmaps bigger than your render target. Here's approximately what I've done so far:
// Get the size of my drawing window.
RECT rect;
HDC hdc = GetDC(hwnd);
GetClipBox(hdc, &rect);
D2D1_SIZE_U size = D2D1::SizeU(
rect.right - rect.left,
rect.bottom - rect.top
);
// Now create the render target
ID2D1HwndRenderTarget *hwndRT = NULL;
hr = m_pD2DFactory->CreateHwndRenderTarget(
D2D1::RenderTargetProperties(),
D2D1::HwndRenderTargetProperties(hwnd, size),
&hwndRT
);
// And then the bitmap render target
ID2D1BitmapRenderTarget *bmpRT = NULL;
// We want it 3x as wide & 3x as high as the window
D2D1_SIZE_F size = D2D1::SizeF(
(rect.right - rect.left) * 3,
(rect.bottom - rect.top) * 3
);
hr = originalTarget->CreateCompatibleRenderTarget(
size,
&bmpRT
);
// Now I draw the geometry to my bitmap Render target...
// Then get the bitmap
ID2D1Bitmap* bmp = NULL;
bmpRT->GetBitmap(&bmp);
// From here I want to draw that bitmap on my hwndRenderTarget.
// Based on where my mouse was when I started panning, and where it is
// now, I can create a destination rectangle. It's the size of my
// drawing window
D2D1_RECT_U dest = D2D1::RectU(x1, y1, x1+size.width, y1+size.height);
hwndRT->DrawBitmap(
bmp,
NULL,
1.0,
D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
dest
);
So when I check the size of my bitmap, it checks out OK - it's the size of my bitmap render target, not my hwnd render target. But if I set x1 & y1 to 0, it should draw the top left-hand corner of the bitmap (which is some geometry off the screen). But it just draws the top left-corner of what **is** on the screen.
Does anyone have any experience with this? How can I create a fairly large bitmap, and then render a portion of it on a smaller-sized render target? Since I'm panning, the render will take place on every mouse-move, so it has to be reasonably performant. | 3 |
10,548,517 | 05/11/2012 09:06:10 | 1,355,400 | 04/25/2012 06:18:06 | 6 | 1 | HTML5 image editors | anyone know about the image editor in html5 and jQuery or example for that
including dragging, resizing, rotating anc etc
not flash | jquery | html5 | image-processing | null | null | 05/17/2012 00:20:42 | not a real question | HTML5 image editors
===
anyone know about the image editor in html5 and jQuery or example for that
including dragging, resizing, rotating anc etc
not flash | 1 |
2,888,633 | 05/22/2010 15:20:24 | 347,859 | 05/22/2010 15:20:24 | 1 | 0 | Changing careers to Software Engineering.... Wise? | I notice this site has a wealth of software professionals and I am investigating a career change to Software Engineering:
*Particularly, I would like to know how likely one would be able to work from home or another country over the internet. Is this something that can be done and what does it usually entail? (time?,experience?, specific companies?, etc)
*Currently, I am a teacher but always had a passion for tech. I am interested in a MS - Software Engineering program designed for individuals based from another field. Is this a wise degree to obtain? Would I be just wasting my time and money obtaining this degree? (I'm suspicious about this program and the feasibility of obtaining employment without a healthy CS background)
Thanks for any assistance you can provide! | career-development | null | null | null | null | 01/28/2012 20:44:49 | not constructive | Changing careers to Software Engineering.... Wise?
===
I notice this site has a wealth of software professionals and I am investigating a career change to Software Engineering:
*Particularly, I would like to know how likely one would be able to work from home or another country over the internet. Is this something that can be done and what does it usually entail? (time?,experience?, specific companies?, etc)
*Currently, I am a teacher but always had a passion for tech. I am interested in a MS - Software Engineering program designed for individuals based from another field. Is this a wise degree to obtain? Would I be just wasting my time and money obtaining this degree? (I'm suspicious about this program and the feasibility of obtaining employment without a healthy CS background)
Thanks for any assistance you can provide! | 4 |
6,830,761 | 07/26/2011 13:30:38 | 737,279 | 05/04/2011 03:42:36 | 55 | 0 | How to map a directory on my VPN to a location on my Windows 7 box at home? | How can I map a folder on my Ubuntu Server VPN (hosted elsewhere on the great Interwebnets) to a drive/folder on my Windows 7 box at home?
Preferably in a secure/encrypted manner that would allow me to safely access it from public wireless without having to worry about bad people doing bad things. | windows | linux | networking | remote-access | shared-directory | 07/26/2011 17:18:59 | off topic | How to map a directory on my VPN to a location on my Windows 7 box at home?
===
How can I map a folder on my Ubuntu Server VPN (hosted elsewhere on the great Interwebnets) to a drive/folder on my Windows 7 box at home?
Preferably in a secure/encrypted manner that would allow me to safely access it from public wireless without having to worry about bad people doing bad things. | 2 |
11,534,448 | 07/18/2012 04:46:37 | 303,979 | 03/29/2010 06:19:11 | 516 | 4 | Effective algorithm for matching complex name variations using Java | I have to match a number of store names and I am having a difficult time getting Levenshtein and SoundEx to yield acceptable results given my data.
Here are a few examples of what I'm dealing with:
The Home Depot
Office Depot
Apple store
Apple
Walgreens
Walgreens Denver
Quiznos
Quiznos Sandwich Restaurants
Most of these variations represent the same store, of course.
Any help would be great.
| java | algorithm | null | null | null | 07/18/2012 06:17:44 | not a real question | Effective algorithm for matching complex name variations using Java
===
I have to match a number of store names and I am having a difficult time getting Levenshtein and SoundEx to yield acceptable results given my data.
Here are a few examples of what I'm dealing with:
The Home Depot
Office Depot
Apple store
Apple
Walgreens
Walgreens Denver
Quiznos
Quiznos Sandwich Restaurants
Most of these variations represent the same store, of course.
Any help would be great.
| 1 |
10,833,773 | 05/31/2012 12:37:15 | 1,150,301 | 01/15/2012 11:37:55 | 1 | 0 | How to Create Web User Control in C# | Thanks All of u for help me on my Previous Topic.
Now i am Problem that How to Create User Control in C#.
Actually i want to create User Control for Website in C# . so please tell me Suggesion or send link where i can find Solutions.
thanks | c# | asp.net | null | null | null | 05/31/2012 13:59:36 | not a real question | How to Create Web User Control in C#
===
Thanks All of u for help me on my Previous Topic.
Now i am Problem that How to Create User Control in C#.
Actually i want to create User Control for Website in C# . so please tell me Suggesion or send link where i can find Solutions.
thanks | 1 |
8,943,093 | 01/20/2012 14:42:26 | 280,501 | 02/24/2010 16:29:27 | 143 | 9 | sql query getting groups of two or more similar rows | I have a table with this schema:
![enter image description here][1]
[1]: http://i.stack.imgur.com/iOVMr.jpg
The context is people who are traveling the same day and almost same hour.
What i need to obtain from it is:
**Groups of people who have a similar date (2 +/- hours max of diference) same place and same type and they have to appear two or more times together with that constrains.**
In the image above John and Steve should appear in the results since they share all the requisites for the query.
Thanks in advance.
| sql | query | null | null | null | null | open | sql query getting groups of two or more similar rows
===
I have a table with this schema:
![enter image description here][1]
[1]: http://i.stack.imgur.com/iOVMr.jpg
The context is people who are traveling the same day and almost same hour.
What i need to obtain from it is:
**Groups of people who have a similar date (2 +/- hours max of diference) same place and same type and they have to appear two or more times together with that constrains.**
In the image above John and Steve should appear in the results since they share all the requisites for the query.
Thanks in advance.
| 0 |
6,192,989 | 05/31/2011 20:11:28 | 77,451 | 03/12/2009 22:20:09 | 458 | 7 | storing n+1 objects in a solr document | I'm struggling to work out how the best way to store n+1 object in a solr document.
I am storing a CV/resume document in a solr document. I am looking at storing two different data types "education" and "employment"
If we look at education the object looks like this:
{
"establishment" => 'Oxford',
"Subject" => 'Computing',
"Type" => 'Degree',
"Grade" => '2:1
}
A CV can have n+1 of these objects depending on the contents of the CV. The search needs to be able to see that when I search for CV with Establishment = Oxford & Subject = Computing & Grade = 2:1 that it matches this object not a different establishment with the same subject and grade.
A multivalue I don't think would help or is possible to store n+1 of these types of objects.
My question is how to set up solr to be able to store this type of data against one "CV" Solr document so that it is search able as part of a general search of the index?
Thanks,
Grant
| php | search | lucene | solr | null | null | open | storing n+1 objects in a solr document
===
I'm struggling to work out how the best way to store n+1 object in a solr document.
I am storing a CV/resume document in a solr document. I am looking at storing two different data types "education" and "employment"
If we look at education the object looks like this:
{
"establishment" => 'Oxford',
"Subject" => 'Computing',
"Type" => 'Degree',
"Grade" => '2:1
}
A CV can have n+1 of these objects depending on the contents of the CV. The search needs to be able to see that when I search for CV with Establishment = Oxford & Subject = Computing & Grade = 2:1 that it matches this object not a different establishment with the same subject and grade.
A multivalue I don't think would help or is possible to store n+1 of these types of objects.
My question is how to set up solr to be able to store this type of data against one "CV" Solr document so that it is search able as part of a general search of the index?
Thanks,
Grant
| 0 |
2,891,687 | 05/23/2010 12:23:05 | 253,257 | 01/18/2010 14:38:41 | 1,439 | 149 | Good tutorial for ASP.net mvc 2 | I am an experienced asp.net web forms developer using c# but i have never used asp.net MVC. As I am just starting out with mvc i would like to start with mvc 2. I am looking for a good intro/tutorial to help me understand the basics. I am aware of the [Nerd Dinner][1] but that is based around MVC 1. What would you guys recomend for me to get started. Should i work through the nerd dinner tutorial then once i have a good understanding of mvc then research the new features of mvc 2 or is there a similar getting started tutorial for mvc 2. Sugestions of good books to read are also welcome. In fact any advice on getting started on mvc 2 would be good.
[1]: http://nerddinnerbook.s3.amazonaws.com/Intro.htm | c# | .net | asp.net | asp.net-mvc | asp.net-mvc-2 | 03/27/2012 15:51:17 | not constructive | Good tutorial for ASP.net mvc 2
===
I am an experienced asp.net web forms developer using c# but i have never used asp.net MVC. As I am just starting out with mvc i would like to start with mvc 2. I am looking for a good intro/tutorial to help me understand the basics. I am aware of the [Nerd Dinner][1] but that is based around MVC 1. What would you guys recomend for me to get started. Should i work through the nerd dinner tutorial then once i have a good understanding of mvc then research the new features of mvc 2 or is there a similar getting started tutorial for mvc 2. Sugestions of good books to read are also welcome. In fact any advice on getting started on mvc 2 would be good.
[1]: http://nerddinnerbook.s3.amazonaws.com/Intro.htm | 4 |
11,501,037 | 07/16/2012 09:00:57 | 1,528,325 | 07/16/2012 08:48:34 | 1 | 0 | How do I point a domain to a sub-domain of another site (different hosting provider)? | I am fairly junior in web dev, and have a bit of a puzzle. I will try to be as clear as possible about the problem, but would really appreciate any help!!
I have been developing a site using Drupal for a local charity. They already have a site on domain (lets say): "www.charity.com"
The domain and hosting for this site is under the control of someone else who helped the charity many years ago.
In order to develop the new site, I created a sub-domain on the domain I owned through my hosting provider (lets say): "www.dev.mysite.com"
I have now completed the dev, and want to tell the guy managing the old charity site what changes he needs to make to point www.charity.com to the subdomain i am hosting...is this possible? What is the best way of doing this??
Also, in about 8 weeks time, I am going to be able to acquire the domain for www.charity.com, so am happy with temporary measures if need be as can resolve it properly when I own the domain...
Thanks in advance for any help..
Andrew | hosting | null | null | null | null | 07/16/2012 16:47:48 | off topic | How do I point a domain to a sub-domain of another site (different hosting provider)?
===
I am fairly junior in web dev, and have a bit of a puzzle. I will try to be as clear as possible about the problem, but would really appreciate any help!!
I have been developing a site using Drupal for a local charity. They already have a site on domain (lets say): "www.charity.com"
The domain and hosting for this site is under the control of someone else who helped the charity many years ago.
In order to develop the new site, I created a sub-domain on the domain I owned through my hosting provider (lets say): "www.dev.mysite.com"
I have now completed the dev, and want to tell the guy managing the old charity site what changes he needs to make to point www.charity.com to the subdomain i am hosting...is this possible? What is the best way of doing this??
Also, in about 8 weeks time, I am going to be able to acquire the domain for www.charity.com, so am happy with temporary measures if need be as can resolve it properly when I own the domain...
Thanks in advance for any help..
Andrew | 2 |
6,478,754 | 06/25/2011 15:38:43 | 67,959 | 10/19/2008 09:51:07 | 3,493 | 160 | What OpenSource System.Security.Cryptography.Pkcs Alternatives are there? | I am trying to use PKCS on mono. The only issue is that after running MoMa, the scan report showed the the following:
Calling Method Method with [MonoTodo]
Byte[] Sign (Byte[]) void SignedCms.ComputeSignature (CmsSigner)
Byte[] Sign (Byte[]) Byte[] SignedCms.Encode ()
Byte[] Envelope (Byte[]) void EnvelopedCms.Encrypt (CmsRecipient)
Byte[] Envelope (Byte[]) Byte[] EnvelopedCms.Encode ()
As you can see, the required methods I need to use, are not yet implemented on Mono. Does anyone know a workaround to this, may be a patch, or does anyone know of any open source libraries which would allow me to achieve similar results as the System.Security.Cryptography.Pkcs.CmsSigner module.
TIA,
Andrew | c# | .net | mono | cryptography | null | null | open | What OpenSource System.Security.Cryptography.Pkcs Alternatives are there?
===
I am trying to use PKCS on mono. The only issue is that after running MoMa, the scan report showed the the following:
Calling Method Method with [MonoTodo]
Byte[] Sign (Byte[]) void SignedCms.ComputeSignature (CmsSigner)
Byte[] Sign (Byte[]) Byte[] SignedCms.Encode ()
Byte[] Envelope (Byte[]) void EnvelopedCms.Encrypt (CmsRecipient)
Byte[] Envelope (Byte[]) Byte[] EnvelopedCms.Encode ()
As you can see, the required methods I need to use, are not yet implemented on Mono. Does anyone know a workaround to this, may be a patch, or does anyone know of any open source libraries which would allow me to achieve similar results as the System.Security.Cryptography.Pkcs.CmsSigner module.
TIA,
Andrew | 0 |
1,139,475 | 07/16/2009 18:37:52 | 99,327 | 05/01/2009 13:21:42 | 1 | 2 | Is there a jQuery-like library written in C#? | I love jQuery. I am probably going to have some XML parsing and manipulation using C#. It would be a piece of cake doing it in jQuery.
Is there a C# library that implements jQuery's functionality?
| jquery | c# | .net | xml | null | 06/19/2012 18:40:21 | not constructive | Is there a jQuery-like library written in C#?
===
I love jQuery. I am probably going to have some XML parsing and manipulation using C#. It would be a piece of cake doing it in jQuery.
Is there a C# library that implements jQuery's functionality?
| 4 |
8,671,865 | 12/29/2011 18:35:08 | 587,497 | 01/24/2011 12:44:48 | 156 | 8 | Pointers for writing context menu items for windows explorer using C# | this is a generice question any Pointers for writing context menu items for windows explorer using C#
Thanks and regards,
Sri | c# | windows | null | null | null | 12/30/2011 12:57:55 | not a real question | Pointers for writing context menu items for windows explorer using C#
===
this is a generice question any Pointers for writing context menu items for windows explorer using C#
Thanks and regards,
Sri | 1 |
6,080,708 | 05/21/2011 08:57:42 | 719,001 | 04/21/2011 13:12:04 | 48 | 1 | Clustering - leader algorithm compared to k-means? | I need to map several advantages and disadvantages of the leader algorithm as compared to K-means. The problem is that I cant put my pinger on even one.. | algorithm | cluster-analysis | data-mining | null | null | 05/21/2011 12:30:20 | not a real question | Clustering - leader algorithm compared to k-means?
===
I need to map several advantages and disadvantages of the leader algorithm as compared to K-means. The problem is that I cant put my pinger on even one.. | 1 |
11,112,696 | 06/20/2012 04:10:19 | 1,468,036 | 06/20/2012 03:28:17 | 1 | 0 | Developing a notepad in C++ | I am trying to develop a notepad with menus in C++. the code is as below.
#include <windows.h>
#define IDI_APP_ICON 1
#define IDD_ABOUT 100
#define IDC_STATIC 101
#define IDM_MAINMENU 200
#define IDM_FILE_NEW 201
#define IDM_FILE_OPEN 203
#define IDM_FILE_SAVE 204
#define IDM_FILE_EXIT 205
#define IDM_HELP_ABOUT 206
class MainWindow
{
public:
MainWindow(HINSTANCE hInstance);
~MainWindow();
static LRESULT CALLBACK MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static void OnCommand(HWND hwnd, int id, HWND hCtl, UINT codeNotify);
bool Run(int nCmdShow);
private:
WNDCLASSEX m_wndClass;
static HINSTANCE m_hInstance;
HWND m_hwnd;
static char m_szClassName[];
};
class AboutDialog
{
public:
AboutDialog();
~AboutDialog();
static BOOL CALLBACK DialogProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
int Run(HINSTANCE hInstance, HWND hParent);
private:
HWND m_hwnd;
};
AboutDialog::AboutDialog()
{
}
AboutDialog::~AboutDialog()
{
}
// Function: Run
// Returns: Result of the DialogBox
int AboutDialog::Run(HINSTANCE hInstance, HWND hParent)
{
int retval = DialogBox(
hInstance,
MAKEINTRESOURCE(IDD_ABOUT), // Dialog template
hParent, // Pointer to parent hwnd
DialogProc);
}
char MainWindow::m_szClassName[] = "DrawLite";
HINSTANCE MainWindow::m_hInstance = NULL;
MainWindow::MainWindow(HINSTANCE hInstance)
{
m_hInstance = hInstance; // Save Instance handle
m_wndClass.cbSize = sizeof(WNDCLASSEX); // Must always be sizeof(WNDCLASSEX)
m_wndClass.style = CS_DBLCLKS; // Class styles
m_wndClass.lpfnWndProc = MainWndProc; // Pointer to callback procedure
m_wndClass.cbClsExtra = 0;
m_wndClass.cbWndExtra = 0;
m_wndClass.hInstance = hInstance;
m_wndClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
m_wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
m_wndClass.hbrBackground = (HBRUSH) (COLOR_WINDOW);
m_wndClass.lpszMenuName = MAKEINTRESOURCE(IDM_MAINMENU);
m_wndClass.lpszClassName = m_szClassName;
m_wndClass.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
}
MainWindow::~MainWindow()
{
}
LRESULT CALLBACK MainWindow::MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_COMMAND:
//HANDLE_WM_COMMAND(hwnd, wParam, lParam, OnCommand);
break;
default:
return DefWindowProc (hwnd, msg, wParam, lParam);
}
return 0;
}
void MainWindow::OnCommand(HWND hwnd, int id, HWND hCtl, UINT codeNotify)
{
switch(id)
{
case IDM_FILE_EXIT:
PostQuitMessage(0);
break;
case IDM_HELP_ABOUT:
AboutDialog* dlg = new AboutDialog();
dlg->Run(m_hInstance, hwnd);
delete dlg; dlg = NULL;
break;
}
}
bool MainWindow::Run(int nCmdShow)
{
if(!RegisterClassEx(&m_wndClass))
return false;
m_hwnd = CreateWindowEx(
0,
m_szClassName,
"Draw Lite",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
500,
400,
NULL,
NULL,
m_hInstance,
NULL
);
if(!m_hwnd)
return false;
ShowWindow(m_hwnd, nCmdShow);
return true;
}
I am having a linker error and don't know how to fix it as i am quite new in this field. I wonder if someone could help me on this. Thanks,
Asif | c++ | notepad | null | null | null | 06/21/2012 01:31:40 | too localized | Developing a notepad in C++
===
I am trying to develop a notepad with menus in C++. the code is as below.
#include <windows.h>
#define IDI_APP_ICON 1
#define IDD_ABOUT 100
#define IDC_STATIC 101
#define IDM_MAINMENU 200
#define IDM_FILE_NEW 201
#define IDM_FILE_OPEN 203
#define IDM_FILE_SAVE 204
#define IDM_FILE_EXIT 205
#define IDM_HELP_ABOUT 206
class MainWindow
{
public:
MainWindow(HINSTANCE hInstance);
~MainWindow();
static LRESULT CALLBACK MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static void OnCommand(HWND hwnd, int id, HWND hCtl, UINT codeNotify);
bool Run(int nCmdShow);
private:
WNDCLASSEX m_wndClass;
static HINSTANCE m_hInstance;
HWND m_hwnd;
static char m_szClassName[];
};
class AboutDialog
{
public:
AboutDialog();
~AboutDialog();
static BOOL CALLBACK DialogProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
int Run(HINSTANCE hInstance, HWND hParent);
private:
HWND m_hwnd;
};
AboutDialog::AboutDialog()
{
}
AboutDialog::~AboutDialog()
{
}
// Function: Run
// Returns: Result of the DialogBox
int AboutDialog::Run(HINSTANCE hInstance, HWND hParent)
{
int retval = DialogBox(
hInstance,
MAKEINTRESOURCE(IDD_ABOUT), // Dialog template
hParent, // Pointer to parent hwnd
DialogProc);
}
char MainWindow::m_szClassName[] = "DrawLite";
HINSTANCE MainWindow::m_hInstance = NULL;
MainWindow::MainWindow(HINSTANCE hInstance)
{
m_hInstance = hInstance; // Save Instance handle
m_wndClass.cbSize = sizeof(WNDCLASSEX); // Must always be sizeof(WNDCLASSEX)
m_wndClass.style = CS_DBLCLKS; // Class styles
m_wndClass.lpfnWndProc = MainWndProc; // Pointer to callback procedure
m_wndClass.cbClsExtra = 0;
m_wndClass.cbWndExtra = 0;
m_wndClass.hInstance = hInstance;
m_wndClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
m_wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
m_wndClass.hbrBackground = (HBRUSH) (COLOR_WINDOW);
m_wndClass.lpszMenuName = MAKEINTRESOURCE(IDM_MAINMENU);
m_wndClass.lpszClassName = m_szClassName;
m_wndClass.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
}
MainWindow::~MainWindow()
{
}
LRESULT CALLBACK MainWindow::MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_COMMAND:
//HANDLE_WM_COMMAND(hwnd, wParam, lParam, OnCommand);
break;
default:
return DefWindowProc (hwnd, msg, wParam, lParam);
}
return 0;
}
void MainWindow::OnCommand(HWND hwnd, int id, HWND hCtl, UINT codeNotify)
{
switch(id)
{
case IDM_FILE_EXIT:
PostQuitMessage(0);
break;
case IDM_HELP_ABOUT:
AboutDialog* dlg = new AboutDialog();
dlg->Run(m_hInstance, hwnd);
delete dlg; dlg = NULL;
break;
}
}
bool MainWindow::Run(int nCmdShow)
{
if(!RegisterClassEx(&m_wndClass))
return false;
m_hwnd = CreateWindowEx(
0,
m_szClassName,
"Draw Lite",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
500,
400,
NULL,
NULL,
m_hInstance,
NULL
);
if(!m_hwnd)
return false;
ShowWindow(m_hwnd, nCmdShow);
return true;
}
I am having a linker error and don't know how to fix it as i am quite new in this field. I wonder if someone could help me on this. Thanks,
Asif | 3 |
7,470,994 | 09/19/2011 12:33:51 | 553,071 | 12/24/2010 06:41:45 | 165 | 21 | Protocol and Categories can be inherit? | I am little confused for the concept of protocols and Categories.
Can Protocols , categories be inherited? Please answer me with the reasons.
Thanks in advance | iphone | objective-c | ios | null | null | null | open | Protocol and Categories can be inherit?
===
I am little confused for the concept of protocols and Categories.
Can Protocols , categories be inherited? Please answer me with the reasons.
Thanks in advance | 0 |
1,854,585 | 12/06/2009 06:51:19 | 224,922 | 12/04/2009 16:51:10 | 7 | 0 | json jquery php question | i dont understand one thing.
if i want to get JSON data (key-value-pairs) from php to jquery using ajax...which of these following ones should i use?
$.get
$.post
$.getJSON
do i need to use getJSON if i want to use json_encode in php file? but what if i want to send with post? (there is no postJSON)?
and one more thing:
in php file i wrote:
<?php
if($_GET['value'] == "value")
{
$array['firstname'] = 'Johnny';
$jsonstring=json_encode($array);
return $jsonstring;
}
?>
in jquery file
$.getJSON("php.php", {value: "value"}, function(data){
alert(data.firstname);
});
why doesnt this work??:S
| json | jquery | ajax | php | null | null | open | json jquery php question
===
i dont understand one thing.
if i want to get JSON data (key-value-pairs) from php to jquery using ajax...which of these following ones should i use?
$.get
$.post
$.getJSON
do i need to use getJSON if i want to use json_encode in php file? but what if i want to send with post? (there is no postJSON)?
and one more thing:
in php file i wrote:
<?php
if($_GET['value'] == "value")
{
$array['firstname'] = 'Johnny';
$jsonstring=json_encode($array);
return $jsonstring;
}
?>
in jquery file
$.getJSON("php.php", {value: "value"}, function(data){
alert(data.firstname);
});
why doesnt this work??:S
| 0 |
7,658,452 | 10/05/2011 08:14:27 | 974,267 | 10/01/2011 08:00:11 | 1 | 0 | how to use dispatch in C | I need to use dispatch_sync_f in my program but i am not sure how to use it..
dispatch_queue_t queue = dispatch_queue_create("queue", NULL);
dispatch_function_t func = (void *)a_method_takes_a_struct; // like void a(struct a a)
dispatch_sync(queue, ^{
printf("test\n");
dispatch_sync_f(dispatch_get_main_queue(), calc_earliest_deadline_scheduling, func);
});
dispatch_main();
Thanks in advance | c | dispatch | null | null | null | 12/25/2011 02:17:26 | not a real question | how to use dispatch in C
===
I need to use dispatch_sync_f in my program but i am not sure how to use it..
dispatch_queue_t queue = dispatch_queue_create("queue", NULL);
dispatch_function_t func = (void *)a_method_takes_a_struct; // like void a(struct a a)
dispatch_sync(queue, ^{
printf("test\n");
dispatch_sync_f(dispatch_get_main_queue(), calc_earliest_deadline_scheduling, func);
});
dispatch_main();
Thanks in advance | 1 |
11,291,492 | 07/02/2012 10:03:42 | 1,423,600 | 05/29/2012 11:47:06 | 40 | 1 | Book for starting with Advanced Java Programming | Can someone please recommend me a book to start with advanced Java topics?
My curriculum is [HERE](http://www.msbte.com/website/curriculum/SCHEME%20-%20E%20Sixth%20Semester%20Curriculum/SCHEME_E%20Sixth_Semester(CO,CM).pdf) and Java topics are mentioned on **page 15** | java | sockets | tomcat | servlets | containers | 07/02/2012 15:22:59 | not constructive | Book for starting with Advanced Java Programming
===
Can someone please recommend me a book to start with advanced Java topics?
My curriculum is [HERE](http://www.msbte.com/website/curriculum/SCHEME%20-%20E%20Sixth%20Semester%20Curriculum/SCHEME_E%20Sixth_Semester(CO,CM).pdf) and Java topics are mentioned on **page 15** | 4 |
9,020,380 | 01/26/2012 15:19:44 | 1,105,875 | 12/19/2011 12:24:22 | 13 | 0 | Looking for android multitouch game controls | Can anyone give me an example (snippet or smth) of development multitouch controls for android game. Can't find it anywhere. I want to develop the controls similar to given on the picture. If you share the link for the manual or article, I will be also thankful.
Thanks.
![android game control][1]
[1]: http://i.stack.imgur.com/GN0TI.png | android | null | null | null | null | 01/27/2012 15:53:08 | not a real question | Looking for android multitouch game controls
===
Can anyone give me an example (snippet or smth) of development multitouch controls for android game. Can't find it anywhere. I want to develop the controls similar to given on the picture. If you share the link for the manual or article, I will be also thankful.
Thanks.
![android game control][1]
[1]: http://i.stack.imgur.com/GN0TI.png | 1 |
9,600,470 | 03/07/2012 11:18:51 | 1,023,528 | 11/01/2011 11:00:51 | 78 | 15 | How to select/set a selected row in picker view as default selected row every time | I have a picker view
[picker selectRow:3 inComponent:0 animated:YES];
when i wrote this code in view did load,
This method is used to set the row 3 as default row in picker.
But i want that the row i have selected is set to be as default for the next time.
what to do? thanks in advance...
| iphone | objective-c | datepicker | uipickerview | didselectrowatindexpath | null | open | How to select/set a selected row in picker view as default selected row every time
===
I have a picker view
[picker selectRow:3 inComponent:0 animated:YES];
when i wrote this code in view did load,
This method is used to set the row 3 as default row in picker.
But i want that the row i have selected is set to be as default for the next time.
what to do? thanks in advance...
| 0 |
3,704,077 | 09/13/2010 20:18:21 | 442,142 | 09/08/2010 07:17:33 | 6 | 0 | staic members and consts | class a{
protected:
const int _ID;
public:
a::a(int id){};
a::top(int num);
};
class b: public a{
static int ok;
b::b(int id):a(id){};
a::top(ok);
}
int main(){
int t=5;
b opj=b(t);
}
first why i get this compile error that solved only when i remove the const
non-static const member ‘const int Student::_ID’, can't use default assignment operator -
instantiated from ‘void std::vector::_M_insert_aux(__gnu_cxx::__normal_iterator<typename
std::_vector_base::_Tp_alloc_type::pointer, std::vector >, const _Tp&) [with _Tp = Student, _Alloc = std::allocator]’
second
i have anther problem
undefined reference to b::ok
| c++ | static | const | null | null | 09/16/2010 01:50:14 | not a real question | staic members and consts
===
class a{
protected:
const int _ID;
public:
a::a(int id){};
a::top(int num);
};
class b: public a{
static int ok;
b::b(int id):a(id){};
a::top(ok);
}
int main(){
int t=5;
b opj=b(t);
}
first why i get this compile error that solved only when i remove the const
non-static const member ‘const int Student::_ID’, can't use default assignment operator -
instantiated from ‘void std::vector::_M_insert_aux(__gnu_cxx::__normal_iterator<typename
std::_vector_base::_Tp_alloc_type::pointer, std::vector >, const _Tp&) [with _Tp = Student, _Alloc = std::allocator]’
second
i have anther problem
undefined reference to b::ok
| 1 |
8,464,118 | 12/11/2011 12:53:14 | 1,092,236 | 12/11/2011 12:51:34 | 1 | 0 | confusing in SEAL (Software-Optimized Encryption Algorithm) mathematic notation | I'm developing an encryption software based on SEAL algorihm for my research. I found the paper in here : http://www.cs.ucdavis.edu/~rogaway/papers/seal.pdf.
My Question is what is the meaning of $$ H_{i}^{i mod 5} $$ in page 5?
Thanks in advance.
| math | encryption | cryptography | notation | number-theory | 12/11/2011 15:36:51 | off topic | confusing in SEAL (Software-Optimized Encryption Algorithm) mathematic notation
===
I'm developing an encryption software based on SEAL algorihm for my research. I found the paper in here : http://www.cs.ucdavis.edu/~rogaway/papers/seal.pdf.
My Question is what is the meaning of $$ H_{i}^{i mod 5} $$ in page 5?
Thanks in advance.
| 2 |
10,022,524 | 04/05/2012 04:04:44 | 1,123,584 | 12/30/2011 21:39:05 | 13 | 0 | I don't understand += statements. What do they mean? | I'm going through a Ruby tutorial and I can't grasp the += statement. Google isn't helping, "Ruby +=" only searches for "Ruby".
Help is appreciated.
Sample:
num = -10
num += -1 if num < 0
puts num
#=> -11 | ruby | null | null | null | null | 04/05/2012 05:21:58 | not constructive | I don't understand += statements. What do they mean?
===
I'm going through a Ruby tutorial and I can't grasp the += statement. Google isn't helping, "Ruby +=" only searches for "Ruby".
Help is appreciated.
Sample:
num = -10
num += -1 if num < 0
puts num
#=> -11 | 4 |
138,621 | 09/26/2008 10:20:21 | 17,398 | 09/18/2008 08:22:42 | 58 | 9 | Best Version control for lone developer | I'm a lone developer at the moment; please share you experiences on what is a good VC setup for a lone developer.
My constraints are;
- I work on multiple machines and need to keep them synced up
- Sometimes I work offline
I'm currently using Subversion(just the client to a remote server), and that is working ok. I'm interested in mecurial and git DVCS, but none of their use-cases make sense to my situation.
| version-control | dvcs | vcs | null | null | 02/05/2012 17:06:46 | not constructive | Best Version control for lone developer
===
I'm a lone developer at the moment; please share you experiences on what is a good VC setup for a lone developer.
My constraints are;
- I work on multiple machines and need to keep them synced up
- Sometimes I work offline
I'm currently using Subversion(just the client to a remote server), and that is working ok. I'm interested in mecurial and git DVCS, but none of their use-cases make sense to my situation.
| 4 |
5,768,469 | 04/24/2011 03:31:52 | 722,319 | 04/24/2011 03:28:53 | 1 | 0 | HTML doubt regarding usage of title and H1 tags in a webpage | What is the difference between H1 tags and Title tags in a HTML page?
Also how to increase the page rank of a web page?
- Deepak
[mis510proj][1]
[1]: http://128.196.27.185:8080/onestopmob/ | html | null | null | null | null | 04/24/2011 03:58:36 | not a real question | HTML doubt regarding usage of title and H1 tags in a webpage
===
What is the difference between H1 tags and Title tags in a HTML page?
Also how to increase the page rank of a web page?
- Deepak
[mis510proj][1]
[1]: http://128.196.27.185:8080/onestopmob/ | 1 |
1,339,708 | 08/27/2009 08:38:03 | 85,606 | 04/01/2009 10:59:21 | 812 | 48 | Any free animation available for WPF? | Being developer its very hard to designing and Animate the thing... Are there any animation libraries (like WPF themes) available out there for WPF ??
| wpf | animation | null | null | null | null | open | Any free animation available for WPF?
===
Being developer its very hard to designing and Animate the thing... Are there any animation libraries (like WPF themes) available out there for WPF ??
| 0 |
9,368,926 | 02/20/2012 21:49:09 | 1,217,004 | 02/17/2012 19:28:01 | 1 | 0 | Division by zero error of Solr StatsComponent for date field in case of no results | I have a number of docs indexed by Solr 3.5, which contain date fields (solr.DateField) among others. Now I do request to Solr component which should return no results:
http://example.com/solr/select?fq=sis_field_int:1000&
stats=true&stats.field=ds_field_date
and get error
HTTP Status 500 - / by zero java.lang.ArithmeticException: / by zero at
org.apache.solr.handler.component.DateStatsValues.addTypeSpecificStats
(StatsValuesFactory.java:384) at ...
If I send request without stats part or specify any non-date stats field instead, I get expected response with no results. It looks like a bug of Solr which tries e.g. to calculate mean value in this case. Unfortunately I've found no references on this problem. Is there some way to bypass or solve the problem?
| solr | statistics | datefield | dividebyzero | null | null | open | Division by zero error of Solr StatsComponent for date field in case of no results
===
I have a number of docs indexed by Solr 3.5, which contain date fields (solr.DateField) among others. Now I do request to Solr component which should return no results:
http://example.com/solr/select?fq=sis_field_int:1000&
stats=true&stats.field=ds_field_date
and get error
HTTP Status 500 - / by zero java.lang.ArithmeticException: / by zero at
org.apache.solr.handler.component.DateStatsValues.addTypeSpecificStats
(StatsValuesFactory.java:384) at ...
If I send request without stats part or specify any non-date stats field instead, I get expected response with no results. It looks like a bug of Solr which tries e.g. to calculate mean value in this case. Unfortunately I've found no references on this problem. Is there some way to bypass or solve the problem?
| 0 |
6,906,781 | 08/02/2011 02:54:30 | 103,264 | 05/08/2009 01:16:16 | 2,046 | 4 | Get IPAddress C# | How do I get the HTTP_X_FORWARDED_FOR Ip Address?
1. HTTP CLIENT IP
HttpContext.Current.Request.UserHostAddress.ToString();
2. HTTP X-FORWARDED FOR //proxy ip address
?
3. REMOTE ADDRESS
?
| c# | ip-address | null | null | null | 08/02/2011 07:14:03 | not a real question | Get IPAddress C#
===
How do I get the HTTP_X_FORWARDED_FOR Ip Address?
1. HTTP CLIENT IP
HttpContext.Current.Request.UserHostAddress.ToString();
2. HTTP X-FORWARDED FOR //proxy ip address
?
3. REMOTE ADDRESS
?
| 1 |
6,830,883 | 07/26/2011 13:39:46 | 526,938 | 12/01/2010 17:48:43 | 164 | 7 | IE8 error object doesn't support property | Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; YPC 3.2.0)
Timestamp: Tue, 26 Jul 2011 13:35:27 UTC
Message: Object doesn't support this property or method
Line: 2
Char: 69242
Code: 0
URI: http://sadiecoles.uwpistol.net/CatalystScripts/Cache/lightbox2021.js
This is the error I keep getting from this page http://sadiecoles.uwpistol.net/CustomContentRetrieve.aspx?ID=1142452
I've recently added the jQuery.noConflict();
jQuery(function($){ to the code I've written but I'm still getting the error in IE.
Anyone any ideas as to how to sort this? Thanks very much for all the help I get! | jquery | noconflict | null | null | null | null | open | IE8 error object doesn't support property
===
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; YPC 3.2.0)
Timestamp: Tue, 26 Jul 2011 13:35:27 UTC
Message: Object doesn't support this property or method
Line: 2
Char: 69242
Code: 0
URI: http://sadiecoles.uwpistol.net/CatalystScripts/Cache/lightbox2021.js
This is the error I keep getting from this page http://sadiecoles.uwpistol.net/CustomContentRetrieve.aspx?ID=1142452
I've recently added the jQuery.noConflict();
jQuery(function($){ to the code I've written but I'm still getting the error in IE.
Anyone any ideas as to how to sort this? Thanks very much for all the help I get! | 0 |
11,118,303 | 06/20/2012 11:14:07 | 902,207 | 08/19/2011 09:57:20 | 321 | 23 | Smartphone browser JavaScript support | I've been reading a few previous questions posted on stackoverflow, but none of them had what I wanted…
Does anyone have any statistics regarding the percentage of smartphone traffic where JavaScript is supported on the browser?
Also, what about phones overall (including non-smartphones)?
I want percentage of traffic, not percentage of phones, as I don't care about supporting phones that don't use the internet. | javascript | smartphone | browser-support | null | null | 06/21/2012 13:06:42 | off topic | Smartphone browser JavaScript support
===
I've been reading a few previous questions posted on stackoverflow, but none of them had what I wanted…
Does anyone have any statistics regarding the percentage of smartphone traffic where JavaScript is supported on the browser?
Also, what about phones overall (including non-smartphones)?
I want percentage of traffic, not percentage of phones, as I don't care about supporting phones that don't use the internet. | 2 |
5,033,536 | 02/17/2011 19:21:25 | 281,434 | 02/25/2010 17:10:40 | 294 | 4 | How to compare user input with db password when using PHP's sha256 hash method? | Say I set a new users password like this:
$salt = random_string(40) // some method that spits out a random
// 40 alpha-numeric character string
$password = hash('sha256', $_POST['password'] . $salt);
How do I then compare the users input to his hashed db password when he wants to log in?
| php | hash | sha256 | null | null | null | open | How to compare user input with db password when using PHP's sha256 hash method?
===
Say I set a new users password like this:
$salt = random_string(40) // some method that spits out a random
// 40 alpha-numeric character string
$password = hash('sha256', $_POST['password'] . $salt);
How do I then compare the users input to his hashed db password when he wants to log in?
| 0 |
8,122,334 | 11/14/2011 13:33:23 | 328,397 | 04/28/2010 23:54:42 | 3,089 | 76 | Performance comparison between Automapper, Valuinjector, vs manual | I'm looking for a performance comparison between [Automapper][1] vs [Valueinjector][2] vs a manual mapping.
Are some scenarios much slower/faster than others (e.g. flattening, etc) ?
[1]: http://automapper.codeplex.com/
[2]: http://valueinjecter.codeplex.com/ | c# | .net | automapper | valueinjecter | emitmapper | 11/15/2011 00:04:36 | not constructive | Performance comparison between Automapper, Valuinjector, vs manual
===
I'm looking for a performance comparison between [Automapper][1] vs [Valueinjector][2] vs a manual mapping.
Are some scenarios much slower/faster than others (e.g. flattening, etc) ?
[1]: http://automapper.codeplex.com/
[2]: http://valueinjecter.codeplex.com/ | 4 |
11,298,080 | 07/02/2012 17:04:51 | 1,469,540 | 06/20/2012 14:20:49 | 163 | 9 | Java: Best way to work with Locales in Swing (with change at Runntime)? | I thought about the best way to implement localisation with runtime in Swing.
Currently I solve the problem like that:
JMenu menuData = new JMenu("Data");
menuData.setName("mainframe.menu.data"); // property key
localeChangedListener.add(menuData);
The LocaleChangedListener:
public class SwingLocaleChangedListener implements LocaleChangedListener {
private ArrayList<AbstractButton> abstractButtons;
@Override
public void localeChanged(ResourceBundle rb) {
logger.info("Locale changed to '" + rb.getLocale() + "'");
for (AbstractButton b : abstractButtons) {
b.setText(rb.getString(b.getName()));
}
}
public boolean add(AbstractButton b) {
initAbstractButtons();
return abstractButtons.add(b);
}
private void initAbstractButtons() {
if (abstractButtons == null) {
this.abstractButtons = new ArrayList<AbstractButton>();
}
}
}
And the registration of the Listener:
public class GuiBundleManager {
private String filePrefix = "language.lang";
private ResourceBundle rb = null;
private LocaleChangedListener listener = null;
private static GuiBundleManager instance = null;
private GuiBundleManager() {
setLocale(Locale.getDefault());
}
public String getString(String key) {
return rb.getString(key);
}
public String[] getStringArray(String key) {
return rb.getStringArray(key);
}
public Locale getLocale() {
return rb.getLocale();
}
public void setLocale(Locale l) {
rb = ResourceBundle.getBundle(filePrefix, l);
if (listener != null) {
listener.localeChanged(rb);
}
}
public LocaleChangedListener getLocaleChangedListener() {
return listener;
}
public void setLocaleChangedListener(LocaleChangedListener listener) {
this.listener = listener;
if (listener != null) {
listener.localeChanged(rb);
}
}
public static GuiBundleManager get() {
if (instance == null) {
instance = new GuiBundleManager();
}
return instance;
}
}
.
.
An other way I'm thinking of is using Component.setLocale() combined with an PropertyChangedListener:
public abstract class GUIComponentFactory {
public JLabel createLocalisedJLabel(final String key) {
final JLabel label = new JLabel(GuiBundleManager.get().getString(key));
label.addPropertyChangeListener("locale", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
label.setText(GuiBundleManager.get().getString(key));
for(Component c : getComponents()){
c.setLocale(e.getNewValue());
}
}
});
return label;
}
.
.
.
}
Maybe you have a better solution
| java | swing | locale | null | null | 07/04/2012 11:54:12 | off topic | Java: Best way to work with Locales in Swing (with change at Runntime)?
===
I thought about the best way to implement localisation with runtime in Swing.
Currently I solve the problem like that:
JMenu menuData = new JMenu("Data");
menuData.setName("mainframe.menu.data"); // property key
localeChangedListener.add(menuData);
The LocaleChangedListener:
public class SwingLocaleChangedListener implements LocaleChangedListener {
private ArrayList<AbstractButton> abstractButtons;
@Override
public void localeChanged(ResourceBundle rb) {
logger.info("Locale changed to '" + rb.getLocale() + "'");
for (AbstractButton b : abstractButtons) {
b.setText(rb.getString(b.getName()));
}
}
public boolean add(AbstractButton b) {
initAbstractButtons();
return abstractButtons.add(b);
}
private void initAbstractButtons() {
if (abstractButtons == null) {
this.abstractButtons = new ArrayList<AbstractButton>();
}
}
}
And the registration of the Listener:
public class GuiBundleManager {
private String filePrefix = "language.lang";
private ResourceBundle rb = null;
private LocaleChangedListener listener = null;
private static GuiBundleManager instance = null;
private GuiBundleManager() {
setLocale(Locale.getDefault());
}
public String getString(String key) {
return rb.getString(key);
}
public String[] getStringArray(String key) {
return rb.getStringArray(key);
}
public Locale getLocale() {
return rb.getLocale();
}
public void setLocale(Locale l) {
rb = ResourceBundle.getBundle(filePrefix, l);
if (listener != null) {
listener.localeChanged(rb);
}
}
public LocaleChangedListener getLocaleChangedListener() {
return listener;
}
public void setLocaleChangedListener(LocaleChangedListener listener) {
this.listener = listener;
if (listener != null) {
listener.localeChanged(rb);
}
}
public static GuiBundleManager get() {
if (instance == null) {
instance = new GuiBundleManager();
}
return instance;
}
}
.
.
An other way I'm thinking of is using Component.setLocale() combined with an PropertyChangedListener:
public abstract class GUIComponentFactory {
public JLabel createLocalisedJLabel(final String key) {
final JLabel label = new JLabel(GuiBundleManager.get().getString(key));
label.addPropertyChangeListener("locale", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
label.setText(GuiBundleManager.get().getString(key));
for(Component c : getComponents()){
c.setLocale(e.getNewValue());
}
}
});
return label;
}
.
.
.
}
Maybe you have a better solution
| 2 |
7,238,050 | 08/30/2011 02:19:39 | 674,463 | 03/24/2011 07:22:03 | 28 | 0 | XCode Theme to Notepad++? | Is is possible to convert a Xcode theme to a Notepad++ theme? The theme I want for Notepad++
is the Ego Theme found here : [Original EGO Theme][1] except I would like it to work for C++.
I have to theme format experience so I am grateful for any advice. Thanks =)
[1]: http://developers.enormego.com/view/ego_xcode_theme_for_xcode_4_egov2 | c++ | objective-c | ios | xcode | notepad++ | null | open | XCode Theme to Notepad++?
===
Is is possible to convert a Xcode theme to a Notepad++ theme? The theme I want for Notepad++
is the Ego Theme found here : [Original EGO Theme][1] except I would like it to work for C++.
I have to theme format experience so I am grateful for any advice. Thanks =)
[1]: http://developers.enormego.com/view/ego_xcode_theme_for_xcode_4_egov2 | 0 |
9,448,750 | 02/25/2012 22:39:49 | 1,233,108 | 02/25/2012 22:17:17 | 1 | 0 | Quick sort doesn't work | The following code is wrong, because I changed the return index from left to right in partition(), also the index in quicksort(), but I why I can't change, the idea is still the same. How can I make it work if I want to return the right index in partition()? Thanks for all your help.
Here is the correct one:
public class Quicksort {
public static void swap(int[] array, int i, int j) {
int tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
public static int partition(int arr[], int left, int right) {
int pivot = arr[(left + right) / 2]; // Pick a pivot point. Can be an
// element.
System.out.println("pivot" + pivot);
while (left <= right) { // Until we've gone through the whole array
// Find element on left that should be on right
while (arr[left] < pivot) {
left++;
}
// Find element on right that should be on left
while (arr[right] > pivot) {
right--;
}
// Swap elements, and move left and right indices
if (left <= right) {
swap(arr, left, right);
left++;
right--;
}
}
return left;
}
public static void quickSort(int arr[], int left, int right) {
int index = partition(arr, left, right);
if (left < index - 1) { // Sort left half
quickSort(arr, left, index - 1);
}
if (index < right) { // Sort right half
quickSort(arr, index, right);
}
}
public static void main(String[] args) {
int[] arr = { 20, 10, 17, 18, 15, 16, 12, 19, 21 };
AssortedMethods.printIntArray(arr);
quickSort(arr, 0, arr.length - 1);
AssortedMethods.printIntArray(arr);
}
}
Here is the wrong one:
public class Quicksort {
public static void swap(int[] array, int i, int j) {
int tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
public static int partition(int arr[], int left, int right) {
int pivot = arr[(left + right) / 2]; // Pick a pivot point. Can be an
// element.
System.out.println("pivot" + pivot);
while (left <= right) { // Until we've gone through the whole array
// Find element on left that should be on right
while (arr[left] < pivot) {
left++;
}
// Find element on right that should be on left
while (arr[right] > pivot) {
right--;
}
// Swap elements, and move left and right indices
if (left <= right) {
swap(arr, left, right);
left++;
right--;
}
}
return right;
}
public static void quickSort(int arr[], int left, int right) {
int index = partition(arr, left, right);
if (left < index) { // Sort left half
quickSort(arr, left, index );
}
if (index + 1 < right) { // Sort right half
quickSort(arr, index + 1, right);
}
}
public static void main(String[] args) {
int[] arr = { 20, 10, 17, 18, 15, 16, 12, 19, 21 };
quickSort(arr, 0, arr.length - 1);
}
}
| java | algorithm | quicksort | null | null | 02/26/2012 00:21:35 | too localized | Quick sort doesn't work
===
The following code is wrong, because I changed the return index from left to right in partition(), also the index in quicksort(), but I why I can't change, the idea is still the same. How can I make it work if I want to return the right index in partition()? Thanks for all your help.
Here is the correct one:
public class Quicksort {
public static void swap(int[] array, int i, int j) {
int tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
public static int partition(int arr[], int left, int right) {
int pivot = arr[(left + right) / 2]; // Pick a pivot point. Can be an
// element.
System.out.println("pivot" + pivot);
while (left <= right) { // Until we've gone through the whole array
// Find element on left that should be on right
while (arr[left] < pivot) {
left++;
}
// Find element on right that should be on left
while (arr[right] > pivot) {
right--;
}
// Swap elements, and move left and right indices
if (left <= right) {
swap(arr, left, right);
left++;
right--;
}
}
return left;
}
public static void quickSort(int arr[], int left, int right) {
int index = partition(arr, left, right);
if (left < index - 1) { // Sort left half
quickSort(arr, left, index - 1);
}
if (index < right) { // Sort right half
quickSort(arr, index, right);
}
}
public static void main(String[] args) {
int[] arr = { 20, 10, 17, 18, 15, 16, 12, 19, 21 };
AssortedMethods.printIntArray(arr);
quickSort(arr, 0, arr.length - 1);
AssortedMethods.printIntArray(arr);
}
}
Here is the wrong one:
public class Quicksort {
public static void swap(int[] array, int i, int j) {
int tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
public static int partition(int arr[], int left, int right) {
int pivot = arr[(left + right) / 2]; // Pick a pivot point. Can be an
// element.
System.out.println("pivot" + pivot);
while (left <= right) { // Until we've gone through the whole array
// Find element on left that should be on right
while (arr[left] < pivot) {
left++;
}
// Find element on right that should be on left
while (arr[right] > pivot) {
right--;
}
// Swap elements, and move left and right indices
if (left <= right) {
swap(arr, left, right);
left++;
right--;
}
}
return right;
}
public static void quickSort(int arr[], int left, int right) {
int index = partition(arr, left, right);
if (left < index) { // Sort left half
quickSort(arr, left, index );
}
if (index + 1 < right) { // Sort right half
quickSort(arr, index + 1, right);
}
}
public static void main(String[] args) {
int[] arr = { 20, 10, 17, 18, 15, 16, 12, 19, 21 };
quickSort(arr, 0, arr.length - 1);
}
}
| 3 |
8,463,859 | 12/11/2011 12:14:49 | 516,160 | 11/22/2010 13:39:23 | 506 | 1 | What Ruby On Rails text editor should a beginner use? | I am new in creating web applications in Windows. I am planning to do it on Ruby On Rails. However, I am confused what text editor should a beginner use. There are a lot of text editors like GVim, red car editor, sublime text, e-text editor, and ruby mine. What text editor is easier to use for a beginner? | ruby-on-rails | ruby | ruby-on-rails-3 | text-editor | null | 12/11/2011 18:44:19 | not constructive | What Ruby On Rails text editor should a beginner use?
===
I am new in creating web applications in Windows. I am planning to do it on Ruby On Rails. However, I am confused what text editor should a beginner use. There are a lot of text editors like GVim, red car editor, sublime text, e-text editor, and ruby mine. What text editor is easier to use for a beginner? | 4 |
6,651,699 | 07/11/2011 14:31:55 | 826,640 | 07/03/2011 06:36:01 | 14 | 0 | Need help in resolving the simple cocos2d error | I am using following code to render the image on screen
-(id) init
{
if( (self=[super init] )) {
CGSize winSize = [[CCDirector sharedDirector] winSize];
CCSprite *player = [CCSprite spriteWithFile:@"Player.png"
rect:CGRectMake(0, 0, 27, 40)];
player.position = ccp(player.contentSize.width/2, winSize.height/2);
[self addChild:player];
}
return self;
}
when I ran the code following error is coming
continue
2011-07-11 19:25:58.220 testcellapp[441:707] cocos2d: cocos2d v1.0.0-rc3
2011-07-11 19:25:58.229 testcellapp[441:707] cocos2d: Using Director
Type:CCDirectorDisplayLink
2011-07-11 19:25:58.407 testcellapp[441:707] cocos2d: OS version: 4.3.1 (0x04030100)
2011-07-11 19:25:58.411 testcellapp[441:707] cocos2d: GL_VENDOR: Imagination Technologies
2011-07-11 19:25:58.415 testcellapp[441:707] cocos2d: GL_RENDERER: PowerVR SGX 535
2011-07-11 19:25:58.418 testcellapp[441:707] cocos2d: GL_VERSION: OpenGL ES-CM 1.1 IMGSGX535-58.6
2011-07-11 19:25:58.423 testcellapp[441:707] cocos2d: GL_MAX_TEXTURE_SIZE: 2048
2011-07-11 19:25:58.427 testcellapp[441:707] cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 16
2011-07-11 19:25:58.430 testcellapp[441:707] cocos2d: GL_MAX_SAMPLES: 4
2011-07-11 19:25:58.434 testcellapp[441:707] cocos2d: GL supports PVRTC: YES
2011-07-11 19:25:58.437 testcellapp[441:707] cocos2d: GL supports BGRA8888 textures: YES
2011-07-11 19:25:58.441 testcellapp[441:707] cocos2d: GL supports NPOT textures: YES
2011-07-11 19:25:58.444 testcellapp[441:707] cocos2d: GL supports discard_framebuffer: YES
2011-07-11 19:25:58.447 testcellapp[441:707] cocos2d: compiled with NPOT support: NO
2011-07-11 19:25:58.450 testcellapp[441:707] cocos2d: compiled with VBO support in TextureAtlas : NO
2011-07-11 19:25:58.454 testcellapp[441:707] cocos2d: compiled with Affine Matrix transformation in CCNode : YES
2011-07-11 19:25:58.457 testcellapp[441:707] cocos2d: compiled with Profiling Support: NO
2011-07-11 19:25:58.554 testcellapp[441:707] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-07-11 19:25:58.558 testcellapp[441:707] cocos2d: Couldn't add image:Player.png in CCTextureCache
2011-07-11 19:25:58.564 testcellapp[441:707] *** Assertion failure in -[HelloWorldLayer addChild:], /Users/shahbazali/Documents/testcellapp/libs/cocos2d/CCNode.m:408
2011-07-11 19:25:58.601 testcellapp[441:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Argument must be non-nil'
*** Call stack at first throw:
(
0 CoreFoundation 0x32c3064f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x31da4c5d objc_exception_throw + 24
2 CoreFoundation 0x32c30491 +[NSException raise:format:arguments:] + 68
3 Foundation 0x318a2573 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 62
4 testcellapp 0x00067c1c -[CCNode addChild:] + 196
5 testcellapp 0x000033ec -[HelloWorldLayer init] + 400
6 testcellapp 0x00066ca0 +[CCNode node] + 76
7 testcellapp 0x000031fc +[HelloWorldLayer scene] + 100
8 testcellapp 0x00002aac -[testcellappAppDelegate applicationDidFinishLaunching:] + 1028
9 UIKit 0x32f6a85d -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 832
10 UIKit 0x32f64b65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272
11 UIKit 0x32f397d7 -[UIApplication handleEvent:withNewEvent:] + 1114
12 UIKit 0x32f39215 -[UIApplication sendEvent:] + 44
13 UIKit 0x32f38c53 _UIApplicationHandleEvent + 5090
14 GraphicsServices 0x31118e77 PurpleEventCallback + 666
15 CoreFoundation 0x32c07a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
16 CoreFoundation 0x32c0983f __CFRunLoopDoSource1 + 166
17 CoreFound
Please help why this error is coming | iphone | cocos2d-iphone | null | null | null | null | open | Need help in resolving the simple cocos2d error
===
I am using following code to render the image on screen
-(id) init
{
if( (self=[super init] )) {
CGSize winSize = [[CCDirector sharedDirector] winSize];
CCSprite *player = [CCSprite spriteWithFile:@"Player.png"
rect:CGRectMake(0, 0, 27, 40)];
player.position = ccp(player.contentSize.width/2, winSize.height/2);
[self addChild:player];
}
return self;
}
when I ran the code following error is coming
continue
2011-07-11 19:25:58.220 testcellapp[441:707] cocos2d: cocos2d v1.0.0-rc3
2011-07-11 19:25:58.229 testcellapp[441:707] cocos2d: Using Director
Type:CCDirectorDisplayLink
2011-07-11 19:25:58.407 testcellapp[441:707] cocos2d: OS version: 4.3.1 (0x04030100)
2011-07-11 19:25:58.411 testcellapp[441:707] cocos2d: GL_VENDOR: Imagination Technologies
2011-07-11 19:25:58.415 testcellapp[441:707] cocos2d: GL_RENDERER: PowerVR SGX 535
2011-07-11 19:25:58.418 testcellapp[441:707] cocos2d: GL_VERSION: OpenGL ES-CM 1.1 IMGSGX535-58.6
2011-07-11 19:25:58.423 testcellapp[441:707] cocos2d: GL_MAX_TEXTURE_SIZE: 2048
2011-07-11 19:25:58.427 testcellapp[441:707] cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 16
2011-07-11 19:25:58.430 testcellapp[441:707] cocos2d: GL_MAX_SAMPLES: 4
2011-07-11 19:25:58.434 testcellapp[441:707] cocos2d: GL supports PVRTC: YES
2011-07-11 19:25:58.437 testcellapp[441:707] cocos2d: GL supports BGRA8888 textures: YES
2011-07-11 19:25:58.441 testcellapp[441:707] cocos2d: GL supports NPOT textures: YES
2011-07-11 19:25:58.444 testcellapp[441:707] cocos2d: GL supports discard_framebuffer: YES
2011-07-11 19:25:58.447 testcellapp[441:707] cocos2d: compiled with NPOT support: NO
2011-07-11 19:25:58.450 testcellapp[441:707] cocos2d: compiled with VBO support in TextureAtlas : NO
2011-07-11 19:25:58.454 testcellapp[441:707] cocos2d: compiled with Affine Matrix transformation in CCNode : YES
2011-07-11 19:25:58.457 testcellapp[441:707] cocos2d: compiled with Profiling Support: NO
2011-07-11 19:25:58.554 testcellapp[441:707] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-07-11 19:25:58.558 testcellapp[441:707] cocos2d: Couldn't add image:Player.png in CCTextureCache
2011-07-11 19:25:58.564 testcellapp[441:707] *** Assertion failure in -[HelloWorldLayer addChild:], /Users/shahbazali/Documents/testcellapp/libs/cocos2d/CCNode.m:408
2011-07-11 19:25:58.601 testcellapp[441:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Argument must be non-nil'
*** Call stack at first throw:
(
0 CoreFoundation 0x32c3064f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x31da4c5d objc_exception_throw + 24
2 CoreFoundation 0x32c30491 +[NSException raise:format:arguments:] + 68
3 Foundation 0x318a2573 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 62
4 testcellapp 0x00067c1c -[CCNode addChild:] + 196
5 testcellapp 0x000033ec -[HelloWorldLayer init] + 400
6 testcellapp 0x00066ca0 +[CCNode node] + 76
7 testcellapp 0x000031fc +[HelloWorldLayer scene] + 100
8 testcellapp 0x00002aac -[testcellappAppDelegate applicationDidFinishLaunching:] + 1028
9 UIKit 0x32f6a85d -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 832
10 UIKit 0x32f64b65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272
11 UIKit 0x32f397d7 -[UIApplication handleEvent:withNewEvent:] + 1114
12 UIKit 0x32f39215 -[UIApplication sendEvent:] + 44
13 UIKit 0x32f38c53 _UIApplicationHandleEvent + 5090
14 GraphicsServices 0x31118e77 PurpleEventCallback + 666
15 CoreFoundation 0x32c07a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
16 CoreFoundation 0x32c0983f __CFRunLoopDoSource1 + 166
17 CoreFound
Please help why this error is coming | 0 |
5,717,609 | 04/19/2011 14:04:43 | 57,132 | 01/20/2009 15:03:07 | 4,386 | 85 | Migrate from TFS to VSS | I installed Team Foundation Server and migrated my code a year ago from VSS. It was a big mistake. Between workspaces, read-only flags, solution bindings and bad merge tools, I think I should have just stuck with VSS.
So, how do I migrate back to VSS from TFS? | tfs | visual-sourcesafe | null | null | null | 04/20/2011 09:57:27 | not constructive | Migrate from TFS to VSS
===
I installed Team Foundation Server and migrated my code a year ago from VSS. It was a big mistake. Between workspaces, read-only flags, solution bindings and bad merge tools, I think I should have just stuck with VSS.
So, how do I migrate back to VSS from TFS? | 4 |
5,394,390 | 03/22/2011 16:17:10 | 295,671 | 03/17/2010 13:15:38 | 3 | 0 | Problems setting visibility in Android application | I'm writing an Android application which requires the user to login. I have a "username" and "password" EditText fields and also a "Submit" button.
When testing in the emulator (and on a phone), the app appears to 'lock up' when the user hits "Submit". It hasn't actually crashed or anything like that, it's just locked whilst the connection to the server is made (and then it advances the user to the next view if their login is correct).
This isn't very cosmetically pleasing as some users may think the app has locked up if their connection is slow and the login doesn't process for a few seconds..
To avoid this I want to have a ProgressBar which will appear just to let the user know something is happening and the app hasn't locked up!
Here's my code:
private OnClickListener listenerOne = new OnClickListener() {
public void onClick(View v) {
Button submitButton = (Button)findViewById(R.id.submit);
submitButton.setVisibility(8); //Make submit button invisible
ProgressBar progressBar = (ProgressBar)findViewById(R.id.progressbar);
progressBar.setVisibility(0); //Make progress bar visible. It's in the same position as the submit button
login(); // do the login server stuff
// the problem is that thenew visibility doesn't happen until the login() is called...
}
};
I've ordered the code so that it makes the submit invisible, then makes the progress bar visible, then does the login (so the progress bar will be there twirling around whilst the app connects to the login server). However, it's not working out how I intended - it's seemingly skipping over the setVisibility code and just calling the login method. It must be setting the visibility of the submit and progress bar items but it doesn't happen before the login method does its stuff as it just locks up like usual and the items never actually get hidden/shown until the login method has completed!!
Any help would be much appreciated. Sorry for the essay! | android | view | null | null | null | null | open | Problems setting visibility in Android application
===
I'm writing an Android application which requires the user to login. I have a "username" and "password" EditText fields and also a "Submit" button.
When testing in the emulator (and on a phone), the app appears to 'lock up' when the user hits "Submit". It hasn't actually crashed or anything like that, it's just locked whilst the connection to the server is made (and then it advances the user to the next view if their login is correct).
This isn't very cosmetically pleasing as some users may think the app has locked up if their connection is slow and the login doesn't process for a few seconds..
To avoid this I want to have a ProgressBar which will appear just to let the user know something is happening and the app hasn't locked up!
Here's my code:
private OnClickListener listenerOne = new OnClickListener() {
public void onClick(View v) {
Button submitButton = (Button)findViewById(R.id.submit);
submitButton.setVisibility(8); //Make submit button invisible
ProgressBar progressBar = (ProgressBar)findViewById(R.id.progressbar);
progressBar.setVisibility(0); //Make progress bar visible. It's in the same position as the submit button
login(); // do the login server stuff
// the problem is that thenew visibility doesn't happen until the login() is called...
}
};
I've ordered the code so that it makes the submit invisible, then makes the progress bar visible, then does the login (so the progress bar will be there twirling around whilst the app connects to the login server). However, it's not working out how I intended - it's seemingly skipping over the setVisibility code and just calling the login method. It must be setting the visibility of the submit and progress bar items but it doesn't happen before the login method does its stuff as it just locks up like usual and the items never actually get hidden/shown until the login method has completed!!
Any help would be much appreciated. Sorry for the essay! | 0 |
6,970,008 | 08/07/2011 00:55:02 | 882,314 | 08/07/2011 00:50:13 | 1 | 0 | Which elegant ways of including the spreadshirt - shop into Wordpress are there? | I have some articles of spreadshirt I want to sell.
I am using wordpress.
Which elegant ways of including **the spreadshirt - shop** into Wordpress are there?
Which elegant ways of including a **foreign website** into Wordpress are there? | php | wordpress | wordpress-theming | null | null | 08/08/2011 06:53:35 | off topic | Which elegant ways of including the spreadshirt - shop into Wordpress are there?
===
I have some articles of spreadshirt I want to sell.
I am using wordpress.
Which elegant ways of including **the spreadshirt - shop** into Wordpress are there?
Which elegant ways of including a **foreign website** into Wordpress are there? | 2 |
6,408,801 | 06/20/2011 08:53:23 | 782,323 | 06/03/2011 07:32:48 | 289 | 16 | Selenium PHP testing logged-in actions | I've done a bit of Selenium testing. I'm currently testing some actions wich require the user to be logged in, but I've noticed that the session gets killed on some browser, but not on others (Internet Explorer keeps session alive, but Firefox doesn't).
Is there a cleaner way to test it other than testing for the session cookie and, if not set, calling to a log-in method?
Currently I'm doing the following:
if(!$this->isCookiePresent('session_cookie')) {
$this->login();
} | php | selenium | phpunit | selenium-rc | null | null | open | Selenium PHP testing logged-in actions
===
I've done a bit of Selenium testing. I'm currently testing some actions wich require the user to be logged in, but I've noticed that the session gets killed on some browser, but not on others (Internet Explorer keeps session alive, but Firefox doesn't).
Is there a cleaner way to test it other than testing for the session cookie and, if not set, calling to a log-in method?
Currently I'm doing the following:
if(!$this->isCookiePresent('session_cookie')) {
$this->login();
} | 0 |
8,758,258 | 01/06/2012 13:06:41 | 995,199 | 10/14/2011 10:20:19 | 1 | 0 | copying files and checking if it exists | Excuse me, what is wrong in this code? I don't get it..
@echo off
cls
md h:\%1
IF EXIST %2 GOTO kop
IF NOT EXIST %2 echo File %2 doesn't exist
GOTO endd
:kop
copy %2 h:\%1
:endd | batch | null | null | null | null | 01/07/2012 03:54:06 | not a real question | copying files and checking if it exists
===
Excuse me, what is wrong in this code? I don't get it..
@echo off
cls
md h:\%1
IF EXIST %2 GOTO kop
IF NOT EXIST %2 echo File %2 doesn't exist
GOTO endd
:kop
copy %2 h:\%1
:endd | 1 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.