Archive for the “Work” Category


Work has been so far so good for me. I am already reaching into my 6th month at the new job. It’s been good and it can be considered a dream job for me. No updates about what i am doing right now. I promise i will share when everything is good enough to see world.

Being the only employee, i get into those situations where i have no choice but to do things that i hate doing. I guess i am doing because i am doing it out of goodwill and there is no one doing it. But i am not afraid to question authority. When i feel the need arises, i will speak up for myself. I haven’t reached that point yet. 

I feel my career is growing the direction i wanted it to be. The opportunity came and i thought i took it despite the risks involved. No fair comparison can be done with my previous place; a big mnc with a good name. My skills is much needed at my current place than the other where you might often find yourself aimless in your career. 

I think i am doing a good job at the moment. The stay at home part makes me feel slack and i have to say that i am not slacking. Refering to Chua’s post “Funny Career Stuff“, software developer is on the top ten jobs for people who like to keep learning. Yes i am learning/working and not sleeping all the time… 

Comments Comments

Giving drupal a shot to attempt to set up a CMS site that can have a Flex UI. The Flex showcase site is running on drupal with an amazing Flex UI. Not trying to copy them but if they are using drupal, i thought why don’t i try it myself. WordPress can be a potential candidate for a CMS but it is still quite limited in becoming a powerful CMS like drupal. It is still a blogging engine. Let’s hang on when WordPress 2.5 is released in the next couple of days.

Ok, back to my topic. Drupal install was pretty smooth but i didnt like it when my url has stuff like ?q=admin/blah blah. Most of us will go to mod_rewrite and create the .htaccess file if our web server support. Here’s the .htaccess i got for my drupal after setting up mod_rewrite on my apache server.

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /~<Your username on your Mac>/drupal
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

Blogged with the Flock Browser

Comments Comments

Damn.. two commands that are so close and one has the ultimate effect of deleting all your cronjob. Guess which one… I learnt two things; one, better know what is the delete command and two, make sure you back up.

Blogged with Flock

Comments Comments

Time to talk about my experience on switching to Flex. It has been a month that i have been working with Flex. Being a Java developer, it has been really smooth. This article pretty much sums it all up.

Something about Flex that is worth mentioning is the amount of essential examples out there. Whenever i see examples on a website or blog, they are good examples.

Sometimes, i make the mistake of mixing syntax when i switch over to work on some Java coding.

i:int = 0 instead of int i = 0

Comments Comments

Found something interesting to take note when passing a Collection input param to a backend web service. Flex does not serialise all the elements in an ArrayCollection but it serialises only the first element.

Try using the ArrayCollection.toArray() first before sending it as an ArrayCollection.

I found out more info from this issue raised on the Flex Bug and Issue Mgmt System.

Comments Comments

Been two weeks since i made the job switch.  Now its work from home on my new macbook pro.

I wouldn’t say that i am enjoying 100%. Passions leads me on despite working more than the hours i used to work in accenture.

Comments Comments

Finally found the way to do the uploading via Flex to a Java backend. What i have used is the Spring Web MVC framework by making use of the example in the Spring Documentation on the multipart support #. The documentation does not include some of the necessary configuration such as the web.xml setup plus the controller and servlet configuration. It is pretty standard if you understand Spring.

The cool part about Spring’s multipart support is that we can simply extract the multipart file from the command object. Any multipart content will be identified by the multipartResolver which we will configure following the documentation.

So all the tricky part is left to be done on the Spring controller. And with a bit of java.io knowledge, our upload can be easily done in two hours. Yes two hours… i realised my mistake in using the file upload example in Spring Web Flow when i was testing with the Flex frontend upload example. At first, i thought it would be cool to make use of it but i guess i have to “Keep it sweet and simple”. So the spring dispatcher servlet approach. I am in love with Spring.

(Updated)References:

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
 public class ImageUploadController extends SimpleFormController {
 
	protected String fileUploadLocation;
 
	protected ModelAndView onSubmit(
	        HttpServletRequest request,
	        HttpServletResponse response,
	        Object command,
 
	        BindException errors) throws Exception {
 
	         // cast the bean - POJO
	        FileUploadBean bean = (FileUploadBean) command;
 
	        // let's see if there's content there
	        MultipartFile imageFile = bean.getFile();
 
	        //Check upload file
	        if (imageFile.getSize() == 0) {
	             //the user did not upload anything
			throw new Exception("No file uploaded");
	        }
	        //Get image filename
	        String fileName = imageFile.getOriginalFilename();
 
	        int index = fileName.toLowerCase().indexOf("jpg");
	        String fileName = "test.jpg";
 
	        //Create new File Object
	        String fileSeparator = System.getProperty("file.separator");
	        File newFile = new File(assetsLocation + fileSeparator + fileUploadLocation + fileSeparator + fileName);
 
	        //check for file
			if (newFile.exists()) {
			    try {
			        // Create file if it does not exist
			        boolean success = newFile.createNewFile();
			        if (success) {
			            	// File did not exist and was created
					System.out.println("File created");
			        } else {
			            // File already exists
					System.out.println("File not created");
			        }
			    } catch (IOException e) {
				// Handle your exception
			    }
			}
		    imageFile.transferTo(newFile);
	        return super.onSubmit(request, response, command, errors);
	    }
}

Web.Xml

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
<servlet>
	<servlet-name>profileImageUpload</servlet-name>
	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
	<servlet-name>profileImageUpload</servlet-name>
	<url-pattern>*.form</url-pattern>
</servlet-mapping>
 
imageUpload-servlet.xml
<pre lang="xml" line="1">
<?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="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<!-- Limit uploads to small (5KB) files for this sample -->
		<property name="maxUploadSize" value="5120" />
	</bean>
 
	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="/WEB-INF/test.properties"/>
	</bean>
	<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="/upload.form">fileUploadController</prop>
            </props>
        </property>
    </bean>
 
    <bean id="fileUploadController" class="com.someclass.ImageUploadController">
        <property name="fileUploadLocation"><value>${fileuploadimage.location}</value></property>
        <property name="assetsLocation"><value>${fileuploadimage.assets}</value></property>
        <property name="commandClass"><value>com.someclass.FileUploadBean</value></property>
        <property name="successView"><value>confirmation.jsp</value></property>
    </bean>
</beans>

Flex codes with some modification from the example at http://blog.flexexamples.com/2007/09/21/uploading-files-in-flex-using-the-filereference-class/ (By request of Tamitutor)

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
 
<?xml version="1.0" encoding="utf-8"?>
 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        creationComplete="init();">
 
    <mx:Script>
        <![CDATA[
            [Bindable]
            private var fileRef:FileReference;
 
            private const FILE_UPLOAD_URL:String = "http://localhost:8080/demo/upload.form";
 
            private function init():void {
                fileRef = new FileReference();
                fileRef.addEventListener(Event.SELECT, fileRef_select);
                fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler);
                fileRef.addEventListener(Event.COMPLETE, fileRef_complete);
            }
 
            private function browseAndUpload():void {
                fileRef.browse();
                message.text = "";
            }
 
            private function fileRef_select(evt:Event):void {
                try {
                    message.text = "size (bytes): " + numberFormatter.format(fileRef.size);
                    var request:URLRequest = new URLRequest(FILE_UPLOAD_URL);
                    request.method = URLRequestMethod.POST;
                    var uploaderReqVars:URLVariables = new URLVariables("var=samevalue");
                    request.data = uploaderReqVars;
                    fileRef.upload(request, "file");
                } catch (err:Error) {
                    message.text = "ERROR: zero-byte file";
                }
            }
 
            private function fileRef_progress(evt:ProgressEvent):void {
                progressBar.setProgress(Number(evt.bytesLoaded), Number(evt.bytesTotal));
            }
 
            private function progressHandler(event:ProgressEvent):void {
            var file:FileReference = FileReference(event.target);
            progressBar.setProgress( Number(event.bytesLoaded), Number(event.bytesTotal));
        }
 
            private function fileRef_complete(evt:Event):void {
                message.text += " (complete)";
            }
        ]]>
    </mx:Script>
<mx:NumberFormatter id="numberFormatter" />
	<mx:ApplicationControlBar>
 
 
	    <mx:Button label="Upload file"
	            click="browseAndUpload();" />
	    <mx:Label id="message" />
	    <mx:ProgressBar id="progressBar" mode="manual"
	            visible="true" />
	</mx:ApplicationControlBar>
 
 
</mx:Application>

Comments Comments

img_1437.JPGimg_1438.JPGimg_1441.JPGimg_1446.JPGimg_1447.JPGimg_1448.JPGimg_1449.JPGimg_1450.JPGimg_1451.JPGimg_1452.JPGimg_1453.JPGimg_1455.JPGimg_1459.JPGimg_1460.JPGimg_1464.JPGimg_1466.JPGimg_1468.JPGimg_1469.JPGimg_1470.JPGimg_1471.JPGimg_1472.JPGimg_1473.JPGimg_1474.JPG

Comments Comments

Preparing for the Flaming Lambo

03082007021.jpg

03082007022.jpg

03082007023.jpg

03082007024.jpg

04082007025.jpg

04082007026.jpg

04082007027.jpg

04082007029.jpg

04082007031.jpg

04082007032.jpg

04082007033.jpg

04082007037.jpg

04082007038.jpg

Comments Comments