Search Results

Search found 532 results on 22 pages for 'intervals'.

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

  • Need advice on cron job'ing a very large process

    - by Arms
    I have a PHP script that grabs data from an external service and saves data to my database. I need this script to run once every minute for every user in the system (of which I expect to be thousands). My question is, what's the most efficient way to run this per user, per minute? At first I thought I would have a function that grabs all the user Ids from my database, iterate over the ids and perform the task for each one, but I think that as the number of users grow, this will take longer, and no longer fall within 1 minute intervals. Perhaps I should queue the user Ids, and perform the task individually for each one? In which case, I'm actually unsure of how to proceed. Thanks in advance for any advice.

    Read the article

  • Accurate clock in Erlang

    - by buddhabrot
    I was thinking about how to implement a process that gives the number of discrete intervals in time that occurred since it started. Am I losing accuracy here? How do I implement this without loss of accuracy after a while and after heavy client abuse. I am kind of stumped how to do this in Erlang. -module(clock). -compile([export_all]). start(Time) -> register(clock, spawn(fun() -> tick(Time, 0) end)). stop() -> clock ! stop. tick(Time, Count) -> receive nticks -> io:format("~p ticks have passed since start~n", [Count]) after 0 -> true end, receive stop -> void after Time -> tick(Time, Count + 1) end.

    Read the article

  • How do I do division on HH:MM:SS format time strings in C#?

    - by Jake
    I have a series of times that are coming to me as strings from a web service. The times are formated as HH:MM:SS:000 (3 milisecond digits). I need to compare two times to determine if one is more than twice as long as the other: if ( timeA / timeB > 2 ) What's the simplest way to work with the time strings? If I was writing in Python this would be the answer to my question: Difference between two time intervals in Python Edit: What I'm really looking for is a way to get the ratio of timeA to timeB, which requires division, not subtraction. Unfortunately, the DateTime structure doesn't appear to have a division operator. Updated the question title to reflect this.

    Read the article

  • Using adaptive step sizes with scipy.integrate.ode

    - by Mike
    The (brief) documentation for scipy.integrate.ode says that two methods (dopri5 and dop853) have stepsize control and dense output. Looking at the examples and the code itself, I can only see a very simple way to get output from an integrator. Namely, it looks like you just step the integrator forward by some fixed dt, get the function value(s) at that time, and repeat. My problem has pretty variable timescales, so I'd like to just get the values at whatever time steps it needs to evaluate to achieve the required tolerances. That is, early on, things are changing slowly, so the output time steps can be big. But as things get interesting, the output time steps have to be smaller. I don't actually want dense output at equal intervals, I just want the time steps the adaptive function uses.

    Read the article

  • Get the Time Interval without ITimer

    - by ronag
    In my application I am hosting a flash activex control, based on the following implementation. However I need to know in what fps the control is running in when it is "ticked". The only way I know of to do this is to implement ITimerService and ITimer to get the vtimeInterval argument from ITimer::Advise. However, I do not want to control my own custom ITimer, instead I want the control to be timed using the default timer (basically sends WM_USER + 1 messages to the message queue at proper intervals) which is used when a custom ITimer is not provided. How can I read the vTimeInterval while still using the default timer?

    Read the article

  • SQL - Break a start/end time into 15 minute records

    - by Chu
    I've got a record set that consists of a start and end time in two separate fields: id - Int startTime - DateTime endTime - DateTime I'd like to find a way to query a record and return it as X records based on the number of 15 minute intervals found between the start and end times. For example, let's say I have a record like this: id, StartTime, EndTime 1, 1/1/2010 8:28 AM, 1/1/2010 8:47 AM I would return 3 records, the first would represent the 8:15 interval, #2 for the 8:30 interval and then a 3rd for the 8:45 interval. I realize this could be done using logic in an sproc, but we are trying to remain db neutral as we support multiple database engines.

    Read the article

  • Sleeping a thread blocking stdin

    - by Sid
    Hey, I'm running a function which evaluates commands passed in using stdin and another function which runs a bunch of jobs. I need to make the latter function sleep at regular intervals but that seems to be blocking the stdin. Any advice on how to resolve this would be appreciated. The source code for the functions is def runJobs(comps, jobQueue, numRunning, limit, lock): while len(jobQueue) >= 0: print(len(jobQueue)); if len(jobQueue) > 0: comp, tasks = find_computer(comps, 0); #do something time.sleep(5); def manageStdin(): print "Global Stdin Begins Now" for line in fileinput.input(): try: print(eval(line)); except Exception, e: print e; --Thanks

    Read the article

  • How can I (reasonably) precisely perform an action every N milliseconds?

    - by Jon Cage
    I have a machine which uses an NTP client to sync up to internet time so it's system clock should be fairly accurate. I've got an application which I'm developing which logs data in real time, processes it and then passes it on. What I'd like to do now is output that data every N milliseconds aligned with the system clock. So for example if I wanted to do 20ms intervals, my oututs ought to be something like this: 13:15:05:0000 13:15:05:0020 13:15:05:0040 13:15:05:0060 I've seen suggestions for using the stopwatch class, but that only measures time spans as opposed to looking for specific time stamps. The code to do this is running in it's own thread, so should be a problem if I need to do some relatively blocking calls. Any suggestions on how to achieve this to a reasonable (close to or better than 1ms precision would be nice) would be very gratefully received.

    Read the article

  • What is corresponding Cron expression to fire in every X seconds, where X > 60?

    - by giolekva
    I want my jobs to execute in every X seconds, there's one to one matching between job and X. Also during runtime there can be registered new jobs with their own intervals. I've tried to write cron expression for such scenarios, but in documentation there's written that value of seconds can't be more than 69. So cron expression like this: "0/63 * * * * ?" isn't valid. At first sight solution of that problem seemed to be expression like this: "0/3 0/1 * * * ?", but it means completely different thing: trigger job in every three second of every minute. Can you suggest what is the right solution (cron expression) for that? I know I could use just simple timers, but I've to use cron jobs using Quartz.

    Read the article

  • Continuously reading from a stream in C#?

    - by Damien Wildfire
    I have a Stream object that occasionally gets some data on it, but at unpredictable intervals. Messages that appear on the Stream are well-defined and declare the size of their payload in advance (the size is a 16-bit integer contained in the first two bytes of each message). I'd like to have a StreamWatcher class which detects when the Stream has some data on it. Once it does, I'd like an event to be raised so that a subscribed StreamProcessor instance can process the new message. Can this be done with C# events without using Threads directly? It seems like it should be straightforward, but I can't get quite get my head around the right way to design this.

    Read the article

  • iphone - Images (slide show) and audio snychronization

    - by Qaiser
    I have 20 images and some audio. I would like to show a single image at a time and change the images at (unequal) intervals. For example, I want to show image 1 for 1.44 seconds and image 2 for 1.67 seconds and so on. Can someone suggest how to go about doing this please? What I have seen are examples that show how to setup an array of images with one field that denotes total time. This causes the images to show for an equal amount of time (each). ... and that not what I am looking for ...

    Read the article

  • how to adjust sliding of scroll according to the value calculated by me?

    - by cng
    I am working on scroll. I have made a program wherein if the scroll box is in particular range of the panel then it automatically moves to a particular position in the slider. For eg, I have a panel of size 500. the scroll has height of 100. Now the total intervals are 5. Now if i slide the scroll box at a position 225 then i want that it automatically slides to the start of that interval that is at position 200. or if i slide to position 450 then instead of staying there it goes to position 400. Is it possible?

    Read the article

  • "tail -f" alternate which doesn't scroll the terminal window

    - by Jagtesh Chadha
    I want to check a file at continuous intervals for contents which keep changing. "tail -f" doesn't suffice as the file doesn't grow in size. I could use a simple while loop in bash to the same effect: while [ 1 ]; do cat /proc/acpi/battery/BAT1/state ; sleep 10; done It works, although it has the unwanted effect of scrolling my terminal window. So now I'm wondering, is there a linux/shell command that would display the output of this file without scrolling the terminal?

    Read the article

  • Strange python error

    - by Werner
    Hi, I am trying to write a python program that calculates a histogram, given a list of numbers like: 1 3 2 3 4 5 3.2 4 2 2 so the input parameters are the filename and the number of intervals. The program code is: #!/usr/bin/env python import os, sys, re, string, array, math import numpy Lista = [] db = sys.argv[1] db_file = open(db,"r") ic=0 nintervals= int(sys.argv[2]) while 1: line = db_file.readline() if not line: break ll=string.split(line) #print ll[6] Lista.insert(ic,float(ll[0])) ic=ic+1 lmin=min(Lista) print "min= ",lmin lmax=max(Lista) print "max= ",lmax width=666.666 width=(lmax-lmin)/nintervals print "width= ",width nelements=len(Lista) print "nelements= ",nelements print " " Histogram = numpy.zeros(shape=(nintervals)) for item in Lista: #print item int_number = 1 + int((item-lmin)/width) print " " print "item,lmin= ",item,lmin print "(item-lmin)/width= ",(item-lmin)," / ",width," ====== ",(float(item)-float(lmin))/float(width) print "int((item-lmin)/width)= ",int((item-lmin)/width) print item , " belongs to interval ", int_number, " which is from ", lmin+width*(int_number-1), " to ",lmin+width*int_number Histogram[int_number] = Histogram[int_number] + 1 4 but somehow I am completely lost, I get strange errors, can anybody help¿ Thanks

    Read the article

  • How to schedule hundreds of thousands of tasks?

    - by wehriam
    We have hundreds of thousands of tasks that need to be run at a variety of arbitrary intervals, some every hour, some every day, and so on. The tasks are resource intensive and need to be distributed across many machines. Right now tasks are stored in a database with an "execute at this time" timestamp. To find tasks that need to be executed, we query the database for jobs that are due to be executed, then update the timestamps when the task is complete. Naturally this leads to a substantial write load on the database. As far as I can tell, we are looking for something to release tasks into a queue at a set interval. (Workers could then request tasks from that queue.) What is the best way to schedule recurring tasks at scale? For what it's worth we're largely using Python, although we have no problems using components (RabbitMQ?) written in other languages.

    Read the article

  • Running a piece of code for a certain amount of time in C#?

    - by Hazem
    Hi I am working on a robot that is capable of motion detection using a webcam. I am doing this in C# The robot moves too fast, so I want to turn it on/off at short time intervals in order to reduce its speed. For example, it will start the engine then wait 0.5 second and turn it off, this cycle repeats every 2 seconds. This way, its speed wont be too fast. I would like to include this in a single function called Move() I just don't know how to do this, especially because my motion detection code runs like 20 times a second. Depending on the position of the obstacle, I may need to disable the Move() function and activate other functions that let the robot move into other directions. Any ideas/suggestions on where am I supposed to start? Thanks a lot!

    Read the article

  • HTTP Headers: Max-Age vs Expires – Which One To Choose?

    - by Gopinath
    Caching of static content like images, scripts, styles on the client browser reduces load on the webservers and also improves end users browsing experience by loading web pages quickly. We can use HTTP headers Expires or Cache-Control:max-age to cache content on client browser and set expiry time for them. Expire header is HTTP/1.0 standard and Cache-Control:max-age is introduced in HTTP/1.1 specification to solve the issues and limitation with Expire  header. Consider the following headers.   Cache-Control: max-age=24560 Expires: Tue, 15 May 2012 06:17:00 GMT The first header instructs web browsers to cache the content for 24560 seconds relative to the time the content is downloaded and expire it after the time period elapses. The second header instructs web browser to expiry the content after 15th May 2011 06:17. Out of these two options which one to use – max-age or expires? I prefer max-age header for the following reasons As max-age  is a relative value and in most of the cases it makes sense to set relative expiry date rather than an absolute expiry date. Expire  header values are complex to set – time format should be proper, time zones should be appropriate. Even a small mistake in settings these values results in unexpected behaviour. As Expire header values are absolute, we need to  keep changing them at regular intervals. Lets say if we set 2011 June 1 as expiry date to all the image files of this blog, on 2011 June 2 we should modify the expiry date to something like 2012 Jan 1. This add burden of managing the Expire headers. Related: Amazon S3 Tips: Quickly Add/Modify HTTP Headers To All Files Recursively cc image flickr:rogue3w This article titled,HTTP Headers: Max-Age vs Expires – Which One To Choose?, was originally published at Tech Dreams. Grab our rss feed or fan us on Facebook to get updates from us.

    Read the article

  • Schedule Auto Send & Receive in Microsoft Outlook

    - by Mysticgeek
    If you use Outlook as your email client, you might want to schedule how often it checks for new messages. Today we show you how to schedule how often auto send/receive occurs. If you’re busy during the day and need to keep up with your emails, you might want want Outlook to check for new messages every few minutes. Here we’ll show how to schedule it in Office 2010, 2007, and 2003 for a busy inbox where you want to keep on top of your important emails. Outlook 2010 To schedule Auto Send/Receive in Outlook 2010, click on the File tab then Options. The Outlook Options window opens…click on Advanced and scroll down to Send and receive and click on the Send/Receive button. In the Send/Receive Groups window under Setting for group “All Accounts” check the box Schedule an automatic send/receive every…minutes. It is set to 30 minutes by default and you can change the minutes to whatever you want it to be. If you’re busy and want to keep up with your messages you can go as low as every one minute. You can also get to the Send/Receive groups by selecting Send/Receive tab on the Ribbon and then Define Send/Receive Groups. Outlook 2007 To select the send/receive time intervals in Outlook 2007, open Outlook and click on Tools \ Options. Click on the Mail Setup tab, check the box next to Send immediately when connected then the Send/Receive button.   Now change the schedule to automatically send/receive. You can also access the Send/Receive Groups section by going to Send/Receive > Send/Receive Settings and Define Send/Receive Groups. Outlook 2003 In Outlook 2003 click on Tool \ Options… Click on the Mail Setup tab then check Send immediately when connected, then the Send/receive button. Then set the amount of time between send/receive attempts. If you live out of Microsoft Outlook and want to keep up with messages, setting the automatic send/receive minutes will keep you up to date. Similar Articles Productive Geek Tips Force Outlook 2007 to Download Complete IMAP ItemsUse Hotmail from Microsoft OutlookClear the Auto-Complete Email Address Cache in OutlookIntegrate Twitter With Microsoft OutlookCreate an Email Template in Outlook 2003 TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips CloudBerry Online Backup 1.5 for Windows Home Server Snagit 10 VMware Workstation 7 Acronis Online Backup Windows Firewall with Advanced Security – How To Guides Sculptris 1.0, 3D Drawing app AceStock, a Tiny Desktop Quote Monitor Gmail Button Addon (Firefox) Hyperwords addon (Firefox) Backup Outlook 2010

    Read the article

  • Add Global Hotkeys to Windows Media Player

    - by DigitalGeekery
    Do you use Windows Media Player in the background while working in other applications? The WMP Keys plug-in for Media Player adds global keyboard shortcuts that allow you to control Media Player even when it isn’t in focus. Windows Media Player has a slew of keyboard shortcuts that work only when the media player is active, but these shortcuts stop working once WMP is no longer in focus or minimized. WMP Keys add the following default global hotkeys for Windows Media Player 10, 11, and 12. Ctrl+Alt+Home – Play / Pause Ctrl+Alt+Right – Next track Ctrl+Alt+Left – Previous track Ctrl+Alt+Up Arrow Key – Volume Up Ctrl+Alt+Down Arrow Key – Volume Down Ctrl+Alt+F – Fast Forward Ctrl+Alt+B – Fast Backward Ctrl+Alt+[1-5] – Rate 1-5 stars Note: Tapping Ctrl+Alt+F and Ctrl+Alt+B will skip ahead or back in 5 second intervals. Close out of Windows Media Player and then download and install WMP Keys (link below). After you’ve installed WMP Keys, you’ll need to enable it. Select Organize and then Options… In the Options window, select the Plug-ins tab, click Background in the Category window, then check the box for Wmpkeys Plugin. Click OK to save and exit. You can also enable the plug-in by selecting Tools > Plug-ins and clicking Wmpkeys Plugin. You to view and edit the global hotkeys in the WMPKeys settings window. Select Tools > Plug-in properties and click Wmpkeys Plugin. Below you can see all the default WMP Keys shortcuts.   To change any of the shortcuts, select the text box then press the new keyboard shortcut. Click OK when finished. WMP Keys is very simple little plug-in that makes using WMP while you’re multitasking just a little bit easier and more efficient.  Looking for more plugins for Windows Media Player? Check out our previous articles on adding new features with Media Player Plus, and displaying song lyrics with Lyrics Plugin. Download WMP Keys Similar Articles Productive Geek Tips Built-in Quick Launch Hotkeys in Windows VistaFixing When Windows Media Player Library Won’t Let You Add FilesKantaris is a Unique Media Player Based on VLCInstall and Use the VLC Media Player on Ubuntu LinuxAssign Keyboard Media Keys to Work in Winamp TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips HippoRemote Pro 2.2 Xobni Plus for Outlook All My Movies 5.9 CloudBerry Online Backup 1.5 for Windows Home Server XPS file format & XPS Viewer Explained Microsoft Office Web Apps Guide Know if Someone Accessed Your Facebook Account Shop for Music with Windows Media Player 12 Access Free Documentaries at BBC Documentaries Rent Cameras In Bulk At CameraRenter

    Read the article

  • Rights Expiry Options in IRM 11g

    - by martin.abrahams
    Among the many enhancements in IRM 11g, we have introduced a couple of new rights expiry options that may be applied to any role. These options were supported in previous versions, but fell into the "advanced configuration" category. In 11g, the options can be applied simply by selecting a check-box in the properties of a role, as shown by the rather extreme example below, where the role allows access for just two minutes after they are sealed. The new options are: To define a role that expires automatically some period after it is assigned To define a role that evaluates expiry relative to the time that each document is sealed These options supplement the familiar options to allow open-ended access (limited by offline access and the ever-present option to revoke rights at any time) and the option to define time windows with specific start dates and end dates. The value of these options is easiest to illustrate with some publishing examples: You might define a role with a one year expiry to be assigned to users who purchase a one year subscription. For each individual user, the year would be calculated from the time that the role was assigned to them. You might define a role that allows documents to be accessed only for 24 hours from the time that they are published - perhaps as a preview mechanism designed to tempt users to sign up for a full subscription. Upon payment of a full fee, users can simply be reassigned a role that gives them greater access to exactly the same documents. In a corporate environment, you might use such roles for fixed term contractors or for workflows that involve information with a short lifespan, or perhaps as part of a compliance process that requires rights to be formally re-approved at intervals. Being role-based, the time constraints apply to any number of documents - including documents that have not yet been created. For example, a user with a one year subscription would have access to all documents published in the relevant classification during the year without any further configuration. Crucially, unlike other solutions, it is not the documents that expire, but the rights of particular users. Whereas some solutions make documents completely inaccessible for all users after expiry, Oracle IRM can allow some users to continue using documents while other users lose access. Equally crucially, a user whose rights have expired can always be granted fresh rights at any time - for example, because they renew their subscription or because a manager confirms that they still need the rights as part of a corporate compliance process. By applying expiry to rights rather than to documents, Oracle IRM avoids the risk of locking an organization out of its own information.

    Read the article

  • Advice on designing a robust program to handle a large library of meta-information & programs

    - by Sam Bryant
    So this might be overly vague, but here it is anyway I'm not really looking for a specific answer, but rather general design principles or direction towards resources that deal with problems like this. It's one of my first large-scale applications, and I would like to do it right. Brief Explanation My basic problem is that I have to write an application that handles a large library of meta-data, can easily modify the meta-data on-the-fly, is robust with respect to crashing, and is very efficient. (Sorta like the design parameters of iTunes, although sometimes iTunes performs more poorly than I would like). If you don't want to read the details, you can skip the rest Long Explanation Specifically I am writing a program that creates a library of image files and meta-data about these files. There is a list of tags that may or may not apply to each image. The program needs to be able to add new images, new tags, assign tags to images, and detect duplicate images, all while operating. The program contains an image Viewer which has tagging operations. The idea is that if a given image A is viewed while the library has tags T1, T2, and T3, then that image will have boolean flags for each of those tags (depending on whether the user tagged that image while it was open in the Viewer). However, prior to being viewed in the Viewer, image A would have no value for tags T1, T2, and T3. Instead it would have a "dirty" flag indicating that it is unknown whether or not A has these tags or not. The program can introduce new tags at any time (which would automatically set all images to "dirty" with respect to this new tag) This program must be fast. It must be easily able to pull up a list of images with or without a certain tag as well as images which are "dirty" with respect to a tag. It has to be crash-safe, in that if it suddenly crashes, all of the tagging information done in that session is not lost (though perhaps it's okay to loose some of it) Finally, it has to work with a lot of images (10,000) I am a fairly experienced programmer, but I have never tried to write a program with such demanding needs and I have never worked with databases. With respect to the meta-data storage, there seem to be a few design choices: Choice 1: Invidual meta-data vs centralized meta-data Individual Meta-Data: have a separate meta-data file for each image. This way, as soon as you change the meta-data for an image, it can be written to the hard disk, without having to rewrite the information for all of the other images. Centralized Meta-Data: Have a single file to hold the meta-data for every file. This would probably require meta-data writes in intervals as opposed to after every change. The benefit here is that you could keep a centralized list of all images with a given tag, ect, making the task of pulling up all images with a given tag very efficient

    Read the article

  • A Generic Boolean Value Converter

    - by codingbloke
    On fairly regular intervals a question on Stackoverflow like this one:  Silverlight Bind to inverse of boolean property value appears.  The same answers also regularly appear.  They all involve an implementation of IValueConverter and basically include the same boilerplate code. The required output type sometimes varies, other examples that have passed by are Boolean to Brush and Boolean to String conversions.  Yet the code remains pretty much the same.  There is therefore a good case to create a generic Boolean to value converter to contain this common code and then just specialise it for use in Xaml. Here is the basic converter:- BoolToValueConverter using System; using System.Windows.Data; namespace SilverlightApplication1 {     public class BoolToValueConverter<T> : IValueConverter     {         public T FalseValue { get; set; }         public T TrueValue { get; set; }         public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)         {             if (value == null)                 return FalseValue;             else                 return (bool)value ? TrueValue : FalseValue;         }         public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)         {             return value.Equals(TrueValue);         }     } } With this generic converter in place it easy to create a set of converters for various types.  For example here are all the converters mentioned so far:- Value Converters using System; using System.Windows; using System.Windows.Media; namespace SilverlightApplication1 {     public class BoolToStringConverter : BoolToValueConverter<String> { }     public class BoolToBrushConverter : BoolToValueConverter<Brush> { }     public class BoolToVisibilityConverter : BoolToValueConverter<Visibility> { }     public class BoolToObjectConverter : BoolToValueConverter<Object> { } } With the specialised converters created they can be specified in a Resources property on a user control like this:- <local:BoolToBrushConverter x:Key="Highlighter" FalseValue="Transparent" TrueValue="Yellow" /> <local:BoolToStringConverter x:Key="CYesNo" FalseValue="No" TrueValue="Yes" /> <local:BoolToVisibilityConverter x:Key="InverseVisibility" TrueValue="Collapsed" FalseValue="Visible" />

    Read the article

  • Unit testing in Django

    - by acjohnson55
    I'm really struggling to write effective unit tests for a large Django project. I have reasonably good test coverage, but I've come to realize that the tests I've been writing are definitely integration/acceptance tests, not unit tests at all, and I have critical portions of my application that are not being tested effectively. I want to fix this ASAP. Here's my problem. My schema is deeply relational, and heavily time-oriented, giving my model object high internal coupling and lots of state. Many of my model methods query based on time intervals, and I've got a lot of auto_now_add going on in timestamped fields. So take a method that looks like this for example: def summary(self, startTime=None, endTime=None): # ... logic to assign a proper start and end time # if none was provided, probably using datetime.now() objects = self.related_model_set.manager_method.filter(...) return sum(object.key_method(startTime, endTime) for object in objects) How does one approach testing something like this? Here's where I am so far. It occurs to me that the unit testing objective should be given some mocked behavior by key_method on its arguments, is summary correctly filtering/aggregating to produce a correct result? Mocking datetime.now() is straightforward enough, but how can I mock out the rest of the behavior? I could use fixtures, but I've heard pros and cons of using fixtures for building my data (poor maintainability being a con that hits home for me). I could also setup my data through the ORM, but that can be limiting, because then I have to create related objects as well. And the ORM doesn't let you mess with auto_now_add fields manually. Mocking the ORM is another option, but not only is it tricky to mock deeply nested ORM methods, but the logic in the ORM code gets mocked out of the test, and mocking seems to make the test really dependent on the internals and dependencies of the function-under-test. The toughest nuts to crack seem to be the functions like this, that sit on a few layers of models and lower-level functions and are very dependent on the time, even though these functions may not be super complicated. My overall problem is that no matter how I seem to slice it, my tests are looking way more complex than the functions they are testing.

    Read the article

  • Suggestions for connecting .NET WPF GUI with Java SE Server

    - by Sam Goldberg
    BACKGROUND We are building a Java (SE) trading application which will be monitoring market data and sending trade messages based on the market data, and also on user defined configuration parameters. We are planning to provide the user with a thin client, built in .NET (WPF) for managing the parameters, controlling the server behavior, and viewing the current state of the trading. The client doesn't need real-time updates; it will instead update the view once every few seconds (or whatever interval is configured by the user). The client has about 6 different operations it needs to perform with the server, for example: CRUD with configuration parameters query subset of the data receive updates of current positions from server It is possible that most of the different operations (except for receiving data) are just different flavors of managing the configuration parameters, but it's too early in our analysis for us to be sure. To connect the client with the server, we have been considering using: SOAP Web Service RESTful service building a custom TCP/IP based API (text or xml) (least preferred - but we use this approach with other applications we have) As best as I understand, pros and cons of the different web service flavors are: SOAP pro: totally automated in .NET (and Java), modifying server side interface require no code changes in communication layer, just running refresh on Web Service reference to regenerate the classes. con: more overhead in the communication layer sending more text, etc. We're not using J2EE container so maybe doesn't work so well with J2SE REST pro: lighter weight, less data. Has good .NET and Java support. (I don't have any real experience with this, so don't know what other benefits it has.) con: client will not be automatically aware if there are any new operations or properties added (?), so communication layer needs to be updated by developer if server interface changes. con: (both approaches) Server cannot really push updates to the client at regular intervals (?) (However, we won't mind if client polls the server to get updates.) QUESTION What are your opinions on the above options or suggestions for other ways to connect the 2 parts? (Ideally, we don't want to put much work into the communication layer, because it's not the significant part of the application so the more off-the-shelf and automated the better.)

    Read the article

  • Suggestions for connecting .NET WPF GUI with Java SE Server aoo

    - by Sam Goldberg
    BACKGROUND We are building a Java (SE) trading application which will be monitoring market data and sending trade messages based on the market data, and also on user defined configuration parameters. We are planning to provide the user with a thin client, built in .NET (WPF) for managing the parameters, controlling the server behavior, and viewing the current state of the trading. The client doesn't need real-time updates; it will instead update the view once every few seconds (or whatever interval is configured by the user). The client has about 6 different operations it needs to perform with the server, for example: CRUD with configuration parameters query subset of the data receive updates of current positions from server It is possible that most of the different operations (except for receiving data) are just different flavors of managing the configuration parameters, but it's too early in our analysis for us to be sure. To connect the client with the server, we have been considering using: SOAP Web Service RESTful service building a custom TCP/IP based API (text or xml) (least preferred - but we use this approach with other applications we have) As best as I understand, pros and cons of the different web service flavors are: SOAP pro: totally automated in .NET (and Java), modifying server side interface require no code changes in communication layer, just running refresh on Web Service reference to regenerate the classes. con: more overhead in the communication layer sending more text, etc. We're not using J2EE container so maybe doesn't work so well with J2SE REST pro: lighter weight, less data. Has good .NET and Java support. (I don't have any real experience with this, so don't know what other benefits it has.) con: client will not be automatically aware if there are any new operations or properties added (?), so communication layer needs to be updated by developer if server interface changes. con: (both approaches) Server cannot really push updates to the client at regular intervals (?) (However, we won't mind if client polls the server to get updates.) QUESTION What are your opinions on the above options or suggestions for other ways to connect the 2 parts? (Ideally, we don't want to put much work into the communication layer, because it's not the significant part of the application so the more off-the-shelf and automated the better.)

    Read the article

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