Friday, August 28, 2015

installing volley for android

Latest volley is available in maven repository,
therefore, you do not need to compile volley from source code.
goto Build > Library and dependencies > dependencies
click + add, search for volley
com.mcxiaoke.volley:library-aar:1.0.1


If you insists:
---old stuff---
Follow instruction here:
http://www.androidhive.info/2014/05/android-working-with-volley-library-1/

but first, makesure you have setup your environment and paths:

PATH=$PATH:/path-to-android-sdks/platform-tools:/path-to-android-sdks/tools:"/Applications/Android Studio.app/Contents/gradle/gradle-2.4/bin"

export ANDROID_HOME=/path-to-android-sdks

(Please change the path-to-android-sdks and gradle version accordingly)

for windows, you may use SET instead of export.
example: set PATH=%PATH%;...

And,

instead of using ant to build, use `gradle build`.
didnt work for me, i tried to use android studio to open the project, and did not manage to get it compiled...

Thursday, July 30, 2015

connecting to sql server with rails

sql server / sql express is by default cannot be connected by a fixed port
to login to sql server, first, assign a password for sa user,
or any user, and map the database to the user.
you may use db_owner for default role mapping.

then open sql configuration manager
select sql server netwrok configuration > Protocols for localhost / express / your instance name
select TCP/IP
scroll to bottom, and set:
all ports: 1433
dynamic port: (empty, not even a zero)
then goto control panel > services > sql server
restart service,
enable sql browser (auto start delayed) and start service

this shall help to make it work with rails or tiny_tds

Monday, July 20, 2015

mariadb 10.0 upgrade from 5.5

Upgrading to Mariadb10 seems to fail on my ubuntu 14 virtualbox.
What i did was restart the instance,
followed instruction from:
https://mariadb.com/kb/en/mariadb/upgrading-from-mariadb-55-to-mariadb-100/

and prompt to replace my my.inf configuration with maintainer configuration.
but it still failed.
tail -n 200 /var/log/syslog turn out that it was unable to bind at 127.0.0.1.

so i vi /etc/mysql/my.inf
change the binding address to 0.0.0.0

and it works :)


Tuesday, July 7, 2015

exim smarthost matching null or empty string via wildlsearch

okay, it took me a long time to finally figure how to match possible null / empty string
due to nature that sender_address_domain may be empty if its a bounce mail,
delimiting it in a string did not work, turn out ive to just create a blank {}

client_send = : ${extract{auth_name}{${lookup{${if eq{$sender_address_domain}{}{'default'}{$sender_address_domain}}}nwildlsearch{/etc/smart}{$value}fail}}} : ${extract{auth_pass}{${lookup{${if eq{$sender_address_domain}{}{'default'}{$sender_address_domain}}}nwildlsearch{/etc/smart}{$value}fail}}}

with this, it matches in /etc/smart:

default: auth_name=... auth_pass=...


notice the {} empty without any string inside


other complaints:
- for some weird reason, strlen function wont work in section: auth...


Monday, May 25, 2015

executing apm with atom on windows

If you have installed atom via chocolatey,
the default path to apm for atom is located in

C:\Users\yourname\AppData\Local\atom\app-0.201.0\resources\app\apm\bin


Thursday, May 21, 2015

deploying to production via capistrano with passenger and sub uri

due to digested assets requirement in production environment,
the url of images cannot be use in relative to path to css file.

example normal assets:
/assets/frontend/all.css

example of digested assets

/assets/all.XXX.css

due to this, the only way to accurately point to images in css is to add relative path to the url.
one way todo it is to use ENV['RAILS_RELATIVE_URL_ROOT'],
first, you will need to change .css file to .css.erb.
and add in <%=ENV['RAILS_RELATIVE_URL_ROOT']%> to the url path.
example: background-image: url('<%=ENV['RAILS_RELATIVE_URL_ROOT']%>/img/logo.png');

but since we are precompiling via capistrano, it is a must to add this environment into deploy/production.rb
example:
set :bundle_flags, '--deployment' # set this to ensure traces of assets compilation can be shown via --trace
set :default_env, {
  'RAILS_RELATIVE_URL_ROOT' => '/shop'
}

and then run:
cap production deploy --trace

took me hours to try to figure all the issues in place to resolve this.
hope it helps you :)