Things I discover in my programming adventures and my thoughts on tech related things.
Friday, June 13, 2014
Sunday, May 18, 2014
Update notes on Discover Meteor book
Collections
Defining the insert record code in fixture.js does not seed the database when it is empty and I'm not sure how to fix that yet.Routing
Although the routing package is no longer supported it is still available, but it didn't work out the box for me and I didn't feel like spending time to figure it out, so I switched to Iron Router instead. The routing syntax is different.- post_page.html > remove {{#with currentPost}}, use Iron Router data attribute to retrieve the post record
this.route('postPage', {
path: '/posts/:_id',
data: function() { return Posts.findOne(this.params._id); }
});
Latency Compensation
For the latency compensation demonstration to work and to take advantage of latency compensation in general the following changes are needed- post method needs to be defined on both the server and client.
- Future ret() function is now return()
----- Client Code ------
----- Server Code ------
Meteor.publish('posts', function() {return Posts.find();
});
Meteor.methods({
post: function(postAttributes) {
var user = Meteor.user(),
postWithSameLink = Posts.findOne({url: postAttributes.url});
// ensure user is logged in
if (!user)
throw new Meteor.Error(401, "You need to login to post new stories");
// ensure the post has a title
if (!postAttributes.title)
throw new Meteor.Error(422, "Please fill in a headline");
// check that there are no prevous posts with the same link
if (postAttributes.url && postWithSameLink) {
throw new Meteor.Error(302,
"This link has already been posted",
postWithSameLink._id);
}
// pick out the whitelisted keys
var post = _.extend(_.pick(postAttributes, 'url'), {
title: postAttributes.title + (this.isSimulation ? '(client)' : '(server)'),
userId: user._id,
author: user.username,
submitted: new Date().getTime()
});
if(!this.isSimulation) {
var Future = Npm.require('fibers/future');
var future = new Future();
Meteor.setTimeout(function() {
future.return();
}, 5 * 1000);
future.wait();
}
var postId = Posts.insert(post);
return postId;
}
});
-
Friday, April 18, 2014
How to Access LocalHost on an Android Emulator
To access LocalHost point your device to 10.0.2.2:[PORT NUMBER].
Enjoy testing your app on the emulator.
Saturday, April 12, 2014
Using AWS SDK For Android
Setup
- Download the Android-AWS SDK
- Unzip the downloaded package then go to the lib folder
- In the lib folder copy aws-android-sdk-[version]-core.jar and aws-android-sdk-[version]-s3.jar
- Use the mechanism your IDE has provided add these jar files and make it available in code. (For Android Studio 0.5.4, I manually added it to the app > lib folder and right clicked on the jar files and select Make Module
Coding
// Create a new S3Client with your credentials. You could get the Keys from the IAM console.
AmazonS3Client s3Client =
new AmazonS3Client(new BasicAWSCredentials("ACCESS KEY", "SECRET KEY");
// Create a PutObjectRequest. This is used to communicate with AWS and upload your file
// The KEY is the full file path to where your file should be stored on AWS.
// For example, images/category/subcategory/image_name.jpg
// The FILE is a file object that you want to upload
PutObjectRequest putObjectRequest = new PutObjectRequest("BUCKET", "KEY", "FILE");
// Now tell AWS S3 a that you want to upload an image with the specifications above.
s3Client.putObject(putObjectRequest);
// The KEY is the full file path to where your file should be stored on AWS.
// For example, images/category/subcategory/image_name.jpg
// The FILE is a file object that you want to upload
PutObjectRequest putObjectRequest = new PutObjectRequest("BUCKET", "KEY", "FILE");
// Now tell AWS S3 a that you want to upload an image with the specifications above.
s3Client.putObject(putObjectRequest);
Tuesday, April 8, 2014
Setup A Superuser Account With Password On A Postgres Database
Friday, April 4, 2014
How To Do The Secret Handshake For Enabling Developer Mode On A Samsung Galaxy S4
- Go to Settings > About device
- Scroll down to Build number
- Tap on Build number (a message should appear saying tap 3 more times to enable developer mode).
- Tap Build number 3 more times.
Thursday, April 3, 2014
Android Development Setup Instructions Using Eclipse 4.3.2 Kepler and ADT Plugin
Step 1
Go to https://www.eclipse.org/downloads/ and download Eclipse Standard. Unpackage the zip folder you download and move it the Applications folder.Step 2
After starting up Eclipse go to Help > Install New Software. Then an Available Software dialogue box will show up.Step 3
Click on the Add button and the Add Repository dialogue will show up. For the name enter ADT Plugin and for location enter https://dl.google.com/eclipse/plugin/4.3After you are done restart Eclipse.
Then you will realize that there are few more configurations that needs to be made. (1) Point to the correct location of Andriod SDK and (2) Update the JRE version to at least 1.7.0.
Step 4
Let's first point Eclipse to the correct location of the Android SDK by clicking on Open Preferences. Next click on the Browse button.Step 5
When the SDK Manager is open check off Tools and Android 4.4.2 (or the latest version) and click the Install button.
Before proceeding to install, you are prompted to accept all the license agreements for the software you are about to install.
Keep going until you wrap up the Android SDK installation.
Step 6
Now let's update the computer's JRE by going to Oracle's website.Click on Download Java Platform (JDK) 8, accept any license agreement, unpackage the download, and run the installer.
Friday, June 25, 2010
Xbox 360 Kinetic - Microsoft's Revolutionizing Moment
Nintendo 3DS - thanks for getting rid for the funky glasses
- Size (when closed):
- Approximately 5.3 inches wide, 2.9 inches long, 0.8 inches tall.
- Weight:
- Approximately 8 ounces.
- Look:
- Final design is TBA.
- Top Screen:
- 3.53-inch widescreen LCD display, enabling 3D view without the need for special glasses; with 800x240 pixel resolution (400 pixels are allocated for each eye to enable 3D viewing).
- Touch Screen:
- 3.02-inch LCD with 320x240 pixel resolution with a touch screen.
- Cameras:
- One inner camera and two outer cameras with 640x480 (0.3 Mega) pixel resolution.
- Pre-Installed Software:
- TBA
- Nintendo 3DS Game Card:
- 2 GB Max. at launch.
- Wireless Communication:
- Can communicate in the 2.4 GHz band. Multiple Nintendo 3DS systems can connect via a local wireless connection to let users communicate or enjoy competitive game play. Systems also can connect to LAN access points to access the Internet and allow people to enjoy games with others. Will support IEEE 802.11 with enhanced security (WPA/WPA2). Nintendo 3DS hardware is designed so that even when not in use, it can automatically exchange data with other Nintendo 3DS systems or receive data via the Internet while in sleep mode.
Game Controls:
Touch screen, embedded microphone, A/B/X/Y face buttons, + Control Pad, L/R buttons, Start and Select buttons, "Slide Pad" that allows 360-degree analog input, one inner camera, two outer cameras, motion sensor and a gyro sensor.
Other Input Controls:
3D Depth Slider to adjust level of 3D effect (can be scaled back or turned off completely depending on the preference of the user), Home button to call system function, Wireless switch to turn off wireless communications (even during game play), Power button. The telescoping stylus is approximately 4 inches when fully extended.
Input/Output:
A port that accepts both Nintendo 3DS game cards and game cards for the Nintendo DS™ family of systems, an SD memory card slot, an AC adapter connector, a charging cradle terminal and a stereo headphone output jack.
Sound:
Stereo speakers positioned to the left and right of the top screen.
Battery:
Lithium ion battery details TBA.
Languages:
TBA
Parental Controls:
Parental controls similar to the Nintendo DSi system will be included.
YouTube Video
YouTube Video
New Apple iPhone 4 released and many new advances
Today Steve Jobs has finally released the iPhone 4 after months of "leaks" (if that is what they are
calling marketing these days). In addition to the new iPhone, Apple has also announced a wave of new
aggressive business installments for the iPhone 4, such as iMovie, FaceTime, and NETFLIX. This is very
smart on Apple's part because they made their phone not only more capable, but there are also offering
services that will utilize the new capabilities.
They are able to optimize their software with their hardware, which gives them the capability to have
these intense functionality on the iPhone 4 making it very attractive to consumers. Microsoft on the
other hand went the software route was able to lead technology market for a long time because they
were able to get their products out cheap since they did not do hardware, but that is all changing now
because consumers cares about functionality, which Microsoft is unable to offer.
Tech Overview
The iPhone 4 features:
iPhone 4 will be launched for the Verizon network. With these new changes and updates to the
hardware:
Today Steve Jobs has finally released the iPhone 4 after months of "leaks" (if that is what they are
calling marketing these days). In addition to the new iPhone, Apple has also announced a wave of new
aggressive business installments for the iPhone 4, such as iMovie, FaceTime, and NETFLIX. This is very
smart on Apple's part because they made their phone not only more capable, but there are also offering
services that will utilize the new capabilities.
They are able to optimize their software with their hardware, which gives them the capability to have
these intense functionality on the iPhone 4 making it very attractive to consumers. Microsoft on the
other hand went the software route was able to lead technology market for a long time because they
were able to get their products out cheap since they did not do hardware, but that is all changing now
because consumers cares about functionality, which Microsoft is unable to offer.
Tech Overview
The iPhone 4 features:
iPhone 4 will be launched for the Verizon network. With these new changes and updates to the
hardware:
- Entire stainless steel rim is the antenna
- Glass front and back panels
- 960 x 640, 326 pixel per inch display
- 800:1 contrast ratio
- IPS Technology screen
- Front facing camera
- Rear facing camera with LED flash
- iOS 4 allowing multitasking on iPhones
- iMovie on iPhone 4
- NETFLIX for the iPhone coming this summer
- Adobe Flash ads on iPhone and iPad - Adobe knows flash is becoming obsolete, so they are trying to get the most out of flash while they can.


















