w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to delay mousover part of hover() function in jquery and to be only executed when cursor is on the element for some given duration
You will need a setTimeout: $('#menu>li').hover( function(){ var t = $(this); setTimeout(function(){ if(t.is(":hover")) // Don't fire the event if #menu>li is not hovered t.find('ul>li').slideToggle(); }, 500); }, function(){ $(this).find('ul>li').slideToggle(); } );

Categories : Javascript

Let a thread wait for n number of pulses
Have a look at the CountdownEvent Class: CountdownEvent Class Represents a synchronization primitive that is signaled when its count reaches zero. Example: CountdownEvent waiter = new CountdownEvent(n); // notifying thread waiter.Signal(); // waiting thread waiter.Wait();

Categories : C#

Why is my VHDL counter not outputting pulses as desired?
The process does not adhere to general rules for a process to be recognized as flip-flops by the synthesis tools, since the outer level for conditions does not cover the signals in the process sensitivity list. The synthesis tool has probably given one or more warnings about this. One way to rewrite the process to adhere to general rules for synthesizable flip-flops is: clk_proc : process (CLK) begin if (CLK'event and CLK = '1') then if CLEAR = '1' then -- clear the counter COUNT <= COUNT - COUNT; elsif CLK_EN = '1' then -- increment the counter COUNT <= COUNT + INC; end if; end if; end process clk_proc; This places the check for clock edge at the outer level, and assumes that the CLEAR is synchronous. More nformation about VHDL codin

Categories : Misc

Counting pulses using a swiss flow meter with an Arduino, how is it done?
The following code changes seem to be printing the RPM and Hz values now. // flow_A LED int led = 4; // relay_A const int RELAY_A = A0; // variables from sketch example String inputString = ""; // a string to hold incoming data boolean stringComplete = false; // whether the string is complete // FLOWMETER SHIT // flowmeter 0 pulse (input) = digital pin 2 // https://github.com/Kegbot/kegboard/blob/master/arduino/kegboard/kegboard_config.h // which pin to use for reading the sensor? kegboard-mini shield has digital pin 2 allocated # define FLOWSENSORPIN 2 int rpmcount = 0; int rpm = 0; unsigned long lastmillis = 0; void setup() { // initialize serial Serial.begin(9600); // open serial port, sets data rate to 115200bps inputString.reserve(200); pinMode(RELAY_A, OUTPU

Categories : C

Parallel Library: does a delay on one degree of parallelism delay all of them?
It's the expected behavior. AsParallel doesn't return until all the operations are finished. Since you're making synchronous requests, you've got to wait until your slowest one is finished. However note that even if you've got one really slow task hogging up a thread, the scheduler continues to schedule new tasks as old ones finish on the remaining threads. Here's a rather instructive example. It creates 101 tasks. The first task hogs one thread for 5000 ms, the 100 others churn on the remaining 20 threads for 1000 ms each. So it schedules 20 of those tasks and they run for one second each, going through that cycle 5 times to get through all 100 tasks, for a total of 5000 ms. However if you change the 101 to 102, that means you've got 101 tasks churning on the 20 threads, which w

Categories : C#

Long Delay using Delay Functions from C18 Libraries for PIC18
It is strongly recommended that you avoid using the built-in delay functions such as Delay10KTCYx() Why you might ask? These delay functions are very inaccurate, and they may cause your code to be compiled in unexpected ways. Here's one such example where using the Delay10KTCYx() function can cause problems. Let's say that you have a PIC18 microprocessor that has only two hardware timer interrupts. (Usually they have more but let's just say there are only two). Now let's say you manually set up the first hardware timer interrupt to blink once per second exactly, to drive a heartbeat monitor LED. And let's say you set up the second hardware timer interrupt to interrupt every 50 milliseconds because you want to take some sort of digital or analog reading at exactly 50 milliseconds. N

Categories : C

What does it mean to multiply a duration by a duration?
The Duration type is simply an int64 representing the duration as a nanosecond count type Duration int64 A Duration represents the elapsed time between two instants as an int64 nanosecond count. So multiplying one duration by another gives the result of multiplying the number of nanoseconds in each. In my example, this gives a billion billion nanoseconds, or 277777h46m40s. Nonsense, but well-defined!

Categories : Go

Using jQuery delay method to delay text
If div-fade is a class then add . if it is an id add # because there is no element div-fade1 Something like this: $(document).ready(function() { $('div.ico-productm').click(function(){ $('.div-fade1').delay(3000) }); }); Or maybe fade1 is a class or an id the you can have something like: $(document).ready(function() { $('div.ico-productm').click(function(){ $('div.fade1').delay(3000) }); });

Categories : Jquery

Propagation Delay vs Trasmission delay
Because they're measuring different things. Propagation delay is how long it takes one bit to travel from one end of the "wire" to the other (it's proportional to the length of the wire, crudely). Transmission delay is how long it takes to get all the bits into the wire in the first place (it's packet_length/data_rate).

Categories : Networking

doctrine:generate-migrations-diff does not generate any new migration
This is the best way I have come across to make migrations and success everytime. Cost me a lot to guess but works perfectly and works with multiple databases. I can be wrong in some sentences so feel free to add or correct me in anything you see. MIGRATIONS, the safest way :) If you need to work Migrations for multiple databases apply these patches and clear symfony cache, they work perfectly: doctrine_core.r7687 doctrine_manager.r7657 A. BACKUP PROJECT AND DATABASE: Save Symfony project Files. (optional but safe way). Save Database Table Schemas only. Save Database Table Data only. Save Database Table Schema with Data. B. HOW TO MAKE CHANGES TO .yml FILES: .yml files cannot contain strange symbols, like ñ, ´, ```... or non UTF characters.. Always shows spaces and tabs in Notep

Categories : Symfony2

The class name that Rails generate controller generate
Just ran it and this is what I got: $new_project rails generate controller Therapeutics create app/controllers/therapeutics_controller.rb invoke erb create app/views/therapeutics invoke helper create app/helpers/therapeutics_helper.rb invoke assets invoke coffee create app/assets/javascripts/therapeutics.js.coffee invoke scss create app/assets/stylesheets/therapeutics.css.scss $new_project

Categories : Ruby On Rails

"make generate" doesn't generate any files
Try this: make generate NOX11=yes And/Or: http://nondroid.blogspot.com/2012/06/mupdf-android-library-build.html

Categories : C

Log duration of an ASP Web API action
Something like this should do the trick... public class StopwatchAttribute : ActionFilterAttribute { private const string StopwatchKey = "StopwatchFilter.Value"; public override void OnActionExecuting(HttpActionContext actionContext) { base.OnActionExecuting(actionContext); actionContext.Request.Properties[StopwatchKey] = Stopwatch.StartNew(); } public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { base.OnActionExecuted(actionExecutedContext); Stopwatch stopwatch = (Stopwatch)actionExecutedContext.Request.Properties[StopwatchKey]; // TODO something useful with stopwatch.Elapsed Trace.WriteLine("Elapsed = " + stopwatch.Elapsed); } } Here we store a new Stopwatch in the reque

Categories : Performance

get the duration of the gif animation
If you only want to play the animated gif once, stop calling invalidate() once you pass the duration. if (movieStart == 0) { movieStart = (int) now; } if (mMovie != null) { int relTime = (int) (now - moviestart); if (relTime > mMovie.duration()) { relTime = mMovie.duration(); } mMovie.setTime(relTime); mMovie.draw(canvas, getWidth() / 2 - mMovie.width() / 2, getHeight() / 2 - mMovie.height() / 2); if (relTime < mMovie.duration()) { invalidate(); } } mMovie.duration() gives you the duration of one loop.

Categories : Android

Top 10 event duration
You can use cross apply to find the first off after an on: select top 10 active.Alarm , active.TimeStamp as TimeOn , active.TimeStamp as TimeOff , datediff(second, active.TimeStamp, inactive.TimeStamp) as Duration from YourTable active cross apply ( select top 1 * from YourTable inactive where inactive.Active = 'false' and inactive.Alarm = active.Alarm and inactive.TimeStamp > active.TimeStamp order by inactive.TimeStamp ) inactive where active.Active = 'true' order by Duration desc See it working at SQL Fiddle.

Categories : SQL

Cannot set animation duration
Well, the problem was very simple. The thing is, that not every property of an object can be animated. For example, we can't animate this expression : int *a = ( int* ) malloc ( 5 * sizeof ( int ) ) ; Or this : int x = 5 ; Or, finally, this : TL.sublayerTransform = CATransform3DRotate(t3d, -(CallCounter*M_PI) , 1.0, 0.0, 0.0) ; Cause the idea of transform property is to generate a matrix, that will be written to sublayerTransfrom class field. And, basically for the compiler, it's the same expression, as malloc call, or initialising x variable - it's an assigment operation. It looks like, CATransformLayer class has some kind of checker, which is being called only if the property changes it's value. Cocoa will automatically send messages when a property changes. by a Key-V

Categories : Iphone

Charting duration of time
If the chart below is of the type you require: then I'd suggest choosing a Stacked Bar format. There are two data sets for each date but the 'key' is that one has been formatted to be invisible. Charting is something that I believe changed quite a lot between Excel 2007 (my version) and later versions so I hope struggling with times may be easier for you.

Categories : Excel

Duration in traffic google api
Take a look at the duration_in_traffic definition under the Legs section on the maps documentation page: The directions request includes a departure_time parameter set to a value within a few minutes of the current time. The request includes a valid Maps for Business client and signature parameter. Traffic conditions are available for the requested route. The directions request does not include stopover waypoints. Maybe not all of the 4 conditions they list are being met? There is also a JSON example on that page w/ a sample url you can use if it helps any.

Categories : Java

IIS Custom Duration Logging
IIS will log time taken, and you can add any custom data that you wish. You can even use ETW to read log objects instead of parsing the log files. IIS logging: http://msdn.microsoft.com/en-us/library/ms525410(v=vs.90).aspx What "time taken" means: http://support.microsoft.com/kb/944884/en-us Writing custom data to IIS logs from your app: http://msdn.microsoft.com/en-us/library/system.web.httpresponse.appendtolog.aspx Optionally interfacing through ETW instead of reading the logs from the file system: http://msdn.microsoft.com/en-us/library/windows/desktop/bb968803(v=vs.85).aspx http://www.iis.net/learn/get-started/whats-new-in-iis-85/logging-to-etw-in-iis-85

Categories : Asp Net

How to Sum the duration and display it in Report
Right, VB.Net is not my language (regular c#) so if there are any mistakes forgive me. It seems that to start with you have an odd mix of query syntax and fluent syntax going on there which you need to be careful with. Also the AsEnumerable I think is not necessary. It also doesn't make sense to have a number of EmployeeViewModels each with seperate working hours but also a total which would be formed from other ViewModels as well. How would you display that? Either the total should be calculated later for the report or you need to change the ViewModel to have a list of WorkingHours and a Total. Also you should not set the HoursWorked here it should be a read only property which returns the calculated value. My first suggestion for you would be a group join. Sum is not available without

Categories : Vb.Net

-moz-transition-duration not function
This is probably because Firefox doesn't know what value of top it must switch to. Indeed, Firefox sees that top is set to -10px in .label:hover but cannot find the value of top in the label declaration. You simply have to set top to 0 in the label declaration: .label { // Your code top: 0; } It works for me!

Categories : CSS

Plotting time vs duration in R
Edit your code to: plot(departure.time$V1, travel.time$V1, main="Variable Travel Time", xlab="Departure Time", ylab="Travel Time in Minutes", pch=19) read.table outputs a data.frame (see help(read.table), section value), so you need to tell plot which column to use from each data frame. If you want departure.time to be a vector and not a dataframe, you should use scan instead of read.table.

Categories : R

Scala looping for certain duration
val timeout = future{Thread.sleep(5000)} while(!timeout.isCompleted){println("Hello")} This works, but I don't like it because: Long loops without sleeps are bad. Long loops in the main Thread is blocking your application Another solution, would be to move your logic (the print function) into a separate Actor, and introduce a scheduler to handle the timing for you, and another scheduler-once to send a PoisonPill after a duration More about Scheduler

Categories : Scala

Hot to get mp3 file duration with mp3spi?
I tried using File instead of ByteArrayInputStream and it works. Consider to change your code in something like this: File file = new File("filename.mp3"); AudioFileFormat baseFileFormat = new MpegAudioFileReader().getAudioFileFormat(file); Map properties = baseFileFormat.properties(); Long duration = (Long) properties.get("duration"); Which version of mp3Spi are you using?

Categories : Java

Set duration for jQuery function
Just set a counter: var makeitstop = 0; $.fn.blink = function () { $(this).animate({ 'opacity': '0.4' }, 200, function () { $(this).animate({ 'opacity': 1 }, 200, function () { makeitstop++; if (makeitstop < 5) $(this).blink(); }); }); }; $('#highScore').blink(); jsFiddle example

Categories : Jquery

JQM Caching of page- how to specify the duration
In jQuery Mobile there is not a DOM cache expiration time setting but you can handle manually the removal from DOM. In order to remove a page from DOM you have to use: $('#page-id').remove();

Categories : Jquery

Checking Process duration with C
The function clock(3) doesn't yield the elapsed time: The value returned is the CPU time used so far as a clock_t. As the simplest example, if your process sleeps or block for I/O, it won't use much CPU time. If you need to measure actual duration, you could use time(3) and difftime(3) or maybe clock_gettime and the like. Side note: I don't really understand why the code appears to work in Windows, but changing to time + difftime should work on both platforms.

Categories : C

Game duration algorithm
The problem with simply allocating each player a random amount of time is that the total may be much larger or much smaller than the overall available time. Therefore it makes more sense to allocate the weighting of the total time that each player can have randomly. So pseudo code* would be double totalWeighting=0 for each player player.weighting=randomPositiveNumber() totalWeighting+=player.weighting end for each player player.allocatedTime=(player.weighting/totalWeighting)*availableTime end Its necessary to go through twice so we know the totalWeighting before we allocate time *some would say my pseudo code is highly non standard and looks too much like java, I would say: I don't like pseudo code

Categories : Java

SQL duration between dates for different persons
SELECT * FROM person p INNER JOIN Treatment t on t.PK_Person = p.PK_Person WHERE DATEDIFF(year,[TREATMENT_DATE_1], [TREATMENT_DATE_2]) > 20 This should do it, it is however untested so will need tweaking to your schema

Categories : SQL

Fotorama Transition Duration
It is posible since 4.2.3. Set animation length in milliseconds using data-transition-duration: <div class="fotorama" data-transition-duration="1000"> <a href="1.jpg"></a> <a href="2.jpg"></a> <a href="3.jpg"></a> </div> To see the changes, click on the stage or navigation. This option does not affect the behavior of the swipe. Fiddle: http://jsfiddle.net/artpolikarpov/jrCC5/embedded/result,html,js/

Categories : Misc

how to set background duration in jquery
You could try setTimeout jQuery(document).ready(function(){ var divs = jQuery('div').css('background','#fff') setTimeout(function(){ divs.css('background','#000'); }, 12000); });

Categories : Javascript

the best way to check duration in mysql
BETWEEN will check to see if the values are greater than or equal to the first number, and less than or equal to the second number. IF (MONTH(CURDATE()) BETWEEN startMonth and endMonth) AND (YEAR(CURDATE()) BETWEEN startYear and endYear))

Categories : PHP

How to multiply duration by integer?
int32 and time.Duration are different types. You need to convert the int32 to a time.Duration, such as time.Sleep(time.Duration(rand.Int31n(1000)) * time.Millisecond).

Categories : Go

How to compare duration between two different TimeStamp
Calendar thatDay = Calendar.getInstance(); thatDay.set(Calendar.DAY_OF_MONTH,25); thatDay.set(Calendar.MONTH,7); // 0-11 so 1 less thatDay.set(Calendar.YEAR, 1985); Calendar today = Calendar.getInstance(); //THIS IS TO GET TODAY DATE, you can simpy use your two dates long diff = today.getTimeInMillis() - thatDay.getTimeInMillis(); //result in millis Here's an approximation... long days = diff / (24 * 60 * 60 * 1000); PLUS : To Parse the date from a string, you could use String strThatDay = "1985/08/25"; SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd"); Date d = null; try { d = formatter.parse(strThatDay);//catch exception } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } Calendar thatDay = Calen

Categories : Java

How to log visit duration on page?
Difficult to test it through jsFiddle (it seems), but you can do something like: function enter() { this.crono = new Date().getMilliseconds(); } function leave() { this.crono = new Date().getMilliseconds() - this.crono; alert(this.crono); } window.onload = enter; window.onbeforeunload = leave; In place of that alert(this.crono); you could launch an ajax call to the server with the crono value.

Categories : PHP

HTML5 video duration
Bind the function to the video's timeupdate event instead of a button's click event, or run it via setInterval

Categories : Javascript

Geting duration of 2 times
Try this String t1 = "20130108T150000"; String t2 = "20130108T131500"; DateFormat df=new SimpleDateFormat("yyyyMMdd'T'HHmmss"); Date date1=df.parse(t1); Date date2=df.parse(t2); System.out.println(date2.getTime()-date1.getTime()); // time difference in mil-seconds

Categories : Java

Generate a web application using maven generate
mvn dependency:tree This is used to view the dependency hierarchy of the project currently being built. It will output the resolved tree of dependencies that the Maven build process actually uses.

Categories : Java

Batch loop for a duration of time
Parse the time variable at the beginning and add the desired minutes. Then you need to cheack in each loop if the stop time is reached. set "startTime=%time%" Split the time into Hour, minutes, seconds Add the desired minutes regarding overflows to the hour field. Begin your loop Parse the current time Check if Hours and minutes are reached Else restart the loop

Categories : Batch File

Get duration of consecutive record views
Yes, it's possible to return the resultset specified, but it's not pretty. In particular, the use of inline views (MySQL calls them "derived tables") means that the rows are going to be written to a temporary MyISAM table, and that operation can be expensive for large sets, so to get performance using this approach will likely require some predicates on the innermost query to get a reasonably sized set of data... e.g. WHERE q.userID = 321 AND q.date_event >= '2012-01-01' AND q.date_event < '2012-01-02' NOTE: It seems like the value of "duration" should be limited... i.e. would you want a click on Friday at 6PM to be "matched" to a click on Monday at 8AM, should that be considered part of the "duration". In the query below, I specified a maximum duration value to

Categories : Mysql



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