Archive for August 2007
damn simple!!!, define instance variables in ruby way
i was creating a new class where a hash object will be passed with value and key. my class suppose to iterate for each key and value. and those key will be treated as the instance variable.
so the pretty simple job i did is the following lines of code block -
def initialize(p_params = {})
super()
unless p_params.empty?
p_params.each do |key, value|
eval %(
self.#{key} = value
)
end
end
end
surprisingly my instance variable declaration became soooooo simple and easy.
update:
i didn’t know that self.send(“#{key}=”, value) does the same job, obviously send is prefer way to do this job.
It seems LinkedIn moved on tomcat !
after a long while i got myself on linked in site, as i got “Server spy” installed on my firefox browser, so i was getting the server name from the browser status menu.
anyway, today i found something different, actually “Server spy” said, linked in is using “Apache-Coyote/1.1″, as far i can remind, linked in was using sun application server previously.
i think it is really interesting, what led linked in to move over tomcat backed or tomcat based servlet container instead of sun application server?
anyway, if i find any info i would love to feed my blog
“শ্রম মিটার”, রিক্সা আর ঠেলা গাড়ির জন্য
আজ রিক্সায় করে আসার সময় ভাবলাম, কেমন হয় আমরা যদি রিক্সা ওয়ালাদের তার প্রাপ্পটা একটা যথাযথ নিয়মে দিতে পারি ?
ত ভাবলাম “শ্রম মিটার” এর ব্যপারে, “শ্রম মিটার” একটা সহজ সিস্টেম, যার কাজ হবে, রিক্সাওয়লার “কেলরি” আর “দুরত্ব” হিসাব করবে ।
এই ২টা হিসাবের মাধ্যমে বের হবে রিক্সার ভাড়া ।
একটা রাফ আইডিয়া, জানিনা কেমন হেব ।
Performance issue with tomcat 5.x.x series
one of our escenic colleagues (Simen L. Haagenrud) just noticed a bottleneck with tomcat 5.x.x series containers. so we had a details digging to let find the reason.
as he mentioned it was because of recurring invocation of “getAttribute”, and tomcat 5.x.x series is using synchornization block inside “getAttribute” method, where lock is kept on “attributes” variable.
so i had a quick look on the source code of the 3 recent series -
2. 5.5.24 (the last version from 5.5.x series)
http://svn.apache.org/repos/asf/tomcat/container/tags/tc5.5.x/TOMCAT_5_5_24/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
3. 6.0.x (trunk)
http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
so the code says 6.0.x series came with the fixes, the fix is the replacement of HashMap with ConcurrentHashMap.
in his case, recurring invocation of “getAttribute” was nearly reduced 50% server request handling capability.
best wishes,




