::: Stay Hungry, Stay Hlungish :::

A lightweight HTTP request class for iOS [1/2]

nfarina:

Part 1 | Part 2

image

Check out SMWebRequest on Github.

Let’s say you’re writing an app, either on iOS or the desktop, and you want to download some JSON data from a web service.

With JavaScript and jQuery, this is a one-liner:

image

Sigh, if only.

Well, technically you could do this in one line:

image

But if you do that, you’ll block the main thread until it completes, after which I will come over to your house and stab you in the face.

To perform asynchronous, cancellable HTTP requests in Cocoa, we have NSURLConnection. Now, this is a pretty nice class. It gives you a great degree of control over the lifetime of the request and for managing the incoming response data. It also handles caching and system proxy settings and global request pooling and other useful things. So we want to use it.

Read More

Via Nick Farina

Another nice pic of Saber!


99 Life Hacks to make your life easier!

shialabeowulf:

Read More

Via flynt coal

Debugging Primer

Things you may need to look for when encountering unknown bugs

  • Package manager version (npm version in package.json file, Heroku Node.js app)
  • File generator version (e.g. texture packer .pvr.ccz)
  • Data synchronization (calling [NSUserDefaults synchronize];)

How to: Get Dropbox free 5GB bonus space!

For anyone that don’t know what Dropbox is, it’s a free and awesome cloud file sync/backup service. You’ll get an initial 2GB of space and more 250MB if you completed the get started quest, or invite your friends to use Dropbox. It is great for storing files across computers. You and your friends will be able to see the files just like it is in a local folder.

The good news is, according to this forum post, Dropbox is recently launching a beta test version which will test the camera upload feature, which anyone can join and upload their photos,videos. For every 500MB you uploaded, you get 500MB of bonus space! - up to 5GB.

I think the forum doesn’t have a good example of how this whole process works, so I want to create this post to explain it.

Alright, here are the steps:

  1. Download and install Dropbox 1.3.15 here…
    Windows: http://dl-web.dropbox.com/u/17/Dropbox%201.3.15.exe
    Mac OS X: http://dl-web.dropbox.com/u/17/Dropbox%201.3.15.dmg
    Linux x86_64: http://dl-web.dropbox.com/u/17/dropbox-lnx.x86_64-1.3.15.tar.gz
    Linux x86: http://dl-web.dropbox.com/u/17/dropbox-lnx.x86-1.3.15.tar.gz Dropbox auto-import popup
  2. After install and launch, a popup will ask you if Dropbox should automatically start importing files when a device is connected. Choose “Start Import”. Don’t worry if you miss this step, just go to Dropbox Preference and enable it.

  3. Connect your device (camera, iPhone, or SD card). If they have photo or video contents, Dropbox will import them automatically.
  4. After import, you can unplug your device and wait for sync to finish. (UPDATE: or you can delete the files right away. You will still get the bonus space.)

In this case, “Import” means Dropbox will create a folder named “Camera Uploads” and it will copy all photos and videos into this folder. Syncing will start afterwards. Only files auto-imported from device to ”Camera Uploads” folder and uploaded successfully will count for bonus.

After files are imported (copied) to your computer. You can unplug your device and pause the sync. Then, you can later do it whenever you want, like during bed time or after work if you use your office’s internet.

Here are some snapshots of my increased bonus, I first have 2.2GB…
2.2gb

Then after uploading about 1.5GB, now I have 3.8GB!!! Pretty sweet eh? :D (The usage % is lower because I deleted some synced files.)
3.8GB

============================

UPDATE! This is kind of awkward after I have taken time explain all these steps. But it turns out you don’t really need to upload all the files. Just import 5GB worth of files and then delete them right away during sync will to do the trick, even though they haven’t finished uploading yet. I thought Dropbox has already fix this hole but it appears that it still works. I realize this while uploading a 2GB file, I thought the file was too big and deleted it to stop its sync in order to start syncing new smaller files. That’s when a popup comes up and tells me I got the 2GB extra space O_o!!!

============================

Now someone might have a nifty idea of throwing a DVD iso into Dropbox. But sorry, I tried and it didn’t work :P. Duplicating existing files won’t work either because Dropbox is smart enough to check that.

So, if you regularly take pictures/shoot videos with your phone of have a SD card full of vacation images, you should have no trouble finding files to upload. I am bit short of 5GB so I shoot some blank videos and upload those (lol). You can safely delete files that are already synced (files with green tick). It will not affect the bonus.

Lastly, try to not make the file too large as you get bonus after a file has finished uploading. If you upload 2GB files, you can end up waiting forever or even run out of space before getting bonus space! Anyway, this should be totally legit since the whole point of Dropbox for this beta is to test the auto-import-and-sync feature.

Have fun with your 7.25GB+ Dropbox space!

 === Reference ===

FAQ on the Photo Upload feature.

Why didn’t I get my free space for beta testing the latest forum build?
https://www.dropbox.com/help/287

Can I manage files after they have been uploaded into my Camera Uploads folder?
https://www.dropbox.com/help/288 


Custom fonts on iPad and iPhone

Just incase you didn’t realise, with iOS 3.2 (iPad) and above you can load in custom fonts and use them with a standard UIFont object.



oozoulabs:

Finally found a workaround to fill color between two lines of graph in Coreplot. Just extend the line back under it. There’s a problem when I experiment to draw one point of the line below to peak up above. The result? - the fill in gone, and when I ⌘+z back to the way it was and pun it again, the fill just doesn’t come back! I had to ⌘+z back more until it works and paste the code back. May be the Coreplot project doesn’t get compiled?

So, beware of this when you try something unusual with coreplot :))

Cheers!


Japan Expo 2010

« Click Here!

07.3 JapanExpo

LOCATION: Parc Des Exposition, France
CAMERA: Canon IXUS 95IS (Orange :)
DATE: 3 July 2010

A picture album of me visiting Japan Expo. There were so many cosplayers! เสียดายมัวแต่เดินดูร้านขายของด้านนอก ไม่ได้เข้าไปดูโชว์ในฮอล T T คนเยอะมากก ตอนกลับนี่แทบจะเหยียบกันขึ้นรถไฟกลับเลย =*= แต่ก็แซงคิวไปมิใช่น้อย ฮาๆ

ENJOY!

PS.
1. Sorry many pictures are blur. Blame my compact camera XD
2. Sorry for late post :)



Measure real-time microphone input volume in Python

Requirements:

- Python 2.6

- SWMixer with following…
PyAudio 0.2.0 (or more recent) http://people.csail.mit.edu/hubert/pyaudio/
NumPy 1.0 (or more recent) http://numpy.scipy.org/

- (Optional) OpenCV - used in example for cv.WaitKey() It has nothing to do with the program but it is for making quiting application easier.

Platform: Windows 7

Description: This uses SWMixer to get microphone input and measure its max data, or the volume of the sound at real-time. It detects sharp increase of volume and trigger the sound as a tap on the table or a snap of fingers.

import sys
import swmixer
import numpy
import cv

swmixer.init(samplerate=44100, chunksize=1024, stereo=False, microphone=True)

micdata = []
micsnd = None
vol = 0
prev_vol = 0
frame = 0

cv.NamedWindow('ESC receiver')
print 'Tap the table or snap finger near the microphone'
print 'Press ESC or Ctrl-C to stop'
try:
while True:
swmixer.tick()
micdata = swmixer.get_microphone()
micsnd = swmixer.Sound(data=micdata)
micsnd.play()
vol = micsnd.data.max() #max 32767
if vol > 12000 and prev_vol < 4000 and prev_vol != 0:
print vol, prev_vol
vol = 0
prev_vol = vol
if cv.WaitKey(1) == 0x1b:
cv.DestroyAllWindows()
break
except KeyboardInterrupt:
pass

15
To Tumblr, Love Metalab