|
Next: Learn The Language before you learn the gui
|
| Author |
Message |
External

Since: Apr 09, 2007 Posts: 5
|
(Msg. 1) Posted: Mon Apr 09, 2007 7:36 pm
Post subject: Some small (?) Carbon troubles Archived from groups: comp>sys>mac>programmer>help (more info?)
|
|
|
Hey,
Im trying to use carbon to make a small app for an image gallery im
working on. All this app needs to do is watch for new images to appear
in a directory, then possibly rotate them and create a thumbnail, then
move everything to another directory. The problem is... I have pretty
much no idea how to use Carbon! I picked carbon because i already know
C++ (the gallery is for the web, PHP), and dont need to take the time
to learn Objective-C.
I've already gotten a window with 2 buttons that trigger functions,
and a text box, but im lost as to how i would check a directory for
new files. I was also hoping someone could point me at some image
libraries (can i use any C++ libraries with Carbon?) that i could use.
All i need to know really is how i can watch a directory for new
files.
Thanks! |
|
| Back to top |
|
 |  |
External

Since: Apr 09, 2007 Posts: 5
|
(Msg. 2) Posted: Mon Apr 09, 2007 9:34 pm
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Apr 9, 11:45 pm, Michael Ash <m....DeleteThis@mikeash.com> wrote:
> Seventoes <sevent....DeleteThis@gmail.com> wrote:
> > Hey,
>
> > Im trying to use carbon to make a small app for an image gallery im
> > working on. All this app needs to do is watch for new images to appear
> > in a directory, then possibly rotate them and create a thumbnail, then
> > move everything to another directory. The problem is... I have pretty
> > much no idea how to use Carbon! I picked carbon because i already know
> > C++ (the gallery is for the web, PHP), and dont need to take the time
> > to learn Objective-C.
>
> First, let me urge you to reconsider. Of course you're free to do as you
> wish, but I think it's worth learning Objective-C in this case so you can
> use Cocoa.
>
> Objective-C is easy. The amount of time it takes to learn the language is
> small. You'll mostly spend time learning the libraries, and Cocoa is much
> faster to pick up than Carbon. I think the time spent with the language
> will be more than compensated by the time not spent learning Carbon.
>
> > I've already gotten a window with 2 buttons that trigger functions,
> > and a text box, but im lost as to how i would check a directory for
> > new files. I was also hoping someone could point me at some image
> > libraries (can i use any C++ libraries with Carbon?) that i could use.
>
> > All i need to know really is how i can watch a directory for new
> > files.
>
> You can use any C++ libraries with Carbon. Carbon is just a library
> itself, and it doesn't limit what else you can use.
>
> For your question, I would suggest kqueues. This is a UNIX level
> notification system which allows you to watch a directory for activity and
> get informed when anything changes. There is more information in the
> kqueue man page.
>
> Another possibility is to use Spotlight. While intended for searches,
> Spotlight will also give you updates to your search whenever anything
> changes. You can ask for all files and limit your search to a specific
> directory, then the query will give you an initial set of results in that
> directory, followed by updates for any new or deleted files in it. This
> functionality is exposed by MDQuery in CoreFoundation and by
> NSMetadataQuery in Cocoa.
>
> --
> Michael Ash
> Rogue Amoeba Software
Thanks for the help, I dont really have the need to learn Objective-C,
since this will probably be the only app i ever write for mac, as im a
web developer. kqueue looks a little advanced for my skill level :-\
Anyone have any information on using FNSubscribeByPath? It sort of
looks like what im looking for, but i still have no idea how to use it. |
|
| Back to top |
|
 |  |
External

Since: Mar 21, 2006 Posts: 164
|
(Msg. 3) Posted: Mon Apr 09, 2007 10:45 pm
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Seventoes <seventoes DeleteThis @gmail.com> wrote:
> Hey,
>
> Im trying to use carbon to make a small app for an image gallery im
> working on. All this app needs to do is watch for new images to appear
> in a directory, then possibly rotate them and create a thumbnail, then
> move everything to another directory. The problem is... I have pretty
> much no idea how to use Carbon! I picked carbon because i already know
> C++ (the gallery is for the web, PHP), and dont need to take the time
> to learn Objective-C.
First, let me urge you to reconsider. Of course you're free to do as you
wish, but I think it's worth learning Objective-C in this case so you can
use Cocoa.
Objective-C is easy. The amount of time it takes to learn the language is
small. You'll mostly spend time learning the libraries, and Cocoa is much
faster to pick up than Carbon. I think the time spent with the language
will be more than compensated by the time not spent learning Carbon.
> I've already gotten a window with 2 buttons that trigger functions,
> and a text box, but im lost as to how i would check a directory for
> new files. I was also hoping someone could point me at some image
> libraries (can i use any C++ libraries with Carbon?) that i could use.
>
> All i need to know really is how i can watch a directory for new
> files.
You can use any C++ libraries with Carbon. Carbon is just a library
itself, and it doesn't limit what else you can use.
For your question, I would suggest kqueues. This is a UNIX level
notification system which allows you to watch a directory for activity and
get informed when anything changes. There is more information in the
kqueue man page.
Another possibility is to use Spotlight. While intended for searches,
Spotlight will also give you updates to your search whenever anything
changes. You can ask for all files and limit your search to a specific
directory, then the query will give you an initial set of results in that
directory, followed by updates for any new or deleted files in it. This
functionality is exposed by MDQuery in CoreFoundation and by
NSMetadataQuery in Cocoa.
--
Michael Ash
Rogue Amoeba Software |
|
| Back to top |
|
 |  |
External

Since: Jun 28, 2005 Posts: 18
|
(Msg. 4) Posted: Tue Apr 10, 2007 12:02 am
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article <1176179668.046936.66740.TakeThisOut@p77g2000hsh.googlegroups.com>,
Seventoes <seventoes.TakeThisOut@gmail.com> wrote:
> Anyone have any information on using FNSubscribeByPath? It sort of
> looks like what im looking for, but i still have no idea how to use it.
I don't thing that's what you want. My impression is that this will
only hear about cases where someone explicitly called FNNotify, and
hence it will not be as reliable as kqueue. See the sample code
<http://developer.apple.com/samplecode/FileNotification/index.html>.
By the way, Carbon questions probably get a wider audience on Apple's
Carbon-dev mailing list. |
|
| Back to top |
|
 |  |
External

Since: Jun 06, 2005 Posts: 660
|
(Msg. 5) Posted: Tue Apr 10, 2007 8:59 am
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article <1176179668.046936.66740.RemoveThis@p77g2000hsh.googlegroups.com>,
"Seventoes" <seventoes.RemoveThis@gmail.com> wrote:
> On Apr 9, 11:45 pm, Michael Ash <m....RemoveThis@mikeash.com> wrote:
> > Seventoes <sevent....RemoveThis@gmail.com> wrote:
> > > Hey,
> >
> > > Im trying to use carbon to make a small app for an image gallery im
> > > working on. All this app needs to do is watch for new images to appear
> > > in a directory, then possibly rotate them and create a thumbnail, then
> > > move everything to another directory. The problem is... I have pretty
> > > much no idea how to use Carbon! I picked carbon because i already know
> > > C++ (the gallery is for the web, PHP), and dont need to take the time
> > > to learn Objective-C.
> >
> > First, let me urge you to reconsider. Of course you're free to do as you
> > wish, but I think it's worth learning Objective-C in this case so you can
> > use Cocoa.
> >
> > Objective-C is easy. The amount of time it takes to learn the language is
> > small. You'll mostly spend time learning the libraries, and Cocoa is much
> > faster to pick up than Carbon. I think the time spent with the language
> > will be more than compensated by the time not spent learning Carbon.
> > ...
> > For your question, I would suggest kqueues. This is a UNIX level
> > notification system which allows you to watch a directory for activity and
> > get informed when anything changes. There is more information in the
> > kqueue man page.
>
> Thanks for the help, I dont really have the need to learn Objective-C,
> since this will probably be the only app i ever write for mac, as im a
> web developer.
But if you read again what Michael wrote, that argues even more in favor
of Objective-C. If X < Y, would you rather spend X minutes learning a
tool which is _primarily_ used on the Mac or Y minutes learning a tool
which is _only_ used on the Mac?
> kqueue looks a little advanced for my skill level :-\
It looks more daunting than it is, and it's the right solution. M. Uli
Kusterer has some excellent code.
<http://www.zathras.de/programming/cocoa/UKKQueue.zip>
> Anyone have any information on using FNSubscribeByPath? It sort of
> looks like what im looking for, but i still have no idea how to use it.
As Michael noted, that takes cooperation from the apps changing that
directory. |
|
| Back to top |
|
 |  |
External

Since: Mar 21, 2006 Posts: 164
|
(Msg. 6) Posted: Tue Apr 10, 2007 8:59 am
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Gregory Weston <uce.TakeThisOut@splook.com> wrote:
>
>> kqueue looks a little advanced for my skill level :-\
>
> It looks more daunting than it is, and it's the right solution. M. Uli
> Kusterer has some excellent code.
> <http://www.zathras.de/programming/cocoa/UKKQueue.zip>
I'm also puzzled as to why he's completely ignoring my suggestion of using
Spotlight, which is much less daunting and works almost as well.
>> Anyone have any information on using FNSubscribeByPath? It sort of
>> looks like what im looking for, but i still have no idea how to use it.
>
> As Michael noted, that takes cooperation from the apps changing that
> directory.
For the record, that was James Walker who noted it, not me. Of course he
is absolutely right, and since so few apps actually do this, it's not
likely to be useful.
--
Michael Ash
Rogue Amoeba Software |
|
| Back to top |
|
 |  |
External

Since: Sep 19, 2005 Posts: 42
|
(Msg. 7) Posted: Tue Apr 10, 2007 6:04 pm
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article <1176172610.648365.102380.TakeThisOut@e65g2000hsc.googlegroups.com>,
"Seventoes" <seventoes.TakeThisOut@gmail.com> wrote:
> Hey,
>
> Im trying to use carbon to make a small app for an image gallery im
> working on. All this app needs to do is watch for new images to appear
> in a directory, then possibly rotate them and create a thumbnail, then
> move everything to another directory. The problem is... I have pretty
> much no idea how to use Carbon! I picked carbon because i already know
> C++ (the gallery is for the web, PHP), and dont need to take the time
> to learn Objective-C.
I would consider doing something like that in AppleScript, with a Folder
Action. If you merge scripts 7 or 8 anad 13 of
<http://www.apple.com/applescript/folderactions/04.html> you almost are
where you want to be (depending on what 'possibly rotate them' means)
Reinder |
|
| Back to top |
|
 |  |
External

Since: Apr 09, 2007 Posts: 5
|
(Msg. 8) Posted: Tue Apr 10, 2007 8:50 pm
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Apr 10, 4:55 pm, silverdr <silve... DeleteThis @inet.pl.remove.it> wrote:
> Seventoes wrote:
>
> > All this app needs to do is watch for new images to appear
> > in a directory, then possibly rotate them and create a thumbnail, then
> > move everything to another directory.
> [...]
>
> > Thanks for the help, I dont really have the need to learn Objective-C,
> > since this will probably be the only app i ever write for mac, as im a
> > web developer. kqueue looks a little advanced for my skill level :-\
>
> Why not putting an automator or AppleScript connected to a folder?
> Folder Actions and Scripts are exactly for that purpose.
>
> Have a look at
>
> $ ls /Library/Scripts/Folder\ Action\ Scripts/Image\ -\ *
>
> /Library/Scripts/Folder Action Scripts/Image - Add Icon.scpt
> /Library/Scripts/Folder Action Scripts/Image - Duplicate as JPEG.scpt
> /Library/Scripts/Folder Action Scripts/Image - Duplicate as PNG.scpt
> /Library/Scripts/Folder Action Scripts/Image - Duplicate as TIFF.scpt
> /Library/Scripts/Folder Action Scripts/Image - Flip Horizontal.scpt
> /Library/Scripts/Folder Action Scripts/Image - Flip Vertical.scpt
> /Library/Scripts/Folder Action Scripts/Image - Info to Comment.scpt
> /Library/Scripts/Folder Action Scripts/Image - Rotate Left.scpt
> /Library/Scripts/Folder Action Scripts/Image - Rotate Right.scpt
>
> You may find an almost ready solution to your need there.
Ohhh, those might be exactly what i need! I just need a couple more
answers and ill be out of you guys hair!
The script 'add - new item alert.scpt', that will activate for any
source, like a file being uploaded via ftp right? I think all i need
if thats true is an applescript that can read EXIF data! |
|
| Back to top |
|
 |  |
External

Since: Apr 10, 2007 Posts: 8
|
(Msg. 9) Posted: Tue Apr 10, 2007 10:55 pm
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Seventoes wrote:
> All this app needs to do is watch for new images to appear
> in a directory, then possibly rotate them and create a thumbnail, then
> move everything to another directory.
[...]
> Thanks for the help, I dont really have the need to learn Objective-C,
> since this will probably be the only app i ever write for mac, as im a
> web developer. kqueue looks a little advanced for my skill level :-\
Why not putting an automator or AppleScript connected to a folder?
Folder Actions and Scripts are exactly for that purpose.
Have a look at
$ ls /Library/Scripts/Folder\ Action\ Scripts/Image\ -\ *
/Library/Scripts/Folder Action Scripts/Image - Add Icon.scpt
/Library/Scripts/Folder Action Scripts/Image - Duplicate as JPEG.scpt
/Library/Scripts/Folder Action Scripts/Image - Duplicate as PNG.scpt
/Library/Scripts/Folder Action Scripts/Image - Duplicate as TIFF.scpt
/Library/Scripts/Folder Action Scripts/Image - Flip Horizontal.scpt
/Library/Scripts/Folder Action Scripts/Image - Flip Vertical.scpt
/Library/Scripts/Folder Action Scripts/Image - Info to Comment.scpt
/Library/Scripts/Folder Action Scripts/Image - Rotate Left.scpt
/Library/Scripts/Folder Action Scripts/Image - Rotate Right.scpt
You may find an almost ready solution to your need there. |
|
| Back to top |
|
 |  |
External

Since: Apr 29, 2006 Posts: 9
|
(Msg. 10) Posted: Wed Apr 11, 2007 8:15 pm
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On 11/4/07 04:50, "Seventoes" wrote:
> On Apr 10, 4:55 pm, silverdr <silve... RemoveThis @inet.pl.remove.it> wrote:
>>
>> Have a look at
[<snip>]
>> You may find an almost ready solution to your need there.
>
> Ohhh, those might be exactly what i need! I just need a couple more
> answers and ill be out of you guys hair!
>
> The script 'add - new item alert.scpt', that will activate for any
> source, like a file being uploaded via ftp right? I think all i need
I think you might be disappointed. The last time I played with
folder actions (a long, forgetful time ago) I'm pretty sure they
only got triggered in response to items being manually dropped
into the folders. I hope someone here can prove me wrong.
Stuart |
|
| Back to top |
|
 |  |
External

Since: Apr 09, 2007 Posts: 5
|
(Msg. 11) Posted: Wed Apr 11, 2007 8:33 pm
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Apr 11, 4:15 pm, Stuart Rogers
<stuart.rogers.clara.co....TakeThisOut@deadmail.co.uk> wrote:
> On 11/4/07 04:50, "Seventoes" wrote:
>
> > On Apr 10, 4:55 pm, silverdr <silve....TakeThisOut@inet.pl.remove.it> wrote:
>
> >> Have a look at
> [<snip>]
> >> You may find an almost ready solution to your need there.
>
> > Ohhh, those might be exactly what i need! I just need a couple more
> > answers and ill be out of you guys hair!
>
> > The script 'add - new item alert.scpt', that will activate for any
> > source, like a file being uploaded via ftp right? I think all i need
>
> I think you might be disappointed. The last time I played with
> folder actions (a long, forgetful time ago) I'm pretty sure they
> only got triggered in response to items being manually dropped
> into the folders. I hope someone here can prove me wrong.
>
> Stuart
Arrg, this is turning out to be alot tougher than i thought... Anyone
else got any ideas? |
|
| Back to top |
|
 |  |
External

Since: Jun 06, 2005 Posts: 660
|
(Msg. 12) Posted: Thu Apr 12, 2007 7:25 am
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article <1176348787.697180.98570.RemoveThis@b75g2000hsg.googlegroups.com>,
"Seventoes" <seventoes.RemoveThis@gmail.com> wrote:
> On Apr 11, 4:15 pm, Stuart Rogers
> <stuart.rogers.clara.co....RemoveThis@deadmail.co.uk> wrote:
> > On 11/4/07 04:50, "Seventoes" wrote:
> >
> > > On Apr 10, 4:55 pm, silverdr <silve....RemoveThis@inet.pl.remove.it> wrote:
> >
> > >> Have a look at
> > [<snip>]
> > >> You may find an almost ready solution to your need there.
> >
> > > Ohhh, those might be exactly what i need! I just need a couple more
> > > answers and ill be out of you guys hair!
> >
> > > The script 'add - new item alert.scpt', that will activate for any
> > > source, like a file being uploaded via ftp right? I think all i need
> >
> > I think you might be disappointed. The last time I played with
> > folder actions (a long, forgetful time ago) I'm pretty sure they
> > only got triggered in response to items being manually dropped
> > into the folders. I hope someone here can prove me wrong.
> >
> > Stuart
>
> Arrg, this is turning out to be alot tougher than i thought... Anyone
> else got any ideas?
The right way, presuming you're not supporting anything older than 10.3,
is still via the kqueue subsystem. |
|
| Back to top |
|
 |  |
External

Since: Apr 09, 2007 Posts: 5
|
(Msg. 13) Posted: Thu Apr 12, 2007 3:42 pm
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
> No - I have a working solution, which reacts to files being "dropped" to
> a folder by the application. It simply saves them to a given folder and
> no manual intervention is necessary.
Well thats good news, i guess i can test it out a bit.
>I recall some glitches when I had to disable and reenable the
>folder action to actually make it work (again) but other than that it
>always worked fine and I still use it occasionally.
Not good news! This script could be running for a full day, and it
might be handling a couple hundred pictures an hour, so if it suddenly
stops working that could be bad news.
>The right way, presuming you're not supporting anything older than 10.3,
>is still via the kqueue subsystem.
I would love to use kqueue, but its a little advanced for me, and the
example given is in Objective-C, which i dont know. This script will
only be run on one server, which runs 10.4, so thats not a problem. |
|
| Back to top |
|
 |  |
External

Since: Apr 10, 2007 Posts: 8
|
(Msg. 14) Posted: Thu Apr 12, 2007 6:47 pm
Post subject: Re: Some small (?) Carbon troubles [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Stuart Rogers wrote:
> [<snip>]
>>> You may find an almost ready solution to your need there.
>> Ohhh, those might be exactly what i need! I just need a couple more
>> answers and ill be out of you guys hair!
>>
>> The script 'add - new item alert.scpt', that will activate for any
>> source, like a file being uploaded via ftp right? I think all i need
>
> I think you might be disappointed. The last time I played with
> folder actions (a long, forgetful time ago) I'm pretty sure they
> only got triggered in response to items being manually dropped
> into the folders. I hope someone here can prove me wrong.
No - I have a working solution, which reacts to files being "dropped" to
a folder by the application. It simply saves them to a given folder and
no manual intervention is necessary.
True - I recall some glitches when I had to disable and reenable the
folder action to actually make it work (again) but other than that it
always worked fine and I still use it occasionally. |
|
| Back to top |
|
 |  |
| Related Topics: | Quicktime troubles saving on MacIntel vs PPC - Hello I've the following problem with QuickTime, in short: - I save an image with the usual routine found in any QT sample; - during the save I specify the type (eg.:k....PNG ); and now the results: - "picture.png" on desktop is ok under OSX...
SetControlBounds on a listbox [carbon] - Hi, I have created a listbox using CreateListBoxControl() and it works ok, but when I try to move or resize it using SetControlBounds() the display is seriously messed up. Moving and resizing other controls like buttons, check boxes, textedit control,....
Obtain_window´s_size_and_coordinates_(Carbon) - How could I obtain the global coordinates and the size of a windows in carbon? Thanks.
Read plist from Carbon - Hi folks, Is it a way to read a plist file from the Carbon app, that is using Carbon API and maybe lower-level API, but not Cocoa API? To be specific I need to know the default browser. I det retrieve this info from..
Carbon, threads, and windoww... - Hi, I'm porting a Win32 application to the Mac using C++ and the Carbon framework. The application must display a window in a non blocking way, i.e. when a specific object is constructed a window must pop up on the screen, display something until the.. |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|