skip main content

Posts Tagged ‘Open source’

Shuffling an Array in Ruby

posted by Duncan at 12:40 pm on November 10th, 2006

[UPDATE] Someone called NoKarma and perraultd have posted even nicer versions on the Code Snippets site, thanks!

class Array
  def shuffle
    sort_by { rand }
  end
 
  def shuffle!
    self.replace shuffle
  end
end

I had a situation when I need to shuffle the contents of an array to randomize the stuff inside. After hunting and hacking the final solution appeared to be:

class Array
  def shuffle!
    size.downto(1) { |n| push delete_at(rand(n)) }
    self
  end
end

So you just enhance the Array Class and give it a new funky method shuffle! so you can do stuff like:

a = [1,2,3,4,5,6,7,8,9]
a.shuffle!
=> [5, 2, 8, 7, 3, 1, 6, 4, 9]

Just how cool is Ruby.

NeoOffice/J 1.1 Released!

posted by Duncan at 10:36 pm on July 22nd, 2005

Hurrah, the first official release of NeoOffice/J was released today. I have downloaded it and will try it out over the next few weeks. I am hoping I will finally be able to stop using the donkey that is Office2004 for Mac. I used to use OpenOffice when I ran Fedora and loved it. NeoOffice/J is a native version of OpenOffice.

red hat has a program for pcs

posted by Duncan at 8:42 am on May 5th, 2004

Red Hat Inc., the world’s biggest distributor of the free Linux computer-operating system, will introduce a version for desktop personal computers to compete with Microsoft Corp.’s dominant Windows.

Red Hat wants to capitalize on rising corporate spending on PCs and Microsoft’s plan for a new version of Windows, which runs about 93 percent of all PCs, Red Hat Chief Executive Matthew Szulik said yesterday in an interview. He said Linux may win 10 percent of the market in “a few years.”

deep inside the k desktop environment 3.2

posted by Duncan at 8:02 am on February 24th, 2004

Deep inside the K Desktop Environment 3.2′ written by Datschge and Henrique Pinto. After introducing KDE and the project’s structure the authors present some new applications of KDE 3.2. After that they explain the key KDE technologies KParts, DCOP, KIO, Kiosk and KXMLGUI and give examples for code reusage and an overview of efforts to integrate non-KDE applications. For developers Umbrello, Cervisia and Valgrind with KCachegrind are introduced and of course KDevelop 3.0. An examination of licenses precedes the positive conclusion.

[VIA SLASHDOT]

lin—s (lindash)

posted by Duncan at 9:12 am on February 19th, 2004

Lin—s (Lindash) Program Ensures Choice in Countries Where Microsoft is Attempting to Block Desktop Linux

Leading Desktop Linux Software Now Available on www.lin—s.com Website and from Participating Resellers in the Netherlands

SAN DIEGO February 17, 2004 –The “Lin—s” (Lindash) program was launched today to make the leading desktop Linux available in those countries where the Microsoft (Nasdaq: MSFT) Corporation has blocked availability. Lin—s makes the affordable and robust operating system available to Dutch citizens through the website at www.lin—s.com and from participating resellers.

“Dutch citizens deserve the same choices that are currently available to the citizens of more than one hundred countries around the world,” said Michael Robertson, chief executive officer of Lindows.com. “Lindash ensures that the Netherlands will have affordable, virus-free options instead of just expensive Microsoft software.”

Lin—s is a program that provides the leading desktop Linux operating system to the citizens of the Netherlands, who would otherwise be unable to attain the software. The www.lin—s.com website enables Dutch citizens to purchase the easy-to-use, powerful software online for instant digital download. The website also offers listings of resellers in the Netherlands who are offering the software in stores and pre-loaded onto powerful, affordable computer systems. Lin—s allows the consumers in the Netherlands to take advantage of the cost-savings of the software that has enabled builders in the United States to offer $199 PCs and $799 laptops.

oscommerce gets a milestone release

posted by Duncan at 8:05 am on February 19th, 2003

osCommerce, the king of open source e-commerce solutions has just announced it’s first milestone release of oScommerce 2.2. Here’s what the big chief Harald Ponce de Leon said in an email to all the members.We proudly present the immediate availability of the first milestone release of osCommerce 2.2, our first public release in nearly two years since Preview Release 2.1. osCommerce 2.2-MS1 is bundled with the Catalog frontend and the Administration Tool backend, and is available in 3 languages – English, German, and Spanish.With a lot of work gone into the long development cycle, the release of 2.2-MS1 includes a wide range of feature enhancements, additions, and security updates that will form the rock-solid foundation which 2.2 and subsequent releases will be built on.Nearing the end of the long 2.2 development cycle, milestone releases are made to show what is expected for the 2.2 release.Read about osCommerce Here.

Linux for playstation comes to uk

posted by Duncan at 9:56 am on May 26th, 2002

Sony has started taking UK orders for a kit to turn the Playstation 2 games console into a computer running the Linux operating system.Full story here.


back to the top