Friday, January 13, 2017

Reading a Book for 6th Graders

Reading a book for 6th graders. Published in 1916. This is in the foreword:

It may perhaps be granted that this general movement towards a more careful study of complete classics is for child's literary welfare. It can not be questioned, however, that many school systems have gone too far in this direction. The expanding life of a child as a citizen of the world demands acquaintance with a considerable portion of the world's best thought as expressed in literature. If literature is to stimulate the child's intellect, kindle his imagination, arouse generous enthusiasms, and develop appreciation of the good and the beautiful, it must not be doled out in workhouse portions like the mush devoted to the sustenance of the youthful Oliver Twist. At the inexhaustible fountain of English literature the child should be led to drink deep. Any plan is at fault that does not develop in him an ever-growing taste for good things to read. It may well be questioned whether limiting the work in literature in the three upper grades to five or six classics a year does not check the natural desire to read. The microscopic study of details, when once the central unity of a production is clearly grasped, is for the grammar-grade child a delusion and a snare. On the other hand, the power to turn on the white light of examination to clear up doubtful meanings and to grasp an author's central purpose should be developed in every child. Such power can come only from a careful study of masterpieces worthy of the child's best efforts; but to insist upon constant in tensity is to prevent a perfect entrance into that delightful realm of fact and fancy which every child must approach on tiptoe. To insist that he have a firm ground of understanding at every step is a stupendous folly. It is to forget that the child is straining manward--that the half-perceived truths and beauties of today will be among tomorrow's clearest visions.

Learned the word "manward" here: towards humankind, directed toward humankind.

I'm not sure how I feel about this kind of formal writing. It goes against what I've learned about good writing: clear, simple, direct, active voice. But I can't help thinking that the desire for simple and clear is a byproduct of both an increasing informality with written word and an understandable desire for teachers to not be subjected to the unskilled and painfully clumsy attempts of literary novices to craft artful, flowing prose and dropping as many ten-dollar words as they think they need to get an A. People didn't even write in the vernacular until relatively recently. In ye olde times in English-speaking countries, people wrote in either Latin or French even though they spoke in English. Now, with cell phones, texting, instant messages, and email, writing is far less formal. It's conversational. It's short bursts. It's optimized for speed, clarity, and it better have bullet points and punchy, summarizing headers over every paragraph because no one has the attention span of more than 4 minutes so no one will be reading your wall-of-text, Dickinson. Just give me the headlines so I can feel smart.

(I discovered this book referenced in this video: THE STRUGGLE FOR STUPIDITY.)

Maybe the more formal literary style is more enjoyable. It seems hard to get into and I don't see too many books I can relate to. Could be new ground. I'll probably have to go it old school -- away from my laptop and cell phone. I'll probably have to engage my imagination more and won't be able to multi-task like I do with audio books. I wonder if it'll be worth it.

Sunday, October 25, 2015

Science is Cool Now

The movie The Martian has a line that made me laugh. Matt Damon is facing death as Robinson Crusoe on mars, and he says to his video log: "I’m going to have to science the shit out of this."

Is that what people think Science is now? That's fine if it is. I don't mind. It's just new to me. Science hasn't always been something you could "do the shit out of". Is an appreciation for science and cleverness mainstream now? Do people sit around thinking "Boy, I sure love technology and by extension the people who make it. Science is cool!"?

Science is a lot more than just being clever. In fact, most real work, the kind that leads to new invention, new predictive theories, etc. is kind of plodding and boring. This kind of work takes patience, stubbornness, diligence, obsession. Have you ever read the book "Origin of Species" by Charles Darwin? That's not even the full title. Back then scientists used hardcore titles like "On the Origin of Species by Means of Natural Selection, or the Preservation of Favoured Races in the Struggle for Life". Just read that title. It's serious. It doesn't care about catching your attention. It's just going to lay it out there, all tight and formal. It's not trying to sell copies. If you don't want to read it, fine. You weren't hardcore enough anyway. The content of the book doesn't let up in style or verbosity either. I gave up about half-way through after a few dozen pages describing the similarities and differences between a few bushes in excruciatingly minute detail. I quit reading, but not before I developed a deep respect for the amount of work it must have taken.

You should always read the classics if only because no one else does and to catch people on their bullshit. I was once talking with a man who described "Origin of Species" as "beautiful and elegant".
Obviously, this person had never actually read the book and only vaguely knew it was supposed to be important.

Wednesday, September 15, 2010

Enabling Internet on Android Emulators

Every Android emulator I'd create and test would not have internet. Digging into the issue it seems to be some of the features I was adding like GSM modem support so I created one without any features and internet worked fine.

Also, another handy trick is using an HTTP proxy so you can view all of your web traffic easily. Sure you could just fire up wireshark but this is a little cleaner looking:
http://aurirahimzadeh.spaces.live.com/blog/cns!F5CF78DEA3328162!3717.entry

Thursday, July 22, 2010

Smali syntax highlighting

I've been doing a lot of Android APK hacking lately and that means reading a lot of code created by smali, the dex format disassembler. Since it's not that popular I could not find any syntax highlighting or smali editor anywhere so I created my own.

This is a wordfile for UltraEdit that provides some much needed syntax highlighting. I dug around the Smali code as much as I could to make sure everything was good. It handles all the keywords and operations.

Here's my code:
// Last updated 7/21/2010
/L20"Smali" Nocase Line Comment = # String Chars = " File Extensions = SMALI Escape Char = \
/Colors = 0,8421376,8421376,8421504,255,
/Colors Back = 16777215,16777215,16777215,16777215,16777215,
/Colors Auto Back = 1,1,1,1,1,
/Font Style = 0,0,0,0,0,
/Open Brace Strings = "{" "(" "["
/Close Brace Strings = "}" ")" "]"
/Open Fold Strings = ".annotation" ".field" ".method"
/Close Fold Strings = ".end annotation" ".end field" ".end method"
/Indent Strings = "{" ".method"
/Unindent Strings = "}" ".end method"
/Delimiters = " $(), +.:;=>{}~
/C1"Keywords 1" STYLE_KEYWORD Colors = 16711680 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 1
.annotation .array-data
.catch .catchall .class
.end .enum .epilogue
.field
.implements .line
.local .locals
.method
.packed-switch .parameter .prologue
.registers .restart
.source .sparse-switch .subannotation .super
annotation array-data
field
local
method
packed-switch parameter
sparse-switch subannotation
/C2"Keywords 2" STYLE_KEYWORD Colors = 32768 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
abstract annotation
bridge
constructor
declared-synchronized
enum
final
interface
native
private protected public
static strictfp synchronized synthetic system
transient
varargs volatile
/C3"Instructions" Colors = 33023 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
add-double add-float add-int add-int/2addr add-int/lit8 add-int/lit16 add-int/lit32 add-int/lit64
add-long add-long/2addr aget aget-boolean aget-byte aget-char aget-object aget-short aget-wide and-int
and-int/2addr and-long aput aput-boolean aput-byte aput-char aput-object aput-short aput-wide array-length
check-cast cmpg-double cmpg-float cmpl-double cmpl-float cmp-long const const/16 const/4 const/high16v0 const-class const-string const-string-jumbo
const-wide const-wide/16 const-wide/32 const-wide/high16
div-double div-float div-int div-int/2addr div-long double-to-float double-to-int double-to-long
fill-array-data filled-new-array filled-new-array-range float-to-double float-to-int float-to-long
goto goto/16 goto/32
if-eq if-eqz if-ge if-gez if-gt if-gtz if-le if-lez if-lt if-ltz if-ne if-nez iget iget-boolean iget-byte iget-char iget-object iget-short
iget-wide instance-of int-to-byte int-to-char int-to-double int-to-float int-to-long int-to-short invoke-direct invoke-direct/range invoke-interface
invoke-interface-range invoke-static invoke-static/range invoke-super invoke-super/range invoke-virtual invoke-virtual/range iput iput-boolean
iput-byte iput-char iput-object iput-short iput-wide
long-to-double long-to-float long-to-int
monitor-enter monitor-exit move move/16 move/from16 move-exception move-object move-object/16 move-object/from16 move-result move-result-object
move-result-wide move-wide move-wide/16 move-wide/from16 mul-double mul-float mul-int mul-int/2addr mul-long mul-long/2addr
neg-double neg-float neg-int neg-long new-array new-instance nop not-int not-long
or-int or-int/2addr or-long
packed-switch
rem-double rem-float rem-int rem-int/2addr rem-long return return-object return-void return-wide
sget sget-boolean sget-byte sget-char sget-object sget-short sget-wide shl-int shl-int/2addr shl-long shr-int shr-int/2addr shr-long
sparse-switch sput sput-boolean sput-byte sput-char sput-object sput-short sput-wide sub-double sub-float sub-int sub-int/2addr
sub-long sub-long/2addr
throw
ushr-int ushr-int/2addr ushr-long
xor-int xor-int/2addr xor-long
/C4"Keywords 3" Colors = 16744448 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
true
false
null
/C5"Keywords 4" Colors = 4210816 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
build
runtime
system
/C6"Section 1" Colors = 33023 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
** : ...
/C7"Section 2" Colors = 4227200 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
** $ ...
/C8"Delimiters" Colors = 16711680 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
=
:

I'll keep an updated version here.

Monday, July 5, 2010

Brain Drugs and my Quest for Sapho Juice

Does the idea of giving your brain a safe and effective boost as good or better than caffeine sound good to you? Are you a student or just enjoy using your brain all the time? "Well hell yea woaw!" is my answer for all those questions. It's all done using a newly emerging type of brain drugs called nootropics.

So I've been listening to a lot of the Dune audio books and fell in love with the idea of sapho juice. It's an imaginary tonic that the highly-trained mind-like-a-computer mentants would drink to improve their cognitive capacity. It was a bitter, cranberry-tasting drink that stained the lips. Anyway, I started digging around trying to come up with ideas for my own recipe and I found this post:
http://www.imminst.org/forum/index.php?showtopic=6018&st=0&p=56900&hl=sapho&fromsearch=1&#entry56900

I hadn't heard of nootropics but they seemed to be exactly what I wanted. Further Wikinvestigation turned up some valuable knowledge:
http://en.wikipedia.org/wiki/Nootropic

Nootropics are a class of cognitive-enhancing drugs that are either highly nontoxic or neuroprotective. That's right. They're either really safe or good for you. Now, granted, we have to have higher standards of evidence to be absolutely sure, and it's not safe to just start trusting everything you read on Wikipedia. However, too many people are using this stuff and claiming to get real results and it's not obviously a scam. (I did some searches for that, too.)

I played around in the nootropic subform for a few days, getting some ideas. Then I went over to Ebay and purchased 60 grams of the most well known and widely used nootropic piracatam and 25 grams of the fat-soluble version called aniracetam, which some people claim is more potent. I figured I'd just mix them together and swirl 'em up. I also read you needed lots of choline to make the drugs more bio-available, so I tried to find a good source of choline. All of the supplements were too expensive for me, but consider the fact that I'm cheap and didn't want to go all out on some strange white powders I'd be buying online and ingesting. So I settled on lecithin, which is actually quite good for you and has been used as a food additive for a while.

Once everything came in, this is what I used for my first sapho juice recipe:
1 small cup of kombucha brewed with green tea and yerba mate (for the caffeine)
~1g piracetam
~400mg aniracetam
2 tea spoons lecithin

The flavor was.. terrible. I figured if I was going to have terrible tastes, I should mix them together and let them fight it out. The result was better than you'd expect, with the kombucha over powering everything else.

The results were quite good. Concentration was more intense and focus was easier. I'm quite sensitive to caffeine and this taken in the morning made me hyper productive until about 3 o'clock, which is when I normally start misfiring in my head. Coming up and while it was rocking my thoughts came quite easily and I was VERY chatty. It was QUITE enjoyable without being too enjoyable. The coming down was surprisingly mild. I just felt a little extra tired after work. Taking it in the evening was great. I enjoyed the extra desire to talk with my girlfriend and I slept just fine and woke up in the morning feeling normal.

All in all, with my dosages and tolerances it's about like half a cup of coffee or more with much less jitters and much less of the 5-minute experience of full-body-omg-I-can-FEEL-the-universe I get. The entire adventure so far has been about 40 bucks but I bought more and have played with different recipes which I'll write about in the future.
I'd also suggest playing around this forum for a bit to get some other ideas: http://www.imminst.org/forum/index.php?showforum=169

Friday, February 8, 2008

Building a Computer

My friend built what can technically be described as a computer. Check it out: Z80 Test Circuit

Even has a dimly lit video showing it off!

It uses a Z80 processor and he refers to it as Thomas Scherrer's testing circuit.

Monday, November 12, 2007

Dropping Replicated Columns For SQL Server 2000

I'm sure all of us have tried, at some point, to delete a column from a table on a replicated database in Enterprise Manager only to be greeted with an error message:
Error 5074: The object 'DF__SomeTable__somec__71CF15EB' is dependant on column 'somecolumn'.
ALTER TABLE DROP COLUMN somecolumn failed because one or more objects access this column.
So you figure, I'll just delete the constraint and everything will be OK. But wait, that constraint is on every single replicated server, so you'll have to delete it there too. If there is a lot of latency between you and the other node, it is like waiting for a Christmas that will never come. Oh yeah, spoiler alert: Added bonus - Each one is named slightly differently. So while you may delete it from your main server, none of the syncs are happening or at least the snapshots are failing because you're missing a constraint that everyone has but you. If only there were some way to programaticly determine the randomly-named constraint and delete it. That's where I was today, so I hacked this together for Microsoft SQL Server 2000:

Use YourDatabaseHere
GO

-- Ad-hoc queries require this because sysobjects is just that important.
SP_CONFIGURE 'ALLOW UPDATES', 1
RECONFIGURE WITH OVERRIDE
GO

DECLARE @parent_id INT
DECLARE @table_name NVARCHAR(255)
DECLARE @column_name NVARCHAR(255)

SELECT @table_name = 'SomeTable'
SELECT @column_name = 'somecolumn'
SELECT @parent_id = (SELECT sysobjects.id FROM sysobjects WHERE sysobjects.name = @table_name AND parent_obj = 0)

DELETE FROM sysobjects
WHERE parent_obj = @parent_id
AND (SELECT syscolumns.name FROM syscolumns WHERE syscolumns.id = @parent_id
AND syscolumns.colid = (SELECT sysconstraints.colid FROM sysconstraints
WHERE sysconstraints.id = @parent_id AND sysconstraints.constid = sysobjects.id)) = @column_name
AND xtype = 'D'
GO

-- Turn it off when we're done.
SP_CONFIGURE 'ALLOW UPDATES', 0
RECONFIGURE WITH OVERRIDE
GO


If you are not familiar with system tables, I heartily recommend you check them out and learn them. Very handy for doing tricky things like this and it will make the above script seem less like magic and will lessen the chances you break something.

For SQL Server 2000: http://msdn2.microsoft.com/en-us/library/aa260604(SQL.80).aspx

For SQL Server 2005: http://msdn2.microsoft.com/en-us/library/ms179932.aspx

If you ARE familiar with system tables, and you find an error in the above script, please let me know in the harshest way possible, so I wont forget (within reason).

Now to run this command on all subscriber databases... For more info on that, check out this link:
http://doc.ddart.net/mssql/sql2000/html/replsql/replimpl_5t9d.htm

Thursday, June 21, 2007

Replication Procedures Accidently Added to Publication

We have merge replication configured for about 20 field computers, and 4 servers on our local network. While trying to fix a problem, all articles on the distributor were added to a publication. This includes about 700 procedures generated by SQL server. We weren't able to uncheck them once the changes were applied, probably because the snapshot was created and to uncheck them would invalidate the snapshot.

This caused a lot of problems because we couldn't create any more snapshots because we kept getting the error:
Cannot drop replicataed procedure 'sp_sel_BD87AFD5144A4C7FEE4B86FD60AC49F3_pal' because it is being used for replication.

So I had to write this script to remove them from the publication programaticly:

DECLARE @proc_name NVARCHAR(100)
DECLARE @pub_name NVARCHAR(100)

SET @pub_name = 'PublicationName'

DECLARE cGetRepProcs CURSOR FOR
SELECT ROUTINE_NAME
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE='PROCEDURE'
AND ROUTINE_NAME LIKE '%_%_pal'

OPEN cGetRepProcs
FETCH NEXT FROM cGetRepProcs INTO @proc_name
WHILE @@FETCH_STATUS = 0
BEGIN
EXECUTE sp_dropmergearticle @pub_name, @proc_name,1,0,1

FETCH NEXT FROM cGetRepProcs INTO @proc_name
END

CLOSE cGetRepProcs
DEALLOCATE cGetRepProcs

Tuesday, May 15, 2007

Failed to enumerate changes in the filtered articles.

If you have Microsoft SQL servers setup for merge replication and you can't sync from the enterprise manager because of the following error:
Failed to enumerate changes in the filtered articles.
Then try syncing from the command line using replmerg. Not only does it, strangely, have a higher chance of working correctly, but it also shows you valuable information that can be used for debugging. To use replmerg, right click on the publication and go to Agent Properties. Then click the Steps tab and there should be a job called "Run agent.". Select that step and click Edit. There should be a long line of text in the command box. Highlight it all and copy it (ctrl+a, ctrl+c), then open a command prompt (windows key+r, cmd) and issue this command:
cd \Program Files\Microsoft SQL Server\80\COM
Now type: replmerg and then right click on the command prompt to paste. If you can't paste, go to the command prompt properties (alt+space, p) and make sure Quick Edit is checked (q) then apply and try again.