curl Unsupported Request Method and Protocol
A weird issue
Svn2Git.NET 1.0.0 Released!
Svn2Git.NET - A cross platform svn to git tool.
重新实现.NET Core的 double.ToString()
目前C#中double.ToString()的问题
.NET Core 2.0发布后,整个框架的性能提升了不少。但是仍然有一些基础数据类型的性能不尽入人意,例如double.ToString()
这个常用方法的性能。一开始 .NET Core团队发现这个问题,是因为double.ToString()
在Linux下的性能比在Windows下慢7倍. 后来为了提升性能,.NET Core团队利用Core RT的代码重写了造成性能瓶颈的 _ecvt 函数,但性能仍然比在Windows下慢了3倍。
Fatal The remote end hung up unexpectedly
Whenever you meet a fatal: The remote end hung up unexpectedly
error during git clone
, please check through following steps:
Change NuGet global package folder path
It spent me 3 hours to find a way to change the default NuGet global package folder path. Finally I end up following solution:
Fixed .NET Framework 10 years old bug
Since my PR has been merged into the master branch of .NET core, this 10 years old bug from .NET framework to .NET Core finally gets fixed. I’d expect it be included in 2.1.0 release.
.NET中值类型比较的问题以及修复
.NET中值类型(ValueType
)比较时隐藏着一个底层的bug, 这个bug已经有接近十年未被修复。从 .NET Framework 到 .NET Core一直存在。StackOverflow上早在2010年就有人提出了这个问题: 10 years old bug.
Rotate array
How to rotate an array clock-wise in kth position?
Performance issue when passing string parameter
Pass std::string(“01”) or “01” to a function?
501 server cannot accept argument
Issue of FTP connection from Linux to Windows Server
Bit operation summary [In Progress]
Bit operation summary
Minimum moves to equal array solution and explanation
Problem Description
Assign cookie solution and explanation
Problem Description
Nim game solution and explanation
Problem Description
Save your life from git rebase --skip
Changes could be lost if we execute git rebase –skip. Following are steps to rescue your changes:
std::basic_stringbuf member __xfer_bufptrs should be explicitly declared private
In a recent project, we have to do a trick to test our legacy code. We define private keyword to public as following:
Setup cdt with cygwin
To setup CDT with cygwin, following below steps.
Add another java project as dependency in eclipse
Let’s say we have 2 projects A and B. Project A is the dependency of project B.
Use jersey 2.0 without maven
The most annoying thing recently for me is, I have to setup maven as a premise for using Jersey 2.0. The official document of Jersey does not provide enough information for me to setup Jersey without maven installed. After hours investigating and searching on the internet, I finally make it to work.
Enable telnet on Windows 10
- In the search box enter cmd.
- Right click the Command Prompt app and select “Run as administrator”.
- In the command prompt, execute following command:
Windows 10 - remote desktop to CentOS
Recently, I have a project needs to be developed on CentOS with C/C++. I decided to setup a CentOS VM and remote from my Windows 10 PC. To enable the RDP from windows to linux, I’ve found a very useful article HERE. However, there’s a missing step and some typos in the article. So I decide to re-write the article as following:
Windows 10 - use ctrl+space to change input method.
If you’re using multiple input methods, you’ll notice that windows 10 only supports win + space to change input methods. It’s really a pain for those who upgraded from windows 7. Fortunately, we have a simple way to save ctrl+space back in windows 10.
How to implement inheritance in react.js.
React.js is a great library to build view in component way. However, one thing makes me frustrated is there’s no inheritance support by using React.createClass() to create a react component. A “Class” cannot be inheritied! Facebook now recommend us using High order components to address code reusable issue, which makes me more frustrated. OK, I’m an old school object oriented guy. I just want something in classic: Class inheritance and overriding.
RatchetProJS v1.0.0 released! A lightweight mobile framework let you build things easier.
So what’s RatchetPro.js? Two years ago, I found a prime project released by twitter - Ratchet.js. It’s lightweight, only contains core functions to run HTML5 web apps. Compare to JQuery Mobile or Sencha Touch, it’s more like a library other than a framework. It’s extremely useful if you already familiar with bootstrap. I implemented my several mobile HTML5 apps based on Ratchet.js and it runs very smoothly and quickly.
InfoPath Analyzer is open source now.
Well, finally I made this decision. The source code is now hosted on github. There are couple of reasons for opening the source code of IA:
1. Microsoft stopped the development of InfoPath. There is no roadmap of it, says, InfoPath retired.
-
InfoPath is still being used in the world. Alternative solutions are coming out these years.
-
I was a C# guy as the time of building IA. It’s been a long time since then I’ve changed my career to dive into the open source world.
-
Currently, I become the bottleneck of IA. Open the source code of IA would be helpful not only for the InfoPath users, but also for the growth of e-form industry.
Hope it helps you guys :)
Started a new project on github - fabric.ext
My project is heavily using fabricjs. However, some events and objects such as double click event, right click event, video and audio obejcts are missing in fabricjs. I decided to start a fabric.ext project on github to impelment these missing features. Hope that will help you as well.
IMPORTANT: I’m not going to include video/audio objects in this project as of our privacy. However, events and any other objects would be included.
Any feedback is welcome :)
InfoPath Analyzer is open source now
Well, finally I made this decision. The source code is now hosted on github. There are couple of reasons for opening the source code of IA:
Convert office files(ppt, excel, doc...) to images on CentOS 6.5
There’s a requirement in my recent project to convert office files to multiple images. After hard work for a week, I found the correct steps that cannot be searched through Google. I’m going to write it down, hope these steps save your time.
Brief
Use unoconv to convert office files to PDF, then convert PDF to images leveraging ImageMagick.
Install unoconv
- Visit http://wiki.centos.org/AdditionalResources/Repositories/RPMForge. Download RPMforge for CentOS 6 via wget. In my case, I downloaded i686 rpm.
Run following command to install the rpm key:
rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Run rpm -Uvh to install the downloaded rpm file.
- Create a file Archives.repo under /etc/yum.repos.d/. Add following contents to Archives.repo :
[c6-archives] name=CentOS-6 – Archives baseurl=http://vault.centos.org/6.2/updates/$basearch/ gpgcheck=0 enabled=1
- Run following comand:
yum clean all
- Run following command:
yum install unoconv openoffice.org-headless openoffice.org-writer openoffice.org-calc openoffice.org-impress
Install ImageMagick
Run following command:
yum install ImageMagick
Install Fonts
CentOS does not support enough fonts by default (e.g Chinese fonts). Therefore the converted file may contain unexpected characters. The easiest way to resolve this issue is to copy fonts from Windows.
-
Create a folder named win in driver D of your Windows.
-
Copy all files under C:\WINDOWS\Fonts to D:\win.
-
Upload folder win to your CentOS 6.5 server(via winscp, or FTP tools).
-
Run following command in CentOS:
mv win /usr/share/fonts
cd win
mkfontscale
mkfontdir
fc-cache -fv
- Restart CentOS server.
Convert
Using following commands to convert an office file to images:
First convert office file to pdf:
‘unoconv -f pdf resume.ppt’
Convert pdf to images:
mkdir resume
‘convert resume.pdf resume/resume_%03d.jpg’
I’ve written a nodeJS wrapper:
var sys = require(‘sys’);
var exec = require(‘child_process’).exec;
console.log(‘converting to pdf…’);
exec(‘unoconv -f pdf resume.ppt’, function(error, stdout, stderr){
console.log(‘converted resume.pdf’);
console.log(‘converting resume.pdf to multiple pics…’);
exec(‘convert resume.pdf resume/resume_%03d.jpg’, function (error, stdout, stderr){
console.log(‘All done’);
});
});
That’s all. Cheers!
How to enable 'meta_key' option for wordpress REST api filter
I’m working at a project which is using wordpress as the backend management system. WP has a great rest api plugin . However, the filter options are limited. Unfortunately, ‘meta_key’ is not supported in current version.
I’ve spent several hours to investigate this plugin, and finally found a one-line-code solution:
- Find a line in get_posts function:
// Allow the same as normal WP
$valid_vars = apply_filters('query_vars', $wp->public_query_vars);
- Add following code below it:
// Add additional key to support.
array_push($valid_vars, 'meta_key');
Done :)
Additionally, add more custom field support you need:
// Add additional custom field keys to support.
array_push($valid_vars, 'meta_key');
array_push($valid_vars, 'meta_value');
array_push($valid_vars, 'meta_value_num');
array_push($valid_vars, 'meta_compare');
array_push($valid_vars, 'meta_query');
Finally here, my long term blog site.
Took me 1 hour to setup jeklly site. Say goodbye to wordpress.com :)
Alternative Way To Resolve Stream_select You Must Recompile Php With A Larger Value Of Fd_setsize Issue Without Recompiling Php
I met a boring issue when adding websocket to a PHP site by using Ratchet (A PHP websocket framework):
“It is set to 1024, but you have descriptors numbered at least as high as 1266.
–enable-fd-setsize=2048 is recommended, but you may want to set it to equal the maximum number of open files supported by your system”
I struggled and googled it, finally found a bad news: FD_SIZE is set to 1024 in the PHP source code. The error occurs if the web socket connections are over 1024. I don’t want to modify the PHP source code and recompile it, which may cause unexpected issue. So I try to find another way to solve this issue. Fortunately, I found it.
Basically, I’m opening multiple websocket service processes in the server, and each process has different port. In the front end, I wrote a js function to choose different port to connect. That means we have 1024 * n availiable connections now. Let’s go to the details.
Back-end implementation
Write a websocket service called push-server.php. Please refer to Ratchet’s example. However, we need make the php file to accept a port parameter:
$port
=
$argv
[1];
if
(
$port
==
""
){
$port
= 40003;
// Default port
}
// .....Ignoring other code .....
// Passing port paramter.
$webSock
->listen(
$port
,
'0.0.0.0'
);
function getWSServer() { var serverPorts = ['40003', '40004', '40005']; var server = 'ws://youhost'; var randomPortIndex = Math.floor(Math.random() * serverPorts.length); server += ':' + serverPorts[randomPortIndex]; return server; };
How to invoke InfoPath designer within SharePoint list data.
SharePoint 2010 has a new feature that can “Customize List” with InfoPath 2010. So how can the system do it? Just one command line can tell you the truth:
infopath.exe /spSiteURL http://sitename /spListID “{524E9C94-639F-4F95-8AD7-C699CBA499BF}” /design /noautoformsdialog
OK. Now specify your site name and list ID, you have the same functionality of “Customize List” ribbon button. /spSiteURL and /spListID are unreleased parameters. Have fun!