1
2
3
4
/* Lets say we have two numbers: 27 and 145 (just two random values) into two separate variable */

int min = 27;  // 00011011 binary 8bit for 27  
...

C On How to find max, min of thr...

by Eineki, November 20, 2008 00:52

It is quite simple, once yo...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
int max = rand(); // or any init value
int min = rand(); // or any init value
int tmp = rand(); // or any init value
...

C On How to find max, min of thr...

by Eineki, November 18, 2008 23:55

Try this code, it's a kind ...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
<?
/*
E.g:
...

PHP On remove http from url string

by Eineki, November 11, 2008 10:49 Star_fullStar_fullStar_fullStar_full

Hi, you can use preg_replac...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
<?php
function get_next_seat($table_id, $start_seat) {
  $player_data=$this->admin->get_player_data($table_id);
...

PHP On Get Next Turn

by Eineki, November 11, 2008 00:26

You are right, $next_seat h...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
<?php
function get_next_seat($table_id, $start_seat) {
  $player_data=$this->admin->get_player_data($table_id);
...

PHP On Get Next Turn

by Eineki, November 08, 2008 20:34

You are right, $next_seat h...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk

PHP On Array To Tablerows

by Eineki, October 26, 2008 23:00

cool version the one liner ...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
<?php
function array_to_tablerows($array = array(), $cols = 2) {
   if (!is_array($array) || $cols < 1) return false;
...

PHP On Array To Tablerows

by Eineki, October 26, 2008 22:57

My previous version shorten...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
<?php

// Example Usage: array_to_tablerows(array('x', 'x', 'x', 'x', 'x', 'x'), 4);
...

PHP On Array To Tablerows

by Eineki, October 25, 2008 07:00

Hi, try this version, it us...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
<?php
function get_next_seat($table_id, $start_seat) {
  $player_data=$this->admin->get_player_data($table_id);
...

PHP On Get Next Turn

by Eineki, October 22, 2008 12:48

This should do the trick in...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
for (char a = 'A', int c = 0; a <= 'Z'; a++, c++) {	
...

C++ On Simple For Loop

by Eineki, October 07, 2008 01:46

Think at the for loop into ...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
#include <iostream.h>

int main() {
...

C++ On Simple For Loop

by Eineki, October 07, 2008 01:09

do you mean this way?

5a00a3a98dcf6f9cd717440fd2b606e5 Talk

PHP On file upload validation

by Eineki, October 03, 2008 20:48

Sorry, it was the cut and p...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
<?
define("DEBUG",1);

...

PHP On file upload validation

by Eineki, October 02, 2008 11:03 Star_fullStar_fullStar_fullStar_fullStar_full

Hi, your code was repetitiv...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
<?php
  function __autoload($class_name) {
    $include_dirs = array('models/', 'generic/' ); // fill the array with appropiate dirs
...

PHP On model loader

by Eineki, August 23, 2008 13:49

If you use php 5.2 you can ...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
<?php
function loadModel($model)
...

PHP On model loader

by Eineki, August 22, 2008 01:12

You can't use a variable to...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk

Bash On store string from terminal ...

by Eineki, July 08, 2008 06:09 Star_fullStar_fullStar_fullStar_fullStar_full

Why don't you use the comma...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
$.fn.textNodes = function() {
   return this.find(*).filter(function(index) { return (this.nodeType==3)||(this.nodeName="br")}).andSelf();
}

JavaScript On [jQuery] All descendent tex...

by Eineki, June 30, 2008 10:43 Star_full

Let me say that I'm rather ...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
<?php
$board = str_repeat("\n",100) . "TICTACTOE\n\n\n\n" . "   +   +   \n %s + %s + %s \n   +   +   \n+++++++++++\n"
       . "   +   +   \n %s + %s + %s \n   +   +   \n+++++++++++\n   +   +   \n %s + %s + %s \n   +   +   \n\n";
...

PHP On Command-Line TicTacToe

by Eineki, March 24, 2008 20:33
5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
#include <math.h>

#define BASE 2
...

C On Quanti bit per rappresentar...

by Eineki, February 20, 2008 22:35

it:Il numero di cifre neces...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
#include <stdio.h>
...

C On Int or Double/Float ?

by Eineki, February 20, 2008 22:04

it: Il tuo codice distrugge...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
SCRIPT="gen_${1}.sql"
echo "--gen_${1}.sql" > $SCRIPT
typeset -i counter
...

Bash On Slow bash for loop.

by Eineki, February 10, 2008 00:57

Hi, the following code don'...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk

PHP On Removing Parameters from an...

by Eineki, February 08, 2008 12:09

If you call parse_url witho...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
REFNO=$(echo $LINE | cut -d\| -f8)

Bash On Slow bash for loop.

by Eineki, February 08, 2008 10:39

Just a quick thought
Maybe ...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
<?
$params = array('SID','t','p','hilite');
$ref = 'url.php?t=4&p=5&sid=ddf175fd02216cbe9fab9a4b528d7185&hilite=2c23tra#link';
...

PHP On Removing Parameters from an...

by Eineki, February 07, 2008 23:53
5a00a3a98dcf6f9cd717440fd2b606e5 Talk
1
2
3
4
;; get the firt n element from a list
;; parameter:
;;     l -> list to split
...

Lisp On Group-by

by Eineki, December 22, 2007 01:38

What do you think of this r...

5a00a3a98dcf6f9cd717440fd2b606e5 Talk