.htaccess – all you ever wanted to know

For me, this has always been frustrating because I use it only once every 8-12 months. Here are some great links to get refreshed.

Basically, what I was trying to do was get all traffic https going to my customers’ mywebsite.com/payments page and all other traffic without “/payments” in the name to mymainwebsite.com. It is important to note, that the myshorturl.ca site is the one with the https or SSL on it. Here are the links I used

The eventual code form my .htaccess file was

[php]

#RewriteCond {HTTPS} on
#RewriteRule ^(.*)$ https://www.myshorturl.ca/payments/$1

#RewriteCond %{HTTPS} on
#RewriteRule .* https://www.myshorturl.ca/payments [R,L]

RewriteCond %{REQUEST_URI} /tithe [NC]
RewriteRule ^(.*)$ https://www.myshorturl.ca/payments/ [L,R=301]

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /payments [NC]
RewriteRule ^(.*)$ https://www.mycumbersomeurl.ca/payments/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www.mycumbersomeurl.com$ [NC]
RewriteRule ^(.*)$ http://www.mycumbersomeurl.com/$1 [L,R=301]

[/php]

Curve Fitting, c# and Math.Net

http://numerics.mathdotnet.com/docs/Regression.html

Some explanation about their regression formulas … and bingo – instant genius created (me). Thanks guys – it was really you all. Oh, and my first MVC project – that is a step forward even if it is only MVC 4.

jQuery Bar and Line Charts alongside Twitter Bootstrap for MVC 4 . Another friend recommended D3js to me for charting

I am currently trying these steps (free-er)

  1. Update VS 2012
  2. Install Nuget Package Manager (was already done)
  3. Git Tools
  4. Web Essentials (but first install this) – cannot be installed on VS 2012 express

Ok – so try this website where he installs Bootstrap on MVC 4 on VS 2012 Express

 

A really good example of scripting the InternetExplorer.Application with downloads

Here is someone who wanted to automate downloads with consistency as seems to have achieved it. It has some SendKeys in it so it is not autonomous – but is a great example of getting it done no matter what. Well done. I am looking for code to see if a machine is alive in < 5 seconds. If not, alert the user to wait. It has an Http Basic Authentication popup that I am trying to get through using tools natively installed on Windows. Of course Curl can do it but that requires all users installing it which is not acceptable for this use.  I need 4 concepts from this article. Here is the msdn on InternetExplorer.Application.

http://www.vbaexpress.com/forum/showthread.php?42206-IE-Automation-File-Open-IE8-IE9 

My code if it was a userform username / password would be like this. Basically you can’t easily unless the registry value is changed specifically allowing the username/password to be sent along in the url. Here is an idea that no one validating has having worked and is in powershell. People did get it working using SendKeys – which I do NOT want. Curl it is! This stuff is not good to post online, but alas, explains why one should NOT store their passwords on any browser.

Adding jQuery to ANY page via local browser – greasemonkey

Here are lots of links on how to find out what to use

http://stackoverflow.com/questions/2283134/how-can-you-implement-a-jquery-feature-without-having-ie-prompt-users-with-an-ac

Settled in on greasemonkey for Firefox.

http://stackoverflow.com/questions/11569293/what-browser-plugin-that-lets-you-override-html-of-a-website-automatically
http://en.wikipedia.org/wiki/Greasemonkey
http://stackoverflow.com/questions/859024/how-can-i-use-jquery-in-greasemonkey

Debugging – can’t get this working with the latest versions of things.  Another Link and I have given up with Firebug or Web Developer Tools.

suggest loading local js file (does not work – so again – forget local debugging!!) 

Blocked Content warning in Firefox – simply press the shield in the upper left corner of the url.

Storing vars across pages

VBA inheritance and interfaces – can it be done?

First, my head hurts at then end of this so this post will be short until I can back to it and digest this stuff. Can VBA implement an interface like c#, cocoa or java? I have been using this stuff without really “getting it”. Now that we have a very smart individual who started with my client as a programmer (I am an engineer) he is bending my head a lot and really helping me see things from his perspective. Thanks man! So – now that I am using VBA … I could use some of this esteric ideas … or can I. This article is well written but I have to go home now.

http://stackoverflow.com/questions/19881863/how-to-use-comparison-methods-between-class-object-modules-in-vba-in-a-similar-m/19908375#19908375

Singleton classes in VBA

 

Excel to XML to avoid direct OPENROWSOURCE SQL data connection to Excel

The company I am currently solving issues for will not accept Excel as a table data source. This I know, so therefore a really really great report cannot go on the live system. So I have been beating my head on how to get around the politics – good politics because Excel is a breakable table (which is why they won’t/don’t like it). But … how do we move forward AND satisfy IT? Well, an interim solution would be to use XML as the SQL Server data source and then build a url driven Service to extract data from Excel into this XML data source. So … links to get started you ask?

Can life get easier? What will the world be like in 10 years. This took me 5 minutes to see if we could do it. Now it is an interim solution because Excel is still the data source, but all we have to do now is replace Excel with an official app on the web in the near future – but to do this properly requires many many weeks of development, whereas a service – either works or doesn’t and only requires unit tests, not people to test is my simplistic view on this.

VBA to … export VBA modules for archiving or other

Neat. http://www.cpearson.com/Excel/VBE.aspx  Now I can export the modules for text version control  (so we can see the changes). AND use it to standardize all the code between little small projects to ensure that all the good ideas from one period in time can be compared to other projects done in an earlier time.

For instance, lets say we made a great “look for header” routine 4 months ago. Today, the header row is not fixed to row 1 any longer. If we make a new routine that is a little more generic – it needs to have a different name but if we backdate all the other routines, then the idea is better for all projects. The tools in the above link give us all we need to get this completed. … and the code above works – with few changes.

Finding most likely Excel A1 cell to place text blocks in

So, I had some manually entered non-tables in an AutoCAD document that I needed to get to an Excel format. Non tables literally refers to tables made by placing text in a rectangular x,y fashion. So these were Bentley ISO’s that the machine makes a material take off in the upper right corner. Not knowing that the future held in terms of the number of columns – this turned out to be a “get all x values and make a histogram of buckets x millimeters wide”. This is basically how communications determines wireless signals in quadrature (x/y plane). Since humans can enter text boxes alongside the machine – what is the best guess for the grid?

We could use some col math like the Verterbi algorithm – but that is a little too complicated. Basically making a histogram and determininig the best row and column was the best approach. Unlike wireless communication theory – the bucket widths are completely known w.r.t. to each drawing that we process AND the number of columns are unknown. What is known is that within a drawing – there are a consistent number of rows and columns.

It worked by the way.

Some links.

  • http://stackoverflow.com/questions/8979752/how-to-count-number-of-peaks-in-graph-graph-analysis
  • Verterbi algorithm: http://en.wikipedia.org/wiki/Viterbi_algorithm