In order to change default keymap to Eclipse keymap, select Preferences > Key Bindings – User. This will automatically open keymap setting file for you. Then paste the content of the following file to opened file:

Full and great cheat-sheet site for Laravel: click here , in case you lost your internet connection, here is PDF copy php artisan key:generate : generate encryption key for application php artisan migrate:install : Create the migration repository php artisan migrate:make name : Create a new migration file php artisan generate:migration –fields=”name:string, description:text, started_at:timestamp, ended_at:timestamp” […]

In Windows: Install Composer from this link. In this step, the installer will ask you the directory of php.exe, you should put C:\xampp\php\php.exe if you use XAMPP OR put c:\wamp\bin\php\php5\php.exe Clone by enter git clone https://github.com/laravel/laravel.git in Git Bash terminal or download Laravel. Make sure enable openssl from all php.ini files. If you used WAMPP, […]

express project_name : create a projects npm install module_name: install a module cd project_dir && npm install : install modules which declare in package.json npm prune : auto remove all of modules which not listed in package.json npm update update all module version which is list in package.json npm init create a module

In order check the Internet connection in Android java code: public boolean checkConnectivity() { boolean enabled = false; ConnectivityManager connectivityManager = (ConnectivityManager) this .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); NetworkInfo wifiConn = connectivityManager .getNetworkInfo(ConnectivityManager.TYPE_WIFI); NetworkInfo mobileConn = connectivityManager .getNetworkInfo(ConnectivityManager.TYPE_MOBILE); try { if ((wifiConn.getState() == NetworkInfo.State.CONNECTED) || ((mobileConn != null && (mobileConn.getState() == NetworkInfo.State.CONNECTED)))) { enabled = […]

This function will parsing JSON feeds in Android java: public JSONArray parsingDatawithURL (String url) { try { HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(new HttpGet(url)); StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_OK) { InputStream inputStream = null; String json = null; // get entity from response HttpEntity entity = response.getEntity(); // get […]

To download a Youtube video or playlist, you need to use a Linux distribution and install the application called youtube-dl Install Youtube-dl application Install this application in Ubuntu-liked Linux distributions is very simple, just run the Linux command : sudo apt-get install youtube-dl However you might run into this following error when you try to […]

Transmission Control Protocol (also known as TCP) is a core protocol of the Internet Protocol Suite. It operates at a higher level than its compatriot, Internet Protocol (also known as IP). The two main concerns of TCP are the two end systems –a web browser and a web server, for example. TCP provides the delivery […]

Referenced from seguetechnologies.com ASP.NET : The Microsoft .NET Framework is a software framework for developing and executing applications on Windows client and server operating systems. It provides features and functionality that are designed specifically for creating and running applications on the Windows platform, but also supports connectivity with non-Windows systems. The Microsoft .NET Platform consists […]

The precompile process is killed because it’s eating out your server’s RAM. You can confirm this by running top in another ssh session. To solve it, we have to create a swap file that will be used when RAM is full. First of all check if your system have any swap files sudo swapon -s […]

Trying rails server then this error occured:  /var/lib/gems/1.9.1/gems/execjs-2.2.1/lib/execjs/runtimes.rb:51:in `autodetect’: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) from /var/lib/gems/1.9.1/gems/execjs-2.2.1/lib/execjs.rb:5:in `<module:ExecJS>’ from /var/lib/gems/1.9.1/gems/execjs-2.2.1/lib/execjs.rb:4:in `<top (required)>’ from /var/lib/gems/1.9.1/gems/uglifier-2.5.3/lib/uglifier.rb:3:in `require’ from /var/lib/gems/1.9.1/gems/uglifier-2.5.3/lib/uglifier.rb:3:in `<top (required)>’ from /var/lib/gems/1.9.1/gems/bundler-1.7.0/lib/bundler/runtime.rb:76:in `require’ from /var/lib/gems/1.9.1/gems/bundler-1.7.0/lib/bundler/runtime.rb:76:in `block (2 levels) in require’ from /var/lib/gems/1.9.1/gems/bundler-1.7.0/lib/bundler/runtime.rb:72:in `each’ from /var/lib/gems/1.9.1/gems/bundler-1.7.0/lib/bundler/runtime.rb:72:in `block in […]

When you try to install rails by thsi command : sudo gem install rail, then this error keep occurring:  Building native extensions.  This could take a while…ERROR:  Error installing rails:    ERROR: Failed to build gem native extension.     /usr/bin/ruby1.9.1 -r ./siteconf20140817-14563-5arwq8.rb extconf.rb/usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require’: cannot load such file — mkmf (LoadError)    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require’    from extconf.rb:1:in […]

Let’s say we have two model Photo and Album, and we like to attablish the many to many relationship between these two models. Here the whole process : 

  • Create Photo model like the following: 

class Photo < ActiveRecord::Base
# validate photo_id unique
validates_uniqueness_of :photo_id

# setup many to meny relationship with albums table
has_and_belongs_to_many :albums

end

Continue reading

You can use JQuery and Ajax to handle the pagination feature. However, there is a much easy way to have this feature working if you use Ruby on Rails. Here is how you got it work:  First install the Ruby plugin called  in Rails system will_paginate by the following command:  gem install will_paginate Then update your […]