Why I must work this morning

War

On my way back from walking Rowan to school this morning I opened up my pocket list and read a post that I had been meaning to read for a week or so.
It was by Sgt. Eric Williams of the U.S. Army. He wrote a blog post days before he was due to return to the U.S. from Afghanistan.

Unfortunately Sgt. Williams was killed on his way back to his home country. His post however serves as a reminder to all of what many of us feel after we have been to war. I remember coming back to the U.K. after my first tour of Iraq and thinking “Look at everybody. They are just carrying on as if nothing is happening. The live in a world of green countryside, friendly people and comparative  wealth and many think that they have it bad. They just haven’t got a clue”.

It is a sad fact that many veterans like Sgt. Williams and myself feel a barrier is now between themselves and civilian society. They can never understand what it is like to witness war first hand. Even now I am not able to watch the news on TV (thank you ISIS you Pricks!), I have an appointment with my Doctor in a few weeks to discuss my deteriorating mental condition (as well as my recovery following back surgery (but this is secondary)).

As a follow up to my initial post Living with PTSD I now plan on a follow up post on the things that Sgt Williams raised.

Please read his post at http://myfriendthemedic.blogspot.co.uk/2012/07/coming-home.html and it will give you an insight worded better than I could put into words.

So why do I need to work this morning?

I love my job. Unfortunately I haven’t had much work in lately. I had to take quite a bit of time off in the run up to my operation as it got to the point where I couldn’t guarantee that I would be able to work x amount of hours. This meant that I had plenty of time to work on my skills and am now a much better coder because of it. It also means that I effectively had to start freelance again as the limited client base that I did have now have nothing for me as yet.

My job gives me a great deal of satisfaction and the project that I am doing gives me a great sense of pride; and so I continue plodding along with my cup of tea in front of me; my classical music playing to keep my mood level whilst I write about subjects that normally affect me emotionally.

If I don’t work this morning I will sit back and dwell on Sgt. William’s post. Instead. I shall be working and enjoying myself knee deep in the wonderful life of web development.

Right…that’s it for now. Everybody get back to work and stop using me as an excuse 😉
If you did manage to get this far though; well done and thank you 🙂

Find string in Files

Web Development

Well tonight I was supposed to be pulling the new project to bits that I’m working on but I ran into a problem – let me explain.

Every time I have wanted to find some text in a directory I’ve had to either search the internet or my bash history for the right command. With this in mind I thought I may as well take a little time to create a function that would just search for the string that I want. After all while I’m learning the layout etc of this project I’m going to need it. Not knowing where all the files are as yet and what they all do it’s going to be a lot easier to run the function and see what files the string turns up in.

The function to put in your ~/.bashrc or similar file

function find-string() {

# re-iterate what we're looking for
echo 'looking for "'$1'"'

# perform a search on all files
find ./ -xdev -type f -print0 | \

# process each file through the grep,
# --colour=always = always show the coloured version
# --ignore-case = search is not case-sesitive
# --line-number = show the line numbers after the filename
# --context=1 = this will print 1 line both above and below the line where the string occurs
# "${1}" = finally search for the passed variable
xargs -0 grep --colour=always --ignore-case --line-number --context=1 "${1}" | \

# replace each tab with 2 spaces to cut down on the amount of indentation in
# the search results from files with large areas of indentation
sed -re 's/\t/ /g'

}

And to get it up and running just run

source ~/.bashrc
to enable your system to see the function and then when you want to use it you can simply enter something like:
find-string viewer-thumbnails-wrapper
find-string being the function and in this case we are searching for file containing viewer-thumbnails-wrapper which will bring results like these:
Looking for "viewer-thumbnails-wrapper"
./css/viewer.css-418-/* Thumbnails */
./css/viewer.css:419:.viewer-thumbnails-wrapper{
./css/viewer.css-420- background: #FFF;
--
./js/mediagallery.js-61- min_thumbs: 5,
./js/mediagallery.js:62: thumbwrapper: 'div.viewer-thumbnails-wrapper',
./js/mediagallery.js-63- btn_thumbs_show: 'a.viewer-thumbs',

Ok, that’s it, if you can make use of the this function then go ahead and copy and paste.”
Enjoy!

if there’s any help I can offer then let me know in the comments section below.