Thursday, September 20, 2012

Getting SQL from HQL


I havent had the need for this yet, but thought it might be handy to keep it noted.


String hql = "select a.id from Animal a";

ISessionImplementor sessionImp = session.GetSessionImplementation(); 
IQueryTranslatorFactory factory = new ASTQueryTranslatorFactory();
IQueryTranslator[] translators = factory.CreateQueryTranslators(hql, null, false, sessionImp.EnabledFilters, sessionImp.Factory);


if (translators == null || translators.Count() == 0)
   throw new Exception("Could not create the required SQL from HQL");


//Possible should join the sql statements separated by ";"
return translators[0].SQLString;

Thursday, May 3, 2012

Android from Java to C#

Just came across this article about converting Android from Java to c# mono. It is an interesting approach and worth following.

Thursday, February 23, 2012

Setting a proxy for linux terminal

This is mainly for my reference. I have been trying to get Ubuntu's terminal to accept a proxy setting. The following is the format that is required probably very obvious for linux users.

export http_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/
export ftp_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/ 


See this link for details. 


I also used the following command to add the proxy to the .bashrc as specified here.

gksudo gedit /etc/bash.bashrc
 
and also to the apt.config.

sudo gedit /etc/apt/apt.conf