WashingtonPost.com website is written in Java. Back a couple of years they were an atrocious website, mainly because they had hired a bunch of java idiots who had over architected the whole thing, throwing all the latest java technology like JSF, Spring, Hibernate, etc...into the mix, making a very fine mess of everything. Every couple of days they would advertise for a new software developer, as some poor soul, ran away screaming. They seem to have gotten their crap together now. But, every so often we get stuff like below.
The title of below webpage is "Null trailer Null"...where can i watch this movie :)
Wednesday, November 12, 2014
wtf
i found this at this url: http://www.codingforums.com/showthread.php?t=267682
what could be the problem :)
what could be the problem :)
With thanks to all codingforum members and volunteers... I'm facing weird issues for a few days while im working with if condition. Whenever i use something like <? if ($x='1') { ... this always returns $x to be 1, even though my database records say its not.
Hulu software developer job application
Hulu software developer job application
i was looking at Java jobs in LA on indeed.com and ran across Hulu's software developer position. So, I did ok on qualifications, CS degree, TDD, web services, etc. Also, ok on experience, Java, no objective-C, Python, no streaming video or Flash, but you know I could dream. So far. But then, I ran into this:
Since we're clearly into lists, here's a Top 5 for how you know you need to work at Hulu in no particular order (* they probably meant - how you need to think ! (nice, if a little Orwellian)):
You fall asleep thinking of ways to search through 100 billion sheep (sadly my last thoughts before going to sleep all involve ludicrous fantasies, involving women, mad money, absolute power, world domination...)
You recently had a nightmare that involved an unbalanced red-black binary tree (i kinda know what an unbalanced binary tree is, but a red-black one...)
You can compress better than H.264 (it's a video compression format, good for making torrents of Hollywood movies (jk, i'm into arthouse)...)
Your most recent open-source app was the 'Most Active' entry on SourceForge (SF and now there's github - sadly my projects always run into my arch enemies - beer, women, junk tv (storage wars !))
You rule at ping-pong, eating contests or Project Euler (exercise is a must, i love eating (PHO) and Euler was a mathematician)
If you're the kind of developer who obsesses over indentation (spaces or tabs), monitoring services, and jumps at the opportunity to take on new math challenges then Hulu may be the place for you. (i do like well formatted code, Euler was a mathematician....)
Dear Hulu,
Why do you have to be such dicks. Did you really have to give us this list? To utterly crush our hopes, just when we were getting ready to fire off our resume. To deny us the small satisfaction of saying, "hey i tried, i applied". A justification to spend the rest of the afternoon watching tv...contemplating your dwindling bank balance...the resultant panic of impending homelessness...causing you to call your Mom, after forgetting her birthday and ignoring countless calls...Did you REALLY have to drive us to this ???
I give up. Job postings like this make me realize, that I am just a mediocore developer. I do like writing code and am pretty good at it, but it's not my life. It's not the end all. Hire a bunch of us mediocore guys, pay your CEO a little less.
Ranjit
http://hire.jobvite.com/CompanyJobs/Careers.aspx?c=qxc9Vfwx&jvprefix=http%3a%2f%2fwww.hulu.com&jvresize=%2fjobs%2fresize_jobvite_frame&page=Job%20Description&j=oAaCWfw2
i was looking at Java jobs in LA on indeed.com and ran across Hulu's software developer position. So, I did ok on qualifications, CS degree, TDD, web services, etc. Also, ok on experience, Java, no objective-C, Python, no streaming video or Flash, but you know I could dream. So far. But then, I ran into this:
Since we're clearly into lists, here's a Top 5 for how you know you need to work at Hulu in no particular order (* they probably meant - how you need to think ! (nice, if a little Orwellian)):
You fall asleep thinking of ways to search through 100 billion sheep (sadly my last thoughts before going to sleep all involve ludicrous fantasies, involving women, mad money, absolute power, world domination...)
You recently had a nightmare that involved an unbalanced red-black binary tree (i kinda know what an unbalanced binary tree is, but a red-black one...)
You can compress better than H.264 (it's a video compression format, good for making torrents of Hollywood movies (jk, i'm into arthouse)...)
Your most recent open-source app was the 'Most Active' entry on SourceForge (SF and now there's github - sadly my projects always run into my arch enemies - beer, women, junk tv (storage wars !))
You rule at ping-pong, eating contests or Project Euler (exercise is a must, i love eating (PHO) and Euler was a mathematician)
If you're the kind of developer who obsesses over indentation (spaces or tabs), monitoring services, and jumps at the opportunity to take on new math challenges then Hulu may be the place for you. (i do like well formatted code, Euler was a mathematician....)
Dear Hulu,
Why do you have to be such dicks. Did you really have to give us this list? To utterly crush our hopes, just when we were getting ready to fire off our resume. To deny us the small satisfaction of saying, "hey i tried, i applied". A justification to spend the rest of the afternoon watching tv...contemplating your dwindling bank balance...the resultant panic of impending homelessness...causing you to call your Mom, after forgetting her birthday and ignoring countless calls...Did you REALLY have to drive us to this ???
I give up. Job postings like this make me realize, that I am just a mediocore developer. I do like writing code and am pretty good at it, but it's not my life. It's not the end all. Hire a bunch of us mediocore guys, pay your CEO a little less.
Ranjit
http://hire.jobvite.com/CompanyJobs/Careers.aspx?c=qxc9Vfwx&jvprefix=http%3a%2f%2fwww.hulu.com&jvresize=%2fjobs%2fresize_jobvite_frame&page=Job%20Description&j=oAaCWfw2
Java Code - This returns the first key in a HashMap given a value
Java Code - This returns the first key in a HashMap given a supplied value
import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; /** * general purpose utility methods * @author ranjit sandhu */ public class Utils { // gets first hashmap key from supplied value public static String getKeyByValue(LinkedHashMap lhm, String value) { String tt = ""; Iterator fat = lhm.entrySet().iterator(); while (fat.hasNext()) { Map.Entry pairs = (Map.Entry)fat.next(); String key = pairs.getKey().toString(); String val = pairs.getValue().toString(); if (val.equals(value)) { tt = key; } } return tt; } // end getKeyByValue } // end Utils
Monday, August 4, 2014
Oracle Jobs - DBMS JOBS - broken fix re-run
Oracle Jobs - DBMS JOBS - broken fix re-run
i was working on a pl/sql application and apparently it had some jobs which were being run on some schedule. I should have just used SQL Developer's Scheduler folder tab to see what jobs were running...but i didn't think of it and ended up googling for some SQL which was:
-- sys level select * from dba_jobs -- sys level select * from dba_scheduler_jobs -- schema user level select * from user_scheduler_jobs -- schema user level select * from user_scheduler_job_run_details -- schema user level WORKED select * from user_jobs order by broken, job asc
if a job fails to successfully execute it will go into a broken state after 16 attempts, so all my jobs were broken and the scheduler was NO longer trying to re-run them. i wanted to reset that flag and execute them straight away. i wrote a loop in a stored procedure to do this.
FOR i IN (SELECT * FROM user_jobs WHERE broken = 'Y') loop num := i.job; -- i didn't want to restart some of my broken jobs if (num <> 232 and num <> 233 and num <> 241 and num <> 270) then -- true does the opposite dbms_job.broken(i.job, false); -- run the job one time, if it's broken throws an error dbms_job.run(i.job); end if; END LOOP;
Friday, July 18, 2014
javascript object hashmap associative array
javascript object hashmap associative array
i use javascript quite a bit and i program for work in Java, so I wanted to mash them both together and as a result was reading about Rhino, which allows javascript to call Java classes and methods. And I was looking through some sample code and the following blew my mind:
var f = new File(arguments[0]); var o = {} var line; while ((line = f.readLine()) != null) { // Use JavaScript objects' inherent nature as an associative array to provide uniqueness o[line] = true; } for (i in o) { print(i); }
i didn't understand the code! after some investigation, i found that the base javascript object acts like a HashMap, a TreeSet and an associative array. check out the code below:
<script> var tt = {hair:"black,cat,dog",eyes:"brown"}; console.log(tt); tt["eyes"] = true; tt[""] = true; tt[null] = true; console.log(tt); console.log(tt[0]); // should print hair console.log(tt[0][1]); // should print cat </script>
it's output is:
Object { hair="black,cat,dog", eyes="brown"} Object { hair="black,cat,dog", eyes=true, =true, null=true} undefined TypeError: tt[0] is undefined
the only drawback is that the last two don't work, you can't access it like an array, even though internally it's an array of arrays. anyways that explains how they were able to get unique lines, they were checking the values against the javascript objects keys (which have to be unique).
tomcat oracle spring BLOB OracleLobCreator exception error
tomcat oracle spring BLOB OracleLobCreator exception error
I recently switched from an older version of Tomcat 5.5 to 7.0. This created an error because the newer version of tomcat creates database connection pools differently. The error pops up in my application when I try to upload a file, because it creates a BLOB type, which this new pool object doesn't support.
ERROR message: document update Blob error exception:org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [org.apache.tomcat.dbcp.dbcp.PoolableConnection]: specify a corresponding NativeJdbcExtractor; nested exception is java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolableConnection cannot be cast to oracle.jdbc.OracleConnection
ERROR message: document update Blob error exception:org.springframework.dao.InvalidDataAccessApiUsageException: OracleLobCreator needs to work on [oracle.jdbc.OracleConnection], not on [org.apache.tomcat.dbcp.dbcp.PoolableConnection]: specify a corresponding NativeJdbcExtractor; nested exception is java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolableConnection cannot be cast to oracle.jdbc.OracleConnection
my original Spring beans XML file:
<bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor" lazy-init="true"/> <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler"> <property name="nativeJdbcExtractor" ref="nativeJdbcExtractor"/> </bean>
As you can see, I was using WebSphereNativeJdbcExtractor as the LOB handler, but tomcat passes it's own implementation of the Oracle database connection to the Spring class. I changed it to:
<bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor" lazy-init="true"/> <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler"> <property name="nativeJdbcExtractor" ref="commonsDbcpNativeJdbcExtractor"/> </bean> <bean id="commonsDbcpNativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor"/></b>
This works!
Monday, July 14, 2014
sqlplus connect to database without using the SID
sqlplus connect to database without using the SID
sqlplus connect to database using description string
sqlplus change expired password
here's the command:
sqlplus user_name/password@"description_string"
Example description string (keep all brackets): (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=name_or_IP)(PORT=1521))(CONNECT_DATA=(SID=sid_name)))
In the case of expired password, it will prompt you to enter a new password.
sqlplus connect to database using description string
sqlplus change expired password
here's the command:
sqlplus user_name/password@"description_string"
Example description string (keep all brackets): (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=name_or_IP)(PORT=1521))(CONNECT_DATA=(SID=sid_name)))
In the case of expired password, it will prompt you to enter a new password.
Thursday, July 3, 2014
ship slams into italian port of genoa killing seven
The bridge of the ship that crashed into Genoa harbour, the 'Jolly Nero', is clearly seen behind the wreckage of the control tower in this picture taken shortly after the collision, late on Tuesday, May 7, 2013.
The ship that crashed was the Jolly Nero. It was manoeuvring out of the port at around 23:00 local time with the help of tugboats in calm weather.
The ship that crashed was the Jolly Nero. It was manoeuvring out of the port at around 23:00 local time with the help of tugboats in calm weather.
Rescuers stand on the rubble of a former harbour control tower, all that remains standing of which is a tilted metal staircase.
The control tower in the Italian port of Genoa was reduced to rubble and a single, leaning staircase after a cargo ship slammed into it late on Tuesday night, killing at least seven people.
The control tower in the Italian port of Genoa was reduced to rubble and a single, leaning staircase after a cargo ship slammed into it late on Tuesday night, killing at least seven people.
The damaged stern of container ship Jolly Nero in the port of Genoa on May 8, 2013, the morning after the crash.
Some damage is visible on the stern of the container ship. The ship's owner, who arrived at the port soon after the incident, told journalists he was "utterly shocked".
Some damage is visible on the stern of the container ship. The ship's owner, who arrived at the port soon after the incident, told journalists he was "utterly shocked".
The container ship Jolly Nero after the fatal crash. The vessel is almost 240 metres long, painted red, with a gross tonnage of nearly 40.600.
The Jolly Nero is almost 240 metres (787 ft) long. Its captain is being investigated by prosecutors with a view to possible manslaughter charges.
The Jolly Nero is almost 240 metres (787 ft) long. Its captain is being investigated by prosecutors with a view to possible manslaughter charges.
The control tower, looking like one at an airport, pictured in 2011, intact.
The control tower was was more than 50m (164ft) tall. About 13 people were inside at the time of the crash, which happened during a shift change.
The control tower was was more than 50m (164ft) tall. About 13 people were inside at the time of the crash, which happened during a shift change.
Collapsed control tower of Genoa's port (8 May 2013)
The tower crashed backwards into the water, pulling down buildings around it.
The tower crashed backwards into the water, pulling down buildings around it.
Rescue workers in the rubble of the collapsed control tower in the port of Genoa (8 May 2013)
Rescue workers have been sifting through rubble on the dock and in the water. At least two people are still missing and four others were injured, two of them critically.
Rescue workers have been sifting through rubble on the dock and in the water. At least two people are still missing and four others were injured, two of them critically.
An operation takes place to remove the wreckage of the control tower from the dock at Genoa's port (8 May 2013)
The BBC's Alan Johnston in Rome says the crash has revived memories of the accident involving the Costa Concordia cruise ship off the Italian island of Giglio in January 2012, which left 32 people dead.
The BBC's Alan Johnston in Rome says the crash has revived memories of the accident involving the Costa Concordia cruise ship off the Italian island of Giglio in January 2012, which left 32 people dead.
cygwin wget setup proxy authentication
I am behind a corporate proxy server and needed to use wget to get some pages. This is from within cygwin. You can use command line options for wget to set the server and username/password. Or, you can set it up in the wgetrc configuration file. This file is located in the cygwin_install_dir/etc directory. I tried modifying the wgetrc under etc/defaults/etc but that did not work. These are the entries you need:
use_proxy = on
http_proxy=http://blah.company.com:80/
proxy_user=username
proxy_password=password
use_proxy = on
http_proxy=http://blah.company.com:80/
proxy_user=username
proxy_password=password
Sunday, May 11, 2014
my old assed ubuntu install
i've been using ubuntu for ever...until the evil gnome 3 install, which was so god awful that i stopped updating my distro...i'm still on ubuntu 9 or 10...chrome is at 18 ,etc...almost everything is outdated, but it still works good enough for me...i have had another newer laptop for almost 2 years now, which i never finished fixing, it was running windows and then i installed a bunch of OS's on it and then gave up on it...the wireless card required a custom fix and the trackpad cannot be disabled easily. anyway, i wanted to post my ubuntu desktop screenshots before it all dies. enjoy !!!
An even older picture of Ubuntu 9 desktop on my toshiba laptop...check out how i have the taskbar completely transparent :)
An even older picture of Ubuntu 9 desktop on my toshiba laptop...check out how i have the taskbar completely transparent :)
Friday, March 14, 2014
Fanny Neguesha at a football match
Java regular expressions sample code
This is sample code of how to do regular expression's pattern matching in Java. I used it to get the thumbnails, image files and captions from this webpage - Click Here. It uses Apache Commons IO to read the file and the rest you can figure out. It was pretty easy when I finally figured out how to use the Matcher class.
The output of this program is the html source for this blog post Pictures of North American Inuit peoples life style
The output of this program is the html source for this blog post Pictures of North American Inuit peoples life style
import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.io.FileUtils; /** * @author ranjit sandhu * @date Fri, Mar 14, 2014 4:02:04 PM */ public class htmlParser { public static void main(String[] args) throws IOException { File ff = new File("c:\\ranjit\\code\\java_read_file.txt"); String input = FileUtils.readFileToString(ff); Pattern pat = Pattern.compile("http://s.imwx.com/dru/2014/02/.+_980x551.jpg"); Matcher mat = pat.matcher(input); printMat(mat); ArrayList bigImages = retMatches(mat); pat = Pattern.compile("http://s.imwx.com/dru/2014/02/.+_85x64.jpg"); mat = pat.matcher(input); printMat(mat); ArrayList smallImages = retMatches(mat); pat = Pattern.compile("caption\":\".+\\("); mat = pat.matcher(input); printMat(mat); ArrayList captions = retMatches(mat); StringBuilder sb = new StringBuilder(); for (int i=0; i < smallImages.size(); i++) { sb.append("<img src=\"").append(smallImages.get(i)).append("\" class=\"smallImage\" onClick=\"jump(") .append(i).append(");\"> "); } sb.append("<br><br>"); String caption = new String(); for (int i=0; i < captions.size(); i++) { caption = (String)captions.get(i); caption = caption.substring(10,caption.length()-2); sb.append("<div class=\"caption\" id=\"").append(i).append("\">").append(caption).append("</div>"); sb.append("<img src=\"").append(bigImages.get(i)).append("\" class=\"bigImage\""). append("> <a href='#top'>Back to Top</a><br><br>"); } System.out.println(sb); } // end main public static void printMat(Matcher mat) { int index = 0; int matchNumber = 0; while (mat.find(index)) { matchNumber++; System.out.println("match number: " + matchNumber); System.out.println("match start/end: " + mat.start() + "," + mat.end()); System.out.println("match value: " + mat.group()); index = mat.end(); } } // end printMat public static ArrayList retMatches(Matcher mat) { ArrayList ar = new ArrayList(); int index = 0; while (mat.find(index)) { ar.add(mat.group()); index = mat.end(); } return ar; } // end retMatches } // end class
Pictures of North American Inuit peoples life style
Pictures of North American Inuit peoples life style
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
Back to Top
BUILD SUCCESSFUL (total time: 0 seconds)
Subscribe to:
Posts (Atom)