Friday, May 17, 2013
annoying problem with firefox 21 on mac
Saturday, February 16, 2013
Wednesday, August 8, 2012
filter on current date and passing time
select * from meeting
where convert(date, start) = convert(date, getdate())
and cast(start-getdate() as float)*24*60 < -120
Thursday, July 28, 2011
Embed XML file in Flex application
private var tsaKml:Class;
…
var byteArray:ByteArray = new tsaKml() as ByteArray;
var xml:XML = new XML(byteArray.readUTFBytes(byteArray.length));
...
Sunday, July 24, 2011
Install Zend_Debugger on CENTOS
The newer version of the debugger is renamed as Studio Web Debugger (http://www.zend.com/en/products/studio/downloads). Download the debugger and follow the instruction.
However, on CentOS there might be some additional issue:
- if SELinux is enabled, you will get warnings like
To fix this, mark ZendDebugger as not need an executable stack.
execstack -c /usr/lib/php/modules/ZendDebugger.so
To verify ZendDebugger.so does not need an executable stack, use the following command
readelf -l /usr/lib/php/modules/ZendDebugger.so | grep STACK
outputs:
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
The second to last column shows “RW” indicates that it does not need an executable stack.
If it shows “RWX/RWE”, the module does require an executable stack. In that case, an non-preferred approach is to turn off SELinux.
- Please also make sure libssl.so.0.9.8 is on the system. If the system has been updated, the entry libssl.so.0.9.8 might be missing from /usr/lib.
Tuesday, July 12, 2011
Install rgdal on Mac OSX
sudo R64 CMD INSTALL --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib' rgdal_0.7-5.tar.gz
Thursday, July 7, 2011
Installing Maven for Flash Builder
The good friend of google search on Maven + Flash Builder results in some links on these. I tried to get to those that were published within the last year.
Maven is now an integrated part of the new Eclipse Indigo release, and maven can be installed with a few mouse click.
- go to Help --> Install New Software
- Select Indigo - http://download.eclipse.org/release/indigo on the Work with dropdown list
- type m2e in the search box
- check m2e - Maven Integration for Eclipse
- click Next --> Next, on the last window, accept the terms of license agreement and click Finish.
- The last step, Click Restart Now to apply the newly installed m2e.
Thursday, June 30, 2011
VPN Failed to connect
mac:~ $ ps -ef | grep racoon
0 23301 1 0 0:01.01 ?? 0:01.68 /usr/sbin/racoon
501 24444 24439 0 0:00.00 ttys000 0:00.00 grep racoon
sudo kill 23301
sudo /usr/sbin/racoon
Wednesday, June 1, 2011
Install Mono on CentOS
First, create a repository description in /etc/yum.repos.d. Create file mono.repo with content
[Mono]
name=Mono Stack (RHEL_5)
type=rpm-md
baseurl=http://ftp.novell.com/pub/mono/download-stable/RHEL_5/
gpgcheck=1
gpgkey=http://ftp.novell.com/pub/mono/download-stable/RHEL_5/repodata/repomd.xml.key
enabled=1
Second, install the Mono “server” stack:
yum clean all
yum install monotools-addon-server
Wait for all packages installed. The binary file will be installed at /opt/novell/mono/bin.
To setup the running environment, run
source /opt/novel/mono/bin/mono-addon-environment.sh
To verify everything is installed:
mono --version
Saturday, May 7, 2011
Android App Architecture
This is a set of notes that I made for my own reference.
Android application does not have a main method as desktop application have. This is because Android application is invoked by the Android system whenever any part of the application is needed, and the Android will instantiates corresponding java objects. This is made possible by components based architecture.
Android application is a collection of components (activities, services, content provider, and broadcast receivers). Not all these components need to exist at the same time in the same application. But all the components share resources, e.g. databases, file systems etc.. The components communicate with each other by intents, which are described by a manifest in application package.
What is Activity and Service?
Activities are components in Android App to presents user interface, which is similar to like WinForms in .NET desktop application. A service is similar to activity but with no user interface. A service runs in the background all the time.
replicate directory structure only
To replicate a directory structure only:
find * -type d -exec mkdir [TARGETDIR]/\{\} \;
Wednesday, May 4, 2011
Air for Android
- activating phone vibration
- access android native contact list
- creating android intents
- messaging to status bar
- enable one air app to open another
- creating widgets
- the WindowedApplication application MXML tag needs to be changed to ViewNavigatorApplication. WindowedApplication assumes there is a NativeWindow, which is not the case on Android.
- In the Application descriptor, the namespace must be 2.6 or later and the visible tag must be set to true.
ActionScript 2, ContextMenu, DatagramSocket, Dockicon, EncryptedLocalStore, HTMLoader, LocalConnection, NativeMenu, NativeWindow, PrintJob, SecureSocket, ServerSocket, StorageVolumeInfo, SystemTrayIcon, Updater, XMLSignatureValidator
Wednesday, April 27, 2011
LiveUpdate
on my mac, the live update come up every hour. To find out what’s causing it, the following are some useful commands:
- check current live update settings
Module Name On UI Freq Day Time Args
--------------
-------- --- --- -------- ----- ------ ----
LiveUpdate DefaultLiveUpdateSchedul 1 0 Hourly 04:33 "All Products"
It is set to hourly update and not in quiet mode.
- delete current setting
- add new policy
- check new settings
--------------
-------- --- --- -------- ----- ------ ----
LiveUpdate LiveUpdate 1 0 Daily 09:00 "All Products" -quiet
Now it is running in quiet mode.
Saturday, February 19, 2011
vsftp server
- Start vsftp automatically
# ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd
ftp stream tcp nowait root /usr/sbin/tcpd vsftpd
xinetd
It is recommended to start the vsftp daemon with xinetd which is more up to date than inetd. Some updates are e.g. logging of requests, access control, binding of the service to a specific network interface and so on. A very good introduction to xinetd can be found under [7]. After the modification restart of xinetd is necessary. The configuration of xinetd could look like this:
# vsftp daemon.
service ftp
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/vsftpd
per_source = 5
instances = 200
no_access = 192.168.1.3
banner_fail = /etc/vsftpd.busy_banner
log_on_success += PID HOST DURATION
log_on_failure += HOST
nice = 10
}
Monday, August 30, 2010
Retrieve Unique Values from gisdata
import arcpy
from arcpy import env
env.workspace = "c:/data"
patch_shp = "test.shp"
field = "GRIDCODE"
valueList = []
rows = arcpy.SearchCursor(patch_shp)
for row in rows:
valueList.append(row.getValue(field))
uniqueSet = set(valueList)
uniqueList = list(uniqueSet)
uniqueList.sort()
del rows
del row
print uniqueList
Thursday, November 27, 2008
Zend Framework with IIS 7.0
Zend Framework uses Fron Controller pattern to redirect incoming request. On Apache web server, mod_rewrite can be used to redirect the request. What I am interested is how to support url rewrite in IIS 7.0.
Google search revealed there is a URL Rewrite module for IIS 7.0.
Wednesday, August 6, 2008
Friday, July 18, 2008
DBCC LOG
There is an undocumented command for checking SQL Server transaction log file for 7.0 and 2000.
To use it: DBCC log(dbname|dbid, [type=-1|0|1|2|3|4])
The meaning of type is
-1: 4 + hex dump of low row info, checkpoint begin, DB version, and Max XDESID
from 0 to 4, more information about the transaction is retrieved. Default value is 0.
Thursday, July 17, 2008
How to extract msi content?
From windows command line tool, msi content can be extracted using msiexec command.
With C:\>msiexec, a windows installer window will come up showing the syntax of msiexec. To actually extract the content,
msiexec /a msifile /qb TARGETDIR=outfolder
SQL Injection
Microsoft published a security advisory (954462) on June 24, 2008 warning about the rising occurrence SQL Injection attack. "These SQL injection attacks do not exploit a specific software vulnerability, but instead target Web sites that do not follow secure coding practices for accessing and manipulating data stored in a relational database."
This morning, I find out that one of our databases was subjected to this issue, which causing the web site failed to launch. We have to restore the data from backup.
One useful tool, (also suggested in the security advisory) is HP Scrawl, which help web site administrators to detect SQL Injection vulnerabilities.