thread synchronised confused by lock(this)
I hava a class:
public class LockTest
{
public void LockThis()
{
lock (this)
{
Console.WriteLine("lock this test");
System.Threading.Thread.Sleep(5000);
}
}
}
in Main:
static void Main(string[] args)
{
LockTest lockTest = new LockTest();
lock (lockTest)
{
//lockTest.LockThis();
System.Threading.Thread thread = new Thread(lockTest.LockThis);
thread.Start();
}
Console.Read();
}
I thought the invoking lockTest.LockThis() will cause a dead lock but it
didn't. I don't konw why.
Saturday, 14 September 2013
Friday, 13 September 2013
HTML CSS draw angular side
HTML CSS draw angular side
Need to draw angular sides of menubar as
inner content may be the some labels or links.
Thanks verymuch
Need to draw angular sides of menubar as
inner content may be the some labels or links.
Thanks verymuch
Dynamic Div Content with just clicking one link/button
Dynamic Div Content with just clicking one link/button
I need help here please.
I want to show dynamic content to a div. I already have the code below:
<script type="text/javascript"><!--
function ReplaceContentInContainer(id,content) {
var container = document.getElementById(id);
container.innerHTML = content;
}
//--></script>
<div id="example1div" style="padding:10px; text-align:left;">
<p>Content 1</p>
</div>
<p align="center"><a
href="javascript:ReplaceContentInContainer('example1div','<p>Content
2</p>')">View another</a></p>
What it does is, when click the "View another" it replace the 'Content 1'
to 'Content 2' but what I want here is that, when 'Content 2' is already
shown, I want to click the "View another" link again and replace the div
content again with the new content like 'Content 3'.
Anyone please help me solve this.
Thanks in advance :)
I need help here please.
I want to show dynamic content to a div. I already have the code below:
<script type="text/javascript"><!--
function ReplaceContentInContainer(id,content) {
var container = document.getElementById(id);
container.innerHTML = content;
}
//--></script>
<div id="example1div" style="padding:10px; text-align:left;">
<p>Content 1</p>
</div>
<p align="center"><a
href="javascript:ReplaceContentInContainer('example1div','<p>Content
2</p>')">View another</a></p>
What it does is, when click the "View another" it replace the 'Content 1'
to 'Content 2' but what I want here is that, when 'Content 2' is already
shown, I want to click the "View another" link again and replace the div
content again with the new content like 'Content 3'.
Anyone please help me solve this.
Thanks in advance :)
understanding javascript functions and var
understanding javascript functions and var
I just went through my class note and not really understood
var x = 1;
function func1() {
x+= 10; }
func2= function( x )
{ x += 5;
}
what does the line func2= function( x ) means? does x will be 15?
I just went through my class note and not really understood
var x = 1;
function func1() {
x+= 10; }
func2= function( x )
{ x += 5;
}
what does the line func2= function( x ) means? does x will be 15?
One notification work and cancel the other notifications
One notification work and cancel the other notifications
I am having a problem here guys which is I'm trying to do three
notification with sounds and what i want to do is when the S1 button or S2
or S3 one of them pressed i want to cancel the other two notification
help please with details because im confused
}
-(void)scheduleLocalNotificationWithDate:(NSDate *)fireDate
{
UILocalNotification *notifiction = [[UILocalNotification alloc]init];
notifiction.FireDate = fireDate;
notifiction.AlertBody = @" ";
notifiction.soundName = NSUserDefaultsDidChangeNotification;
notifiction.repeatInterval= NSMinuteCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification: notifiction];
NSLog(@" ");
}
(IBAction)SetBtn:(id)sender
{
NSDateFormatter *dateFormatter =[ [NSDateFormatter alloc] init];
dateFormatter.timeZone = [NSTimeZone defaultTimeZone];
dateFormatter.timeStyle = NSDateFormatterShortStyle;
dateFormatter.dateStyle = NSDateFormatterShortStyle;
NSString *dateTimeString = [dateFormatter stringFromDate:
dateTimePicker.date];
[self scheduleLocalNotificationWithDate:dateTimePicker.date];
}
(IBAction)S1:(NSDate *) fireDate;
{
soundNumber = 1; [[NSUserDefaults standardUserDefaults] setObject:@"S1"
forKey:@"UserSoundChoice"]; UILocalNotification *localNotification1 =
[[UILocalNotification alloc] init]; [localNotification1
setFireDate:[NSDate date]]; [localNotification1 setTimeZone:[NSTimeZone
defaultTimeZone]]; [localNotification1 setAlertBody:@"Wake up!!"];
[localNotification1 setAlertAction:@"View"]; [localNotification1
setHasAction:YES]; localNotification1.repeatInterval=
NSMinuteCalendarUnit; localNotification1.soundName= [[NSUserDefaults
standardUserDefaults] objectForKey:@"UserSoundChoice"]; [[UIApplication
sharedApplication] scheduleLocalNotification:localNotification1];
}
(IBAction)S2:(NSDate *) fireDate;
{
soundNumber = 2; [[NSUserDefaults standardUserDefaults] setObject:@"S2"
forKey:@"UserSoundChoice"]; UILocalNotification *localNotification2 =
[[UILocalNotification alloc] init]; [localNotification2
setFireDate:[NSDate date]]; [localNotification2 setTimeZone:[NSTimeZone
defaultTimeZone]]; [localNotification2 setAlertBody:@"Wake up!!"];
[localNotification2 setAlertAction:@"View"]; [localNotification2
setHasAction:YES]; localNotification2.repeatInterval=
NSMinuteCalendarUnit; localNotification2.soundName= [[NSUserDefaults
standardUserDefaults] objectForKey:@"UserSoundChoice"]; [[UIApplication
sharedApplication] scheduleLocalNotification:localNotification2];
}
-(IBAction)S3: (NSDate *) fireDate;
{
soundNumber = 3;
[[NSUserDefaults standardUserDefaults] setObject:@"S3"
forKey:@"UserSoundChoice"];
UILocalNotification *localNotification3 = [[UILocalNotification alloc] init];
[localNotification3 setFireDate:[NSDate date]];
[localNotification3 setTimeZone:[NSTimeZone defaultTimeZone]];
[localNotification3 setAlertBody:@""];
[localNotification3 setAlertAction:@"View"];
[localNotification3 setHasAction:YES];
localNotification3.repeatInterval= NSMinuteCalendarUnit;
localNotification3.soundName= [[NSUserDefaults standardUserDefaults]
objectForKey:@"UserSoundChoice"];
[[UIApplication sharedApplication]
scheduleLocalNotification:localNotification3];
}
I am having a problem here guys which is I'm trying to do three
notification with sounds and what i want to do is when the S1 button or S2
or S3 one of them pressed i want to cancel the other two notification
help please with details because im confused
}
-(void)scheduleLocalNotificationWithDate:(NSDate *)fireDate
{
UILocalNotification *notifiction = [[UILocalNotification alloc]init];
notifiction.FireDate = fireDate;
notifiction.AlertBody = @" ";
notifiction.soundName = NSUserDefaultsDidChangeNotification;
notifiction.repeatInterval= NSMinuteCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification: notifiction];
NSLog(@" ");
}
(IBAction)SetBtn:(id)sender
{
NSDateFormatter *dateFormatter =[ [NSDateFormatter alloc] init];
dateFormatter.timeZone = [NSTimeZone defaultTimeZone];
dateFormatter.timeStyle = NSDateFormatterShortStyle;
dateFormatter.dateStyle = NSDateFormatterShortStyle;
NSString *dateTimeString = [dateFormatter stringFromDate:
dateTimePicker.date];
[self scheduleLocalNotificationWithDate:dateTimePicker.date];
}
(IBAction)S1:(NSDate *) fireDate;
{
soundNumber = 1; [[NSUserDefaults standardUserDefaults] setObject:@"S1"
forKey:@"UserSoundChoice"]; UILocalNotification *localNotification1 =
[[UILocalNotification alloc] init]; [localNotification1
setFireDate:[NSDate date]]; [localNotification1 setTimeZone:[NSTimeZone
defaultTimeZone]]; [localNotification1 setAlertBody:@"Wake up!!"];
[localNotification1 setAlertAction:@"View"]; [localNotification1
setHasAction:YES]; localNotification1.repeatInterval=
NSMinuteCalendarUnit; localNotification1.soundName= [[NSUserDefaults
standardUserDefaults] objectForKey:@"UserSoundChoice"]; [[UIApplication
sharedApplication] scheduleLocalNotification:localNotification1];
}
(IBAction)S2:(NSDate *) fireDate;
{
soundNumber = 2; [[NSUserDefaults standardUserDefaults] setObject:@"S2"
forKey:@"UserSoundChoice"]; UILocalNotification *localNotification2 =
[[UILocalNotification alloc] init]; [localNotification2
setFireDate:[NSDate date]]; [localNotification2 setTimeZone:[NSTimeZone
defaultTimeZone]]; [localNotification2 setAlertBody:@"Wake up!!"];
[localNotification2 setAlertAction:@"View"]; [localNotification2
setHasAction:YES]; localNotification2.repeatInterval=
NSMinuteCalendarUnit; localNotification2.soundName= [[NSUserDefaults
standardUserDefaults] objectForKey:@"UserSoundChoice"]; [[UIApplication
sharedApplication] scheduleLocalNotification:localNotification2];
}
-(IBAction)S3: (NSDate *) fireDate;
{
soundNumber = 3;
[[NSUserDefaults standardUserDefaults] setObject:@"S3"
forKey:@"UserSoundChoice"];
UILocalNotification *localNotification3 = [[UILocalNotification alloc] init];
[localNotification3 setFireDate:[NSDate date]];
[localNotification3 setTimeZone:[NSTimeZone defaultTimeZone]];
[localNotification3 setAlertBody:@""];
[localNotification3 setAlertAction:@"View"];
[localNotification3 setHasAction:YES];
localNotification3.repeatInterval= NSMinuteCalendarUnit;
localNotification3.soundName= [[NSUserDefaults standardUserDefaults]
objectForKey:@"UserSoundChoice"];
[[UIApplication sharedApplication]
scheduleLocalNotification:localNotification3];
}
Cakephp Upload plugin allows any file extension to be uploaded despite validation rules
Cakephp Upload plugin allows any file extension to be uploaded despite
validation rules
'model' => array(
'rule' => array('isValidExtension', array('xls')),
'message' => 'File does not have a stl extension'
),
Allows absolutely any file to be uploaded. I have this is as my first
validation rule. Other validation rules like notEmpty, and isUnique work
fine on the same form element.
Tried adding stl to the array found in the main behavior: 'extensions' =>
array('xls') - also did not work.
Any idea on what I'm doing wrong here?
Also: This appears to happen regardless of the file extension I pick. No
matter what, it doesn't call the file invalid. The same issue appears to
happen with Mime types as well.
The plugin URL is: https://github.com/josegonzalez/upload
validation rules
'model' => array(
'rule' => array('isValidExtension', array('xls')),
'message' => 'File does not have a stl extension'
),
Allows absolutely any file to be uploaded. I have this is as my first
validation rule. Other validation rules like notEmpty, and isUnique work
fine on the same form element.
Tried adding stl to the array found in the main behavior: 'extensions' =>
array('xls') - also did not work.
Any idea on what I'm doing wrong here?
Also: This appears to happen regardless of the file extension I pick. No
matter what, it doesn't call the file invalid. The same issue appears to
happen with Mime types as well.
The plugin URL is: https://github.com/josegonzalez/upload
Display Image on Mouseover
Display Image on Mouseover
How do I display an image on mouse over? I also need to underline the text
next to the image on mouse over? On mouseout I have to hide the image and
make the text normal again.
This is my html field
<img src="img.jpg"> Name
Now when I load the page I want not to display the image unless I have the
mouse over the place it should appear.
How do I display an image on mouse over? I also need to underline the text
next to the image on mouse over? On mouseout I have to hide the image and
make the text normal again.
This is my html field
<img src="img.jpg"> Name
Now when I load the page I want not to display the image unless I have the
mouse over the place it should appear.
Subscribe to:
Posts (Atom)