Uncaught SyntaxError: Unexpected end of input error in Chrome

Today, while I was working with jQuery I ran on this error Uncaught SyntaxError: Unexpected end of inputĀ while troubleshooting my code in Chrome. And since Chrome it didn’t report error on any specific line I had to Google for it šŸ™‚

Uncaught SyntaxError: Unexpected end of input

And after opening few pages I found out that this error codes happens when you forget closing “}”. That can happen often when writing JavaScript code.

Locating that is not easy, especially if you’r code is sloppy and you have a lot of it. Luckily my code is always very nicely written so I got it solved quickly. But in case your code is really messy or is compressed (with some JavaScript compressing tool likeĀ jscompress.com) you can copy/paste your JavaScript code into jsbeautifier.org, click on Beautify JavaScript (select the options you want on the right side of the screen first) and see if all of the indentations are correct.

Beautiful and Geeky.


How to setup and use iptables

What’s iptables?

Iptables is the current Linux firewall and routing service. It controls incoming and outgoing network.

 

How to stop/start/restart iptables?

Basically just like any other Linux service:

serviceĀ iptablesĀ startĀ 
serviceĀ iptablesĀ stopĀ 
serviceĀ iptablesĀ restart

 

How to check if iptables is currently running?

Simply call service status

service iptables status

and check the result:

Firewall is stopped.

If the status message is “Firewall is stopped.” that means that iptables are not running and you should start it with sertvice iptables start. If you get some tables with bunch of geek stuff that means that iptables are running.

 

How to automatically start iptables service on Linux boot?

To enable iptables starting on boot run

chkconfig iptables on

or run code below to disable it

chkconfig iptables off

Continue Reading


Security by obscurity

This simple guide will help you secure your server in indirect way by hiding software versions from possible attackers. This can help you prevent many automated attacks and attacks based on software version number. If a hacker want’s to probe your system for hole he’ll start from collecting all version numbers from your running services. This guide will teach you setup common services not to give away their version numbers. This is called Security by obscurity and it’s not something to rely on but it can lower chances of getting your system hacked.

Apache (Web Server)

Let’s start with Apache first. It’s config file should at path

/etc/httpd/conf/httpd.conf

Open that with an editor of choice. For beginners I always suggest Midnight Commander but if you’re more experienced you can use antother editor like pico or vi. Anyway, in MC open file for editing by pressing F4 while the file is selected.

Locate those two lines and set it as follows. If you cant find them – add them.

ServerSignature Off
ServerTokens Prod

Server Signature will remove the identification of Apache version from error pages, and ServerTokens will identify Apache as “apache” without version number or OS information. Save the file and restart the Apache.

service httpd restart

Continue Reading


How to fix Midnight Commander line drawing in PuTTY

Midnight Commander is an awesome little file management tool. Learn how to install Midnight Commander. Folks that remember Norton Commander from MS DOS times know what I’m talking about.

Often problem with using Midnight Commander in PuTTY is that often it’s lines are messed up and look like this:

Midnight Commander in PuTTY with lines now rendered correctly.

This happens when because of charsets mismatch that uses PuTTY uses and MC. To fix this you’ll need to fix the charset in PuTTY. This guide however works only on sessions saved in PuTTY!

Here’s how to do it:

Continue Reading


How to install Midnight Commander?

Whats Midnight Commander?

Midnight Commander is Shell application (visual file manager) for SSH like Norton Commander, that older geeks may remember from the time of DOS, or like Total Commander, the most advanced Shell application today.

 

Why do I need Midnight Commander?

Midnight Commander will help you move more easily trough server files/folders, edit config files, copy/move/delete files/folders/whole directory trees, pack and unpack archives, search for files, run commands in shell… You can also use MC to connect to other server’s FTP and copy files from/to other servers. (can be useful when migrating from one server to another)

 

How to install Midnight Commander?

The easiest way is using yum or apt-get package menages: all you need to do is execute one command and it will install Midnight Commander and all it’s dependencies

Continue Reading