FeatureUp News
Loading...

Recent Post

Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts
25+ Very Useful CSS Tips and Tutorials

25+ Very Useful CSS Tips and Tutorials


Cascade Style Sheet (CSS) is a very important part of any webpage. Using this language you can create some beautiful effects to adorn your website and most important it is not very difficult to comprehend.

It is a style sheet language which is used to describe the presentation parameters like the look and formatting of a document written in a markup language. It’s most common application is to style web pages written inHTML and XHTML, but the language can be applied to any kind of XML document, including SVG and XUL.

With the introduction of CSS3 you can create a lot of new and exciting features like shadows, animations, transitions, border-radius etc. The effects which were made in Photoshop can easily be made here using CSS3 with use of jQuery and little JavaScript.
We have listed below 25+ exciting CSS tips and its features which you can easily create and add to your webpage to give it a new elegant look.

25+ CSS Tips and Tutorials

CSS Image Styles

You can add any style to the background-image with proper rendering using the CSS image styles. In this tutorial you will use jQuery to make perfect rounded corner images dynamically using image CSS trick. You can use use box-shadow, border-radius and transition to create various image styles.
CSS Tutorials
Download Source

Snazzy Hover Effects

In this tutorial, you will be learning to create flexible advanced hover techniques using CSS2.1 properties. You will find caption text to appear over the top of images and information about the image you moused over or focused on.
CSS Tutorials
Download Source

Create a beautiful icon with CSS3

Thus tutorial teaches you how to create a document icon with pure CSS3. You start off with a square box then you round the edges and use pseudo elements to create curled corner and finally you will create the illusion of text with a stripped gradient.
CSS Tutorials
Download Source

Semantic Animation

This is an animation tutorial of a moon rising, and as it rises the sky and ground turn to black. You will need two elements to accomplish this animation. The animation will make your website to be in motion.
CSS Tutorials
Download Source

Animated Mario Block Navigation Menu

This tutorial contains some good clean fun by recreating the animated Mario Bros. question mark box with pure CSS3. You’ll also learn how to use several cool CSS3 technologies such as rounded corners, box and text shadows, and keyframe animations that work in both Safari and Firefox.
CSS Tutorials
Download Source

Create an Apple-Style Input Field With Display Labels

This tutorial builds a small Apple-styled input form with some basic structure and scripting. You will use jQuery 1.4.1 library to support the display label functions. All code included is based off XHTML Transitional Doctype and uses CSS2/ CSS3 techniques.
CSS Tutorials
Download Source

Create Presentation Slides with HTML and CSS

This tutorial contains code for creating slides to show for presentations. It can be useful for your business purpose or even for web sites.
CSS Tutorials
Download Source

Custom CSS Cursors

Here you will find the various default cursor icon associated with a particular element which you can use in your interface. It contains more than 20 cursor icons. Some works on all browers while some are restricted.
CSS Tutorials
Download Source

Stylish Rocking CSS3 Search Field

Here you will create a search box using CSS3 with rounded corners and a search button by applying new styles to the box and button.
CSS Tutorials
Download Source

Create Diagonal Lines with CSS

In this tutorial you will learn to draw diagonal lines which acts as a border. You can use this in diagonal bordered tabs and can include easily in the project
CSS Tutorials
Download Source

Create a Modern Ribbon Banner Navigation Bar with Pure HTML/CSS3

Here you will learn how to create a centered ribbon banner with pure CSS3 using a step by step procedure. You can create modern design elements without the adept knowledge of graphics tools
CSS Tutorials
Download Source

create slick effects with CSS3 box-shadow

In this tutorial you will create drop shadows and inner shadows effects in the box using pure CSS3. Now no need to go for Adobe Photoshop’s blending options. You will use box-shadow property allows you to add multiple shadows (outer or inner) on box elements.
CSS Tutorials
Download Source

Slick login form using HTML5 & CSS3

Using this tutorial you can create stylish login form without the use of any javascript code. You will find the stitch effect and paper stack effect in the login form
CSS Tutorials
Download Source

Create Script-Free CSS3 Tooltips

You can make really awesome tooltips out of pure CSS3 using this tutorial and can also create a mobile friendly version using little javascript
CSS Tutorials
Download Source

CSS3 tables with rounded corners

: In this tutorial you will learn how CSS3 and tables can work together to create some cool and usable results in the tables. You can do rounding of corners with no images and giving this effect will definitely add the beauty to the table
CSS Tutorials
Download Source

Create a CSS3 Tabbed Navigation

Here you will be creating the CSS3 tabbed navigation. You will work with the darkwash jean version out of the many different themes available for awesome tabs.
CSS Tutorials
Download Source

BUILD A PURE CSS 3D CITY

This tutorial teaches you to build a 3D city with six buildings. Buildings are easy and are just cubes with a fancy texture with each building being composed of 5 sides
CSS Tutorials
Download Source

CSS3 enhanced zoom-in zoom out slideshow

In this tutorial you will create a clean zoom-in zoom-out slideshow. Here you will use stylish CSS3 effect to your slideshow simply by setting the style attributes corners to any or all four image-corners, furthermore you can apply shadows. You can also comment on each slide
CSS Tutorials
Download Source

CSS3 tabs with beveled corners

In this tutorial you will learn how to create some good looking tabs with beveled corners using a clever CSS3 gradients technique.
CSS Tutorials
Download Source

DYNAMIC PURE CSS 3D TEXT

Through this tutorial you can get a nice 3D effect combining multiple levels of text-shadow using the CSS. You can also add some CSS transforms, and dynamically rebuild the text-shadow to get a nice mouse-following pure CSS canvas-free 3D text effect.
CSS Tutorials
Download Source

Create a CSS3 Wheel Menu

In this tutorial you will create an awesome, layered CSS3 wheel menu using a few beginner to advanced CSS techniques. There is also a little bit of optional Javascript so that you can rotate your images depending on the hovered menu item.
CSS Tutorials
Download Source

Create a Swish CSS3 Folded Ribbon in Five Minutes

In this tutorial you will find how to create swish folded ribbon by simply taking one line of markup and a couple of CSS3 rules (no images) and you can create this effect within five minutes.
CSS Tutorials
Download Source

Create Pure CSS3 Ticket-Like Tags

During this tutorial you will use CSS3 to create ticket-like tags, without relying on any images just by creating HTML markup and styling main tags and four corners with a punched hole in the tag giving a ticket look.
CSS Tutorials
Download Source

Rotate and Mask Thumbnails With CSS3

This tutorial teaches you how to showcase the rotated thumbnails using the CSS. It’s a simple effect that adds a layer of visual personality. This effect will represent image galleries with rotated thumbnails.
CSS Tutorials
Download Source

Pressable CSS3 Social Buttons

Get a quicktip to create some really awesome press-able social media buttons using pure CSS3. These cool buttons can be placed on any project.
CSS Tutorials
Download Source

Font Face Deisgn Guide

This tutorial explains the common issues with using custom fonts, picking the matching fallback web safe fonts, and how to create a perfect fallback font style with Modernizr. You can adjust the styles for the fallback font (size, letter-space, weight, text-transform, etc.) to best match the custom font.
CSS Tutorials
Download Source
Google Shows Off Gaming Potential Of Glass With Five Simple Games (Google Glass Games)

Google Shows Off Gaming Potential Of Glass With Five Simple Games (Google Glass Games)

Google released five simple games for Glass, the company’s buzz-worthy wearable computing device.
In a post on the Glass Developers blog, a spokesperson wrote, “We hacked together five simple games that experiment with the unique features of Glass and demonstrate some of the possibilities for gaming.”
With TennisBalanceClay ShooterMatcher, and Shape Splitter, Google is making a play for the profitable mobile game market, one that regularly outpaces both traditional gaming revenue as well as other forms of media.
Google Glass has accelerometers and gyroscopes in it, making the head-controlled Tennis and Balance–you need to keep a stack of books from falling off a cartoon character’s head–fairly obvious.Clay Shooter takes a cue from skeet shooting, but in this game, your voice is your trigger. Shape Shifter lets players slice their hands through Glass-displayed objects like Fruit Ninja, and Matcher asks players to match shapes within a grid, similar to something like Bejeweled or Puzzles and Dragons.
Basic though they may be, this move by the Google Glass development team signals an early interest in gaming apps, something that Apple never quite supported early on.

best-google-glass-games-featureup

It’s only a matter of time before we start to see gaming take over wearable computing devices like Glass, though the safety issues are important to pay attention to, as well.
“We intentionally wanted games that are quick to get into when you have a few, free minutes,” says the blog post, “and just as easy to get out of when you want to turn your attention back to reality.”
Developers wanting to make games for Google Glass are encouraged to the Glass Development Kit(GDK) for documentation and coding tools.
Online Payment PHP Codes for your Website

Online Payment PHP Codes for your Website

 The Sample Code will not work without the following:
 
* cURL extension for PHP (http://www.php.net/manual/en/ref.curl.php)
* SSL Certificate
* Development Account setup with DPS

If you dont have access to a Development account please click here to request it.

Online Payment PHP Codes for your Website-featureup

Standard Request Page:

<?php
/*
#
# This function is a simple example of
# how to send and receive Payment Express XML
# messages to process a transaction.
#
*/
     
function process_request($name,$amount,$ccnum,$ccmm,$ccyy,$merchRef)
{
     
$cmdDoTxnTransaction .= "<Txn>";
$cmdDoTxnTransaction .= "<PostUsername>TestUsername</PostUsername>"; #Insert your DPS Username here
$cmdDoTxnTransaction .= "<PostPassword>TestPassword</PostPassword>"; #Insert your DPS Password here
$cmdDoTxnTransaction .= "<Amount>$amount</Amount>";
$cmdDoTxnTransaction .= "<InputCurrency>USD</InputCurrency>";
$cmdDoTxnTransaction .= "<CardHolderName>$name</CardHolderName>";
$cmdDoTxnTransaction .= "<CardNumber>$ccnum</CardNumber>";
$cmdDoTxnTransaction .= "<DateExpiry>$ccmm$ccyy</DateExpiry>";
$cmdDoTxnTransaction .= "<TxnType>Purchase</TxnType>";
$cmdDoTxnTransaction .= "<MerchantReference>$merchRef</MerchantReference>";
$cmdDoTxnTransaction .= "</Txn>";
               
$URL = "sec.paymentexpress.com/pxpost.aspx";
//echo "\n\n\n\nSENT:\n$cmdDoTxnTransaction\n\n\n\n\n$";
              
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://".$URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$cmdDoTxnTransaction);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); //Needs to be included if no *.crt is available to verify SSL certificates
curl_setopt($ch,CURLOPT_SSLVERSION,3); 
$result = curl_exec ($ch);
curl_close ($ch);
                
parse_xml($result);
}
 
function parse_xml($data)
{
$xml_parser = xml_parser_create();
xml_parse_into_struct($xml_parser, $data, $vals, $index);
xml_parser_free($xml_parser);
     
$params = array();
$level = array();
foreach ($vals as $xml_elem) {
if ($xml_elem['type'] == 'open') {
if (array_key_exists('attributes',$xml_elem)) {
list($level[$xml_elem['level']],$extra) = array_values($xml_elem['attributes']);
}
else {
$level[$xml_elem['level']] = $xml_elem['tag'];
}
}
if ($xml_elem['type'] == 'complete') {
$start_level = 1;
$php_stmt = '$params';
             
while($start_level < $xml_elem['level']) {
$php_stmt .= '[$level['.$start_level.']]';
$start_level++;
}
$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
eval($php_stmt);
}
}
     
/* Uncommenting this block will display the entire array and show all values returned.
echo "<pre>";
print_r ($params);
echo "</pre>";
*/
         
$success = $params[TXN][SUCCESS];
     
$MerchantReference = $params[TXN][$success][MERCHANTREFERENCE];
$CardHolderName = $params[TXN][$success][CARDHOLDERNAME];
$AuthCode = $params[TXN][$success][AUTHCODE];
$Amount = $params[TXN][$success][AMOUNT];
$CurrencyName = $params[TXN][$success][CURRENCYNAME];
$TxnType = $params[TXN][$success][TXNTYPE];
$CardNumber = $params[TXN][$success][CARDNUMBER];
$DateExpiry = $params[TXN][$success][DATEEXPIRY];
$CardHolderResponseText = $params[TXN][$success][CARDHOLDERRESPONSETEXT];
$CardHolderResponseDescription = $params[TXN][$success][CARDHOLDERRESPONSEDESCRIPTION];
$MerchantResponseText = $params[TXN][$success][MERCHANTRESPONSETEXT];
$DPSTxnRef = $params[TXN][$success][DPSTXNREF];
         
$html = "<table align='center' width='500' style='FONT-SIZE: 10pt; FONT-FAMILY: Arial, Helvetica, sans-serif'>";
$html .= "<BR><hr><BR>";
$html .= "<tr><td>Merchant Reference: </td><td>$MerchantReference</td></tr>";
$html .= "<tr><td>CardHolderName: </td><td>$CardHolderName</td></tr>";
$html .= "<tr><td>AuthCode: </td><td>$AuthCode</td></tr>";
$html .= "<tr><td>Amount: </td><td>$Amount</td></tr>";
$html .= "<tr><td>CurrencyName: </td><td>$CurrencyName</td></tr>";
$html .= "<tr><td>DateExpiry: </td><td>$DateExpiry</td></tr>";
$html .= "<tr><td>CardHolderResponseText: </td><td>$CardHOlderResponseText</td></tr>";
$html .= "<tr><td>CardHolderResponseDescription: </td><td>$CardHolderResponseDescription</td></tr>";
$html .= "<tr><td>MerchantResponseText: </td><td>$MerchantResponseText</td></tr>";
$html .= "<tr><td>TxnType: </td><td>$TxnType</td></tr>";
$html .= "<tr><td>DPSTxnRef: </td><td>$DPSTxnRef</td></tr>";
$html .= "</table>";
//$html .= "</body></html>";
         
echo $html;    
     
}
 
#main start
$Action = $_REQUEST["Action"];
$CardName = $_REQUEST["CardName"];
$Amount = $_REQUEST["Amount"];
$CardNum = $_REQUEST["CardNum"];
$ExMnth = $_REQUEST["ExMnth"];
$ExYear = $_REQUEST["ExYear"];
$MerchRef = $_REQUEST["MerchRef"];
 
If ($Action == "Submit")
{
 
process_request($CardName, $Amount, $CardNum, $ExMnth, $ExYear, $MerchRef);
 
}
 
?>
 
<html>
<head>
<title>DPS PXPost Sample -- PHP</title>
</head>
<body>
 
 
<form method="POST">
<input type="hidden" name="Action" value="Submit"><BR><BR>
<table align="center" width="550" style="FONT-SIZE: 10pt; FONT-FAMILY: Arial, Helvetica, sans-serif" border="0">
<tr>
<td width="280">
<table style="FONT-SIZE: 10pt; FONT-FAMILY: Arial, Helvetica, sans-serif">
<tr>
<td colspan="2">Name (as it appears on the card)<BR>
<input type="text" name="CardName" value="Mr John Smith" size="26">
</td>
</tr>
<tr><td colspan="2">Card Number<BR>
<input type="text" name="CardNum" value="4111111111111111" maxlength="16" size="26">
</td>
</tr>
<tr><td>Amount<BR>
<input type="text" name="Amount" value="1.80" size="9">
</td>
<td>Merchant Reference<BR>
<input type="text" name="MerchRef" value="invoice 84325" size="12">
</td>
</tr>
</table>
</td>
<td>Expiry Date<BR>
<select name="ExMnth"><option value="01">01</option>
    <option value="02">02</option>
    <option value="03">03</option>
    <option value="04">04</option>
    <option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
</select>
<select name="ExYear"><option value="05">05</option>
    <option value="06">06</option>
    <option value="07">07</option>
    <option value="08">08</option>
    <option value="09">09</option>
</select><BR><BR><BR><BR>
</td>
<td align="right"><img src="http://www.paymentexpress.com/dpslogo.gif">
<BR><BR><BR>
<input type="submit" value="process">
</td>
</tr>
</table>
</form>
 
</body>
</html>
Advance PHP Programming Tips

Advance PHP Programming Tips


Ternary Operators

A ternary operator is a different way to layout a simple if statement. Let's take a look at one and then break it down. We'll just use a simple check to see if a GET parameter is set and not empty, if it is we will default to the word John, otherwise use the value that was set as the GET parameter.
$name = (!empty($_GET['name'])? $_GET['name'] : 'John');
This might look complex to begin with but there are three sections to a ternary operator:
  1. The conditional !empty($_GET['name'])
  2. The true result $_GET['name']
  3. The false result 'John'
The ternary operator will return either the true or false conditional, and therefore it will be assigned to $name. If we write this as a normal if statement we'd have one of the following:
if(!empty($_GET['name'])){
    $name = $_GET['name'];
}else{
    $name = 'John';
}

// Or

$name = 'John';
if(!empty($_GET['name'])){
    $name = $_GET['name'];
}
The two above and the ternary operator will all end up with $name having something assigned to it.

Nesting

While not advisable, it is possible to nest ternary operators within each other much like you would with standard if statements, or to form a long string of if...else if...else if...elsestatements.
Ternary operators can be very helpful and clean up code, but don't over complicate them otherwise your code might become inundated with large amounts of complex rediculousness that will get you hunted down by a violent psychopath.

Class Autoloading

To make use of a class file, you have to ensure that the class you're using is available within the page that you're using it. In most cases this will be as easy as you just including the PHP file that contains the class.
But what if we have a very large number of classes that we could potentially use within one or many sections of our code? Well, we could include all of them within a common header file, or only include the ones that we know that we're going to use on that page. However, we then need to remember to include new classes whenever we want to use a different one etc.
So instead of including classes that might not get used, or we might remove later, we can employ class autoloading. When we autoload classes we can write what will happen - this might be to just throw an error to let us know that we've not included the class file, or, as in most cases, we make the function include the file that we need.

The Code

Here we'll be using the PHP function spl_autoload_register(), we'll only be interested in the first parameter, but there are two others that you can define if you wanted the function to behave differently. I'll jump straight into how to use it:
function loadMyClass($class){
    echo 'We are loading class: ' . $class;
    include_once('classes/' . $class . '.inc.php');
    echo 'Class loaded.';
}

spl_autoload_register('loadMyClass');
This will pass the name of the class that we're trying to load as the first parameter of the function that we specified. As of PHP 5.3.0 we are able to use anonymous functions, basically a function thas has no name:
spl_autoload_register(function ($class){
    echo 'We are loading class: ' . $class;
    include_once('classes/' . $class . '.inc.php');
    echo 'Class loaded.';
});
Which will work exactly the same as the method of implementation above. So now in future, we don't need to include the class files that we'll be using as this function will run if the class is undefined, include the class and then the instantiation will be called.

Dynamic Variables

Sometimes we want to be able to dynmically define a variable, or refer to a variable based on a user's input. Let's start with this code:
$myname = 'Michael';
$yourname = 'Ben';
if($_GET['whatname'] == 'your'){
    echo $yourname;
}else if($_GET['whatname'] == 'my'){
    echo $myname;
}else{
    echo 'No Name';
}
To use the value of a variable to then form another variable we use double dollar signs $$so for example we could do $who = 'myname'; then echo $$who. This will echo out the value of$myname.
Break it down like this (exemplary code, not actual working code):
$who = 'myname';
$$who = $'myname';
$$who = $myname;
echo $$who; // would return 'Michael'
In reference to the code above we could look to use something along the lines of the following for very dynamically defined variables:
$who = $_GET['whatname'] . 'name';
if(isset($$who)){
    echo $$who;
}else{
    echo 'No Name';
}
As with ternary operators, you should use these loosely, as in most situations there's not much need for them, but you will most probably find some crazy-ninja somewhere who uses this notation.

Referencing

Passing variables by reference, is a way to pass variables into functions so that the function can alter the original variable without having to return anything or define it as global etc. A function parameter that is going to be passed in as a reference is preceeded by an ampersand (&). Let's go with an example:
function lowercase(&$string){
    $string = strtolower($string);
}

$name = 'STEPHEN';
lowercase($name);
echo $name; // returns stephen
What you can see is that where we've called the lowercase() method and passed in $name, the function has altered the actual string that we passed in, as within the function $stringbecomes $name.
There are advantages of using references, for example you don't have to return anything from the function, nor do you have to look to define them as globally accessible.

Arrays

References are super awesome when you use them with arrays. Let's say we have a function that sets the first item in any array to potato - because you know, it'll be the most helpful function ever:
function potatoArray(&$array){
    $array[0] = 'potato';
}

$nonpotato = array(
    'john',
    'andrew',
    'cheese'
);

potatoArray($nonpotato);

print_r($nonpotato); // This will now have changed 'john' to 'potato'
References are very powerful things, and could be used extensively. You'll find them used with the array_walk() method other some other array methods that PHP have.

Relative Time Calculation

Everywhere you look people love their relative times, they're on Facebook, they're in most Twitter apps and they're here on Codular. Codular isn't too fussed about the specific time of when an action was made and so we have come up with a special class with handle the relative date for us.
We define a list of the days that exist, and then do some logic to find out what to display. We firstly check if it's today or yesterday, obviously returning the respective term. We then look to see if the date falls in the last 7 days (less than 8 days), this is so that we can display last Monday, last Sunday etc. But obviously the 'Last' prefix can only apply to one week.
Our method takes a second parameter with is a fallback format, this is the format that we use when the date falls out of the 'Last' date range. The first parameter is a simple UNIX timestamp.
<?php

class TimeClass {

    private static $days = array(
        'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
    );

    /**
     * relativeTime()
     * @param int $time
     * @param string $format
     */
    public static function relative($time, $format = 'jS F Y'){
        if(date('d/m/Y', $time) === date('d/m/Y')){
            return 'Today';
        }else if(date('d/m/Y', $time) === date('d/m/Y', time() - 3600 * 24)){
            return 'Yesterday';
        }else if((time() - $time) < 3600 * 24 * 8){
            return 'Last ' . self::$days[date('w', $time)];
        }else{
            return date($format, $time);
        }

    }

}
Usage would be as simple as doing:
echo TimeClass:relative(time());
That will always output Today as we are using the current timestamp.
Relative date calculations can be pretty smple, another that is commonly used is to round to the nearest multiple of a time frame - ie days, weeks, months years etc. Below is a quick function to finish off with that will do exactly that up to 10 years in time then fall back to a date:
<?php

function relativeTime($timestamp, $format = 'Y-m-d H:i'){
    $dif = time() - $timestamp;

    $dateArray = array(
        "second" => 60,     // 60 seconds in 1 minute
        "minute" => 60,     // 60 minutes in 1 hour
        "hour" => 24,       // 24 hours in 1 day
        "day" => 7,         // 7 days in 1 week
        "week" => 4,        // 4 weeks in 1 month
        "month" => 12,      // 12 months in 1 year
        "year" => 10        // Up to 10 years
    );

    foreach($dateArray as $key => $item){
        if($dif < $item)
            return $dif . ' ' . $key . ($dif == 1? '' : 's') . ' ago';
        $dif = round($dif/$item);
    }
    return date($format, $timestamp);
}
Quick Message
Press Esc to close
Copyright © 2013 FeatureUp All Right Reserved. The content is copyrighted to FeatureUp and may not be reproduced on other websites without permission or credit.