Testing pastie.org embed
How does Google 2010 looks in msie3?

Google 2010 in msie 3.0
Just for fun... but believe me, it looks better than Bing. :)
How to Make an HTML5 iPhone App
This is nice. An article on SixRevisions, short version here for my Archive.
If you write a couple meta tags, your html5 app will look like any other iPhone App, but will also work on Android, PalmPre, etc...
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <link rel="apple-touch-icon" href="iphone_icon.png"/> <link rel="apple-touch-startup-image" href="startup.png" /> <link rel="stylesheet" href="styles.css" type="text/css" media="screen, mobile" title="main" charset="utf-8">
- apple-mobile-web-app-capable: This is another tip-off that we want to be an offline app.
- apple-mobile-web-app-status-bar-style: This hides the status bar, and nav bar when the app is offline.
- apple-touch-icon:This is the pointer to the image that want to be the icon.
- apple-touch-startup-image: This is a url pointing to the startup image.
Application Cache
Application caching allows browsers to determine in advance all the files a web page will need for the web page to work.
One tricky part to this whole thing is that the manifest (the list of files that need to be cached offline) has to be passed with a filetype Header set to text/manifest. That is why you need access to a web server that can set HTTP headers.
CACHE MANIFEST
# Version 3
style.css
index.html
init.js
# offline icons
startup.png
iphone_icon.pngOffline Data
Along with the ability to keep files that are needed offline, you can also store user data in an offline database. There are two major APIs for per user and/or per page data. The first is localStorage. localStorage, is an easy to use key-value store with a dead simple API.
localStorage.dataToStore = 5; console.log(localStorage.dataToStore); // 5
Its also possible to use a webdatabase (SQLite):
// Try and get a database object var db; try { if (window.openDatabase) { db = openDatabase("NoteTest", "1.0", "HTML5 Database API example", 200000); if (!db) alert("Failed to open the database on disk. This is probably because the version was / bad or there is not enough space left in this domain's quota"); } else alert("Couldn't open the database. Please try with a WebKit nightly with this feature enabled"); } catch(err) { } // Check and see if you need to initalize the DB db.transaction(function(tx) { tx.executeSql("SELECT COUNT(*) FROM WebkitStickyNotes", [], function(result) { loadNotes(); }, function(tx, error) { tx.executeSql("CREATE TABLE WebKitStickyNotes (id REAL UNIQUE, note TEXT, timestamp / REAL, left TEXT, top TEXT, zindex REAL)", [], function(result) { loadNotes(); }); }); }); // Insert a test Note. var note = { id: "1", text:" This is a test note", timestamp: "112123000", left:10, top:10, zIndex:2 }; db.transaction(function (tx) { tx.executeSql("INSERT INTO WebKitStickyNotes (id, note, timestamp, left, top, zindex) VALUES / (?, ?, ?, ?, ?, ?)", [note.id, note.text, note.timestamp, note.left, note.top, note.zIndex]); }); // Get all the notes out of the database. db.transaction(function(tx) { tx.executeSql("SELECT id, note, timestamp, left, top, zindex / FROM WebKitStickyNotes", [], function(tx, result) { for (var i = 0; i < result.rows.length; ++i) { var row = result.rows.item(i); var note = new Note(); note.id = row['id']; note.text = row['note']; note.timestamp = row['timestamp']; note.left = row['left']; note.top = row['top']; note.zIndex = row['zindex']; if (row['id'] > highestId) highestId = row['id']; if (row['zindex'] > highestZ) highestZ = row['zindex']; } if (!result.rows.length) newNote(); }, function(tx, error) { alert('Failed to retrieve notes from database - ' + error.message); return; }); });
Iniciando em mongoDB
Recentemente descobri o mongoDB, e como tem driver para PHP via Pecl, resolvi investigar...
Uma das primeiras coisas que me chamou atenção era a aparente falta de autenticação, controle de usuários, etc. Eis que hoje descobri como funciona:
Mais ou menos como o mySQL tem uma collection (admin) que, tendo-se usuário e senha para ele, se tem em todos os dbs do sistema. Para se ter auth, basta rodar o daemon com --auth
Em cada banco tem uma collection chamada system.users. Ex: num banco chamado projectx, tem uma collection projectx.system.users. Pra começar a autenticar, é preciso criar um usuário no banco admin (equivalente ao banco mysql):
$ ./mongo > use admin > db.addUser("theadmin", "anadminpassword")
Depois disso vai precisar autenticar para fazer ações administrativas:
> db.auth("theadmin", "anadminpassword")
Pra ver todos os usuários do sistema:
> db.system.users.find()
Criando usuários para um banco específico:
$ ./mongo > use projectx > db.addUser("joe", "passwordForJoe")
pode-se criar tb usuários somente leitura:
> use projectx > db.addUser("guest", "passwordForGuest", true)
Google barra ie6 em 2010
Recebi agora um email da GoogleApps informando que eles vão suspender o suporte à ie6 no Apps, e depois do GoogleDocs.
A partir de primeiro de março, ie6 fora. Ainda em 2010 vão barrar ie6 também para Mail e Calendar. A partir desta semana vão botar um aviso nos sites para as pessoas trocarem o navegador.
O ie6 foi lançado em 2001 (9 anos atrás) e tem conhecidas vulnerabilidades de segurança e virus. As alternativas (Chrome, Firefox, Opera) são todas gratuitas e não dependem do windows update (para quem "não pode" atualizar o windows).
Em média, depois de fazer um site fico no mínimo 30% do tempo ajustando ele para funcionar em ie6.
Como disse o Braz: "ja era hora de alguma empresa grande de internet fazer isso"
Dear Google Apps admin,
In order to continue to improve our products and deliver more sophisticated features and performance, we are harnessing some of the latest improvements in web browser technology. This includes faster JavaScript processing and new standards like HTML5. As a result, over the course of 2010, we will be phasing out support for Microsoft Internet Explorer 6.0 as well as other older browsers that are not supported by their own manufacturers.
We plan to begin phasing out support of these older browsers on the Google Docs suite and the Google Sites editor on March 1, 2010. After that point, certain functionality within these applications may have higher latency and may not work correctly in these older browsers. Later in 2010, we will start to phase out support for these browsers for Google Mail and Google Calendar.
Google Apps will continue to support Internet Explorer 7.0 and above, Firefox 3.0 and above, Google Chrome 4.0 and above, and Safari 3.0 and above.Starting this week, users on these older browsers will see a message in Google Docs and the Google Sites editor explaining this change and asking them to upgrade their browser. We will also alert you again closer to March 1 to remind you of this change.
In 2009, the Google Apps team delivered more than 100 improvements to enhance your product experience. We are aiming to beat that in 2010 and continue to deliver the best and most innovative collaboration products for businesses.
Thank you for your continued support!
Sincerely,
The Google Apps team
Python x PHP: Finding IPs with regex
Sometimes I just like to write code in Python and PHP to compare them, and admire both...
Here's a little code to find IP adressess inside strings (returned from a nslookup). The code is not optimal, but illustrate how both languages works. Just for some friday fun...
Python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> a = 'yahoo.com IN A 69.147.114.224 18774s (05:12:54)' >>> a += 'yahoo.com IN A 209.131.36.159 18774s (05:12:54)' >>> a += 'yahoo.com IN A 209.191.93.53 18774s (05:12:54)' >>> print a 'yahoo.com IN A 69.147.114.224 18774s (05:12:54)yahoo.com IN A 209.131.36.159 18774s (05:12:54)yahoo.com IN A 209.191.93.53 18774s (05:12:54)' >>>; import re >>> p = re.compile('(?:\d{1,3}\.){3}\d{1,3}') >>>; p.findall(a) ['69.147.114.224', '209.131.36.159', '209.191.93.53'] >>>
PHP
$a = 'yahoo.com IN A 69.147.114.224 18774s (05:12:54)'; $a .= 'yahoo.com IN A 209.131.36.159 18774s (05:12:54)'; $a .= 'yahoo.com IN A 209.191.93.53 18774s (05:12:54)'; print $a; /* saida: yahoo.com IN A 69.147.114.224 18774s (05:12:54)yahoo.com IN A 209.131.36.159 18774s (05:12:54)yahoo.com IN A 209.191.93.53 18774s (05:12:54) */ $re = '/(\d+).(\d+).(\d+).(\d+)/'; preg_match_all($re, $a, $matches); var_dump($matches[0]); // saida 1 var_dump($matches); // saida 2 /* saida 1: array(3) { [0]=> string(14) "69.147.114.224" [1]=> string(14) "209.131.36.159" [2]=> string(13) "209.191.93.53" } saida 2: array(5) { [0]=> array(3) { [0]=> string(14) "69.147.114.224" [1]=> string(14) "209.131.36.159" [2]=> string(13) "209.191.93.53" } [1]=> array(3) { [0]=> string(2) "69" [1]=> string(3) "209" [2]=> string(3) "209" } [2]=> array(3) { [0]=> string(3) "147" [1]=> string(3) "131" [2]=> string(3) "191" } [3]=> array(3) { [0]=> string(3) "114" [1]=> string(2) "36" [2]=> string(2) "93" } [4]=> array(3) { [0]=> string(3) "224" [1]=> string(3) "159" [2]=> string(2) "53" } } */
http://sendshack.com
Um jeito fácil, rápido, gratuito de mandar arquivos pra lá e pra cá.
Acho o uploader do mediafire.com beeeem legal, mas a decisão de fazer pastas e como apresentar o conteúdo para o visitante, complicada. Principalmente se o sujeito não fala inglês.
Este sendshack.com no entanto, é bem prático, e os anúncios não ficam pulando no teu colo.

Deletar .svn recursivamente
Desde que comecei a usar GIT acho svn clumsy... prefiro jogar os arquivos no dropbox, que ele guarda versões pra mim.
Agora resolvi detonar todos os .svn de um trabalho que estou fazendo. Chega de xalassa...
- criar um bash script básico para remover os .svn recursivos
- salvar no meu ~/bin e dar chmod +x
- rodar e ser feliz.
#!/bin/sh echo "recursively removing .svn folders from" pwd rm -rf `find . -type d -name .svn`
Como testar o novo Google
É, o google está mudando... Eles estão testando um redesign, que por enquanto está sendo mantido em segredo.
Até agora... :)
- Vá ao google.com
- Se estiver em Português, clique no Go to Google.com
- cole o código abaixo na location bar (barra de endereços) substituindo o http://google.com -
javascript:void(document.cookie="PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG;path=/; domain=.google.com"); - tecle ENTER
- feche o browser
- abra o browser
- Vá ao google.com
- Perceba os botões azuis e faça uma busca. tada!!!

Antes...

Depois
