This link will be helpful in setting up android plugin for netbeans
http://gerry.ws/2009/01/1074/how-to-setup-netbeans-for-android-development.html
Saturday, August 7, 2010
Tuesday, July 7, 2009
Add default value to column in hibernate
private boolean invalid=false;
@Column(name="INVALID", columnDefinition = "BIT(1) default 0")
public boolean isInvalid() {
return invalid;
}
public void setInvalid(boolean invalid) {
this.invalid = invalid;
}
Should work for mysql only.
@Column(name="INVALID", columnDefinition = "BIT(1) default 0")
public boolean isInvalid() {
return invalid;
}
public void setInvalid(boolean invalid) {
this.invalid = invalid;
}
Should work for mysql only.
Monday, July 6, 2009
Junit and Spring
Here is sample code for Junit testing with spring/hibernate.
@ContextConfiguration(locations = { "/applicationContext-hibernate-test.xml" })
public class TestDaoImplTest extends AbstractJUnit4SpringContextTests {
@Autowired
TestDao testDao;
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void test() {
testDao.callyourmethod();
}
}
@ContextConfiguration(locations = { "/applicationContext-hibernate-test.xml" })
public class TestDaoImplTest extends AbstractJUnit4SpringContextTests {
@Autowired
TestDao testDao;
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void test() {
testDao.callyourmethod();
}
}
Wednesday, July 1, 2009
Convert Calendar to Date object java
Suppose the given date string is June, 30 2009
First we will make a Calendar object and convert it to Date Object
Calendar calendar = new GregorianCalendar(2009, 6 - 1, 30);
Date dateObject = new Date(calendar.getTimeInMillis());
So here it is, java.util.Calendar Object converted to java.util.Date object
First we will make a Calendar object and convert it to Date Object
Calendar calendar = new GregorianCalendar(2009, 6 - 1, 30);
Date dateObject = new Date(calendar.getTimeInMillis());
So here it is, java.util.Calendar Object converted to java.util.Date object
Friday, June 12, 2009
Spring MVC 2.5 uploading a file using CommonsMultipartResolver
3 Steps to upload a file in Spring MVC 2.5 using CommonsMultipartResolver
Step 1)
in your servlet.xml or applicationContext.xml paste the following code
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties overall request size(not file size) -->
<property name="maxUploadSize" value="100000"/>
</bean>
Step 2)
Code for Controller
@RequestMapping("/file-upload")
public ModelAndView uploadFile(
@RequestParam("file") CommonsMultipartFile file) {
//do whatever you want with the file object
return new ModelAndView();
}
step 3)
Html Code
<form action="file-upload.html" enctype="multipart/form-data" method="post">
<input name="file" type="file">
<input value="Upload" type="submit">
</form>
That's it. Questions or Comments?
Next post, redirect the user back to the entry form if the upload file size exceeded the maxUploadsize parameter. Also the form parameters entered along with file upload should be shown back. So the user does not have to re enter the previously entered values. Coming up in next post...
Step 1)
in your servlet.xml or applicationContext.xml paste the following code
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties overall request size(not file size) -->
<property name="maxUploadSize" value="100000"/>
</bean>
Step 2)
Code for Controller
@RequestMapping("/file-upload")
public ModelAndView uploadFile(
@RequestParam("file") CommonsMultipartFile file) {
//do whatever you want with the file object
return new ModelAndView();
}
step 3)
Html Code
<form action="file-upload.html" enctype="multipart/form-data" method="post">
<input name="file" type="file">
<input value="Upload" type="submit">
</form>
That's it. Questions or Comments?
Next post, redirect the user back to the entry form if the upload file size exceeded the maxUploadsize parameter. Also the form parameters entered along with file upload should be shown back. So the user does not have to re enter the previously entered values. Coming up in next post...
Thursday, September 13, 2007
Hurrican Humberto Pics
I went to bed Wednesday expecting just a little over a heavy downpour, only to be awakened at around 3 am by Category 1 Hurricane Mr. Humberto. The first hurricane experience in my life was awesome.
With around 80mph wind, blowing me, and heavens opening up, it was just too good an experience to miss. I just tried experimenting by putting a chair on the 2nd floor of the apartment and it was blown down to floor 1, and after some chilly windy moments there was power outrage. I tried to walk on the lawn outside the apartments at 4am only to find that the wind was too gusty to bear. Simply an awesome experience!!!!!!!!!!!
Friday, May 18, 2007
Ek "TA" ki kahani
TA- "Teaching Assistant" the famous word among the student community in usa.
As i was walking towards home, from Maes(CS Department @ Lamar University) group of students were passing by, looking angrily at me and mumbling something. If not the lips i could read their minds.... "sala mar kyu nahi gaya 0 dene se pehle".
Students would think about a TA as God, when it comes to that particular subject. But the truth is he is a human and learning at every stage of his life.
There is often pressure from the instructor to grade in a particular way, wheather you like it or not, wheather the students love it or not. And that way generally is called the tough grading. My instructor would tell me "You cannot make every one happy...grade tough".
Catching "copy cases" was a quandary. You know it might ruin the career of a student, but you know if you dont do it, it might ruin yours. Many time i felt i could not do it any more playing with careers of students, but i had no option. I had commited for the job and i could not leave in middle, and i wanted to be honest to myself and my work.
It was in middle of Fall 06, i decided that after the end of the semester i will never ever take up this job again.
The other side of the story is that, the students should themselves understand that they are here to study, and they better study, which will make life easier for every one around, instead of indulging themselves in plagiarism issues.
Arpan.
As i was walking towards home, from Maes(CS Department @ Lamar University) group of students were passing by, looking angrily at me and mumbling something. If not the lips i could read their minds.... "sala mar kyu nahi gaya 0 dene se pehle".
Students would think about a TA as God, when it comes to that particular subject. But the truth is he is a human and learning at every stage of his life.
There is often pressure from the instructor to grade in a particular way, wheather you like it or not, wheather the students love it or not. And that way generally is called the tough grading. My instructor would tell me "You cannot make every one happy...grade tough".
Catching "copy cases" was a quandary. You know it might ruin the career of a student, but you know if you dont do it, it might ruin yours. Many time i felt i could not do it any more playing with careers of students, but i had no option. I had commited for the job and i could not leave in middle, and i wanted to be honest to myself and my work.
It was in middle of Fall 06, i decided that after the end of the semester i will never ever take up this job again.
The other side of the story is that, the students should themselves understand that they are here to study, and they better study, which will make life easier for every one around, instead of indulging themselves in plagiarism issues.
Arpan.
Subscribe to:
Posts (Atom)