Macintosh

Deleting LiveJournal

About a year ago, I posted an article about the AppleScript I had written which, when run on a Mac computer in conjunction with the Safari web browser, would go through a LiveJournal account and save each entry to a PDF file, preserving the original formatting and comments.

Now I finally decided it’s time for me to delete my old journal. I was concerned, though, that purging the entire journal or marking all entries as deleted might just set a ‘deleted’ flag on them which could just as easily be un-set to bring everything back someday. So I decided to first set the text of each journal entry to the word “deleted” so as to make such a thing marginally more difficult.

Here’s the AppleScript that I came up with. It runs in Script Editor with Safari on macOS Big Sur. The buttons might be specific to my custom LiveJournal theme, so this script might not work for you as-is, but with some knowledge of CSS you can probably finagle it.

-- This script will delete LiveJournal pages, one by one.
-- Before it deletes each, it will change the text of that entry to the word "deleted",
-- as an extra safeguard against it ever being restored.

-- Start by going to your LiveJournal recent entries page

set editEntryButton to "document.querySelector('[title=\"Edit Entry\"]')"
set body to "document.querySelector('textarea#body')"
set saveEntryButton to "document.querySelector('[name=\"action:update\"]')"
set deleteEntryButton to "document.querySelector('[name=\"action:delete\"]')"

on wait()
	delay 3
end wait

on doJavaScript(js)
	tell application "Safari"
		ignoring application responses -- otherwise a JavaScript alert blocks AppleScript from continuing
			tell document 1 to do JavaScript js
		end ignoring
	end tell
end doJavaScript

-- wait for a specific page element to appear, as a way to make sure the page is loaded
on waitFor(element)
	tell application "Safari"
		tell document 1 to repeat
			delay 3
			do JavaScript element & " != null"
			if the result is true then exit repeat
		end repeat
	end tell
end waitFor

set done to false -- I never set it to true, but you could add a test for done-ness
repeat until done
	
	tell application "System Events"
		tell process "Safari"
			set frontmost to true
		end tell
	end tell
	
	-- set the text of the entry to "deleted"
	doJavaScript(editEntryButton & ".click()")
	waitFor(body)
	doJavaScript(body & ".value = 'deleted'")
	wait()
	doJavaScript(saveEntryButton & ".click()")
	
	-- then actually delete the entry
	waitFor(editEntryButton)
	doJavaScript(editEntryButton & ".click()")
	waitFor(deleteEntryButton)
	doJavaScript(deleteEntryButton & ".click()")
	
	-- press 'Return' to answer the 'really delete?' modal
	tell application "System Events"
		tell process "Safari"
			set frontmost to true
			delay 1
			keystroke return
		end tell
	end tell
	
	-- start over again with the next journal entry
	waitFor(editEntryButton)
	
end repeat

display notification "Finished deleting your LiveJournal."

Deleting LiveJournal Read More »

Choosing a laptop

I wanted a new laptop computer. My MacBook Pro (15″, Late 2013) is eight years old. It’s been my Swiss army knife, able to dual-boot into macOS and Windows 10; I’ve used it for Mac programming, for Windows games, for email and web surfing and writing and family/friends tech support. It’s been able to handle anything I throw at it. But lately the fans have been spinning up and making it sound like a jet engine any time I boot into Windows, much less try to play any games (it has a very old GeForce 750M graphics chip); and it doesn’t support a laundry list of features in modern apps (such as virtual backgrounds in Zoom).

I was further encouraged to upgrade when, out of curiosity, I ran the GeekBench benchmark tool on my once-top-of-the-line MacBook Pro to see how it compares these days. It scored notably worse than an iPhone 12. So I began looking around to see what’s available these days that might replace the MacBook.

The MacBook Pro scored 832 single-core and 3437 multi-core; an iPhone 12 gets 1569 single, 3827 multi; my newly-built Ryzen 5600X desktop PC (not top of the line, but the latest tech) gets 1628 single and 8155 multi.

Spoiler: I eventually upgraded to a Lenovo Legion 5 16″ (AMD), but it took me a while to get there.

Choosing a laptop Read More »

Exporting LiveJournal

For a long time now, I’ve wanted to export my LiveJournal account to PDF files so that I have a local copy of it. But LiveJournal has no export feature. There are sites like BlogBooker, who (for a fee and my LJ login) will generate PDFs for me; there are also other sites which (if I give them my LJ login) will import my LJ posts and comments. But I don’t trust any of those services to get everything. Plus, I wanted to find a solution on my own.

Exporting LiveJournal Read More »

Crushed

I check my Hackintosh computer’s disk with Disk Utility every now and then to make sure there are no problems. Usually it says the disk is okay. This time it said “error: drec_val object (oid 0x8f62a): invalid type (0). fsroot tree is invalid.” Disk Utility also told me that it couldn’t repair it. I found some discussion boards online which say the only solution is to reformat the disk and restore from backup.

This is a problem.

Crushed Read More »

Time and space

My MacBook Pro has a 500GB solid-state drive. (Technically 512GB, I suppose, but it reserves all the rest to replace blocks as they fail. I’m okay with that.) When I first got this computer, I decided to allocate 380 gigs of that to Mac OS, and the remaining 120 gigs to Windows, because I like being able to dual-boot into Windows when I want to help someone with Windows or play a game.

Turns out that I don’t use much storage on the Mac side; I prefer to keep most of my data on my desktop, where it’s more secure. But meanwhile, Windows games are big and I have a bunch of them (darn Steam sales), so I was running out of room on the Windows side.

So I decided to shrink the Mac partition and expand the Windows partition, to give them each 250 gigs.

Time and space Read More »

Backing up

The best backup software I’ve found for Windows is Acronis True Image.

Unfortunately, the software really sucks.

Let me illustrate the problem. I told Acronis (on their Facebook wall) that I want a simple “set and forget” backup that doesn’t require a lot of configuration and maintenance, and I asked what the latest version of their product can do for me. Their reply:

An incremental backup stores changes to the data against the latest backup. So you need access to previous backups from the same chain to recover data from an incremental backup. To clean up an older backup chain (Full backup + dependent incremental backups) you’ll need to create a new full backup as a base for next incremental backups. Here you can find different clean up schemes available in the custom backup scheme: http://www.acronis.com/…/document…/ATI2017/index.html… For your scenario I’d suggest using an option “Keep size of the backup no more than [defined size]” – to limit maximum size of the backup. After creating a new backup version, the program checks whether the total backup size exceeds the specified value. If it’s true, the oldest backup version will be deleted.

This is the year 2016. I shouldn’t have to deal with “full” versus “incremental” backups. I shouldn’t have to worry about what will happen when my backup disk fills up. I should just be able to plug in a backup disk, hit a button, and have the backup software take care of the rest.

Backing up Read More »

Moments of Transition

shore

All around us, it was as if the universe were holding its breath, waiting. All of life can be broken down into moments of transition or moments of revelation. This had the feeling of both.

I don’t want to count how many years it’s been since Babylon 5 went off the air, but quotes from it keep coming back to me. (Such a well-written piece of science fiction that was.) This has been a year of transition, and I’ve been so busy living it that I haven’t had the presence of mind to write about it.

Moments of Transition Read More »

To Serve Man

dogfood

It’s nice that Apple has bundled all the tools necessary to turn a Macintosh into a server (mail, web, file sharing, DHCP, DNS, &c.) into a $20 app store purchase. I think the Server version of Mac OS X used to cost $500, and the new low price really puts the power of a server into the hands of the masses.

Unfortunately, Apple has also dumbed down the whole server interface. I can see what they were trying for; they want to turn the experience of editing config files into the experience of clicking on something that looks like an on/off switch. Problem is, there’s still a need for server administrators and there’s still a need to know how to edit config files. It would be like buying a button for your car’s dashboard that says FIX IT and telling you, hey, congratulations, you’re a mechanic now! But if you press that button and nothing happens, then, well, you’re in trouble.

To Serve Man Read More »

Scroll to Top