23rd Nov, 2009

iPhone: TYTMobile

Screenshots

podcast twitter
podcast

Updates

I’ve put the code on google code.  You can get it from svn:

svn checkout http://tytmobile.googlecode.com/svn/trunk/ tytmobile

Hopefully someone can take it and either use it personally, expand it, or post on the app store. If you wish to contribute directly to the repository please let me know and I’ll grant you access.

Happy Coding!

You may have read about the Calendar bug that allows an applet to leave its normal privileges and engage in local privileges. This mainly effects Mac OS X due to their unpatched version of Java. Basically, it allows someone to run any Java code on the a client’s computer they wish just by the client visiting their url. I won’t go into the details how it works, you can read up on the proof of concept blogs here:
http://slightlyrandombrokenthoughts.blogspot.com/2008/12/calendar-bug.html
http://landonf.bikemonkey.org/
http://blog.cr0.org/2009/05/write-once-own-everyone.html

I got curious how this works, but no source code was available so I gave it a shot. So I now have a proof of concept and some source code to share. You can visit the proof of concept url here: http://www.therareair.com/javaexploit. If the exploit effects you, you can find a new directory on your desktop “Hi”.

The source code can be found here: Source Code

When I get more time I can maybe comment how it works and what files do what. Pretty sure you can figure it out with the source though.

That’s it.
Happy coding!

This tutorial will show how to setup an Icefaces development environment in Eclipse for Jboss 5.0. I will be using the newest GM versions of Icefaces (1.7.2-SP1), Eclipse (3.4.2), and Jboss (5.0.1).

Download the Stuff

First, lets get Icefaces here. Notice we will not be downloading the libraries, as they are included in the Eclipse Plugin.

Next lets download Eclipse here. Note you will need to have a Java JDK installed. You can get that here.

Lastly, lets get the Jboss Application Server here.

Install Applications

Extract all three of these somewhere. I extracted them into C: as seen here:

Open eclipse and goto the help menu->Software Updates… From here hit the Available Software tab. Click the add site button and then the Local… button. Direct it to where you extracted the Icefaces Eclipse Plugin. Should end up looking like this:

Click install and agree to the terms. It will install and restart Eclipse. Last thing before we get started is to add our server. In Eclipse goto the Window menu->Preferences. Expand Server->Runtime Environment. Click Add… Expand Jboss and select Jboss v5.0. Click next and browse to where you extracted Jboss.

Create Icefaces Project

We are now ready to start creating a new Icefaces project. Goto the file menu->New->Dynamic Web Project. Give it a project name. Set the Target Runtime to the server we created in the last step. You can leave Dynmaic Web Module version at 2.5 Changed the configuration to an Icefaces Project.

Click Next. Change Content Directory to ‘web’ since this is more popular.

Click Next. Select Server Supplied JSF radio button. Deploy only the Icefaces Libraries as Jboss AS has the rest already included. Including the others will throw errors when you deploy your web application. You can leave the rest. Click Next and Finish.

You now have have your project created. Before we can start developing, one more thing to configure. We need to add a line to the faces-config.xml in the WEB-INF folder. Without it you will receive errors when deploying. Your face-config.xml should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<application> 
	<view-handler> 
		com.icesoft.faces.facelets.D2DFaceletViewHandler 
	</view-handler> 
</application> 
</faces-config>

After making the changes save the file.

Test if it Works

We are now ready to add a new test page. Right click on the web folder and New->JSP. Lets name the new file ‘test.jspx’. Click Next. Select New IceFaces JSPX File (.jspx).

Click finish. We can now deploy and test if it works. Right click the project and select Run As->Run on Server. It should already be set to the server we created earlier:

You can click next and make any configuration changes if you wish. Click finish when you are ready. Notice it will open to the default root. Open a browser and enter this url if you used the same configurations as I did (default).

http://localhost:8080/IcefacesTutorial/test.iface

If everything worked as expected you should have received this page:

Hope this helped. If you got lost or just want to check out the files, here is the Eclipse project used in the tutorial. Happy coding!

This is a tutorial to show how to compile Google Chrome on Leopard.

Download and Install Google Depot Tools

First thing you need to do is get gClient, a tool in Google’s Depot Tools. This will help download/sync the latest source code for Chrome. Open a terminal:

cd Desktop/
svn co http://src.chromium.org/svn/trunk/tools/depot_tools/ depot_tools

This will create a folder ‘depot_tools’ on the desktop. Move this somewhere you like. I move this folder into /usr/bin by hitting ‘command-shift-g’, navigating to /usr/bin and dragging this new folder in there. You will probably need to authenticate as well. You will need to add this to the $PATH as well. You do this by going to the terminal:

sudo nano /etc/bashrc

Add: export PATH=$PATH:/usr/bin/depot_tools and exit and save. Quit the terminal.

Download and Compile Google Chrome

After you have installed Depot Tools the gClient command should now work. Open up a terminal:

mkdir chrome
cd chrome
gclient config http://src.chromium.org/svn/trunk/src
gclient sync

If it is your first time downloading the source it could take a while so grab a drink… Later updates you can just run the sync (last command) and it is fairly quick. After it has completed downloading go to the the terminal:

cd src
cd build
xcodebuild -project all.xcodeproj -target All

You can also open the all.xcodeproj in Xcode if you wish. After it is complete you will notice a ‘Chromium.app’ in the xcodebuild directory in the chrome folder. That’s it. Happy Coding!

This is a quick tutorial to show you how to minimally compile a version of the openssl and crypto libraries for the iPhone.
 

Download and Configure OpenSSL

First thing to do is grab the openssl source.  You can get that here.  I’ll be using openssl-0.9.8i for this demo.  Unzip this file (mines on the desktop).  Open up a terminal and go to the unzipped folder and run the default configuration.  The argument passed is where your ‘make install’ will place the compiled libraries. You should replace this with your path.

cd Desktop/openssl-0.9.8i
./config --openssldir=/Users/airpard/Desktop/openssl_arm/

Edit the Makefile

Next thing to do is open up the make file.  This is named “Makefile” in the current directory you should already be in with the terminal.  Here are the list of changes to make:

Find CC= cc and change it to:
CC= /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0
 
Find -arch i386 in CFLAG and change it to:
-arch armv6
 
Find CFLAG and add to the BEGINNING!!:
-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk
 
Find SHARED_LDFLAGS=-arch i386 -dynamiclib and change it to:
SHARED_LDFLAGS=-arch armv6 -dynamiclib

Fix Build Error

If you build it at this point you may have noticed a build error. To fix this open up ui_openssl.c. This is located in openssl-0.9.8i/crypto/ui/ folder. If you have a text editor with line numbers, head down to line 403. Otherwise do a text search to make this change:

static volatile sig_atomic_t intr_signal;
to 
static volatile int intr_signal;

Save your changes and you should now be able to build with no errors.

Build Libraries

make
make install

That’s it. You’ll notice that everything was moved to the path provided in step 1 when configuring openssl. Remember to add the include folder to your Xcode project. Also, remember these libraries are only built for the iPhone and will not work in the simulator. You can change all the armv6 references to i386 and build it again if you choose to. Happy Coding!

Examples

Some people had some questions about how to use the libraries in an Xcode project. Here is a simple xcode project including just the linking of the libraries and adding of the header files: openssl_tutorial

For the lazy people.  Compiled libraries: compiled_libraries

Install LLVM/Clang (Optional)

This tutorial is to show how to use the clang static analyzer tool to automatically find bugs in your objective-c code. I am going to show you the long but probably better off way by first installing llvm and clang then installing the tool. Lets get started.
First thing first, go to http://clang.llvm.org/get_started.html and read up if you wish.  Otherwise here we go. Open a terminal and svn a current version of llvm down:

svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm

Next lets configure and make llvm:

cd llvm
./configure; make

This will take a minute to build. After it’s completed lets get clang:

cd tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang

After this has been downloaded we need to build this as well:

cd clang
make

From here I like to install llvm and clang into the command line:

cd ..
cd ..
sudo make install

Now llvm libraries are installed. We need to install clang now:

cd tools
cd clang
sudo make install

Clang should be installed now, so lets test it. Quit the terminal and open a new one and try this:

clang --help

If everything worked you get something like this:


Install the Clang Analyzer Tool

Yes, we didn’t actually need these things installed to use the static tool but it’s nice to have. So now for the static analyzer tool. You can find a download link here: http://clang.llvm.org/StaticAnalysis.html. After you’ve downloaded the zip unzip it. Find a place to put these files. I personally like it in the /usr/bin but it’s up to you. Since, I’m doing the demo I will use that. So first lets create a directory there:

cd /usr/bin
sudo mkdir objc-analyzer

Then just drag the files from the zipped folder in there. So it should something like this:

Almost done, we need to set the bash path to look here. Simply open the bash profile and export the new path like such:

sudo nano /etc/profile

And add this to the bottom:

PATH=$PATH:/usr/bin/objc-analyzer/
export PATH

Save it and quit the terminal and open a new one. The analyzer should be working now. Test it by typing:

scan-build

If everything worked as planned you get some output:


Run the Clang Analyzer Tool

Now we are ready to move on to the fun easy stuff. Find an old project with a lot of bugs and go there in the terminal, clean the project first (yes you need to do this every time), and run scan build. It was recommended to always use it on the “Debug” configuration.

cd /workspace/EyeConsoleCD
scan-build xcodebuild -configuration Debug clean
scan-build -V xcodebuild -configuration Debug

This should run and open the report if any bugs were found (-V automatically opens scan-view which opens the report). Here is what it found in my project:

Whoa lets take a look at that leak:

No way a real bug :)

Anyway, hope that helped and thanks for reading. Here’s the picture tutorial if you don’t like reading.

This Java application can check your ip from any machine that supports Java v6.0. I use v6.0 for the system tray options, you could take this out to use it for older versions if need be.

Basic Features:
- Get outside IP address
- Optionally email a list of provided addresses when change occurs
- Check ip address every hour/min
- Hide in system tray

Version Notes:
v5.2b
- Added Port to SMTP.
- Added SSL Support to SMTP.
- Better resend button.
- Authentication button bug fixed.

Project Files: IP Change Notifier v5.2b – 09/27/08

Categories