Random posts about coding

Mostly blogging about dart.

Creating New Java Project With Cloudfoundry and Spring Source Tool

| Comments

After picking up SpringSource Tool Suite and Installing the Cloudfoundry plugins creating a new java project is painless, as long as you know which options to choose. From the New wizard you need to choose “Dynamic Web Project” Target runtime at the time of this post was “Cloud Foundry (Runtime) v1.0” and Dynamic web module version “2.5” with a Configuration of “Default Configuration for Cloud Foundry (Runtime) v1.0” The Project layout Creating a new Package and class Create a classic HelloWorld Time to extend the HttpServlet and override doGet Add entries of the servlet and servlet-mapping Add Application Start the service And you have the basic hello world from the cloud foundry samples.

Byte Client/Server for SpringFramework.NET

| Comments

Investigating using springframework.net for a project, I decided to create a quick sample of how to pass byte arrays around in a client server model. Reviewing the Spring.NmsQuickStart helped me create a sample that just passes byte arrays from a client to the server. One starting point was to get ActiveMQ running on the system, downloading the latest at the time ActiveMQ 5.5.0 Release. Unpack and launch the activemq service The administration console can be viewed from a web url http://localhost:8161/admin The project’s layout has a server, client, and shared data component. The objects that get passed between the client and server are located in ByteServer.Common. This is a very simply defined byte array object. A bat file located in the Data folder called generate-classes.bat is used to create the C# code from DataBlob.xsd. The Converters folder holds some general utility classes that help with converting and resolving type objects from xml. For the server component the sample is laid out as follows. Config data containing the configuration data for the spring framework. Handlers for handling and routing messages to the correct locations within the application. Services for defining the service interfaces. Gateways for sending service data out. A good general start is to define and implement the service interfaces before moving onto anything else. The sample defines a single call that the client can make that returns a response. Actual implementation of this interface is bind by the spring framework configuration data in ServiceStubs.xml Screen clipping taken: 4/2/2011 10:06 PM Handlers.xml is the configuration data that binds the service object to a handler object which then gets configured as a MesssageListenerAdapter in the Messaging.xml configuration. The MessageListenerAdapter is then assigned a destination “APP.DATA.BLOB.REQUEST” to consume messages that are passed on that pipe. The client application is very similar except we need a Gateway to get our messages from the client to the server and receive the return objects from the server. Config folder contains the spring framework configurations. Handlers contains the functions that handle returns from the server. Gateways contain the object that can communicate directly with the message broker for sending messages. Controller would be the objects that could be used in a MVC fashion in application development. The trickiest thing I found about using spring framework for .net was getting the configuration data correct. Besides that the data transferred is great, very fast and persistence works great in AciveMQ. Here is ByteServer.zip project, the springframework.net project need to be included or referenced.

High-Low Card Counting Strategy

| Comments

Took a ride over to Wesley Tansey’s blog and checked out the blackjack simulator project there. Decided on adding card counting strategy High-Low. I used Standford Wong’s book Professional Blackjack as a reference. Did not have great success with it, some tweaks need to be done on the betting strategies. Was only able to get a approx -4.10 to -3.07 return on 500,000 hands played. Either way, packing up the code here as a zip file that includes HighLowStrategy object or you can get the original code here. Blackjack.zip

Building and Editing Linux Kernel in Eclipse for Android Rowboat

| Comments

First off some references I used to complete this task. This was possibly the best so far http://issaris.blogspot.com/2007/12/download-linux-kernel-sourcecode-from.html Some other references also helped Ref1, Ref2, Ref3, Ref4 I had following file system layout when dealing with TI_DevKit V2.2 After you have everything imported per directions the next big step is getting the .config setup. Follow the directions on the android rowboat site for doing a first build of the linux kernel in commandline before trying to build from eclipse. This helps generate the .config file. Some additional settings needed was PATH and Build Command /home/adam/BeagleBoard/rowboat-prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

BeagleTouch on TI_Android_Froyo_DevKit-V2.2

| Comments

Liquidware’s BeagleTouch provides a nice display device for BeagleBoard developer. They provide non android linux kernel source code to jump in right away to use it. BeagleTouch blog post by will on antipastohw. Here is some crude patches to get started with it on rowboat / TI DevKit. I have my patches located on google docs: BeagleTouch.TI_Android_Froyo_DevKit-V2.2.config BeagleTouch.TI_Android_Froyo_DevKit-V2.2.patch Apply the patch accordingly and copy over the config into the kernel source tree. One issue that was noticeable from a direct patch of code was the y-axis being inverted. I corrected it with a hard coded reference value for now. This patch doesn’t help when offset loss happens in the touch screen. Looking info using tslib to capture better data settings and a linear formula for pointer calculations. Some good instructions for compiling tslib on android can be found on wenes1’s blog. A different direction to fix this issue would be to use Y_AXIS_MAX constant. [youtube=http://www.youtube.com/watch?v=8594I2NDPsM] It was hard for me to find any direct documentation on how touch screen drivers should be designed and configured in Android. If you know of any please ping me.

How to Flash New Boot Loader and Firmware Netduino Mini

| Comments

I got my netduino in the mail and whatever was flashed on it was toast, so after a few posts on the forum I got great advice on how to flash the Boot Loader (TinyBooter) and firmware (ER_CONFIG and ER_FLASH)
Erase Chip
Erase the chip by applying +5v to the gold pad located by pin 12
Download the TinyBooter
http://forums.netduino.com/index.php?/topic/621-netduino-mini-firmware-v410-update-5/
Run SAM-BA
Run the SAM-BA application from ATMEL (Note if your on windows 7 Ultimate stick with an older version of SAM-BA, do not use 2.10.)
The current package I have installed is from: Install_AT91-ISP_v1.13.exe
Power Up
Power up the netdruino by connecting the power and serial TX/RX on pin 1 & 2 (Note: make sure you have completely removed power after sending +5v to the gold pad)
Chose serial port and board
If the first time does not succeed power down and try again. And if it still does not succeed try hitting the gold pad for a second time.
If SAM-BA can communicate and get a valid id on the chip you should be presented with the following screen
Choose a file to send while in the “Flash” tab.
Click Send File. The SAM-BA application isn’t that great and locks up while sending data over the serial port. If possible just wait. This part of the process will take a while, even if you don’t see data being sent over the serial port stuff is going on.
SAM-BA will ask you if you want to “lock involved lock region(s) (0 to 2)”, I choose “No” on this.
At this point you should have succeefully flashed the Boot Loader onto the netduino mini. Click on “Compare sent file with memory” to ensure the Boot Loader did not get corrupted in the process. If everything is fine you should be presented with something similar to the following screen.
While still in the “Flash” tab execute the script “Boot from Flash (GPNVM2)” by clicking on the “Execute” button. The terminal on the bottom of the app should display “-I- GPNVM2 set”
Download and extract the firmware
http://forums.netduino.com/index.php?/topic/621-netduino-mini-firmware-v410-update-5/
Run MFDeploy.exe
Remove power from the netduino before trying to pin the device.
If you open a putty terminal and repower the device you should see the following
This should help you determine if the Boot Loader that has been flash is working.
Choose the proper COM port the netduino is on.
Try and ping
Erase
Deploy Firmware
A successful flash should look something like this
Try sending some debug commands

New Google Finance API Demo Released in C#

Download Here

Added a simple application that lets you do a complete management of your Google Portfolio from the command line. You can load an example S&P 500 CSV file, create & delete portfolios, add & remove stocks, add transactions of stocks. etc.. Try it out and have fun with it, does provide a good example of how you could create your own application using the methods in GoogleFinanceManager.cs. You might notice I use a YahooHelper.cs object, this is cause Google does not yet provide a way (or one that I know of) to resolve which exchange a ticker symbol is located. Soon will be working on another example demo that will involve WPF. If you have any problems, questions or comments please feel free to contact me directly or leave a post. Please, if you can donate some money. Even if this project does not serve anything purposeful yet, any donations can really help.


Donate to this project, it really helps a lot!

Getting All Googled Up

Creating a blog for my google finance project here. It is late and just putting some items together for this project. In the next few weeks it should take off a bit more.