Tuesday, 6 July 2021

Encrypting and Decrypting connection strings in web.config

Make a copy of the web.config file
Open an elevated command prompt
Change directory to C:\windows\Microsoft.NET\Framework\v4.0.30319 if necessary

Decrypt: ASPNET_REGIIS -pdf "connectionStrings" "<folder containing the web.config file>

Encrypt: ASPNET_REGIIS -pef "connectionStrings" "<folder containing the web.config file>

Wednesday, 27 September 2017

Combining separate MP4 files into one

Another useful thing I found out that I needed to know that I didn't know that I needed to know (if you still follow!)

Combining two .mp4 files into a single .mp4 file.

So, say you have a NAS and a collection of DVDs and a 'Smart TV'. You decide to "rip" your DVD collection to your NAS so that you can view them on your Smart TV as it is a DLNA device. All good. But what happens when you find out (I mean, remember) that you have a "flipper" - you know a DVD that you have to turn over halfway through playback?

So you know you have to rip it as two separate files, but now it is a stream you don't want the inconvenience of watching the first half of the film only to have to find the second half in your library and start watching that one. No. What you want to do is combine them into a single file.

I have been ripping my collection into MP4 format, but I have read in the original article that this technique will work for any format that VLC Player supports. So, there's the first thing - you need VLC Player.

Here's a link to the original article, but if like me you're a reasonably technically savvy, then here's the boiled down version.

  1. Ensure both clips are in the same format, and the format is one that VLC Player supports
  2. Open a command prompt
  3. Enter the following command with suitable replacements:
  4. [Location of vlc.exe] [first_clip.ext] [second_clip.ext] --sout "#gather:std{access=file,dst=[new_name.ext]}" --sout-keep

    ** Remember that if your paths include long filenames (i.e. spaces), use quotes.

    Here's  a working example of the above command:
    "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" C:\Ripped\Goodfellas-p1.mp4 C:\Ripped\Goodfellas-p2.mp4 --sout "#gather:std {access=file,dst=C:\Ripped\Goodfellas.mp4}" --sout-keep

  5. VLC Launches and starts processing the files. Wait until it is done (the progress bar finishes, er, progressing across the second file), then start monitoring the output folder. It seems to take quite some time until the finished output file grows from 0bytes with no visual output from VLC that it is doing anything! Don't worry - just wait, and press F5 on that Windows Explorer ...
  6. When it is all done, close VLC and the command window

Saturday, 25 February 2017

'Fixing' a corrupt User Profile

Here's another one for memory banks... Fixing a corrupt profile in Windows Vista, 7 or 10. Sadly this happens far too often and I am often called upon to help people back on their computer or laptop AND to help retrieve their data that's seemingly 'locked in' to the corrupt profile.

This article is really useful and the basis of this post. Just remember - the only way to "fix" this isn't really to fix it but to create a new profile on the errant computer, copy the data files from the corrupt profile to the new one, and then hide the corrupt profile from the login. It is a bit crap, well a LOT crap actually IMO, but I have never had success by trying to restore the system or registry.

So, suck it up, and go right ahead and create that new profile.

In order to do this you're going to need to be able to log on to the computer as an Administrator of some kind. But the Admin account that came with that lovely branded laptop is hidden, right?! Yeah, it usually is.
 
Boot into safe mode, click Start, type 'cmd', then right-click Command Prompt and select 'Run as Administrator'. In the command prompt type:
Net user administrator /active:yes
Hit Enter and you should see a message that says, "The command completed successfully". 

Exit the command prompt and re-boot. When the login screen appears you should see the newly un-hidden Administrator account. Log in as Administrator - there shouldn't be a password (hint: you may want to set one at some point, but for goodness sake DO NOT FORGET IT!)

After you've logged in you can go right ahead and create the new account (Control Panel, User Account and Family Safety, User Accounts, Manage another account, Create another account). Remember that this new user account needs to have a different username to the username on the corrupt profile (seems obvious, but there are some dumb people out there). Make the new account an Administrator.

Log off and then log on as the new user (or switch account if you prefer) to create the new user's folders on the local drive, then log off and log on as the Administrator again (or switch...)

Now you can go ahead and copy the data from the corrupt profile to the new profile. Copy the data files from the corrupt profile (C:\Users\CorruptProfileUserName) to the new profile. Don't forget to enable 'Show hidden files, folders and drives' in Windows Explorer first though else you won't get far. Remember: DO NOT COPY Ntuser.dat, Ntuser.dat.log, Ntuser.ini from the corrupt profile or you'll be back where you started.

There you go. You can log off and then log on as the new user and set-up your desktop and so on just how you like it. Don't forget some housekeeping though ...

Hide the Administrator account with
Net user administrator /active:no
on the command line, and delete or disable the corrupt profile (after you're sure you have everything you need from it!!)


Thursday, 24 March 2016

Windows 10, Date formats and Excel

Since installing Windows 10 I noticed that the date formatting in my Excel spreadsheets had become inconsistent. It turns out that even though I had selected my location as UK and my keyboard layout as British, the system still had the system locale and associated settings as U.S.

Something to watch out for...

Tuesday, 22 September 2015

Mutual Authentication (2-way SSL)

I had to look into this today for a project I am working on. I found this blog which I think explains the concept very nicely.

One Way and Two Way SSL and TLS

Monday, 16 December 2013

Clearing Windows Media Player cache

During an MP3 re-tagging session I was becoming frustrated that WMP wasn't refreshing and showing the tag changes I had made to the files on my NAS. The NAS is a uPnP server for media around the home and WMP is just one of the clients that render from it.

Restarting WMP didn't help, nor did re-starting the machine, so after a bit of Googling I found this post that help me crack it. Essentially you have to delete the WMP databases (local cache) which forces WMP to reload from the uPnP server.

NB: I had to stop the Windows Media Player Network Sharing Service for this to work (it has a read lock on one file)

Link Here

A copy of the text is reproduced here in case it goes missing ...

Hi,
Method 1: To resolve this problem, clear the Windows Media Player database. To do this, follow these steps:
a. Exit Windows Media Player.
b. Click Start, click Run, type %LOCALAPPDATA%\Microsoft\Media Player, and then click OK.
c. Select all the files in the folder, and then click Delete on the File menu.
Note You do not have to delete the folders that are in this folder.
d. Restart Windows Media Player.
Note Windows Media Player automatically rebuilds the database.


Method 2: If this does not resolve the problem, clear the Windows Media Player database cache files. To do this, follow these steps:
a. Exit Windows Media Player.
b. Click Start, click Run, type %LOCALAPPDATA%\Microsoft, and then click OK.
c. Select the Media Player folder, and then click Delete on the File menu.
d. Restart Windows Media Player.

Note :Windows Media Player automatically rebuilds the database.

Monday, 12 August 2013

Progress

It has been a while since my last post about Project Sputnik and so a quick progress report is definitely due.

I haven't had much free time to work on the project in this last month due to work activities and personal commitments. Same old same old, right?

That said, I have coded up the DAL layer for each database table in a basic form, and tested each unit. So, essentially, I now have a complete DAL for the project that performs the basic CRUD functionality. As I code up the BL and UI layers I expect that some of the DAL functionality will need to be honed in certain areas to provide extra functionality.

From here on in it is a Business Logic focus for me. For the next few weeks at least ...