Monday, September 9, 2013

main.scala.html fails to load with end tags

I encountered very interesting issues today when I was adding twitter bootstrap to our project. I downloaded the bootstap and added the files into my public directory. Subsequently I added below lines into our main template since I need the styles on all the pages.


href="@routes.Assets.at("bootstrap/css/bootstrap.min.css")" rel="stylesheet" media="screen">
<script src="@routes.Assets.at("bootstrap/js/bootstrap.min.js")" type="text/javascript" />

After adding I refreshed my page and it was getting rendered as blank. None of the contents were getting displayed on the page though I could see them using view source. 

I started playing around and replaced the "/>" with proper ending tag. i.e.

<link href="@routes.Assets.at("bootstrap/css/bootstrap.min.css")" rel="stylesheet" media="screen">

<script src="@routes.Assets.at("bootstrap/js/bootstrap.min.js")" type="text/javascript"></script>

Everything started working as expected. So not sure why it did not work without proper end tag. I will debug the playframwork code soon when I will have some time.

Cheers!
Manisha




Friday, May 31, 2013

Using Developer License for iPhone development

I should say my start was bumpy. I was hoping to be up and running in an hour and it took me entire morning. Yes I am dumb and agree English is my third language but stumbled upon provisioning was no fun.

So started with applying the developer license and activating it. I was pretty happy to think I am all set to develop.

1) Downloaded and installed latest version of XCode 4.6.2.
2) Upgraded to latest version iOS 6.
3) Downloaded and Installed PhoneGap latest API for iOS.

Using below command created my HelloWorld application.

./phonegap-2.7.0/lib/ios/bin/create ~/Documents/toyspace/HelloWorld com.toy.HelloWorld HelloWorld

Install iOS Simulator components by choosing. XCode -> preferences -> Downloads -> Components.

Double click on HelloWorld.xcodeproj project to open and try running it using Simulator. Should run without any hassle.

Now I wanted to deploy the same HelloWorld application on my iPhone. Very simple desire of mine. Boom encountered

"No iOS Development certificate was found. However, there is already a certificate request pending. An Agent or Admin must approve this request before you can download your certificate."

Searched the error on google and found couple of useful links. Then I realized just activating the license which was issues to me is not enough.

One should create following things to get started.
1) Login to https://developer.apple.com using your apple id.

2) Choose -> iOS-> Development -> Certificates, Identifiers & Profiles. Create a new certificate using your mac Keychain store and register it under Certificates -> Development options.
 
3) Create a App ID for the package name of your application. Otherwise you will encounter
 "Code Sign error: The identity 'iPhone Developer: x Xxxxx' doesn't match any identity in any profile" error. i.e. in our case it will be com.toy.HelloWorld.

Once you have done above things on developer website. Come back to XCODE and open the Organizer to setup your device.  On XCODE menu options choose Windows - > Organizer.

Click on Add icon on Provisioning Profile option. Provide a profile name , select the App Id which we created and select the device where you want it to be deployed and choose the certificate to register your device with XCODE.

Now select the device as target and run the application again. Hopefully you should not see any error.


Cheers!
Manisha

Saturday, May 25, 2013

Another reason to use Java 7 - Tiered Compilation


I had my Ahhhaaa moment last week when I was reading about Tiered compilation, which was introduced in Java SE 7. It combines the goodness of client and server startup. In short client startup speeds to the server VM. 

Check below graph. 



Isn't this awesome performance benefit? For more details read this documentation. So start using java 7 if you haven't already done it. Or I would say go for java 8. I know lots of big companies where java 6 is still de facto standard. Question is how can we make these companies adapt quickly. May not be appropriate for this blog post. I need another blog for my all my rants ;).

Take a look and let me know your thoughts.

Will share more
Manisha 

Thursday, March 7, 2013

File not found issue with tomcat: URL Encoding

I have to admit, today was lot better than yesterday. My struggle started when I was asked to quickly ( I mean it, in 10 minutes or so..) deploy a POC application on amazon ec2 instance. It is a windows 2008 server, so installed tomcat as service under "Program Files" and installed java 7. Hoping my 5 pages application will fly in no time that's when I noticed an error stack on the tomcat console :(. Main root cause was:

"Caused by: java.io.FileNotFoundException: File 'C:\Program%20Files\apache-tomcat-7.0.29\webapps\xyz\WEB-INF\classes\createData.sql' does not exist"

I could see the file under WEB-INF\classes and that's when I realized that my URL is getting encoded, hence all spaces are getting replaced with %20.

I had below line of code which was causing the issues since there is no folder with name "Program%20Files" in the system.

String path = FileUtils.class.getClassLoader().getResource("createData.sql").getPath();
List readLines = FileUtils.readLines(new File(path));
I wrapped it using URI and BOOM problem went away.

String path = FileUtils.class.getClassLoader().getResource("createData.sql").getPath();
List readLines = FileUtils.readLines(new File(new URI(path).getPath()));

as usual I happy soul again.
Manisha                

Wednesday, February 6, 2013

Install applications without admin permission on windows machine


Off late I am living under processes and restriction world. Got confused correct? I am consulting at a place where I don't have any permission on my own laptop. I am not complaining about installing stuff but coping under certain directory and changing the environment varibales are restricted too.
Being a developer I live in code and wants full access to environment where I am living.  I found out that if you don't have Admin access to your machine you can still do things like administrator.
Create a "Temp" directory under c:\ drive. create a wintv directory under it and copy the cmd.exe underneath it. Boom now you can do anything on your machine. Copy any exe here and you can run them, install them. To change the environment variable just open the command prompt from c:\Temp\wintv directory and open Windows\System32\sysdm.cpl file. BOOM BOOM!!
You are unstoppable again :) Manisha

"." to open the home directory in windowns


Yesterday I was tweaking with my setting.xml which resides under ~\.m2\conf directory.

I was opening my explorer and then was making hundreds of click to reach there :O. A friend (Sachin) who was standing next to me showed me a nice shortcut to open home directory with one click.
Start -> Run -> Type just "." and hit enter.. Tadaaaa it will open your home directory. Thank you for showing Sachin.   I will remember, it now. Manisha

Maven: Could not calculate build plan: Failure to transfer

Last day a very simple thing took little while for us to resolve. I was trying to setup a new project on a machine and did not have all my environment variables setup properly.


I was trying both the command line and eclipse options interchangibly. Initially I had the wrong repository settins in settings.xml so it could not download any jars and I ended up having *.lastUpdated files all over.

Eclipse maven plugin seems to stop downloading the dependencies if it seems *.lastUpdated files. I had to remove the all the *.lastUpdated file and plugin starts to work agian.
I read same clean up can be done using mvn -U clean too.   happy reading Manisha