Sunday, July 21, 2013

function: initComponent()

In Extjs, sometimes you want to create a component, and use it immediately after creation.

If you're using Ext.define('app.view.blah', {});
it can be really hard find a way to reference an instance of the class you just created.

It took me forever, but all you do is use the
function: initComponent() when placing items into your view.
Since the scope this of the whole function is an instance of the class, you can use the this keyword at the end of the initComponent function.

Interestingly, there is also an afterrender function

Wednesday, July 17, 2013

Agh Ext!

http://stackoverflow.com/questions/7316967/extjs-4-problems-with-jsonstore-post-request

Sillyness!

I've had a lot of trouble with xml loading too, and I learned some stuff that I might post later on.

But ewy ew ew

Friday, July 12, 2013

Using @Consumes("x-www-form-urlencoded")

For all the newbies out there (like myself :-)

When you use @Consumes("application/x-www-urlencoding")
you use @FormParams not @QueryParams.

Silly silly!

Tomcat/JAX-RS

I'll have a lot to write about my experience with JEE and creating restful services later.

However, for now, I'd like to talk about the following problem that I've had twice:

After making some changes to the Resource files, I've started to get this response:

exception
javax.servlet.ServletException: Servlet.init() for servlet ServletAdaptor threw exception
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
 org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
 org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
 org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)
 java.lang.Thread.run(Thread.java:619)
root cause
java.lang.IllegalArgumentException: java.text.ParseException: End of header
 com.sun.jersey.core.header.MediaTypes.createMediaTypes(MediaTypes.java:224)
 com.sun.jersey.core.header.MediaTypes.createMediaTypes(MediaTypes.java:191)
 com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.addConsumes(IntrospectionModeller.java:152)
 com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.workOutSubResourceMethodsList(IntrospectionModeller.java:338)
 com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:120)
 com.sun.jersey.server.impl.application.WebApplicationImpl.getAbstractResource(WebApplicationImpl.java:623)
 com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:114)
 com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1013)
 com.sun.jersey.server.impl.application.WebApplicationImpl.access$600(WebApplicationImpl.java:153)
 com.sun.jersey.server.impl.application.WebApplicationImpl$11.f(WebApplicationImpl.java:652)
 com.sun.jersey.server.impl.application.WebApplicationImpl$11.f(WebApplicationImpl.java:649)





What the heck is that? The first time I fixed it by making a new project and redoing everything (!)

The second time, I tried restarting and copying all the Resources files from the old project to the new one. Turns out, it still messes up.

Later, I found that the problem is in the @Produces and @Consumes annotation.

For one of the services, I had written @Produces("x-www-form-urlencoded") instead of @Produces("application/x-www-form-urlencoded)


In conclusion, the root problem 
java.lang.IllegalArgumentException: java.text.ParseException: End of header
is usually a stupid annotation problem.

Sunday, June 16, 2013

Load Ext grid with store

So I wasted about an hour trying to load a grid with a store, and nothing ever showed up. Turns out I needed to do Ext.create('Namespace.store.storename') for it to work. Stupid!

Sunday, June 2, 2013

Getting Ruby for Mac

I was working on a project with a friend and needed to get Ruby on Rails for my mac, and this was an incredibly helpful tutorial to do so. here. I would like to add that if you get the error
Can not find compiler and 'make' tool - make sure Xcode and/or Command Line Tools are installed.
, in order to get command line tools (assuming you've downloaded Xcode) do the following: go to Preferences>Downloads, and click install on the row for "Command Line Tools". After this, you should be all set! Note: it'll take awhile. 20-30 minutes is my estimate?