I couldn't find a simple app to dictionary attack .zip files on Windows for a NetSec challenge, so I coded one.
Download Link: Here (106kb)
Github Repo: Here
If you're looking for something more intensive, try John the Ripper
Sample Screenshot
Thursday, December 28, 2017
Sunday, December 18, 2016
JavaScript - Sum of the first X prime numbers
I recently had a programming challenge where I had to find the sum of the first X prime numbers in JavaScript in a slightly compressed format, and couldn't find anything decent online.
So I coded this.
It could be far better, although the challenge was timed :P
Thanks to The Polyglot Developer for their "isPrime" function :)
So I coded this.
It could be far better, although the challenge was timed :P
Thanks to The Polyglot Developer for their "isPrime" function :)
Wednesday, November 23, 2016
A Textbox that only allows numbers
Since this seems so hard to do... An actual working example :)
Usage HTML: <input type="text" onkeypress="return isNumericKeyPress(event.keyCode);" onpaste="isNumericPaste(this);" />
OR
ASP.NET: <asp:textbox ID="txtNumsOnly" runat="server" onkeypress="return isNumericKeyPress(event.keyCode);" onpaste="isNumericPaste(this);"></asp:textbox>
Demo Type or paste something:
Samples
- 1!2@3#
- Test
- Test1
- 1a2b3c
Usage HTML: <input type="text" onkeypress="return isNumericKeyPress(event.keyCode);" onpaste="isNumericPaste(this);" />
OR
ASP.NET: <asp:textbox ID="txtNumsOnly" runat="server" onkeypress="return isNumericKeyPress(event.keyCode);" onpaste="isNumericPaste(this);"></asp:textbox>
Demo Type or paste something:
Samples
- 1!2@3#
- Test
- Test1
- 1a2b3c
Saturday, October 29, 2016
C# - Finding the Median value of a List
I love using Lists in C#. Unfortunately, the List class lacks some functionality - Like finding the median value in a set.
Definition: The median is the value separating the higher half of a data sample, a population, or a probability distribution, from the lower half. In simple terms, it may be thought of as the "middle" value of a data set. For example, in the data set {1, 3, 3, 6, 7, 8, 9}, the median is 6, the fourth number in the sample. The median is a commonly used measure of the properties of a data set in statistics and probability theory.
Examples:
1.) If there is an odd number of numbers, the middle one is picked. For example, consider the set of numbers:
2.) In the data set:
- Median on Wikipedia
So - Here's some code to do it :)
Definition: The median is the value separating the higher half of a data sample, a population, or a probability distribution, from the lower half. In simple terms, it may be thought of as the "middle" value of a data set. For example, in the data set {1, 3, 3, 6, 7, 8, 9}, the median is 6, the fourth number in the sample. The median is a commonly used measure of the properties of a data set in statistics and probability theory.
Examples:
1.) If there is an odd number of numbers, the middle one is picked. For example, consider the set of numbers:
1, 3, 3, 6, 7, 8, 9This set contains seven numbers. The median is the fourth of them, which is 6.
2.) In the data set:
1, 2, 3, 4, 5, 6, 8, 9The median is the mean of the middle two numbers: this is (4 + 5) ÷ 2, which is 4.5.
- Median on Wikipedia
So - Here's some code to do it :)
Monday, July 6, 2015
ASP.NET - Fixing Entity Framework Migration Errors
AKA
"The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information."
OR
"Exception Details: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information."
Whilst doing migrations from EF4 to EF6, I came across the following error. This is caused by two different things
1.) Your project contains both EF4 and EF6 references. If you're using EF6, only EF6 can be in the project. Either remove everything EF4 related, or upgrade it to EF6.
2.) You're missing a DLL. This seems to be the most common error. Navigate to applicationPath\bin\ on the server, and look for EntityFramework.SqlServer.dll (Should be around 600KB). For some odd reason, it rarely gets included in deployments. If it's not there, simply copy the version from your development machine onto the server, and you're good to go!
"The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information."
OR
"Exception Details: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information."
Whilst doing migrations from EF4 to EF6, I came across the following error. This is caused by two different things
1.) Your project contains both EF4 and EF6 references. If you're using EF6, only EF6 can be in the project. Either remove everything EF4 related, or upgrade it to EF6.
2.) You're missing a DLL. This seems to be the most common error. Navigate to applicationPath\bin\ on the server, and look for EntityFramework.SqlServer.dll (Should be around 600KB). For some odd reason, it rarely gets included in deployments. If it's not there, simply copy the version from your development machine onto the server, and you're good to go!
Sunday, July 27, 2014
The End Of Windows Defender
I recently had a rather rampant piece of Adware that was effecting Chrome, and causing several miscellaneous words to underline, and hyperlink their way to ad sites. I eventually found the location of the executable, and submitted it to Windows Defender (The Anti Virus I was using at the time).
What I got back shocked me. A result of "Not detected". This means that the executable had been previously submitted, and had been found by the Microsoft researchers to not be harmful.
Curious about the result, I decided to submit the same file to several online virus scanners - All of which detected the file as harmful by no less than 15 separate anti virus scanners, none of which were Windows Defender.
Curious, I decided to check some previous submissions of mine. The early ones (Back in the Windows 7 / Early Windows 8 period) had all subsequently been added within a few days of my submission. The later ones were either Not Detected or simply No Scan Result Available. Keep in mind that both of those submissions are picked up by the majority of other Anti-Virus's (AVG, F-Secure, Malwarebytes, McAfee, Etc), so I decided to switch.
Having 3 known virus files at my disposal, I decided to look around to various free alternatives. I used to use AVG when they were still located at http://free.grisoft.com/ before they went corporate, but they have since severely dwindled in quality. Norton was out of the question (Any tech-savvy person will know how useless and bloatware-esque it is), so I decided to try Malwarebytes. I downloaded their free version located here (16.5MB), and it quickly scanned my PC, effortlessly finding the 3 files I had, as well as some registry entries that the Adware had created. Happy, I acquired a premium version (Real Time Protection), and went merrily on my way.
What I got back shocked me. A result of "Not detected". This means that the executable had been previously submitted, and had been found by the Microsoft researchers to not be harmful.
Curious about the result, I decided to submit the same file to several online virus scanners - All of which detected the file as harmful by no less than 15 separate anti virus scanners, none of which were Windows Defender.
Curious, I decided to check some previous submissions of mine. The early ones (Back in the Windows 7 / Early Windows 8 period) had all subsequently been added within a few days of my submission. The later ones were either Not Detected or simply No Scan Result Available. Keep in mind that both of those submissions are picked up by the majority of other Anti-Virus's (AVG, F-Secure, Malwarebytes, McAfee, Etc), so I decided to switch.
Having 3 known virus files at my disposal, I decided to look around to various free alternatives. I used to use AVG when they were still located at http://free.grisoft.com/ before they went corporate, but they have since severely dwindled in quality. Norton was out of the question (Any tech-savvy person will know how useless and bloatware-esque it is), so I decided to try Malwarebytes. I downloaded their free version located here (16.5MB), and it quickly scanned my PC, effortlessly finding the 3 files I had, as well as some registry entries that the Adware had created. Happy, I acquired a premium version (Real Time Protection), and went merrily on my way.
Friday, May 23, 2014
Convert Number To Month Name In Excel
A simple Excel function to convert a digit to a month name
The first letter of the month (Eg: "N" of "November" for 9)
=TEXT(DATE(2000,A1,1),"MMMMM")
The complete month name (Eg: "November" for 9)
=TEXT(DATE(2000,A1,1),"MMMM")
The abbreviation of the month name (Eg: "Nov" for 9)
=TEXT(DATE(2000,A1,1),"MMM")
Thank to this thread.
The first letter of the month (Eg: "N" of "November" for 9)
=TEXT(DATE(2000,A1,1),"MMMMM")
The complete month name (Eg: "November" for 9)
=TEXT(DATE(2000,A1,1),"MMMM")
The abbreviation of the month name (Eg: "Nov" for 9)
=TEXT(DATE(2000,A1,1),"MMM")
Thank to this thread.
Friday, January 17, 2014
CSS equivalent of the center tag
From: <center>dataHere</center> to
To: <div style="margin: auto; text-align: center;">dataHere</div>
Thanks to Isaksen from Stack Overflow
To: <div style="margin: auto; text-align: center;">dataHere</div>
Thanks to Isaksen from Stack Overflow
Thursday, January 16, 2014
Online Wh to mAh Converter
Just a useful little utility :)
Wh (Eg: 4.44): | |
V (Eg: 3.7): | |
mAh: | |
Formula: mAh = Wh * 1000 / V
<script type="text/javascript">
<script type="text/javascript">
function convertWhtomAh()
{
var WhValue = document.getElementById('convertWh').value;
var VValue= document.getElementById('convertV').value;
var result = (WhValue * 1000) / VValue;
void(document.getElementById('convertmAh').value = result);
}
</script>
HTML Font Size Conversion
Whilst getting rid of font tags today, I needed an easy reference point to find what size rating in one coding format was equivalent to another (Eg: Is <font size="1"> the same as <span style = "font-size: 8px;"> or... ?) and came across this fantastic chart!
http://www.trishasdesignstudio.com/font-size-conversion-chart.asp
As the link died, here is a version of it hosted on imgur.
Monday, January 13, 2014
How To Rename Google Maps Saved Locations
Whilst saving various places on Google Maps for navigation on my Android phone, I got annoyed that the phone only listed the address (Which gets confusing when you have a list)
To rename them to something more friendy, do the following:
1.) Star a place as per usual.
2.) Browse to https://www.google.com/bookmarks/
3.) Click "Edit" next to the one you want to change.
4.) Change the top line (That currently has the address) to the name you want.
5.) Click "Save"
Your Android device will automatically sync, and you will now see the user-friendly name when navigating :)
To rename them to something more friendy, do the following:
1.) Star a place as per usual.
2.) Browse to https://www.google.com/bookmarks/
3.) Click "Edit" next to the one you want to change.
4.) Change the top line (That currently has the address) to the name you want.
5.) Click "Save"
Your Android device will automatically sync, and you will now see the user-friendly name when navigating :)
Friday, December 20, 2013
Skype - Ultra High CPU Usage
The past few days I've noticed that my office laptops Skype was permanently sitting at +- 90%+ CPU usage. Since I use Skype for work, not using it was not exactly a viable option, and restarting it (And updating to the latest version) didn't help.
I did, however - Find a solution!
1.) Download Process Explorer
2.) Run it
3.) Right click on Skype, and click "Properties"
4.) Click "Threads" (Ignore the potential message about something not being up to date)
5.) Sort by CPU usage by clicking the 2nd tab from the left twice.
6.) Find that a single thread is using all the CPU (For me it was Skype.exe+0x705c although it's also known to be Skype.exe+0x7074)
7.) Click the offending thread, and click "Kill"
Skype's CPU usage will drop to what it's meant to be (0% average for me), with no visible side effects.
Seems like Microsoft have some threading bug with Skype that's existed for awhile :)
Seems like Microsoft have some threading bug with Skype that's existed for awhile :)
Friday, October 11, 2013
Copy.com VS Dropbox.com
I recently got suggested a new Cloud Storage service - Copy
After testing it for about 5 minutes, I give it the following review :)
1.) 15GB Default Storage - Awesome!
2.) The Desktop app seems awesome (Although the 45MB download is a bit overkill) - It's also native x64!
3.) Files can be direct linked - Which is awesome!
4.) HTML files are served as type text/plain intead of text/html- This is a critical fail on Copy's behalf.
Whilst the first 3 are awesome, the 4th is a critical failure, and so I will stick to Dropbox :)
After testing it for about 5 minutes, I give it the following review :)
1.) 15GB Default Storage - Awesome!
2.) The Desktop app seems awesome (Although the 45MB download is a bit overkill) - It's also native x64!
3.) Files can be direct linked - Which is awesome!
4.) HTML files are served as type text/plain intead of text/html- This is a critical fail on Copy's behalf.
Whilst the first 3 are awesome, the 4th is a critical failure, and so I will stick to Dropbox :)
Thursday, October 10, 2013
New IRC Client - AdiIRC
Whilst searching around for an IRC client with a native x64 build (Curse you mIRC ;D), I stumbled across AdiIRC.
TINY IRC Client (1MB) that's coded in C#, and 100% Free :D
I'd highly recommend it :)
TINY IRC Client (1MB) that's coded in C#, and 100% Free :D
I'd highly recommend it :)
Wednesday, October 2, 2013
How do I get started programming games???
By reading this fantastic guide by Tommy Refenes - That's how :)
Sunday, August 18, 2013
JavaScript - Regex to format currency
A simple way to format currency! Given a number, format it to a currency-esque format.
number.toFixed(decimalPlaces).replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
Sample:
Symbol (EG: R, $):
Number (EG: 1234567.50):
Decimal Places (EG: 1, 2, 3 - Probably 2):
number.toFixed(decimalPlaces).replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
Sample:
Symbol (EG: R, $):
Number (EG: 1234567.50):
Decimal Places (EG: 1, 2, 3 - Probably 2):
Saturday, August 3, 2013
Handler "PHP53_via_FastCGI" has a bad module "FastCgiModule" in its module list
I found this error after installing PHP on IIS, and attempting to browse to a local .php page.
Do the following to fix it.
1.) Go to Add / Remove Programs
2.) Click "Turn Windows features on or off"
3.a.) Open "Internet Information Services"
3.b.) Open "World Wide Web Services"
3.c.) Open "Application Development Features"
3.d.) Tick "CGI"
3.e.) Click "OK
3.f) Wait for it to complete.
4.) Attempt to go to your php page again.
\o/
Do the following to fix it.
1.) Go to Add / Remove Programs
2.) Click "Turn Windows features on or off"
3.a.) Open "Internet Information Services"
3.b.) Open "World Wide Web Services"
3.c.) Open "Application Development Features"
3.d.) Tick "CGI"
3.e.) Click "OK
3.f) Wait for it to complete.
4.) Attempt to go to your php page again.
\o/
Thursday, July 11, 2013
Wednesday, July 10, 2013
Online ASP.NET ViewState Decoder
I was looking for one of these, and it took me awhile to locate - Maybe someone will find it useful :)
Link: Here
Link: Here
Monday, July 8, 2013
XNB Decompressor
Whilst messing around with some XNA .XNB files, I wanted to see if I could extract any useful information from them.
A bit of googling later lead me to an archive with several files, and this!
Whilst it keeps the files as the ".xnb" format, it decompresses them allowing you to pull some info using a basic text editor :)
Thanks to the XeNTaX forum for the link :)
A bit of googling later lead me to an archive with several files, and this!
Whilst it keeps the files as the ".xnb" format, it decompresses them allowing you to pull some info using a basic text editor :)
Thanks to the XeNTaX forum for the link :)
Tuesday, June 18, 2013
3D JavaScript is weird...
3D JavaScript is weird...
An object can ONLY be collided with if it's in the scene, even if you're only using the object collection as collision reference.
The problem is that an object can only be collided with if it's of type geometry , which normal .obj's aren't.
Now, for the fun part!
Rendering a textured object is significantly faster than rendering an object with a mesh, so, whilst you could just use textured mesh's and render those, this is slow as heck.
And how do you get past this dilemma... ?
Add both the object AND the mesh to the scene, and hide the mesh's. Since they're technically there, they can still be collided with, and since they're invisible, they don't use rendering cycles ;D
Result: 60 FPS with full collision ♥
An object can ONLY be collided with if it's in the scene, even if you're only using the object collection as collision reference.
The problem is that an object can only be collided with if it's of type geometry , which normal .obj's aren't.
Now, for the fun part!
Rendering a textured object is significantly faster than rendering an object with a mesh, so, whilst you could just use textured mesh's and render those, this is slow as heck.
And how do you get past this dilemma... ?
Add both the object AND the mesh to the scene, and hide the mesh's. Since they're technically there, they can still be collided with, and since they're invisible, they don't use rendering cycles ;D
Result: 60 FPS with full collision ♥
Saturday, May 25, 2013
Friday, May 24, 2013
Friday, May 17, 2013
How to block ads from websites
As you probably see below this post (If it's the latest) and on the right of the page under the "Site History", I have added some ads.
But fret not - For this post shall include how to remove ads such as these! \o/
1.) Download and install Adblock for Firefox, Chrome, or Opera - If you're using IE... Download Chrome ^_^
2.) Subscribe to the recommended filter list - Should be called 'EasyList'
3.) Enjoy an ad-free experience :D
4.) Example With Adblock Installed: Click Me :D
Note: Some of the items in the image (Pencil, Spanner, Etc) only appear for me since I own the page ^_^
But fret not - For this post shall include how to remove ads such as these! \o/
1.) Download and install Adblock for Firefox, Chrome, or Opera - If you're using IE... Download Chrome ^_^
2.) Subscribe to the recommended filter list - Should be called 'EasyList'
3.) Enjoy an ad-free experience :D
4.) Example With Adblock Installed: Click Me :D
Note: Some of the items in the image (Pencil, Spanner, Etc) only appear for me since I own the page ^_^
Monday, May 6, 2013
Create a SQL Database using an existing MDF File
If you have an MDF file, and you need to create a SQL Database from it using code, do the following:
USE [master] GO CREATE DATABASE [insert_database_name_here] ON ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Data\fileNameHere.mdf' ), FOR ATTACH ; GO
Subscribe to:
Posts
(
Atom
)