IPTABLES to redirect 80 to 8080 for Tomcat



This is partially noted in some earlier posts, but the full detail is missing…

sudo /sbin/iptables -I INPUT 1 -p tcp –dport 8080 -j ACCEPT
sudo /sbin/iptables -I INPUT 1 -p tcp –dport 80 -j ACCEPT
sudo iptables -t nat -A PREROUTING -p tcp -m tcp –dport 80 -j REDIRECT –to-ports 8080
sudo service iptables save
sudo service iptables restart


Identify full table scans in Oracle


I used to have a good query that I was happy with to do this, but I apparently lost it. Here’s some queries I’ve cobbled together today to identify full table scans and check their SQL…and determine that a maybe some new indexes might be in order based on real world queries…

select * from v$sql_plan where operation = ‘TABLE ACCESS’ and options = ‘FULL’
AND timestamp > sysdate – .01
order by TIME

and use the hash value to get the SQL:

select * from v$sql
where HASH_VALUE = {hash value of a result}

A cool row selection


A co-worker had something like this in a project, and I thought it was pretty neat.  A lot cleaner than what I’ve been doing recently:

DataSet ds = GetDataFromSomeWhere();
IEnumerable<DataRow> rows = null;
rows = from row in ds.Tables[0].AsEnumerable()
       where (row.Field<String>("ColumnA").ToUpper() == myValue
       || row.Field<String>("ColumnA").ToUpper() == "SomeOtherValue")
       && row.Field<String>("ColumnB").ToUpper() == aBoolean.ToString().ToUpper()
       && row.Field<String>("ColumnC").ToUpper() == "SomeDifferentValue"
       select row;
foreach (DataRow row in rows)
    // stuff

ASP.net update control in parent page from acsx user control



Needed to update a treeview control (oh noes!) on the page from an ascx user control. It was easier than I expected…

// path value for the tree node to update:
string path = string.Format("0/{0}/{1}/{2}", this.Group, this.Trend, this.NID);
// find the treeview control in the page controls collection:
TreeView tvc = Page.FindControl("tvEvents") as TreeView;
tvc.FindNode(path).ImageUrl = im;

Find Active Directory user by SMTP Email Address



We’re always having to look up users in AD by some value or another.  The newest twist was to take an SMTP e-mail address and find the sAMAccountName (LAN login) for that user.  We couldn’t just use the mail value because a lot of users may have more than one SMTP e-mail address…for nick-names and the like.  So, it’s DirectorySearcher to the rescue!  Code after the break uses an OR in the DirectorySearcher’s Filter property to look at PRIMARY SMTP addresses — proxyaddresses=SMTP:{0} OR OTHER SMTP addresses — proxyaddresses=smtp:{0} to find a match.  Notice the case difference there?

Continue reading

Task Scheduler error “Action failed to start”


Interesting point in the Windows Server 2008 Task Scheduler that tripped me up (thanks to http://www.arcomit.co.uk/support/kb.aspx?kbid=000058 for pointing out the problem to me). Don’t include quotes in the Start In: value for your task, even if the path contains spaces. If there are spaces, the Program/Script: value must be surrounded by quotes, but the Start In: value has to be free of quotes…weird.

Using Team Foundation Service



Let’s not beat around the bush.  I love Microsoft’s Team Foundation Service.  At the Alpha Job, we use SVN and I have Tortoise SVN installed to help me manage my interactions.  We used TFS for one project, and I liked it so much more than the Tortoise Challenge.  But, we were evicted from the TFS server due to cheap assedness.  Needless to say, the 5 user freebie TFS-in-the-sky is perfect for my small projects.

What’s great:

  • Source code management! “In the cloud”!
  • Tight integration with Visual Studio
  • Add/Edit work items from the IDE
  • Update work items on commit
  • Agile planning and task board online

What I’m getting used to:

  • Agile planning and task board online
  • Project and team work space planning

What needs work:

  • Work space management tools are CLI tools rather than being online options or available in Visual Studio

I’ve paid for a couple of different SVN services, but like this offering from Microsoft (even free for a small team!) much better.  I’m going to try out the Eclipse plug-in, and understand that I can even connect XCode’s GIT repository to it.  Good stuff.  Good stuff.