11 Aug '17, 6am

Convert ruby script into a Go script

Hi guys, i have a ruby script to split big xml (20go~) into several xml. The script run in 15min and i would like to try Go for improving this running time. But i'm pretty new in this language, and my way is hard. require 'xml' XML_FILE = './exported_0.xml' # A special file class that we'll write its output in # successive files with the same number of items in it # (except for the last one which size may vary) class SplitFile def initialize(template_name, items_per_file) @template_name = template_name @items_per_file = items_per_file @item_count = 0 @file_index = 0 @fh = open() end def write(content) @fh.write(content) @fh.write("\n") @item_count += 1 if @item_count == @items_per_file self.close() self.open() end end def open exit if @file_index == 3 @file_index += 1 @fh = File.open(self.batch_name(), 'w') end def close @fh.close @item_count = 0 end def batch_name @templa...

Full article: https://www.reddit.com/r/golang/comments/6szca1/convert_r...

Tweets

Live now!! GO GO GO!

saucony.com 11 Aug '17, 4pm

"For my Originators Only collaboration I knew from the beginning I wanted to design a Tony the Tiger themed sneaker. I’ve ...

Convert Temperatures the Analog Way

Convert Temperatures the Analog Way

hackaday.com 10 Aug '17, 8am

Everyone knows how to convert from Celsius to Fahrenheit, right? On a digital thermometer you just flick the little switch...

How to go to Mount Kelimutu in #Flores

blog.malaysia-asia.my 10 Aug '17, 6am

For those who want to know how to go to Mount Kelimutu, I have come up with a basic guide that will provide you with the m...

This season, dresses go to new lengths. Meet th...

bottegaveneta.com 10 Aug '17, 8pm

Um den Besuch auf der Website besser zu gestalten, verwendet diese Seite Cookies zur Profilerstellung auch seitens Dritter...

Script to inverse a given printable string to z...

gist.github.com 09 Aug '17, 8pm

script to inverse a given printable string to zeroing out registers (Useful in Buffer Overflow).

'Ruby Viveza Bangle' Beaded Bangles, £70 https:...

craftylittlebecca.co.uk 13 Aug '17, 8am

No not the kind you dunk in a cup of tea... We use cookies (or local storage) to ensure that we give you the best experien...

This still doesn't seem real. Way to go @emmajcoburn and @courtfrerichs8

This still doesn't seem real. Way to go @emmajc...

letsrun.com 11 Aug '17, 9pm

Heading into the last water jump, it was a three person race between the two Americans and 2015 champion Hyvin Kiyeng of K...

'Ruby Rivoli Pendant' Beaded Neclaces, £20 http...

craftylittlebecca.co.uk 13 Aug '17, 4am

No not the kind you dunk in a cup of tea... We use cookies (or local storage) to ensure that we give you the best experien...

Go Off-Grid with Solar Power Explore the components & considerations

Go Off-Grid with Solar Power Explore the compon...

motherearthnews.com 10 Aug '17, 2am

PV array. The modules and module support structure are the same for off-grid and grid-tied systems, but with an off-grid d...

My first was a shell script fix in a ruby project.

github.com 09 Aug '17, 4pm

in the first line. All the other grep s are escaped with the \ so it's cool. This one is not and it breaks on some systems...

.@HBO's #GoT hackers leak Episode 5 script and leave ransom note:

.@HBO's #GoT hackers leak Episode 5 script and ...

highsnobiety.com 08 Aug '17, 1pm

Last week, hackers attacked HBO , leaking the script for the fourth episode of Game of Thrones Season 7, before releasing ...

New ruby gem parses @Pensoft TaxPub XML docs

rubygems.org 10 Aug '17, 1pm

RubyGems.org is the Ruby community’s gem hosting service. Instantly publish your gems and then install them . Use the API ...

Singapore's public transport system to go fully...

straitstimes.com 11 Aug '17, 6am

SINGAPORE - Singapore's public transport network is set to go fully cashless by 2020, with all bus and train rides to be p...

Filaween 2.0 is Go

Filaween 2.0 is Go

hackaday.com 14 Aug '17, 8am

[Thomas Sanladerer] is at it again: testing all of the 3D-printer filaments that are fit to print (with). And this year, h...