Search Results

Search found 42629 results on 1706 pages for 'dry run'.

Page 3/1706 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Practices for domain models in Javascript (with frameworks)

    - by AndyBursh
    This is a question I've to-and-fro'd with for a while, and searched for and found nothing on: what're the accepted practices surrounding duplicating domain models in Javascript for a web application, when using a framework like Backbone or Knockout? Given a web application of a non-trivial size with a set of domain models on the server side, should we duplicate these models in the web application (see the example at the bottom)? Or should we use the dynamic nature to load these models from the server? To my mind, the arguments for duplicating the models are in easing validation of fields, ensuring that fields that expected to be present are in fact present etc. My approach is to treat the client-side code like an almost separate application, doing trivial things itself and only relying on the server for data and complex operations (which require data the client-side doesn't have). I think treating the client-side code like this is akin to separation between entities from an ORM and the models used with the view in the UI layer: they may have the same fields and relate to the same domain concept, but they're distinct things. On the other hand, it seems to me that duplicating these models on the server side is a clear violation of DRY and likely to lead to differing results on the client- and server-side (where one piece gets updated but the other doesn't). To avoid this violation of DRY we can simply use Javascripts dynamism to get the field names and data from the server as and when they're neeed. So: are there any accepted guidelines around when (and when not) to repeat yourself in these situations? Or this a purely subjective thing, based on the project and developer(s)? Example Server-side model class M { int A DateTime B int C int D = (A*C) double SomeComplexCalculation = ServiceLayer.Call(); } Client-side model function M(){ this.A = ko.observable(); this.B = ko.observable(); this.C = ko.observable(); this.D = function() { return A() * C(); } this.SomeComplexCalculation = ko.observalbe(); return this; }l M.GetComplexValue = function(){ this.SomeComplexCalculation(Ajax.CallBackToServer()); }; I realise this question is quite similar to this one, but I think this is more about almost wholly untying the web application from the server, where that question is about doing this only in the case of complex calculation.

    Read the article

  • Ad-Driven Apps Are Sucking Your Android Battery Dry

    - by Jason Fitzpatrick
    Ads in free Android apps might be annoying but you probably never imagined they were radically draining your battery. New research from Purdue University and Microsoft highlight just how much ad-driven apps tank your battery life. What did they find? That poorly designed ad-modules in free ad-driven applications are terrible at conserving energy. In popular applications like Angry Birds and Free Chess 70% of the energy the application consumed was used to drive the ads. They also surveyed other applications and found that ad-driven apps weren’t alone in excessive battery use–the New York Times app, for example, spent 15% of its battery consumption on tracking and background tasks. Hit up the link below to read the full whitepaper for a more in depth look at the methodology and results. Fine Grained Energy Accounting on Smartphones with Eprof (PDF) [via ZDNet] Make Your Own Windows 8 Start Button with Zero Memory Usage Reader Request: How To Repair Blurry Photos HTG Explains: What Can You Find in an Email Header?

    Read the article

  • How to set up a Hudson server to run cppunit tests

    - by kyue
    Hello, I'm having problems setting up my Hudson server to run cpp unit tests so I can output an .xml file. I tried searching the web for some more straight forward instructions on how to set this up but still don't understand how to. It sounds like I need to set up ant to run...but how?? I'm currently running Hudson ver 1.352. Any suggestions will be greatly appreciated. Kat

    Read the article

  • Run length encoding

    - by Phoenix
    What is the best we can do with run length encoding. http://en.wikipedia.org/wiki/Run-length_encoding Page suggests the time complexity is O(m*n) where m is the number of time the number repeats .. Is the a more efficient algorithm to do RLE ??

    Read the article

  • Run Application Command to open Terminal

    - by Narcolapser
    Question: What command do you type in to the "Run Application" box on ubuntu to open the terminal? Info: I'm having horrible horrible driver issues on my netbook. I might be able to solve some of these problems if I could just get to Terminal, but all I have is my keyboard, no mouse, so i need to know what command to type in to run application (Which I can get to with alt-f2) to open terminal. Thanks, ~N

    Read the article

  • First run notepad with my.cfg and only then start the service

    - by Viv Coco
    Hi all, I install along with my application: 1) a service that starts and stops my application as needed 2) a conf file that contains actually the user data and that will be shown to the user to modify as needed (I give the user the chance to change it by running notepad.exe with my conf file during installing) The problem is that in my code the service I install starts before the user had the chance to modify the conf file. What I would like is: 1) first the user gets the chance to change the conf file (run notepad.exe with the conf file) 2) only afterward start the service <Component Id="MyService.exe" Guid="GUID"> <File Id="MyService.exe" Source="MyService.exe" Name="MyService.exe" KeyPath="yes" Checksum="yes" /> <ServiceInstall Id='ServiceInstall' DisplayName='MyService' Name='MyService' ErrorControl='normal' Start='auto' Type='ownProcess' Vital='yes'/> <ServiceControl Id='ServiceControl' Name='MyService' Start='install' Stop='both' Remove='uninstall'/> </Component> <Component Id="my.conf" Guid="" NeverOverwrite="yes"> <File Id="my.cfg" Source="my.cfg_template" Name="my.cfg" KeyPath="yes" /> </Component> [...] <Property Id="NOTEPAD">Notepad.exe</Property> <CustomAction Id="LaunchConfFile" Property="NOTEPAD" ExeCommand="[INSTALLDIR]my.cfg" Return="ignore" Impersonate="no" Execute="deferred"/> <!--Run only on installs--> <InstallExecuteSequence> <Custom Action='LaunchConfFile' Before='InstallFinalize'>(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE)</Custom> </InstallExecuteSequence> What am I doing wrong in the above code and how could I change it in order to achieve what I need? (first run notepad with my conf file and then start the service). TIA, Viv

    Read the article

  • create jrxml file at run time and modify at run time

    - by Srinivas
    Hi I have a requirement to develop custom reports where we already have some reoprts developed using JasperReports using iReport tool. Now the requirement is to modify those reports design at run time. I should use those existing jrxml files and save as to new report then change the design at run time. Also I should see those newly created reports whenever I want. I have gone through the Jasper API and Dynamic Reports where we can create the reports dynamically at run time but we can't save the design (like JRXML). I am looking for any other JRXML design API to create and modify and save the Jasper Reports at run time. I appreciate if any one can help me. Thanks in Advance Srinivas

    Read the article

  • create jrml file at run time and modify at run time

    - by Srinivas
    Hi I have a requirement to develop custom reports where we already have some reoprts developed using JasperReports using iReport tool. Now the requirement is to modify those reports design at run time. I should use those existing jrxml files and save as to new report then change the design at run time. Also I should see those newly created reports whenever I want. I have gone through the Jasper API and Dynamic Reports where we can create the reports dynamically at run time but we can't save the design (like JRXML). I am looking for any other JRXML design API to create and modify and save the Jasper Reports at run time. I appreciate if any one can help me. Thanks in Advance Srinivas

    Read the article

  • Implementing dry-run in bash scripts

    - by Andrei Serdeliuc
    How would one implement a dry-run option in a bash script? I can think of either wrapping every single command in an if and echoing out the command instead of running it if the script is running with dry-run. Another way would be to define a function and then passing each command call through that function. Something like: function _run () { if [[ "$DRY_RUN" ]]; then echo $@ else $@ fi } `_run mv /tmp/file /tmp/file2` `DRY_RUN=true _run mv /tmp/file /tmp/file2` Is this just wrong and there is a much better way of doing it?

    Read the article

  • How do I DRY up business logic between sever-side Ruby and client-side Javascript?

    - by James A. Rosen
    I have a Widget model with inheritance (I'm using Single-Table Inheritance, but it's equally valid for Class-per-Table). Some of the subclasses require a particular field; others do not. class Widget < ActiveRecord ALL_WIDGET_TYPES = [FooWidget, BarWidget, BazWidget] end class FooWidget < Widget validates_presence_of :color end class BarWidget < Widget # no color field end class BazWidget < Widget validates_presence_of :color end I'm building a "New Widget" form (app/views/widgets/new.html.erb) and would like to dynamically show/hide the color field based on a <select> for widget_type. <% form_for @widget do |f| %> <%= f.select :type, Widget::ALL_WIDGET_TYPES %> <div class='hiddenUnlessWidgetTypeIsFooOrBaz'> <%= f.label :color %> <%= f.text_field :color %> </div> <% end %> I can easily write some jQuery to watch for onChange events on widget_type, but that would mean putting some sort of WidgetTypesThatRequireColor constant in my Javascript. Easy enough to do manually, but it is likely to get disconnected from the Widget model classes. I would prefer not to output Javascript directly in my view, though I have considered using content_for(:js) and have a yield :js in my template footer. Any better ideas?

    Read the article

  • Specifying default value for django hidden form field - bone DRY?

    - by jMyles
    So let's say at the last minute (in the view) I decide I want to specify a default for a field and make it hidden, like so: form.fields['coconut'] = forms.ModelChoiceField(label="", widget=forms.HiddenInput(), queryset=swallow.coconuts.all(), initial=some_particular_coconut) My question is this: Do I really need to specify queryset here? I mean, I already know, from initial, exactly which coconut I'm talking about. Why do I also need to specify that the universe of available coconuts is the set of coconuts which this particular swallow carried (by the husk)? Is there a way I can refrain from specifying queryset? Simply omitting causes django to raise TypeError. If indeed it is required, isn't this a bit damp?

    Read the article

  • Run Program on Startup?

    - by Maddest Hatter
    How is it possible to have an executable run automatically on startup? Is it possible by having a shortcut to the .exe in the startup folder in the All programs section of the start menu? If that is correct, what is the full directory of the start up folder? C:/

    Read the article

  • Run Configuration Batch Script

    - by Karl
    For the purpose of a demonstration I'm looking for a way to start an eclipse run configuration from outside using a script (e.g. windows batch script). I have no idea if that's possible or how to do it.. Does anybody have an idea?

    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

  • Adding complexity to remove duplicate code

    - by Phil
    I have several classes that all inherit from a generic base class. The base class contains a collection of several objects of type T. Each child class needs to be able to calculate interpolated values from the collection of objects, but since the child classes use different types, the calculation varies a tiny bit from class to class. So far I have copy/pasted my code from class to class and made minor modifications to each. But now I am trying to remove the duplicated code and replace it with one generic interpolation method in my base class. However that is proving to be very difficult, and all the solutions I have thought of seem way too complex. I am starting to think the DRY principle does not apply as much in this kind of situation, but that sounds like blasphemy. How much complexity is too much when trying to remove code duplication? EDIT: The best solution I can come up with goes something like this: Base Class: protected T GetInterpolated(int frame) { var index = SortedFrames.BinarySearch(frame); if (index >= 0) return Data[index]; index = ~index; if (index == 0) return Data[index]; if (index >= Data.Count) return Data[Data.Count - 1]; return GetInterpolatedItem(frame, Data[index - 1], Data[index]); } protected abstract T GetInterpolatedItem(int frame, T lower, T upper); Child class A: public IGpsCoordinate GetInterpolatedCoord(int frame) { ReadData(); return GetInterpolated(frame); } protected override IGpsCoordinate GetInterpolatedItem(int frame, IGpsCoordinate lower, IGpsCoordinate upper) { double ratio = GetInterpolationRatio(frame, lower.Frame, upper.Frame); var x = GetInterpolatedValue(lower.X, upper.X, ratio); var y = GetInterpolatedValue(lower.Y, upper.Y, ratio); var z = GetInterpolatedValue(lower.Z, upper.Z, ratio); return new GpsCoordinate(frame, x, y, z); } Child class B: public double GetMph(int frame) { ReadData(); return GetInterpolated(frame).MilesPerHour; } protected override ISpeed GetInterpolatedItem(int frame, ISpeed lower, ISpeed upper) { var ratio = GetInterpolationRatio(frame, lower.Frame, upper.Frame); var mph = GetInterpolatedValue(lower.MilesPerHour, upper.MilesPerHour, ratio); return new Speed(frame, mph); }

    Read the article

  • Custom daemon script: works, but does not run at boot / startup

    - by pearjoint
    this is Ubuntu 10.10 Maverick. I have the following shell script in init.d that I want to run as a "daemon" (background service with start/stop/restart really) at system startup. There is a symlink in rc3.d. I tried 4 and 5 too. (Ideally this would initialize before graphical login happens and before a user logs in.) IMPORTANT: the script works 100% as expected and required when testing this with service MetaLeapDaemon start and service MetaLeapDaemon stop. (This shell script calls a Python program which makes sure the appropriate .pid files are both created at startup and deleted at exit.) So generally it works fine but now my only issue is why it will not be run at any of the run-levels I tried. I know for sure it isn't run because the log file it normally creates does not get created. As you can see (by the lack of any uid:gid args in the start-stop-daemon commands) this would currently run only under root, is this forbidden in a default setup? Here's the script, pretty much your run-off-the-mill daemon script really: #! /bin/sh DAEMON=/opt/metaleap/_core/daemon/MetaLeapDaemon.py NAME=MetaLeapDaemon DESC="MetaLeapDaemon" test -f $DAEMON || exit 0 set -e case "$1" in start) start-stop-daemon --start --pidfile /var/run/$NAME.pid --exec $DAEMON ;; stop) start-stop-daemon --stop --pidfile /var/run/$NAME.pid ;; restart) start-stop-daemon --stop --pidfile /var/run/$NAME.pid sleep 1 start-stop-daemon --start --pidfile /var/run/$NAME.pid --exec $DAEMON ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart}" >&2 exit 1 ;; esac exit 0

    Read the article

  • eclipse jetty:run differs to cli mvn jetty:run

    - by adam
    I have managed to track a problem where within eclipse I see no error, but anywhere outside eclipse the error exists. The error I get when run outside eclipse is LazyInitializationException from hibernate - caused by a ${entity.service.id} reference in the jsp. Outside eclipse I have tried jetty standalone, mvn jetty:run from the command line, and tomcat. I've cleaned the projects, disabled workspace dependency etc. I'm using eclipse galileo, m2eclipse 0.9.8.200905041414, jdk 1.6_17, maven 2.1.1 (not embedded), jetty 6.1.22 (standalone and plugin). How is that possible??

    Read the article

  • How to do run length encoding?

    - by Phoenix
    I have a long string for example it could be "aaaaaabbccc". Need to represent it as "a6b2c3". What's the best way to do this ? I could do this in linear time by comparing characters and incrementing counts and then replacing the counts in the array, using two indexes in one pass. Can you guys think of a better way than this? Are any of the encoding techniques going to work here ?

    Read the article

  • First run run after install.

    - by frndforall
    Hello, In Symbian, if we set a parameter frri, we can make the appmanager to run the new application on completion of download and installation. Do we have any feature as such in android so that application will start as soon as it gets installed on to device. Thx.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >