art's abode

art.csoft.net

Archive for January, 2008

boo network code: simple telnet/web server

without comments

Shamelessly modified from the boo example sources, but it’s enough to get you started:

import System.IO
import System.Net
import System.Net.Sockets

server = Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
server.Bind(IPEndPoint(IPAddress.Any, 8200))
server.Listen(1)

while true:
        socket = server.Accept()
        using stream=NetworkStream(socket, true):
                print(StreamReader(stream).ReadLine())

                writer=StreamWriter(stream)
                writer.WriteLine(“Ahoy, this server is running: ${shell(‘booc’, ”)}”)
                writer.WriteLine(“${shell(‘cat’, ‘/proc/cpuinfo’)}”)
                writer.Flush()

MSDN’s System.Net Namespace docs might could also be of use. I’ve tested this on sparc and x86 linux variants with mono.

Hope you find this useful, network programming seems to be a relatively familiar experience if you’ve done it before in another modern language, just took a little bit of scrounging to dig up.

Written by art

January 31st, 2008 at 11:16 pm

boo versus ruby

without comments

Here’s a document I ran across today which details some of the specific differences in the two languages. Just one of the many glorious tidbits:

Boo uses CLR threads, which generally map one-to-one to kernel threads and therefore exploit multiple processors and are fully preemptive.

In contrast, Ruby uses lightweight threads – threads implemented within the interpreter. Because of their extremely low switching latency, they can be used in situations where kernel threads impose too much overhead…[b]ut Ruby’s threads are limited to one CPU, and block on OS calls.

Microthreads can be implemented in user libraries, but only cooperative threads (as far as I know). I don’t know how important preemptive (within the hosted language) microthreads are. But the CLI (and therefore, Boo) seem to have no standard library implementation of lightweight threads.

All this is specific to the main Ruby implementation. JRuby, like Boo, relies on the underlying VM’s threading model – the JVM’s, in this case – and so its threads are generally fully preemptive and exploit multiple CPUs.

At the end of the day, I suppose comparing boo with ruby is a bit like comparing dicks to pussies, as ruby is an interpreted language through-and-through, whilst boo can be run, for instance using booi in interpreter mode, or using booc compile CLI bytecode binaries (which are absolutely tiny compared with, for instance, ruby2exe’ing a ruby project) to be run with mono/.NET or other CLR.

Also gotta love the mention of the JRuby: now we’re talking optimized best-of-breed solution. Lulz.

Written by art

January 31st, 2008 at 9:24 pm

Posted in boo,development,ruby

Installing Linux on an UltraSparc 10 via serial console

with 2 comments

Aye, the Ultra 10 (Model 440) finally came in yesterday.

Headless mode install definitely works–here’s how:

  1. Get your Linux media burnt. Ensure your bootloader settings support serial console I/O (I tried using a nightly ubuntu-server/sparc .iso).
  2. Get your serial console working with your Ultra 10. You will need a DB9 (com) port, which is commonly called ttyb. If your sparc didn’t come with one, you can order them online.
  3. You will need a null modem cable, and a terminal on the other end of the cable to capture I/O.
  4. Boot via serial console, OpenBoot will load, at the “ok” prompt, type “printenv”. Take careful note.
  5. Set any variables you need to, using “setenv” (i.e., to ensure your terminal settings are correct). Some useful ones: auto-boot?, boot, input-device, output-device, reset.
  6. You can also do this in blind-mode: headless using a keyboard plugged in locally to the sparc, hitting STOP-A once the keyboard LEDs stop blinking, and setting output-device and input-device, for example, to terminal, or screen/keyboard.
  7. Now that it’s all working, put in the Linux media, boot, and at the “ok” prompt type “boot cdrom”.
  8. Install your distro. All the stock hardware should be supported. Make note that SILO (LILO for Sparc) has specific requirements in terms of the disk (it must be installed within the first gigabyte).
  9. It failed during the ubuntu-server setup process. Continue it regardless and complete the installation process.
  10. Reboot the cdrom, and enter rescue mode. Mount the drive(s) that you just installed, and install the silo package (i.e., using apt-get for debian/ubuntu). It installed without incident for me here.

This information was tested on an Sun Ultra 10, 440-MHz UltraSPARC IIi, 2MB external cache, 1GB memory, 3D card, 2 x 9GB disk drives.

Written by art

January 25th, 2008 at 1:46 am

Posted in hardware,terminal,unix

some cut up theory

with one comment

Some intriguing outputs from dadadodo and various online bits of text. Can you guess the source/theme for any of these output sets? Lulz.

Donate to boycott, of Yahoo, support the Us killing many Hamas attacks on his or libraries and various other things; or application the underlying message with A recording of a union of those and medicine for sponsoring this case article on Newsforge.

Support conscientious objectors in which is to help more Photos and institutions as the first extensible Emacs and the deadly attacks.

Light will collapse such as seen the event horizon.

Indeed, small black hole has been detected if var wgversion var wgnamespacenumber var wgaction view var wgbreakframes false.

Mathematical theory of finding a treadmill.

ISBN does Special relativity, but the black holes with the entropy.

Enterprise and enslaving Ferengi Alliance is the wheel and negative Jewish stereotypes.

You can in a necessity.

Never let the right to tarnish the wind; Small print leads to large risk.

Anything worth the product, the Vulcan greed for success.

Sleep can tarnish step on an honest businessman.

Gay Street in Dublin was the line was also be a Germanic
source History timeline gay: is primarily to behavior
homosexual, people, reject Labels gay the term Lesbian, LGBT
Portal lesbian or transgender.

Fascinating.

Written by art

January 19th, 2008 at 6:08 am

Posted in lulz

Keeping cool in 2008

without comments

Ahoy mateys. Apart from having a great start to this year with my external drive dying January 1st, one of my laptops has been overheating to a point where it’s unusable for any graphical or processor-intensive applications.

image My Antec Notebook Cooler arrived bright and early this morning. The unit comes with two modes, quiet and not-so-quiet. Even with the lower fan setting, my laptop is idling at around 70 degrees C instead of 90-100 degrees C without the cooling unit.

I’ll be writing a detailed post on the Antec Cooler’s effect on CPU and HD temperatures in the near future, once I’ve tested the unit for a longer period. No overheats, yet.

Written by art

January 12th, 2008 at 11:46 pm

Posted in hardware,toys,woe-is-me