Monthly Archives: March 2013

Web browser text search

So I am working on a project where I have to search some HTML documents for a possible text string. This lead me to an interesting find in how browsers do searching on text.

 

Let’s look at the following HTML.

<div>
<div style="background-color: #00ff00;">Hello ther</div>
<div style="background-color: #ff0000;">e,
<span style="background-color: #f0ff00;">bob</span> how are</div>
<div style="background-color: #00ff00;">you?</div>
</div>

The text displays as the following: Text displayed in a browser

The yellow represents the inner span. The divs are different colors to show their distinction.

If you search for the text “Hello there” no results will be found as the browser does not search across div elements.

If you search for the text “e, bob how are” the text will be found as the browser will search across span elements.

It’s interesting to note that the browser’s search works only across defaulted inline elements but not elements set inline by the html.

Find out what Subversion commits haven’t been merged to stable

We frequently use Subversion for version control, and use /trunk to commit all code in active development and merge code to a stable branch that represents what is currently on a production server.

Sometimes commits need to be done right away, so you merge them right away; others can wait until you do a push.  After developing a while with regular commits to trunk, you can have a state where several commits in trunk may already be in the stable branch while others aren’t.  When you’re ready to push a group of commits to stable or do a full release of everything from trunk to stable, it’s helpful to know which commits haven’t been merged to your stable branch yet.

Here’s a bash script that will show you the details of everything in trunk that hasn’t been merged to stable:

#!/bin/bash
for i in `svn mergeinfo --show-revs eligible svn://server/project/trunk svn://server/project/branches/stable | cut -c 2-`
do
svn log -c $i svn://server/project/trunk
done | less

The magic here is the “svn merginfo –show-revs eligible”.  Very useful.