Showing posts with label tricks. Show all posts
Showing posts with label tricks. Show all posts

Sunday, November 13, 2016

Enabling C++11 in Eclipse Kepler/Luna CDT

When you are coding in C++ using eclipse IDE (installing CDT plugin)and if you use newer features of C++11 sometimes you might get errors when compiling. Reason for that might be you haven't enabled C++11 in Eclipse CDT. Lets see how to enable C++11 in Eclipse CDT. These steps are given assuming you are using GCC compiler. But steps are more similar to the other compilers as well.

Step 1 : Set up your compiler

  • Right click your project and click Properties
  • Under C/C++ Build click Settings
  • Under GCC C++ Compiler, click Miscellaneous
  • In the Other Flags box, append "-std=c++11" to the list of tokens
  • Click Apply and OK

Saturday, December 5, 2015

How to use google fonts in your html

When we creating a web page one of the main problem we face is using fonts we want in our web page. That is not easy because in order to display the correct font in viewer's browser that font should be installed in that person's device.
Otherwise our web page will not be displayed properly in viewer's device.
Using google fonts is the best solution for that.

How to use Google fonts

  1. Type the name of font that you need and find it (In example below finding "Bree Serif" font is shown)
  2. Change the appearance of your font (bold, italic etc)
  3. Click add to collection.
  4. After adding all fonts you want by following step 1 to 3 repeatedly click on use button.
  5. In the next interface scroll down a bit and find the CSS link for your fonts and include it in your html as a style reference (It will render those fonts from that link)


Now you can use font you wanted as <FONT FACE="Bree Serif">Bree Serif font</FONT>
Because of Google fonts you don't need to worry about viewer's installed font styles. You can use what ever font you need and make an attractive web pages.

Feel free to add a comment if something was not clear to you or you have something to add.

Thursday, December 3, 2015

How to use a long URL using bit.ly URL shortner

Some times we have to deal with very long URLs and that is very annoying. Here is a simple solution foe that. This not only shorten your URL but provide many other supports such as keep track of number of clicks on the links.

Here you go.
You can download this cool video by this link

Tuesday, November 24, 2015

Log into a website using a IP address from another country



Today we are going to talk about very interesting topic and that is how we fake our real IP address and log into a web site.

First let me briefly explain how this happen.

Normally when we surfing the web what we do is we send our HTTP or HTTPS requests to a particular server. In that case server can know our real IP and someone in our path can block requests goes to a particular server if that person want.

In this approach we send our request to a special type of server called proxy servers. After that that proxy server sends our request and send the response to us. What end server notice is request coming from proxy server and some one on the way to proxy server will think that we are going to proxy server, but actually we are going to proxy server to ask that server to do some thing for us  that is go to website we want.. :)



That is how it happens lets get into work,

  1. Type "http free proxy" and search in google
  2. you will find many site that give free proxy server addresses.
  3. Choose a good proxy server according to your needs.
    • different servers are in different countries.
    • some servers does't allow HTTPS connections.
  4. Change your proxy settings in your browser using proxy server IP and port obtain from a site
That's it and now you can use a proxy server from another country to get web sites for you.

NOTE:  Be careful If you are going to use proxy servers for login Facebook, G mail or other sites which you have to provide your secret credentials. Those servers will direct you to wrong pages and steal your credentials.

Friday, May 1, 2015

Install apps in your android virtual device

Some times we want to install built apps (apk files) in our virtual device.
It is simple we just have to copy that apk file in to platform-tools folder in Android sdk directory.
Then execute this command in command prompt in platform-tools directory.

            adb install appName.apk

"appName.apk" should replaced by name of the app that you want to replace.

see the following example screen shot.


Thursday, February 12, 2015

importing .sql file into a database using wamp



















when you have a sql file you can easily import it in to a database Using wamp.

1. left click wamp -> phpmyadmin
2. select database then click import (top right)
3. locate the database and click go.
You can use the command prompt as well. For that,

1. Run the cmd (DOS) and get into the mysql folder, which in my case works like this
C:\>cd C:\wamp\bin\mysql\mysql5.0.51b\bin
2. Then use this command to fire up MySQL

C:\wamp\bin\mysql\mysql5.0.51b\bin>mysql.exe -use databasename -u username -p

you should provide a password if you have one.
After that copy .sql file to directory where mysql.exe is located and run the command ,
mysql> source myfilename.sql;

Saturday, January 10, 2015

Add a syntax highlighter to your blog

If you are doing a blog about programming or some other stuff some times you need to put some code (e.g Java, PHP)in your blog post. so it would be very nice and easy to reader if that code segment is syntax highlighted.

So lets see how to add a syntax highlighter to your blog.

1. First you have to take a backup of your  blog template ( to use if something goes wrong).
2. Then click on 'Template' in the right side of the  page and click on "Edit HTML"(shown in the picture below).


3. After opening the blogger template copy the all CSS given in this link before </b:skin> tag.
4. Then you have to paste the following code before </head> tag.


   <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCpp.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCSharp.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCss.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushDelphi.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJava.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJScript.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushPhp.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushPython.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushRuby.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushSql.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushVb.js' type='text/javascript'></script>

<script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushXml.js' type='text/javascript'></script>

5. Then paste the following code before </body> tag.
<script language='javascript'>

dp.SyntaxHighlighter.BloggerMode();

dp.SyntaxHighlighter.HighlightAll('code');

</script>

6. Finally save the blogger template.
7. Now the syntax highlighter is ready for your page and your codes that syntax highlighting is needed should goes with in <pre></pre> tags as shown below.(code should be entered in HTML mode)

<pre name="code">
...Your html-escaped code goes here...
</pre>

<pre name="code" class="php">
    echo "I like PHP";
</pre>

This code will look like this,

...Your html-escaped code goes here...
    echo "I like PHP";

8. Here is list of supported language for <class> attribute.
9.If you want you can escape your code here 

now you can have a nice syntax highlighter for your blog

Saturday, January 3, 2015

Internet Connection එකක් නැතුව .NET Framework 3.5 Install කරන හැටි.

අපි අද පාවිච්චි කරන ගොඩක් Software ව්ලට ඕන් දෙයක් තමයි Microsoft .NET Framework කියන්නේ.එක එක සොෆ්ට්වෙයාර් වලට ඕන එක එක Frameworks :). ඒ කියන්නෙ සමහර සොෆ්ට්වෙයාර් වලට ඕන .NET Framework 2.0. සමහර සොෆ්ට්වෙයාර් වලට ඕන .NET Framework 3.5. මේ වගේ අවශ්‍ය Frameworks වෙනස් වෙනවා. ඒත් ගොඩක් Software වලට අවශ්‍ය එකක් තමයි .NET Framework 3.5 . Windows 7 තියනවනම් අපිට .NET Framework 3.5 අමුතුවෙන් ඉන්ස්ටෝල් කරන්න දෙයක් නෑ.මොකද Windows 7 ඉන්ස්ටෝල් කරනකොට මෙකත් ඉබේම ඉන්ස්ටෝල් වෙනවා.

ඒත් ඔයාලා වැඩ කරන්නෙ Windows 8 වල හරි 8.1 වල හරි නම් ඔයාලට .NET Framework 3.5 වෙනමම ඉන්ස්ටෝල් කරන්න වෙනවා.Windows 8 හරි 8.1 වල හරි .NET Framework 3.5 අවශ්‍ය වෙන ප්‍රොග්‍රැම් 1ක් run කරොත් ඔයාලා .NET Framework 3.5 ඉන්ස්ටෝල කරලා නැත්තම් මේ වගෙ Dialog box 1ක් එයි.




අපි Install this feature කියන Option 1 තේරුවොත් ඉන්ටෙර්නෙට් Connect වෙලා .NET Framework 3.5 Download කරල Install කරනවා.

නමුත් මේ ලිපියෙන් අපි බලමු Internet Connection 1 ක් නැතිව කොහොමද .NET Framework 3.5 Install කරන්නෙ කියලා.


  1. ඉස්සෙල්ලම අපිට ඕන Windows 8 ISO File 1ක් හරි Setup disk 1ක් හරි. අපි ලඟ තියෙන්නෙ ISO File 1ක් නම් Power ISO,7-Zip වගේ Software 1ක් පාවිච්චි කරලා ISO File 1ක Extract කරගන්න ඕන.(මේකෙදි ඔයාලට ලේසි විදිහකට Extract කරගන්න.)අපි ලඟ තියෙනනේ Setup Disk 1ක් නම් කරන්න තියෙන්නෙ නිකන්ම Disk 1 CD/DVD Drive 1ට ඇතුල් කරන්න විතරයි.
  2. ඊලඟට Command Prompt 1 Open කරන්න ඕන (As Administrator).
  3. ඊට පස්සෙ පහල තියන Command 1 Command Prompt 1කේ Type කරලා Enter කරන්න (කැමති නම් Paste කරන්නත් පුලුවන් :-) )
          Dism /online /enable-feature /featurename:NetFx3 /All /Source:F:\sources\sxs /LimitAccess 

     මේකෙ "F:" කියන්නෙ Setup Disk 1 තියන CD/DVD Drive එකේ Drive Letter 1.අපි අපේ System 1 ට අනුව ගැලපෙන Drive Letter 1 යොදන්න ඕන.

අපි ISO File 1ක් extract කරා නම් "F:\sources\sxs /LimitAccess " කොටස වෙනුවට ගැලපෙන File Path එක දෙන්න ඕන.

ඒ Command 1 execute කරපු ගමන්ම .NET Framework 3.5 Install වෙන්න පටන් ගන්නවා.ඊට පස්සෙ කරන්න තියෙන්නෙ Install වෙලා ඉවර වෙනකම් බලගෙන ඉන්න විතරයි.



   මේ ක්‍රමයට ගොඩක් ලේසියෙන්, Internet Connection එකක් නැතුව .NET Framework 3.5 install  කරගන්න පුලුවන්.









Optimize you working enviorenment : Single command to create & move to a directory in linux (C Shell, Bash)

Usually move to a directory just after creating is bit of a anxious task specially if the directory name is too long. mkdir long-name-of...