I love my syntax highlighting in jEdit, and why shouldn’t I? Good Syntax Highlighting helps you catch code errors early. So about 2 years ago, I created a custom jEdit “Edit Mode” so that HTML buried in your XML CDATA tags would be Syntax Highlighted. Here is the original post on Google Groups ( http://groups.google.com/group/opensocial-api/browse_thread/thread/12e250246ab64054/343c858695e8eb12 ).
Here is the custom Edit Mode for XML->CDATA->HTML c-xml.xml
It uses a simple trick to identify the CDATA with HTML with a special CDATA tag like the one below
<![CDATA[<!--HTML-->
<html>
<!-- friendly neighborhood web page -->
</html>
]]>
The perl version is here perl-html.xml
So for the perl version i use the structure of Perl’s HEREDOCS and use the following java capable regex
<<\p{Space}*(['"])([\p{Space}\p{Alnum}]*)\1;?\s*<\!--.*HTML.*-->
Which will HTML Syntax highlight any perl HEREDOC as HTML if it has <!– HTML –> in it so the following should syntax highlight. There is however, one bug. If your HEREDOC is not well formed, meaning you have an unclosed tag css object, or javascript call, then the syntax highlighting gets stuck. Maybe I will figure out how to make this work for non well-formed HTML. any ideas?
print <<"EOT"; <!-- HTML -->
<html>
<!-- friendly neighborhood web page -->
</html>
EOT
It’s almost been 2 years since i moved to california and its been a rough adventurous ride, and I don’t regret a moment of it. However, when I look back it’s odd to see just how different I am today.
Since sundays are for reflection, here are a few bullet points.
- • living in milwaukee i felt very connected to the community, i knew so many people by name that everywhere i went was like an episode of cheers.
- • i used to drink and eat a lot more, today i eat 2/3rds to 1/2 as much food. it’s so warm in california you really don’t need much.
- • winter seems like someplace you visit, rather than live through.
- • i used to feel tech deprived, now it’s easily accessible and to some degree less exotic
- • i understand better how some ideas are good ones and others are a waste of time
- • i now know i own too much stuff, too much ownership is a burden; you end up consuming more resources just keeping it and not appreciating it.
- • women like geeks and entrepreneurs here, i feel sexy here
- • hackathons used to be parties, now they seem like work
- • i miss bucketworks, but….. have found noisebridge, and techshop, but don’t go enough.
- • owning cars seem silly, but i still love my 350z, but now i don’t have a venue to enjoy it. i may just sell it and rent a sports car for a day, even at 500 dollars every few months, it’s cheaper, than paying for insurance and parking.
- • in milwaukee, geeks were most easily found at goth industrial clubs, but out here, they are everywhere.
- • you live in a city, not in an apartment, neighborhoods are probably more important than your home.
- • being able to bike everywhere RULES.
- • public transit is better than no transit, but it still sucks, its a tragedy of the commons.
- • some graffiti is good, some is bad.
- • political parties are not relevant.
- • some people are so angry about somethings, that they will never listen about other things
- • what its like to have a lot of friends that are female, what it’s like to have a female room mate; the secret is it’s really not that different, except your guy friends probably are more likely to drink your beer and watch the same tav shows.
- • on average women think about sex way more than I would have thought 2 years ago.
- • women may think differently, but they think about the same things. ( ok, maybe not all of the same things, or maybe just not at the same level of detail )
- • the goal of any good conversation is to derive respect of and for someone regardless of weather you agree, find enjoyment in their fellowship, however not all people are respectable, and so don’t spend your time with them
- • no matter how much you may want others to be independent and self capable, some people just want to follow, or lead. people may not be built for an egalitarian maximum.
- • any good piece of art, creates a deeper connection between people. it should make good conversation easy. ( see above )
For the last few days I have been trying to track down why Unity’s PHPBB 2 Forum (http://forum.unity3d.com) was so slow. Page rendering times were taking between 2 and 10 seconds and for me this was just unacceptable.
A proper website should be able to render a majority of the page in less than 250ms, and delivering most of the content in less than 50ms is ideal. Sites like Amazon, Yahoo, and Google have studied the effects of response time vs. features, and have found that response time is often times more important. Greg Linden pulls together a few sources on the topic in his blog.
So, 10 seconds was just unacceptable, and I was bound to find a solution. I started with the low hanging fruit, and installed PHP’s APC cache which is an OpCode Cache that stores compiled versions of the PHP code to reuse on the next request. There is evidence out there to suggest that not only do opcode caches reduce CPU requirements, but they also reduce your memory load. I saw a few sites that claim about a 3-4x performance increase on the CPU and about a 25% reduction in memory usage.
The next step, as the forums were still slow, was to start looking into our MySQL usage. Did the server have enough memory, were the MySQL caches and buffers large enough, or were searches and queries getting pruned to make room for more queries? After using MySQL’s GUI tools through an SSH Tunnel I was able to see that the server had 64MB of query cache, and only 90% of it was being used, so the caches were good.
Next was to look for slow queries, however a slow query or two would be hard to fix considering PHPBB was building the queries as part of the application and should have been tested in advance. If a slow query was the problem, it probably was not part of the application design, but rather an indication of something else that was going wrong. We did notice a few slow queries, but nothing ridiculous. However, what we did notice was that a number of queries were running slow because other ones where holding a lock for a long period. Hmmm?
Next we started looking at the problem from a system level using apps like ‘top’, ‘dstat’, ‘mytop’, etc… From here we found that disk IO was over working. Hmmm… but why?
I later found out that we were serving large files in our forum, however it did not seem like our forum was being used as a hot linking service, and I would suspect that PHPBB has some defense from that, but going forwards this is a concern of mine.
I finally found a post on the web talking about MySQL CPU spikes, and it was related to a corrupted table index. http://forums.fedoraforum.org/showthread.php?t=232008
After reading the forum for a bit, I thought, well there seems to be a few low risk commands I can run to look into our table integrity. Here is the full command list http://dev.mysql.com/doc/refman/5.0/en/mysqlcheck.html
First I ran
mysqlcheck -A -F -u [username] –p
This reported several table closed improperly errors, and took about 2-6 mins to run without taking down the forums.
Next I ran
mysqlcheck -A -q -r -u [username] –p
This is basically the fastest repair option, and would only fix minor corruption. It took about 5-10 min to run.
The result was that our MySQL usage dropped from 100-300% to 3-6% and page response times being about 200-500ms. I have a few other things I would like to try, from using our CDN with the forums to DB optimizations, to other server upgrades.
Over the weekend, I think I am going to run
mysqlcheck --all-databases --optimize -u [username] –p
Which should be more thorough, but might take an hour. This will defrag the table and resolve some indexing errors.
I finally have a new place, and it’s an open concept loft in San Francisco’s SOMA district. It’s got everything I have ever wanted in a place, but it’s got one problem, to afford it I had to take on a good friend as a roommate. I love having roommates in a traditional space, but having a roommate in an open concept loft could, well ,,,.. get bothersome in the future.
I am currently exploring and brainstorming concepts to create privacy. However, building a full height wall, although a feasible engineering solution, is not what I am looking for. We are looking for something that keeps the loft as open as possible, while allowing us to define private spaces. We have thought of the following options, but what ideas might you have?
- using plexiglass panels
- using triangular plexiglass panels and create an uneven surface
- using plexiglass with a negative pressure interior ( vacuum )
- using glass
- using foam
- hanging rugs
- hanging curtains
- using bloxes
- using a rubber skin around a substructure/ skeleton
- creating a plexiglass substructure
- creating a wooden substructure
- creating a cardboard substructure
- sucking out the air from with in the rubber encased structure
- doing something organic looking
- doing something modern
- using small bright light sources like LEDs to trick the eye of an on looker to contract and thus be unable to see passed the array of LEDs, one might call this a ‘light screen’
- use a light projector to overpower any refracting light in the room, thus creating optical privacy in one direction.
- using some sort of blinds
I will try to update this post with examples of interesting design at some point. Maybe you can comment on a few.
Since this took me a little longer than I would have liked to find, and improve I thought I would post a little nugget about Linux Shell scripting and SVN that I learned today.
You can use the following line to add multiple files to your repository:
svn st | grep "^?" | awk '{ print $2}' | while read f; do svn add "$f"; done
However, the solution above from array studios to add multiple to a subversion repository fails when you have filenames that contain spaces. Normally files with spaces in them are not idea, however, I had a few files with spaces and I thought that there must be a solution. With a little digging, I found the AWK Manual very helpful. Below is an updated solution that should work with filenames that have spaces.
svn st | grep "^?" | awk '{ $1=""; print;}' | while read f; do svn add "$f"; done
About Loc.is
Loc.is is a short url service that creates location aware hashes. The initial prototype of Loc.is was created during the fall 2009 LA Startup weekend. The idea was pitched by Justin Kruger, and was created with the help of Alexis Eller, and Andrew….
Loc.is uses geolinks to represent geographic areas on a map. Each geolink may be accurate enough to describe something like a region, city, or street address. We can even define a specific GPS coordinate with about 12 characters that you can share in your tweets, on your blog, or in your text messages to friends. Geolinks are especially neat because you can vary the precision of the defined area by removing characters from the end of the link. Because of this special attribute, geo hashes are easily compared and hierarchically grouped, so a computer might be able to find all of the geohashes that are within a city just by comparing strings; no calculation is necessary.
The geohash algorithm has a few other improvements over the one found at http://geohash.org, for one, our hashes dedicate the 1st character to defining the longitudinal region. We use 1 of 64 possible characters in each character position thus breaking the earth into 64 vertical regions. We even put the 1st region at the international dateline to make time calculations easier. The idea here is that if your geohash was only one character long, or you/ your computer only wanted to look at the first character, it could then roughly approximate which time zone the remaining characters are in. Using the 1st, and 2nd character, you should be able to define a region the size of Kansas. Together the 1st two characters define 4,096 regions on earth ( 64×64 ). The remaining characters work a bit differently and work more like a traditional geohash. Each character in the hash describes with increasing precision an area inside of one of those 4,096 regions. Using 5 or 6 characters should define about the size of a city, and 12 characters the area of a laptop computer.
Because geolinks, are both a geohash, and a hyperlink, we can collect interesting stats on who is visiting a given region, and we can crawl the web and twitter to see what people are saying about a given reason. Think of it as a sort of pageRank for location on the web. And because it’s a hierarchical data format, any shorter url can include the information from all of the locations that it contains.
We plan to have a lot of fun with taking the site further, how would you want to use the site? Please provide us feedback through the Uservoice link on the left hand side and we would love to add interesting features.
Apps I can’t Live without
Every now and then there are a few applications that I just can’t live without. Right now I’ll tell you about a few of my favorite ones for windows xp.
Launchy (micro utility)
http://launchy.net/#introduction
Launchy is a micro utility that launches when you type ‘alt+space’ ( I set mine to ctrl+space), and then you just start typing the name of the app or web address you want to launch. The app makes it possible to use a lot more of Windows XP without using a mouse. A few of the mondern operating systems have something simular, but if you are still on Windows XP, you will love launchy as much as you love your keyboard.
jEdit (text editor)
Since being a developer these days means writing scripting languages on linux, windows, and mac os you will need a great text editor that works in all three. jEdit is great because it runs in java, and thus works on windows, linux (ubuntu), and mac osx. It’s lighter weight than using eclipse and supports 30+ languages with syntax highligting. jEdit also has an easy to use plugin interface kinda like Firefox, that manages plugin installs, and plugin updates. When I set up jEdit, I usually set the tab ( buffer )controls up to be the same as they are in Firefox.
Firefox 3.5 (development browser)
http://www.mozilla.com/en-US/firefox/firefox.html
Firefox 3.5 is a huge speed improvement over 3.0, and it now supports all of your favorite dev plugins. One of these days, I will have to see if I can configure different FF Profiles to load different plugin sets. Maybe I would have one profile for speed, one for dev, and maybe one for demos.
Google Chrome (performance browser)
Google Chrome is the fastest web browser, not just because the browser renders javascript at blazing speeds, but because the browser has several other optimizations in the user interface to make it light, powerful and fast. You can even use chrome with a choice of themes now, and change the default search engine to something other than Google’s, but who would want to use that? I use chrome whenever I don’t need all of the dev plugins loaded in FF.
Steam ( game app store )
http://store.steampowered.com/
I know a lot of you like the Apple app store, but for those of us that game, Steam is the best place to buy, download, and manage the updates for all of your video game needs. Steam, produced by Valve Software, allows you to buy a game through there small desktop client and then it will download it on your idle bandwidth, and update your games in the background. You basically never have to worrry about keeping your games or drivers uptodate again. I now hate it when I have to buy a game any other way. Oh, yeah the best part, no more annoying CD checks for games that you paid for. I love this service so much, I have rebought games just so I don’t have to manage them or deal with CD cracks any more. You can even gift games to your friends.
At LA startupweekend I built with one other team member http://loc.is
a geolinking service that computes a geohash for gps coordinates or a
street address. The resulting geolink will provide a map, and some
other interesting information when a user clicks the link.
It’s kinda a little cobbled together, but by dec.3rd it should be working well.
What would you want on the landing page?
Just a quick thought.
I wonder if all of the the twitter bots are a result of people trying to gain free api access to twitter. Normal rules allow a certain number of requests per minute or or something. However if yo were to have 1,000 accounts, you could perform 1,000x that number of requests and searches per hour.
I bet if twitter looked for accounts that were performing high volumes of API requests, they would find accounts that were most likely linked to bots.
I am not yet sure if it is worth it for twitter to remove these accounts or if they are oddly good for the ecosystem.
Read ‘The Calorie-Restriction Experiment’ ( NY-Times http://tr.im/BP44 )
After reading this article I am convinced that calorie restriction will at least improve the quality of my life, but it may also extend it. New evidence is showing that adding ’some’ exercise to your life, and reducing calorie intake will reduce your chance for cancer, and or heart disease by more than 50%.
While living in Wisconsin, I used to eat till I was full, and it was leaving me to not feel healthy. This spring I decided to start changing my behavior. I bought a bike, and started biking. At first it was just to and from the beach, or Mitsuwa ( http://www.mitsuwa.com ). Later I moved on to up along the beach towards Topanga Canyon, and before long a 5 mile ride was achievable. The next leap I made, was to start biking to work, an 8 mile ride there, and an 8 mile ride back. The 1st time I did this on a weekend, and I went there and back, the full 16 miles. It took me 2 hours 15 min. I felt tired, and sore, but I felt great. All the while I started having just yogurt for breakfast and bring in Apples and Bananas to work to snack on, and although I was feeling better, I was not loosing weight. I think this was because for lunch and dinner I was still eating out.
Come June, I was laid off at work, and my income drastically changed. It was a good excuse for me to start changing my habits. Once nice thing about consulting is how it allows for more time to exercise.
I started dining in, eating when hungry, and watching what I ate.
2 weeks ago, I was able to see that I am making progress. I am now down to 202 / 4 where as in mid summer I was between 215 / 218.
Now, I try to eat a reasonable amount and try to ride 13 miles a day on my bike in Griffith Park ( but it’s probably more like 4 times a week ). Out here in California eating till full just was not going to work, 1st, eating that much food causes you to sweat in this weather, so eating less means I have a lower body temp, so I can cope with the weather better. It’s also the reason I am loosing weight.
It’s not a lot but it’s at a healthy rate. By the new year I hope to be well into 190. In college I was at 174, and I felt really good. I was able to run 5 miles a day, and lift weights for 1 hour a day. Right now I am getting good at biking 13 miles a day, and I may up the load again. I may add a 1 or 2 mile run 3 days a week. I put this out there so that you can spread the word to the people you care about. Eating well, and exercising is more than looking fit, its about quality of life.
;and I feel so much better now.
