Trying to delete members via a listbox - how to call my delete function
passing the member's id?
To list all my members, I simply run a function that runs a SELECT query
(mssql) and lists all users by frst name / last name. I also fetch the
user id there.
To delete a user, I have a delete button, which runs a delete function
that runs a query such as
DELETE FROM members where id = @id
However, for the @id, I use the SelectedIndex, which of course is not
always equal to the user ID. I'd like to pass the user ID to my delete
function as a param but I'm not sure how.
I tried creating a hidden textBox for each member, with their ID in it,
but it failed and doesn't seem like the best way to do it even if I
succeed with that technique.
How would you go about it?
Thanks
Friday, 6 September 2013
Do something every X time with a cronometer
Do something every X time with a cronometer
I am quite noob I have a cronometer that begins to counter when I click a
button
crono = (Chronometer) findViewById(R.id.crono);
begin= (Button) findViewById(R.id.begin);
begin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
crono.setBase(SystemClock.elapsedRealtime());
crono.start();
every minute do something ////////
}
});
What should I do to do something every minute? For example 1:00 ---> do
something 2:00 ---> do something
Any suggestion will be apreciated. :)
I am quite noob I have a cronometer that begins to counter when I click a
button
crono = (Chronometer) findViewById(R.id.crono);
begin= (Button) findViewById(R.id.begin);
begin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
crono.setBase(SystemClock.elapsedRealtime());
crono.start();
every minute do something ////////
}
});
What should I do to do something every minute? For example 1:00 ---> do
something 2:00 ---> do something
Any suggestion will be apreciated. :)
MKMapView center and zoom the view towards the annotations,
MKMapView center and zoom the view towards the annotations,
MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation1 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation2 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation3 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation4 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation5 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation6 = [[MKPointAnnotation alloc] init];
annotation.coordinate=CLLocationCoordinate2DMake(40.748736,-73.892523);
annotation.title=@"Head Office";
annotation1.coordinate=CLLocationCoordinate2DMake(40.747972,-73.891858);
annotation1.title=@"Kalpana Chawla";
annotation2.coordinate=CLLocationCoordinate2DMake(40.74768,-73.891818);
annotation2.title=@"New Jackson Heights";
annotation3.coordinate=CLLocationCoordinate2DMake(40.642973,-73.979019);
annotation3.title=@"Brooklyn";
annotation4.coordinate=CLLocationCoordinate2DMake(40.617862,-73.962418);
annotation4.title=@"Coney Islands";
annotation5.coordinate=CLLocationCoordinate2DMake(40.83659,-73.853234);
annotation5.title=@"Bronx";
annotation6.coordinate=CLLocationCoordinate2DMake(40.635336,-73.963204);
annotation6.title=@"Malborough";
[mapView addAnnotation:annotation];
[mapView addAnnotation:annotation1];
[mapView addAnnotation:annotation2];
[mapView addAnnotation:annotation3];
[mapView addAnnotation:annotation4];
[mapView addAnnotation:annotation5];
[mapView addAnnotation:annotation6];
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in mapView.annotations) {
NSLog(@"%@",annotation);
MKMapPoint annotationPoint =
MKMapPointForCoordinate(annotation.coordinate);
MKMapRect pointRect = MKMapRectMake(annotationPoint.x,
annotationPoint.y, 0, 0);
if (MKMapRectIsNull(zoomRect)) {
zoomRect = pointRect;
} else {
zoomRect = MKMapRectUnion(zoomRect, pointRect);
}
}
[mapView setVisibleMapRect:zoomRect animated:YES];
I have these 6 static locations I have to show on the MK Map. After
manually declaring all the annotation, I used the for loop code I found on
stackoverflow to center and zoom my map to the annotations declared. But
when I run my application, the map gives me a default zoom level view
towards the Atlantic Ocean. Help please. I am running the app in simulator
MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation1 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation2 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation3 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation4 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation5 = [[MKPointAnnotation alloc] init];
MKPointAnnotation *annotation6 = [[MKPointAnnotation alloc] init];
annotation.coordinate=CLLocationCoordinate2DMake(40.748736,-73.892523);
annotation.title=@"Head Office";
annotation1.coordinate=CLLocationCoordinate2DMake(40.747972,-73.891858);
annotation1.title=@"Kalpana Chawla";
annotation2.coordinate=CLLocationCoordinate2DMake(40.74768,-73.891818);
annotation2.title=@"New Jackson Heights";
annotation3.coordinate=CLLocationCoordinate2DMake(40.642973,-73.979019);
annotation3.title=@"Brooklyn";
annotation4.coordinate=CLLocationCoordinate2DMake(40.617862,-73.962418);
annotation4.title=@"Coney Islands";
annotation5.coordinate=CLLocationCoordinate2DMake(40.83659,-73.853234);
annotation5.title=@"Bronx";
annotation6.coordinate=CLLocationCoordinate2DMake(40.635336,-73.963204);
annotation6.title=@"Malborough";
[mapView addAnnotation:annotation];
[mapView addAnnotation:annotation1];
[mapView addAnnotation:annotation2];
[mapView addAnnotation:annotation3];
[mapView addAnnotation:annotation4];
[mapView addAnnotation:annotation5];
[mapView addAnnotation:annotation6];
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in mapView.annotations) {
NSLog(@"%@",annotation);
MKMapPoint annotationPoint =
MKMapPointForCoordinate(annotation.coordinate);
MKMapRect pointRect = MKMapRectMake(annotationPoint.x,
annotationPoint.y, 0, 0);
if (MKMapRectIsNull(zoomRect)) {
zoomRect = pointRect;
} else {
zoomRect = MKMapRectUnion(zoomRect, pointRect);
}
}
[mapView setVisibleMapRect:zoomRect animated:YES];
I have these 6 static locations I have to show on the MK Map. After
manually declaring all the annotation, I used the for loop code I found on
stackoverflow to center and zoom my map to the annotations declared. But
when I run my application, the map gives me a default zoom level view
towards the Atlantic Ocean. Help please. I am running the app in simulator
Thursday, 5 September 2013
Is there a way to modify GC behavior for objects of my class
Is there a way to modify GC behavior for objects of my class
I have an application which is going to have millions of objects of a
class that we own. We need our application to perform good on low memory
machines; So we have a solution that lets us store and retrieve objects in
file system on disk.
What I would like to implement is some sort of "shelving" of an object
once its created and not used for so long,
One way is to destory/re-construct; but I heard GC moves long living
objects to Gen 2 Heap; Is there any way I can tell GC that for so and so
types of object, the Gen 2 heap should be replaced by something else ?
I have an application which is going to have millions of objects of a
class that we own. We need our application to perform good on low memory
machines; So we have a solution that lets us store and retrieve objects in
file system on disk.
What I would like to implement is some sort of "shelving" of an object
once its created and not used for so long,
One way is to destory/re-construct; but I heard GC moves long living
objects to Gen 2 Heap; Is there any way I can tell GC that for so and so
types of object, the Gen 2 heap should be replaced by something else ?
how to play video using flow player
how to play video using flow player
i am trying to pass the path of my video to play using the following code
protected string videoplay(string links)
{
string val;
val = "<object
data='http://releases.flowplayer.org/swf/flowplayer-3.2.16.swf'
displaysize='4' autosize='-1' bgcolor='green' showtracker='-1'
showdisplay='0' showstatusbar='-1' videoborder3d='-1' width='800'
height='285' src=' " + links + "' autostart='false'
loop='false'>";
val = val + "</object>";
return val;
}
but its not playing the video selected.
please help
any code or suggestions is much appreciated
thanks
i am trying to pass the path of my video to play using the following code
protected string videoplay(string links)
{
string val;
val = "<object
data='http://releases.flowplayer.org/swf/flowplayer-3.2.16.swf'
displaysize='4' autosize='-1' bgcolor='green' showtracker='-1'
showdisplay='0' showstatusbar='-1' videoborder3d='-1' width='800'
height='285' src=' " + links + "' autostart='false'
loop='false'>";
val = val + "</object>";
return val;
}
but its not playing the video selected.
please help
any code or suggestions is much appreciated
thanks
Detect the device file used by a terminal
Detect the device file used by a terminal
When a terminal or console is started a /dev/ttyX file is created for that
instance. From that given terminal, is it possible to detect what is the
ttyX file being used?
When a terminal or console is started a /dev/ttyX file is created for that
instance. From that given terminal, is it possible to detect what is the
ttyX file being used?
how to dismiss MPMoviePlayer ? properly from one ViewController to another
how to dismiss MPMoviePlayer ? properly from one ViewController to another
Now when the video is playing and reaches the end. the Notification works
great. This is what I have
NSURL * url = [[NSURL alloc]
initWithString:@"http://INFINITECREATIVEUNIVERSE.COM/Media/module_1_Dec/c_January27AffactPerfect.mov"];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[moviePlayer.view setFrame:CGRectMake(0, 0, 500, 260)];
[self.view addSubview:moviePlayer.view];
//Some addiontal customization
moviePlayer.fullscreen = YES;
moviePlayer.allowsAirPlay = YES;
moviePlayer.shouldAutoplay = YES;
moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
//moviePlayer.endPlaybackTime = NO;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playMovieFinished:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
// this part of Notification Works great. It finds the Segue no problem
-(void)playMovieFinished:(NSNotification*)theNotification {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; //
Change Segue ID Here
[self performSegueWithIdentifier:@"VC_5" sender:self];
}
But when I click next while the video is playing and my next
ViewController has no video I can hear the video still playing from the
previous ViewController.
My question is this. To properly dismiss the View Controller and the
MPMoviePlayer. how do I do that? I am lost. I did download the file from
Apple to MoviePlayer. But it is now old and it will not work properly. I
am lost on how to make this work. So, how do I click the button for the
Next ViewController that has no Video. I am crossing my fingers that I
have answered the question correctly. Please have mercy on my novice
question. Thank you robert
Now when the video is playing and reaches the end. the Notification works
great. This is what I have
NSURL * url = [[NSURL alloc]
initWithString:@"http://INFINITECREATIVEUNIVERSE.COM/Media/module_1_Dec/c_January27AffactPerfect.mov"];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[moviePlayer.view setFrame:CGRectMake(0, 0, 500, 260)];
[self.view addSubview:moviePlayer.view];
//Some addiontal customization
moviePlayer.fullscreen = YES;
moviePlayer.allowsAirPlay = YES;
moviePlayer.shouldAutoplay = YES;
moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
//moviePlayer.endPlaybackTime = NO;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playMovieFinished:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
// this part of Notification Works great. It finds the Segue no problem
-(void)playMovieFinished:(NSNotification*)theNotification {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; //
Change Segue ID Here
[self performSegueWithIdentifier:@"VC_5" sender:self];
}
But when I click next while the video is playing and my next
ViewController has no video I can hear the video still playing from the
previous ViewController.
My question is this. To properly dismiss the View Controller and the
MPMoviePlayer. how do I do that? I am lost. I did download the file from
Apple to MoviePlayer. But it is now old and it will not work properly. I
am lost on how to make this work. So, how do I click the button for the
Next ViewController that has no Video. I am crossing my fingers that I
have answered the question correctly. Please have mercy on my novice
question. Thank you robert
Subscribe to:
Posts (Atom)