Showing posts with label Web Tutorials. Show all posts

Fixing WordPress Website Infected by .ico Malware

 More cases of WordPress websites being infected by .ico Malware are showing up and it is a difficult job to get rid of it completely and make sure site safe again, but it's not impossible. 

I wrote an article on fixing this virus problem before and it is recommended you check it first, it explains how to get rid of the virus by manual process simply by finding the strange looking PHP files and the .ico files which are spread across different folders, it makes it very hard to find if you are not someone who deals with these sort of things on a regular basis.

Just recently multiple websites were again infected by this malware, which in all instances caused the website's to go down and returned error messages like "There has been critical error on your website."

What does the malware do?

The malware may have originated from a compromised plugins (it happens a lot often on WordPress platform) which have now infected your whole server with strange looking PHP files in different folders which includes the core WordPress files and also the plugin files, when it does that a faulty plugin file can lead to your site going down, in some cases your admin dashboard won't be accessible in some cases the main site, and sometimes both. 

What to do now?

It depends on your experience in cleaning up sites and detecting infected files. If you are not a tech savvy person it might be difficult, best option is to hire somebody to do it for you and get it fixed completely. I have a lot of experience in this and if you want my help you can email me at depy45631@gmail.com and we can take it forward. 

For the developers, read this article, the cleanup process involves finding the strange files, you will know when you see one and also files with .ico extensions. Along with that I would definitely recommend the plugin MalCure which can save you a lot of time by helping you find the infected files so that you can clean it up yourself completely. 


Getting Rid of WordPress Malware (.ico Backdoor Malware)

Recently major malware campaigns on WordPress were launched, infecting and exposing vulnerabilities in many popular plugins which effectively affected hundreds of thousands of WordPress sites.

In this post we talk about a malware that affects the site by injected malicious .ico files at random locations, as well as index.php files and code snippets in core WordPress files.




One of the sites that I manage was affected by this malware, first course of action was to look for the problem being faced by other people, this article came up which was one of the very few links online that discussed the issue we face:

https://www.getastra.com/e/malware/infections/favicon-ico-malware-backdoor-in-wordpress-drupal

As discussed this hack injects files with .ico extensions in different folders. These ico files contain malicious PHP code which does all of the malicious tasks it is supposed to do, one is to spread the malware and infect further files.  Primary function of this malware is to redirect incoming traffic to some shady websites.

Steps that were taken

But did not work.

I tried finding the root cause, where it came from, which plugin caused but it was not very clear. However, I decided to take some steps to clean it which was to look for .ico files on the server, because some core files like wp-config.php, index.ph, wp-settings.php had the code these @include.. PHP which referenced to the actual files I was able to search for its location by decoding the Unicode text.




Using FTP I found the files which were in a deep folder:



After removing it we believed the problem was solved, but 2 days later the same problem was back, this time the .ico file was added to a different random location and the code injected into different core files.

What Worked

So far it was frustrating, like many on the forums who discussed this issue who woke up daily in the morning and checked for such files and cleaned it we too were doing just that, the malware kept coming back. 

Updating / removing plugins did not worked either. 

What work was cleanup of the core WordPress files completely. These WordPress files are files that are supposed to be intact and does not change with our changes. Follow these stes:

  1. Make sure you have FTP access to your site, also take backup of your files (any customized theme, plugins etc.)

  2. Delete these folders completely:
    wp-admin
    wp-includes

  3. When you delete the folders, also remove core files in the root folder where files like wp-config.php, index.php etc. reside. Make sure to copy contents of wp-config.php file as it contains details of your server / database.
  4. Download WordPress files from here: https://wordpress.org/download/ - unzip it and place it somewhere on your system.
  5. Now one by one first upload the files using FTP that you deleted from the root folder, make sure to replace important content in wp-config.php file.
  6. Now, it is time for uploading the entire wp-admin and wp-includes folder back. Use your FTP software to upload all the files. 
If everything is done right you should be able to access your site.

At this point all we can do is wait and see if the malware returns. In our case this method fixed the problem which makes it apparent that somewhere inside the core WordPress files the malware was injected and went unnoticed by security plugins like Sucuri and WordFence.

If you still face the issue even after trying this let us know in the comments. 

Spoiler Content Box for Posts in Blogger Blogs

It is difficult to warn users about possible spoilers in an article, if you are a blogger who blogs about TV shows, movies or books which are some common subjects of spoilers for its audience. Today you will learn how to implement a simple technique to handle spoiler contents on your blog posts.

Before you proceed any further you want to make sure that this is what you want to have as a feature on your blog, so try this live demo here



The best thing is that you don't have to write a lot of stuff to include it into your post every time, once you set it up, you just need the text content which is probably a spoiler, into a line of HTML which we will provide in the tutorial below.

Spoiler: This is easy to add to your blog!! See this.

It is a little addition, but we have created it to work on any kind of device a reader might be using so they get the best experience on your blog and keep themselves away from spoilers if they are unaware, following are some features worth noting

  1. Almost no work to do when adding these Spoiler box in your blog posts. 
  2. Works on Blogger, WordPress, basically it is all HTML and CSS, thus works perfectly fine on any kind of website. The tutorial is meant for Blogger though. 
  3. Your readers use mobile devices to read your blog? No problem, we got you covered, they just need to tap the boxes to show the hidden content
  4. Different colors! Match it with your blog's color scheme. 

Let's Begin The Tutorial

You are here, it means you have made up your mind and would like to continue adding it to your blogger blog (or probably other sites like WP). Before we begin these are some steps you should follow:

  • Backup your Blogger Template - In case anything goes wrong you can restore it to the way it was. 
  • Open a plain text editor in your computer (Notepad or TextEdit, if you have a code editor then it is a plus but that's optional!)
  • Coffee or tea? You choose :)
This tutorial is split into two parts, adding the CSS and then setting up the HTML, these are the only two things that you have to go through and we will give you a small hints about what's going on with each part so you don't feel lost. 

Adding the CSS

CSS is the language used on the web to style things on a website, it plays a major role in our spoiler content box, as it is the back-bone of how our spoiler content show/hide box is going to work.

Following is the CSS code we are going to use, this is the whole code, and is less than 2 kilobytes in size, that means no performance impact on your blog at all :

/*************************************
Spoiler Content Box
# By Deepak Kamat
# stramaxon.com
# depy45631@gmail.com

Get it for your blog at:
http://goo.gl/ZiJj3J
*************************************/
.spoiler {
position: relative;
border: 2px dotted rgba(0,0,0,0.1);
padding: 10px;
background-color: #ffe496;
margin: 10px 0;
}

.spoiler {
color: #ffe496;
color: transparent;
-webkit-transition: 0.4s all ease-in-out;
-moz-transition: 0.4s all ease-in-out;
-ms-transition: 0.4s all ease-in-out;
transition: 0.4s all ease-in-out;
}

.spoiler:hover ,
.spoiler:active ,
.spoiler:focus {
color: inherit;
}

.spoiler::after {
content: "{Click or hover to see spoiler}";
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background-color: #ffe496;
text-align: center;
font-size: 0.8em;
padding: 10px;
color: rgba(0,0,0,0.6);
font-weight: 600;
opacity: 1;
-webkit-transition: 0.4s all ease-in-out;
-moz-transition: 0.4s all ease-in-out;
-ms-transition: 0.4s all ease-in-out;
transition: 0.4s all ease-in-out;
}

.spoiler:hover::after,
.spoiler:active::after,
.spoiler:focus::after{
opacity: 0;
}

/* Colors */
.spoiler.green { background-color: #c8fbb8;}
.spoiler.green::after { background-color: #c8fbb8;}
.spoiler.blue { background-color: #bfe1ff;}
.spoiler.blue::after { background-color: #bfe1ff;}
.spoiler.red { background-color: #ffbfbf;}
.spoiler.red::after { background-color: #ffbfbf;}
.spoiler.purple { background-color: #e4bfff;}
.spoiler.purple::after { background-color: #e4bfff;}
.spoiler.black { background-color: #222; color: #fff;}
.spoiler.black::after { background-color: #222; color: #fff;}
.spoiler.white { background-color: #fff; color: #222; border-color: rgba(0,0,0,0.8); }
.spoiler.white::after { background-color: #fff; color: #222; }

Looks like a large piece of code? That's a very small snippet in comparison to what other plugins for these kinds of features takes.

Now follow these steps:

  • Copy the entire CSS snippet above and place it in a Notepad/TextEdit application
  • See how to add CSS to your Blogger Blog or,
  • Go to your Blogger Dashboard - Template - Customize - Advanced - Add CSS 
  • And paste the CSS in the text box on the right hand side, now click on the "Apply to blog" button
Once you have the CSS code in place you can proceed to the next section to learn how to make use of the CSS we added in a blog post. 

The HTML 

We have to tell the browser "Hey web browser, this is a spoiler box, please hide its text content!", unfortunately we can't tell it in English, so we use HTML, that's the markup language, if you have been working on Blogs for long you might have come across it many times, because it's what makes everything on the web!

Without further lesson on HTML, here's the markup we need, copy it, we'd need it in a moment:

<div class="spoiler">
The quick brown fox jumps over the lazy dog.
</div>

This is the base code we need, of course you want to replace The quick brown fox jumps over the lazy dog. to anything you want to appear inside the spoiler box, you can put images, text, headings, even videos!

Using the HTML

Follow these steps properly to learn how to add it to a blog post, you just have to carefully understand the process once and afterwards you would be able to easily modify the code as you like and add it to your posts.
  • Open a post or a draft in your blogger dashboard
  • On the top left corner of the post editor, you will see two buttons "Compose | HTML", click on the HTML button OR 
  • You could skip the above step by enabling "Interpret typed HTML" in the options in your post editor, on the right sidebar under Post Settings, click on Options and then choose "Interpret typed HTML"
  • Paste the HTML in the post where you want it to appear. That's it, if you pasted the code in "HTML" mode, switch back to "Compose" and you will see the text in post editor with no styles, don't worry, when you load the post on your blog the spoiler content styles will be applied automatically.

Applying different colors

If you like you can apply different colors to the spoiler box, there are 7 color styles, namely

yellow (default) | green | blue | red | purple | black | white

You can easily change the color of a spoiler content box by adding the name in the  class="spoiler" part. How? See the example below:

Default color:
<div class="spoiler">
...
</div>

Blue:
<div class="spoiler blue">
...
</div>

Green:
<div class="spoiler green">
...
</div>

And so on. You just have to add the supported colors name next to spoiler in the class attribute. If you know how to code CSS.

If you want to add new colors please let us know in the comments on this post and we will be happy to consider it if it is a good fit.

Generate Spoiler Content Box Code

Don't want to write the code each time you proceed to add it in your post? Use this generator to enter your desired content and get the code right away, works on mobile phones as well!



A small tool to make your life easier :)

What else?

A similar functionality that you might want to take a look at which also can be used for spoiler content show/hide effect: Expandable Section in your Post on Blogger

Stuck with something and don't know how to proceed? Please leave us a comment on this post and we will get back to you as soon as possible. Or found a bug in the generator? Send me an email at depy45631@gmail.com

Like what I am doing and want me to make something similar but more customized for your blog/website? I am a web developer and you can hire me.

Remote Debugging Intex Cloud Fx. (Firefox OS) using ADB and WebIDE on Firefox

Recently Mozilla's Firefox OS came to India with the brands Intex and Spice. If you are a developer and trying to test apps or debug your phone using ADB then you might have had a hard time. The official tutorial on Mozilla Developer Network just have listed the basic steps, but to make our Intex device work we need to get our hands somewhat dirty in code.

This guide is meant for Windows users only. Alternatively you can use the vendor ID for the Intex Device if you are on another system and just need the vendor ID.


Before we start, we need to have the following things:
  1. ADB and Fastboot - ADB is included in the official Android SDK, but it is about 800mb, and for one simple application downloading the whole heavy SDK wouldn't be a nice idea. So download this 15 Seconds ADB Installer from the link and install on your system.
  2. Mozilla Firefox 35+ - Currently Mozilla Firefox 35+ is a Nightly Build. But if you don't want to download an 80mb thing again, you can alternatively use the latest Mozilla Firefox which has the App Manager.
  3. ADB Helper Addon - Install the ADB Helper on your Mozilla Browser.
For now we just need these two things in order to get start. 

You need to learn a little bit about using Windows Command Line and ADB. If you know about how to use them you are all set to go!

Connect Your Device

Connecting your device is more than just plugging the USB cable. We need to make some changes on our device so it works without any problem.

Disable Screen Lock

If you have screen lock enable on your device, simply disable it by going to  Settings > Screen Lock (Under "Privacy and Settings")





Enable Remote Debugging

Disable USB Storage in your devices' settings before you enable remote debugging.

Now you need to enable remote debugging in the settings of your phone. Go to Settings >  Device Information > More Information > Developer > And under "Remote Debugging" choose "ADB and Devtools"



We Need USB Drivers for our Device

For ADB to detect our device Intex Cloud Fx. it needs its OEM USB Driers, but the problem is that Intex doesn't provide it, so bad.

But we have got a workaround. By specifying the vendor ID in the adb_usb.ini file in the ADB application directory we can get our device connected to ADB. Here's how:

The vendor ID of our Intex Cloud Fx. Device: 0x1782

Download this file: adb_usb.ini (Dropbox) 

Where to save it? C:// drive > Users > {username} > .android > Paste the adb_usb.ini file there.


Start ADB

Open the "RUN" window by pressing 
Window + R then type "cmd" and hit enter to open the command prompt window.


Now you must connect your device using an USB cable with all the settings mentioned above.

We are now ready to see if the devices is connected to ADB or not. Run the following command and see what it returns:
adb devices

If successful it will show something like:



If not, then you must try unplugging and then plugging the USB cable. Also try it on different USB ports too and check if you have done everything mentioned in the "Connect Your Device" section above.

Now we need to tell ADB to forward the port to the WebIDE or App Manager on Firefox browser to actually get started with debugging. To do that run this command:

adb forward tcp:6000 localfilesystem:/data/local/debugger-socket

You are done! Continue to the final step.

Open Firefox Browser (with either App Manager or WebIDE)

First let's clear the confusion between App Manager and WebIDE, on Firefox 33 and prior App Manager is the default app to manage and debug apps on Firefox OS, and in later version WebIDE replaced the App Manager.

See:
    WebIDE Documentation
    Using the App Manager

I am going to provide instructions for both application. The overall functionality of both the apps are similar, except for that WebIDE is newer it has more updates than the previous App Manager,

Connecting your device with WebIDE

Open your Firefox browser. Go to Tools > Web Developer > WebIDE or simply hit Shift + F8.


Now in the WebIDE Interface, click on the dropdown on the right that says "Select Runtime", if you can see "Cloud Fx." under the USB Devices, then simply click on it and it will get connect.



Else click on "Remote Runtine" and enter the port as localhost:6000 and the WebIDE will be connected to the device. If it succeeds the icon will turn blue and you can access the apps in your devices on the left pane of the user interface.

Now you can debug apps, install your own apps on the device remotely.

Connecting with App Manager

The process is pretty much the same. Connect your device with the adb command prompt first. Then open Firefox browser.

Go to Tools > Web Developer > App Manager 

At the bottom of the screen, you will see the device id in the list of connections available. Click on it and the device will be connected to the app manager.



When connected you will see something similar to this:


Yay! We are done. Now debug the way you want, but just don't damage your phone ;)

Fun things to do!

You can debug system apps like Gallery, Camera etc. And you can edit the HTML, CSS or JS of those apps live and can see the result on the device screen.

If you know HTML/CSS/JS you can really have fun tweaking things on your device. That wouldn't be permanent, as once you close and re-open it will go into its original state.

But you can create your own apps and install it on the phone. 

How to Open Developer Tools in Different Browsers

Developer tools or shortened DevTools are set of tools used for debugging web pages which is important tool for web developers and also general users who wants to inspect a page, make changes to the site on the front-end or analyse network usage by the webpage.

It is a all-in-one tool for a person who wants to learn what happening behind the scenes of a website. If you are new to it you may want to learn about, I wrote a post about using Chrome Developer Tools but if you need a more brief information about it see this
https://developers.google.com/chrome-developer-tools/

Chrome and Safari's developer tools are very much the same. But Mozilla Firefox has it's own unique developer tool set but using it is almost same as using any other developer tool.

Google Chrome

Google Chrome in my opinion is the best browser for web debugging using DevTools. DevTools are frequently updated and are simple to use.

Starting DevTools on Chrome

Starting DevTools on any webpage is very easy. There are three ways to open the console :

1. Select the Chrome Menu  > Tools > Developer Tools

2. Right click on a blank area of the page and from the list of options click on "Inspect Element" at the bottom. To inspect a particular element right click on the element and then select the inspect element option.

3. Another way to open the console is keyboard shortcut. Press Ctrl+Shift+I (Cmd+Shift+I on Mac) and the developer tools will appear.


Starting JavaScript Console in DevTools

JavaScript Console is used to run JavaScript codes on a page. It's often used to test scripts on a website to check if the code works well or not. But you can use it as a calculator or just try out JavaScript functions using it.
To directly open the JavaScript Console select the Chrome Menu  > Tools > JavaScript console or use the keyboard shortcut Ctrl+Shift+J (Cmd+Shift+J on Mac).

When the Developer Tool is opened select the "Console" tab on top to switch to JavaScript console.

Mozilla Firefox

If you are using Firefox make sure you have the latest version, as older versions don't include developer tools or if they do, they are old. Developer tools of new Firefox is way better than the older version and got some extra tools too.

Starting Developer Tools on Firefox

You can it by various ways. The most common way is to open it using Inspect Element option. Right click on a blank area on the web page and from the list options select "Inspect Element", the Firefox Developers tools will open.

Or if you can open it by going to the Tools menu > Web Developer > Inspector, this will open the developer tool in page inspector mode.

Opening JavaScript Console

Accessing JavaScript console in Firefox is similar to opening the page inspector. Open the Developer tools by right clicking on a blank area and then selecting the Inspect Element option. Now just switch to the "Console" tag on top of the dev. tools.

Or you can also open it through the tools menu. Click on Tools > Web Developer > Web Console or use the keyboard shortcut CTRL+SHIFT+K.



Apple Safari

Accessing developer tools on Safari is similar to as in Chrome. Some keyboards shortcuts might be different. Simply right click anywhere on the page and press Inspect element.

If you have any question ask it in the comments.  

Getting a Blog Address Already Taken but not Used

You all know Blogger is a free service and you need to pay nothing to get a free blog with your own unique blog address (with a .blogspot.com prefix) but not everyone's not that lucky to get their favourite blog address.
Blog address i s not a major issue but yet people badly wants their desired address for their blog. If you were not able to get a blog address because it's already taken but not used by the current owner, it's obvious to get frustrated. You want that address but you can't get it just because someone else owns it and they don't even write anything on it.

Contact the blog owner

Blogger don't delete a blog even it haven't been updated since 10 years , blogger doesn't delete a blog for inactivity. But don't lose hope you there are still chances to get the desired address. If you can find contact information on their blog, blogger profile or any other social networking site and if he/she is a friendly person you can ask him/her to transfer the blog address to your account.

But why transfer, Can't he just delete it and then I can create the blog with that address ? No! Don't do it or you will have to wait 3 months or more to get that blog address. When you delete a blog on blogger, it isn't deleted instantaneously, the user have 90 days to undelete it. So the blog address doesn't become available before 90 daysr. Read more here :
http://www.stramaxon.com/2012/07/blog-removed-url-not-available-blogger.html

And to learn how to transfer blogs between two accounts read this
http://www.stramaxon.com/2012/03/transfer-blog-from-one-account-to.html
http://support.google.com/blogger/bin/answer.py?hl=en&answer=41448

Can't contact the owner?

If there's no way to contact the blog owner you have less chances to get that blog address. Many people on Blogger Help Forum request Blogger to get them their desired blog address even if it's being used for an other blog, but blogger can't do it. Blogger can't harass owner for the blog address.

What should I do now?

I believe a blog address doesn't matter that much for a blog. You couldn't get a neat blog address like
flower.blogspot.com try something different like my-flower.blogspot.com there's no advantage or disadvantage in using any of those blog address, what readers really want is content. Read this
http://blogging.nitecruzr.net/2009/05/value-of-your-blog-is-based-upon.html


But if you still want a your desired blog address, consider buying a custom domain, which cost not more than $10 per year. Try GoDaddy, search for a domain from here



Or if you want a self hosted website, GoDaddy has those services too

Put your business on the Web for a buck a month!

Embed PDF or Docs File In Blog Posts

File formats like PDF, Docx, PPT etc. are used widely to share documents digitally. In this post we will talk about embedding or attaching such files into a blog post. This method can be used on any blogging platform.
Document files like PDF are used to share documents from one person to another but sometimes people needs to implement it in a blog post which can be shared with multiple readers.

You can even upload a document file on your host and then share the direct link but it's not a good idea to share the document like that, as it's not sure how Google or other search engines will treat the files. The best way is to embed the file using HTMLs <iframe> element. The idea is simple but procedure is long but once you understand the method you will be able to do it yourself.

Embedding Files

HTML is the language of the www and I am sure your blogging platform also uses HTML for posts. We will use the iframe element to embed the files on blog posts (using too many iframe or making a loop with iframe can make your website slow). Follow the instructions :

Uploading the File on Google Docs

First of all we need to upload the file to a host and Google Docs/Drive is the best for this purpose. Go to https://drive.google.com/ sign-in and click on the upload button (next to the Create button), browse to the file and upload it.

When the uploading is done click on the the share

Now a new box will appear, click on the 'Change' link under Who Has Access To It, again a new box may appear just select the Public On The Web radio box under Visibility Option and click on the Save Button. This will make the document visible to everybody, you can also specify who can view the doc. you just need to enter their email addresses. 

Getting the Embedding Code

After changing the visibility settings we will need the iframe code to embed it on a blog post. To do that click on the file and a new window will be opened, click on File on the menu-bar and then select Embed this PDF File or other file format, you will then get the iframe code. It may look like this
<iframe src="https://docs.google.com/file/d/0B2jVGjwW6nn5dWtKb000UnQ2eHM/preview" width="640" height="480"></iframe>
The URL in src attribute might be different.

If you want to change the width or height of the iframe just change the values in width or height attribute.

Implementing the code in Blog post

The final step is to use the iframe code. You can easily implement the code in a HTML file or a blog post from your editor. Make sure your blog post editor supports editing HTML. Blogger, WordPress and most of the Blogger platforms have HTML friendly blog post editor.
For Bloger
Open your post editor and you will see a button that says 'HTML', click on it and you will be in the HTML editing mode, so this is where you will place your iframe code. Paste the code anywhere in the post, make sure it's not between another format markup. Publish or Update the post and you can then view the document from your blog post.
For WordPress
The procedure is same. Switch to the HTML mode and place the code wherever you want the document iframe to appear.

That's it. You are done attaching document to your blog post. 

Your Feedback

Tell us how you got helped with this tutorial or how we can improve this tutorial. Drop your suggestion in the comments. 

Implement PrismJs Syntax Highlighting to your Blogger/BlogSpot

As the web becomes more open source and beautiful, programmers and designers are coming up with their own ideas. Syntax Highlighter is the most used code highlighter for websites since it was the first of it's kind and opensource. The web has changed then and now and you need a brand new Syntax highlighting plugin that really looks like the 2012's site
Last updated: 15th April 2017

Still wondering what's PrismJs ? Check it's official page for more information http://prismjs.com/, it's the second generation of syntax highlighting, it is more lightweight and that doesn't affect your page load time at all.


The overall adding procedure is the same as mentioned on the PrismJS official page but there are yet some modifications need to be made if you want it to work properly on Blogger blogs. In this tutorial i will provide the links to minified version of the codes, once you get the idea about adding it, you can use whatever version you want.

Include the files in your template

The first thing you have to do is adding the CSS and JavaScript files, to make Prism Syntax Higlighter work, you just need to add two files into your template and both are less than 10kb. That's a good thing for you Page Speed.

<link rel="stylesheet" href="http://prismjs.com/themes/prism.css"/>
<script type='text/javascript' src="http://prismjs.com/prism.js"></script>

And where to add this ? It is simple, just above the ending </head> tag. Go to your Template -> Edit HTML -> Proceed -> Use CTRL+F to find </head> and paste the HTML script and link tag just above </head>


Note : The links in the script and link tag is only for demo of the code, if you want to use different theme then you can download the version of your choice on PrismJS Download page, upload it to your hosting service and replace the links with your hosted file's links.

Now display codes in your post

Wrapping the display code into <pre> tag is normal for displaying codes on webpages and to display the codes in Prism style you have to do it like this way. (demo for codes display)


The following example is for displaying HTML codes in your pages, to define any languages you have to edit language-xxx
<pre class='language-markup'>
<code>
// Your HTML Code here
</pre>
</code>

Tip: You can add the class for a language to any parent element and the children elements will inherit the defined language. It is very useful when you just want to display codes of the same language in a page.

Escape HTML characters

But in Blogger you have to escape the HTML characters so it don't get interpreted as raw HTML. Use QuickEscape tool to convert Raw HTML into displayable HTML. For example, if you want to display this HTML code
<ul class='make-tea'>
<li>Tea</li>
<li>Water</li>
<li>Sugar</li>
<li>Milk</li>
</ul>
It should be converted into this, so you can paste it into the HTML mode of Blogger post editor to make it displayable
&lt;ul class='make-tea'&gt;
&lt;li&gt;Tea&lt;/li&gt;
&lt;li&gt;Water&lt;/li&gt;
&lt;li&gt;Sugar&lt;/li&gt;
&lt;li&gt;Milk&lt;/li&gt;
&lt;/ul&gt;
The whole code witth <pre> and <code> tag will be then look like this.
<pre class='language-markup'>
<code>
&amp;lt;ul class='make-tea'&amp;gt;
&amp;lt;li&amp;gt;Tea&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;Water&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;Sugar&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;Milk&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
<code>
</pre>
The HTML is then ready to be pasted in your post. In the post editor switch to HTML view and place the code but always remember to escape raw HTMLs.

Languages

To define languages you just have to change the language-xxxx in the class you can find in <pre> and <code> tags.
  • For HTML we will use this tags to wrap the display codes
    <pre class='language-markup'>
    <code>
    // Your HTML Code here
    </code>
    </pre>
    language-markup is used for HTML markups. You may use this for XML codes too.
  • CSS will be wrapped into this tags
    <pre class='language-css'>
    <code>
    // Your CSS Code here
    </code>
    </pre>
  • JavaScript can be wrapped into this
    <pre class='language-javascript'>
    <code>
    // Your JS Code here
    </pre>
    </code>
    JQuery can also be displayed with this.
  • Want to learn more than check out the PrismJS homepage

For Different Themes

The great thing about PrismJS syntax highlighter is that you can make the code blend with your site's overall theme by using different themes provided by PrismJS. There are the following themes available by default for it : default, dark, funky, okaidia, twilight, coy and solarized light

With a single addition of a CSS file you can change the theme for all PrismJS syntax highlighter instances on your blog.
In the first step we added the default theme,

<link rel="stylesheet" href="http://prismjs.com/themes/prism.css"/>
<script type='text/javascript' src="http://prismjs.com/prism.js"></script>

The http://prismjs.com/themes/prism.css in the first line of code sets the theme to default, while the following sets it to its corresponding theme.

Dark 
<link rel="stylesheet" href="http://prismjs.com/themes/prism-dark.css"/>

Funky
<link rel="stylesheet" href="http://prismjs.com/themes/prism-funky.css"/>

Okaidia
<link rel="stylesheet" href="http://prismjs.com/themes/prism-okaidia.css"/>

Twilight
<link rel="stylesheet" href="http://prismjs.com/themes/prism-twilight.css"/>

Coy
<link rel="stylesheet" href="http://prismjs.com/themes/prism-coy.css"/>

Solarized Light
<link rel="stylesheet" href="http://prismjs.com/themes/prism-solarizedlight.css"/>

Your feedback

I tried to put as much information as I can but if you find something missing or needs to be reviewed then please drop your comments. Also you can write to us on depy45631@gmail.com or see the contact page.

Switching to Custom domain effects existing backlinks ?

There are hundreds of questions in one's mind when he is going to change his blogspot or wordpress domain to their own custom domain.One of the most common question is about backlink, backlink is important for SEO and Pagerank, so this may always be a concern but is it really affects your backlinks ?

When switching to a new custom domain then it's obvious that you will see downfall of your traffic and believe me it's normal, you will again see your traffic back to normal when your page got crawled by search engine bots. But what about backlinks, will your old backlinks will be yet credited and help your SEO and pagerank ?

The answer to this question is NO, switching to custom domain doesn't affect your backlinks in any way as long as you are redirecting your blog to the custom domain from server side. The reason is that search engine bots not only sees the URL but get into the link and indexed the link redirected when visits that link.

It's clear that if you are pointing your blog to your custom domain then the backlinks of your .blogspot domain will even work for your custom domain, cause the bot is also redirected to the custom domain when it's crawling the url.

It means you never need to worry about the backlinks, it's obvious that you will see backlinks count fluctuated in Alexa because their system is different, Alexa is not a search engine bot so that doesn't even matter for you. I suggest you to use your .blogspot domain whenever linking from sites, that will make sure that if you again switch the domain to different domain name then the backlinks would work.

It will also not effect your pagerank, your pagerank will also be the same when Google crawls  your blog it will see your new custom domain after the redirection and that's when your pagerank will be also transferred on your new domain

It was that simple, this was a small post to let blogger and other users on subdomain provided by the service,  so it's safe for your search ranks and PR to get a custom on your blog as long as the redirection is made on server side.

  

Create Google like Scroll bar in blogger blog

If you look back at Google web pages back in mid 2011, they were simple just like a classic web page like other pages but 2012 seems to be a design year and that's why each and every big company painted their web pages with dynamic looks and features. One of the extraordinary thing about Google is it's scroll bars, they are just awesome and anyone wants to implement it, this tutorial will show you how to do that.

Many websites used the same design for scrollbar with different techniques, some with JQuery or etc. Many blogger users also wanted to use the same design for their blog but they were helpless as most of the blogger users just have basic knowledge of web languages so it was difficult for them to make such design on their own.



Before
After
This tutorial will teach you how to design the scrollbars like that in blogger.
Actually the trick is very simple, the scrollbars are design with new CSS3 scrollbar selectors which only works in webkit, unfortunately their's currently no way to make it work in non webkit browsers such as Firefox, Opera etc.

I have recently published 'Dream Blog V2' template in which i have implemented the scrollbar design. So here's the demo


Demo

The CSS

It is all CSS which do the designing on the scrollbar and you don't need to worry about heavy javascript codes, a simple CSS code block can do it. This is the CSS, you don't need to make any changes in this code but if you know what to do then you can change color and some values to fit your needs.
/* Webkit Scrollbar */
::-webkit-scrollbar {
width: 15px;
}
::-webkit-scrollbar-track {
background: #FFFFFF;
-webkit-box-shadow: inset 1px 1px 2px #E0E0E0;
border: 1px solid #D8D8D8;
}
::-webkit-scrollbar-thumb {
background: #646464;
-webkit-box-shadow: inset 1px 1px 2px rgba(155, 155, 155, 0.4);
}
::-webkit-scrollbar-thumb:hover {
background: #AAA;
}
::-webkit-scrollbar-thumb:active {
background: #888;
-webkit-box-shadow: inset 1px 1px 2px rgba(0,0,0,0.3);
}

Adding the CSS

Adding this CSS is easy, check this tutorial or follow these steps.
  • Go to Blogger Dashboard 
  • Select the Template tab
  • Click on Customize button
  • When you are in template designer, select Advanced
  • And from the Advanced menu select Add CSS 
  • Paste the CSS there and hit Apply to Blog. 
That's it, now clear and caches and reload your blog by hitting CTRL+F5 and you will see the Google like scrollbars on your blog, now when your readers ask you how you did it you can tell them about us :)

If you are facing any problems implementing the code then you can send us your message by dropping comments. 

Embed Slideshow in blog post from Picasa

Many Blogger users wanted to use a slideshow technique in Blogger, but they don't have the idea to do it. This tutorial will tell you an easy and working way to put slideshow into post.
Embedding this slideshow into your post don't require you to use some heavy codes. Or you don't have to insert each and every image url in the source HTML yourself. This slideshow gadget provided by Picasa uses flash embed to put the slideshow on a page, so it's only displayable if you have Flash Player installed in your browser or computer system.
Just follow these steps which is a 2 minute work.

Procedure to add the slideshow

If you are using blogger then the photo you upload into your posts are actually stored on your Picasa Web Albums. The half of the work in done inside Picasa Web Albums, follow the steps
  1. Log into your Picasa Web Albums with your current Google account. 
  2. When logged in you will see a upload button on top of the page,click it to upload your picture

    picasa web album homepage upload button

  3. A new page will be opened, name your Album and selection the files you want to upload by either clicking 'Select photos from your Computer' or dragging and dropping the pictures in the box. Just a quick example of it here.

    album create in picasa
  4. When the photos are successfully uploaded you now have to make the album Public, because photos uploaded directly through Picasa site are turned to private. You will see the privacy settings on right side (if it's already public then you can leave this step)
    Click on the Edit > And when a new box appears, you will see a dropdown menu under 'Visibility', select 'Public on the web' and Save changes.

    privacy settings edit album picasa

    album edit information picasa
  5. Now you will see some extra options on your right sidebar after turning the album public (by following above step), you will see 'Link to this Album' > Now click on 'Embed Slideshow'.

    picasa albums slideshow embed
  6. A pop-up will appear after you click on 'Embed slideshow', choose your settings. I recommend you to use the Large one, that's ideal for a blog. You will be given the code, click on the Yellow text area and copy the embed code.

    slideshow gadget configuration in picasa photo albums 
We have now completed the 80% distance.
Implementing the code in blog post
To implement the code into a blog post, create a new post. You have to switch to the HTML mode and then paste the copied embed code from Picasa into the HTML of the post. Switch to compose mode to see how it is looking.

Tip - If also want to have texts in your blog post (obviously) then first put the embed code in HTML mode and then enter a character after the embed code of slideshow. When you switcht to compose mode you will have the character in the Compose mode to get a text writing point in the post.
Tip - Not only in post but you can also embed this gadget anywhere into your blog or website by placing it in the right place.

Yay ! That's great you have your own slideshow in your post. If you are a photography blogger then this tutorial will help. Drop your comments on how was this tutorial helpful to you.  

    Disable users from selecting text and images on blog/website

    Bloggers using tricks to disable right click are benefited in ways. They may have surely get red of their content being copied.
    There are more steps you can take to make your content secure and can disable others from copying it. I posted a tutorial on disabling right click but there more techniques you have to use to protect your content better.

    Demo

    We can disable the selection of text or images on any website or blog to disallow others from copying your contents. It can be done with CSS easily. You just have to make some small customization depending on your needs.

    body {
    -webkit-user-select: none; /* Chrome all / Safari all */
    -moz-user-select: none; /* Firefox all */
    -ms-user-select: none; /* IE 10+ */
    -o-user-select: none;
    user-select: none;
    }
    The above CSS will disable selections on all elements including text, images, tables etc. Learn from the examples below  


    This CSS will work in Blogger, it disables selection on all elements in a post. Means users will be able to select every element on sidebars,headers and other parts of the blog except the .post-body area.
    .post-body {
    -webkit-user-select: none; /* Chrome all / Safari all */
    -moz-user-select: none; /* Firefox all */
    -ms-user-select: none; /* IE 10+ */
    -o-user-select: none;
    user-select: none;
    }
    The CSS below will only disable selections for images in the whole document, cause i have put body in the selector.
    body img {
    -webkit-user-select: none; /* Chrome all / Safari all */
    -moz-user-select: none; /* Firefox all */
    -ms-user-select: none; /* IE 10+ */
    -o-user-select: none;
    user-select: none;
    }
    Or if you want to disable selection for images in post area only, then this CSS will work (for Blogger)
    .post-body img {
    -webkit-user-select: none; /* Chrome all / Safari all */
    -moz-user-select: none; /* Firefox all */
    -ms-user-select: none; /* IE 10+ */
    -o-user-select: none;
    user-select: none;
    }

    This was a quick overview on the user-select CSS property and the way to disable selection on elements. If you want to apply CSS on your blogger blog can check this tutorial.


    If you want the disable selection for elements in a specific part of your web page then you use chrome developer tools to know it's class and put it into the selector area of CSS code.

    Disable right click without JavaScript

    There are many JavaScripts that can disable right click on a website or blog, but JavaScripts can be bypassed in many ways and just to reduce the chances for copy-cat to copy your contents use the disable right click technique along with the technique in this tutorial.
    http://stramaxon.blogspot.com/2012/07/disable-right-click-without-using.html

    Disable right click without using JavaScripts

    Disabling right click on websites and blogs are very popular nowadays just to ensure that no one can copy content from their website.
    Using JavaScripts provided by many websites on blog or website to protect content from being copied is very popular. JavaScripts can be of different types depending on it's author, they can put whatever they want and block right click on webpages.
    But JavaScripts have it's own bad effect on blogs, because most the JavaScripts provided to disable right click on webpages sends out an alert message whenever someone right clicks and it is irritating. And JavaScripts can be easily bypassed and allow the right click.
    So what you want is a hassle free way to stop peoples from right clicking on your page and copy your contents.

    One benefit of having right click disabled is that you can stop most visitor from copying your contents, but there can be some people knowing ways to bypass it, but hope you don't have such visitors who will copy your content.

    The real trick

    Almost everywhere you will see tricks to disable right click using JavaScript, but if the user disables JavaScript they can easily use right click on your website without any difficulties. JavaScript is not an ideal way to do it.
    We have got a new way to disable right click without any implementation of JavaScripts that can slow down your page. I came to knew about this while I was in a net banking site, just used the chrome developer tool tools to inspect what they used to disable right click and found it.
    It was a small attribute in the body tag of the document. So follow the steps to do it on Blogger, this can implemented on any website, just find your main HTML and add this attribute in the <body> tag.

    Demo

    For Blogger Users - 

    1. Go to Blogger Dashboard
    2. Select Template tab
    3. Click on Edit HTML > Proceed
    Now click CTRL+F and find enter this <body into the search box, you will find something similar to this



    The
    <body> tag is just below the ending </head> tag. Now when you find it, copy this small code snippet or a short code word.
    oncontextmenu="return false;"

    When copied, go back to the Edit HTML of your Blog and paste this after
    <body with a space in between. So it must look something like this


    Once you have added the attribute in the body tag refresh your blog with CTRL+F5 and try to right click, now you have right click disabled on your blog/website ! Great, people can't copy your content.

    Negative points in using JavaScript for this ?

    You can rank JavaScript 2nd to play the trick of disabling right click on a website but there are some negative points of JavaScript. Read those below
    • Most JavaScripts uses alert message which can annoy regular users
    • If the page load is interrupted when the page is loading then JavaScript don't work which will result in letting others copy your contents with right click.
    • Those who want to copy the content they can disable JavaScript in their browser and they can copy the content again. 
    • JavaScript slows down the page loading speed 
    So, these were some negative points of using JavaScript to disable right click, simply use the small attribute to make it work like the JavaScript does.

    Will it completely disallow the user to copy contents ?

    You must accept the bitter truth that there's no technique which can keep everyone from copying contents or pictures from a site. They can use many ways to do this, but if you don't have some wicked minded people on your blog then it's guaranteed that your content will be less copied from your site. Using this trick is better than not using it.
    • Additionally you may also disable text and image selection on your page for better protection - Click to know about it

    Your feedback

    As always your opinions and feedback is important for us because you are the one who makes our post more valuable and worth reading. Drop your comments to express your thought on this tutorial.

    How to use Chrome developer tools

    Chrome is the best browser for any web developer like me, it's just all i want to discover new things online such as new designs and techniques to make the web better. So, today i will give some basic tips on using Chrome developer tools to understand your own website/blog structure better.
    In most of the tutorial for blogger, it's straight that the selectors will be the same in all classic blogger templates and that CSS or JQuery can be used globally on any blogger blog and that might work well.

    But when you are using a custom template for your blog or website then you don't know what selector to put the CSS or JQuery and that's frustrating, but ever wondered how we know what selector you must use on your blog for a particular CSS or JQuery ? Now it's clear that you know, it's Chrome developer Tools.

    Chrome developer tool is one in all complete tool to understand the structure of a page and see the complete HTML. You also get to see what files are loaded with the site load and also you can monitor the network condition and how files are loaded. That's why i love using the Developer tools. Here is how it looks (opened for blog page)


    chrome developer tools


    Whenever you open it you will see some beautiful codes and i just love it !

    How to open it ?

    When you want to experience better web developing with Developer tools then always use Chrome, browsers like Firefox also have their own developer tools inbuilt but not too effective.


    To access the developer tools in chrome, find a blank space or an element in the webpage and right click on it, you will see 'Inspect Element' in the menu (usually at bottom), click on it and you will get your developer tool opened. Now you will get the first feeling of a web developer.

    Using it 

    You can't make use of the developer tools if you don't have any plan regarding it. But yet you can look at the structure of a website to know more about it. It's more than just source code of the website, you can edit the website by changing the HTML markup on the elements page and the changes are made in real time but the changes are only for you, editing the HTML markup doesn't mean that the changes will be made for everyone viewing the website. Not only HTML, but you can also apply CSS and JavaScript on site, it's useful for testing a code before you apply it on your web page. 

    Elements

    Elements tab shows you the elements of the webpage your inspecting in HTML and on right sidebar you will see the matched CSS rules on the element you are inspecting. You can edit the HTML by right clicking on the HTML markup and edit HTML or double any HTML line to change it.

    Resources

    This the best place for me, because i can test my developed CSS code without bothering to apply it on the web page and then test. Actually the resource tab is for seeing the files externally with the website, such as JavaScript, CSS, Fonts and images files which you can call resource for the website.

    chrome developer tools resource

    You can see that i am editing a CSS file in my website and that's how i test new CSS. If the website you are inspecting have a stylesheet file then you can edit it freely or add new CSS to it to test a CSS before you apply it.


    Similar to the CSS file you can see JS, Fonts and images files too.  

    Network

    As the name suggest, it's related to network. It shows you how your browser loaded the content and is the condition ok. I don't use it much but it's help for people who really need help with their network monitoring.

    More other tabs

    There are more other useful tabs in the chrome developer tool, which is very useful when you want it. You can discover more with the developer tool and even if you aren't a tech savvy person you can learn the basics of web development yourself and then basic is all you need to get to the next level.

    Your feedback ?

    This post was written to help people inspect their websites for better and fast development. Your feedback is important for us to improve our content and know more about how are we doing. You may drop your previous advice and thought in the comments. 

    Anonymous comments on Blogs, beware it's spam

    Spam, some hates this word and some who are used to spam loves 'spam'. I had previously written some articles on referral spam, which helped thousand of people to understand what is it and avoid it. But now when it's fading out a different spam took over. 
    Comments in every blog is a way to give your feedback on the post and it's very useful. But what will we do when it's also spammed. Imagine how your blog will look with full of spam comments with random links into it. Almost all types of spam's target is to make the victim click on their link, but as always never click on those links.


    Spams comments done by 'human' is understandable but in this case it doesn't seems like these comments spams are being done by a human. These new spammers are very smart, they only post one comment on the post whenever it's published. The comment contains some self praising sentences with a link to a mysterious site irrelevant to your blog topic.


    I noticed that they post such comments that readers would want to visit the link in curiosity. As an example you can see this email notification (can't show the actual comment because i am using disqus)


         
    You wondering how can i say that these comments are made by computer bots ? I am using Disqus comment system in my blog but these spam comments are yet made on blogger comments system. So this concludes that the comments are automated and done by a bot but behind all these there must be a human at least.

    Be safe and avoid these comments and links in it, you may also mark these comments as spam to help blogger understand that comments with the links in it are spam. Also teach your readers to mark these types of comments as spam.

    To keep our blogosphere clean we need to fight with these spammy things which is common now, use your common sense and just take actions that may not harm you.