• Posts 15
  • Member Since
  • Last Active
Email
  • Name Daniel M
All Posts Topics Started
Workaround for constant background CPU load
Today I got a little bit annoyed at the fact that PersonalBrain constantly uses some 5-10% CPU time even when it's sitting in the background getting no input from me, so I decided to do something about it. This solution may only appeal to the technical inclined, but it does work for me (and makes me happy!) so I thought I'd share:

PB stop toggler

Fortunately, the underlying system on the Mac has a nifty feature that you can use to temporarily stop an application: our old Unix friend, kill -STOP <pid> and its counterpart, kill -CONT <pid>. It works like a charm, except of course you need to somehow figure out the pid, and type it in a terminal, which is not so practical, right?..

But hey! here comes Applescript (and bash, and perl, and...). So, I wrote a shell script that finds the pid of a PersonalBrain.app instance (caveat: it only works when there's only one running!). After that, it also kills it with the right signal to toggle its state (from stopped, which shows as T in ps, to running -- or the other way around). It's a one line file (OK, two lines including the header). Looks gory, but should work fine:

% cat /Users/Shared/toggleBrain.sh
#!/bin/sh
ps ax | grep PersonalBrain.app | grep -v grep | perl -lne '($a,$pid,$c,$_) = split / +/; /T/ && print "-CONT $pid"; /T/ || print "-STOP $pid"' | xargs kill

This isn't a good place to explain in detail what happens there. Anyway, most of the goreness comes from parsing the output from "ps"; if you want to debug it for some reason, just replace "kill" with "echo" and it won't do anything other than string matches and printing arguments that should go to the kill command.

In Applescript, all that's needed is one line script with a call to:

do shell script "/Users/Shared/toggleBrain.sh"

which I saved to my user scripts directory. Applescript editor has a "General" config option that lets you "Show Script menu in menu bar" - try it and you should figure out the rest for yourself if you care. The little saved script should appear at the bottom of the menu and should toggle PB between running (and wasting a tenth of your CPU power) and stopped (which just shows a circling ball cursor over the brain window).

I know, it would have been nicer if it were automatically detecting when PB gets focus, but I don't know how to do that. Of course, even nicer would have been for the PB developers to get a grip on their CPU eating Java code!

If you followed me so far, thanks, and have fun.
Daniel.

Utility for capturing lost thoughts/attachments
For the first question: the whole point of the matter is that there *is* no thought that corresponds to that folder (not in the exported file, anyway). Most likely it's been deleted completely some time ago. If there is some way to find it in the database, maybe the support team can help you -- I only use the open XML format that the export function offers.

If you have older backup brainzips (for example, I zip my brain weekly, and only after that delete forgotten thoughts completely) then you can try to open them, type the GUID in the quick search box and hit Enter -» if the thought having that ID existed in that version of the brain, it gets highlighted.

For the second brain, please check that you used the correct XML (exported from that brain, and not from the first one).

If you did, then it could be that the folder names were lowercase (and since I'm doing a case sensitive compare, didn't match). I can update the app to ignore uppercase/lowercase differences, if this is the problem.
Utility for capturing lost thoughts/attachments
Ah, sorry, I have java in my PATH variable and forgot to mention that.

You need to prepend the directory of your java installation to the command, like this:

W:\Eclipse\PBDeadFolderFinder\bin>"c:\Program Files\Java\jdk1.6.0_16\bin\java.exe" -Xmx512m ro.barba.pbdeadfolderfinder.AppWindow

Your path is likely different. Just use <TAB> for autocompletion to find it. I think it's usually in c:\program files\java\..., so you could start typing C:\pro <tab> \Java <tab> \ etc. If this doesn't work and you don't know where java is, open up Program Files\PersonalBrain\.install4j\inst_jre.cfg in wordpad and you'll find the path there. Add \bin\java.exe to that.

Hope this helps.

I'm sorry I didn't provide something easier to run point-and-click-like, but I'm a full time C/C++ developer with not much experience with or time for user interfaces (and I would have had to handle all java exceptions nicely, print out the results in another window, etc... a lot more work to get rid of the console completely).

Utility for capturing lost thoughts/attachments
I was intrigued by this, as I also had some problems with data corruption (caused by my broken laptop, that randomly powers off - it seems that doing this while PB was starting corrupts things).

I wrote a small Java application that should help you find those folders. From lack of development time, it currently only prints the names of the "dead folders", one per line, on standard output (in a console). If anyone finds it useful and wants more, I (or anyone else who wishes to) may implement other actions. Also from lack of time, I used a lot of memory for parsing (via XPath), so this might not scale to Jerry Michalski's brain.

In my case, it found a bunch of folders, 20 or so, but they each seemed to only contain an empty PersonalBrain Notes folder.

I attached a zip with the application, including source, compiled version and a README.txt that you should read to find out how to run it (from the console). Tested on Windows, but should work on Mac/Linux too.

As a side note, some of the folders may refer to type thoughts (each type has its own thought, with GUID and possibly attachments, too). My app doesn't list those as "dead", though it could be easily made to do so (just addding an "[isType='0']" to the XPath).

Edit: reduced the screenshot image to half size.
Click image for larger version - Name: pb-dead-folder-finder-small.jpg, Views: 234, Size: 57.17 KB
Newby Questions
For the third question, if I got your problem right, this sometimes happens to me too, especially when I build my thoughts bottom-up. Scenario: I add a web link, then want to categorize it by assigning a parent thought such as, let's say, Movies, then I add some more child thoughts to Movies and finally, after some days, I discover a thought called Films that I had forgotten about. Obviously the two should be merged.

What I do in this case is ctrl-click the child gate of one of them, say Films (to add all children to selection), choose Edit->Unlink selection (breaks the links between Films and its children), then navigate to the other one, Movies, and choose Edit->Link selection as children of. Same can be done with jump and parent links.

Other than that, there isn't any way of having two "merged" thoughts.
Paste thought icon freezes PB
Thanks.

For the time being I'm also saving all images with an image editor first, as TheBrainIcon.png, and dragging them over the thought.

icons set off vertically in reports
Hi,

again in PB beta, thought icons in the reports list are misaligned. The (similar looking) quick search and create thought lists are OK, though (see attached images).

Using PB 5.5.0.8 on Windows with JRE 1.6.0-06 or -15.

Thanks

Click image for larger version - Name: pb-icons-report.jpg, Views: 65, Size: 12.45 KB Click image for larger version - Name: pb-icons-search.jpg, Views: 65, Size: 10.79 KB
Paste thought icon freezes PB
Hi,

My PB freezes when I try to set a thought icon by copying from the browser (right click -> copy image, Firefox 3.5.3 browser) and pasting with right click -> paste thought icon in the brain. This doesn't happen with all images though, so here is an example:

From http://en.wikipedia.org/wiki/Orthodox_Church#The_Cross use the image labeled "The Three-Bar Orthodox Cross"

Another one: from http://www.mnar.arts.ro/persoane_contact.php use one of the images on the right (I only tried with the fourth and the last one).

In contrast, copying and pasting as thought icon the smiley face from this forum editor's formatting bar () works with no problems.

The program freezes right after I click on the "paste thought icon" menu option, i.e. the menu doesn't disappear and I have to kill PB with Task Manager. However, upon restarting, I find that the icon has been set correctly.

Here are the last lines of my output.log:

~Update Thought Icon Path: W:\Brains\mySITA_brain\Files\D428367B-9A05-7C46-E73A-C0703DAC0CDC\TheBrainIcon.png [CURRENT_TIMESTAMP] [CURRENT_TIMESTAMP] [2,7376]
~Update Display Modification Date: CURRENT_TIMESTAMP [2,7376]
~Set Thought Icon: [W:\Brains\mySITA_brain\Files\D428367B-9A05-7C46-E73A-C0703DAC0CDC\TheBrainIcon.png] 2,7376


I'm running the beta version 5.5.0.8, on Windows with JRE 1.6.0-06.

Thanks.
Which theme are you using?
Sure, it's was the initial version of "todo" and I never actually used it, but here it is attached, with three others.

Which theme are you using?
Sure, here they are, hopefully, attached.

If you open them with windows preview you might be surprised to see just a white screen, that's because they are white & transparent (mostly, some black did escape here and there). Any decent photo program (not Paint) should be able to handle the transparency.

There are large and small versions, mostly because PB does a quick job at making thumbnails and they don't look as good as when resizing in an image editor (you can see ragged edges in the screenshot in my previous post; compare for example the "in" icon top-left of the large screenshot with the thumbnail generated for its source in the other image).

To assign an image to a thought type, do Ctrl-C on the file in Explorer and paste it in the edit thought type dialog.
Which theme are you using?
I also like having white text on black background, at least in my brains.

I use the default theme (or possibly the black one, I can't remember exactly), with a custom star image background I googled for, and that I find to be much nicer than the plain color or gradient ones, but also not too distracting. I tried various other background images, but even after toning them down I find they just make it harder for me to see things.


The font I use is Times New Roman, mostly because of issues with chars like ș and ț that are missing from most other fonts, and then PB cannot render them in the plex. Before caring about this issue, I used Bookman Antiqua.

I also use a few thought types, especially for GTD, but I don't like to have colored thougts, because I think their readability is drastically reduced (well, I have to admit I am also suffering slightly from astigmatism but choose to just use larger fonts, etc instead of wearing glasses).

I make the difference by assigning icons to thought types, which means that each time you change the type of a thought it automatically gets the specific icon for the type, unless it already has an icon of its own. Here is how they look like (unlike the rest of the icons in my brain I drew these images myself, so if anyone is interested I can upload an archive.)



I also found the default notes font completely unreadable, so I edited the notes.css file in the brain folder to have

  /* default font */
  font-family: "DejaVu Serif";
  font-size: 20pt;
  /* background color and foreground color */
  background: #151B54;
  color: #FBB117;

which is (aproximately) large orange letters on dark blue. I don't like, however, that the cursor in the notes editor remains black and very thin (and so I can't see it at all in this setup)

I also use much larger interface fonts (ok on my 1920x1200 screen resolution I think they just look normal, instead of around 3mm tall), which required some weird tweaking of the java VM (because I couldn't figure out how to modify some of the fonts in windows, I hacked a bit and recompiled WindowsLookAndFeel).

PDF Management - How do you use it
Looking at Middleway's link, it seems you would have to install a local web server and access your pdf files through that - I haven't tried it, but it might work nicely.

Another (less elegant, but free) option would be to use DDE to control the Acrobat Reader window. This implies having a kind of "shortcut" attached to each of the thoughts that are supposed to link to a specific article. Clicking the shortcut would run the DDE client app that would start Adobe Reader, open the doc and jump to a specific page. The name of the doc and page number need to be present in the shortcut.

I wrote a proof of concept script in python (to test it, you need python for windows with the pywin32 package installed). This is how the code looks like:

Code:
import os

import win32ui
import dde
import time

doc = "c:/test.pdf"
page = 3

acrord = "c:/acrord"

server = dde.CreateServer()
server.Create("PyAcroview")
conversation = dde.CreateConversation(server)
try:
conversation.ConnectTo("acroview", "control")
except:
print "Starting Acrobat Reader..."
os.startfile(acrord)
time.sleep(3)
conversation.ConnectTo("acroview", "control")

time.sleep(1)
conversation.Exec("[DocOpen(\"%s\")]" % doc)
conversation.Exec("[DocGoTo(\"%s\", %d)]" % (doc, page - 1))


Saving this as test_3.py and running it with python would open c:/test.pdf at page 3 (starting acrobat if it's not already running).

Obviously, you would need to attach one such script for each thought, changing the doc and page variables.

To be able to start Acrobat automatically, you need to create a shortcut to it (named here c:/acrord) with the field "Run: " set to "Minimized" (needed because of issues with which window is on top). Well, if this doesn't work, you can always start the reader manually and keep it open.

Daniel
count post selected

Add a Website Forum to your website.