Other

Partition a list numerically?

Submitted by Greg Buchholz
on June 9, 2009 - 11:13pm

Over on the Haskell Cafe mailing list, the topic of which of the following two definitions was better came up:

buildPartitions xs ns = zipWith take ns . init $ scanl (flip drop) xs ns


...or...

takeList :: [Int] -> [a] -> [[a]]
takeList [] _         =  []
takeList _ []         =  []
takeList (n : ns) xs  =  head : takeList ns tail
     where (head, tail) = splitAt n xs

...with various parties declaring the first example as "too smart", and others claiming that the second example is newbie level code. Well I'm much too lazy to try to reason out what those snippets might do at a glance. But the type signature was a pretty big hint as to what the intent was. So I fired up

Think About Career

Submitted by jennyl8221
on May 6, 2009 - 3:43am

The concept of career planning is no simple one to say the very least. Although you've probably heard it before, I will reiterate the notion that selecting the right career field can be irksome and stressful. Everyone on this planet wants to choose a job that they're going to enjoy, or at least partially enjoy. This is why career planning is so essential.

Preventing STP forwarding loops

Submitted by ciscozine
on February 4, 2009 - 6:24pm

The Spanning Tree Protocol is an OSI layer-2 protocol that ensures a loop-free topology for any bridged LAN. Spanning tree allows a network design to include spare (redundant) links to provide automatic backup paths if an active link fails, without the danger of bridge loops, or the need for manual enabling/disabling of these backup links.

DOCSIS 3.0: Modems Over 300 Mbps

Submitted by ciscozine
on January 30, 2009 - 9:00am

Cisco Systems is developing a cable modem that will use Broadcom’s recently announced DOCSIS 3.0 silicon to bond together eight downstream channels – letting cable providers, theoretically, pump Internet content down to subscribers at more than 300 Mbps.

Cisco IOS: Attack & Defense

Submitted by ciscozine
on January 30, 2009 - 8:56am

Surfing the web, I have found a nice talk on Cisco IOS Forensics and Exploits, explained during the 25C3: “Cisco IOS Attack & Defense - The State of the Art“.

What is 25C3?

Finding Foreign Key Constraints in Oracle by JP Vijaykumar

Submitted by UMBRO
on January 19, 2009 - 2:24am

Finding Foreign Key Constraints in Oracle by JP Vijaykumar

http://www.databasejournal.com/features/oracle/article.php/3665591/Findi...

SELECT owner, constraint_name, constraint_type, table_name, r_owner,
r_constraint_name
FROM all_constraints
WHERE constraint_type = 'R'
AND r_constraint_name IN (

Non-ugly average in Haskell

Submitted by Greg Buchholz
on November 8, 2008 - 12:01am

data E a b = L (E a b) | R b deriving (Show)

fold f acc [] = R acc                      
fold f acc (x:xs) = let x' = f acc x 
                    in x' `seq` (L $ fold f x' xs)

lift2 f = \x y -> par_eval x y
    where par_eval   (L x)   (L y) = par_eval x y
          par_eval x@(R _)   (L y) = par_eval x y
          par_eval   (L x) y@(R _) = par_eval x y
          par_eval   (R x)   (R y) = R $ f x y

lift1 f (L x) = lift1 f x
lift1 f (R x) = R (f x)

sum' xs = fold (+) 0 xs
len' xs = fold (\x y->succ x) 0 xs
avg  xs =  (sum' xs) / (len' xs)

main = print $ avg [1..1e7]

instance Eq b => Eq (E a b) where
    a == b = case (lift2 (==) a b) of (R x) -> x

instance Num b => Num (E a b) where
   (+) = lift2 (+)
   (*) = lift2 (*)
   fromInteger = R . fromInteger
   abs = lift1 abs 
   signum = lift1 signum

instance Fractional b => Fractional (E a b) where
   (/) = lift2 (/)
   fromRational = R . fromRational

handcrafting programmers: small embedded example

Submitted by olecom
on April 22, 2008 - 12:52am

More stuff from MSP430 experience; now microprocessor itself.
Conclusion: imagination and creativity, guys, like PR dudes do.
But from educational POV it is a sad thing.

Newsgroups: gmane.comp.hardware.texas-instruments.msp430.gcc.user
Subject: A bit more about software (Re: How do you get an ez430 going under Linux?)
Date: 2007-10-01 04:16:09 GMT (29 weeks, 1 day and 9 minutes ago)

Syntax highlighting (oh, that handcrafted programming)

Submitted by olecom
on April 7, 2008 - 5:17pm
User-Agent: jed (x86_64-pc-linux-glibc-debian)

Value of syntax highlighting for programming in text editors is hard to
overestimate. I recall one my buddy, a keen school olympic competitor on
programming, who said, that move from Borland Pascal 5 to 6 and 7 was a
great thing because of highlighting.

Many syntax and logic errors just popped up right before one's eyes.

Back to text and graphic terminals.

Submitted by olecom
on April 5, 2008 - 6:32pm

It's about my view of another incarnation of text/graphic terminals in modern, not so efficient, noisy, but power-saving reality. One, three or more useless x86 cores? Why? Toasters from xbill are finally here?

It's better to have one processor in display and a bit of imagination.

http://www.advogato.org/person/olecom/diary/7.html

Misc. ray tracers

Submitted by Greg Buchholz
on October 10, 2007 - 5:01pm


By popular demand, here's the more web accessible versions of a couple of simple ray tracers that I quickly cranked out in Perl and Haskell. Along with the respective source code.

It takes a POV-like scene file, and spits out a *.ppm file onto STDOUT.

高句丽和(王氏)高丽不是一回事,渤海国跟韩国人也没有什么大的关系

Submitted by UMBRO
on June 24, 2007 - 1:47pm

高句丽和(王氏)高丽不是一回事,渤海国跟韩国人也没有什么大的关系

1,高句丽公元668年灭国。高句丽灭国后,唐朝在其故地成立安东都护府。
后来由于高句丽遗民的叛乱和安史之乱的影响,唐朝无力经营这一地区,

Wanted: standardised hardware classes

Submitted by biscuitman
on May 29, 2007 - 1:22am

We really need standardised device classes similar to the USB device classes. If the major players dont want to then we should start talking to all the minor players. If still that would not work then we have to start making our own devices.

solaris 10 development tools on CORE installation : make / CC / headers

Submitted by mator
on April 3, 2007 - 4:28am

My new work is to manage solaris 10 on sparc machines, and i'm newbie in solaris.

here's some hints on packages, how to compile something if you installed Solaris in minimal CORE package configuration:

needed :
SUNWbtool for ar , SUNWsprot for make , add /usr/ccs/bin to PATH
SUNWhea for std headers (stdio.h, etc...)
Sun Studio 1x for CC compiler , add /opt/SUNWspro/bin to PATH, vim in /opt/SUNWspro/contrib/

php mysql NONEXISTENT/charsets error

Submitted by mator
on February 6, 2007 - 4:50pm

last time, our developers have given me following error, while trying to use mysql database connection from php :

File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#51' is not a compiled character set and is not specified in the 'NONEXISTENT/charsets/Index' file

i spend 3 working hours to detect what was the reason of this, and the problem was inside php which was compiled with it's internal mysql support. once i recompiled php (--with-mysql=/path/to/mysql) with system installed mysql version, the problem is gone!