wget spyder to crawl webpage

wget -e robots=off -r -l 50 --timeout=10 -t 2 --delete-after http://webpage.com/;

ab -c 10 -n 1000 http://webpage.com/;

Custom Plugin for Clients

<?php
/*
 * Plugin Name: Client Plugin
 * Plugin URI: http://webdesign.com
 * Description: Custom Plugin for Clients
 * Version: 1.0
 */

function wdc_create_widget_area(){
register_sidebar( array(
'name' => 'Widget Staging',
'id' => 'customer_widget',
'description' => 'Customize your Widgets here before going live.',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="customer-title">',
'after_title' => '</h2>'
)
);
}
add_action('widgets_init', 'wdc_create_widget_area');

add_filter('admin_footer_text', 'wdc_custom_footer');
function wdc_custom_footer(){
echo 'Theme and Site Development by Bob Bobertson.  Learn more at <a href="http://bobbobertson.com">http://bobbertson.com</a>.';
}

add_filter('default_content', 'custom_writing_helps');
function custom_writing_helps($content){
global $post_type;
if ($post_type == "post"){

$contentHelp = array(
0 => "Your Blog is Haunted",
1 => "I hacked your site"
);
return $contentHelp[array_rand($contentHelp)];
}
}

add_action('admin_head', 'excerpt_textarea_height');
function excerpt_textarea_height(){
echo '
<style type="text/css">
#excerpt{height:350px;}
</style>
';
}









iOS SDK - GET UDID from different Device System Version

#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
- (NSString*)deviceUDID {
    NSString *udidString;
   
    if (SYSTEM_VERSION_LESS_THAN(@"6.0")) {
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        udidString = [defaults objectForKey:@"udidKey"];
        if (!udidString) {
            CFUUIDRef identifierObject = CFUUIDCreate(kCFAllocatorDefault);
            // Convert the CFUUID to a string
            udidString = (NSString *)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, identifierObject));
            [defaults setObject:udidString forKey:@"udidKey"];
            [defaults synchronize];
            CFRelease((CFTypeRef) identifierObject);
        }
       
    } else {
        udidString = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
    }
    return udidString;
}

iOS SDK Url encode for special characters

//!*'();:@&=+$,/?%#[]
- (NSString *)encodeWith:(NSString *)string
{
    return CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, NULL, CFSTR("!*'();:@&=+$,/?%#[]"), kCFStringEncodingUTF8));
}

iOS SDK Custom NSLog

//  Modify to Prefix.pch
//  Prefix header
//
//  The contents of this file are implicitly included at the beginning of every source file.
//

#import <Availability.h>

#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
#endif

/************* Custom Log *************/
#ifndef CULog

#ifdef DEBUG
#   define CULog(fmt, ...) {NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);}

#else

#   define CULog(fmt, ...) {}

#endif

#endif

iOS SDK Fix Custom TextField Placehold issues

#import "CustomTextField.h"

#define TEXTFIELD_PADDING 10.0

@implementation CustomTextField

//placehold
- (CGRect)textRectForBounds:(CGRect)bounds
{
    return CGRectMake(bounds.origin.x + TEXTFIELD_PADDING, bounds.origin.y + TEXTFIELD_PADDING, bounds.size.width - TEXTFIELD_PADDING*2, bounds.size.height - TEXTFIELD_PADDING*2);
}

// text position
- (CGRect)editingRectForBounds:(CGRect)bounds
{
    return [self textRectForBounds:bounds];
}

- (void)drawPlaceholderInRect:(CGRect)rect
{
    [[UIColor blueColor] setFill];
    //Fixed for iOS 5 and iOS 7 display issue
    CGRect placeholderRect = CGRectMake(rect.origin.x, (rect.size.height- self.font.pointSize)/2, rect.size.width, self.font.pointSize);
    [[self placeholder] drawInRect:placeholderRect withFont:self.font lineBreakMode:NSLineBreakByWordWrapping alignment:self.textAlignment];
}

@end

Split Excel Worksheets into New Workbooks and to any Image Format using Cl

#######
Section 1 ######
app_sid = '####### Section 1 ######
app_sid = '77******-1***-4***-a***-80**********'
app_key = '*********************'
Aspose::Cloud::Common::AsposeApp.new(app_sid, app_key)
#build URI to split workbook
str_uri = 'http://api.aspose.com/v1.1/cells/Sample.xlsx/split?format=png';
#uncomment following line to split specific worksheets
#str_uri = 'http://api.aspose.com/v1.1/cells/Sample.xlsx/split?from=2&to=3&format=tiff';
#sign URI
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri);
#######
End Section 1 ######
#######
Section 2 ######
#Split spreadsheet file
response_stream = RestClient.post(signed_uri, '', {:accept=>:json})
#######
End Section 2 #####

#Download Split Files

stream_hash = JSON.parse(response_stream)
stream_hash['Result']['Documents'].each do |document|

       #Build and sign URI to download split files

file_name = File.basename(document['link']['Href'])
str_uri = 'http://api.aspose.com/v1.1/storage/file/' + file_name;            
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri);

file_name = File.basename(str_uri)

      #Download and save split files

response_stream = RestClient.get(signed_uri, :accept => 'application/json')
      Aspose::Cloud::Common::Utils.save_file(response_stream, file_name)

End

Image Replacement Code

/*
 * Image replacement
 */

.ir {
overflow: hidden;
/* IE 6/7 fallback */
*text-indent: -9999px;

&:before {
content: "";
display: block;
width: 0;
height: 150%;
}
}

Declaring, Setting and Using Variables in SQL Script

/*
This example is connecting to a Lab Test table with LabTest = Name of Lab Test,
LabDate = Date that the LabTest was Performed

CREATE TABLE [dbo].[LabTests](
[LabTestId] [int] IDENTITY(1,1) NOT NULL,
[LabDate] [datetime] NULL,
[LabTime] [varchar](50) NULL,
[LabTest] [varchar](50) NOT NULL,
[LabResult] [varchar](50) NULL,
[LabUnits] [varchar](50) NULL,
[LabNormalRange] [varchar](50) NULL,
[LabNotes] [varchar](1000) NULL
) ON [PRIMARY]
*/

--Declaring variable name and type
DECLARE @LabTest  varchar(100)
DECLARE @StartDate datetime

--Setting the Variable value
SET @LabTest = 'HGB'
SET @StartDate = '9/23/2013'

--Utilizing variable within the WHERE clause
SELECT LabTest, LabName, LabResult, LabUnits
FROM LabTests
WHERE LabTest = @LabTest and LabDate >= @StartDate

How To Add visual composer support to WP Touch Theme

function add_js_script () {
    wp_enqueue_script( "js_script", plugins_url()."/js_composer/assets/js/js_composer_front.js" );
   wp_enqueue_style( "js_script", plugins_url()."/js_composer/assets/css/js_composer_front.css" );
}

add_action( 'wp_enqueue_scripts', 'add_js_script' );

Wordpress get/insert post attachments at custom size linked to custom size

<?php
// To insert custom loop of post attachments as images (at core or custom size) linked not to full size image but custom-configured (or core) size.

$postID = $post->ID;
//print_r($product_meta);

// (thumbnail, medium, large or full) or a 2-item array
// representing width and height in pixels, e.g. array(32,32)
// OR the custom config'd name of image size
$image_size = 'prods-large'; // the image size to be shown initially (smaller version)
$image_size_lg = 'large'; // the image size to link to (large version)

$images = get_children(array(
'post_parent' => $postID,
'post_type' => 'attachment',
'numberposts' => -1,
'order' => 'ASC',
'orderby' => 'menu_order',
//'exclude' => get_post_thumbnail_id(), -- uncomment to exclude post thumbnail
'post_mime_type' => 'image',
)
);

//print_r($images);
if($images) {

echo '<div class="prod-imgs">';

foreach( $images as $image ) {

$attachment_id = $image->ID;

// get the 'large' size image's URL
$image_attributes = wp_get_attachment_image_src( $attachment_id, 'large' ); // returns an array - [0] is the URL of the image 'large' size
$largeSizeURL = $image_attributes[0];

echo '<a class="attachment-' . $attachment_id . ' popup-with-zoom-anim img-link" href="' . $largeSizeURL . '">';
echo wp_get_attachment_image($attachment_id, $image_size);
echo '</a>';

}
echo '</div>';
}
?>

How to Open all external links in a new window

$('a').each(function() {
// The link's href
var theHref = $(this).attr('href').toLowerCase();
// The current domain
var currentDomain = window.location.host;
    // Kill any subdomains
    var noSubDomain = currentDomain.match(/[^\.]*\.[^.]*$/)[0];
    // Create a new (case insensitive) regex from the clean domain
var theDomain = new RegExp(noSubDomain, 'gi');

if(/^https?/gi.test(theHref)) {
// This link is using HTTP/HTTPs and is probably external
if(theDomain.test(theHref)) {
// Do nothing. For some reason, this site is using absolute internal links        
        } else {
$(this).attr('target', '_blank');
}
}
});

Hides plugins from the plugins page by defined author(s)

<?php
/*
Author:
Description: Hides plugins from the plugins page by defined author(s)
Plugin Name: Plugin Hider
Plugin URI:
Text Domain: plugin-hider
Version: 1.0.0
*/
if( !function_exists('add_action') ) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
exit;
}
if( version_compare( PHP_VERSION, '5.0.0', '<' ) ) {
add_action( 'admin_notices', 'wpph_version_require' );
function wpph_version_require() {
if( current_user_can( 'manage_options' ) )
echo '<div class="error"><p><strong>Plugin Invisibility</strong> requires at least PHP 5.</p></div>';
}
return;
}

class WP_Plugin_Hider {

private $store_name = 'wpph_settings';
private $group_name = 'wpph_group';
private $filter_num = 0;
private $filter_max = 6;
private $headers = array(
'Author',
//'AuthorName',
        //'AuthorURI',
//'Description',
//'DomainPath',
'Name',
//'Network',
        //'PluginURI',
//'TextDomain',
//'Title',
//'Version '
);
private $nice_header = array(
'Author' => 'Author',
//'AuthorName' => 'Author Name',
'AuthorURI' => 'Author URI',
//'Description' => 'Description',
//'DomainPath' => 'Domain Path',
'Name' => 'Plugin Name',
//'Network' => 'Network',
'PluginURI' => 'Plugin URI',
//'TextDomain' => 'Plugin Text Domain',
//'Title' => 'Plugin Title',
//'Version' => 'Plugin Version'
);
private $filters = array();
private $current = array();

public function __construct() {
add_action( 'admin_init', array( $this, 'wpph_admin_init' ), 1000 );
add_action( 'admin_menu', array( $this, 'wpph_admin_menu' ), 1000 );
}
public function wpph_admin_init() {

if( !current_user_can( 'activate_plugins' ) )
return;

global $pagenow;

// Filter to increase filter set limit
$this->filter_max  = apply_filters( 'wpph_filter_number', $this->filter_max );
// Filter to add/remove header fields to check against
$this->headers     = apply_filters( 'wpph_headers',       $this->headers );

// The currently saved data(if any)
$this->current     = get_option( $this->store_name );
// Register the option to hold saved data
register_setting( $this->group_name, $this->store_name, array( $this, 'wpph_validate_input' ) );

// Bail if not the plugins listing
if( 'plugins.php' != $pagenow )
return;

// Only hook when there's filter sets configured
if( $this->wpph_setup_sets() )
add_filter( 'all_plugins', array( $this, 'wpph_filter_plugins' ), 10000 );
}
private function wpph_current_setting( $num, $name ) {
if( !isset( $this->current['set-' . $num][$name] ) )
return '';
if( !empty( $this->current['set-' . $num][$name] ) )
return $this->current['set-' . $num][$name];
return '';
}
private function wpph_setup_sets() {
foreach( $this->current as $set => $headers )
$this->filters[$set] = array_filter( $headers );
$this->filters = array_filter( $this->filters );

if( !empty( $this->filters ) )
return true;
return false;
}
public function wpph_admin_menu() {

if( !current_user_can( 'activate_plugins' ) )
return;

$hook = add_options_page( __( 'Plugin Hider' ), __( 'Plugin Hider' ), 'manage_options' , 'wppi', array( $this, 'wpph_plugin_page' ) );
add_action( 'admin_print_styles-' . $hook, array( $this, 'wpph_css' ) );
}
public function wpph_validate_input( $input ) {
$cleansed = array();
foreach( $input as $set => $data )
$cleansed['set-'.(int) substr( (string)$set, 4 )] = $data;
return $cleansed;
}
public function wpph_filter_plugins( $all_plugins ) {
// Loop over each plugin
foreach( $all_plugins as $handle => $_plugin ) {
// Loop over each set
foreach( $this->filters as $data ) {
$unset = true;
// Loop each header
foreach( $data as $header => $value ) {
if( !isset( $_plugin[$header] ) ) {
$unset = false;
continue;
}
if( $_plugin[$header] != $value )
$unset = false;
}
if( $unset )
unset( $all_plugins[$handle] );
}
}
return $all_plugins;
}
public function wpph_css() { ?>
<style type="text/css">
.wppi-wrapper { background-color:#f5f5f5;border:4px solid #eee;margin: .5em 0 0; }
.wppi-filter-num { border: 1px solid #aaa;text-shadow: #fff 1px 1px 1px;margin: 0;line-height:2em;color:#666;padding: .3em 1em;background: #ddd;background:-moz-linear-gradient(bottom,  #ddd,  #eee);background:-webkit-gradient(linear, left bottom, left top, from(#ddd), to(#eee));}
.wppi-filter { padding: .4em 1em;line-height: 2.5em;border: 1px solid #bbb;border-top: none;margin-bottom:2px }
.wppi-filter label { white-space:nowrap; }
.wppi-filter input { border:1px solid #ccc!important;padding:.5em;margin: 0 .6em; }
</style>
<?php }
public function wpph_plugin_page() { ?>

<div class="wrap">
<h2><?php _e( 'Plugin Hider' ); ?></h2>
<p class="description">
<?php _e( 'You can specifically hide plugins based on one or many of the plugin headers, add more specificity to make exclusions less general.' ); ?>
</p>
<form method="post" action="options.php" >
<?php $this->filter_sets(); ?>
<?php settings_fields( $this->group_name ); ?>
<p class="submit" style="clear:left">
<input type="submit" name="submit" class="button-secondary action" value="<?php _e( 'Save' ) ?>" />
</p>
</form>
</div>

<?php }
private function filter_sets() { ?>

<div class="wppi-wrapper">

<?php for( $this->filter_num; $this->filter_num < $this->filter_max; $this->filter_num++ ) : ?>

<p class="wppi-filter-num"><strong><?php printf( 'Filter %s', $this->filter_num + 1 ); ?></strong></p>
<div class="wppi-filter">
<?php foreach( $this->headers as $plugin_header ) : $current = $this->wpph_current_setting( $this->filter_num, $plugin_header ); ?>
<label for="<?php echo $this->store_name . '-set-' . $this->filter_num . '-' . $plugin_header; ?>">
<?php echo $this->nice_header[$plugin_header]; printf( ' <input type="text" name="%s[%s][%s]" value="%s" />', $this->store_name, 'set-' . $this->filter_num, $plugin_header, $current ); ?>
</label>
<?php endforeach; ?>
<br style="clear:both" />
</div>

<?php endfor; ?>

</div>

<?php }
}

$hmc = new WP_Plugin_Hider;

How to Add "Post to Diigo" button on website

<a href="#" onclick="window.open('https://www.diigo.com/post?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), '_blank', 'menubar=no,height=580,width=608,toolbar=no'); return false;">
  <img src="https://lh4.ggpht.com/PaV4x6Q92xFbKHOyS-FpZ7jzWDdAWrnhOAb0d8t_SODgsXWHhO8PNCvLkQWU-k3vwPQO=w50" height="16" width="16" alt="Diigo"> Post to Diigo
</a>

HTML5 Basic Markup

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=1">

<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css">

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
</head>
<body>

</body>
</html>

Get Viewport width. jQuery

function viewportWidth() {
    var $body = $('body'),
        viewPortWidth = $body.css('overflow', 'hidden').width();
   
    $body.css('overflow', '');

    return viewPortWidth;
}

wordpress load post with ajax

***************  HEADER
<script>
$(document).ready(function(){

   $.ajaxSetup({cache:false});
   $(".trick").click(function(){
       var post_id = $(this).attr("rel");
       $("#single-home-container").html("loading...");
       $("#single-home-container").load("http://<?php echo $_SERVER[HTTP_HOST]; ?>/single-home/",{id:post_id});
   return false;
   });

});
</script>
   
***************** INDEX IN POST

<a class="trick" rel="<?php the_ID(); ?>" href="<?php the_permalink();?>"><?php the_ID(); ?> <?php the_title(); ?></a>


*************** INDEX {LACE TO LOAD

<div id="single-home-container"></div>

******************* SINGL HOME TEMPLATE
<?php
 
    /*
    Template Name: single-home
    */
 
?>    
<?php
      $post = get_post($_POST['id']);

?>
  <?php the_ID(); ?>
    <!--single-home-->
    <div id="single-home post-<?php the_ID(); ?>">
        <!--sh-post-->
        <div class="sh-post">
            <!--sh-content-->
            <div class="sh-content">
<?php

echo '<h1>'.$post->post_title.'</h1>'; // Š’Ń‹Š²Š¾Š“ŠøŠ¼ Š·Š°Š³Š¾Š»Š¾Š²Š¾Šŗ Š·Š°ŠæŠøсŠø;
echo '<p>'.$post->post_content.'</p>'; // Š’Ń‹Š²Š¾Š“ŠøŠ¼ ŠŗŠ¾Š½Ń‚ŠµŠ½Ń‚ Š·Š°ŠæŠøсŠø;
?>
            </div>
            <!--sh-content-->
    </div>
    <!--sh-post-->        
    <div class="clearfix"></div>    
    </div>
    <!--single-home-->



http://wp-kama.ru/function/get_post
http://school-wp.net/spravochnik/posts-pages/get_post/
not working http://stanislav.it/load-wordpress-post-content-with-ajax-and-jquery/

Preliminary async-dal for Android

// AsyncHandler interface
public interface AsyncHandler {

void onSuccess(Object result);
void onError(Object result);

}

// DAO implementation
public class MyDaoImpl<T, PK> implements Dao {

    // Llamada sĆ­ncrona
public T find(PK id) {
...
}

// DemƔs mƩtodos del CRUD

}

// Service implementation with async-calls
public class MyServiceImpl<T, PK> implements Service {

// ImplementaciĆ³n del DAO no asĆ­ncrona
private MyDaoImpl myDao;

// Llamada asĆ­ncrona - No devuelve nada porque el resultado lo manejarĆ” el handler
public void findByIdAsync(PK id, AsyncHandler handler) {
FindProxy proxy = new FindProxy(handler);
proxy.execute(id);
}

// DemƔs mƩtodos del CRUD con firma asƭncrona

// Una AsyncTask por cada mƩtodo del DAO que se
// quiera llamar de forma asĆ­ncrona
private class FindProxy extends AsyncTask<PK, Void, T> {

private AsyncHandler _handler;

public FindProxy(AsyncHandler handler) {
this._handler = handler;
}

protected T doInBackground(PK... params) {
T result = this.myDao.find(params[0]);
return result;
}

protected void onPostExecute(T result){
if (result != null) {
this._handler.onSuccess(result);
} else {
this._handler.onError(result);
}
}

}

}

php array()

<?php
$identity = array(
        "name" => "Sam",
        "age"  => "47",
        "country" => "USA"
                );
?>

extract function use case

<?php
extract($identity); //var_dump(extract($identity)) == int 3
?>

Fix UITableView background issue on iOS 7

#pragma mark Table View Delegate methods
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    [cell setBackgroundColor:[UIColor clearColor]];
}

wordpress sort by post view

<?php
   $args = array(
               'orderby'      => 'meta_value',
               'meta_key'     => 'post_views_count',
               'order'        => 'DESC',
               'post_status'  => 'publish'
           );
   $ranking = 0;
?>
<?php query_posts($args); ?>
<?php if ( have_posts() ) : ?>
     <?php while ( have_posts()) : the_post();
           $ranking++; ?>
               
               
          <!-- HTML -->
         
          <?php endwhile; else: ?>
<?php endif; ?>

information about a file path

<?php
$path_parts = pathinfo('/www/htdocs/inc/lib.inc.php');

echo $path_parts['dirname'], "\n";   // /www/htdocs/inc
echo $path_parts['basename'], "\n";  // lib.inc.php
echo $path_parts['extension'], "\n"; // php
echo $path_parts['filename'], "\n"; // since PHP 5.2.0   // lib.inc
?>

Refactoring of Jumping

private void Jump() {
    if (touchingPlatform) {
        rigidbody.AddForce(jumpVelocity, ForceMode.VelocityChange);
        touchingPlatform = false; // This allow one jump after colliding with side of platform, but not more
    }
    else if (boosts > 0) {
        rigidbody.AddForce(boostVelocity, ForceMode.VelocityChange);
        boosts -= 1;
        GUIManager.SetBoosts (boosts);
    }
}

Read Tap as Jump

if ((Input.GetButtonDown("Jump")) ||
    ((Application.platform == RuntimePlatform.Android) && (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began))) {
    // your code here
}

String to character in JAVA

// Case 1 with using charAt()
String str = "Hai Navas";
for(int i=0;i<str.lenght();i++){
char c = str.charAt(i);
System.out.println("Character"+i+":"+c);
}

// Case 2 without using charAt()
String str = "Hai Navas";
for(char c: str.toCharArray())
    System.out.println(c);

Script para comprobar el estado de Apache2.

#! /bin/bash
#Recomiendo insertar este script en el crontab para que se ejecute cada cierto tiempo.
npid="/var/run/apache2.pid"
if [ -e $npid ]
then
echo "El servidor Apache se encuentra activo"
else
echo "El servidor Apache estĆ” apagado. Iniciando..."
/etc/init.d/apache2 start
fi

Wordpress excerpt

function improved_trim_excerpt($text) {
        global $post;
        if ( '' == $text ) {
                $text = get_the_content('');
                $text = apply_filters('the_content', $text);
                $text = str_replace('\]\]\>', ']]&gt;', $text);
                $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
                $text = strip_tags($text, '<p>');
                $excerpt_length = 80;
                $words = explode(' ', $text, $excerpt_length + 1);
                if (count($words)> $excerpt_length) {
                        array_pop($words);
                        array_push($words, '[...]');
                        $text = implode(' ', $words);
                }
        }
        return $text;
}


remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'improved_trim_excerpt');

Position Expression to place a layer on edge of solid

l = thisComp.layer("bar") //the control layer
startX = l.transform.position[0]; //the position of the control layer
s = l.transform.scale[0]/100; //the scale divided by 100 to get a decimal

//This checks the index of the layer and uses it to flip the sign
halfWidth = l.width/2;
if(index%2!=0){
halfWidth *= -1;
}

posX = startX + (-halfWidth*s); // the original pos + half the width * the scale

[posX, value[1]]; // setting the value

mytime.h

#include <sys/time.h>
#include <time.h>
#include <sys/timeb.h>
#include <stdlib.h>
#include <stdio.h>

#define TIME_s 0
#define TIME_ms 1
#define TIME_us 2
#define TIME_ns 3

double get_time(int resolution);

void tic(double * time, int resolution);

void tac(double * time, int resolution);

Hire iOS developer from AgileInfoways.com

However, a number of the tips are all about Apple development such as whether the developer has experience with Objective-C coding, and Xcode tools. And he warns against the over use of open source frameworks.

http://iosdeveloperforums.com/threads/looking-to-hire-ios-developers-ipad-iphone-application-development-team.555/
http://www.xda-developers.com/announcements/iphone-developers-officially-launches/
http://www.zdnet.com/blog/apple/how-to-hire-a-savvy-ios-developer/9747
http://answers.oreilly.com/topic/2292-how-much-does-it-cost-to-develop-an-app/page__gopid__38779&#entry38779

Muffin Cheatsheet

<?php
/*
Plugin Name: Box WDC 10
Plugin URI: http://webdesign.com
Description: Add a simple author box to your blog
Version: 0.1
Author: Bob Bobertson
Author URI: http://bobbobertson.com.com
License: GPL3
*/
/*
    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 3 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.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

register_activation_hook( __FILE__, 'wdc10_author_install' );

function wdc10_author_install() {
   add_option( 'wdc10_author_box_name', '', '', 'yes' );
   add_option( 'wdc10_author_box_bio', '', '', 'yes' );
   add_option( 'wdc10_author_box_image', '', '', 'yes' );
   add_option( 'wdc10_muffins', '', '', 'yes' );
   add_option( 'wdc10_activation_redirect', true );
}

function wdc10_plugin_redirect() {
    if (get_option('wdc10_activation_redirect', false)) {
        delete_option('wdc10_activation_redirect');
$adminUrl = admin_url();
        wp_redirect($adminUrl.'/options-general.php?page=author-box-settings');
    }
}
add_action( 'admin_init', 'wdc10_plugin_redirect' );

register_uninstall_hook( __FILE__, 'wdc10_author_deactivate' );

function wdc10_author_deactivate() {
   delete_option( 'wdc10_author_box_name', '', '', 'yes' );
   delete_option( 'wdc10_author_box_bio', '', '', 'yes' );
   delete_option( 'wdc10_author_box_image', '', '', 'yes' );
   delete_option( 'wdc10_muffins', '', '', 'yes' );
}

add_action( 'admin_menu', 'wdc10_authorbox_menu' );
function wdc10_authorbox_menu() {
add_options_page( 'AuthorBox Options', 'Author Box', 'manage_options', 'author-box-settings', 'wdc10_authorbox_options' );
}

function wdc10_authorbox_options() {
if ( !current_user_can( 'manage_options' ) )  {
wp_die( __( 'You are not allowed to access this page.' ) );
}

$opt_name = 'wdc10_author_box_name';
$opt_bio = 'wdc10_author_box_bio';
$opt_image = 'wdc10_author_box_image';
$opt_muffins = 'wdc10_muffins';

    $hidden_field_name = 'wdc10_mt_submit_hidden';
   
    $data_field_name = 'wdc10_author_box_name';
$data_field_bio = 'wdc10_author_box_bio';
$data_field_image = 'wdc10_author_box_image';
$data_field_muffin = 'wdc10_muffins';

$opt_val_name = get_option( 'wdc10_author_box_name' );
$opt_val_bio = get_option( 'wdc10_author_box_bio' );
$opt_val_image = get_option( 'wdc10_author_box_image' );
$opt_val_muffins = get_option( 'wdc10_muffins' );

if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
        $opt_val_name = $_POST[ $data_field_name ];
$opt_val_bio = $_POST[ $data_field_bio ];

$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $_FILES[$data_field_image]["name"]));
if ((($_FILES[$data_field_image]["type"] == "image/gif")
|| ($_FILES[$data_field_image]["type"] == "image/jpeg")
|| ($_FILES[$data_field_image]["type"] == "image/png")
|| ($_FILES[$data_field_image]["type"] == "image/jpg"))
&& ($_FILES[$data_field_image]["size"] < 2000000)
&& in_array($extension, $allowedExts))
 {
 if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES[$data_field_image]["error"] . "<br />";
}
 else
{
$upload_dir = wp_upload_dir();
  move_uploaded_file($_FILES[$data_field_image]["tmp_name"], $upload_dir['basedir'] . "/" . $_FILES[$data_field_image]["name"]);
}
 }
else
 {
   echo "Invalid file";
 }

        update_option( $opt_name, $opt_val_name );
update_option( $opt_bio, $opt_val_bio );
update_option( $opt_muffins, $opt_val_muffins );
update_option( $opt_image, $upload_dir['baseurl'] . "/" . $_FILES[$data_field_image]["name"] );
    }

echo '<div class="wrap">';
    echo "<h2>" . __( 'Author Box Plugin Settings', 'wdc10_author-menu' ) . "</h2>";  
?>
<form name="form1" method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">

<p><?php _e("Author's Name:", 'wdc10_author-menu' ); ?>
<input type="text" name="<?php echo $data_field_name; ?>" value="<?php echo $opt_val_name; ?>" size="20">
</p>
<p><?php _e("Author's Bio:", 'wdc10_author-menu' ); ?> <br />
<textarea name="<?php echo $data_field_bio; ?>" cols="80" rows="8"><?php echo $opt_val_bio; ?></textarea>
</p>
<p><?php _e("Author Muffin:", 'wdc10_muffins' ); ?> <br />
<input type="text" name="<?php echo $data_field_muffin; ?>" value="<?php echo $opt_val_muffins; ?>" size="20">
</p>
<p><?php _e("Author's Picture:", 'wdc10_author-menu' ); ?> <br />
<?php if ($opt_val_image != '') { ?>
<img src="<?php echo get_option($opt_image); ?>" />
    <p>Update image
<?php } ?>
<input name="<?php echo $data_field_image; ?>" type="file" />
</p></p>
<hr />

<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
</p>

</form>
</div>

<?php

}

wp_register_sidebar_widget(
    'author_box_widget',      
    'Author Box',        
    'wdc10_widget_display',
    array(                
        'description' => 'Display information about the blog author in your sidebar'
    )
);
function wdc10_widget_display($args){
   extract($args);
   echo $before_widget;
   echo $before_title . 'About the Author' . $after_title;
   echo '<img src="'.get_option('wdc10_author_box_image').'" style="max-width:" /><br />';
   echo '<strong>'.get_option('wdc10_author_box_name').'</strong>';
   echo '<p>'.get_option('wdc10_author_box_bio').'</p>';
   echo '<p>'.get_option('wdc10_muffins').'</p>';
   echo $after_widget;
}

add_shortcode( 'authorbox', 'wdc10_author_shortcode' );

function wdc10_author_shortcode($atts){
return '<strong>About the Author</strong><br /><img src="'.get_option('wdc10_author_box_image').'" style="max-width:150px" /><br /><strong>'.get_option('wdc10_author_box_name').'</strong><p>'.get_option('wdc10_author_box_bio').'</p><p>'.get_option('wdc10_muffins').'</p>';
}


iOS SDK UIScrollView - UIScrollIndicator flash

[self performSelector:@selector(flashScrollIndicators:) withObject:_scrollView afterDelay:0.5];

#pragma mark - UIScrollIndicator flash handling method
- (void)flashScrollIndicators:(id)sender
{
    UITextView *textView = (UITextView *)sender;
    [textView flashScrollIndicators];
}

Linear Range Mapping

// add a slider to a null
// use this slider to control another property
// the slider has a range of 0 to 100
// you can clamp that value by adjusting the inputs low and high
// tie this to some y values to make some sort of scrolling happen
// if the value is 0 it will output 500
// if the value is 50 it will output 500 plus 50*500

input = effect("Slider Control")("Slider"); // 0 to 100
inputLow = 0;
inputHigh = 100;
outputLow = -456;
outputHigh = 1234;

linear(input,inputLow,inputHigh,outputLow,outputHigh);



C# Code Sample to Create PDF from HTML Using REST API

stringstrURI = "http://api.aspose.com/v1.1/pdf/outPdfFile.pdf?templateFile=input.html&templateType=html";
stringsignedURI = Sign(strURI);
StreamReader reader = new StreamReader(ProcessCommand(signedURI, "PUT"));
//further process JSON response
stringstrJSON = reader.ReadToEnd();
//Parse the json string to JObject
JObjectparsedJSON = JObject.Parse(strJSON);
BaseResponse stream = JsonConvert.DeserializeObject<BaseResponse>(parsedJSON.ToString());
if (stream.Code == "200" &&stream.Status == "OK")
Console.WriteLine("Empty PDF file has been created successfully");

//Here is the BaseResponse class
public class BaseResponse
{
publicBaseResponse() { }
public string Code { get; set; }
public string Status { get; set; }
}

Java Code Sample to Create PDF from HTML Using REST API

//build uri to create empty pdf
    String strURI = "http://api.aspose.com/v1.1/pdf/outPdfFile.pdf?templateFile=input.html&templateType=html";
    String signedURI = Sign(strURI);
InputStreamresponseStream = ProcessCommand(signedURI, "PUT");
    String strJSON = StreamToString(responseStream);
Gsongson = new Gson();
    //Parse the json string to JObject and Deserializes the JSON to a object.
BaseResponsebaseResponse = gson.fromJson(strJSON,BaseResponse.class);
if (baseResponse.getCode().equals("200") &&baseResponse.getStatus().equals("OK"))
System.out.println("Empty PDF file has been created successfully");

//Here is the BaseResponse class
public class BaseResponse {
publicBaseResponse() { }
private String Code;
private String Status;
public String getCode(){return Code;}
public String getStatus(){return Status;}
public void  setCode(String temCode){ Code=temCode;}
public void setStatus(String temStatus){ Status=temStatus;}
}

Ruby Code Sample to Create PDF from HTML Using REST API

app_sid = '77******-1***-4***-a***-8***********'
app_key = '89******************************'
Aspose::Cloud::Common::AsposeApp.new(app_sid, app_key)

#build URI to create PDF from HTML
str_uri = 'http://api.aspose.com/v1.1/pdf/outPdfFile.pdf?templateFile=HtmlExample1.html&templateType=html'

#sign URI
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
RestClient.put(signed_uri, '', {:accept=>'application/json'})

#build URI to download output file
str_uri = 'http://api.aspose.com/v1.1/storage/file/outPdfFile.pdf'

#sign URI
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
response_stream = RestClient.get(signed_uri, :accept => 'application/json')
Aspose::Cloud::Common::Utils.save_file(response_stream, "outPdfFile.pdf")
p 'done'

jcarousel wrap and autoscroll

$('.jcarousel').jcarousel({
wrap:'both'
})
.jcarouselAutoscroll({interval:2000});

Actualizar kernel en Ubuntu

#Mirar versiĆ³n de kernel instalado.
uname -a
#Bajamos los paquetes necesarios correspondiente a la arquitectura de nuestro procesador.
http://kernel.ubuntu.com/~kernel-ppa/mainline
#Instalamos el nuevo kernel.
sudo dpkg -i linux*.deb
#Actualizamos el grub.
sudo update-grub
string.split = function(text, split)
  result = {}
  result2 = {}
  a = text:gsub("(.-)" .. split, function(c) table.insert(result, c) end)
  b = text:gsub(split .. "(.-)$", function(c) table.insert(result2, c) end)
  table.insert(result, result2[#result2+1])
  return result
end
monitor = peripheral.wrap("top")
url = "http://hentie.co:8080"


getChat = function(channel, width, height)

  chatlog =  http.get(url .. "/getmessages?channel="..channel .. "&width=" .. width .. "&height=" .. height).readAll()
 
  cursor = 0
  monitor.clear()
  for i,v in pairs(string.split(chatlog, "</br>")) do
    cursor = cursor + 1
    monitor.setCursorPos(1, cursor)
    monitor.write(v)
    print(v)
  end
  print(chatlog)
end

local w, h = monitor.getSize()
while true do
  getChat("TestPackPleaseIgnore", w, 20)
  sleep(5)
end
string* greetingArray()
{
    string greetings[50000];
    for(int i = 0; i < 50000; i++)
    {
        greetings[i++] = "Hi";
        greetings[i++] = "Hey";
        greetings[i++] = "Hello";
        greetings[i++] = "What's up";
    }

    for (int i = 0; i < 50000; i++)
    {
        cout << greetings[i] << endl;
    }
    return 0;
}

int main()
{
    greetingArray();
    return 0;
}

for(int i = 0; i < 50000; i++)
{
    greetings[i++] = "Hi";
    greetings[i++] = "Hey";
    greetings[i++] = "Hello";
    greetings[i++] = "What's up";
}

for(int i = 0; i < 50000; i++)
{
    greetings[i++] = "Hi";
    greetings[i++] = "Hey";
    greetings[i++] = "Hello";
    greetings[i] = "What's up";
}

#define AMOUNT 50000 //change this number for whatever count of strings you need
std::vector<std::string> greetings;
while(greetings.size() < AMOUNT){
   greetings.push_back("Hi");
   greetings.push_back("Hey");
   greetings.push_back("Hello");
   greetings.push_back("What's up");
}

//print the vector's contents
for (std::vector<string>::iterator strIter = greetings.begin(); strIter != greetings.end(); ++strIter){
   cout << *strIter << endl;
}

string*

string greetings[50000];

for(int i = 0; i < 50000; i++)
{
    greetings[i++] = "Hi";
    greetings[i++] = "Hey";
    greetings[i++] = "Hello";
    greetings[i++] = "What's up";
}

#include <iostream>
#include <string>

std::string * greetingArray( size_t n )
{
    const size_t N = 4;
    const char *words[N] = { "Hi", "Hey", "Hello", "What's up" };

    std::string *greetings = new std::string[n];

    for ( size_t i = 0; i < n; i++ )
    {
        greetings[i] = words[i % N];
    }

    return greetings;
}


int main()
{
    size_t N = 50000;

    std::string *greetings = greetingArray( N );

    for ( size_t i = 0; i < N; i++ )
    {
        std::cout << greetings[i] << std::endl;
    }

    delete [] greetings;

    return 0;
}

string* yourFunctionName();

{
   string myArray[50000];

for(unsigned int i=0;i<12500;){
      myArray[i*4]="Hi";
      myArray[i*4+1]="Hey";
      myArray[i*4+2]="Hello";
      myArray[i*4+3]=What's up";
   }

return myArray;

#include <iostream>
#include <array>

const unsigned arraySize = 50000;

std::array<std::string, arraySize> greetingArray()
{
    std::array<std::string, arraySize> greetings;
    for(unsigned i = 0; i != greetings.size(); i += 4)
    {
        greetings[i] = "Hi";
        greetings[i+1] = "Hey";
        greetings[i+2] = "Hello";
        greetings[i+3] = "What's up";
    }

    return greetings;  // return the array, not 0 !
}

int main()
{
    std::array<std::string, arraySize>  greetings = greetingArray();
    for(unsigned i = 0; i != 20; ++i) std::cout << greetings.at(i) << 'n'; // 20 outputs is plenty to check if it worked
    return 0;
}
public boolean intersects(ImageView block,ImageView round){

float blockBottom = block.getY()+block.getHeight();
float blockLeft = block.getX();
float blockRight = block.getX()+block.getWidth();
float roundTop = round.getY();
float roundLeft = round.getX();
float roundRight = round.getX() + round.getWidth();

if (blockBottom<roundTop)
{
if (roundLeft>blockLeft && roundRight<blockRight) return true;
}
return false;
}
public class TopLevelViewModel
{
    public TopLevelID  { get; set; }
    public TopLevelTitle  { get; set; }
        public List<SecondLevelViewModel> SeconLevel { set; get; }

    public TopLevelViewModel()
       {
           Inner = new List<SecondLevelViewModel>();
       }

    }

public class SecondLevelViewModel
{
    public SecondLevelID  { get; set; }
    public SecondLevelTitle  { get; set; }
            public TopLevelID  { get; set; }
        public WrapperViewModel  { get; set; }
}  

public class InnerViewModel
{
    public InnerID  { get; set; }
    public InnerTitle  { get; set; }
        public SecondLevelID  { get; set; }
}

public class WrapperViewModel
{
        public List<InnerViewModel> Inner { set; get; }

        public WrapperViewModel()
        {
                Inner = new List<InnerViewModel>();
        }

}

List<TopLevelViewModel> data = null ;
        data = db.TopLevel.Where(t => t.TopLevelID == URLTopLevelID).Select(t => new TopLevelViewModel()
                {
                    TopLevelID = t.TopLevelID,
        TopLevelTitle = t.TopLevelTitle,
                    SeconLevel = db.SecondLevel.Where(s => s.TopLevelID == t.TopLevelID).Select(s => new SecondLevelViewModel()
                    {
                        SecondLevelID = s.SecondLevelID,
            SeconLevelTitle = s.SeconLevelTitle,            
                        WrapperViewModel = ??????question???????


                    }).ToList<SecondLevelViewModel>()
                }).ToList < TopLevelViewModel();

db.Inner.Where(i => i.SecondLevelID == s.SecondLevelID).Select(i => new InnerViewModel()
                                            {
                                               InnerID  = i.InnerID,
                       InnerTitle = i.InnerTitle
                                            }).ToList<InnerViewModel>()

List<TopLevelViewModel> data = null ;
        data = db.TopLevel.Where(t => t.TopLevelID == URLTopLevelID).Select(t => new TopLevelViewModel()
                {
                    TopLevelID = t.TopLevelID,
        TopLevelTitle = t.TopLevelTitle,
                    SeconLevel = db.SecondLevel.Where(s => s.TopLevelID == t.TopLevelID).Select(s => new SecondLevelViewModel()
                    {
                        SecondLevelID = s.SecondLevelID,
            SeconLevelTitle = s.SeconLevelTitle,            
                        WrapperViewModel = new WrapperViewModel { Inner =
                                        db.Inner.Where(i => i.SecondLevelID == s.SecondLevelID).Select(i => new InnerViewModel()
                                            {
                                               InnerID  = i.InnerID,
                       InnerTitle = i.InnerTitle
                                            }).ToList<InnerViewModel>()
                    }).ToList<SecondLevelViewModel>()
                }).ToList < TopLevelViewModel();

PRAVILA

1.Zabranjeno psovanje!
2.Zabranjeno fan 4 fan!
3.Zabranjeno pitati za rank!
4.Zabranjeno pustati pesme koje su duze od 5:00!
5.Zabranjeno pisati woot/skip/meh!
6.Zabranjeno pustati navijacke/nacionalisticke pesme!
7.Zabranjeno pustati pesme koje se nalaze u history!
ZASVE DODATNE INFORMACIJE OBRATITI SE HOSTU :)
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_mixer.h>
#include <iostream>
#include "Constants.h"
#include "Texture2D.h"
#include "GameScreenManager.h"
using namespace::std;

//Globals
SDL_Window* gWindow = NULL;
Mix_Music* gMusic = NULL;
GameScreenManager* gameScreenManager;
Uint32 gOldTime;

//Function Prototypes
bool InitSDL();
void CloseSDL();
bool Update();
void Render();
void LoadMusic(string path);


SDL_Renderer* gRenderer = NULL;
//Texture2D* gTexture = NULL;

int main(int argc, char* args[])
{
//Check if SDL was set up correctly
LoadMusic("Music/bubble-bobble.mp3");
if(InitSDL() == true)
{
gameScreenManager = new GameScreenManager(gRenderer, SCREEN_INTRO);
gOldTime = SDL_GetTicks();

bool quit = false;

while(!quit)
{
Render();
quit = Update();
}
}




//Close Window and free resources
CloseSDL();

return 0;
}

bool InitSDL()
{
//Setup SDL
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
cout << "SDL did not start. Error: " << SDL_GetError();
return false;
}
else
{
//All good, so attempt to create a window
gWindow = SDL_CreateWindow("Games Engine Creation",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
SCREEN_WIDTH,
SCREEN_HEIGHT,
SDL_WINDOW_SHOWN);


//Did the window get created?
if(gWindow == NULL)
{
//Nope
cout << "Window was not created. Error: " << SDL_GetError();
return false;
}

gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED);

if(gRenderer != NULL)
{
//Intialise PNG loading
int imageFlags = IMG_INIT_PNG;
if(! (IMG_Init(imageFlags) & imageFlags))
{
cout << "SDL_Image could not start. Error: " << IMG_GetError();
return false;
}

/*Load the background texture
gTexture = new Texture2D(gRenderer);
if(!gTexture->LoadFromFile("Images/test.bmp"))
{
return false;
*/


}
else
{
cout << "Renderer could not start. Error: " << SDL_GetError();
return false;
}


return true;
}

if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0)
{
cout << "Mixer could not initialise. error: " << Mix_GetError();
return false;
}

}

void CloseSDL()
{
//Clear up texture
//gTexture->Free();

//Destory the game screen manager
delete gameScreenManager;
gameScreenManager = NULL;

//Release the renderer
SDL_DestroyRenderer(gRenderer);
gRenderer = NULL;

//Release the window
SDL_DestroyWindow(gWindow);
gWindow = NULL;

//Quit SDL subsystems
IMG_Quit();
SDL_Quit();

Mix_FreeMusic(gMusic);
gMusic = NULL;
}

bool Update()
{
Uint32 newTime = SDL_GetTicks();

//Event Handler
SDL_Event e;

//Get the events
SDL_PollEvent(&e);

//Handle any events
switch(e.type)
{
case SDL_QUIT:
return true;
break;
}

gameScreenManager->Update((float)(newTime-gOldTime)/1000.0f, e);
gOldTime = newTime;


switch (e.type)
{
case SDL_KEYDOWN:
switch (e.key.keysym.sym)
{
case SDLK_RETURN:
gameScreenManager = new GameScreenManager(gRenderer, SCREEN_LEVEL1);
break;
case SDLK_LSHIFT:
gameScreenManager = new GameScreenManager(gRenderer, SCREEN_LEVEL2);
break;
}
break;
}

if(Mix_PlayingMusic() == 0)
{
Mix_PlayMusic(gMusic, -1);
}

return false;


}

void Render()
{
//Clear the screen
SDL_SetRenderDrawColor(gRenderer, 0xFF, 0xFF, 0xFF, 0xFF);
SDL_RenderClear(gRenderer);

gameScreenManager->Render();

//Update Scrren
SDL_RenderPresent(gRenderer);
}

void LoadMusic(string path)
{
gMusic = Mix_LoadMUS(path.c_str());

if(gMusic == NULL)
{
cout << "Failed to load background music! Error: " << Mix_GetError() << endl;
}
}