flash compilation problem : white screen

June 27th, 2010 by admin

if error “5005: Unknown error optimizing byte code” and white screen at compilation, we can increase the memory given to the compilator :

create the file ~/.MacOSX/environment.plist and copy :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>JAVA_TOOL_OPTIONS</key>
<string>-Xmx512m</string>
</dict>
</plist>

then log out for the change to take effect

with CS5 we also should modify this file : ~/Library/Application Support/Adobe/Flash CS5/en_US/Configuration/ActionScript3.0/jvm.ini
and change -Xmx128m by -Xmx512m

restart flash and it should be ok

Using a Debian Virtual Machine as local server in OS X (2)

June 20th, 2010 by admin

install debian

virtualbox preferences > network >
adapter : 192.168.3.1
dhcp server : off

settings > network :
adapter 1 : host-only adapter
adapter 2 : NAT

settings > storage :
CD/DVD : VBoxGuestAdditions

restart virtualbox

start vm

nano /etc/network/interface
auto eth0
iface eth0 inet static
address 192.168.3.3
netmask 255.255.255.0

auto eth1
iface eth1 inet dhcp

(use ifconfig -a to get the right interface name : eth0, eth1, eth2, …)

aptitude install virtualbox-ose-guest-dkms

virtualbox : settings > shared folders > add

rm -f /var/www/*

nano /etc/fstab

Sites /var/www/ vboxsf defaults,uid=33,gid=33 0 0

uid=33, gid=33 -> mount as user www-data so that apache can write to disk (file upload, etc ..)

GeekTool for Snow Leopard

May 11th, 2010 by admin

calendrier :
cal | sed "s/^/ /;s/$/ /;s/ $(date +%e) / $(date +%e | sed 's/./#/g') /"

date :
date +'%A %d %B %H:%M:%S'

OS :
echo `sw_vers -productName` `sw_vers -productVersion` `sw_vers -buildVersion`

IP externe :
echo "External :" `curl --silent http://checkip.dyndns.org | awk '{print $6}' | cut -f 1 -d "<"`

IP ethernet :
echo  Ethernet : `ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`

IP airport :
echo  Airport : `ifconfig en1 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`

Wifi :
echo wifi: `system_profiler SPAirPortDataType | grep -A 1 "Current Network Information:" | tail -1`

Top :
top -l1 -ocpu -F -R -l2 -n10 | tail -n 11 | cut -c 1-38

Using a Debian Virtual Machine as local server in OS X

May 10th, 2009 by admin

old -> updated version

This post will explain how to use a Debian virtual machine as a local server in OS X instead of the LAMP packaged by Apple.

If you’re like me and use OS X as your workstation but have a Debian production server, it could be very useful to be able to test your websites locally directly into a Debian server similar to your production one. To achieve that, we are going to install a Debian virtual machine in OS X and make them communicate by NFS. That way we will be able to develop with our favorite tool (like textmate) in OS X with our websites in ~/Sites being read by the Debian VM

1) First we need to install a VM engine (like VirtualBox) and install a Debian Linux with Apache, PHP. etc …

[EDIT]
By default the network adapter is in NAT mode and get its IP directly from your router, which means that you can’t access your VM if you’re not connected.
By using the “host-only adapter” mode you can access your VM at 192.168.56.3 (default IP, you can change that in VirtualBox preferences) with or without being connected to a network
-> “Settings / Network / Adapter 1 / Attached To” select “host-only Adapter”
[/EDIT]

[EDIT 2]
you can set up a second adapter as NAT to give internet access to the VM
-> “Settings / Network / Adapter 2 / Attached To “NAT”

and configure /etc/network/interface according :

auto eth0
iface eth0 inet dhcp
 
auto eth1
iface eth1 inet dhcp

(use ifconfig -a to get the right interface name : eth0, eth1, eth2, …)
[/EDIT 2]

2) Setup NFS export on OS X (you will need to be root for that) to allow NFS connection for the OS X user.

You need to know your user uid and gid. You can get them by typing (as your user, not as root) :

id

and you should get something like that :

uid=501(myusername) gid=20(staff)

Now setup the NFS export :

nano /etc/exports

and add this line :

/Users/myusername/Sites -network=192.168.0.0 -mask=255.255.0.0 -rw,no_root_squash,anonuid=501, anongid=20

then type

nfsd update

and

showmount -e

if the NFS export is correct you should see :

/Users/myusername/Sites              192.168.0.0

3) Now on the Debian side we create the same user (myusername, uid=501, gid=20) :

adduser myusername --home /home/myusername --shell /bin/bash --uid 501 --gid 20

and we create a folder www in myusername home folder which will be the mount point for the NFS connection :

mkdir /home/myusername/www
chown myusername: /home/myusername/www

we install portmap and nfs-common:

aptitude install portmap nfs-common

and edit /etc/fstab to automatically mount the NFS connection at boot time :

nano /etc/fstab

and add this line (machostname is the OS X hostname) :

192.168.56.1:/Users/myusername/Sites /home/myusername/www nfs user,rw,exec 0 0

reboot (the Debian VM)

after reboot is completed you should be able to access the /Users/myusername/Sites content from OS X in the /home/myusername/www in the Debian VM

ssh 192.168.56.3 - l myusername

5) configure apache

nano /etc/apache2/sites-available/default
NameVirtualHost *
 
ServerAdmin webmaster@localhost
DocumentRoot /home/myusername/www

and reload apache configuration :

/etc/init.d apache2 reload

voila, you should be able to see the website in Sites by going to the url http://192.168.56.3

PageFlip with shadows

May 7th, 2009 by admin

I took the very good PageFlip class from Didier Brun and added support for shadows. It adds 3 different shadows :

  1. one shadow on the fixed page side
  2. one shadow on the inside of the flipped page
  3. one shadow on the outside of the flipped page

It doesn’t work with the vertical mode (!ish) but works ok with the horizontal mode

demo

download source

download demo source