Technical blog discussing various programming languages, frameworks and paradigms. Code snippets and projects are also provided.
Friday, 3 October 2014
A duplicate value cannot be inserted into a unique index - SQL Error
If the problem is your primary key, it's probably set to auto-increment and you have recently dropped some tables or refreshed your database for example. The problem therefore lies with your databases Seed Value. With the auto-increment properly of the primary key, the Seed Value will determine the next ID for your primary key. Chances are this has probably been reset with your recently database refresh. You can solve this issue with the following line of code...
ALTER TABLE tablename ALTER COLUMN columnname IDENTITY (newseedvalue, 1)
If your primary key values end at 150 for example, then you should replace 'newseedvalue' with 151. This will then be the new seed value for the next primary key.
Example (Start PK Identity at 1 for the tblNames table):
ALTER TABLE tblNames ALTER COLUMN ID IDENTITY (1, 1)
Thursday, 25 September 2014
.NET Windows Forms - Getting Docking to Work Properly!
Sunday, 7 September 2014
AddThis vs ShareThis vs Sociable (Social Media Plug-In Comparisons)
http://www.hyperlinksmedia.com/learning-center/helpful-web-tools/addthis-vs-sharethis/
Friday, 23 May 2014
How to Clear Error 5200 / P08 & Reset Printer Hardware (Canon Pixma MG2100 MX and S series printers)
Step 1) Unplug the printer from Power and wait 5 sec then Plug it back in.
Step 2) Press "Stop/Reset" button for 2 sec and hold it.
Step 3) Now Press and hold the "Power" button also with "Stop/Reset" for 5 sec.
Step 4) Release only "Stop/Reset" and wait for 2 sec (still holding "Power" button)
Step 5) Now press and release "Stop/Reset" 5 times.
Step 6) After 5 sec release "Power" button also (No LCD only power light seen).
Step 7) Wait for a minute (after the printer resetting).
Step 8) Now power off the printer by pressing "Power" button.
Step 9) After 30 Seconds press "Power" button again. Now you're ready to print !!!
All printer errors should be cleared!
Wednesday, 6 March 2013
Evasi0n - iOS 6.1.2 Untethered Jailbreak [v1.5 Released!]
Sunday, 10 February 2013
CSS - Web Safe Font Stacks
Enjoy!
Link Here: CSS Friendly Font Stacks
Wednesday, 30 January 2013
C#: Send a simple E-Mail via. Google Gmail SMTP Server
Here's a code snippet which allows you to send an E-Mail using Gmails SMTP server...
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Mail;
- using System.Text;
- /// <summary>
- /// Simple Emailer class for sending a simple email.
- /// </summary>
- public class Emailer
- {
- /// <summary>
- /// Takes a users email and item name and generates an email
- /// </summary>
- /// <param name="recipient">Recipients e-mail address</param>
- public static void SendMail(string recipient)
- {
- try
- {
- // Setup mail message
- msg.Subject = "Email Subject";
- msg.Body = "Email Body";
- msg.To.Add(recipient);
- msg.IsBodyHtml = false; // Can be true or false
- // Setup SMTP client and send message
- {
- smtpClient.Host = "smtp.gmail.com";
- smtpClient.EnableSsl = true;
- smtpClient.Port = 587; // Gmail uses port 587
- smtpClient.UseDefaultCredentials = false; // Must be set BEFORE Credentials below...
- smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
- smtpClient.Send(msg);
- }
- }
- catch (SmtpFailedRecipientsException sfrEx)
- {
- // TODO: Handle exception
- // When email could not be delivered to all receipients.
- throw sfrEx;
- }
- catch (SmtpException sEx)
- {
- // TODO: Handle exception
- // When SMTP Client cannot complete Send operation.
- throw sEx;
- }
- catch (Exception ex)
- {
- // TODO: Handle exception
- // Any exception that may occur during the send process.
- throw ex;
- }
- }
- }
Thursday, 22 November 2012
Facebook Developer: Debugger
You can enter an Input URL, Access Token, or Open Graph Action ID!
View Here: http://developers.facebook.com/tools/debug
Error when saving a table in SQL Server: "Saving changes is not permitted"
Saving changes is not permitted. The changes that you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.
Why?
This problem occurs when the Prevent saving changes that require the table re-creation option is enabled, and you make one or more of the following changes to the table:
- You change the Allow Nulls setting for a column.
- You reorder columns in the table.
- You change the column data type.
- You add a new column.
Fixing the Problem
OPTION 1 - Using the ALTER SQL keyword to change the table definition.
- ALTER TABLE NameOfTable ALTER COLUMN ColumnToAlter INT NOT NULL
Option 2 - Turning off the "Prevent saving changes that require table re-creation" option. NOT RECOMMENDED!. This may cause data loss due to changes with the meta structure of the table. A good example of potential data loss is if you enable Change Tracking.
If you only have the table structure set up and/or data loss isn't an issue (Test Data for example), then here are the following steps to turn off this data protection feature.
1. Open SQL Server Management Studio (SSMS).
2. On the Tools menu, click Options.
3. In the navigation pane of the Options window, click Designers.
4. Select or clear the Prevent saving changes that require the table re-creation check box, and then click OK.
Joining MP4 Files together without Re-Encoding (Windows and MAC)
VERY simple cross platform solution to join MP4 files. Just add them to the lit, re-order them, and it will simply copy the next video on to the previous at the end of the last frame. It will output the final MP4 without loss of quality or re-encoding.
Download Here: http://www.mp4joiner.org/en
OPTION 2 - Quicktime (7 or X at time of writing). Windows users must use Quicktime PRO ONLY.
1. Open the two H264 videos in Quicktime 7. Let's suppose they are named video1.mp4 and video2.mp4.
2. Working on video1.mp4, Select All, then Copy.
3. Switch to video2.mp4, make sure the "cursor" is at the beginning of the video, then Paste. This inserts the content of video1.mp4 at the front of video2.mp4.
4. This step is probably optional. "Save As" the modified video2.mp4. You will be able to save in .mov format only. I saved as a self-contained movie, but I suppose a reference movie would work too. I used the filename "video.mov".
5. Select "Export" in the file menu to export video.mov to the joined H264 file. The "Export" to select is "Movie to MPEG-4". The preset is not important, I chose "LAN/Intranet". The preset is not important because we override it in the next step.
6. Click on "Options" to reach the settings dialog. In the Video pane, "Video Format" is selected to be "H.264". Click on the menu, select "Pass Through". As expected, all the other options will get disabled.
7. Click OK, then Save, and watch your joined file be saved at the speed of your hard disk.
OPTION 3 - MAC Users Only!
SimpleMovieX, a shareware video editor which exactly advertises this as a feature. Requires OS X 10.6 or later.
Download Here: http://simplemoviex.com/SimpleMovieX/download.html