06 April, 2009

VirtualHost on Leopard

Here's how I created a virtual host on my Mac OS X 10.5.x.
1. Start with 'hosts' file, might be located at /private/etc/hosts. Add following line:
127.0.0.1    your.virtual.host

2. Add virtual host to Appace. Open file /private/etc/apache2/extra/httpd-vhosts.conf and add:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
<virtualhost *:80 >
DocumentRoot "/Users/username/Sites/mark-kirby"
ServerName mark-kirby.dev
</virtualhost>

26 March, 2009

https certificate hassle

Have you ever found yourself banging your head agenst the wall because you just can't make Java trust some https certs. Heres how I did it last time:

1. start with getting server certificates
run: openssl s_client -showcerts -connect [domain_name]:443

2. srom the result copy parts from -----BEGIN CERTIFICATE----- to -----END CERTIFICATE----- (included) and paste it to text file (pem).

3. now add those certs to your java keychain
run: keytool -keystore $JAVA_HOME/bin/lib/security/cacerts -import -file [file_name] -alias [cert_alias]

And there you go!

23 December, 2008

metaflac - good tool for changing flac tags

following example adds cd cover art to your flac files:
find . -name "*.flac" -exec metaflac --import-picture-from {} \;

14 December, 2008

flac & crappy id3 tags

There are many music players which can normally play flac files. But in real life, those applications do not recognize some flacs. In most cases, the reason is very simple: this "not recognizable" flacs are containing additional id3 tags. Id3 tags are little bit different from vorbis tags that are used in flac files normally.
Fixing this kind of problems is quite simple by removing id3tags from flacs. It can be done with linux command line tool.
For example, following command finds all flac's from current directory (and subdirectories) and removes id3tags from them:
find . -name "*.flac" -exec id3v2 --delete-all {} \;

25 February, 2008

Adobe Air

1. Download free adobe Flex 3 SDK (http://www.adobe.com/products/flex/)

2. Extract and put bin directory into PATH

3. Create new file:

----- MyFirstAir-app.xml-------


<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://ns.adobe.com/air/application/1.0">
<id>eu.siilbek.janno.HelloWorld</id>
<version>0.1</version>
<filename>MyFirstAir</filename>
<initialWindow>
<content>MyFirstAir.swf</content>
<visible>true</visible>
<systemChrome>none</systemChrome>
<transparent>true</transparent>
<width>400</width>
<height>200</height>
</initialWindow>
</application>


4. Create new application file:

-----MyFirstAir.mxml----------
<?xml version="1.0"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" title="Hello World">
<mx:Style>
WindowedApplication
{
background-color:"0x999999";
background-alpha:"0.5";
}
</mx:Style>
<mx:Label text="Who is the bich now?" horizontalCenter="0" verticalCenter="0"/>
</mx:WindowedApplication>

5. Compile the stuff (this creates MyFirstAir.swf):

amxmlc MyFirstAir.mxml

6. Test it:
adl MyFirstAir-app.xml

7. And do the rest until you are bored. Only good reason for doing Air is that it looks "nice". Otherwise "USE JAVA"

30 November, 2007

Make iSync to support K530i cellphone

I recently got myself a new Sony Ericsson cellphone (not too fancy but still a new model). Guys form the EMT store doesn't know anything about Mac so they couldn't promise me then K530i will sync at all. So toke the challenge and purchased it anyway.
When I first started iSync and tried to add new device, it found my phone, but alerted me that this model is not supported. And the solution was more simple than I could imagine - just need to modify some XML and iSync gets smarter. Hit was on the blog http://www.bermione.be/2006/09/20/isync-a-sonyericsson-k510i-please/. Although the article was about K510i, the same approach worked for K530i. All you need to do is replace model number. Works like a charm.

To make it more simple:

Open file: /Applications/iSync.app/Contents/PlugIns/ApplePhoneConduit.syncdevice/Contents/PlugIns/PhoneModelsSync.phoneplugin/Contents/Resources/MetaClasses.plist

Add text:

<key>com.sony-ericsson.K530</key>
<dict>
<key>Identification</key>
<dict>
<key>com.apple.gmi+gmm</key>
<array>
<string>Sony Ericsson+Sony Ericsson K530</string>
</array>
</dict>
<key>InheritsFrom</key>
<array>
<string>family.com.sony.ericsson.syncml-phones-2005.bt</string>
</array>
<key>Services</key>
<array>
<dict>
<key>ServiceName</key>
<string>com.apple.model</string>
<key>ServiceProperties</key>
<dict>
<key>AlternativeNames</key>
<string>K510i</string>
<key>ModelIcon</key>
<string>SEK750.tiff</string>
<key>ModelName</key>
<string>K530</string>
</dict>
</dict>
<dict>
<key>ServiceName</key>
<string>com.apple.synchro</string>
<key>ServiceProperties</key>
<dict>
<key>NbrEmailPerContact</key>
<integer>3</integer>
</dict>
</dict>
</array>
</dict>

24 August, 2007

Handling error messages using AOP and annotations

http://www.thearcmind.com/confluence/display/SHJFT/Handling+error+messages+using+AOP+and+Annotations