Error: No Image Handler Defined
the fix:
wxInitAllImageHandlers();
A record of solutions to when I get stuck on some problem. When I think 'I know I have found the answer to this before' I can just search my blog.
wxInitAllImageHandlers();
$arr = array();
$arr[] = array('first'=>'jack','last'=>'smith');
$arr[] = array('first'=>'john','last'=>'williams');
$arr[] = array('first'=>'mark','last'=>'jesperson');
$arr[] = array('first'=>'vlad','last'=>'shuttleworth');
$f = array_map(create_function('$a', 'return $a["first"];') , $arr);
echo implode(",", $f);
//outputs:
//jack,john,mark,vlad
echo "<?php for(\$i=1; \$i<=999; \$i++){ echo sprintf('%03d',\$i).chr(10);} ?>"|php
$sql = '';
$sql.="SELECT fieldtype, count(1) as count ";
$sql.="FROM mytable ";
$sql.="GROUP BY fieldtype ";
$sql.="ORDER BY fieldtype ";
echo report_append("summary of data", $sql);|fieldtype|count|
|0 |9 |
|1 |397 |
|2 |965 |
|3 |554 |
|4 |683 |
|5 |1352 |
|6 |1390 |
|7 |237 |
|8 |1372 |$q='';
$q.="SELECT
(case
when fieldtype=1 then 'Apple'
when fieldtype=2 then 'Banana'
when fieldtype=3 then 'Blackberry'
when fieldtype=4 then 'Cherry'
when fieldtype=5 then 'Grape'
when fieldtype=6 then 'Orange'
when fieldtype=7 then 'Peach'
when fieldtype=8 then 'Pear'
else '' end) as typename, fieldtype, count(1) as count
FROM mytable d GROUP BY fieldtype ORDER by fieldtyped;
";
report_append("summary of data", $q);|typename |fieldtype|count|
| |0 |9 |
|Apple |1 |397 |
|Banana |2 |965 |
|Blackberry|3 |554 |
|Cherry |4 |683 |
|Grape |5 |1352 |
|Orange |6 |1390 |
|Peach |7 |237 |
|Pear |8 |1372 |function select_all($sql)
{
$rows = array();
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result))
$rows[] = $row;
return $rows;
}
function report_append($title,$sql)
{
$rows = select_all($sql);
$headersize=array();
$header=array();
foreach($rows[0] as $colname=>$col)
$header[]=$colname;
foreach($rows[0] as $colname=>$col)
$headersize[] = strlen($colname);
foreach($rows as $row)
foreach($headersize as $colnum=>$col)
$headersize[$colnum] = max( $headersize[$colnum] , strlen($row[$header[$colnum]]) );
$h='';
foreach($header as $colnum=>$colname)
$h.="|".sprintf("%-".$headersize[$colnum]."s", $colname);
$h.= "|\n";
foreach($rows as $row)
{
foreach($headersize as $colnum=>$col)
$h.="|".sprintf("%-".$col."s", $row[$header[$colnum]]);
$h.= "|\n";
}
$return='';
$return.="---------------------------------------------------------\n";
$return.="$title\n";
$return.="---------------------------------------------------------\n";
$return.=$h;
return $return;
}common pitfalls when going from html to xhtml
-------------------------------------------------
<img /><br /><input /> #good, bad: <img><br><input>
<i><b>hi</b></i> #good, bad: <b><i>hi</b></i>
<a href=""></a> #good, bad: <a href=''></a>
<a href="a=b&c=d"></a> #good, bad: <a href="a=b&c=d"></a>
  #good, bad: mount -t cifs -o username=guest \\\\192.168.0.97\\share /home/share-buff/
select dob,extract(year from AGE(dob )) from dob_table limit 1;
select dob,extract(year from AGE(now(), dob )) from dob_table limit 1;
select dob,extract(year from AGE(current_timestamp,dob)) from dob_table limit 1;
select dob,extract(year from AGE('2009-09-10', dob )) from dob_table limit 1;
select dob,to_char(AGE(dob),'YYYY')::integer from dob_table limit 1;
select dob,substr(AGE(dob)::text,1,3) from dob_table limit 1;
nohup ./myscript.sh>log_myscript.log 2>&1 &
tail -f log_myscript.log
nohup ./myscript.sh>log_myscript_`date +%Y%m%d`.log 2>&1 &
tail -f log_myscript_`date +%Y%m%d`.log
`date +%Y%m%d` - grabs current date, inserts it into filename
nohup - script run even after terminal/ssh session ends
>log_myscri... - captures output to log file named log_myscr..
2>&1 - outputs stderr to stdout
& - makes it run in the background
tail -f - watches log, CTRL-C will not stop script
# assume we are setting it up to vnc as bsmith
su -
# as root: verify current ip address
ifconfig
# as root: install if needed
yum install vnc-server
# as root: uncomment out 2 lines, replace myusername with bsmith
vim /etc/sysconfig/vncservers
# as bsmith: set vnc password
vncpasswd
# as root: generates ~/.vnc/xstartup
service vncserver start
# as root: sets service to startup with machine
chkconfig vncserver on
# as root: uncomment out line 4 and 5
vim /bsmith/.vnc/xstartup
# as root: applies settings
service vncserver start
# as root: open up port in firewall, note vnc is insecure by protocol
vim /etc/sysconfig/iptables
# as root: apply firewall changes, vnc=insecure so better to use over lan
service iptables restart