when i gdb a process on a remote server, the ssh disconnect, how could i
recover the ssh session work?
When I gdb a process on a remote server, the ssh disconnect.
How could I recover the old session's work when I ssh the server next time?
I try to kill the gdb process, but it causes the real process over.
thanks.
Wednesday, 11 September 2013
Is there another way to do this case statement?
Is there another way to do this case statement?
I have a case statement which evaluates an integer (result of a function)
for a result code, like this:
R:= DoSomething;
case R of
0: begin
//Success
end;
-MAXINT..-1: begin
//Failure
end;
end;
If it's a failure, it returns a negative number representing an error
code. DoSomething is just any function which returns an integer as a
response code (or error code, being a negative). If it is an error, it
gets passed on to another error handler. If it's a success, it gets passed
on to a success handler (continue, etc.). Positive values will be handled
by various specific handlers.
I was wondering if there's another way to write -MAXINT..-1. Something
more along the lines of "Anything -1 and under". I tried <=-1 but the
compiler didn't like that too much.
Is there a way to do this in a case statement?
I have a case statement which evaluates an integer (result of a function)
for a result code, like this:
R:= DoSomething;
case R of
0: begin
//Success
end;
-MAXINT..-1: begin
//Failure
end;
end;
If it's a failure, it returns a negative number representing an error
code. DoSomething is just any function which returns an integer as a
response code (or error code, being a negative). If it is an error, it
gets passed on to another error handler. If it's a success, it gets passed
on to a success handler (continue, etc.). Positive values will be handled
by various specific handlers.
I was wondering if there's another way to write -MAXINT..-1. Something
more along the lines of "Anything -1 and under". I tried <=-1 but the
compiler didn't like that too much.
Is there a way to do this in a case statement?
Javascript singleton inheritance
Javascript singleton inheritance
I would like to keep a single parent class. all clild classes that inherit
the parent class will be able to share the same parent class object. How
that can be achieved?
var ParentClass = function(){
this.a = null;
}
ParentClass.prototype.setA = function(inp){
this.a = inp;
}
ParentClass.prototype.getA = function(){
console.log("get a "+this.a);
}
// Clild Class
var ClassB = function(){}
ClassB.prototype = Object.create(ParentClass.prototype);
var b = new ClassB();
b.setA(10);
b.getA(); //it will return 10
//Another clild Class
var ClassC = function(){}
ClassC.prototype = Object.create(ParentClass.prototype);
var c = new ClassC();
c.getA(); //I want 10 here.
I understand, as for the second clild class the parent class is
instantiating again that is why I can't access the old object. How I can
achieve this singleton inheritance in Javascript? Any idea?
I would like to keep a single parent class. all clild classes that inherit
the parent class will be able to share the same parent class object. How
that can be achieved?
var ParentClass = function(){
this.a = null;
}
ParentClass.prototype.setA = function(inp){
this.a = inp;
}
ParentClass.prototype.getA = function(){
console.log("get a "+this.a);
}
// Clild Class
var ClassB = function(){}
ClassB.prototype = Object.create(ParentClass.prototype);
var b = new ClassB();
b.setA(10);
b.getA(); //it will return 10
//Another clild Class
var ClassC = function(){}
ClassC.prototype = Object.create(ParentClass.prototype);
var c = new ClassC();
c.getA(); //I want 10 here.
I understand, as for the second clild class the parent class is
instantiating again that is why I can't access the old object. How I can
achieve this singleton inheritance in Javascript? Any idea?
Scaleability of Remote EJB vs Local EJB
Scaleability of Remote EJB vs Local EJB
I have been trying to decide between a Local and Remote EJB for a Data
Access Layer. Through a lot of research, it seems like the general
consensus is that if I want scalability, I should use a Remote EJB.
What does that mean though? I can not find anything that explicitly shows
why Remote EJB can scale and Local can not.
I have been trying to decide between a Local and Remote EJB for a Data
Access Layer. Through a lot of research, it seems like the general
consensus is that if I want scalability, I should use a Remote EJB.
What does that mean though? I can not find anything that explicitly shows
why Remote EJB can scale and Local can not.
Android YouTube API access player from onClickListener
Android YouTube API access player from onClickListener
I'm following this tutorial to set up a custom youtube player via
youtubeapi:
http://www.techrepublic.com/blog/android-app-builder/using-googles-youtube-api-in-your-android-apps/
Here's the code for loading pre-set youtube video:
import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
import com.google.android.youtube.player.YouTubePlayer.Provider;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends YouTubeBaseActivity implements
YouTubePlayer.OnInitializedListener {
static private final String DEVELOPER_KEY = "mykey";
static private final String VIDEO = "Yc8YrVc47TI";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
YouTubePlayerView youTubeView = (YouTubePlayerView)
findViewById(R.id.youtube_view);
youTubeView.initialize(DEVELOPER_KEY, this);
}
@Override
public void onInitializationFailure(Provider provider,
YouTubeInitializationResult error) {
Toast.makeText(this, "Oh no! "+error.toString(),
Toast.LENGTH_LONG).show();
}
@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer
player, boolean wasRestored) {
player.loadVideo(VIDEO);
}
}
Now I'm trying to load different youtube video by clicking a button. So I
setup onClickListener for my button1 and trying to access the youtube
player, but It wont work.
public class MainActivity extends YouTubeBaseActivity implements
YouTubePlayer.OnInitializedListener {
static private final String DEVELOPER_KEY = "mykey";
static private final String VIDEO = "Yc8YrVc47TI";
Button button1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
YouTubePlayerView youTubeView = (YouTubePlayerView)
findViewById(R.id.youtube_view);
youTubeView.initialize(DEVELOPER_KEY, this);
button1 = (Button) findViewById(R.id.button1);
button1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
youTubeView.loadVideo("Erd2k6EKxCQ");
}
});
}
@Override
public void onInitializationFailure(Provider provider,
YouTubeInitializationResult error) {
Toast.makeText(this, "Oh no! "+error.toString(),
Toast.LENGTH_LONG).show();
}
@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer
player, boolean wasRestored) {
player.loadVideo(VIDEO);
}
}
How do I load a specific video from button1's onClickListener to
YouTubePlayer player.component?
I'm following this tutorial to set up a custom youtube player via
youtubeapi:
http://www.techrepublic.com/blog/android-app-builder/using-googles-youtube-api-in-your-android-apps/
Here's the code for loading pre-set youtube video:
import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
import com.google.android.youtube.player.YouTubePlayer.Provider;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends YouTubeBaseActivity implements
YouTubePlayer.OnInitializedListener {
static private final String DEVELOPER_KEY = "mykey";
static private final String VIDEO = "Yc8YrVc47TI";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
YouTubePlayerView youTubeView = (YouTubePlayerView)
findViewById(R.id.youtube_view);
youTubeView.initialize(DEVELOPER_KEY, this);
}
@Override
public void onInitializationFailure(Provider provider,
YouTubeInitializationResult error) {
Toast.makeText(this, "Oh no! "+error.toString(),
Toast.LENGTH_LONG).show();
}
@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer
player, boolean wasRestored) {
player.loadVideo(VIDEO);
}
}
Now I'm trying to load different youtube video by clicking a button. So I
setup onClickListener for my button1 and trying to access the youtube
player, but It wont work.
public class MainActivity extends YouTubeBaseActivity implements
YouTubePlayer.OnInitializedListener {
static private final String DEVELOPER_KEY = "mykey";
static private final String VIDEO = "Yc8YrVc47TI";
Button button1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
YouTubePlayerView youTubeView = (YouTubePlayerView)
findViewById(R.id.youtube_view);
youTubeView.initialize(DEVELOPER_KEY, this);
button1 = (Button) findViewById(R.id.button1);
button1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
youTubeView.loadVideo("Erd2k6EKxCQ");
}
});
}
@Override
public void onInitializationFailure(Provider provider,
YouTubeInitializationResult error) {
Toast.makeText(this, "Oh no! "+error.toString(),
Toast.LENGTH_LONG).show();
}
@Override
public void onInitializationSuccess(Provider provider, YouTubePlayer
player, boolean wasRestored) {
player.loadVideo(VIDEO);
}
}
How do I load a specific video from button1's onClickListener to
YouTubePlayer player.component?
execute only whitelisted python scripts
execute only whitelisted python scripts
I want to use python on my machine but I want to restrict script
execution. I want to maintain a file (or in memory data-structure) that
will contain the list of python scripts that may be executed on the
machine; the scripts that are not in this list shouldn't be allowed to get
executed.
Is there any way or tool to achieve this in python?
I want to use python on my machine but I want to restrict script
execution. I want to maintain a file (or in memory data-structure) that
will contain the list of python scripts that may be executed on the
machine; the scripts that are not in this list shouldn't be allowed to get
executed.
Is there any way or tool to achieve this in python?
How to start Activity using instance of it?
How to start Activity using instance of it?
I used this code to start a activity but throw a NullPointer and
illegalState exceptions.this is the code.
String test="test";
DownloadActivity downloadAct=new DownloadActivity(test);
Intent intent=new Intent(this,DownloadActivity.class);
downloadAct.startActivity(intent);
Is this possible?And i also tried with
downloadAct.onCreate();
but it need to pass Bundle and i passed
new Bundle();
it throw null pointer exception,So how can i use DownloadActivity
constructers to set its data and start the activity?
I used this code to start a activity but throw a NullPointer and
illegalState exceptions.this is the code.
String test="test";
DownloadActivity downloadAct=new DownloadActivity(test);
Intent intent=new Intent(this,DownloadActivity.class);
downloadAct.startActivity(intent);
Is this possible?And i also tried with
downloadAct.onCreate();
but it need to pass Bundle and i passed
new Bundle();
it throw null pointer exception,So how can i use DownloadActivity
constructers to set its data and start the activity?
Subscribe to:
Posts (Atom)