2009年11月12日 星期四

Linux 64 platform 下如何判斷 ELF 檔案是 64bits or 32bits

可以使用 file 這個指令
nysonchao@nysonchao-laptop:/usr/lib/mozilla/plugins$ file ./libnpWebATM.so
./libnpWebATM.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

2009年10月27日 星期二

在NSTimer event內 用 abortModal 來停止 runModalForWindow

http://www.omnigroup.com/mailman/archive/macosx-dev/2004-January/050089.html

Are you calling stopModal from an IBAction method?

Quote from the NSApplication docs:

- (void)stopModal

Stops a modal event loop. This method should always be paired with a
previous invocation of runModalForWindow: or
beginModalSessionForWindow:. When runModalForWindow: is stopped with
this method, it returns NSRunStoppedResponse. This method stops the
loop only if it's executed by code responding to an event. If you need
to stop a runModalForWindow: loop outside of one of its event callbacks
(for example, a method repeatedly invoked by an NSTimer object or a
method running in a different thread), use the abortModal method.
(end quote)

So, it looks to me like you must invoke stopModal only in an IBAction.
Of course, if you're not, then this won't help, but it's all I could
come up with. Hope you get your problem sorted out.

David

2009年10月21日 星期三

Sheets and NSTimer

Re: Sheets and NSTimer


  • Subject: Re: Sheets and NSTimer
  • From: Bjoern Kriews <email@hidden>
  • Date: Mon, 23 Feb 2004 00:52:39 +0100

On 22.02.2004, at 22:01, David Dauer wrote:

Hello

I've got a little problem using an NSTimer while running a sheet.
I tried to create the timer using

myTimer = [[NSTimer scheduledTimerWithTimeInterval:5.0 target:self
selector:@selector(myTimerAction:) userInfo:nil repeats:YES] retain];

I suppose you need:

NSTimer *timer = [[NSTimer timerWithTimeInterval: 1.0 target: self selector: @selector(countDown:) userInfo: nil repeats: YES] retain];
[[NSRunLoop currentRunLoop] addTimer: timer forMode: NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer: timer forMode: NSModalPanelRunLoopMode];
...
[timer invalidate];
[timer release];

(I used this one with NSEventTrackingRunLoopMode to make my Timer fire while dragging a slider).

The docs say that only the timer... (not the scheduledTimer...) methods return a Timer that
you can add to run loop afterwards. I did this before and it worked - now your question
led to me fix a possible problem in my code.

2009年9月17日 星期四

2009年9月4日 星期五

Mac OS X 開發筆記

  • Cocoa uses the bottom-left corner of the frame rectangle as the origin for the

    base coordinate system, unlike Carbon applications, which use the top-left corner. Views draw themselves

    in coordinate systems transformed from (and relative to) this base coordinate system.

2009年8月21日 星期五

regular expression "\w" 在 Xml Schema 以及 .Net RegEx 的意義不同

使用XSD對XML驗證E-MAIL格式時 如果用以下的 pattern 則email含有 "_" "-" 符號的 是不會通過的(在 .NET RegEx class是會通過的),

"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"

原因如下



https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=471388&wa=wsignin1.0
描述
The matching of the simple regular expression "^\w+$" fails for the underscore character in an xml schema pattern facet. The error does not occur when using the Regex class directly.
註解
Note: This problem did not occur in .NET 1.1.
rkahlert 在 2009/6/30 於 上午 07:43 所公佈
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you
Microsoft 在 2009/6/30 於 下午 06:46 所公佈
Hi,

Xml Schema implementation follows the W3C schema spec for handling regualar expressions and hence may behave slightly different from .Net RegEx implementation.

From the specs,
RegEx class defines \w as [\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}\p{Lm}]. Underscore character is in Pc unicode category, so it is included in this definition of \w.
o Reference: http://msdn.microsoft.com/en-us/library/20bw873z.aspx

• XSD spec defines \w as [#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}] (all characters except the set of "punctuation", "separator" and "other" characters). P category consist of all punctuation (which includes Pc). Therefore underscore is excluded in XSD definition of \w.
o Reference: http://www.w3.org/TR/xmlschema11-2/#regexs

Thanks
Nithya Sampathkumar
Program Manager

2009年8月14日 星期五

Debug VS2008 產生出來的Code


VS2008 預設只能夠Debug使用者寫的Code,如果是VS 2008自動產生出來的是無法Debug的,但只要到[Tool]->[Options]將 [Enable Just My Code]的選項取消,就可以Debug VS2008 產生出來的Code 了

soapUI:好用的WebService(SOAP) 測試工具

soapUI; the Web Services Testing tool.

soapUI is the leading tool for Web Service Testing. With more than 950 000 downloads, it's the most used tool for SOA testing in the world.


2009年8月4日 星期二

Browser , OS , Market share

http://marketshare.hitslink.com/account.aspx?url=%2fbrowser-market-share.aspx%3fqprid%3d0%26qptimeframe%3dM%26qpmr%3d100%26qpdt%3d1%26qpct%3d3%26qpsp%3d-1

2009年6月6日 星期六

轉換 Code sign 憑證成為可以 sign XPI , jar 檔的 pfx

Signing Jar Files




Signing Jar Files (converting pvk to p12)

You will need two files:

• pvk file (generated by IE, and stored in c:\mykey.pvk by default)
• spc file (the cert)

Now to generate a PKCS12 pfx file you need Microsoft's pvkimprt tool. So install and run the tool:
pvkimprt c:\mycert.spc c:\mykey.pvk

Import it into your personal keystore, so we can export it as a pfx file:
• Start-Run: mmc.exe
• Add Snapin: Certificates
• Properties: Add a friendly name to the cert (this will be the alias)
• Export a pfx file

And after that process you will have a certificate you can use to sign jar files, and possibly start your own import/export business.
Here's the ant task I use to sign jar files:

message="Please enter keystore password:"
addproperty="keypass" />

keystore="${keystore}/yourkey.p12" alias="Your Alias"
storepass="${keypass}"/>


Code signing java applets is also possible. A comprhensive guide can be found here:

http://www.suitable.com/docs/signing.html

2009年6月2日 星期二

轉換Glade file 成 c 的 source files

http://mail.gnome.org/archives/gtkmm-list/2006-June/msg00305.html

Convenience utility for Glade users


  • From: Bob Caryl
  • To: Gtkmm Mailing List
  • Subject: Convenience utility for Glade users
  • Date: Fri, 30 Jun 2006 14:05:12 -0500

Hello all,

I have found Glade to be a very useful tool. I use it in conjunction with libglademm (using the Gnome::Glade::Xml::create_from_buffer method), and because I have a phobia about my executables being dependent on "load files" I wrote a utility that takes the standard Glade project file (e.g. foo.glade) and converts it into an include file that contains the Glade XML converted into a const char * literal. The output also encloses the entire thing in a macro wrapper. This can be downloaded here:
http://users.nehp.net/rcaryl/xmltocsource-0.09.tar.gz

Run from the command line without arguments, it outputs a verbose usage message. I use it in my makefiles to keep the include (.h) file synchronized with my Glade file. --
/*Bob Caryl*
Fiscal Systems,Inc.
256.772.8920 Ext. 108
http://www.fis-cal.com <http://www.fis-cal.com/>/

2009年1月15日 星期四

解決 Google Chrome 無法正常顯示 ASP.Net Menu 的問題

只要在Project 加上App_Browsers的Folder(如右圖),然後在該Folder內新增一個內容如下的Chrome.browser的檔案,Google Chrome以及Safari 就可以正常顯示ASP.Net的Menu Control 了










<browsers>

<browser refID="safari1plus">

<controlAdapters>

<adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />

<controlAdapters>

<browser>

<browsers>





2009年1月12日 星期一

ILMerge(合併 .net 的 assemblies ) & DotNetZip

ILMerge

Brief Description
ILMerge is a utility for merging multiple .NET assemblies into a single .NET assembly. It works on executables and DLLs alike and comes with several options for controlling the processing and format of the output. See the accompanying documentation for details.


DotNetZip - Zip file manipulation in .NET languages

DotNetZip is a small, easy-to-use class library for manipulating .zip files. It can enable .NET applications written in VB.NET, C#, or any .NET language, to easily create, read, and update zip files. Zip Compression is easy with DotNetZip.

DotNetZip works on PCs with the full .NET Framework, and also runs on mobile devices that use the .NET Compact Framework. DotNetZip supports these scenarios:
- creating a zip archive, adding files or directories into the archive
- listing or extracting files from an existing archive
- modifying an existing archive - renaming entries, removing entries from an archive or adding new entries to an archive
- password protecting entries in the archive
- getting entry input from a file or a stream
- reading a zip file from a file or a stream
- extracting an entry into a file or a stream

2009年1月10日 星期六

International Components for Unicode 支援 BIG5 、CP937(EBCDIC 繁體中文) 互轉

http://icu-project.org/

example

Usage: uconv [ -h, -?, --help ] [ -V, --version ] [ -s, --silent ] [ -v, --verbo
se ] [ -l, --list | --list-code code | --default-code | -L, --list-transliterato
rs ] [ --canon ] [ -x transliteration ] [ --to-callback callback | -c ] [ --from
-callback callback | -i ] [ --callback callback ] [ --fallback | --no-fallback ]
[ -b, --block-size size ] [ -f, --from-code code ] [ -t, --to-code code ] [ --a
dd-signature ] [ --remove-signature ] [ -o, --output file ] [ file ... ]

Options: -h, --help print this message
-V, --version print the program version
-s, --silent suppress messages
-v, --verbose display progress information
-l, --list list all available encodings
--list-code code list only the given encoding
--default-code list only the default encoding
-L, --list-transliterators list all available transliterators
--canon print list in cnvrtrs.txt(5) format
-x transliteration run everything through transliteration
--to-callback callback use callback on destination encoding
-c omit invalid characters from the output
--from-callback callback use callback on original encoding
-i ignore invalid sequences in the input
--callback callback use callback on both encodings
-b, --block-size size read size bytes blocks (default: 4096)
--fallback use fallback mapping
--no-fallback do not use fallback mapping
-f, --from-code code set the original encoding
-t, --to-code code set the destination encoding
--add-signature add a U+FEFF Unicode signature character
(BOM)
--remove-signature remove a U+FEFF Unicode signature charac
ter (BOM)
-o, --output file write output to file

Callbacks: substitute skip stop escape escape-icu escape-java escape-c escape-xm
l escape-xml-hex escape-xml-dec escape-unicode

H:\temp\icu\icu\bin>uconv -f cp950 -t cp937 -o cp937.txt big5.txt

H:\temp\icu\icu\bin>uconv -t cp950 -f cp937 -o cp950.txt cp937.txt