Szolgáltató adatai Help Sales ÁSZF Panaszkezelés DSA

Offline ruby-core and stdlib documentation with YARD

A short howto on creating a working offline Ruby documentation, including the ruby-core and stdlib, using the YARD gem. The original post here is 3 years old, and it was missing some instructions that took me 30 minutes googling and documentation reading.

I chose to generate the offline documentation from the Ruby source code itself. YARDoc can generate HTML pages along its own document format so you can decide in what format you want to browse the Ruby document pages. The OS is Linux and I have the most recent stable Ruby version (2.0.0-p247).

Install YARD:

$ gem install yard

Download the Ruby language source code and extract it (mine is ruby-2.0.0-p247 MRI but can be any version, although documentation quality might vary):

$ wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
$ tar xzvf ruby-2.0.0-p247.tar.gz
$ cd ruby-2.0.0-p247

Build the core documentation:

$ yardoc *.c

YARDoc will create a ".yardoc" folder by default (surprise!), that contains the YARD format and a "doc" folder where it puts the HTML pages.

$ yardoc -b .yardoc-stdlib -o doc-stdlib

Here YARDoc will create a ".yardoc-stdlib" folder for its own format and a "doc-stdlib" for the HTML pages. And we're done!

Now you can go into one of those HTML folders and load 'index.html' into your browser, however index.html is not the real starting page for the framed version you might got used to. Index.html starts with a japanese language page where you need to click "Index" or "frames" to get to the familiar looking RubyDoc pages.

Or, let's start the YARD server:

$ yard server -m ruby-core2.0 .yardoc stdlib .yardoc-stdlib

"-m" tells YARD to load multiple documents, "ruby-core2.0" and "stdlib" are just screen names. Navigate your browser to http://localhost:8808 and you will see them popping up in a list.

Happy browsing offline.

0 Tovább

apt-get behind proxy on Debian - lesson learned #2

A new proxy has been set up at my workplace and 'sudo apt-get' always fails. I have set up the proper environment variable but that did not help.

I was just about posting a question to Superuser.com when it striked me that I use 'sudo'. That means it won't be my regular user that runs 'apt-get' therefore all environment variables are lost at the point of execution.

Switched to root, set up environment variable, and issue 'apt-get', and tadaaa, problem solved. It was time to set up the proxy env variable temporarily for root.

1 Tovább

Ruby gems error: "Could not find a valid gem 'redcarpet' (= 0) in any repository ERROR: Possible alternatives: redcarpet"

Our company has moved, and we got a spectacular proxy installed at the new place, causing some chaos. Not only I had to reconfigure my Windows, I spent 2 hours to figure out how to use that proxy from a VirtualBoxed Debian. I had to supply my username and password on a command line to 'curl' or 'wget', that's for security. Setting system-wide proxy in $HTTP_PROXY env variable, also with my user/pass.

My first 'gem install' failed as it did not use the proxy. Configured it with the --http-proxy argument, it finally worked well.

Then I got home, no proxies, no whatever, just working network. A 'gem update' and a 'gem update --system' ran without error, but the next 'gem install'-s failed with a magic error:

> gem install redcarpet
WARNING:  Error fetching data: SocketError: getaddrinfo: Name or service
not known (http://rubygems.org/latest_specs.4.8.gz)
ERROR:  Could not find a valid gem 'redcarpet' (>= 0) in any repository
ERROR:  Possible alternatives: redcarpet

WTH? Gem install fails for a gem and immediately suggests the same gem?

Checked for proxy, none. Environment variable, none, there was no proxy set anywhere. Then I accidentally checkhed the 'gem install' doc:

-p, --[no-]http-proxy [URL]      Use HTTP proxy for remote operations

Err, why would it have a [no] prefix? If I don't want to use a proxy, I simply don't set it, right? Not right. Gem install remembers that I was using a proxy and tries to use it in subsequent requests.

Setting --no-http-proxy solved the problem.

Lesson learned: 'gem install' remembers if it was once run with --http-proxy parameter. Subsequent 'gem install' will use the same proxy regardless its availability.

0 Tovább

Ruby gem dependency FTW

  • simple_memoize gem uses jeweler
  • jeweler gem uses rcov
  • rcov gem cannot run under Ruby 1.9

Welcome to fail!

0 Tovább

LOLCODE rulz!

HAI
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
	AWSUM THX
		VISIBLE FILE
	O NOES
		INVISIBLE "ERROR!"
KTHXBYE

Source
1 Tovább

Good job, Bing.

0 Tovább

Ubuntu now supports time travel

At least on the features page.

0 Tovább

Steve Jobs emlékére, magyar fordítás 1-es alá

Ezúton gratulálnék annak, aki a "a company that only he could have built"-et lefordította "egy olyan vállalatot[...]amelyet csakis ő lett volna képes felépíteni"-re.

A jó megoldás természetesen az "amelyet csak ő volt képes felépíteni", egyrészt azért, mert Present Perfect-et látunk, ami befejezett múltbeli eseményekre vonatkozik, másrészt a józan paraszti ész miatt, hiszen Steve Jobs építette fel ezt a vállalatot.

steve_jobs_rip_eng

steve_jobs_rip

0 Tovább

Solution to cifs_mount fail under Ubuntu 11.04

When trying to mount a Windows share in Ubuntu 11.04 it fails with a rather useless error description, but there is some usable info in dmesg:

$ sudo mount -t cifs \/\/servername\/share_name \\
-o username=Username,password=Password /mnt/share_dir

mount: wrong fs type, bad option, bad superblock on //bsrfile12.res.hu.corp/,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount. helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

$ dmesg | tail

[90319.053420] CIFS VFS: cifs_mount failed w/return code = -22
[90408.561437] CIFS VFS: cifs_mount failed w/return code = -22

The solution is to install the 'cifs-utils' package:

$ sudo apt-get install cifs-utils
0 Tovább

All the "fuck"s in Linux kernel

Let's have some fun and grep the linux source code (linux-3.0.y) for bad words :-)

$grep -i -r -B 2 -A 2 fuck *

...

drivers/ide/cmd640.c- *  of IDE interfaces using the CMD Technologies 0640 IDE interface chip.
drivers/ide/cmd640.c- *
drivers/ide/cmd640.c: *  These chips are basically fucked by design, and getting this driver
drivers/ide/cmd640.c- *  to work on every motherboard design that uses this screwed chip seems
drivers/ide/cmd640.c- *  bloody well impossible.  However, we're still trying.

...

lib/vsprintf.c-/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
lib/vsprintf.c-/*
lib/vsprintf.c: * Wirzenius wrote this portably, Torvalds fucked it up :-)
lib/vsprintf.c- */

0 Tovább

Firefox 6 memory consumption

This is Zombieland.

0 Tovább

Soundcloud teszt - 瀟洒な花は夜に咲く

瀟洒な花は夜に咲く by karatedog

0 Tovább

"Grfológiai" tanácsadás

Valószínűleg diszgráfia kezelésért barterezhető.

0 Tovább

Firefox 5 won't create new entry in Google Calendar

I recently bumped into a problem with Google Calendar. It wouldn't create new entries, no matter how I tried (direct clicking on timesheet, through the Create button, etc.). It worked perfectly in other browsers.

So I checked Firebug, and saw an XHR entry that was red and loaded very fast (4 ms): https://www.google.com/calendar/static/41160d4e4ae6c0f08ffb15dbc5124b31calendarjs_eventformcompiled__en.js

0 Tovább

bringóhintóóóóó

0 Tovább

Compacting non-contiguous data in Ruby arrays (an Array.uniq replacement)

In Ruby, uniq is great for clearing duplicate values from an Array. However it clears every duplication throughout the array, no matter where it is located.

irb(main):001:0> a = [1,1,1,3,3,5,7,7,7,7,7,1,1,1,3,3,3]
=> [1, 1, 1, 3, 3, 5, 7, 7, 7, 7, 7, 1, 1, 1, 3, 3, 3]
irb(main):002:0> a.uniq
=> [1, 3, 5, 7]

 

That's not what I want. I want the data locally uniq-ed, so that I'd get [1, 3, 5, 7, 1, 3] as if each contigous block of data were shrinked to exactly one element.

require 'pp'
  a, b = [1,1,1,3,3,5,7,7,7,7,7,1,1,1,3,3,3], []
  a.each {|x| if a[x]!=b.last then b.push(a[x]) end}
  pp b

 

This operation won't destroy 'a' therefore the a.each... line cannot be executed more than once without first clearing the target array, as it would push the data again into 'b'.

 

Update: Shoot! Enumerable#chunk - introduced in Ruby 1.9.2 - just does the same, so it is no use to reinvent the wheel.

0 Tovább

Árukapcsolás

Új szlogen lehetne a "Mi sem temetjük a döglött aksit"?

0 Tovább

Matek, képbuheráláshoz

0 Tovább

Ruby ARGV, OptionParser

0 Tovább

Index főoldal, jííháá

0 Tovább

56 gyerek íze

11 gyerek, rögtön le is kell hozzá tenni egy D típusú vezetői engedélyt :-)

0 Tovább

Használható desktop témák Ubuntu Unity alá

0 Tovább

Firefox 4 is slow to exit, but at least it takes out the garbage!

I was just cleaning my notebook HDD so the next virtual OS would fit somewhere, when I found Firefox 'Cache' folder. It was about 621 Mbytes, which is not a big issue, but hey, I was cleaning seriously, so it had to go.

Then the next folder was 'Cache.Trash', whose size Total Commander couldn't count in 1 minute. I thought I just delete it rightaway (experimenting rocks!) then I got a few errors for some files being used. So I exited Firefox and the fun started automatically.

The folders inside 'Cache.Trash' - there was a gigazillion of them - began to disappear, one-by-one, 30 seconds later I checked Task manager and, yes, Firefox was still running. It was busy deleting those files and folders.

This nice garbage cleaning action took Firefox about 1 minute, which explains why exiting Firefox and starting it half-a-minute later might fail. And why it is a bad thing for the impatient to kill firefox.exe process immediately, when it seems to not exiting fast enough.

0 Tovább

Vélemény-ellenvélemény

0 Tovább

Olcsó lehetett

0 Tovább

Tényleg jó fotó :-)

0 Tovább

Internet Explorer 6 kiirtása az univerzumból, by Microsoft.

0 Tovább

SSD decoder ring

SSD meghajtók, chipset alapján rendezve.

0 Tovább

Logitech ügyintézés 10/10

Bekrepált a Logitech VX Nano egerem rádiós vevője, biztos rosszul viselte a folyamatos kihúzást/bedugást.

Felhívtam hát az ügyfélszolgálatot, ez a beszélgetés rövidített változata:

ÜSZ: Jó napot kívánok, XYZ vagyok, miben segíthetek?
Én: Üdvözlöm, a Logitech VX Nano egerem vevője kilazult, már nem érzékeli a számítógép, hogy be van dugva.
.
.
.
ÜSZ: Úgy látom, ez az egér még garanciás, ezért küldök Önnek helyette egy másikat. Illetve most látom, hogy ilyen egér már nincs, mert a termék megszűnt, viszont tudok helyette küldeni egy Anywhere Mouse MX-et.
Én: Rendben, köszönöm.
ÜSZ: 4-5 napon belül érkezik, UPS-sel.
ÜSZ: Viszonthallásra.

Azt hiszem hamarosan felébredek, mert ez túl szép, hogy igaz legyen.

---

Update: Az egér megérkezett. A régit nem kérték vissza.

0 Tovább

Ciklus performancia Rubyban

Maradék szabadidőmben ismét haszontalan dolgokkal kezdtem el foglalkozni, mint pl. a jó öreg Mandelbrot és Julia halmazok. Mivel a Ruby nyelvvel is most ismerkedem, remek alkalomnak tűnt a kettőt kombinálni.

Aztán belefutottam ebbe: http://shootout.alioth.debian.org/u64/performance.php?test=mandelbrot

Azt sejtettem, hogy a Ruby nem a legjobb választás a sima matematikai problémák megoldására - arra továbbra is a legjobb a C vagy a bátrabbaknak az Assembly - de az, hogy ilyen durván lassú legyen, azért nem gondoltam.

0 Tovább

/dev/random

blogavatar

Phasellus lacinia porta ante, a mollis risus et. ac varius odio. Nunc at est massa. Integer nis gravida libero dui, eget cursus erat iaculis ut. Proin a nisi bibendum, bibendum purus id, ultrices nisi.

Utolsó kommentek