ignore
ignore
Last edited by jimi_hendrix; January 5th, 2009 at 01:49 AM.
XHTML (With a bit of PHP)
Code:<html> <head> <title>Hello World form</title> </head> <body> <? if(!$_GET['name']){ ?> <form name="input" action="" method="get"> What is your name? <input type="text" name="name" /> <input type="submit" value="Submit" /> </form> <? }else{ ?> Hello, <? echo $_GET['name'];?> welcome to Ubuntu! <? } ?> </body> </html>
Warning: Any code examples I write are probably untested and contain bugs. Do not execute directly. Look for intent, not accuracy, please!
L.A.G. - Jobs Dissembles - 2010/4/29
You could also do it in one file
helloubuntu.py :
Code:#!/usr/bin/env python import cgi form = cgi.FieldStorage() tpl = """ <html> <head> <title>Hello Ubuntu</title> </head> <body> %s </body> </html> """ if not form.has_key("submitted") : form = """ <p>Hi, what's your name?</p> <form action="helloubuntu.py"> <input type="hidden" name="submitted" value="true" /> <input type="text" name="name" /> <input type="submit" value="Get reply" /> </form> """ print tpl % form else : print tpl % "Hello, %s! Welcome to Ubuntu!" % form["name"]
Last edited by -grubby; January 11th, 2009 at 09:27 AM.
<bump>This thread is getting ignored</bump>
MirthKit
MirthKit is my game platform project, which runs a language called Squirrel.Code:for(;;) { text("Hello World! Welcome to Ubuntu.",10,10,100); update(); }
http://www.mirthkit.com
Last edited by curvedinfinity; January 12th, 2009 at 12:31 AM.
"Simplicity is the ultimate sophistication." - Leonardo da Vinci
Erlang:
shoudl work but i didnt test...Code:-module(hello). -export([helloUbuntu/2]). helloUbuntu() = Name = io:get_line("what is your name? "), NewName = string:strip(Name, both, $\n), io:format("hello ~s and welcome to ubuntu", [NewName])
you need to run it in an erlang shell though with hello:helloUbuntu after compiling
JavaScript, using Seed
Code:Seed.import_namespace("readline"); Seed.import_namespace("GLib"); var my_name = GLib.get_user_name(); Seed.print("Hello, " + my_name + "! Welcome to Ubuntu");
Last edited by bruce89; February 18th, 2009 at 02:01 AM.
A Fedora user
posix c
policy based c++Code:/* written by g3rc4n@gmail.com */ #include <unistd.h> #include <stdlib.h> #include <string.h> #define BUF_SIZE 4096 int main(){ const char* intro = "Hi! What's your name? "; const char* outroa = "\nHello, "; const char* outrob = "! Welcome to Ubuntu!\n"; char* input_buf[BUF_SIZE]; if(write(STDOUT_FILENO,intro,strlen(intro))==-1) exit(EXIT_FAILURE); ssize_t n = read(STDIN_FILENO,input_buf,BUF_SIZE-1); if(n == -1) exit(EXIT_FAILURE); if(write(STDOUT_FILENO,outroa,strlen(outroa))==-1) exit(EXIT_FAILURE); if(write(STDOUT_FILENO,input_buf,n)==-1) exit(EXIT_FAILURE); if(write(STDOUT_FILENO,outrob,strlen(outrob))==-1) exit(EXIT_FAILURE); exit(EXIT_SUCCESS); }
Code:#include <iostream> #include <string> #include <cstdlib> template<class LANG> struct hello_ubuntu : private LANG{ static void run(std::istream& istr, std::ostream& ostr){ ostr << LANG::intro(); std::string name; istr >> name; ostr << LANG::outroa() << name << LANG::outrob() << std::endl; } }; struct english{ static std::string intro(){ return "Hi! What's your name? "; } static std::string outroa(){ return "Hello, "; } static std::string outrob(){ return "! Welcome to Ubuntu!"; } }; int main(){ hello_ubuntu<english>::run(std::cin,std::cout); std::exit(EXIT_SUCCESS); }
Last edited by i_heart_pandas; February 18th, 2009 at 02:16 AM.
Started similar thread on Dream In Code, feel fre to move examples. Search for "Hello DIC" on Dream In Code.
Bookmarks