All posts by Tidbytez 1

How to use a generic PC controller with GTA 5

So you plugged in the cheap PC controller you bought off eBay or Amazon (say one that is coincidentally shaped like an Xbox controller) and found it doesn’t work with GTA 5?

This is probably because the controller is using the DirectInput standard as opposed to the newer XInput standard. You can read more about these standards from Microsoft by clinking on this link.

GTA 5 (or GTA V if you’re feeling fancy) was not optimised to use the DirectInput standard unfortunately. However if you’re playing the game on PC you should be using a keyboard and mouse like a grown-up anyway, it’s way better for shooters. Ah but GTA isn’t all about the shooting I hear you say and you’re right. I’ll admit I switch to a controller for flying vehciles because they are horrible to pilot with direction keys. Analogue sticks are much better suited to aircraft.

So the workaround for being able to use the cheap generic controller is quite simple but requires using an “Xbox 360 Controller Emulator”.

Download the file x360ce_x64 from the following site by clicking on the “download for 64 bit games” button at the top of the screen.

https://www.x360ce.com/

(Be sure to test the downloaded file with whatever antivirus software you have installed)

Once you are satisfied the software is safe extract the file to the root directory of where you installed GTA 5.

(If you do not know where that folder is try searching GTAV in your Windows search bar. Note a folder called GTA V is often created in the Documents folder but this is not the correct directory.  The correct directory will have application files with the GTAV logo in it. The game maybe in a Rockstar folder or perhaps a Steam or Epic folder, it all depends on who you bought it from.)

Right click on x360ce_x64 and run the file as administrator and you should be given an option button to “Create”.

Click this button and a Xbox controller calibration window will open.

At this point if your controller has a large circular button at its center press it and make sure it lights up otherwise it may not send the right signals when the controller is being mapped.

Click “Auto” and then “Save”.

I found the A, B, X and Y face buttons were not mapped correctly and needed to be mapped manually.

To do this, beside each face button on the emulator interface there is a drop down menu. Click on it for each button and choose the option to record. The interface will highlight which button to press on your controller to map it correctly. Once the buttons are mapped correctly click “Save” again.

After following these steps you should now be able to play GTA V with the controller.

How to fix the right analog stick of a generic PC controller for Fifa Online 3

Fifa Online 3 is a free version of Fifa that is popular in Asia as an esport title. The gameplay and visuals are a little dated but it’s still a solid experience at a great price. You won’t make it through the tutorials however if you are using a cheap generic PC controller (say one that is coincidentally shaped like an xbox controller) as you won’t be able to save penalties. This is because the right analog stick may not be recognised.

The fix is quite simple.

Download the file x360ce from the following site by clicking on the “download for 32 bit games” button at the top of the screen.

https://www.x360ce.com/

(Be sure to test the downloaded file with whatever antivirus software you have installed)

Once you are satisfied the software is safe extract the file to the root directory of where you installed the game. (Note: the game directory will probably not be called Fifa etc. it will likely be a series of numbers)

Open the file and you should be given an option button to “Create”.

Click this button and a Xbox controller calibration window will open.

Click “Auto” and then “Save”, and that should do it.

See the video below for a more visual guide, just don’t download the 64 bit file.

How to fix the “Fatal Error: Illegal characters in path” problem during a WSUS Installation

If your reading this you’re probably at the point of trying to install a new WSUS server on Windows Server 2012 R2 and have received the message “Fatal Error: Illegal characters in path”.

The fix is annoyingly simple.

You may have created a partition specifically for the task, i.e. created a new drive and assigned it the letter E:\, and only referenced the root of the partition assuming the installation would create whatever directories it needs, you know like every other software.

The problem is you cannot specify the root of partition alone, you need to specify a directory, or the partition name, such as E:\WSUS.

A fully qualified path should fix the problem.

What is WSUS?

Windows Server Update Services (WSUS) provides a cost-effective patch management solution to deploy updates to domain-joined Windows servers and workstation in a corporate network. WSUS is fully integrated in Windows Server 2012 and can be enabled on Windows clients by configuring settings in Group Policy Objects – GPO.

How to fix winhiip writing to hard drive problem

If you are trying to format a hard drive to be used by a PlayStation 2 you’ve probably already come across excellent content like the video below and the necessary tools to do the job.

 

However you might, like me, run into the problem of winhiip not being able to right to the drive which will prevent it from formatting the drive correctly.

To resolve this problem you will need to manipulate the drive in Windows “Disk Management”.

Open Disk Management (to open type disk management in Windows search and hit enter)

Find the reference to disk you want to fix and if it has not already been formatted follow these steps:

  • Initialize the disk. (If not already initialized)
  • Right click the Unallocated Space on the disk and click New Simple Volume.
  • Proceed through the New Volume Wizard, setting the Volume size to the maximum disk space and formatting the drive under the NTFS file system. (Only a quick format is needed)
  • Wait for the drive to finish formatting, then right click the healthy partition you just made and click Delete Volume.
  • Open WinHIIP and click Select Drive, then select your drive. Press OK to all errors that pop up upon loading the drive.

At this point you should be able to write to the drive with no problems.

 

How to list login details, such as name and role membership, for all logins in a SQL Server Instance

The script below will provide SQL Server Instance login details such as:

  • The login name
  • The role membership the login is part of such as sysadmin etc.,
  • Whether or not the login is enabled
  • Whether or not the login is a SQL Server Login or Windows Login etc.
  • Login created date
  • Login modified date
  • Etc.
SELECT SP.principal_id
	,SP.name
	,SUSER_NAME(role_principal_id) server_role
	,SP.is_disabled
	,SP.type_desc
	,SP.sid
	,SP.type
	,SP.create_date
	,SP.modify_date
	,SP.default_database_name
	,SP.default_language_name
	,SP.credential_id
	,SP.owning_principal_id
	,SP.is_fixed_role
FROM sys.server_principals AS SP
LEFT JOIN sys.server_role_members AS RM ON SP.principal_id = RM.member_principal_id;

 

How to set every database in a SQL Server instance to read only

The following TSQL when executed will create the TSQL needed to set all databases in a SQL Server instance to read only mode.

Typical use cases for this might include creating a copy of databases for reporting purposes or when migrating databases from one server to another.

SELECT 'ALTER DATABASE [' + NAME + '] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE [' + NAME + '] SET READ_ONLY WITH NO_WAIT
ALTER DATABASE [' + NAME + '] SET MULTI_USER
GO'
FROM sys.databases
/*Setting database id > 4 excludes the system databases*/
WHERE database_id > 4

 

Before you run the outputted script you may need to kill open connections to the databases or certain running activities. Obviously you would want to make sure it is safe to do so before killing any activity.

To kill activities on mass you can use the script in this post.

 

 

How to fix the SQL Server Job Error “Failed to decrypt an encrypted XML node because the password was not specified or not correct” encountered with SSIS packages

If you have a password protected SSIS package you may encounter this error.

First off this seems like a very buggy problem and the solution may not work for everyone. Also, as typical, you may find that you are trying to solve more than one problem at once, for instances going from one domain to another seems to confuse matters. So if this solution doesn’t work it may be just part of the solution to your particular puzzle.

If you go to the job step properties you actually see that there are two spaces between /DECRYPT and /CHECKPOINTING.

CommandLine

If you reduce the space to one and run the job again you might get this error:

“Enter decryption password: Missing argument for option “decrypt””

This is because you’ve removed the password from the job associated with the package.

I’ve found that when you edit the command manually by first removing the spaces and then retyping the command with the package password this solves the error.

EditCommand

For example:

/DECRYPT YourPackagePassword /CHECKPOINTING

If this doesn’t work try scripting out the job, deleting it, and then running the script again.

Good Luck.

 

 

How to set a database to single user and back to multiuser

Here’s a quick script to set a database to single user and then back to multi user.

You’ll need to do this when altering the database in situations like database name changes, file name changes or even restores 

/*
Set Database to Single User
*/
USE [master];
GO

ALTER DATABASE [my_db]

SET SINGLE_USER
WITH

ROLLBACK IMMEDIATE;
GO

/*
Set Database to back to Multi User
*/
USE MASTER;

ALTER DATABASE [my_db]

SET MULTI_USER
WITH

ROLLBACK IMMEDIATE;
GO

 

How to get the date a web page was published

This posting is particularly useful for anyone looking to use the date a web page was published as part of academic referencing.

Step 1. In your browser open https://www.google.com/.

Step 2. Copy the url of the web page you want to get a publication date for.

Step 3. Paste this url into the search bar of the google.com page and search. The search should return a series of results.

Step 4. In the address bar of the results page go to the very end of the url text and paste &as_qdr=y15 and hit return.

This should update the results page with each link including a publication date.

How to monitor file stats using a batch script

The use case for this batch script is to monitor SQL Server files using Windows task manager scheduled to run the file every 5 minutes. The batch scripts gathers the stats of  every file in a referenced directory. The script can obviously be adapted however to something that suits your specific needs.

Note: Running this script against the C drive on a laptop took 15 minutes and produced a text file that was around 50 Mb. The script is best utilized in scenarios such as monitoring file sizes on drives used by applications that do not generate thousands of files, e.g. backup directories etc.

There is two scripts presented below. The first is the simpler of the two scripts, it just records the file stats of a single directory.

Directions for use:

Take either script below and save it as a batch file called FileStatsLogger.

Two variables need to be updated to use the script:

“LogPath=C:\Log\” Change C:\Log\ to another directory if you want the output file written somewhere else.

“ScanDir=C:\FolderToScan\” Change C:\FolderToScan\ to the directory you want to gather file stats from.

The file that will be created, FileStats, will record the following information:

  • A timestamp of when the batch script was run
  • A reference to each parent directory
  • Every file creation date and time
  • File size in Kbs
  • Every file owner
  • The name of the file
  • How many files are in the directory and their collective size

The output file will look like this when opened.

FileStats

Each time the script is run it will update the text file FileStats.

@ECHO OFF

REM SET TIMESTAMP VARIABLE
SET Timestamp=%date:~6,8%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2%

REM SET FILE LOGGING VARIABLES
SET "LogPath=C:\Log\"
SET "LogFileName=FileStats.txt"
SET "Log=%LogPath%%LogFileName%"
SET "ScanDir=C:\FolderToScan\"

REM CREATE FILE IF DOES NOT EXIST
IF NOT EXIST "%Log%" ECHO File Created Timestamp: %Timestamp% > "%Log%"

REM TIMESTAMP ENTRY
ECHO/ >> "%Log%"
ECHO Entry Timestamp: %Timestamp% >> "%Log%"
ECHO/ >> "%Log%"

REM SCAN DIRECTORY
DIR /a %ScanDir% >> %Log%

To scan multiple directories create a text file called DirectoryList and populate the the file with the directories you want to scan. Each directory on a new line, for example:

L:\
D:\
T:\

It is assumed the directory list text file will be kept in the same directory as the batch file FileStatsLogger but you should add the full file path to were DirectoryList.txt is referenced in the script to avoid any problems.

Note: L, D & T are the naming convention for the Log, Data and tempdb drive names for SQL Server. These are just drive letters examples but you can be more specific like C:\Users\UserName\Desktop\ just be sure to include the backslash at the end of the reference.

This script will create a new log file for each day as the files can be large. The filename will following the format FileStats_YYYYMMDD.

As before you will have to:

“LogPath=C:\FileStats\” Change C:\Log\ to another directory if you want the output file written somewhere else.

“ScanDir=C:\FileStats\DirectoryList.txt” Change to the directory you will store DirectoryList.txt.

Though it is recommended you keep everything in a folder like this (potentially writing the FileStats log to a directory off of the host server):

FileStatsDirectory

@ECHO OFF

REM SET TIMESTAMP VARIABLES
for /f "tokens=2 delims==" %%G in ('wmic os get localdatetime /value') do set datetime=%%G
SET "dd=%datetime:~6,2%"
SET "mth=%datetime:~4,2%"
SET "yyyy=%datetime:~0,4%"
SET "hh=%time:~0,2%"
SET "mm=%time:~3,2%"
SET "ss=%time:~6,2%"

SET "FileNameDate=%yyyy%%mth%%dd%"
SET "Timestamp=%yyyy%%mth%%dd%%hh%%mm%%ss%"

REM SET FILE LOGGING VARIABLES
SET "LogPath=c:\FileStats\"
SET "LogFileName=FileStats_%FileNameDate%.txt"
SET "Log=%LogPath%%LogFileName%"


REM CREATE FILE IF DOES NOT EXIST
IF NOT EXIST "%Log%" ECHO File Created Timestamp: %Timestamp% > "%Log%"

REM TIMESTAMP ENTRY
ECHO/ >> "%Log%"
ECHO Entry Timestamp: %Timestamp% >> "%Log%"
ECHO/ >> "%Log%"

REM READ DIRECTORY LIST AND SCAN EACH DIRECTORY REFERENCED 
FOR /f "tokens=*" %%x IN (c:\FileStats\DirectoryList.txt) DO DIR /a /s /q "%%x" >> %Log%

Finally you can create a Windows task scheduler task to run the script at an interval that suits your needs.

The description of the task could be something along the lines of:

This task runs the batch script “FileStatsLogger” every 5 minutes which
logs the stats for each file of each directory referenced in the file
Directory List. The stats are recorded in the FileStats txt file.
All resources related to this tasks are contained in the FileStats directory.