Design, photography and ramblings

Month: March 2015

Firefox 36 – CSS and image blur bug

I am trying to create an image editor using the ‘transform: matrix’ and ‘filter’ CSS properties. The ‘transform: matrix’ works fine if the ‘filter’ CSS property is not used, but as soon as I apply the ‘filter’ property the image begins to blur. I need to be able to set the image height.

Below is some html code to see how the same image blurs with different CSS configurations (images one and three are blurred, the second has proper sharpness). In some cases it is very subtle but there is definitely a change in image sharpness. It just seems the ‘transform: matrix’ and ‘filter’ properties do not play well together in this case.

    <img height="300" src="" style="filter:brightness(100%);transform: matrix(2, 0, 0, 2, 26.25, 0);"/>
<img height="300" src="" style="transform: matrix(2, 0, 0, 2, 26.25, 0);"/>
    <img src="" style="filter:brightness(100%);transform: matrix(2, 0, 0, 2, 26.25, 45.3125);height:300px;"/>

This see how this code behaves in Firefox, copy the code above and paste into the body of this online editor at W3Schools.

A bug report was submitted to Mozilla.

A reason for local file access in HTML pages

Web browsers are great for rapid application development.  Using PHP, HMTL5, and any number of new technologies widely used and documented online you are able to quickly prototype applications.  However one area of development where it gets tricky is when you are trying to load local files into your HTML pages.  Maybe you are creating a web application that needs to load locally stored images, videos, or sound files because of bandwidth constraints or file storage restrictions.

I recently faced this issue where my application needed to load images into a simple Javascript/CSS image viewer.  The image were stored locally on the user computer (via a USB drive or other local storage) because of the shear number and size of the files.  However new security restrictions in web browsers block local file access by default.  To get around this I used a new version of Firefox portable with HTML5 enabled so I could configure the browser and then distribute it to my users with custom settings and plugins.  The next step was to install the NoScript plugin and checked the ‘Options/Advanced/Trusted/Allow local links’ option which gets around the issue of allowing locally stored files to load into the web browser pages.  NOTE: if you are doing this for a web application you might want to configure NoScript to disallow access to other sites other than your web application for security reasons.

I was then able to view locally stored images in my web browser application referencing the files like so:

<img class="someClass" src="file:///H:/localImageStorageDir/image_342.jpg"/>

SQL Server database to SAS

The other day I was trying to migrate data from SQL Server to SAS.  The first thing I had to do was generate an insert/update SQL script from my production database so I could place the data in a local SQL Server instance with ODBC access to SAS.

The first issue I had was running the SQL query (backup from production) to create and populate the database on my local server.   For some reason I had to change my command to the following:

sqlcmd -S [server instance name] -i [location of the sql file on my network drive] -d [database to 'use'the sql script on]

So that code looked like:

sqlcmd -S MySQLServerInstanceName -i C:\mydirectory\sqlbackup.sql -d dbFromProd

Also I found the best way to generate the SQL query from production was to set the ‘Script USE DATABASE’ option to false so I could specify the USE [database name] when executing the SQL on my local machine like so (note that I used !! in the sqlcmd statement due to the fact that I executed this statement from within SQL Management Studio with the Query/SQLCMD Mode enabled):

USE [database name]
!!sqlcmd -S MySQLServerInstanceName -i C:\mydirectory\sqlbackup.sql -d dbFromProd

With my production database now on my local database and an SQL Server ODBC connection created to the local copy of my database, I wanted to see that SAS could actually connect to the ODBC connection and see the tables in my database using this code:

*SAS code to check tables SAS is able to see;

proc contents data=mydblib._ALL_ nods; run;

The first thing I noticed was not all of the tables in the database were showing up for my dbo schema, although SQL Server Managerment Studio was telling me otherwise just looking at the tables.  However the following SQL code told me that the schema indeed was not assigned to all of the tables:

USE prod_db_copy

I then found a script to assign all of the database tables to my schema (the question mark must mean ‘for the selected table in the foreach loop’:

USE [database name]
exec sp_MSforeachtable "ALTER SCHEMA [dbo or other schema you want to use] TRANSFER ?"

I then returned to my SAS code and to find out if it was able to see all of the tables…and it still was unable to see them.  I went back to look at my ODBC connection and the problem lay in not checking the ‘Change default database to’ and selecting the database I wanted.  After doing this I was able to see all of the database tables in SAS with no problem.

Follow this website

Get every new post delivered right to your inbox.