The way people want to see their timeline has changed very fast in the last several years.Now instead of seeing timestamp people are more interested is seeing something like : “in 3 minutes!” etc etc.
The best way to do this in java is to use http://ocpsoft.com/prettytime/ , which allow you to use it in various variety of ways e.g. : PrettyTime.NET, PrettyTime Grails Plug-in, PrettyTime with JSP .
Tag Archives: howto
How to ignore test in maven build using Netbeans
If you want to ignore the test cases execution to run while building a maven project using Netbeans then do the following :
1. Select the project in the project explorer.
2. Right Click it , then select Custom then Goals.
3. In new window check Skip Tests and add install as "Goal"
4. Press OK
5. Done !! now drink coffee.
How USBLAN 0fe6:8101 Kontron Debian Lenny
if you are running the old version of the GNU/Linux like Debian Lenny and your USB LAN is of Kontron (Industrial Computer Source / ICS Advent) DM9601 Fast Ethernet Adapter which is not working then here is a quick solution.
1. Execute the command lsusb, if it display something like this :
Bus 001 Device 005: ID 0fe6:8101 Kontron (Industrial Computer Source / ICS Advent) DM9601 Fast Ethernet Adapter then go to step 2 , it means you are actually using the correct usblan for which this solution will work.
2. Do this to add backport repository for Debian Lenny.
3. Update you kernel to 2.6.32 from backport repository.
4.Enjoy after reboot !!
How to send free SMS from command line #perl API
Following is the script that I am using from last several weeks for sending SMS's from command line.
Note : This has been taken from Arulalan.T Blog[0] from here : [1] .
[0] : http://tuxcoder.wordpress.com/
[1] : http://tuxcoder.wordpress.com/2011/06/14/send-free-sms-in-india-via-way2sms-login-from-terminal-using-perl-code/
?Download download.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | #!/usr/bin/perl ############################################################################################### # source link : http://digitalpbk.com/2009/12/perl-script-send-free-sms-any-mobile-number-india-using-way2sms # From CPAN : from CPAN link itself you can download the source for way2sms. # # Modified by : Arulalan.T (arulalant@gmail.com) # # Goal : send sms through way2sms.com with few easy options. So I modified this below code accordingly. # # Note : This should work only to the Indian regions cell phone numbers only # # Usage : # Save this file in the path /usr/bin/sms and make it as excutable by setting permission # 1. $ sms 9876543210 'hello' # 2. $ sms 9876543210,9876501234,9988776655 'hai dude' # 3. $ sms -f sms-nos-list-file 'message' # sms-nos-list-file is a text file, that contains the 10 digit phone nos with new line character. # i.e. each line must have only one phone no. # We no need to use +91 or 0 prefix no. So use only 10 digit phone no alone. #################################################################################################### use WWW::Mechanize; use Compress::Zlib; my $mech = WWW::Mechanize->new(); my $username = "way2sms login username"; #fill in username here my $keyword = "password"; #fill in password here my ($text,$mobile,$option); my @mobilenos; $option = $ARGV[0]; if ( $option == "-f") { # reading file and collecting the nos my $smslistfile = $ARGV[1]; $text = $ARGV[2]; open(FILE,$smslistfile) or die "Can not open file\n"; @mobilenos = ; close FILE; } else{ my $morenos = $ARGV[0]; if (length($morenos) > 10) { # splitting nos with comma seperated in the first arg @mobilenos = split(',',$morenos); } else { # for single phone no @mobilenos = $morenos; } # collecting message to send $text = $ARGV[1]; } $deb = 1; print "Total Character of message is ".length($text)."\n" if($deb); $text = $text."\n\n\n\n\n" if(length($text) < 135); $mech->get("http://wwwl.way2sms.com/content/index.html"); unless($mech->success()) { exit; } $dest = $mech->response->content; print "Fetching...\n" if($deb); if($mech->response->header("Content-Encoding") eq "gzip") { $dest = Compress::Zlib::memGunzip($dest); $mech->update_html($dest); } $dest =~ s/ <form action="..\/auth.cl" name="loginForm">update_html($dest); $mech->form_with_fields(("username","password")); $mech->field("username",$username); $mech->field("password",$keyword);</form>print "Loggin...\n" if($deb); $mech->submit_form(); $dest= $mech->response->content; if($mech->response->header("Content-Encoding") eq "gzip") { $dest = Compress::Zlib::memGunzip($dest); $mech->update_html($dest); } foreach $mobile (@mobilenos){ # for loop begins chomp($mobile); print "\nMessage sending to ".($mobile)."\n"; $mech->get("http://wwwl.way2sms.com//jsp/InstantSMS.jsp?val=0"); $dest= $mech->response->content; if($mech->response->header("Content-Encoding") eq "gzip") { $dest = Compress::Zlib::memGunzip($dest); $mech->update_html($dest); } print "Sending ... \n" if($deb); $mech->form_with_fields(("MobNo","textArea")); $mech->field("MobNo",$mobile); $mech->field("textArea",$text); $mech->submit_form(); if($mech->success()) { print "Done \n" if($deb); } else { print "Failed \n" if($deb); exit; } $dest = $mech->response->content; if($mech->response->header("Content-Encoding") eq "gzip") { $dest = Compress::Zlib::memGunzip($dest); #print $dest if($deb); } if($dest =~ m/successfully/sig) { print "Message sent successfully \n" if($deb); } # foreach loop ends } print "Message sent to all the numbers\n Bye.\n"; exit; #EOF |
Solution for org.apache.catalina.connector.RequestFacade cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest
If you are getting a error something like this (In JSP/Servlet environment) or more specifically in OpenMRS :
An Internal Error has occurred
Java.lang.ClassCastException
org.apache.catalina.connector.RequestFacade cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest
Consult the help document.
Contact your friendly neighborhood administrator if it cannot be resolved.
Hide stack trace
The solution is that :
You
?Download download.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | org.springframework.web.servlet.mvc.AbstractFormControIIer.getCommand (AbstractFormCont roller. java:435) org.springframework.web.servlet.mvc.AbstractFormControIIer.handIeRequestlnte rnal (Abst ractFo rmCont roller. java:265) org.springframework.web.servlet.mvc.AbstractControIIer.handIeRequest (AbstractController. java: 1 53) Q org.springframework.web.servlet.mvc.SimpIeControllerHandIe rAdapter.handIe (SimpIeControllerHandIerAdapter. java:4) org.springframework.web.servlet.Dispatcherservlet.doDispatch (DispatcherServlet. java:771 ) org.springframework.web.servlet.Dispatcherservlet.doSe rvice (DispatcherServlet. java:716) org.springframework.web.servlet.Frameworkservlet.processRequest (FrameworkServlet. java:644) org.springframework.web.servlet.Frameworkservlet.doPost (FrameworkServlet. java: 560) javax.servlet.http.Httpservlet.se rvice(HttpServlet. java:637) javax.servlet.http.Httpservlet.se rvice(HttpServlet. java:717) org. apache.cataIina.core.AppIicationFilterChain.inte rnaIDoFiIter(AppIicationFilterChain. java:290) org. apache.cataIina.core.AppIicationFilterChain.doFiIter(AppIicationFilterChain. java:206) org. apache.cataIina.core.AppIicationFilterChain.internaIDoFiIter(AppIicationFilterChain. java:235) org. apache.cataIina.core.AppIicationFilterChain.doFiIter(AppIicationFilterChain. java:206) org. apache.cataIina.core.AppIicationFilterChain.internaIDoFiIter(AppIicationFilterChain. java:235) org. apache.cataIina.core.AppIicationFilterChain.doFiIter(AppIicationFilterChain. java:206) org.springframework.web.fiIter.OncePe rRequestFiItendoFiIter(OncePe rRequestFiIter. java:76) org. apache.cataIina.core.AppIicationFilterChain.inte rnaIDoFiIter(AppIicationFilterChain. java:235) org. apache.cataIina.core.AppIicationFilterChain.doFiIter(AppIicationFilterChain. java:206) org.springframework.orm.hibe rnate3.support.OpenSessionlnViewFiItendoFiIterlnte rnal (OpenSessionlnViewFiIter. java: 19) org.springframework.web.fiIter.OncePerRequestFiItendoFiIter(OncePerRequestFiIter. java:76) org. apache.cataIina.core.AppIicationFilterChain.inte rnaIDoFiIter(AppIicationFilterChain. java:235) org. apache.cataIina.core.AppIicationFilterChain.doFiIter(AppIicationFilterChain. java:206) org. apache.cataIina.core.AppIicationFilterChain.internaIDoFiIter(AppIicationFilterChain. java:235) org. apache.cataIina.core.AppIicationFilterChain.doFiIter(AppIicationFilterChain. java:206) U |