Search Results

Search found 15210 results on 609 pages for 'technical writing'.

Page 53/609 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • Is there a consolidated way of writing several prototype functions for a single object?

    - by Christopher Altman
    I have about eight prototype functions for the Date object. I would like to avoid repeating Date.prototype. Is there a consolidated way of writing several prototype functions for a single object? I tried this to no avail: Date.prototype = { getMonthText: function(date){ var month = this.getMonth(); if(month==12) month = 0; return ['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'][month]; }, getDaysInMonth: function(date){ return 32 - new Date(this.getFullYear(), this.getMonth(), 32).getDate(); } };

    Read the article

  • How to evade writing a lot of repetitive code when mapping?

    - by JPCF
    I have a data access layer (DAL) using Entity Framework, and I want to use Automapper to communicate with upper layers. I will have to map data transfer objects (DTOs) to entities as the first operation on every method, process my inputs, then proceed to map from entities to DTOs. What would you do to skip writing this code? As an example, see this: //This is a common method in my DAL public CarDTO getCarByOwnerAndCreditStatus(OwnerDTO ownerDto, CreditDto creditDto) { //I want to automatize this code on all methods similar to this Mapper.CreateMap<OwnerDTO,Owner>(); Mapper.CreateMap<CreditDTO,Credit>(); Owner owner = Mapper.map(ownerDto); Owner credit = Mapper.map(creditDto) //... Some code processing the mapped DTOs //I want to automatize this code on all methods similar to this Mapper.CreateMap<Car,CarDTO>(); Car car = Mapper.map(ownedCar); return car; }

    Read the article

  • Writing the code iby dividing it into more files.

    - by srikanth rongali
    My problem is, I need a background image, a sprite(with animation) on left edge, another sprite(with animation) at other edge, a number count animation 1-2-3 at middle. I got all these when I wrote all in same file.(like [self addChild:label], [self addChild:sprite].., But in this it needs touch enables for both sprites separately, and touchDisabled to the remaining screen. So thought of writing in different files. But now it is not working. I kept one sprite, background image, numbercount in one file and another spritr in other file. Either I am getting the second sprite or the (sprite+background+numberCount) is displayed. This is my problem. plz give me solution. Thank You

    Read the article

  • Writing the code by dividing it into more files in cocoatouch.

    - by srikanth rongali
    My problem is, I need a background image, a sprite(with animation) on left edge, another sprite(with animation) at other edge, a number count animation 1-2-3 at middle. I got all these when I wrote all in same file.(like [self addChild:label], [self addChild:sprite].., But in this it needs touch enables for both sprites separately, and touchDisabled to the remaining screen. So thought of writing in different files. But now it is not working. I kept one sprite, background image, numbercount in one file and another spritr in other file. Either I am getting the second sprite or the (sprite+background+numberCount) is displayed. This is my problem. plz give me solution. Thank You

    Read the article

  • Restoring a saved opengl ES buffer (i.e. writing it back to screen)

    - by Adam
    I'm writing an iPhone app where I need to save and load the screen contents. I was able to save the screen using glReadPixels(), but since there's no glDrawPixels() in openGL ES, I'm having a lot of trouble restoring that buffer to the screen. I gather that I need to save the screen as a texture: http://stackoverflow.com/questions/708760/what-is-the-equivalent-of-gldrawpixels-in-opengl-es-1-1 But I'm not sure how to implement this. Does anyone have or know of any code samples that do this? I'm an openGL noob, so any help would be greatly appreciated :)

    Read the article

  • Design guide-lines for writing a Typed SQL Statement API ?

    - by this. __curious_geek
    Last night I came up to sometihng intersting while designing my new project that brought me to ask this qustion here. My project is supposed to follow Table Gateway pattern using tradional ADO.Net datasets for data access. I don't want to write plain queries in my data-access classes. So I came up with an idea of writing a parser kindaa api that exposes objects and methods to generate queries on the move based on my domain objects. Later I want this api to hook up to my Business objects and provide Typed SQL generator api right on the business object instances. Any idea or references how can I do this ? This seems very wide to start with that I'm compelled take your opinions here. Does there anything already exists that can do this ?

    Read the article

  • Writing a jquery plugin in coffeescript - how to get "(function($)" and "(jQuery)"?

    - by PandaWood
    I am writing a jquery plugin in coffeescript but am not sure how to get the function wrapper part right. My coffeescript starts with this line: $.fn.extend({ Which creates the javascript with a function wrapper: (function() { $.fn.extend({ but I want a '$' passed in like this: (function($) { $.fn.extend({ Similar for the ending I have... nothing in particular in coffeescript. I get this in javascript: })(); But would like this: })(jQuery); Does anyone know how to achieve this with the coffeescript compiler? Or what is the best way to get this done within coffeescript?

    Read the article

  • Is modifying a file without writing a new file possible in c++?

    - by Phenom
    Let's say I have a text file that is 100 lines long. I want to only change what is in the 50th line. One way to do it is open the file for input and open a new file for output. Use a for-loop to read in the first half of the file line by line and write to the second file line by line, then write what I want to change, and then write out the second half using a for-loop again. Finally, I rename the new file to overwrite the original file. Is there another way besides this? A way to modify the contents in the middle of a file without touching the rest of the file and without writing everything out again? If there is, then what's the code to do it?

    Read the article

  • Writing a custom wpf 'rolling' plot control (are there any components with such functionality?)

    - by adrin
    I need a wpf plot control that would 'roll' (scroll) as data is fed to it (instead of stretching, etc). Unfortunately i didnt find a working component so now I am considering writing my own control (its plotting features need to be simple). Did anyone write a custom plot/chart control? Is it difficult? What container should I use (Canvas & ViewBox?) so that it is reasonably fast, easy to write and scales as window is resized?

    Read the article

  • Flash CS4/AS3 Writing local file from local game without save dialog prompt?

    - by dragonridingsorceress
    I'm writing a game to be run locally, on the user's computer. NOT over the internet. I want to have a file that will hold the usernames and avatar indices (they're in an array). I want to know if there's a way to write to files through Flash with AS3. I'm using CS4. I'd also like to know if you can delete files through Flash, though that's just optional. Thanks in advance for any help you can give.

    Read the article

  • Why is Drupal writing to root and not sites/default/files?

    - by Candland
    I'm using Drupal 6.14 on Win7. Everything seems to work except files that should be written to sites/default/files are trying to be written to /. The site was moved from a linux installation, which is writing the files correctly. I have setup a web.config w/ the rewrite rules for drupal. Not sure what or where else I should check. Thanks for any help. <rule name="Drupal Clean URLs" stopProcessing="true"> <match url="^(.*)$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" /> </rule>

    Read the article

  • Writing different structs to a file in C++? [on hold]

    - by user58053
    I need a way to write structures of three different kinds to a binary file, which later has to be searched. (As in, for example, struct A has two fields, an int and a char; struct B has int and a long; I need to output all structures whose int equals the one given from keyboard). I understand how to write structs of the same kind to a file and how to search them, but here I am just lost, best thing I came up with is declaring a struct containing all possibly needed fields and leaving the ones I don't need empty, but it really feels wrong, there HAS to be a better way to do that. I've read about binary files and could not find anything relevant, most examples and tutorials deal with writing one data type. Could anyone point me in the right direction? EDIT: I am looking for what @Jerry_coffin called database mode, and will probably use one of the existing database systems for that, best way to go, probably. Thank you everybody for the suggestions

    Read the article

  • Why is this writing part of the text to a new line? (Python)

    - by whatsherface
    I'm adding some new bits to one of the lines in a text file and then writing it along with the rest of the lines in the file to a new file. Referring to the if statement, I that to be all on the same line: x = 13.55553e9 y = 14.55553e9 z = 15.55553e9 infname = 'afilename' outfname = 'anotherone' oldfile = open(infname) lnum=1 for line in oldfile: if (lnum==18): line = "{0:.2e}".format(x)+' '+line+' '+"{0:.2e}".format(y)+' '+ {0:.2e}".format(z) newfile = open(outfname,'w') newfile.write(line) lnum=lnum+1 oldfile.close() newfile.close() but y and z are being written on the line below the rest of it. What am I missing here?

    Read the article

  • Independent SharePoint Trainer in DC ~ I conduct, teacher-led SHAREPOINT user training anywhere ~

    - by technical-trainer-pro
    Your options: "*interactive" hands-on VIRTUAL or CLASSROOM style training to all SharePoint Users & Site Admin owners.* I also develop customized classes tailored to the specific design of any SharePoint Site - acting as the translator for those left to understand and use it, on an everyday basis. Audience: users,clients,stakeholders,trainers Areas: functionality,operations,management, user site customization,ITIL training, governance process,change mangement and industry or client specific scenerios. INDIVIDUAL RATE- $300 to join any class *(1)* GROUP RATE - $1500 for a private group of (6-10) Flexible Scheduling contact me : [email protected] Local to DC/MD/VA ---can train hands-on anywhere~

    Read the article

  • What is the list of special variables available when writing a shell command for a context menu

    - by giovanni.pellicciotta
    When extending the Windows' shell context menu (e.g. for adding an 'Open command here' prompt on directories), a 'command' key needs to be created in the registry. The value of this 'command' key apparently can be any valid command line. I want to know which 'special variables' are available for use inside this command line. For example, I use following command for opening and cmd window from within a directory's context menu (*): cmd.exe /e:on /f:on /s /k pushd "%V" I cannot find any reference to what %V actually means or what the full list of such variables is. (*) Following registry keys are created for this: [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmdshell] @=Open Command Prompt Here" HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmdshell\command] @="cmd.exe /e:on /f:on /s /k pushd \"%V\""

    Read the article

  • Writing an internal disk from IMG, what XP software to use?

    - by Andrew Swift
    I am trying to install the Chromium OS on an EEE PC 901, and I have succeeded in using Image Writer for Windows 0.2r23 to copy the IMG file to an SDHC card. Since the OS speed is limited by slow card access, I'd like to install the Chromium OS on the second, unused, internal SSD Drive, D:. However, Image Writer doesn't allow me to restore an internal drive from an IMG file. To be clear: I boot in XP on C: then run Image Writer to install the Chromium OS. Does anyone know how I can either convince Image Writer that D: is a removable drive or know of alternative program that will let me restore D: from an IMG file (non-windows file system)?

    Read the article

  • Having Textmate warn me when writing to a file that was modified since Textmate last read it

    - by emm
    Scenario: I open a file, I edit it. After I began editing, the file is modified by another program. Finally, I save the file. In that case, Vim would provide that helpful warning: WARNING: The file has been changed since reading it Do you really want to write to it (y/n)? But Textmate will overwrite the file silently, which can result in unpleasant data loss (in my case, a de facto revert on Git). How can I prevent that?

    Read the article

  • ASP.Net: Writing chunks of file..HTTP File upload with resume..

    - by Manish
    Please refer to question: http://stackoverflow.com/questions/2062852/resume-in-upload-file-control Now to find a solution for the above question, I want to work on it and develop a user control which can resume a HTTP File Upload process. For this, I'm going to create a temporary file on server until the upload is complete. Once the uploading is done completely then will just save it to the desired location. The procedure I have thought of is: Create a temporary file with a unique name (may be GUID) on the server. Read a chunk of file and append it to this temp file on the server. Continue step 1 to 3 until EOF is reached. Now if the connection is lost or user clicks on pause button, the writing of file is stopped and the temporary file is not deleted. Clicking on resume again or uploading the same file again will check on the server if the file exists and user whether to resume or to overwrite. (Not sure how to check if it's the same file. Also, how to step sending the chunks from client to server.) Clicking on resume will start from where it is required to be uploaded and will append that to the file on the server. (Again not sure how to do this.) Questions: Are these steps correct to achieve the goal? Or need some modifications? I'm not sure how to implement all these steps. :-( Need ideas, links... Any help appreciated...

    Read the article

  • JSF 2.0: Validate equality of 2 InputSecret Fields (confirm password) without writing Code?

    - by yournamehere
    I'm developing a pure JavaEE6 application with JSF 2.0 and Glassfish. My JSF implementation is Primefaces (beside Mojarra provided by Glassfish). I want to verify if the values of 2 password fields in a JSF form are equal. With Seam, there is the neat component <s:validateEquality for="pw1"/>. I want do to the same without Seam, just using JSF (or maybe a component of a JSF library). Until now i only saw examples which validate the form with a custom validator. But i would like to compare the fields without writing Java code or Javascript code. Is that possible? This what it looks like with Seam: ... <h:inputSecret id="passwort" value="#{personHome.instance.password}" redisplay="true" required="true"> <f:validateLength minimum="8"/> <a:support event="onblur" reRender="passwortField" bypassUpdates="true" ajaxSingle="true" /> </h:inputSecret> ... <h:inputSecret id="passwort2" required="true" redisplay="true"> <!-- find the JSF2.0-equivalent to this tag: --> <s:validateEquality for="passwort"/> <a:support event="onblur" reRender="passwort2Field" bypassUpdates="true" ajaxSingle="true" /> </h:inputSecret> ... Any help is appreciated. Thanks!

    Read the article

  • Writing to a new window with javascript... get access denied

    - by Søren
    Hello gurus :) I have been struggling with this for a while now, and decided it was time to ask for help. I am trying to create a print function on an aspx page, and I am using javascript to do this: function PrintContentCell() { var display_setting = "toolbar=yes, location=no, directories=yes, menubar=yes,"; display_setting += "scrollbars=yes, width=750, height=600, left=100, top=25"; var content_innerhtml = document.getElementById("testTable").innerHTML; var document_print = window.open("Loading.htm", "", display_setting); document_print.document.open(); document_print.document.write('<html><head><title>Print</title></head>'); document_print.document.write('<body style="font-family:verdana; font-size:12px;" onLoad="self.print();self.close();" >'); document_print.document.write(content_innerhtml); document_print.document.write('</body></html>'); document_print.print(); document_print.document.close(); return false; } I get "Access Denied" when the script tries to write to the new window. The Loading.htm file is just a very slim html document writing out the text "Loading...". I had hoped this would work after reading this thread: http://stackoverflow.com/questions/735136/ie-6-7-access-denied-trying-to-access-a-popup-window-document Anybody can help?

    Read the article

  • Writing an auto-memoizer in Scheme. Help with macro and a wrapper.

    - by kunjaan
    I am facing a couple of problems while writing an auto-memoizer in Scheme. I have a working memoizer function, which creats a hash table and checks if the value is already computed. If it has been computed before then it returns the value else it calls the function. (define (memoizer fun) (let ((a-table (make-hash))) (?(n) (define false-if-fail (?() #f)) (let ((return-val (hash-ref a-table n false-if-fail))) (if return-val return-val (begin (hash-set! a-table n (fun n)) (hash-ref a-table n))))))) Now I want to create a memoize-wrapper function like this: (define (memoize-wrapper function) (set! function (memoizer function))) And hopefully create a macro called def-memo which defines the function with the memoize-wrapper. eg. the macro could expand to (memoizer (define function-name arguments body ...) or something like that. So that I should be able to do : (def-memo (factorial n) (cond ((= n 1) 1) (else (* n (factorial (- n 1)))))) which should create a memoized version of the factorial instead of the normal slow one. My problem is that the The memoize-wrapper is not working properly, it doesnt call the memoized function but the original function. I have no idea how to write a define inside of the macro. How do I make sure that I can get variable lenght arguments and variable length body? How do I then define the function and wrap it around with the memoizer? Thanks a lot.

    Read the article

  • What's the use of writing tests matching configuration-like code line by line?

    - by Pascal Van Hecke
    Hi, I have been wondering about the usefulness of writing tests that match code one-by-one. Just an example: in Rails, you can define 7 restful routes in one line in routes.rb using: resources :products BDD/TDD proscribes you test first and then write code. In order to test the full effect of this line, devs come up with macros e.g. for shoulda: http://kconrails.com/2010/01/27/route-testing-with-shoulda-in-ruby-on-rails/ class RoutingTest < ActionController::TestCase # simple should_map_resources :products end I'm not trying to pick on the guy that wrote the macros, this is just an example of a pattern that I see all over Rails. I'm just wondering what the use of it is... in the end you're just duplicating code and the only thing you test is that Rails works. You could as well write a tool that transforms your test macros into actual code... When I ask around, people answer me that: "the tests should document your code, so yes it makes sense to write them, even if it's just one line corresponding to one line" What are your thoughts?

    Read the article

  • How might a C# programmer approach writing a solution in javascript?

    - by Ben McCormack
    UPDATE: Perhaps this wasn't clear from my original post, but I'm mainly interested in knowing a best practice for how to structure javascript code while building a solution, not simply learning how to use APIs (though that is certainly important). I need to add functionality to a web site and our team has decided to approach the solution using a web service that receives a call from a JSON-formatted AJAX request from within the web site. The web service has been created and works great. Now I have been tasked with writing the javascript/html side of the solution. If I were solving this problem in C#, I would create separate classes for formatting the request, handling the AJAX request/response, parsing the response, and finally inserting the response somehow into the DOM. I would build properties and methods appropriately into each class, doing my best to separate functionality and structure where appropriate. However, I have to solve this problem in javascript. Firstly, how could I approach my solution in javascript in the way I would approach it from C# as described above? Or more importantly, what's a better way to approach structuring code in javascript? Any advice or links to helpful material on the web would be greatly appreciated. NOTE: Though perhaps not immediately relevant to this question, it may be worth noting that we will be using jQuery in our solution.

    Read the article

  • What's the proper approach for writing multi-path "story" flows?

    - by Basiclife
    Hi, I wonder if you can help me. I'm writing a game (2d) which allows players to take multiple routes, some of which branch/merge - perhaps even loop. Each section of the game will decide which section is loaded next. I'm calling each section an IStoryElement - And I'm wondering how best to link these elements up in a way that is easily changed/configured and at the same time, graphable I'm going to have an engine/factory assembly which will load the appropriate StoryElement(s) based on various config options. I initially planned to give each StoryElement a NextElement() As IStoryElement property and a Completed() event. When the vent fires, the engine reads the NextElement property to find the next StoryElement. The downside to this is that if I ever wanted to graph all the routes through the game, I would be unable to - I couldn't determine all possible targets for each StoryElement. I considered a couple of other solutions but they all feel a little clunky - eg Do I need an additional layer of abstraction? ie StoryElementPlayers or similar - Each one would be responsible for stringing together multiple StoryElement perhaps a Series and a ChoicePlayer with each responsible for graphing its own StoryElement - But this will just move the problem up a layer. In short, I need some way of emulating a simple but dynamic workflow (but I'd rather not actually use WWF). Is there a pattern for something this simple? All the ones I've managed to find relate to more advanced control flow (parallel processing, etc.)

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >