Slow Gradle build time in Android Studio when using libGDX

Follow the SO answer: http://stackoverflow.com/a/35859572/5539403

In Android Studio go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle

Check the ‘Offline work’ under ‘Global Gradle settings’

However, if it Gradle needs to get libraries from the Internet, turn off ‘Offline work’ and run it for first time, then turn the option on to speed up build process.

Creating additional series from same table column for Line graphs in SSRS

I spent quite a lot of time experimenting to be able to do this.

Say you have a table like so

KPI        Value    Date

Temp      34        …

Press      12         …

 

And you would like to have 2 lines in the line graph, one for temperature, one for pressure, the series for pressure may use the secondary y axis. The series for pressure may use a totally different chart type(column).

To do this, don’t add KPI as a series group, add Date as a category group and add Value twice as values.

for the first Value, use IIf(Fields!KPI.Value = “Temp”, sum(Fields!Value.Value, Nothing).

for the second Value, use IIf(Fields!KPI.Value = “Temp”, sum(Fields!Value.Value, Nothing).

Configure the second value to use secondary y axis and you’re done.

Firefox requests for XML format when performing a GET to Web API

Today while testing the Ext JS application I was writing on various browsers, something strange happened. The app works on IE and Chrome, while on Firefox it breaks.

It turns out if not configured correctly WebAPI will return data depending on the Accept HTTP header sent by browsers, and different browsers sent different HTTP Accept header.

More details in the SO answer: http://stackoverflow.com/a/31934984

Firefox prefers XML, so Web API try to serialize data in XML format to return to Firefox.

IE and Chrome doesn’t prefer one over other, so Web API chooses Json.

I solved this issue in Firefox by configuring the web api to always return JSON by adding the following line to WebApiConfig.cs

config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(“text/html”));

Using Ext JS proxy ajax writer

The default behaviour of Ext JS proxy ajax writer seems to be to always use POST. Whenever trying to create/update/delete a record, a JSON object will be sent to the server in the request payload through POST.

It might be possible to configure the proxy and writer to use other HTTP methods like PUT and DELETE, but I haven’t seen any documentation on this yet.

The Id field is always included. So there are 3 cases

  • When the request is to create/update the record, the fields with data will be included. Example: {“Id”:1, “Name”:”Tom”}. Using the Id the server can determine whether it’s a update or create request if a record with same Id already exists.
  • When deleting a record, only the Id is included in the JSON object. Example: {“Id”: 1}. The server can determine that it’s a delete request by checking the number of properties the JSON object has.

If the server is written in ASP.NET Web API, it’s important to read the request body and process it manually instead of using a parameter in the method and let the framework do the deserialization automatically, because then it will not be possible to count the number of properties the object original has, the deserialized object has all properties with default values for missing ones.