Tag Archives: tutorials

Maximum Input Variables WP Error

The max_input_vars limitation error is a very common issue that most WordPress web developers and website owners may encounter at some point in their career. Few days ago, my website also experienced the same problem. The solution is very simple; increase the value assigned to max_input_vars in the PHP configuration file on the web server. However, depending on server setup, you may have to do few more things to get this problem fixed.

Warning
Editing php.ini may result in complete failure of the php module and it may put your website out of service. If you are hesitant about something, hire a professional. I take no responsibility for any issues arise out of the following instructions.

Continue reading Maximum Input Variables WP Error

Recover Data from Internal Hard Drives

Computers are made of multiple different components. Not all components are vital to operations of a computer. For example, failure of a disk drive (DVD/BlueRay) would most likely have little to no impact on other functions of a computer. But failure of a vital component such as the processor, power supply or malfunctioning of a hard drive will lead to a situation where the computer is no longer operational. Do not panic. You may be able to recover data from such computers using either an external enclosure or using an IDE/SATA to USB adapter.

You can recover data from most “broken” computers even if you are not tech savvy. If you perform the recovery at home (or business) by yourself, you will save from $100 to $2000 CAD (2016 estimates) on data recovery costs.

External Enclosures

External enclosures are bit more expensive than the IDE/SATA to USB adapters. There are few advantages of this method for example, encloses these allow you to use the hard drive as an external storage device, if the hard drive is still in good condition. Another advantage of this method is that most enclosures are compatible with multiple interfaces such as USB 2.0, USB 3.0, older FireWire, etc. Higher end external enclosures will also have the ability to connect to a network as a Network Attached Storage (NAS) or to connect to multiple computers simultaneously.

Installation of external enclosures is fairly simple. To setup, attached the IDE or SATA connector and power supply cable from the enclosures’ printed circuit board (PCB) to the internal hard drive. You may also follow the instructions posted under IDE and SATA to USB Adapters. They are very similar to each other.

Example of a External Enclosure with connection points highlighted.
Example of a External Enclosure with connection points highlighted.

Image modified from: https://en.wikipedia.org/wiki/Disk_enclosure#/ media/File:Usb_firewire_hard_disk_enclosure.jpg

IDE and SATA to USB Adapters

The IDE/SATA to USB adapters operate on the same fundamental principles as external enclosures. The major difference is that they do not have enclosure casing hence mostly used by computer technicians. The best advantage of using this method is that you can access the hard drives of computers and servers without completely removing the device from the main unit. The adaptors have a simple control board with IDE, SATA or other connectors and a power supply. As long as you can access these connectors on the hard drive, you can recover data from a unit without wasting time on removing components. These adaptors also take less space hence they can be easily transported and stored. Another advantage is the price. I must admit it is not a very good advantage because the price differences between IDE/SATA to USB adapters and external enclosures have significantly decreased in recent years.

Installation of these adaptors is bit more complicated than the external enclosures. Here are some suggestions for installation and usage of IDE/SATA to USB adapters.

Step 1: Ground yourself by using a wrist strap or by connecting a wire between yourself and the computer case (metal).

Step 2: Locate your internal hard drive and get clear access to data connector (IDE/SATA) and power connector of the unit.

Internal hard drive with attached cables from motherboard and PSU.
Internal hard drive with attached cables from motherboard and PSU. Click for enlarge image.

Step 3: Remove the attached IDE/SATA cable that runs between the motherboard and the hard drive. Remove the power rail connection between the computer’s Power Supply Unit (PSU) and the hard drive.

SATA and power connectors on a typical internal hard drive.
SATA and power connectors on a typical internal hard drive. Click for enlarge image.

Step 4: Attach the SATA connector from the IDE/SATA-USB to the hard drive and power connector from the IDE/SATA-USB power unit.

SATA and power connections from the IDE/SATA to USB adapter.
SATA and power connections from the IDE/SATA to USB adapter. Click for enlarge image.

Step 5: First power on the internal hard drive by plugging the IDE/SATA-USB power unit to a wall outlet. Then connect the control board to the IDE/SATA cable and the USB cable. Connect the USB cable to the computer.

USB connection to the computer via the IDE/SATA to USB adapter.
USB connection to the computer via the IDE/SATA to USB adapter. Click for enlarge image.

You should now have a USB attached mass storage unit on your computer just like a USB key. However, if this is not shown on the first attempt, disconnect power to the IDE/SATA to USB adapter, wait few seconds and reconnect the power.

Limitations

If the internal hard drive data is protected through hardware or software encryption, then this simple recovery method may not work. Sometimes only the main user folder such as “Documents” or “My Documents” is encrypted by the operating system (OS). In this case you will be able to extract data from all other locations except the user folder. For instance, Windows XP, 7 and 8 usually encrypt user folder by default except if the user change the default settings. This limitation also applies to professional data recovery services. If the password or encryption key is known, then data recovery companies may charge you a premium and may be able to recover your data. If the password or encryption key is unknown, then depending on how strong the encryption is no one can guarantee recovery success.

Another limitation is the differences in interfaces and communication protocols. Older products may have operating and file systems that are incompatible with modern computers. Hence, you will not be able to read information from the extracted drive. The best solution for this is to find an older unit that can read such data files and use that in the recovery process.

Corrupted files can also pose a major problem for recovering data. Sometimes when hard drives fail, they can overwrite meaningful data with useless junk. This can be reserved but at a very high cost because this type of recovery require military grade data recovery tools.

Finally, if the components of the hard drive have failed, then you have to send the drive to a laboratory that can take apart the disks and read it in a special dust free, static free and highly controlled environment. This is probably the most expensive recovery option and most likely be used by large corporations and government agencies than consumers and small businesses.

Installing a router and routing basics

Modem, Router and Modem-Router combination

The term routing has been in used long before the Internet age. In the past, routing refers to distribution of mail or landline (traditional) phone calls through mail sorting centers or telephone switching centers. Today, a router is an electronic networking device that acts as the “middle guy” between two or more data lines from different devices. A router manages the packets (data) migration between computers within the local area network (LAN) and provides distributed Internet (Wide Area Network) access to the local clients.

There are differences between a router and a switch. A router assigns individual identification tags for each unit in the LAN known as internal IPs through a method called Dynamic Host Configuration Protocol (DHCP). DHCP help each individual unit to communicate properly with the rest of the units in the LAN and on the Internet (WAN). A network switch connects data lines from one single network for another without routing. A switch is often used in conjunction with a router to add additional physical ports or wireless connections to a network. A switch must obtain DHCP IP addresses from a router within the same network to work because switches do not have the DHCP engine.

Modem is a unit that converts signals from the WAN and transcribes into LAN format for internal use. It is the main communication hub between your home and the Internet Service Provider (ISP). It is usually provided by the ISP and sometimes contains a built-in router. If your modem has more than one LAN connection, then it must have an internal router. Without a router and its’ DHCP capabilities, you would not be able to connect more than one unit to the modem.

If you want to use a separate router with these modem-router combination units, you have to remove the routing capabilities of the unit. You can do this either by contacting your ISP or by following instructions on your specific model. A router is connected to the (or a) LAN port of your modem.

You may ask what is DHCP? DHCP is like a local address assignment office. When you paid for your Internet connection, usually the cable or telephone company assigns you an IP address known as the external IP. Each computer/network unit requires a unique IP address to communicate with other network equipment. But almost every household and business has more than one computer/network unit. The DHCP creates local addresses to separate each computer/network unit while maintaining the connection to outside world using just single IP address; the external IP. Another way to look at this is the router’s DHCP is like an intercom internal telephone exchange; one main phone number with multiple extensions. Each computer/network unit has their own internal IP (just like a telephone extension), but all units can be reach though a single Internet connection to the outside world. You cannot use a one Internet connection with a single IP to connect several units without a DHCP system.

Parts of a Router

Most consumers are not interested in internal hardware of networking equipment. However, it is important to have a familiarity with at least the external parts of a router in order to make an informed purchasing decision. The following diagram shows the basic parts; the WAN (Internet) port, LAN (local) ports, reset switch and the WPS push button. Depending on the type of router, the location of these may differ. Generally the WAN port is coloured or marked differently from the LAN ports. The reset button is usually a pinhole button where you need a pin/pen tip to press it.
parts_dir-890r
parts_wrt1900ac

Above: Two images of a D-Link router and a Linksys router. 1. WPS button and it is usually pops out of the back surface. 2. LAN ports. Typically there are four ports on consumer grade routers. 3. WAN (Internet) port where the ISP connection is attached. 4. Rest button and unlike the WPS it is usually a pinhole button. This prevents accidental hard resets. Click on images to enlarge versions.

WAN port: The connection from your modem provided by your ISP will connect to this port via a CAT5e or CAT6 network cable (regular computer network cable).

LAN ports: Any computer or device can be connected to one of these ports. Usually only about four to five LAN parts are provided by the router manufactures. You may increase the number of LAN ports by attaching a network switch. A network switch can be used to increase the number of LAN ports from 4 to 50+. For a general home use with a family of four, I would recommend a simple 4 or 6 port switch or router.

WPS button: This is a standard secure WIFI connection method. If a device is equipped with the WPS (Wifi Protected Setup) button or software and a compatible wireless card, it can be connected to the wireless LAN by pressing the buttons on both units. Please follow the instructions on your specific router and the device for configuration.

Rest button: There are several things that can be obtained from the reset button. As the name implies, it can be used to reset the router to factory settings. Additionally, some router will allow the users to even rest set the router firmware all the way back to the original version. Depending on the router if you hold down the reset button for a short period, generally it will result in a factory default. If you hold the button for more than five seconds of so, it may reset the whole unit back to the original factory setting.

Installing a Router

Consumer routers currently in the market are usually plug-and-play type units. Manufactures includes quick install guides for faster setup. Depending on the manufacture and the quality of the product, a router can be as simple as just a DHCP server with few basic features all the way up highly customizable unit with as complex as VPN configurations (higher price units have more features). For home use I recommend a simple basic router. But if your house is large (eg. over 1500 sqft) or the wireless connection is not reaching every corner of the house, you should invest in a high-end router.

Typically a router can be installed by:

    1) Plug-in the Internet cable and at last one wired LAN computer.
    2) Turn on the power to the router and wait for few seconds (refer to specific manufacture instructions).
    3) Open a web browser on your LAN connected computer and either type in the router’s internal IP address or in “smart routers” the web address provided by the manufacture.
    4) Follow the “quick setup” or “automatic setup” or “plug-n-play setup” (each manufactures will have a different term to describe easy setup feature) to configure the router.
    You will have Internet with DHCP at the end of the Step 4. If that fails, do not immediately reboot the router. Instead wait few minutes (~10 min) because sometimes it takes more time than what manufacture stated to complete the initial setup. If there is still no connection, then reboot the router by physically disconnecting-reconnecting the power supply to the router.

Configuring a Router or Routing system of a modem

Computers

Simply plug-in the computer to a LAN port using a CAT5e or CAT6 cable. For wireless, use either the provided password by the manufacture or the new password you have created. Make sure to pick the wireless network name or SSID you have created during the setup of the router to find your network.

IP/Network Cameras

IP or network cameras are becoming popular due to lower prices. They are used as a deterrent against crime, baby monitors, pet monitors or simply for fun. While the “smart” IP cameras will allow you to view the live feed from anywhere in the world using a mobile application, you can also get direct access to most of the IP cameras from your web browser. To do this, you should reserve the internal IP of the camera using DHCP reservation in your router. Otherwise, every time the router reboots (power failures, etc) a new internal IP will be issued to the device. By reserving the internal IP, you can use the same internal IP to access the camera from any web browser by entering the internal IP address.

The DHCP reservation feature can be found in several places in the firmware (router software) depending on the routers’ model number and the manufacture. Please refer to the user manual or call the 1-800 helpline if you are uncomfortable with changing router configurations manually.

An example of a typical DHCP Reservations Table with three devices with reserved internal IPs.
An example of a typical DHCP Reservations Table with three devices with reserved internal IPs.

Network Attached Servers (NAS)

Similar to IP cameras, I highly recommend DHCP reservation for NAS servers. However, just like the IP cameras, most NAS server manufactures will allow you to access the home server using a mobile application or a web program regardless of the internal IP address. Additionally, if the NAS server is properly setup with a device name, regardless of the internal IP address, you can connect to the NAS server using the device network name. The IP cameras can also be setup with network names hence eliminating the need for the DHCP reservation. But in the long run, I highly recommend both network names and DHCP reservations for NAS servers and IP cameras. It makes it easier to troubleshoot problems in the future.

Network Printers

I do not recommend manual installation of network printers. Use the software provided by the manufacture to install the printer through a LAN connection. Most companies like Brother, Cannon and HP have excellent software tools to help you install (map) the printer to your home computers. You do not need a DHCP reservation for this type of installation because the printer software will look for the printer name/ID and the MAC (Media Access Control) address for connection.

Frequently asked Questions

How often should a router be replaced? A typical consumer grade router should last for at least one year with heavy usage (large downloads and uploads with heavy bandwidth usage). Some routers can last for five to six years. But the technology is changing at a rapid rate; hence to keep up with the technology and the increasing speed of the Internet, I would recommend changing the router biennially.

Do I need a router? Please consider investing in a router:

    -If you have more than one computer or network device (such as network printers, etc) and you only have one single LAN port available on your modem
    -If your modem comes with a routing capabilities but with limited number of LAN ports
    -If you need wireless (WIFI) connections, which is not provided through a ISP modem-router combination
    -If the range of the wireless (WIFI) provided by the ISP modem-router is small or the signal strength is weak
    -If you are planning an advanced LAN network (such as hosting file servers, multiple IP cameras, etc)

I recommend buying 10/100/1000 Mbps or gigabit routers and networking devices for both consumers and businesses. I do not know why companies still manufacture 10/100 Mbps units. Routers and switches are cheap and gigabit units will benefit you especially with the higher internal file transfer rates.

How much should I spend? If you are living in a small apartment or a condo, there is no point of buying a high-end top of the range router. The prices increase with the wireless range, the strength of the signal and the processor/hardware capabilities of the unit.

When should I add a network switch? If your wired network expand to the point where you no longer have enough wired LAN ports on the router, then buy a 10/100/1000 Mbps switch. Because most families now have NAS servers for family pictures, movies, music and other media, invest in gigabit routers and switches, which will improve the internal data transfer rates. Any network equipment that handles up to 1000 Mbps will not provide the full capacity throughput to the Internet due to Internet (ISP) speed limitations. (I don’t know any Canadian company that offer 1000 Mbps Internet speeds at this time).

Protect and secure WordPress admin

The plain HTML based websites are no longer popular on the net. This is because the PHP based Content Management Systems (CMS) offer wide range of flexible solutions. From development stand point CMS programs allow easy integration of different tools such as jQuery, JavaScipt, PHP scripts and many more. From end-user point of view, it is much easier to manage a CMS based site like a WordPress or a Drupal site than to carefully edit each HTML Continue reading Protect and secure WordPress admin

How to build a basic antenna

We use wireless devices to send and receive information without worrying about physical obstacles. In the old days, most consumer grade wireless devices such as mobile phones, routers and RC controllers came with large antennas. Today some manufactures decided to go with internal or built-in antennas. This is not always beneficial to the consumer. For example, if you have a weak signal in an area, it would be difficult to change the position of the antenna because; you do not know where is it in the casing and you may not be able to place the device in a position. The solution is to add a external antenna.

Antenna Theory

This is a very specialized area of engineering and physics. In fact, I do not think that I am qualified or educated enough to go into details on antenna theory. Likely, an experienced Engineer has posted all the details here. If you need extensive information on how antennas work, that is the best place to start.

For our purpose of building a home made antenna, we only need few details from basic physics. This is because I will introduce you to a basic antenna design.

Antenna Length

All radio equipments comes with details on specific frequencies in which the data is transmit. We can use that information to build a whip antenna (single wire). The length of the antenna itself (“the exposed wire”) depends on the frequency of the device. To calculate the length, we take the speed, c in which the wave propagate (travel) and divide that by the rated frequency of the particular device.

The formula for length (actually it is the wavelength) is, l = c/f and since most waves travels close to the speed of light in a vacuum, we can assume that c = 2.998 x 108m/s. Now we know two unknowns (frequency is taken from a published documentation of the device), we can calculate the required length. For example, if I were to build an external antenna to my Vera home automation controller with the f = 908 MHz, I would have to build an antenna that is about 33.02 cm in length. But generally we do not built at full wavelength. Instead, most antennas use either 1/2 or 1/4 of the wavelength. As long as the antenna length is within those multipliers, it will work fine.

Antenna length difference due to wavelength difference between 2.4 GHz vs 900 MHz
Antenna length difference due to wavelength difference between 2.4 GHz vs 900 MHz

If you hate calculations, search for a online calculator. Make sure you are using the right calculator because depend on the type of antenna, the information is varies.

Build it

Once you have calculated the required length, you may use a piece of coaxial cable (with the copper core) to build your antenna. Strip the outer cable (ground plane) to expose the inner core copper wire. The length of the exposed core must be the exact same length as what we calculated for our antenna length. Let’s say we want a 908 MHz antenna. Then the core wire should be exposed exactly 33.02 cm or close to that. The length of the rest of the cable will not effect your wireless signals. But longer the cable, higher the impedance hence may even weaken the signal.

There are several choices on how to connect the other end to the device’s circuit board. I recommend against soldering directly onto to the PCB. Instead, use a pigtail connector or a wire. Some PCBs come with removable antenna wires (“clip ons”). They are usually U.fl connectors. Yes you can buy them online (cheap) with all the connectors and wires attached. If your board does not have removable connectors, you can solder a wire between the board and the pigtail connector. By keeping the antenna wire itself separate from the PCB, you now have greater flexibility in future modification.

If you do have removable connections between the PCB and the antenna wire, then it is most likely a U.fl type connector. Read more about other types of connectors here.

If you are building a GSM (~ 900 MHz) antenna, order something like, SMA female straight to U.fl/IPX Pigtail cable. The other option is to take the PCB connector from an old router (regardless of wifi frequency) and use a RP-SMA connector type antenna. Note that RP-SMA is the type that comes in 99% of all WiFi routers with external antennas. However, most GSM based antennas such as ~ 900 MHz requires a SMA female connector.

Most consumer products with antennas do not come with a good ground plane connection. You can connect a wire between the antenna lead and any of the socket plates (Example of a socket plate is highlighted by B on the following image) for a good ground connection. Make sure you clean the socket plates before attaching the ground wire.

Internal view of D-Link LAN Switch.
Internal view of D-Link LAN Switch.

Special note: if you are an electronics enthusiast in Calgary, try MRO for supplies. I am not affiliated with them nor promote them. However, I was able to find most electronics parts such as ICs, resistors, transistors, antenna parts, etc over there.