Wednesday, September 29, 2010

Career Path Finder...Highly informative



PLEASE FORWARD THIS EMAIL TO EVERY FRIEND, COLLEAGUE AND RELATIVE OF YOURS…

 

 

 

 

Posted via email from Sravan Sarraju

Friday, September 17, 2010

Predators of Productivity

Going Green Begins At Home

This is not a house dropped by mistake in the middle of a forest.. its the other way. My home @ Vijayawada. 


Posted via email from Sravan Sarraju

A Beautiful Coffee

A perfect blend of chennai style taste and innovative presentation. Don't miss this if you hit Vijayawada - Hyderabad highway. 

Location : 7 Restaurant, Near Suryapet, Hyderabad - Vijayawada Highway

Posted via email from Sravan Sarraju

Conflict of Interest

This is what happens if a Java Geek tries to move into Fast and Furious zone..

Posted via email from Sravan Sarraju

Saturday, September 04, 2010

Apache POI Cell Background Problem and Resolution

cell = currentRow.createCell(0); CellStyle cs = wb.createCellStyle(); cs.setFillForegroundColor(HSSFColor.ROSE.index); cs.setFillPattern(CellStyle.SOLID_FOREGROUND);

Posted via email from My Hello World!

Monday, August 30, 2010

Test Mark Down

!java

public static void main(String[] args){ System.out.println(“Hello World”); }

Posted via email from My Hello World!

Monday, August 23, 2010

Handling DOJO FileUpload, JavaServlet and Cross Browser Issues


My use cases is as follows

1.    Design a form with various text input fields and also have a file upload as one of the parameters
2.    Submit an AJAX Request to the Server and wait to receive an XML as response from server
3.    Pick the request and handle it in Java Servlet
4.    Send Response to the client
5.    Handle the response and display the result in a text area
6.    Handle IE

Lets start of with Step 1

1. Design a form similar to this

        <form dojoType="dijit.form.Form" id="myForm" method="post" enctype="multipart/form-data">
            <div>
                <table width="100%">
                    <tr>
                        <td colspan="2">
                            <label class="firstLabel" for="name">Parameter 1</label>
                            <br>
                            <input type="text" id="url" name="url" style="width: 800px; padding-left: 0px"  class="medium"
                                   dojoType="dijit.form.ValidationTextBox"
                                   required="true"
                                   ucfirst="true" invalidMessage=""/>
                        </td>
                    </tr>
                    <tr>
                        <td id="uploadKeyStore" style="display:none;" >
                            <div id="uploadContainer" style="margin-top: 15px;">
                                <input type="hidden" name="MAX_FILE_SIZE" value="500000">
                                <!-- wrapping these in spans to be able to modify
                                  parts of this form depending on what the
                                  dojo.io.iframe.submit() does -->
                                 <input type="file" class="medium" id="fileInput" name="uploadTestFile" style="width: 400px;">
                            </div>
                            <br/>
                        </td>
                    </tr>
                </table>
            </div>

           <div class="formAnswer">
                <textarea style="width: 400px;height:500px" id="request" name="request" >
                </textarea>
                <textarea   style="width: 400px;  height:500px" id="response" name="response"></textarea>
            </div>
             <div dojoType="dijit.form.Button" id="start">
                    Submit
             </div>
        </form>
       
2.    In your javascript make sure u add the following       

    dojo.addOnLoad(function(){
        dojo.query("#start").onclick(function(){
            dojo.byId("response").value = "Waiting for the response.."
            dojo.io.iframe.send({
                url: this.url,
                form : 'myForm',
                method: "post",
                handleAs: "xml",
                "accept-charset" : "UTF-8",
                enctype:"multipart/form-data",
                handle: handleInitialResponse)
            });           
        });
    }
    function handleInitialResponse(response){
        //Code to be added
    }

3.    Code the Java Servlet. I have used apache FileUpload library to do this as it offer facility to handle multiple types of request parameters

    Code example can be found in the apache site.
   
    Important points to note when coding the servlet.
   
        Your response type is very crucial.
        If you choose to send response as plain text or html,
            MAKE SURE YOU WRAP YOUR RESPONSE WITH A TEXT AREA BEFORE SENDING THE RESPONSE.
            <textarea>[Your Response]</textarea>
            response.setContentType("text/html");
            This has serious limitation with IE7. Hence I would suggest not to go with this.
        If you choose to send response as plain xml,
            response.setContentType("text/xml");
            NO NEED TO WRAP YOUR RESPONSE WITHIN A TEXT AREA
           
4.    Handling the Servlet Response at the client keeping IE7 in mind

        Here comes the most trickest part.       
        If your response type is HTML, you are up for a party with IE7. I couldn't crack it and hence i worked around with xml.

        Make sure your handleAs element is "xml"
       
        Define the response handler as below
       
        function handleInitialResponse(response){
            try {
                // Gecko-based browsers, Safari, Opera.
                dojo.byId("response").value  = new XMLSerializer().serializeToString(response);
            }
            catch (e) {
                try {
                    dojo.byId("response").value  = response.xml ;
                }
                catch (e)
                {//Strange Browser ??
                    alert('Xmlserializer not supported');
                }
            }
        }

 

The code above is not compler friendly. Pls make sure you hit right basics to make the things work.    

Posted via email from My Hello World!

Saturday, August 14, 2010

Bottleneck

The pic below is not a car parking. The Grey block is the marker for the small lane which everyone in this pic trying to sneak into.. by the way i'm among the minority waiting in the actual route waiting sincerely for my turn.

Posted via email from Sravan's posterous

Sunday, August 01, 2010

Boundary Between Countries......

Hope the world celebrates Friendship.. for a long long time! Happy Friendship Day!



 

وبلجيكاHOLAND & BELGIUM B في نفس الوقت

هذا الرجل في اسبانيا ويحتاج فقط لإجتياز هذا الشق
في الصخره ليكون فيESPAIN & PORTUGAL البرتغال

احدىENGLAND & SCOTLAND المزارع نصفها في اسكتلند والنصف الاخر في انجلترا


دولLAOUS ,MYANMAR & THAILAND مايعرف بالمثلث الذهبي

المبنى بالاعلام الحمراء ( المغرب ) و المبنى بالاعلام
الاخضر والابيض ( الجزائرALGIEIR & MOROCCO )

امراه في المانيا تقف بجانب العلامه الفاصله بينها وبينGERMANY & CZECH الحدود التشيكيه والنمساويه


جسرSPAIN & FRANCE صغير يفصل بين اسبانيا وفرنسا


خط لايتجاوز عرضه 10 سم يفصل بين الاخوه الاعداء
الهند وباكستانPAKISTAN & INDIA


جدار اسمنتي يفصل بين أغنى دوله في العالم وواحده من افقر دولMEXICO & USA العالم


طريق ابيض من الجليد يفصل بين الجارين كنداCANADA & USA وامريكا


[

يقالPERAGUAY ,ARGENTINE & BRAZIL بان هذه اجمل صوره لعلامه حدوديه بين 3 دول

رجلFOUR US STATE يبتسم للكاميرا . لتواجده في 4 ولايات امريكيه في نفس الوقت


علامه حدوديه مؤلمه لكل مسلم . عماره سكنيه تفصل بين منطقة المسلمين
والكروات في البوسنه والهرسك . ويلاحظ ان جزء البنايه في المنطقه الكرواتيه
تم ترميمه بينما الجزء في منطقة المسلمين باقي على وضعه بعد الحربAFTER WAR BOSNIA & CROATIA

 


PAKISTAN & CHINA

الخط الفاصل بين ألد الاعداء كوبا وامريكا من خلال قاعد تها في غوانتناموUS & CUBA


ITALIA & FRANCE

MALAYSIA & INDONISIA

SOUTH & NORTH KOREA

 

NEBRASKA & EVA

 


NEPAL & INDIA

UZBAKISTAN & TAJECKTAN

 

SAUDIA & YEMEN

]

NORWAY & SWEDEN

بداية الاسفلت النظيف يعني الدخول للاراضي اليونانيه
للقادم من تركياTURKEY & GREECE

Posted via email from Sravan's posterous

Saturday, July 31, 2010

Monday, July 05, 2010

Telugu Comedy-TV9.1 Comedy Crime Watch /Kishore : a 100 smiles

Check out this video on YouTube, I bet u can't stop laughing 4 a second...!

Posted via email from Sravan's posterous

Wednesday, June 23, 2010

The Choice

There once lived a great mathematician in a village outside Ujjain. He was often called by the local king to advice on matters related to the

economy. His reputation had spread as far as Taxila in the North and Kanchi in the South. So it hurt him very much when the village headman told him, "You may be a great mathematician who advises the king on economic matters but your son does not know the value of gold or silver."

The mathematician called his son and asked, "What is more valuable - gold or silver?" "Gold," said the son. "That is correct. Why is it then that the village headman makes fun of you, claims you do not know the value of gold or silver? He teases me every day. He mocks me before other village elders as a father who neglects his son. This hurts me. I feel everyone in the village is laughing behind my back because you do not know what is more valuable, gold or silver. Explain this to me, son."

So the son of the mathematician told his father the reason why the village headman carried this impression. "Every day on my way to school, the village headman calls me to his house. There, in front of all village elders, he holds out a silver coin in one hand and a gold coin in other. He asks me to pick up the more valuable coin. I pick the silver coin. He laughs, the elders jeer, everyone makes fun of me. And then I go to school. This happens every day. That is why they tell you I do not know the value of gold or silver."

The father was confused. His son knew the value of gold and silver, and yet when asked to choose between a gold coin and silver coin always picked the silver coin. "Why don't you pick up the gold coin?" he asked. In response, the son took the father to his room and showed him a box. In the box were at least a hundred silver coins. Turning to his father, the mathematician's son said, "The day I pick up the gold coin the game will stop. They will stop having fun and I will stop making money."

Sometimes in life, we have to play the fool because our seniors and our peers, and sometimes even our juniors like it. That does not mean we lose in the game of life. It just means allowing others to win in one arena of the game, while we win in the other arena of the game. We have to choose which arena matters to us and which arenas do not.

Posted via email from Sravan's posterous

Thursday, May 20, 2010

Untitled

Temperature is pretty much binary here.. Got chance feel African and Antartican temperatures in the same week..!

Posted via email from Sravan's posterous