2014/12/01

Linux compiler warnings

没有评论:
When compiling C++ programs, gcc reports -Wwrite-strings warning.
xxx.cpp:344:5: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
Solution 1 (推荐):
     cast constant string from char * s = "constant string" to const char *s= "constant string".

Solution 2:
 you can also pass -Wno-write-strings to gcc which then suppresses this warning.

Solution 3:
#pragma GCC diagnostic ignored "-Wwrite-strings"    忽略警报
...
#pragma GCC diagnostic pop       重新打开警报


gcc reports -Wmultichar warning:
xxx.cpp:332:7: warning: multi-character character constant [-Wmultichar]
 #if (('1234' >> 24) == '1')     // little endian ?
       ^
这个是用宏判断机器是否little-endian/big-endian,一般主机都是little-endian.
Solution 1 (推荐):
Check endian-ness at run time:
 int IS_LITTLE_ENDIAN() {
  static const int NL_AT_END = 0x000A;
  return ((char*)(void*)&NL_AT_END)[0] == '\n';
 }

Solution 2:
pass -Wno-multichar  to gcc for suppressing this warning.

Further reading: http://zipcon.net/~swhite/docs/computers/languages/c_multi-char_const.html
 

2014/06/18

ODBC driver problem

没有评论:
2009年写的一个船舶碰撞模拟器最近要求再产生一些数据,于是重新拾掇了程序。发现连接的mdb文件数据库在windows 7 64-bit上有问题:

Microsoft ODBC Administrator: The setup routines for the Microsoft Access Driver (*.mdb, *.accdb) ODBC driver could not be found. Please reinstall the driver.

找出原因如下:

We have an excel sheet that runs a report and get it's data from a database. The database that it gets the data from was recently moved to a different shared instance. I am now having issues setting up a new connection to the shared instance that the database now resides on. When I try to go in to try to add an ODBC I only have an option to setup a SQL server connection (No option to setup an Excel Files ODBC). If I try to configure the existing Excel Files ODBC I get the error

"The setup routines for the Microsoft Excel Driver ODBC driver could not be found. Please re-install the driver."

Once I click "OK" on that error another one pops up saying "Errors found: The specified DSN contains an architecture mismatch between the driver an application."

The system is running Windows 7 Enterprise (x64), has 6GB of RAM, an Intel Xeon E5620 (2.4GHz) and the version of office is Office 2010 Pro.


解决办法:
在64位机器上直接使用odbc 32-bit程序。
Use odbcad32.exe under %WINDIR%\SYSWOW64, you will find all the 32bit drivers enumerated.  MS Access 32-bit ODBC driver is already shipped.

32-Bit Excel needs 32-Bit ODBC-Adminstrator odbcad32.exe which lives in C:\Windows\SysWOW64

64-Bit Excel needs 64-Bit ODBC-Adminstrator odbcad32.exe which lives in C:\Windows\System32



2014/04/09

OpenSSL HeartBleed 漏洞来势凶猛

没有评论:
最近透露出来的OpenSSL HeartBleed (心脏滴血)漏洞很厉害,yahoo.com 都被用来作为POC攻击的示范站点。不过发此文时yahoo似乎已修复, 但查询top 1000...网站确实还有不少中招。ssltest python script 轻易就可以搜到,就不放在此了,注意它们只是显示是否vulnerable,并没有显示message content,当然这也很简单。此时攻防双方应该是在分秒必争,我觉得一些搞bitcoin的一些网站真是应该小心了。。。

INSECURE - bitcurex.com:443 has the heartbeat extension enabled and is vulnerable
INSECURE - localbitcoins.com:443 has the heartbeat extension enabled and is vulnerable
INSECURE - vip.btcchina.com:443 has the heartbeat extension enabled and is vulnerable
INSECURE - www.bitfinex.com:443 has the heartbeat extension enabled and is vulnerable
INSECURE - www.bitgo.com:443 has the heartbeat extension enabled and is vulnerable
INSECURE - www.bitstamp.net:443 has the heartbeat extension enabled and is vulnerable
INSECURE - www.cryptsy.com:443 has the heartbeat extension enabled and is vulnerable
INSECURE - www.virwox.com:443 has the heartbeat extension enabled and is vulnerable



OpenSSL HeartBleed bug
http://heartbleed.com/

Online heartbleed test
http://possible.lv/tools/hb/
http://filippo.io/Heartbleed/
https://www.ssllabs.com/ssltest/



2014/04/08

Skype Silk 与Opus的关系

没有评论:
Skype自2009年1月以来一直采用自己的SILK音频编码解码器,但是从2012年起过渡到新的Opus标准。Opus标准已经获互联网工程任务组(IETF)批准,标准格式为RFC 6716。它 是一个有损声音编码的格式,适用于网络上的实时声音传输。Opus支持6kbps到510kbps的可变比特率。由于是一个开放格式,Opus在使用上没有任何专利限制。

Opus合并了Xiph.org的CELT低延时音频编解码器和Skype的SILK语音编解码器,专为互联网音频设计,可用于替代现有的私有音频编解码器,由 Xiph.Org、Mozilla、微软、Broadcom、Octasic和Google联合开发。


目前软件包版本是Opus v1.1
Skype Opus Codec