Tuesday, February 27, 2007

Everybody loves a self explanatory error message....



...and this ain't a very good example of one, is it?

Monday, February 26, 2007

Search and Zip (revised and improved)

This is a little vbs script I wrote the other day. It's purpose is to find all log files in a given directory, create a zip archive (using 7-Zip command line interface) of each individual file (created before today, so I don't zip anything currently in use) and delete the original file.

I hope somebody else finds it useful... Although I know that someone can probably out best me with a Perl one-liner..

Here goes!

'Function: Compress and delete log files
'Description: Finds all files with the extension ".log"
'from inside the folder(s) passed as arguments, create a ".zip"
'archive with the same name and delete the original file
'Example: cscript compress.vbs d:\logs "d:\big app logs"

strComputer = "."
str7z = "C:\7-Zip\7z.exe"
i=0

If WScript.Arguments.Count = 0 then
WScript.Echo "Directory path missing. Usage: cscript zippit.vbs dir1 ""dir 2"" (etc)"
Else
'For each folder passed as an argument
For Each strArgument in WScript.Arguments
strDir = WScript.Arguments.Item(i)
Set oShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
'fiel collection inside strDir folder
Set colFiles = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='"& strDir &"'} Where " _
& "ResultClass = CIM_DataFile")
'Process monitor; will report upon closed \ finished processes
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("select * from __instancedeletionevent " _
& "within 1 where TargetInstance isa 'Win32_Process'")

If colFiles.Count >0 Then

'for each file
For Each objFile In colFiles
'only logs mater.any other file is skiped

If WMIDateStringToDate(objFile.CreationDate) > now() And objFile.Extension = "txt" Then
'compression routine
oShell.Run ""& str7z &" a -tzip """& strDir &"""\"& objFile.FileName &".zip "_
& " """& strDir &"""\"& objFile.FileName &".txt"
WScript.Echo "Created the file "& strDir &"\"& objFile.FileName &".zip "

'log deletion routine
z = 0
'wainting Loop (sleep until zip is done)
Do While z = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
If objLatestProcess.TargetInstance.Name = "7z.exe" Then
'7z process ended; i can leave the waiting loop and delete the original file
objFile.Delete
WScript.Echo "Deleted the file "& strDir &"\"& objFile.FileName &"."& objFile.Extension &" "
z = 1
Exit Do
End If
Loop

End If
Next
End if

i = i+1
Next
End If

'change date format returned by wmi_script
Function WMIDateStringToDate(dtmDate)
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & _
Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate, _
13, 2))
End Function

WScript.Quit

'as with everything else on this blog.... Creative Commons apply to this code.

Friday, February 23, 2007

my version of this week in tech

Like most geeks I spend much of my off (work) time trying out software solutions just for the sake of knowing how it works and evaluating my options.

So this week I got interested in streaming again. Apple as a good offer. You should check it out. Not only is Darwin Streaming Server free, it is also open source (well not _exactly_ open source, but you can get the source), and they offer you pre-compiled binaries for Linux and Windows.

ESR, one of my personal heroes seems to have fallen out of love for Red Hat and is currently trying to land a job with Ubuntu. Mark Shuttleworth, it has been rumored, was seen buying a one way ticket to the next space shuttle for tourists (tm). Probably no relation what so ever between these events.

Steve Balmer said that Vista's poor sales are a consequence of pirating, giving linux lovers and CTOs all around the world another reason to suspect Microsoft’s stance on security. I mean, if they can't protect their own software...

Of course that since that they're being so generous with their licensing this time, I'm sure the adoption rate will not reflect the sales figures.

Mono is now supporting native Visual Basic code in their new release.

Sarcasm mode on:
Well, Mono belongs to Novell, Novell seems to be 0wn3d by Microsoft so I'm not surprised.
Sarcasm mode off:
Really, this is great news for me and, I'm sure, to some other ex-VB addicts.

Finally, it seems that Terrasoft (Yelow Dog Linux, anyone?) is giving me another reason to buy a PS3.

Wednesday, February 21, 2007

carla, you still owe me for this one!

A friend of mine called me recently at 1 a.m. and asked me for some coding help. I had insomnia so, i agreed to help.

Two hours of phone coding later this was the best i could do. Not bad, if you consider that all i had was a pen, some paper and her telling me if the code compiled successfully and if the result was what she expected.

By the way, if you know what kind of code this is and are looking for a job, send me your CV. I might know of a job opening for you.

local desconta, cod_subsrefeicao, N

desconta = .f.
cod_subsrefeicao = 107
N = 0

if txnlevel() = 0
select prre
scan
if prre.cr = 399 or (prre.cr <350 or >364)
desconta = .t.
N = N + prre.rqtt
end if
end scan
if N >0
goto top
scan
if prre.cr = cod_subsrefeicao
scatter name myPRRE
select prre
gather name myPRRE
replace prre.rqtt with rqtt
replace prre.ere with prre.ere * 1-(n/30)
replace prre.re with ((prre.re * N) /30)
replace prre.ervu with ((prre.ervu * N) /30)
REPLACE PRRE.RVU WITH ((PRRE.RVU * N) /30)
replace prre.Lordem with prre.Lordem * 100

scatter name myPRRE
select prre
append blank
gather name myPRRE
replace prre.rqtt with rqtt
replace prre.ere with ((prre.ere * N) /30) * -1
replace prre.re with ((prre.re * N) /30) * -1
replace prre.ervu with ((prre.ervu * N) /30) * -1
REPLACE PRRE.RVU WITH ((PRRE.RVU * N) /30) * -1
replcace prre.rem with "reembolso subsidio refeicÁ„o"
replace prre.Lordem with prre.Lordem * 100

m.mxsujirs = 0
m.mvirs = 0
declare a_diff (L),a_mesano(L),a_dtsuj(L)
a_diff = 0
a_mesano= 0
a_dtsuj= 0
do prantirs with pr.no, pr.data, m.eur_def
do prproc
do prprocf
exit
end if
end scan
else
goto top
scan
if prre.cr = cod_subsrefeicao
scatter name myPRRE
select prre
append blank
gather name myPRRE
replace prre.rqtt with rqtt
replace prre.ere with prre.ere * -1
replace prre.re with prre.re * -1
replace prre.ervu with prre.ervu * -1
REPLACE PRRE.RVU WITH PRRE.RVU * -1
replcace prre.rem with "reembolso subsidio refeicÁ„o"
replace prre.Lordem with prre.Lordem * 100

m.mxsujirs = 0
m.mvirs = 0
declare a_diff (L),a_mesano(L),a_dtsuj(L)
a_diff = 0
a_mesano= 0
a_dtsuj= 0
do prantirs with pr.no, pr.data, m.eur_def
do prproc
do prprocf
exit
end if
end scan
end if
end if
return prbairro

Sunday, February 18, 2007

Vista pitch

I'm still trying to digest a discussion I had last friday at work.

I was discussing with some friends the real cost of upgrading (if possible) to Vista, and a Microsoft employee who apparently had nothing better to do but listening in on our conversation decided to offer himself to get us a discount on a Vista purchase.

I just have to tell you is sales pitch and then you tell me if I should consider his offer.

"Well, I would never buy it myself if I didn't have such a discount..."

Ok, to be honest I already made my mind to not buy it anytime soon, so i'll just tell you my answer straight up.

"Wow, then i can save my money to get a new graphics card and buy more RAM! What a nice offer. If only I really needed a new OS to _do_ the same things i do now."

Ok, so now I'm labeled as anti-Microsoft at work, which just isn't true. I'm not _anti_ anything.

I take great pride on being a Microsoft technologies specialist, and I have been using all of Microsoft's OSs since 3.11. With some notable exceptions.

Thursday, February 15, 2007

can you think of a geekier thing to do?

My favortie band is doing the geekiest promo thing to promote their upcoming album!

The plot is somewhat reminiscent of Blair Witch Project's, wich if you remeber, included TV reportings of some missing students, an audio tape found in one of the boys car and even a book with all the case documents (including interrogation transcripts and all) just before the movie was revealed. And even them some people refused to accept that it was just good publicity and some acting talent.

It started with a hidden message in the new tour t-shirts..

(can you see it?? hint: look for what seems out of place)


...that lead people to a strange web site and from there on to a series of strange web sites that can be found if if follow the recursive leads found in each one of them.

Just yesterday a story popped up all over the net (well, the right places to look for a sory like this, that is) about a lost USB thumbdrive "lost" in a bathroom after the last concert in Portugal where an mp3 file (My Violent Heart - great song!!!) was found and made it to the net. Now it gets funny... if you play the file and use a spectrographic visualization plugin (i used this one (for itunes on mac) ) you will see something like this...


(the presence!!!!)


Follow the white rabbit down this link for the full story so far.

By the way, there are some hidden images in the new album mini site. Can you find those?


Photo credits: Found all over the net, really.

Wednesday, February 14, 2007

open mindness

Today i saw a post on P* from Ivo Gomes aimed directly at the quality of work of a friend and co-worker of mine.

So i passed the link down to my friend (who will remain anonimous, because i didn't ask for his permission to name him) who read the whole article and then phoned me to say "You know, he's (Ivo) right".

That took me by surprise really, i knew he was a very cool person, but his attitude towards criticism pleasently surprised me. Good for him.

He also explained that, although he agreed with all of the points Ivo makes, some were actually due to regulations over Banking Web Sites in Portugal and others were really great points about usability that just might land Ivo (or the company were he works) some contacts in the future.

Now if this isn't Web 2.0, than i really didn't get this video.

Tuesday, February 13, 2007

18 inches of nails



This was a _GREAT_ weekend!

Nine Inch Nails were here in Lisbon for 3 nights in a row, playing at the "Coliseu", one of the best concert halls in Portugal.

I was luky enough to go to both the first and the last of the three concerts and all i can say is UAUUUUU!!!!! (and this is me being reasonably distant so i can make a serious review....)

Day 1 (February 10, 2006)
The show started with The Popo heating up the room with a competent yet somewhat boring display of atari-teenage-riotesque furios beat and rage-against-the-machine-like lyrics. They might be giants in the future, but right now they just make a good enough proof of concept.

Being the first shows of the upcoming tour, and after 7 months off stage (more one this one another post) I expected NIN to be somewhat rusty and the first (shocking) image of how fat Trent was has he entered the stage led me to believe I was going to see a decadent display of vulgarity from a former star. Images of Axel Rose at Rock in Rio were going trough my mind and they were not pleasent as you might remeber if you saw that show.

But boy, was i wrong!!

The scenario was set with over 3.000 people (ok, its just a guess) dressed in the same black that taint their souls, as lost as Ian Curtis' , screaming Trent's name.

By the end of "Terrible Lie",the lights on stage went out and this was when i realised NIN where in town for business. What might have been the only moment where something was not planned, Trent took things into his hands and shouted "We're not here to fuck around. Turn the house light on and we'll keep playing". And they did. They played "March of the Pigs" on a pit black stage. Wow.

An hour and a half of angry dark feelings and emotions, soud waves coming from a place close to the hell where the lyrics to "Hurt" were first bled, the show remarkably orchestrated by Trent and his acolytes, ended leaving a (still) full room expecting and in extasy.

There was no encore. But there were two more shows to play.

My rating : 18 out of 20
Playlist:
Mr. Self Distruct
Last
Terrible Lies
March Of The Pigs
Something I Can Never Have
The Line Begins to Blur
Closer
Burn
Wish
Help Me I'm In Hell
Eraser
La Mer
Into The Void
No You Don't
Only
You Know What You Are
Hurt
Hand That Feeds
Head Like a Hole

Day 2 (February 12, 2006)

Well this was a very special show for me for several reasons, namely:
I had my girlfrind there with me
I wasn't so hesterical to see NIN, because after all I had seen them just 48 hours earlier
It was the first concert in a more civilized Portugal

The Popo were no surprise. They played the same songs (probably the only ones they know how to...) or at least they all sounded pretty much the same. No surprises here.

As for the NIN show... Well, i never tought they would give so much for Portugal. I mean, it was the third night in a row and they played louder, more intensely that in the first day!

On a side note, I had went to the oficial site earlier that day and there was a visual reference thare to their shows in Lisbon. That felt great!



(screen capture of the nin.com front page on monday)


Back to the show now. They played the whole set with the stage lights out, using instead a light show that included strobs and other parafernalia that I can't really name.

That light game provided an even better ambiance to the show, which by itself proved even more intense, more powerfull than the first.

To my great surprise they even played a cover from Adam Ant (get down, make love) wich is a hidden track on the Burn EP.
I just love that song, and their version gives it an extra something.

Again, in under two hours of screaming, crazy feedback ridden riffs Nine Inch Nails proved to be in great shape, no matter how fat or old Trent looks right now. I bet that at this rate by the end of March he'll be back to his old fantastic shape. I just hope he can hold it together and stay clean. At least I could have sworn he was sober for the entire show.

If you missed it, do your best to see them during this tour. You will never regret it


My Rating: 20 out of 20
Playlist:
Pinion
Love Is Not Enough
Sin
Terrible Lie
March Of The Pigs
The Line Begins To Blur
Closer
Reptile
Deep
No You Don't
Even Deeper
Help Me I'm In Hell
Eraser
Fragile
All That Could Have Been
Into The Void
Wish
Make Love (Adam Ant cover!!!)
Down In It
Hand That Feeds
Head Like a Hole


Image credits:
All the images in this post are from the NIN official site and are here because I think I can use them. If you know diferent, please let me know.

Wednesday, February 07, 2007

Post em continuaçao da "conversa" com mlopes

Olá de novo caro,

Espero não te estar a maçar com os meus comentários, não é esse o meu objectivo.

Pelo que vejo a tua decisão está tomada e não haverá nada a dizer que te possa fazer mudar de opinião. Pelo que deveria desistir, mas não consigo (signo Touro...).

Vamos então fazer um jogo. Eu avanço com pontos que deves seguir enquanto concordardares. Assim que encontres um ponto que não concordes podes parar.

Acreditas que Pavlov estava errado e que haverá pessoas que repetem o mesmo erro mesmo quando são duramente penalizadas (histerectomia é uma imagem que me vem á cabeça mas também a excisão) á primeira tentativa? Há os doentes. Mas também há os psiquiatras.

Achas preferivél ver noticias ou saber de casos de abandono pós-natal, ou saber (ou ver) noticias de uma interrupção voluntária de gravidez? Nem sequer dá direito a tempo de antena, não é?

Compreendes que "71% das estatisticas são inventadas em cima do joelho"? Mais concretamente, e por exemplo:
- O nr. de IVGs em Espanha aumenta de ano para ano. Ok, e quantas das intervenções são realizadas em portuguesas? E marroquinas? E venezuelanas? E....
- Na Holanda o nr. de IVG tem vindo a aumentar. Sim, especialmente na comunidade islamica que proibe as raparigas de assitir ás aulas de educação sexual.
- O 1% dos 71% foi esta mesma estatistica. Não sou estatistico, nem matemático. Nem a maioria das pessoas que cospe numeros em programas de televisão, radio e blogs. Agora os dois primeiros pontos foram-me transmitidos por um analista (estatistico) holandês.

Acreditas que há outras maneiras de combater o aborto ilegal que não passam pela legalização? Claro que há a educação sexual (que foi prometida á 8 anos e até hoje não arrancou), há a ilegalização... mas já é ilegal. Há o combate com a perseguição (mas são os defensores do não os primeiros a dizer que o aborto é um crime sem castigo em Portugal. Se uma mulher não é condenada por abortar, então não há caso possivel contra as pessoas que fizeram esse aborto)

Quando houves dizer que uma mulher que queira abortar precisa de ser aconcelhada, percebes a profunda hipocrisia nesta frase? Como é que pode haver conselhos se só a opção de levar a gravidez pela frente é legal? Sabendo isto, quantas mulheres pensas tu que recorrem á ajuda dos psicólogos ou das instituições que existem para este efeito?
Não te parece que se souberem que, caso realmente a IVG seja uma solução legal, não haverá mais pessoas a recorrer a esta ajuda? Assim talvez se salvem vidas. E familias.

E o tráfico de crianças? Achas que a maioria das vitimas são filhos de familias que tudo fizeram para os proteger ou filhos de pessoas que não os quiseram e pior ainda, lucram com a sua venda? Há noticias de raptos e desaparecimentos todos os anos, mas se morares num bairro pobre (ou conheceres alguém que more), pergunta por isso.

Concordas que uma mulher deva ter poder de decisão sobre o seu futuro ainda que essa decisão cá contra os teus pontos de vista e principios mais básicos?
Se não concordas, liga imediatamente á primeira namorada que acabou contigo ou á primeira rapariga que te deu tampa e diz-lhe que achas ilegal o que ela fez. Poderia ter havido todo um projecto...
Se achas que depende, há muitos niveis de concordância e que talvez o que para ti não tem razão de ser, para outros pode ser um factor decisivo de toda uma vida... Há um referendo no próximo domingo que sugiro que vás (logo que saias da confissão em que pedes perdão para o caso de estares errado) e vota SIM.

Friday, February 02, 2007

new look

well, don't we all like to look our best sometimes?

As you can see i've upgraded OMOO to the new blogger and i've included a Tag Cloud (humm.. candy).

I think it looks great. Hope you like it too!