Posts

Arrange posts by "order" attribute in WordPress

It's just simple as this function: function my_get_posts( $query ) {     if ( is_home() && false == $query->query_vars['suppress_filters'] )                 $query->set('orderby', 'menu_order');                 $query->set('order', 'ASC');      return $query; } Basically, you need to order the posts by menu_order attribute.

Auto merge data from multiple sheets in a google spreadsheet

Image
Ok, so I heard that you want to merge multiple sheets (let's say 2) in a google spreadsheet? That's easy (after hours of trying :"D) Assuming you have 2 sheets as following: Sheet1 Sheet2: In the merged list or master list you need these information: First Name, Last Name, Company, Job Title, Email Address 1. First thing you need to do is to find out a field to use as merge key . It's Email Address in this case. You also should be noticed that there should be no duplicate email addresses. So in order to get all the unique email addresses from 2 sheets, you need to use UNIQUE. But UNIQUE will also give you a blank row (ending row), so FILTER will do the job: =FILTER(UNIQUE({Sheet1!H2:H;Sheet2!E2:E}),NOT(ISBLANK(unique({Sheet1!H2:H;Sheet2!E2:E})))) Notes: Look at how I refer to another sheet (Sheet!H2:H...) You only enter the formula in cell E2 of the Master list, all the email addresses will be filled in other rows automatically. 2. Then ...

Amazing!!!!

Image

Quote of the day

Image
~Confucius.

Redmine - 500 error when upload files

For couple years, users could not upload files into our Redmine instance when creating or updating issues (or tickets). We ignored it because most of the tickets were created from the email pulling task (IMAP) and the attachments were created just fine. But when we developed an external tool to manipulate issues with attachment, I think it's time to seriously looking at the problem and fix it. Here is the command we try (upload file using Redmine's Rest API): # curl 'http://myredmine.com/uploads.json' -X POST -H 'X-Redmine-API-Key: <myapikey>' -H 'Content-Type: application/octet-stream' --data-binary "@myfile.png" and errors (/var/log/redmine/default/production.log): ... Completed 500 Internal Server Error in 15.4ms Errno::EACCES (Permission denied - /var/lib/redmine/default/files/2016/12):   app/models/attachment.rb:108:in `files_to_final_location'   app/controllers/attachments_controller.rb:88:in `upload' ... Rea...

Migrate from manual-installed gitlab 7.8.1 to omnibus gitlab-ce 8.14.0

As you may already know, you can only restore your backups in the same gitlab version. So it means that you cannot move your old repositories to the newer version of gitlab using the backup/restore method. Fortunately there is another way to import those repositories into gitlab. Follow these instructions: In my case, I want to migrate my old repositories from a manual-installed gitlab v7.8.1 to omnibus gitlab-ce 8.14.0 instance which were installed on the same server. 1. Create a group folder in the gitlab-ce's repositories directory: sudo -u git mkdir /var/opt/gitlab/git-data/repositories/geniuses 2. Copy the old repositories (repositories in gitlab are bare ones): sudo cp -r /home/git/repositories/* /var/opt/gitlab/git-data/repositories/geniuses/ 3. Correct the permissions of the new folder and all of its sub-directories: sudo chown -R git:git /var/opt/gitlab/git-data/repositories/geniuses/ 4. Import the new copied repositories: sudo gitlab-rake gitlab:import:r...

Quote of the day

"When you teach to the heart, the mind will follow." ~ http://www.ted.com/talks/victor_rios_help_for_kids_the_education_system_ignores