Wednesday, August 24, 2016

Telerik and Webforms: Trimming Paste on a RadComboBox

I had an issue with being able to trim incoming text into a radcombobox.  The code below is really simple but it took me a bit to figure out.  I'm stuck not using the latest release of Telerik's ASP.Net webform controls so maybe there is a different way to do this with later versions, but this worked for me.


I'm plugging into the RadComboBox's OnClientItemsRequesting by setting it to "MyItemsRequesting"

  function MyItemsRequesting(s, e) {  
     var txt = e.get_text();  
     if (txt != txt.trim()) {  
      e.set_cancel(true);  
      var d = document.getElementById("mymasternamepageifany" + "_mydropdownid_Input");  
      if (d != null) d.value = txt.trim();  
      s.requestItems(txt.trim(), false);  
     }  
   /* more code */  
  }  



Tuesday, August 02, 2016

Free FTP Program WinSCP

I've used the command line, File Explorer FTP, Smart FTP, Filezilla, and now have settled on the free WinSCP program for FTP type stuff.  It supports ftps and other formats and seems to work pretty well. It is also automatable but I haven't played with that yet.

Check it [HERE].

Visual Studio Image Library

Remember that pack of icons in Visual Studio 2010 that you could use in your projects?  I noticed them missing in Visual Studio 2015.  Apparently in order to save space Microsoft now has them as a download now.  

You can download these icons [HERE].

Thursday, June 30, 2016

Importing Access Tables into Sqlite

There are numerous ways to do this, this is how I did it.
  1. Download LibreOffice.
  2. Use Base to open your access .mdb database
  3. Right click on the table, click copy.
  4. Open Calc, create a new spread sheet, control V to paste in data that is in memory from when you right clicked copy on the table in Base.
  5. Export your new spread sheet in CVS format (I left all the default options).
  6. Open your SQLite DB (I use the SQLite Manager Plugin for Firefox to Manage SQLite DBs).
  7. Import the CSV file (again I left all the defaults except I did click use the first row as a header).
  8. Once imported, you can tweak the headers.  If the datatypes are slightly off, you might have to create a new table how you like it and then select into that table from the newly created imported table.
This was good for a simple table with about 30000 records.  Your mileage may very.  Happy coding.

Friday, May 06, 2016

Disable Codelense for Faster Visual Studio Performance (Visual Studio 2013+)

My work computer is an older machine that comes to an absolute crawl when opening up Visual Studio 2015.  One thing I did today to speed things up is to disable Codelense.

What is Codelense?  It is that new feature where if you are working in a team environment when you open up code you can see who created various pieces of code and how many modifies have happened to it and by who, plus probably other stats I'm unaware of. All fine and good but at the cost of a lot of performance I don't want it.

To disable Codelense-

Tools->Options->Text Editor->All Languages->Codelense.

Why Codelense is under Text Editor and all languages doesn't make a lot of sense to me but whatever.

This might help speed things up for you.  Happy coding.

More here-

https://stackoverflow.com/questions/20457796/how-to-turn-off-codelens-references

Tuesday, April 19, 2016

Crappy Hardware Not Worth It

OK, so for work I have the latest and greatest laptop...

Well, it was 5 years ago.

My work insist on buying "corporate" grade laptops that cost thousands of dollars.  The CIO gets the newest once a year or two, and then those of use who are remote get the hand-me-downs.  I'm about on the third wrung down.

I noticed something.  My home laptop, which is the latest and greatest ASUS light weight gaming laptop of course :)  boots up including entering my login in under 10 seconds.  From there I'm ready to go.

On my current hand-me-down work computer it is taking me from initial startup to actually having Visual Studio and a few other things up about 5 minutes.

So, for an argument for me at least a "consumer" grade gaming computer that rocks for about 1000 bucks-

Say I lose 2.5 minutes of productivity a day with booting my work laptop up and opening up software which is being generous (Visual Studio 2015 sometimes takes 2 or 3 minutes to boot).  So I'm not going to tell you how much I make but let's use a 50 dollar an hour figure.   Let's also take a 48 week work year.

48 Weeks x 5 Days a Week x 2.5 minutes = 10 hours a year of wasted productivity time x $50 and hour = $500 bucks.

Now considering corporations can right off hardware purchases as a business expense that is the equivalent of about $600 of buying power.  So that gives my company about $1200 worth of purchasing power for getting me a new laptop every two years.  And I would be totally happy with a "consumer" gaming machine (which has plenty of power and reliability) over a "corporate grade" block that cost 2x more.

My last "consumer" grade machine which at the time I also used for work because I didn't want the hand-me-downs ran flawlessly for about 14 hours a day 6 days a week for over 3 years while my co-workers "corporate" laptops tended to have issues.

Note, I haven't brought this up at work yet or cried about it there, but I might.  

So there is some ammo you can use for someone to justify getting a new machine.

Thursday, April 07, 2016

Common Free Software Packages I Use

Not too long ago I had to install all my apps on a new windows laptop.  In doing so I made a list of windows applications that I commonly use that are free or essentially free.  I hope it is useful.

  • Winamp - the old stand by for playing MP3 files.  
  • irfanview - another old stand by for image viewing and quick manipulation
  • e-sword.net - I'm a Christian, this is a great Bible / Bible study free package.  MySword on Android is good as well.
  • Virtual Clone Drive - Why burn an ISO to a DVD to use it if you don't have to?
  • 7-Zip (or Winzip) - Extends your base OS zip and unzip functionality to support more file types (like RAR files)
  • Libre Office - Decent enough, why pay for office if you don't have to?
  • Paint.Net - It ain't Photoshop but it will do in a pinch and it is free.
  • Visual Studio Community Edition - Essentially a full version of Visual Studio for free.  
  • SQLite Manager Extension for Firefox - using SQLite more and more for more and more things.  This extension for Firefox is kinda like SQL Manager for Sqlite.  There might be better ones but this one works great for me.
  • Notepad++ - I usually just use notepad but sometimes I like editing by column and Notepad++ supports that, also has great syntax highlighting support.
  • CC Cleaner - Keeps your Windows registry clean
  • Macrium Reflect - Need to clone a drive hassle free?  This is your beast.
  • Blender - For a little 3D fun
  • K-Lite Mega Code Pack - To make sure I can play videos from my phone.
  • Freemind - Mind mapping software.
  • CDBurnerXP - Free CD and DVD burner (not sure about Blue Ray support)
  • VLC Media Player - Free DVD and other format watcher
Maybe one day I'll come back and link to all these programs but you people are smart and can copy/paste into a google search like the rest of us.  Maybe there is one or two on the list you haven't heard of or had forgotten about.  Know of any that you think should be included on this list?  Add them to the comments.


Monday, March 07, 2016

Great Piece Disk Cloning of Software: Macrium Reflect

I got a new laptop and needed to clone a drive.  I saw reports saying that older Samsung drive software doesn't work with the new mk 2 SSD drives.  So I read a few recommendations for Macrium Reflect and gave it a whirl.

I cloned my 7200 RPM drive to my new SSD (including copying some hidden partitions just to be safe).  Went to the bios, changed to the boot order, and the SSD booted right up.  Took about 45 minutes.  I didn't have to hassle with boot sector / partial re-install of Windows 10 either.

Highly recommended piece of software.  I just used the free version, but the other versions can do all sorts of things like backup restores, imaging, and get this...into dissimilar hardware.

Check it here-

http://www.macrium.com/reflectfree.aspx

Friday, October 16, 2015

Windows 10 WiFi Issue

Problem:  You go to a coffee shop or other wifi network that's password changes often.  You try to log on, but the password has changed.  There is no new place to enter the password.  

Solution: Turn WiFi off.  Go to Advanced Settings.  Click Manage pre-existing networks.  Find the network that you wish to connect to.  Click on it. Then click forget.  Go back and turn wi-fi back on.  Connect, it will now ask you for a password.


Thursday, August 13, 2015

5 Plus CSS Tech Bits

Some CSS tech bits from around the web-

  1. Localizing Dates in Javascript CSS-Tricks
  2. Quantity CSS Queries Demo http://quantityqueries.com/ via CSS-Tricks
  3. Image Scroll Snap Points Team Tree House via CSS-Tricks
  4. 12 Obscure CSS Facts Site Point via CSS-Tricks
  5. CSS Only Dropdowns With The Checkbox Hack tutorialzine
  6. Dragula: Simple Drag and Drop Dragula via Webdesigner Depot




Monday, May 11, 2015

Debugging Old ASMX Web Services - The "Cannot Create Type XXX" Error

So I had to upgrade an old web service from a Visual Studio 2008 project to a Visual Studio 2012 project.  When I went to do a build on my local machine I kept getting the "Cannot create type xxx" error on my asmx web service.

Ultimately, after playing around and researching, the fix is this.  The webservice is looking for the dll files in the bin directory.  The problem is if you are debugging the web service on your local machine the dll's will be outputted to either the bin\debug or the bin\release folders.  You need to grab those dll's and move them up on to just the bin folder, and at least for me the error went away.

Happy Coding.

Friday, February 20, 2015

BrowserLink and Why Is My Page So Slow?

In Visual Studio 2013 Microsoft added a new feature called "Browser Link". I was running some razor web pages that had almost nothing to them and they were taking a lot longer to load then they should have. So I hit F12 in the browser and analyzed the network traffic, and low and behold I noticed 3 or 4 additional gets going back to IIS, including one websocket call, that I never added. The culprit?  Browser Link.

I'm not sure what Browser Link does, but here is how to disable it.  My page load times went back from 1.56 seconds to .02 seconds.

[Disable Browser Link]

Happy Speedier Coding.

Friday, February 06, 2015

Some Web Dev Bits and Pieces 2

Performance Optimization in ASP.NET Web Sites
A decent article describing some site enhancing performance tips.

Getting Start With Node.JS Tools For Visual Studio
An introduction to Node JS tooling for Visual Studio and a few Node tips.

Integrating AngularJS with Azure Active Directory Services and Office 365/SharePoint, Part 4
Adding AAD and OWIN code to handle user authentication (can be used for other things beyond Sharepoint).

Azure VM Blues: Fighting a losing Performance Battle
Datamine this article to find Azure performance tips and learn how to avoid some Azure pit falls.

Composing Synchronous and Asynchronous Functions in JavaScript
Learn about Javascript Async functions and some use scenarios.

Thursday, January 15, 2015

Some Tech Tidbits

How do I render CSS data-attribute values properly with Razor in .Net MVC or Web Pages?
http://merrickchaffer.blogspot.com/2015/01/how-to-do-data-dash-data-attributes-in.html

main HTML5 Tag not working in Internet Explorer 9/10/11, an easy fix
http://weblog.west-wind.com/posts/2015/Jan/12/main-HTML5-Tag-not-working-in-Internet-Explorer-91011

SQL Server Compact & SQLite Toolbox and the Community Version of VS 2013
http://erikej.blogspot.com/2015/01/sql-server-compact-sqlite-toolbox.html



Happy Coding!



Tuesday, December 23, 2014

Trends in Web Development for 2014

Here are a few trends for 2014 I inked out of Google Trends for the past year.  Some may find them of interest.






-- And here are job listing from Dice, which might be useful to trend.

asp.net 3276
ruby on rails 1919
php 2115
Java 13616
node.js 473
photoshop 473
sharepoint 2288
wordpress 237
sql server 25901
Android 1916
Mobile 7281
sqlite 50
mysql 2348
HTML 5  14453
dotnetnuke 9
jquery 3592
angular 764
javascript 8532
bootstrap 586
WPF 470

Friday, November 07, 2014

SQLite Windows and Mono Compatible

I haven't tried this yet, but if you have a .net project that needs to use SQLite on both Mono and Window's platforms, I found this comment interesting.

Taken from here http://www.codeproject.com/Articles/821149/Universal-System-Data-Sqlite-binary-for-NET-and-Mo


You could just use Mono.Data.SQLite PinmemberWilliam Ivanski22-Sep-14 4:16 
I copied the file "Mono.Data.SQLite.dll" from Mono to my application bin folder.

I also copied "sqlite3.dll" from SQLite website.

It works flawlessly under both .NET/Windows and Mono/Linux.

Friday, October 03, 2014

Dates in Javascript and the Underscore Framework

I haven't posted much as I've been busy.  I pan to post a few articles this month, just not sure when I will get to them.  In the meanwhile here is a good article on Javascript dates, which I have to deal with from time to time.

[Link]

Also a framework which might be useful is _underscore.js.  Looks like some useful cross-browser functionality.

[Link]

Thursday, July 10, 2014

Using Nuget with Team Foundation Server

Just a heads up...

Can you use Nuget to get packages if you are using Microsoft Team Foundation Server?  Yes...but you have to do some work arounds so the default answer is NO.  The issue is that when you download packages depending on how workspaces are setup on each developer's machine problems could happen.  At least for me at this point it is better to download what you need from say codeplex and install things dropping a dll in a folder and then adding a reference in your project (with copy local set in properties) to the dll.

I screwed up a project using Nuget without knowing things need to be tweaked.

More info here-http://stackoverflow.com/questions/6344119/nuget-and-tfs-best-practices

Monday, June 09, 2014

WCFExtras No Longer Needed In ASP.Net 4.5+ For Flat WSDLs

So I started a new WCF Service Application Project in Visual Studio 2013.  I soon ran into the "Where are all the missing parts of my WSDL?"  I then remembered something about needing WCFExtras to generate "flat" WSDLs with all the pieces parts in WCF.  In googling around about the difference between WCFExtras and WCFExtrasPlus was I found some good news...

WCF in the .Net framework 4.5+ will generate "flat" WSDLs for you without the need of WCFExtras!

All you need to do is have your connecting clients point themselves to..

http://someurl/someport/someservice.svc?singlewsdl

Just add the ?singwsdl at the end of your service.svc and the full WSDL for your WCF is exposed without any missing pieces parts.

Win.

Here is a [LINK] for more info.

Thursday, May 29, 2014

A Few SQLite Tips

 
 SQLite http://sqlite.org/ is an open source database that is written in C.  It is similar to say an access .mdb file or a Microsoft SQL Server CE file only databases in that it is a file and runs in the same process (well, some caviots here with newer mods to SQLite but I'm not familiar enough there to comment) as your deployed program.  It is used by Firefox, Chrome, a lot of phone app developers, and now by me.  SQL Server is overkill for many of the little web applications I write and although I like SQL Server Compact Edition it looks like it is dead in the water [LINK].

1) Once you have created a table in SQLite, you cannot add a new column to that table with the alter command that has a default value [LINK].

2) It seems like time for SQLite is defaulted to GMT, which in my opinion is a good thing.  For default dates in tables, use CURRENT_TIMESTAMP.

3) SQLite-Net looks really cool, but I haven't been able to hack it to work for web development.  If you are using Windows 8 and developing APPS or Desktop applications, take a look at it. [LINK].

4) A really great and free GUI manager for SQLite is a plugin for Firefox called SQLite Manager. Look for it in the Firefox Plugins.  More info [LINK].

5) It looks like the main .Net SQLite Data Connection enabler is System.Data.Sqlite.  The full Nuget package contains Linq and Entity Framework support.  More info [LINK].

6) There is a version of SQLite written in managed .net code, but it looks like it is no longer being revised.  Maybe Microsoft will pick it up.  Info [LINK].  You might be able to hack SQLite-net to use this version, as it looks like it was originally intended to use it.  I tried for a few hours but gave up.  Maybe I'll take another stab at it.

7) There are no stored procs with SQLite (although I believe there is a fork in development that supports that, but I'm not sure how stable it is).  You can however create user defined functions.

8) When to use SQLite [LINK].

9) Interestingly, if you try to connect to a SQLite DB that doesn't exist the SQLite Connection object will create a new blank DB file for you with the name that you were looking for.  This actually caused me some confusion as has an extra character in my connection string and suddenly I couldn't query any of my tables...duh, they didn't exist because I was querying a new database.

10) If you are familiar with Transact SQL and Microsoft SQL Server (or MySQL, Postgress, Oracle) I don't think you will have any problems using SQLite.

11) Data types on columns are more recommendations than set and fast.  I believe if you try you can save strings in int fields and mix and match.  This might have changed with the 3.x version but from what I have been reading this at lest used to be very true.  Who knows in some cases this could be a good thing, but in most if you aren't careful this might cause havoc.

12) For bulk inserts you want to use SQLite transactions else SQLite will be very slow [LINK]

13) SQLite select queries are CASE SENSITIVE by default.  You can get around this by using COLLATE NOCASE after your where condition like select * from mytable where colum1 = @somevalue COLLATE NOCASE.  A post explaining the particulars can be found [HERE].

14) There is no "Select top * or Select top 10" in SQLite.  Instead use limit. Example: "Select blah from mytable where blah order by blah limit 10"

I got my start in web development using classic ASP and Access MDB databases.  I could crank stuff out FAST.  I think now for some of my projects using MVC (thought without most of the MVC, just using Razor pages almost like development with WebMatrix) and SQLite might be a sweet spot for me as far as making development fun and productive.  I plan to update this page as I find more little quirks using SQLite with ASP.Net.  I also will be posting some source code examples.