showing a list of mounted volumes with icon

2010-04-23 Thread Angelo Chen
Hi,
Just like when press 'Option' while booting, we can see a list of volumes with 
icons, is there a simple way to do something similar in a sheet? Thanks,
Angelo



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: showing a list of mounted volumes with icon

2010-04-23 Thread Angelo Chen
Hi Kyle,
I'd just like show a collection of mounted volumes in a sheet and let user 
choose one of them.
Thanks,
Angelo

--- 2010年4月24日 星期六,Kyle Sluder  寫道﹕

寄件人: Kyle Sluder 
主題: Re: showing a list of mounted volumes with icon
收件人: "Angelo Chen" 
副本(CC): Cocoa-dev@lists.apple.com
日期: 2010年4月24日,星期六,上午1:51

On Fri, Apr 23, 2010 at 10:01 AM, Angelo Chen
 wrote:
> Hi,
> Just like when press 'Option' while booting, we can see a list of volumes 
> with icons, is there a simple way to do something similar in a sheet? Thanks,

What is the part you're trying to emulate, the appearance or the
functionality? Do you just need a horizontal collection of things, do
you just need to collect a list of mounted volumes and their icons, or
do you want to combine the two somehow to make something similar to
the Startup Disk preference pane? What purpose is this UI going to
serve?

The EFI boot selector is hardly the first place I'd look to for
inspiration for desktop UI.

--Kyle Sluder




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: showing a list of mounted volumes with icon

2010-04-24 Thread Angelo Chen
Hi James,
NavCreateChooseVolumeDialog will do, thanks. I was trying to find a sample code 
that uses the function in the net, but none so far, any idea where I can find a 
sample code for this function?
Thanks,
Angelo
--- 2010年4月24日 星期六,James Walker  寫道﹕

寄件人: James Walker 
主題: Re: showing a list of mounted volumes with icon
收件人: cocoa-dev@lists.apple.com
日期: 2010年4月24日,星期六,上午9:23

On 4/23/2010 5:47 PM, Angelo Chen wrote:

> I'd just like show a collection of mounted volumes in a sheet and let
user choose one of them.

Carbon has a call just for this (NavCreateChooseVolumeDialog) but I
don't see anything so easy for Cocoa.  You can get a list of volumes
with NSFileManager, get their icons with NSWorkspace, and then build
your own sheet, maybe using NSTableView.

-- 
  James W. Walker, Innoventive Software LLC
  <http://www.frameforge3d.com/>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/angelochen960%40yahoo.com.hk

This email sent to angelochen...@yahoo.com.hk




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


getting file time stamp from a NTFS volume

2010-05-22 Thread Angelo Chen
Hi,
I use following code to get file creation time stamp, it works with FAT32, but 
seems returning wrong date if the file is in a NTFS volume, any idea? Thanks,
Angelo
NSFileManager *fm= [NSFileManager defaultManager];NSDictionary *fileAttributes 
= [fm fileAttributesAtPath:path traverseLink:YES];   fileCreatDate = 
[fileAttributes objectForKey:NSFileCreationDate];



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


getting file creation date from NTFS

2010-05-22 Thread Angelo Chen
Hi,
I'd like to get creation date of a file, here are the codes:
NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:path 
traverseLink:YES];NSLog(@"Dict %@", fileAttributes);
This works if the file came from FAT or Mac OS X, but if it is in a NTFS 
volume, creation date is always wrong, I observe the Finder can display the 
creation date correctly, any idea how to obtain a creation date for files in 
NTFS? Thanks,
Angelo
This come from a NTFS:
2010-05-22 23:06:12.276 test1[2531:a0b] Dict {    NSFileCreationDate = 
"2928613-08-09 15:06:42 +0800";    NSFileExtensionHidden = 0;    
NSFileGroupOwnerAccountID = 20;    NSFileGroupOwnerAccountName = staff;    
NSFileHFSCreatorCode = 0;    NSFileHFSTypeCode = 0;    NSFileModificationDate = 
"2004-08-04 12:56:56 +0800";    NSFileOwnerAccountID = 501;    
NSFileOwnerAccountName = user1;    NSFilePosixPermissions = 493;    
NSFileReferenceCount = 1;    NSFileSize = 69120;    NSFileSystemFileNumber = 
2469;    NSFileSystemNumber = 234881027;    NSFileType = NSFileTypeRegular;}
This come from a file in FAT:
2010-05-22 23:09:43.336 test1[2702:a0b] Dict {    NSFileCreationDate = 
"2009-01-13 22:56:16 +0800";    NSFileExtensionHidden = 0;    
NSFileGroupOwnerAccountID = 20;    NSFileGroupOwnerAccountName = staff;    
NSFileHFSCreatorCode = 0;    NSFileHFSTypeCode = 0;    NSFileModificationDate = 
"2008-02-25 04:01:00 +0800";    NSFileOwnerAccountID = 501;    
NSFileOwnerAccountName = user1;    NSFilePosixPermissions = 511;    
NSFileReferenceCount = 1;    NSFileSize = 13086720;    NSFileSystemFileNumber = 
119;    NSFileSystemNumber = 234881031;    NSFileType = NSFileTypeRegular;}




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: getting file creation date from NTFS

2010-05-22 Thread Angelo Chen
As suggested by Ken, I tried FSMegaInfo on NOTEPAD.EXE in a bootcamp volume:if 
I compared it with Finder's display, Finder listed March 30, 2010 6:48PM as 
'Created'looks like, st_atime is the creation date?
'NOTEPAD.EXE'    st_dev     = 0x0e03 (major=14, minor=3, disk0s3)    st_ino 
    = 2469    st_mode    = 0x81ed (-rwxr-xr-x)    st_nlink   = 1    st_uid  
   = 501 (user1)    st_gid     = 20 (staff)    st_rdev    = 0x 
(major=0, minor=0, console)    st_atime   = 1269957274.686875000 (Tue Mar 30 
13:54:34 2010)    st_mtime   = 1091595416.0 (Wed Aug  4 04:56:56 2004)    
st_ctime   = 1274540319.708286000 (Sat May 22 14:58:39 2010)    st_size    = 
69120 (67 KB)    st_blocks  = 136    st_blksize = 33554432    st_flags   = 
0x    st_gen     = 0

--- 2010年5月23日 星期日,Paul Sanders  寫道﹕

寄件人: Paul Sanders 
主題: Re: getting file creation date from NTFS
收件人: "Ken Thomases" , "Angelo Chen" 

副本(CC): cocoa-dev@lists.apple.com
日期: 2010年5月23日,星期日,上午1:14

> Also be aware that not all file systems support the notion of 
> creation dates of their objects.  I don't know off-hand if 
> NTFS does.

It does.

Paul Sanders. 







___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: getting file creation date from NTFS

2010-05-23 Thread Angelo Chen
Hi,
I think FSGetCatalogInfo (&ref, kFSCatInfoCreateDate, &info, NULL, NULL, 
NULL); info.createDate has the creation date, can see it clearly in debugger, 
problem is, how to convert it into NSDatefollowing code taken from net works 
with UTC dates from OS X or FAT files, but not working with NTFS files, how to 
adjust this code to be able to convert NTFS file's date as well?
static NSTimeInterval CarbonReferenceDate( ){    static NSTimeInterval 
sCarbonReferenceDate = 0;    if( sCarbonReferenceDate == 0 ) {        
NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];        NSDate 
*ref = [[NSCalendarDate alloc] initWithYear: 1904 month: 1 day: 1   

   hour: 0 minute: 0 second: 0 timeZone: gmt];        sCarbonReferenceDate 
= [ref timeIntervalSinceReferenceDate];        [ref release];    }    return 
sCarbonReferenceDate;}

static NSDate* UTCDateTimeToNSDate( UTCDateTime *utc ){    NSTimeInterval 
utcTime = *(unsigned long long*)utc / 65536.0;    return [NSDate 
dateWithTimeIntervalSinceReferenceDate: CarbonReferenceDate() + utcTime];}

static void NSDateToUTCDateTime( NSDate* date, UTCDateTime *utc ){    
*(unsigned long long*)utc = ([date timeIntervalSinceReferenceDate] - 
CarbonReferenceDate()) * 65536.0;}

--- 2010年5月23日 星期日,Ken Thomases  寫道﹕

寄件人: Ken Thomases 
主題: Re: getting file creation date from NTFS
收件人: "Paul Sanders" 
副本(CC): "Angelo Chen" , cocoa-dev@lists.apple.com
日期: 2010年5月23日,星期日,下午5:56

On May 23, 2010, at 4:19 AM, Paul Sanders wrote:

> Assuming that these figures come from stat (man -S 2 stat for details), it 
> should be in something called st_birthtime.

Yes, although the stat structure only has the st_birthtimespec field if you 
build with 64-bit inodes enabled.  This is the default on Snow Leopard or for 
64-bit, but not for 32-bit on Leopard or earlier.  Unfortunately, it seems that 
FSMegaInfo is not 64-bit-inode aware.  It will never print the birth time.

It's not hard to update it to be aware of that, though.

>  st_atime refers to the last time the file was accessed. So, either call stat 
>yourself or, better perhaps, go via the file manager:
>  
> http://developer.apple.com/mac/library/DOCUMENTATION/Carbon/Reference/File_Manager/Reference/reference.html

FSMegaInfo can be used to exercise that API, too.  It's not just for 'stat'.  
To get the creation date:

./FSMegaInfo -vv FSGetCatalogInfo -kFSCatInfoCreateDate /path/to/file

or, for everything:

./FSMegaInfo -vv FSGetCatalogInfo -kFSCatInfoGettableInfo /path/to/file

Cheers,
Ken





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: getting file creation date from NTFS

2010-05-23 Thread Angelo Chen

Hi Ken,
Thanks, that works, problem solved. FSGetCatalogInfo (&ref, 
kFSCatInfoCreateDate.. is a better option to obtain creation date when you need 
to get NTFS file's date too.
Thanks to all responded,
Angelo.
--- 2010年5月23日 星期日,Ken Thomases  寫道﹕

寄件人: Ken Thomases 
主題: Re: getting file creation date from NTFS
收件人: "Angelo Chen" 
副本(CC): cocoa-dev@lists.apple.com
日期: 2010年5月23日,星期日,下午7:12

On May 23, 2010, at 5:33 AM, Angelo Chen wrote:

> I think FSGetCatalogInfo (&ref, kFSCatInfoCreateDate, &info, NULL, NULL, 
> NULL); info.createDate has the creation date, can see it clearly in debugger, 
> problem is, how to convert it into NSDate

You should use UCConvertUTCDateTimeToCFAbsoluteTime() and CFDateCreate().  
Since CFDate is toll-free bridged with NSDate, you can just cast the result.  
(You do have to be mindful of memory-management issues, of course.)

You can also feed the CFAbsoluteTime value to +[NSDate 
dateWithTimeIntervalSinceReferenceDate:], since the reference date is the same 
between the two.

Regards,
Ken





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


terminates app when main window closes

2010-06-17 Thread Angelo Chen
Hi,
I have a non document based application, I quit the app by sending terminate to 
NSApplication(file owner). if I close the main window, application will not be 
closed, what I'd like is, when user close the main window, application also 
terminates, possible? Thanks,
Angelo



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: terminates app when main window closes

2010-06-18 Thread Angelo Chen

Thanks, applicationShouldTerminateAfterLastWindowClosed works.
Now I'd like to prompt user if he really wants to quit, if not, return NO, that 
seems working as well.
--- 2010年6月18日 星期五,Kyle Sluder  寫道﹕

寄件人: Kyle Sluder 
主題: Re: terminates app when main window closes
收件人: "Angelo Chen" 
副本(CC): cocoa-dev@lists.apple.com
日期: 2010年6月18日,星期五,下午3:02

On Thu, Jun 17, 2010 at 11:41 PM, Angelo Chen
 wrote:
> I have a non document based application, I quit the app by sending terminate 
> to NSApplication(file owner). if I close the main window, application will 
> not be closed, what I'd like is, when user close the main window, application 
> also terminates, possible? Thanks,

Non-document-based apps typically don't do this.

That said, look at -applicationShouldTerminateAfterLastWindowClosed:
in the NSApplicationDelegate protocol.

--Kyle Sluder




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


RADPlugin framework

2010-06-20 Thread Angelo Chen
Hi,I have seen some Apple's applications having this RADPlugin, iMovie, 
FinalCut pro:
/Applications/Final Cut Pro.app/Contents/PlugIns/AVCHD.RADPlug
and sometimes, those files can be interchanged between iMovie and FinalCut Pro, 
is there documentation on this?  Thanks,
Angelo



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


AppleScript in a Cocoa app

2010-06-20 Thread Angelo Chen
Hi,
I need to create an AppleScript and run it inside the app to activate another 
program, the applescript should call 'add' function the the other program with 
different file names, any idea how to achieve this? Thanks,
Angelo



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: detect NSPopUpButton changes

2010-06-22 Thread Angelo Chen
Hi,
oic, i'm kind of ignorant:(
however, since that even will be called every time when the drop down is 
selected, is there a way to check if selected item really change? thanks

--- 2010年6月22日 星期二,Graham Cox  寫道﹕

寄件人: Graham Cox 
主題: Re: detect NSPopUpButton changes
收件人: "Angelo Chen" 
副本(CC): cocoa-dev@lists.apple.com
日期: 2010年6月22日,星期二,下午1:56


On 22/06/2010, at 3:51 PM, Angelo Chen wrote:

> Hi,
> How to detect if user has change NSPopupButton's selection? Thanks,
> Angelo  


What have you tried?

It's a control like any other - hook it up to a target and an action and you'll 
get called when the user changes the selection.

--Graham






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


detect NSPopUpButton changes

2010-06-22 Thread Angelo Chen
Hi,
How to detect if user has change NSPopupButton's selection? Thanks,
Angelo  



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


checking if an app installed

2010-06-23 Thread Angelo Chen
Hi,
Is there a way to check if a certain application is installed? say if iMovie is 
installed? thanks,
Angelo



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: checking if an app installed

2010-06-23 Thread Angelo Chen
Hi,
Thanks for the fast reply, this works very well, now I'd like to check if 
certain plugin for Quicktime got installed too, is there a similar service? i 
tried following and it returns nil:
NSURL * bURL = [[NSWorkspace sharedWorkspace] 
URLForApplicationWithBundleIdentifier:@"com.apple.AppleIntermediateCodec"];
Thanks.
--- 2010年6月24日 星期四,Stephen J. Butler  寫道﹕

寄件人: Stephen J. Butler 
主題: Re: checking if an app installed
收件人: "Angelo Chen" 
副本(CC): Cocoa-dev@lists.apple.com
日期: 2010年6月24日,星期四,上午8:55

On Wed, Jun 23, 2010 at 7:48 PM, Angelo Chen  wrote:
> Hi,
> Is there a way to check if a certain application is installed? say if iMovie 
> is installed? thanks,

Three ways:

-[NSWorkspace absolutePathForAppBundleWithIdentifier:] (10.3)
-[NSWorkspace fullPathForApplication:] (10.0)
-[NSWorkspace URLForApplicationWithBundleIdentifier:] (10.6)




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


set defaults in another application?

2010-07-01 Thread Angelo Chen
Hi,
In application A, I use following code to set some settings:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];NSData 
*defaultSettings = [defaults objectForKey : EXPORT_SETTINGS];
ExportSettings *es = [[ExportSettings alloc] init];NSData *settings = [es 
getExportSettings: defaultSettings];[es release];if (settings)[defaults 
setObject:settings forKey:EXPORT_SETTINGS];   Now I'd like to access 
and set the settings in application B to the defaults in A, possible? thanks,
Angelo  



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


horizontal radio group

2010-07-01 Thread Angelo Chen
Hi,
radio group created in Interface builder is vertical, how  to set it 
horizontal? example, two radio buttons in one line? Thanks,
a.c.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTextField restriction

2010-02-10 Thread Angelo Chen
Hi,
I have a NSTextField outlet, and I'd like to limit the input to:
1) only upper case alpha characters2) must be two characters
Any idea how to achieve this? Thanks,
Angelo

___
 YM - 離線訊息
 就算你沒有上網,你的朋友仍可以留下訊息給你,當你上網時就能立即看到,任何說話都冇走失。
 http://messenger.yahoo.com.hk
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


searching a string in big file

2009-06-12 Thread Angelo Chen
Hi,
I need to open a big file and search for a certain string, if found, I need tup 
do some updates and write back the file, any idea what approach I should take? 
Thanks,
Angelo


  Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: searching a string in big file

2009-06-13 Thread Angelo Chen
Hi Stephen,
Thanks for the quick reply, it is a binary file, coming from Quicktime's mov, I 
need to search backward for a string 'free', then change it to 'moov', so 
search should start from the end of file, any ideas? Thanks,
Angelo 


--- 2009年6月13日 星期六,Stephen J. Butler  寫道﹕

寄件人: Stephen J. Butler 
主題: Re: searching a string in big file
收件人: 
副本(CC): cocoa-dev@lists.apple.com
日期: 2009年6月13日,星期六,下午2:04

2009/6/13 Angelo Chen :
> I need to open a big file and search for a certain string, if found, I need 
> tup do some updates and write back the file, any idea what approach I should 
> take? Thanks,

32 or 64 bit? What is the encoding (ASCII, UTF-8, UTF-16, etc)? Are
the updates in place (that is, overwriting existing characters) or is
it more of an inserting new characters operation?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/angelochen960%40yahoo.com.hk

This email sent to angelochen...@yahoo.com.hk



  Yahoo! 推出全...@ymail.com 電郵地址,想登記你的新身份? 請前往 
http://hk.promo.yahoo.com/mail/ymail/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


xcode 2.4 and gcc 3.3

2009-06-15 Thread Angelo Chen
Hi,every new project i created in xcode 2.4 uses gcc 3.3, but when compiling i 
got:
gcc-3.3: installation problem, cannot exec `cc1obj': No such file or directory
gcc-3.3: installation problem, cannot exec `cc1obj': No such file or directoryI 
need to change the gcc 3.3 to gcc 4.0, is there a way to set the xcode to use 
gcc 4.0 as default?
Thanks,



  Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


renaming executable files

2009-06-21 Thread Angelo Chen
Hi,
I need to rename the executable file without renaming the project, how to do 
that? thanks


  Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: renaming executable files

2009-06-21 Thread Angelo Chen
thanks for the reply, i tried two approaches , all not working, still get the 
same name

--- 2009年6月21日 星期日,Filip van der Meeren  寫道﹕

寄件人: Filip van der Meeren 
主題: Re: renaming executable files
收件人: "Angelo Chen" 
副本(CC): cocoa-dev@lists.apple.com
日期: 2009年6月21日,星期日,下午9:51

Just change the name of the targetname, or get Info on the proper target, and 
change the executable name in the properties tab.

Filip van der Meeren


On 21 Jun 2009, at 15:47, Angelo Chen wrote:

> Hi,
> I need to rename the executable file without renaming the project, how to do 
> that? thanks
> 
> 
>      Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/filip%40code2develop.com
> 
> This email sent to fi...@code2develop.com




  Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


stepping in unit test

2009-06-22 Thread Angelo Chen
Hi,
I'm using XCode 2.4.1, doing some unit test, is it possible to debug/step in 
unit test classes? Thanks,
Angelo


  Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Intercepting console in an app

2009-07-08 Thread Angelo Chen
Hi,
I use NSTask to run a command line program(ffmpeg in this case),  NSPipe can't 
get the output from the program, but I can see those messages from the Console 
during runtime, is there a way to grab the Console output from a running cocoa 
app? Thanks,
Angelo


  Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


getting directories created from a certain time

2009-07-10 Thread Angelo Chen
Hi,
I have a lengthy process where it creates a few directories, I'd like to know 
how to get a list of directories created since the starting of the process, any 
hints? Thanks,
Angelo


  Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


from CFDataRef to NSString

2008-06-10 Thread Angelo Chen
Hi,

What is the correct way to cast from CFDataRef to NSString, I have this code:

CFDataRef data;
NSString *messageString = [NSString stringWithCString:CFDataGetBytePtr(data)]; 

it always return this warning, any idea?

warning:pointer targets in passing argument 1 of 'stringWithCString:' differ in 
signedness

Thanks




  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


adding a delegate to a class

2008-06-10 Thread Angelo Chen
Hi,

I have a code like this:

@interface BackgroundObj : NSObject
{
Controller *mc;
}

- (void) sayHi;


@implementation BackgroundObj

- (void) sayHi
{
[mc showText:@"Hi"];
}
@end

As you can see, the code is hard coded to use class Controller, can not be used 
with any other object, I'd like to add a delegate which will have a showText 
method, sayHi method will just call the delegate instead of hard coded 
Controller, any idea how to add delegates to this object? or, any tutorials for 
this? Thanks,

Angelo




  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


looking for a crc code

2008-06-13 Thread Angelo Chen
Hi,

Is there a crc code that can be used directly in Objective-C? any tips? Thanks.

Angelo


  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


using NSFileManager to read data

2008-06-14 Thread Angelo Chen
Hi,

NSFileManager's contentsAtPath can read the entire file, is there a way to read 
only a specific bytes? something similar to NSFileHandle's readDataOfLength? 
thanks,

Angelo


  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


(no subject)

2008-06-16 Thread Angelo Chen
Hi,

I have following action, two NSButtons are linked to it, I'd like to test which 
button trigger the action in the code, any way to do this? thanks.


- (IBAction)doCopying:(id)sender
{
   // how to determine which NSButton is clicked?
}

Angelo


  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


opening default email and browser from the code

2008-06-16 Thread Angelo Chen
Hi,

I got two questions:

1) I have an email address in the code, I'd like to open default mailing 
program from the code with the email address as the recipient.


2) I have a NSImageView, when mouse move over it, the cursor should be changed 
to a hand, and when it is clicked, it will open a URL in the default browser.

Any tips on these? Thanks,

Angelo


  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


iMovie HD like splash screen

2008-06-17 Thread Angelo Chen
Hi,

I'd like to implement a iMovie HD like splash screen, here are some tips needed:

1) when the 'quit' button is clicked, how to quit the entire application?

2) the bottom of the splash is grey with rounded corners, how to do that?

Thanks,

Angelo


  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: iMovie HD like splash screen

2008-06-17 Thread Angelo Chen
Hi,

Thanks for the fast response, I tried the -setContentBorderTHickness, it does 
not work with me as I'm using Tiger 10.4.11, any equivalent of the method in 
this OS X? 

Angelo

>   Use NSWindow's new
> -setContentBorderThickness:forEdge: method.
> 
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
> http://www.zathras.de


  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


clickable NSImageView

2008-06-17 Thread Angelo Chen
Hi,

I use the code at the end to let user click on an image and open a URL, this 
works, but not really satisfactory as when the mouse is moved over the image, 
the cursor was not changed to point-hand shape, any idea to improve this? 
Thanks,

Angelo


@interface BannerView : NSImageView
{
}


- (void)mouseDown:(NSEvent *)theEvent
{
if ([theEvent clickCount] ==1) {
NSURL *url = [NSURL URLWithString:@"http://www.cnn.com";];
[[NSWorkspace sharedWorkspace] openURL: url];   
}
}




  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


getting accurate file modification time?

2008-06-17 Thread Angelo Chen
Hi,

I use the code at end to get modification timestamp of a file including 
seconds, it works well until I encounter following:

I have a file that is in the Document folder, the creation and modification 
date are both:2008-05-04 22:06:46 +0800

when this file is copied to a FAT volume, naturally the creation date is lost, 
modification date become:
2008-05-04 22:06:47 +0800

Any idea why this happens? Thanks,

Angelo


NSFileManager *fileManager = [NSFileManager defaultManager];
NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:path 
traverseLink:YES];
fileModDate = [fileAttributes objectForKey:NSFileModificationDate];


  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


disable manual resizing of NSWindow

2008-06-18 Thread Angelo Chen
Hi,

Is there a way to do following:

In a NSWindow, I'd like to disable manual resizing(don't allow user to drag the 
lower right corner to resize the window), only by clicking 'max' and 'restore' 
icons, possible? the reason is, I put a QuickTIme's movieview in the window and 
the preserving aspect ratio is on, manual resizing will not do good. 

Thanks,

Angelo

 


  Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


getting free space available in a drive

2008-06-18 Thread Angelo Chen
Hi,

how to get the total free space available in a drive? thanks,

Angelo

___
 YM - 離線訊息
 就算你沒有上網,你的朋友仍可以留下訊息給你,當你上網時就能立即看到,任何說話都冇走失。
 http://messenger.yahoo.com.hk
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Error when building a Cocoa-Java app

2008-06-23 Thread Angelo Chen
Hi,

I'm trying out Cocoa-Java application, in the XCode 2.4, I created a new object 
'Cocoa-Java application', then click 'build', and it gives me error:

command /Developer/Private/jam failed with exit code 1

any idea how to fix this? Thanks.

Angelo

___
 YM - 離線訊息
 就算你沒有上網,你的朋友仍可以留下訊息給你,當你上網時就能立即看到,任何說話都冇走失。
 http://messenger.yahoo.com.hk
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Error when building a Cocoa-Java app

2008-06-23 Thread Angelo Chen
Hi,

There is this tutorial:

http://www.informit.com/articles/article.aspx?p=428071&seqNum=3

but no source code included, following the steps turned out not working, I 
think Cocoa-java bridge is quite useful, example, you might like to use 
Hibernate in your Cocoa app, and Objectiv C does not that support, only way is 
to go java.

Angelo

--- 2008年6月23日 星期一,Kyle Sluder <[EMAIL PROTECTED]> 寫道﹕

> 寄件人: Kyle Sluder <[EMAIL PROTECTED]>
> 主題: Re: Error when building a Cocoa-Java app
> 收件人: "Angelo Chen" <[EMAIL PROTECTED]>
> 副本(CC): cocoa-dev@lists.apple.com
> 日期: 2008 6 23 星期一 下午 7:32
> 2008/6/23 Angelo Chen <[EMAIL PROTECTED]>:
> > any idea how to fix this? Thanks.
> 
> Good luck; the Cocoa-Java bridge has been deprecated as of
> 10.4.
> 
> --Kyle Sluder

___
 YM - 離線訊息
 就算你沒有上網,你的朋友仍可以留下訊息給你,當你上網時就能立即看到,任何說話都冇走失。
 http://messenger.yahoo.com.hk
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


renaming a project

2008-08-23 Thread Angelo Chen
hi,

I have a project which has "MyTest" as the project name, so the executable has 
the same name, now I'd like to rename it to "MyProg", I renamed the Xoce's 
project file to "MyProg", but the executable still has the previous name, any 
idea how to rename ? thanks

Angelo


  為了不斷提升Yahoo! 
Mail,雅虎香港誠邀你參與意見調查。請前往http://surveylink.yahoo.com/wix/p5429076.aspx 發表你的意見!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


specify a NSPredicate for jpeg file names?

2008-08-23 Thread Angelo Chen
Hi,

I'd like to filter an array to return only jpeg file names like DSC0001.jpg, 
DSC0002.jpg, etc. could anybody help me modify the jpegPredicate for that 
mater? thanks

NSPredicate *jpegPredicate = [NSPredicate predicateWithFormat:@"SELF [c] 'b'"];
NSArray *lst = [[[NSFileManager defaultManager] directoryContentsAtPath:aDir] 
filteredArrayUsingPredicate:jpegPredicate];




  為了不斷提升Yahoo! 
Mail,雅虎香港誠邀你參與意見調查。請前往http://surveylink.yahoo.com/wix/p5429076.aspx 發表你的意見!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


using OpenPanel to select volumes?

2008-08-23 Thread Angelo Chen
Hi,

I use following code to select a volume, it works, but it also give the user 
chance to select directory as well, how to disable selection of directories, 
only allow volumes?
thanks,


NSOpenPanel *oPanel = [OpenPanel openPanel];
[oPanel setCanChooseFiles:NO];
[oPanel setCanChooseDirectories:YES];
[oPanel setCanCreateDirectories:NO];


  為了不斷提升Yahoo! 
Mail,雅虎香港誠邀你參與意見調查。請前往http://surveylink.yahoo.com/wix/p5429076.aspx 發表你的意見!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]