Bitnami provides an AMI that can be used in the EC2 for quickly setting up a Wordpress server.
Steps described here: http://wiki.bitnami.com/Applications/BitNami_Wordpress_Stack#How_to_change_the_default_URL_to_root.3f
My online tech scrapbook where I keep my notes in case I need to look them up later
Monday, December 30, 2013
Saturday, December 21, 2013
Modal Window Not Displaying With AngularJS and Bootstrap
This will probably be fixed pretty soon but for now (i.e. Angular UI for Bootstrap version 0.7 and Bootstrap 3), the modal window will not display (only the backdrop will).
To make the modal window display, change "display: none" to "display: block" in the ".modal" class in the CSS. However, it will be very badly formatted. To fix the formatting issues, the markup for the modal needs to be put inside the following 2 div blocks:
References:
To make the modal window display, change "display: none" to "display: block" in the ".modal" class in the CSS. However, it will be very badly formatted. To fix the formatting issues, the markup for the modal needs to be put inside the following 2 div blocks:
<div class="modal-dialog">
<div class="modal-content">
<!-- modal content here→
</div>
</div>
|
References:
AngularJS Logging
AngularJS has a logging service $log that can be used to log information for e.g. debugging purpose. The main advantage of using this instead of the usual "console.log" is that you can control whether debug level messages are filtered out. Additionally, you can also add decorators to add additional behaviours.
To use it, just inject "$log" as you would $scope, $location etc.
Example here: http://docs.angularjs.org/api/ng.$log
Configure the $logProvider when defining the module to enable/disable debug.
Example: http://plnkr.co/edit/HZCAoS?p=preview
Example of decorator to add additional behaviour: https://coderwall.com/p/_zporq
To use it, just inject "$log" as you would $scope, $location etc.
Example here: http://docs.angularjs.org/api/ng.$log
Configure the $logProvider when defining the module to enable/disable debug.
Example: http://plnkr.co/edit/HZCAoS?p=preview
Example of decorator to add additional behaviour: https://coderwall.com/p/_zporq
Downloading File using curl
When you issue a "curl <url>" command, the output will be shown on stdout. This is great when trying to read a text response but most of the time, what you're doing is downloading a file.
The easiest way to do it is "curl -O <url>". This downloads the file with the same filename as the remote file.
The easiest way to do it is "curl -O <url>". This downloads the file with the same filename as the remote file.
Wednesday, December 18, 2013
CIDR Block Cheat Sheet
This page has a cheat sheet for coming up with CIDR blocks using the "a.b.c.d/x" notation: http://whatismyipaddress.com/cidr
Thursday, December 12, 2013
Online Tool for Converting Between Sexagesimal and Decimal Notations
Latitude and Longitude are represented sometimes in decimal notation and other times in sexagesimal notations.
Here's an online tool for converting between the two: http://ghiorzi.org/sexagesi.htm
Here's an online tool for converting between the two: http://ghiorzi.org/sexagesi.htm
Wednesday, December 11, 2013
Friday, November 29, 2013
Javascript Adding Arrays
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:
References:
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.
Thursday, October 31, 2013
Cocos2D-X: Useful Code Saving Memory Management Macros
CC_SAFE_RELEASE: Checks whether the object is valid before calling "release" on it.
CC_SAFE_RELEASE_NULL: Checks whether the object is valid before calling "release" on it, and then also sets the variable to NULL.
CC_SAFE_RETAIN: Use when it's possible that the return value from a function can be NULL and you don't want to call retain on a NULL value.
#define CC_SAFE_RELEASE(p) do { if(p) { (p)->release(); } } while(0)
#define CC_SAFE_RELEASE_NULL(p) do { if(p) { (p)->release(); (p) = 0; } } while(0)
#define CC_SAFE_RETAIN(p) do { if(p) { (p)->retain(); } } while(0) |
Wednesday, October 30, 2013
iOS Autorelease After Creating New Object
It is recommended to call "autorelease" after create a new object via the "new" operator (or any other method that leaves the retain count set at 1 but doesn't call "autorelease"). This is because after a "new" operator, the retain count of the object is set to "1" to ensure that it doesn't get destroyed. If "autorelease" is not called, the object will continue to take up memory until "release" is called on the object. Calling "autorelease" will ensure that the object's retain count is set to reduced by one (important!) after the current event loop is completed and the autorelease pool is drained. This means that if "retain" is called subsequently, the object will still not be destroyed if that is not matched with a corresponding "release".
Note: I ran my tests on Cocos2D-X's implementation of the autorelease pool system but as I understand, it behaves the same as the iOS one.
References:
Note: I ran my tests on Cocos2D-X's implementation of the autorelease pool system but as I understand, it behaves the same as the iOS one.
References:
- http://stackoverflow.com/questions/2076402/what-is-the-difference-between-releasing-and-autoreleasing
- https://developer.apple.com/library/mac/DOCUMENTATION/Cocoa/Conceptual/MemoryMgmt/Articles/MemoryMgmt.html#//apple_ref/doc/uid/10000011-SW1
- http://www.cocoanetics.com/2009/08/understanding-autoreleasing/
Cocos2D Cropping Sprites
Useful trick for features like graphical health bars etc.
Reference: http://www.cocos2d-x.org/forums/6/topics/32721
theSprite->setTextureRect(CCRectMake(x,y,w,h));
|
Reference: http://www.cocos2d-x.org/forums/6/topics/32721
Cocos2D Draw Order
In summary:
- If within same parent and same Z order, then nodes that are added first will be drawn first, followed by the ones added later in sequence.
- If within the same parent and different Z order, then it's according to Z order. The higher the Z order, the later it will be drawn. Note: negative Z order will be drawn before the parent, and positive Z order will be drawn after the parent.
- If different parents, then the Z order of the parent decides first, then Z order within each parent.
- The only way for nodes with different parents to be ordered with each other independently of parent is using VertexZ. (However, I could not get it to work with Cocos2D-X Isometric tile maps across map layers. I ended up removing all the objects (e.g. buildings) on the other layers in runtime and re-inserting them in the same layer as the other sprites as sprites, and then ordering via Z order.
C++ Static Variables
Other than the usual differences in scope, there are some unique aspects of the syntax that will stump a developer from a Java background.
While instance variables only require declaration in the header file, a static variable in C++ needs to be declared twice, once in the header file and another in the CPP file. Otherwise you'll get a linker error.
See here for example: http://stackoverflow.com/questions/9282354/static-variable-link-error
While instance variables only require declaration in the header file, a static variable in C++ needs to be declared twice, once in the header file and another in the CPP file. Otherwise you'll get a linker error.
See here for example: http://stackoverflow.com/questions/9282354/static-variable-link-error
Wednesday, October 23, 2013
Cocos2D-X: Tile Map Layer Empty Gotcha
With Cocos2D-X, if you leave a layer with no tiles, there will be a crash that look like this:
This is due to the CCTexture2D object being undefined when initialising the layer. This can occur when the layer does not have a tile defined.
It is sometimes necessary to have a layer with no tiles defined initially and then define them in code during runtime. However, due to this crash, it is necessary to define those tiles and remove them in code prior to the game starting. Same problem might happen in Cocos2D also.
bool CCTexture2D::hasPremultipliedAlpha()
{
return m_bHasPremultipliedAlpha; <-------- EXC_BAD_ACCESS HERE
}
|
This is due to the CCTexture2D object being undefined when initialising the layer. This can occur when the layer does not have a tile defined.
It is sometimes necessary to have a layer with no tiles defined initially and then define them in code during runtime. However, due to this crash, it is necessary to define those tiles and remove them in code prior to the game starting. Same problem might happen in Cocos2D also.
Tuesday, October 22, 2013
Cocos2D: Checking if Animation Currently Running
Check that "bear->numberOfRunningActions()" returns 0.
Reference: http://stackoverflow.com/questions/12582481/check-if-animation-is-running-in-cocos2d-x
Reference: http://stackoverflow.com/questions/12582481/check-if-animation-is-running-in-cocos2d-x
Cocos2D Sprite Sheets: To Use CCSpriteBatchNode Or Not
Examples such as the one here use CCSpriteBatchNode as it is apparently some form of "best practice" to do so due to apparent performance benefits by batching draw operations.
However, the benefits of doing this is debatable, with the following articles claiming only marginal benefits in most use cases, and with significant benefits only in certain situations:
However, the benefits of doing this is debatable, with the following articles claiming only marginal benefits in most use cases, and with significant benefits only in certain situations:
Obviously if using CCSpriteBatchNode is easy then it's a no brainer to use it. But unfortunately it gets pretty complicated when you have a sprite that requires multiple sprite sheets. Rather than to have to figure out how it all has to work, or if it can even work in the first place, it's a pretty straightforward decision instead to not use it.
So from the sprite sheet tutorial, instead of using CCSpriteBatchNode:
- Load all the various sprite sheets into the sharedSpriteFrameCache
- Create one CCAction for every animation sequence using the frame names
- Create a Sprite directly using 1 of the frames
- Call runAction on the sprite whenever a new animation sequence needs to be run
Other References:
Thursday, October 17, 2013
Tiled / Cocos2D: Using Objects
- Go to Tiled, create an object layer
- On the object layer, add objects by using the drawing shapes
- If you are using rectangular shapes to represent tiles, you can open the object properties sub-menu after selecting the object and adjust the position and size to fit perfectly the tile
- Load the map in Cocos2D and read it with the following code (Example is C++ using Cocos2D-X):
CCTMXObjectGroup* objectGroup = map->objectGroupNamed(objGroupName);
CCArray* objects = objectGroup->getObjects();
CCDictionary* objectAsDict;
CCObject* obj;
CCARRAY_FOREACH(objects, obj)
{
objectAsDict = (CCDictionary*)obj;
if(!objectAsDict)
{
break;
}
const char* key = "x";
int x = ((CCString*)objectAsDict->objectForKey(key))->intValue();
key = "y";
int y = ((CCString*)objectAsDict->objectForKey(key))->intValue();
key = "width";
int width = ((CCString*)objectAsDict->objectForKey(key))->intValue();
key = "height";
int height = ((CCString*)objectAsDict->objectForKey(key))->intValue();
// figure out which tiles are covered the rectangle here
}
|
Note that the coordinates for the rectangle are based on the coordinate system of an ortho tile map (with origin at bottom left). If you are using an iso tile map in Cocos2D, the origin is at the top of the diamond. You'll have to do the necessary conversion.
Cocos2D Sprite Sheets
Guide: http://www.raywenderlich.com/32045/how-to-use-animations-and-sprite-sheets-in-cocos2d-2-x
This is based on sprite sheets generated by Texture Packer, which will also generate plist files for each frame, and also uses offset to minimize white space.
I had to change the following before I could get this to work in Cocos2D-X 2.2.0
Cocos2D-X didn't accept the "CCSpriteFrame" entered here. It was expected "CCAnimationFrame" objects. As such, I had to do this:
This is based on sprite sheets generated by Texture Packer, which will also generate plist files for each frame, and also uses offset to minimize white space.
I had to change the following before I could get this to work in Cocos2D-X 2.2.0
[walkAnimFrames addObject:
[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
[NSString stringWithFormat:@"bear%d.png",i]]];
|
Cocos2D-X didn't accept the "CCSpriteFrame" entered here. It was expected "CCAnimationFrame" objects. As such, I had to do this:
CCSpriteFrame* spriteFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(frameName);
CCAnimationFrame* animationFrame = new CCAnimationFrame();
animationFrame->initWithSpriteFrame(spriteFrame, 1.0f, CCDictionary::create());
walkAnimFrames->addObject(animationFrame);
|
Large Objects in Tiled Map Editor
This article includes a section describing how to include a large object e.g. a large tree or a building in a Tiled map. Basically this involves having a tileset with large tiles and placing them on the map as a separate layer, and then using object layer to specific collision boxes.
Link: http://gamedev.tutsplus.com/tutorials/level-design/introduction-to-tiled-map-editor/
Link: http://gamedev.tutsplus.com/tutorials/level-design/introduction-to-tiled-map-editor/
Twitter $10m Pay Cheque, Engineering Talent Wars and the 10x Engineer
Tuesday, October 15, 2013
C++ Warning "Deprecated conversion from string literal to 'char*'"
This post in StackOverflow provides a good explanation and solution for it.
http://stackoverflow.com/questions/9650058/deprecated-conversion-from-string-literal-to-char
http://stackoverflow.com/questions/9650058/deprecated-conversion-from-string-literal-to-char
Tuesday, October 8, 2013
Cocos2D Managing Touch Input
In a subclass of CCLayer, just set "isTouchEnabled" to true and implement the callback functions.
Otherwise, add a touch delegate class to the touch dispatcher. There are 2 types, as explained here: http://www.cocos2d-iphone.org/wiki/doku.php/tips:touchdelegates
Otherwise, add a touch delegate class to the touch dispatcher. There are 2 types, as explained here: http://www.cocos2d-iphone.org/wiki/doku.php/tips:touchdelegates
Porting From Obj-C to C++ for Cocos2D-X
This page provides a guide for developers when porting code from Obj-C to C++
http://www.cocos2d-x.org/wiki/Moving_From_Objective-C_to_C++
http://www.cocos2d-x.org/wiki/Moving_From_Objective-C_to_C++
Converting from Screen to Map Coordinates in Isometric 2D Games
This article here provides a great explanation on this.
Formulae in summary:
From screen coordinates to tile x,y
From tile x,y to screen coordinates
Note: these only work if the iso map is skewed at 45 degrees. If it's skewed in 30 degrees or 60 degrees, trigonometry will be needed.
Formulae in summary:
From screen coordinates to tile x,y
map.x = screen.x / TILE_WIDTH + screen.y / TILE_HEIGHT;
map.y = screen.y / TILE_HEIGHT - screen.x / TILE_WIDTH;
|
From tile x,y to screen coordinates
screen.x = (map.x - map.y) * TILE_WIDTH_HALF;
screen.y = (map.x + map.y) * TILE_HEIGHT_HALF;
|
Note: these only work if the iso map is skewed at 45 degrees. If it's skewed in 30 degrees or 60 degrees, trigonometry will be needed.
Thursday, October 3, 2013
Android Google Maps Draw Text Label On Map
Unfortunately, on V2 of the API, this is not possible. The workaround is to create a bitmap image from text, and then draw it as an image Marker.
Solution is described here: http://stackoverflow.com/questions/14631223/draw-text-on-google-map-no-longer-possible
When creating the Paint object, the text size should be calculated during runtime based on the display. This is done according to the example here: http://stackoverflow.com/questions/12620343/text-size-with-different-resolution
Solution is described here: http://stackoverflow.com/questions/14631223/draw-text-on-google-map-no-longer-possible
When creating the Paint object, the text size should be calculated during runtime based on the display. This is done according to the example here: http://stackoverflow.com/questions/12620343/text-size-with-different-resolution
Wednesday, October 2, 2013
Git See Older Version of File
Here's a quick way to see the older version of a file in Git:
git show HEAD~4:pathto/file
Where "4" represents the number of versions to go back in HEAD.
See the following references for more details and variations:
git show HEAD~4:pathto/file
Where "4" represents the number of versions to go back in HEAD.
See the following references for more details and variations:
Android: ListView Black When Scrolling
Encountered this a couple of times on some Android OS versions.
It's due to the scrolling cache. To fix it, use "setCacheColorHint(preferredBgColor)". I usually just use transparent.
Reference:
It's due to the scrolling cache. To fix it, use "setCacheColorHint(preferredBgColor)". I usually just use transparent.
Reference:
Android: Using "ellipsize" to Deal With Long Text
In a TextView the "android:ellipsize" attribute is used to handle rendering of text that is too long for the space given.
More information in the following links:
More information in the following links:
Saturday, September 28, 2013
Notes for Android Google Maps API Version 2
Some notes:
- It is required to obtain an API key at the Google APIs console
- First step is to create a project, the name is not important
- Within the project, switch on the Google Maps API
- Create a "Registered App" for each key you want to create
- I have 1 desktop and 1 notebook, so I ended up registering 2 apps with the debug keys on each machine
- These keys, by default can be used across apps
- There are 2 main ways to include a map in a screen
- The preferred way is to use a fragment, which can be used with the most flexibility with the newer API levels
- Some older devices won't be able to use fragments unless it's called from within a FragmentActivity
- Alternatively, MapView can be used but requires life-cycle events to be forwarded to the MapView
- Gotchas:
- You have to include the source codes of the Google Play Services library project in your workspace in order to use the API
- It still doesn't support the ingestion of a KML file and automatically drawing the contents on the map
- The docs say you don't have to use MapsInitializer.initialize, I've had to do it (with MapView)
Resources:
- https://blog-emildesign.rhcloud.com/?p=435
- http://stackoverflow.com/questions/16572020/error-java-lang-classnotfoundexception-com-google-android-gms-maps-mapfragment
- http://stackoverflow.com/questions/15958550/java-lang-classnotfoundexception-android-view-fragment
- http://stackoverflow.com/questions/13905230/mapview-and-cameraupdate-in-api-v2
Android API Levels
This page contains the reference to use on this: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
Simple Guide on "How to Get Started in Data Science"
Link: http://hortonworks.com/blog/how-to-get-started-in-data-science/#.UkNOfLx543c
Contains pointers for people from different backgrounds e.g. Java developer, Hadoop developer, Statistician etc.
Contains pointers for people from different backgrounds e.g. Java developer, Hadoop developer, Statistician etc.
Java Still Going Strong
I've always believed in using Java for the backend because of its performance, maturity, versatility, availability of open source tools/libraries and also you can have large teams work on projects together without things getting messy.
So it's good to see these articles, which also provide a good inside look at Twitter's struggles with Ruby on Rails and its subsequent migration to Java:
So it's good to see these articles, which also provide a good inside look at Twitter's struggles with Ruby on Rails and its subsequent migration to Java:
Tuesday, September 24, 2013
Twitter Search Queries
Advance Twitter search queries:
Twitter Java Library
Twitter4J is an open-source (Apache License) Java Twitter library that can be used to integrate into Twitter's API.
It includes OAuth and gzip support, and can be used within Android.
Site: http://twitter4j.org/en/
It includes OAuth and gzip support, and can be used within Android.
Site: http://twitter4j.org/en/
Saturday, September 14, 2013
Monday, September 2, 2013
Articles With Comparison Between DynamoDB and MongoDB
- http://slashdot.org/topic/bi/why-my-team-went-with-dynamodb-over-mongodb/
- http://stackoverflow.com/questions/17931073/dynamodb-vs-mongodb-nosql
- http://www.masonzhang.com/2013/07/lean7-migrate-from-mongodb-to-dynamodb.html
- http://www.masonzhang.com/2013/08/7-reasons-you-should-use-mongodb-over.html
- http://www.masonzhang.com/2013/08/3-reasons-you-should-use-dynamodb-over.html
- http://db-engines.com/en/system/DynamoDB%3BMongoDB
- http://newgenapps.com/blog/bid/213202/Amazon-DynamoDB-vs-MongoDB
Tuesday, August 6, 2013
Removing DOS Carriage Return in Linux
This shows up as "^M" in some editors, and can cause some scripts to fail.
To fix it, install the package "dos2unix". Available in at the minimum RedHat and Ubuntu based distros.
To fix it, install the package "dos2unix". Available in at the minimum RedHat and Ubuntu based distros.
Thursday, August 1, 2013
Android Private Libraries
In the Eclipse ADT, this is libraries that are placed in the "libs" folder, they are automatically placed on the classpath as "Android Private Libraries".
However, when removing it, the ADT removes the library but flags it as an error as it is missing. A restart needed to be performed before the project compiles properly.
However, when removing it, the ADT removes the library but flags it as an error as it is missing. A restart needed to be performed before the project compiles properly.
Android Include Library in APK
In order for library JAR files to be included in the APK, it is necessary to go the "Build Path" and check "Android Private Libraries" in "Order and Export".
References:
References:
Android Library References
To make one project depend on another, add into project.properties as follows:
android.library.reference.1=../LibraryOne
android.library.reference.2=../LibraryTwo
|
Friday, July 12, 2013
Article About Data Scientist Jobs
Talks about what the requirements are for someone who aspires to gets hired as one.
Link: http://gigaom.com/2013/04/16/how-to-hire-data-scientists-and-get-hired-as-one/
Link: http://gigaom.com/2013/04/16/how-to-hire-data-scientists-and-get-hired-as-one/
Tuesday, July 9, 2013
Android Themes Remove Action/Title Bar
Some people do this by using themes that don't have title or action bars, but this might be in conflict with existing theming requirements. This method is also difficult to apply to multiple SDK levels at the same time, due to inconsistent theme availability.
The best solution so far is to add customizations within each style as described in these answers:
Android Icon Sizes
Current recommended launcher icon sizes in Android:
- 48 x 48 (mdpi)
- 72 x 72 (hdpi)
- 96 x 96 (xhdpi)
- 144 x 144 (xxhdpi)
There is also 36 x 36 for ldpi but the OS is able to resize that nicely from the better quality ones.
Wednesday, June 12, 2013
Monday, June 10, 2013
Big Data is About Speed Instead of Just Size
Article: http://www.guardian.co.uk/news/datablog/2013/may/20/big-data-critics-overlooked-speed-not-size
The main point of the article provides an insightful reminder for us not to be fixation with just the volume aspect of big data. There are many cases characterized by a high-velocity stream of data that needs to be processed and acted on immediately.
The main point of the article provides an insightful reminder for us not to be fixation with just the volume aspect of big data. There are many cases characterized by a high-velocity stream of data that needs to be processed and acted on immediately.
Google Launches "Mobile Backend as a Service"
Google launches "Mobile Backend as a Service" starter kit. It's called "Mobile Backend Starter" and runs on top of Google App Engine.
It's mainly a client-to-client networking and communications stack. It supports storage of state data on the server side and also Google Authentication. However, no customized server logic or extensions are supported.
References:
It's mainly a client-to-client networking and communications stack. It supports storage of state data on the server side and also Google Authentication. However, no customized server logic or extensions are supported.
References:
Wednesday, May 29, 2013
Application Management for AWS
Currently, the following application management frameworks are available for AWS (excludes third party solutions):
- AWS Elastic Beanstalk
- AWS OpsWorks
- AWS CloudFormation
Details can be found here: https://aws.amazon.com/application-management/
Something they didn't mention in the above web-page is that OpsWorks is a technology acquired in an acquisition, and does not integrate into all of AWS's services yet, the most important being ELB (OpsWorks uses HAProxy). Leaving CloudFormation as the framework of choice if this is an issue.
Forum post about this: https://forums.aws.amazon.com/message.jspa?messageID=426226
On the other hand, the downside of CloudFormation is the lack of automated failover.
On the other hand, the downside of CloudFormation is the lack of automated failover.
Sunday, April 7, 2013
BASH IO Redirection
In bash, by default, only stdout gets redirected to a file when you use the ">" operator.
To redirect stderr to a file, use the "2>" operator.
To redirect both, use "&>"
Reference:http://www.cyberciti.biz/faq/redirecting-stderr-to-stdout/
To redirect stderr to a file, use the "2>" operator.
To redirect both, use "&>"
Reference:http://www.cyberciti.biz/faq/redirecting-stderr-to-stdout/
Git Undo Staging a File for Commit
If a file has already been staged for commit i.e. via the "git add" command, use the following command to unstage the file:
git reset HEAD <filename>
git reset HEAD <filename>
Tuesday, April 2, 2013
Iterating Through All Loggers & Appenders in LogBack
Most people probably won't need it, but when you do, this will come in handy.
http://stackoverflow.com/questions/7064402/is-it-possible-to-find-logback-log-files-programmatically
http://stackoverflow.com/questions/7064402/is-it-possible-to-find-logback-log-files-programmatically
Monday, April 1, 2013
The "spi" Package in Java Projects
It's quite common to find a package called "spi" in Java projects.
Here's an explanation of what it means and what it's for:
Here's an explanation of what it means and what it's for:
Friday, March 22, 2013
C# Iterate Dictionary
Using "foreach" and "KeyValuePair" as the element. Refer to this: http://stackoverflow.com/questions/141088/what-is-the-best-way-to-iterate-over-a-dictionary-in-c
Monday, March 18, 2013
C# Start New Process
This is how it's done:http://stackoverflow.com/questions/258416/shellexecute-equivalent-in-net
If you need to start multiple processes asynchronously, you'd need to first start multiple threads and then within each thread, each process is started.
Reference for this: http://www.codeproject.com/Articles/25983/How-to-Execute-a-Command-in-C
How to add arguments: http://msdn.microsoft.com/en-sg/library/system.diagnostics.processstartinfo.arguments.aspx
If you need to start multiple processes asynchronously, you'd need to first start multiple threads and then within each thread, each process is started.
Reference for this: http://www.codeproject.com/Articles/25983/How-to-Execute-a-Command-in-C
How to add arguments: http://msdn.microsoft.com/en-sg/library/system.diagnostics.processstartinfo.arguments.aspx
Tuesday, March 12, 2013
C# Getting Time Since Epoch
Many things are simpler in C# than e.g. in Java, but getting the Epoch time is an exception, and this is how it's done.
TimeSpan timeSpan = DateTime.UtcNow - new DateTime(1970, 1, 1); double currentTime = timeSpan.TotalSeconds; |
Tuesday, February 5, 2013
Ubuntu: Configuring Tomcat
Instead of hacking the startup scripts, some of the common configuration variables can be set in Ubuntu in the file "/etc/default/tomcat7"
Git Log Show File List
To list the files that were involved in each commit:
git log --name-status
References:
git log --name-status
References:
Git Checkout File From Branch
To checkout a file from a specific branch:
git checkout <branchname> <filepath>
References:
git checkout <branchname> <filepath>
References:
Friday, January 25, 2013
iOS How to Close an App
With multi-tasking, apps no longer really close when you press the home button. It stays in the background and the OS automatically closes them when the device is low on memory and when it thinks the app is unlikely to be used in the near future. To force it to close for e.g. development testing purpose, follow the instructions on this page: http://support.apple.com/kb/ht5137
Thursday, January 24, 2013
AWS DynamoDB Java API Gotcha
If you don't set the end-point, it will default to the US East Virginia region, resulting in an error saying the table can't be found.
The error message you'll get varies. If you have IAM setup to limit access for the user account to this specific DynamoDB table, then you'll get an "AccessDeniedException". Otherwise, you'll get a "ResourceNotFoundException".
If your DynamoDB is configured in the other regions, you'll have to set the End Point after creating the client e.g:
The error message you'll get varies. If you have IAM setup to limit access for the user account to this specific DynamoDB table, then you'll get an "AccessDeniedException". Otherwise, you'll get a "ResourceNotFoundException".
If your DynamoDB is configured in the other regions, you'll have to set the End Point after creating the client e.g:
client = new AmazonDynamoDBClient(awsCredentials); client.setEndpoint("https://dynamodb.ap-southeast-1.amazonaws.com"); |
AWS DynamoDB ARN for IAM
To give access via IAM to a specific DynamoDB resource, define the ARN as follows:
arn:aws:dynamodb:<region>:<accountID>:table/<tablename> |
AWS IAM Account ID
The account ID is needed to construct the ARN for IAM entries. AWS isn't being very clear about how to retrieve the account ID. It's actually the Account Number (with the hypens removed) that you see under your name in the "Manage Your Account" page (accessed via the "My Account" link in a drop down menu under your name on the top-right of the console).
Thursday, January 17, 2013
Mac Show Hidden Files in Finder
I usually don't need this feature, as I can use the Terminal to work with hidden files, but when I needed to restore some hidden files from Time Machine, I needed to get Finder to show hidden files.
Here's a couple of links showing how it's done:
Here's a couple of links showing how it's done:
Monday, January 7, 2013
iOS Simulator: View Files
If you ever need to look into the filesystem of an iOS Simulator to e.g. test file download features, here are some information as to how it's done:
Subscribe to:
Posts (Atom)