All posts by ernani

SQL Server remote access

I just found a gem of a post in how to make Sql Server talk to anyone in your network!

Source: https://stackoverflow.com/questions/11278114/enable-remote-connections-for-sql-server-express-2012

I will definitely go back to this everytime I want access to a database in our network.

Basically, this will show us how to set up SQL Server so that any program on the network is allowed access to its content given they have the right user access to it. It has something to do with enabling Sql Server browser and enabling TCP/IP connection.

Understanding DNS, Nameservers and Record types

Are you a web developer, who mainly focuses on developing your application? Do you only just update your nameserver and point to your hosting company at the registry and think everything will just work with no hiccups and go on your business coding? If yes then dont be that developer as I was.

Nameservers comes first! 

You have to understand this bit to understand everything else in the DNS realm (https://webmasters.stackexchange.com/questions/16297/which-comes-first-dns-or-name-servers link to the article) .  I have spent my night trying to uncover this puzzle basically there is 2 entities that you will likely come across when dealing with DNS, the Domain Registry(where you bought your domain) and your Web Host DNS manager(your webhost).

When you change your nameservers to your new hosting, you are basically saying to delegate all DNS records to that server thus allowing your new web host to handle your DNS or RR(Resource Records). Your Domain Registry will be free of responsibility when it comes to other records you have on it. I am saying the A , AAAA, MX records etc. These records will now be handled by your web host dns manager.

Very important if you have existing RR in your domain registry make sure you leave them be until you actually know whats happening and make sure you read this blog post before committing. So what you can do is to copy all your resource records from your original DNS to your hosting company, which to be honest is I dont like doing because a lot things can go awry when you get it wrong and will take time for it to get right.

OR

Create an A record for your domain.com to point to the IP address of your hosting company. Then create an MX record for that domain.com to point to your current mail.domain.com DNS, then do the rest for every RR you have, that includes FTP, SFTP sub-domains.

Source: https://serverfault.com/questions/149509/changing-domain-name-dns-to-redirect-web-traffic-to-one-server-and-leave-mail-t

So there you have it! If you are wondering what those records do here is a quick rundown below.

A records – translate domain name to IP address eg. domain.com -> 118.123.9.12

MX records – for email service that only points to domain name. eg mail.domain.com -> A record.

CNAME record – an alias to another name record or domain name.

AAAA record – A record but points to IPv6 instead of IPv4

More info:
CNAME https://www.web24.com.au/tutorials/cname-records-used

What is ‘@’ record used for:
http://forums.devshed.com/dns-36/mean-setting-dns-settings-636502.html

Windows: Do everything with shortcuts!

When working on your chosen OS, we tend to do repetitive work using our mouse. The time to move the mouse to the direction of the icon you wanna click is more effort than pressing 2 to 3 keystroke on the keyboard. So what do someone like us lazy people do to make this effortless and hopefully avoid injury to our hands in the future? Shortcuts! Here I will list my most used chores on windows that I often find doing.

Changing Explorer View
CTRL + SHIFT + 1 Extra Large
CTRL + SHIFT + 2 Large Icons
CTRL + SHIFT + 3 Medium Icons
CTRL + SHIFT + 4 Small Icons
CTRL + SHIFT + 5 List
CTRL + SHIFT + 6 Details
CTRL + SHIFT + 7 Tiles
CTRL + SHIFT + 8 Content

Using RUN command with WIN + R key:
cmd  To open cmd line.
Press win key , type cmd press ctrl + shift + enter Run as administrator.
services.msc  Open services window
control  Open control panel
ncpa.cpl  Open network connections
regedit Registry Editor
shift + F10 To display right click on any object selected
appwiz.cpl Very handy to open Add/Remove program

Open CMD on any window explorer open:
alt + d and type cmd This will open command line in that folder

Editing Text
shift + up or down – To select whole line or below line.
shift + home or end – to select from cursor left and right, very useful

Navigating Windows Explorer
F6 Very handy to navigate to different elements of the window like the left panel to get the drive you want
alt + DMove focus to the address bar and select current path.
ctrl + N Open new window on the same folder
Alt + Right Arrow Go forward.
Alt + Left Arrow Go back.

Paper sizes people!

Okay I just added a new category on my blog. Hello Printing! This is due to the fact that I have started in a new role and its an Industry that I have never dealt with before!

For most part its a marketing business that deals with all sort of things pertaining to the subject. And majority of the company deals with marketing print jobs such as flyers, brochures, letterheads, invoices etc. Mainly direct mails!

One thing you will want to know are of course the ‘stocks’ as the commercial term for papers!

Anyways first off you will definitely want to familiarize yourself with paper! We all know about A4 and A3 sizes but never really thought about what the numbering means. And to be honest I would never in my programming experience ever think about this stuff, but to effectively do my job there, I gotta to know this otherwise Im just shooting blanks!

In summary A letter is actually a standardize ISO 216(International Organization of Standardization) for paper. And there is a B which isn’t widely used but mostly good for posters, then there is the C, which I did not know anything about! Envelopes!

So if you are ever lost with the measurements and terms when it comes to paper sizes come back to this page and here is the link to make you come back home. And yes I am talking to myself here.

Below the link to paper sizes and a very informative website indeed:
http://www.paper-sizes.com/

Credit and big thanks to the author.

PS: You might also want to know about RA or SRA papers such as SRA3 for A3, these are untrimmed papers for cutting A3 bleeds but that is another post altogether!

Untrimmed Raw Format (RA and SRA)
http://www.papersizes.org/ra-sra-untrimmed.htm

Port forwarding and Software Update Implementation

Port Forwarding
I was trying to set up remote access to my router from outside world(I have done it before) and have access to network drive and for the love of me, could not seem to get it to work.

It is so easy for a long time of not doing it and understanding how they all work, your way of thinking just shifts and completely throw you off balance. You know how they work and such but you just need that one sentence to explain it all until… I only needed to see one picture.

Simple illustration of how port forwarding works.

And everything just became clear and smooth sailing!

Software Update Implementation
As you write software and programs and such, you think how do they actually perform an update onto itself, so I went and ask Google. Its actually pretty basic in terms of step by step process, although if you are only making a small simple program sometimes the technology you are using have it figured out for you.

Just like program in C#.NET, they have the ClickOnce installer where you can upload your package to a server and have it check by the computer if you have the latest version of the application. You can either go that way or a  more traditional route.

Have a separate process in your program that checks the server if you have the latest version installed, and allow the program to download the new version. Then ask the user to install the new version or have it closed and let the updater do the job for you by replacing all necessary files. An will run the newly updated program to continue.

For more information about this topic:
https://stackoverflow.com/questions/1748586/i-dont-get-how-a-program-can-update-itself-how-can-i-make-my-software-update#_=_

Windows Install change hardware configuration

Ever wondered how licensing works now comes Windows 10? Back in previous Windows OS, as soon as your pc glitches the last resort for salvation is through fresh install of the system.

I can just boot from my DVD drive using the OS CD and input back your serial number and away you go.

This is still applicable in the latest Windows 10. You can also create a boot USB disk if you are trying to install to a different drive. But somewhat came as a bit confusing as many devices now came pre-installed with the OS.

If you are building your own system, you will need to buy your own license or if you have a Windows 8 or 7. You can go to the upgrading route. When your build PC you have to know that, new motherboard = new license.

Here is a link that will help you understand a little bit the process how installation of new OS works.

How does Windows 10 licensing status change with changes in hardware configuration

In other words, when you buy a new PC loaded with operating system, you need to ask how they installed the OS. And make sure you get the serial key off them by hook or by crook if its not already on the physical box on the sticker.

 

Marshalling and Serialization

These 2 concepts you will often encounter when writing applications especially dealing with data and communication between 2 programming languages.

They seem synonymous to each other but have slight difference.

Serialization is a process of converting an object ready to be written on disk and transmission. In layman’s term object converted into bytes.

Marshalling is to serialize an object just like the explanation above but also gives functionality to convert them back to their original form. Let say C# object serialized and written to disk as “file.dat”, and for C++ to read the file, and a function gets exported as well. When you call that function the data inside the object gets return and process of marshalling concludes.

This also copy and pasted from the link:

In regards to commonality between marshalling and serialization, they both have in common to allow streaming of a representation of an object or a hierarchy of objects to typically be put in a medium (file, memory) for the reverse process to restore the initial object or object hierarchy.

Reference link below:
https://www.quora.com/What-are-the-differences-between-serialization-and-marshalling

 

C++: Range-Based loops

I have come across a new way to loop through collections and range.

It consist of example code below:

for (auto const &x : vec)
{
  // x is a reference to an const item of vec
  // We can not change vec's items by changing x 
}

This is definitely new to me and a welcome change as using auto creates a placeholder for any types and can be anything with a proper cast to return back to its original form.

The new loop also simplifies the code as more explain by the link:

https://stackoverflow.com/questions/15176104/c11-range-based-loop-get-item-by-value-or-reference-to-const

Visual Studio: Useful Shortcuts

General:
Ctrl+Shift+ B  | Build the project
Ctrl + – | Ctrl + Shift + – | Navigate backwards and forward
Ctrl+K then Ctrl+C | Comment selected or cursor
Ctrl+K then Ctrl+U | Uncomment selected or on the cursor
Ctrl+K then Ctrl+F | Format and beautify selected code
Ctrl+L | Delete a line or selected
Ctrl+U | Changes the selected text to lowercase characters
Ctrl+Shift+U | Changes the selected text to uppercase characters
Ctrl + W | Selects the word near the cursor or highlighted one
Ctrl+Tab | Change active document among the open ones.
Ctrl+Shift + Space | Show tool tip for parameter function.