New Comments


0
So man, you are doing so serious shit out here :) I gotto learn some too :)
avatar

turalo

  • June 7, 2010, 2:43am
0
Awesome Job on the Virtual Appliance.
Thank you for taking the time and effort.

Would love to talk with you about building other appliance and working together.

-James
VirtualBoxImages.com
avatar

VirtualBoxImages

  • June 6, 2010, 7:12am
+1
Well. Gary I don't know, but I think that this second example will work only with MySQL database. And you haven't written in which database this should work. I am shure that this won't work in SQL Server. I have checked in SQL Server manual msdn.microsoft.com/en-us/library/ms177523.aspx and I haven't found this kind of syntax you hav written.

I've got one better example of UPDATE ;)



update 
    gracze 
set
    drewno = drewno + drewno_kop * 2 + s.drewno
    ,kamienie = kamienie + kamienie_kop * 2 + s.kamienie
    ,krysztal = krysztal + krysztal_kop * 2 + s.krysztal
    ,siarka = siarka + siarka_kop * 1 + s.siarka
    ,klejnoty = klejnoty + klejnoty_kop * 1 + s.klejnoty
    ,rtec = rtec + rtec_kop * 1 + s.rtec
    ,zloto = zloto + zloto_kop * 1000 + s.zloto
from
    (
        select
            sum(ps.drewno) drewno
            ,sum(ps.kamienie) kamienie
            ,sum(ps.krysztal) krysztal
            ,sum(ps.siarka) siarka
            ,sum(ps.klejnoty) klejnoty
            ,sum(ps.rtec) rtec
            ,sum(ps.zloto) zloto
            ,ps.id_gracza
        from
            (
                select
                    id_gracza
                    ,sum(zloto_plus) zloto
                    ,sum(drewno_plus) drewno
                    ,sum(kamienie_plus) kamienie
                    ,sum(krysztal_plus) krysztal
                    ,sum(rtec_plus) rtec
                    ,sum(klejnoty_plus) klejnoty
                    ,sum(siarka_plus) siarka
                from
                    bohaterowie
                group by 
                    id_gracza
                
                union 
                
                select
                    b.id_gracza
                    ,sum(a.zloto) zloto
                    ,sum(a.drewno) drewno
                    ,sum(a.kamienie) kamienie
                    ,sum(a.krysztal) krysztal
                    ,sum(a.rtec) rtec
                    ,sum(a.klejnoty) klejnoty
                    ,sum(a.siarka) siarka
                from
                    bohaterowie b
                inner join
                    bohaterowie_artefakty ba
                on
                    ba.id_bohatera = b.id_bohatera and ba_pozycja < 15 and ba_pozycja > 0
                inner join
                    artefakty a
                on
                    a.id_artefaktu = ba.id_artefaktu
                group by
                    b.id_gracza
                
                union
                
                select
                    m.id_gracza
                    ,sum(case 
                        when 
                            m.glowny_budynek = 1 
                        then 
                            500
                        when 
                            m.glowny_budynek = 2 
                        then 
                            1000
                        when 
                            m.glowny_budynek = 3 
                        then 
                            2000      
                        when 
                            m.glowny_budynek = 4 
                        then 
                            4000
                        end) zloto
                    ,sum(mz.drewno) drewno
                    ,sum(mz.kamienie) kamienie
                    ,sum(mz.krysztal) krysztal
                    ,sum(mz.rtec) rtec
                    ,sum(mz.klejnoty) klejnoty
                    ,sum(mz.siarka) siarka
                from
                    miasta m
                inner join
                    magazyny_zasobow mz
                on
                    mz.typ_miasta = m.typ_miasta
                group by
                    m.id_gracza                    
                
                union
                
                select
                    id_gracza
                    ,0 zloto
                    ,0 drewno
                    ,0 kamienie
                    ,sum(case
                            when
                                magiczny_staw = 1 
                            then
                                2
                            else
                                0
                        end
                        )krysztal
                    ,0 rtec
                    ,0 klejnoty
                    ,0 siarka
                from
                    miasta      
                group by
                    id_gracza   
            ) ps
        group by
            ps.id_gracza
    ) s
where
    s.id_gracza = gracze.id_gracza


avatar

jmail

  • May 29, 2010, 6:08am
0
tnx for comments, I will post smth about ruby soon, I'm playing now with cherokee webserver + python
avatar

t0lkman

  • April 29, 2010, 5:47am
+1
Thanks, interesting.
Waiting for more complicated stuff.

What about Ruby?
avatar

paker

  • April 29, 2010, 4:17am
+1
Useful case, thanks!
avatar

tapin13

  • April 29, 2010, 1:33am
0
I liked more this…


function dump(arr,level) {
	var dumped_text = "";
	if(!level) level = 0;

	//The padding given at the beginning of the line.
	var level_padding = "";
	for(var j=0;j<level+1;j++) level_padding += "    ";

	if(typeof(arr) == 'object') { //Array/Hashes/Objects
		for(var item in arr) {
			var value = arr[item];

			if(typeof(value) == 'object') { //If it is an array,
				dumped_text += level_padding + "'" + item + "' ...\n";
				dumped_text += dump(value,level+1);
			} else {
				dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
			}
		}
	} else { //Stings/Chars/Numbers etc.
		dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
	}
	return dumped_text;
}

avatar

t0lkman

  • March 18, 2010, 11:43am
0
Nice tool
avatar

t0lkman

  • January 21, 2010, 10:36am
0
I've just read about it, almost half a million people were died…
avatar

EvgenyM

  • January 14, 2010, 3:23pm
-1
Where photos ;]?
avatar

t0lkman

  • January 13, 2010, 12:34am