Wednesday, June 12, 2013

MSSQL Version?

From the master System Database:

SELECT 
  SERVERPROPERTY('productversion') as 'Product Version',
  SERVERPROPERTY('productlevel') as 'Service Pack', 
  SERVERPROPERTY('edition') as 'Edition',
  SERVERPROPERTY('instancename') as 'Instance',
  SERVERPROPERTY('servername') as 'Server Name';

OR

SELECT @@version

Thursday, December 1, 2011

Nuking System Apps in Android

su
mount -o rw,remount /system
cd /system/apps
rm {application.apk}
mount -o ro,remount /system

Thursday, November 17, 2011

Verifying pagination ids don't overlap (page 1 ends at 25, page two starts at 26)


(run your search step)

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = groovyUtils.getXmlHolder( context.expand( '${User 1 - Search Tracks Keyword - ticket 8816 - 1st page#ResponseAsXml}' ));
def nodeValue = holder.getNodeValue( "//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e[1]/ns1:result[1]/ns1:tracks[1]/ns1:e[1]/ns1:track[1]/ns1:track_id[1]/text()" );
def i = 1;

return_string = nodeValue;

while ( nodeValue != null ) {
    if ( ! return_string.contains( nodeValue ) ) {
        return_string = return_string + "," + nodeValue;
    }
    i++;
    nodeValue = holder.getNodeValue( "//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e[1]/ns1:result[1]/ns1:tracks[1]/ns1:e[" + i.toString() + "]/ns1:track[1]/ns1:track_id[1]/text()" );
}

return return_string;


(run your property transfer based on script result)

(run your search step with offset - this is your scripted assertion)



def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = groovyUtils.getXmlHolder( context.expand( '${User 1 - Search Tracks Keyword - ticket 8816 - 2nd page#ResponseAsXml}' ));
def nodeValue = holder.getNodeValue( "//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e[1]/ns1:result[1]/ns1:tracks[1]/ns1:e[1]/ns1:track[1]/ns1:track_id[1]/text()" );
def i = 1;

// Setup compare string (all the page 1 id's)
compare_string = context.expand( '${#ticket_8816_documents}' )

log.info( "nodeValue: " + nodeValue )
log.info( "compare_string: " + compare_string )

while ( nodeValue != null ) {
    // Verify that no page 2 id is in page 1 id's
    assert compare_string.contains( nodeValue ) != true
    i++;
    nodeValue = holder.getNodeValue( "//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e[1]/ns1:result[1]/ns1:tracks[1]/ns1:e[" + i.toString() + "]/ns1:track[1]/ns1:track_id[1]/text()" );
}

Thursday, June 30, 2011

Verifying Elements are Descending by Date

import java.text.DateFormat;
import java.text.SimpleDateFormat;

def bo_host = context.expand( '${#Project#project_host}' );
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = groovyUtils.getXmlHolder( messageExchange.responseContentAsXml );
def nodeCount = holder["count(//ns1:Response[1]/ns1:chirps[1]/ns1:e)"];
def dateString, nextDateString = "";
def DateFormat df = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss");
def Date dateDate, nextDateDate;

dateString = holder.getNodeValue( "//ns1:Response[1]/ns1:chirps[1]/ns1:e[1]/ns1:chirp[1]/ns1:pub_date[1]/text()" );
dateDate = df.parse(dateString);
nodeCount = nodeCount.toInteger();

for ( i = 2; i < nodeCount; i++ ){
   nextDateString = holder.getNodeValue( "//ns1:Response[1]/ns1:chirps[1]/ns1:e[" + i + "]/ns1:chirp[1]/ns1:pub_date[1]/text()" );
   nextDateDate = df.parse(nextDateString);
 
   assert dateDate >= nextDateDate;

   dateString = nextDateString;
   dateDate = nextDateDate;
}

Thursday, May 26, 2011

SoapUI Pro / Groovy - Scripts and scripted assertions

I am putting these scripts and scripted assertions up here for a couple reasons. One - I am very forgetful where I've put different assertions and don't like scouting around my large projects trying to find a specific assertion. I refuse to reinvent the wheel, if I already invented it. Two - I hope to help anyone who has run into similar requirements and issues.

Hope you enjoy





Verify Elements of Each Type are Descending by Score

import com.eviware.soapui.support.XmlHolder
import java.util.*

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = groovyUtils.getXmlHolder( messageExchange.responseContentAsXml )
def nodeCount = holder["count(//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e)"]
def currentType, currentScore = ""
def typeList = []
def found = false
def index = 0

currentType = holder.getNodeValue( "//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e[1]/ns1:result[1]/ns1:type[1]" )
currentScore = holder.getNodeValue( "//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e[1]/ns1:result[1]/ns1:score[1]" )
typeList.add( [ currentType, currentScore ] )
nodeCount = nodeCount.toInteger()

for ( i = 2; i < nodeCount; i++ ){
  currentType = holder.getNodeValue( "//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e[" + i + "]/ns1:result[1]/ns1:type[1]" )
  currentScore = holder.getNodeValue( "//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e[" + i + "]/ns1:result[1]/ns1:score[1]" )
  typeSize = typeList.size()
  for ( y = 0; y < typeSize; y++ ){
    if ( typeList[ y ].contains( currentType ) ){
      index = y
      found = true
      break
    }
  }
  if ( found ){
    previous = typeList[ index ]
    assert previous[ 1 ] >= currentScore
    found = false
  }
  else
  {
    typeList.add( [ currentType, currentScore ] )
  }
}




The Universal SLA Assertion (makes managing sla assertion values a one-stop-shop)

def sla_time_taken = messageExchange.getTimeTaken();
def sla_time = context.expand( '${#Project#sla_time}' ).toInteger();

assert sla_time_taken < sla_time;




Header Information Assertion

def headers = messageExchange.getResponseHeaders();
def map_key = context.expand( '${#Project#map_key}' );
def map_val = context.expand( '${#Project#map_val}' );

assert headers.get(map_key).toString() == map_val;




Verifying Order of Response Elements by Element Value Assertion

import com.eviware.soapui.support.XmlHolder;

def bo_host = context.expand( '${#Project#project_host}' );
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = groovyUtils.getXmlHolder( messageExchange.responseContentAsXml );
def nodeCount = holder["count(//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e)"];
def expectedCount = context.expand( '${#Project#expected_return_count}' );

nodeCount = nodeCount.toInteger();
assert nodeCount == expectedCount;
previousPlayCountValue = holder.getNodeValue( "//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e[1]/ns1:result[1]/ns1:track[1]/ns1:playcounts[1]" ).toInteger();

for( int i = 2; i <= nodeCount; ++i ){
    currentPlayCountValue = holder.getNodeValue( "//ns1:Response[1]/ns1:search[1]/ns1:results[1]/ns1:e[$i]/ns1:result[1]/ns1:track[1]/ns1:playcounts[1]" ).toInteger();
    assert previousPlayCountValue >= currentPlayCountValue;
    previousPlayCountValue = currentPlayCountValue;
}




Gregorian Date String Builder

def gCalendar = new GregorianCalendar();
def returnString = null;

gCalendar.timeInMillis = System.currentTimeMillis();

return gCalendar.get(Calendar.YEAR) + "-" +\
    gCalendar.get(Calendar.MONTH) + "-" + ( gCalendar.get(Calendar.DATE) - 1 ) +\
    " " + gCalendar.get(Calendar.HOUR_OF_DAY) + ":" + gCalendar.get(Calendar.MINUTE) +\
    ":" + gCalendar.get(Calendar.SECOND);



Random Non-Repeating IDs String Builder

def standard_count = context.expand( '${Properties#standard_count}' ).toInteger();
def track_range = context.expand( '${Properties#track_range}' ).toInteger();
def generator = new Random();
def random_int = generator.nextInt( track_range );
def random_int_string, return_string = random_int.toString();
def jump_string = "";

for ( i = 1; i < standard_count; i++ ) {
    if ( ! return_string.contains( jump_string ) && return_string != "" && random_int < track_range ) {
        return_string = return_string + ", " + jump_string;
    }
    else {
        i--;
    }
    random_int = generator.nextInt(track_range);
    jump_string = random_int.toString();
}

return return_string;




Reversing IDs String Builder

def original = context.expand( '${Properties#tracks}' );
def tokens = original.tokenize(", ");
def size = tokens.size();
def newValue = "";

newValue = tokens[ 0 ];
tokens.remove( 0 );
for ( current in tokens ) {
    if ( current != null && current != "" ) {
        newValue = newValue + ", " + current;
    }
}

return newValue;




Shuffle IDs String Builder

def original = context.expand( '${Properties#tracks}' );
def tokens = original.tokenize(", ");
def size = tokens.size() - 1;
def newValue = "";
def generator = new Random();

if ( size > 0 ) {
    int r = generator.nextInt(size) + 1;
    newValue = tokens[r];
    for ( i in 1..size ) {
        r = generator.nextInt(size + 1);
        newValue = newValue + ", " + tokens[r];
        tokens.remove(r);
        size = tokens.size() - 1;
    }
}
else {
    newValue = original;
}

return newValue;




Response Elements Values String Builder

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = groovyUtils.getXmlHolder( context.expand( '${Publish Playlist#ResponseAsXml}' ));
def nodeValue = holder.getNodeValue( "//ns1:Response[1]/ns1:warning[1]/ns1:fail_to_add[1]/ns1:e[1]/text()" );
def i = 1;

return_string = context.expand( '${Properties#blacklisted_track_ids}' );

while ( nodeValue != null ) {
    if ( ! return_string.contains( nodeValue ) ) {
        return_string = return_string + ", " + nodeValue;
    }
    i++;
    nodeValue = holder.getNodeValue( "//ns1:Response[1]/ns1:warning[1]/ns1:fail_to_add[1]/ns1:e[" + i.toString() + "]/text()" );
}

return return_string;




Random Hex String Builder

def generator = new Random();
def r = generator.nextDouble();

return Double.toHexString(r)[4..16];




Random Characters String Builder

def generator = new Random();
def count = ( context.expand( '${Search Properties#search_string_length}' ).toInteger() );
def r = generator.nextInt( count +1 ) +1;
def token_string = Long.toString( Math.abs(generator.nextLong() ), 36);

return token_string.getAt( 1..count );

Thursday, January 27, 2011

Rooting and ROM'ing your Droid X 2.2.1 (version 2.3....Verizon.en.US)


**I am not responsible for any damage to your phone.  Rooting and ROM'ing your phone isn't too difficult, but has the potential of bricking it.  There are plenty of web sites dedicated to un-bricking your phone, but my blog isn't one of them.**


For those of you who have just purchased your new Verizon Droid X, you probably notice that there are a handful of junk / partner apps that you cannot uninstall or stop from starting and restarting. They eat up resources and slow down your phone. Thanks Verizon, for all your shitty apps!!


Let's get started.

First and foremost, you will need to root your phone.
- 1 Install an APK manager / installer
--- 1a I used "Apk manager" from the Market
- 2 Set your phone to allow unknown source
--- 2a Settings --> Applications (enable the checkbox for Unknown sources)
- 3 Set your phone to enable USB Debugging
--- 3a Settings --> Applications --> Development --> (enable the checkbox for USB debugging)
- 4 Download and install a rooting application
--- 4a Plug your phone into your Windows PC (make sure you can browse your droid files)
--- 4b I used z4root to root my phone.  Download it.
--- 4c Copy the z4root*.apk to your phone
--- 4d Unplug your phone from your PC
--- 4e Launch Apk manager and install Z4root (com.z4mod.z4root)
- 5 Root your phone
--- 5a Launch z4root
--- 5b From Superuser Request page, enable remember checkbox
--- 5c Hit Allow button
--- 5d From z4mod page, hit permanent root
--- 5e WAIT!!! (your phone will reboot when done)
- 6 You are now rooted!

Next, you'll want to choose a ROM. Here's a decent explanation of the different ROMs.


Finally, let's lay down a new ROM!  (I chose to use rubiXfocused1.9.7)
- 1 Plug your phone back into your PC (make sure you can browse your droid files)
- 2 Copy your ROM image (don't unzip it) to your driod
- 3 Unplug your phone from your PC
- 4 Install a ROM Manager App from the Market (I used the free version of ROM Manager)
- 5 Launch ROM Manager
--- 5a Hit Flash ClockworkMod Recovery
- 6 Install a Bootstrap App from the Market (I used Droid X Bootstrapper - for $2 it's well worth it)
- 7 Launch Droid X Bootstrapper
--- 7a Hit Bootstrap Recovery (It will ask for superuser permissions - Hit allow)
--- 7b Hit Reboot Recovery
--- 7c WAIT!!!! Your phone will reboot
- 8 Your phone will boot into ClockworkMod Recovery
-*- 8a - (Optional) You can wipe your sdcard if you feel like it
--- 8b Using the volume buttons, scroll down to install zip from sdcard - hit the camera button to select
--- 8c Scroll down to choose zip from sdcard and hit the camera button
--- 8d Browse / scroll to wherever you put your ROM zip and hit the camera button
--- 8c Scroll down to Yes - Install and hit the camera button
--- 8d WAIT!!!! Your phone will apply the new ROM
--- 8e Once completed, scroll up to reboot now and hit the camera button
YOU ARE DONE!!!

While I was walking a buddy through this process, his phone got itself into a reboot loop.  Here's the solution to that.  You will have to go through the registration process and re-sync your phone with google.

- 1 Pull the battery and then replace it
- 2 Hold the power button AND the home button, until the droid guy shows up with a ! triagle
- 3 Hit the search button
- 4 Scroll down to wipe data/factory reset and hit the camera button
--- 4a Scroll down to Yes -- delete all user data
--- 4b WAIT!!!!! Your phone will return to the first screen
- 5 Select (if it's not already selected) reboot system now and hit the camera button
- 6 Go through the registration process for re-syncing your google account

Questions or comments, ping me.

Wednesday, August 25, 2010

When partman-lvm Sucks Your Taint (with teeth)

While installing ubuntu lucid, I ran into an error with LVM.  I couldn't make an LVG and the partitioning portion of the installer failed and said to view the error message(s) in /var/log/syslog

If you see the below, be filled with joy.  There is a simple solution.

partman-lvm:   Incorrect metadata area header checksum

If you are seeing this behavior and this error in your /var/log/messages, perform the following:

dd if=/dev/zero of=/dev/xxxxx

For me this is what I needed to do:

dd if=/dev/zero of=/dev/sda; dd if=/dev/zero of=/dev/sdb

Then you need to rediscover the drive(s)

Enjoy and continue putting your taint on partman-lvm's face