Monday, April 20, 2009

Curl HTTP Authentication

// HTTP authentication
$url = "";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "myusername:mypassword");
$result = curl_exec($ch);
echo $result;


Sunday, April 19, 2009

FLTK in Visual C++ Express 2008

FLTK in Visual C++ Express 2008

1. Download
2. Unzip to C:\Server\fltk-1.1.9\
3. Your include folder is C:\Server\fltk-1.1.9\FL\
4. Your lib folder is C:\Server\fltk-1.1.9\include\
5. Go into C:\Server\fltk-1.1.9\vc2005\
6. Open fltk.sln
7. Compile as Debug
8. Compile as Release

9. Build your hello world.

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

int main(int argc, char **argv) {
  Fl_Window *window = new Fl_Window(300,180);
  Fl_Box *box = new Fl_Box(20,40,260,100,"Hello, World!");
  window->show(argc, argv);
  return Fl::run();

10. Configure the following in your project in Visual C++ Express 2008:

Tools > Options > Projects and Solutions > VC++ Directories >
  INCLUDE: C:\Server\fltk-1.1.9
  LIB: C:\Server\fltk-1.1.9\lib

Project > Project Properties > [Debug and Release] > Linker
    > Input > Additional Dependencies
  wsock32.lib fltk.lib comctl32.lib

Thursday, April 02, 2009

setup vnc server on fedora

# assume we are setting it up to vnc as bsmith
su -

# as root: verify current ip address

# 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

# 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