### The beauty of Mathematics :)

01Jan09

True 🙂 However I would put physicists a bit nearer mathematicans 😉

### Solution: VS C++ 2008 “Project creation failed” bug

27Dec08

God damn. I took me about a half of an hour to Google that out…

Things to do to fix Visual Studio C++ Express (Probably in most cases you don’t have to delete those entries first. (worked for me)):

1. Go to Start -> All Programs -> Accessories -> Run, and type “RegEdit.exe”
2. Locate the following folder/key: “HKEY_LOCAL_MACHINE\SOFTWARE\Classes\VsWizard.VsWizardEngine.9.0”
3. Right click -> Permissions -> Advanced -> Owner (Should be getting alot of “No permission to do that” likely-errors)
4. Click one time on “Administrators”, then click “OK”.
5. Expand “VsWizard.VsWizardEngine.9.0”, Right Click CLSID and do the same. (Do that to all subfolders which is under “VsWizard.VsWizardEngine.9.0” aswell, if any.)
6. Right Click “VsWizard.VsWizardEngine.9.0” and click “Delete”, choose yes if you get an confirmation window.
7. Right Click “VsWizard.WizCombo.9.0” and set permissions for that folder and subfolders, and delete that one too.
8. If everything went fine, you shouldn’t have any folder called “VsWizard.WizCombo.9.0” or “VsWizard.VsWizardEngine.9.0” anymore.
9. Goto: Start-> All Programs -> Accessories, Right Click “Command Promt” and click “Run as administrator”.
10. Navigate to your Microsoft Visual Studio IDE folder, by using the “cd” command. (usually “cd C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE”)
11. Type “RegSvr32.exe VsWizard.dll”. You should get a window telling that you’ve registered that dll file (or something like that).
12. Start RegEdit.exe again (if you haven’t), and locate to “HKEY_LOCAL_MACHINE\SOFTWARE\Classes\VsWizard.VsWizardEngine.9.0”. This should have been added again.
13. Right Click -> Permissions, you should see “Administrators” and “SYSTEM” or something, click them both and enable Full Control and Read.
14. Do the same for subfolders (should’ve been done automatically), and then do it for “VsWizard.WizCombo.9.0” and subfolders, which should’ve been added again.
15. Close RegEdit.exe
16. Start the version of visual studio you have, create a new project, and watch how it works!

uff… I hate Microsoft software…

### Idealist on Google code & feature demo

20Dec08

This short video intends to show you shortly how to use IdeaList application and how can it simplify your daily time management.

IdeaList is completly free and open on GNU v3 licence.

Mobiola Screen Capture demo (not working quite well) was used to do this video so it contains some bugs. I’ve done a lot of cut’s and a speech synthesizer was used as a voice-over, so the final result doesn’t look as it was supposed to look.
I’m currently working on Wiki pages in Google code and documentation. Some new archives should be available soon too.
However I don’t know if I will be possible to simplify the installation for s60 phones. If someone have some good knowledge about those things and would like to help, please contact me.

### Method NO. 4 : The polynomial argument

19Dec08

The polynomial argument is a very useful fact which can be used in order to prove, or justify a statement.

It bases on simple fact that non-zero polynomial of k degree, can have no more than k solutions, futhermore the difference of two polynomials of k degree can also have max of k solutions if only those polynomials weren’t identical, then they have infinite numbers of solutions.

So how to use that fact?

Let me show an example, with use of extended Newtons binominal for all real numbers defined as:

${r \choose k} = \frac{r(r-1)...(r-k+1)}{(k(k-1)...(1))} \quad r \in \mathbb{R}, k \in \mathbb{N}$

We will try to prove one of it’s properties using the properties of the normal binominal and the polynomial argument.

First, the folowing equality called the rule of absoption works for all real numbers $r, k \neq 0$: ${r \choose k} = \frac{r}{k}{{r-1} \choose {k-1}}$. We will it into other form: $k{r \choose k} = r{{r-1} \choose {k-1}} \quad *$

Next you can simply check the property of symmetry of the normal binominal isn’t extendable to our extended definition of the binomial: ${r \choose k} \neq {r \choose {n-k}}$. However symmetry stays for all positive $n$ values, so will call this propetry using symbol **.

Now the proper part, we’ll prove that $(r-k){r \choose k} = r{{r-1} \choose {k}}$ for all real numbers $r$

Proof:

$(r-k){r \choose k} =^{**} (r-k){r \choose {r-k}} =^{*} r{{r-1} \choose {r-k-1}} =^{**} r{{r-1} \choose k}$

Now probably most of people would disagree, since for proving something for all real numbers I used a property which works only for the positive integers. Well they are right, the missing part is the polynominal argument: Look at the left and right part of equotation like on a polynomial of degree $k+1$ then using using the property of correctness of this theorem for infinite number of arguments $r \in \mathbb{N}$, we can tell that both of this polynomials have to be identical ■

Quite clever isn’t it?

### Limit NO. 1 : The limit points of the sin n sequence

14Nov08

The proof for the limit points of the sequence $a_n = \sin{n}$ haven’t given me a calm dream until today.

Of course the limit points of that sequence (almost intuitively) $\in [-1;1]$

Lemma.

$\mbox{There can be found a sequence } n_k \in \mathbb{N} \mbox{ such that:}$

$\lim_{k\to\infty} \lfloor n_k \rfloor_{2\pi} =\lim_{k\to\infty} n_k - \lfloor \frac{n_k}{2\pi} \rfloor 2\pi = 0$

Lemma proof.

$\lfloor n \rfloor_{2\pi} = n-\lfloor \frac{n}{2\pi} \rfloor 2\pi \quad n \in \mathbb{N}$

from floor function definition web have the following inequality:

$0 < \lfloor n \rfloor_{2\pi} < 2\pi$

Now we will prove that

$\forall_{n_0 \in \mathbb{N}} \Rightarrow \exists_{n_1 \in \mathbb{N}} \lfloor n_{1} \rfloor_{2\pi} < \lfloor n_{0} \rfloor_{2\pi}$

Let $\lfloor n_{0} \rfloor_{2\pi} = \alpha \quad \lfloor \frac{n_0}{2 \pi} \rfloor = k_0 \in \mathbb{N}$ where $\alpha \in (0, 2 \pi)$

So we have $\alpha = n_0 - 2k_0 \pi$

$n_0=2k_0 \pi + \alpha$

Let $p = \lfloor \frac{2\pi}{\alpha} \rfloor \quad p > 1$

so of course $p\alpha < 2\pi < \alpha(p+1)$

Lets consider $n_{0}(p+1) = (2k_{0}\pi + \alpha )(p+1) = 2k_{0}(p+1)\pi + \alpha(p+1) =$

$= 2k_{0}(p+1)\pi + 2\pi + \alpha(p+1) - 2\pi = 2\pi(k_{0}(p+1) +1 ) +\beta$

and look closer at $\beta$

The following is true $0 < \alpha (p+1) -2\pi = \beta < \alpha$

It’s also simple to show (for example geometricly), that we can find such $s \in \mathbb{N}$ that the following inequality is satisfied $\frac{\alpha}{2} \leq s(\alpha-\beta) < \alpha$

Now we will consider $n_{1} = n_{0} + sn_{0}p \in \mathbb{N}$

$n_{1} = 2k_{0}\pi + \alpha + s(2\pi ( k_{0} (p+1) +1)+\beta - 2k_{0} \pi -\alpha)=$

$= 2\pi(k_{0}(sp+1)+s) + \alpha -(\alpha-\beta)s$

From which $\lfloor n_{1} \rfloor_{2\pi}= 2\pi(k_{0}(sp+1)+s)+\alpha - (\alpha-\beta)s - \lfloor (k_{0}(sp+1)+s)+ \frac{\alpha - (\alpha-\beta)s}{2\pi} \rfloor 2\pi =$

$2\pi(k_{0}(sp+1)+s)+\alpha-(\alpha-\beta)s-2\pi(k_{0}(sp+1)+s)$

$=\alpha-(\alpha-\beta)s \leq \alpha-\frac{\alpha}{2}=\frac{\alpha}{2}$

And that means that for all $k \in \mathbb{N} \lfloor n_{k} \rfloor_{2\pi} \leq \frac{1}{2^k} \lfloor n_{0} \rfloor_{2\pi}$ so $\lim \lfloor n_{k} \rfloor_{2\pi} = 0$ ■

Proof.

We’ll show that $\forall_{s\in [-1,1]} \exists_{l_k\in\mathbb{N}} \lim_{k\in\infty}\sin{l_k} = s$

Lets take $\lfloor m \rfloor_{2\pi} < \beta - \alpha$ where $m \in \lbrace n_k \rbrace$ and $\alpha \in [0;2\pi), \beta \in [0;2\pi)$

Then $\exists_{k\in\mathbb{N}}{k}\lfloor{m}\rfloor_{2\pi}\in(\alpha,\beta)$ ( because the step is smaller then the range)

So when’ll take $n=mk$ then

$\sin{n}=\sin{mk}=\sin{\left(\lfloor m\rfloor_{2\pi} + \lfloor\frac{m}{2\pi}\rfloor 2\pi \right) \cdot k}=\sin{k\lfloor m \rfloor_{2\pi}}\in (s-\epsilon,s+\epsilon)$

which satisfies the limit definition. ■

### Project NO. 2 : IdeaList

02Nov08

I would like to announce that my second PyS60 project called IdeaList is near it’s first alpha release!

Today I’ve done another milestone in it’s developement and I decided to no longer keep the project secret.

So what does IdeaList do? Why did I create it?

Simply because I believe that there’s nothing more precious than time.

Do you remember the default Nokia calendar? The awful times when you’ve got to correct there something quickly, but it took minutes instead of seconds?

Do you remember the times when you’ve had a terrific idea and you’ve noted it somewhere on your phone, but then you forgot about it?

Idealist was designed to be a solution for those problems!

So how does the IdeaList differ from other time management applications?

• IdeaList is the first mobile non-colision day planner! That means the end with overlaping tasks and appointments
• IdeaList interface is done using a timeline conception, that means that you see what takes at most of your time
• Every event in IdeaList holds a referer to a todolist! That means that  you can simply checkout your project milestones by entering an event todolist, called an IdeaBox
• Every event can be stretched and moved over days visually! No need to enter exact time!
• IdeaList allows you to note your Ideas by pressing just one key!
• Idealist analyzes the day and helps you entering your idea into the calendar, by highlighting the free spaces

It’s hard to explain all that it can do and how simple it is, so in few weeks I’ll add some Video demo’s how it works.

Other features:

• Scheduled sms sending
• Visual Reminders
• Two move modes
• The background gradient changes dynamicly every hour, so it becomes darker at night and lighter in the day
• Events and Ideas are sort by categories
• Every category has it’s own color which can be adjusted by the user
• Minimalistic signal and battery indicators
• Easy key shortcuts
• ….

However still there are some small things to do…

Like:

• Showing the new message alerts
• Saving the config file
• App Icon
• Beta testing on different phones
• Sis packing and signing

and of course optimalization, which takes the most of my time right now.

### Method NO. 3 : Neat Integral

16Sep08

Today, I decided to post a very eye-catching method for calculating an integral which shows very often in Statistical Mechanics in Physics.

Let’s try to calc this $\int\limits_{-\infty}^{\infty}e^{-x^{2}} dx$

First let’s mark it with a name $K$, then

$K^{2} = \int\limits_{-\infty}^{\infty}e^{-x^{2}} dx \int\limits_{-\infty}^{\infty}e^{-y^{2}} dy = \int\limits_{-\infty}^{\infty}\int\limits_{-\infty}^{\infty}e^{-(x^{2}+y^{2})} dx dy$

What is just a double integral over the whole 2d surface. It can be also written in polar coordinate system as $K^{2} = \int\limits_{0}^{\infty}e^{-r^{2}} \cdot 2\pi r dr = \pi \cdot \int\limits_{0}^{\infty}e^{-t} dt = \pi$

What means that $K = \int\limits_{-\infty}^{\infty}e^{-x^{2}} dx = \sqrt{\pi}$

### Google Chrome for Linux w/o Wine

09Sep08

It’s all I wish for now.

I stopped using Firefox, only thing in which ff was better was my del.icio.us bookmarks integration plugin.

Looking forward with esperanza.

This post will be destructed when my dream will come true.

### Tweak NO. 2 : Fedora 9 Linux on Dell XPS M1530 with dual boot

29Aug08

After some trubles in doing dual boot and isntaling Fedora I decided to write this post so that other users won’t waste so much time as I did.

Firstly if you wan’t to have your remote control working on your XPS you don’t have to install Media Direct!

What’s more your remote will work on your Fedora as well!

So the biggest mistake you can do while reinstalling your system is to install the SHITY MEDIA DIRECT SOFTWARE!… but do not throw away the Media Direct Cd, we will need it later 😉

Here is how my installation process looked like.

1. Install Windows (I have Vista 32 bit- however I’m angry for dell for not allowing to choose the 64 bit edition)
2. While installing drivers try always do a restart after installing each driver!
3. Start installation Fedora 9 64 bit
4. Install it on a primary partition and make a SWAP partition at least the size of your RAM memory, keep on track on which partition the windows is and where linux is being installed. For example if you’ve got windows on hda/sda2 then your partition number is 2. Write does down.
5. When you’ve got the Time Setup popup uncheck the “My system has UTC time” option
6. While installing grub choose an advanced option to install it on the partition that you have linux, DO NOT CHANGE MASTER BOOT RECORD
7. Once you’ve installed Linux go to Windows (You will not be able to boot Linux yet), put the Media Direct CD in your CD Drive but do not install or run it, instead run the cmd.exe on Admin rights and type: X:\DellKit\rmbr.exe DELL Y Z where X is your Cd drive letter, Y the Windows partition number and Z the Linux partition number.
8. Boot from the Media Direct Button – Linux should start
9. Install all the updates for your system.
10. While rebooting you can have an ISSUE 1. and get the system hanged on displaing message “Decompress Linux Done. Booting the Kernel.”. to solve change the kernel argument from quiet to verbose at GRUB. Should work now
11. The Ethernet, wifi and sound should work, except the sound is set to Headphones output – try it.
12. Install the nvidia drivers.Go to http://rpm.livna.org/rlowiki/ and install livna repository rpm for Fedora 9.
13. Type yum install kmod-nvidia in console at root privileges.
14. Restart. Adjust your settings using nvidia-settings. You can turn on Desktop Effects now if you want 😉 ISSUE 2. Sometimes the selection rectangle on the desktop is running slow – try reenabling destkop effects.
15. Installing 32 bit flash player on Firefox 64 bit – download a normal rpm at adobe.com and after installing it run console at root rights and type: yum install nspluginwrapper.{i386,x86_64} libflashsupport.i386
16. Now flash player should be working properly.

I will write more about installing hardware later. Currently I’m trying to change the shity media direct logo while booting Fedora.

### Room Visualization Part 2 – Furniture and assigning Materials

27Aug08

Modeling

• I’ve measured all my furniture and I constructed it using simple boxes and cylinders objects
• Details on window frame, such as the pull

Materials

• There are two things i can be glad off, the rest is shit.
• First: the furniture glossy background. However I didn’t see the final render (I’m doing the render while writting this)
• Second the glossy handle of the window

Lights

• mr Sky Portal Settings: filter set to dark grey in order make some normal view outside the window

Rendering

• mr Photographic Exposure Control: changed preset to Daylight Indoor
• Final Gather Settings: In the main render bounces increased to 5, Image Precision: High,  Final Gather Precision: High, in other renders everything is set to low with bounces 0.

Corrects

• The window handling added to the window

Notes

• I’ve got a lot of problems in applying a proper texture such that my table doesn’t get too much highlights
• I noticed that more glossy promaterials rather than the unfinished one don’t get completly white when directing a lighting on it, so all my furniture was set to glossy even if it’s not so glossy at all in real.
• To sum up, 3ds max is great for modelling things, however when it comes to materials the issue is fimiliar to building a computer from home made parts… (materials editor in 3ds max = shit)
• It took me 7 hours to render the main scene… Moreover vista user control and system update screwed my 3dsmax a couple of time… (mad)

Open for comments and suggestions.

### Flash Labs NO.2 : Newton’s Law of Gravitation

22Aug08

It’s high time to support my physics by computers. Today I experimented with Newton’s Law of Gravitation for 3D and as far as it goes to one object it works great. However I didn’t managed to apply the force to the second object (The Sun).The movie which you can see above is a gif, cause of WordPress politics… The original animation looks much better.

Here’s my source code:

/* NEWTON'S GRAVITATION v. 0.1
The rule that makes the day and night
F = GMm/r^2

Two movieclips one called "planet" and the second called "sun" both should be exported for AS2
To get the best results get "planet" and the "sun" to the center of the movieclip
To make the planet move in third dimension I used the scale trick and I combine it with the Newton's formula.
Well we all know that Newton laws are symmetrical, so that the sun should also move a little, but I had no luck adjusting the params so I excluded it.

coder: Ranza
web: https://masteranza.wordpress.com
time: 00:26:31
*/

var sun:MovieClip = _root.attachMovie("sun","sun",1);
sun._x =  Stage.width /2;
sun._y = Stage.height /2;
sun.mass = 20;

var planet:MovieClip = _root.attachMovie("planet","planet",2);
planet.Yspeed = -0.5;
planet.Xspeed = -0.1;
planet.Zspeed = -0.2;
planet.mass = 5;
planet._x = Stage.width /5;
planet._y = Stage.height /2;
planet.onEnterFrame = _root.PlanetPhysics;

function PlanetPhysics(){
//Never mind about the G 😉 the speed is just for fun 😉
sqrdistance = Math.pow(this._x-sun._x,2) + Math.pow(this._y - sun._y ,2) + Math.pow((100 - this._xscale),2);
this.Xacc = ((sun._x - this._x)/Math.sqrt(sqrdistance)) * this.mass * sun.mass / sqrdistance;
this.Yacc = ((sun._y - this._y )/Math.sqrt(sqrdistance)) * this.mass * sun.mass / sqrdistance;
this.Zacc = ((100 - this._xscale)/Math.sqrt(sqrdistance)) * this.mass * sun.mass / sqrdistance;
this.Xspeed += this.Xacc;
this.Yspeed += this.Yacc;
this.Zspeed += this.Zacc;
this._x += this.Xspeed;
this._y += this.Yspeed;
this._alpha = this._xscale = this._yscale += this.Zspeed ;

//The objects which are closer have to be on top
if (this._xscale > 100){
this.swapDepths(2);
}
else{
this.swapDepths(1);
}
}


By the way, I’ve invented a logo, shortly I will explain it’s symbolic meanings.

### Room Visualization Part 1 – Walls and Padding’s

13Aug08

Writing everything on this blog has a lot of positive sights. Firstly I can easily and quickly find any information that I need, due to excellent tag system. I don’t have to worry (at least I believe so :P) about the safety of my data, cause there are not in my drawer or even hard drive. Furthermore those data can be useful for someone who is reading my blog (is there anybody? ;)) and is interested in the topic…

Playing around with 3dsmax last days (and waiting long for the renders :P) I decided to document the progress of my work.

Everything started from an urge to project a char handler which would carry my phone… I tried autoCAD, but it seemed to much effort to learn it and then I reminded myself that I’ve been experimenting with 3d studio max from my early childhood. When I turned 3dsmax again I felt so fascinated with its possibilities that I instantly changed my mind – I decided to do the whole my room in it.

Yes, I’m a beginner I’ve never tried to do realistic scenes before, but I’ve got time (lots of time since I’ve injured my leg unluckily), so don’t get my work too serious.

In all parts of this article I will try to use the same scheme to keep it clear. They will all start from a few pictures of the room from different angles with a short labels what I wanted to show.

Secondly it will contain a few categories, such as Modeling, Materials, Lights, Rendering and Corrects in which I will sum up my progress, on the end of each I will probably write some Notes… Let’s Blast Off!

Modeling

• I’ve measured my room walls and done a accurate model of them with a cut’s in places where the wall color changes.
• Window frame (A handle is still missing)
• Window sill

Materials

• I think that I’ve done the walls good enough, I mean that the color fits the original one and floor material too. However I can’t stop the wall from reflecting the color of the floor.
• Temporary I’ve assigned a material to the sill and to the window frame.
• I used the Max default ProMaterials, adjusting a little preferences mainly by enabling the Stain Application and changing the default texture.

Lights

• I used Max’s Daylight System and allowed him to enable Final Gather. I created also a mr Sky Portal on the window’s glass surface. The compass was set as in my real location and the time was switched to 12:17 13.08.2008
• mr Sun Settings: default
• mr Sky Portal Settings: increased Multipler to 1,5 and Shadow Samples to 64

Rendering

• Exposure Control: changed to mr Photographic Exposure Control
• mr Photographic Exposure Control: Exposure Value (EV) changed to 10,5
• Final Gather Settings: Bounces increased to 5, Image Precision: Medium,  Final Gather Precision: Low

Corrects

• I’ve put all things in separate layers like furniture, lightning, walls etc..

Notes

• I enabled the viewport background to see the the lightning changes directly in viewport.
• There’s still 99% of work before me… I think that the biggest problem will be to do the proper materials and maps for my models. I wished to apply here some automatics too, for example to make a bed that changes to a sofa as I have in my room.
• I don’t render the scene at full settings cause there not much done yet so i don’t want to waste to much time. However the rendering of the Interior took me 17 minutes :]

Open for comments and suggestions.

### Hardware Review NO. 2 : Nokia BH-503

09Aug08

Wires are the real scourge of our times and I suppose that everybody look at them with disgust, but is there any good substitute for them?

The answer is Blutooth 2.0. If you’re curious if it really does the job, read this article.

### Hardware Review NO. 1 : Dell XPS M1530

07Aug08

If you are about to buy a notebook computer this post can become helpful for you, because it’s about one of sleekest and fastest machines available in shops*.

I decided to write this review because the one that I read on the Internet doesn’t go over the reality test.

Specification:

• Processor: Intel Core 2 Duo Processor T8300 (2.4 GHz, 3 MB L2 cache, 800 MHz FSB)
• RAM Memory: 3 GB DDR 2 (667mhz)
• HDD: 320 GB (7200 rpm)
• Graphics Card: NVIDIA GeForceTM 8600M GT 256MB DDR3
• Disc Drive: Nagrywarka DVD DUAL 8x Slim
• Screen: 15.4″ Wide Screen (1280 x 800)TrueLifeTM
• Operating system: Microsoft Windows Windows VISTA Ultimate
• Ethernet | wifi: LAN 10/100 MB | 802.11 n
• Others: remote, HDMI, FireWire

First impresion.

### Flash Labs NO.1 : Famous Matrix Code- Binary

03Aug08

Today I finally started the experiments with Adobe Flash AS2 and here comes my first experiment.

All that’s needed is a black background and a movieclip called “code” exported for AS with a little green dynamic text area named “inside”.

Change the number of frames per second to 120 and copy this code to the first frame on the main timeline.


/* MATRIX BINARY CODE v. 0.1
You'll need: black background, movieclip "code" exported for AS, dynamic text "inside" inside the "code" movieclip
coder: Ranza
web: https://masteranza.wordpress.com
time: 00:09:26
*/

//function which varies the brightness
function setBrightness(col:Color, brightness:Number):Void {
var anum:Number = 100 - brightness;
var bnum:Number = 255 / 100 * brightness;
col.setTransform( {ra:anum, ga:anum, ba:anum, rb:bnum, gb:bnum, bb:bnum, aa:100, ab:0} );
};

var colMin:Number = 0;        // min brightness
var colMax:Number = 50;        // max brightness
var colVariance:Number = colMax - colMin;
var chars:Array = ["0","1"]
var depth:Number = 0;
var lastx:Number=0;
var chainlen:Number=0;
var lastspeed:Number =0;

//function which randomizes color
function nooCol(Void):Number {
return colMin + Math.random() * colVariance;
}

onEnterFrame = function(){
if (Math.floor(Math.random() * 1) == 0) { //how often to create new movieclips
depth++;
var noo:MovieClip = _root.attachMovie("code", "code" + depth, depth);
noo.inside.text = chars[Math.floor(Math.random()*chars.length)];
var col:Color = new Color(noo);
setBrightness(col, nooCol());
//the part responsible for creating chains
if (Math.floor(Math.random() * 10) == 0){
noo._x = Math.random()*Stage.width;
noo._y = -10;
chainlen = 0;
noo.speed = Math.random() * 3 + 1;
lastspeed = noo.speed;
}
else{
chainlen++;
noo._x = lastx;
noo._y = -10 - (noo._height*chainlen);
noo.speed = lastspeed;
}
lastx = noo._x;
noo.onEnterFrame = _root.flow;
}
}
//this function which was handled the onEnterFrame event makes our code move
function flow(){
this._y += this.speed;
if (this._y > Stage.height) {
this.removeMovieClip();
}
}


Gosh… How big was my furry when I noticed that there’s no way to upload swf files and insert as2 sourcecode on wordpress.com … That’s why my code isn’t as colorful as it should be. Damn.

### Handful App for S60

25Jul08

I usually don’t write posts about software since I could have written about mobbler, but this time I found something that makes the jaw fall… 🙂

Yeah, I bet that every advanced s60 user tried at least once in his life an app called S60Ticker. Today stoeger it gives to our hands the new 1.05 version of it’s newest baby and I must say that the programmers have done a marvelous work. It works flawlessly and there’s so many things that have been improved since the last version which I tried that I’m really impressed. Let’s take the Pager functionality which allows you to filtrate all incoming messages in search for a given phrase and gives a special predefinied alert if it’s found!

21.07.2008 – S60TickerServer and S60TickerSetup version 1.05
• Each ticker item is now able to link to any Url – e.g. to support newsfeeds.
• Long key press “C” on mail ticker items will remove the item and mark the sms/email as read.
• Internal optimization for key capturing (hotkey).
• Ticker items with support for an unique action (see On-Action-Events) are underlined now.
• Support for scrolling manually each ticker item by pressing cursor left or right. (Cursor keys for former speed adjustment have been removed – use setup to adjust scroll speed).
• Pager: Any individual sound file can be played now. The file must be placed to C:\data\sounds\ and named to “S60TickerPagerAlarm.wav”.
• updated language files (french).
• BugFix: Option “Global > Inactivity timeout” resetted after (device) restart to 120 seconds.
• Some minor optimization.

Personaly I really like the feature to apply a skin that fits your phone theme it’s looks really awesome.

… Have I told you about the coolest thing? S60Ticker has it’s own SDK and there exists an extension for it to automaticly download the latest news from rss channels and scroll it on your mobile screen. It’s called S60NewsReader. On the screenshot you can see me scrobbling my current tracks from last.fm as an example. The extension is fully customizable and full of handful shortcuts. You may add, edit, remove and schedule your favorite feeds, which will scroll over the screen while you’re watching a movie, writing an sms or coding your project in Python and if one interests you more than others, then with exacly two button clicks you can open it detailed in browser. Freakin’ cool.

### Physics NO. 1 : The momentum of light

29Jun08

Well, everyone of us probably heard in high school (or earlier) that the photon has it’s own momentum.
And I think that more then a half of us kept wondering then about it. Namely, without deep knowledge of Physics, such statements like “light have no rest mass”, or “light is an electromagnetic wave, but it has a momentum” can be confusing, and as Richard Feynman once said – it’s an awful feeling 🙂

Here I want to explain shortly the mechanism of passing the momentum by a photon through classic physics.

Firstly, light is an electromagnetic wave which as the names says is composed from magnetic and electric field. Those two fields are perpendicular to each other and to the direction in which the wave propagates. What makes them propagate? Here my answer can be given only by those two equations:

$\nabla \times \bf{E} = - \frac{\partial \bf{B}}{ \partial t}$

$\nabla \times \bf{B} = - \mu_0 \epsilon_0 \frac{\partial \bf{E}}{ \partial t}$

Those equations mean that whenever there exists a circulation of electric field there should be created a changeable magnetic field and vice versa.

Using Maxwell equations and some mathematics we can derive the following equation $\bf{B} = - \bf{e_{r'}} \times \bf{E} /c$ wchich gives us the direct relationship between the electric and the magnetic field!

Now lets assume that an electric field is vertically positioned in space and the magnetic field horizontally. What happens when an electromagnetic wave passes an electron? The electric field of the electromagnetic wave makes it swing back and forth in the vertical direction what leads the electron to create a new electromagnetic wave in every perpendicular direction to it’s movement. That’s *exactly how the reflection of the light works!

Hold on, but what does the magnetic field of the electromagnetic wave to the electron? Well, I suppose that everyone remember the famous Lorentz Force $\bf{F}= q\bf{v} \times \bf{F}$.The Lorentz force keeps affecting the electron only when it’s in movement, and it is when the electric field affects it. Both fields work then together, but in what direction affects the Lorentz force? In the direction of light propagation. Though when light go over an charged object, which starts to move in the reaction of the affecting field, then a pushing force happens in the direction in which light propagates!

That forced is called the pressure of radiation now, we’ll derive the amount of that pressure. The force equals of course $F=qvB$, but because everything moves, the $\overline{F}$ is an average of force $F$. Moreover $\overline{B}=\overline{E}/c$ and the speed $\overline{v}$ is also taken an avarage, so we have $\overline{F}=q\overline{vE}/c$… but wait a minute! $\overline{qE} = \overline{F'}$ and $\overline{F'v}= \frac{dW}{dt}$ and now we can write $p=\overline{F}dt= \frac{dW}{c}.$ What’s more, from school we know that light keeps with itself energy $W=hv=\hbar \omega$ This leads us to the ultimate result $p=W/c=\hbar \omega /c = \hbar k$ where $k$ is known as wave wavenumber.

Even though we finished, there’s a tousend more things to explore, for example we can find out that $W=\hbar \omega$ and $\bf{p} = \hbar \bf{k}$ create a four-vector like the energy and the momentum in special relativity, but it’s a whole new topic… 😉

I hope you enjoied  my article, feel free to ask if anything’s unclear. I will try to help you as much as I can.

### The evolution of Python

27Jun08

It’s really inspiring 🙂

### Google Code Jam: Alien Numbers Algorithm

27Jun08

Here I’m posting the source code written in Python for the Google Code Jam Practice Problems.
The tasks is available after logging at google – in: http://code.google.com/codejam/contest/ in Practice Problems link.

I don’t consider this code to be optimal or the quickest, so I’m open for your suggestions and remarks, what could have been done better

from math import pow
print "enter the filename: "
pliczek = str(raw_input())

pierwsza=1
f=open(pliczek, 'r' )
g=open("result " + pliczek, 'w' )

for data in f:
if (pierwsza==1):
pierwsza=0
ile = 1
else:
data = data.split(' ' )
base0 = len(str(data[1]))
base1 = len(str(data[2].strip()))
dlugosc = len(str(data[0]))

liczba = 0
for i in str(data[0]):
liczba += data[1].index(i) * pow(base0,dlugosc - 1)
dlugosc-=1
liczba = int(liczba)

nowaliczba = ""
while liczba>0:
nowaliczba = str(data[2].strip())[liczba%base1] + nowaliczba
liczba = liczba/base1

g.write('Case #'+str(ile) + ': '+nowaliczba + '\n' )
ile+=1
f.close()
g.close()


by the way, I noticed some little bug in WordPress – it’s changing “‘)” to a smiley even when it’s written as a source code

### Theory NO. 3 : Geometry, tangents and angles in circle

26Jun08

The angle which arms contain chords or tangents of a circle is the half of the sum (if the verticle of the angle lies inside the circle or on it) or difference (if the verticle lies outside) of middle angles based on the curves, which set this angle.

The proof can be illustrated by following pictures which consider all the possibilities.