|
Home Pages Pidgin Azarennya (S|N) Mac Thesaurus Reference ToDo Colino Food Local Blogs: BadIdea Rachel RIAA Cult: Clambake Infidels Fi: Arda StarTrek Trek/Wars Film: IMDB D Harry Jabootu Kyle Fun: Agony ICanHas? ObSkills Snopes Lang: ZBB Vreleksá AwkWords Omniglot Scriptorium More... Local: Maps Map MyWeb Metro (map) FC Weather GoWhere? GGWash DC Arlington Reston Beyond Bacon Pix: Deviant Places Renderosity Blender Artists Pol: Anchoress Lizards Lucianne Strata WAwakes Sci: SmallThings Darwin AntiEvo Skeptics EvC BAUT Physics /.Sci Junk Panda Pharyngula Mags AmSci NatG Space X86: OSX86 ArsTech OSNews TUAW Dev PowWeb PHP Webmaster Coding Walkers Prog: PHP JS Toolbox Unobt Compress RegExp (test) Lint SQL Cocoa Builder Dev Apple BBS Userland Faqin Science/Tech: Engadget Thunderbolts Icecap Centauri NewSci Gizmodo co2sci ClimateDebate SciDaily Nrich NatGeog Math CreatClaims GoodBadMath CurrentEvents: OrigSig Flamingo FlopAces ImmigProf ~J~ MyVRWC NewsGroper Pal2Pal Sanity Simon TCS Toldjah Blogs... Tools: Calculator AsciiArt XMLVal FunStuff: Pictures: Photobucket (eg Dubai) Videos: YouTube Subtitler InterestingThings: LibraryThing FlashCards GoogleDocs Wowio Bubbl.us Colemak Audible PodioBooks WonderfulInfo BooksOnline AboutUs.org |
Main /
OrganizerProjectScratchpad2008-07-20: I'm thinking about resuming work on Sasshi. The other items don't do what I want. This is my list of things I want:
This stuff is nice but definitely optional:
The GUI of Sasshi could just be that of a regular text editor, but it would have a drawer or dialog box for building a sorted filtered subset of the file for viewing, printing, or export to (X)HTML. What is out there:
(2008-07-09: Jeez, just download Scrivener and play with that for a while. See if you can export outlines as text, change them in a text editor, and reimport them back into Scrivener.) Overview"Sasshi" (Japanese: "notebook" or "pamphlet") will be a text editor for Mac OS X. What distinguishes Sasshi from other text editors is that it treats a text file as a series of entries, and it is designed to deal with multiple entries in various ways -- by hiding (or "folding") all entries that don't match certain criteria, by moving multiple entries together so that they are contiguous within the file, by sorting them, by printing or searching or exporting only certain entries and not others, and so on. The Sasshi editor window has an entry list contained in a side drawer. The entries listed are those that match the criteria specified by the current filter. Clicking an entry in the list selects it; double-clicking the entry moves the cursor to the start of that entry. Filters are additive; each new filter acts on the entries allowed by the previous filter. Thus there is a "show all entries" command, and individual filters can be taken off. EntriesFiltersStylesFeature list
ProgrammingImplementing featuresThe IDEKit might be worth investigating. It promises "programmer source code editing, including syntax coloring, popup functions, and split frames." Regular expressionsDownload a library of functions for handling regular expressions -- AGRegex or more likely RegexKit. Jumping to an entryHold text in linked lists of blocks? Internally, Sasshi keeps each entry as an object, consisting of the entry text, the number of lines the entry has, and pointers to the next and previous entries. The entry list in effect contains pointers to individual entries within this linked list, simplifying the task of figuring out which line number to jump to when an entry name in the list is doubleclicked. Insert special characters into text? Sasshi could also insert special characters before each entry -- characters that are not echoed in the editor but are used internally to track the location of each entry. Each entry would get a certain sequence of characters, e.g., Chr(1) followed by a series of digits followed by Chr(2). Each item in the entry list has both an entry's name and its internal ID instead of a line number. To find an entry, given its ID, we just search the string for the ID enclosed in the opening and closing special characters. I think the advantage, overall, goes to the linked list of blocks. There is work to be done whenever loading or saving, switching between one long text and the series of blocks, but entries can be rearranged at will, and there is no need to go hunting for an entry. An index could be added, with one index object for every entry in the file. In addition, this scheme allows me to purge infrequently used entries to disk, thus making it easier to deal with large (multi-megabyte) files. Entry foldingYou "fold" an entry by hiding all lines except for the entry's name line. The editor needs to display a widget to the left of the line, which toggles between "expanding" the entry (adding its lines back into the editor display) and "collapsing" it (removing its lines). Other thingsLinksIconsOne idea for an icon: a hardbound book (triangular protectors on the two corners away from the spine), with two or three bookmarks sticking out of it, laying on a red sash. Old stuff, unorganized2008-07-07: (Possible feature where you toggle between the "project" file and the "common" file? The common file is where you keep all your clips and everything you want to be available no matter what you're working on; the "project" file is the one you open in the file picker or by double-clicking it in the Finder.) (Alternative to opening a single huge file: Open multiple files at once, but press Cmd plus a number key to switch among up to ten open files.) It's a text editor with "folding" and "bookmarks." It's a text editor, not a card editor, so the editor window displays the entire file. The editor still looks for three kinds of lines, though:
The entry list
What would my editor have that other text editors don't?
Version 2 would involve a rewrite of the file-handling code. It would be nice to have file operations handled in a separate thread, so that you can work on huge files without having to wait for things to load and be resaved. The plan was to develop a system where only some of the file is in memory, and lines are loaded from the file on demand. However, I'd also want the scrollbars in the editor to behave AS IF the whole file were loaded. This is a bit more than I'm ready to chew at this point, so the special code for handling huge files can be deferred. 2008-07-05: GUI update. The main window has three parts, from left to right:
Thus the editor never contains more than one entry at once. Also note: The filter is a first-class object. Each entry in a list produced by a filter can:
The list can also be passed to another filter, and each entry in that list can also have each or any of the above actions applied to it, and so on. Miniproject: FilterPOC (POC = "proof of concept") Application reads data from a file: (1) the file to open, and (2) the tags to look for. Application opens the file specified and reads the lines from the file, retaining only the lines of entries containing the tags specified. The app closes the file when it reaches the end of the file, and reports the results (number of entries found, time taken to open the file, memory consumed by the entries, and probably the text of the entries). Purpose: To demonstrate reading part of a large file without consuming ungodly amounts of memory. (For this, the file to open needs to be very large, e.g., many megabytes in size.) Application will likely use a 64KB buffer, read in 64KB at a time, and scan the data for characters 10 and 13 (line endings). I'll need to learn how to "realloc" a buffer to keep enlarging it so that I can keep appending data until the end of a line or an entry is reached. 2008-07-04: On how entries appear in the editor. A person should be able to work on multiple projects at once, each with a different set of filters on the current file. However, ALL projects use the same ONE editor window, it's just that when you switch to a different project (a different view or filter), a different set of entries is shown. The editor just displays a subset of the full file, built from just the entries allowed by the filter. The list, though, can show "stubs" between entry names. You can click a stub to see a list of hidden entries; you can click one of these to add the entry name to the list and to insert the entry into the editor. (You should also be able to hide a displayed entry.) Filter history! Searches and filters need to be saved to a history. You should be able to go back through the history and save a search or a filter permanently by giving it a name. 2008-07-03: To do: Study Objective-C and Cocoa this weekend.
Look for samples of source code to learn from.
You might also look at:
Write up your notes.
Write "learning code."
2008-07-02: Make plans to ditch this website. Host your scratchpad app on Google. Back up all your website crap onto your hard disk at home, and turn it into scratchpad files. More ideas here, such as a search-and-replace dialog box that displays all of the matching lines AND what they'd look like after the replace, BEFORE ANY replacements have been made (presumably so you can veto some of the replacements listed). IDEA FOR AN ICON: One of those 4x4 puzzles where you unscramble a picture or put numbers in order by pushing squares around. The picture is of a piece of paper with a "T" on it. Flashcard modeDisplay entries randomly. An entry needs a (Alternative: A field might mark the beginning of a section; the actual question and the actual answer might be in the text, flanked by entry lines.) Automatter (automatic formatter) or "styler"Syntax-highlighting definitions are implemented as searches. The system searches for each word, phrase, pattern, or regular expression in a whole list of them, and highlights each occurrence of each item in a given color (or character style). (NOTE: To handle strings in a C program, you might highlight keywords first, then go back and highlight all strings, which recolors any keywords within strings.) Syntax-highlighting should thus be accessible, if you just want the editor to highlight all instances of particular words or names. (Musing: Maybe you can use more than color. Maybe you can use fonts, sizes, and styles. Maybe you can even use this to generate live links. If that's the case, you can use the "formatter" [for that is how I'm starting to think of it] to implement a markup system right within the editor. Thus a line that begins with exclamation points is displayed in large bold letters, text between asterisks is displayed in bold, etc.) (A side issue: Use the same search patterns that the formatter uses, but instead insert and delete text, e.g., change "!Title" to "<h1>Title</h1>".) You should also be able to switch formatting schemes at will, and also to use two or more at once. Text-file handlingHistory? How about keeping older versions of entries around automatically? Other featuresOutlines. The list of entries can be displayed as an outline, based on entry metadata. This can be either a "parent" (if the entry is to be a child of the "parent" named) or a "level" (a number). (Probably just a level, as in MS Word.) A parent can be expanded to reveal its children, or collapsed to hide them. And of course the list can be switched from "list mode" to "outline mode" and back. Calendars and alarms. Perhaps the app should keep track of entries with special date fields and alert you when a given date is coming by displaying the entry in a popup, or summarizing the entry in a special "alert" pane at the top of the window (hopefully one that WON'T interrupt your typing, but instead will play a sound or an animation or something). [You also have to know that people are going to want integration with iCal and Address Book if you go this route.] Statistics -- counting characters, lines, words, sentences in each entry and in all entries displayed, and in all entries in a file. Displaying the most recently updated entries. In-text commands. You should be able to enter "8x5" and get "40" in the text. You'd probably hit a key, say Cmd+M for macro, and enter either a direct command, or the name of a macro (or external script) to run. The output of the macro or script will be inserted into the text. Popup entries. You can assign an entry to a key, so that when you hit the key, the entry pops up in a side window. (Easiest way to do it: Reserve a number of keys for popups, rather than allow the user to assign ANY key.) BONUS: App's windows automatically arrange themselves so that you can see everything on the screen. Pop current entry out into a window. Press a key to display the current entry by itself in a new window (editable or read-only?). 2008-07-01:
Keyboard shortcuts:
2008-07-07: Needed: Keyboard shortcuts to:
In addition to the file you're working on, the app keeps open a "common" file (equivalent to the "personal workbook" in Excel). This common file contains clips, templates, syntax-highlighting definitions, and other things you might want available no matter which file you're working on. (Clips, templates, etc. can also be stored in the main file.) Field names are abbreviations, descriptions of which are stored elsewhere (and are brought up whenever you are editing a field with that name). For example, 2008-06-30: Different approach. The editor has a subset of the whole file -- all entries matching current criteria, separated by separator lines. You see the percent signs; they are not hidden. Setting new criteria simply changes the entries in the editor once; it does not produce a watch that continues to remove entries that do not match. Thus you can add new entries that don't match, e.g., if you have an idea or a name or a phone number you need to type in right now. The left side is just a list of entry names -- in essence, bookmarks to the entries currently in the editor. Add an entry, and a new bookmark appears; delete an entry, and its bookmark disappears. Clicking a bookmark moves the cursor to the top of that bookmark's entry. (Update 2008-07-02: If you move the cursor from entry to entry within the editor, the selection in the list should move to the name of the entry where the cursor is located.) 2008-06-30: Quick observation: "mac os x textshuffler" returns no results on Clusty. Google returns exactly ONE reference -- to a GZIP file from a .ru site, where "TextShuffler" is apparently the name of a (source code) class. 2008-06-28: Try to work through Cocoa (articles). In F-Script, you can load the contents of a file into a string like this:
To start, you might learn about NSString and NSMutableArray and see if they have methods for reading from and writing to files. NSString has a method initWithContentsOfFile (Mac OS X 10.4 or later). For files, explore NSStream. Test app to writeThe app should look for a given file, open it, read in only entries with specific criteria, and display the text of those entries on its main window. The test requires that the file contain entries that don't match those criteria. A real proof-of-concept test would use a file containing many thousands of entries. What I've read so far suggests that, if you want to read a file line-by-line, you gotta write code to do that yourself. You can create an NSFileHandle object to a file and keep reading N bytes from the file, but you'd have to scan the input for newlines. Notes and Questions
2008-06-29: A more achievable goal than a full-blown text editor, especially for someone like me who is new to Objective-C and Cocoa, would be an app that just reads a text file and displays only those entries that match certain criteria. You'd do your work in an actual text editor, then preview the results in the other app. This app could also export the entries to a single file or to one file per entry, and maybe send the text of each entry to another app, e.g., one that converts markup to HTML. What can be achieved with just shell scripts?Suppose I use a regular text editor for editing, a browser for previews, and scripts to convert marked-up text to HTML and to write files. What can shell scripts do? Can a script convert Colino markup to HTML, or would I need to write a C program to do that? Edenki againOne feature you can't have by farming this stuff out to command-line scripts is a list of names of pages within the text file. It'd be nice to click on a page name and go right to the page. 2008-06-28: Maybe doing stuff over the Internet isn't always the best way to go -- because I've had too many instances of my connection being flaky or even of losing my connection altogether for awhile. Maybe I really should be "living in text files" and trying to come up with a way to make working with multiple texts on a hard disk easier. (If I want to access my stuff from multiple locations, I should be carrying my stuff around on a USB drive, not renting Web space.) On keeping everything in one big text file, see also: I thought of having large text files, but splitting each file up into "cards" or "entries" or "chunks" using a regular expression for a delimiter. The text should be editable in any text editor. However, I'd use a special program at home to edit individual entries, and to display entries sorted and filtered (so that only those entries matching certain criteria appear in the editor window). I wonder how easy it would be to create an entry-filtering text editor with F-Script? (NOTE: Source code for OS X TextEdit is in "Macintosh HD/Developer/Examples/AppKit/TextEdit".) Edent"Edent" is short for "edit entries." This is my code name for my most recent idea (2008-06-28) for a text editor: Edit a single huge text file, but recognize certain lines as borders between "entries" within the file. In other words, edit a text file as a collection of text entries. These entries can be filtered (so that the editor displays only those entries that match certain criteria), and they can be sorted (by fields that you can assign to each entry). (Alternate name: "Edenki" -- "EDit ENtries in a wiKI." This is if we implement entry names and links to entries.) You should be able to set these conventions in a Preferences dialog, but the default conventions are:
First things firstFirst I have to learn how to write a bare-bones text editor in F-Script or whatever. Eventual features(Let's not go overboard. Edent's core functionality is its ability to treat a text file as a collection of entries, and to output a subset of these entries.) Core features
Features to make working within Edent more convenient
InternalsA file is broken down into entries, each stored in an array or list of strings. The file itself (when it comes time to save the file) is represented by a list of entry IDs (or pointers into this entry list). The current view is also represented by a list of entry IDs. All entries from all open files go into a single list, so that a view can reference entries from multiple files. Future features, such as outlines and corkboards, may be built based on the fact that a view can reference entries so freely. NOTE: To accommodate huge files, not all entries may actually be in memory. An entry object might not have the entry text, but only a filename, entry position, and entry size. (The entry object needs a property "complete" that is set to True only if ALL of an entry, all content and all metadata, is in memory. The object may contain SOME of an object's metadata, for example, so that Edent can determine whether the object needs to be read into memory if a new filter is applied.) SimplicityI want the program to be as conceptually simple as possible.
Learning Objective-C and Cocoa |