Tuesday, July 31, 2012

Fighting make error: not protecting function: no buffer at least 8 bytes long

Attempting to build monetdb from source. The mercurial checkout date is not today but somewhere around start of July.

Getting the following error saying something like:
cc1: warnings being treated as errors - this is due to -Werror flag to gcc


inet.c: In function ‘INET_comp_CW’:
inet.c:323: error: not protecting function: no buffer at least 8 bytes long
inet.c: In function ‘INETbroadcast’:
inet.c:423: error: not protecting function: no buffer at least 8 bytes long
inet.c: In function ‘INETnetmask’:
inet.c:523: error: not protecting function: no buffer at least 8 bytes long
inet.c: In function ‘INETnetwork’:
inet.c:593: error: not protecting function: no buffer at least 8 bytes long
inet.c: In function ‘INETabbrev’:
inet.c:660: error: not protecting function: no buffer at least 8 bytes long
make[7]: *** [libatoms_la-inet.lo] Error 1
 - due to -fstack-protector-all -Wstack-protector flags to gcc. For more info on stack protector feature refer http://stackoverflow.com/questions/1629685/when-and-how-to-use-gccs-stack-protection-feature


The explanation at http://ubuntuforums.org/showthread.php?t=1612849 was sufficient for fixing.

Went to those line numbers.  They were the entry point of the reported functions.
Found unsigned char[4] local variables. Changed them to char[8].

Owned it.

Regards,
Tapomay.

Design patterns in Ruby


http://rubylearning.com/blog/2010/11/02/how-does-one-use-design-patterns-in-ruby/ :


I believe that the essence of design patterns is to make a system resilient to changes in requirements which in itself could be attributed with the parameters associated with the problem definition. The above article helped me with a lucid set of ruby examples demonstrating following patterns:
(The comments are for my personal notes. Plz ignore them)
1. Inheritance  : Car < Vehicle
2. Composition over inheritance : Car<Vehicle, Car->Engine
3. Delegation ; Car<Vehicle, Car->Engine
4. Template Method pattern : HTMLReport<Report, TextReport<Report
5. Singleton pattern : require 'singleton', attr_accessor :data
6. Adapter pattern : Renderer, TextObject, DifferentTextObject, TextObjectAdapter, class << diff_text_obj

Thanks and Regards,
Tapomay




Tuesday, May 8, 2012

Java books


Concurrency in java -doug lee
gang of 4
Effective Java -Joshua
Java performance tuning 

Friday, April 20, 2012

Bash script - execute all sql files in a directory


#!/bin/bash

for i in $(ls *.sql)
do

echo "Executing" $i;
mysql  -u root < $i

done

Wednesday, March 21, 2012

Try hd(0,0): NTFS5: No wubildr

http://ubuntuforums.org/showthread.php?t=1585120&page=2

Just wait for sometime on the screen saying "Try hd(0,0): NTFS5: No wubildr". Grub comes up later without doing anything.

I was getting windows boot loader earlier. Selected Ubuntu and I was stuck with above message.

Monday, March 19, 2012

Hibernate HQL view join: java.lang.NullPointerException at org.hibernate.util.ReflectHelper.getConstructor(ReflectHelper.java:234)

https://hibernate.onjira.com/browse/HHH-5621

What worked for me:
"This is a minor issue since an easy workaround is available: you just have to use an alias to qualified the properties....
Query query3 = session.createQuery("select new Something(sthg.id, sthg.event, sthg.dummyField) " +
"from Something sthg" );"