To add a Javascript array to another, use the "concat" method. Note that it doesn't change the original array but instead returns a new one, so you have to assign the return value.
References:
My online tech scrapbook where I keep my notes in case I need to look them up later
Friday, November 29, 2013
Friday, November 22, 2013
AngularJS Datepicker
The Angular UI team has an implementation based on JQuery UI datepicker. Download and documentation here: https://github.com/angular-ui/ui-date
Note: it is possible to customize the behavior using options (see "Options" section in the link above).
As an alternative, there is a variant based on Bootstrap: http://angular-ui.github.io/bootstrap/
Note: it is possible to customize the behavior using options (see "Options" section in the link above).
As an alternative, there is a variant based on Bootstrap: http://angular-ui.github.io/bootstrap/
Thursday, November 21, 2013
Does Order of Javascript Matter?
Yes, you should link dependencies first before linking the files that depend on the dependencies.
Reference: http://stackoverflow.com/questions/1323196/does-the-order-of-javascript-matter-in-a-page
Reference: http://stackoverflow.com/questions/1323196/does-the-order-of-javascript-matter-in-a-page
Wednesday, November 20, 2013
Sniffing Packets Using "tcpdump" on Mac OS
Here's how it's done: http://stackoverflow.com/questions/9321853/how-to-sniff-packets-on-mac-os-10-7-lion
Monday, November 18, 2013
Startup Funding Rounds
A good reference for anyone who might forget the names and numbers from time to time: http://www.mediapost.com/publications/article/199103/the-three-stages-of-funding-a-startup.html
Thursday, November 14, 2013
Git Diff Tool
It seems after the Mountain Lion update, "git difftool" now no longer has a graphical diff interface.
I had to set it up again using the instructions from here: http://git-scm.com/book/en/Customizing-Git-Git-Configuration
I also had to install kdiff3 separately.
I had to set it up again using the instructions from here: http://git-scm.com/book/en/Customizing-Git-Git-Configuration
I also had to install kdiff3 separately.
Wednesday, November 13, 2013
Jackson Date Handling
The default is behavior is epoch, but lots of way to customize, as explained here: http://wiki.fasterxml.com/JacksonFAQDateHandling
Servlet "init" Method Called Multiple Times
This can happen if an exception is thrown the last time it was called.
Monday, November 11, 2013
Thursday, November 7, 2013
Installing MongoDB Using "yum" in RedHat Based Distros
All it takes is to add the repository to the configuration.
Details here: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/
Details here: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/
Wednesday, November 6, 2013
AWS Policy Document "Sid" Field
This is a field that is usually generated by the policy generator but what happens when you copy and paste a policy? Is it safe to leave it unchanged? Or should it be changed to another value?
According to this blog post:
"The Sid (statement ID) is an optional identifier you provide for the policy statement. Essentially it is just a sub-ID of the policy document's ID. The Amazon S3 implementation of the access policy language require this element and have uniqueness requirements for it."
In this case, any identifier unique to the document should be sufficient, even "1", "2", "3" etc.
According to this blog post:
"The Sid (statement ID) is an optional identifier you provide for the policy statement. Essentially it is just a sub-ID of the policy document's ID. The Amazon S3 implementation of the access policy language require this element and have uniqueness requirements for it."
In this case, any identifier unique to the document should be sufficient, even "1", "2", "3" etc.
Hosting a Static Website on AWS S3
Step by step guide provided by AWS here: http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html
MongoDB vs MongoLab for Early Stage Live Apps
MongoDB and MongoLab are the 2 main MongoDB hosted service providers who provide their servers within the AWS network and in all regions. For a startup just going live with a new product, volume is initially expected to be low but HA may also be a requirement. Obviously cost is also an issue.
With these in mind the shared instances sound like the way to go, unfortunately with MongoLab this option is not available in all AWS regions. It also comes at a big jump in price from the single server shared plan (i.e. $15 -> $89 for same storage). Bump up the budget to $200 a month and you can get a dedicated instance with much more storage and dedicated RAM. With MongoHQ it gets worse with no cluster / replica-set options available.
So moving on to dedicated instances, MongoLab provides cluster / replica-set options for as little as $200 a month, while MongoHQ doesn't do so until you reach the $1345 a month price plan. For a startup just starting out trying to save costs and not wanting to compromise on HA, seems like MongoLab is the obvious choice purely basing on the packages and price plans.
References:
With these in mind the shared instances sound like the way to go, unfortunately with MongoLab this option is not available in all AWS regions. It also comes at a big jump in price from the single server shared plan (i.e. $15 -> $89 for same storage). Bump up the budget to $200 a month and you can get a dedicated instance with much more storage and dedicated RAM. With MongoHQ it gets worse with no cluster / replica-set options available.
So moving on to dedicated instances, MongoLab provides cluster / replica-set options for as little as $200 a month, while MongoHQ doesn't do so until you reach the $1345 a month price plan. For a startup just starting out trying to save costs and not wanting to compromise on HA, seems like MongoLab is the obvious choice purely basing on the packages and price plans.
References:
DynamoDB Hash and Range
Hash doesn't have to be unique if "Hash and Range" PK is selected. In this case, it is used for evenly sharding the data under-the-hood.
However, the Hash and Range combination should be unique (not mentioned specifically but obvious and implied).
More details in the following references:
However, the Hash and Range combination should be unique (not mentioned specifically but obvious and implied).
More details in the following references:
Handling Complex Objects in DynamoDB
Apparently AWS's Java APIs provide means to handle this.
Link: https://java.awsblog.com/post/Tx1K7U34AOZBLJ2/Using-Custom-Marshallers-to-Store-Complex-Objects-in-Amazon-DynamoDB
Link: https://java.awsblog.com/post/Tx1K7U34AOZBLJ2/Using-Custom-Marshallers-to-Store-Complex-Objects-in-Amazon-DynamoDB
Articles With Comparison Between DynamoDB and MongoDB (Part 2)
Tuesday, November 5, 2013
Cocos2D-X: Drawing Rectangle with Border
This needs to be done in 2 draws, one to draw the border and the other to draw a solid rectangle.
Example code:
p1 being the bottom left corner of the rectangle and p2 being the top right.
In order for this to be called, the function needs to be override the "draw" function of the parent.
Example code:
void MyLayer::draw()
{
CCPoint p1 = ccp(x1,y1); CCPoint p2 = ccp(x2,y2);
ccColor4F color;
color.a = 1.0;
color.r = 0;
color.g = 0;
color.b = 0;
ccDrawSolidRect(p1,p2, color);
ccDrawColor4B(255, 255, 255, 255);
ccDrawRect(p1,p2);
}
|
p1 being the bottom left corner of the rectangle and p2 being the top right.
In order for this to be called, the function needs to be override the "draw" function of the parent.
Subscribe to:
Posts (Atom)