How to hide rows in a html table the right and easy way

I came into this problem a few days ago, and tried to search Google for “JavaScript hide table rows”, what came up was abysmal to say the least. Many iterated entire DOM trees using class names for each row to toggle. Some used reg exp in class/id names.

The solution came to me when thinking “isn’t there something called row-groups”. A swift visit to w3c and it was done in 2 minutes!

The nitty-gritty:

This requires prototype, but is easily adjusted for any “ExplandorCollapse” JavaScript function.

Give table tags with ids for each group, then hide/show that id.

It so simple you wish you had thought about it yourself!

Test it here http://thefivepillars.org/hideshow.html


<table>

<tbody>

<tr>

<th colspan="3" onmousedown="$('group1').toggle();">Group 1</th>

</tr>

</tbody>

<tbody id="group1">

<tr><td>row1 col1 </td><td>row1 col2 </td><td>row1 col2 </td></tr>

<tr><td>row 2 col1 </td><td>row 2 col2 </td><td>row 2 col3 </td></tr>

</tbody>

<tbody>

<tr><th onmousedown="$('group2').toggle();">Group 2</th></tr>

</tbody>

<tbody id="group2">

<tr><td>col1 </td><td>col2 </td><td>row 1 col3 </td></tr>

<tr><td>row 2 col1 </td><td>row 2 col2 </td><td>row 2 col3 </td></tr>

</tbody>

</table>

Submitted by Olav Bringedal

How to make wikified links in php

If you are using output buffering, it’s pretty simple. Add this code at the bottom. It will parse text that are marked with [[..]] and transform it inot a link to the selected wiki page. so a text like [[wiki]] will transform into

$contents = ob_get_contents();      

$yourwikipage="/mediawiki/index.php"; 

ob_clean ( );      

$pattern = '/\[\[(([^\]]*?))\]\]/';      

// $pattern = "/&lt;&lt;(.*)&gt;&gt;/is";     

$contents = preg_replace($pattern, "</a><a href="%5C%22$yourwikipage/$1%5C%22" target="wiki">$1</a>", $contents);     

print ($contents);       

ob_end_flush();

Virkelige spill i virtuelle verdener?

Det kommer flere og flere virtuelle verdener som er styrt av sanseintrykk og interaktivitet. Vi hører om spill/verdener hvor virtuell økonomi “tas ut” i den “virkelige verdenen” og blir en inntektkilde for det “virkelige liv”. Stadig flere av disse verdenene kommer med et ferdigstøpt visuellt intrykk, og selv om de blir mer og mer enorme i omfang, virker det som man blir mer og mer lÃ¥st til konvensjonene for hver ny versjon man kj�per. Hva med virtuelle verdener basert pÃ¥ fantasi og innlevelse? De fleste vil vil vel tenke p� de s�kalte MUDS. Men dette kan være sÃ¥ enkelt som at man har et forum der man er enig om en omgangsform. Jeg har i flere Ã¥r deltatt i strategiske spill der poenget ved spillet blir st�re eller mindre grad underordnet selve innlevelsen. Dette gjelder for meg personlig to sÃ¥ forskjellige spill som “Hattrick” (http://hattrick.org) og “The Five Pilllars” (http://thefivepillars.org).

I Hattrick spiller man en fotballmanager som skal drive et lag. Målsetningen er diffus (eller rette sagt umulig), og dette er det som for meg gjør spillet fantastisk. Å rykke opp til førstedivisjon/tippeligaen er urealistisk hvis man ikke startet for tre-fire år siden, derfor lager vi middelmådige spillere være egne mål. Det kan være å få en spiller inn på landslaget, ha den største fanklubbben eller noe så sært å ha et lag med spillere med sære navn (det finnes feks et lag der alle heter Bacon til etternavn). Spillerene på laget består et dusin egenskaper som man utrolig nok gjør at man får et visuelt bilde av spilleren. Jeg ser for meg nin midtbane med excellent playmaking, weak winger og disatrous defending som en blanding av Raymond Kvisvik og Tommy Svindal Larsen. Selv om han spiller drit, vegrer jeg meg for å selge han. Selve ideen bak spillet forsvinner i et sosialt sett av relger som spillerene selv definerer.

Det samme gjelder i krigsspillet The Five Pillars. Her skal man ved hjelp av hører av diffust definerte monstre (som er definert hva tall) og detaljert ressursplanlegging av et land best�ende av tall, legge under seg mest mulig land og pÃ¥ denne mÃ¥te fÃ¥ mest mulig makt. Kun et fÃ¥tall av spillerene er gode nok til � faktisk klare � hevde seg pÃ¥ rankingen, dermed tar de egendefinerte mÃ¥l over. Her har man laug som spesiaiserer seg pÃ¥ impersonere “Riddere av det runde bord”, spanjoler som gÃ¥r bananas om man trÃ¥kker dem for nær, og laug som har gjort fullstendig uforstÃ¥elige politiske regler for sine egne medlemmer. Man har ogsÃ¥ spillere som driver utstrakt handel med artifakter, og som kun henger rundt for Ã¥ “ta ned” noen i et svakt øyeblikk.

I tillegg til dette har man lurkerene, som henger i chattekanalene uten Ã¥ spille noe særlig i det hele tatt. Spør man spillerene sier de at det er miljøet, og ikke selve spillet som er drivkraften. Er vi da undermÃ¥lere? Hva er poenget med spill nÃ¥r man ikke vinner? Man kan jo sjekke pÃ¥ en hvilken som helst søkemotor etter juksekoder for et hvilket som helst spill. Det er ikke tvil om at Ã¥ vinne et spill er en drivkraft. Men det sier seg jo selv at alle ikke kan bli best, men vi kan vel prøve. Er det dette som gjør at vi hopper pÃ¥ ethvert nytt spill med et snev av hype over seg; “Tenk om jeg er sinnsykt talentfull i dette spillet”, kan jo være en drivkraft. NÃ¥r man etter et par uker innser at man ikke er det, finner man seg et nytt spill, og dermed har man det gÃ¥ende. Spill som de jeg beskrev over, gir en annen motivasjon, man “henger rundt”, man deltar i et samfunn. Og kanskje er det det som er forskjellen. En virtuell verden er i det store og hele uinteressant uten et virtuellt samfunn. Og for noen er kanskje samfunnet viktigere enn verdenen?

How to make wikified links in php

If you are using output buffering, it’s pretty simple. Add this code at the bottom. It will parse text that are marked with [[..]] and transform it into a link to the selected wiki page. so a text like [[wiki]] will transform into

 $contents = ob_get_contents();       $yourwikipage="/mediawiki/index.php";  ob_clean ( );       $pattern = '/\[\[(([^\]]*?))\]\]/';       // $pattern = "/<<(.*)>>/is";      $contents = preg_replace($pattern, "</a><a href="%5C%22$yourwikipage/$1%5C%22" target="wiki">$1</a>", $contents);      print ($contents);        ob_end_flush();   

Submitted by Olav Bringedal

OMG launches Gaming Directory

OMG has launched a new Gaming Directory. This is a site where online games are ranked and voted on in a ladder system.

The site is made on demand from various gamers that feel that many sites like this are manipulated. We intend to follow up closely on this and make a fair ranking that reflects which games that really are popular.

We hope that you will take the time to link your game to our site, and that your game earns success in the voting!

How to make the best windows email client even better

For me Foxmail is the best email client out there. It has one drawback though. It embeds Internet Explorer as HTML renderer.

Mozillas IE patcher fixes this!

You also need a version of “mozctlx.dll”. As i use K-melon as browser it was located in my HD already. A more advanced version is: Mozilla embedded

Step by step:

-open a shell (command.com or cmd.exe)

-go to folder where mozctlx.dll is

-type in the command: regsvr32 mozctlx.dll

-if you get a little window saying “DLLregisterService in mozctlx.dll succeed” or something, you are rolling.

-open iepatcher.exe from the iepatcher.zip file

-browse to foxmail

-apply

-open moz_foxmail.exe and be happy!

How to play movies on slow computers.

How to play movies on slow computers.

Written by Olav Bringedal http://jaggu.org

ver: 0.1 (17/7-2003)

Im currently working on this document, and if you have any suggestions or corrections feel free to post them or mail me.

I would prefer that you do not spread the text of this document now, as it is so unfinished. Instead post a link to it, that way everyone get the updates.

How to play movies on slow computers.

Written by Olav Bringedal http://jaggu.org

ver: 0.1 (17/7-2003)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Copyright (c) 2003 Olav Bringedal.

Permission is granted to copy, distribute and/or modify this document

under the terms of the GNU Free Documentation License, Version 1.2

or any later version published by the Free Software Foundation;

with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

A copy of the license is included in the section entitled “GNU

Free Documentation License”.

http://www.gnu.org/licenses/licenses.html#FDL

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

0: Why this guide?

1: Minimum Hardware

2: Required Software

3: Reccomended Software

4: Conclution

5: Extra tips to try

0: WHY?

You may ask why is this guide needed, why not simply upgrade your hardware? The answer is simple. Im sick and tired of software developers adding a lot of stuff to their programs, making them harder to run around than a waterwheel for a slave in the dark ages. The general trend seem to be: Get new hardware, our new software is so big, your old PC will lag behind.

Of course i had to give in myself and buy a new PC, but I still got my old one running in my living room acting as a mp3, mpg4 player displaying on my TV. That was when my crusade started. I got a 450mhz AMD-k6, 512 MB ram and only uses the TV-out on the video-card.

1: Minimum hardware

Minimum hardware for playing movies should theoreticly be a pc with a decent pentium processor, a hard-disk and a video card able to play in decent colors in 640*480 resolution and something to show it on. This is of course not the case. To get it running in most cases, we should need a FAST CPU at least running at 1 Ghz, and a monster video-card, many of the reccomended cards are in fact cards able to run complex 3D games in the same frame rate we want our flat movie to run in…

I got an ATI Rage 128 pro in my PC. It shows DVD perfectly, so my guess it should be sufficent. My CPU is running at 450 mhz. Since I’ve silenced all my fans by reducinf voltage to 5v, for mimimum sound, I cannot run it at the 550 mhz it used to. My HD is a 1.2GB fujitsu that sounds like a plane taking off, but im hoping to buy a second hand 2,5″ 4500 rpm laptop HD soon that is virtually silent. All files is on my fast PC, so the only files on the PC is the Operating System and The Software Needed for playing the movies.

2: Required Software

You will need an Operating System. I use windows XP, as i got it with my other PC and that one runs on linux. You can of course use Linux, but that I dont reccomend unless you are quite experienced with consoles and such. I am, but I want an easy system that even my girlfriend can use and understand.

We need a decently new version of Windows, that means equal or more than windows 95, and a decently new DirectX packange. Here we need a decently new one, as the early releases are hoeplessy bugged. Version 7.5 or better is my bet.

We want a robust system without having to install/uninstall things all the time. And software used for play movies are a JUNGLE. Some come with Windows, most not. In this guide I will talk about two systems, codecs or more precisely decoders, used for playing videos. It’s not really fair to call them codecs, but since everyone else does it I’ll do too. Codecs are in general small files that are installed in the system directory on your PC. We’ll talk about the most commonly spread, DivX and XViD here.

In addition, you need something that can use those decoding files and use them to turn what looks like binary-rubbish into a movie. Again a jungle, but I’ll only talk about a neat little one called Windows Media Player ver 6.4 (this one is locaded in /program files/Windows media player/mplayer2.exe. No nosense and among the fastest around. There is also one calles BSPlayer that is lightning fast, but for me works very seldom with the codecs i’ve installed. So on my system it’s out.

3: Reccomended Software

Instead of the codecs a nice program to have is a neat little program called ffdshow, and is totally incomprehensible to understand for newbies, but install it anyway and try not to change to much of default settings. This program makes audio and video sync much better that the standalone decoders, and reduces the problems you have with sound getting several seconds ahead of the video. It is also almost as fast as the DivX and XviD.

Personally I use both XviD and ffdshow, and have deinstalled DivX as it is currently full of spyware, and when using the configuration interface it crahsed more often than not.

If you have some really heavy stuff you want to show, you might have to re-encode it. The best bet for re-encoding software is the brilliant VirtualDub ( http://virtualdub.org ). This has good documentation on its own, so I’ll not mention it anymore.

4: System optimalization

A thing to really get your old machine going is to lower your desktop resolution. In newer Windows systems lower than 800*600 is a bit tweaky, but possible (and reccomended). You use the compability wizard to set your player to trigger 640*480 or try this solution : http://support.gateway.com/s/SOFTWARE/MICROSOF/7509594/FAQ2/7509594faq11.shtml

Some say you also should reduce your colordepth. I have not seen any gain from this and suspect the ectra work in form of dithering makes up for the minimized memory usage.

When running an NT-based system (NT/2000/XP/2003), the default configuration is full of useless services and tasks that should be disabled. It is also important to have the newest drivers for your video-card as thay often are bugged when shipping.

5: colorspaces

Colorspaces are a bit of a pain, and i’m currently trying to find out which factors are involved. <<NEED more here

source: http://www.geocities.com/HWautorun/BSplayerFAQ.htm#Overlay_mode

Overlay is a nifty solution to provide quick picture composition on screen, without raising CPU load much. The GPU on your graphic board does most of the work.

Overlay can be created in different formats, i.e. color space formats.

If you're eager to learn more on that have a look here: http://www.fourcc.org/fccyuv.htm

Most important for quick overlay drawing are YUY2, YV12 and UYVY.

YV12 is the fastest AFAIK, but causes some trouble with cards which however don't properly support this format, thus image quality is decreased. For instance Matrox cards as well as NVIDIA are said to have bad driver architecture, bad overlay support.

YV12 is usefull on slow machines for MPEG4 decoding (DivX and XVid) is heavy work for

CPU, so every off-load is "good". You can try to switch it on in bsplayer trough overlay mode 1.

If you switch to bsplayer overlay mode 2, you'll get YUY2 output which is default and preferred overlay output from most players and DirectShowFilters (ffdshow!).

On modern graphic cards there ought to be no visibile difference.

Changing between those two modes is only advised if your card does not support one mode. Also it's better to not manipulate this during playback, some systems don't tolerate this and bsplayer crashes. After mode switch close player and re-open to make it store overlay initialisation info in registry.

To find out which color overlays your graphic system supports try to use Sisoft Sandra 2003.