Search Results

Search found 25 results on 1 pages for 'dreftymac'.

Page 1/1 | 1 

  • Ruby: add custom properties to built-in classes

    - by dreftymac
    Question: Using Ruby it is simple to add custom methods to existing classes, but how do you add custom properties? Here is an example of what I am trying to do: myarray = Array.new(); myarray.concat([1,2,3]); myarray._meta_ = Hash.new(); # obviously, this wont work myarray._meta_['createdby'] = 'dreftymac'; myarray._meta_['lastupdate'] = '1993-12-12'; ## desired result puts myarray._meta_['createdby']; #=> 'dreftymac' puts myarray.inspect() #=> [1,2,3] The goal is to construct the class definition in such a way that the stuff that does not work in the example above will work as expected. Update: (clarify question) One aspect that was left out of the original question: it is also a goal to add "default values" that would ordinarily be set-up in the initialize method of the class. Update: (why do this) Normally, it is very simple to just create a custom class that inherits from Array (or whatever built-in class you want to emulate). This question derives from some "testing-only" code and is not an attempt to ignore this generally acceptable approach.

    Read the article

  • Ruby: add custom properties to built-in classes

    - by dreftymac
    Question: Using Ruby it is simple to add custom methods to existing classes, but how do you add custom properties? Here is an example of what I am trying to do: myarray = Array.new(); myarray.concat([1,2,3]); myarray._meta_ = Hash.new(); # obviously, this wont work myarray._meta_['createdby'] = 'dreftymac'; myarray._meta_['lastupdate'] = '1993-12-12'; ## desired result puts myarray._meta_['createdby']; #=> 'dreftymac' puts myarray.inspect() #=> [1,2,3] The goal is to construct the class definition in such a way that the stuff that does not work in the example above will work as expected. Update: (clarify question) One aspect that was left out of the original question: it is also a goal to add "default values" that would ordinarily be set-up in the initialize method of the class. Update: (why do this) Normally, it is very simple to just create a custom class that inherits from Array (or whatever built-in class you want to emulate). This question derives from some "testing-only" code and is not an attempt to ignore this generally acceptable approach.

    Read the article

  • Applicability of the Joel Test to web development companies

    - by dreftymac
    QUESTION: How can you re-write the questions of the Joel test to apply to web developers? 1. Do you use source control? (source control for all aspects of your app, including configuration, database and user-based settings?) 2. Can you make a build in one step? (can you deploy a site from staging to prod in 1 step?) ... 10. Do you have testers? (how do you test AJAX and CSS?) BACKGROUND: This is for people who work in a shop that does some web development but also uses some off-the-shelf tools like Drupal and Wordpress, but doing custom development on top of that. RELATED LINKS: http://www.joelonsoftware.com/articles/fog0000000043.html What do you think about the Joel Test?

    Read the article

  • installing bitnami stacks with virtualbox

    - by dreftymac
    Background: I cannot seem to get the vmdk files to work with VirtualBox as a way of using Bitnami stacks. The documentation says you can use VirtualBox, but there is no detail except how to use VMWare player. I know how to get .iso files working with virtual box, but not the files that Bitnami uses. Question: Anyone have experience getting this specific configuration to work?

    Read the article

  • MSFT Excel pivot table links to external data

    - by dreftymac
    Question1: What is the best online forum to ask MSFT Excel questions of the following variety? Question2: How can I link an excel pivot-table to a potentially changing source table without having to re-draw the excel pivot-table layout every time the source table changes data. (Note, the columns are not changing, just the data in the rows). Background: I have an excel 2007 pivot table that is grabbing data from another sheet (an excel "table" ... tables are a new feature of excel 2007). When I change the data in the source table, and then go to the pivot table and press "refresh" ... the pivot table reverts to its "blank" format and requires me to re-drag the columns rows and values. What I want is for the pivot-table to simply re-draw itself without me having to re-create the pivot table layout.

    Read the article

  • Excel data representation: show me all people who did not pass the exam

    - by dreftymac
    Background I have an excel spreadsheet with the results of a pass/no-pass exam. Students are allowed to take the exam as often as they want until they either pass, or give up trying. student ;; result ;; date [email protected] ;; no-pass ;; 2000-06-07 [email protected] ;; pass ;; 2000-06-07 [email protected] ;; pass ;; 2000-06-07 [email protected] ;; no-pass ;; 2000-06-07 [email protected] ;; pass ;; 2000-06-07 [email protected] ;; pass ;; 2000-06-08 [email protected] ;; no-pass ;; 2000-06-08 Question Using a pivot-table or something else, how can I get excel to show me a clean report or representation of this data on another sheet that answers the question: Who are all the people who took the exam, but never got a passing grade? In the above example it would just show me [email protected] ;; no-pass ;; with all the dates that delta took the exam. I know excel is not a database nor a reporting tool per-se, but it would be great if I could get it to do this.

    Read the article

  • Eclipse PDT debugging web application: evaluating expressions in a console

    - by dreftymac
    When using Eclipse PDT with XDebug to debug a PHP web application, is there any way to open up a console window that will allow me to type in and see the value of arbitrary expressions in the current scope? This would seem like an obvious element of the debugging environment, and I may be missing something, but the only thing resembling a console says "no consoles to display at this time"

    Read the article

  • indentation preference and personality

    - by dreftymac
    This question is similar in spirit to : http://stackoverflow.com/questions/492178/links-between-personality-types-and-language-technology-preferences But it is based specifically on indentation (spaces vs tabs and the number of spaces). The reason I am asking here instead of searching is because I remember seeing a specific document writing about this. If I remember correctly, it also talked about why Linus prefers eight spaces.

    Read the article

  • ruby xmpfilter on windows

    - by dreftymac
    Has anyone out there ever gotten xmpfilter to work on windows? xmpfilter "unterminated string meets end of file" is the error. The only Google hit is in Japanese: google://xmpfilter "unterminated string meets end of file" http://www.unkar.org/read/pc12.2ch.net/tech/1249687283 For background, the desired feature from xmpfilter is to get automatic "eval" annotations of Ruby sourcecode: Before: a = "bravo alpha charlie" # => b = a.split # => b.sort! # => After: a = "bravo alpha charlie" # => "bravo alpha charlie" b = a.split # => ["bravo", "alpha", "charlie"] b.sort! # => ["alpha", "bravo", "charlie"]

    Read the article

  • javascript normalize whitespace and other plain-text formatting routines

    - by dreftymac
    Background: The language is JavaScript. The goal is to find a library or pre-existing code to do low-level plain-text formatting. I can write it myself, but why re-invent the wheel. The issue is: it is tough to determine if a "wheel" is out there, since any search for JavaScript libraries pulls up an ocean of HTML-centric stuff. I am not interested in HTML necessarily, just text. Example: I need a JavaScript function that changes this: BEFORE: nisi ut aliquip | ex ea commodo consequat duis |aute irure dolor in esse cillum dolore | eu fugiat nulla pariatur |excepteur sint occa in culpa qui | officia deserunt mollit anim id |est laborum ... into this ... AFTER: nisi ut aliquip | ex ea commodo consequat duis | aute irure dolor in esse cillum dolore | eu fugiat nulla pariatur | excepteur sint occa in culpa qui | officia deserunt mollit anim id | est laborum Question: Does it exist, a JavaScript library that is non-html-web-development-centric that has functions for normalizing spaces in delimited plain text, justifying and spacing plain text? Rationale: Investigating JavaScript for use in a programmer's text editor.

    Read the article

  • Normalize whitespace and other plain-text formatting routines

    - by dreftymac
    Background: The language is JavaScript. The goal is to find a library or pre-existing code to do low-level plain-text formatting. I can write it myself, but why re-invent the wheel. The issue is: it is tough to determine if a "wheel" is out there, since any search for JavaScript libraries pulls up an ocean of HTML-centric stuff. I am not interested in HTML necessarily, just text. Example: I need a JavaScript function that changes this: BEFORE: nisi ut aliquip | ex ea commodo consequat duis |aute irure dolor in esse cillum dolore | eu fugiat nulla pariatur |excepteur sint occa in culpa qui | officia deserunt mollit anim id |est laborum ... into this ... AFTER: nisi ut aliquip | ex ea commodo consequat duis | aute irure dolor in esse cillum dolore | eu fugiat nulla pariatur | excepteur sint occa in culpa qui | officia deserunt mollit anim id | est laborum Question: Does it exist, a JavaScript library that is non-html-web-development-centric that has functions for normalizing spaces in delimited plain text, justifying and spacing plain text? Rationale: Investigating JavaScript for use in a programmer's text editor.

    Read the article

  • Git tutorial: Understanding git pull and branches (using a specific example repo)

    - by dreftymac
    Backround: Suppose I have the following Git URLs (hosted on github) http://github.com/mikl/drupal.git git://github.com/mikl/drupal.git (Git read-only) I am interested in having a local copy of this repository so I can pratice working with branches in git and see how my local working tree can change depending on which branch I am working with. Questions: To get started, I set up a local directory and do git clone git://github.com/mikl/drupal.git ... Will this clone all of the branches? Or will it only clone master? The web front-end for github gives me a "drop down" menu that allows me to switch branches ... Does changing this drop-down actually change which branch I will be grabbing when I run git clone? If I want a new copy of this repository on my local machine, but I am interested in only two branches of this repository and I want to ignore all the rest, what command do I use to ensure I clone only those two branches and nothing else (assume one of the branches is master)?

    Read the article

  • are there any negative implications of sourcing a javascript file that does not actually exist?

    - by dreftymac
    If you do script src="/path/to/nonexistent/file.js" in an HTML file and call that in a browser, and there are no dependencies or resources anywhere else in the HTML file that expect the file or code therein to actually exist, is there anything inherently bad-practice about doing this? Yes, it is an odd question. The rationale is the developer is dealing with a CMS that allows custom (self-contained) javascript files to be provided in certain circumstances. The problem is the CMS is not very flexible when it comes to creating conditional includes for javascript. Therefore it is easier to just make references to the self-contained js files regardless of whether they are actually at the specified path. Since no errors are displayed to the user, should this practice be considered a viable option?

    Read the article

  • Web-based JSON editor that works like property explorer with AJAXy input form

    - by dreftymac
    Background: This is a request for something that may not exist yet, but I've been meaning to build one for a long time. First I will ask if anyone has seen anything like it yet. Suppose you have an arbitrary JSON structure like the following: { 'str_title':'My Employee List' ,'str_lastmod': '2009-June-15' ,'arr_list':[ {'firstname':'john','lastname':'doe','age':'33',} ,{'firstname':'jane','lastname':'doe','age':'34',} ,{'firstname':'samuel','lastname':'doe','age':'35',} ] } Question: Is there a web-based JSON editor that could take a structure like this, and automatically allow the user to modify this in a user-friendly GUI? Example: Imagine an auto-generated HTML form that displays 2 input-type-text controls for both title and lastmod, and a table of input-type-text controls with three columns and three rows for arr_list ... with the ability to delete or add additional rows by clicking on a [+][X] next to each row in the table. Big Idea: The "big idea" behind this is that the user would be able to specify any arbitrary (non-recursive) JSON structure and then also be able to edit the structure with a GUI-based interaction (this would be similar to the "XML Editor Grid View" in XML Spy).

    Read the article

  • convert any language into PHP sourcecode

    - by dreftymac
    Question: Is there any such thing as a programming language (other than an esoteric language such as BrainF@#$, or the languages PHP or VB) that you can "compile" into non-obfuscated PHP source code? Rationale: Swip wants to generate ordinary PHP code because it is so ubiquitous for the types of projects swip wants to do. Unfortunately swip would like to actually avoid writing PHP -- strange but true! Swip is crazy enough to want to generate PHP source code without having to type any PHP into Swip's editor.

    Read the article

  • Mac OS X - run shell script from the desktop GUI

    - by dreftymac
    You can create a shell script or a Python or Ruby script and run it on the Mac by using "Terminal" ... if you have Finder open, and you click on the icon for the file containing the source code of a saved shell script, is there a way to have that script run, instead of opening in my text editor ?

    Read the article

  • Vim step-by-step: How do you line up arbitrary text by arbitrary delimiter?

    - by dreftymac
    Background: There are a lot of great tutorials and "tricks" pages for Vim, but one thing that is very difficult is to find specific instructions on how to do some arbitrary thing that one can easily do in one's own familiar text editor IDE. Therefore I am asking for step by step instructions on how you I would do something in Vim that I already know how to do in other text editors. I like Vim and the great built-in help and numerous on-line tutorials, but sometimes a human has to break down and ask another human. Question: Suppose I have the following code in my file, how can I use Vim to get from BEFORE, to AFTER? BEFORE: Lorem ipsum dolor | sit amet, consectetur | adipisicing elit, sed do eiusmod | tempor incididunt | ut labore et | dolore magna aliqua. | Ut enim ad minim veniam, quis nostrud | exercitation ullamco | laboris nisi ut | aliquip ex ea commodo | consequat. Duis aute irure AFTER: Lorem ipsum dolor | sit amet, consectetur | adipisicing elit, sed do eiusmod | tempor incididunt | ut labore et | dolore magna aliqua. | Ut enim ad minim veniam, quis nostrud | exercitation ullamco | laboris nisi ut | aliquip ex ea commodo | consequat. Duis aute irure

    Read the article

  • Web-app currency input/manipulation/calculation with javascript .. there has got to be a better (fra

    - by dreftymac
    BACKGROUND: I am of the "user-input-lockdown" school of thought. Whenever possible, I try to mistrust and sanitize user input, both client side and server side; and I try to take multiple opportunities to restrict possible inputs to a known subset of possibilities, usually this means providing a lot of checkboxes and select lists. (This is from the usability side of things, I know security-wise that malicious users can easily bypass fixed user input GUI controls). PROBLEM: Anyway, the problem always arises with non-fixed input of currency. Whenever I have to accept a freely-specified dollar amount as user input, I always have to confront these problems/annoyances and it is always painful: 1) Make sure to give the user two input boxes for each currency_datapoint, one for the whole_dollar_part and another for the fractional_pennies_part 2) Whenever the user changes a currency_datapoint, provide keystroke-by-keystroke GUI feedback to let them know whether the currency_datapoint is well-formed, with context-appropriate validation rules (e.g., no negatives?, nonzero only?, numeric only!, no non-numeric punctuation! no symbols!) 3) For display purposes, every user-provided currency_datapoint should be translated to human-readable currency formatting (dollar sign, period, commas provided by the app, where appropriate) 4) For calculation purposes, every user-provided currency_datapoint has to be converted to integer (all pennies, to avoid floating point errors) and summed into a grand total with zero or more subtotals. 5) Every user-provided currency_datapoint should be displayed or displayable in a nice "tabular" format, which auto-updates as the user enters each currency_datapoint, including a baloon that warns when one or more currency_datapoints is not well-formed. I seem to be re-inventing this wheel every time I have to work with currency in Javascript on the client side (server side is a bit more flexible since most programming languages have higher-level currency formatting logic). QUESTION: Has anyone out there solved the problem of dealing with the above issues, client side, in a way that is server-side-technology-stack agnostic, (preferrably plain javascript or jquery)? This is getting old, there has to be a better way.

    Read the article

  • gedit underscore as a word_character

    - by dreftymac
    Is it possible to configure gedit to treat the underscore character as a word character? Currently, it appears that the editor treats "two_words" as two separate words when selecting, instead of a single word as in many other mainstream text editors.

    Read the article

1