50 Most Influential Projects

LEARN HOW PROJECT WORK HAS CHANGED, IS CHANGING AND WILL CONTINUE TO CHANGE THE WORLD https://mip.pmi.org/home

What’s a world without projects? A world without architectural marvels, medical breakthroughs, must-see mega-events or advancements in technology. And what’s behind every great project? A great project team!
To commemorate our 50th anniversary, PMI has ranked the 50 most influential projects of the past half-century. Thousands of projects were considered, but only 50 were chosen – the icons, innovators and game-changers that defied expectations and transformed our culture in ways that continue to reverberate.
Advertisements
Posted in Project Management | Leave a comment

Two useful SQL queries

1. Sometimes we do need insert some data from sub select query. But did you try to use insert some data from sub select query include another sub select query. Yes, it’s possible. Below is an example: We want to insert a new subscription (subscription_id = 301) for each users who already have a certain subscription (subscription_id = 48), but we don’t want to create duplication, so we need remove those uses already have this new subscription (subscription_id = 301). You can see the first sub select will return the user_id who already have subscription_id = 301, then 2nd sub select will build user_id, and subscription_id = 301, which those user has subscription_id = 48, and whose user are not in the first sub select result.

INSERT INTO user_subscriptions (user_id, subscription_id) 
  SELECT user_id, 301 FROM user_subscriptions 
    WHERE subscription_id = 48 AND user_id NOT IN 
    (SELECT user_id FROM user_subscriptions WHERE subscription_id IN (301))

2. In this case, we used CONCAT() and GROUP_CONCAT() to build one to many relationship in one row. Each event has multiple products and services related, so in one table, it will have multiple rows with one event_id, we want to concatenate all product/services for each event id, then we created below query, which can pull the data as we expected.

SELECT COUNT(*) AS `Rows`, `event_id`, 
  GROUP_CONCAT(CONCAT(customers_affected,':',product,'/',service)) AS products 
  FROM `event_product_service` 
  RIGHT JOIN event_core ON event_core.id = event_product_service.event_id 
  GROUP BY `event_id` ORDER BY `Rows` DESC

These two queries shows some tricks that we may never tried, but it does very practical and useful when you looking for it.

Hopefully it can give you some hints when you have similar situation as I have.

Posted in Computers and Internet, Uncategorized | Leave a comment

Set Log Rotation

Source from: https://linuxconfig.org/setting-up-logrotate-on-redhat-linux and https://linoxide.com/linux-how-to/setup-log-rotation-logrotate-ubuntu/

 

What’s log rotation?

Logrotate is a utility designed for administrators who manage servers producing a high volume of log files to help them save some disk space as well as to avoid a potential risk making a system unresponsive due to the lack of disk space.

In web server, it’s very often to save access_log and error_log on purpose. access_log will help you to check hijack and error_log will help you to locate any error in your web apps.

We will describe log rotation in:

  1. Check if logrotate is running
  2. Config logrotate
  3. Add your log files into logrotate.d

Normally the logrotate will be executed in a daily routine.

so you can find if it’s enabled in /etc/cron jobs

$ ls cron.*
cron.deny

cron.d:
0hourly katello-host-tools sysstat

cron.daily:
logrotate man-db.cron mlocate rhsmd

cron.hourly:
0anacron

cron.monthly:

cron.weekly:

So in our case, it enabled in cron.daily, which means running every day.

Logrotate’s configuration is done by editing two separate configuration files:

  • /etc/logrotate.conf
  • service specific configuration files stored in /etc/logrotate.d/.
cat /etc/logrotate.conf 
# see "man logrotate" for details
# rotate log files weekly
weekly

# use the syslog group by default, since this is the owning group
# of /var/log/syslog.
su root syslog

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0660 root utmp
    rotate 1
}

# system-specific logs may be configured here

The main options of logrotate are:

  • weekly: rotates the log files once a week
  • su root syslog: will archive the logs using the specific user (root) and group (syslog) to prevent issues with permissions
  • rotate 4: makes sure that four old versions of the file are saved. Rotates a given log four times before deleting it, so this keeps four weeks of logs online.
  • create: The old file is saved under a new name and a new file is created
  • compress: compress causes logrotate to compress log files to save space. This is done using gzip by default, but you can specify another program
  • include: This important option makes sure that the content of the directory /etc/logrotate.d is included. In this directory, files exist that specify how to handle some individual log files.

You can see for example the logrotate configuration for the apache web server

# cat /etc/logrotate.d/apache2 
/var/log/apache2/*.log {
	daily
	missingok
	rotate 14
	compress
	delaycompress
	notifempty
	create 640 root adm
	sharedscripts
	postrotate
                if invoke-rc.d apache2 status > /dev/null 2>&1; then \
                    invoke-rc.d apache2 reload > /dev/null 2>&1; \
                fi;
	endscript
	prerotate
		if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
			run-parts /etc/logrotate.d/httpd-prerotate; \
		fi; \
	endscript
}

Logrotate contains some additionals options that you can see above:

  • daily: rotates log on basis day
  • missingok: Don’t raise an error if the log is missing
  • delaycompress: Don’t compress the file until it has already been rotated. This is to prevent corruption if the daemon doesn’t close the log file immediately.
  • notifyempty: Don’t rotate the log file when it is empty
  • create 640 root adm: this will create new log files with set permissions, owner and group
  • sharedscripts: If the wildcard matches several files, run any scripts once for all files
  • postrotate/endscript: Specifies some commands or scripts that should be executed until the endscript keyword, after the logs were rotated.
  • prerotate/endscript: as postrotate/endscript, it specifies commands or scripts that should be executed before log rotating begins.

You can have some information about the additional options by using the manual

man logrotate

 

 

Posted in Uncategorized | Leave a comment

PDO statement::execute(): MySQL server has gone away

Just in case you have same issue when you deal with big data in Laravel, and try to save the big data into database, you may have same issue.

Original I thought it was time out caused MySQL connection lost, after a couple of round test, I found it’s not because connection lost. (You can use mysql_ping() to test connectivity). The reason is because the data is too big which is out of max_allowed_packet = 2M. Then I changed it to 5M, and now I got another issue:

sqlstate[42000]: syntax error or access violation: 1118 the size of blob/text data inserted in one transaction is greater than 10% of redo log size. increase the redo log size using innodb_log_file_size.

This is because we are using innodb engine, which saved transactions into log file in case you want to rollback the last operation. So the old value of innodb_log_file_size is 5MiB, then I changed to 20MiB, then restart MySQL DB server, the issue is gone.

It’s very interesting that we all thought the server gone away is because connectivity issue, but it’s because we don’t have enough memory of file size settings.

Posted in Uncategorized | Leave a comment

A Work-from-Home Guide to Internet Speed

If your job depends on your home Internet, our bandwidth guide is for you.

Editor’s Note: Frontier Business posted the article below on LinkedIn.

undefinedThere are many reasons why almost 3% of the workforce is spending less time at the office. One study even shows that employees who work from home are actually more productive thanks to fewer distractions from co-workers and a quieter workspace.

To keep up with your workload, though, your home Internet speed needs to be at least as reliable as business Internet. Read our guide below to help determine how much bandwidth you need and compare residential or business service.

Determining Your Current Bandwidth

Bandwidth is the maximum rate at which your computer can receive information from the Internet. Larger files, such as movies, require more bandwidth, while checking your email or working on a Word document uses less.

To determine your current bandwidth, test your Internet speed with an online speed test tool. While your service provider might promise a certain maximum speed, the speed you actually get depends on the number of devices that connect to the Internet at the same time, the types of activities you do (word processing, video conferencing, chatting with clients, etc.), and cloud and storage needs.

In most cases, Internet connections download much faster than they upload, since most online activity involves your computer receiving information from the Internet. Upload speeds tend to be slower because sending emails and posting on social media don’t require a lot of bandwidth, but depending on your specific needs you could require a faster upload speed.

Calculating How Much Bandwidth You Need

If you work from home and are considering adjusting your Internet service, you’ll first need to calculate how much bandwidth you actually need.

For example, you wouldn’t want the most elite business Internet service plan if you live alone and work from home during the day. But if you have a family, factor them and their online activities into your bandwidth needs.

Opting for Residential or Business Internet

Residential Internet will probably be enough if you use your home as a satellite office, but you may have to deal with speed lags throughout the day because some residential lines are shared with your neighbors to keep the overall cost down, be sure to check with your local service provider. If you’re a small-business owner, you may want a dedicated business line so you’ll have a consistent connection around the clock.

Another perk to a business line is some Internet Service Providers (ISPs) offer service-level agreements (SLAs) that can guarantee a certain level of performance, as well as compensation if the service doesn’t meet that level. ISPs may also offer small business-owners Virtual Private Networks (VPNs), data backup, security, and Wi-Fi network setup for an additional fee.

Some companies require their remote workers to connect their home computers to a VPN—a private network that allows you to share data securely. If your employer hasn’t provided a computer with an already-established VPN, you may want to think about that feature when you’re deciding between residential and business Internet for your home.

Choosing Your Internet Service Provider

Now that you’ve figured out how much bandwidth you need and whether you want residential or business high-speed Internet service, how do you choose a provider? Consider the following tips:

  • Make sure they offer high-speed Internet. The faster your Internet connection, the better—especially when you’re working on a deadline.
  • Compare prices based on download and upload speeds. Not all companies use the same unit of measurement for speeds (i.e., 60 Mbps is not the same as 60 Gbps).
  • Pay attention to contract terms. If you’re working from home short term, you may not need a year-long contract. Some ISPs offer month-to-month options, while others will charge you a fee for canceling service before your contract ends.
  • Ask about add-ons and fees. Business customers may get some added perks with their service plans, but even if you decide to go with a residential plan, ask about any additional benefits or fees. For example, some providers charge a one-time or monthly fee for the router, and some offer free virus protection or website hosting.

In the end, it just takes a little research into Internet speeds, and you can get as much work done at home as you do in the office—if not more!

Posted in Uncategorized | Leave a comment

Why we lost 1M people?

Today is March 28, 2019, When I open the census.gov page, https://www.census.gov/popclock/. I found US population decreased again, that’s good news or fake news??

I pulled my last saved screen shot on Dec 04, 2018, the population number is 329,114,356.

2018-12-04

So I use select a date to search the US population on Dec 04, 2018, the population number is only 328,096,801, we lost over 1 Million people!!

2019-03-28

I don’t know how to explain this: on the same day the data difference is 1 million? which number I should trust on earth?

Posted in Uncategorized | Leave a comment

Linux grep command

Sometimes, we need grep a string with slash/ or backslash\, like we want to know where we called this model “use App\Models\Users” in the code.

First, I tried grep -rils “Models\\Users”, nothing returned;

Then I tried grep -rils “Models/\Users”, still nothing returned;

Very occasionally, I tried grep -rils “Models\\\Users”, it returned results as I expected.

Posted in Computers and Internet | Leave a comment