logo
Sep
27

How to configure libstdc++ with GCC 4.8?

You need to tell your dynamic linker (it’s executed when you run your program) where to find the library. Set LD_LIBRARY_PATH to the path of the library (probably somewhere under /app/gcc/4.8.0/lib or something). Use find /app/gcc/4.8.0 -name “libstdc++.so.6″. Add the directory to your LD_LIBRARY_PATH. e.g with the path I mentioned: export...
Sep
11

Openresty : Programming with Magento/Mysql – Get Inventory of Products REST API

Skills Requried – LUA, nginx, mysql If you have nginx-openresty installed, open the vhost file of your domain, than follow this: Let your REST API path is http://<your-domain>.com/getstockserv?p=123450,12145 where p is the parameter where all product ids of Magento Products has been supplied. Now add this entry to the vhost file - location ^~ /getstockserv { content_by_lua ‘ local mysql =...
Sep
9

How to add a Volume to EC2 Instance?

Go to EC2 console to create the volume and attach it to the instance, and then we’ll mount the volume to make it available. - under Elastic Block Store, click Volumes. - Click on Create Volume – Select the General Purpose (SSD) volume type. - Wait for your Volume to be available. - Right click on it and select Attach Volume, Select the instance and specify an unused device name say...
Sep
4

How to make nginx works with Geo IP?

  NGINX GEO IP Installation: wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz tar -zxvf GeoIP.tar.gz cd GeoIP-1.4.8/ ./configure make make install echo ‘/usr/local/lib’ > /etc/ld.so.conf.d/geoip.conf yum install gcc pcre-devel.x86_64 openssl-devel.x86_64 yum install readline-devel pcre-devel openssl-develWe are using openresty – nginx...
Aug
7

Nginx Openresty Get/Set Cookies using LUA.

To set cookies using lua while using nginx_lua module in openresty/nginx server, use this code: local expires = 3600 * 24  — 1 day ngx.header["Set-Cookie"] = “session=demo; Path=/; Expires=” .. ngx.cookie_time(ngx.time() + expires) This will set cookie session = demo for 1 day from current time on path...
Aug
5

Use PHP Functions in LUA Code

explode Based on [PHP explode] Example: explode(” and “,”one and two and three and four”) –> {“one”,”two”,”three”,”four”} Compatibility: Lua 5.0 and 5.1function explode(div,str) if (div==”) then return false end local pos,arr = 0,{} – for each divider found for st,sp in function() return...
Aug
4

Purge redis keys in matching pattern

After logging in to linux shell execute this command redis-cli KEYS “*$1*” | xargs redis-cli DEL where $1 is the argument/string which you need to find. E.g.   redis-cli KEYS “*test*” | xargs redis-cli DEL where test is a string you need to search for.  
Aug
3

Mysql get size of tables in a database

To find the detail of size of tables in a database use this query in mysql console: SELECT table_name AS “Tables”, round(((data_length + index_length) / 1024 / 1024), 2) “Size in MB” FROM information_schema.TABLES WHERE table_schema = “$DB_NAME” ORDER BY (data_length + index_length) DESC; E.g. for database name mydatabase : SELECT table_name AS...
Aug
1

Nginx Proxy requests are redirecting to upstream name.

If you are using nginx as a reverse proxy and having the redirection issues to upstream name when proxy request results in 301,302 redirects, e.g. http://www.mind-geek.net/new.html is proxied by backend upstream i.e. upstream backend { server 54.21.42.13:80; } location / { proxy_pass http://backend; } and the requests are getting ended eith http://backend/new.html, than you need to sepecify the...
Jul
31

How to add indexer in a Custom Module?

Follow these steps: config.xml: <index>                        <indexer> <cms_indexer> <model>module/cmsindexer</model> </cms_indexer> </indexer> </index> Model: app/code/local/Name/Module/Model/Cmsindexer.php Class Module_Model_CmsIndexer extends Mage_Index_Model_Indexer_Abstract { public function getName(){ return ‘Add CMS...

« Previous Entries

logo