Dalla Rosa

0 notes &

RPM Packages: Compilation flags

Since October last year I took over the server management tasks in my project. Unfortunately, those machines are loaded not with Debian but with Scientific Linux (Why SL is one of the great mysteries of universe). 

One of these days I needed to know which were the compilation flags of a package. 

TL;DR:

rpm -q --queryformat="%{NAME}: %{OPTFLAGS}\n" PACKAGE_NAME

Long Version:

-q or —query is the flag for querying information about a package.

—queryformat is quite obvious but here it is: use this flag to set the the output format of the query result.

A bit more on —queryformat:

According to the docs:

Query formats are modifed versions of the standard printf(3) formatting.

Ok, how can I get a list of the information I can output?

Again, from the docs:

rpm will print a list of all of the tags it knows about when it is invoked with the —querytags argument.

Kinda weird to be writing about RPM based distributions but oh well, at least I’m not managing Windows servers ;)

Filed under centos linux rpm tech server

1 note &

Exchanging your notebook LCD screen in Japan

This is the second time I break the screen of a notebook.

First time was with this this Asus Eee PC 1000HE I had for a 1 year and a half. The little boy was on beside my bed and so it had an encounter with my foot, long enough just to crack the LCD screen. The second time was a few weeks ago. I was doing some work on the bed before sleeping but I actually fell asleep. The notebook just fell. Here I am again with a broken LCD screen.

The first time I really had no idea of where to buy a new screen, so I just went around the web looking for some japanese site that seemed reliable enough and that was selling notebook LCD screens. The search took a few days but I ended finding 液晶プロ(Ekishou Pro - “LCD Pro”).

They specialize on replacement LCD screens for notebooks and have a pretty nice line up, covering most brands like Asus, Dell and even Apple.

The looks of the website don’t really help but my first buying went really smooth. The screen for my notebook was listed as in “contact us” so I sent them an email which was quickly replied by their staff with a link to the an available screen, compatible with my model. Payment can be done through credit card or bank transfer. 

The LCD arrived in a few days and worked all pretty well.

So, this time when I got yet another screen broken it was a no brainer. Just went to Ekishou Pro and looked up my model (Dell Inspiron 1122 - or M102z) and quickly found it around the Dell, 11.6 inches category.

Can’t wait for it to arrive soon and get my machine back!

Filed under lcd ekishoupro tech dell apple asus inspiron eeepc

0 notes &

Dynamically adding attribute accessors in Ruby

A simple way for adding attribute accessors to a class dynamically:

class MyClass
  def add_attr(name, value)
    self.class.send(:attr_accessor, name)
    instance_variable_set("@#{name}", value)
  end
end
just call the add_attr method passing the name of the accessor (as a string) and a value that will be assigned to the variable.
You can also turn this in to a module so that you can easily add the functionality to all your classes.
I’m actually using this in a script I made to easily change data in long csv files.
I wanted to be able to convert CSV files into Ruby objects before changing the data, even if the fields change from file to change.
I know some people are gonna say “just use an existing gem or so”, but this is being fun.

Filed under tech ruby programming accessors

1 note &

Fixing garbage text on terminal on Linux and Mac

Sometimes you just happen to cat a binary file and it just messes up your terminal output and all can see and type is garbage.

Normally here you’d just give up and reopen your terminal but here’s another solution: Just type the command below:

 echo -e \\033c

All you’re doing is sending an ESC(033 is the octal version of the ASCII control key “ESC”) + a letter “c” to the console, which is a VT100 command to reset the terminal to its default settings. If you’re curious about other VT100 commands, take a look at this page. You can send them all using

echo -e 

followed by the the codes in ASCII. This works in any VT100 compatible terminal which means that you’re safe to use it on your Linux or Mac machine.

Edit: As some people said in the comments and at G+, you can just use the “reset” command, which is actually doing the above and some more.

To read more about the reset command, check the man pages here.

Filed under linux mac tech terminal vt100 memotoself