Ahot's weblog

Tuesday Aug 26, 2008

I've just updated some of my old entries (added syntaxhighlighter plugin).
And what I see? www.planetsun.org is filled with all of them.
I'm famous!
This is the simplest way to be on the top. Just change a letter in your old post.
Crazy logic :)

Wednesday Aug 20, 2008

Want to turn this boring code-view to something more exciting?
#include "stdio.h"

//main function
int main(int argc, char *argv[]) {
    printf("Hello world\n");
	return 0;
}
How do you like this? Here we have code highlighting, line tracking and line numbers:
#include "stdio.h"

//main function
int main(int argc, char *argv[]) {
	printf("Hello world\n");
	return 0;
}
All you need is just one line of javascript.
[html]:
<PRE id=codeview style='border:1px solid black;background:#FFFFCC;'>
#include "stdio.h"

//main function
int main(int argc, char *argv[]) {
    printf("Hello world\n");
	return 0;
}
</PRE>

[javascript] (it's realy only one long line):
<SCRIPT>

document.getElementById('codeview').innerHTML=
"<OL style=margin-top:0px;margin-bottom:0px;>"+
("\n"+document.getElementById('codeview').innerHTML).
replace(/\t/g, "    ").
replace(/ /g, " ").
replace(RegExp("(\"[^\"]*\")","g"), "<font color=green>$1</font>").
replace(RegExp("//([^\n]*)","g"), "<font color=red>//$1</font>").
replace(RegExp("(\\n| |#|\\()(int|return|include|char)", "g"), 
"$1<font color=blue>$2</font>").
replace(RegExp("\n","g"), "<LI style=background:white; "+
"onmouseover=this.style.background='#EEEEFF' "+
"onmouseout=this.style.background='white'>") +
"</OL>";

</SCRIPT>

You should understand, this is just an example. Syntax highlighting will not work with any source code. At the moment there are a lot of solution. For example:

Saturday Nov 24, 2007


Do you know math game life?
Here is 3d version. I wrote this program in 2003. And it still looks fun.
You can edit field, pause life-process to view current result from different points.
It works on Win+directx8 platforms.
Download.

Wednesday Sep 12, 2007

It's not need to install Miranda IM, Mozilla Thunderbird, Apache now.
All of them can work from usb-flash!

I remember the time. It was a problem to show workable web-site.
Especially if web-site uses cgi and database. And you have no notebook...
Now it's easy. USB-flash is not so expensive :)

Solution is here: http://portableapps.com.

<< Total entries: 39

FEEDS:

BOOKMARKS:

This blog copyright 2009 by ahot