Best Desktops for Programming & Developers 2018 - Buyer's Guide & Reviews

On 1/18/2018 Be the first to comment!

Slow computer sucks! Whether you are a newbie developer or a veteran programmer, you already know the necessity of a powerful computer in your profession. Though laptops are portable and easy to carry on your back, nothing can beat up the productivity of a desktop pc. Setting up a perfect workstation at home or office will bring in more discipline to your work. I agree desktop computers are stationary and take up lot of space but it happens to be more ergonomic than a crammed up laptop.

There is no single best computer suitable for all developers. It just boils down to your programming requirements. The best specs and perfect hardware combination should be able to open up your coding opportunities.

However choosing a perfect desktop for programming is not an easy job. You must know what sort of hardware combination is right for your coding demands. To make your job easier I'm going to show you how to pick up the best computer and what are the things to consider in a programming desktop.

Laptop or Desktop? Which is Best?

This question is asked around a lot when buying a new computer. There are so many factors to decide between a desktop and a laptop. It ultimately depends on your lifestyle. Both laptops and desktops have their share of pros and cons.

Laptops take up less physical space and have the advantage of mobility. If you travel a lot and don't work from home or office setup they are the best. You can lug it anywhere you go. But laptops are expensive and deliver lower performance compared to similar-priced desktop.

Plus most of the laptops have small poor-quality keyboards and you don't get the advantage of working in a bigger screen. Trust me! Large displays matters a lot for a programmer.

On the other hand, Desktops are cheaper, comfortable and have better performance - suitable for dual or triple monitor setup. Having a powerful workstation setup vastly improves your productivity. You can conveniently sit and work for extended hours without feeling fatigue or strain. The only downside to desktop is they are NOT portable and takes up lot of space.

Besides Desktop PCs are easy to upgrade and repair. But laptops come with so many smaller parts that you need professional help to repair and upgrade.

As a developer myself, I own both desktop and a laptop, just like most of the programmers. It's good to have a reliable workstation at home and also get the convenience of carrying work in your backpack wherever you go.

Our Top Picks for Best Desktop for Programming in 2017-2018

Here are our top 5 recommendations for programming desktop computers.

1. Dell XPS x8900-7319BLK - The Best Programming Desktop 2018

best desktop pc for programmers

Check Price @ Amazon

Our top pick for the best programming desktop is Dell XPS x8900. Dell brand is reliable and this computer is an ultimate powerhouse. It comes with blazing-fast 6th generation Intel i7 Processor, 24GB of RAM, and huge 2TB of HDD and an additional 256GB of SSD for lightning speed. It's just the right combination to meet up all your programming demands. With ample RAM the desktop handles serious multi-tasking with great ease.

It comes pre-installed with Windows 10 Professional and a discrete NVIDIA GeForce GTX 960 graphics with 2GB of GDDR5 memory for superior graphics. So apart from coding you can also use XPS x8900 for game development, video editing and gaming.

The machine has hybrid storage so I suggest you to install all programs and apps on Solid state drive for fast launching and use HDD to store all your files and work. Plus it has got 6 USB 3.0 ports and 4 USB 2.0 ports which is more than enough for your programming needs.

  • Intel Core i7-6700K up to 4 GHz Processor
  • 24GB DDR4 RAM + 64bit Windows 10 Professional
  • 2TB HDD (7200RPM) + 256GB SSD storage
  • NVIDIA GeForce GTX 960 with 2GB GDDR5 Memory
  • 802.11 AC Wireless connectivity + Bluetooth 4.0
  • Dell KB216 wired keyboard, mouse combo

Get It Now From Amazon


2. Acer Aspire TC-780-AMZKi5 Desktop - Top Budget Desktop for Programming

cheapest desktop for programming

Check Price @ Amazon

Acer Aspire is the cheapest programming desktop computer in our recommendation and gives best value for money. Being Amazon's best seller speaks for its credibility. If you are a budding programmer, computer science major or a programming student with budget-constraint then I highly recommend considering this one.

The PC has the right combination of hardware to deliver power and performance. All your coding work goes smoother with this machine as it comes with 7th generation Intel Core i5 Processor, 8GB DDR4 RAM, huge 2TB Storage and pre-loaded Windows 10 Home OS.

Besides it has integrated Intel HD 630 Graphics to handle all basic gaming and graphics. So unless you are into game development, Acer TC-780 is more than enough to handle all your programming needs.

  • 7th Generation Intel Core i5 CPU
  • 8GB DDR4 RAM + 2TB SATA3 Hard Drive
  • Intel HD Graphics 630
  • 802.11ac Wi-Fi + Bluetooth 4.0
  • Windows 10 Home OS + 8X DVD Writer
  • USB Keyboard and Optical Mouse

Get It Now From Amazon


3. HP Pavilion All-in-One Desktop - Best Touchscreen Coding PC

best developer desktop pc

Check Price @ Amazon

If you don't like desktops taking up too much space then you can go for clutter-free All-in-One computers. All-in-Ones are attractive, touch screen enabled, easy to setup and need less room. HP Pavilion All-in-One Desktop is a powerful combination of latest Intel Core i7 CPU with turbo boost up to 3.6 GHz, 8 GB DDR4 SDRAM which you can expand up to 16GB and Intel HD 530 GPU for handling graphics.

If you feel 8GB Memory is not enough you can always upgrade it to 16GB at any time. And the best part is the big 23.8 inch widescreen Full HD IPS Panel display which is touch enabled. The thin almost bezel-less display makes the desktop very attractive.

It also has built-in Bluetooth 4.0 support which is the latest technology and has HP TrueVision Web Camera, Ultra Slim SuperMulti DVD Burner, wireless keyboard and mouse. Overall it's a complete package that is efficient to meet up every coding demands of a programmer.

  • Intel Corei7-6700T up to 3.6 GHz Processor
  • 23.8-inch IPS FHD Touchscreen Display
  • 8GB DDR4 SDRAM + 1TB SATA Hard Disk
  • Intel HD 530 Graphics Card
  • HD Webcam + Microphone + DVD Writer
  • Wireless Keyboard + Optical Mouse
  • Windows 10 64-bit

Get It Now From Amazon


4. Lenovo IdeaCentre 700-25ISH Desktop - Mid-Range Programming + Game Development Desktop

best desktop for programming and gaming

Check Price @ Amazon

Lenovo IdeaCentre 700 is another good pc computer for developers. It comes with the configuration suitable for heavy duty processing and gaming. It comes pre-loaded with Windows 10 OS and is powered with Skylake Intel Core i7 3.4 GHz Processor coupled with 8GB RAM and deliver smooth performance and effortless multi-tasking.

There is huge 1TB HDD storage plus additional 120GB of Solid State drive. The best part of this desktop is that Operating system is installed in SSD so literally it takes up only few seconds for booting Windows 10.

The desktop comes with a really good dedicated graphics card with 2GB video RAM. The NVIDIA GeForce GTX 960 Graphics is more than enough to run latest graphics softwares and game engines without hassle. Overall Lenovo IdeaCentre has all the power and elegance to meet up the demands of a programmer & game developer with more room for upgrades and expansion.

  • 3.4 GHz Intel Core i7 6700 Processor
  • 8GB DDR4-SDRAM + Windows 10 OS
  • 1TB HDD + 120GB Solid State Drive
  • NVIDIA GeForce GTX 960 (2GB) Graphics Card
  • DVD Read/Write Optical Drive

Get It Now From Amazon


5. Alienware AUR5-12571SLV Desktop - Best Game Development Computer

best computer for game development

Check Price @ Amazon

Alienware AUR5-12571SLV is a high-end VR Ready desktop with lightening fast performance. The machine is powered with 6th generation Intel Core i7 3.4GHz Processor teamed up with 16GB DDR4 RAM with more room for expansion up to 64GB RAM.

It comes pre-installed with Windows 10 OS and got 2TB of hard disk space to store all your files and projects. Plus there is also another 256GB SSD storage for fast loading OS and Programs.

As for GPU, Alienware AUR5 has the excellent NVIDIA GeForce GTX 1070 with 8GB GDDR5 Memory which makes it the best desktop for Virtual Reality and Game Developers. Hard-core gamers are going to have great time with this beast.

Overall it's a great pc and little expensive but worth every penny you spend. Highly suitable for Professional developers and programmers.

  • Intel Core i7-6700 3.4GHz Processor
  • 16GB DDR4 RAM, Expandable up to 64GB
  • NVIDIA GeForce GTX 1070 with 8GB GDDR5 vRAM
  • 2TB 7200RPM HDD + 256GB M.2 PCIe SSD
  • Dual layer DVD Burner + Windows 10 Home

Get It Now From Amazon


How to Choose the Best Desktop for Programming?

Should You Get SSD or HDD Storage?

If you don't have patience to sit and watch your computer taking up ages to open up a file or program then do you yourself favor and get SSD. You won't regret it.

HDD drives are cheaper and you get so much of space at lower price. But the problem is they are slow. The more data you store the more slower it is. The entire process is mechanical. It has this small moving head that spins and sorts through several millions of bits of data stored in the disk every time you try to access a file, folder or program.

But SSD or Solid State Drive is super fast since it has no mechanical parts. It literally boots up a computer within seconds and loads up mega files and heavy programs at lightning speed. They are expensive but well-worth the price. Together with Powerful Processor, Good RAM and SSD your system will chew up any task you throw at it.

These days' computers happen to have hybrid storage that is with both HDD and SSD drives. I highly recommend going for this type of storage if you can afford it. By this way you can get to store all static files and Medias in HDD and install Operating system and Programs on SSDs for faster performance.

Processor: How Many Cores Do You Need?

The Processor or CPU (Central Processing Unit) is the brain of your computer and the driving force behind every task your system performs.

Your desktop/laptop performance relies on CPU. The two most important things you must consider about a processor are speed and number of cores.

Most of the latest processors are tuned out for faster performance. So if you go for Intel chipset you don't have to worry much about speed. They will be at best. But the number of cores is a different story. Most of the time number of cores is related to speedy performance. This is not entirely true. Their main purpose lies on the level of multi-tasking they accomplish.

We programmers are used to open up multiple applications, browser windows, several files and tabs during work. This increases work load on CPU. A CPU like Intel i7 with four-cores will meet up all your coding demands without trouble.

Unless you are on tight-budget I suggest you to go with i7 or i5 processor. On any case if you have to settle for Processor with two cores, just make sure it is capable of hyper threading which will be OK for multi-tasking.

How Much RAM is Optimal?

RAM is another one important factor to consider. RAM or Random Access Memory keeps tab of all opened applications, files etc and data related to them for easy access. So having a good amount of RAM is a must if you don't want a lagging pc. Just a bloated IDE and 8 to 10 Chrome tabs are enough to slow-down a computer. So I would recommend going for at least 8GB RAM - NEVER settle for anything less than that.

RAM is relatively cheap so going for 16GB or even 32GB won't hurt. This helps in case you work on GPU intensive tasks such as game development. Game engines do need more power.

Generally there is a misconception about 'More RAM' equals 'More Speed'. This is not completely true. Just keep in mind, doubling RAM won't double the speed. Having 32GB RAM with low-end processor doesn't boost up performance of a computer. At the same time a 4-core high-end processor with 16GB RAM will do wonders.

Do You Need A Graphics Card?

Gone are the times when we programmers sit and do only coding. Now everyone has to do everything. I know several developers who do designing stuffs too. For some it's a hobby, some its passion and others simply work.

A Graphics Card or GPU takes care of rendering images to screen and comes with separate video RAM for processing data into signals. Modern Processors like Intel i5, i7 has built-in integrated graphics which is efficient to some level. This type of graphics card doesn't have separate memory so they'll make use of system RAM for handling games and graphics. As a coder you can get away with this and don't need a dedicated GPU.

But if you are into desktop gaming or occasionally work with graphics softwares like Photoshop then you'll need a discrete GPU on your desktop.

As for Game Developers you MUST have a high-end Graphics card for rendering images. Just an integrated graphics won't cut it. The better your graphics card the better and smoother the rendering is. This is very important for game developers, graphics artists, gamers and video editors.

NVIDIA is the most popular graphics card with AMD cards lining next. If at all you have to choose a dedicated graphics card, I recommend you to go for NVIDIA card with at least 2GB vRAM.

What about Display & Keyboard?

Computer Display and Keyboard is what you call as comfort feature. I like large screen monitor and mechanical keyboard. Since this is what you are going to do all day as a programmer, sit and look into the monitor and type into the keyboard.

Big display is the luxury you get with Desktops. You can't expect such thing with a laptop. A wide monitor can accommodate so much screen elements in one go and you don't have to squint your eyes to read through tiny texts. A well-spaced super responsive keyboard will prevent strain on your wrist and fingers. I must say mechanical keyboards are the BEST in this context.

Over To You:

That concludes our buying guide on best desktop computers for programmers and developers. The desktops reviewed here are very good for programming and coding needs and suitable for everyone's budget. I hope now you have better understanding of what to look for and already found a great desktop for coding purpose. If you have any good suggestions please leave it in the comment section.

Also Read:

Best Monitors for Eyes (To Avoid Strain & Fatigue) 2018 - Buyer's Guide

On 1/18/2018 Be the first to comment!

Computers are inevitable these days. People look at screens all day regardless of work or game. However, when you continue to look at the monitor for hours it will lead to eye strain and fatigue. Especially professionals like computer programmers, web designers, video editors and bloggers are prone to eye problems due to long hours of working on computers. Therefore, it is important to choose eye-friendly monitors to keep your eyes healthy.

Nowadays monitors are designed with eye care technology to help people with eye problems. Even if you are on tight budget, there are affordable monitors for eyes in the market. To maintain good eye-health you must be choosy with the monitor you use with your desktop pc or laptop. With a wide range of choices, it is definitely a tedious task to choose the best monitor for eyes. This buying guide gives you a good insight into eye care technology and helps you choose the right eye monitor in 2018.

Top 10 Best Monitors for Eyes in 2017-2018

Here are our top 10 best recommended monitors for good eye health.

1. ASUS PB279Q 4K Eye Care Monitor
asus pb279q

With IPS Panel display and excellent 3840 x 2160px screen resolution, ASUS PB279Q is one of the best monitor for eyes. This 27-inch monitor comes with a good ergonomic design and can be used in portrait mode as well. It is built with ASUS Eye Care Technology and supports features like Flicker Free display and Blue Light Filter thus preventing eye strain and fatigue.

And the Smart Dynamic Backlight Adjustment ensures a smooth and eye-friendly user experience. It comes with various height level adjustments and different on-screen filter settings for eye protection. Picture-in-Picture and Picture-by-Picture functions are available and four 4K sources can be viewed on the monitor.

In addition, the ASUS PB279Q packs several types of ports, including a Display Port 1.2, a Mini Display Port and four HDMI 1.4 / MHL ports. Taking into account all of its powerful features ASUS PB279Q is one of the best monitors to avoid eye fatigue out there.

Check Price on Amazon


2. BenQ GW2765HT 27-inch IPS Monitor
benq gw2765ht

BenQ GW2765HT is another good eye monitor with a great ergonomic design. The monitor is 27" in size with a resolution of 2560 x 1440 IPS display. The WQHD panel provides 109 ppi making it suitable for watching movies and games.

For added viewing comfort, it is equipped with an eye-care technology called "Revolution Eyes". This includes features like Zero Flicker and Low Blue Light to prevent eye fatigue.

Being a high-end monitor, BenQ GW2765HT offers a wide range of options to choose from, such as standard, sRGB, movie, echo, game, photo and reading mode. And choosing the Eco mode will result in less energy consumption which is another good thing. It comes with many ports such as VGA, HDMI, DVI-D, and display port. Overall BenQ GW2765HT is a great monitor to consider buying.

Check Price on Amazon


3. ASUS MX27AQ Eye Care Frameless Monitor
asus mx27aq

ASUS MX27AQ is another great choice for eye care monitor with thin and frameless design. The monitor is 27" in size and has good ergonomics with various height adjustments. It comes with 2560 x 1440 px screen resolution and the AH-IPS panel has wide viewing angles of 178 degrees for a minimum color shifting.

The monitor features ASUS Eye Care Technology and comes with Flicker Free display and Blue Light Filtering to reduce eye strain and fatigue. In addition, you can choose between different levels of brightness and blue light with the help of the OSD menu which is suitable for long hours of work.

Another good thing about ASUS MX27AQ is its built-in speakers. With Band & Olufsen ICEpower the audio quality is good for entertainment and games. There are 2 HDMI ports, HML ports and a display port on the monitor. Overall ASUS MX27AQ could be another good option to avoid strain on the eyes.

Check Price on Amazon


4. ASUS MX259H 25" IPS Eye Care Frameless Monitor
asus mx259h

ASUS MX259H comes with a 25-inch LED display with 1920 x 1080 px screen resolution. It is built ultra thin and without frame and has an incredible viewing angle of 178 degrees wide for stunning visuals. With ASUS SonicMaster technology, the built-in speakers have a very good sound quality.

It is one of the best monitors for eyes since it is designed with ASUS eye care technology and features TUV certified flicker-free and blue light filter display for less eye strain.

The monitor controls are very sensitive. Plus the audio jack is on the rear side so you have to turn it around to connect the jack which is a slight discomfort.

Besides ASUS MX259H comes with a good ergonomic design and allows you to adjust height level, screen brightness, sharpness etc. As for connectivity, it supports dual VGA and HDMI ports and let you connect other devices to it.

Check Price on Amazon


5. BenQ BL2711U 27" IPS 4K Monitor
benq bl2711u

BenQ BL2711U is a 27-inch monitor with IPS Panel and 4K HD resolution display. It has a dynamic contrast ratio of 20,000,000: 1 for amazing color accuracy. The screen colors are rendered professionally with 100% sRGB and Rec 709 color space.

The monitor comes with Zero Flicker and Low Blue Light technology to avoid eye fatigue and strain. The display is great especially for designers and graphic artists, as it offers CAD/CAM mode for enhanced color contrast in 3D color lines. There is also this animation mode that delivers excellent user experience for animators and designers.

BenQ BL2711U is highly ergonomic as you can adjust height and rotation for better viewing angle. Plus the availability of PIP and PBP makes it even better. And it sports various ports like HDMI, Display & DVI-D ports for connectivity.

Check Price on Amazon


6. BenQ EW2750ZL 27-Inch Full HD IPS Monitor
benq ew2750zl

BenQ EW2750ZL is a thin bezel monitor with a 27-inch wide screen and 1920 x 1080px display resolution. Its base is constructed with the shiny plastic slab with a light metal bracket and looks attractive.

It is designed with eye care features such as TUV Rheinland Certified Flicker-free display and Low Blue Light filtering and regarded as the best eye monitor. Thus, even with a high level of brightness, it reduces blinking and prevents eye fatigue.

There are four preset modes for low blue light and let you set it up for multimedia, reading, working or surfing the Internet. The display panel is especially good for multimedia.

The only downside is OSD navigation menu is a bit inconvenient. Otherwise BenQ EW2750ZL is lightweight, attractive with solid color contrast and reproduction.

Check Price on Amazon


7. ASUS VX24AH IPS WQHD Eye Care Monitor
asus vx24ah

ASUS VX24AH is a 23.8" monitor with frameless bezel screen. It features IPS panel display for excellent color contrast with 2560 x 1440 px resolution. The anti-glare screen also makes it easy on the eyes while working. This is a must have feature if you have light sensitive eyes.

To prevent eye strain and fatigue it supports Asus Eye-care features like zero flicker and blue light filter. Plus the display has nice viewing angles up to 178 degrees as well.

ASUS VX24AH includes a VGA port and two HDMI ports with MHL support. Being bezel-less and light the monitor will be aptly suitable if you plan to go with multi monitor set up. Overall VX24AH is a decent eye monitor on budget which is best for pc gaming and everyday use.

Check Price on Amazon


8. Dell UltraSharp U2412M
dell u2412m

Dell UltraSharp U2412M is a 24-inch monitor with excellent color rendering and wide angle viewing. The screen has a resolution of 1920 x 1200 pixels and comes with amazing features for long hours of work.

The monitor has robust built but at the same time looks slim and elegant. It offers easy-to-navigate OSD menu for an excellent user experience. There are as many connectivity ports on the monitor such as five USB ports, VGA, Display Port and DVI so you can connect it to other devices.

But there is no HDMI port which is little disappointing. Apart from that, Dell UltraSharp U2412M comes with so many good features including excellent color contrast and energy efficient.

Check Price on Amazon


9. ViewSonic VA2855SMH 1080p LED Monitor
viewsonic va2855smh

ViewSonic VA2855SMH offers 28-inch screen with Full HD display supporting 1080p resolution. The Super Clear Pro imaging technology offers incredible wide viewing angles. And the color rendering is pretty good with true 8-bit color and a static contrast ratio of 3000: 1.

The monitor is equipped with eye care features such as blue light filtering and flicker less display to reduce eye strain. It also comes with various display modes for preferred color choice such as image, movie, gaming, browsing etc.

It comes with built-in dual-speakers. Although the speakers are small, their audio quality is good and optimal for entertainment. The only downside is the lack of USB port on ViewSonic VA2855SMH.

Check Price on Amazon


10. ASUS ROG SWIFT PG279Q 27" Eye Care Gaming Monitor
asus rog swift pg279q

ASUS ROG SWIFT PG279Q is a 27-inch monitor with support for 2560 x 1440 px resolution. The monitor is built with IPS LCD panel and offers 178 degrees of wide viewing angles for minimal distortion and color change. It has a very fast response time and supports G-Sync and FreeSync adaptive refresh rates.

Built with ASUS eye care technology, the monitor supports low blue light filter and flicker free display for less eye fatigue. The display is smooth, eye-friendly and offers a rich multimedia experience.

ASUS ROG SWIFT PG279Q is very ergonomic and can be adjusted tilt, height, swivel and pivot for comfortable viewing. The monitor comes with two usb ports, a display port and hdmi ports. Although it is a bit pricey, you get what you pay for. This is an amazing eye monitor for the best gaming experience.

Check Price on Amazon


How to Choose the Best Eye Monitor - Buying Guide

In order to choose the right eye monitor, you must clearly understand about eye care technology and its positive impact on maintaining good eye health. Features like blue light filter, zero-flicker, refresh rate, anti-glare screen are important for an eye-friendly monitor. And there are other general factors like resolution, ergonomics to be considered as well. So here we present the detailed buying guide to help you choose the best monitor to prevent eye strain.

What are Eye Care Technologies?

Working extended period of time on computer can cause eye fatigue. This is because you look at the screen from a very close distance which obviously leads to Computer Vision Syndrome (CVS). So the solution to this problem is to work on monitors that are easy on the eyes. And brands like ASUS, BenQ, Viewsonic etc. have developed some technologies for designing eye-friendly monitors which include features like low blue-light, flicker free, anti-glare, ergonomics etc.

1. Blue Light Filter

The first and foremost important feature to look for in an eye-friendly monitor is the low blue light filter. Blue light is the harmful blue-violet radiation from the monitor and can cause eye damage, strains, headaches, and sleeping disorders. Children are most prone to eye damage than adults due to this blue light. If you are serious about your eye health then you must definitely choose a monitor designed with low-blue light technology. And the monitors we have recommended above have this feature and provides easy to access OCD menu to choose from various levels of blue light to use throughout the day.

2. Flicker-Free

The second important eye technology to look for in a monitor is flicker-free display. In general, flickering is the state of the LED backlight rapid on/off cycle and this is how the screen maintains brightness level. When you work on low-brightness flicker can be noticed. When the display flickers, the pupil of the human eye expands and contrasts according to the frequent change in brightness. In case of prolonged use, flickering can cause eye strain, fatigue and headache. So how could you avoid this problem? The monitor with dynamic backlighting will be gentle on the eyes and will give you a better working experience. So pay attention to the "Flicker-free" screen when selecting the monitor.

3. Anti-Glare/Matte Display

A monitor with anti-glare or matte display will dissipate reflected light, thus reducing eye strain and fatigue. Smooth, glossy screen reflects light directly backwards and causes unwanted glare. They are distracting and put strain on your eyes. So make sure your eye monitor comes with anti-glare panel that you will definitely like.

4. Ergonomic Build

Ergonomics is important. Monitor with good ergonomic design will be convenient to work for long hours. It lets you adjust the height level according to your preferences. Viewing the monitor from the wrong angle or height is the main cause for eye problems. So go for ergonomically designed monitor when you shop for the best eye monitor.


Other Factors to Look for in Eye-Monitor

Monitor Size is Important

Monitor size depends purely on your nature of work and comfort level. Basically they come in three different sizes, small (17 - 18"), standard (19 - 24") and large (25 - 30") screen. Monitors with too wide screen may be inconvenient for some. In such case going for multi-monitor setup would be better. Instead of one big monitor you can get two small monitor and do the job faster.

If you are a graphic designer or a gamer, then a large screen monitor would be more convenient to fit so many windows at a time. On the other hand if you are copywriter or video editor, then you can use double or triple monitor setup where you can open up a reference web page on one screen and work with the application on the other.

Screen Resolution

The resolution of the screen has a direct impact on eye health. The popular screen resolutions are 1080p, 1440p, and 4K (2160p) monitor. Too high or too low resolution is not good for eye health. Therefore, in general, the text and icons should be large enough for a better view. For standard size monitor ranging between 22 to 24 inches, 1080p resolution is the best and gives you great picture quality. Anything above 24", it is better to choose 1440p or 4k resolution.

Display Panel

Another important factor to pay attention is the type of display panel a monitor uses. There are three main types of display panels available on the market today and are IPS, VA and TN panels. Of the three, the TN Panel (Twisted Nematic) is the cheapest and has a fast response time and a high refresh rate. This type of panel is used a lot in game monitors, but they are not best for the eyes. Second, VA (Vertical Alignment) Panels are a good mid-level option and are considered to have decent color accuracy, brightness and contrast ratio. On the other hand the In-Plane Switching (IPS) Panel has the eye-friendly display and has better viewing angles and color accuracy. Although little expensive, they are very suitable for intensive graphics work. Therefore it is highly recommended to go for a monitor with the IPS panel.

Brightness and Contrast Ratio

Brightness - Too much brightness may lead to visual strain. Most high-end monitors have a brightness level ranging between 300 and 350 cd/m2. But a brightness of 250 cd/m2 is considered to be good for eye health.

Contrast ratio - It is the difference between the luminance of the brightest white and the darkest black that a monitor can produce. The higher the contrast ratio, the better the color accuracy.

Viewing Angle

A monitor with a larger viewing angle let you see from the sides of a screen without a change in color and brightness level. Generally monitors with viewing angle above 170 degrees will be easy on the eyes.

Refresh Rate

Monitors with 60Hz refresh rate are more common these days and means that the display is capable of producing 60 frames per second. It is true that low refresh rate monitors may cause eye problem. But as for LCD monitors, 60Hz refresh rate is more than enough to avoid eye fatigue. You don't need to go beyond that, but it doesn't hurt to go with higher refresh rate monitors since they are not expensive. Monitors with a 120Hz or 144Hz refresh rate can be much smoother and offer a very good gaming experience.

Response Time

It defines how fast a monitor display transition takes place and is measured in mille seconds. In general the monitor with lower response time is good.

I/O Ports

Often a feature overlooked at first but people regret later. Make sure your monitor has a sufficient number of I/O Ports and has convenient access to it. There must be at least two USB ports, a HDMI port and a Display port on a monitor. If you plan to connect monitor to the laptop, then verify what kind of port the laptop has. Most laptops come with HDMI port. Therefore, the monitor you choose must also have a compatible compatible port on it to connect the device.

Over to You

We hope this guide has helped you get an idea of what to look for in the best eye monitor. As a professional I work at the computer all day and know the importance of maintaining good eye health. So when you shop for a monitor, do yourself favor and buy an eye-friendly monitor.

Best Mechanical Keyboards for Programming in 2018 - Reviews & Buying Guide

On 1/18/2018 1 Comment so far

As a coder you should never compromise on the quality of your tools and keyboard is one such important programming tool. Being a programmer you spend most of the time typing on the keyboard. Therefore, it only makes sense that you invest in the best mechanical keyboard for programming in 2018.

A reliable high quality mechanical keyboard will provide you with comfortable typing experience and enhance your productivity. These mechanical keyboards use mechanical switches to give tactile feedback and help you type faster and efficiently than the standard keyboards. It is not an easy job to find the perfect keyboard to suit your need, so we put together the ultimate guide to help you in choosing the best coding keyboard.

Best 6 Mechanical Keyboards for Programming - Recommendations & Reviews

1. Filco Ninja Majestouch 2 - Best Programming Keyboard
filco majestouch 2 ninja review

Filco Ninja Majestouch-2 is the best mechanical keyboard for programmers on the market right now. It is one of the modern keyboards that support Full USB N-Key Rollover, meaning there is no limit to how many keys you press at once, all keystrokes will be accurately registered. This feature is very useful not only for gamers, but also for programmers, as they often use extensive combinations of shortcuts while coding.

Filco Ninja Majestouch 2 features front printing key caps that looks almost blank and good. This avoids the problem of fading labels. Although coders are precision typists, having faded label on keyboard do not look good.

The sturdy chassis and smooth key caps call for excellent build quality. The keyboard is available with Cherry MX Brown and Blue switches and Full size or Tenkeyless option. I like the full-size but if you want to bring it on your trip then TKN is a good choice. It just weighs only 2.2 pounds and requires little space.

The mechanical keyboard comes with 1.5 m cord to power up. Not all keys are backlit, but only the Caps, Num and Scroll Lock keys. See, it's not like you need an illuminated keyboard for programming work. In short Filco Ninja Majestouch 2 is the best professional keyboard that a programmer can ask for.

Full Size - Check Price on Amazon

Tenkeyless - Check Price on Amazon


 

2. WASD Code 87 - Best Keyboard for Programming MAC and PC
best keyboard for programming mac

CODE comes with a clean design with no logo on front. It's not just another programming keyboard, but the finest any professionals can get. At first glance, the keyboard may seem simple but, it balances greatly with its performance. Everything about this speaks of quality right from the build to the tactile performance.

Illuminated keyboards are a great help when you are accustomed to working at late night. And CODE comes with LED back lighting with 7 levels of adjustment. It uses Cherry MX switches. The key caps have high quality labels and feel smooth at your fingertips.

WASD CODE comes in several options, Tenkey-less / Full Size, Cherry MX Blue / Brown switches. The keyboard supports excellent cable routing. It has a 1.8m micro-USB cable with a cable tie, which allows you to route the cable in different ways.

It is compatible with PC and Mac and offers hardware-level control. With the help of DIP switch you can turn ON/OFF the operating system keys and switch over the keyboard function from QWERTY to MAC mode.

The CODE Keyboard offers great feel and supports alternate layouts - a great choice for programmers.

Cherry MX Brown - Check Price on Amazon

Cherry MX Blue - Check Price on Amazon


3. CM Storm QuickFire Rapid - Best Cheap Mechanical Keyboard
cm storm quickfire rapid review

CM Storm QuickFire Rapid is the best budget mechanical keyboard featuring Cherry MX switches and solid build. Coming from a well-known manufacturer of keyboards, QuickFire Rapid is one of the most popular products in its class. It is available both as TKL and Full Size version and completely customizable to your liking.

The design is simple and clean with excellent performance. It offers several options for switches such as Cherry MX Brown / Blue / Green / Red. Cherry MX keys provide solid feedback and suitable for programmers who prefer precision and comfort.

CM Storm QuickFire Rapid supports NKRO with PS/2 and 6 KRO via USB. In addition, the laser marked key caps are very durable and can be changed if desired. You also get some additional key caps and a key cap puller as well with the device.

It has multimedia controls and features a detachable braided USB cord with cable routing. So you can route the cable left, right or back according to your choice. Programmers who also like to play game get a nice option with this - which is to disable Windows keys with a dedicated switch.

In general it is a very good mechanical keyboard for beginners. If you are new to mechanical keyboards and want to try your hands on it, I would recommend QuickFire Rapid rather than going for expensive ones.

Cherry MX Brown - Check Price on Amazon

Cherry MX Blue - Check Price on Amazon


4. Corsair K95 - Best Value for Money
best value for money mechanical keyboard

The flagship Corsair k95 is one of the best value for money mechanical keyboard for programming. It got loads of customizing options and features Cherry MX Red and Brown switches with smooth actuation and flawless accuracy. Built with aircraft-grade aluminium, quality and durability is not something you have to worry about.

Corsair k95 is the full-size keyboard that includes number pad with 18 additional programmable G-Keys. The programmable keys support 3 different profiles offering totally 54 programmable keys. This much level of customization makes it the best keyboard for programmers.

It offers many high-end features, such as Key-by-Key backlight, media control, 100% anti-ghosting and an astonishing 122-key rollover. This practically means that you can sleep over the keyboard and it would still register each keystroke separately.

The fact that it requires two USB ports to power on and the lack of USB hub are the downside of this awesome keyboard. But overall the positive aspects of Corsair K95 outweigh the small negatives and it is a great professional mechanical keyboard.

Check Price on Amazon


5. Corsair Vengeance K65 - Tenkeyless Coding Keyboard
corsair vengeance k65 review

If you are looking for a best tenkeyless mechanical keyboard then Corsair Vengeance K65 should be your top choice. The keyboard is quite affordable and comes with rugged, anodized aluminum solid chassis. Being 10-key less keyboard, it is small and portable and can be carried with you on travel.

People with large hands may find typing on tenkeyless keyboard inconvenient as the keys will be little confined. But that is not the case with Corsair Vengeance K65. Despite being compact, it has standard size keys, making typing very comfortable.

It uses linear MX Red switches with acute precision and features Full Key Roll over and Anti-Ghosting. It also offers detachable USB with cable routing which is very convenient if you move around a lot.

A small drawback of Vengeance K65 is the lack of programmable keys, but it is understandable because of the smaller size of the device. Apart from that, it is a great tenkeyless keyboard to program that offers comfort, accuracy and portability.

Check Price on Amazon


6. Ducky Shine 5 RGB - LED Backlit Mechanical Keyboard
best backlit mechanical keyboard 2018

As it name suggests Ducky Shine 5 RGB is a full-size backlit RGB illuminated mechanical keyboard. The keyboard is all shiny with impressive design. It has a solid, if slightly rough chassis with individual LED backlit keys and smooth key caps. The key caps are made of double shot ABS, which is thicker and more durable than normal ABS.

Generally, illuminated keyboards use special software to change colors and lighting effects. But not Ducky Shine 5. It uses key combinations to change lighting profiles, such as Breathing, Reactive, Aurora, Wave and Ripple mode. There is also the option to change the lighting level for the Red, Green and Blue colors individually.

The keyboard features Cherry MX Brown / Blue switches and uses the ARM M3 MCU, to provide the fastest key response possible. It has 24 media keys, but they are disabled by default. You have to follow the instructions provided in the manual to enable them.

Ducky Shine 5 comes with removable 5-foot long mini-USB cable to power on. And the good thing is it is compatible with Mac as well. You have to use the DPI switches to make it work with Mac OS.

Cherry MX Blue - Check Price on Amazon

Cherry MX Brown - Check Price on Amazon


How to Choose the Best Keyboard for Programming?

The keyboard is the most important gear of a programmer so it only makes sense to get a well designed quality keyboard that will last for years to come. Undoubtedly, a good keyboard will provide the best experience for a programmer and increase performance. But a poor design keyboard will make things hard and frustrating for a coder and will reduce their quality of performance.

Most programmers, including myself prefer that their keyboard is as simple as possible following the standard layout and excellent response on key press. But not all programmers' needs are the same. It may vary according to their nature of work and personal preferences. Even before purchasing a new keyboard, make a list of all the features you want the most and make that priority.

Keyboard Size

When it comes to keyboard its size matters. The size of the keyboard depends on the number of keys it contains. There are three common keyboard sizes available on the market and they are Full size, Tenkeyless (TKL) and Compact.

A full sized keyboard follows a standard design with 104 keys, including the number pad and all. This is the size of the keyboard widely used, but they are not light and take up more desk space. Also, your hands must travel a long distance to reach the mouse.

On the other hand, a Tenkeyless keyboard is lighter than the full-size keyboard and very portable. It has a standard key layout without the numeric keys, resulting in only 87 keys. This makes the keyboard smaller and also keeps the mouse closer together so you don't have to reach that far. Basically, number pad is of little use to programmers. Also, given the ergonomic factor, TKL design is probably the best keyboard for a programmer in my opinion.

The third, Compact size follows a 60% design and excludes numeric keys and function keys, such as F1 to F12, Home, Insert, Delete, Page Up and Down keys. There is no doubt that the compact keyboard is the lightest of all, but at the cost of so many functional keys, it probably is not the best choice for coding work.

Ergonomics

Ergonomic keyboards usually come with sculpted or split designs that are way different from what you are used to. It will take some time getting used to the new layout and everything. But once you start working on the ergonomic keyboard, it will be difficult to return to the normal keyboard.

Unless you suffer from wrist pain or injury, there's no need to buy ergonomic keyboard. For one thing, they aren't cheap and will not make you type faster. But mainly because they don't use mechanical switches in ergonomic keyboards, so feedback of keys are not that good.

May be this is my opinion, but I have tried different keyboards and nothing is satisfactory like working on a mechanical keyboard. As a programmer you'll need to type fast and want a satisfactory typing experience, which is why mechanical keyboards are the best in this context.

Improving Keyboard Ergonomics

Using the wrist rest is a simple solution to maintain the ergonomics of the keyboard. It'll keep your palms raised as you type to remove strain on your wrists. In this way you can improve ergonomics of your standard keyboard without switching over to an expensive ergonomic design.

The wrist rests made of rubber or finished wood are the best and come in different shapes and sizes. When buying wrist rests, make sure their height and length match your keyboard model and fit comfortably at the bottom of it.

Keyboard Switch Type

What makes a keyboard good or bad? It all starts with the type of switch they use. There are several switch technologies used in the manufacture of keyboard, such as membrane, mechanical, dome, scissor switch, etc. In these, membrane and mechanical switches are most commonly used on PC keyboards.

Generally, Membrane keyboards are cheap, but their key feedback is not so good. While mechanical keyboards are designed with a separate switch under each key and is composed of a base, a spring and a rod. Based on the shape of the spring and stem used, the switches are classified into several types. And each type also has different drive force, travel distance and sound. Cherry MX and Topre are popular types in mechanical switches.

Mechanical Switch Color

If you want the best keyboard for programming, all you need to do is choose a keyboard with Cherry MX switches. Cherry MX switches come in various colors named Cherry MX Red, Blue, Brown, Black and Clear. Black and Red ones are the most popular switches for gaming keyboards.

In my experience, the best mechanical switches for programming are the Cherry MX Brown, Blue and Clear switches. The tactile feedback offered by these switches gives you a great feel for every keystroke and let you into the flow of effortless coding.

Both the Brown and Clear switches are non-clicky, so they will not make noise while typing. Also the brown switches has 45g actuation force, which is much lower, so you won't feel soreness on your fingers even after typing for long hours. On the other hand, the blue switches have the actuation force of 50g and are clicky. Therefore, they will be suitable for individuals who like to hear audible audio feedback of key strokes and it gives a great feeling of satisfaction when typing.

Key Rollover & N-Key Rollover

The term Key Rollover or KRO refers to the ability to register multiple key presses at the same time on a keyboard. If a keyboard is labeled "6 Key Roll Over", it means that the keyboard can only register six keys at the same time. When labeled as "N-key rollover" there is no limitation on the number of keys you press at a time and all key presses will be recorded and carried out without fail.

This feature benefits mainly in games than in programming. But programmers also get some benefits because of the extensive shortcut key-combinations they often use.

The old PS/2 cable supports N-KRO by default, but the recent USB connection allows only 6 KRO. Nowadays, modern keyboards use two USB ports simultaneously and allow N-Key Rollover.

Over To You

Finding the best keyboard for programming can be daunting when you do not know what to look for on a keyboard. We hope this guide has shed some light on what to look for in a mechanical keyboard and given you some good recommendations in the market. Now is the time to make the choice that fits both your needs and your budget.

Also Read:

How to Get Country Name from IP Address with PHP

On 1/15/2018 Be the first to comment!

Hi! In this post, let's see how to get country name from ip address using php. When working on multilingual web applications, it is mandatory to find the geographic location of the visitors, so that you can provide the contents that match the specific location. Some websites even change country flags and themes accordingly.

With PHP, you can get the visitor's IP easily, but unfortunately there's no way to get the country details from it. Hence, you have to rely on external web services to provide the location details. Here I'm going to show you how to find the country of visitors with the help of GeoPlugin API and PHP.

php get country name from ip address

Getting Country Name from IP Address with GeoPlugin:

GeoPlugin is a free web service that provides geographical location of site visitors from IP. It offers various types of services like PHP, JSON etc., and in this tutorial, I'm going to use the JSON API to find the country name.

You have to access the service with this url,

http://www.geoplugin.net/json.gp?ip=IP_ADDRESS

The API will return the name of the country along with other details related to the location, such as city, currency, latitude, longitude, etc.

Below I have created a PHP function getIP(). It accepts the IP Address as a parameter, communicates with the geoPlugin api and returns the country name for that IP.

PHP Function:

<?php
function getIP($ipadr) {
    if(isset($ipadr)) {
        $details = file_get_contents('http://www.geoplugin.net/json.gp?ip=' . $ipadr);
        $json = json_decode($details);
        if($json->geoplugin_status == '200')
            return $json->geoplugin_countryName;
        else
            return 'Error getting country name.';
    } else {
        return 'IP is empty.';
    }
}
?>

Usage:

You must call the function like this,

<?php
echo getIP('17.142.180.78');

// output
// United States 
?>

What the function does is, take the ip address and send the http request to the api using file_get_contents() method. The api returns the json response, which it decodes with json_decode(), parses for the country name and returns it.

Finding Visitor Country Location:

In case you want to find the visitor's location, you must pass the client ip address to the function in this way,

<?php echo getIP($_SERVER['REMOTE_ADDR']); ?>

Keep in mind to use this on live server, because REMOTE_ADDR will return the default ip '127.0.0.1' when you run it from localhost.

Read Also:

That explains about getting country name from IP address using geoplugin api and php. The good thing about this API is you do not need to register or obtain an API key to use the web service. It's totally free and simple to use. I hope you like this. Please share this on social networks if you find it useful.

How to Print Contents of a Div using JavaScript

On 1/12/2018 Be the first to comment!

Hi! Today let's see how to print contents of a div using javascript. Have you ever tried printing a web page or part of a page programmatically? There is an interesting utility in JavaScript called print(). It is one of the methods of the 'Window' object and is used to trigger your system's printing feature.

In case you want to print part of a page area, the simple solution is to place all the printable content inside a 'div' block and invoke the print action with some user event. Let's see how to do it.

javascript print contents of a div

Print Contents of a Div in JavaScript:

Let's first create a div container to hold the printable part.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Print Part of a Webpage with JavaScript</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">
    <div id="printableDiv" class="jumbotron">
        <h2>Test Printing</h2>
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</p>
    </div>
</div>
</body>
</html>

In the above markup, we have created a <div> container with an id #printableDiv and placed some text inside. This is the block we need to print.

Next add a button element to trigger the print action when the user clicks on it.

<button type="button" class="btn btn-warning btn-lg" onclick="printIt('printableDiv')">Print this block</button>

Include onclick event to the button and pass the id of the div we have created earlier.

Finally the printing part! Write a simple java script function to print the div contents.

JavaScript:

<script type="text/javascript">
function printIt(divID) {
    var divContent = document.getElementById(divID);
    var WinPrint = window.open('', '', 'width=800,height=600');
    WinPrint.document.write('<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">');
    WinPrint.document.write(divContent.innerHTML);
    WinPrint.document.close();
    WinPrint.focus();
    WinPrint.print();
    WinPrint.close();
}
</script>

The js function will open a window of defined width and height, write the contents of the div to it and invokes printing window using the print() function.

Keep in mind that the contents will be printed without any css styles you have in the webpage. To preserve styles, you must link the css file using windowsobject. document.write() method like I did in the JS code.

One good thing about using this method is it will not fire printing immediately, but the print window as a means of confirmation - just leaving the choice to users in case they clicked on it accidentally.

Read Also:

That explains printing div contents using javascript. The method described in this post is very useful to print a portion of a webpage. You just have to keep all the printable contents in a div block and trigger the java script function. I hope you like this tutorial. Please share it in your social circle if you find it useful.

Get JSON from URL in PHP

On 1/09/2018 12 Comments so far

In this tutorial, I’m going to show you how to get json from url in php script. JSON has become a popular way to exchange data and web services outputs in json format. To send a HTTP request and parse JSON response from URL is fairly simple in php but newbies may find how to parse json difficult.

Let's see how to build a php json parser script. For this script, I’m going to access Google MAP web service via API and get latitude and longitude co-ordinates for a location. Google map api produces both json/xml output. But for this example I’m going to get the json response and show you how to parse json object to retrieve the geo-metric details.

php-get-json-from-url

Codeigniter Login and Registration Tutorial & Source Code

On 1/09/2018 54 Comments so far

Today we'll see a codeigniter tutorial demonstrating user login and registration system. As you know Login and Signup Module (User Management System) forms the base for membership driven websites and applications. I have written about codeingiter login and registration process separately earlier, but got requests from blog readers to provide a complete user management module. So in today's post, I have tried to cover as much as possible in user module comprising home, login, signup and user profile/dashboard page.

So let us see how to create complete codeigniter login and registration system.

Create Database for CI Login & Signup Module:

First create the mysql database required for the codeigniter user management system.

Read Also:
CREATE DATABASE `testdb`;
USE `testdb`;

CREATE TABLE IF NOT EXISTS `user` (
  `id` int(12) NOT NULL AUTO_INCREMENT,
  `fname` varchar(30) NOT NULL,
  `lname` varchar(30) NOT NULL,
  `email` varchar(60) NOT NULL,
  `password` varchar(40) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Run the above the sql commands in mysql db and create the necessary database and table.

Build CodeIgniter Login and Registration System:

To build our codeigniter login and registration system we need a bunch of controller, view and model files. Here are the files we are going to create.

  • home.php - This is the Home page controller of the user management application.
  • login.php - It's the user login form controller file.
  • signup.php - This one is the user signup page(registration) controller.
  • profile.php - This is the controller for my profile/dashboard page.
  • home_view.php - It is the Home page view file.
  • login_view.php - View file for login controller.
  • signup_view.php - View file for signup/registration controller.
  • profile_view.php – It is the user profile view file.
  • user_model.php - This is the model file for the user management module. Here we place all the db transactions of the module.

Codeignitor User Login and Registration System:

In case you don't know, below are the steps breakdown for what we are going to build in this user login/signup system in code igniter.

  1. The user enters the Home page which contains links for Login and Signup on top navigation menu.
  2. As for New Users » user click on Signup link » user redirected to signup/registration form » user fills up the form details and submit » process user details and store it into database » notify user.
  3. As for Registered Users » user click on the Login link on Home page » user redirected to login form » user enter login credentials » authenticate user and redirect to User Profile page.
  4. For Singed-in users » Show User's name and Logout link on top menu bar.
  5. When user clicks on Logout » destroy session and redirect to Home page.

Note: As for designing user interface, I have used the readily available Twitter Bootstrap CSS as it's easier this way and mobile responsive in nature. Check here to know about using bootstrap with codeigniter framework.

Home.php

This is controller for the Home/Main page of the user management module and it shows Login and Signup link at the top menu for guests and User's Name and Logout link for signed-in users.

<?php
class home extends CI_Controller
{
 public function __construct()
 {
  parent::__construct();
  $this->load->helper(array('url', 'html'));
  $this->load->library('session');
 }
 
 function index()
 {
  $this->load->view('home_view');
 }
 
 function logout()
 {
  // destroy session
        $data = array('login' => '', 'uname' => '', 'uid' => '');
        $this->session->unset_userdata($data);
        $this->session->sess_destroy();
  redirect('home/index');
 }
}
?>

Signup.php

This is the controller file for the codeigniter user registration form. It collects first name, last name, email id and password from the user and validates the input and stores it into database.

<?php
class signup extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->helper(array('form','url'));
        $this->load->library(array('session', 'form_validation'));
        $this->load->database();
        $this->load->model('user_model');
    }

    function index()
    {
        // set form validation rules
        $this->form_validation->set_rules('fname', 'First Name', 'trim|required|alpha|min_length[3]|max_length[30]|xss_clean');
        $this->form_validation->set_rules('lname', 'Last Name', 'trim|required|alpha|min_length[3]|max_length[30]|xss_clean');
        $this->form_validation->set_rules('email', 'Email ID', 'trim|required|valid_email|is_unique[user.email]');
        $this->form_validation->set_rules('password', 'Password', 'trim|required|matches[cpassword]|md5');
        $this->form_validation->set_rules('cpassword', 'Confirm Password', 'trim|required');

        // submit
        if ($this->form_validation->run() == FALSE)
        {
            // fails
            $this->load->view('signup_view');
        }
        else
        {
            //insert user details into db
            $data = array(
                'fname' => $this->input->post('fname'),
                'lname' => $this->input->post('lname'),
                'email' => $this->input->post('email'),
                'password' => $this->input->post('password')
            );

            if ($this->user_model->insert_user($data))
            {
                $this->session->set_flashdata('msg','<div class="alert alert-success text-center">You are Successfully Registered! Please login to access your Profile!</div>');
                redirect('signup/index');
            }
            else
            {
                // error
                $this->session->set_flashdata('msg','<div class="alert alert-danger text-center">Oops! Error.  Please try again later!!!</div>');
                redirect('signup/index');
            }
        }
    }
}
?>

This is how the signup form looks like,

codeigniter-signup-form

All fields are mandatory and once the user submits the form the input will be validated against a set of form validation rules. If the validation fails, user will be prompted to enter right data by showing the error message like this.

codeigniter-signup-form-validation-error

If validation succeeds, registration process will be completed and notified to the user.

Login.php

This is the controller file for user login process. It asks for user's email address and password and check if the provided login credentials are correct or not.

<?php
class login extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->helper(array('form','url','html'));
        $this->load->library(array('session', 'form_validation'));
        $this->load->database();
        $this->load->model('user_model');
    }
    
    function index()
    {
        // get form input
        $email = $this->input->post("email");
        $password = $this->input->post("password");

        // form validation
        $this->form_validation->set_rules("email", "Email-ID", "trim|required|xss_clean");
        $this->form_validation->set_rules("password", "Password", "trim|required|xss_clean");

        if ($this->form_validation->run() == FALSE)
        {
            // validation fail
            $this->load->view('login_view');
        }
        else
        {
            // check for user credentials
            $uresult = $this->user_model->get_user($email, $password);
            if (count($uresult) > 0)
            {
                // set session
                $sess_data = array('login' => TRUE, 'uname' => $uresult[0]->fname, 'uid' => $uresult[0]->id);
                $this->session->set_userdata($sess_data);
                redirect("profile/index");
            }
            else
            {
                $this->session->set_flashdata('msg', '<div class="alert alert-danger text-center">Wrong Email-ID or Password!</div>');
                redirect('login/index');
            }
        }
    }
}
?>

It produces a login form like this,

codeigniter-login-system-form

If login failed, the user will be shown an error message like this,

codeigniter-login-form-validation-error

If user credentials are valid, then it will be stored in session and user will be redirected to profile/dashboard page.

Profile.php

This is the controller for the User Profile page. It lists user profile summary and other details.

<?php
class profile extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->helper(array('url','html'));
        $this->load->library('session');
        $this->load->database();
        $this->load->model('user_model');
    }

    function index()
    {
        $details = $this->user_model->get_user_by_id($this->session->userdata('uid'));
        $data['uname'] = $details[0]->fname . " " . $details[0]->lname;
        $data['uemail'] = $details[0]->email;
        $this->load->view('profile_view', $data);
    }
}
?>

That's it. These are all the important controller files required for the code igniter user registration and login system. Now run the app and go to Home page.

codeigniter-login-and-registration-tutorial-home-page
CodeIgniter Login and Registration System - Home Page

Click on Signup link and it will take you to the user signup form.

codeigniter-login-and-registration-tutorial-signup-page

Now enter the details and submit the form. If things gone right, you will be shown with a success message like this,

codeignitor-user-registration-process-success

Now click on the Login link to go to the login page.

codeigniter-login-and-registration-tutorial-login-page

Provide the email and password which you have registered earlier. Now you will be redirected to your Profile page.
codeigniter-login-and-registration-tutorial-profile-page
CodeIgniter Login and Registration Module - User Profile Page

To sign-out the session, click on Logout link at the top navigation menu which will take you back to Home page.

CodeIgniter Login and Registration Source Code:

Download Source

Read Also:

Well! Now we have created user login and registration system in codeignator. I hope you have enjoyed this codeigniter login and registration tutorial. Please let me know your queries through comments :)

Contact Form

Name

Email *

Message *