Search Results

Search found 63795 results on 2552 pages for 'compile time'.

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

  • C# Proposal: Compile Time Static Checking Of Dynamic Objects

    - by Paulo Morgado
    C# 4.0 introduces a new type: dynamic. dynamic is a static type that bypasses static type checking. This new type comes in very handy to work with: The new languages from the dynamic language runtime. HTML Document Object Model (DOM). COM objects. Duck typing … Because static type checking is bypassed, this: dynamic dynamicValue = GetValue(); dynamicValue.Method(); is equivalent to this: object objectValue = GetValue(); objectValue .GetType() .InvokeMember( "Method", BindingFlags.InvokeMethod, null, objectValue, null); Apart from caching the call site behind the scenes and some dynamic resolution, dynamic only looks better. Any typing error will only be caught at run time. In fact, if I’m writing the code, I know the contract of what I’m calling. Wouldn’t it be nice to have the compiler do some static type checking on the interactions with these dynamic objects? Imagine that the dynamic object that I’m retrieving from the GetValue method, besides the parameterless method Method also has a string read-only Property property. This means that, from the point of view of the code I’m writing, the contract that the dynamic object returned by GetValue implements is: string Property { get; } void Method(); Since it’s a well defined contract, I could write an interface to represent it: interface IValue { string Property { get; } void Method(); } If dynamic allowed to specify the contract in the form of dynamic(contract), I could write this: dynamic(IValue) dynamicValue = GetValue(); dynamicValue.Method(); This doesn’t mean that the value returned by GetValue has to implement the IValue interface. It just enables the compiler to verify that dynamicValue.Method() is a valid use of dynamicValue and dynamicValue.OtherMethod() isn’t. If the IValue interface already existed for any other reason, this would be fine. But having a type added to an assembly just for compile time usage doesn’t seem right. So, dynamic could be another type construct. Something like this: dynamic DValue { string Property { get; } void Method(); } The code could now be written like this; DValue dynamicValue = GetValue(); dynamicValue.Method(); The compiler would never generate any IL or metadata for this new type construct. It would only thee used for compile type static checking of dynamic objects. As a consequence, it makes no sense to have public accessibility, so it would not be allowed. Once again, if the IValue interface (or any other type definition) already exists, it can be used in the dynamic type definition: dynamic DValue : IValue, IEnumerable, SomeClass { string Property { get; } void Method(); } Another added benefit would be IntelliSense. I’ve been getting mixed reactions to this proposal. What do you think? Would this be useful?

    Read the article

  • Optimizing perceived load time for social sharing widgets on a page?

    - by Lucka
    I have placed the facebook "like" and some other social bookmarking websites link on my blog, such as Google Buzz, Digg, Twitter, etc. I just noticed that it takes a while to load my blog page as it need to load the data from the social networking sites (such as number of likes etc). How can I place the links efficiently so that first my blog content loads, and meanwhile it loads data from these websites -- in other words, these sharing widgets should not hang my blog page while waiting for data from external sites?

    Read the article

  • How to cut the line between quality and time?

    - by m3th0dman
    On one hand, I have been taught by various software engineering books ([1] as example) that my job as a programmer is to make the best possible software: great design, flexibility, to be easily maintained etc. One the other hand although I realize that I actually write software for money and not for entertainment, although is very nice to write good code and plan ahead and refactor after writing and ... I wonder if it is always best for the business (after all we should be responsible). Is the business always benefiting from a best code? Maybe I'm over-engineering something, and it's not always useful? So how should I know when to stop in the process to achieving the best possible code? I am sure that experience is something that makes a difference here, but I believe this cannot be the only answer. [1] Uncle Bob's in Clean Code says at page 6 about the fact that: They [managers] may defend the schedule and requirements with passion; but that’s their job. It’s your job to defend the code with equal passion.

    Read the article

  • Problem inserting android.text.format.Time.toMillis value into SQLite DB on droid

    - by schusselig
    I'm writing an app for Android OS, and I need to store some time values in the SQLite DB. I have been using android.text.format.Time to store the time values in the app, and then inserting the values as millis into the DB as REAL values. On the SDK emulator, everything works perfectly. On the sole phone I've had the opportunity to test my app (so far), my duration code doesn't work as expected. Some relevant code: private static final String DATABASE_CREATE = "create table " + DATABASE_TABLE + " (" + KEY_ROWID + " integer primary key autoincrement, " + KEY_START + " REAL, " + KEY_STOP + " REAL, " + KEY_DUR + " REAL );"; ... private SQLiteDatabase mDb; ContentValues timerValues = new ContentValues(); ... timerValues.put(KEY_START, stime.toMillis(false)); timerValues.put(KEY_STOP, etime.toMillis(false)); timerValues.put(KEY_DURATION, stime.toMillis(false)-etime.toMillis(false)); int result = mDb.insert(DATABASE_TABLE, null, timerValues); I pull this data from two separate functions with slightly different bits of code, both using Time.set(long millis), both giving incorrect results: The start and stop values come back correct, but the duration comes out 17 hours too large. Am I missing something about calculating durations or does this just seem like there's something "special" about this particular droid? I'll have another droid to test on Monday, but any ideas are appreciated.

    Read the article

  • Merging datasets with 2 different time variables in SAS

    - by John
    Hye Guys, for those regularly browsing this site sorry for already another question (however I did solve my last question myself!) I have another problem with merging datasets, it seems that accounting for time in datasets is a real pain in the ass. I succesfully managed to merge on months in my previous datasets, however it seems I have a final dataset which only has quarter as a time count variable. So where all my normal databases have month 1- xxx as an indicator of time, this database had quarter as an indicator of time. I still want to add the variables of this last database, let's call it TVOL, into my WORK database. Quick summary QUARTER: Quarter 0 = JAN1996-MAR1996 Month: Month 0 = JAN1996 Example: TVOL TVOL _ Ticker ____ Quarter 1500 _ AA ________ -1 52546 _ BB ________ 15 Example: WORK BETA _ Ticker ____ Month 1.52 _ AA ________ 2 1.54__ BB _______ 3 Example: Merged: BETA ______ TVOL __ Ticker ____ Month 1.52 _______ 500 ___ AA _______ 2 I now want to merge this 2 tables using following relationship if the month is in quarter 1, the data of quarter 0 has to be used, so if i have an observation i nWORK with date 2FEB1996 the TVOL of quarter -1 has to be put behind this observation. Something like IF month = quarter i use data quarter i-1. Also, as TVOL is measured quarterly and I have to put in monthly I have to take the average, so (TVOL/3) should be added as a variable. Thanks!

    Read the article

  • Reducing Time Complexity in Java

    - by Koeneuze
    Right, this is from an older exam which i'm using to prepare my own exam in january. We are given the following method: public static void Oorspronkelijk() { String bs = "Dit is een boodschap aan de wereld"; int max = -1; char let = '*'; for (int i=0;i<bs.length();i++) { int tel = 1; for (int j=i+1;j<bs.length();j++) { if (bs.charAt(j) == bs.charAt(i)) tel++; } if (tel > max) { max = tel; let = bs.charAt(i); } } System.out.println(max + " keer " + let); } The questions are: what is the output? - Since the code is just an algorithm to determine the most occuring character, the output is "6 keer " (6 times space) What is the time complexity of this code? Fairly sure it's O(n²), unless someone thinks otherwise? Can you reduce the time complexity, and if so, how? Well, you can. I've received some help already and managed to get the following code: public static void Nieuw() { String bs = "Dit is een boodschap aan de wereld"; HashMap<Character, Integer> letters = new HashMap<Character, Integer>(); char max = bs.charAt(0); for (int i=0;i<bs.length();i++) { char let = bs.charAt(i); if(!letters.containsKey(let)) { letters.put(let,0); } int tel = letters.get(let)+1; letters.put(let,tel); if(letters.get(max)<tel) { max = let; } } System.out.println(letters.get(max) + " keer " + max); } However, I'm uncertain of the time complexity of this new code: Is it O(n) because you only use one for-loop, or does the fact we require the use of the HashMap's get methods make it O(n log n) ? And if someone knows an even better way of reducing the time complexity, please do tell! :)

    Read the article

  • Php - divide time period into equal intervals

    - by experc
    Hi! I am working on my php course project and for the past few days I have stucked at the point where I have to create php function which gets 5 parameters which represents information about the working time of some department - when the work starts/ends, when the lunchtime (or any other break) starts/ends and integer representing minutes into how small piecies we should divide time period. Besides - it's possible that there are not any breaks in the working time. The function should return all intervals from working time. function split_time_into_intervals($work_starts,$work_ends,$break_starts=null; $break_ends=null,$minutes_per_interval=60){ $intervals=array(); //all of the function code return $intervals; } So if I have the following parameters for the function function split_time_into_intervals("8:30","14:50","11:45"; "12:25"){ .. } I would like to retrieve the following array: $intervals[0]['starts']="8:30"; $intervals[0]['ends']="9:30"; $intervals[1]['starts']="9:30"; $intervals[1]['ends']="10:30"; $intervals[2]['starts']="10:30"; $intervals[2]['ends']="11:30"; $intervals[3]['starts']="11:30"; $intervals[3]['ends']="11:45"; //this interval was smaller than 60 minutes - because of the break (which starts at 11:45) $intervals[4]['starts']="12:25";//starts when the break ends $intervals[4]['ends']="13:25"; // interval is again 60 minutes $intervals[5]['starts']="13:25"; $intervals[5]['ends']="14:25"; $intervals[6]['starts']="14:25"; $intervals[6]['ends']="14:50"; //this period is shorter than 60 minutes - because work ends Any advises? I would apriciate any php (or C#) code regarding to this problem!

    Read the article

  • Limit a program's execution time in C (Monte Carlo technique)

    - by rrs90
    I am working on a project which has no determined algorithm to solve using C language. I am Using Monte Carlo technique for solving that problem. And the number of random guesses I want to limit to the execution time specified by the user. This means I want to make full use of the execution time limit defined by the user (as a command line argument) to make as many random iterations as possible. Can I check the execution time elapsed so far for a loop condition. Eg: for(trials=0;execution_time P.S. I am using code blocks 10.05 for coding and GNU compiler.

    Read the article

  • Real time web services

    - by daliz
    Hi everybody, I have a little (maybe the answer could require a book) question about web services and server side programming. But first, a little preamble. Recently we have seen new kind of applications & games using some kind of real-time interaction with a database, or more generally, with other users. I'm talking about shared drawing canvas, games like this , or simple chats, or the Android app "a World of Photo", where in real time you see who is online, to share your photos, etc. Now my question: Are all these apps based on classic TCP client/server architectures or is there a way to make them in a simpler way, like a web platform like LAMP? What I'm asking, in other words is: Can PHP+MySQL (or JSP, or RoR, or any other server language) provide a way to make online users communicate in real time and share data? Is there a way to do that without the ugly and heavy mechanism of temporary tables? Thank you! I hope I've been clear.

    Read the article

  • Java Date Hibernate cut off time

    - by Vlad
    Hi folks, I have a Date type column in Oracle DB and it contains date and time for sure. But when I'm trying to get data in java application it will return date with bunch of zeros instead of real time. In code it'll be like: SQLQuery sqlQuery = session.createSQLQuery("SELECT table.id, table.date FROM table"); List<Object[]> resultArray = sqlQuery.list(); Date date = (Date)resultArray[1]; If it was 26-feb-2010 17:59:16 in DB I'll get 26-feb-2010 00:00:00 How to get it with time?

    Read the article

  • How to remove some of the TimeSeries titles in a AChartEngine Time Series View

    - by user1831310
    As a workaround of not being able to change colors of selected points in a series on an AChartEngine Time Chart, I was using an additional series for each point whose color has to be changed. I need to disable series titles for those additional series. Using empty string as the argument to the Time Series construtor: TimeSeries ts = TimeSeries(""); still results in the line-and-point symbol being placed with empty series title string under the X-axis labels for each such series. It would be a desirable feature for AChartEngine to remove both the line-and-point symbol and the series title string for a series created with a null argument to the TimeSeries construtor call: TimeSeries ts = TimeSeries(null); But this currently resulted in nullPointerException instead. Would the AChartEngine developers consider the above suggestion and until then, is there a way to remove some of the TimeSeries titles from a AChartEngine Time Series View? Best regards.

    Read the article

  • PHP: Coding long-running scripts when servers impose an execution time limit

    - by thomasrutter
    FastCGI servers, for example, impose an execution time limit on PHP scripts which cannot be altered using set_time_limit() in PHP. IIS does this too I believe. I wrote an import script for a PHP application that works well under mod_php but fails under FastCGI (mod_fcgid) because the script is killed after a certain number of seconds. I don't yet know of a way of detecting what your time limit is in this case, and haven't decided how I'm going to get around it. Doing it in small chunks with redirects seems like one kludge, but how? What techniques would you use when coding a long-running task such as an import or export task, where an individual PHP script may be terminated by the server after a certain number of seconds? Please assume you're creating a portable script, so you don't necessarily know whether PHP will eventually be run under mod_php, FastCGI or IIS or whether a maximum execution time is enforced at the server level.

    Read the article

  • How does operating system software maintains time clocks?

    - by Neeraj
    Hi everyone, This may sound a bit less relevant but I couldn't think of a better place to ask this question. Now consider this situation, you install an OS on your system, set the timezone and time, do some stuff and turn it off. (Note that there is no power going in to the computer). Now next time (say after some hours or days) you turn it on again, and you see the updated time. How is this possible even when my computer is not connected to the internet and was consuming no power during the period it was down.(Is there some kind of hardware hack?) please clarify!

    Read the article

  • How to get the running of time of my program with gettimeofday()

    - by Mechko
    So I get the time at the beginning of the code, run it, and then get the time. struct timeval begin, end; gettimeofday(&begin, NULL); //code to time gettimeofday(&end, NULL); //get the total number of ms that the code took: unsigned int t = end.tv_usec - begin.tv_usec; Now I want to print it out in the form "**code took 0.007 seconds to run" or something similar. So two problems: 1) t seems to contain a value of the order 6000, and I KNOW the code didn't take 6 seconds to run. 2) How can I convert t to a double, given that it's an unsigned int? Or is there an easier way to print the output the way I wanted to?

    Read the article

  • Displaying current time above the thumb of a slider in Silverlight

    - by Scharrels
    I've made a time slider in Silverlight. To style it, I've made a control template and modified the style. I've added a text field above the thumb (always centered above the thumb), which should display the time. However, I can't find any way to access the slider information (e.g. current value) or find another way to pass any information to the style, which I can then data bind to the text field. So my question in short: how can I display time information above the thumb?

    Read the article

  • Real time video stream from camera via server to Iphone

    - by devdevdev
    Hi I want to create an Iphone app that can display real time video from a camera. The intended setup is. Camera connected to Mac Mini delivering real time video to Iphone over local network. The Iphone doesn't need to display high quality or use a high frame rate, but it has to be real time. Max 1 sec delay. I've been searching a lot for a solution, but so far I have not found a resonable one. HTTP Live Stream is not a solution due to the delay. Any suggestions?

    Read the article

  • Display relative time in hour, day, month and year

    - by JohnJohnGa
    I wrote a function toBeautyString(epoch) : String which given a epoch, return a string which will display the relative time from now in hour and minute For instance: // epoch: 1346140800 -> Tue, 28 Aug 2012 05:00:00 GMT // and now: 1346313600 -> Thu, 30 Aug 2012 08:00:00 GMT toBeautyString(1346140800) -> "2 days and 3 hours ago" I want now to extend this function to month and year, so it will be able to print: 2 years, 1 month, 3 days and 1 hour ago Only with epoch without any external libraries. The purpose of this function is to give to the user a better way to visualize the time in the past. I found this: Calculating relative time but the granularity is not enough.

    Read the article

  • SQL Time(2) to Array in C#?

    - by Jacob Huggart
    Hello all, I am using ASP MVC and SQL Server and I have a database that is updated intermittently with expected wait times for some event. Also, I am using some ajax and jquery. I need to display the average and maximum wait times. How can I take the entire list of time from the server and get the average time? Also, what would be the best method to simply grab a new time from the server when it is updated without having to pull the whole list again? Thanks!

    Read the article

  • Live asynchronous time feed for websites

    - by Maven
    I want to show up the time over my website based over the location of the user, let’s say if user one browsing the website is from USA than the time should be what is in USA currently and same for China etc. and all. I was wondering if there exists a JavaScript plugin for it but I didn’t find any as dynamic as I want, my requirements include: Something that can be fully stylized according to website theme (no iframes) The pattern I want is to be in (HH:MM:SS) It should be asynchronous like the second [SS] keep ticking and the time keep updating Is this possible, a way around to achieve it?

    Read the article

  • Slow server response time - CakePHP

    - by Hasan
    I am using CakePHP 1.2 for building a website. The problem i am facing is when ever a page loads it takes a lot of time in "waiting for www.example.com". The server response time is very slow. First i thot it was my database queries, but they were executing in less than seconds time. Next i also contacted the server people. They told it was not the server. Now i am stuck very badly with "waiting for www.example.com". Is the problem is in coding or the cakePHP is mis configured. Need help badly and fast. Thanks

    Read the article

  • PHP: producing relative date/time from timestamps

    - by KeyStroke
    Hi, I'm basically trying to convert a Unix timestamp (the time() function) to a relative date/time that's both compatible with past and future date. So outputs could be: 2 weeks ago 1 hour and 60 minutes ago 15 minutes and 54 seconds ago after 10 minutes and 15 seconds First I tried to code this, but made a huge unmaintainable function, and then I searched the internet for a couple of hours, yet all I can find are scripts that produce only one part of the time (e.h: "1 hour ago" without the minutes). Do you have a script that already does this? If so, I'd really appreciate if you could share it. Thanks.

    Read the article

  • How to calculate time spent for Linux system administration?

    - by Jaakko
    I would love figuring out how much time I actually have spent in shell performing administrative duties. For billing of course, this information is not sufficient, but it would be helpful to figure out how much time I have actually spent in shell. My question is: How anyone got tips on how to calculate time spent in shell (in hours + minutes), let's say per user account? Could anyone recommend a software that could be used to analyze this time? Optionally I would like to know about ways how to categorise time spent (e.g. 1 hour for Apache, 2 hours for Samba, etc.) Also, your takes on how you monitor your admin time, are also much appreciated! To narrow down the problem, I am specifically interested in ways of tracking time spent in shell for Linux system administration

    Read the article

  • Compile latest blender on ubuntu 12.0464bit?

    - by gabriel
    What i want is to compile latest blender from SVN. I am using this guide My issues are: How can i install it with the final .deb created file and how can i give this package to a ppa! So, when i execute sudo apt-get update; sudo apt-get install subversion build-essential gettext \ libxi-dev libsndfile1-dev \ libpng12-dev libfftw3-dev \ libopenexr-dev libopenjpeg-dev \ libopenal-dev libalut-dev libvorbis-dev \ libglu1-mesa-dev libsdl1.2-dev libfreetype6-dev \ libtiff4-dev libavdevice-dev \ libavformat-dev libavutil-dev libavcodec-dev libjack-dev \ libswscale-dev libx264-dev libmp3lame-dev python3.2-dev \ libspnav-dev it gives me this The following packages have unmet dependencies: libjack-dev : Depends: libjack0 (= 1:0.121.0+svn4538-3ubuntu1) but it is not going to be installed E: Unable to correct problems, you have held broken packages. I know that skype does not allow the installation of those libraries. Thanks

    Read the article

  • Glib.h error while trying to compile an application

    - by user91125
    I've been trying to compile this app from source https://code.launchpad.net/gala and i keep getting this message when i run MAKE: Scanning dependencies of target gala [ 11%] Building C object CMakeFiles/gala.dir/src/DBus.c.o /home/camilo/notifications/build/src/DBus.c:21:18: fatal error: glib.h: No such file or directory compilation terminated. make[2]: *** [CMakeFiles/gala.dir/src/DBus.c.o] Error 1 make[1]: *** [CMakeFiles/gala.dir/all] Error 2 make: *** [all] Error 2 Even though I' have installed glib and there is the glib.h file camilo@ian:~$ find /usr -iname glib.h /usr/include/glib-2.0/glib.h Is it a bug form the application or is it something wrong with my system?

    Read the article

  • How to compile Asus-syntec-webcam-driver stk11xx

    - by berot3
    i have asus v1s and some time ago i was able to easily compile and install it. but now compiling fails... i hope u guys know what i can do, if there is anything that can be done... after svn checkout https://syntekdriver.svn.sourceforge.net/svnroot/syntekdriver syntekdriver and cd ./syntekdriver/trunk/driver as well as make -f Makefile.standalone i got: make -C /lib/modules/2.6.36.2/build SUBDIRS=/home/berot3/syntekdriver/trunk/driver modules make[1]: Betrete Verzeichnis '/usr/src/linux-headers-2.6.38-8-generic' CC [M] /home/berot3/syntekdriver/trunk/driver/stk11xx-usb.o CC [M] /home/berot3/syntekdriver/trunk/driver/stk11xx-v4l.o /home/berot3/syntekdriver/trunk/driver/stk11xx-v4l.c:43:28: fatal error: linux/videodev.h: File not found! compilation terminated. make[2]: *** [/home/berot3/syntekdriver/trunk/driver/stk11xx-v4l.o] Error 1 make[1]: *** [_module_/home/berot3/syntekdriver/trunk/driver] Error 2 make[1]: Verlasse Verzeichnis '/usr/src/linux-headers-2.6.38-8-generic' make: *** [driver] Error 2 same for http://bookeldor-net.info/merdier/Makefile-syntekdriver http://webcache.googleusercontent.com/search?q=cache:OM0zVNlYiVQJ:bookeldor-net.info/merdier/Makefile-syntekdriver+http://bookeldor-net.info/merdier/Makefile-syntekdriver&hl=de&strip=1

    Read the article

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