Sunday, 28 June 2009

It came to my mind I've never made a twistable element in Flash. So I wrote one. The basics:It needs an item (descendant of the DisplayObject class) to twist. Don't forget to position this element to the point you want to twist around. (Most cases it is the center point.) My idea is when you click on the object, you store the current angle relative to center of ui element and store the current angle of the object. Then if you move your cursor, you will know the difference between the initial angle and the current angle. And you add this difference to the stored angle of the object. [It is easy, however, my english makes it hard to understand.] The interesting thing is to get the angle from a cursor position. I thought that the good old trigonometrics functions give the shade between 0 and 360 but, it came to light, I was wrong. Some recall:[http://en.wikipedia.org/wiki/Sine#Sine]A triangle with a 90 degree angle has 3 side: adjacent, opposite, hypotenuse. You can calculate the tangent alpha by division of the oposite with adjacent. Arctangent gives the reverse of tangent, so atan(tan(alpha)) = aplha. But if you make some test you realize its not the whole 360 degree (or 2PI in rad) but 2 peaces of 180. Strange, but I have never been a math guy.

Anyway, here you are my quick source. Just paste to a Flash IDE as it is and run it.

And the results were quite nice: 0.026 against 0.017. So that is why echo still rocks, because with echo you can use comma instead of period. Never heard of commas for echo before. This is a PHP magic:)

In a nutshell thats all about it. The MySQL and Apache server works as I wrote before. By the way just for play I tried the free MAMP application, but I found it a little bit old for my claims. It has a pretty cool minimalistoc control interface, works fine but doesn't contain some imprtant module. To be honest I was't bother with it so much. (My bad.)

One thing. Last week I began to use NetBeans for debugging PHP projects. The reason I didn't use it for debug I didn't know how I can examine pages other than index.php. But as a matter of fact if it starts and finish it's first debug run you can enter any subpage into the browser (the same has the xdebug session) and the debug cycle will start again. So its really cool. There is a big advantage against ViM+XDebug, I like more NetBeans's variable browser. In ViM you are restricted to the php xdebug config (ex maximum variable nested level) and the limited height of the editor. But sake of NB's tree visualizaton you can traverse arrays and objects quite convenient.(Other tiny minus sign for osx - the default key bindings messes the F2..F6 key usages in vim.)

Sunday, 14 June 2009

This morning I missed my old MySQL tables from Windows XP, but for some reason I needed separate database dumps for each db. As far as I know I've 2 options to do that, dump each db in command line or to write a script in command line. No way. So I made a quick & dirty PHP script to generate the dump commands:

Saturday, 13 June 2009

This week I've got my first Macbook. I don't want to say any advertisement for the machine. Apple already has a very ugly campaign, just check www.apple.com and watch some commercial. Anyway. I love it even if it's so hard to setup.Some quick steps, how you can setup a minimal web developer environment if you've never seen OS X.

It just an overview, it's highly suggested to read some external materials. My intention was giving a small insight what you should expect. For me (as a first-time macer) was kinda hard to setup the basic stuffs. Of course there are easier ways. If you want to find some seamless solution, just check out these projects: MAMP, Fink.

I want to write about my other experiences about the mac, but for now there are tons of works to do, so back to mac.

I used the so popular technology came up recently: augmented reality with a small difference, not there isn't any 3D magic. (But I'm thinking on it.) You can find a detailed description on the link above.

I'm a really bad blogger. First, I never write. Secondly, I never write about new stuffs. I have my reason and to be honest, I've seen too many very good article so I had to realise, it's not going to be a tech blog. I'm really curious about how my coming MacBook affects to my reading habit. I've got a lot of hope in it. And another big news for me. I'll be a proud cat holder? Call me crazy but she will be my first child. (Besides that if her teacher says she is the smartest in the class - I won't believe it:) Anyway. To restart this stuff I intend to share a small Drupal site generator script with you.

What is the problem?I'm a Drupal developer. I need to test modules before using it on production sites. I need to try out a lot of things. And the best for doing that is a Drupal sandbox. But it takes 1 or 2 minutes to create one. (At least for me.) ((It should be a Drupal install contest - yeah:))

Solution?Create a sandbox once and pre-populate it when needs a new one.