Mittwoch, 24. Februar 2010

("php" == 0) is true

Believe it or not but this is a feature of the language.

http://www.php.net/manual/en/types.comparisons.php
(look for the second table)

PHP automatically casts strings to number, if the boolean expression contains a number or both of the strings are containing only numbers.

So the expression ("01" == "1") is also true,
but ("0" == "php") is false.

You could use strict equal(===) to avoid this behaviour.
Which is a good idea, if you compare different types
or strings with numeric content.

You can't compare apples with oranges, because they are allways different.
But with php you can do it and even better they are equal...;-)

Labels:

Montag, 27. August 2007

Testing Websites in older Internet Explorer's

If you need to test your Websites against older Versions of Microsoft's Internet Explorer this could be the Link you need:
http://tredosoft.com/Multiple_IE
Seems not to work on Vista. So, you might want to install an virtual XP machine.

Labels: , , ,

Donnerstag, 9. August 2007

SQLFairy - The SQL Translator

I needed to convert a database schema from MySQL to SQLite and found a great tool for doing such schema conversion jobs.
# install sqlt on debian sytems with:
sudo apt-get install sqlfairy
# convert from one schema to another schema with:
sqlt -f DBI --dsn dbi:mysql:dbname --db-user root -t SQLite > sqlite.sql
The above command connects to mysql and reads the mysql schema from the connection and writes the sqlite schema to sqlite.sql. You can easily change this command for other databases. If you want to know if sqlt supports your conversion you can run:
sqlt -l
Parsers:
Access
DB2
DB2-Grammar
DBI
DBI-DB2
DBI-MySQL
DBI-PostgreSQL
DBI-SQLite
DBI-Sybase
Excel
MySQL
Oracle
PostgreSQL
SQLite
Storable
Sybase
XML
XML-SQLFairy
YAML
xSV

Producers:
ClassDBI
Diagram
Dumper
GraphViz
HTML
MySQL
Oracle
POD
PostgreSQL
SQLServer
SQLite
Storable
Sybase
TT-Base
TT-Table
TTSchema
XML
XML-SQLFairy
YAML
The Parsers are needed to read the schema and the Producers are needed to write the schema.
Links
http://sqlfairy.sourceforge.net/

Labels: , , , , ,

Sonntag, 29. Juli 2007

Capistrano multistage

Capistrano our loveliest tool has got a great plugin which allows us to easily stage releases before they going into production. So you can first deploy to testing and wait for the feedback of the QA/Project Owners and than "push the button" to deploy to production. If you need you could use more stages than testing and production.
http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage

Labels: ,

Montag, 23. Juli 2007

Capistrano 2.0 is real

Great news. Your favourite tool for automating tasks on multiple machines has released his second version. It is really an awesome tool. It makes you forget physical boundries between systems. Deploying is no pain anymore since capistrano does anything for us.

Labels: , ,

Software Project Management: Retrospectiva

I must check out this application, it looks really reasonable.
Introduction

Update
Had some troubles installing retrospectiva on my ubuntu box. The solution was to do a:
rake rails:freeze:edge TAG=rel_1-2-3
...in the retrospectiva app directory.
The source of this problem was that i have installed the rails version:
rails-1.2.3.7116 which seems not work with current stable retrospectiva version, this incompatibility is sadly not detected by retrospectivas environment.rb because the check there checks only for the major and the minor version which was corectly in my case. Otherwise everything noted in retrospectivas Quick Install Guide worked like a charm.

Update 2
This tool is awesome. Love the changeset feature, the easy setup, ticket filter and more. Can't wait to hear what non-programmers say to this easy interface.

Labels: , ,

Sonntag, 8. Juli 2007

Developing Adobe Flash Actionscript on Linux

There are some possebilities out there. But they matched not my needs. What i simply wanted ist a way to develop Actionscript 1. Yes it's true, i want to develop Actionscript 1 ;-). If it is necessary i would develop AS3 or maybe AS2 but for most my needs AS1 is the perfect choice, it's compatible with JavaScript, dynamic and has it's focus on productivity and not on overestimated aspects like type safety.

Flash 8 is my current Flash-IDE. I have tried to run it with wine but with limited success, it was very slow and buggy. So i tried to run Flash 8 from a virtual Windows XP Machine, it's not as fast as with an native Window XP but it is really fast enough to me. It seems that it's zero point three times slower.

So far so good. As an advanced actionscript coder i don't wanted to code my AS1 inside the Flash 8 IDE, because this slows my hacking workflow about factor 3 or 4 down. This is because of the integrated Editor, which is definitly not worth to work with for more than 10 Minutes. My editor of choice is SciTE or SciTE-st. But i don't wanted to code on the virtual Windows XP. I wanted to use my nicely configured Linux version SciTE-st to code my AS1. But how would i test my movies in the virtual machine, without copying Actionscript files and switching to it.

The solution is simple. I installed a ssh server on Windows XP. Installed Robin Debreuil's Flush. And here we go. I simply written a task which copies the actionscript files with scp to the virtual machine and than executes flush on the virtual machine. Flush tests the movie inside the Flash IDE. Great. The last thing to do was to configure the Editor to run this task if i hit the F5 key. So the workflow is really speeded up. No window switching any more, just edit the Actionscript and hit F5 to see movie and output in the virtual machine.

Links
Flush for Flash 8
http://www.flashfanatiker.de/blog/archives/000051.html
Original Flush Homepage
http://www.debreuil.com/flush/
The Company behind Flash
http://www.adobe.com/
Free ssh server for Window XP
http://www.freesshd.com/
Tool for automating tasks like make or ant, but with an uncircumstantial syntax
http://rake.rubyforge.org/
My favourite Editor
http://scintilla.org/SciTE.html
My favourite Version of my favourite Editor
http://caladbolg.net/scite_st.php

Tips
Configuring freeSSHd has taken some time, this is what i have done:
  1. Check the following settings in the FreeSSHDService.ini file, it contains all configuration you can also access through the ui
  2. SSHNewConsole=0 - i needed to deactivate because i had some problems executing commands via ssh, this was on freeSSHd-Version 1.2.0
  3. SSHPasswordAuth=1 - disables password authentication
  4. SSHPublickeyAuth=2 - set public key authentication to required
  5. SSHPublickeyPath=C:\SOMEPATH\ssh_public_keys - set the directory in which freeSSHd searches for files with public keys. Each file has to be named after it's user.
  6. You need to create an user within FreeSSHd, thats all

Labels: , , , , , , ,