programming
Windows, PHP, cURL SSL certificate problem.
When you use a library that wraps an API (Facebook PHP SDK, AWS PHP SDK) usage, it often boils down to cURL in the core. These libraries often want to communicate over SSL by default. So, any call you make on these libraries involves a cURL request over a SSL connection. The problem with this is that cURL does not ship CA certificates bundle any more, so SSL certificates of the sites the requests are addressed to cannot be verified.
For instance, with AWS PHP SDK, you’ll get the following error if your cURL setup is not fixed:
Fatal error: Uncaught exception 'cURL_Exception' with message 'cURL resource: Resource id #10; cURL error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (cURL error code 60). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes.' in C:\Users\Engin\Code\PHP\unuttumbile\AWSSDKforPHP\lib\requestcore\requestcore.class.php:824
Stack trace:
#0 C:\Users\Engin\Code\PHP\unuttumbile\AWSSDKforPHP\services\s3.class.php(895): RequestCore->send_request()
#1 C:\Users\Engin\Code\PHP\unuttumbile\AWSSDKforPHP\services\s3.class.php(1125): AmazonS3->authenticate('php-sdk-getting...', Array)
#2 C:\Users\Engin\Code\PHP\unuttumbile\AWSSDKforPHP\_samples\cli-s3_get_urls_for_uploads.php(60): AmazonS3->create_bucket('php-sdk-getting...', 's3-us-west-1.am...')
#3 {main}
thrown in C:\Users\Engin\Code\PHP\unuttumbile\AWSSDKforPHP\lib\requestcore\requestcore.class.php on line 824
cURL explains the situation in depth here.
2 step easy solution:
- Generate CA bundle yourself via scripts provided by cURL. Either via mk-ca-bundle.pl (PERL) or mk-ca-bundle.vbs (Windows Shell). Then copy it to c:\Windows just for convenience.
Engin@Engin-VAIO ~ $ perl mk-ca-bundle.pl Downloading 'certdata.txt' ... Processing 'certdata.txt' ... Done (137 CA certs processed, 32 untrusted skipped). Engin@Engin-VAIO ~ $ cp ca-bundle.crt /cygdrive/c/Windows/ -vf `ca-bundle.crt' -> `/cygdrive/c/Windows/ca-bundle.crt'
- Then add the following line in your php.ini’s [PHP] section. Note that this configuration option is available since PHP 5.3.7. See not so very detailed info.
[PHP] curl.cainfo = c:\windows\ca-bundle.crt
- Restart your HTTP server and you’re done.
9Gagtension – Facebook comment, message and chat trendy meme emoticons support
I noticed I was using quite some meme references in my Facebook comments such as :sweet jesus: or :mother of god:. So, yesterday evening, I put together an Chrome extension for this. Very simple.

List of memes and other information: http://engin.bzzzt.biz/9gagtension
Source code: https://github.com/engina/9gagtension
This is where you install: Chrome Extension Page
uIP 1.0 for Windows
Thanks to some other guy’s (Higepon, I assume) efforts (whom site is now offline), I got uIP-1.0 to run on my Windows 7. You can see and get the code yourself https://github.com/engina/uip-1.0-win
Engin@Engin-VAIO ~/Code/uip-1.0-win/x86-gcc
$ ./uip
0 - (TAP-Win32 Adapter V9)
fe80::b89d:19c6:5f43:ec4e%32 [0]
0.0.0.0 [0]
1 - (VMware Virtual Ethernet Adapter)
fe80::b98e:1fe8:9121:d0f2%24 [0]
192.168.67.1 [0]
2 - (Microsoft)
fe80::b4cb:2e7f:d890:9004%21 [0]
0.0.0.0 [0]
3 - (Microsoft)
192.168.1.223 [0]
4 - (Microsoft)
fe80::cd43:876e:3b0b:5b79%14 [0]
0.0.0.0 [0]
5 - (Microsoft)
fe80::2daf:5bd7:5b32:618e%15 [0]
192.168.1.111 [0]
6 - (VMware Virtual Ethernet Adapter)
fe80::5431:7f2f:1920:632c%23 [0]
192.168.9.1 [0]
7 - (Intel(R) 82567LM Gigabit Network Connection)
fe80::5872:faab:8d21:2e44%10 [0]
192.168.1.142 [0]
Choose:
This is useful as a debugging aid, a reference implementation and rapid development.
MySQL Workbench fetching… problem solved
In my previous post about Restoring MySQL Databases from an HDD Image I’ve talked about restoring previous a MySQL development environment from a backup. First of all, there’s a documentation about it, which admittedly I haven’t read. I have simply copied @@datadir and my applications apparently worked fine but Workbench didn’t like it very much. Whenever I tried to expand database tables it kept telling me “Fetching…”. I checked the error logs and it looks something like this:
110406 23:09:00 [Note] Plugin 'FEDERATED' is disabled. 110406 23:09:00 InnoDB: The InnoDB memory heap is disabled 110406 23:09:00 InnoDB: Mutexes and rw_locks use Windows interlocked functions 110406 23:09:00 InnoDB: Compressed tables use zlib 1.2.3 110406 23:09:01 InnoDB: Initializing buffer pool, size = 128.0M 110406 23:09:01 InnoDB: Completed initialization of buffer pool 110406 23:09:01 InnoDB: highest supported file format is Barracuda. 110406 23:09:01 InnoDB: Waiting for the background threads to start 110406 23:09:02 InnoDB: 1.1.5 started; log sequence number 3061735 110406 23:09:02 [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it 110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'threads' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure 110406 23:09:02 [ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure 110406 23:09:02 [Note] Event Scheduler: Loaded 0 events 110406 23:09:02 [Note] C:\PROGRA~2\EASYPH~1.0\MySql\bin\mysqld.exe: ready for connections. Version: '5.5.10-log' socket: '' port: 3306 MySQL Community Server (GPL) 110406 23:13:36 [ERROR] Incorrect definition of table mysql.proc: expected column 'comment' at position 15 to have type text, found type char(64).
If you look careful enough you’ll see please run mysql_upgrade to create it . So I’ve just did it and viola! It looks like fixed. Everything is working fine.
Running an HTTP server in default port 80 on Windows
Summary: SQL Server Reporting Services is listening on port 80 from within System (PID 4) process.
I tried to run a HTTP server on my Vista box. It couldn’t bind to that port. So I looked around a bit.
Engin@Engin-PC ~ $ netstat -n -a -p tcp -b -o Active Connections Proto Local Address Foreign Address State PID TCP 0.0.0.0:22 0.0.0.0:0 LISTENING 3816 [sshd.exe] TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4 Can not obtain ownership information
From Process Explorer I can tell that it is System process. So why does such a core part of my OS listening on port 80. A rather easy way to find out is to simply netcat to that port.
$ nc localhost 80 help HTTP/1.1 400 Bad Request Content-Type: text/html; charset=us-ascii Server: Microsoft-HTTPAPI/2.0 Date: Thu, 31 Mar 2011 08:44:26 GMT Connection: close Content-Length: 326 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Bad Request</TITLE> <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> <BODY><h2>Bad Request - Invalid Verb</h2> <hr><p>HTTP Error 400. The request verb is invalid.</p> </BODY></HTML>
Server: Microsoft-HTTPAPI/2.0 hmm. A little bit googling told me that this is due to SQL Server Reporting Services. When you stop this service, port 80 will be available again.
Restoring MySQL Databases from an HDD Image
UPDATE: There’s an update to this MySQL Workbench fetching… problem solved
I don’t know what is the proper way of handling this but this is rather a cumbersome process apparently.
You can see your datadir by issuing:
select @@datadir;
Replace this directory with your backed up datadir. Datadir can also be found in my.ini (or my.cnf in GNU/Linux I guess).
When I did, I got the following error while trying to start the MySQL server:
110331 9:56:57 [Note] Plugin 'FEDERATED' is disabled. 110331 9:56:57 InnoDB: The InnoDB memory heap is disabled 110331 9:56:57 InnoDB: Mutexes and rw_locks use Windows interlocked functions 110331 9:56:57 InnoDB: Compressed tables use zlib 1.2.3 110331 9:56:57 InnoDB: Initializing buffer pool, size = 128.0M 110331 9:56:57 InnoDB: Completed initialization of buffer pool InnoDB: Error: log file .\ib_logfile0 is of different size 0 55574528 bytes InnoDB: than specified in the .cnf file 0 5242880 bytes! 110331 9:56:58 [ERROR] Plugin 'InnoDB' init function returned error. 110331 9:56:58 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 110331 9:56:58 [ERROR] Unknown/unsupported storage engine: InnoDB 110331 9:56:58 [ERROR] Aborting 110331 9:56:58 [Note] C:\PROGRA~2\EASYPH~1.0\MySql\bin\mysqld.exe: Shutdown complete
I’ve added “innodb_log_file_size = 53M” parameter to my my.cnf and the server started just fine. You see the 55574528 in the above error log ? That is precisely 53M (55574528/(1024*1024)=53). Though MySQL Workbench still can’t browse the databases in the UI, it tells me
Error: Time: 10:56:43 Message: Error Code: 1548 Cannot load from mysql.proc. The table is probably corrupted Details: Get schema contents
Though I can use the databases as below:
use myolddb; select * from atable;
Even though Workbench is not happy with this, it works. I’ll update if I find anything useful.
Update to SharkIt
My brother told me SharkIt stopped working, I’ve updated it to work again.
Changes include:
- Again compatible with Grooveshark
- Faster session retriving, hence you can log in faster!
- Handles bad file names
- More cross platform file handling.
Wireless module of Sony VAIO VGN-Z790 broken
Me and my partner got two Sony VAIO VGN-Z790DIB notebooks 1.5 years ago. Admittedly, I still think it is the best PC notebook out there (P9700 CPU, 4G RAM, 1.47kg, ~6h battery). Though, wireless module of my partner’s notebook stopped working in the first month. The wireless module got physically broken, completely disappeared from system as it is not connected at all.
Today, it turned out that these notebooks have some kind of design fault, as mine also got broken. It literally disappeared all of a sudden. It is not a software problem as it is not seen by GNU/Linux or anything.
I tried to order another Wireless Module for VGN-Z790 but all my searches failed. Then, I decided to disassemble it, in hope that I could find a part number etc. After all, I have changed broken parts of my previous notebooks anyway.
It is a very painful task to disassemble this notebook. It took almost 1h to disassemble and assemble the notebook back. Here’s the service manual for VGN-Z series, it is almost impossible to work on this notebook without this. I’d expect a much better service manual from a company such as Sony, but it was quite low quality if you ask me. Dell’s service manuals were way better.
Anyway, I got it! The wireless module of VGN-Z790 is 512AN_HMW. You can see the pictures below.


Luckily, if you search with this model number you can find this part from ebay. I’ll order one soon and see if it is the module that is getting broken or it is something else that is affecting it — only if I don’t get a new notebook! This is a pretty damn good excuse to get one, amarite ?
TIM: Time Is Money! Standalone meeting calculator in HTML/Javascript
This is my take on TIM calculator, you can download, modify and run it in any browser (I’ve tested with IE8, Chrome, FF). View, download or use it online.
Modify the currency to your liking. Oh, and of course, best viewed with Chrome.