Amazon S3 with Bucket Policies

I received a newsletter from amazon some hours ago with some news about S3:

[..]
We are pleased to announce beta support for Amazon S3 bucket policies, which gives customers the ability to create conditional rules for managing access to their buckets and objects. Amazon S3 customers now have the following options for restricting access to their resources:

  • Authenticated requests: Allow or deny access based on AWS account
  • Query string authentication with expiring URLs: Allow temporary access to resources
  • Request-based restrictions: Allow or deny access based on request attributes, such as HTTP referrer and IP address

With bucket policies, customers can also now define security rules that apply to more than one object, including all objects or a subset of objects within a bucket. This makes updating and managing permissions easier.
[..]

This makes S3 much more fun! You can create temporary access to resources based on a query string like session id’s.

You can restrict content to be used only within your website without external linking (HTTP referrer).

And simple group editing using security rules, just change the rules for a folder with one command instead of executing it for every file!

I like that!

More control over your own data and easier editing!


1 Comment »

  1. Travel Deals says:

    Hi I like this post and it was so informational and I am gonna bookmark it. I Have to say the Superb analysis you have done is trully remarkable.Who goes that extra mile these days? Bravo.. Just another tip you shouldget a Translator for your Global Audience !!!

RSS feed for comments on this post. / TrackBack URI

Leave a Reply

V8 vs. Spidermonkey

About a year ago I decided to go with v8js to use javascript code within php because it was so much easier to handle.

Today I benchmarked a problem related to the v8 engine and just out of curiosity I ran the same test with Spidermonkey.

A simple A/B Test:

  • A = define a JS Function and call it it in a loop
  • B = define a JS Function once and call it in a loop

The results for V8 were:

Runs 10 100 1.000 10.000 100.000
A 0.0048ms 0.0018ms 0.0159ms 0.4257ms 4.9063ms
B 0.0004ms 0.0011ms 0.0072ms 0.1733ms 1.8506ms

It was not really surprising that the one-time-definition was faster.
I tried exact the same with Spidermonkey:

Runs 10 100 1.000 10.000 100.000
A 0.0016ms 0.0276ms 0.2141ms 1.8415ms 18.483ms
B 0.0011ms 0.0039ms 0.0713ms 0.8591ms 8.4125ms


Huge difference compared to V8!


Here’s the test code:

V8 Test:


<?php
$runList = array(10, 100, 1000, 10000, 100000);
$jsFunc = 'function myTestFunc () { return {foo: "bar"}; } ';
foreach ($runList as $runs ) {
$start = mstime();
$js = new V8Js('Test');
for ( $i = $runs; $i > 0; $i-- ) {
$js->executeString($jsFunc, 'Test.Context');
$js->executeString("myTestFunc();", 'Test.Context');
}
echo "#1: " . (mstime() - $start)." ({$runs} with re-definition)<br />";
unset($js);
$start = mstime();
$js = new V8Js('Test');
$js->executeString($jsFunc, 'Test.Context');
for ( $i = $runs; $i > 0; $i-- ) {
$js->executeString("myTestFunc();", 'Test.Context');
}
echo "#2: " . (mstime() - $start)." ({$runs} without re-definition)<br />";
unset($js);
echo "<hr />";
}
function mstime() {
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}


Spidermonkey Test:


<?php
$runList = array(10, 100, 1000, 10000, 100000);
$jsFunc = 'function myTestFunc () { return {foo: "bar"}; } ';
foreach ($runList as $runs ) {
$start = mstime();
$js = new JSContext('Test');
for ( $i = $runs; $i > 0; $i-- ) {
$js->evaluateScript($jsFunc, 'Test.Context');
$js->evaluateScript("myTestFunc();", 'Test.Context');
}
echo "#1: " . (mstime() - $start)." ({$runs} with re-definition)<br />";
unset($js);
$start = mstime();
$js = new JSContext('Test');
$js->evaluateScript($jsFunc, 'Test.Context');
for ( $i = $runs; $i > 0; $i-- ) {
$js->evaluateScript("myTestFunc();", 'Test.Context');
}
echo "#2: " . (mstime() - $start)." ({$runs} without re-definition)<br />";
unset($js);
echo "<hr />";
}
function mstime() {
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}



I just wanted to share the following complaint:

WS only captures the visible part of the web page, the rest is blank.

Please fix this or I’ll have to write a scathingly negative review and give you zero stars.

(Running iOS 5 developer preview.)

Yours, [..]

Remember: iOS 5 is just a Developer preview right now (a few days old) and scheduled to be made public in the next months.

Time Machine Interval

Time Machine is a great way to backup all files and restore to any point in time, by default it creates a new backup every hour.

Normally this won’t hurt the performance but if you have many small files on your disk or huge portions of your data change very often, it will slow down the whole system.

You can change the intervals to reduce the slowdowns. To backup only every 6 hours, open your terminal and:

sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 21600

The interval is in seconds.

To setup more sophisticated schedules you can also try a free tool called TimeMachineEditor (http://timesoftware.free.fr/timemachineeditor/).

Archived Apps in XCode and where they are

Archived Apps in XCode are a great way to submit new versions to iTunes Connect because they are automatically grouped, tagged and re-signed in the process – you don’t need to manually find the compiled App, zip it & upload with the Application Loader.

If you start at a new Mac without data migration, you can simply copy the folder with all archived App versions to your new users library.

You can find it here:

/Users/<USERNAME>/Library/Application Support/Developer/Shared/Archived Applications


Or, if you develop at different Macs, symlink that folder to your Dropbox to have them accessible everywhere :-)

Analytics for iPad, Release 1.6

Today the 1.6 Update was submitted to Apple. Originally this update have been scheduled for the first week of November but was put on hold to be released with the iOS 4.2 version to have the least possible problems when everyone upgrades their iPad :-)

It contains only a few but very cool new features:


The new features are:

  • Support for Multiple Accounts – often asked for, here it comes!
  • Advanced Segments – take a better look at your reports by switching and comparing subsets of data
  • Open Reports in other Apps like iBooks – any App that supports PDF Files can receive reports for later usage
  • Print your Reports! – Support for AirPrint is now built in


Improved was the following:

  • The general speed of the website listing updates and report downloads was improved
  • Goals have now names instead of numbers


Also one bugfix is included:

  • Some users with special characters in their password had trouble logging in


In addition to the Update of the Free Version including its Premium Upgrade, there was also a full blown premium Version submitted to the store. That version is exactly the same but meant for everyone who has disabled In-App-Purchases and can’t get the premium upgrade.


2010/12/05 – Today the update hit the store, watch out for update notices in iTunes or the App Store to get it on your iPad!

Detect iPad and iPhone using Javascript

I’ve got some people asking for a simple Javascript-Detection for iPad’s.

It’s simple, just take a look at the browser identification:




Example:


It basically searches in the browser information for any occurence of “iPad” or respectively “iPhone” and returns true if found.

Here’s an example of Safari’s identification on the iPad:


Switch to our mobile site