Using CSS after to add a inner border to an image

http://www.storiesinflight.com/html5/pseudo_after.html

 

<div class="framedphoto"><img src="images/crossings1.jpg" width="200" height="150"></div>

<style>
.framedphoto {
	position: relative;
	display: inline-block;
	font-size: 0;
	line-height: 0;
}

.framedphoto:after {
	position: absolute;
	top: 0px;
	left: 0px;
	bottom: 0px;
	right: 0px;
	content: " ";
	border: 10px solid;
	-moz-border-image: url('images/overlay2.png') 20 20 20 20 stretch stretch;
	-webkit-border-image: url('images/overlay2.png') 20 20 20 20 stretch stretch;
	border-image: url('images/overlay2.png') 20 20 20 20 stretch stretch;
}
</style>

Nice CSS flowchart diagram

http://www.htmlforums.com/css/t-flowchart-using-css-85999.html

http://valid-webs.com/samples/arrow.php

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>family tree using 32 divs </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
h1 {
    width:580px; 
    font-family:verdana,arial,helvetica,sans-serif;
    font-size:18px;
    text-align:center;
    margin:40px auto;
 }
#container {
    width:580px; 
    font-family:verdana,arial,helvetica,sans-serif;
    font-size:11px;
    text-align:center;
    margin:auto;
 }  
#container a {
    display:block;
    color:#000;
    text-decoration:none;
    background-color:#f6f6ff;
 }
#container a:hover {
    color:#900;
    background-color:#f6f6ff;
 }
#no1 {
    width:190px;
    line-height:60px;
    border:1px solid #000;
    margin:auto;
 }
#no1 a {
    height:60px;
 }
#line1 {
    font-size:0;
    width:1px;
    height:20px;
    color:#fff;
    background-color:#000;
    margin:auto;
 } 
#line2 {
    font-size:0;
    width:424px;
    height:1px;
    color:#fff;
    background-color:#000;    
    margin:auto;
 } 
#line3 {
    font-size:0;
    display:inline;
    width:1px;
    height:20px;
    color:#fff;
    background-color:#000;
    margin-left:78px;
    float:left;
 }  
#line4,#line5,#line6 {
    font-size:0;
    display:inline;
    width:1px;
    height:20px;
    color:#fff;
    background-color:#000;
    margin-left:140px;
    float:left;
 }
#no2 {
    display:inline;
    border:1px solid #000;
    clear:both;
    margin-left:35px;
    float:left;
 }
#no2 a,#no4 a,#no8 a {
    width:84px; 
    height:50px;
    padding-top:8px; 
 }  
#no3 {
    display:inline;
    border:1px solid #000;
    margin-left:58px;
    float:left;
 }
#no3 a,#no5 a,#no6 a,#no7 a,#no9 a {
    width:84px; 
    height:42px;
    padding-top:16px;  
 } 
#no4 {
    display:inline;  
    border:1px solid #000;
    margin-left:53px;
    float:left;
 }  
#no5 {
    display:inline;   
    border:1px solid #000;
    margin-left:55px;
    float:left;
 }  
#line7,#line13 {
    font-size:0;
    display:inline;
    width:1px;
    height:38px;
    color:#fff;
    background-color:#000;
    margin-left:219px;
    float:left;
 } 
#line8,#line14 {
    font-size:0;
    display:inline;
    width:1px;
    height:38px;
    color:#fff;
    background-color:#000;
    margin-left:281px;
    float:left;
 }  
#no6,#no8 {
    display:inline;  
    border:1px solid #000;
    margin-left:107px;
    float:left;
 }
#line9,#line11,#line15,#line17 {
    font-size:0;
    display:inline;
    width:26px;
    height:1px;
    color:#fff;
    background-color:#000;    
    margin-top:29px;
    float:left;
 }  
#line10,#line12,#line16,#line18 {
    font-size:0;
    display:inline;
    width:1px;
    height:60px;
    color:#fff;
    background-color:#000;
    float:left;
 } 
#line16,#line18 {
    height:30px;
 }
#no7,#no9 {
    display:inline; 
    border:1px solid #000;
    margin-left:169px;
    float:left;
 } 
.clear {
    clear:both;
 }                  
-->
</style>

</head>
<body>

<h1>A simple family tree using 32 divs</h1>

<div id="container">

<div id="no1"><a href="">Managing Director</a></div>
<div id="line1"></div>
<div id="line2"></div>
<div id="line3"></div>
<div id="line4"></div>
<div id="line5"></div>
<div id="line6"></div>
<div id="no2"><a href="#">Sales &amp; Marketing Director</a></div>
<div id="no3"><a href="#">Production Director</a></div>
<div id="no4"><a href="#">Human Resources Director</a></div>
<div id="no5"><a href="#">Finance Director</a></div>
<div id="line7"></div>
<div id="line8"></div>
<div class="clear"></div>
<div id="no6"><a href="#">Factory Manager</a></div>
<div id="line9"></div>
<div id="line10"></div>
<div id="no7"><a href="#">Management Accountant</a></div>
<div id="line11"></div>
<div id="line12"></div>
<div class="clear"></div>
<div id="line13"></div>
<div id="line14"></div>
<div class="clear"></div>
<div id="no8"><a href="#">Quality Control Manager</a></div>
<div id="line15"></div>
<div id="line16"></div>
<div id="no9"><a href="#">Financial Accountant</a></div>
<div id="line17"></div>
<div id="line18"></div>
<div class="clear"></div>

</div>

</body>
</html>

jQuery 1.7 and jquery.upload-1.0.2.js by http://lagoscript.org

Have to update the code a bit to work with Jquery 1.7

 

function handleData(iframe, type) {

    if (type == “json”) {

    return $(iframe).contents().find(‘body’).html();

    } else {

    var data, contents = $(iframe).contents().get(0);

    if ($.isXMLDoc(contents) || contents.XMLDocument) {

    return contents.XMLDocument || contents;

    }

    data = $(contents).find(‘body’).html();

    if (type == ‘xml’) return parseXml(data);

    else return data;

    }

  } 

jQuery this selector

http://www.javascript-coder.com/jquery/jquery-selector-this.phtml

 

When you handle events for a particular element, it is often required to make a change only within children of the element. Here is how to do it.

Suppose this is the HTML code

<h2>Select the services you want:</h2>
<ul id='services'>
<li><img src='tick.gif'>Build a Website</li>
<li><img src='tick.gif'>Page design</li>
<li><img src='tick.gif'>Flash banners</li>
<li><img src='tick.gif'>SEO</li></ul>
</ul>

When someone clicks on each of the service, the image is to toggle.
Here is the jQuery code to do that

$(function()
{
    //handle the click for each of 'li'
    $('ul#services li').click(function()
    {
        //toggle the image
        var newimg =
            $('img',this).attr('src') == 'tick.png' 'cross.png' 'tick.png';
        /*
        notice the second parameter to $() is the context.
         'this' is the 'li' that was clicked.*/
        $('img'this).attr('src',newimg);
    });
});

jQuery draggable and resizable images

http://jsbin.com/ipoxe5/edit#javascript,html,live

 

$(document).ready(function(){

  $(“img”).resizable({ handles:’n,e,s,w,ne,se,nw,sw’ , maxHeight: 300, aspectRatio: true }).parent().draggable({containment: “#droppable”, snap:false});  

  $( “#droppable” ).droppable({

      drop: function( event, ui ) {

        $( this )

          .find( “p” ).hide();

      }

    });

});

Input field label alignment wrap float wrapping

http://ryanflorence.com/sandbox/aligned-labels.html

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

	<title>untitled</title>
	<style type="text/css">
	ol{
		padding-left: 0;
		margin-left:0;
	}

	ol>li {
		list-style-type: none;
		margin-bottom: .5em;
	}

	ol>li input[type=radio] {
		display: -moz-inline-box;
		display: inline-block;
		vertical-align: middle;
	}

	ol>li label {
		display: -moz-inline-box;
		display: inline-block;
		vertical-align: middle;
	}
	</style>
</head>

<body>
	<fieldset>
	    <legend>Radio Buttons</legend>
	    <ol>
	        <li>
	            <input type="radio" name="radio" id="x">
	            <label for="x">blah blah<br/>blah blah<br/>blah</label>
	        </li>
	        <li>
	            <input type="radio" name="radio" id="y">
	            <label for="y">blah blah<br/>blah blah<br/>blah</label>
	        </li>
	    </ol>
	</fieldset>

</body>
</html>

jQuery Hover DIV pop-up slide up

http://buildinternet.com/2009/03/sliding-boxes-and-captions-with-jquery/

 

$(‘.container’).hover(function(){

var position = $(this).children().position();

$(“.detail”, this).stop().animate({bottom: 0},{queue:false,duration:600});

}, function() {

var position = $(this).children().position();

$(“. detail”, this).stop().animate({bottom : -70},{queue:false,duration:600});

});

});

Promise Smartstor 4300n hack hacking

  1. Go to http://www.16paws.com/projects/NS4300N/dropbear.html
  2. Download the http://www.16paws.com/projects/NS4300N/dropbear_ppg/dropbear_005200.ppg
  3. Copy ppg file to your Promise drive
  4. Go to your web admin for your 4300n drive
  5. Go to Application Plug-ins and enable the new ppg file
  6. SSH into your promise drive using ssh admin@IP address using your admin password

Once you are inside SmartStor SSH:

  • The sudoers file is at /etc/sudoers
  • Type uname -mrs to see the operating system. Should be Linux 2.6.11SR3_1_2 ppc
  • You can copy and move files using cp and mv commands
  • Commands are: alias bg break cd chdir command continue eval exec exit export  false fg getopts hash help jobs kill let local pwd read readonly  return set shift times trap true type ulimit umask unalias unset  wait [ ash basename bunzip2 busybox bzcat cat chgrp chmod chroot  chvt clear cmp cp cut dd deallocvt df dirname dmesg du echo egrep  env expr false fgrep free getty grep gunzip gzip head hostname  id ifconfig insmod install kill killall ln loadkmap logger login  ls lsmod mkdir mknod mkswap more mv netstat nslookup openvt passwd  pidof ping ps pwd reset rm rmdir rmmod route run-parts sed sh  sleep sort start-stop-daemon strings stty sulogin swapoff swapon  sync tail tar tee test time top touch tr true tty uname uniq  unzip uptime usleep vi vlock wc whoami xargs yes zcat 

 

Latest DLNA drivers

this is the new ftp address for the DLNA plugin 01.02.0000.05 A6
thanks to Promise on Twitter

ftp://oem.promise.com
username: promisenas
password: dlna

Go here to learn more http://www.avsforum.com/avs-vb/showthread.php?t=859675&page=19

http://mizupc8.bio.mie-u.ac.jp/pukiwiki/?Promise%20NS4300N#hf420c97

Know any more hacks? I want to increase the speed of copies. 4300n is so damn slow over network.

Useful UNIX commands to remember

history
get history of commands

history | grep “sudo”
find all history of commands that has sudo in it

history > commands.txt
output the history to a text file

increase scrollback buffer in OS X

  1. Edit .bash_profile 
  2. Add HISTFILESIZE=2000

 

Copy files recursively keeping directories
cp . -b –parent /usbdrive

Find files by certain size and copy them
find . -size -4gb -exec cp -b –parent ‘{}’ /downloads \;

restart shell

  • . .bash_profile
  • sh .bash_profile

 

Rsync only certain file size
rsync -rv –max-size=1.5m root@tss01:/tmp/dm

Prevent SSH disconnect
edit /etc/ssh/ssh_config
ServerAliveInterval 100

Copy files without overwrite and typing Y over and over again
yes n | cp -R -h -i /dirone/* /dirtwo 

Creating alias shortcuts
alias browse=’nautilus’
alias gohere=’cd /gohere’

You can save shorts to your .bash_profile file. 

Convert unix timestamp to facebook style date format using javascript

http://forrst.com/posts/Facebook_style_live_dates_in_JavaScript-hro

 

 

/**
 * date_suffix()
 * returns the date suffix (st,nd,rd,th) for a given day in a month
 *
 * @author: Andy Thomas (forrst@antom.co.uk)
 * @date: 27/09/2010
 */

function date_suffix(date) {
        if (date == 1 ||  date == 21 || date == 31) {
                return 'st';
        } else if (date == 2 || date == 22) {
                return 'nd';
        } else if (date == 3 || date == 23) {
                return 'rd';
        } else {
                return 'th';
        }
}

/**
 * time_since()
 * returns the time passed since a given unix_timestamp.
 * eg. 10 seconds ago, 1 hour ago, 10th Sep etc
 *
 * @author: Andy Thomas (forrst@antom.co.uk)
 * @date: 27/09/2010
 */
function time_since(original) {
        original = new Date(original * 1000);
        
        var str = '';
        
        var months = [
                'Jan',
                'Feb',
                'Mar',
                'Apr',
                'May',
                'Jun',
                'Jul',
                'Aug',
                'Sep',
                'Oct',
                'Nov',
                'Dec'
        ];
        
        var chunks = [
                [31536000000, 'year'],
                [2592000000, 'month'],
                [604800000, 'week'],
                [86400000, 'day'],
                [3600000, 'hour'],
                [60000, 'minute'],
                [1000, 'second'],
        ];
        
        var today = new Date();
        var since = new Date(today.getTime() - original.getTime());
        
        if (since.getTime() > 604800000) {
                str = months[original.getMonth()] + ' ' + original.getDate() + date_suffix(original.getDate());
                
                if (since.getTime() > 31536000000) {
                        str = str + ', ' + original.getFullYear();
                }
                
                return str;
        }
        
        var ms = 0;
        var name = 0;
        var i = 0;
        var ic = chunks.length;
        var count = 0;
        
        for (i=0;i<ic;i++) {
                ms = chunks[i][0];
                name = chunks[i][1];
                
                count = Math.floor(since.getTime() / ms);
                
                if (count != 0) {
                        break;
                }
        }
        
        return count + ' ' + name + ((count == 1) ? '' : 's') + ' ago';
}

 

Colossal error by HP on last chance HP touchpads… people are fuming

http://h20435.www2.hp.com/t5/The-Next-Bench-Blog/UPDATE-Last-Chance/ba-p/68749/page/98#comments

People are angry and honestly I dont blame them. Who can wait so many months with promise for a chance to get a Touchpad and then be told that it’s all out and we shipped them all to BestBuy and others. WOW… colossal…

Good tutorial on AJAX requests using jQuery

http://kyleschaeffer.com/best-practices/the-perfect-jquery-ajax-request/

 

The Perfect AJAX Request

I’m fairly positive that by using the term perfect, I’m going to get a good amount of nay-sayers telling me why jQuery AJAX sucks, but that’s not what I’m getting at. This jQuery function is perfect in the sense that it handles 99% of all the AJAX requests you’ll ever need to make, it includes a success and failure function to ensure that users get the proper feedback they need, and you’ll get a spinning loading image while the request is being processed to boot. Throw on top of that the fact that it’s extremely easy to use, and I’d say you have something that’s pretty damned close to perfect, at least in my book. Here is the template:

$.ajax({
  type: 'POST',
  url: 'http://kyleschaeffer.com/feed/',
  data: { postVar1: 'theValue1', postVar2: 'theValue2' },
  beforeSend:function(){
    // this is where we append a loading image
    $('#ajax-panel').html('<div class="loading"><img src="/images/loading.gif" alt="Loading..." /></div>');
  },
  success:function(data){
    // successful request; do something with the data
    $('#ajax-panel').empty();
    $(data).find('item').each(function(i){
      $('#ajax-panel').append('<h4>' + $(this).find('title').text() + '</h4><p>' + $(this).find('link').text() + '</p>');
    });
  },
  error:function(){
    // failed request; give feedback to user
    $('#ajax-panel').html('<p class="error"><strong>Oops!</strong> Try that again in a few moments.</p>');
  }
});

In this case, I’m loading my site’s RSS feed into a <div/> with an ID of ajax-panel. What does it look like exactly, you ask? Let’s try it out.