Comment by Industrial on Can I overwrite a constructor in javascript?
@MaëlNison For testing purposes to be able to inject spies to catch arguments for validation
View ArticleComment by Industrial on Storing Exceptions in my webapp?
Single file + aggregator of logs seems like the best thing to do to me, two years after my question was asked.
View ArticleComment by Industrial on How does require in node.js deal with globals?
Well, if I do passwordhelper_mock = require("helpers/password"), the later on sutbbed mock will not be used. Doing global.passwordhelper_mock will however allow me to modify properties
View ArticleComment by Industrial on How do I sort the output of find?
Didn't know about the tee command, but it still doesn't sort properly
View ArticleComment by Industrial on How do I sort the output of find?
Sorry for not being clearer. I updated my post
View ArticleComment by Industrial on Why should I use require.js if I still concenate all...
Instead of voting for closing, please make me understand as I do not get this concept at all
View ArticleComment by Industrial on Mantis Bug tracker API integration?
@StevenScott I do not have access to that codebase any longer I'm afraid :(
View ArticleMocking database in node.js?
How would I mock out the database in my node.js application, which in this case uses mongodb as the backend for a blog REST API ? Sure, I could set the database to a specific testing -database, but I...
View ArticleContent-type not working in PHP
I have some issues with a PHP file that is not working properly. The Content-type does not get recieved by any browser at all. Firebug interprets the file as text/html instead of css. Here's the file...
View ArticleHow to install mongoDB on windows?
I am trying to test out mongoDB and see if it is anything for me. I downloaded the 32bit windows version, but have no idea on how to continue from now on. I normally use the WAMP services for...
View ArticleRegular expressions: Matching strings starting with dot (.)?
I am a complete Reg-exp noob, so please bear with me. Tried to google this, but haven't found it yet. What would be an appropriate way of writing a Regular expression matching files starting with a...
View ArticleCreating methods to update & save documents with mongoose?
After checking out the official documentation, I am still not sure on how to create methods for use within mongoose to create & update documents. So how can I do this? I have something like this...
View ArticleSplitting string by whitespace, without empty elements?
I am trying to explode an string using javascript to pick searchterms, whitespace-separated. However I get empty array elements if a searchterm is ended by a whitespace, as shown below. What should I...
View ArticleLimiting node.js's memory usage
I am trying to limit a node.js application from using to much memory and I've found out about the --max-stack-size & --max_executable_size options that are available within V8 to pass when...
View ArticleDates in mongoose?
I know that I can set Date.now as a default value in a mongoose schema, but what other Javascript date types or are all dates automatically converted to mongodb´s standard format - ISOdate? Are there...
View ArticleGet mtime of specific file using Bash?
I am well aware of being able to do find myfile.txt -mtime +5 to check if my file is older than 5 days or not. However I would like to fetch mtime in days of myfile.txt and store it into a variable...
View ArticlePHP: Get key from array?
I am sure that this is super easy and built-in function in PHP, but I have yet not seen it. Here's what I am doing for the moment: foreach($array as $key => $value) { echo $key; // Would output...
View ArticleSorting multidim array: prioritize if column contains substring, then order...
I am currently creating a sorting method that consists of values from an mysql query. Here's a brief view of the array: Array ( [0] => Array ( ['id'] = 1; ['countries'] = 'EN,CH,SP'; ) [1] =>...
View ArticleHow to build an available web application
Let's say that we are about to build an web application where high availability is top focus. Our customers are companies, so downtime are equal to loss of revenue for everyone involved. To sum it up,...
View ArticlePHP: Check if URL redirects?
I have implemented a function that runs on each page that I want to restrict from non-logged in users. The function automatically redirects the visitor to the login page in the case of he or she is...
View ArticleHow do I start node.js+supervisor on boot?
After installing and setting up node.js on my development VM running Ubuntu 11.10, I would like supervisor to start automatically on boot, calling and reloading node.js when needed. Below snippet...
View ArticleWhen to implement and extend? [closed]
When should implement or extend be used? What are some real-world examples? Is this correct? Implementing appears to be a way to enforce that certain methods exists in a class, and that these methods...
View ArticleSplit array into chunks
Let's say that I have an Javascript array looking as following: ["Element 1","Element 2","Element 3",...]; // with close to a hundred elements. What approach would be appropriate to chunk (split) the...
View ArticleHow can I find input elements which have not been changed in jQuery?
I want to find all form elements, with a specific class, and check if they have been altered or not. The if-statement does its job, but I have no idea to correct the find thingy. Is this in the right...
View ArticleComment by Industrial on How do I access this Javascript property?
Would you mind telling me where I could find an explanation on how this works - I've never seen this syntax before
View ArticlePHP: Iterating through array?
I want a function that searches through my array, and returns all the children to a specific node. What is the most appropriate way to do this? Will recursion be necessary in this case?I have...
View ArticleExtending ArrayObject in PHP properly?
Problem: I am trying to extend PHP's ArrayObject as shown below. Unfortunately I can't get it to work properly when setting multi-dimensional objects and instead an error thrown as I have the strict...
View ArticleMove node in Nested Sets tree
I am working on an adjacency list with mySQL and can not (atleast by myself) do the thinking needed to make a decent enough query to be able to move a set of nodes (together with eventual children...
View ArticleRewriting nginx for pushState-URL's
I am trying to get nginx to work with my pushState-based URI handling that backbone.js manages for me in an Javascript app. Right now accessing URI's with one level, eg. example.com/users works well,...
View ArticleEvent binding clicks with backbone.js & jQuery
I need to bind two events in my backbone.js-view in order to toggle a menu. The idea is that if a button with the id #toggler is clicked the menu appears and any click outside the #menu element will...
View ArticleHow to store the contents of select box to a variable?
I have a <select> field on my HTML page that is populated with a few options. With the help of AJAX, I replace those options in the select field with more appropriate options.How can I store the...
View ArticleCheck if string is serialized in PHP
I am in the middle of building a cache layer for the Redis DB to my application and I have come to the point where's it's about to take care of arrays.I wonder if there's any good (high performance!)...
View ArticleAnswer by Industrial for Handling white screen of death in PHP
I've found out, since the time of my question, that nothing seems to ensure that errors are always outputted with PHP, which seems to throw white screens here and there. Regardless of PHP's...
View ArticleHandling white screen of death in PHP
After debugging a CodeIgniter application that were installed into a new development environment, I have started to freak out when seeing white screens with nothing more available. I have been able to...
View ArticlemySQL: Subquery to array?
I am working on a slight complex (at least for me) mySQL query containing a subquery and it isn't going to well to be honest.SELECT `products`.`id`, `product`.`price`, ( SELECT `value` FROM...
View ArticleComment by Industrial on Keeping errors from appearing to the user in node.js
That did it. I had to put the error handling block after my routes though, which was kind of unexpected.
View ArticleComment by Industrial on Any library for visualizing module dependencies in...
github.com/hughsk/colony ?
View ArticleWhen to use which mysql partitioning model
Ok guys, just starting out with partitioning some tables in mySQL. There's a couple of different ways describing this, but what I cant find is a more practical approach. - Which type of data does each...
View ArticlePHP header location-redirect doesn't work - why? [duplicate]
Here's my file. I want to make it redirect, but nothing happens. To check out what is going on, I added an echo before the header part.It neither throws an error or redirect to index.php. What is...
View ArticlePrevent two users from editing the same data
I have seen a feature in different web applications including Wordpress (not sure?) that warns a user if he/she opens an article/post/page/whatever from the database, while someone else is editing the...
View Article