tag:blogger.com,1999:blog-73122426159384457552024-03-12T21:36:19.546-07:00Visual Studio JourneySharing the joys and frustrations of C# and ASP.NET programming since 2006Unknownnoreply@blogger.comBlogger198125tag:blogger.com,1999:blog-7312242615938445755.post-2518448533492619452021-01-16T15:05:00.003-08:002021-01-16T15:05:38.720-08:00For those of you stalwart followers who like me here, I am splitting out the SQL Server posts to a new blog.Find it here.Posts that apply to both Visual Studio development AND SQL Server will probably be posted on both sites.
...
Bryan Valencia is a contributing editor and founder of Visual Studio Journey. He owns and operates Software Services, a web design and hosting company in MantecaUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-7773142021537606242020-11-06T12:23:00.001-08:002021-10-05T11:08:26.275-07:00SQL Server: My AutoIncrement Column is Skipping Values (solved)There is a long explanation about SQL server caching values for autoincrement columns, and losing them when the server is restarted, but the fix is this:USE [database_name]ALTER DATABASE SCOPED CONFIGURATION SET IDENTITY_CACHE = OFF GOThis does incur a performance hit, so if you're inserting 20 billion records a day, be warned. But for a normal web or app database, this will make it more Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-67825833100656493402020-07-21T08:56:00.001-07:002020-07-21T08:56:28.054-07:00Unforgivable SinsLast night we had a power outage, so I left my PC off all night. When I rebooted, guess what happened?Slack - a program I had very clearly configured to run-on-demand suddenly decided it needed to launch on startup. I don't now and never have used Slack as a primary means of communication, and the thought that they would take ownership of my PC because they think they know what's goodUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-16992127837296238352020-07-16T10:03:00.001-07:002020-07-16T10:32:06.488-07:00The solution you are opening is bound to source control on the following Azure DevOps Server:Unlike Git or Subversion, when you move your projects to a new path, say to organize your hard drive, you'll see this warning when you open your project. --------------------------- Microsoft Visual Studio --------------------------- Team Foundation Server Version Control The solution you are opening is bound to source Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-52629935895285314242020-07-03T17:53:00.001-07:002020-08-10T10:35:14.456-07:00ASP.NET MVC - Simple 5 Step JQuery Filter.Using this 5 step process you can add a client-side JQuery filter to your MVC Index pages. Set up your layout page so that the JQuery pages load BEFORE the page loads. Add a filter bar. Add a <thead> and <tbody> section to your table (so we don't inadvertently filter the header row). Add data- Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-56092270813881644562019-04-25T10:44:00.001-07:002019-04-25T10:44:45.913-07:00Automatically execute a SQL Command from an iconYou'll need SQL Server command line tools to run this.
Assuming:
you have a .sql file you want to run,
you have a username/password and all that.
Create a batch file.
In file manager, right-click somewhere in the folder you want to put it in (like Documents\batch) and New->Text file.
Edit the name that comes up and call it [something].bat
Windows may warn you about renaming file Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-81651834023298087312018-12-18T13:43:00.002-08:002018-12-18T13:43:50.854-08:00Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.In my MVC app, I followed the OLD ASP.net roleManager and MembershipManager setup.
DO NOT DO THIS WITH MVC!
DO NOT RUN ASPNET_REGSQL!
Identity does NOT work that way anymore.
What I had to do was remove the line in my web.config that said:
<roleManager enabled="true" cacheRolesInCookie="false" />
Once I got rid of that, the error blessedly poofed into a memory.
.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-76137674669880409732018-12-07T17:35:00.001-08:002018-12-07T17:36:59.575-08:00Updating Object Relational Model Easily in MVCSo I got my mind around the models, if I change a field, I know how to modify the object properties to match. Ditto the relationships - add a hashset here and there to reference linked items.
But I read the ORM (the main model page) and that thing just mystifies me.
Like this:
So a PrefCategory has many Prefs. got it.
But it has a required PrefCategory??? Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-4177457508195170892018-11-28T21:18:00.002-08:002018-11-28T22:27:21.421-08:00SQL Server: How to Concatenate Parent Nodes in Irregular Category TreesConsider this table:
id
ParentCategory
Name
1
NULL
Household
2
1
Furniture
3
1
Appliances
4
2
Chair
5
2
Couch
6
2
Bed
7
3
Refridgerator
8
3
Counter
10
3
Bathroom
We want each node to display all it's parents back to its root.
This SQL helps.
SET ANSI_NULLSUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-44961780092324946062018-11-20T07:05:00.001-08:002018-11-20T07:05:15.750-08:00SQL Server: Return All Dates in a RangeThis function will return a list of all dates between a start date and an end date.
SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Author: bryan valencia-- Create date: 11/20/2018-- Description: returns the dates between start and end (inclusive).-- ===========================================Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-58262921825163780062018-09-19T16:05:00.001-07:002018-09-19T16:06:14.939-07:00css Tab Bar DemoYou created a great tabbed interface or vertical menu but you hate it that the links in the menu only respond to clicks on the actual text.
This css style info will show you how to make the whole tab clickable by making the link fill the entire box.
<!doctype html><html lang="en"> <head> <meta charset="UTF-8"> <meta name="Generator" content="EditPlusUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-80252610281534764592018-04-26T12:08:00.000-07:002018-04-26T12:19:13.724-07:00Changelog.txt. Playing with their heads.Today I was checking my server logs for the root IP address. This is people who are scouring the internet by IP address looking for whatever they can find.
One file I noted a lot of 404's for was CHANGELOG.TXT. Apparently this is a DRUPAL file that might contain the current versions of some of your server's software.
Because I like to mess with these net scanners, I created this Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-40755548334273623912018-03-21T22:39:00.001-07:002018-03-21T22:42:52.012-07:00MVC: A public action method ... was not found on controllerYou have a page with something embedded, a partial view, a generated image, or something. And it's odd, but the first time you load the page, everything works, but every time you reload (like someone clicks a button on the page), MVC claims it can't find the action.
InnerException:
ErrorCode=-2147467259
HResult=-2147467259
Message=A public action method ... was not found on Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-60654513021616493042018-03-21T17:11:00.000-07:002018-03-21T17:30:45.441-07:00SupportBack in the annals of history, companies wanted people to buy their software. Most bought software came with a thing we used to call support.
Soon, places like Apple and Microsoft were getting 650 billion calls a day from every grandma that couldn't figure out how to get the cup holder to pop out.
What we really need, thought the beleaguered support operators; is a way to prevent Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-36983817087655121782018-03-12T14:07:00.001-07:002018-03-12T14:59:44.050-07:00How to Copy a MSSQL Server database to a New Webhost without RESTOREThis article explains how to copy a database from one server to another when Backup/Restore is not an option.
This will work as long as you have SQL Server Management Studio access to the source and destination databases.
This is very slow, and may take many hours to run on a big database.
First, open the database server you want to copy in SSMS.
Next, Right-click the Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-40869064990308677472018-02-22T14:38:00.001-08:002018-02-22T14:39:42.624-08:00Fix for nav-tabs Stop Working After jQuery Update
If your tabbed notebooks stopped working after a jQuery update then here's the fix.
First, you'll need some classes you didn't have before in your site.css
.nav-tabs { border-bottom: 2px solid #DDD; }
.nav-tabs > li > a {
border: none;
color: #666;
 Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-41130314091337231622017-11-27T10:15:00.001-08:002017-11-27T10:15:22.323-08:00Absolutely no Fixed Bid Contracts - Ever!I got a job from a client and it was a fixed bid. We pay you x dollars and you finish the work.
BUT...
The scope was ill-defined
the "spec" for the project was "replace our existing system", not an objective set of criteria. Therefore any variation between their old system and the new one could be considered incorrect.
If there are features that we cant see from the 300 screen Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-6443318309137661772017-11-09T11:27:00.003-08:002017-11-09T11:27:40.082-08:00MVC ActionLink will not Accept Markup (easy fix!)
I needed to make a button that included a glyphicon. The glyphicon looked like this:
<i class="fa fa-plus"></i>
If you use this in @Html.ActionLink() you'll see the markup in your page, not the glyphicon.
There is a way around this:
Replace your @Html.ActionLink() with this...
<a href="@Url.Action("Index","Customers",new { CompanyID = Model.UniqueId }, Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-90132984448209822552017-09-21T20:07:00.001-07:002017-09-21T20:15:36.573-07:00Cool Little Batch File to Log Your Crappy ISP Tried this in Windows 10. I just spent all day with the internet winking on and off, and wanted to get a feeling for the extent of the outages. Also sometimes they were hard down, and other times the DNS servers just stopped working.
Enjoy...
@echo off
cls
set Address=google.com
set ThisDate=%date%A
echo %ThisDate%
:Loop
timeout /t 60
if "%date%" NEQ "%ThisDate%" (
echo %Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-2324121291727044222017-06-23T12:05:00.000-07:002017-06-23T12:05:44.430-07:00Found on Job Postings..."must be familiar with Software Development Life Cycle"...
No two companies use the same one, and most exclude several steps from the map. For instance, if your SDLC does not include the eventual phase-out of your application, then it's incomplete. It's ludicrous to think that any software we develop is going to perform forever, so the phase out - especially of corporate software - is a Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-82796930909243184462017-05-25T16:57:00.001-07:002017-05-25T17:04:28.248-07:00Naming Conventions50% plus of the grief I have with software - especially Microsoft software - comes from when things are named inconsistently. If you're going to pop a message to a developer - or user - that says:
Missing reference to Microsoft.SqlServer.Types
That what needs to happen is adding something named Microsoft.SqlServer.Types to someplace called References. I see this all the time. Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-73088527965822740552017-05-05T16:25:00.001-07:002017-05-05T16:38:24.945-07:00How to Check for any Changes in Table Data.
I am having a problem where some sneak process is changing the wrong
data in my inventory table. I wanted to discover how and when this was
happening, so I created a copy of my inventory table (on my local
machine, like this:
Select * from [dbo].[Inventory] into [dbo].[InventoryBASELINE]
Now I can check for discrepancies, like this...
select * from [dbo].[InventoryBASELINE] IB whereUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-87637987702449026272017-03-31T12:05:00.002-07:002017-05-25T17:07:09.679-07:00The Annoying Things About Visual StudioAs I work with VS, day in and day out, there are certain things that just annoy and frustrate me. I will share them so the zero people who read this blog might have a snicker.
In General
If you have an older app, say one that uses .net Framework 4.5.1, and you try to edit it on a machine that has a newer version, you CAN'T. There is no way to install an older version of the Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-23153699402206261942017-03-04T15:24:00.001-08:002017-03-04T15:24:36.167-08:00system.data.pdb not loadedThere are some helpful pages about this, but I find that just stopping and recompiling the app usually fixes this.
...
Bryan Valencia is a contributing editor and founder of Visual Studio Journey. He owns and operates Software Services, a web design and hosting company in Manteca, California.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7312242615938445755.post-7345235063822898342016-12-30T09:44:00.001-08:002017-03-10T18:45:11.532-08:00Making Transparent PNGs in C#This bit of code shows how to make a PNG with transparency totally from scratch in code. This code will save the image back as a file, but it could as easily be streamed back to a web request. This is a complete console app, if you want to compile it, you'll need to add a reference to System.Drawing.
using System.Drawing;
using System.Drawing.Drawing2D;
using Unknownnoreply@blogger.com0