Thursday, August 28, 2014

Argh! - How to force firefox to open new tabs in the background.

One of my favorite NewsBlur keyboard shortcuts is the 'o' key which opens the story in a new tab.
However, I would rather it open the story in a background tab and allow me to continue processing the story previews in the news feed.
In Chrome this works great by default, but with Firefox it took me a while to find out how to get this working. 
Thanks to a quick google search and a great lifehacker post I found the solution which worked great.
http://lifehacker.com/263940/force-links-to-open-in-the-background

The solution is to open about:config in the url bar.
Then double click the following setting: browser.tabs.loadDivertedInBackground

This should toggle the setting to true.


Enjoy!

Friday, April 4, 2014

Wordpress ecommerce-product-catalog colorbox - how to set the maxHeight property

In the template files, open the content-al_product.php file.
Edit line 22 from this: jQuery(".a-product-image").colorbox({transition: 'elastic', initialWidth: 200});

Change it to this: jQuery(".a-product-image").colorbox({transition: 'elastic', initialWidth: 200, scalePhotos: true, maxHeight: '95%'});

Really needed this and hope it will help someone else.


Tuesday, January 28, 2014

960 grid

Although I don't do a lot of web design, occasionally I work on a few pages, mostly non-public web pages and web apps. 
I have never used a grid for layout of a site, but found myself building a data entry form and attempting to build the css for a small grid from scratch. After taking a break I thought, hey why reinvent the wheel and searched the internet for css grids and found the 960.gs site. 
Which led me to this great tool: http://grids.heroku.com/
I ended up using a column width of 80, with 12 columns and a gutter width of 10 for the project. 
This site made it incredibly easy to download the css code and get the form up and running. 

Friday, January 24, 2014

Dahua IPC-HFW4300S setting up IPVision or IP Cam Viewer on IOS

After trying for way to long to get the IP Vision app on IOS to work with my new Dahua IPC-HFW4300S I finally gave up and went to bed knowing I had one last option.  (Blue Iris)
Well, I got it working with a couple of settings, but the bottom half of the video would "wig-out" every few seconds. It helped to change the video analysis setting to slow, but still not good enough to be happy about it. I also used IP Cam Viewer and selected the Dahua camera and it worked, but still it wasn't great either as it would sometimes time out or take a really long time to load compared to my other cameras (some of which are at remote locations).
Anyway, after spending the day at work and once the kids were in bed I got a chance to play with it again.
I am setting up a couple of these for a client soon and needed to get them working with IP Vision for iPhone viewing and with Blue Iris for video management and recording.
So I fired up Blue Iris, added a new camera and put the ip address into the settings. I clicked the "Inspect ONVIF etc" button. This is awesome, it discovered the settings and showed me the connection string which I used in IP Vision to connect successfully.


Here is a screenshot of the settings I used.

I also included this screenshot to show the settings after scrolling to the bottom of the page.
Sometimes the video resize "Aspect R" option is better than "Fit".

To use the main stream I used the following path which Blue Iris discovered:
/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
And just change the subtype=0 to "subtype=1" to get the Sub Stream instead.

In nearly complete darkness this is the image from the Main Stream.

And here is the Sub Stream Image.

Below are the camera settings I am using.
My intention is to use the Sub Stream for accessing the video from IOS devices for checking on general presence of the facility. And I will use the Main Stream for sending to Blue Iris.
Of course Blue Iris struggled with the 8K bit rate, so I dropped it down to 4K and even 2K and had great results.
I'm not sure how big of a difference the 3M Resolution setting has over the lower resolutions as I have not been able to test this yet in an area with good lighting, and as you can see from the images above at night it makes a difference, but the 384bps wasn't that far off from the 8Kbps image.
I imagine that during the day in good lighting conditions the 3Megapixel option will shine.

Thursday, January 9, 2014

Wednesday, January 8, 2014

Responsive Video Plugin for Wordpress.




For a new web site i am building which needed a few video files included, I initially tried using the video.js plugin which I have used on lots of projects. And with a little searching I even found a wordpress plugin for it. 

But the videos would drift off the page on smaller viewport sizes and mobile devices. I fought with it to be responsive, but didn't have any luck. Anyway, I realized that Wordpress version 3.6 and up are supposed to have built in support for responsive video short codes using mediaelement.js so I switched over to that instead. 

However, the jednotka holobest theme I am using breaks the responsiveness of both of these plugins. However, I found a simpler plugin for using YouTube which ended up working great. 



Thanks a million wptuts! 

http://wp.tutsplus.com/tutorials/plugins/creating-a-shortcode-for-responsive-video/



I have also used FitVids.js recently, but didn't realize there was a wordpress plugin for FitVids until I was writing this post and noticed the comments on the wptuts post.

This is even easier than the wptutsplus version.


  1. Install FitVids for Wordpress Version 2.1
  2. Activate it.
  3. Under the Wordpress Appearance menu click the FitVids Options page.
  4. Enter the jQuery selector that you will use for your videos. 
  5. Create the html code for the page and embedded youtube / vimeo video. (see below)
<div class="FitVids" style="margin: auto; width: 80%;">
  <iframe width="420" height="315" src="//www.youtube.com/embed/O56p5nOYNHo" frameborder="0" allowfullscreen></iframe>
</div>

I grab the embed code from the share link on youtube.
Wow, that was easy. 

Google Calendar add recurring events for months that have 5 sundays.



I recall trying to do this a few years back and ended up with some very difficult method of doing this. 
So I figured I would write a post on how to do it, turns out that it is much easier now. 
Simply use the calendar quick add option and the following example text: 
Example Meeting every fifth sunday from 5pm to 6pm
 This will create the event on your calendar.

Tuesday, January 7, 2014

Arduino Gemma USB Drivers for Windows

So I decided to learn about the world of micro controllers, arduino and electronics for a project I am trying to build later this month. In the process of doing so I have learned a lot from the adafruit.com website.
I started with an Adafruit Gemma and struggled for a few hours to get the drivers to load.
I tried both my Windows 7 64bit computer as well as my Windows XP machine.
The win7 box really struggled to install the driver it would only recognize it as "Unknown Device".
I finally found some posts that suggested using the hdwwiz.exe to manually install the driver.
I'm not exactly sure what solved the problem, but I ended up manually installing three separate drivers.
I reboot a few times as well.
At this point it worked, then started failing again about every other time I would reboot the gemma.
I finally discovered by accident that the gemma seemed to be stable if I unplugged my microsoft USB mouse.
Maybe some sort of conflict there.
In the meantime, I also tried getting the WinXP machine to recognize the usb drivers, it would load it as a trinket, and after a reboot and again installing the driver a second time it installed the usbtinyisp device into device manager.
However this one refused to work with the Arduino IDE.
I would only get the avrdude expected 4, got -5 errors and the verification error mentioned in the gemma getting started tutorial.
I found this post: http://www.adafruit.com/forums/viewtopic.php?f=52&t=45541
And after changing the avrdude.conf file chip_erase_delay setting from 9000000 to 4000000 and replacing the avrdude.exe file with the 11513 version from the above post it started working.
I get the TRINKET BOOTLOADER SELECTED message, but otherwise this works.
I hope this helps others out there.

Tuesday, October 15, 2013

SNMPv3 error Perl Net::SNMP - Time synchronization failed during discovery - Powerware ConnectUPS-MS with firmware version HF

SNMPv3 error Perl Net::SNMP - Time synchronization failed during discovery - Powerware ConnectUPS-MS with firmware version HF
The Net::SNMP module uses the procedure outline in Section 4 of RFC 3414 to perform discovery.
It seems that the Eaton Powerware ConnectUPS-MS NIC running version HF firmware does not enforce timeliness checking and is not responding with a usmStatsNotInTimeWindows Report-PDU during the discovery process.
You can work around this by editing the lib/Net/SNMP.pm and removing the '($this->{_error} =~ /usmStatsNotInTimeWindows/)' part of the if statement.

See the reference to this information here also: http://cpanforum.com/threads/11146

Friday, September 13, 2013

Not an IT post, but still useful. Rock Wall Install

This is the second time I have installed a rock wall in our house. And
not that I am looking forward to doing it again, but just in case I
ever need to find the products we used or if this helps someone else I
wanted to document some of the tips here.
First of all, the Type S mortar is fine for doing this, and it is
cheap, but if you really want an excellent product get this FlexBond
Mortar from Home Depot. It is very expensive, but I absolutely love
it. It is so much more sticky and cleaner to work with. Still make
sure you have a sponge nearby to clean off any drips or excess
mortar. We also used lots of Qtips and paper towels for clearing out
the tiny hard to reach places.
The other tip we learned from the first time is how this Deft Clear
Wood Finish hides and scratches, (we didn't clean off the drips very
well, and tried brushing it off with a hard bristle brush). Well, the
Deft hid the scratches very well and really brought the colors to
life.
One coat was plenty. See the before and after pictures.

Tuesday, April 2, 2013

Updated Wireless Client Tracking

Some of the comments in my older post about RRDTool Wireless Graphing asked for detailed graph creation code. Below is what I use for generating three types of graphs. 1. A single record graph. 2. An Access Point graph with multiple clients displayed. 3. A composite graph that includes all the access points the client has associated to.
First, I query our wireless controller and save an RRD database for each client/ap association. I use an HTML and perl based web page for the user interface. I also save the records to a database in order to query for the most recent records. I use datatables to display the records. And some jqueryui buttons to limit the search filtering.
When the user clicks a row in datatables, the script below processes the request and creates the graphs. The other graphs besides daily are hidden by default, but a click of the button will swap the images. Also, using daterangepicker the user can select a specific range of dates.
Here is an example of the results. This gives us a nice visual of clients moving from one access point to another.
print "Content-type:text/html\n\n";
use Win32::ODBC;
use CGI;
use CGI::Carp qw( fatalsToBrowser );
use CGI qw/:standard/;
use RRDs;

my $GraphType = param('GraphType');
my $ApName = param('ApName');
my $ClientMac = param('ClientMac');
#print "
GraphType: $GraphType"; #print "
ApName: $ApName"; #print "
ClientMac: $ClientMac"; my $dateRange=param('dateRange'); #print $dateRange; my $startDate; my $endDate; my $image_path='../../Charts'; my $web_image_path='/Charts'; my $stats_path='../../Stats'; my $stats_file="2gwlan_".$ClientMac."_".$ApName.".rrd"; my $random_number=time(); my $AreaColor = '54EC48'; my $LineColor = '24BC14'; my @DEF; my $counter = 0; if ($dateRange=~/^$/) { & create_def; & daily; & weekly; & monthly; & yearly; } else { if ($dateRange=~/(\d\d)\-(\d\d)\-(\d\d\d\d)\s\-\s(\d\d)\-(\d\d)\-(\d\d\d\d)/) { $startDate = "$3$1$2"; $endDate = "$6$4$5"; } elsif ($dateRange=~/^(\d\d)\-(\d\d)\-(\d\d\d\d)$/) { $endDate = "$3$1$2"; my $year = $3; my $month = $1; my $day = $2; use Date::Calc qw(Add_Delta_Days); ($year, $month, $day) = Add_Delta_Days($year, $month, $day, -1); $month = "0$month" if $month < 10; $day = "0$day" if $day < 10; $startDate = "$year$month$day"; #print "SD:$startDate"; } & create_def; & custom; } ############## create_def ################ sub create_def { my $query; if ($GraphType=~/Record/) { #Get Single Record & save_def; } else { if ($GraphType=~/Client/) { #Get top 6 most recent client records $query = "SELECT * FROM ClientDetails WHERE ClientMac LIKE '%$ClientMac%' ORDER BY modified DESC"; } elsif ($GraphType=~/AP/) { #Get top 6 most recent AP records $query = "SELECT * FROM ClientDetails WHERE ApName LIKE '%$ApName%' ORDER BY modified DESC"; } my($find_record_db) = new Win32::ODBC('DB') || die "Error connecting:" .Win32::ODBC::Error(); $find_record_db->Sql("$query"); while ($find_record_db->FetchRow()) { my(%data) = $find_record_db->DataHash(); $ApName = $data{'ApName'}; $ClientMac = $data{'ClientMac'}; $stats_file="2gwlan_".$ClientMac."_".$ApName.".rrd"; & save_def; last if $counter == 7; } } } ##################################### ############## save_def ################ sub save_def { $AreaColor = "54EC48" if $counter == 0; $LineColor = "24BC14" if $counter == 0; $AreaColor = "EA644A" if $counter == 1; $LineColor = "CC3118" if $counter == 1; $AreaColor = "DE48EC" if $counter == 2; $LineColor = "B415C7" if $counter == 2; $AreaColor = "7648EC" if $counter == 3; $LineColor = "4D18E4" if $counter == 3; $AreaColor = "ECD748" if $counter == 4; $LineColor = "C9B215" if $counter == 4; $AreaColor = "48C4EC" if $counter == 5; $LineColor = "1598C3" if $counter == 5; $AreaColor = "EC9D48" if $counter == 6; $LineColor = "CC7016" if $counter == 6; push (@DEF,"DEF:DS$counter=$stats_path/$stats_file:snr:AVERAGE:step=300"); push (@DEF,"AREA:DS$counter#$AreaColor:") if $GraphType!~/AP/; push (@DEF,"LINE2:DS$counter#$LineColor:$ApName $ClientMac \\t"); push (@DEF,"GPRINT:DS$counter:LAST:Last\\: %1.lf"); push (@DEF,"GPRINT:DS$counter:MIN:Min\\: %1.lf"); push (@DEF,"GPRINT:DS$counter:MAX:Max\\: %1.lf"); push (@DEF,"GPRINT:DS$counter:AVERAGE:Avg\\: %1.lf\\n"); $counter++; } ##################################### ############## daily ################ sub daily { $graphlength="-24 hours"; RRDs::graph ("$image_path/my_2gwlan_stats_daily_graph.png", "-s $graphlength", "-t 24 Hour Wireless Stats", "-v SNR", "--height=250", "--width=800", "--slope-mode", @DEF, ); if ($ERROR = RRDs::error) {print "$0: unable to generate graph: $ERROR\n";} print "
"; } ################################################# ############## weekly ################ sub weekly { $graphlength="-168 hours"; RRDs::graph ("$image_path/my_2gwlan_stats_weekly_graph.png", "-s $graphlength", "-t Weekly Wireless Stats", "-v SNR", "--height=250", "--width=800", "--slope-mode", @DEF, ); if ($ERROR = RRDs::error) {print "$0: unable to generate graph: $ERROR\n";} print "
"; } ################################################# ############## monthly ################ sub monthly { $graphlength="-720 hours"; RRDs::graph ("$image_path/my_2gwlan_stats_monthly_graph.png", "-s $graphlength", "-t Monthly Wireless Stats", "-v SNR", "--height=250", "--width=800", "--slope-mode", @DEF, ); if ($ERROR = RRDs::error) {print "$0: unable to generate graph: $ERROR\n";} print "
"; } ################################################# ############## yearly ################ sub yearly { $graphlength="-8760 hours"; RRDs::graph ("$image_path/my_2gwlan_stats_yearly_graph.png", "-s $graphlength", "-t Yearly Wireless Stats", "-v SNR", "--height=250", "--width=800", "--slope-mode", @DEF, ); if ($ERROR = RRDs::error) {print "$0: unable to generate graph: $ERROR\n";} print "
"; } ################################################# ############## custom ################ sub custom { RRDs::graph ("$image_path/my_2gwlan_stats_custom_graph.png", #"-s 20110819", #"-e 20110822", "-s $startDate", "-e $endDate", "-t $startDate - $endDate Wireless Stats", "-v SNR", "--height=250", "--width=800", "--slope-mode", @DEF, ); if ($ERROR = RRDs::error) {print "$0: unable to generate graph: $ERROR\n";} print "
"; } #################################################

Thursday, March 21, 2013

Tomato VPN and OpenVPN client cannot connect to LAN server using hostname

I have been trying to figure out how to allow an application to connect using the hostname. 
The application works fine on the LAN, but when the user goes to a remote location and uses the OpenVPN GUI client to connect to the network the hostname no longer works. 
If I edit the hosts file and add an entry for example: 10.10.10.10 servername 
Then I can get to servername just fine, however I didn't want to edit the hosts file on all workstations. 
So in looking for another answer, I went into the Basic menu in tomato and the Identification menu. 
In the Domain Name field it was blank, I made up some random domain name and saved the settings. 
I thought I would have to use the fully qualified domain name to connect. (ie: servername.my.private.lan) But after reconnecting to the VPN I was simply able to use the hostname. (ie: servername) to connect and the application now works fine. 



Tuesday, February 26, 2013

Tomato E1000 Firmware issues

I have been deploying tomato shibby firmware version 1.04 for use in
various client offices with wireless disabled, so I had not noticed
these issues. I also, haven't experienced the same reliability that I
have with polar tomato, or tomato raf that I run on many different
networks with linksys e2000, wrt54gl, and wrt610n routers.
I noticed severe slowness on Internet speedtest sites using tomato
shibby 1.04. I tried upgrading to 1.06, but it would not install.
1.05 resulted in being unable to access the GUI page after changing
the admin settings. Using the reset button allowed me to get back in
and after a number of attempts I upgraded the firmware to the tomato
toastman version shown below.
1.28.0501
This version worked well, but seems to have the same problem as 1.04
with wan speeds.
Under advanced wireless settings, if it is set to WMM enabled then I
get fast speeds between LAN and wifi devices. Like 35Mbps as shown in
the wifiperf screenshot.
However wan speedtest is about 0.03 Mbps download.
If I disable the WMM, I get wan speeds of 22 Mbps on my Comcast 25M
connection, but LAN speeds drop to around 15Mbps.
So this is the setting I am using for now.
I'm not sure what else to try in order to improve this.
In researching things I noticed the linksys e1200 and e1500 and e1550
models are in the $25 - $60 range and there is now tomato raf support
for these devices. I'm off to order one of these to test for future
deployments.

Friday, November 9, 2012

Ubiquiti AirCam save snapshots to web page and refresh every 30 seconds

I am running firmware version 1.1.5 on the Ubiquiti (UBNT) AirCam.
First open an ssh session to the AirCam using putty or another ssh client.
Login using the username and password.
Enter the following line:

mkdir /etc/persistent/www ; ln -s /tmp/snap.jpeg /etc/persistent/www/logo.gif ; save

The image should display. 

Here is the code I am using for the web page
<div id="AirCam" class="LiveImg">
<img src="http://192.168.1.63/images/logo.gif" alt="" class="photo">
</div>

<script type="text/javascript">
setInterval(function(){
$("#AirCam img").attr("src", "http://192.168.1.63/images/logo.gif?timestamp=" + new Date().getTime());
},30000);
    </script>

Another option is on the UBNT forums: 


Tuesday, October 23, 2012

Use WMIC to get logged in user from remote computer

The Command:

C:\>WMIC /NODE:’Hostname' ComputerSystem Get Username,Name

The Results:

Name           UserName

Hostname  Domain\User.Name

 

The node can be the DNS name, or IP Address, also a list can be used as well.

I would have really liked to use this command to query thousands of nodes, however through experimentation the tool seemed to crash after 30 or 40 hosts.

I tried the /FAILFAST:ON and /FAILFAST:50 options with some improvements, but nothing solid.

Please comment if you have used this tool successfully for a large list of nodes.

Thanks!