Using jQuery or nodejs makes you addicted to pubsub (publish/subscribe) model. Nodejs has nattive support for event emitters but javascript doesn’t have. Events are only binded to a DOM, using which doesn’t make sense and its also adds to performance cost. To solve the problem i wrote a custom class which implements `on` and `emit` …
2015 archive
Nov 23
Converting Opensource Dictionary to JSON
Folddoc provide free online computer dictionary but they don’t have any standard tool or format to import dictionary in database or so. Dictionary can be downloaded form http://foldoc.org/Dictionary.txt Run the following nodejs code it will dump dictionary to OUTPUT.json and don’t forget to remove initial lines of disclaimer or they will add to your dictionary. …
Nov 18
Importing large CSV file to Mongo.
Someday you will need to import a large file to mongo or some other DBMS , You start writing code for achieving same using NodeJS, but when you run memory usage start increasing and either core of your CPU is at 100%.
Oct 30
Getting whatsapp statistics – WhatsappWeb
There are no tool available for whatsapp which give us how many messages a user has contributed to group, Sometimes you need. Whatsapp web exposes whatsapp to JS, whiche makes things more easy, I wrote a simple code which logs Number of messages sent by each user of group, obviously you need full conversation open …
Oct 10
Redis Vs MongoDB
Redis and Mongodb are considered to solve a common problem that “There is something wrong with RDBMS” So what is difference ? Redis is stored in memory and swapped with disk, So data is not lost and you can enjoy performance of your RAM. (Not to be confused with Memcached it is memory only database) …
Oct 01
Why not nodejs v4.1.1
Recently i updated nodejs installation to v4.1.1 using curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash – sudo apt-get install -y nodejs and i ended up fixing many bug in other modules, but i couldn’t move far in this decision. Nodejs has a history of breaking compatibility with older code in every new release, so if …
Sep 28
Backup Server Configurations to Git
When you have multiple servers it pain to remember every configuration and it may take hours to configure servers again incase you need. It is also impractical to copy each files. There are few tools available but they come with overhead attached moreover its fun to write custom solutions 🙂 1. Create directory 2. cd …
Sep 12
Cloning Server to New Hardware
You can find many ways of cloning old server to new hardware, create diskimage and move to new hardware and if you have identical hardware use `dd` or similar tool to copy disks block by block, but if you have new hardware and want to move server without downtime and with no configuration change there …
Sep 10
Adding ellipsis to long text
When you have some long division and you don’t want to wrap text or extend size of div, But instead you want to use add few `…` at end of text using CSS .wrapped{ overflow:hidden; white-space: nowrap; text-overflow: ellipsis; width: 300px; } Example : Text without text-overflow :Lorem ipsum dolor sit amet, consectetur adipiscing elit. …
Sep 06
Monitoring Website for Downtime
Sometimes our in house server go down, But at production level we cannot take risk of 1min downtime, so we were supposed to monitor our server for downtime. Although there are many cheap services available but i decided to do it my own way, I can use this script in my RPI to monitor even …
- 1
- 2
Recent Comments