Monkey-X / Android – App name, version, orientation and package name.

Posted by on January 30, 2014

Certain games and applications require different screen orientation constraints as well as the obvious name, version and package differences between each other. There are also GPU flags and “MIMEs” we have to setup based on each project’s requirements, Monkey-X simplifies this by reducing the amount of resource / XML editing by allowing us to define constants in code.

The following is pretty much what I use on my main source before I begin to include libraries and the main routine:

#ANDROID_APP_LABEL			= "Your Program Name"
#ANDROID_SCREEN_ORIENTATION 		= "portrait" ' could be landscape or user which may or may not use 'sensor'.
#ANDROID_APP_PACKAGE			= "com.yourbrand.yoursubcat.yourprogramname" ' for instance:
#TEXT_FILES				= "*.txt|*.xml|*.json"
#IMAGE_FILES				= "*.png|*.jpg|*.gif|*.bmp"
#SOUND_FILES				= "*.wav|*.ogg|*.mp3|*.m4a"
#MUSIC_FILES				= "*.wav|*.ogg|*.mp3|*.m4a"
#BINARY_FILES				= "*.bin|*.dat"

By defining these constants we avoid having to edit resource files by hand or utilize extra tools / external code to perform the same action.

If you want to fully customize your Android target I suggest you create a new target to avoid modifying the defaults.

That’s all for now, Cheers!

Monkey and SVN – Auto delete .build and .svn

Posted by on January 24, 2014

Couple useful bats

These are a couple basic yet useful bat files (alright you got me, I mostly develop in Windows… but don’t judge just yet!) to wipe clean build directories and svn directories accordingly.

For wiping out the .build directory on a Monkey project (monkey-x, monkeycoder):

for /d %%x in (*.build) do rd /s /q "%%x"

.svn cleaner: (recursive)

for /r . %%a in (.) do @if exist "%%a\.svn" rd /s /q "%%a\.svn"

That’s it for now, enjoy!

Improvising a die holder for the lathe

Posted by on January 11, 2014

This is another one of those “on a pinch” deals, I had to thread small diameters and a die was the ideal option however I currently don’t have a die holder (1″) … Here’s a way to improvise by using what I call a “paper clutch”.

The concept is very simple, open your jacobs chuck all the way so the jaws are inside the chuck body, place the die on the stock and push the jacobs against the die, now, in between the die and the jacobs, place two square pieces of sandpaper, I used 600 grit without trouble. This acts as a friction clutch and will slip past a certain torque value, but it will hold for threading brass and aluminum no problem.

Remember: the tailstock is locked, but the quill isn’t. You’ll need to keep up with the quill!

Lathe Improvised Die Holder

Die holder? Who needs one? — I know, the sandpaper is in contact with the die and the chuck and if it slips it will “polish” the surface of either or both objects, however that’s a small price to pay I say…


Once you’ve arranged this madness, to begin threading use your tailstock to apply force while you turn your headstock chuck forward using your key for maximum force, depending on the pitch of the thread you’ll have to keep up rather quickly with the tailstock but it doesn’t take a lot of practice to do this…

Alternatively you can try the same method but instead once you get the thread started, you can lock the die via the toolpost using an improvised tool so it indexes with the indent on the die, however without applying force with the tailstock the die will tend to skew off center during the first threads, so beware!

To back out the die you have many options, if you used it with the adjusting screw set to the minimum, you can try setting it to the maximum to ease the tension and hopefully you can back it out by hand, otherwise you can try a piece of cloth and visegrips.

Yes, it’s die threading on the lathe “ghetto style” but it works on a pinch.

Have fun turnin’ and threadin’!





PS: I promise to clean up the lathe soon…



Reconstructing a Crosman 2100C Valve

Posted by on December 28, 2013

Crosman 2100 goes “boom”

Ever heard of “dieseling” … Me neither, until the valve blew up on me. So now what?, order a reproduction off of eBay and wait a month to get it? — End up paying more for less? … Or turn a new part out of 6061 Aluminum?

Getting the metal turnin’…

Started off with 1″ 6061 rod, I didn’t have anything closer to 3/4″ so a lot of it went to waste… All operations were performed by hand, no power feeding was used in this case.


Once the blank was turned down to size I had the option to leave the top flat for a flat cup or turn it down to a taper, like the original. I ended up turning a taper on it right after I installed it onto the body (which I then held on the chuck to perform the last operation on the valve cover)

Next time I’ll leave it flat and replace the cup with a straight one as well. Plus the flat top allows you to drill indents for tooling (installing / removal of the valve cap) whereas with the tapered cap you have no means to grip it without causing some form of damage…

The threads are 1.25mm, rather interesting finding a non imperial thread on what I would like to think is an American product. Needless to say every other part of the valve assembly was fine, except for the plastic inlet seal valve (I belive it to be PTFE, but I used Delrin/Acetal which is what I had in hand to turn a new one).

The o-ring groove was cut with a parting blade, my o-ring profiled carbide tool needed to be resharpened so I took a shortcut, the 90° edges were smoothed down with a green brillopad before installing the o-ring.

Sorry, no pictures of the finished part (I wasn’t thinking about documenting the process) But here’s the finished reconstructed valve:


New o-rings, new transfer seal. Yep I ported it while I was at it.

It’s important to clean the parts after turning them, I use ph-neutral soap and hot water. Whenever nitrile or silicone o-rings are involved, I don’t want any pretroleum based oils anywhere near them!

For lubrication always use SILICONE BASED LUBRICANTS, stay away from any other type of oil when it comes to the air path or any parts involving rubber o-rings.

Remember kids: Dieseling is bad for your toys!

Stay tuned as I convert a 1077 into bulk-fill using my own pressure tank design!

(PB) Capitalizing strings using native code

Posted by on November 10, 2013

Sometimes plain text needs to be formatted in non common ways. In this case we’ve got filenames where spaces have been converted to either “-” or “_” and each word may or may not be capitalized. The idea is to have a certain degree of uniformity on the user interface so the labels are formatted to meet these requirements.

One of the steps involved is to simply capitalize every word in the string. In this case we are also recovering the space characters prior to formatting.

We don’t know if the first character is part of a word or if it’s just a space, due to the actual requirements of this application multiple spaces are ignored and trimmed to a single instance.

To avoid using multiple string manipulation function calls, we handle all of the manipulation through low level code (without going into ASM). This way we avoid the use of Trim(), LCase(), Mid(), Left(), Right(), etc. To speed things up.

Procedure.s CapitalizeString( StringInput.s )
	Define.Character *ptr = @StringInput
	Define.s ReturnString = ""
	If *ptr
		Define.i flag_firstchar = #False
			If *ptr\c = ' ' And Not flag_firstchar ; in case the first character is a space, let's trim it.
				*ptr + SizeOf(Character)
			If *ptr\c => 'A' And *ptr\c < = 'Z' ; lower case everything
				*ptr\c + 32
			If Not flag_firstchar
				flag_firstchar = #True
				ReturnString + Chr(*ptr\c - 32)
				*ptr + SizeOf(Character)
			If *ptr\c = ' '
				flag_firstchar = #False
			ReturnString + Chr(*ptr\c)
			*ptr + SizeOf(Character)
		Until *ptr\c = #Null
	ProcedureReturn ReturnString

The routine is quite simple and allows for all kinds of modifications, since we are performing all of the string manipulation ourselves. We assume ASCII to be the input and output.

That’s all for now, just had a need for this and couldn’t find a proper function out there (only a “let’s see who can make it faster and forget about readability” war at the official forums, not very handy for real world projects).

Have fun,