Apache slow time to first byte TTFB linked to slow DNS lookup [localhost]

A really brief post here I had an issue where I had a virtual domain (say jaspreetchahal.org) configured with apache virtual hosts and in my hosts file entries on my iMac (sudo vi /etc/hosts), I want this domain to resolve to 127.0.0.1 The problem I had was that sometimes it was taking up to 10 seconds for something to show up,  I checked pretty much all my configurations, I didn't see any issue with those. Then I diverted my attention to the hosts file itself just to found out that I had over 20 test domain records resolving to 127.0.0.1 What I did then resolved the issue for me I consolidated all my domains to a single line as shown below [crayon-65767cdc63329947316565/] and removed all the unwanted records from the hosts file Tada! that's how fast it should be on a localhost. :) This is what solved for me, I am not saying that it will for you too, there could be several other reasons associated with this issue. There are far too many things that could contribute to the slowness, if you solved it in any other way, feel free to share. I hope this helps. … [Read more...]

Unzip files in bulk in their own directory (sh)

Here is a quiz tip to unzip several zip files found in a directory to their own directories. Use this command from the folder where zip files are to be found [crayon-65767cdc63742806522978/] To make sure that output folders will be created as per required, let's print unzip commands with an echo using the command below [crayon-65767cdc63746987064287/] I hope this helps, if you come across some other way, please share it with others. … [Read more...]

Installing Latest MongoDB version on Ubuntu 14.04 LTS 15.04

How to Install MongoDB on Ubuntu 14.04 and 15.04 As we all know that MongoDB is becoming a default choice for certain part of community and is also emphasized as M in MEAN stack. Its an open source NoSQL database that is available free of cost and that you can make use of. In this article I will show you to quickly utilize official MongoDB repository to get and install most recent version of MongoDB.   Prerequisites You will need a running Ubuntu 14.04 server and a sudo non-root user, A great article on setting up such account can be found here What you need to do By default, MongoDB package is included in official Ubuntu package repositories, but this does not guarantee that its the latest version, so a better and recommended way to install MongoDB is to Import the MongoDB public GPG key used by the package management system. [crayon-65767cdc638af259199487/] Once you are done with above command you will see something like this Output [crayon-65767cdc638b2633239563/] Next Let's add Mongo repository details to APT, this is required so you have apt  remember where to find MongoDB the next time you want to update it. Use the commands below [crayon-65767cdc638b3431279845/] Let's now update the package list by using the command below [crayon-65767cdc638b4484165576/]   Next We install MongoDB by issuing the command below [crayon-65767cdc638b5122102702/] When installation finish,  you now have a MongoDB server, Mongo shell, and other Mongo tools such as mongoimport, mongodump etc You can now verify if MongoDB server s running by issuing the following command [crayon-65767cdc638b8105882356/] Helpful commands Stops mongo sudo service mongod stop Start mongo sudo service mongod start Restart mongo sudo service mongod restart You can read more on official Mongo docs website http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/ I hope this helps Cheers. … [Read more...]

Ace editor cursor position has space between expected position and the current position

Hi, I have used Ace editor a few times in my previous projects. Never did I face this problem before of having my cursor misplaced in my Ace editor. Let me guide you step by step Editor markup Here is a markup where I want my Ace editor to show up. [crayon-65767cdc63b05401585231/] Then I have this CSS that applies to the editor element CSS [crayon-65767cdc63b08936629454/] Above CSS allow my editor to take entire space within the document body or relatively positioned container. Then comes the Javascript to do its magic [crayon-65767cdc63b09665013510/] Now the editor will show up and I am able to do my thing. However I now have a unique issue where when I start to type the cursor position is a bit far from the text, so basically I have a gap between the expected and actual cursor position in my Ace Editor as shown below It turned out that Ace editor must use monospace font and I was setting fonts on a not so recommended way as shown below [crayon-65767cdc63b0a452090176/] Just to check things out and enforcing my editor to use monospace font fixed the issue instantly. This is what I changed my styles for my editor instance to which solved it. [crayon-65767cdc63b0b587962513/] I also ended up cleaning the way I was applying my fonts to all my elements by getting rid of * construct. I hope this helps   … [Read more...]

Online webpage to image conversion with ImgCake.com includes API

Hi Guys, I thought I would inform that there is a new tool available for taking screenshots of webpages called imgcake.com Talking about features there are many Unlimited renders/month High quality renders Custom window and shot size 30 days caching for web shots Delivery over SSL Webpages are rendered to either PNG or JPEG Enforce a new web shot to override cache Up to 10 referring websites per account Free Email support Custom user agent or accept language headers Reliable Flexible Cancel anytime First 7 days free Over 3000+ fonts supported This makes it quite appealing, so if you don't want to host your own screenshoter then this tool will help you out to get started. With Free support and anytime cancellation of your subscription it can't get any better. Renders are delivered over SSLto make it even more appealing. Render time varies as renders cannot happen until full page is downloaded. Try it out I bet you will like it. Regards     … [Read more...]

CommandLine Convert WMF, EPS etc to SVG using inkscape

Hello, I thought this might be a good tip to share for people who are looking to convert their vector images to SVG format. inkscape is the right tool just for that. Get inkscape from their website https://inkscape.org/en/ for you operating system Download it and install it. Make sure that inkscape executable to environment path. I am using windows but commands to convert any of the supported format to SVG is not different in any other operating system too. Example 1 Below is command to convert an EPS file to SVG file [crayon-65767cdc63d24593436835/] Above command will out test.svg file which you can view using any modern browser or SVG viewer Example 2 Command below will convert a wmf file to svg. Please note that wmf is primarily a windows format and this command will only work in Windows. [crayon-65767cdc63d27962425016/] So this is just a start you can explore more command line options available with inkscape from link provided in resources section of this article If you have anything else to add please leave your comment. Let others benefit from what you've done with your work or if you know of any other tool that is capable of doing better job. I will be writing a tool based on inkscape for batch processing files. Resources Command line options for inkscape inkscape website … [Read more...]

Installing New Comodo Positive SSL Certificate on Apache and OpenSSL on Centos, Fedora and RedHat

Hello, I had to buy a certificate and install it on my new server I was issued with a new certificate by Comodo under Comodo Positive SSL. To start with I think it doesn't matter which certificate you choose, end of the day they all follow pretty much same standards and the only thing that make a certificate expensive is a company or issuing authority such as thwate (expensive). I personally always choose a cheapest certificate on market. Anyway with latest certificate I received 4 files in an archive as shown below You could just install a certificate by adding [crayon-65767cdc63e2f025534777/] and it will work on some browsers but you would need intermediate cert as well. Here is what always gets me. With latest PositiveSSL They give us 3 files which we need to combine and feed it to [crayon-65767cdc63e31458670317/] So to do that you will run this command [crayon-65767cdc63e32540676826/] Considering that all you files are under /home/crt/2014 folder our final VirtualHost confg will look like this   [crayon-65767cdc63e33996558854/] Once you made above change, don't forget to restart your apache service generally located as /etc/init.d/httpd restart on Centos and Red Hat OS If you have any comment or would like to point out any error please leave your comments. … [Read more...]

Rackspace Cloud FIles Bulk Delete objects prefixed/* wildcard php sdk

Hi Guys   Rackspace cloud files is an awesome file storage system, We upload a file and can make it publicly available through their CDN. While I use Cloud files in pretty much all my projects at work or personal stuff, one thing that I did today was to delete objects with specific prefix e.g. Lets say I have these objects under container "jcorg" hello hello1 hello2 anothervaluableobject and I want to delete all objects whose name starts with hello Here is a code snippet that will be handy for you Language: PHP API link: https://github.com/rackspace/php-opencloud and of course you can use equivalent code in other language SDKs too     Code Snippet [crayon-65767cdc63fe0818121344/] Let me give you a brief overview to you First we are creating a connection to Rackspace server, depending on which region you are in you will use either RACKSPACE_US or RACKSPACE_UK to authenticate your request. [crayon-65767cdc63fe2536858529/] Then we are connection to our object store [crayon-65767cdc63fe6705055659/] Then we are getting hold of object list where name or an object starts with "hello" [crayon-65767cdc63fe7891468047/] Finally we are iterating on objects found and deleting them. You can check object name here to just to filter them out before you process them for deletion [crayon-65767cdc63fe8242673086/] I hope this makes sense, but just in case if you have a question, do leave your comment.     … [Read more...]

How to make xml_split, xml_merge, xml_pp, xml_grep, xml_spellcheck under XML-Twig tools work on Windows

Large XML files could sometimes lead to overall slowness of your program. Thus it makes sense to sometimes split them to rearrange contents within to optimize querying your XML files. This post will touch base on how to split a large XML file on windows OS and I will use a cool tool written by Michel Rodriguez. XML-twig is presumably an open source library that works on large XML files. Notable tools includes XML Grep XML merge XML pretty printer XML spell check XML split Our focus is to build this library on windows so that we can use it from windows command prompt Download XML-Twig Get this library from cpan websites. Here is the URL http://search.cpan.org/~mirod/XML-Twig-3.48/Twig.pm Download the XML-Twig-3.48.tar.gz file and extract it under c:\devtools Here is a screenshot of what it looks like on my machine   Lets leave it there for the time being and install prerequisites Pre-requisites There are a couple of pre requisites that you will want to install. Perl. As this library is written in perl so you would want to install Perl on your system. ActiveState perl is something that I sometimes use and is a good option by far on Windows computers. Download for your processor arch 32 bit or 64 bit from the URL below http://www.activestate.com/activeperl/downloads I installed it under c:\perl64 Visual studio Express 2010 for tool called "nmake" I've got Visual studio 2012 but you can get an express edition of "Express 2013 for Windows Desktop" from URL below http://www.visualstudio.com/en-US/products/visual-studio-express-vs#2010-Visual-CPP Now that perl is available from command prompt You may also want to run this command ppm install MinGW64 Above will install dmake as a perl module too just in case if you want to use that. But in this article I will use name.   That's it for the pre requisites and I hope that you would have installed both of the above so that we can move on to next … [Read more...]

Google MarkerClusterer Handling Multiple Markers On Same Geo Location

When you are dealing with addresses on Google Maps there are times when you have multiple addresses for a same location. For example if you live in a building with 200+ apartments, building address remains the same but you also add apartment number to your address to precisely locate you. Here are couple of address examples 1/991 Buleen Road 2/991 Buleen Road From the example above its clear that 991 buleen road is building address, 1 and 2 are apartment numbers. I would just use InfoWindow to go with MarkerCluster to show details of multiple points. Lets check out the code below   [crayon-65767cdc6424c828702292/] And that's pretty much it. Here is a working example of above code Two things to remember while doing above code You have to instantiate MarkerClustere [crayon-65767cdc6424e897132636/] While creating Markers, you can add any custom property to your marker, or hell of an amount of data, so when you create your info window, you have that data available. Also you can have a look at another way of handling it https://github.com/jawj/OverlappingMarkerSpiderfier I hope this helps or at least gives you a pointer what you should be doing for multiple markers for same location. Cheers,   … [Read more...]