sudo apt-get install wx-headers libwxbase2.8-0 libwxbase2.8-dev
g++ main.cpp `wx-config --libs` `wx-config --cxxflags`
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.
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="utf8_basic"
ProjectGUID="{2FA27B9E-AB18-4225-BF22-3D6042C2D6B6}"
RootNamespace="utf8_basic"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""C:\Server\wxWidgets-2.8.10\include\msvc";"C:\Server\wxWidgets-2.8.10\include""
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WINVER=0x0400;__WXMSW__ ;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="comctl32.lib rpcrt4.lib winmm.lib advapi32.lib wsock32.lib wxbase28ud.lib wxmsw28ud_core.lib"
LinkIncremental="2"
AdditionalLibraryDirectories=""C:\Server\wxWidgets-2.8.10\lib\vc_lib""
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories=""C:\Server\wxWidgets-2.8.10\include\msvc";"C:\Server\wxWidgets-2.8.10\include""
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WINVER=0x0400;__WXMSW__ ;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="comctl32.lib rpcrt4.lib winmm.lib advapi32.lib wsock32.lib wxbase28u.lib wxmsw28u_core.lib"
LinkIncremental="1"
AdditionalLibraryDirectories=""C:\Server\wxWidgets-2.8.10\lib\vc_lib""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
//Project Properties:
//http://wiki.wxwidgets.org/Microsoft_Visual_CPP_Guide
//General>Charset: Use Unicode Character Set (or ansi:not set)
//Include: "C:\Server\wxWidgets-2.8.10\include\msvc";"C:\Server\wxWidgets-2.8.10\include"
//Library: "C:\Server\wxWidgets-2.8.10\lib\vc_lib"
//[preprocessor defines:] WINVER=0x0400;__WXMSW__ ;_WINDOWS
//[linker system subsystem:] Windows (/SUBSYSTEM:WINDOWS)
//[linker libraries (all ):] comctl32.lib rpcrt4.lib winmm.lib advapi32.lib wsock32.lib
//[linker libraries (debug ):] wxbase28ud.lib wxmsw28ud_core.lib
//[linker libraries (release):] wxbase28u.lib wxmsw28u_core.lib
//File > Advanced Save Options > UTF8 with signature, CRLF
#include <wx/wx.h>
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
wxFrame *simple = new wxFrame(NULL, wxID_ANY, wxT("你好"), wxDefaultPosition, wxSize(250, 150));
simple->Centre();
simple->Show(true);
return true;
}
[ansi] wxexpatd.lib wxexpat.lib wxjpegd.lib wxjpeg.lib wxpngd.lib wxpng.lib wxtiffd.lib wxtiff.lib wxzlibd.lib wxzlib.lib wxregexd.lib wxregex.lib wxbase28d.lib wxbase28.lib wxbase28d_odbc.lib wxbase28_odbc.lib wxbase28d_net.lib wxbase28_net.lib wxbase28d_xml.lib wxbase28_xml.lib wxmsw28d_adv.lib wxmsw28_adv.lib wxmsw28d_aui.lib wxmsw28_aui.lib wxmsw28d_core.lib wxmsw28_core.lib wxmsw28d_dbgrid.lib wxmsw28_dbgrid.lib wxmsw28d_gl.lib wxmsw28_gl.lib wxmsw28d_html.lib wxmsw28_html.lib wxmsw28d_media.lib wxmsw28_media.lib wxmsw28d_qa.lib wxmsw28_qa.lib wxmsw28d_richtext.lib wxmsw28_richtext.lib wxmsw28d_xrc.lib wxmsw28_xrc.lib [unicode] wxregexud.lib wxregexu.lib wxbase28ud.lib wxbase28u.lib wxbase28ud_odbc.lib wxbase28u_odbc.lib wxbase28ud_net.lib wxbase28u_net.lib wxbase28ud_xml.lib wxbase28u_xml.lib wxmsw28ud_adv.lib wxmsw28u_adv.lib wxmsw28ud_aui.lib wxmsw28u_aui.lib wxmsw28ud_core.lib wxmsw28u_core.lib wxmsw28ud_dbgrid.lib wxmsw28u_dbgrid.lib wxmsw28ud_gl.lib wxmsw28u_gl.lib wxmsw28ud_html.lib wxmsw28u_html.lib wxmsw28ud_media.lib wxmsw28u_media.lib wxmsw28ud_qa.lib wxmsw28u_qa.lib wxmsw28ud_richtext.lib wxmsw28u_richtext.lib wxmsw28ud_xrc.lib wxmsw28u_xrc.lib
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
sudo apt-get install libgtk1.2
umount /media/cdrom
sudo mount /dev/cdrom /media/cdrom
export SETUP_CDROM=/media/cdrom
/media/cdrom/linux-installer.sh
... let it install ...
umount -f /media/cdrom
ls *.psd | cut -d . -f 1 | xargs -L1 -i convert {}.psd {}.png