Otra vez #Cdia
seen from Yemen
seen from United States
seen from United States
seen from United States
seen from Spain

seen from United States
seen from Yemen
seen from China

seen from United States
seen from Algeria
seen from United States
seen from Spain

seen from Russia
seen from Yemen
seen from Yemen

seen from United States
seen from Spain
seen from Switzerland
seen from Yemen

seen from Australia
Otra vez #Cdia

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Top most priority to issue visas to Pak importers: Chinese Consul General
Top most priority to issue visas to Pak importers: Chinese Consul General
KARACHI: The top most priority of Chinese government is to ensure speedy release of the visas to the commercial importers of Pakistan.
This was stated by Chinese Consul General, Zhang Jianxin during a meeting with a 10-member delegation of Pakistan Chemicals and Dyes Merchants Association (PCDMA). The PCDMA delegation was led by its Chairman Shaukat Riaz.
Chinese Consul General said that both the…
View On WordPress
I am a huge believer in writing down ones goals and what one wants out of life, and the increase in possibility that creates. Inspired by the approaching New Year and the words of a good friend, yesterday I asked my class to take 15 minutes to start a 2014 resolution list leading with the heading "The Year of {YOUR NAME}". — with Randall Armorat Center for Digital Imaging Arts at Boston University.
About Azerbaijan
How to pass parameters as a query string to your PHP functions
Many programming languages allow one to pass named parameters or keyword arguments to functions. Using named parameters provides the advantage of not having to worry about the order of your parameters. While I find passing an array of named parameters preferable to ordered parameters, query strings are another way to use named parameters and shorten the setup for your function calls. Many WordPress functions allow you to pass parameters using query strings. What does that mean exactly? Key/pair values, just like you often see in a URL query string, e.g.
page=5&lang=en
Below I will show a few examples of options for passing params to functions. Then I will provide a “parse_args()” function that lets me process the query string params in my functions.
Option 1: Ordered parameters
/** ordered parameters */ function get_tweets($var1,$var2,$var3){ // validate the params and make use of them. // Order matters when you pass them in. } /** calling it */ get_tweets("arg1","arg2","arg3"); /** OR */ $arg1 = "barackobama"; $arg2 = "10"; $arg3 = "false"; get_tweets($arg1,$arg2,$arg3);
You can spice up ordered parameters a bit by using the native PHP functions:
func_get_args() // get array of all args func_num_args() // get length of args func_get_arg() // get specific argument from arguments array
Option 2: Pass an array and extract from within
Advantages: Unlike ordered params, you don’t need to worry about the order of your arguments. You also can have a varying number of arguments.
/**Setup an array of parameters and extract them from inside function.*/ function get_tweets($array){ extract($array) // array keys are exposed now as variables }; /** Setup */ $array=array( "twitter_user" => "barackobama", "number_of_tweets"=>"10", "date" => "2010-11-01" ); /** Calling it */ get_tweets($array);
Note: If one of your params is an array of data, you need to use the above approach. After passing the associative array of params to your function, you can use the php function extract() to get turn the array keys into variables. The query string params approach below will not work if you are passing an array of data. **Unless you serialize() your array before concatenating the final query string and passing the params to your function. Then inside the parse_args(), you'd need to revise it to test whether any of the params can be unserialized().
Option 3: Query-string-style params
Advantages: Less typing and preparation before executing functions() Using query string parameters gets you the advantages noted for using Arrays – variable length and order of argument list – and also allows you to shorten the preparation required to setup your function calls.
function get_tweets($args){ extract( parse_args($args) ); // array keys are exposed now as variables }; /** Setup, store query string args in variable*/ $var = "twitter_user=barackobama&number_of_tweets=3&date=2010-11-01"; get_tweets($var); /** OR pass directly */ get_tweets("user=zeldman&limit=3&date=2010-11-15");
Implementation: A parse_args() function
/** * * parse_args($args) parses query string style params * and returns array. * @param String Your params as a string. * E.g. 'day=10&month=11' * @uses explode() to separate query string into key/pair * @description Call this function inside your own * functions to get an array of args passed, even * though you didn't pass an array or multiple params. * @return Array * * */ function parse_args($args){ if( empty($args) ): throw new Exception("\n\nfunction parse_args() expects you to pass a param\n\n"); elseif( !is_string($args) ): throw new Exception("\n\nfunction parse_args() expects a string, ". gettype($args). " passed\n\n"); endif; // array to store our parsed args $parsed = array(); // confirm there is at least one param, in format we expect if( !strpos($args,"=") ): // if not, trigger exception $msg="\n\nfunction parse_args() expects query string params. \n\n"; $msg.="String passed does not contain any assignments using = operator\n\n"; throw new Exception($msg); elseif( strpos($args,"&") ): // if str contains &, assume multiple params $parts = explode("&",$args); for( $i=0, $len=count($parts); $i<$len; $i++ ): $tmp = explode("=",$parts[$i]); $parsed[$tmp[0]] = $tmp[1]; endfor; else: $tmp = explode("=",$args); $parsed[$tmp[0]] = $tmp[1]; endif; return $parsed; }
Using parse_args($args)
function get_tweets($args){ /* parse our query string-style params & return an array to php's native extract() function */ extract(parse_args($args) ); /** Now, after calling extract(), following items from this string - "twitter_user=barackobama&number_of_tweets=3&date=2010-11-01" - are now available to you as variables: $user; // 'barackobama' $number_of_tweets; // 3 $date; // 2010-11-01 */ }
Modify parse_args() to return early if an array is passed
The next step I think would be to build in support for arrays, so you can call parse_args() on either query string params or an array of params. This wouldn't take much work and would provide even more flexibility and wider application. Here's an attempt, seems to work, which tests if an array has been passed in. If an array was passed, we return right away since there is no point in evaluating any more code.
function parse_args($args){ if( empty($args) ): throw new Exception("\n\nfunction parse_args() expects you to pass a param\n\n"); elseif( is_array( func_get_arg(0) ) ): /* return right away if param itself is an array */ return func_get_args(); elseif( !is_string($args) ): throw new Exception("\n\nfunction parse_args() expects a string, ". gettype($args). " passed\n\n"); endif; // array to store our parsed args $parsed = array(); // confirm there is at least one param, in format we expect if( !strpos($args,"=") ): // if not, trigger exception $msg="\n\nfunction parse_args() expects query string params. \n\n"; $msg.="String passed does not contain any assignments using = operator\n\n"; throw new Exception($msg); elseif( strpos($args,"&") ): // if str contains &, assume multiple params $parts = explode("&",$args); for( $i=0, $len=count($parts); $i<$len; $i++ ): $tmp = explode("=",$parts[$i]); $parsed[$tmp[0]] = $tmp[1]; endfor; else: $tmp = explode("=",$args); $parsed[$tmp[0]] = $tmp[1]; endif; return $parsed; }
Thanks to Ryan Bagwell for helping me formulate this post. Find Ryan: @ryanbagwell, http://www.ryanbagwell.com/

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Rounded corners with or without images
For those of you who just want to see the code: Rounded corners with background-images and Rounded corners using border-radius. Some parts of the code below are pseudo code. Working demo code is here.
Before CSS3
Often the websites I build for clients include rounded corners in the design. Prior to CSS3, creating rounded corners ( without JavaScript ) in any browser required creating and slicing up images to be used with html elements and the css property, background-image. How many images need to be cut? How many elements do we need in our HTML mark-up to properly display the background-image? Other than background-image, what CSS properties are required to display the background-images? Those answers depends on whether you require the content to be able to expand and contract, or whether the height and width are fixed. E.g., Rounded corners for the chrome of a webpage might need three background images and three HTML divs - div#top, div#center (repeating vertically), and div#bottom. Repeating the center background image allows for content of varying length. If you have a fixed height and width then you can cut a single background-image. To boot, IE6 does not include native support for PNG images. So if your rounded corners required transparency, you needed separate background images and CSS rules to specify GIFs for IE6 and PNGs for IE7+ and other browsers. In order to apply rules specifically to IE6, you need detect the browser on the server side, use Microsoft proprietary conditional comments for Internet Explorer, or javascript. Alternatively, you can use the proprietary Microsoft filtering code to add support for transparent PNGs in IE6. Either way it requires adding browser specific CSS, which is generally undesirable but sometimes unavoidable. Below is an example of adding the conditional wrapper div for IE6, which is used primarily for targeting your CSS as well as using different background images between IE6 and > IE6. Also shown is the conditional div for generating the additional markup required for the background images.
Rounded Corners with background-images
Your CSS for IE browsers would be something like:
/* IE Browsers: #box_bottom */ .ie6 #box_bottom, .ie7 #box_bottom, .ie8 #box_bottom { background:url("images/bottom.gif") no-repeat bottom left; width:420px; height:300px; padding-bottom:18px; } /* For IE7 and IE8, height:auto */ /* IE7+ Use PNG */ .ie7 #box_bottom, .ie8 #box_bottom { height:auto; background:url("images/bottom.png") no-repeat bottom left; } /* IE Browsers, #box */ .ie6 #box, .ie7 #box, .ie8 #box { background:url("images/top.gif") no-repeat top left; width:420px; height:300px; padding-top:18px; } /* IE7+ Use PNG */ .ie7 #box, .ie8 #box { background:url("images/top.png") no-repeat top left; } /* IE Browsers, #box textarea */ .ie6 #box textarea, .ie7 #box textarea, .ie8 #box textarea { width:400px; height:300px; padding:0px 10px; overflow:auto; background-color:#FFF; background:url("images/mid.gif") repeat-y; text-align:justified; } /* IE7+ Use PNG. */ .ie7 #box textarea, .ie8 #box textarea { background:url("images/mid.png") repeat-y center center; }
And that's just the CSS for IE! You might need something different to get rounded corners with background-images working in Firefox, Safari, Chrome, and Opera.
Rounded Corners using CSS3 border-radius
To the rescue came the CSS3 property, border-radius. Border-radius allowed web developers and designers to easily create rounded corners simply by declaring the "border-radius:" property and specifying a value. *The property to be declared actually depends on your browser, and I will get into that later when I show you the code. Currently, the CSS3 border-radius property is supported by recent versions of major browsers such as Firefox (Gecko), Safari (Webkit), Google Chrome (Webkit), and Opera (Presto). However, Internet Explorer versions 6-8 do not support border-radius. For me, the decision on whether to support IE at all, and if so which versions, depends on the project.
/* styles for all browsers except the IEs, which won't support border radius until IE9 */ #box textarea { padding:5px; border:none; color:#FFF; width:420px; min-height:300px; background-color:#00bfff; -moz-border-radius:5px 5px 5px 5px; -webkit-border-radius:5px 5px 5px 5px; /* For opera and hopefully other browsers in the future */ border-radius:5px 5px 5px 5px; }
Using the border-radius property gives us rounded corners in almost all the popular browsers, while requiring less html mark-up and fewer CSS rules. If you need to support Internet Explorer, you can use the border-radius approach in combination with background-images. Working demo here.
GeoBlog app: Google Maps, Sinatra, Sqlite3, ActiveRecord, Webfaction, Nginx, Thin
For fun I had been working on Sinatra apps and experimenting with the Google Maps API. Worked out well that I needed to create a social "web 2.0" application for school. So I adapted my Sinatra app to be a blog, and incorporated Geocoding and reverse Geocoding via the Google Maps JavaScript API. Currently, the GeoBlog app is up here, http://dev.zhannes.com/. Fun features -User agent detection to serve a different layout to mobile safari users (iphone and itouch) - Highlight tab if it is the current page. - Some CMS features:
Ability to have posts and pages.
Any items marked as "page" show up on the navigation. This is similar to the wp_list_pages() function in wordpress.
Options table - allows user to dynamically update tagline, footer content, etc.
Future enhancements: Right now, the geocoding and reverse geocoding are done using Javascript when the user creates a new blog post. At some point, I will probably write a ruby script to do the Geocoding on the server side. Also plan to finish the Mobile Safari layout.
Using PHP Variable Variables With Form Data
A nice technique I discovered last week, mostly because I am lazy. Typically when handling form data with PHP, you need to create variables one by one, plucking values out of the PHP superglobal associative array, $_POST. For each form field whose value you want to validate and store, we usually declare variables and assign values. The value we want is stored inside a named index in $_POST. Say for example we have a form with two fields: firstname, and address.
We might do something like:
$firstname = $_POST['firstname']; $address = $_POST['address'];
And we would do that for each item from the form that we need. Instead of doing that, we can use PHP's variable variables to automagically create variables. The variable names (important so we can refer to them later) will correspond to the name attributes on the form input fields. So we can do this:
foreach ($_POST as $key => $value){ $$key=$value; }
The above foreach loop, while probably cryptic and not good for a person who is inheriting the code, is only three lines of code. And after we run it we will have stored all the values from the $_POST super global in variables. What are the variables named? The names of the created variables correspond to the names of the keys in $_POST, which correspond to the html name attribute of the form elements. So in the above foreach loop, the variable $key really refers to the name of the current item in the $_POST associative array. If $key = 'firstname', then $$key really refers to $firstname! If we say $$key = "something", then we have just assigned $firstname a value of "something". In our case, the value stored will be whatever was in the form field at the time the form was submitted. By using PHP variable variables we can automatically create variables whose names correspond to the POST data, which as you know corresponds to the name attribute on each form element. If this concept still makes no sense, here is another attempt to explain. Normally in php, the dollar sign ($) followed by a word ($variable) denotes a variable. We can store values inside variables, e.g.
$variable = "string";
Now by using the $$ syntax, $$variable, we are referring to whatever is stored inside (single dollar sign) $variable, in this case "string". Basically, so long as $variable = "string"; assigning a value to $$variable is like implicitly declaring a new variable, whose name comes from the value stored in the first variable. So if we applied that to our example above:
$variable = "string"; // think of assigning $$variable a value as equivalent to assigning $string // a value. $$variable = 'I am stored inside $string. I was created when the programmer referred to me as $$variable. I started out as just a simple string, stored inside $variable. But now I am moving onnnnnn up, running things!'; echo $string; // outputs the long string above.