Reading cURL Headers in PHP

 

Find Generic Type of Return Type in Java

This example finds the generic type of the test() method in the Test class.

This outputs  Generic type is class java.lang.String.

Queuing Dojo Deferred Objects

I ran into the problem of having to execute a few dojo/Deferred objects in sequence and ensure only one executed at a single time, so I wrote a class called DeferredQueue. The depreciated class dojo/DeferredList and the replacement dojo/promise/all don’t cover this use case.

DeferredQueue accepts Deferred objects wrapped in callback functions and runs the functions when it’s time for that specific Deferred object to execute. I wrote another simple class called DeferredWrapper which accepts a callback and stores a reference to it. The wrapper is itself a Deferred object, and resolving it stores the result of the callback (the inner Deferred object) in the inner property. This is needed since we don’t want our request to the server executing immediately.

Here are the class definitions:

Customising Gradients for Ext JS Charts

In Ext JS gradients are automatically generated for chart themes, but the ability to define how much shading to use isn’t customisable. The following script modifies Ext.chart.theme to allow intercepting the process and modifying these values.

Now I can define a new theme and make the shading darker from 0.1 to 0.3 for instance.

You can provide a gradientCallback callback in the options object you pass in and customise the entire process of setting up gradients if you so wish. Another useful argument is gradientAngle, which defaults to 45 degrees.

Screen Shot 2013-02-03 at 2.55.08 AM