w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Not able to fire NSLocalNotification at specific time
You are confused about what is in the data and what it displays on your console. Specifically, in your second log message you need to format it again. It seems that the date is OK. So just use it as expected. If you want it to look right in the NSLog statements, you have to format it (which you know how to do). No conversion necessary, just data formatting to display it properly.

Categories : Iphone

Timer in android to execute after a specific time?
You can use this: private void TimeMethod() { new Handler().postDelayed(new Runnable() { @Override public void run() { //TODO after 9 sec } }, 9000); } Hope this will be usefull, Cheers

Categories : Android

display text when the timer reaches a specific time
Define a Timer after the class. static volatile int time; Timer t = new Timer(); now edit your function like this botonok.setOnClickListener(new OnClickListener() { public void onClick(View v) { Resources res = getResources(); myString = res.getStringArray(R.array.myArray); String a = myString[rgenerator.nextInt(myString.length)]; time=1; t.scheduleAtFixedRate(new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { public void run() { TextView elemento1 = (TextView) findViewById(R.id.elemento1); if(time==0||time==2||time==4||time==6) elemento1.setText(a); time=time+1; } } }); } }, 10

Categories : Android

Run timer for 10 minutes and then Disable Button c#
Your timer may be getting garbage collected if it is a long-running method instead of as part of the class, I cannot tell by the code posted. Read the Timer.Interval Property documentation, which also has a sample of how to implement a timer.

Categories : C#

NSTimer and NSInvocation, timer does not fire
You need to add the timer to a run loop that a) exists and b) is running, or it will never fire, and you probably want your callback to happen on the main thread anyways. Add the timer to the main thread's run loop like this: [[NSRunLoop mainRunLoop] addTimer:[NSTimer timerWithTimeInterval:timeUntilCheck invocation:invocation repeats:NO] forMode:NSDefaultRunLoopMode];

Categories : Objective C

backbonejs fire event after parse is complete
The reset method will be triggered when {reset: true} option is passed to the fetch. You can listen to the add and sync that will fire this method. Also use this.listenTo bind the events in a cleaner manner. initialize: function() { ... some other code this.listenTo(this.collection, "add sync", this.more); this.collection.fetch(); }

Categories : Backbone Js

Getting the time difference using LINQ from a list of TimeSpans and parsing the time in as only minutes and seconds
I would use DateTime.ParseExact. Then you can use the indexer of the ordered List to access the previous TimeSpan and subtract it from the next TimeSpan: var lapTimes = new[]{"00:30", "1:50","2:00"}; var laps = lapTimes.Select(s => DateTime.ParseExact(s, "m:ss", null).TimeOfDay) .OrderBy(ts => ts) .ToList(); var diffs = laps.Take(1) // take the first fix TimeSpan .Concat(laps.Skip(1).Select((ts, i) => ts - laps[i])) // add all differences .ToList(); DEMO Edit: For the sake of completeness, i always forget that you need to escape the colons in TimeSpan.ParseExact, so this works also: var laps = lapTimes.Select(s => TimeSpan.ParseExact(s, @"m:ss", null)) .... Details: Custom TimeSpan Format Strings

Categories : C#

Calculate total time in minutes between two timings in two diff. time zones (UTC and IST) - Rails 3.2.13
seconds_difference = Time.parse('2013-08-29 22:48:00 UTC') - Time.parse('2013-08-30 00:18:40 +0530') Will give you the seconds difference, then you can get you need from there by doing seconds_difference / 1.day or seconds_difference / 1.hour

Categories : Ruby On Rails

Difference of current time and past time in minutes?
This line: current_date = java.text.DateFormat.getDateTimeInstance().format( Calendar.getInstance().getTime()); returns the current time (string). So then When you try current_date.getTime() you are trying to get the time from a string. Do this (untested but it should work): Calendar current_date = Calendar.getInstance(); Then you should call current_date.getTime(), and parse the answer to int/long/double. Do the same for saved_date. Check this out too: http://developer.android.com/reference/java/util/Calendar.html Try, and write for further help.

Categories : Java

Count Minutes Between Current Time and Open Time
you have to use following function for get minute difference. SELECT TIMESTAMPDIFF(MINUTE,opentime,endtime); Please refer http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_timestampdiff

Categories : SQL

Jquery Trigger Events programmatically and wait until the action of previous event is complete to fire next one
Create $.Deferred objects for each part of the chain, then bind them to be resolved when the events are actually triggered: callbacks = [$.Deferred(), $.Deferred(), $.Deferred()]; obj.on('mouseover', callbacks[0].resolve); obj.on('click', callbacks[1].resolve); obj.on('mouseout', callbacks[2].resolve); $.when(callbacks).done(function() { console.log('all three have fired'); }); You'd need additional logic to ensure that the order is preserved -- perhaps by using 'reject' if click isn't triggered before mouseout.

Categories : Javascript

jquery .one() fire query for one time but how can i able to fire query once if something is going wrong inside .one()?
You want to use one() for this, but plain ajax. Instead of the way you do it now, make a variable called something like 'allowAjaxCheckLogin` and set it to true. In your regular click handler you check if it is true, if so, set it to false and do the ajax part. When ajax is done and the user needs to be able to do it again, set it back to true var allowAjaxCheckLogin = true; // set to true, normal/startsituation allows a click $('#submit').on('click', function(){ // User may trigger actions: if( allowAjaxCheckLogin === true){ allowAjaxCheckLogin = false; // Instantly set to false, if the user clicks again, nothing will happen $.ajax({ /* ajax settings here */ }) .complete(function(){ // this always fires, here you can check if you need to re

Categories : Javascript

Shell script: fire a command if system time is equal to given time
I think the above is just a small syntax error, instead of: if ($now == $cur) You may want to do this: if [ $now -eq $cur ] #very basic comparison here, you may want to have a #look at the bash comparisons Update Could you change the variable to, $cur=$(date +%H%M) And in case the input is not provided by you, you should remove the space in front of the $now now=$(echo $now | sed 's/s//g') #this removes the spaces in the input

Categories : Linux

getting the time of X minutes ago in C
Since time(NULL) returns the time in seconds from the epoch (usually the Unix epoch) i.e. 00:00:00 UTC on 1 January 1970 (or 1970-01-01T00:00:00Z ISO 8601): #include <time.h> #include <stdio.h> time_t current_time; time_t tenMinutesAgo; int main() { char* c_time_string; current_time = time(NULL); tenMinutesAgo = current_time - 10*60;//the time 10 minutes ago is 10*60 c_time_string = ctime(&tenMinutesAgo);//convert the time tenMinutesAgo into a string format in the local time format printf("The time 10 minutes ago in seconds from the epoch is: %i ", (int)tenMinutesAgo); printf("The time 10 minutes ago from the epoch in the local time format is: %s ", c_time_string); return 0; } EDIT: @PaulGriffiths makes a good point in that my solution isn't guarantee

Categories : C

Add minutes to current time
Your code is redundant. Why format a timestamp as a string, then convert that string back to a timestamp? Try $now = time(); $ten_minutes = $now + (10 * 60); $startDate = date('m-d-Y H:i:s', $now); $endDate = date('m-d-Y H:i:s', $ten_minutes); instead.

Categories : PHP

Session Time-Out after 10 minutes
Quick hack: Set the session 2 minutes later than the forms timeout. This ensures that the session is not killed on the exact second the authentication dies. But remember, sessions are independent of forms (see this blog) for more details. <system.web> <authentication mode="Forms"> <forms timeout="20" loginUrl="-- Login Page here --"/> </authentication> <sessionState mode="InProc" timeout="22"/> </system.web> Deeper investigation: I would try and work out which one specifically is timing out. This is a fairly easy test, and will save you quite a lot of time. So, the sections required are these with a timeout of 1 minute and session of 10000 <system.web> <authentication mode="Forms"> <forms timeout="1" loginUr

Categories : Asp Net

Date and Time Difference in Minutes
You can rely on TimeSpan: Dim elapsedTime As TimeSpan = DateTime.Parse(EndTime.Text).Subtract(DateTime.Parse(StartTime.Text)) It behaves as a normal time variable from which you can extract all the information you want. Example: Dim elapsedMinutesText As String = elapsedTime.Minutes.ToString() Bear in mind that the code above takes string variables as inputs (the text from your textboxes) because it performs the corresponding conversion: Convert.ToDateTime. Regarding your code, it refers to EndTime and StartTime and these are not DateTime variables, but TextBoxes. You have to convert them (their text) into DateTime as I am doing above, that is: DateDiff(DateInterval.Minute, DateTime.Parse(EndTime.Text), DateTime.Parse(StartTime.Text))

Categories : Vb.Net

Calculate time difference in minutes
You can use the datetime module import datetime with open('minutes', 'r') as myfile: times = myfile.read().split()[::2] dates = [datetime.datetime.strptime(i, '%H:%M') for i in times] differences = [j-i for i, j in zip(dates[:-1], dates[1:])] print [divmod(i.seconds, 60)[0] for i in differences] Prints: [1, 0, 1]

Categories : Python

R - how to turn time stamp into minutes?
install the chron package install.packages("chron") load the library library(chron) Ill create a timestamp character string to play with d=c("2:20:34","3:12:22") read the data into a date-time class df=strptime(d,format='%H:%M:%S') > minutes(df) [1] 20 12 > hours(df) [1] 2 3 > seconds(df) [1] 34 22 so all we need to do is compute the minutes from these three timeinminutes= 60*hours(df)+minutes(df)+seconds(df)/60

Categories : R

Socket time out after two minutes although set to more than two mintues
You can't increase the connect timeout beyond the platform default, which is about a minute. You can only decrease it. Trying to increase it doesn't actually make sense. What are you trying to accomplish?

Categories : Java

How to program a user-specific RSS reader that checks for new XML data every 15 minutes in C# ASP.NET
This should be done outside of ASP.NET using a kind of scheduler. You can build your own solution using Windows Service/Timer or use 3rd party solution like Quartz.NET At a very basic, every time scheduled interval elapses - you loop thru your user accounts, parse their RSS feeds and notify users about new items.

Categories : C#

detect 15 minutes elapsed time from datetime.now
Just use // In the timepicker's time-changed event if (DateTime.Now.CompareTo(timepicker.Value) == 1 && DateTime.Now.Subtract(timepicker.Value).TotalMilliseconds > 15 * 60 * 1000) { // Do stuff! MessageBox.Show("You can only set a max of 15 minutes ahead of the current time!"); // Cancel the event / set the timepicker's value back to the current time / whatever you prefer // One option: timepicker.Value = DateTime.Now; }

Categories : C#

Python: Get minutes overlap between time range
def overlap(range1,range2): start_datetime = max(range1[0],range2[0]) end_datetime = min(range1[1],range2[1]) return end_datetime-start_datetime print overlap([date_base_start,date_base_end],[date_3_start, date_3_end])

Categories : Python

How to convert the NSString time to condition if it's more than 30 minutes
Here you are NSString *string = @"00:50"; NSArray *components = [string componentsSeparatedByString:@":"]; int hours = [[components objectAtIndex:0] intValue]; int minutes = [[components objectAtIndex:1] intValue]; if( ((hours * 60) + minutes) > 30) { // ... }

Categories : IOS

How to test if passed in datetime (GMT) is within 5 minutes of time?
After your parse the passed in date to an appropriate format, you can use the DateTime.Subtract method to determine the difference, e.g. var minutes = utcNow.Subtract(gmt).TotalMinutes

Categories : C#

click event fire multiple time if i initialize marker multiple time in google maps
Every time you click the map (after the first) you move the marker: if (markerForWhatsHere != undefined) { // ... markerForWhatsHere.setPosition(whatsHereEventLatLng); But add a new 'click' event listener to it: google.maps.event.addListener(markerForWhatsHere, 'click', function (event) { alert("addressForWhatsHere "+addressForWhatsHere); if (event.alreadyCalled_) { // alert('circle clicked again'); } else { var markerTitle=markerForWhatsHere.getIcon(); if(markerTitle.indexOf("green")!=-1) { //for marker selection setMarkerTitle=markerTitle.replace("green","yellow");//changing color of marker markerForWhatsHere.setIcon(setMarkerTitle); }//end if marker is green //end of marker selection if(markerTitle.in

Categories : Google Maps

How can I sleep for the difference between 5 minutes and the start time in Ruby?
The current code sleeps for the length of time that the original process took (the value of ended). Which makes the whole loop time half "doing stuff", half sleep. You should probably just change the sleep line to sleep 5.minutes - ended instead, if I understand the question correctly, and that you wish to run the process once every 5 minutes, taking account of how long it takes to complete. You might want to consider using cron instead, if setup time to get to the loop is not too high.

Categories : Ruby

date time difference get hour:minutes:seconds
Try this, SELECT convert(varchar(10),DATEDIFF(hour,t.Paydate,t.DelDate))+'hr:' +convert(varchar(10),DATEDIFF(minute,t.Paydate,t.DelDate)% 60) + 'mnts:' +convert(varchar(10),DATEDIFF(SECOND,t.Paydate,t.DelDate)% 60) +'seconds' AS 'DIFF IN HH:MM:SS' FROM Transaction_tbl t WHERE t.transactID=19

Categories : SQL

Add 15 minutes to current time and snap to 15 minute intervals
Just to correct my post: $time = time(); $last_time = ($time - ($time % (15 * 60))); $in15mins = $last_time+ (15 * 60); echo 'Now: '. date('Y-m-d H:i') ." "; echo 'in 15 mins: '. date('Y-m-d H:i', $in15mins) ." "; I think it is quite self explaining. Optimize it, use it.

Categories : PHP

How to Vibrate Android device for long time(e.g 2,5,10 minutes)
that works as expected, see 2nd parameter docs: repeat the index into pattern at which to repeat, or -1 if you don't want to repeat. and since your pattern doesn't have index 10 it's just ignored

Categories : Android

Group time by X minutes, splitting at X minute intervals
Conceptually I would approach this by first grouping by date, then iterate over all the date groups and place the different entries into 5 min time buckets. The time buckets could perhaps be implemented as a predefined Dictionary<int,List<DateTime>> that you add to

Categories : C#

Visual Studio blocks the UI for minutes at a time for C++/XAML file
first of all try this. Also I recommend to disable design view default for XAML files in options: Tools -> Options... -> Text Editor -> XAML -> Misc -> Always open documents in full XAML view. FYI: this recommendations made my VS2012 faster. With kind regards, Michael.

Categories : C++

cakephp 2.3 format time input hours minutes seconds
If you are not a php expert then you can go with simple code given below. Note: Post is my Model name.So Replace it with yours. Add function in your controller public function add() { if ($this->request->is('post')) { $this->Post->create(); $hours = $this->data['Post']['hours']; $minutes = $this->data['Post']['minutes']; $seconds = $this->data['Post']['seconds']; $this->request->data['Post']['duration']=$hours.':'.$minutes.':'.$seconds; if ($this->Post->save($this->request->data)) { $this->Session->setFlash('Your post has been saved.'); $this->redirect(array('action' => 'index')); } else { $this-&

Categories : Cakephp

How to fire two events at the same time in c#
Looks like you just need to provide some base value for calculation: void CalculateT0(DateTime calculationBase) {...} void CalculateT1(DateTime calculationBase) {...} void T0_ButtonClick(...) { CalculateT0(DateTime.Now); } void T1_ButtonClick(...) { CalculateT1(DateTime.Now); } void T0Plus1_ButtonClick(...) { var calculationBase = DateTime.Now; CalculateT0(calculationBase); CalculateT1(calculationBase); } Update. About firing two events at the same time. The first, you're question has nothing about firing events. You have such kind of code now: void T0Plus1_ButtonClick(...) { T0_ButtonClick(...); T1_ButtonClick(...); } This is not an Button0.Click or Button1.Click event firing. This code just call two methods (even if they're used as event handlers so

Categories : C#

How do I fire only one event at a time
Tabbing out is produced by both events. You can flag your tabbing out event and not handle the blur: var handleBlur = true; $(".timeSeenInput").on("focusout keypress",function(event) { if (event.type === 'keypress' && event.keyCode === TAB) { alert($(this).attr("id")); handleBlur = false; return; } else if (event.type === 'blur' && handleBlur) { // Handle blur } handleBlur = true; });

Categories : Javascript

Computed Column Specification in SQL Server - Time Difference in hours or minutes
ALTER TABLE yourTable ADD yourColumn AS (datediff(hour,[StartTime],[EndTime])) SQLFiddle DEMO EDIT: That was the syntax for alter table, off-course you can also define it during table creation CREATE TABLE tbl1 ( startDate DATETIME, enddate DATETIME, diffCol AS (datediff(hour,startDate,enddate)) ); SSMS also have an option in table designer to add formula for computed columns

Categories : SQL

Fire event on document unless element contains a specific class
you need to check whether actual click target has the class completed, it cannot be done using the element filter in on() because of event bubbling jQuery(function($){ $(document).click(function(e){ if(!$(e.target).is('.completed')){ $('.remove').remove() } }) }) Demo: Fiddle

Categories : Jquery

Trying to aggregate (and average) time series data (collected every five minutes) into day and night periods for each 24 hr period in R
You don't have a particularly good dataset to test code since you have only am cases for the first data and pm cases for the second, but this will do a two-way classification by date and am/pm indicator in the time column. I also removed all the non-numeric columns from consideration, since it makes no sense to ask for the mean of a factor. new2 <- aggregate(dat[unlist(lapply(dat, is.numeric))], by = list(date, gsub("^.+ ", "", dat$GMT_Time) ), mean) new2 Group.1 Group.2 CollarID ActivityX ActivityY ActivitySum Temp 1 2000-01-01 AM 2905 0.00000 0 0.00000 21.66667 2 2011-02-21 PM 2905 10.66667 12 22.66667 20.66667 The gsub call is removing any character between the beginning of the string and the last instance of a

Categories : R

C++ / Converting time(NULL) to exact years, months, weeks, hours, and minutes from Jan 1, 1970
First you need to consider in which timezone you want this information. Then instead of writing the code yourself, use either gmtime_r to get the result in UTC or localtime_r to get the result in your current TZ's local timezone.

Categories : C++

Jquery Click event does not fire on 2nd time in UpdatePanel
Bind the event initially in document.ready and rebind outside: <script type="text/javascript"> $(document).ready(function () { $("#btn_Save").click(function (e) { e.preventDefault(); $('#showMessage').fadeIn(100); setTimeout(function () { $('#showMessage').fadeOut(500); }, 2000); }) }) var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_endRequest(function () { // re-bind your jquery events here $("#btn_Save").click(function (e) { e.preventDefault(); $('#showMessage').fadeIn(100); setTimeout(function () { $('#showMessage').fadeOut(500); }, 2000); }) }) </script> This post may help: jQuery $(document).ready and UpdatePanels?

Categories : Jquery



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.