Feb 28

Seguite questo tutorial per creare un logo di successo con Adobe Illustrator!

Link: http://www.blog.spoongraphics.co.uk/tutorials/logo-design-process-and-walkthrough-for-vivid-ways

fonte: www.sastgroup.com » Vai al post originale





Feb 28

Nel file php.ini sostituite:

;extension=php_curl.dll

in

extension=php_curl.dll

Riavviate apache e il gioco è fatto -)

fonte: www.sastgroup.com » Vai al post originale

Feb 28

Ecco per voi una raccolta di icone da utilizzare nei vostri progetti!

Link: http://www.webiconset.com/mobile-icon-set/

fonte: www.sastgroup.com » Vai al post originale

Feb 26

scaricare-musica-gratis

Puniz.com ti permette di scaricare musica da youtube da oltre 500 milioni di traccie audio totalmente gratuite.

Ti basta inserire il nome della canzone o dell’autore che ti interessa e il sito ritornerà una lista di canzoni corrispondenti alla tua ricerca.

Puoi ascoltare direttamente dal sito oppure scaricarla in diversi formati sul tuo pc cosi da poterla ascoltare anche quando non sei connesso.

Un sito da mettere sicuramente tra i preferiti.

fonte: www.sastgroup.com » Vai al post originale

Mar 11

I carboidrati rappresentano la principale fonte di energia, costituendo il 55-60% della quota calorica giornaliera che va adattata dopo valutazione individuale basata sulle abitudini nutrizionali, sulla condizione clinica e sul quadro lipidico del paziente.
In genere in una dieta si privilegiano i carboidrati complessi, che dovrebbero rappresentare circa il 90% del totale, rispetto agli zuccheri semplici. Comunque deve essere tenuto presente che le variazioni glicemiche indotte dai carboidrati non sono solo correlate alla loro struttura molecolare, ma anche ad altri fattori, quali la rapidità con cui il cibo viene assunto, il modo in cui è stato elaborato e l'associazione con altri cibi.
In considerazione dell'ampia variabilità delle risposte glicemiche ai differenti carboidrati è stato elaborato un parametro per classificare gli alimenti in base ai livelli glicemici indotti, rispetto ad un elemento di riferimento detto indice glicemico.
Un indice glicemico elevato, inizialmente riferito al glucosio, ma, attualmente, al pane, corrisponde ai livelli di glicemia più alti dopo l'ingestione di quell'alimento [...]

fonte: dieta-dimagrante.com » vai al post originale »

Feb 26

In questo tutorial creeremo una semplice interfaccia per chiamare webservices REST in PHP.

 
private function _run()
{
$headers = $this->_headers;
$curly = $result = array();
 
$mh = curl_multi_init();
foreach ($this->_requests as $id => $reg) {
$curly[$id] = curl_init();
 
$type = $reg[0];
$url = $reg[1];
$params = $reg[2];
 
if(!is_null($this->_user)){
curl_setopt($curly[$id], CURLOPT_USERPWD, $this->_user.‘:’.$this->_pass);
}
 
switch ($type) {
case self::DELETE:
curl_setopt($curly[$id], CURLOPT_URL, $url . ‘?’ . http_build_query($params));
curl_setopt($curly[$id], CURLOPT_CUSTOMREQUEST, self::DELETE);
break;
case self::POST:
curl_setopt($curly[$id], CURLOPT_URL, $url);
curl_setopt($curly[$id], CURLOPT_POST, true);
curl_setopt($curly[$id], CURLOPT_POSTFIELDS, $params);
break;
case self::GET:
curl_setopt($curly[$id], CURLOPT_URL, $url . ‘?’ . http_build_query($params));
break;
}
curl_setopt($curly[$id], CURLOPT_RETURNTRANSFER, true);
curl_setopt($curly[$id], CURLOPT_HTTPHEADER, $headers);
 
curl_multi_add_handle($mh, $curly[$id]);
}
 
$running = null;
do {
curl_multi_exec($mh, $running);
sleep(0.2);
} while($running > 0);
 
foreach($curly as $id => $c) {
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
switch ($status) {
case self::HTTP_OK:
case self::HTTP_CREATED:
case self::HTTP_ACEPTED:
$result[$id] = curl_multi_getcontent($c);
break;
default:
if (!$this->_silentMode) {
$result[$id] = new Http_Multiple_Error($status, $type, $url, $params);
}
}
curl_multi_remove_handle($mh, $c);
}
 
curl_multi_close($mh);
return $result;
 

fonte: www.sastgroup.com » Vai al post originale

Feb 26

Combinando Illustrator e Photoshop è possibile creare effetti sorprendenti! In questo tutorial faremo proprio questo, creeremo uno sfondo astratto unendo la potenza di questi due bellissimi software!

Link: http://spyrestudios.com/design-an-abstract-wallpaper-in-photoshop-illustrator/

fonte: www.sastgroup.com » Vai al post originale

Feb 26

Le due tipologie di orologio, sono state realizzate in HTML, javascript e CSS!

Link: http://joncom.be/code/css-clocks/

fonte: www.sastgroup.com » Vai al post originale

Feb 26

In questo tutorial vi mostreremo come creare un bellissimo effetto 3D, utilizzando diverse texture per dare un aspetto unico al vostro progetto!

Link: http://www.adobetutorialz.com/articles/30970297/1/how-to-create-3d-love-text-composition

fonte: www.sastgroup.com » Vai al post originale

Feb 26

In questo tutorial imparerete come ottenere le informazioni di un file attraverso l’array “$_FILES”.

$_FILES['immagine']['name'] //The Original file name on the browser system.
$_FILES['immagine']['type'] //The file type determined by the browser.
$_FILES['immagine']['size'] //The Number of bytes of the file content.
$_FILES['immagine']['tmp_name'] //The temporary filename of the file in which the uploaded file was stored on the server.
$_FILES['immagine']['error'] //The error code associated with this file upload.

fonte: www.sastgroup.com » Vai al post originale

Feb 26

YoxView è a mio parere uno dei più belli visulizzatori d’immagini. E’ possibile spostarsi da una foto all’altra anche con i tasti direzionali, potete aggiungere una breve descrizione, potete impostare lo scorrimento automatico premendo il tasto “play” e godervi il fit automatico delle immagini!

Link: http://www.yoxigen.com/yoxview/

fonte: www.sastgroup.com » Vai al post originale

Feb 24

Ecco per voi una bellissima raccolta di effetti realizzati con i CSS3!

Link: http://www.queness.com/post/2025/18-incredible-css3-effects-you-have-never-seen-before

fonte: www.sastgroup.com » Vai al post originale

Feb 24

Se desiderate creare un menu cross browser che appare al click del pulsante destro del mouse, dovete assolutamente seguire questo semplice tutorial!

Link: http://www.webdeveloperjuice.com/2010/02/22/create-simple-jquery-right-click-cross-browser-vertical-menu/

fonte: www.sastgroup.com » Vai al post originale

Feb 24

In questo tutorial imparerete come creare uno SlideShow di immagini con MooTools!

Link: http://davidwalsh.name/slideshow-thumbnails-captions

fonte: www.sastgroup.com » Vai al post originale

Feb 24

In questo tutorial imparerete come trasformare un’immagine diurna in notturna!

Link: http://www.psdrockstar.com/photo-effects/converting-a-daytime-image-into-a-night-scene/

fonte: www.sastgroup.com » Vai al post originale

Feb 24

Grazie a questo semplice tutorial PHP, imparerete come trovare la posizione geografica di un utente.

Per prima cosa dovete scaricare il Database degli IP: Download

FILE import.php

 
< ?php
 
// Connect to your database
$con = mysql_connect("localhost", "yourUsername", "yourPassword");
 
// Display an error if there was a problem with connection
if(!$con){
 
die(mysql_error());
 
}
 
// Select your database
$select_db = mysql_select_db("ip", $con);
 
// If there was problems with selecting your database.. It will display an error
if(!$select_db){
 
die(mysql_error());
 
}
 
// Select your database file
$db = file("ip-to-country.csv");
 
// Now let’s get all rows separately and insert it into database
foreach($db as $row){
 
$content = trim( str_replace(‘"’, "’", str_replace("’", "\’", $row) ) );
$sql = "INSERT INTO locations (from, to, short, cc3, cname) VALUES($content)";
$query = mysql_query($sql);
 
if(!$query){
 
die(mysql_error());
 
}
 
}
 
// If it’s done.. Display this message
echo "Done!";
 
?>
 

FILE checkip.php

 
< ?php
 
// Let’s start our function
function check_country($ip){
 
// Connect to database
$con = mysql_connect("localhost", "yourUsername", "yourPassword");
 
if(!$con){
 
die(mysql_error());
 
}
 
// Select database
$select_db = mysql_select_db("ip", $con);
 
if(!$select_db){
 
die(mysql_error());
 
}
 
// Now let’s get the long ip
$real_ip = ip2long($ip);
$sql = "SELECT cname, short FROM locations WHERE from = ‘$real_ip’";
$sql = mysql_query($sql);
$cd = mysql_fetch_assoc($sql);
 
$country = ucwords(strtolower($cd[‘cname’]));
$short = strtolower($cd[’short’]);
 
// Let’s display your user’s ip and location
echo "IP: $ip";
echo "Location: $country";
 
}
 
check_country($_SERVER[‘REMOTE_ADDR’]);
 
?>
 

fonte: www.sastgroup.com » Vai al post originale

Feb 24

Questo plugin jQuery permette di applicare l’effetto slide e lo zoom su ogni singolo box.

Link: http://css-tricks.com/moving-boxes/

fonte: www.sastgroup.com » Vai al post originale

Feb 22

Ecco a voi un’altro bellissimo tutorial che vi spiegherà in modo dettagliato, come trasformare una normale persona in Na’vi, il personaggio del bellissimo capolavoro di James Cameron, Avatar!

Link: http://free-web-design.co.cc/create-james-camerons-avatar-movie-poster-in-photoshop-tutorial.html

fonte: www.sastgroup.com » Vai al post originale

Feb 22

FORM HTML

 

 

FILE PHP

 
$data = $_POST[‘tweet-msg’];
$twitter_data = "status=" . substr($data, 0, 136) ." …";
$twitter_user = ‘tuauser’;
$twitter_password = ‘tuapassword’;
 
$twitter_api_url = "http://twitter.com/statuses/update.xml";
$ch = curl_init($twitter_api_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $twitter_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "{$twitter_user}:{$twitter_password}");
$twitter_data = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
 

fonte: www.sastgroup.com » Vai al post originale

Feb 22

Se desiderate installare una chat sul vostro sito, questa farà sicuramente al caso vostro! Non necessita di database ed è facile da installare. Supporta gli smiles più utilizzati ed è molto leggerà!

Link: http://css-tricks.com/examples/Chat2/

fonte: www.sastgroup.com » Vai al post originale

Feb 22

Ecco a voi una semplice guida per creare animazioni con jQuery!

Link: http://net.tutsplus.com/tutorials/javascript-ajax/jquery-animations-a-7-step-program/

fonte: www.sastgroup.com » Vai al post originale

Feb 22

In questo tutorial Joe Moore vi insegnerà in modo dettagliato come creare una bellissima coomposizione 3D utilizzando, Photoshop e 3D Studio Max (anche Xara 3D va bene).

Link: http://design.creativefan.com/create-a-beautiful-3d-text-composition/

fonte: www.sastgroup.com » Vai al post originale

Feb 22

In questo tutorial imparerete come generare scelte casuali con PHP!

 

function Add()
{
var Space = document.getElementById(‘extra’);
 
Space.innerHTML +=
;
}

Cueburst - Random Choice Generator

 

Random Choice Generator
 
< ?php
 
$form =
Stuck with a decision?
Let me help!
+
 

 
 

 

 
‘;
 
if(!isset($_POST[’submit’]))
{
echo $form;
}
else
{
 
$choice = $_POST[‘choice’];
 
foreach($choice AS $number => $input)
{
if($input == null)
{
unset($choice[$number]);
}
}
 
if(count($choice) == 0)
{
echo Quack!No choices to choose from.’;
$answer = 0;
}
elseif(count($choice) == 1)
{
echo Quack!That was an easy choice.’;
$answer = 1;
}
else
{
echo Quack!;
$answer = 1;
}
 
$chosen = array_rand($choice);
 
if($answer == 1)
{
echo "Your choice is " . $choice[$chosen];
}
 
echo "
 
Another go?"
;
}
 
?>

 

fonte: www.sastgroup.com » Vai al post originale

Feb 20

Ecco per voi una raccolta di funzioni più comuni da utilizzare nei vostri progetti!

< ?php

class common {

static private $link = NULL;
static private $linki = NULL;
private $config = NULL;

function __construct() {

// ini_set(’include_path’, ini_get(’include_path’).’;’.BASEPATH.’application/my_classes/’);
// ini_set(’register_globals’,'off’);
// ini_set(’max_input_time’,'600′);

include(”./config.php”);
$this->config = $config;
}

function check_user() {

$user_id = “”;
$id = “”;
$user_id = $this->common->get_encrypted_id();
$uid = $this->common->value(’uid’);

if( (empty($user_id)) ) {
$session_id = ”;
$session_id = $_SESSION['userid'];
if(!empty($session_id)) {
$msg = “
session exists($session_id)”;
$id = $session_id;
}
else if(!empty($uid)) {
$msg = “
uid found($uid)”;
$id = $uid;
}
}
else {

$session_id = ”;
$session_id = $_SESSION['userid'];
if(!empty($session_id)) {

if( $user_id == $session_id ) {
$msg = “
Session($session_id) & user_id($user_id) matches”;
$id = $session_id;
}
else {
$msg = “
Session($session_id) exist but not matches with user_id($user_id)”;
$id = $user_id;
}
}
else {
$msg = “
Session not exist, user_id($user_id)”;
$id = $user_id;
}
}

// echo $msg.”, User_id=”.$id; exit;

if(empty($id)) {
// Redirecting into login page
$url = “http://www.google.co.in”;
header(”location:”.$url);
}
else {
$_SESSION['userid'] = $id;
return true;
}
}

function get_body($body, $type) {

$body = $this->get_absolute_value($body);
$newline=”\n”;
$content_type = strtolower($type);
$company_address = $this->config->config['organisation_details'];
$unsubscribe_ar = $this->config->config['unsubscribe_ar'];

if($content_type == “plain”) {
$str = “”;

$str .= $newline. $body . $newline.$newline.$newline.$this->remove_html(html_entity_decode($company_address));

return $str;
}

if($content_type == “html”) {

$str = “”;
$html_head = “”;
$html_foot = “”;

$html_head .= $newline.$newline.”;
$html_head .= $newline.”;
$html_head .= $newline.”;
$html_head .= $newline.”;
$html_head .= $newline.’Test document’;
$html_head .= $newline.”;
$html_head .= $newline.”;

$html_foot .= $newline.$newline.$newline.$company_address;
$html_foot .= $newline.$newline.$newline.$unsubscribe_ar;

$html_foot .= $newline.”;
$html_foot .= $newline.”;

$str .= $html_head . $body . $html_foot;

return $str;
}
}

function replace_personalized_text($body, $buyer_array, $user_array, $mail_type=”html”) {

$content = $this->get_body($body, $mail_type);
$access_code = $this->encode($buyer_array->first_name, $buyer_array->last_name);

$replace = array(
‘buyer_first_name’ => $this->value(’first_name’, ”, $buyer_array),
‘buyer_last_name’ => $this->value(’last_name’, ”, $buyer_array),
‘buyer_email’ => $this->value(’email’, ”, $buyer_array),
‘buyer_phone’ => $this->value(’phone’, ”, $buyer_array),
‘my_first_name’ => $this->value(’first_name’,”,$user_array),
‘my_last_name’ => $this->value(’last_name’,”,$user_array),
‘my_email’ => $this->value(’email’,”,$user_array),
‘my_phone’ => $this->value(’phone’,”,$user_array),
’subscribe_ar’ => BASEURL.’guest/subscribe/’.$buyer_array->id.’/’.$access_code,
);

while( is_array($replace) && list($key,$value) = each($replace) ) {

$patterns[] = ‘/>/’;
$patterns[] = ‘/< >/’;

foreach ($patterns as $pattern) {
$content = preg_replace($pattern, $value, $content);
}
}

return $content;
}

function remove_html($str) {
$patterns = “/]*>/”;
$content = preg_replace($patterns, “”, $str);
return htmlspecialchars($content);
}

function connect_smtp() {
try {

require_once “./libraries/swift/Swift.php”;
require_once “./libraries/swift/Swift/Connection/SMTP.php”;
require_once “./libraries/swift/Swift/Authenticator/LOGIN.php”;

$smtp =& new Swift_Connection_SMTP($this->config['smtp_host']);

//Continue like normal
$smtp->setUsername($this->config['smtp_user']);
$smtp->setPassword($this->config['smtp_pass']);

$swift =& new Swift($smtp);
return $swift;

}
catch (Swift_ConnectionException $e) {
echo “There was a problem communicating with SMTP: ” . $e->getMessage();
exit;
}
}

/**
* Enter description here…
*
* ex - $result = $this->common->send_mail(array(’Manoj Verma’ => ‘manoj.verma@hytechpro.com’, ‘Manu’ => ‘manabendra.sarkar@hytechpro.com’), array(’Manojkumar’ => ‘manoj.verma@hytechpro.com’), ‘test’, ‘testing purpose mail’);
*
* @param array $to
* @param array $from
* @param string $sub
* @param text $body
* @param string $mail_type
* @param object $swift
* @return mixed
*/
function send_mail($to=array(), $from=array(), $sub, $body, $mail_type=’html’, $swift=false, $undisclosed=true, $attachment=array(’browse_field_name’ => ‘attachment’)) {

$return = false;

if(!$swift) {
$swift = $this->connect_smtp();
}

$content_type = “text/html”;
if(strtolower($mail_type) == “plain”) {
$content_type = “text/plain”;
}

try {

//Create the message
$message =& new Swift_Message($sub, $body, $content_type);

// preparing from address
if($this->check_array($from)) {
foreach ($from as $from_name => $from_email) {

if(is_string($from_name)) {
$from_address = new Swift_Address($from_email, $from_name);
}
else {
$from_address = new Swift_Address($from_email);
}
}
}
else {
$this->log_msg(’Common::send_mail() –> Please mention from email address.’);
return false;
}

// Preparing to addressess
$recipients =& new Swift_RecipientList();
if($this->check_array($to)) {

if(count($to) > 1) {
if($undisclosed == true) {
$message->setTo(”undisclosed-recipients:;”);
}
}
else {
$to_email = array_values($to);
// setting header
$message->headers->set(”To”, array($to_email[0]));
}

foreach ($to as $to_name => $to_email) {
if(is_string($to_name)) {
$recipients->addTo($to_email, $to_name);
}
else {
$recipients->addTo($to_email);
}
}
}
else {
$this->log_msg(’Common::send_mail() –> Please mention to email address.’);
return false;
}

// Attachment
if($this->check_array($_FILES)) {
$attachment_fieldname = $attachment['browse_field_name'];
$attachment_name = $_FILES[$attachment_fieldname]['name'];
if(!empty($attachment_name)) {

$arr = explode(”.”, $attachment_name);
$extentsion = $arr['1'];
$attachment_type = “application/”.$extentsion;
$attachment_path = $_FILES[$attachment_fieldname]['tmp_name'];

$swift_file = new Swift_File($attachment_path);
$part =& new Swift_Message_Part($body, $content_type);
$message->attach(new Swift_Message_Attachment($swift_file, $attachment_name, $attachment_type));
$message->attach($part);
}
}

if ($number_sent = $swift->send($message, $recipients, $from_address)) {
$msg = “Mail has been sent to ($number_sent) users.”;
$return = $number_sent;
}
else {
$msg = “Unexpected error occured when sending mail.”;
$return = false;
}

}
catch (Swift_Message_MimeException $e) {
$msg = “There was an unexpected problem building the email:” . $e->getMessage();
$return = false;
}

$this->log_msg($msg);

return $return;
}

function check_email($address){

// check an email address is possibly valid
if(ereg(”^[^@ ]+@[^@ ]+\.[^@ ]+$”,$address,$trashed))
return true;
else
return false;
}

function find_client_ip()
{

global $_SERVER;

// No IP found (will be overwritten by for
// if any IP is found behind a firewall)
$ip = FALSE;

// $this->print_rr($_SERVER);

// If HTTP_CLIENT_IP is set, then give it priority
if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
$ip = $_SERVER["HTTP_CLIENT_IP"];
}

// User is behind a proxy and check that we discard RFC1918 IP addresses
// if they are behind a proxy then only figure out which IP belongs to the
// user. Might not need any more hackin if there is a squid reverse proxy
// infront of apache.
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {

// Put the IP’s into an array which we shall work with shortly.
$ips = explode (”, “, $_SERVER['HTTP_X_FORWARDED_FOR']);
if ($ip) { array_unshift($ips, $ip); $ip = FALSE; }

for ($i = 0; $i < count($ips); $i++) {
// Skip RFC 1918 IP’s 10.0.0.0/8, 172.16.0.0/12 and
// 192.168.0.0/16
if (!preg_match(’/^(?:10|172\.(?:1[6-9]|2\d|3[01])|192\.168)\./’, $ips[$i])) {
if (version_compare(phpversion(), “5.0.0″, “>=”)) {
if (ip2long($ips[$i]) != false) {
$ip = $ips[$i];
break;
}
} else {
if (ip2long($ips[$i]) != -1) {
$ip = $ips[$i];
break;
}
}
}
}
}
// Return with the found IP or the remote address
return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
}

#######################
## MYSQL_I api Start
#######################

function connect_mysqli() {

$link = mysqli_connect($this->config["db_host"], $this->config["db_user"], $this->config["db_pass"], $this->config["db_name"]);
if (!$link) {
die (’i Mysqli connection failed: ‘ . mysqli_connect_error());
}
else {
$this->linki = $link;
}
}

function execute_queryi($query=”) {

if (empty($query)) {

$this->log_msg(”Common::execute_queryi() –> Query can not be empty.”, “#888888″);
return ”;
}
else {
if( self::$linki == NULL ) {
$this->connect_mysqli();
}
}

// execute query
$mtime = explode(” “, microtime());
$start = doubleval($mtime[1]) + doubleval($mtime[0]);

$result = @mysqli_query($this->linki, $query);

$mtime = explode(” “, microtime());
$end = doubleval($mtime[1]) + doubleval($mtime[0]);
$time_elapsed = number_format(abs($start - $end), 5, ‘.’, ”);

// if error occured
if (!$result) {
$error = @mysqli_error($this->linki);
$this->log_msg(”Common::execute_queryi() –> Error in query: [ $query ] ($time_elapsed), Mysqli error: “.$error);
}
else {
if(is_object($result)) {
$num_rows = @mysqli_num_rows($result);
$this->log_msg(”Common::execute_queryi() –> Num Rows: $num_rows, [ $query ] ($time_elapsed)”, “#8686D9″);
}
else {
$affected_rows = @mysqli_affected_rows($this->linki);
$this->log_msg(”Common::execute_queryi() –> Affacted Rows: $affected_rows, [ $query ] ($time_elapsed)”, “#8686D9″);
}
}

return $result;
}

function get_primarykeyi($table) {

$sql = “SELECT * FROM `”.$table.”`;”;
// execute query
$result = $this->execute_queryi($sql);

if($result) {
$fields = @mysqli_fetch_fields($result);
// $this->print_rr($fields);
foreach ($fields as $field) {
if($field->type == 253) {
$pk = $field->orgname;
return $pk;
}
}
}
return false;
}

#######################
## MYSQL_I api Ends
#######################

/**
* Returns a string representation of the date, of differing format
* depending on how recent the date is.
*
* @param int $_date Unix timestamp of the date.
* @return string String representation of the date.
*/
function nice_date( $_date ) {
$date_ymd = date( “Ymd”, $_date );
$now = time();

if ( $date_ymd == date( “Ymd”, $now + 86400 ) ) { // tomorrow
return “Tomorrow”;
} elseif ( $date_ymd == date( “Ymd”, $now ) ) { // today
return “Today”;
} elseif ( $date_ymd == date( “Ymd”, $now - 86400 ) ) { // yesterday
return “Yesterday”;
} elseif ( ( $now < $_date ) && ( abs( $now - $_date ) < 518400 ) ) { // next week
return “Next “.date( “l”, $_date );
} elseif ( ( $now > $_date ) && ( abs( $now - $_date ) < 518400 ) ) { // previous week
return “Last “.date( “l”, $_date );
} elseif ( date( “Y”, $now ) == date( “Y”, $_date ) ) { // this year
return date( “j M”, $_date );
} else {
return date( “j M Y”, $_date );
}
}

/**
* Returns a string representation of the date and time, of differing format
* depending on how recent the date is.
*
* @param int $_datetime Unix timestamp of the date.
* @return string String representation of the date and time.
*/
function nice_datetime( $_datetime ) {
$datetime_ymd = date( “Ymd”, $_datetime );
return $this->nice_date( $_datetime ).”, “.date( “g:ia”, $_datetime );
}

/**
* This function returns difference between two days.
*
* @param timestamp $start
* @param timestamp $end
* @return integer
*/
function daysInSpan($start,$end=”)
{
if(empty($end)) {
$today=getdate();
// $yesterday=mktime(0,0,0,$today[mon],$today[mday]-1,$today[year]);
$today=mktime(0,0,0,$today['mon'],$today['mday'],$today['year']);

$end = $today;
}
return (($end-$start)/86400);
}

#################################################################################################
#################################################################################################
#################################################################################################
#################################################################################################
#################################################################################################

function get_primarykey($table) {

$sql = “SELECT * FROM `”.$table.”`;”;
// execute query
$result = $this->execute_query($sql);

if($result)
for($i = 0; $i < @mysql_num_fields($result); $i++) {
if(eregi(”.*primary_key.*”, @mysql_field_flags($result, $i))){
$pk=@mysql_field_name($result, $i);
@mysql_free_result($result);
return $pk;
}
}

return false;
}

function connect_mysql() {

$link = mysql_connect($this->config["db_host"], $this->config["db_user"], $this->config["db_pass"]);
if (!$link) {
die (’Mysql connection failed: ‘ . mysql_error());
}
$db_selected = mysql_select_db($this->config["db_name"], $link);
if (!$db_selected) {
die (’Can not able to open database : ‘ . mysql_error());
}
else {
$this->link = $link;
}
}

function execute_query($query=”) {

if (empty($query)) {

$this->log_msg(”Common::execute_query() –> Query can not be empty.”, “#888888″);
return ”;
}
else {
if( self::$link == NULL ) {
$this->connect_mysql();
}
}

// execute query
$mtime = explode(” “, microtime());
$start = doubleval($mtime[1]) + doubleval($mtime[0]);

$result = @mysql_query($query);

$mtime = explode(” “, microtime());
$end = doubleval($mtime[1]) + doubleval($mtime[0]);
$time_elapsed = number_format(abs($start - $end), 5, ‘.’, ”);

// if error occured
if (!$result) {
$error = @mysql_error();
$this->log_msg(”Common::execute_query() –> Error in query: [ $query ] ($time_elapsed), Mysql error: “.$error);
}
else {
if(is_resource($result)) {
$num_rows = @mysql_num_rows($result);
$this->log_msg(”Common::execute_query() –> Num Rows: $num_rows, [ $query ] ($time_elapsed)”, “#8686D9″);
}
else {
$affected_rows = @mysql_affected_rows();
$this->log_msg(”Common::execute_query() –> Affacted Rows: $affected_rows, [ $query ] ($time_elapsed)”, “#8686D9″);
}
}

return $result;
}

function fetch_result($result, $fetch_type=”") {

$returnValue = array();
if(is_resource($result)) {
if(@mysql_num_rows($result) > 0 ) {
switch($fetch_type)
{
case ‘0′:
$array = array();
while($row = @mysql_fetch_row($result)) {
$array[] = $row;
}
break;
case ‘1′:
// returns associative array
$array = array();
while($row = @mysql_fetch_assoc($result)) {
$array[] = $row;
}
break;
case ‘2′:
// returns object type
$array = array();
while($row = @mysql_fetch_object($result)) {
$array[] = $row;
}
break;
case ‘3′:
$array = @mysql_fetch_row($result);
break;
case ‘4′:
$array = @mysql_fetch_assoc($result);
break;
case ‘5′:
$array = @mysql_fetch_object($result);
break;
default:
$array = @mysql_fetch_assoc($result);
break;
}
// gets momory free
@mysql_free_result($result);
if($this->check_array($array)) {
$returnValue = $array;
return $returnValue;
}
else {
return false;
}
}
else {
return false;
}
}
else {
return false;
}
}

function get_row($table, $id=”", $fields=”") {

if(empty($fields)) $fields=”*”;

if (!empty($id)) {
$pk = $this->get_primarykey($table);
if(!$pk) return false;
$sql = “SELECT $fields FROM $table WHERE $pk=’$id’”;
}
else {
$sql = “SELECT $fields FROM $table LIMIT 0 , 1″;
}

$rs = $this->execute_query($sql);
$row = $this->fetch_result($rs);

if($fields != ‘*’) {
return $row[$fields];
}

return $row;
}

function get_rows($table, $condition=”", $fields=”", $fetch_type=’1′) {

if(empty($fields)) $fields=”*”;

if (!empty($condition)) {
$sql = “SELECT $fields FROM $table WHERE $condition”;
}
else {
$sql = “SELECT $fields FROM $table”;
}

$rs = $this->execute_query($sql);
$rows = $this->fetch_result($rs, $fetch_type);

return $rows;
}

function get_result($sql=”", $fetch_type=”1″) {

$rs = $this->execute_query($sql);
$rows = $this->fetch_result($rs, $fetch_type);

return $rows;
}

function select($table=”, $arr=array(), $where=”) {

if(empty($table)) {
return false;
}

$result = self::execute_query(”SELECT * FROM $table LIMIT 0,1″);
$columns = @mysql_num_fields($result);
// getting list of columns of the specified table.
for ($i = 0; $i < $columns; $i++) {
$fieldarr[] = @mysql_field_name($result, $i);
}

$fields = ”;
$i=1;
if($this->check_array($arr)) {

foreach ($arr as $key => $field_name) {

$total = count($arr);

// Appending ‘,’ after field name
if (in_array ($field_name, $fieldarr)) {
$fields .= $field_name;
if($i != $total) {
$fields .= “,”;
}
}
$i++;
}
}
else {
$fields = ‘*’;
}

$sql = “SELECT $fields FROM $table”;

if(!empty($where))
$sql .= ” where “.$where;

// executing query.
$result = self::get_result($sql);
return $result;

}

function insert($table, $arr) {

$result = self::execute_query(”SELECT * FROM $table LIMIT 0,1″);
$columns = @mysql_num_fields($result);
// getting list of columns of the specified table.
for ($i = 0; $i < $columns; $i++) {
$fieldarr[] = @mysql_field_name($result, $i);
}

// building insert statement.
$sqla = “INSERT INTO $table ( “;
$sqlb = “) VALUES ( “;
foreach ($arr as $name => $value) {
if (in_array ($name, $fieldarr)) {
$sqla .= “$name,”;
if (is_array($value)) {
$sqlb .= “‘|”;
$j = count($value);
for ($i = 0; $i < $j-1; $i++) {
$sqlb .= addslashes($value[$i]) . “|,|”;
}
$k = $j-1;
$sqlb .= addslashes($value[$k]) . “|’,”;
} else {
if( $value == null ){
$sqlb .= ‘null’.”,”;
}
else
$sqlb .= “‘” . addslashes($value) . “‘,”;
}
}
}
$sqlb .= “)”;
$sql = $sqla . $sqlb;
$sql = str_replace(”,)”, “)”, $sql);

// executing query.
$result = self::execute_query($sql);
return $result;
}

function update($table, $arr, $where) {

$result = $this->execute_query(”SELECT * FROM $table LIMIT 0,1″);
$columns = @mysql_num_fields($result);
// getting list of columns of the specified table.
for ($i = 0; $i < $columns; $i++) {
$fieldarr[] = @mysql_field_name($result, $i);
}
// building update statement.
$sql = “UPDATE $table SET “;
foreach ($arr as $name => $value) {
if (in_array ($name, $fieldarr)) {
$sql .= “$name = “;

if (is_array($value)) {
$sql .= “‘|”;
$j = count($value);
for ($i = 0; $i < $j-1; $i++) {
$sql .= addslashes($value[$i]) . “|,|”;
}
$k = $j-1;
$sql .= addslashes($value[$k]) . “|’,”;
} else {
if( $value == null ){
$sql .= ‘null’.”,”;
}
else
$sql .= “‘” . addslashes($value) . “‘,”;
}
}
}
$sql .= “;”;
$sql = str_replace(”,;”, ” “, $sql);

$sql .= ” where “.$where;

$result = self::execute_query($sql);

return $result;
}

function value($key=”, $default=”, $arr=array()) {

if(gettype($arr) == ‘object’) {
$arr = get_object_vars($arr);
}

if(! $this->check_array($arr) ) {
global $_REQUEST;
$arr = $_REQUEST;
}

if(!$this->check_empty($key)) {

if( (!isset($arr[$key])) || (trim($arr[$key] == ”)) ) {
return $this->get_absolute_value($default, “Common::value() –> Element ($key) not found in array and default value not exist.”);
}else{
return $this->get_absolute_value($arr[$key]);
}
}
else {
return $this->get_absolute_value($default, “Common::value() –> Key is missing.”);
}
}

function get_absolute_value($val=”, $msg=”) {

if($this->check_empty($val)) {
if(empty($msg)) {
$this->log_msg(’Common::get_absolute_value() –> Value is Empty.’);
}
else {
$this->log_msg($msg);
}

return null;
}
else {
if(is_string($val) ) {
return htmlspecialchars_decode(stripslashes(trim($val)), ENT_QUOTES);
}
else {
return $val;
}
}
}

function check_empty($value=”) {

if(empty($value)) {
if( ($value === 0) || ($value === ‘0′) ) {
return false;
}
else {
return true;
}
}
else {
return false;
}
}

function check_array($arr = array()) {

if( (is_array($arr)) || (is_object($arr)) ){

if(count($arr) > 0) {

foreach ($arr as $val) {
if(!$this->check_empty($val)) return true;
}
}
}

return false;
}

#################################################################################################
#################################################################################################
#################################################################################################
#################################################################################################
#################################################################################################

function getxml($array=array(), $fields = array()) {

$sql = “select eid,ename from emp”;
$result = $this->execute_query($sql);
if(is_resource($result)){
$numRows = mysql_num_rows($result);
if($numRows >= ‘1′){
$xml = “\n”;
$xml .= “\n”;
while($arr=mysql_fetch_assoc($result)) {
$xml.= ” \n”;
foreach ($arr as $key => $value) {
if($key == ‘thumbImagePath’) {
$xml.= ” Title_Thumb/{$value}\n”;
}
}
$xml.= ” \n”;
}

$xml.= “\n”;

} else {
$xml = ”;
}
} else {
$xml = ”;
}

header(’Content-Type: text/xml’);
echo $xml;
}

/**
* xml2array() will convert the given XML text to an array in the XML structure.
* Link: http://www.bin-co.com/php/scripts/xml2array/
* Arguments : $contents - The XML text
* $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the tag values - this results in a different array structure in the return value.
* $priority - Can be ‘tag’ or ‘attribute’. This will change the way the resulting array sturcture. For ‘tag’, the tags are given more importance.
* Return: The parsed XML in an array form. Use print_r() to see the resulting array structure.
* Examples: $array = xml2array(file_get_contents(’feed.xml’));
* $array = xml2array(file_get_contents(’feed.xml’, 1, ‘attribute’));
*/
function xml2array($contents, $get_attributes=1, $priority = ‘tag’) {
if(!$contents) return array();

if(!function_exists(’xml_parser_create’)) {
//print “‘xml_parser_create()’ function not found!”;
return array();
}

//Get the XML parser of PHP - PHP must have this module for the parser to work
$parser = xml_parser_create(”);
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, “UTF-8″); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, trim($contents), $xml_values);
xml_parser_free($parser);

if(!$xml_values) return;//Hmm…

//Initializations
$xml_array = array();
$parents = array();
$opened_tags = array();
$arr = array();

$current = &$xml_array; //Refference

//Go through the tags.
$repeated_tag_index = array();//Multiple tags with same name will be turned into an array
foreach($xml_values as $data) {
unset($attributes,$value);//Remove existing values, or there will be trouble

//This command will extract these variables into the foreach scope
// tag(string), type(string), level(int), attributes(array).
extract($data);//We could use the array by itself, but this cooler.

$result = array();
$attributes_data = array();

if(isset($value)) {
if($priority == ‘tag’) $result = $value;
else $result['value'] = $value; //Put the value in a assoc array if we are in the ‘Attribute’ mode
}

//Set the attributes too.
if(isset($attributes) and $get_attributes) {
foreach($attributes as $attr => $val) {
if($priority == ‘tag’) $attributes_data[$attr] = $val;
else $result['attr'][$attr] = $val; //Set all the attributes in a array called ‘attr’
}
}

//See tag status and do the needed.
if($type == “open”) {//The starting of the tag ”
$parent[$level-1] = &$current;
if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag
$current[$tag] = $result;
if($attributes_data) $current[$tag. '_attr'] = $attributes_data;
$repeated_tag_index[$tag.'_'.$level] = 1;

$current = &$current[$tag];

} else { //There was another element with the same tag name

if(isset($current[$tag][0])) {//If there is a 0th element it is already an array
$current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
$repeated_tag_index[$tag.'_'.$level]++;
} else {//This section will make the value an array if multiple tags with the same name appear together
$current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array
$repeated_tag_index[$tag.'_'.$level] = 2;

if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
$current[$tag]['0_attr'] = $current[$tag.'_attr'];
unset($current[$tag.'_attr']);
}

}
$last_item_index = $repeated_tag_index[$tag.'_'.$level]-1;
$current = &$current[$tag][$last_item_index];
}

} elseif($type == “complete”) { //Tags that ends in 1 line ”
//See if the key is already taken.
if(!isset($current[$tag])) { //New Key
$current[$tag] = $result;
$repeated_tag_index[$tag.'_'.$level] = 1;
if($priority == ‘tag’ and $attributes_data) $current[$tag. '_attr'] = $attributes_data;

} else { //If taken, put all things inside a list(array)
if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array…

// …push the new element into that array.
$current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;

if($priority == ‘tag’ and $get_attributes and $attributes_data) {
$current[$tag][$repeated_tag_index[$tag.'_'.$level] . ‘_attr’] = $attributes_data;
}
$repeated_tag_index[$tag.'_'.$level]++;

} else { //If it is not an array…
$current[$tag] = array($current[$tag],$result); //…Make it an array using using the existing value and the new value
$repeated_tag_index[$tag.'_'.$level] = 1;
if($priority == ‘tag’ and $get_attributes) {
if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well

$current[$tag]['0_attr'] = $current[$tag.'_attr'];
unset($current[$tag.'_attr']);
}

if($attributes_data) {
$current[$tag][$repeated_tag_index[$tag.'_'.$level] . ‘_attr’] = $attributes_data;
}
}
$repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken
}
}

} elseif($type == ‘close’) { //End of tag ”
$current = &$parent[$level-1];
}
}

return($xml_array);
}

/**
* This function helps to populate the form fields as well as Table fields.
*
* @param array $arrToAssign
* @param array $arrFromAssign
* @param integer $modeOfAssigning
* @param array $replaceArray
* @return array
* @access public
*/
function assignValueToFormElements($arrToAssign, $arrFromAssign=”, $modeOfAssigning=”, $replaceArray=”) {

global $_POST;

$is_return = 0;
// checking for replace array passed as parameter or not
if(is_array($replaceArray) && (count($replaceArray) > 0))
{
// if replace array passed as parameter no need to return anything.
$replace = &$replaceArray;
}else{
// if replace array not passed as parameter return array $arr;
$is_return = 1;
$arr = array();
$replace = &$arr;
}
$formArray = $arrToAssign;
if(empty($arrFromAssign)){
// if $arrFromAssign not passed peak the value from post array.
$arrFromAssign = $_POST;
}
switch ($modeOfAssigning){

case ‘0′:
// 0 for populating database fields with respect to database fields.
// used when needs to populate form fields with values stored in database.
foreach($formArray as $key => $value){
if(!empty($value)){
$replace[$value] = self::value($value, ”, $arrFromAssign);
}
}
break;

case ‘1′:
// 1 for populating form fields with respect to database fields
// used when needs to populate database values in form.
foreach($formArray as $key => $value){
if(!empty($key)){
$replace[$key] = self::value($value, ”, $arrFromAssign);
}
}
break;

case ‘2′:
// 2 for populating database fields with respect to form fields
// used when needs to insert form data into database table.
foreach($formArray as $key => $value){
if(!empty($value)){
$replace[$value] = self::value($key, ”, $arrFromAssign);
}
}
break;

default:
// populating form fields with respect to form fields, ($arr[key] = $arr[$key])
// used when server error occured to preserve the form value
foreach($formArray as $key => $value){
if(!empty($key)){
$replace[$key] = self::value($key, ”, $arrFromAssign);
}
}
break;
} // Switch Ends

if($is_return == ‘1′){
return $replace;
}
}
// Function assignValueToFormElements Ends

/**
* Select or remove array elements from an array.
* Source array could be either one dimensional or muti dimensional.
*
* @param array $existingArray like array(’first_name’=>’Manoj’, ‘last_name’=>’Verma’, ‘username’=>’abc’, ‘password’=>’abcpwd’)
* @param array $removingElementArray like array(’first_name’, ‘password’)
* @param strinf ($action != 2) if u want to remove the element from existing array and ($mode==2) if u want to select those elements from the existing array.
* @return array
* @access public
*/
function operateArrayElements($sourceArray, $targetArray, $action=’select’) {

$arr = array();

if((is_array($sourceArray)) && (is_array($targetArray))) {
if((count($targetArray) > 0) && (count($sourceArray) > 0)){
switch($action){
case ’select’:
foreach ($targetArray as $key) {
foreach($sourceArray as $key2 => $value2){
if($key == $key2){
$arr[$key] = $value2;
break;
}
}
}
break;

case ‘remove’:
foreach ($targetArray as $key) {
foreach($sourceArray as $key2 => $value2){
if($key == $key2){
unset($sourceArray[$key]);
break;
}
}
}
break;

case ‘modify’:
foreach ($targetArray as $key => $value) {
foreach($sourceArray as $key2 => $value2){
if($key == $key2){
$sourceArray[$key] = $value;
break;
}
}
}
break;

/**
* searching for value in $targetArray
* if value not found return false
* if value found, check value
* if value is empty
* return false;
* if value is not empty
* return true;
* if value not found
* return false;
*/
case ‘checkempty’:
foreach ($targetArray as $key) {
foreach($sourceArray as $key2 => $value2){
if($key == $key2){
if(empty($value2)){
// if value found empty
return ‘0′;
}
}
}
}
break;

// Default operation is ’select’
default:
foreach ($targetArray as $key) {
foreach($sourceArray as $key2 => $value2){
if($key == $key2){
$arr[$key] = $value2;
break;
}
}
}
break;
}

switch($action){
case ’select’:
return $arr;
break;

case ‘remove’:
return $sourceArray;
break;

case ‘modify’:
return $sourceArray;
break;

case ‘checkempty’:
return ‘1′;
break;

// Default operation is ’select’
default:
return $arr;
break;
}
}else{
// if $targetArray is empty.
return ‘0′;
}
}else{
// if $sourceArray is empty.
return ‘0′;
}
}

/** Function to find a single value or list of values(Array) from source array
* e.g., Capture the value and occurance of ’stage’ field comes in source array
* @Param $sourceArray — array() — Single or Multidimensional array
* @Param $toFindValue — Single value or an array(one dimensional)
* @Param $parentLevel — Tells that the value which i have to search, found in which Level of Source Array
* @Param $parentLevel — no need to pass as parameter when call this function
* @Param $parentLevel — no need to pass as parameter when call this function
* Rest of two parameter need not to pass in function calling
* ### THIS FUNCTION IS COPY OF getValueFromArray() IN nsLIB FILE.
*/
function getValueFromArray($sourceArray, $toFindValue=”, $parentLevel=”, $arr=array(), $level=0) {
$returnValue = ”;
$levelFound = true;

if((!empty($toFindValue)) && ($toFindValue != ”)){
foreach($sourceArray as $key => $value) {

// If value == array()
if (is_array($value) && (count($value)>0)) {
$level++;
$this->getValueFromArray($value, $toFindValue, $parentLevel, &$arr, $level);
$level–;
}else{

// Set value $levelFound either true or false after checking it is passed as parameter or not

if((!empty($parentLevel)) && ($parentLevel != ”)){
if($parentLevel == $level){
$levelFound = true;
}else{
$levelFound = false;
}
}

// If parentLevel is passing as parameter and found then block runs or if parentLevel is not passing as parameter then also block is running

if($levelFound == true){
if(is_array($toFindValue)){
foreach($toFindValue as $value2){ // $toFindvalue array is like array(’stage’, ‘name’, ‘roll’) — 1 dimensional
if($key == $value2){
$arr[$key] = $value;
}
}
}else{

// $Searching Value is not array

if($key == $toFindValue){
$arr[$key] = $value;
}
}
}
}
}
}

if(count($arr) > 0){
$returnValue = $arr;
}
return $returnValue;
}

/**
Function to output a separator either through whitespace, or with an image
*/
function putSpace($height=’1′, $image , $type=”hor”, $y){

if($y != ‘100%’) {
$y = $y.’px’;
}

if(($type == ‘hor’) || (empty($type))) {
return ‘‘;
}
else {
return ‘‘;
}
}

/**
* $this->putWhiteSpaces(array(’14′),&$replace);
* $this->putWhiteSpaces(array(’5′,’14′), &$replace, ‘pixel_silver.gif’, true, ’silverSpace’);
* $this->putWhiteSpaces(array(’5′,’14′, ‘30′, ‘80′), &$replace, ‘pixel_black.gif’, false, ‘blackSpace’);
* In template — or or
*/
function putWhiteSpaces($arr, $replace, $image=”, $y=’100%’, $type=”hor”, $range=true, $text=’whitespace’){
switch($image){
case ”:
$img = ‘pixel_trans.gif’;
break;
case ’silver’:
$img = ‘pixel_silver.gif’;
break;
case ‘black’;
$img = ‘pixel_black.gif’;
break;
default:
$img = $image;
break;
}
if($range == true){
$min = (count($arr) == 2) ? $arr[0] : ‘0′;
$max = (count($arr) == 2) ? $arr[1] : $arr[0];
for($height=$min; $height< =$max; $height++){
$key = $text.$height;
$replace[$key] = $this->putSpace($height, $img, $type, $y);
}
}else{
foreach($arr as $height){
$key = $text.$height;
$replace[$key] = $this->putSpace($height, $img, $type, $y);
}
}
}

/**
* Function to generate string like ‘1′,’2′,’3′ to use in “IN Query”
* e.g, SELECT * FROM user as u WHERE u.user_id IN (’44′,’48′,’47′,’53′,’27′,’29′)
*
* @param array $array
* @return string
* @access public
*
*/
function generateInQueryParameter($array) {

// counts the no of elements in array
$count_rows = count($array);
$str = “”;
$counter = 0;
foreach($array as $value){

$str .= “‘”.$value.”‘”;
$counter++;
if($counter != $count_rows){
$str .= “,”;
}
}
return $str;
}

/**
* format must be like - mm/dd/yy or mm/dd/yyyy
*/
function check_date($date) {

if(!empty($date)) {
$arr = explode(”/”, $date);
if( (count($arr) > 3) || (count($arr) < 3) ){
return false;
}
else {
foreach ($arr as $val) {
if(! is_numeric($val)) return false;
}
}

$mydate = date(”m-d-Y”, mktime(0, 0, 0, $arr[0], $arr[1], $arr[2]));
$arr2 = explode(”-”, $mydate);

$check = checkdate($arr2[0], $arr2[1], $arr2[2]);
if(!$check) {
return false;
}
}
return true;
}

function html_drop_down($name=”", $values=array(), $default = ”, $parameters = ”) {

if(empty($name)) $name=”select”;

$field = ‘
‘;

if($this->check_array($values))
foreach ($values as $key => $value) {
$field .= ” . htmlspecialchars($value) . ”;
}
$field .= ”;

return $field;
}

/**
* Function to add the elements in array on specified position.
* If position is not specified it will add array at end.
* Ex - $arr = $common->array_add_element(array(’Manoj’, ‘Manu’, ‘Koushal’), array(’Ratnesh’, ‘Janki’), ‘0′);
*
* @param array $arr - ex. array(’Manoj’, ‘Manu’, ‘Koushal’, ‘Janki’);
* @param array $element - ex. array(’Ratnesh’) || array(’Ratnesh’, ‘Sanjay’);
* @param integer $position
*/
function array_add_element($arr=array(), $element=array(), $position=”) {

if($this->check_array($arr)) {
if($this->check_array($element)) {
if($this->check_empty($position)) {
$position = count($arr);
}
array_splice($arr, $position, 0, $element);
}
}

return $arr;
}

#####################################################
## Functions for two way encryption and decryption
#####################################################

function generate_code($length=6) {

$chars = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPRQSTUVWXYZ0123456789″;

$code = “”;

while (strlen($code) < $length) {

$code .= $chars[mt_rand(0,strlen($chars))];

}

return $code;
}
##————————————————–
## SIMPLE FUNCTION TO ENCODE & DECODE STRING
function encode($string,$key) {
$key = sha1($key);
$strLen = strlen($string);
$keyLen = strlen($key);
$j=”";
$hash=”";
for ($i = 0; $i < $strLen; $i++) {
$ordStr = ord(substr($string,$i,1));
if ($j == $keyLen) { $j = 0; }
$ordKey = ord(substr($key,$j,1));
$j++;
$hash .= strrev(base_convert(dechex($ordStr + $ordKey),16,36));
}
return $hash;
}
##————————————————–
function decode($string,$key) {
$key = sha1($key);
$strLen = strlen($string);
$keyLen = strlen($key);
$j=”";
$hash=”";
for ($i = 0; $i < $strLen; $i+=2) {
$ordStr = hexdec(base_convert(strrev(substr($string,$i,2)),36,16));
if ($j == $keyLen) { $j = 0; }
$ordKey = ord(substr($key,$j,1));
$j++;
$hash .= chr($ordStr - $ordKey);
}
return $hash;
}
##————————————————–
## Function to converting hexadecimal number into binary form.
function hex2bin($hexdata) {
$bindata=”;
for ($i=0;$iget_result($query, ‘2′);
if($this->check_array($row))
$id = $row[0]->id;

return $id;
}
##————————————————–
function set_encrypted_id($id, $key=’Test’) {

$encrypted_id = “”;

$query = “select hex(AES_ENCRYPT(’”.$id.”‘, ‘”.$key.”‘)) as encrypted_id”;
$row = $this->get_result($query);
if($this->check_array($row))
$encrypted_id = $row[0]->encrypted_id;

return $encrypted_id;
}
##**************************************************

//Get the result of the query as a CSV stream.
function CSVExport($query) {
$sql_csv = $this->execute_query($query);

header(”Content-type:text/octect-stream”);
header(”Content-Disposition:attachment;filename=data.csv”);
while($row = $this->fetch_result($sql_csv)) {
print ‘”‘ . stripslashes(implode(’”,”‘,$row)) . “\”\n”;
}
exit;
}

/**
* Import the contents of a CSV file after uploading it
* http://www.bin-co.com/php/scripts/csv_import_export/
* Aruguments : $table - The name of the table the data must be imported to
* $fields - An array of fields that will be used
* ex - $fields = array(’first_name, last_name, country, address, city, state, zip, phone, fax, email’,’status’,'priority’,'mail_subscription’,'user_id’,'created_at’,'updated_at’);
* $auto_fields - An array of fields that will be used — Not mandatory
* ex - $cur_date = date(”Y-m-d H:i:s”, time());
* $auto_fields = array(’ACTIVE’, ‘NORMAL’, ‘new’, ‘1′, $cur_date, $cur_date);
* $csv_fieldname - The name of the CSV file field
*/
function upload_csv($table=’buyers’, $fields=array(), $csv_fieldname=’buyercsv’, $auto_fields=array()) {

$return = FALSE;
global $_FILES;

if(count($fields) < = 0) {
$this->log_msg(”Common::upload_csv() –> Please specify corrospondant database fields.”); return false;
}

if( (count($_FILES) < = 0) || ($_FILES[$csv_fieldname]['name'] == ”) ) {
$this->log_msg(”Common::upload_csv() –> Please upload a csv file.”); return false;
}

$file_name = $_FILES[$csv_fieldname]['name'];

$arr = explode(”.”, $file_name);
$extentsion = $arr['1'];
if(strtolower($extentsion) != ‘csv’) { $this->log_msg(’Common::upload_csv() –> Please upload only csv files.’); return false; }

$handle = fopen($_FILES[$csv_fieldname]['tmp_name'],’r');
if(!$handle) die(’Cannot open uploaded file.’);

$row_count = 0;
$sql_query = “INSERT INTO $table(”. implode(’,',$fields) .”) VALUES(”;

$rows = array();

//Read the file as csv
while (($data = fgetcsv($handle, 1000, “,”)) !== FALSE) {

if( $this->check_array($data) ) {

$row_count++;
$data = array_merge($data, $auto_fields);
foreach($data as $key=>$value) {
$data[$key] = “‘” . addslashes($value) . “‘”;
}
if(count($data) != count($fields)) { $this->log_msg(’Common::upload_csv() –> Some fields are missing in csv, Please check.’); $return=TRUE; }

// $this->print_rr($data); exit;

$rows[] = implode(”,”,$data);
}
}
// $this->print_rr($rows); exit;
$sql_query .= implode(”),(”, $rows);
$sql_query .= “)”;
fclose($handle);

if($return == TRUE) {
return false;
}

// echo $sql_query; exit;

if(count($rows)) { //If some recores were found,

$this->execute_query($sql_query);

$this->log_msg(’Common::upload_csv() –> Successfully imported ‘.$row_count.’ record(s)’);

return true;

} else {
$this->set_message(’Cannot import data - no records found.’);

return false;
}
}

function print_rr($arr = array(), $arr_name=”) {

if( $this->check_array($arr) ) {

$rows = count($arr);

echo “
Total elements in array ($arr_name) = “.$rows.”“;

echo ”
“;
print_r($arr);
echo ”

“;
}
else {

if(is_array($arr)) {

echo “
Empty array having ‘”.count($arr).”‘ Keys.“;

echo ”
“;
print_r($arr);
echo ”

“;

}
else if($this->check_empty($arr)) {
echo “
Parameter is not an array or object, Type = (”.gettype($arr).”), Empty value.“;
}
else {
echo “
Parameter is not an array or object, Type = (”.gettype($arr).”), value = ($arr).“;
}
}

echo “
“;
}

function log_msg($msg=”Error occured.”, $color=”red”, $size=”3″) {

$str = ‘['.date("D M d H:i:s Y", time()).'] : ‘. $msg;
// echo $my_msg = ‘
‘.$str.’‘;

$source_file = “tmp/mylog.txt”;
@chmod($source_file, 0777);

$handle = @fopen($source_file, “a+”); // w+ is used to write every time from begining.
if($handle) {

$str2 = “\n $str”;
if (@fwrite($handle, $str2) === FALSE) {
echo “Cannot able to write into file ($source_file)”;
}
fclose($handle);
}
else {
echo “Cannot able to open file - ($source_file)”;
}
}

function echoo($str, $exit=false) {
$msg = ‘
Track Message : ‘.$str.’‘;
echo $msg;

if($exit != false) {
exit;
}
}

} // Common Class Ends

################################
## Testing
################################

$common = new common();
//$common->getxml(); exit;

//$common->execute_query(”update emp set ename=’Ratnesh kr’ where eid=1″);
//$common->execute_queryi(”update emp set ename=’Ratnesh kumar’ where eid=1″);
//$common->execute_queryi(”select * from emp inner join emp_profile on emp.eid=emp_profile.id”);
//$common->execute_query(”select * from emp inner join emp_profile on emp.eid=emp_profile.id”);
//$common->get_primarykeyi(’emp’);
//$row = $common->get_row(’te’, ‘1′);
//$rows = $common->select(’emp’, array(’eid’,'mid’));
//$replace = $common->assignValueToFormElements(array(’emp_id’ => ‘eid’, ‘emp_name’ => ‘ename’), ”, ”);
//$common->print_rr($replace);

//echo $common->html_drop_down(’dd’, array(’01′=>’Manoj’));
//$arr = $common->array_add_element(array(’Manoj’, ‘Manu’, ‘Koushal’), array(’Ratnesh’, ‘Janki’), ‘0′);
$arr = $common->array_add_element(array(’mannu’=>’Manoj’, ‘manu’=>’Manu’, ‘jha’=>’Koushal’), array(’ratan’=>’Ratnesh’, ‘jaan’=>’Janki’), ‘0′);
//$common->print_rr($arr); exit;

$common->upload_csv(’emp_profile’, array(’id’,'address’), ‘empcsv’);

$common->putWhiteSpaces(array(’1′, ‘10′), &$hor, ‘pixel_silver.gif’);
$common->putWhiteSpaces(array(’1′, ‘10′), &$ver, ‘verticle.gif’, ‘100′, ‘ver’);

//print_r($arr); exit;
/*echo ‘

1 ‘.$ver['whitespace1'].’ 2

1 ‘.$ver['whitespace10'].’ 2

1 ‘.$hor['whitespace1'].’ 2

1 ‘.$hor['whitespace10'].’ 2

‘;
*/

/*
echo ‘

Upload csv:

‘;

echo $common->nice_datetime(strtotime(’2009-05-17 14:25:50′));
echo “
My Machine’s IP = “.$common->find_client_ip();
echo “
No of Days-”.$numDays=$common->daysInSpan(mktime(0,0,0,5,1,2009));
*/
?>

fonte: www.sastgroup.com » Vai al post originale

Feb 20

Se siete amanti della grafica e desiderate dare uno stile agli elementi dei vostri form Uniform fa per voi!

Link: http://pixelmatrixdesign.com/uniform/

fonte: www.sastgroup.com » Vai al post originale

Feb 20

L’Ajax è ormai diventato un “must” da avere sul proprio sito, è ormai possibile moltissimi effetti che si fanno con il flash, uno tra questi effetti è proprio quello che vi proponiamo oggi, cioè quello di animare uno sfondo!

Link: http://davidwalsh.name/mootools-animate-background

fonte: www.sastgroup.com » Vai al post originale

Feb 20

In questo tutorial imparerete come creare il pelo realistico di un gatto con Photoshop!

Link: http://www.pxleyes.com/tutorial/photoshop/1579/How-To-Create-Realistic-Cat-Fur.html

fonte: www.sastgroup.com » Vai al post originale

Feb 20

In questo tutorial verrà creato un sistema che converte i smile di testo in smile d’immagini.

 
< ?php
 
function replaceSmilies($str, $smilies) {
 
$new_str = $str;
 
foreach($smilies as $tag => $image) {
 
$new_str = str_replace($tag, "", $new_str);
 
}
 
return $new_str; //return the new, updated string containing the smiley images
 
}
 
$smilies = array(":)" => "smile.jpg", ":P" => "thongue.jpg");
$str = "Hi there! ) Example text P ";
 
echo "Input string: {$str}
 
 
Output string: "
.replaceSmilies($str, $smilies);
 
?>
 
 

fonte: www.sastgroup.com » Vai al post originale

Feb 20

Ketchup è un leggerissimo plugin jQuery che convalida i vostri moduli. E’ mirato ad essere flessibile sia per il suo aspetto che per le sue funzionalità.

Link: http://demos.usejquery.com/ketchup-plugin/

fonte: www.sastgroup.com » Vai al post originale

Feb 18

Avete mai visto banner pubblicitari che mostrano un sorriso brutto con denti sporchi e maltrattati con accanto il risultato finale dove mostra denti freschi e brillanti? Bene, nel tutorial di oggi creeremo il contrario, partiremo da denti puliti e li trasformeremo in denti sporchi e maltrattati!

Link: http://blog.boxedart.com/tutorials/from-gorgeous-to-gross-reverse-cosmetic-dentistry/

fonte: www.sastgroup.com » Vai al post originale

Feb 18

jDigiClock è un plugin jQuery ispirato allo stile HTC Hero!

Link: http://www.radoslavdimov.com/jquery-plugins/jquery-plugin-digiclock/

fonte: www.sastgroup.com » Vai al post originale

Feb 18

In questo tutorial imparerete come leggere il contenuto di un file XML con PHP!

FILE XML

 
< ?xml version="1.0" encoding="UTF-8"?>

Jaan
18
male
Estonia

Mike777
25
male
United States

DingoNKangarooLove
12
female
Australia

TingTongPingPong
36
male
China

 
 
< ?php
 
$xml = simplexml_load_file("users.xml");
 
$count = count($xml->user)-1;
 
for($i=0;$i< =$count;$i++){
 
echo $xml->user[$i]->username."";
 
}
 
?>
 

fonte: www.sastgroup.com » Vai al post originale

Feb 18

Se desiderate creare uno script che debba essere eseguito solo in background e l’accesso diretto al file deve essere bloccato, seguite questo semplicissimo metodo per fare quanto detto!

 
< ?php
//if the current file the user is browsing for is the file block.php then block the access
if(basename($_SERVER[‘SCRIPT_FILENAME’]) == "block.php"):
echo "Sorry but you cannot browse this file directly!";
exit;//this will make sure the browser stops here and won’t go any further
endif;
?>
 
If you are browsing this file directly you will not see this text, but if you are including
this file in another file using the include(); function you should see this text.
 

fonte: www.sastgroup.com » Vai al post originale

Feb 18

In questo tutorial Photoshop imparerete come creare un ritratto utilizzando gli strumenti messi a disposizione da questo fantastico programma!

Link: http://www.cgarena.com/freestuff/tutorials/photoshop/magic_warrior/magic_warrior.html

fonte: www.sastgroup.com » Vai al post originale

Feb 18

Con questo script jQuery è possibile visualizzare le vostre immagini a rotazione, creando un effetto gradevole agli occhi dell’utente.

Link: http://www.sohtanaka.com/web-design/automatic-image-slider-w-css-jquery/

fonte: www.sastgroup.com » Vai al post originale

Feb 16

In questo tutorial Photoshop imparerete come creare una perla con effetto lucido, utilizzando i stili di livello!

Link: http://richworks.in/2010/01/create-a-shiny-and-realistic-pearl-in-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Feb 16

Questa funzione PHP converte i bytes in kilobytes e superiori!

 
< ?
function convert($b) {
# Perform Calculation
$kb = $b / 1024;
$mb = $kb / 1024;
$gb = $mb / 1024;
$tb = $gb / 1024;
$pb = $tb / 1024;
# Round As Necessary
if ($b > 1) {$s = round($b, 2) . "B";}
if ($kb > 1) {$s = round($kb, 2) . "KB";}
if ($mb > 1) {$s = round($mb, 2) . "MB";}
if ($gb > 1) {$s = round($gb, 2) . "GB";}
if ($tb > 1) {$s = round($tb, 2) . "GB";}
if ($pb > 1) {$s = round($pb, 2) . "PB";}
# Return Convert
return $s;
}
?>
 

fonte: www.sastgroup.com » Vai al post originale

Feb 16

In questo tutorial MooTools imparerete come caricare altri elementi automaticamente, scrollando semplicemente verso il basso la scrollbar laterale.

Link: http://davidwalsh.name/mootools-scrollspy-load

fonte: www.sastgroup.com » Vai al post originale

Feb 16

In questo tutorial Photoshop imparerete come creare un effetto carta strappata come l’immagine che vedete sopra!

Link: http://richworks.in/2010/02/create-a-realistic-torn-paper-effect-with-coffee-stains/

fonte: www.sastgroup.com » Vai al post originale

Feb 16

Questa funzione PHP vi permette di reimportare il testo (passato nella funzione), all’interno di una variabile.

 
function var_import ($text) { return eval("return $text;"); }
 

fonte: www.sastgroup.com » Vai al post originale

Feb 16

Tutti noi amiamo le applicazioni Mac, in particolare per la cura nei dettagli. Le animazioni eleganti rendono l’utilizzo facile e gradevole agli occhi. Il plugin jQuery che vi proponiamo oggi, cerca di ricreare effetti semplici ed eleganti proprio come quelli Apple!

Link: http://razorjack.net/quicksand/

fonte: www.sastgroup.com » Vai al post originale

Feb 14

Ecco alcuni esempi di costanti “magiche” messe a disposizione da PHP!

 
< ?php
/**
* Script to demonstrate magic constants in php
*/

 
echo "\n" . "We are at line " . __LINE__;
echo "\n" . "The full path and filename of the file is " . __FILE__;
 
function myFunction(){
echo "\n" . "The function name is " . __FUNCTION__;
}
 
myFunction();
 
class myClass
{
public function __construct()
{
echo "\n" . "The class name is " . __CLASS__;
echo "\n" . "The method name is ". __METHOD__;
}
}
 
$object = new myClass();
echo "\n";
?>
Sample output of the script:
 
We are at line 6
The full path and filename of the file is /home/sudheer/workspace/php/cli/constant/magic.php
The function name is myFunction
The class name is myClass
The method name is myClass::__construct
 
?>
 

fonte: www.sastgroup.com » Vai al post originale

Feb 14

Nel tutorial di oggi imparerete come creare un bellissimo Slideshow panoramico con effetti di transizione diversi utilizzando jQuery!

Link: http://buildinternet.com/2010/02/animate-panning-slideshow-with-jquery/

Demo: http://s3.amazonaws.com/buildinternet/live-tutorials/panning-slideshow/panning-slideshow.htm

fonte: www.sastgroup.com » Vai al post originale

Feb 14

In questo tutorial verrete guidati passo passo per creare una scrolling list, utilizzando i CSS e le animazioni jQuery!

Link: http://www.fiveminuteargument.com/blog/scrolling-list

fonte: www.sastgroup.com » Vai al post originale

Feb 14

Le FAQs in un sito web sono molto noiose da leggere. Se volete dare un tocco di originalità alle domande frequenti dovete assolutamente seguire questo articolo!

Link: http://davidwalsh.name/jquery-sliders

Demo: http://davidwalsh.name/dw-content/fancy-faqs-jquery.php

fonte: www.sastgroup.com » Vai al post originale

Feb 14

In questo tutorial imparerete come aggiungere neve, ghiaccio e altri oggetti, utilizzando i pennelli e le impostazioni di default di Photoshop!

Link: http://www.webdtools.com/design/graphics/winter_scene/

fonte: www.sastgroup.com » Vai al post originale

Feb 14

Grafico è una libreria javascript costruita con Prototype e Raphaël. La libreria fornisce una vasta gamma di grafici e possedendo numerose API è possibile personalizzarli secondo i vostri gusti!

link: http://kilianvalkhof.com/2010/design/grafico-javascript-charting-library/

fonte: www.sastgroup.com » Vai al post originale

Feb 12

In questo tutorial imparerete come creare una forza energetica come quella che vedete sopra.

Link: http://wegraphics.net/tutorials/photoshop/how-to-create-an-energy-sci-fi-scene-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Feb 12

jQuery MagicLine è un plugin jQuery che crea una linea che si adatta automaticamente alla larghezza del testo all’evento “hover” del link.

Link: http://css-tricks.com/jquery-magicline-navigation/

fonte: www.sastgroup.com » Vai al post originale

Feb 12

In questo tutorial imparerete come trasformare un tranquillo paesaggio urbano in uno scenario catastrofico!

Link: http://www.myinkblog.com/2010/01/25/matte-painting-create-a-distressed-surreal-cityscape/

fonte: www.sastgroup.com » Vai al post originale

Feb 12

Ecco una dimostrazione di come passare valori in una URL e leggerli in modo sicuro!

 
< ?
// example URL: http://www.example.com/products.php?id=1&name=foo
// init the variables
$id = 0;
$name = ;
if (isset($_GET[‘id’])) $id = (int) $_GET[‘id’];
if (isset($_GET[‘name’]))
{
if (preg_match(‘/^[a-z]+$/i’,$_GET[‘name’])) $name = $_GET[‘name’];
}
?>
 

fonte: www.sastgroup.com » Vai al post originale

Feb 12

Il plugin jQuery che vi proponiamo oggi, simula l’effetto dello scatto della fotocamera creando una simpatica animazione.

Link: http://demo.tutorialzine.com/2010/02/photo-shoot-css-jquery/demo.html

fonte: www.sastgroup.com » Vai al post originale

Feb 12

Questa semplice funzione valida se l’immagine caricata è una JPEG o meno.

 
< ?
function validate_image(&$img)
{
if ($img[‘type’] != ‘image/jpeg’) return false;
if (@exif_imagetype($img[‘tmp_name’]) != IMAGETYPE_JPEG) return false;
return true;
}
?>
 

fonte: www.sastgroup.com » Vai al post originale

Feb 10

Grazie a questo plugin jQuery, è possibile taggare le foto presenti sul tuo sito!
E’ possibile creare un box sovrapposto all’immagine e assegnargli un messaggio.

Link: http://www.bennadel.com/projects/jquery-photo-tagger.htm

Demo: http://www.bennadel.com/resources/projects/jquery_photo_tagger/demo/index.cfm

fonte: www.sastgroup.com » Vai al post originale

Feb 10

In questo tutorial imaprerete come creare uno sfondo di San Valentino partendo da zero.L’immagine che vedete sopra è il risultato finale del tutorial.

Link: http://www.adobetutorialz.com/articles/30970290/1/how-to-create-waved-valentine-background-with-hearts

fonte: www.sastgroup.com » Vai al post originale

Feb 10

Questo bellissimo set è stato realizzato da Iconmaster. Le icone sono state create da zero utilizzando Adobe Fireworks. Le icone sono disponibili nelle risoluzioni 32×32px, 48×48px, 128×128px and 150×150px in formato .ico, .png and .icns.

Link: http://www.noupe.com/freebie/free-saint-valentine-s-day-icon-set.html

fonte: www.sastgroup.com » Vai al post originale

Feb 10

Questa funzione PHP ritorna il valore medio dei numeri inseriti nell’array.

 
< ?php
 
function average($numbers=array())
{
if (!is_array($numbers))
$numbers = func_get_args();
 
$sum = 0;
$amt = count($numbers);
 
foreach($numbers as $num)
$sum += $num;
 
return ($amt > 0) ? ($sum / $amt) : false; // no division by zero
}
 
/*
echo average(array(3,4,5)); // 4
echo average(50,30,40); // 40
*/

 
?>
 

fonte: www.sastgroup.com » Vai al post originale

Feb 10

In questo tutorial vi verrà mostrato come realizzare un’icona con effetto polaroid! E’davvero facile da realizzare e l’effetto finale sembra davvero bello!

Link: http://tutorials-place.com/content/articles/item/design-a-polaroid-photo-icon-in-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Feb 10

Per far funzionare questo script è necessario ffmpeg-php e PHP5 installati sul vostro server.

 
< ?php
$dir = ‘./’; // set to current folder
if ($handle = opendir($dir)) {
while(false!== ($file = readdir($handle))) {
if ( is_file($dir.$file) ){
if (preg_match("’\.(avi)$’", $file) ){
$sub_file = str_ireplace(".avi", ".srt", $dir.$file);
$idx_file = str_ireplace(".avi", ".idx", $dir.$file);
$thumb_file = str_ireplace(".avi", ".jpg", $dir.$file);
$out_file = str_ireplace(".avi", ".mp4", $dir.$file);
flv_convert_get_thumb($dir.$file, $sub_file, $idx_file, $thumb_file, $out_file);
}
else{
continue;
}
}
}
closedir($handle);
}
 
//flv_convert_get_thumb(’input.avi’, ‘input.srt’, ‘output.jpg’, ‘output.ogm’);
// code provided and updated by steve of phpsnaps ! thanks
// accepts:
// 1: the input video file
// 2: path to thumb jpg
// 3: path to transcoded mpeg?
function flv_convert_get_thumb($in, $in_sub, $in_idx, $out_thumb, $out_vid){
// get thumbnail
$cmd = ‘ffmpeg -v 0 -y -i ‘.$in.‘ -vframes 1 -ss 250 -vcodec mjpeg -f rawvideo -s 286×160 -aspect 16:9 ‘.$out_thumb;
$res = shell_exec($cmd);
// $res is the output of the command
// transcode video
$cmd = ‘mencoder ‘.$in.‘ -o ‘.$out_vid.‘ -sub ‘.$in_sub.‘ -subfont-text-scale 3.0 -subpos 99 -af volume=10 -aspect 16:9 -of avi -noodml -ovc x264 -x264encop$
$res = shell_exec($cmd);
}
?>

fonte: www.sastgroup.com » Vai al post originale

Feb 08

QUnit è stato sviluppato dal team di jQuery. Questo framework è utilissimo per testare il codice Javascript, ma in particolare jQuery. In questo tutorial imparerete come utilizzare le funzioni principali di questo fantastico framework!

Link: http://net.tutsplus.com/tutorials/javascript-ajax/how-to-test-your-javascript-code-with-qunit/

fonte: www.sastgroup.com » Vai al post originale

Feb 08

San Valentino è quasi arrivato. Se volete sorprendere il vostro partner con un calendario come quello che vedete sopra, dovete seguire assolutamente questo fantastico tutorial!

PSD: http://www.adobetutorialz.com/articles/30970268/1/desktop-wallpaper-calendar-february-2010

Tutorial: http://www.adobetutorialz.com/articles/3049/1/Romantic-February-2009-Calendar-Wallpaper

fonte: www.sastgroup.com » Vai al post originale

Feb 08

La funzione ritorna “false” se il file non è stato trovato

 
function find_file($file, $prev_path = )
{
$new_path = ($prev_path == ) ? dirname(__FILE__) : dirname($prev_path);
 
if ($prev_path == $new_path)
return false;
 
$full_path = $new_path . DIRECTORY_SEPARATOR . $file;
 
return (file_exists($full_path)) ? $full_path : find_file($file, $new_path);
}
 

ESEMPIO APPLICATO

 
$file = find_file(‘file_in_a_higher_directory_but_dont_know_where.php’);
 
if ($file)
include($file);
else
echo "File Not Found!";
 

fonte: www.sastgroup.com » Vai al post originale

Feb 08

Vi ricordate che nelle applicazioni Windows bisognava scorrere fino in fondo i Termini e le Condizioni per poter andare avanti? ScrollSpy fa proprio questo!

Link: http://davidwalsh.name/scrollspy-terms

Demo: http://davidwalsh.name/dw-content/scrollspy-terms.php

fonte: www.sastgroup.com » Vai al post originale

Feb 08

Ora che Apple ha ufficialmente rilasciato l’iPad, vogliamo iniziare a progettare per esso! Interface Builder di Apple è grandioso ma in realtà non ci consente di creare elementi personalizzati “on the fly” dell’interfaccia utente. In questo articolo troverete un file PSD con la GUI dell’iPad.

Link: http://www.teehanlax.com/blog/2010/02/01/ipad-gui-psd/

fonte: www.sastgroup.com » Vai al post originale

Feb 08

Grazie a questa funzione PHP potrete leggere qualsiasi RSS feed!

 
< ?php
 
function readRSSFile($filename) {
$data = implode(, file($filename));
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $values, $tags);
xml_parser_free($parser);
 
foreach ($tags as $key => $val) {
if ($key == ‘item’) { // select the ‘items’
$itemRanges = $val;
for($i=0; $i

Feb 06

Ecco un semplice tutorial per principianti nello spirito di San Valentino, che spiegherà come usare Pen Tool, forma personalizzata e lo stile di livello per creare uno sfondo romantico con Photoshop.

Link: http://www.adobetutorialz.com/articles/30970266/1/how-to-create-a-romantic-valentines-day-card

fonte: www.sastgroup.com » Vai al post originale

Feb 06

In questo articolo analizzeremo la proprietà del border-radius e come può essere utilizzato per creare cerchi, semi-cerchi e quarti di cerchio. E’possibile realizzare disegni usando solo CSS, senza nessuna immagine!

Link: http://blog.creativityden.com/the-hidden-power-of-border-radius-2/

fonte: www.sastgroup.com » Vai al post originale

Feb 06

Grazie a questo semplicissimo script MooTools, sarà possibile filtrare le checkbox digitatndo la parola interessata all’interno di un input!

 

  • ADDRESS
  • APPLET
  • AREA
  • A
  • BASE
  • BASEFONT
  • BIG
  •  

 
 
 
/* usage */
window.addEvent(‘domready’,function() {
var myFilter = new ElementFilter(’search-term’, ‘#my-list label’, {
trigger: ‘keyup’,
cache: true,
onShow: function(element) {
$(element.get(‘for’)).checked = true;
},
onHide: function(element) {
$(element.get(‘for’)).checked = false;
}
});
});
 

Fonte: http://davidwalsh.name/checkbox-filter

fonte: www.sastgroup.com » Vai al post originale

Feb 06

In questo video-tutorial Photoshop, vedrete come realizzare il dispositivo magico e rivoluzionario di mamma Apple!

via PlayTuts

fonte: www.sastgroup.com » Vai al post originale

Feb 06

Questa semplice funzione PHP permette di “pulire” una URL rendendola facilmente assimilabile dai motori di ricerca!

 
function generate_seo($uri) {
/* regular expressions */
$regex1 = ‘/[^a-zA-Z0-9]/’; //remove anything but letters and numbers
$regex2 = ‘/[\-]+/’; //remove multiple "-"’s in a row
$regex3 = ‘/^[-]+/’; //remove starting "-"
$regex4 = ‘/[-]+$/’; //remove ending "-"
/* return… */
return preg_replace(
array($regex1,$regex2,$regex3,$regex4),
array(‘-’,‘-’,,),
$_SERVER[‘REQUEST_URI’]
);
}
 
/* do it! */
$url = generate_seo($_SERVER[‘REQUEST_URI’]);
 

fonte: www.sastgroup.com » Vai al post originale

Feb 06

Questo plugin jQuery trasforma una normale select multipla in un elegante Drop down con caselle di controllo!

Link: http://www.erichynds.com/examples/jquery-multiselect/examples.htm

fonte: www.sastgroup.com » Vai al post originale

Feb 04

Ieri vi abbiamo spiegato come personalizzare una pagina di errore MySQL, oggi vedremo come ANIMARE un pagina di errore,  utilizzando jQuery, CSS e PHP!

Link: http://www.jooria.com/Tutorials/Website-Designing-11/Fantastic-Animation-PHP-CSS-jQuery-Error-pages-156/index.html

fonte: www.sastgroup.com » Vai al post originale

Feb 04

In questo tutorial imparerete come creare un effetto piega utilizzando le maschere di ritaglio e altri strumenti Photoshop!

Link: http://richworks.in/2010/01/create-a-crumbled-paper-effect-in-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Feb 04

PHP Hide_Email() è una funzione PHP che maschera un indirizzo email e quindi ti protegge dallo spam!

Link: http://www.maurits.vdschee.nl/php_hide_email/

fonte: www.sastgroup.com » Vai al post originale

Feb 04

Se volete personalizzare una pagina di errore MySQL dovete seguire assolutamente questo semplice tutorial!

Link: http://www.jooria.com/Tutorials/Website-Programming-16/Making-Cool-Mysql-Error-Page-Using-PHP-66/index.html

fonte: www.sastgroup.com » Vai al post originale

Feb 04

Questo tutorial vi spiegherà come creare un effetto gel su un testo qualsiasi del vostro progetto PSD.

Link: http://www.illustrateddesigns.com/articles/3106/1/Create-a-gel-text-effect-photoshop—Gelatinous-Text/Page1.html

fonte: www.sastgroup.com » Vai al post originale

Feb 04

Grazie all’Html 5 possiamo visualizzare video senza l’uso di alcun plugin Flash!

Link: http://jilion.com/sublime/video

fonte: www.sastgroup.com » Vai al post originale

Feb 02

L’obiettivo di questo tutorial è quello di creare un menu di navigazione che carica velocemente, e non richiede Javascript per gli effetti del passaggio del mouse.

Link: http://buildinternet.com/2010/01/how-to-make-a-css-sprite-powered-menu/

fonte: www.sastgroup.com » Vai al post originale

Feb 02

In questo tutorial imparerete come creare bellissimi fiori (Iris) utilizzando un oggetto insolito.

Link: http://www.pxleyes.com/tutorial/photoshop/1692/How-To-Create-Beautiful-Iris-Flowers.html

fonte: www.sastgroup.com » Vai al post originale

Feb 02

E ‘possibile ottenere il valore di una costante PHP dinamicamente utilizzando la funzione constant().

 
class example {
 
const SITE_ID_NZ = 1;
const SITE_ID_AU = 2;
const SITE_ID_US = 3;
const SITE_ID_CA = 4;
 
function get_country_id($country_code) {
$constant = ’self::SITE_ID_’.strtoupper($country_code);
if(defined($constant)) {
return constant($constant);
}
else {
return false;
}
}
 
}
 

fonte: www.sastgroup.com » Vai al post originale

Feb 02

Questo script PHP e jQuery darà ai visitatori la possibilità di creare note con un’anteprima in tempo reale e di spostarle sullo schermo. Ogni movimento verrà salvato nel database tramite AJAX.

Link: http://tutorialzine.com/2010/01/sticky-notes-ajax-php-jquery/

fonte: www.sastgroup.com » Vai al post originale

Feb 02

In questo tutorial Photoshop imparerete come creare un cartoon utilizzando lo strumento penna e forma.

Link: http://themegamag.com/tutorials/draw-a-cartoon-boy-in-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Feb 02

Questo bellissimo set di icone in formato vettoriale è disponibile in 32px e 16px. Nel file ZIP troverete le icone in tre formati diversi, EPS, PNG e GIF.

Link: http://icondock.com/free/vector-social-media-icons

fonte: www.sastgroup.com » Vai al post originale

Gen 31

In questo tutorial vi vostreremo come creare uno sfondo colorato per San Valentino, utilizzando forme personalizzate, stili di livello e altri strumenti Photoshop!

Link: http://www.adobetutorialz.com/articles/30970252/1/create-a-colorful-background-for-valentines-day

fonte: www.sastgroup.com » Vai al post originale

Gen 31

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.setBufferTime(4);
my_video.attachVideo(stream_ns);
stream_ns.play(”promo.flv”);

stream_ns.onStatus = function(info) {
var netStreamStatus = info.code;
if (netStreamStatus == ‘NetStream.Play.Stop’) {
stream_ns.seek(0);
}
};

stop();

fonte: www.sastgroup.com » Vai al post originale

Gen 31

Buongiorno a tutti!
oggi vi dimostrerò come utilizzare PHP per svolgere i copiti per casa con un semplice script PHP!
La formula di Pitagora è la seguente: a² + b² = c²

Lo script è questo:

 

Finding the Hypotenuse
 
< ?php
 
if($_POST[‘Submit’]) {
 
$num1 = $_POST[‘num1′];
$num2 = $_POST[‘num2′];
 
$sqrd1 = $num1*$num1; //the squared number
$sqrd2 = $num2*$num2; //the squared number
 
$sumof = $sqrd1+$sqrd2; //the sum of the squared number
 
$answer = sqrt($sumof); //the answer
 
//below is the working for you to copy out.
echo("The answer is " . $ans . ".
Working:
a² = b² + c²
a² = "
. $num1 . "² + " . $num2 .
a² = "
. $sqrd1 . " + " . $sqrd2 . "
a² = "
. $sumof . "
a = √"
. $sumof . "
a = $answer "

);
}
?>
 
//the form to get the input variables

Number 1

Number 2

 

 

fonte: www.sastgroup.com » Vai al post originale

Gen 31

In quasi tutti i browser ormai sono presenti le schede di navigazione, prendiamo Firefox ad esempio, quando aprite un link cliccando con il tasto sinistro del mouse apparirà la voce “Apri in nuova scheda”. In questo tutorial vedremo come simulare con jQuery questa funzionalità che i browser supportano.

Demo: http://www.jankoatwarpspeed.com/examples/dynamic_tabs/

Tutorial: http://www.jankoatwarpspeed.com/post/2010/01/26/dynamic-tabs-jquery.aspx

fonte: www.sastgroup.com » Vai al post originale

Gen 31

Se volete stupire la vostra ragazza/ragazzo con un bellissimo sfondo da mettere sul desktop, dovete assolutamente seguire questo tutorial Photoshop!
L’immagine che vedete sopra è il risultato finale del tutorial, ma ovviamente, dopo aver preso familiarità con lo strumento pennello, potete modificare lo sfondo secondo i vostri gusti artistici!

Link: http://www.adobetutorialz.com/articles/30970259/1/create-an-abstract-valentine-background-with-hearts

fonte: www.sastgroup.com » Vai al post originale

Gen 31

Se avete un sito web o un blog che si basa sui tag PRE, si conosce l’importanza di convertire il contenuto del tag PRE alla loro entità HTML. Facendo così, infatti, si impedisce il possibile problema di rendering.
La funzione che trovate qui sotto evita proprio i problemi che abbiamo appena elencato.

 
//replaces pre content with html entities
function pre_entities($matches) {
return str_replace($matches[1],htmlentities($matches[1]),$matches[0]);
}
//to html entities; assume content is in the "content" variable
$content = preg_replace_callback(‘/
(.*?)/imsu’,pre_entities, $content);

fonte: www.sastgroup.com » Vai al post originale

Gen 31

Questo set di 31 icone vettoriali renderà le vostre pagina web più belle e accattivanti!
E’possibile utilizzare le icone liberamente senza restrinzioni di copyright.

Link: http://iconeden.com/icon/shine.html

fonte: www.sastgroup.com » Vai al post originale

Gen 29

David Walsh ha creato un bellissimo effetto Accordion con MooTools che si apre semplicemente passando sopra il mouse!

Link: http://davidwalsh.name/mootools-accordion-print

fonte: www.sastgroup.com » Vai al post originale

Gen 29

In questo tutorial imparerete a creare uno sfondo esplosivo 3D utilizzando Illustrator e Photoshop!

Link: http://kapdesignstudio.com/archives/680

fonte: www.sastgroup.com » Vai al post originale

Gen 29

Grazie a questo plugin jQuery sarà possibile simulare alcune funzionalità di Firebug!

Link: http://demos.usejquery.com/brosho-plugin/

fonte: www.sastgroup.com » Vai al post originale

Gen 29

In questo tutorial imparerete a colorare foto in bianco e nero grazie allo strumento pennello di Photoshop!
L’immagine che vedete sopra sarà il risultato finale che otterrete seguendo questo tutorial.

Link: http://www.webdesign.org/photoshop/photo-editing/color-touched-black-and-white-photos.15724.html

fonte: www.sastgroup.com » Vai al post originale

Gen 29

Questo è uno script semplice ma efficace per estendere la tua textarea con l’attributo maxlength, così l’input dell’utente non può superare un certo numero di caratteri.
E’possibile applicare la funzione a più textarea presenti nella stessa pagina!

Codice Javascript

 

 
/***********************************************
* Textarea Maxlength- © Jooria Refresh Your Site (www.jooria.com)
* This notice must stay intact for legal use.
* Visit http://www.jooria.com
***********************************************/

 
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}
 

 

Codice HTML

 

 

fonte: www.sastgroup.com » Vai al post originale

Gen 29

Questo plugin jQuery è un tentativo di ricreare i pulsanti “IMAGELESS” di Google e dimostrare che non ci vuole un intero team di ingegneri e un ciclo infinito di revisione del codice e il controllo di qualità (parole loro) per tirare fuori questo. I pulsanti possono adattarsi automaticamente allo stile presente nella vostra pagina.

Link: http://swizec.com/code/styledButton/

fonte: www.sastgroup.com » Vai al post originale

Gen 27

In questo tutorial PHP imparerete ad inviare email a più destinatari.

elist.txt

firstemail@here.com
secondemail@there.com
yourplace@somewhere.com
another@elsewhere.com

Script invio email

 
< ?php
// read the list of emails from the file.
$email_list = file("elist.txt");
 
// count how many emails there are.
$total_emails = count($email_list);
 
// go through the list and trim off the newline character.
for ($counter=0; $counter
 

fonte: www.sastgroup.com » Vai al post originale

Gen 27

Chi non ha visto il capolavoro di James Cameron, Avatar? Volete trasformarvi anche voi in Na’Vi, il protagonista di questo splendido film? Anche in questo caso Photoshop ci da una mano per manipolare il volto da sottoporre alla trasformazione! Seguite il tutorial passo passo e il risultato finale sarà simile alla foto che vedete sopra.

Link: http://www.webdesign.org/photoshop/photo-editing/na-vi-avatar-photo-manipulation-exclusive-tutorial.18015.html

fonte: www.sastgroup.com » Vai al post originale

Gen 27

jQuery.sheet riproduce quasi fedelmente gli strumenti e l’interfaccia di MS Excel. E’ facile da implementare e da personalizzare. Maggiori dettagli, la demo e la documentazione la trovate qui!

fonte: www.sastgroup.com » Vai al post originale

Gen 27

Blozilla, è una soluzione opensource italiana professionale di Content Management System per la gestione dei contenuti di un sito web interattivo.

E’ un’applicazione modulare che offre all’utente la massima libertà di gestione sia dei contenuti che delle aree da gestire, inoltre da la possibilità di raggruppare in maniera ordinata le categorie, le pagine ed eventualmente gruppi di pagine.
La gestione è del tutto autonoma, basta disporre di un browser (es. Internet Explorer, FireFox, Opera) e dei dati di accesso e da qualsiasi parte del mondo è possibile inserire i propri contenuti.

CMS ed editor visuale
Blozilla dispone di un Content Management System grazie al quale è possibile gestire tutto il contenuto ed il materiale relativo senza nessuno strumento aggiuntivo oltre al browser e senza disporre di alcuna conoscenza php. Grazie ad un potente editor WYSIWYG integrato è inoltre possibile produrre testi multimediali e formattati senza scrivere codice HTML.

Multilingua
Blozilla è stato progettato per consentire un facile inserimento e gestione di contenuti in piu lingue. Non si hanno limiti nella creazione di lingue per le quali è possibile anche definire il loro charset

Url rewriting
Il cms prevede una funzione di url rewriting che sfruttando il file .htaccess (solo su server linux) permette di trasformare gli url delle pagine per renderle piu appetibili ai motori di ricerca

Upload integrato
Un componente per l’upload permette di utilizzare Blozilla da qualsiasi computer dotato semplicemente di browser, ma di sfruttare anche la possibilità di pubblicare un file multimediale o un allegato.

Template personalizzabili
Blozilla permette di modificare agevolmente il template grafico del sito, separando il layout dal codice di programmazione, in questo modo ogni web designer può rivedere (anche completamente!) l’impostazione del sito senza modificare per nulla la programmazione.

Gestione menu
Blozilla permette di creare e modificare in maniera molto avanzata i menu e le condizioni di apparizione.

http://www.blozilla.com/index.php

fonte: www.sastgroup.com » Vai al post originale

Gen 27

In questo tutorial imparerete a salvare lo stato dei pannelli “Drag and Drop” e a recuperarli quando l’utente carica nuovamente la pagina!

Link: http://webdeveloperplus.com/jquery/saving-state-for-collapsible-drag-drop-panels/

fonte: www.sastgroup.com » Vai al post originale

Gen 27

In questo tutorial vedrete com’è semplice cercare e sostituire con PHP!

 
< ?php
$entry = "bla bla bla :\)"; //contenuto
$pattern = ":\)"; //elemento da cercare
$replacement = ""; //elemento da sostituire
$result_entry = ereg_replace($pattern,$replacement,$entry); //se trova l’elemento da cercare lo sostituisce con il valore di "$replacement"
echo "$result_entry"; //stampa il risultato
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 27

In questo tutorial imparerete a creare uno scenario fantastico piena di colori e creatività! Il tutorial è mirato ai principianti ma non fa male nemmeno ai “guru” Photoshop!

Link: http://www.pxleyes.com/tutorial/photoshop/1694/Create-a-Colorful-Rainbow-Fantasy-Scene.html

fonte: www.sastgroup.com » Vai al post originale

Gen 25

CSS è grande e quando è combinato con un potente framework JavaScript come jQuery, è possibile ottenere alcune cose davvero sorprendenti. La combinazione di questi due ti consente di migliorare l’esperienza degli utenti fornendo un’interfaccia web più intuitiva e reattiva.
Qui di seguito trovate 15 modi per usare jQuery migliorando le prestazioni dei CSS.

Link: http://webdeveloperplus.com/css/15-ways-to-improve-css-techniques-using-jquery/

fonte: www.sastgroup.com » Vai al post originale

Gen 25

Come avrete già capito dal titolo, in questo tutorial vi mostrerò come aggiungere e modificare gli elementi di un array.

 
< ?php
$pantry = array(
1 => "apples",
2 => "oranges",
3 => "bananas"
);
?>
 

Quello che vedete sopra è un array con tre elementi.

 
< ?php
$pantry[4] = "potatoes";
$pantry[5] = "bread";
?>
 

Nella sintassi che vedete sopra, stiamo dicendo a PHP di aggiungere altri due elementi con indice 4 e 5.

 
< ?php
$pantry[4] = "tomatoes";
?>
 

Qui invece stiamo sovrascrivendo il valore precedente con “tomatoes”. Il risultato dell’array sarà simile a questo:

 
< ?php
$pantry = array(
1 => "apples",
2 => "oranges",
3 => "bananas",
4 => "tomatoes",
5 => "bread"
);
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 25

In questo semplice e bel tutorial sarà possibile creare un Wallpaper di alta qualità da aggiungere tra gli sfondi desktop del vostro sistema operativo!

Link: http://www.pxleyes.com/tutorial/photoshop/1658/Create-a-Psd-Geek-Wallpaper-From-Scratch.html

fonte: www.sastgroup.com » Vai al post originale

Gen 25

In questo video-tutorial imparerete come inserire luci e ombre utilizzando i livelli 3D che mette a disposizione Photoshop CS4!

fonte: www.sastgroup.com » Vai al post originale

Gen 25

Grazie a questo semplice tutorial imparerete come creare uno sfondo in movimento grazie a jQuery!

Link: http://www.gayadesign.com/diy/text-with-moving-backgrounds-with-jquery/

fonte: www.sastgroup.com » Vai al post originale

Gen 25

La tigre è uno degli animali più “cool” della terra. E ‘un animale molto potente, pericoloso, ma affascinante. In questo tutorial imparerete come creare un tigrotto utilizzando gli strumenti che mette a disposizione Illustrator. Siete pronti? Si comincia!

Link: http://designinformer.com/create-a-cute-little-tiger-in-illustrator/

fonte: www.sastgroup.com » Vai al post originale

Gen 23

Ecco un semplice script che vi permette di creare un calendario in PHP!

 
< ?php
 
if($_GET[‘month’]) {
$month = $_GET[‘month’];
}
else {
$month = date(‘n’);
$_GET[‘month’] = date(‘n’);
}
if($_GET[‘year’]) {
$year = $_GET[‘year’];
}
else {
$year = date(‘Y’); // Year
$_GET[‘year’] = date(‘Y’);
}
 
$firstday = mktime(0, 0, 0, $month, 1, $year);
$number = cal_days_in_month(CAL_GREGORIAN, $month, $year); // Number of Days in a Month
$title = date(‘F’, $firstday); // Month name
$day = date(‘D’, $firstday);
 
if($day == "Sun") {
$before = "0";
}
elseif($day == "Mon") {
$before = "1";
}
 
elseif($day == "Tue") {
$before = "2";
}
 
elseif($day == "Wed") {
$before = "3";
}
 
elseif($day == "Thu") {
$before = "4";
}
 
elseif($day == "Fri") {
$before = "5";
}
 
elseif($day == "Sat") {
$before = "6";
}
 
if($_GET[‘month’] == 12) {
$nextmonth = 1;
$previousmonth = $_GET[‘month’] - 1;
$nextyear = $_GET[‘year’] + 1;
$previousyear = $_GET[‘year’];
}
 
elseif($_GET[‘month’] == 1) {
$previousmonth = 12;
$nextmonth = $_GET[‘month’] + 1;
$previousyear = $_GET[‘year’] - 1;
$nextyear = $_GET[‘year’];
}
 
else {
$nextmonth = $_GET[‘month’] + 1;
$previousmonth = $_GET[‘month’] - 1;
$nextyear = $_GET[‘year’];
$previousyear = $_GET[‘year’];
}
 
echo"&laquo;";
echo"&nbsp; $title $year &nbsp;";
echo"&raquo;";
 
$i = 1;
$real = 1 + $before;
 
echo"

";
while($before > 0) {
echo"

 
";
$before;
}
 
while($i < = $number) {
 
echo"
$i "
;
 
$divide = $real / 7;
if(is_int($divide)) {
echo"
"
;
}
++$real;
++$i;
}
 
echo"

 
";
 
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 23

A volte molte donne hanno paura di cambiare il colore dei capelli perchè non sanno se quella tonalità gli starà bene in viso o meno.
Photoshop ci aiuta anche in questo! Grazie a questo tutorial imparerete come cambiare il colore dei capelli in modo del tutto rapido e semplice.

Link: http://vampyriccadence.blogspot.com/2009/10/change-hair-color-tutorial-red-to-black.html

fonte: www.sastgroup.com » Vai al post originale

Gen 23

In questo tutorial imparerete come scambiare temi utilizzando PHP e CSS.
Io la reputo una tecnica vantaggiosa, in quanto è possibile manipolare i CSS in qualsiasi modo utilizzando solo una pagina!

Link: http://blog.adamoliver.net/tutorials/theme-switcher-with-php-variables-in-css/

fonte: www.sastgroup.com » Vai al post originale

Gen 23

PanoScroll è un plugin jQuery che permette di visualizzare foto panoramiche facendo scorrere lo sfondo di un div.

Link: http://steve.deadlycomputer.com/portfolio/PanoScroll/

fonte: www.sastgroup.com » Vai al post originale

Gen 23

Questo tutorial vi insegnerà una tecnica per integrare il tuo schizzi nelle tue opere digitali. Useremo Photoshop per aumentare il contrasto dell’immagine, Illustrator per fornire i colori e ancora una volta Photoshop per i ritocchi.

Link: http://wegraphics.net/tutorials/photoshop/how-to-integrate-your-digital-sketches-in-your-works/

fonte: www.sastgroup.com » Vai al post originale

Gen 23

Ogni giorno ci ritroviamo a combattere contro lo spam, inventando sistemi per far si che l’email presente in una pagina web non venga vista dallo spam. Qui di seguito trovate uno dei tanti modi per codificare un’email.

 
< ?php
function encode_email($e)
{
for ($i = 0; $i < strlen($e); $i++) { $output .= ‘&#’.ord($e[$i]).‘;’; }
return $output;
}
echo(encode_email(‘tuaemail@email.com’));
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 21

Questo divertente tutorial Photoshop vi spiegherà come realizzare un testo 3D effetto giungla.
Creeremo il testo con Xara3D e useremo Photoshop per applicare la texture della pelle degli animali!

Link: http://wegraphics.net/tutorials/photoshop/jungle-3d-text-in-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Gen 21

Credo che almeno una volta vi è capitato di cercare su Google qualcosa e di fare un errore di battitura. Il famoso motore di ricerca vi mostrerà “Forse cercavi….”. Se volete dare anche voi la possibilità ai vostri utenti di dare un suggerimento, seguite questo tutorial!

 
$dictionary = array(
"php", "javascript", "css"
);
 
$word = "japhp";
 
$best_match = $dictionary[0];
$match_value = levenshtein($dictionary[0], $word);
 
foreach($dictionary as $w) {
$value = levenshtein($word, $w);
if( $value < $match_value ) {
$best_match = $w;
$match_value = $value;
}
}
 
echo "Did you mean the ‘$best_match’ category?";
 
//stamperà: Did you mean the ‘php’ category?
 

fonte: www.sastgroup.com » Vai al post originale

Gen 21

In questo tutorial troverete due esempi che vi mostreranno com’è possibile accedere alle variabili globali.

 
$a = "Hello";
$b = "World";
function hello()
{
global $a, $b;
echo "$a $b";
}
hello(); //visualizza: Hello World
 
 
$a = "Hello";
$b = "World";
function hello()
{
echo $GLOBALS[’a’] .’ ’. $GLOBALS[’b’];
}
hello(); //visualizza: Hello World
 

fonte: www.sastgroup.com » Vai al post originale

Gen 21

Un modo “attraente” per organizzare i vostri contenuti in un piccolo spazio è quello di utilizzare un sistema di tab. Questo tutorial vi mostrerà come creare dei bellissimi tab animati utilizzando CSS e MooTools!

Link: http://net.tutsplus.com/tutorials/javascript-ajax/sexy-animated-tabs-using-mootools/

fonte: www.sastgroup.com » Vai al post originale

Gen 21

In questo tutorial imparerete come eliminare gli occhi rossi dalle vostre foto!

fonte: www.sastgroup.com » Vai al post originale

Gen 21

TipTip è un leggero plugin jQuery che permette di visualizzare un tooltip. TipTip non utilizza immagini ed completamente personalizzabile tramite CSS.

Link: http://code.drewwilson.com/entry/tiptip-jquery-plugin

fonte: www.sastgroup.com » Vai al post originale

Gen 19

In questo tutorial imparerete a realizzare un bellissimo pulsante con effetto glossy utilizzando Photoshop!

Link: http://www.psdvault.com/drawing/draw-a-rather-cute-unique-style-play-button-in-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Gen 19

L’estensione PHP imagick è davvero sorprendente. E’ possibile aggiungere effetti, ruotare un’immagine, convertire e qualsiasi altra manipolazione si possa immaginare! Nell’esempio che vedete qui sotto vi mostriamo com’è possibile convertire un file PSD in immagine PNG.

 
< ?php
 
/*** the image name ***/
$image = ‘my.psd’;
 
/*** read the image into imagick ***/
$im = new Imagick( $image );
 
/*** convert to png ***/
$im->setImageFormat(‘png’);
 
/*** thumbnail the image ***/
$im->thumbnailImage( 200, null );
 
/*** set the correct header ***/
header( "Content-Type: image/png" );
 
/*** display the image ***/
echo $im;
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 19

In questo articolo troverete una raccolta di plugin jQuery che ogni sviluppatore web dovrebbe avere!

Link: http://www.tripwiremagazine.com/2009/12/15-jquery-plugins-that-you-will-find-useful-in-2010.html

fonte: www.sastgroup.com » Vai al post originale

Gen 19

Se avete bisogno di integrare nel vostro sito una web chat, iJab potrebbe essere adatto a voi! Si tratta di una chat Open Source realizzata in Ajax che può essere utilizzata liberamente senza nessun costo.

Link: http://www.ijab.im/demos/

fonte: www.sastgroup.com » Vai al post originale

Gen 19

In questo tutorial imparerete a realizzare un effetto di testo in stile Harry Potter!
L’immagine che vedete sopra è il risultato finale del tutorial.

Link: http://richworks.in/2010/01/create-a-stormy-harry-potter-text-effect-in-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Gen 19

Aggiungere e rimuovere le variabili da e per gli URL utilizzando PHP è un processo relativamente semplice, è vero, ma queste due funzioni rendono il processo meno lungo!

AGGIUNGE VARIABILI IN UNA QUERYSTRING

 
function add_querystring_var($url, $key, $value) {
 
$url = preg_replace(‘/(.*)(\?|&)’ . $key . ‘=[^&]+?(&)(.*)/i’, , $url . ‘&’);
$url = substr($url, 0, -1);
if (strpos($url, ‘?’) === false) {
return ($url . ‘?’ . $key . ‘=’ . $value);
} else {
return ($url . ‘&’ . $key . ‘=’ . $value);
}
 
}
 

RIMUOVE VARIABILI IN UNA QUERYSTRING

 
function remove_querystring_var($url, $key) {
 
$url = preg_replace(‘/(.*)(\?|&)’ . $key . ‘=[^&]+?(&)(.*)/i’, , $url . ‘&’);
$url = substr($url, 0, -1); return ($url);
 
}
 

fonte: www.sastgroup.com » Vai al post originale

Gen 17

Se volete far condividere ai visitatori i contenuti delle vostre pagine con un effetto bellissimo da vedere ma facile da implementare, non dovete far altro che seguire questo semplice tutorial.

Link: http://webdeveloperplus.com/jquery/quick-easy-way-to-implement-drag-n-share-with-jquery/

fonte: www.sastgroup.com » Vai al post originale

Gen 17

In questo tutorial imparerete ad aumentare i dettagli e la nitidezza di una foto attraverso il “Filtro Accentua” di Photoshop!

fonte: www.sastgroup.com » Vai al post originale

Gen 17

Tutti noi sappiamo che (purtroppo) Internet Explorer fa i “capricci” in tutte le varie versioni. Per ovviare a questo problema si usano i commenti condizionali, che permettono di creare una regola CSS personalizzata per ogni versione di IE.

Link: http://davidwalsh.name/ie-conditional-comments

fonte: www.sastgroup.com » Vai al post originale

Gen 17

Grazie alla funzione “implode()” sarà possibile unire più stringhe in una singola. Qui di seguito trovate un’esempio di quanto detto!

 
< ?php
$date = array(‘01′, ‘01′, ‘2006′);
$keys = array(‘php’, ’string’, ‘function’);
print("A formated date: ".implode("/",$date)."\n");
print("A keyword list: ".implode(", ",$keys)."\n");
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 17

Grazie a questo semplicissimo tutorial imparerete come creare un file grazie alla funzione fwrite che mette a disposizione PHP!

 
< ?php
 
$filename = "mioFile.txt";
$content = "Inserire contenuto qui";
 
$open = fopen($filename, "a");
 
if(fwrite($open, $content)){
 
echo "file creato!";
fclose($open);
}else{
 
echo "Non posso creare il file!";
 
}
 
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 17

In questo articolo imparerete come creare una pianeta terra realistico, utilizzando gli stili di livello, lo strumento sfumatura, lo strumento penna e molti altri strumenti. Il livello di difficoltà di questo tutorial è intermedio.

Link: http://richworks.in/2009/12/create-a-realistic-looking-earth-in-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Gen 15

Grazie a questo tutorial imparerete a realizzare la parte grafica della chat del Social Network più famoso al mondo, utilizzando jQuery e CSS!

Link  Parte 1: http://www.sohtanaka.com/web-design/facebook-style-footer-admin-panel-part-1/

Link Parte 2: http://www.sohtanaka.com/web-design/facebook-style-footer-admin-panel-part-2/

Demo: http://www.sohtanaka.com/web-design/examples/footer-panel/

fonte: www.sastgroup.com » Vai al post originale

Gen 15

Teehan + Lax ha rilasciato Palm Pre GUI PSD per aiutare i progettisti del settore ad utilizzare le parti grafiche di questo telefono. Gli elementi sono realizzati con i vettori per il ritocco e la scalatura.

Link: http://www.teehanlax.com/blog/2009/07/08/palm-pre-gui-psd/

fonte: www.sastgroup.com » Vai al post originale

Gen 15

Grazie a questo plugin jQuery sarà possibile “accorciare” un testo e visualizzarlo interamente solo se richiesto dall’utente!
Considero questo plugin molto utile proprio perchè permette di ottenere una grafica pulita, mantenedo i testi tutti della stessa dimensione all’interno di una pagina web!

Link: http://papermashup.com/truncate-text-with-the-jtruncate-jquery-plugin/

fonte: www.sastgroup.com » Vai al post originale

Gen 15

Credo che ognuno di voi sapete che se mettete l’email visibile sul vostro sito dopo qualche giorno verrete assaliti dallo spam. Facebook per ovviare a questo problema ha convertito l’email (in formato testo) in immagine.
In questo tutorial imaparerete come realizzare quanto descritto sopra.

 
< ?php
 
// header dell’immagine
header("Content-type: image/jpg");
 
// indirizzo email
$string = "tuaemail@dominio.com";
 
// impostazioni generali
$font = 4;
$width = ImageFontWidth($font) * strlen($string);
$height = ImageFontHeight($font);
 
// creazione immagine
$im = @imagecreatetruecolor ($width,$height);
 
//sfondo bianco
$background_color = imagecolorallocate ($im, 255, 255, 255);
 
//testo nero
$text_color = imagecolorallocate ($im, 0, 0, 0);
 
// conversione del testo in immagine
imagestring ($im, $font, 0, 0, $string, $text_color);
 
// visualizzazione
imagejpeg ($im);
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 15

In questo tutorial, imparerete come creare copertine per un video preferito o gioco per computer, utilizzando diversi strumenti di Photoshop come strumento Pennello, diversi metodi di fusione, e altro ancora. Buon lavoro!

Link: http://www.adobetutorialz.com/articles/30970244/1/create-a-fuel-game-cover-in-photoshop

fonte: www.sastgroup.com » Vai al post originale

Gen 15

Diversi siti web utilizzano fastidiose finestre popup. Il problema è che alcune persone hanno il blocco popup, ma non lo sanno, in tal modo la nuova finestra non si apre. Ovviamente il browser avvisa l’utente, ma non è sempre così evidente come dovrebbe essere. Ecco un metodo rapido per verificare se la finestra popup è stata bloccato.

 
var windowName = ‘userConsole’;
var popUp = window.open(‘/popup-page.php’, windowName, ‘width=1000, height=700, left=24, top=24, scrollbars, resizable’);
if (popUp == null || typeof(popUp)==‘undefined’) {
alert(‘Please disable your pop-up blocker and click the "Open" link again.’);
}
else {
popUp.focus();
}
 

Fonte: http://davidwalsh.name/popup-block-javascript

fonte: www.sastgroup.com » Vai al post originale

Gen 13

In questo tutorial imparerete a creare un testo con effetto cucitura. Grazie agli stili di livello Photoshop sarà possibile creare un’immagine come quella che vedete sopra!

Link: http://richworks.in/2009/12/create-a-cool-and-realistic-denim-textured-typography/

fonte: www.sastgroup.com » Vai al post originale

Gen 13

PHP ci mette a disposizione una funzione molto utile. La funzione “range”permette di creare un array di numeri o lettere specificando il numero / lettera di partenza e quello di fine. Per capire meglio quello che vi sto dicendo, vi consiglio di dare un’occhiata agli esempi sotto!

ESEMPIO 1

 
$values = range(1, 5);
 

OUTPUT

 
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
)
 

ESEMPIO 2

 
$values = range(1, 10, 2);
 

OUTPUT

 
Array
(
[0] => 1
[1] => 3
[2] => 5
[3] => 7
[4] => 9
)
 

ESEMPIO 3

 
$letters = range(‘z’, ‘r’, 2);
 

OUTPUT

 
Array
(
[0] => z
[1] => x
[2] => v
[3] => t
[4] => r
)
 

fonte: www.sastgroup.com » Vai al post originale

Gen 13

Con questo script è possibile convertire liberamente tra 36 valute diverse da tutto il mondo. Lo script utilizza i tassi di cambio scaricati dalla Banca centrale europea, tramite un file XML che si trova su www.ecb.int/stats/eurofxref/eurofxref-daily.xml. Le tariffe vengono poi memorizzate nel proprio database MySQL per l’impiego e quindi aggiornato quotidianamente.

CLASSE

 
< ?php
 
/*
* File: CurrencyConverter.php
* Author: Simon Jarvis
* Copyright: 2005 Simon Jarvis
* Date: 10/12/05
* Link: http://www.white-hat-web-design.co.uk/articles/php-currency-conversion.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
* http://www.gnu.org/licenses/gpl.html
*
*/

 
class CurrencyConverter {
 
var $xml_file = "www.ecb.int/stats/eurofxref/eurofxref-daily.xml";
var $mysql_host, $mysql_user, $mysql_pass, $mysql_db, $mysql_table;
var $exchange_rates = array();
 
//Load Currency Rates
function CurrencyConverter($host,$user,$pass,$db,$tb) {
$this->mysql_host = $host;
$this->mysql_user = $user;
$this->mysql_pass = $pass;
$this->mysql_db = $db;
$this->mysql_table = $tb;
 
$this->checkLastUpdated();
 
$conn = mysql_connect($this->mysql_host,$this->mysql_user,$this->mysql_pass);
 
$rs = mysql_select_db($this->mysql_db,$conn);
 
$sql = "SELECT * FROM ".$this->mysql_table;
 
$rs = mysql_query($sql,$conn);
 
while($row = mysql_fetch_array($rs)) {
$this->exchange_rates[$row[‘currency’]] = $row[‘rate’];
}
}
 
/* Perform the actual conversion, defaults to £1.00 GBP to USD */
function convert($amount=1,$from="GBP",$to="USD",$decimals=2) {
return(number_format(($amount/$this->exchange_rates[$from])*$this->exchange_rates[$to],$decimals));
}
 
/* Check to see how long since the data was last updated */
function checkLastUpdated() {
$conn = mysql_connect($this->mysql_host,$this->mysql_user,$this->mysql_pass);
 
$rs = mysql_select_db($this->mysql_db,$conn);
 
$sql = "SHOW TABLE STATUS FROM ".$this->mysql_db." LIKE ‘".$this->mysql_table."’";
 
$rs = mysql_query($sql,$conn);
 
if(mysql_num_rows($rs) == 0 ) {
$this->createTable();
} else {
$row = mysql_fetch_array($rs);
if(time() > (strtotime($row["Update_time"])+(12*60*60)) ) {
$this->downloadExchangeRates();
}
}
}
 
/* Download xml file, extract exchange rates and store values in database */
function downloadExchangeRates() {
$currency_domain = substr($this->xml_file,0,strpos($this->xml_file,"/"));
$currency_file = substr($this->xml_file,strpos($this->xml_file,"/"));
$fp = @fsockopen($currency_domain, 80, $errno, $errstr, 10);
if($fp) {
$out = "GET ".$currency_file." HTTP/1.1\r\n";
$out .= "Host: ".$currency_domain."\r\n";
$out .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
$buffer .= fgets($fp, 128);
}
fclose($fp);
 
$pattern = "{}is";
preg_match_all($pattern,$buffer,$xml_rates);
array_shift($xml_rates);
 
for($i=0;$imysql_host,$this->mysql_user,$this->mysql_pass);
 
$rs = mysql_select_db($this->mysql_db,$conn);
 
foreach($exchange_rate as $currency=>$rate) {
if((is_numeric($rate)) && ($rate != 0)) {
$sql = "SELECT * FROM ".$this->mysql_table." WHERE currency=’".$currency."’";
$rs = mysql_query($sql,$conn) or die(mysql_error());
if(mysql_num_rows($rs) > 0) {
$sql = "UPDATE ".$this->mysql_table." SET rate=".$rate." WHERE currency=’".$currency."’";
} else {
$sql = "INSERT INTO ".$this->mysql_table." VALUES(’".$currency."’,".$rate.")";
}
$rs = mysql_query($sql,$conn) or die(mysql_error());
}
}
}
}
 
/* Create the currency exchange table */
function createTable() {
$conn = mysql_connect($this->mysql_host,$this->mysql_user,$this->mysql_pass);
 
$rs = mysql_select_db($this->mysql_db,$conn);
 
$sql = "CREATE TABLE ".$this->mysql_table." ( currency char(3) NOT NULL default ”, rate float NOT NULL default ‘0′, PRIMARY KEY(currency) ) ENGINE=MyISAM";
 
$rs = mysql_query($sql,$conn) or die(mysql_error());
 
$sql = "INSERT INTO ".$this->mysql_table." VALUES(’EUR’,1)";
 
$rs = mysql_query($sql,$conn) or die(mysql_error());
 
$this->downloadExchangeRates();
}
 
}
 
?>

ESEMPIO

 
< ?php
include(‘CurrencyConverter.php’);
$x = new CurrencyConverter(‘your_host’,‘your_username’,‘your_password’,‘your_database_name’,‘your_table_name’);
echo $x->convert(2.50,‘GBP’,‘USD’);
?>
 

Fonte: http://www.white-hat-web-design.co.uk/articles/php-currency-conversion.php

fonte: www.sastgroup.com » Vai al post originale

Gen 13

L’obiettivo di mascherare la password in ritardo, è quello di aiutare l’utente attraverso un modo meno “macchinoso”, compilando i form e in particolare i campi password. Questo metodo è ormai diventato popolare su tutti i dispositivi mobili, applicazioni desktop e browser Web.

Link: https://www.queridodesign.net/blog/passshark

fonte: www.sastgroup.com » Vai al post originale

Gen 13

In questo video-tutorial imparerete a togliere le borse dal viso utilizzando i strumenti che mette a disposizione Photoshop.

fonte: www.sastgroup.com » Vai al post originale

Gen 13

Questo bellissimo script riproduce “quasi” fedelmente la bacheca di Facebook, infatti, se provate a mettere un link youtube il sistema farà visualizzare il video.

Link: http://www.9lessons.info/2009/12/facebook-style-wall-post-script-with.html

fonte: www.sastgroup.com » Vai al post originale

Gen 11

In questo tutorial useremo un pannello di opzioni personalizzate per inserire i codici di monitoraggio analitycs. Questo sarà possibile grazie a Wordpress 2.9 che mette a disposizione queste funzionalità.

Link: http://buildinternet.com/2010/01/create-custom-option-panels-with-wordpress-2-9/

fonte: www.sastgroup.com » Vai al post originale

Gen 11

In questo tutorial verrete guidati passo passo per creare un bellissimo tema spaziale come quello che vedete in figura.

Link: http://www.psdvault.com/photo-effect/design-an-awesome-space-themed-unleash-your-creativity-artwork-in-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Gen 11

Questo tutorial vi mostrerà come creare fuochi d’artificio stilizzati con Photoshop. La foto che vedete soprà è il risultato finale del tutorial.

Link: http://www.psdrockstar.com/photo-effects/creating-a-fireworks-effect/

fonte: www.sastgroup.com » Vai al post originale

Gen 11

L’esempio che vi mostro qui di seguito permette di eseguire un login tramite script.

 
$url = "http://www.somesite.com/members/";
 
$ch = curl_init();
 
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
// send the username and password
curl_setopt($ch, CURLOPT_USERPWD, "myusername:mypassword");
 
// if you allow redirections
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
// this lets cURL keep sending the username and password
// after being redirected
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
 
$output = curl_exec($ch);
 
curl_close($ch);
 

fonte: www.sastgroup.com » Vai al post originale

Gen 11

Tutorialzine ci mostra come creare un’avanzata timeline di eventi con l’aiuto di PHP, MySQL, CSS e jQuery.

Link: http://tutorialzine.com/2010/01/advanced-event-timeline-with-php-css-jquery/

fonte: www.sastgroup.com » Vai al post originale

Gen 11

Grazie a questo tutorial imparerete come selezionare / deselezionare tutte le checkbox presenti in un fieldset.

// these will be affected by check all

Check all

Checkbox

Checkbox

Checkbox

// these won’t be affected by check all; different fieldset

Checkbox

Checkbox

Checkbox

Gen 09

Grazie a questo tutorial imparerete come trasformare un volto in quello di un orco.

Link: http://csscreme.com/tutorials/photoshop-tutorials/shrek_girl_photoshop_tutorial

fonte: www.sastgroup.com » Vai al post originale

Gen 09

Come già saprete, l’aspetto grafico in un sito è molto importante, renderlo intuitivo e semplice è l’obiettivo che si pone ogni webmaster. Lo script che vi propongo oggi, permette di trascinare un div e all’evento “Drag” gli viene data un’opacità. Questo effetto è molto importante, in quanto fa capire all’utente che sta spostando quel determinato div.

Link: http://davidwalsh.name/mootools-drag-opacity

fonte: www.sastgroup.com » Vai al post originale

Gen 09

La funzione count() ritorna il numero degli elementi di un array. Come potete vedere nell’esempio sotto abbiamo passato come parametro l’array da contare e tramite “print” stampiamo il risultato!

 
$utenti = array ("pippo", "pluto", "topolino", "paperino");
print count($utenti);
 

fonte: www.sastgroup.com » Vai al post originale

Gen 09

Con il Plugin Google Maps jQuery sarà possibile semplificare l’implementazione di Google Maps. Questo plugin tenta di semplificare il processo di aggiunta di mappe in una pagina.

Link: http://www.mayzes.org/googlemaps.jquery.html

fonte: www.sastgroup.com » Vai al post originale

Gen 09

In questo fantastico tutorial imparerete come creare un testo floreale con Photoshop e Illustrator. Il tutorial lo considero semplice ma do per scontato che i miei lettori abbiano una conoscenza base di Illustrator e Photoshop!

Link: http://www.psdrockstar.com/text-effects/floral-text-wallpaper/

fonte: www.sastgroup.com » Vai al post originale

Gen 09

La funzione rmdir() consente agli sviluppatori di rimuovere una directory dall’FTP. Per poter eliminare una cartella è necessario che quest’ultima abbia le autorizzazioni necessarie. La funzione restituirà TRUE in caso di successo e FALSE in caso di fallimento.

 
< ?php
if (!is_dir(‘exampledir’)) {
mkdir(‘exampledir’);
}
 
rmdir(‘exampledir’);
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 07

In questo tutorial imparerete come creare una Lollipop Girl con Photoshop. Per creare questa illustrazione dovete saper usare bene lo strumento Pen Tool, quindi il tutorial è rivolto agli utenti più esperti. L’immagine che vedete sopra è il risultato finale del tutorial.

Link: http://www.psdrockstar.com/illustration/create-a-lollipop-girl-in-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Gen 07

Oggi vi mostrerò com’è possibile conoscere la dimensione massima di upload del vostro server, in questo modo sarà possibile effettuare controlli personalizzati affinchè la dimensione di upload del vostro form non venga superata!

 
< ?php echo "la dimensione massima di upload &egrave;: " . ini_get(‘upload_max_filesize’); ?>
 

Come potete vedere la funzione da applicare è semplicissima ma allo stesso tempo risulta molto utile!

fonte: www.sastgroup.com » Vai al post originale

Gen 07

openWYSIWYG è un editor Open Source estremamente veloce, scritto in Javascript e DHTML. Per applicarlo sulla vostra “textarea” bastano poche righe di codice. Per quanto riguarda la compatibilità dei browser non dovete preoccuparvi perchè funziona perfettamente!

Link: http://www.openwebware.com/wysiwyg/demo.shtml

fonte: www.sastgroup.com » Vai al post originale

Gen 07

Grazie a questo tutorial imparerete come creare una ragazza galattica come nell’immagine finale che vedete sopra.

Link: http://www.adobetutorialz.com/articles/30970236/1/create-a-galactic-girl-photo-manipulation-in-photoshop

fonte: www.sastgroup.com » Vai al post originale

Gen 07

Nell’esempio che vedete sotto potete vedere com’è possibile formattare i numeri direttamente con la funzione printf() messa a disposizione da PHP.

 
$number = 5;
printf("Decimal: %d", $number );
printf("Binary: %b", $number );
printf("Double: %f", $number );
printf("Octal: %o", $number );
printf("String: %s", $number);
printf("Hex (lower): %x", $number );
printf("Hex (upper): %X", $number );
 

fonte: www.sastgroup.com » Vai al post originale

Gen 07

Questo plugin jQuery permette di implementare sul vostro sito un Auto-Suggest e un Auto-Complete in modo del tutto semplice. Per questo plugin non sono necessarie immagini perchè l’aspetto è gestito con i CSS.

Link: http://code.drewwilson.com/entry/autosuggest-jquery-plugin

http://code.drewwilson.com/entry/autosuggest-jquery-plugin

fonte: www.sastgroup.com » Vai al post originale

Gen 05

Grazie a questo tutorial imparerete come allineare verticalmente un div utilizzando jQuery e MooTools!

Link: http://www.nitinh.com/2010/01/vertical-align-middle-using-javascript-jquery-mootools/

fonte: www.sastgroup.com » Vai al post originale

Gen 05

In questo articolo troverete una raccolta di 207 pennelli Photoshop utili per creare un mix di fiori.

Link: http://photoshoptutorials.ws/photoshop-downloads/photoshop-brushes/potpourri-photoshop-brushes.html

fonte: www.sastgroup.com » Vai al post originale

Gen 05

thumb2

Grazie a questo tutorial riiuscirete a creare una galleria come quellache vedete sopra!

Link: http://www.editorschoice.be/?p=1205

fonte: www.sastgroup.com » Vai al post originale

Gen 05

Questa funzione permette al programmatore di inserire un nuovo elemento in un determinato indice all’interno di un array esistente. L’elemento nuovo può essere una stringa o un altro array.

 
< ?php
function insertArrayIndex($array, $new_element, $index) {
/*** get the start of the array ***/
$start = array_slice($array, 0, $index);
/*** get the end of the array ***/
$end = array_slice($array, $index);
/*** add the new element to the array ***/
$start[] = $new_element;
/*** glue them back together and return ***/
return array_merge($start, $end);
}
?>
 

ESEMPIO APPLICATO

 
< ?php
 
$index = 3;
 
$new_element = ’steve irwin’;
 
$array = array(‘platypus’, ‘wallaby’, ‘koala’, ‘dingo’, ‘wombat’);
 
$new_array = insertArrayIndex($array, $new_element, $index);
 
print_r( $new_array );
 
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 05

Mi è capitato più di una volta di avere la necessità di far eseguire processi in background per compiere operazioni speciali. Immaginate a una chatserver che gestisce imessaggi in arrivo e li trasmette a tutti i client collegati. Per tale scopo non possiamo utilizzare su script eseguiti dagli utenti o cronjobs. Abbiamo bisogno di un sistema che gestisca una serie di comandi per tutto il tempo. Quì è dove i daemon ci tornano utili!

CLASSE

 
abstract class Daemon
{
const PID_BASE_PATH = ‘/var/run/’;
 
const LOG_NOTICE = 1;
const LOG_WARNING = 2;
const LOG_ERROR = 3;
 
private $_is_running = false;
private $_is_children = false;
private $_pid = 0;
private $_pid_file_path = ;
 
public function __construct($pid_filename)
{
$this->_pid_file_path = self::PID_BASE_PATH . $pid_filename;
 
// Makes sure that the script will not time out
set_time_limit(0);
ob_implicit_flush();
 
$this->logMessage(‘Starting daemon…’);
 
if ($this->_initialize())
{
$this->_start();
}
}
 
public function __destruct()
{
// Delete the PID file when the Daemon releases
if ($this->_is_children && file_exists($this->_pid_file_path))
{
$this->logMessage(‘Releasing daemon’);
unlink($this->_pid_file_path);
}
}
 
public function logMessage($msg, $level = self::LOG_NOTICE)
{
// Add your log code here
}
 
protected abstract function _loop();
 
private function _start()
{
$this->logMessage(‘Running…’);
$this->_is_running = true;
 
while ($this->_is_running)
{
$this->_loop();
}
}
 
private function _stop()
{
$this->logMessage(‘Stopping daemon’);
$this->_is_running = false;
}
 
private function _initialize()
{
if ($this->_isAlreadyRunning() || !$this->_fork())
{
return false;
}
 
// Make the current process a session leader
if (!posix_setsid())
{
$this->logMessage(‘Could not make the current process a session leader’,
self::LOG_ERROR);
return false;
}
 
// Write this process’ ID into the PID file
$fp = @fopen($this->_pid_file_path, ‘w’);
if (!$fp)
{
$this->logMessage(‘Could not write to PID file’, self::LOG_ERROR);
return false;
}
 
fputs($fp, $this->_pid);
fclose($fp);
 
// Switch to root directory so we do not keep any other directory in use
@chdir(‘/’);
 
// Maker us independant of the caller’s umask
umask(0);
 
declare(ticks = 1);
 
// Setup the signal handlers
pcntl_signal(SIGCHLD, array(&$this, ’sigHandler’));
pcntl_signal(SIGTERM, array(&$this, ’sigHandler’));
 
return true;
}
 
private function _isAlreadyRunning()
{
// Check if the daemon is already running by looking up if a PID file is already existing
$old_pid = @file_get_contents($this->_pid_file_path);
 
if ($old_pid !== false && posix_kill(trim($old_pid), 0))
{
$this->logMessage(‘Daemon already running with PID ‘ . $old_pid, self::LOG_ERROR);
return true;
}
 
return false;
}
 
private function _fork()
{
$this->logMessage(‘Forking…’);
 
// Make a copy of the current process
$pid = pcntl_fork();
 
if ($pid === -1) // error occured
{
$this->logMessage(‘Forking failed’, self::LOG_ERROR);
return false;
}
else if ($pid) // we are the parent - commit suicide
{
$this->logMessage(‘Killing parent’);
return false;
}
else // we are the child
{
$this->_is_children = true;
$this->_pid = posix_getpid();
 
return true;
}
}
 
public function sigHandler($sig)
{
switch ($sig)
{
// The daemon is requested to terminate
case SIGTERM:
 
$this->logMessage(‘Shutdown signal’);
$this->_is_running = false;
 
break;
 
// A child terminates
case SIGCHLD:
 
$this->logMessage(‘Halt signal’);
 
// Wait until all childs terminated
$status = null;
while (pcntl_waitpid(-1, $status, WHOHANG) > 0);
 
break;
}
}
}
 

CLASSE APPLICATA

 
class MyChatServer extends Daemon
{
public __construct()
{
parent::__construct(‘mychatserver.pid’);
}
 
protected function _loop()
{
// Do your stuff here
}
}
 

fonte: www.sastgroup.com » Vai al post originale

Gen 05

area30

In questo tutorial imparerete come creare una statua umana di pietra colpita dal maleficio di Medusa.

Link: http://www.psdrockstar.com/photo-effects/human-statue-effect/

fonte: www.sastgroup.com » Vai al post originale

Gen 03

In questo tutorial imparerete come salvare (e leggere successivamente) un array criptato all’interno di un record MySQL.

 
< ?php
 
function store_encrypt($array)
{ // Start function with function name store_encrypt.
if (!is_array($array))
{ // Check if $array is an array or not if it isnt return false.
return false; // return false.
}
else
{
foreach ($array as $key => $value)
{ // Cycle through the array.
$key = base64_encode($key); // Encode the key with base 64.
$value = base64_encode($value); // Encode the value with base 64.
 
$array[$key] = $value; // Put the key and value back into the array
}
return serialize($array); // Use the PHP serialize function to save the array, type and values and return the function.
}
}
 
function unstore_uncrypt($value)
{ // Start function with function name unstore_uncrypt.
if (!is_array($array))
{ // Check if $array is an array or not if it isnt return false.
return false; // return false.
}
else
{
$array = unserialize($value); // Restore the value into an array.
foreach ($array as $key => $value)
{ // Cycle through the array.
$key = base64_decode($key); // Decode the key from base 64.
$value = base64_decode($value); // Decode the value from base 64.
 
$array[$key] = $value; // Put they key and value back into the array.
}
return $array; // Return the array.
}
}
 
$conn = mysql_connect("DATABASE_LOCATION","DATABASE_USER","DATABASE_PASSWORD"); // Connect to mysql server
if (!$conn) die ("Could not connect MySQL"); // If unable to connect die
mysql_select_db("DATABASE_NAME",$conn) or die ("Could not open database"); // Now your connected select the correct database
 
$array = array("first_name" => "Peter", "last_name" => "Kelly", "website" => "http://www.pk-tuts.co.uk"); // Create the array.
$info = store_encrypt($array); // Run the function
$add_array = mysql_query("INSERT into `table` (`id`, `array`) values (”, ‘".$info."’);"); // Insert into the table
 
$result = mysql_query("SELECT * FROM `table` ORDER BY `id` DESC LIMIT 1"); // Select one row from table and order by id descending.
$r = mysql_fetch_array($result); // Select the data.
$uncrypt = unstore_uncrypt($r[‘array’]); // Get the array stored in the database and run the function to uncrypt it
echo "
“; // Do some formatting so the array looks pretty.
print_r($uncrypt); // Echo the array.
echo “”;
?>

fonte: www.sastgroup.com » Vai al post originale

Gen 03

page0_thumb

In questo tutorial imparerete come risolvere i problemi di compatibilità cross browser con l’aiuto di jQuery!

Link: http://addyosmani.com/blog/extending-css-with-jquery-a-new-years-guide/#myPosts

fonte: www.sastgroup.com » Vai al post originale

Gen 03

fairyPreview

Ecco un tutorial che mostra come creare una fata come nell’immagine sopra. Per i più pigri, nell’articolo in fondo alla pagina trovate il file PSD.

Link: http://www.psdrockstar.com/photo-effects/how-to-create-a-fairy-using-photos/

fonte: www.sastgroup.com » Vai al post originale

Gen 03

content-slider

Grazie a questo plugin sarà possibile integrare uno slide che apparirà solo se richiamato!

Link: http://srobbin.com/blog/jquery-pageslide/

fonte: www.sastgroup.com » Vai al post originale

Gen 03

Immagine-riflessa

In questo video-tutorial Photoshop imparerete come creare un’immagine riflessa utilizzando le sfumature e i livelli!

fonte: www.sastgroup.com » Vai al post originale

Gen 03

FeedCreator è una classe PHP che permette di creare feed in formati diversi, come ad esempio, RSS e Atom. Anche se l’ultimo aggiornamento risale al 2005, questa classe è tra le migliori per scrivere feed RSS, Atom, OPML e PIE.

Qui di seguito troverete un esempio per applicare questa splendida classe sul vostro sito!

 
< ?
include("feedcreator.class.php");
 
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = "PHP feed";
$rss->description = "Feed Sastgroup";
$rss->link = "http://www.tuosito.com/feed";
$rss->syndicationURL = "http://www.tuosito.com/".$PHP_SELF;
 
$image = new FeedImage();
$image->title = "logo sastgroup";
$image->url = "http://www.sastgroup.com/tuologo.png";
$image->link = "http://www.sastgroup.com";
$image->description = "Feed di test Sastgroup, clicca qui per visitarci!";
$rss->image = $image;
 
mysql_select_db($dbHost, $dbUser, $dbPass);
$res = mysql_query("SELECT * FROM feed_table ORDER BY data DESC");
 
while ($data = mysql_fetch_object($res)) {
$item = new FeedItem();
$item->title = $data->titolo;
$item->link = $data->url;
$item->description = $data->riassunto;
$item->date = $data->data;
$item->source = "http://www.sastgroup.com";
$item->author = $data->autore;
 
// aggiunge la news alla lista di elementi del feed
$rss->addItem($item);
}
 
$rss->saveFeed("RSS2.0", "feed.xml");
?>
 

La classe FeedCreator potete scaricarla direttamente da qui!

fonte: www.sastgroup.com » Vai al post originale

Gen 01

tutorial-tn

In questo articolo troverete alcuni tutorial su come creare bellissime foto spaziali con Photoshop!

Link: http://designinformer.com/out-of-this-world-tutorials/

fonte: www.sastgroup.com » Vai al post originale

Gen 01

google-wave-layout

Uki è un toolkit javascript per applicazioni web! Nell’esempio che vedete i dati non vengono memorizzati. Uki utilizza un rendering progressivo ed compatibile con IE6+, Opera 9+, FF2+, Safari3+ e Chrome.

Link: http://ukijs.org/functional/wave.html

fonte: www.sastgroup.com » Vai al post originale

Gen 01

In questo articolo vi mostrerò come calcolare il numero di giorni in un mese specificando solamente l’anno e il mese. Questa funzione è molto utile perchè non dovrete preoccuparvi se nel mese di febbraio variano i giorni nel caso in cui l’anno è bisestile!

 
cal_days_in_month(CAL_GREGORIAN, 12, 2009);
 

fonte: www.sastgroup.com » Vai al post originale

Gen 01

Ritratto-luci-spot

In questo tutorial imparerete come trasformare una foto con luci naturali in una con luci spot da studio fotografico!

fonte: www.sastgroup.com » Vai al post originale

Gen 01

Questa funzione PHP vi permetterà di convertire un numero nel formato romano. Come potete vedere la funzione è semplicissima, vengono effettuati solo vari controlli tramite il ciclo while.

 
< ?php function roman_number($number)
{
$roman = ;
while ($number >= 1000)
{
$roman .= "M";
$number = $number -1000;
}
while ($number >= 900)
{
$roman .= "CM";
$number = $number -900;
}
while ($number >= 500)
{
$roman .= "D";
$number = $number -500;
}
while ($number >= 400)
{
$roman .= "CD";
$number = $number -400;
}
while ($number >= 100)
{
$roman .= "C";
$number = $number -100;
}
while ($number >= 90)
{
$roman .= "XC";
$number = $number -90;
}
while ($number >= 50)
{
$roman .= "L";
$number = $number -50;
}
while ($number >= 40)
{
$roman .= "XL";
$number = $number -40;
}
while ($number >= 10)
{
$roman .= "X";
$number = $number -10;
}
while ($number >= 9)
{
$roman .= "IX";
$number = $number -9;
}
while ($number >= 5)
{
$roman .= "V";
$number = $number -5;
}
while ($number >= 4)
{
$roman .= "IV";
$number = $number -4;
}
while ($number >= 1)
{
$roman .= "I";
$number = $number -1;
}
return $roman;
}
?>
 

Esempio applicato

 
< ?php
echo roman_number(251);
// try any number you like..
?>
 

fonte: www.sastgroup.com » Vai al post originale

Gen 01

before-after-jquery

Il New York Times ha pubblicato un articolo che mostrava una strada di Brooklyn restaurata. Per mostrare la differenza del progetto di ricostruzione, hanno realizzato una foto in Flash permettendo al visitatore di trascinare il cursore e visualizzare la strada prima e dopo i lavori.

CatchMyFame ha trovato molto utile questo effetto e lo ha creato in jQuery. Le possibilità di questo plugin sono infinite. I medici possono mostrare le foto “prima” e “dopo” ai loro pazienti, gli utenti Photoshop possono mostrare i loro progetti “prima” e “dopo” il fotoritocco ecc.

Questo plugin pesa solamente 7 KB e può essere utilizzato più volte in una pagina.

Link: http://www.catchmyfame.com/jquery/demo/8/

fonte: www.sastgroup.com » Vai al post originale

Dic 30

PHP GoogleMapAPI è una classe PHP che permette di facilitare il compito di noi programmatori, come potete vedere infatti, nell’esempio qui sotto troverete poche righe di codice per realizzare una mappa inserendo semplicemente l’indirizzo da voi scelto!

 
< ?php
require(‘GoogleMapAPI.class.php’);
$map = new GoogleMapAPI(‘map’);
 
// enter YOUR Google Map Key
$map->setAPIKey(‘YOURGOOGLEMAPKEY’);
 
$map->addMarkerByAddress(‘621 N 48th St # 6 Lincoln NE 68502′,‘Our Address’,Our Address);
 

 
< ?php $map->printMap(); ?>
 

 

fonte: www.sastgroup.com » Vai al post originale

Dic 30

6-president

In questo tutorial, imparerete come usare Photoshop per mixare i volti delle persone o mettere il volto di una persona sulla testa di un’altra persona.

Link: http://designinformer.com/mix-faces-adobe-photoshop/

fonte: www.sastgroup.com » Vai al post originale

Dic 30

jquery-roundabout

Roundabout è un plugin jQuery che trasforma una struttura statica di elementi HTML in un insieme di elementi dinamici che ruotano al click del mouse!

Link: http://fredhq.com/projects/roundabout/

fonte: www.sastgroup.com » Vai al post originale

Dic 30

webforms-1s

Molto spesso per noi programmatori, impostare graficamente una pagina web risulta un procedimento tanto noioso. Deviantart ci mette a disposizione due bellissimi layout per form, in questo modo possiamo creare una grafica curata in pochissimo tempo!

Link: http://www.webappers.com/2009/12/26/free-web-form-elements-in-psd-format/

fonte: www.sastgroup.com » Vai al post originale

Dic 30

La variabile $ _FILES in PHP è una delle variabili più complesse in PHP. Con essa, è possibile caricare file sul server e trovare un po ‘di roba su quei file. Di seguito una piccola guida su questa variabile.

 

 
 
< ?php
 
if($_GET[‘upload’]) {
 
$url = "uploads/";
 
$file = $_FILES[‘file’][‘name’];
$file_temp = $_FILES[‘file’][‘tmp_name’];
$filesize = $_FILES[‘file’][’size’] / 1024 / 1024;
$size = number_format($filesize, 3);
 
if(move_uploaded_file($file_temp, $url.$file)) {
echo"You just uploaded the file ".$file." ";
echo"with a size of ".$size." MB.";
}
else {
echo"There’s been a problem uploading your file. Please try again";
 
}
}
 
?>
 

fonte: www.sastgroup.com » Vai al post originale

Dic 30

Notturno

In questo bellissimo tutorial imparerete come creare uno scenario notturno utilizzando una foto scattata alla luce del giorno!

fonte: www.sastgroup.com » Vai al post originale

Dic 28

5thoct0903

jQuery Browser Plugin è un addon per jQuery che rende facile da identificare i browser dei tuoi visitatori.

Link: http://jquery.thewikies.com/browser/

fonte: www.sastgroup.com » Vai al post originale