Windows: Copy only files recursively from a folder containing sub folders


windows
What this post is all about?
This post is basically to serve a way to copy all or some files at once from a folder containing one or multiple sub-folders.

Which OS are supported?
Windows 7, Windows 8, Windows 8.1

What is the situation, by the way? Can we have an example ?
Let’s create two folders named Folder1 and Folder2 on desktop. Then copy some files in to Folder1. Create few sub-folders inside this folder and again copy few files to each of the sub-folders. Now what we may want to do are:

  • Copy all the files from Folder1 and its sub-folders to Folder2
  • Copy specific types of files from Folder1 and its sub-folders to Folder2

Is there any solution to this requirement?
Yes ! :)

Is it a simple one?
Yes ! Very much. Indeed, You know this already :P .It’s just a simple trick to what you already know.

Then you are waiting for what? Show me !
Okay. I have few pdf files in each level of the folder hierarchy in Folder1 as shown the fig. below .
a1     a2   a3

Now I want all these pdf files to be copied to a4Folder2 at once. Here is the trick then: open Folder1 and search for *.*

Select all files (by pressing CTRL+A) and exclude all the sub-folders, copy (CTRL+C) and paste (CTRL+V) on Folder2 . This solves our first purpose.

For the second purpose, you only need to change the search pattern to *.<file extension> instead of *.* .For Example- *.pdf . This will list only the pdf files automatically excluding the sub-folders.

Hopefully you liked reading this little post. I really welcome all kind of feedbacks and suggestions.

Thanks for reading !

Photoshop: 10 simple steps to create soft edged border effect


fadeedgeThere are very few simple steps need to follow if you want to have fade out kind of effect which makes the edges look soft using Adobe Photoshop. This is a very popular effect when you want to merge an image to another background so that the new image fits or adapts to it’s new environment resulting a WOW effect.

I have tried all my best to keep this post simple so that even a guy who has no experience of Photoshop can do the trick. What you need to do is to walk through the procedure step by step.

Tools Needed : :) You are right !   Adobe Photoshop
Skills Needed : :( You are wrong ! Nothing

Now, without twisting the story much, let’s get started with step 1.

STEP 1:
Choose 2 Images. For this demo I have picked following two images, first is a simple one with a beautiful quote and the sweet smiling kid borrowed from source: http://www.adorabletab.com .

sweetkid

Image 2

quotedimage

Image 1

You may download these images to your PC by simply clicking each of them or you may choose any other two images of your choice.

STEP 2: Open Image 1 with Photoshop.

STEP 3: Drag Image 2 and place just on the Image 1 opened with Photoshop.
901

STEP 4: Drag/Move this image to your preferred location on the Image 1 . You can resize the image too by stretching the corners of the Image 2 (with shift key to maintain the aspect ratio) . Then press Enter key to place the image.
902

STEP 5: Select the Elliptical Marquee Tool .
903

STEP 6: Create a marquee selection by dragging around the area of the Image 2 you want to keep which will be visible above the Image 1.
904

STEP 7: Click on the Add layer mask button at the bottom of the layers palette.
905   906

STEP 8: Go to Filter Menu and select Blur and then Gaussian Blur .
907  

STEP 9: You can use the slider to increase or decrease the intensity of blur .
909

STEP 10: WAIT ! Are you seriously waiting to follow the 10th step ? :D :D Okay. Just click the Save from File menu and save the file to the format you want.

And yes, don’t forget to drop few lines for me regarding how you liked :) or disliked :( the post.

Thanks a lot for reading !

CSS: Drop Caps


css-dropcapsDrop caps is a very old technique of styling first letter of the paragraph or article, commonly used by News Papers, Magazines etc. With CSS we can achieve this requirement. Let’s have a look on the following example.

The pesudo-element :first-letter will do our job. This CSS selector can only be used with block level elements.
Example:

CSS
<style>
    p:first-letter {
        font-size: 400%;
        float:left;
    }
</style>
HTML
<div style="width: 40%;">
    <p>
       MVC framework will really helps you to develop the project rapidly, if you know one framework well then you’ll never worry about the project deadline. You will write less code, which means less time spent typing. You will not have to chase down 3rd party libraries all the time for every new project because most of them will come with the default framework install.
    </p>
 </div>
RESULT

blog1
You can apply other CSS styling too like background-color,, color, border etc to make it more beautiful.

Hopefully, this short little tip will be helpful.
Thanks !

C# Corner Full Day Technical Seminar at Bhubaneswar


c_sharpCorner1It was the first technical event (as far as I know) at Bhubaneswar of this kind. As the title suggests, yes, it was a full day technical event organized by the Bhubaneswar chapter of C# Corner. On 16th of August 2014, I attended this event with 2 of my colleagues at CET college. This event was basically arranged for the Computer Science & IT students to give them some brief idea about the latest technologies.

The session started as per the schedule with little delay. The first session was delivered by the first MVP of Odisha, Tadit Dash on “Introduction to ASP.NET“.tadit Then we had two more good sessions on “Building Rich UI with jQuery in ASP.Net applications” by Ashutosh Mahto and “Intro to HTML5 and bootstrap” by Balakrushna Swain.

Then after lunch break, Nirmal Chandra Hota spoke about “Developing Mobile applications using Xamarin“. During this session, when there was power failure for few minutes, everybody came near to his laptop where he demonstrated few simple yet exciting demos and this describes how everybody loved his presentation. Everybody was sure that it was going to be a very interesting session when he started his session with this funny video to describe the role of interpreter.

The last session was on “Building your First windows phone app” by Biswa Pujarini Mohapatra.

There were quizzes & goodies for correct answers too. csharp3I was fortunate to get a c# corner t-shirt for answering a simple question.

Looking forward to more events of this kind for professional developers.

Thank you so much C-Sharp corner, all the speakers and volunteers !!!

Why to use Framework in PHP ?


Pravasini

<?php $are_you_a = $_POST['man']; ?>
/* by unknown */

Introduction:

A Framework is a universal, reusable software platform to develop software applications, products and solutions. In other words, we can say it is some kind of library, a piece of software, which provide web developers with code base and consistent standardized ways of creating web applications.

Back when PHP and other technology started, developers were writing their own custom code for each functionality. Then after, some people realized that, writing the same code every time, not reusing it extensively, plain PHP is not so effective.

Afterwards, as the PHP object model developed (especially with the launch of PHP 5), framework development really came into action and became so popular.

Most of the popular PHP Framework provides you with the following capabilities:

1. Code and File Organization
When you setup a PHP Framework, it already has a certain folder structure. Most of the Framework, use MVC (Model-View-Controller) guideline or structure for managing the code. MVC
pattern allows to separate business logics and presentation layer of your website, making its structure consistent and maintainable. It is expected from you to follow the same standards and keep everything organized in a certain way. Once you get used to this model, you will never want to go back.

2. The MVC Pattern
The Popular PHP frameworks like CakePHP, CodeIgniter, Zend Framework , Symfony follows Model View Controller(MVC) design pattern which separates business logic from user interface making the code cleaner and extensible. The way the MVC Pattern applies to PHP applications:

  • Models represent your data structures, usually by interfacing with the database.
  • Views contain page templates and output.
  • Controllers handle page requests and bind everything together

3. Enforcing of Good Coding Standards
Another effect of using Framework is maintaining coding standard in an efficient manner. Coding conventions are a set of guidelines for a specific programming language that recommend programming style, practices and methods for each aspect of a piece program written in this language. Using Framework makes it so much easier to code as you should.

4. Utilities and Libraries
PHP is a great language for web development and provides countless number of tools and libraries. As everybody can guess, these frameworks contains a lot of libraries to make your job easier. All top PHP frameworks come with certain Libraries and Helpers, that help you with:

  • Form Validation
  • SOAP/REST API
  • Caching Mechanism
  • Input/Output Filtering
  • Data Handle With JSON
  • Database Abstraction
  • Session and Cookie Handling
  • Email, Calendar, Pagination etc…

5. Less Code & Faster Development
These MVC framework will really helps you to develop the project rapidly, if you know one framework well then you’ll never worry about the project deadline. You will write less code, which means less time spent typing. You will not have to chase down 3rd party libraries all the time for every new project because most of them will come with the default framework install. While working on a large project in a team, these MVC PHP framework will be a great tool for development as you can assign a developer to develop MVC part of a module for a developer and integration will be quite easy of these developed module at final level. Also, since you are being more organized, it will be much faster to chase down bugs, maintain code, and make changes to existing code.

6. Community Support
All popular PHP Frameworks have great active communities behind them. There is no lack of support from the community, the documentation, and the developers. If you have any questions or need any clarifications, a quick search with the right keywords should almost always give you relevant results. If not, there’s still the message boards, mailing Lists, the official and unofficial forums or the unofficial IRC channel.

7. Security
With a framework, most of the work for code security can be done for you automatically. For example:

  • Central Authentication
  • Any value passed to database object gets filtered against SQL injection attacks.
  • Central input validation and filtering
  • All html generating functions, such as form helpers and url helpers filter the output automatically.
  • Cross Site Request Forgery (CSRF) Protection
  • Session Management Security
  • Cross Site Scripting (XSS) Protection
  • Encrypting cookies automatically is only a matter of changing a config option and lot more…

8. Performance Tools
Framework tools are utility module for maintaining modular application. You can actually gain perCode generation make developers life easier by creating files and default content automatically so you don’t have to do the same thing again. Framework come with tools that help you to do caching, benchmarks, profiling etc… Modern frameworks are also great with dynamic loading, as they load code only as needed. Lazy loading concept is also there, to make the web page ready, till the time content is ready. Different page requests can load different amount of library code based on what needs to be used.

9. Simplified and Pretty URLs
Most Framework use a bit of mod_rewrite magic to ensure, your URLS are always clean and accessible. Apache handles requests to a particular URL, and (hidden to the client) returns this URL to /index.php as a GET string. The index page instantiates your main framework object. Accessible URLS also help with SEO. URLs are great for below reasons:

  • They look prettier
  • They are easier to remember
  • They help you save filespace on pages which have many links
  • They are easier to link to, both for you and for other webbies
  • They help cut down on typos because there is less confusion about what exactly to write and type

10. Efficiently Access Database
Framework provides the way to access database in an object-oriented way. Instead of directly interacting with the database using SQL queries, you can use any Object-Relational Mapping (ORM) model to manage the structure and relationships between your data. With ORM model, you can map your database table to a PHP class and a row from that table is mapped to an instance of that class.

 Conclusion:
You might not opt for using PHP Framework or using a Framework may or may not be the best choice for you. But, if we are believing with the word “Performance Really Matters”, then we can try for any popular PHP Framework, and that will be even easier and robust way to develop applications. Frameworks are cool and easy, and we can’t tell what tomorrow is going to bring. I hope this blog will help you to understand what are the advantages of using a Framework and will value Developers.

Thanks :) and will be happy to listen from you :).

MySQL: Condition based sorting


AscDescIntrioduction:

Sometimes we need to sort a result set based on some conditions. Let’s take few real time scenarios and than try to resolve these with the help of CASE WHEN. Scenario-1: Sometimes we need an element to be placed at bottom of the list. For example, a Dropdownlist containing educational qualifications may contain  an item “Other”. While showing all the educational qualifications from database we may need this particular element (i.e, “Other”) to be moved to the bottom of the list. If we try to sort this list using usual ORDER BY keyword then we may not get the desired sequence. To get the desired result we need to use CASE WHEN keyword along with the ORDER BY. Let’s illustrate this with an example- Simple ORDER BY :


SELECT * FROM
(
 SELECT 'I.Sc.' AS Qualification
 UNION
 SELECT 'B.Sc.' AS Qualification
 UNION
 SELECT 'Other' AS Qualification
 UNION
 SELECT 'P.G.' AS Qualification
 UNION
 SELECT 'MCA' AS Qualification
 UNION
 SELECT 'DCA' AS Qualification
 UNION
 SELECT 'P.H.D' AS Qualification
) AS TBL
ORDER BY Qualification

OUTPUT: 5         ORDER BY with CASE WHEN :


SELECT * FROM
(
 SELECT 'I.Sc.' AS Qualification
 UNION
 SELECT 'B.Sc.' AS Qualification
 UNION
 SELECT 'Other' AS Qualification
 UNION
 SELECT 'P.G.' AS Qualification
 UNION
 SELECT 'MCA' AS Qualification
 UNION
 SELECT 'DCA' AS Qualification
 UNION
 SELECT 'P.H.D' AS Qualification
) AS TBL
ORDER BY CASE WHEN Qualification='Other' 
THEN 'ZZZZZ' ELSE Qualification END

OUTPUT: 6           EXPLAINATION: Here we have set the value of item “Other” as “ZZZZZ” while the sorting is being done. Generally “ZZZZZ” will be the last item in any real world list and hence will move to the last. Scenario 2: In some other cases we may need the desired item to be moved to top of the result set. An example for this situation can be, a Dropdownlist containing items for Book Category. The list may have an item with text “General” , which is meant for those books whose category is not clearly known. Let’s assume that most of the books are supposed to be of this category. Then we have to place this item in the first index of the Dropdownlist so that it will be easier for user to pick the item. Now, we need a little modification in the ORDER BY clause as follows.


ORDER BY CASE WHEN Qualification='General' THEN NULL ELSE Qualification END

Please share your feedback ! Thanks   You may also like :

Creating a simple stored procedure in MySQL

CodeProject

CSS: Under-utilized content property


css

#Batman {
background-color: black;
clear: both;
visibility: hidden;
content: “I’m Batman”; }  /* @CSSHumor */

Introduction:

In this post we’ll discuss about

  • (The Theory) use and importance of CSS property – content
  • (The Magic) creating printable links using CSS content and pseudo-elements

If you are not interested in ‘The Theory’ which is available in almost all CSS books and web tutorials like w3schools.com, you can start with ‘The Magic’, the feature which motivated me to write this blog post.

CSS ‘content’ Property:

The primary use of CSS is to describe the presentation semantics of an HTML documents but, we can also use CSS for content generation. With content property we can inject a piece of information to an existing document. We have to use content property along with pseudo-elements like :before, :after etc.

Example:

I feel, the best use of content property is to inject the URL of a hyperlink next to it’s text content.

a:after
{
   content: "(" attr(href) ")";
}

This will inject the URL mentioned within the href tag next to each link and will be decorated with a pair of parenthesis. For detailed list of content property values you may refer w3Schools.com.

Create Printable Links:

Before we start let’s have a look on the below paragraph of an HTML page-

“If you want to start learning web technologies then there is no better place than W3School to start with. For Microsoft technologies you can get comprehensive help from MSDN. My suggestion is to follow blogs like Technology Talks, Daily Dot Net Tips, Dot Net Tricks, Kunal Chowdhury, SQL Authority etc. ”

The HTML code for this is

printable_link_1

Note that this HTML snippet has certain links to some other places. Now let someone wants to print the page containing the above paragraph. He/she will get the print copy as the above paragraph but

  • What about the links?
  • How can the user get the links for Technology Talks, Daily Dot Net Tips, Dot Net Tricks, Kunal Chowdhary, SQL Authority etc. from the print copies?
  • Is there any way that we can show links on the print copy but not in the web page?

Solution

The easiest solution is to use content property of CSS along with pseudo-element :after. And as we want the URL to be injected next to it’s corresponding link only in the print page and not in the page that is rendered to the browser, we need to mention media type as ‘print’. So code view of the final document may look like

<style media="print">
    a:after {
      content: "(" attr(href) ")";
    }
</style>
<div>If you want to start learning web technologies then there is no better place than
 <a href="http://www.w3schools.com/">W3School</a> to start with.For Microsoft technologies
 you can get comprehensive help from <a href="http://msdn.microsoft.com/en-US/">MSDN</a>.
 My suggestion is to follow blogs like <a href="http://suvendugiri.wordpress.com/">
 Technology Talks</a>, <a href="http://dailydotnettips.com/">Daily Dot Net Tips</a>,
 <a href="http://www.abhisheksur.com/">Dot Net Tricks</a>, <a href="http://www.kunal-chowdhury.com/">
 Kunal Chowdhury</a>, <a href="http://blog.sqlauthority.com/">SQL Authority</a> etc.</div>

Live Demo

You can view the live demo here. To spot the difference just view the print preview.

Conclusion

Now, we are able to do the magic with which we can create better web pages with links for both kind of users i.e, online users and offline users (with printed material).

Hopefully, you have enjoyed reading this post.
I’ll love to read a feedback from you.
Thanks !