Re: Hyperlinks in NSAttributedString?

2009-07-30 Thread Тимофей Даньшин
Yes, it is possible. See the docs for NSAttributedString for details.  
There was also an example of how to make hyperlinks, the link to that  
sample code, i suppose, must be there, too.


Best regards,
Timofey

On Jul 30, 2009, at 1:53 PM, Rick Mann wrote:

I need to render short sentences in my UI, and make certain words  
clickable (and differently-styled). I know I can use a web view, but  
that seems like overkill. I currently have a multiline NSTextField.  
Is it possible to display an NSAttributedString, and have the cursor  
change over clickable words, and detect a click on those words?


Or is a webkit view really the only easy way to go?

Thanks!

--
Rick

___

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/ok5.admin%40gmail.com

This email sent to ok5.ad...@gmail.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 arch...@mail-archive.com


Re: Multiple keyboard shortcuts for the same menu command

2009-07-27 Thread Тимофей Даньшин
Well, you could have two different menu items doing the same thing and  
having the two shortcuts.

On Jul 27, 2009, at 11:38 AM, Oleg Krupnov wrote:


I'd like the Go Back command in my app to be triggered by both Cmd+[
and Cmd+- (left arrow) keyboard shortcuts. How do I do that?

I am aware of the [NSMenuItem isAlternate] but it only works if the
keyboard equivalents are the same and only the modifiers differ,
whereas in my case the opposite is the case: the modifiers are the
same and the keyboard equivalents are different.

Is there a way to do it, desirably without much hassle (invisible
buttons, Carbon, etc.)?

Thanks!
___

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/ok5.admin%40gmail.com

This email sent to ok5.ad...@gmail.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 arch...@mail-archive.com


Re: SQLite -- same DB, different machines - different results

2009-06-12 Thread Тимофей Даньшин

Thank you all for your replies.

I really didn't have any order by clause.
But, unfortunately, I can't test it on my iMac right now.

On Jun 11, 2009, at 6:30 PM, Gregory Weston wrote:


Timofey wrote:


I've written the alfa of my first app on the Mac which works in an
acceptable manner on my macbook. But when i run it on my iMac, it
returns different results for the in seemingly the same conditions.

The application is a dictionary. As the user types a word into the
searchfield, he/she gets a completion suggestion (much like in Xcode
for class or variable or method names or like in Safari for web-
addresses). In my case it is the first word in the database with the
prefix the user has already typed. So, for example, if a the user
types te, the first suggestion (s)he gets is tea. But on the  
iMac,

the user does not get that completion...


As a recovering Oracle DBA, to me the most obvious question is: Are  
you assuming that the result set will have any given ordering  
automatically imposed, or are you including an explicit order clause  
in your query?


G
___

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/ok5.admin%40gmail.com

This email sent to ok5.ad...@gmail.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 arch...@mail-archive.com


SQLite -- same DB, different machines - different results

2009-06-11 Thread Тимофей Даньшин

Hello.
I've written the alfa of my first app on the Mac which works in an  
acceptable manner on my macbook. But when i run it on my iMac, it  
returns different results for the in seemingly the same conditions.


The application is a dictionary. As the user types a word into the  
searchfield, he/she gets a completion suggestion (much like in Xcode  
for class or variable or method names or like in Safari for web- 
addresses). In my case it is the first word in the database with the  
prefix the user has already typed. So, for example, if a the user  
types te, the first suggestion (s)he gets is tea. But on the iMac,  
the user does not get that completion...
Again, the application is completely the same. It is the release  
build. It has the same database. Now that I think about it, the  
versions if SQLite may be different, but that shouldn't really matter,  
for SQL syntax is pretty standard. And the tables in the database do  
have an autoincremental id (besides the 'rowid').


What could be the reasons for that?

Thank you in advance,
Timofey.

By the way, if you are willing to try it, I think i could upload it  
somewhere... It is a russian-english-russian dictionary.

___

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


[OT] default boot device

2009-05-26 Thread Тимофей Даньшин

Hello.
I installed another version of MacOS X in a separate partition of my  
hard disc. And now whenever i start the computer, it boots from that  
partition by default (unless i press option to select the partition to  
boot from this time). How can i permanently change the primary boot  
device to my initial one?

Sorry if this is too off-topic.

Thanks in advance,
Timofey.
___

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: microsoft file formats in cocoa

2009-05-17 Thread Тимофей Даньшин
TextEdit doesn't render quite a lot of things in doc files, such as  
footnotes, headers/footers, comments and lots of other things.

I've tried to find a library that would do that, but failed.

If you do find anything like that (or reinvent it for that  
matter ;) ), please, let me know as well.


Timofey

On May 17, 2009, at 10:37 AM, Thomas Davie wrote:



Op 17 May 2009, om 02:02 heeft Alexander Cohen het volgende  
geschreven:


Does anyone know of any libraries that can read microsoft formats  
( xls, ppt, doc, etc, ... )? I'd rther not reinent the wheel if  
something is already out there.


For .doc, go look at the TextEdit sources - it's in the sample code.

Bob
___

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/ok5.admin%40gmail.com

This email sent to ok5.ad...@gmail.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 arch...@mail-archive.com


Categories and splitting an app into logical blocks.

2009-05-15 Thread Тимофей Даньшин

Hello.

Suppose, I have an app that, for example, works with a database. It  
can write to the db, it can select things. There is a class that works  
with the database, a class that controls that class and a class that  
interacts with the gui. And, of course, there is some testing code in  
all the three layers.


Is it a good idea to split all those classes into categories for  
writing, reading and testing? For example, Database (Writing),  
Database(Reading), Database(Testing) and so on? Or is it a silly thing  
to do for some reason?


Thank you in advance for your replies.
Timofey.
___

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: IP detection code by country

2009-05-15 Thread Тимофей Даньшин

I once used the IP-to-country database for my site.
It was a free-to-download-and-use csv consisting of ip ranges and  
countries, to which they correspond. It can easily be used to create  
an sqlite database.


Check out http://ip-to-country.webhosting.info.

But there are no Cocoa libs for that that i know of.

Timofey.

On May 16, 2009, at 3:04 AM, Erg Consultant wrote:

Does anyone know of some Cocoa libraries for detecting which country  
the machine's IP address is currently running in?


Thanks.

Erg




___

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/ok5.admin%40gmail.com

This email sent to ok5.ad...@gmail.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 arch...@mail-archive.com


Win-MacOS porting question.

2009-05-13 Thread Тимофей Даньшин

Hello.
I am about to get involved in a project on porting a windows program  
into MacOS. The original program is written in C++ with limited use of  
windows-specific libraries, and its owner wants the code that will  
result from that project to be compilable both under Windows and MacOS  
(and, preferably, other platforms).
We both understand, that that cross-platform code will only be, in  
terms of the MVC model, the Model.

In that view I have two questions:
Is it a good idea to port a program that way? Or is it, perhaps,  
better to have platform-specific code for each system?
If it is a good idea, then how should we create a project in a  
repository so that it was usable both in Windows and in MacOS? Say, a  
framework for Mac and a dll for win?

Is there anything i need to know before starting that?

Thank you in advance,
Timofey.
___

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


C++ constructors.

2009-05-13 Thread Тимофей Даньшин

Hi there.


Here is a C++ constructor that is said to work on Windows (i.e., the  
guy who wrote it says it works on Win), but doesn't work on Mac. Is  
there a way to fix it, except by replacing it with a copy method?


Cbyte1::Cbyte1 (Cbyte1 val) {
m_size = val.m_size;
if (m_size == 0) {
m_totalmax = 0;
b = ;
return;
}
}
The errors I get are:

/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp: In function 'void Test()':
/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:25: error: no matching function for call to  
'Cbyte1::Cbyte1(Cbyte1)'
/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:13: note: candidates are: Cbyte1::Cbyte1(Cbyte1)
/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:12: note: Cbyte1::Cbyte1(Cbyte1*)
/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:11: note: Cbyte1::Cbyte1(char*)
/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:10: note: Cbyte1::Cbyte1(int)
/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:25: error:   initializing temporary from result of  
'Cbyte1::Cbyte1(char*)'
	/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:25: error: no matching function for call to  
'Cbyte1::Cbyte1(Cbyte1)'
	/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:13: note: candidates are: Cbyte1::Cbyte1(Cbyte1)
	/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:12: note: Cbyte1::Cbyte1(Cbyte1*)
	/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:11: note: Cbyte1::Cbyte1(char*)
	/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:10: note: Cbyte1::Cbyte1(int)
	/Users/dtv/Documents/XCodeBuilds/dakakugodno/dakakugodno/Mtran2/ 
cbyte_suggest.cpp:25: error:   initializing temporary from result of  
'Cbyte1::Cbyte1(char*)'


PS. I do my best to persuade that dude that the code badly needs  
refactoring, but he is reluctant.


Thank you in advance.
Timofey Danshin.

___

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


NSTextView delegate methods in NSTextView subclass.

2009-05-06 Thread Тимофей Даньшин

Hello.
I have subclassed NSTextView and I am using that subclass as a field  
editor for an NSTextField. On certain events in the field editor, i  
need to take certain actions again in the field editor, and as of now  
i have to use delegate methods in the TextField's delegate to call  
methods in the TextView, even though the messages that call those  
delegate methods, originate in the TextView.


Is there a way to receive the notifications on those events  
(triggering the delegate methods) in the NSTextView subclass?


The one I am particularly interested in is -controlTextDidChange;

Thank you for your help in advance.

Timofey.
___

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


NSTableView, 2mln rows, looks bad.

2009-05-04 Thread Тимофей Даньшин

Hello.
I need to have a tableView with about 2 million rows, and that figure  
may actually be bigger. But the table looks awfully bad in that case:  
you get artifacts when scrolling, the text in the rows does not  
coincide with the alternate bluish and white stripes, and if you click  
on a row, you get the action from another row, not the one you see. Is  
it the problem of my design (i.e. i may have done anything wrong while  
writing that), or is it a flaw of NSTableView? Are there any  
workarounds?


Thank you in advance for your help.
Timofey.
___

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: How to change the case of letters

2009-05-04 Thread Тимофей Даньшин
It looks like, if you want to change the case of a particular letter  
(say, all occurrences, letter a), you will have to iterate through  
all the chars in your textView, check if they are as, if they are  
upper or lower case, and change their case accordingly.

That is, if I understood your intentions correctly.

On May 4, 2009, at 2:38 PM, rethish wrote:


Hi,

I am using the action methods uppercaseWord: and lowercaseWord: to  
change

the case of selected word.

-(IBAction)changecase:(id)sender
{
  if([[fontCasePopup titleOfSelectedItem] isEqualToString:@A])
   {
  [textView uppercaseWord:sender];
   }
   else if([[fontCasePopup titleOfSelectedItem] isEqualToString:@a])
   {
[textView lowercaseWord:sender];
   }
}

I want to change the case of letters rather than a complete word.  
And I

tried it with another action message:

[textView changeCaseOfLetter:sender];

But its not working. why is it so? Is there anything thing to be done?


Thank you in advance

rethish




___

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/ok5.admin%40gmail.com

This email sent to ok5.ad...@gmail.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 arch...@mail-archive.com


It doesn't work without the NSLog()... Why?

2009-04-29 Thread Тимофей Даньшин

Hello.
It's a very funny thing. And i do hope i am not bonkers. But the  
following code works fine until i delete the line with NSLog().  
In the latter case it just returns an empty array. Are there any sane  
reasons why that can happen?


- (NSArray *) selectWordsBeginningWith:(NSString *) s {

	NSLog(@We do call SelectWordsBeginningWith); //- here is that  
line.

NSString *searchString = [NSString stringWithFormat:@%...@%@, s, 
@%%];
NSMutableArray *mutableRet = [[NSMutableArray alloc]init];

	[self intoArray:mutableRet addItemFromTable:@english  
usingStatement:readEnglish andSearchString:searchString];
	[self intoArray:mutableRet addItemFromTable:@russian  
usingStatement:readRussian andSearchString:searchString];


sqlite3_reset(readEnglish);
sqlite3_reset(readRussian);
NSArray *ret = [mutableRet copy];
//  NSLog(@The number of items to be returned is: %i, [ret count]);
[mutableRet release];
return ret;
}

Thank you in advance,
Timofey.
___

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: It doesn't work without the NSLog()... Why?

2009-04-29 Thread Тимофей Даньшин
Why copy mutableRet when you just release it anyway? Instead, just  
return it with an autorelease:
I do that because i return an immutable array. I always try to return  
the types i promise to return in the declaration :)


To Kyle:
I looked at the - 
intoArray:addItemFromTable:usingStatement:andSearchString:, but i  
failed to find anything bad in there. Here is the code:


- (void) intoArray:(NSMutableArray *)mutableRet addItemFromTable: 
(NSString *)table usingStatement:(sqlite3_stmt *)statement  
andSearchString:(NSString *) searchString {


	sqlite3_bind_text(statement, 1, [searchString  
cStringUsingEncoding:NSUTF8StringEncoding], -1, SQLITE_TRANSIENT);


while (sqlite3_step(statement) == SQLITE_ROW) {
		NSString *s = [NSString stringWithUTF8String:(char *)  
sqlite3_column_text(statement, 0)];

int wid = sqlite3_column_int(statement, 1);
		[mutableRet addObject:[WordIdAndDatabase makeWithId:wid word:s  
andDatabaseName:table]];

}
}

And here is some more detailed description of the problem. The thing  
is that i have a class called Database which is responsible for  
communicating with my database. The Database class is controlled by a  
DatabaseManager, which is a singleton... Any object in my application  
wanting to get anything from the db calls the [DatabaseManager  
sharedManager] and calls the methods it needs to call.


As I may have mentioned before, the app I am writing is a dictionary.  
The user interface has an NSTableView and an NSTextField. As the user  
types a searchword into the textfield, the app creates new  
NSOperations that select the words beginning with the chars the user  
has typed, from the database, and then i show them in the table view.  
Again, all the interactions with the db are executed via the  
DatabaseManager.


When the user hits enter or clicks on a cell with a word in it, we  
select that word with the equivalent from the db and display that in a  
different window.


And the thing is that when the NSLog line we talked above is not  
there, the -selectWordsBeginningWith: method works fine only until the  
user presses Enter or clicks a cell, i.e. until we get another class  
connect to the database.


Again, with NSLog in place, it all works fine no mater how many  
translations you open...


I would be really grateful for any hints to what the cause might be.




On Apr 29, 2009, at 4:32 PM, Graham Cox wrote:



On 29/04/2009, at 10:05 PM, Тимофей Даньшин wrote:


NSArray *ret = [mutableRet copy];
//  NSLog(@The number of items to be returned is: %i, [ret count]);
[mutableRet release];
return ret;



I don't see why your NSLog line should cause a problem, but your  
memory management at the end of the function is wrong, so may have a  
bearing on it.


Why copy mutableRet when you just release it anyway? Instead, just  
return it with an autorelease:


return [mutableRet autorelease];

There is no need to copy a mutable array just so you can return it  
as a non-mutable array - it is an array and its mutability is  
invisible to the client of this code. As it stands you're leaking  
the copy because it is never released.


--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


NSOperation, Sqlite, library routine called out of sequence

2009-04-29 Thread Тимофей Даньшин

Hello again.

In short, i get an error calling the same synchronized singleton  
DatabaseManager from different threads.


Here is what I am actually doing. As I was writing earlier, i am  
writing a dictionary application that is supposed to show translations  
for words from the database. In the main window, there is a tableview  
and a textfield. As a user types a word, i create a new NSOperation  
that calls the [DatabaseManager  sharedManager] and calls the methods  
to select all the words beginning with the letters the user has typed.  
And then the tableview is filled with the words so selected.


That works ok until the user presses return to see the translation of  
the word he has typed. That action also calls the [DatabaseManager  
sharedManager] and calls the methods for selecting the whole article  
from the db. This results in the library routine called out of  
sequence error in sqlite. Selecting an article from the db worked  
perfectly well when it was not called after the procedure described  
above.


And when, after receiving an empty dictionary article, the user begins  
typing a new word in the search textfield, nothing happens with the  
tableview, and sqlite3_step function calls end with the library  
routine called out of sequence error.


Here are the relevant excerpts from the classes involved.

Database:

- (NSArray *) selectWordsBeginningWith:(NSString *) s {
NSString *searchString = [NSString stringWithFormat:@%...@%@, s, 
@%%];
	NSMutableArray *mutableRet = [self itemsFromTable:@english  
usingStatement:readEnglish andSearchString:searchString];
	NSMutableArray *arr2 = [self itemsFromTable:@russian  
usingStatement:readRussian andSearchString:searchString];


[mutableRet addObjectsFromArray: arr2];

sqlite3_reset(readEnglish);
sqlite3_reset(readRussian);
NSArray *ret = [[mutableRet copy] autorelease];

return ret;
}


- (NSDictionary *) selectArticleWithId: (WordIdAndDatabase *)  
articleId {

sqlite3_stmt *currentOne;

if ([articleId.datbaseName isEqualToString:@english]) {
currentOne = selectArticleEnglishToRussian;
} else {
currentOne = selectArticleRussianToEnglish;
}

NSString *originalWord = articleId.word;
sqlite3_bind_int(currentOne, 1, articleId.wordId);
NSMutableArray *translations = [[NSMutableArray alloc] init];

while (sqlite3_step(currentOne) == SQLITE_ROW) {
		[translations addObject:[NSString stringWithUTF8String:(char *)  
sqlite3_column_text(currentOne, 0)]];

}

	NSLog(@There may be an error in the db things: %s,  
sqlite3_errmsg(database));


	NSDictionary *ret = [NSDictionary  
dictionaryWithObjectsAndKeys:originalWord, @original, translations,  
@translations, nil];

[translations release];

sqlite3_reset(currentOne);
return ret;
}

- (NSMutableArray *) itemsFromTable:(NSString *)table usingStatement: 
(sqlite3_stmt *)statement andSearchString:(NSString *) searchString {


	NSMutableArray *mutableRet = [[[NSMutableArray alloc] init]  
autorelease];
	sqlite3_bind_text(statement, 1, [searchString  
cStringUsingEncoding:NSUTF8StringEncoding], -1, SQLITE_TRANSIENT);

while (sqlite3_step(statement) == SQLITE_ROW) {
		NSString *s = [NSString stringWithUTF8String:(char *)  
sqlite3_column_text(statement, 0)];

int wid = sqlite3_column_int(statement, 1);
		[mutableRet addObject:[WordIdAndDatabase makeWithId:wid word:s  
andDatabaseName:table]];

}

	NSLog(@There MIGHT BE an error in getting things from the db: %s,  
sqlite3_errmsg(database));

return mutableRet;
}

Thank you for your attention.

Timofey.
___

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: NSOperation, Sqlite, library routine called out of sequence

2009-04-29 Thread Тимофей Даньшин
The DatabaseManager is synchronized. If any class is to communicate  
with the db, it does that through the DatabaseManager. The latter just  
provides proxy methods. I think, that should result in classes getting  
the instance of the DatabaseManager only when it is no longer (or not  
yet) used by other classes.


+ (DatabaseManager*)sharedManager {
@synchronized(self) {
if (sharedDatabaseManager == nil) {
[[self alloc] init]; // assignment not done here
}
}
return sharedDatabaseManager;
}

+ (id)allocWithZone:(NSZone *)zone {
@synchronized(self) {
if (sharedDatabaseManager == nil) {
sharedDatabaseManager = [super allocWithZone:zone];
[sharedDatabaseManager initDb];
return sharedDatabaseManager;
}
}
return nil;
}


On Apr 29, 2009, at 10:52 PM, Greg Guerin wrote:


Тимофей Даньшин wrote:

In short, i get an error calling the same synchronized singleton  
DatabaseManager from different threads.



Are you sure your database accesses are synchronized (i.e. thread- 
safe)? I see nothing in the posted code that uses @synchronized or  
any other locking mechanism.


 -- GG

___

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/ok5.admin%40gmail.com

This email sent to ok5.ad...@gmail.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 arch...@mail-archive.com


Re: NSOperation, Sqlite, library routine called out of sequence

2009-04-29 Thread Тимофей Даньшин

Hm...
That really works! Thanks a lot.

Putting the bodies of those methods in @synchronized(self) blocks helped

Thanks a lot again.

On Apr 29, 2009, at 11:33 PM, Greg Guerin wrote:


Тимофей Даньшин wrote:

The DatabaseManager is synchronized. If any class is to communicate  
with the db, it does that through the DatabaseManager. The latter  
just provides proxy methods. I think, that should result in classes  
getting the instance of the DatabaseManager only when it is no  
longer (or not yet) used by other classes.



But that does nothing to prevent multiple threads from performing  
additional concurrent actions on the database.  It's not enough to  
just control access to the shared singleton, if the actions  
performed by the singleton aren't also thread-safe.  All the  
queries, updates, etc. need thread-safety, too.


 -- GG

___

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/ok5.admin%40gmail.com

This email sent to ok5.ad...@gmail.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 arch...@mail-archive.com


Problem: sqlite3 and .sqlite-journal files

2009-04-17 Thread Тимофей Даньшин

Hello.

As I wrote earlier, in my application a user can open a database or  
create a new one, and then perform some tasks, the results of which  
are stored in the said database.


However, a strange thing happens: when the user _creates_ a database,  
everything is stored as hoped. But when the user _opens_ an existing  
database, nothing is stored in it, and a new file gets created, which  
name coincides with the name of the database the user opened with - 
journal in the extension. (I did read about that on the sqlite3 site,  
but it didn't seem to help).


The most puzzling thing about this is that when a database gets  
created, it is first created with a different name (from the one the  
user wants it to have), then my app, specifically, a class called  
DatabaseCreator, creates the necessary tables, populates them with  
initial data and closes the database. After that that, if a database  
with the name specified by the user for the new one already exists, it  
is moved to trash, and the newly created db with the temporary name is  
renamed to the name given by the user. And after that the class called  
DatabaseManager, which is a singleton, opens that database the same  
way it would if the user wanted to open a pre-existing database.


I am continuing my search for the possible reason for such a strange  
behavour, but i would be very grateful for any thoughts in that regard.


Thank you in advance.
Timofey.
___

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


static vs non-static. Recommendation needed.

2009-04-13 Thread Тимофей Даньшин

Hello.
A foreword:
In my application I need to allow the user to create a database. So i  
display a dialogue panel, collect all the necessary information about  
the db to be created and create a DatabaseInfo object. Then i pass  
that DatabaseInfo object to the DatabaseCreator to actually create the  
needed database. I want the DatabaseCreator to return an sqlite3  
pointer.


And here is my dilemma:
As i don't need that DatabaseCreator to exist for a long time i  
thought it better to make it completely static. Sorry if the  
terminology is wrong, but what i mean is: it cannot be initialized, it  
has no instance variables, it has no instance methods, all it has is  
one public class method: + (sqlite3 *) createDbaseWithDatabaseInfo:  
(DatabaseInfo *) dbInfo;


However, that proves not very convenient, as i need to break up the  
logic of that class into individual steps and I end up passing a lot  
of things from one method to another.


Is it all right to init an object just to dealloc it in the next line  
(or create an autorelease object using a convenience method for that  
matter)? I mean, if i made it non-static, i would have something like  
this in the class that uses it:


DatabaseCreator *dbc = [DatabaseCreator creatorWithDBInfo: dbInfo];
sqlite3* database = [dbc database];  // and dbc would no longer be used.

Or is it better to put up with the inconveniences of having that thing  
static?


Thank you in advance,
Timofey.



___

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: static vs non-static. Recommendation needed.

2009-04-13 Thread Тимофей Даньшин
But I might suggest you've omitted a couple of options. Would it be,  
for example, particularly evil if your DatabaseInfo object include a  
createDatabase method?


Well, not exactly, i suppose. The point is that i create DatabaseInfo  
either before creating a new database or after opening an existing  
one. In both cases the object is used to show the user some general  
information about the currently open db, and in the former case, it is  
also used to actually create the database.

I think i'll stick to Quincey Morris's suggestion.

And again thank you all for the help.
Timofey.


On Apr 13, 2009, at 3:59 PM, Gregory Weston wrote:


ok5.admin wrote:


Hello.
A foreword:
In my application I need to allow the user to create a database. So i
display a dialogue panel, collect all the necessary information about
the db to be created and create a DatabaseInfo object. Then i pass
that DatabaseInfo object to the DatabaseCreator to actually create  
the

needed database. I want the DatabaseCreator to return an sqlite3
pointer.

...

Is it all right to init an object just to dealloc it in the next line
(or create an autorelease object using a convenience method for that
matter)? I mean, if i made it non-static, i would have something like
this in the class that uses it:

DatabaseCreator *dbc = [DatabaseCreator creatorWithDBInfo: dbInfo];
sqlite3* database = [dbc database];  // and dbc would no longer be  
used.


Or is it better to put up with the inconveniences of having that  
thing

static?


It's better to follow the practice that you'll find most maintainable.

But I might suggest you've omitted a couple of options. Would it be,  
for example, particularly evil if your DatabaseInfo object include a  
createDatabase method?

___

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/ok5.admin%40gmail.com

This email sent to ok5.ad...@gmail.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 arch...@mail-archive.com


SQLite3 and Unicode Strings - Problem

2009-04-07 Thread Тимофей Даньшин

Hello.
In my application, I have the need to store strings with non-latin  
characters in a SQLite database.

But when I insert them, they become corrupt.

When i bind the string to the prepared statement, i do make sure it is  
in UTF-8:
sqlite3_bind_text(sentence_insert_statement, 1, [string UTF8String],  
-1, SQLITE_TRANSIENT); //Where string is the string i am trying to  
insert.
I thought that might be the problem of SQLite itself, but when I make  
an sql file in the UTF-8 encoding, like 'insert into sentences  
(sentence) values (привет);' and perform .read (the name of my  
sql file), it works absolutely fine.
Am I missing something important when inserting strings to my db  
programmatically?


I really hope you can help.
Thank you in advance,
Timofey.___

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


Fwd: SQLite and Unicode

2009-04-07 Thread Тимофей Даньшин


On Apr 7, 2009, at 8:14 PM, Keary Suska wrote:

Are you properly encoding your C strings with -cStringUsingEncoding:?

Yes, I think so.
At present, I am using the -UTF8String method, but I also tried the - 
cStringUsingEncoding: to no avail.


Here is the line that binds the string to the prepared statement:
	sqlite3_bind_text(sentence_insert_statement, 1, [string UTF8String],  
-1, SQLITE_TRANSIENT);
and I translate it back into NSString by [string  
stringWithUTF8String], although I also tried the -stringWithCString:  
encoding: method. The characters _are_ mangled.
And the funny thing is that i am able to add non-latin strings to it  
by reading sql files from SQLite in Terminal...


Best regards, Timofey.





On Apr 6, 2009, at 2:31 PM, Тимофей Даньшин wrote:

When I insert non-latin strings into my SQLite3 database, they turn  
into some weird sets of characters (as I select those strings later  
in Terminal), and the fields, which contain those strings, become  
unusable by my application.


I googled for it for quite a bit, but everywhere it says that  
SQLite 3 supports utf8, so there is no advice on what should be  
done in such situations.


What can I do about it?


Are you properly encoding your C strings with - 
cStringUsingEncoding:? If so, when you query the column (and  
properly translate the C string to NSString using - 
stringWithCString:encoding:), are the characters still mangled?


HTH,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

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: SQLite and Unicode

2009-04-07 Thread Тимофей Даньшин
How do you define string (i.e. how is its value set)? There can be  
an issue with UTF8 constant strings. Have you called - 
canBeConvertedToEncoding: to make sure string is utf-8 compatible?


To be on the safe side, i make a local copy of the method's input  
string. And the -canBeConvertedToEncoding: returns yes...
I am really at a loss. I open the db with sqlite3_open([path  
UTF8String], db), which as i am lead to understand opens it in the  
UTF-8 compatible mode. May there be anything wrong with the way i  
create prepared statements? Or anything else?



Here is the method that writes to the db:

- (int) writeToDB:(NSString *)string {
if (!dbIsOpen) {
[self openDatabase];
}
if (sentence_insert_statement == nil) {
static char *sql = INSERT INTO sentences (sentence, slength)  
VALUES(?, ?);
if (sqlite3_prepare_v2(db, sql, -1,  
sentence_insert_statement, NULL) != SQLITE_OK) {
NSLog(@Error: failed to prepare statement with message  
'%s'., sqlite3_errmsg(db));

}
}


NSString *string2 = [string copy];
	NSLog(@The string can be converted to utf: %i, [string2  
canBeConvertedToEncoding:NSUTF8StringEncoding]);


const char *cString = [string2 UTF8String];

	sqlite3_bind_text(sentence_insert_statement, 1, cString, -1,  
SQLITE_TRANSIENT);

sqlite3_bind_int(sentence_insert_statement, 2, string.length);
int success = sqlite3_step(sentence_insert_statement);
[string2 release];
sqlite3_reset(sentence_insert_statement);
if (success == SQLITE_DONE) {
return sqlite3_last_insert_rowid(db);
}
NSLog(@Success is %d, sqlite_ok is %d, success, SQLITE_OK);
	NSLog(@Error: failed to insert sentence with message '%s'.,  
sqlite3_errmsg(db));

return 0;
}   

I read about SQLite in Python, that one should not pass null- 
terminated strings to insert statements, or there will be problems  
with non-latin chars. Can that be the issue here? How can i chop off  
the NULL-char off the cString just to give it a try?




On Apr 7, 2009, at 9:12 PM, Keary Suska wrote:



On Apr 7, 2009, at 10:39 AM, Тимофей Даньшин wrote:



On Apr 7, 2009, at 8:14 PM, Keary Suska wrote:
Are you properly encoding your C strings with - 
cStringUsingEncoding:?

Yes, I think so.
At present, I am using the -UTF8String method, but I also tried the  
-cStringUsingEncoding: to no avail.


Here is the line that binds the string to the prepared statement:
	sqlite3_bind_text(sentence_insert_statement, 1, [string  
UTF8String], -1, SQLITE_TRANSIENT);
and I translate it back into NSString by [string  
stringWithUTF8String], although I also tried the - 
stringWithCString: encoding: method. The characters _are_ mangled.
And the funny thing is that i am able to add non-latin strings to  
it by reading sql files from SQLite in Terminal...



How do you define string (i.e. how is its value set)? There can be  
an issue with UTF8 constant strings. Have you called - 
canBeConvertedToEncoding: to make sure string is utf-8 compatible?


Best,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business



___

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: SQLite and Unicode

2009-04-07 Thread Тимофей Даньшин

I am deeply and sincerely ashamed of myself.
The point is that i get that input string by splitting the string in  
my textView ([[myTextView textStorage] string]) into sentences. During  
that procedure i check every char if it is a sentence terminator (?!  
or linebreak). And i do that by using the -characterAtIndex: method.  
And the thing is that that method returns wrong characters if it deals  
with unicode ones. Thanks Keary Suska for pointing that out to me.


I will now have to find another unicode-safe way to split the string  
into sentences.


Thanks again for all your help.
And if you could give me a hint on how to safely get unicode chars at  
a given position of a string, I'd be even more grateful :)


Timofey.

On Apr 7, 2009, at 10:23 PM, Greg Guerin wrote:


Тимофей Даньшин wrote:

To be on the safe side, i make a local copy of the method's input  
string.


Maybe the lifetime of the local copy is less than what SQLite needs.

I see in your code that you're releasing the copy, but is SQLite  
asynchronous and still needing the buffer to exist at that point?


If you don't use a copy of the arg string, but the original arg  
itself, does that change anything?


If you intentionally leak the copy, by not releasing it, does that  
change anything?


How about autoreleasing the copy, which defers the actual release  
until later?


I'm not suggesting that any of these are fixes, just different  
things to test and observe, that may lead to more clues.


 -- GG

___

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/ok5.admin%40gmail.com

This email sent to ok5.ad...@gmail.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 arch...@mail-archive.com


SQLite and Unicode

2009-04-06 Thread Тимофей Даньшин

Hello.
When I insert non-latin strings into my SQLite3 database, they turn  
into some weird sets of characters (as I select those strings later in  
Terminal), and the fields, which contain those strings, become  
unusable by my application.


I googled for it for quite a bit, but everywhere it says that SQLite 3  
supports utf8, so there is no advice on what should be done in such  
situations.


What can I do about it?

Thank you in advance.
Timofey.
___

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


Double Clicks in an NSTextView.

2009-04-01 Thread Тимофей Даньшин

Hello.

I would like to be able to intercept double clicks on the text in an  
NSTextView even if the text is not a link and is not in an  
NSTextAttachmentCell. I did try to do this by implementing the  
textView: willChangeSelectionFromCharacterRange: toCharacterRange and  
comparing the initial and the proposed ranges and the time between the  
current call to this method and the previous one. But that doesn't  
work quite well, for i often get double clicks when i select the  
text by holding shift and an arrow key.


I know, that the method for intercepting double clicks is private.

Is there any working work around for that?

Thank you for your replies in advance.


Timofey.
___

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


Absolutely Mysterious Compilation Error

2009-03-29 Thread Тимофей Даньшин

Hello.
I have a class called TableMaker. And i import its header in the  
header of another class. The funny thing is that every once in a while  
the app fails to build, XCode pointing to the line TableMaker  
*tableMaker; in that other header file as the cause of the failure.
If i comment out that line, build the project, and then uncomment it  
again, the project builds normally. But after a while the whole  
situation repeats.

What could be the cause?

Thank you in advance for your replies.
Timofey.
___

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: Absolutely Mysterious Compilation Error

2009-03-29 Thread Тимофей Даньшин

Yes, that cleared it. Thank you a lot.

Could you, please, tell me, where i can read more about circular  
includes and what the ways of dealing with them are? It seems rather  
an odd thing after Java.



On Mar 30, 2009, at 3:25 AM, Stephen J. Butler wrote:


2009/3/29 Тимофей Даньшин ok5.ad...@gmail.com:

It says error: syntax error before 'TableMaker'


Could be a circular include problem. Try this:

In OtherClass.h:
- remove the #import TableMaker.h
- add @class TableMaker;

In OtherClass.m:
- add #import TableMaker.h


___

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


KVC-KVO compliance - noob questions

2009-03-26 Thread Тимофей Даньшин

Hi. I'm new to the field of KVC/KVO, but I want to master it.
Are there any standard tests to check whether my objects are KVC/KVO  
compliant? And are there, perhaps, simpler and less profound  
explanations of that subject, than the ones on the Apple site?


Thank you for your attention and replies.
Timofey.
___

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


Custom windows -- just curious

2009-03-23 Thread Тимофей Даньшин

Hi.
Does anybody know how to make totally custom windows, such as the  
control window in DVD Player or the minimized iTunes window?

As i said in the subject -- I am just curious.

Timofey.
___

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: Send events to AppleScript

2009-03-21 Thread Тимофей Даньшин


On Mar 21, 2009, at 5:38 AM, has wrote:



On Mar 21, 2009, at 1:06 AM, Тимофей Даньшин wrote:


On Mar 21, 2009, at 3:34 AM, has wrote:


Is it at all possible to have an application send actions to a
particular AppleScript script,


Yes. See NSAppleScript/OSAKit/Carbon OSA APIs. There's a sample  
project in the objc-appscript repository, CallAppleScriptHandler,  
that provides a simple demonstration of calling script handlers  
from ObjC, using appscript's AEM APIs to simplify the process of  
converting Cocoa objects to/from NSAppleEventDescriptors.


Sorry for misleading you, i rather meant receive events from  
third party applications.


If you want to run an AppleScript as a standalone application and  
send it events from other applications, save your script in Script  
Editor as a 'stay open' application. As for sending events from  
Cocoa(?) apps to this applet; there's a couple ways you could  
arrange that, but you'd need to provide more details on what the  
setup needs to do if you want specific advice.


Or do you mean that you want to write a Cocoa application that  
forwards some/all incoming events to an embedded AppleScript? In  
that case you want either NSAppleEventManager, or possibly Cocoa  
Scripting, to handle incoming events, and NSAppleScript or OSAKit to  
host the script, and write some glue code to go inbetween.


Well, I'm writing a translation memory application, which is a  
program that grabs sentence by sentence from a given text (that needs  
translating), asks the user to translate that sentence and stores the  
translation and the original in a database. If the user comes across  
the same sentence again in the future, he or she will not need to  
translate it again.
I thought i would take the TextEdit app as the text editing part of my  
project, but as I wrote the database management and the search parts,  
it turned out that TextEdit is not capable of correctly interpreting  
word files or RTF's (ie it ignores footnotes, headers/footers and a  
lot of other stuff). That is why I am trying to find out how i can  
communicate with Word or Pages.
As far as what I would want from an AppleScript (if I were to use  
AppleScript) is to be able to receive notifications from Word when,  
for example, the user has hit a certain key combination, to know where  
the insertion point (or selection) is in Word and to receive  
notifications when it moves, to be notified when a user is trying to  
edit something and prevent him/her from doing so if that part of the  
text should not be edited.
Receiving those notifications, that script would just redirect them to  
my application and receive responses to them and redirect them to Word.
In case of scripting bridge, the logic I described for AppleScript  
would be in my application.
But having read what I found and had time to read, I'm not quite sure  
yet I can be notified of the things going on in another application  
(such as Word, for example).






or set that script as a delegate of that application


Depends exactly what you mean by 'delegation'. The OSA API  
provides a whole bunch of arcane selectors and callbacks for two- 
way intra-process integration between application and scripts, but  
whether it's appropriate/how to use it will depend on exactly what  
you're trying to achieve.


By delegation I mean the form of delegation that is present in  
Objective-C, when one can register one's object with another object  
as it's delegate and receive messages from in on certain occasions,  
such as textViewDidChangeSelection:


That's pretty much what the OSA API was designed to do [1] - allow a  
C/C++/ObjC application to load a script and invoke its handlers  
(what AppleScripters call 'attachability'). See Folder actions, Mail  
rule scripts, etc. Satimage Smile, for example, provides a great  
demonstration of just how far you can go with this sort of thing.


HTH

has

[1] With the caveat that the OSA API is somewhat over-complicated,  
under-documented, lame in parts, and only really practical for  
AppleScript despite being theoretically language agnostic.


--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net



___

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: Send events to AppleScript

2009-03-21 Thread Тимофей Даньшин
As far as TextEdit is concerned, i thought of taking its source and  
modifying it to my needs, and actually create a single application,  
not a tandem of two or more. I am even beginning to think of taking  
the OppenOffice as the host for my additional functionality, but OO  
doesn't look at all stable. Are there any libraries out there that  
could access all (or at least the most common) elements of .doc, docx  
and RTF documents besides NSDocument? It doesn't really matter if they  
can render page layout correctly, the important thing is that they  
could access and modify those elements.



On Mar 21, 2009, at 7:28 PM, has wrote:


On Mar 21, 2009, at 12:09 PM, Тимофей Даньшин wrote:

Well, I'm writing a translation memory application, which is a  
program that grabs sentence by sentence from a given text (that  
needs translating), asks the user to translate that sentence and  
stores the translation and the original in a database. If the user  
comes across the same sentence again in the future, he or she will  
not need to translate it again.
I thought i would take the TextEdit app as the text editing part of  
my project, but as I wrote the database management and the search  
parts, it turned out that TextEdit is not capable of correctly  
interpreting word files or RTF's (ie it ignores footnotes, headers/ 
footers and a lot of other stuff). That is why I am trying to find  
out how i can communicate with Word or Pages.
As far as what I would want from an AppleScript (if I were to use  
AppleScript) is to be able to receive notifications from Word when,  
for example, the user has hit a certain key combination, to know  
where the insertion point (or selection) is in Word and to receive  
notifications when it moves, to be notified when a user is trying  
to edit something and prevent him/her from doing so if that part of  
the text should not be edited.
Receiving those notifications, that script would just redirect them  
to my application and receive responses to them and redirect them  
to Word.


It is rare to find applications that provide notifications, and  
almost unheard of for them to provide notifications of minor events  
such as text edits. You certainly won't get the sort of  
notifications you describe from TextEdit, Word or Pages. ISTR a  
third-party tool that allows you to attach AppleScripts to the GUI  
objects of another application, but that sort of thing is inherently  
hackish, prone to breakage, and liable not to go down too well with  
increasingly security conscious software and users. I suspect your  
best bet would be to poll the application, bearing in mind that  
might create its own issues (e.g. performance/responsiveness).


HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net



___

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


Send events to AppleScript

2009-03-20 Thread Тимофей Даньшин

Hello.
Is it at all possible to have an application send actions to a  
particular AppleScript script, or set that script as a delegate of  
that application or to have an AppleScript as a means of communication  
between two applications (one of which is mine, and the other isn't)?


Thank you in advance for your replies.

Timofey.
___

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 GoogleCode.

2009-03-19 Thread Тимофей Даньшин

Hello.

Are there any instructions out there for creating new Xcode projects  
in an existing SVN repository on Google Code from within Xcode? For  
the only way i could find was to create an empty project in Xcode,  
then commit it to the repository from a command line and then create a  
new project in Xcode from that repository. But that isn't very neat,  
is it?


Thank you for your attention,
Timofey.
___

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


- (IBAction) executes normally, but then crushes.

2009-03-19 Thread Тимофей Даньшин

Hello.

I have got a method that is an IBAction, and it works quite all right,  
it reaches its final curly bracket, but then the whole application  
crushes for some reason. But the words [Session started... etc] in the  
log appear about three lines before the phrase Finished adding to the  
DB, which is written by the last line of code in that method. I.e.,  
if i feed the following to my app: It first empties the cell's title  
and

asks it to draw., the last lines of the log look as follows:

2009-03-19 23:47:28.204 Untitled[16510:10b] The splitString is 'dra'

[Session started at 2009-03-19 23:47:28 +0300.]
2009-03-19 23:47:28.207 Untitled[16510:10b] The splitString is 'raw'
2009-03-19 23:47:28.211 Untitled[16510:10b] The splitString is 'aw.'
2009-03-19 23:47:28.214 Untitled[16510:10b] Finished Adding to DB;
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40  
UTC 2008)



What can possibly go wrong there?

The idea behind this method is to have a string in the textView split  
by sentences (which is done by the SentenceSplitter, which was tested  
and works well), then write each sentence to the database, split that  
sentence into sequences of three chars each (by ThreeCharSplitter,  
which also was tested), and write them into a different table in the  
same db. As i said earlier, everything works fine, everything gets  
added to the db as expected. The only unexpected thing is the crush at  
the end.


Here is the method:

- (IBAction) dbit: (id) sender {
	SentenceSplitter *ss = [[SentenceSplitter alloc] initWithString: 
[[tview textStorage] string]];

DB *db = [[DB alloc] initWithPath:@somePath];
NSString *sentence;
NSString *splitString;
ThreeCharSplitter *sp;

for (int i = 0; i  [ss length]; i++) {
@try {
sentence = [ss nextSentence];
if (sentence == nil || sentence.length == 0) {
continue;
}
sp = [[ThreeCharSplitter alloc] 
initWithString:sentence];
int a = [db writeToDB: sentence];
NSLog(@Last id is %d, sentence: %@, a, sentence);
for (int i = 0; i  sp.length; i++) {
splitString = [sp next];
NSLog(@The splitString is '%@', splitString);
if ( a != 0 ) {
[db writeCharsToDB:splitString 
withSentenceId:a];
}
}
[sp release];
} @catch (NSException *e) {
NSLog(@EXCEPTION: %@, e);
}
}
[db release];
[ss release];

NSLog (@Finished Adding to DB;);
}








Thank you for your attention.___

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: - (IBAction) executes normally, but then crushes.

2009-03-19 Thread Тимофей Даньшин
Could you, please, expand on that? Am I using too much memory? Am I  
not releasing objects correctly? I am really at my wit's end...

On Mar 20, 2009, at 12:12 AM, mm w wrote:


memory

2009/3/19 Тимофей Даньшин ok5.ad...@gmail.com:

Hello.

I have got a method that is an IBAction, and it works quite all  
right, it
reaches its final curly bracket, but then the whole application  
crushes for
some reason. But the words [Session started... etc] in the log  
appear about
three lines before the phrase Finished adding to the DB, which is  
written
by the last line of code in that method. I.e., if i feed the  
following to my

app: It first empties the cell's title and
asks it to draw., the last lines of the log look as follows:

2009-03-19 23:47:28.204 Untitled[16510:10b] The splitString is 'dra'

[Session started at 2009-03-19 23:47:28 +0300.]
2009-03-19 23:47:28.207 Untitled[16510:10b] The splitString is 'raw'
2009-03-19 23:47:28.211 Untitled[16510:10b] The splitString is 'aw.'
2009-03-19 23:47:28.214 Untitled[16510:10b] Finished Adding to DB;
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26  
08:14:40 UTC

2008)


What can possibly go wrong there?

The idea behind this method is to have a string in the textView  
split by
sentences (which is done by the SentenceSplitter, which was tested  
and works
well), then write each sentence to the database, split that  
sentence into
sequences of three chars each (by ThreeCharSplitter, which also was  
tested),
and write them into a different table in the same db. As i said  
earlier,
everything works fine, everything gets added to the db as expected.  
The only

unexpected thing is the crush at the end.

Here is the method:

- (IBAction) dbit: (id) sender {
  SentenceSplitter *ss = [[SentenceSplitter alloc]
initWithString:[[tview textStorage] string]];
  DB *db = [[DB alloc] initWithPath:@somePath];
  NSString *sentence;
  NSString *splitString;
  ThreeCharSplitter *sp;

  for (int i = 0; i  [ss length]; i++) {
  @try {
  sentence = [ss nextSentence];
  if (sentence == nil || sentence.length == 0) {
  continue;
  }
  sp = [[ThreeCharSplitter alloc]
initWithString:sentence];
  int a = [db writeToDB: sentence];
  NSLog(@Last id is %d, sentence: %@, a,  
sentence);

  for (int i = 0; i  sp.length; i++) {
  splitString = [sp next];
  NSLog(@The splitString is '%@',
splitString);
  if ( a != 0 ) {
  [db writeCharsToDB:splitString
withSentenceId:a];
  }
  }
  [sp release];
  } @catch (NSException *e) {
  NSLog(@EXCEPTION: %@, e);
  }
  }
  [db release];
  [ss release];

  NSLog (@Finished Adding to DB;);
}








Thank you for your  
attention.___


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/openspecies%40gmail.com

This email sent to openspec...@gmail.com





--
-mmw


___

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: - (IBAction) executes normally, but then crushes.

2009-03-19 Thread Тимофей Даньшин

Hello again.

Here is what is says in the debugger:

0 objc_msgSend
1 NSPopAutoReleasePool
2 -[NSApplication run]
3 NSApplicationMain
4 main

Here is the stacktrace with the 0th line selected.


0x91edd670  +  mov0x8(%esp),%ecx
0x91edd674  +0004  mov0x4(%esp),%eax
0x91edd678  +0008  cmp$0xfffeb010,%ecx
0x91edd67e  +0014  je 0x91edd6fb objc_msgSend+139
0x91edd680  +0016  test   %eax,%eax
0x91edd682  +0018  je 0x91edd6e0 objc_msgSend+112
0x91edd684  +0020  mov0x0(%eax),%edx
0x91edd687  +0023  push   %edi
 0x91edd688  +0024  mov0x20(%edx),%edi // The line with the  
red arrow

0x91edd68b  +0027  push   %esi
0x91edd68c  +0028  mov0x0(%edi),%esi
0x91edd68f  +0031  lea0x8(%edi),%edi
0x91edd692  +0034  mov%ecx,%edx
0x91edd694  +0036  shr$0x2,%edx
0x91edd697  +0039  and%esi,%edx
0x91edd699  +0041  mov(%edi,%edx,4),%eax

By the way, are there any manuals on reading these stacktraces?


On Mar 20, 2009, at 1:36 AM, Shawn Erickson wrote:


2009/3/19 Тимофей Даньшин ok5.ad...@gmail.com:


2009-03-19 23:47:28.204 Untitled[16510:10b] The splitString is 'dra'

[Session started at 2009-03-19 23:47:28 +0300.]
2009-03-19 23:47:28.207 Untitled[16510:10b] The splitString is 'raw'
2009-03-19 23:47:28.211 Untitled[16510:10b] The splitString is 'aw.'
2009-03-19 23:47:28.214 Untitled[16510:10b] Finished Adding to DB;
Loading program into debugger...
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26  
08:14:40 UTC

2008)

What can possibly go wrong there?


Can you outline how it crashed? The backtrace for the thread that
crashed, the type of crash, etc.

If you use the debugger you should be able to tell the code pathway
involved in the crash... (likely best to launch the application in the
debugger and then cause the failure you are seeing).

-Shawn


___

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


SearchKit quiestion.

2009-03-16 Thread Тимофей Даньшин

Hi all.

In my application I have to search for strings closest matching a  
given string. So, for example, if the given string is Hello. Would  
you like some oranges, I need to find  Hello. Would you like some  
lemons or Hello. Would you want some oranges (if they are in the  
database), and not just any phrase that contains the word oranges or  
would or hello, etc.


For this purpose I tried to use the SearchKit, and tried to filter out  
the strings that were below a certain relevancy threshold and compare  
the remaining ones to the given string using some other methods.  
However, it turns out, that the bigger the database with the strings  
gets, the more irrelevant strings i receive, and the whole search  
process becomes quite slow.


And my question is, am I right in thinking that the SearchKit may not  
be the solution that I want and I will have to write my own indexing  
engine, or is it just that I am not using it right?


Here is how I create the index (the code was almost entirely taken  
from a code example):


- (void) newIndexInFile  {
NSURL * url = [NSURL fileURLWithPath: path];
NSString * name = @SomeName;
if ([name length] == 0) name = nil;
SKIndexType type = kSKIndexInvertedVector;
NSNumber * minTermLength = [NSNumber numberWithInt: (int) 3];
NSSet * stopwords = [NSSet setWithObjects:
 @all,
 @and,
 @its,
 @it's,
 @the,
 nil
 ];
NSDictionary * properties =
[NSDictionary dictionaryWithObjectsAndKeys:
 @, @kSKStartTermChars,
 @-...@.', @kSKTermChars,
 @, @kSKEndTermChars,
 minTermLength, @kSKMinTermLength,
 stopwords, @kSKStopWords,
 nil
 ];
skIndex = SKIndexCreateWithURL(
   (CFURLRef) 
url,
   
(CFStringRef) name,
   
(SKIndexType) type,
   
(CFDictionaryRef) properties
   );
if (!skIndex) {
NSLog(@SKIndex doesnt exist right after the creation);
}
}
Thank you for your attention.
Timofey.
___

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


NSMutableDictionary drives me mad.

2009-03-10 Thread Тимофей Даньшин

Hello.
I am writing a method for searching for the longest common substring.  
The idea is to store the pieces of that LCS in an NSMutableDictionary  
with TMIntWrappers as keys and NSMutableStrings as values.
Now, TMIntWrapper is the class i created for wrapping ints into  
objects. It stores an int, gives access to it via the .value property,  
adopts the NSCopying protocol and implements the -(BOOL) isEqual: (id)  
object method.
The logic is, if the dictionary already has a value for a given key,  
the new value should be appended to the current value, if the  
dictionary doesn't have any value for that key yet, a new  
NSMutableString is created and stored in that dictionary.


But I just cannot understand why, within one and the same cycle, some  
values get appended, and some are stored with seemingly different  
TMIntWrapper keys with the same value (even though the isEqual method  
returns YES if the int values of two int wrappers are equal).


Here is the method in question:

- (void) addToAddedCharAtPosition:(int)charPosition withKey: 
(TMIntWrapper *)key {
	NSLog  
(@___ 
);

NSLog (@The key is: %@, key);
	NSLog (@ The object for the key is: %@, [addedToDbString  
objectForKey:key]);

if ([addedToDbString objectForKey:key] == nil) {
		NSMutableString *ms = [[NSMutableString alloc]initWithString:[inText  
substringWithRange:NSMakeRange(charPosition-1, 1)]];

NSLog(@  The ms string is: %@, ms);
[addedToDbString setObject:[ms mutableCopy] forKey:[key copy]];
		NSLog(@ We are trying to add this: %@, [inText  
substringWithRange:NSMakeRange(charPosition-1, 1)]);
		NSLog (@AND NOW: The object for the key is: %@, [addedToDbString  
objectForKey:key]);

return;
}
	NSLog (@We are trying to add this: %@,[inText  
substringWithRange:NSMakeRange(charPosition-1, 1)]);
	[[addedToDbString objectForKey:key] appendString:[inText  
substringWithRange:NSMakeRange(charPosition-1, 1)]];

}

And here is what those NSLogs generate.



2009-03-10 21:09:48.871 SQL doc[13532:10b]  
___
2009-03-10 21:09:48.872 SQL doc[13532:10b] The  
key is: 0
2009-03-10 21:09:48.872 SQL doc[13532:10b]  The object for the  
key is: (null)
2009-03-10 21:09:48.873 SQL doc[13532:10b]   The ms  
string is: x
2009-03-10 21:09:48.874 SQL doc[13532:10b]  We are trying to  
add this: x
2009-03-10 21:09:48.875 SQL doc[13532:10b] AND NOW: The object for the  
key is: (null)
2009-03-10 21:09:48.875 SQL doc[13532:10b]  
___
2009-03-10 21:09:48.877 SQL doc[13532:10b] The  
key is: 0
2009-03-10 21:09:48.877 SQL doc[13532:10b]  The object for the  
key is: (null)
2009-03-10 21:09:48.879 SQL doc[13532:10b]   The ms  
string is: e
2009-03-10 21:09:48.880 SQL doc[13532:10b]  We are trying to  
add this: e
2009-03-10 21:09:48.880 SQL doc[13532:10b] AND NOW: The object for the  
key is: e
2009-03-10 21:09:48.880 SQL doc[13532:10b]  
___


Please help me...







___

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


Exel and PowerPoint

2009-03-02 Thread Тимофей Даньшин

Hello.
Are there any abstractions in Cocoa to open and handle Exel and  
PowerPoint files?

Thank you.
Timofey.
___

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


Spotlight

2009-03-01 Thread Тимофей Даньшин

Hi all!

I have a potentially large database with attributedStrings. Is there a  
way to somehow get the Spotllight find the closest matches to another  
string, or do i have to write the search engine myself?


Thank you.
Timofey.
___

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


setSelectedRange doesn't work properly...

2009-03-01 Thread Тимофей Даньшин

Hello.
In my NSDocument-based application I use a number of my own attributes  
to the NSTextStorage in that document.
The funny thing is when i set the cursor to the desired point and  
begin typing, one of those attributes gets broken, i.e. the range  
containing the text that i type in doesn't have that attribute.  
However, if i move the cursor from that position and back to it using  
the arrow keys, the text typed in has that attribute. Another funny  
thing is that it happens only to one of two custom attributes that are  
set for that position in the text.

Am I doing something wrongly? How can I fix/work around it?

Thank you.
___

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