Friday, December 27, 2013

Unable to download data from https://rubygems.org/ - SSL_connect


If you are getting:

Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed ...

Its most likely your gem gem is outdated.
Try updating via:
gem update --system

then try to install your gem as required

if it still fails, try using raggi brew update
brew tap raggi/ale
$ brew install openssl-osx-ca
as referred from here:

Thursday, December 12, 2013

cpanel and ruby on rails

#first, use rvm to install both ruby stable version + rails, run as root:

curl -sSL https://get.rvm.io | bash -s stable --rails


yum install curl-devel

gem install passenger

rvm list
rvm --default 

export APXS2=/usr/local/apache/bin/apxs
passenger-install-apache2-module

next, copy the configuration in the final readme when compilation is done, eg:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.27/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.27

PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-2.0.0-p353/ruby

and paste to :
/usr/local/apache/conf/includes/pre_main_2.conf

then restart apache:
/scripts/restartsrv_httpd

next, to install rails app onto 1 of the account:
mkdir -p /usr/local/apache/conf/userdata/std/2/[username]/[domain]
vi /usr/local/apache/conf/userdata/std/2/[username]/[domain]/rails.conf


ServerName www.yourhost.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /home/[username]/[path-to-rails]/public
<Directory /home/[username]/[path-to-rails]/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>

#rebuild apache config:
/scripts/rebuildhttpdconf

then restart apache:
/scripts/restartsrv_httpd

next, to be able to run bundle install as a shell user:
mkdir ~/bin
ln -s /usr/local/cpanel/3rdparty/bin/git ~/bin/git
then run bundle install at root of rails application.
this will install gems into vendor/bundle

running git to parse ssl from github seems to return certicate error,
to solve this, pre run this as shell user:
git config --global http.sslverify false

then only run bundle install

if you are using json api,
you will need nodejs installed.
install this as root

on centos:
yum install npm
for other os:
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

 for reference:

Friday, November 22, 2013

mod passenger httpd.conf configuration

Example configuration:

RailsEnv "development" # to setup default environment for passenger
  PassengerEnabled on
  AllowOverride None
  Options FollowSymLinks ExecCGI
  Order allow,deny
  Allow from all
  PassengerBaseURI /mydir
  PassengerAppRoot /var/www/mydir


Tuesday, November 12, 2013

prestashop, sometimes save does not work?

Thats why i hated PHP.
It took me half a day to finally realize, prestashop was posting too much variables on the product form with my additional fields.
There wasn't any error, but the form just return back to the front page with no exception, no error logs...
just plain - "not working".

after testing

echo "keys: ".count(array_keys($_REQUEST));

i found 990 keys posted.
then i went into whm and change php.ini in /usr/local/lib
max_input_vars 5000
then i found the keys posted is 1800+ keys..

PHP sucks!

Wednesday, October 9, 2013

changing git remote origin

#to list all remote url
git remote -v

#to remove existing remote (not reversible)
git remote remove [name]
eg: git remote rm origin

#then you may add your new remote
git remote add origin ssh://git destination/...


Tuesday, October 8, 2013

rails mysql2 install fail

if you encounter No such method for Nil Class,
its due to a bug in mysql2 v0.3.13,

so try to install
gem install mysql2 -v 0.3.11

to get it installed on windows, you will need the right connector library to be installed.
first, download the zip file of the mysql connector, and extract it.
v0.3.11 requires mysql-connector-c-noinstall-6.0.2-win32

next, install using this command:
gem install mysql2 -v 0.3.11 --platform=ruby -- --with-opt-dir="C:\path-to\mysql-connector-c-noinstall-6.0.2-win32"

after installed, makesure to copy C:\path-to\mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll to c:\Ruby200\bin\

Note: nokogiri currently desnt support ruby 64bits.
so try to use 32bits if you need to use it.

Wednesday, September 18, 2013

phpmyadmin blank page

due to hosting configuration,
some hosting don't allow use of ini_set.
to fix it,
edit libraries/session.inc.php and comment off all ini_set
edit libraries/common.inc.php and comment off all ini_set

in config.inc.php, maksure to set:


$cfg['Error_Handler']['display'] = true;
$cfg['Error_Handler']['log'] = true;
$cfg['Error_Handler']['gather'] = true;
$cfg['Servers'][$i]['auth_type'] = 'cookie';

//optional
$cfg['Servers'][$i]['extension'] = 'mysql'; //if mysqli isnt supported

//and off these:

//$cfg['Servers'][$i]['controluser'] = 'root';
//$cfg['Servers'][$i]['controlpass'] = '';



Wednesday, September 11, 2013

mac ruby iconv not found

#if you are using rbenv to setup your ruby, use this command:
CONFIGURE_OPTS="--with-iconv-dir=/usr/bin/iconv" rbenv install [version]

#to locate your iconv, use
which iconv

eg:
CONFIGURE_OPTS="--with-iconv-dir=/usr/" rbenv install 1.9.3-p448

otherwise for rvm, you may use instruction from here:
http://stackoverflow.com/questions/7829886/in-require-no-such-file-to-load-iconv-loaderror

Friday, September 6, 2013

php $_POST return empty

its most likely due to ini setting post_max_size.
make sure to set your post_max_size to higher than upload_max_filesize in php.ini,
other wise your $_POST variable or $_REQUEST variable might become empty...

Monday, August 19, 2013

wordpress wp_insert_user cannot login?

its a weird behaviour.
after running these code below, i wasn't able to login.
but when i request for password, the password reset works.
so, work around is, running wp_set_password after insert user:
Example:


$user = array(
          'user_login'          => $email,
          'user_password'       => $password,
          'user_email'          => $email,
          'first_name'          => $first_name,
          'last_name'           => $last_name,
          'user_registered'     => $row->updated_at
);

$user_id = wp_insert_user($user);

$customer = get_user_by('id', $user_id);

$customer->add_role( 'customer' );

//workaround below
wp_set_password( $password, $user_id );

Wednesday, August 14, 2013

cpanel subprocess exited with status 2

it looks like recent changes on cpanel have caused third party perl modules to fail,

tail /usr/local/cpanel/logs/error_log shows:
Can't locate Template/Constants.pm

to fix it, follow here:
http://forums.cpanel.net/f5/cpanel-11-38-perl-issues-500-internals-whm-351901.html#post1414301

*note: use at your own responsibilities:
rm -f /usr/bin/perl /usr/local/bin/perl
ln -s /usr/local/cpanel/3rdparty/bin/perl /usr/bin/perl
ln -s /usr/bin/perl /usr/local/bin/perl

Thursday, June 27, 2013

post checkbox array limit in php

If you have really large array of checkbox values to be submitted to php,
you will likely to hit the limit on

max_input_vars = 99999
post_max_size = 100M
max_input_nesting_level = 64 #normally good enough unless you have really deep array
or suhosin issue: (php.ini):
suhosin.post.max_array_depth 

suhosin.post.max_array_index_length 

suhosin.post.max_name_length 

suhosin.post.max_totalname_length 

suhosin.post.max_vars 

suhosin.post.max_value_length 

Wednesday, June 26, 2013

modx php5.3 timezone error

In my case, setting
date_default_timezone_set("Asia/Kuala_Lumpur"); //didnt work

only solution was to set it in .htaccess
php_value date.timezone Asia/Kuala_Lumpur

Monday, June 10, 2013

Prestashop cart rules for selecting products not working

In my case, was due to fancybox not working properly on jquery 1.9.
after replacing fancybox with latest version and it works!

Friday, June 7, 2013

R cannot be resolved to a variable

this happen to me on new project,
and it turn out that i need to update every single outdated package for it to compile the r class properly.

help > check for updates

Window > Android SDK Manager
Check all available upgrade and package required for your project (min to max version).
Then make sure to agree on every single package, and then click install.
Next, restart the eclipse.

Thursday, June 6, 2013

bruteforce attack growing

It seems that in a single day, there are 6 attack from different machine and different country to a particular server.
Have you guys protected your server? No? try CSF.


Tuesday, May 21, 2013

Prestashop adding image field

To add in admin as a list field:
override/controllers/admin/Admin[Name]Controller.php
in __construct():

$this->fieldImageSettings = array(
  'name' => 'image', //form name
  'dir' => 'name'//img/name
);
$this->imageType = "jpg";


in __construct() or ajaxProcessDetails(): //depending on extended controller

$this->fields_list['image'] = array(
  'title' => $this->l('Image'),
  'width' => 70,
  "image" => $this->fieldImageSettings["dir"]
);

if helper is generated manually:
//$this->setHelperDisplay($helper); // this is full helper
$helper->imageType = $this->imageType;

in __construct() or renderForm or renderForm[Name] //depending on extended controller
$this->fields_form["input"][] = array(
  'type' => 'file',
  'label' => $this->l('Image:'),
  'name' => 'image',
  'required' => false,
  'display_image' => true
);

In override/classes/modelname.php
in __construct():
$this->image_dir = "name"; //points to same path as fieldImageSettings["dir"] above

if you generate custom thumb based on alias name, makesure to clear all cache files in tmp with this additional function in Model Class:

public function deleteImage($force_delete = false) {
    $res = parent::deleteImage($force_delete);
 
    if ($res) {
      //clear cached file
      $files = array(
        $table.'_mini_'.$this->id.'.'.$type,
        $table.'_thumb_'.$this->id.'.'.$type
    );
    foreach($files as $file) {
      if (file_exists(_PS_TMP_IMG_DIR_.$file)) {
        unlink(_PS_TMP_IMG_DIR_.$file);
      }
    }
   
    }
  return $res;
}




Wednesday, May 15, 2013

Prestashop form field type

Adminisration notes:

the template for default form helper is located @
[path-to-project]/[admin-path]/themes/default/template/helper/form/form.tpl

the template for default listing helper is located @
[path-to-project]/[admin-path]/themes/default/template/helper/list/list.tpl

if you want to override the form template,
create the file or copy a pre-made template to:
[path-to-project]/[admin-path]/themes/default/template/controllers/[yourcontrollername]/helpers/form/form.tpl

eg:
AdminMyAdminController form helper in

[path-to-project]/[admin-path]/themes/default/template/controllers/my_admin/helpers/form/form.tpl


If you want to know all other supported form type, locate the smarty form functions @
[path-to-project]/tools/smarty/plugins/function.[name].php

Monday, May 13, 2013

prestashop Undefined index: unifunc in

I came across this issue while trying to get a module hook output.
it turn out that if i tried to get instance of a module and render its hook,
and then try to return my own output for my hook, the $this->display will cause error: Undefined index: unifunc in ...


Thursday, May 2, 2013

changing hostname on centos vps

if you are using solus vps, just login into solus control panel, click on vps and click on hostname and change the hostname.

after some tinker, i realize changing /etc/hosts nor /etc/sysconfig/network seems to revert back after reboot

GoDaddy VPS SUCKS!


  • Customer
    hi
    6:10:34 PM
  • Customer
    im facing slow email
    6:10:40 PM
  • Jiri S
    Hello, how can I help you?
    6:10:44 PM
  • Customer
    some of my email hang in queue
    6:10:45 PM
  • Customer
    [root@ip-[hidden] script]# /var/qmail/bin/qmail-qread
    2 May 2013 08:57:43 GMT  #29037308  1152  reeve@hidden
      done remote fteo@[hidden]
      done remote lng@[hidden]
           remote sandra@[hidden]
      done remote wteo@[hidden]
    
    2 May 2013 10:01:16 GMT  #29033403  723  test@hidden
     remote james@hidden-gmail-server
    6:10:55 PM
  • Customer
    the mail is sent about an hour ago
    6:11:08 PM
  • Customer
    initially 2 is sent, but the rest 2 was hanging there
    6:11:26 PM
  • Customer
    did u defer my mail?
    6:11:36 PM
  • Customer
    its going extremely slow
    6:12:21 PM
  • Jiri S
    We would not make changes to the configuration of your email.
    6:12:44 PM
  • Jiri S
    However.
    6:12:47 PM
  • Jiri S
    If the relay has to process larger volume of emails than usual,
    6:13:06 PM
  • Jiri S
    it is possible that some of the email would not be accepted by the relay.
    6:13:26 PM
  • Jiri S
    Email is not an instant service and sometimes can become backed up and queued on your server. We are unable to guarantee instant delivery as Simple Mail Transfer Protocol (SMTP) is not designed to do so. RFC 821, RFC 2821, RFC 5321, and others, contain technical specifications. The inclusion of sections relating to sending, receiving, and retry strategies; and the nature of global telecommunications networks imply that instant delivery is neither intended, expected, nor guaranteed. The retry time frames specified in the sending strategies support this conclusion. That is not to say that we do not strive to minimize delivery time; it just says that it cannot be guaranteed.
    6:13:36 PM
  • Customer
    noo
    6:14:11 PM
  • Customer
    i cant accept such delay
    6:14:21 PM
  • Customer
    my server is already on low traffic
    6:14:28 PM
  • Customer
    less than 5 accounts using it and the mail isnt much in the queue
    6:14:37 PM
  • Customer
    and why would u take 1 hour to send a single queue?
    6:14:48 PM
  • Customer
    THIS IS NOT ACCEPTABLE
    6:14:59 PM
  • Customer
    if your relay is unable to service my server, then please consider adding more proxy
    6:16:02 PM
  • Customer
    upgrading ur system to handle more loads
    6:16:09 PM
  • Customer
    you cannot be allowing this kind of delay to happen
    6:16:24 PM
  • Customer
    ELSE just open up port 25 so that my server can flow my own email
    6:16:44 PM
  • Customer
    fyi, ive 3 servers on your services
    6:17:03 PM
  • Customer
    and im responsible for every single client using it.
    6:17:15 PM
  • Customer
    if you guys are always giving me this kind of service problem and delay
    6:17:26 PM
  • Customer
    how am i suppose to answer my client?
    6:17:31 PM
  • Customer
    ive been sitting here trying to figure out what went wrong
    6:17:49 PM
  • Customer
    just now even cant connect to your smtp proxy on port 25
    6:17:58 PM
  • Customer
    it failed to connect
    6:18:01 PM
  • Customer
    r u having ddos attack internally?
    6:18:06 PM
  • Customer
    look, my queue is almost empty
    6:18:40 PM
  • Jiri S
    These are standards for email
    6:18:48 PM
  • Customer
    left 2 in the queue since i started wthis chat with u , and now its still 2 in the queue pending
    6:18:59 PM
  • Jiri S
    as you can see if you lookup the email standards mentioned above.
    6:19:01 PM
  • Customer
    wtf is going on????
    6:19:03 PM
  • Customer
    look @ this, no change since start of this chat!
    6:19:31 PM
  • Customer
    root@ip-[hidden]script]# /var/qmail/bin/qmail-qread
    2 May 2013 08:57:43 GMT  #29037308  1152  reeve@[hidden]
      done remote fteo@hidden
      done remote lng@hidden
     remote sandra@hidden
      done remote wteo@hidden
    2 May 2013 10:01:16 GMT  #29033403  723  test@hidden
    6:19:32 PM
  • Customer
    pls dont give me excuses, i want answer to the delay
    6:20:56 PM
  • Jiri S
    We are unable to guarantee instant delivery as Simple Mail Transfer Protocol (SMTP) is not designed to do so. RFC 821, RFC 2821, RFC 5321, and others, contain technical specifications.
    6:21:29 PM
  • Jiri S
    I would recommend reviewing those.
    6:21:37 PM
  • Customer
    dont talk nonsense
    6:21:39 PM
  • Customer
    ive another server in us, and ive over 30 domains on it and its running fine!
    6:22:01 PM
  • Customer
    ive no queue stuck
    6:22:47 PM
  • Customer
    you guys must just admited that your idea of smtp proxy SUCKS!
    6:23:00 PM
  • Customer
    if you cant handle those mail volumes, then pls reconsider opening up port 25
    6:23:20 PM
  • Customer
    so please.. i need answer

Tuesday, April 30, 2013

Prestashop hook before header

If you are looking for a hook which comes before any controller is dispatched,
use $this->registerHook('actionDispatcher')

function hookActionDispatcher() {
...
}

Sunday, April 28, 2013

mosync exceptions -fexceptions

Mosync cannot use exception.
Enabling -fexceptions seems to throw lots of linking error.
use maPanic instead, but which is not a wise way to handle error...

Wednesday, April 24, 2013

network congested to a specific server? try ssh tunelling

SSH tunnelling basically open up a proxy through your localhost on a specific port,
and redirect the traffic through your ssh server to the destination domain.

#Run this SSH tunnel
ssh -f ssh-username@ssh-server.com -L 2000:yourdomain.com:80 -N
#edit hosts file to point a domain to a localhost
vi /etc/hosts (/private/etc/hosts - on MAC OS)
127.0.0.1 www.yourdomain.com
#open this in browser
http://www.yourdomain.com:2000/


Monday, April 22, 2013

Adding custom tab for product admin via module

be sure to use input names which is not same as database field name,
then you may use hookproductupdate or hookproductadd to set the value manually,
and call update to the $product parameter.


Saturday, April 13, 2013

prestashop 1.5.4.0 delete all orders and cart items

TRUNCATE `ps_orders`;
TRUNCATE `ps_order_detail`;
TRUNCATE `ps_order_detail_tax`;
TRUNCATE `ps_order_history`;
TRUNCATE `ps_order_invoice`;
TRUNCATE `ps_order_invoice_payment`;
TRUNCATE `ps_order_invoice_tax`;
TRUNCATE `ps_order_message`;
TRUNCATE `ps_order_message_lang`;
TRUNCATE `ps_order_payment`;
TRUNCATE `ps_order_return`;
TRUNCATE `ps_order_return_detail`;
TRUNCATE `ps_order_return_state`;
TRUNCATE `ps_order_return_state_lang`;
TRUNCATE `ps_order_slip`;
TRUNCATE `ps_order_slip_detail`;
TRUNCATE `ps_order_state`;
TRUNCATE `ps_order_state_lang`;
TRUNCATE `ps_message`;
TRUNCATE `ps_cart`;
TRUNCATE `ps_cart_product`;

Friday, April 12, 2013

Prestashop complete state list of the world

Need a complete list of states of the world?
use these code below, but Note:
this has changed name size to 200 and iso_code size to 30,
please remember to change class/State.php accordingly,
and change class/Validate.php too.

Or replace both class via override/classes, see code below:
(as of prestashop 1.5.4.0)

makesure to run this after import:
update ps_country set contains_states=1;

to enable all countries:
update ps_country set active=1;

Monday, April 8, 2013

Prestashop adding jQuery plugin

Front end / Back end controller class, call this:
 $this->addJQuery($componentname);
 $this->addJqueryUI("ui.componentname");

 eg. $this->addJqueryUI("ui.datepicker");

Tuesday, April 2, 2013

modx getresources sortby and limit

looking @ the new documentation of getresources, it shows that its possible to add sort direction within the sortby parameter. but as it turn out, if we add sortby and limit together, will also need to add sortdir,...

Wednesday, March 20, 2013

cpanel compiling php 5.4 modules

/usr/local/bin/phpize ./configure --with-php-config=/usr/local/bin/php-config make clean make make test make install this works well with mongodb Example for mongodb: git clone https://github.com/mongodb/mongo-php-driver.git cd mongo-php-driver /usr/local/bin/phpize ./configure --with-php-config=/usr/local/bin/php-config make clean make make test make install vi /usr/lib/php.ini add extension=mongo.so

Tuesday, March 19, 2013

PHP facebook logout?


//for some reason, facebook getlogouturl does not seems to be able to populate access_token byitself.
//Therefore this method forces it to attach the access token:
$logoutUrl = $facebook->getLogoutUrl(array(
        "next" => "yourdomain.com?logout=1", "access_token" => $facebook->getAccessToken()
      ));
$facebook->destroySession();
<script>

document.location.href="<?=$logoutUrl?>";

</script>


Prestashop smarty cache

Do not enable smarty cache on prestashop,
or all your screen will appear the same as last accessed screen, including admin screen.

its pretty messed up.

Sunday, March 17, 2013

Kloxo custom php.ini per domain

sudo cp /etc/php.ini /home/httpd/domain.com/
#edit /home/httpd/domain.com/php.ini as required

#then
sudo vi /home/apache/conf/domains/domain.com.conf
#and add this line in <ifmodule mod_php5.c="">
PHPINIDir /home/httpd/domain.com

#restart apache
/etc/init.d/httpd restart


This shall allow you to set allow passthru or system or exec call per domain.

Saturday, March 16, 2013

axlsx vs simple_xlsx

simple_xlsx:

text = getRandomString(15)
serializer = SimpleXlsx::Serializer.new("test2.xlsx") do |doc|
  doc.add_sheet("Report") do |sheet|
    (1...3000).map{
      row = []
      (1...1800).map{
        row.push text
      }
      sheet.add_row row 
    }
  end
end

axlsx:
text = getRandomString(15)
package = Axlsx::Package.new
workbook = package.workbook
workbook.add_worksheet(:name=>"Report") do |sheet|
  (1...3000).map{
    row = []
    (1...1800).map{
      row.push text
    }
    sheet.add_row row 
  }
end
package.serialize("test.xlsx")

Results:
simple_xlsx:
Memory Usage: 17836kb, elapsed: 61.828213seconds.
axlsx:
Memory Usage: 2118256kb, elapsed: 177.089469seconds.

17+Mb vs 2+Gb, 61s vs 177s

File output seems to result in same size: 14+Mb

it would be nice if axlsx could write to file directly instead of serialize in the end.



Friday, March 15, 2013

JSTree DND


jQuery("#treeidhere").bind("move_node.jstree", function (e, data) {
  console.log("from id: " + data.rslt.obj.attr("data-id"));
  console.log("to id: " +  (data.rslt.parent === -: data.rslt.parent.attr("data-id"));
  console.log("position: " + data.rslt.position);//starts from 0

});

Thursday, March 14, 2013

Social shares in php


Example of social share: twitter, Facebook, linkedin

Note: if url contains ? might cause linked in share to fail...     ---HEADER---
<meta property="og:title" content="Title here">
<meta property="og:description" content="Description here">
<meta property="og:image" content="http://your domain.com/uri here">
---HEADER---


Thursday, March 7, 2013

Prestashop redirect to module configure

When you need to create an AdminTab to redirect to a module configure,
create a class which extends AdminTab

class Admin[NameHere]Tab extends AdminTab

public function display() {

  Tools::redirectAdmin("index.php?controller=AdminModules&configure=[NameHere]&token=" . Tools::getAdminTokenLite("AdminModules"));
}

this will pass in the admin token as required...

prestashop jquery version

to upgrade,
copy jquery min file to js/jquery/

and then edit config/defines.inc.php

define('_PS_JQUERY_VERSION_', '[version here]');

example:
#copy:
js/jquery/jquery-1.9.1.min.js

--------
define('_PS_JQUERY_VERSION_', '1.9.1');

Tuesday, March 5, 2013

cpanel retrieving mail log

sudo grep [domainname] /var/log/exim_mainlog


Sunday, March 3, 2013

prestashop disable right column via hook?

need to disable right or left column via hook?
do these:

create a module,
makesure to hook onto displayFooter


$this->context->smarty->assign("HOOK_LEFT_COLUMN", "");
$this->context->smarty->assign("HOOK_RIGHT_COLUMN", "");


Alternative way is to go into Modules > Positions And edit the module, and add in exception page name onto the exception box. It's separated by comma.

Monday, February 25, 2013

Modsecurity 2 disabling per domain

sample of disabling mod security 2 for a single domain:
SecRule SERVER_NAME "^.*domain\.com$" phase:1,nolog,allow,id:[#id here],ctl:ruleEngine=Off

Example:
SecRule SERVER_NAME "^.*domain\.com$" phase:1,nolog,allow,id:12312388,ctl:ruleEngine=Off



Wednesday, February 20, 2013

jQuery mobile blank page on navigate on android

This situation happen when the app requires an inner ajax page loading without refresh the page.

It seems that when one of the inner div is long (especially with listview), any navigation to a short page might trigger a blank page issue.

We aren't sure if this is android browser issue, or jquery mobile issue.
The solution is to scroll to the top before showing the new page (especially short page).

To scroll to the top:

jQuery.mobile.silentScroll(0);


Example:
jQuery.mobile.silentScroll(0);
jQuery("#content > div").hide();
jQuery("#content #mypage").show();


Sunday, February 3, 2013

jstree 1.0 new concept

replace json_data with json
eg.:



new data array uses li_attr and a_attr

Sample json:


Wednesday, January 30, 2013

modx page error

this caused me an hour to finally realize,
never ever use reserved querystring Q and A in modx

Tuesday, January 29, 2013

rails engine initializer to add upload path


sample: lib/mymodule/lib/mymodule/engine.rb

module MyModule
  class Engine < ::Rails::Engine
    isolate_namespace MyModule
    #dependency setting is important here
    initializer 'Entcommerce.initialize_upload', :after=> :disable_dependency_loading do |app|
      #Rails.logger.debug "Root: " + Rails.root.to_s
      config.upload_path = Rails.root.join("assets").join("images").join("product")
      #Rails.logger.debug "upload_path: " + config.upload_path.to_s
    end
  end
end



#To get this setting from controller
Rails.application.config.upload_path

reference: