Search Results

Search found 59295 results on 2372 pages for 'lord of time'.

Page 16/2372 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Using Time datatype in MySQL without seconds

    - by Alex
    I'm trying to store a 12/24hr (ie; 00:00) clock time in a MySQL database. At the moment I am using the time datatype. This works ok but it insists on adding the seconds to the column. So you enter 09:20 and it is stored as 09:20:00. Is there any way I can limit it in MySQL to just 00:00?

    Read the article

  • How to calculate the time difference between two time fields , with respect to the date changes

    - by Tiru
    I want to calculate the time difference.I have three EditTexts , I want to input the times in the first two edittexts in HH:MM format. And then calculate the time difference and the result will show on third edittext field in same format. If the date changes, the time difference will calculate according that, i.e If first time = 23:00 and second time = 01:00 then, the time difference = 02:00 hours public class TimeCalculate extends Activity { private String mBlock; private String mBlockoff; private String mBlockon ; // String mHours, mMinutes; Date date1, date2; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); EditText blockoff = (EditText) findViewById(R.id.blockoff); mBlockoff = blockoff.getText().toString(); EditText blockon = (EditText) findViewById(R.id.blockon); mBlockon = blockon.getText().toString(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("hh:mm"); try { date1 = simpleDateFormat.parse(mBlockoff); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { date2 = simpleDateFormat.parse(mBlockon); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } mBlock = getDifference(date1, date2); EditText block = (EditText) findViewById(R.id.block); block.setText(mBlock.toString()); } public static String getDifference(Date startTime, Date endTime) { if (startTime == null) return "corrupted"; Calendar startDateTime = Calendar.getInstance(); startDateTime.setTime(startTime); Calendar endDateTime = Calendar.getInstance(); endDateTime.setTime(endTime); long milliseconds1 = startDateTime.getTimeInMillis(); long milliseconds2 = endDateTime.getTimeInMillis(); long diff = milliseconds2 - milliseconds1; /*int hours = (int)diff / (60 * 60 * 1000); int minutes = (int) (diff / (60 * 1000)); minutes = minutes - 60 * hours; long seconds = diff / (1000); */ //timeDiff = DateUtils.formatElapsedTime(seconds); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:MM"); Date date = new Date(diff); return simpleDateFormat.format(date); } } I executed this code ,but gives error as Source not found.I think error at getDifference method.Please give any other logic

    Read the article

  • Setting time to 23:59:59

    - by Mike Wills
    I need to compare a date range and am missing rows who's date is the upper comparison date but the time is higher than midnight. Is there a way to set the upper comparison's time to 23:59:59?

    Read the article

  • Using client time to calculate timezone

    - by Mike TK
    Hi Folks, Instead of asking a client timezone in registration form (to correctly format datetime, all server dates in UTC) I thought about fetching a time from client computer and calculating time offset between client and server. Anyone tried this? How often clients have something insane on their system clocks? Cheers!

    Read the article

  • C++ Vector vs Array (Time)

    - by vsha041
    I have got here two programs with me, both are doing exactly the same task. They are just setting an boolean array / vector to the value true. The program using vector takes 27 seconds to run whereas the program involving array with 5 times greater size takes less than 1 s. I would like to know the exact reason as to why there is such a major difference ? Are vectors really that inefficient ? Program using vectors #include <iostream> #include <vector> #include <ctime> using namespace std; int main(){ const int size = 2000; time_t start, end; time(&start); vector<bool> v(size); for(int i = 0; i < size; i++){ for(int j = 0; j < size; j++){ v[i] = true; } } time(&end); cout<<difftime(end, start)<<" seconds."<<endl; } Runtime - 27 seconds Program using Array #include <iostream> #include <ctime> using namespace std; int main(){ const int size = 10000; // 5 times more size time_t start, end; time(&start); bool v[size]; for(int i = 0; i < size; i++){ for(int j = 0; j < size; j++){ v[i] = true; } } time(&end); cout<<difftime(end, start)<<" seconds."<<endl; } Runtime - < 1 seconds Platform - Visual Studio 2008 OS - Windows Vista 32 bit SP 1 Processor Intel(R) Pentium(R) Dual CPU T2370 @ 1.73GHz Memory (RAM) 1.00 GB Thanks Amare

    Read the article

  • Why is sys+user > real in "time command"?

    - by shadyabhi
    I have a program that uses pthread library to do the matrix multiplication of 500x500 matrix. Each thread calculates 50 rows of the matrix. When I run tiem command:- shadyabhi@shadyabhi-desktop:~$ time ./a.out real 0m0.383s user 0m0.810s sys 0m0.000s shadyabhi@shadyabhi-desktop:~$ How come sys+user is greater than real time?

    Read the article

  • Automatically update or delete record(s) after x time in coldfusion

    - by Nich
    Hi, I've searched all over the net for this. Hope that someone's got something. How would a record in a database be updated automatically after x time n coldfusion? I know how to manually do it by writing an sql that performs an action to all records older than x time based on the timestamp. How would this be done automatically? Kind Regards, Nich

    Read the article

  • Reduce Processing Time of accessing databse

    - by medma
    hello all, I m making an app which requires remote databse connection. I want the values in picker from database but when I click on button to invoke picker it takes some time to fetch the values and displaying. Is there any way to do it fast? and also is there any way to reduce the time of transition between 2 views? Thanx

    Read the article

  • Can I Force A ASP.Net Website to Show Time in A Specific Time Zone?

    - by KevDog
    I have a client request that all times be displayed in Pacific Time Zone, regardless of client settings. I'd like to avoid a scenario where I have to call a function for every time display and instead have a single point where I can make the switch. I'm thinking a custom culture might do the trick, but I wanted to ask before I set off down a potentially blind alley (or miss something trivially easy).

    Read the article

  • minutes to time in sql server

    - by Luca Romagnoli
    i've created a function for convert minutes (smallint) in time (varchar(5)) like 58 - 00:58 set QUOTED_IDENTIFIER ON GO Create FUNCTION [dbo].[IntToMinutes] ( @m smallint ) RETURNS nvarchar(5) AS BEGIN DECLARE @c nvarchar(5) SET @c = CAST((@m / 60) as varchar(2)) + ':' + CAST((@m % 60) as varchar(2)) RETURN @c END The problem is when there are minutes < 10 in time like 9 the result of this function is 0:9 i want that the format is 00:09 how can i do that?

    Read the article

  • TDBGrid columns design time or run time?

    - by Mawg
    I am using TDBGrid for the first time. I didn't even notice the Columns property in the object inspector and everything went just fine: the grid was filled. Then I saw the Columns property and tried it. When I use the object insector to add items to the Columns property of the grid, they do not all of them show up at run time. To me, it looks like the FieldName property is important. It looks like it is correct, but there are no values in some columns. If I leave this property blank (no columns at all) it seems that the control populates it itself at run time and I do see all the columns. I could live with that. When I set column titles at run time it works, but setting column width does not.

    Read the article

  • Elapsed time of running a C program

    - by yCalleecharan
    Hi, I would like to know what lines of C code to add to a program so that it tells me the total time that the program takes to run. I guess there should be counter initialization near the beginning of main and one after the main function ends. Is the right header clock.h? Thanks a lot... Update I have a Win Xp machine. Is it just adding clock() at the beginning and another clock() at the end of the program? Then I can estimate the time difference. Yes, you're right it's time.h. Here's my code: #include <stdio.h> #include <stdlib.h> #include <math.h> #include <share.h> #include <time.h> void f(long double fb[], long double fA, long double fB); int main() { clock_t start, end; start = clock(); const int ARRAY_SIZE = 11; long double* z = (long double*) malloc(sizeof (long double) * ARRAY_SIZE); int i; long double A, B; if (z == NULL) { printf("Out of memory\n"); exit(-1); } A = 0.5; B = 2; for (i = 0; i < ARRAY_SIZE; i++) { z[i] = 0; } z[1] = 5; f(z, A, B); for (i = 0; i < ARRAY_SIZE; i++) printf("z is %.16Le\n", z[i]); free(z); z = NULL; end = clock(); printf("Took %ld ticks\n", end-start); printf("Took %f seconds\n", (double)(end-start)/CLOCKS_PER_SEC); return 0; } void f(long double fb[], long double fA, long double fB) { fb[0] = fb[1]* fA; fb[1] = fb[1] - 1; return; } Some errors with MVS2008: testim.c(16) : error C2143: syntax error : missing ';' before 'const' testim.c(18) :error C2143: syntax error : missing ';' before 'type' testim.c(20) :error C2143: syntax error : missing ';' before 'type' testim.c(21) :error C2143: syntax error : missing ';' before 'type' testim.c(23) :error C2065: 'z' : undeclared identifier testim.c(23) :warning C4047: '==' : 'int' differs in levels of indirection from 'void *' testim.c(28) : error C2065: 'A' : undeclared identifier testim.c(28) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data and it goes to 28 errors. Note that I don't have any errors/warnings without your clock codes. LATEST NEWS: I unfortunately didn't get a good reply here. But after a search on Google, the code is working. Here it is: #include <stdio.h> #include <stdlib.h> #include <math.h> #include <share.h> #include <time.h> void f(long double fb[], long double fA, long double fB); int main() { clock_t start = clock(); const int ARRAY_SIZE = 11; long double* z = (long double*) malloc(sizeof (long double) * ARRAY_SIZE); int i; long double A, B; if (z == NULL) { printf("Out of memory\n"); exit(-1); } A = 0.5; B = 2; for (i = 0; i < ARRAY_SIZE; i++) { z[i] = 0; } z[1] = 5; f(z, A, B); for (i = 0; i < ARRAY_SIZE; i++) printf("z is %.16Le\n", z[i]); free(z); z = NULL; printf("Took %f seconds\n", ((double)clock()-start)/CLOCKS_PER_SEC); return 0; } void f(long double fb[], long double fA, long double fB) { fb[0] = fb[1]* fA; fb[1] = fb[1] - 1; return; } Cheers

    Read the article

  • Suggest a good method with least lookup time complexity

    - by Amrish
    I have a structure which has 3 identifier fields and one value field. I have a list of these objects. To give an analogy, the identifier fields are like the primary keys to the object. These 3 fields uniquely identify an object. Class { int a1; int a2; int a3; int value; }; I would be having a list of say 1000 object of this datatype. I need to check for specific values of these identity key values by passing values of a1, a2 and a3 to a lookup function which would check if any object with those specific values of a1, a2 and a3 is present and returns that value. What is the most effective way to implement this to achieve a best lookup time? One solution I could think of is to have a 3 dimensional matrix of length say 1000 and populate the value in it. This has a lookup time of O(1). But the disadvantages are. 1. I need to know the length of array. 2. For higher identity fields (say 20), then I will need a 20 dimension matrix which would be an overkill on the memory. For my actual implementation, I have 23 identity fields. Can you suggest a good way to store this data which would give me the best look up time?

    Read the article

  • C Run-Time library part 2

    - by b-gen-jack-o-neill
    Hi, I was suggested when I have some further questions on my older ones, to create newer Question and reffer to old one. So, this is the original question: What is the C runtime library? OK, from your answers, I now get thet statically linked libraries are Microsoft implementation of C standart functions. Now: If I get it right, the scheme would be as follow: I want to use printf(), so I must include which just tels compiler there us functio printf() with these parameters. Now, when I compile code, becouse printf() is defined in C Standart Library, and becouse Microsoft decided to name it C Run Time library, it gets automatically statically linked from libcmt.lib (if libcmt.lib is set in compiler) at compile time. I ask, becouse on wikipedia, in article about runtime library there is that runtime library is linked in runtime, but .lib files are linked at compile time, am I right? Now, what confuses me. There is .dll version of C standart library. But I thought that to link .dll file, you must actually call winapi program to load that library. So, how can be these functions dynamically linked, if there is no static library to provide code to tell Windows to load desired functions from dll? And really last question on this subject - are C Standart library functions also calls to winapi even they are not .dll files like more advanced WinAPI functions? I mean, in the end to access framebuffer and print something you must tell Windows to do it, since OS cannot let you directly manipulate HW. I think of it like the OS must be written to support all C standart library functions same way across similiar versions, since they are statically linked, and can differently support more complex WinAPI calls becouse new version of OS can have adjustements in the .dll file.

    Read the article

  • Pseudo-quicksort time complexity

    - by Ord
    I know that quicksort has O(n log n) average time complexity. A pseudo-quicksort (which is only a quicksort when you look at it from far enough away, with a suitably high level of abstraction) that is often used to demonstrate the conciseness of functional languages is as follows (given in Haskell): quicksort :: Ord a => [a] -> [a] quicksort [] = [] quicksort (p:xs) = quicksort [y | y<-xs, y<p] ++ [p] ++ quicksort [y | y<-xs, y>=p] Okay, so I know this thing has problems. The biggest problem with this is that it does not sort in place, which is normally a big advantage of quicksort. Even if that didn't matter, it would still take longer than a typical quicksort because it has to do two passes of the list when it partitions it, and it does costly append operations to splice it back together afterwards. Further, the choice of the first element as the pivot is not the best choice. But even considering all of that, isn't the average time complexity of this quicksort the same as the standard quicksort? Namely, O(n log n)? Because the appends and the partition still have linear time complexity, even if they are inefficient.

    Read the article

  • Java convert time format to integer or long

    - by behrk2
    Hello, I'm wondering what the best method is to convert a time string in the format of 00:00:00 to an integer or a long? My ultimate goal is to be able to convert a bunch of string times to integers/longs, add them to an array, and find the most recent time in the array... I'd appreciate any help, thanks! Ok, based on the answers, I have decided to go ahead and compare the strings directly. However, I am having some trouble. It is possible to have more than one "most recent" time, that is, if two times are equal. If that is the case, I want to add the index of both of those times to an ArrayList. Here is my current code: days[0] = "15:00:00"; days[1] = "17:00:00"; days[2] = "18:00:00"; days[3] = "19:00:00"; days[4] = "19:00:00"; days[5] = "15:00:00"; days[6] = "13:00:00"; ArrayList<Integer> indexes = new ArrayList<Integer>(); String curMax = days[0]; for (int x = 1; x < days.length1; x++) { if (days[x].compareTo(curMax) > 0) { curMax = days[x]; indexes.add(x); System.out.println("INDEX OF THE LARGEST VALUE: " + x); } } However, this is adding index 1, 2, and 3 to the ArrayList... Can anyone help me?

    Read the article

  • Windows Form UserControl design time properties

    - by Raffaeu
    I am struggling with a UserControl. I have a UserControl that represent a Pager and it has a Presenter object property exposed in this way: [Browsable(false)] [DesignSerializationAttribute(DesignSerializationAttribute.Hidden)] public object Presenter { get; set; } The code itself works as I can drag and drop a control into a Windows From without having Visual Studio initializing this property. Now, because in the Load event of this control I call a method of the Presenter that at run-time is null ... I have introduced this additional code: public override void OnLoad(...) { if (this.DesignMode) { base.OnLoad(e); return; } presenter.OnViewReady(); } Now, every time I open a Window that contains this UserControl, Visual Studio modifies the Windows designer code. So, as soon as I open it, VS ask me if I want to save it ... and of course, if I add a control to the Window, it doesn't keep the changes ... As soon as I remove the UserControl Pager the problem disappears ... How should I tackle that in the proper way? I just don't want that the presenter property is initialized at design time as it is injected at runtime ...

    Read the article

  • javascript accordion - tracking time question

    - by JohnMerlino
    Hey all, I was reading up on this javascript tutorial: http://www.switchonthecode.com/tutor...ccordion-menus Basically, it shows you how to create an accordion using pure javascript, not jquery. All made sense to me until the actual part of tracking the animation. He says "Because of all that, the first thing we do in the animation function is figure out how much time has passed since the last animation iteration." And then uses this code: Code: var elapsedTicks = curTick - lastTick; lastTick is equal to the value of when the function was called (Date().getTime()) and curTick is equal to the value when the function was received. I don't understand why we are subtracting one from the other right here. I can't imagine that there's any noticeable time difference between these two values. Or maybe I'm missing something. Is that animate() function only called once every time a menu title is clicked or is it called several times to create the incremental animation effect? setTimeout("animate(" + new Date().getTime() + "," + TimeToSlide + ",'" + openAccordion + "','" + nID + "')", 33); Thanks for any response.

    Read the article

  • Live clock javascript starts from my custom time

    - by newworroo
    I was trying to create a live/dynamic clock is based on my custom time instead of system time. There are many scripts, but I couldn't find the clock starts from my custom time. Here is an example that I'm trying to modify. The problem is the seconds doesn't change, and it looks like I need to use ajax. Is there any way to do it without ajax? If not, help me to do it using ajax!!! The reason I don't like ajax method is that another page should be called and refreshed, so it will eat server ram. ex) http://www.javascriptkit.com/script/cut2.shtml Before: <script> function show(){ var Digital=new Date() var hours=Digital.getHours() var minutes=Digital.getMinutes() var seconds=Digital.getSeconds() ... ... After: <script> function show(){ var Digital=new Date() var hours=<?php echo $hr; ?>; var minutes=<?php echo $min; ?>; var seconds=<?php echo $sec; ?>; ... ...

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >