Monday, April 20, 2009

Curl HTTP Authentication

// HTTP authentication
$url = "http://www.example.com/protected/";
$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);
curl_close($ch);
echo $result;
?>



source(s): http://devzone.zend.com/article/1081-Using-cURL-and-libcurl-with-PHP

Sunday, April 19, 2009

FLTK in Visual C++ Express 2008

FLTK in Visual C++ Express 2008

1. Download fltk-1.1.9-source.zip
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.
(http://www.fltk.org/documentation.php/doc-1.1/basics.html)

#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!");
  box->box(FL_UP_BOX);
  box->labelsize(36);
  box->labelfont(FL_BOLD+FL_ITALIC);
  box->labeltype(FL_SHADOW_LABEL);
  window->end();
  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
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