ROFLMOA of the Day from the Retro-styled Game Dwarf Fortress

0

Play Dwarf Fortress.

ARMOK DEMANDS WEEKLY PROGRESS REPORTS, LEST HE FORCE YOU TO BUILD HIS MACHINATIONS WITH THE BONES OF YOUR CHILDREN! ARMOK ALSO DEMANDS A COVER SHEET!

from Reddit

A CSS Sprites Helper Tool (written in jQuery)

0

CSS Sprites are the preferred method for reducing the number of image requests. Combine your background images into a single image and use the CSS background-image and background-position properties to display the desired image segment.

References:
Best Practices for Speeding Up Your Web Site
CSS Sprites: Image Slicing’s Kiss of Death
Sourcecode (bitbucket repository)

The Helper is part of a little gaming project of mine. The interface, although bare-bone, is working fine.

1. Add the url of the image and provide the icon dimensions.
2. Press “load” (try loading a second time if the image is shown too small, little bug to fix soon).
3. Use the prefix and name field for the CSS class name.
4. Click an icon.
5. Repeat step 3 and 4 to add CSS to the text-area.
6. Copy the CSS to your own file and read the reference for further instructions … a demo of an CSS Sprites implementation can also be found here: CSS Sprite Demo

CSS Sprites Helper Tool

My wife beat me at MewMew Tower.

0

How embarrasing :)

From Blog

Adding multiple databases to the Application.ini in Zend Framework

2

application.ini

resources.multidb.db1.adapter        = "mysqli"
resources.multidb.db1.isDefaultTableAdapter = true
resources.multidb.db1.host           = "localhost"
resources.multidb.db1.username       = "xx"
resources.multidb.db1.password       = "xx"
resources.multidb.db1.dbname         = "zftutorial"

resources.multidb.db2.adapter        = "mysqli"
resources.multidb.db2.isDefaultTableAdapter = false
resources.multidb.db2.host           = "localhost"
resources.multidb.db2.username       = "xx"
resources.multidb.db2.password       = "xx"
resources.multidb.db2.dbname         = "bboard"

bootstrap.php


protected function _initDatabase ()
    {
        $resource = $this->getPluginResource('multidb');
        $resource->init();

        Zend_Registry::set('db1', $resource->getDb('db1'));
        Zend_Registry::set('db2', $resource->getDb('db2'));
    }

Use by calling:

$db = Zend_Registry::get('db1');
$result = $db->fetchAll ( "select * from mytable", array ());

See also:
http://forums.zend.com/viewtopic.php?f=69&t=5615

Reporting Live Status of Livestreams with PHP & jQuery

4

DEMO

References:
- Livestream Channel API 2.0
- Zend_Json
- jQuery Ajax
- Livestream

islive.php

<?php
/*
ini_set('display_errors', 1);
error_reporting(E_ALL);
*/

/*
 * http://framework.zend.com/manual/en/zend.json.html
 */
include_once 'Json.php';

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');

try {
	$url = '';
	switch ($_GET['name']) {
		case 'cowclan':
			$url = 'http://xcowclanx.channel-api.livestream-api.com/2.0/livestatus';
			break;
		case 'rebootgpf':
			$url = 'http://xrebootgpfx.channel-api.livestream-api.com/2.0/livestatus';
			break;
		case 'clgaming':
			$url = 'http://xclgamex.channel-api.livestream-api.com/2.0/livestatus';
			break;
	}

	function isLive($url) {
		$data = file_get_contents($url);
		$xml = new SimpleXMLElement($data);

		$nsdata = $xml->children('http://api.channel.livestream.com/2.0');

		$list = array();
		foreach($nsdata as $c) {
			$list[$c->getName()] = (string)$c;
		}

		return $_GET['callback'].'('.Zend_Json::encode($list).')';
	}

	if (!empty($url)) {
		echo isLive($url);
	} else {
		echo $_GET['callback'].'('.Zend_Json::encode(array('error'=>'404')).')';
	}
} catch (Exception $e) {
	echo $_GET['callback'].'('.Zend_Json::encode(array('error'=>'503')).')';
}

$err = error_get_last();
if (!empty($err)) {
	echo $_GET['callback'].'('.Zend_Json::encode(array('error'=>'500')).')';
}
?>

Code Snippet from the DEMO

function updateStreamInfo(channel, element, name) {
$.ajax({
	url : "http://ingol.nl/lol/livestream/islive.php?name="+channel,
	type : "GET",
	dataType : "jsonp",
	success : function(data, textStatus, XMLHttpRequest){
		var color = {'color':'#FFFFFF'};
		if (data.isLive && data.isLive == 'true') {
			color = {'color':'#FF0000'};
		} else {
			color = {'color':'#FFFFFF'};
		}

		var viewercount = 'undefined' === typeof(data.currentViewerCount) ? '-.-' : data.currentViewerCount;
		var link = $('<a/>').attr({'href':'http://livestream.com/'+channel,"target":"livestream"}).css(color)
			.html('LIVESTREAM '+name.toUpperCase()+' ('+viewercount+')');
		element.html(link);
	},
	error : function(XMLHttpRequest, textStatus, errorThrown){
		// console.debug(XMLHttpRequest);
	}
});
}

function isLiveStatus(name,channel) {
	var minutes = 5;
 	updateStreamInfo(channel,$('#'+name), name);
	window.setInterval('updateStreamInfo("'+channel+'",$("#'+name+'"), "'+name+'")', 1000 * 60 * minutes);
}

$(function(){
 	isLiveStatus('rebootgpf','rebootgpf');
 	isLiveStatus('clgaming','clgame');
 	isLiveStatus('cowclan','cowclan');
 	isLiveStatus('Team-AON','teamaon');
 	$('#popup').click(function(){
		window.open('index.html','livestreams','width=400,height=200,menubar=no,status=no,location=no,toolbar=no,scrollbars=no');
 	});
});

More (unannounced) League of Legends Skins in v10096

0

Mental Note: Zend_Date compare method is slow?

0

Can someone explain why the standard Zend_Date comparison slowed the performance of an application of mine by a significant amount.
It was checking a date to be within a specific timespan for like 90 times.

$date = new Zend_Date();
if ($date->compare($otherDate) >= 0) {
...

// Now fetching the timestamps to compare those against each other.
// For example:
if ($date->getTimestamp() >= $otherdate.getTimestamp()) {
...
}

More LoL Skins, Hidden and New, in Patch v1.0.0.94

0

Added Skins:
- Goalkeeper Blitzcrank
- All-star Akali
- Striker Ezreal
- Red Card Katarina … O_o
- Blast Zone Heimerdinger
- Riot Squad Singed … MUST HAVE !!!
- Uncle Ryze
- Statue of Karthus
- Minuteman Gankplank
- Lollipoppy

So that’s like 7 unannounced additional skins?!?
I did not even put in Kog’Maw’s skins (which do not seem very special, just a re-paint in my opinion)
and putting up Kog’Maw up for 6300 IP ……. BOOoOOoooO BOOOOOOOO -.-

Go to Top