Sunday, 15 December 2019

Browser Slow Down May Have a Windows Cause

By Strictly-Software

Yesterday if you read my blog article about Firefox and Chrome slowing me down as if I was being dragged through mud by a 3 legged donkey, then you will know that I was blaming the browsers and their settings for the slow down.

However when I could take no more, of browser windows hanging and then seemingly Windows applications not opening when I clicked the desktop icon which I have never had before I thought it must be a virus or some sort of app slowing me down however virus scans with Windows Defender and MalwareBytes AntiMalware showed nothing at all.

I was trying to open applications like Open Office only to see the process in the task manager running as a background process. It was not up the top under Apps, but just sat there forever under background processes.

I also had 100% Disk usage with no singular app or process looking like it was causing it. I also had high memory and CPU usage. So I thought what I had done lately. I went to Programs and Features to see which applications had been updates or loaded recently. Skype was there, like it is today, and I removed it as I can no longer use it with Windows 8.1r.

There was also Spotify which I hardly ever use so I uninstalled that as well. However it was after this I started getting the problems.

So I went to System Restore Points and noticed a Critical Windows Update had been carried out on the 11th of this month. I ticked the box to show all restore points and chose the Automatic Restore Point before the update.

I did a system restore to that date which was 2 days before the Windows Update and after an hour I had my PC back and working. It was much faster and the browsers were fast as well, both Chrome and Firefox.

However I will not take away the points I made yesterday about over complicating the options and issues for privacy and security which seem far too over the top for the average user to understand.

So when I was finished with what I was doing I went to shut the laptop off and did the Windows Update again. This time it seems to not have slowed everything down. The Critical Update has been done and I have a much faster laptop. For example just look at the Task Manager, which for the same apps, with the same tabs open was showing 100% DISK usage and high Memory and CPU usage, with programs running in the background not as open Apps.

However I am not holding my breath as it seems that all these browsers and other apps like Rapport (banking crud software), seems to be slowing the laptop down.

I think it is time I do a proper search of the computer, remove apps I don't use, run Chkdsk -f (from the command prompt), and see if a particular browser is causing me issues.


At the moment I have 5% CPU, 40% Memory 3% Disk usage (Not the 100% I was seeing all the time).

I have no ideas what the Windows Update did to screw this up and when I look at programs recently installed I only see Google Chrome as having updated itself today. Firefox is set to auto update so I will wait to see what happens when the latest version comes in as I am currently on version 70, and yesterday I was on version 71. Since Chrome updated however the CPU and Disk Usage also started to spike again.


I have decided to uninstall Chrome and just use Firefox and since doing so my disk usage is running at 1%. I have no idea what Chrome could be doing to cause these memory leaks and disk usage. I did notice in their settings under advanced the other day an option to look for "malware" that could be slowing your computer down. I reckon it is more to do with all the holes that let PUPs and other files that keep popping up after a scan in the Chrome Roaming folder that they are looking for.

However it in not uncommon for people to have issues after Windows Updates. User Profiles going missing causing you to think you have lost all your apps and other weird things. Having to do restore points seems drastic but at the moment I am happy as my apps are all running and the task manager is showing good stats. However I still think Firefox's security and privacy options are too much for the average user and some of them even confused me as their was no explanation. So read that article if you can.
I think these auto updates behind the scenes can cause major slowdowns and they should all be optional. If I have a version of Chrome that is running fast, not causing major CPU, Memory or Disk usage then I should be able to keep it. I don't want some new buggy install being rolled out and then a fix for that buggy version rolled out later.

As I said earlier IE only brings a new version of IE out once every couple of years. I cannot really see the need for 70+ versions of Chrome or Firefox unless they contain bugs and future version are to fix them.


By Strictly-Software

© 2019 Strictly-Software

Thursday, 12 December 2019

Browsers New Automatic Settings Slowing Site Loads Down

Blocking All Social Media Cookies and Trackers Seems To Be Slowing Down Chrome and FireFox

By Strictly-Software

I have had recent automatic updates for Firefox and Chrome to versions

Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0

and 

Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36

How these two have got to versions nearing 80 so quickly is funny, when IE just rolls out a new version of it's browser every year or so not every time I try and open Firefox from my taskbar.

However these updates seem to contain some important settings, some may have been around for a while which I just haven't noticed. However it is the slowness of these browsers compared to Opera, that uses a proxy server in it's pretend VPN, so you are actually going through 2 servers to your site compared to the other browsers, that is doing my head in.

I liked Firefox, and Chrome when it first came out for their speed, and add-ons. However either my laptop is either deciding to slow down these 2 browsers for some reason and let Opera hop before loading a faster page or something else is going on.

My version of Opera with this "VPN" is:

Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 OPR/65.0.3467.62

When I open it, it is faster than both Chrome and FireFox despite their VPN which when I check with a geo location website shows I have these details instead of my real ones:
  • Your Public IPv6 is: 2001:67c:2660:425:7::dfa
  • Your IPv4 is: 77.111.247.105
  • Location: Amsterdam, NH NL 
  • ISP: Hern Labs AB
I notice they have removed the word Opera and replaced it with OPR now, also nearing it's 70th edition. So not only does it protect my privacy a bit it is faster than Chrome and FireFox at the moment for me.

So today after upgrades to both Chrome (manual due to it's insane slowness) and an automatic update for FireFox that took almost 20 minutes, I noticed major slowdowns.

Chrome seems to always be showing a "resolving host" message in the status bar and loading in remote scripts from the big 3 spyware social networks, Twitter, Facebook and Google.

Of course site builders have put these outbound scripts into their code as they want people to Like, Follow and Tweet whatever crap they are selling and you may like seeing a Twitter scroller on the blog you are following and the ability to share the page to Facebook.

However I watched a video on www.darkpolitricks.com the other night about how many #alttnews sites are moving their videos from YouTube to BitShute. YouTube is broken and Google is an evil company. And it seems they are indeed.

It is all about how these niche news outlets had created YouTube making it the biggest video sharing site online, and although the company claims they are only 1% of all videos watched they still feel the need to de-rank these alternative views and put "authoritative sources" above your searches in their algorithm tweaks. These tweaks were all admitted by a Google employee who described getting those Up Ticks and Likes as a "drug" that ensures people continue with their outpourings of every thing they do in life on Social Media.

Yes we do want to see where Jane is having lunch, who with, where the cafe is located and then everything else she does that day as we follow her goings about on Facebook and Instagram.Well you may want to but I don't. However to do so you need to load in Facebook scripts from their servers.

However it seems if you delve into the privacy and security settings for Firefox you get to see that their default setting is to stop tracking cookies from cross site and social media trackers which obviously means if you are loading a 3rd party script from another location you could see as I did today on one site the "trying to connect to t.co" message appear dozens of times as the page tried to load. All the while the page was hung and unusable.

You can go into the FireFox settings and change your settings under Privacy and Security. The heading is...

Browser Privacy

Enhanced Tracking Protection

Trackers follow you around online to collect information about your browsing habits and interests. Firefox blocks many of these trackers and other malicious scripts.

The default setting will block Social media trackers, Cross-site tracking cookies, Tracking content in Private Windows and Cryptominers.

Obviously the latter few are definitely required but let me know if you have noticed a slow down with the standard setting that supposedly is "Balanced for protection and performance. Pages will load normally.", as they may load normally but they seem very slow to load, and off server scripts like Twitter and Facebook are attempted multiple times before a page is usable.

What happened to just loading the core code first to let the page be usable and load any off server scripts by Ajax in the background. It seems too many sites now use pure JavaScript and Ajax to load the content, probably to prevent content scraper BOTS however it does mean a lot of code has to run and be loaded before the page is usable. Have you had a look at the source HTML of www.google.com lately?

Apart from some META tags after the HTML tag the whole source is JavaScript and probably Ajax to load in the content for what is really nothing more than a white page with a different image every now and then above a text input box for searching.

The links to your Google account and Gmail in the top right corner are just that links. We could shorten the load time and the code to a few lines of HTML in reality. I really think Google have gone overboard with their API Jizz all across their systems as their need to stop scrapers has just caused slow loading pages it seems.

Would you like all 3rd party scripts and cookies blocked, or would you like the site to work and load quickly? It seems a dilemma these browsers are making over complicated especially for non techies who wouldn't know half the words in Firefox's Privacy and Security settings.

The difference between Standard which says "Balanced for protection and security. Pages will load normally" and Strict which says "Stronger protection, but may cause some sites or content to break" seems to only be the addition of:
  • Tracking content in all windows - rather than standard mode which only blocks "Tracking content in Private Windows" and
  • Fingerprinters (blocking Browser finger printing, logging your add-ons, window size and other ways to identify you from just your browser)
They don't actually explain what a fingerprinter is, and to the average user they would be scratching their head thinking about their latest Samsung phone and the ability to login using your fingerprint. However these two extra blocks seem to be deadly for a working website as they state underneath :
Heads up! Blocking trackers could impact the functionality of some sites. Reload a page with trackers to load all content.
So god knows how someone is supposed to manage the 3rd option which is a custom way of blocking things you don't understand or know why they would break a site.

Of course they have a number of complicated Knowledge Base articles  for you to read and get your head round to try and understand whether they need to use Private Windows for browsing all the time, and why the prevention of loading certain features is going to stop your site loading.

Of course Firefox has a "simple way" to help you understand what is going on by just clicking on the shield in the address bar you can change the mode of protection on or off. 

You can view this site with "Enhanced Tracking Protection is OFF for this site" or ON and if you don't know what the difference is they have helpful little graphs that tell you about their Enhanced Tracking Protection, how many trackers they have blocked over the week and ways to look for data breaches. All very interesting but not very helpful information.

They helpfully clarify the situation by saying "Social networks place trackers on other websites to follow what you do, see, and watch online. This allows social media companies to learn more about you beyond what you share on your social media profiles."

Of course you could just disable 3rd party cookies and JavaScript by default with a web developer toolbar and see if the page loads or not. If it doesn't work turn on JavaScript and try again before white listing the site so it can use JavaScript again.

It seems that as Windows in numptifying the front end of their latest operating systems and making it harder for developers to dig in and get into the back end like Windows 8.1r which I still have - now without Skype support - the browsers are offering their users far too many options they probably don't understand or need to know about.

What I want from a browser is for websites to load quickly, any 3rd party hosted widgets like Facebook or Twitter widgets to load in asynchronously and not prevent the working of the site. I want the browser to do the dirty stuff behind the scenes and I don't want 100's of options to play about with. They should block dangerous content, warn users about dangerous sites and stop anything that may have a dangerous effect on my browsing or privacy.

Yes - Ask me if I want to load this soon to be outdated flash movie or allow notifications but don't give me too much to tweak about with.

The speed of loading a site is the most important factor for most users and also affects the sites SEO. If they want to give us an option for being as private as possible or allowing tracking cookies then just have a single option "Privacy HIGH or OFF" option, and then use their own browsing logic to work out if a page won't load instead of offering the user a whole list of options to try out if a page doesn't load.

What is wrong with just keeping incognito windows that are private as possible, don't allow trackers or fingerprinting and the logging of pages visited with a clear out of cookies automatically when I leave?

It just seems that as Chrome enters the laptop world with it's Chromebooks, that as Operating Systems continually ask for your admin password in Windows 10+ when opening an application. Hiding all the nitty gritty that really slows your PC down behind automated "maintenance jobs". That browsers are trying to become their own little PC within a PC.

Just give me fast loading pages and if I want to hide what I am doing from sites and other users of my laptop then make the incognito windows as private as possible. Stop trackers, fingerprinting, 3rd party cookies, and anything else you are now making a "choice" for the user under the settings.

It is bad enough that as everyone moves to HTTPS we see the TLS handshake message in the taskbar constantly which is obviously slowing down the loading of pages and their content, especially if it's mixed.

Just give me a fast browser. I thought using FireFox today would speed things up as Chrome is just getting unusable and as everyone realises they are actually evil, I don't want to help Google pass on my data from their browser or search engines and analytics trackers to advertisers and god knows who else.

From now on Opera with its extra server hop is going to be my standard browser. The "VPN" offers enough privacy and whilst some pages won't remember certain settings due to my location changing the browser is fast.

Anyone find their settings too complicated nowadays and the speed an issue?


By Strictly-Software

© 2019 Strictly-Software

 

Saturday, 11 May 2019

Getting SQL Server Information

Using TSQ to obtain MS SQL Server Information

By Strictly-Software

In the years gone by when we had relational database systems that worked across MS SQL Versions such as our DEV, DEMO and LIVE databases we sometimes needed to do a check to see what the Version of the server was before running the appropriate code.

Our DEV server might be pretty old compared to our LIVE server and code that would run on SQL 2005 wouldn't on 2000.

An example would be if the Server needed to know whether it could use a CTE and temporary view to return hierarchical information or whether it had to use a more basic stack style temporary table version.

For example the stored proc we would call on any server would be:

EXEC dbo.usp_get_workers_heriarchy

-- inside the stored proc we would have a function wrapped around the @@version code that would just return 2000,2005,2008,2012 etc
DECLARE @SQLVERSION INT
SELECT @SQLVERSION = dbo.udf_GET_SQL_VERSION(@@VERSION) -- returns 2000 or 2012

IF @SQLVERSION > 2005
  BEGIN
        -- use a more modern CTE and temporary view
        EXEC dbo.usp_SQL_GET_WORKERS_CTE_VERSION
  END
ELSE -- handle everything under 2005 when CTE's and temporary views came out
  BEGIN
        -- use old stack method for adjency 
        EXEC dbo.usp_SQL_GET_WORKERS_STACK_VERSION
  END

So if the dbo.udf_GET_SQL_VERSION(@@VERSION) returned 2005, 2008, 2012, 2015 then it would use the most modern type of TSQL to handle returning a hierarchy whilst anything below that would use a stack version.

We would have to build this code up on an SQL system that handled CTES otherwise trying to save the stored procedure and the CTE would just cause invalid SQL errors as it wouldn't recognise the code.

So we built it on an SQL 2005+ machine and then had no problems as all calls were made from the front end by stored procedures and any machine over 2005 would handle a CTE or Stack response.

In the old days when we only had @@VERSION with very little text to parse it was pretty simple to just extract the SQL version from the return string, e.g remove 'Microsoft SQL Server ' or look for the first number after the word Server and LTRIM(RTRIM(@Version)) it to get 2005 such as this example piece of code which would have been used in the UDF dbo.udf_GET_SQL_VERSION in the example above.

DECLARE @Version varchar(30)
SELECT @Version = @@VERSION -- Microsoft SQL Server 2012 (RTM) - 14.0.1000.169 (X64)
SELECT @Version = REPLACE(@VERSION,'Microsoft SQL Server ','')
SELECT @Version = LEFT(@Version,4) -- to get just 2012 not the (RTM) - 14.0.1000.169 (X64)
SELECT @Version = CAST(@Version as INT) -- return as an integer
RETURN @Version -- e.g 2012

Now we have even more information in the @@VERSION system variable. For example now if you call @@VERSION on a later edition you will get.

SELECT  @@version
Microsoft SQL Server 2012 - 11.0.2100.60 (X64) 
	Feb 10 2012 19:39:15 
	Copyright (c) Microsoft Corporation
	Web Edition (64-bit) on Windows NT 6.2  (Build 9200: ) <x64>

Which as you can see contains much more information than the old @@VERSION which just returned the bare basics of the server. Now we get the build version, the Edition type and Build details.

To access this information you can now use the SERVERPROPERTY function calls to get detailed information from the @@VERSION data but on it's own e.g

SELECT  SERVERPROPERTY ('productversion')
SELECT  SERVERPROPERTY ('productlevel')
SELECT	SERVERPROPERTY ('edition')

Which returns....

11.0.2100.60
RTM
Web Edition (64-bit)

Two other interesting functions are:

SELECT	SERVERPROPERTY ('InstanceDefaultDataPath')
SELECT	SERVERPROPERTY ('InstanceDefaultLogPath')
Which return the paths of your default data and log files locations for the current SQL Server instance e.g

C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\
C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\

So as we can see using a branch off @@VERSION on any old code you may have lying about may need editing and if you are automating things such as data beign moved and paths being created you can see hopw the DefaultDataPath and DefaultLogPath variables maybe of use. We all live and learn and the world of SQL keeps turning ensuring jobs for people to fix old code!

By Strictly-Software

Friday, 15 February 2019

Do You Want Multiple Wickr Accounts?

How to get another Wickr Account To Work

By Strictly-Software

If you are like me you might have an Android phone with Wickr the encrypted chat app installed on it.

However if you have been blocked by someone, locked out, forgotten your password or just want another Wickr account it's not easy as Wickr is tied to your Google account and device and if you try and install it from Google Play Store on a different device it will just say "Already Installed". 

You have to either remove the app from your phone and start again or use a different phone with a different Google Account linked to it as Google Play always knows what devices you have installed and which apps are on it.

I tried the obvious route first, use an Android Emulator such as NOX, and then created a new Google Account and Email address and then went to the PlayStore to download Wickr. The only thing was the link was broken and it kept sending me to an error page.

I tried downloading the APK file from a site I searched for Wickr Download APK, but even after installing it, it got to the 99% of "encrypting your device" e.g my NOX Emulator on Windows 8.1, and just hung forever.

Therefore I couldn't get the emulator to work. I could have installed another one but whats the point of slowing down a PC with multiple Android emulators just to watch free TV from Navisport etc?

Therefore I actually did a search for "Download Wickr For Windows 8.1" and all I got were help articles telling me to download further emulators and then install from Google Play. This was obviously a no go.

Therefore I actually tried the following which did work on Windows 8.1 from this link.



The Windows 10 link is the first one on the left. The rest are APK, Mac and IOS files.

To install on a Windows 8.1 machine do the following, without the need for an Android Emulator.
  1. Create a new Google Account, username, password, add it to the 12 you already have.
  2. Log out of any Google account you might be in e.g especially if you are using Chrome.
  3. Go to this link https://pro-download.wickr.com/#/version/pro
  4. Select "Windows - For use with Windows 10"  and download the application.
  5. Install the MSI file called WickrMe-5.4.3.msi.
  6. It may take a while but it should start to install, even on Windows 8.1.
  7. Once installed, create a new Wickr account and username.
  8. Find your old contacts and start chatting from your laptop or PC.

It works for me, so it should work for you, don't spend hours trying to getting your emulator to install an APK file that just hangs. Try the Windows 10 Desktop MSI file first.


By Strictly-Software

Wednesday, 23 January 2019

SQL Regular Expressions - Extracting Income From PayPal IPN Data

Extracting Payment Amounts From PayPal IPN Data Using SQL 

By Strictly-Software

Recently I had to come up with a way on one of my sites, www.fromthestables.com, to find the total amount of income received by certain members from their PayPal subscription information. 

This is all stored in an MS SQL Payments table along with the Member ID, the PayPal IPN data and Payment type e.g P for Payment, C for Cancelled, W for Waiting, E for EOT etc.

I also have a table of Member Subscriptions which stores details of every subscription they have ever had including their Member ID, a custom GUID to identify the subscription as they could have had multiple subscriptions. Also I store their PayPal Subscription ID and details of their Sign Up Date, Cancellation Date and Next Payment Date alongside other relevant information.

If you don't know about PayPal and how to make a payment system using their shopping cart or a custom payment system then you can read up about it on their site here.

However the main thing to know is that when payments are made, recurring subscriptions started or cancelled then PayPal will send your site an Instant Payment Notification (IPN) to a callback page for you to handle.

This IPN data is a long string of text including the payers name, email, address, recurring payment information such as the number of days payments are made, plus any custom values you may need for your site such as a unique identifier (GUID).

This is useful in website systems so that you can save the new member in a database table with an ID before they go off to PayPal. When they return to your site this information can be sent back to your IPN callback page so that you can analyse the IPN data and ensure it's a valid callback attempt by making a handshake with PayPals system. Once you know it's valid information you can link the callback and IPN data string to a member by matching their Member ID with the one you stored earlier in the database.

An example of an IPN string looks like the text below and contains all the information about an IPN. There are many types of IPN strings such as those that handle cancellations, waiting, EOT (End Of Term) etc but the one I am interested in that contains two bits of information I require is the Payment Notification. 

You can see the two pieces of information in the IPN text below as they are highlighted in blue and red. The start of the string contains one part and the other is halfway through the data.

mc_gross=30.00&protection_eligibility=Eligible&address_status=confirmed&payer_id=NW2XBXPZ6C78W&address_street=Some+Street&payment_date=13%3A27%3A02+Jan+17%2C+2019+PST&payment_status=Completed&charset=windows-1252&address_zip=D02TX83&first_name=Paul&mc_fee=1.37&address_country_code=IE&address_name=Paul+Hickey¬ify_version=3.9&subscr_id=I-PLD46W039GB&custom=%7B7CD66296-0664-4A51-9ACD-05FE46821D44%7D&payer_status=verified&business=rob%40somesite.com&address_country=Ireland&address_city=Dublin&verify_sign=AczUU94BLMilZ9uHs3gDJVFDFmnrAhoedso-UI.71KEbRJ9deMwoa8KS&payer_email=paulhickey1234%40hotmail.com&txn_id=91X75169EH810362V&payment_type=instant&last_name=Hickey&address_state=DUBLIN&receiver_email=rob%40somesite.com&payment_fee=&receiver_id=5Z7P6UFG56B3P&txn_type=subscr_payment&item_name=Strictly+Software&mc_currency=GBP&item_number=%7B24C686D0-BBF5-54B6-A1D6-215AP099CD43%7D&residence_country=IE&transaction_subject=Membership&payment_gross=&ipn_track_id=98d91af71234

As you can see the amount I want is in the first part is at the beginning of the string, just after mc_gross e.g mc_gross=30.00.

However due to legacy issues of the system and I also need to connect the users PayPal subscription ID to the one I store in the members subscription table.

This is highlighted further along in the string e.g subscr_id=I-PLD46W039GB.

An example of the CLR User Defined Function I use to allow for Regular Expression Replacements can be seen below. It is connected to a DLL that contains the C# code that runs the regular expression replacing, however that is another topic altogether. You just need to know the format of the parameters for the SQL I show you later on.

Personally I store this function in the MSDB system database so that all my databases on the server can utilise it for regular expression replacements.

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER FUNCTION [dbo].[udf_SQLRegExReplace](@Pattern [nvarchar](500), @MatchString [nvarchar](max), @ReplaceString [nvarchar](2000))
RETURNS [nvarchar](max) WITH EXECUTE AS CALLER
AS 
EXTERNAL NAME [asbl_SQLRegExpr].[UserDefinedFunctions].[RegExReplace]

The SQL code I use for totaling up all amounts for a certain member is below.

I use two embedded SQL UDF Replacement Functions to extract just the monetary amount and remove everything after it. I also use the same function to join the Subcriber ID in my table to the subscr_id value in the string. 

This involves using a sub-query that does the cleaning and replacing and returns the monetary value. Then an outer query uses that value and a SUM function to total all the values up.


SET ANSI_NULLS OFF
SELECT SUM(VAL) as Amount
FROM (
  SELECT CAST(msdb.dbo.udf_SQLRegExReplace('&.+?$',msdb.dbo.udf_SQLRegExReplace('^.*mc_gross=',PayPalDetails,''),'') as money) as val 
  --*
  FROM MEMBERS_PAYMENTS as p with (nolock) 
  JOIN MEMBER_SUBSCRIPTIONS as ms with (nolock) 
   ON ms.MemberFK = p.MemberFK
    AND ms.PaypalSubscriptionID = dbo.udf_SQLRegExReplace('&.+?$',dbo.udf_SQLRegExReplace('^.*subscr_id=',PayPalDetails,''),'')
    AND ms.MemberFK = 10342
  WHERE PaymentStatus = 'P'
 ) as t 
WHERE ISNUMERIC(t.VAL)=1

As you can see the SQL function calls are wrapped in an inner SQL statement so that it just returns payment values and then the outer SQL statement returns the SUM amount for a particular member ID value.

This is a good example of having to use SQL CLR Regular Expressions as well as the use of embedded functions to extract hard to get values from a long complicated string of data.

You could attempt to write the regular expression calls so that only one function call is made for the monetary amount and another one for the subscriber ID. However the IPN strings are not always similar in format and sometimes it is better for performance to break your regular expressions down into multiple replacement calls instead of writing a complicated expression to cover all possible formats.

Try it and see for yourself. See if you can re-write the query with one regular expression per extraction, and then compare the performance of the two queries with SQL Performance Monitor.

By Strictly-Software

© 2019 Stictly-Software

Thursday, 27 December 2018

Boggle - Online Game

Playing Boggle Online - A Game For XMAS In Pure JavaScript, CSS and HTML

By Strictly-Software

I made this online version of Boggle, the shake letters and make words from letters that join together as my Dad was learning JavaScript, HTML and CSS. So I made it purely in those languages.

You too can play the game if you want online on any up to date browser that is standard compliant and runs JavaScript on my site at https://www.strictly-software.com/games/boggle.html

The version I made uses a single Boggle object with a number of settings, properties and timers. I have split all the functions out into their own methods and added some features that let you edit the game such as:

-The time the game plays for. It defaults to 03:00 minutes but you can change it to any time in the 00:00 format.
-There is a drop down box with Easy, Medium and Hard for you to select. Each option has a different array of letters that are randomly picked for the game. You are more likely to get multiple X, Z and Qu's in the hard level than the easy one.
-There is an option to select the MAXIMUM red letters than appear in a game. It defaults to 3. You might not get 3 but you won't get over 3. You can change this to another numerical value up to 9. When you pick a word containing a red letter you get double points.
-There is a random tick box which means that the letters chosen for the game are purely picked at random from the alphabet array defined in the Boggle object.

If your browser is working (I have tested it on my TV, Laptop, Tablet and phone) then the countdown timer should turn from green to yellow after 90 seconds and then start flashing red during the last 30 seconds before beeping at the end.

If your TV doesn't do all this then it is down the the TV's browser. Test it online on a PC/Laptop first to ensure it all works.

We played a few games of it at Christmas and it worked perfectly.

It is an ideal way for someone learning HTML, JavaScript and CSS to understand the code, tweak it and learn about selectors, short cuts, regular expressions and so on.

It makes use of my lightweight framework which supports chaining, setting HTML, removing nodes callbacks, CSS selectors and much more

You can read about the Getme.js framework and how I made it here > http://blog.strictly-software.com/2009/10/build-your-own-framework.html.

I use SS instead of $ like jQuery and other frameworks and I am of the mindset that pure JavaScript should be used as much as possible. 

An example of chaining is joining multiple functions together with one initial selector to pick the array of nodes to work on.

SS("DIV .mycontrols input).setAtts({style:"color:black;"}).setHTML("Game Over!);

Where the node list (array) from the first selector is passed into the second function so that only those relevant nodes/elements are acted upon. Read the Getme.js article for more details.

All the files can be downloaded to your local machine to play offline and In Chrome to see the code in action go to More Tools > Developer Tools and open the Console in the bottom part of the screen.

Turn the debug variable in the Boggle.html file to true and you will see all the debug to help you understand which functions are being called and if any errors are shown they will appear in red. 

Play around and make the CSS, HTML different and add extra functions or features with JavaScript.


Enjoy the game, we did!

Wednesday, 28 November 2018

ShowBox Has Stopped Working - Getting Popcorn Time to install on a Kindle Fire Tablet

ShowBox Has Stopped Working! Get a replacement application onto your Kindle Fire or Tablet

By Strictly-Software

Showbox has stopped working.

Hopefully this is a temporary situation but as it provides great TV and Films I needed a replacement. This is how I got Popcorn Time onto my Kindle Fire, a tablet that didn't seem to want to take any .APK file from the web in the first place.

If you have a standard tablet then you should just be able to do a search for the Popcorn time APK and download and install the APK file on your tablet as long as you have turned on the ability to install applications from unsafe locations (e.g the web and not Playstore/Amazon store).

Remember to go to Settings -> Security -> Install Unknown Apps and enable whilst trying to install from a website.

If you want an easy way you can just go to the website https://watch.popcorntime-online.tv and then you can select films or TV shows and watch them directly on your laptop.

If you have a Chromecast you can stream the content to a TV that its plugged into OR if you have a WiFi enabled TV you should be able to select the TV of your choice.

Another way would just be to connect your laptop to your TV with an HDMI cable and get the picture that way. However I wanted the application on my Kindle Fire as its easy to hold and I can take it from room to room and stream it from that device to the main TV or bedroom TV or just watch it on the tablet.

If you want to use a tablet try using the USB cable and connect it to your laptop first and see if it shows as an external device. If it does then just copy the Popcorn APK file across and install it.

I tried this but the Kindle didn't show up despite updating drivers. However try this before the FTP steps below.

Full Requirements for these steps to work...
-A Wifi enabled TV or Chromecast that can handle streamed content
-Kindle Fire or another tablet
-ES File Explorer application working on your tablet (download from PlayStore or web)
-TOR Browser (download from Google to get around blocked sites)
-FileZilla FTP App (or another FTP app - free to download

So to get Popcorn TV onto my Kindle I had to do the following steps...
1. Use TOR Browser and go to https://popcorn-time.en.uptodown.com/android/download (other sites I checked wanted payment for download or had dead links)
2. Download the file to your laptop/PC and remember the location
3. Open the ES File Explorer on Kindle/tablet
4. Go to Remote Manager
5. Press the "Turn ON" button
6. You will be given a local IP address for viewing your tablets files by FTP e.g ftp://192.168.1.125:3725. If you enter that into a web browser you should see the contents of your Kindle however to transfer the downloaded file I used FileZilla a free FTP app for transferring files.
-Open Filezilla and select "New Site"
-Enter the IP address and port number into the boxes
-Chose FTP Plain Insecure
-Chose Anonymous login
-Select the Transfer Settings tab and ensure "Passive" is selected
-Hit connect and as long as the "TURN ON" button is still enabled on your Kindle/Tablet in ES FIle Explorer you should get to see your tablets Hard Drive
-You can then copy the popcorn-time-3-2-2.apk file from the file you downloaded it to on your computer to the downloads folder on your Kindle/Tablet.
-Select the Download folder in ES File Explorer once copied and select "Install"
-It should install the APK
-You can then open it, select a file and hit the Cast button to stream it to your TV or ChromeCast
-I had to open the app a couple of times at first as it was a bit shaky but it is now playing a movie on my TV okay.

Hope this helps people out ....

© 2018 Strictly-Software

Latest Cheap Amazon Goods