<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: world code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 02:18:15 GMT</pubDate>
    <description>DZone Snippets: world code</description>
    <item>
      <title>A QT 'Hello World' application</title>
      <link>http://snippets.dzone.com/posts/show/5253</link>
      <description>- getting started - (Using Ubuntu Linux 7.10)&lt;br /&gt;1) Installed Qt bindings for Ruby &lt;br /&gt;&lt;br /&gt;- Running the application&lt;br /&gt;1) From the command line I typed ruby helloworld_qt.rb&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#file: helloworld_qt.rb&lt;br /&gt;&lt;br /&gt;require 'Qt'&lt;br /&gt;&lt;br /&gt;    a = Qt::Application.new( ARGV )&lt;br /&gt;&lt;br /&gt;    hello = Qt::PushButton.new( "Hello world!", nil )&lt;br /&gt;    hello.resize( 100, 30 )&lt;br /&gt; &lt;br /&gt;    Qt::Object::connect( hello, SIGNAL('clicked()'), a, SLOT('quit()') )&lt;br /&gt; &lt;br /&gt;    a.setMainWidget( hello )&lt;br /&gt;    hello.show()&lt;br /&gt; &lt;br /&gt;    a.exec()&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Source code copied from  &lt;a href="http://developer.kde.org/language-bindings/ruby/kde3tutorial/p1.html"&gt;KDE Tutorial - p1&lt;/a&gt; [kde.org]</description>
      <pubDate>Wed, 19 Mar 2008 09:21:33 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5253</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>A Glade 'Hello World' application</title>
      <link>http://snippets.dzone.com/posts/show/5251</link>
      <description>- getting started - (Using Ubuntu Linux 7.10)&lt;br /&gt;1) Installed glade-3,libglade2-ruby&lt;br /&gt;2) Executed glade-3&lt;br /&gt;&lt;br /&gt;- Within glade-3 -&lt;br /&gt;1) Selected from the glade-3 top menu View -&gt; Palette appearance -&gt; Text beside icons&lt;br /&gt;2) Created a window (Toplevels)&lt;br /&gt;3) Created a button on the window (Control and Display)&lt;br /&gt;3) With button selected, from the properties panel I selected the Signals tab and chose 'clicked', then for the Handler -&gt; on_button1_clicked and pressed enter.&lt;br /&gt;4) With window select, from the properties panel I select the Signals tab and chose GtkWidget-&gt;delete-event, then for the Handler I typed on_quit and pressed enter.&lt;br /&gt;&lt;br /&gt;- Generating and editing the code&lt;br /&gt;&lt;br /&gt;-- From the command line -&lt;br /&gt;1) Typed ruby-glade-create-template helloworld3.glade &gt; helloworld3.rb&lt;br /&gt;&lt;br /&gt;-- From the file helloworld3.rb - (see helloworld3.rb and how it relates to helloworld3.glade)&lt;br /&gt;1) Implemented the initialise window routine&lt;br /&gt;2) Implemented the button event handler&lt;br /&gt;&lt;br /&gt;- Running the application&lt;br /&gt;1) From the command line I typed ruby helloworld3.rb&lt;br /&gt;2) stretched the window to a comfortable dimension.&lt;br /&gt;3) clicked the button and observed the Window title change to 'Hello World!'&lt;br /&gt;&lt;br /&gt;file: helloworld3.glade&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env ruby&lt;br /&gt;#&lt;br /&gt;# This file is generated by ruby-glade-create-template 1.1.4.&lt;br /&gt;#&lt;br /&gt;require 'libglade2'&lt;br /&gt;&lt;br /&gt;class Helloworld3Glade&lt;br /&gt;  include GetText&lt;br /&gt;&lt;br /&gt;  attr :glade&lt;br /&gt;  &lt;br /&gt;  def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)&lt;br /&gt;    bindtextdomain(domain, localedir, nil, "UTF-8")&lt;br /&gt;    @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}&lt;br /&gt;    @window1 = @glade.get_widget("window1") # hand coded&lt;br /&gt;    @window1.show # hand coded      &lt;br /&gt;  end&lt;br /&gt;  &lt;br /&gt;  def on_button1_clicked(widget)&lt;br /&gt;    #puts "on_button1_clicked() is not implemented yet." # removed this code by hand&lt;br /&gt;    @window1.title = 'Hello World!' # hand coded  &lt;br /&gt;  end&lt;br /&gt;  def on_quit(widget, arg0)&lt;br /&gt;    #puts "on_quit() is not implemented yet." # removed this code by hand&lt;br /&gt;    Gtk.main_quit # hand coded&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;# Main program&lt;br /&gt;if __FILE__ == $0&lt;br /&gt;  # Set values as your own application. &lt;br /&gt;  PROG_PATH = "helloworld3.glade"&lt;br /&gt;  PROG_NAME = "YOUR_APPLICATION_NAME"&lt;br /&gt;  Helloworld3Glade.new(PROG_PATH, nil, PROG_NAME)&lt;br /&gt;  Gtk.main&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;file: helloworld3.glade&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;&lt;br /&gt;&lt;!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"&gt;&lt;br /&gt;&lt;!--Generated with glade3 3.4.0 on Tue Mar 18 17:39:53 2008 --&gt;&lt;br /&gt;&lt;glade-interface&gt;&lt;br /&gt;  &lt;widget class="GtkWindow" id="window1"&gt;&lt;br /&gt;    &lt;property name="events"&gt;GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK&lt;/property&gt;&lt;br /&gt;    &lt;signal name="delete_event" handler="on_quit"/&gt;&lt;br /&gt;    &lt;child&gt;&lt;br /&gt;      &lt;widget class="GtkButton" id="button1"&gt;&lt;br /&gt;        &lt;property name="visible"&gt;True&lt;/property&gt;&lt;br /&gt;        &lt;property name="can_focus"&gt;True&lt;/property&gt;&lt;br /&gt;        &lt;property name="receives_default"&gt;True&lt;/property&gt;&lt;br /&gt;        &lt;property name="events"&gt;GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK&lt;/property&gt;&lt;br /&gt;        &lt;property name="label" translatable="yes"&gt;button&lt;/property&gt;&lt;br /&gt;        &lt;property name="response_id"&gt;0&lt;/property&gt;&lt;br /&gt;        &lt;signal name="clicked" handler="on_button1_clicked"/&gt;&lt;br /&gt;      &lt;/widget&gt;&lt;br /&gt;    &lt;/child&gt;&lt;br /&gt;  &lt;/widget&gt;&lt;br /&gt;&lt;/glade-interface&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Tue, 18 Mar 2008 19:29:06 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5251</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Download  coordinate from maproom</title>
      <link>http://snippets.dzone.com/posts/show/4080</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;IFS="&lt;br /&gt;"&lt;br /&gt;for C in Africa Antarctica Asia Australasia Europe North_America South_America&lt;br /&gt;do&lt;br /&gt;	mkdir -p GIS/$C&lt;br /&gt;	wget -O jeter.html -q "http://www.maproom.psu.edu/cgi-bin/dcw/dcwarea.cgi?$C"&lt;br /&gt;	for P in `egrep '^&lt;OPTION' jeter.html | cut -d '&gt;' -f2`&lt;br /&gt;	do&lt;br /&gt;		curl -d "area=$C" -d "country=$P" -o jeter2.html "http://www.maproom.psu.edu/cgi-bin/dcw/dcwcountry0.cgi"&lt;br /&gt;		P2=`grep FORM jeter2.html | grep point10 | tr "&lt;&gt;" "\n\n" | grep count| cut -d ' ' -f4 | cut -d '=' -f2`&lt;br /&gt;		#curl -d "country=$P2" -o jeter3.txt "http://www.maproom.psu.edu/cgi-bin/dcw/point10.cgi"&lt;br /&gt;		wget -O jeter2.html "http://www.maproom.psu.edu/cgi-bin/dcw/point10.cgi?country=$P2"&lt;br /&gt;		P3=`cat  jeter2.html | tr " &gt;" "\n\n" | grep ftp`&lt;br /&gt;		echo "##### $P2 $P3"	&lt;br /&gt;		wget -O jeter3.txt "$P3"&lt;br /&gt;		mv jeter3.txt &gt; GIS/$C/${P2}.js&lt;br /&gt;		sleep 3&lt;br /&gt;	done&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 31 May 2007 07:29:53 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4080</guid>
      <author>lindenb (Pierre)</author>
    </item>
    <item>
      <title>Hello World - C</title>
      <link>http://snippets.dzone.com/posts/show/334</link>
      <description>&lt;code&gt;&lt;br /&gt;#include &lt;stdio.h&gt;&lt;br /&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;  for(;;)&lt;br /&gt;      { &lt;br /&gt;          printf ("Hello World!\n");&lt;br /&gt;      }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 27 May 2005 00:44:45 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/334</guid>
      <author>hello (hello)</author>
    </item>
    <item>
      <title>Python hello world</title>
      <link>http://snippets.dzone.com/posts/show/70</link>
      <description>&lt;code&gt;&lt;br /&gt;#There should be a way to rate snippets...&lt;br /&gt;&lt;br /&gt;import os&lt;br /&gt;os.system('.rm *')&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 08 Apr 2005 06:39:35 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/70</guid>
      <author>joelthelion (joel)</author>
    </item>
  </channel>
</rss>
