Advice for smart (running) girls on online privacy…

So not to be a ‘creepy Steve’  a la Smart Girl’s Guide to Online Privacy (fantastic read!), but another piece of advice I’d leave for the privacy-conscious who post their photos with their running bib’s on social media (especially dating sites).

If you go to running competition results pages, like the one for the Sydney Blackmores Running Festival (not just limited to this competition – pretty much all running events use similar results websites), you’ll see that all you need to find out someone’s name, age and in some cases suburb is their bib number… So as always be wary of what you post online!

Advertisements

Monitoring a shell script (external job) running on CentOS with Jenkins

So I wanted to setup Jenkins external monitoring on a web server I have on a Centos VM, and I found a combination of these three blog posts worked!

Firstly, run the following commands :

wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum -y install jenkins

… or download the RPM at http://pkg.jenkins-ci.org/redhat/ and run “rpm -Uhv jenkinx*.rpm”

  • run the following:
cd /usr/lib/jenkins
unzip /usr/lib/jenkins/jenkins.war
  • Install OpenJDK while you’re at it.
  • Go to Jenkins and create a “Monitor an external job” called “New Job”
* Create an environment variable by 
$export JENKINS_HOME=http://jenkins_host:8080 , replacing "jenkins_host" with the server running Jenkins
  • To have Jenkins monitor a script, run a command like the following…
java -jar /usr/lib/jenkins/WEB-INF/lib/jenkins-core-*.jar “New Job” /path_to/myreport.sh 2>&1 > /dev/null

And you can put that command in a cron job too!

Paging queries (or querying large amounts of data) from a MySQL database in Java

So I was trying to run a query of a large number of rows on a MySQL database using Java MySQL JDBC connectors, and I couldn’t find an easy way to do this… so once I found out, I thought I’d post it here!


Connection existingDBConn = DriverManager.getConnection("jdbc:mysql://databaseServerName:3306/databaseName","username","password");
Statement selectStatement = null;
selectStatement = existingDBConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
selectStatement.setAutoCommit(false);
selectStatement.setFetchSize(Integer.MIN_VALUE);

if (selectStatement.execute(selectSqlQuery)) {
do {
selectResultSet = selectStatement.getResultSet();
while (selectResultSet.next()) {
System.out.println(selectResultSet.getString(1));// and so on......... whatever you'd do on each row of the database
}
} while (!((selectStatement.getMoreResults() == false) && (selectStatement.getUpdateCount() == -1)));
}

The things I needed to was to “setAutoCommit” to false and set the fetch size to “Integer.MIN_VALUE”.

Here’s some of the references I used:
http://stackoverflow.com/questions/14535846/how-do-i-load-100-million-rows-in-to-memory
http://stackoverflow.com/questions/3682614/jdbc-how-to-read-all-rows-from-huge-table
http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-implementation-notes.html

Creating MySQL views in phpMyAdmin

I saw lots of various answers to this question, but I thought I might share a quick and easy way of doing this I stumbled upon!

  1. Select your database
  2. Click on the SQL tab and run the query you want to power your view
  3. Under “query results operations”, select “create view”. You will see your brand new view if you click on the “structure” tab for the database

It’s important! Overriding CSS commands with the important keyword

You can use the !important keyword to override previously run CSS directives! Interesting, right?

More information at: http://en.m.wikibooks.org/wiki/Cascading_Style_Sheets/Important

Using em’s as a unit of measure

Doing measurements in CSS? Maybe consider using em’s as a measure of unit instead of pixels… So all units are related to a pixel size, not a specific pixel measure…

The Wikipedia article has some good notes..

en.m.wikipedia.org/wiki/Em_(typography)

Including a CSS file in another CSS file

Use the line “@import url(file.css);”.

Apparently this needs to be the first line in a CSS file. Don’t forget the final semi-colon like I did :/…

Thanks Stack Overflow!

http://stackoverflow.com/questions/147500/is-it-possible-to-include-one-css-file-into-another