Computer Science .NET mini-project – Car Rental Management System

This is a database driven mini-project written in VB.NET implementing a simple Car Rental Management System. The project uses embedded SQLite database and is lightweight and has good UI.
The software lets the user manage fleet of vehicles, dispatch them to customers, reclaim a vehicle and generate invoices. Download the source code from the link below.

Screenshots

Car Rental Management System Screenshot
Read more…

 

Change color of status bar in android apps programmatically

Android Lollipop brought with it the ability to change the color of status bar in your app for a more immersive user experience and in tune with Google’s Material Design Guidelines. Here is how you can change the color of the status bar using the new window.setStatusBarColor method introduced in API level 21. Changing the color of status bar also requires setting two additional flags on the Window; you need to add the FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag and clear the FLAG_TRANSLUCENT_STATUS flag.

Working Code :

Window window = activity.getWindow();

// clear FLAG_TRANSLUCENT_STATUS flag:
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

// add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

// finally change the color
window.setStatusBarColor(activity.getResources().getColor(R.color.my_statusbar_color));

Keep in mind that using this requires an API level of 21 at least.
The color my_statusbar_color needs to be defined in your color resources

 

Blurred text effect using CSS

The following quick-tip shows how to obtain a blurred-text effect using purely CSS. The trick is to set the color property to transparent and set an appropriate text-shadow

Code

p.blur {
color:transparent;
text-shadow:0px 0px 4px #333333;
}

Output

Live Example

 

How to take full-page screenshots with Firefox’s developer toolbar

Taking screenshots of webpages is a handy and quick way of saving interesting stuff for later reference or for documentation purposes if you are a developer. While the quickest and easiest way is to just hit the Print Screen key on your keyboard and save the screenshot in an image editor, sometimes you may require to capture more than what is visible of the webpage in the current window.
With Firefox’s developer toolbar it is quite easy and straightforward to save screenshot of the complete webpage rather than just the current view-port. Here is how you can save a full-page screenshot of any website using Firefox without using any add-ons:

  • Open Developer Toolbar by going to Tools->Web Developer->Developer Toolbar or use the shortcut Shift+F2
  • A command-line will open at the bottom of the page, here type the command: screenshot filename.png --fullpage
    You can enter any name of your preference in place of the ‘filename.png’ parameter. The screenshot will be saved to your Downloads folder. You can even skip the filename parameter and Firefox will assign a name for the file containing current timestamp.
 

C++ tip: Check if input is of valid data type using cin.fail()

When accepting user inputs in C++ console applications using cin object, it is always a good idea to check the input stream for possible errors.

If you intend to read a numeric value using cin and the user inputs a character or string instead then it can lead to unexpected results and run-time errors later in program.

For example if you are using a do…while loop to implement a menu driven program, and instead of a numeric choice the user accidentally (or maliciously?) enters a character, your program can run into an infinite loop.

cin.fail() returns true if the input stream encounters errors, most commonly which happens due to reading incorrect data type.

Here is how you can prevent it:

 int i;
 cin>>i;
if(cin.fail()) {
  // do error handling here
}

You can also check for cin.fail() using the shortcut method :

if(!cin) {
  // this is same as cin.fail()
}

When cin fails, it is also very important to clear the input stream of any garbage value and reset the internal error flags. It can be done using the cin.clear() and cin.ignore() methods as follows :

if(!cin) {
 cin.clear(); // clears error flags
 cin.ignore(999,'\n'); // the first parameter is just some arbitrarily large value, the second param being the character to ignore till 
}

Putting it all together

Here is a more robust way to read any input from user which uses the functions cin.ignore() and cin.clear() :

 int i;
 while(!(cin>>i)) {
 	cin.clear();
 	cin.ignore(999,'\n');
 	cout<<"Invalid data type! Please enter 'i' again";
 }
 
webBluePrint

Top Mistakes to Avoid while Designing A Website

While using the Internet, sometimes you don’t find some sites as attractive as others are. While web designing is not a difficult task, still few people fail to accomplish his job. It is very important for a website to be user friendly and interactive. It helps in directing visitors towards your site. An ill designed website will drive your visitors away from your site.
Read more…

 
Essentials of mobile web designing

Essentials of Mobile Website Designing

It is very essential for the mobile website designers to put an extra effort on the aspects of the website design. As the designed website should not only be user friendly but also complement your site. A few considerations while designing mobile website are as follows:
Read more…

 
© 2015 All rights reserved | Powered by WordPress
Back to top ↑
Theme by dynamicguru.com