Monthly Archive: August 2014

3

How to increase scope (change netmask) in windows server 2012

As you may have noticed, there is no easy way to change the netmask of a scope. The only way is to delete and recreate it.

If you have a network anywhere near as complex as the one I’m dealing with right now, you KNOW manual insertion is not even remotely an option. Luckily there is an easy way…. command prompt 🙂

 

Step 1. open up cmd as administrator and export your scope

The command is:

C:>netsh dhcp server \dhcp_server_name scope my_scope dump>c:dhcp.txt

eg. C:>netsh dhcp server \dc1 scope 192.168.1.1 dump>c:dhcp.txt

 

Step 2. Open that document and find the line saying

Dhcp Server \xyz.domain.local add scope 10.0.10.0 255.255.255.0 “scope_name” “scope_description”

and change the netmask to whatever you wish it to be… In my case I changed to 255.255.254.0 for an extra 255 Ip addresses so instead of 192.168.1.1-254 I have 192.168.1.1 – 192.168.2.254

 

Step 3. Delete your scope…

Yes, delete your scope… Be sure that you have opened up the dhcp.txt and confirmed that all your reservations and other configurations are stored in there. (Note. delete using the default GUI MMC console)

 

Step 4. Import modified scope. 

I called my modified scope dhcp_custom.txt and so I will import it with

C:>netsh exec c:dhcp_custom.txt

 

done and done!! 

 

How to solve inconsistent PHP times 0

How to solve inconsistent PHP times

Most likely, the issue is with your php server randomly choosing a timezone and therefore having times which are usually either one hour behind or one hour after..

To solve it, right before the ‘mission critical’ area of your script, use date_default_timezone_set() .

An example of this is

date_default_timezone_set('America/Dominica');

Note: you can test your timezone with

echo date_default_timezone_get();

 

How to add and subtract fom time in MySQL 0

How to add and subtract fom time in MySQL

Luckily for us there is an ADDTIME function we can use to add and remove from times… The syntax is as follows: ADDTIME(datetime,time_to_change) example

SELECT `emp_id` , `clock_time` , ADDTIME( '-01:00:00', `clock_time` ) AS new_time
FROM `timeclock`

Will return

emp_id clock_time new_time
10059 08:30:55 07:30:55
10059 08:31:06 07:31:06
10059 08:31:28 07:31:28
10046 08:33:44 07:33:44

An Update example

UPDATE `timeclock` SET `clock_time` = ADDTIME( '-01:00:00', `clock_time` ) WHERE `id` BETWEEN 40967 AND 41022