Still trying to figure this whole posting thing out.
If I post something how can I make a reference to a static page for further information? Or more importantly to a section of a static page?
Go to the second part of the page
Kung Fu Kode
Wednesday, June 24, 2015
Thursday, January 22, 2015
Using Task Shortcuts to keep track of code
Using Task Shortcuts to keep track of code
Bookmarks are OK for some things, but there is not an easy way to know what exactly a bookmark points too. A better way is to use the "Task List Shortcuts" which will display the text of the line of code they are on in the "Task List" window.
First make sure your Task List window is open.
View-Task List (Ctrl+W, T)
Now create a Task List Shortcut by placing the cursor on a line you want to be able to jump too, then choose Edit-Bookmarks-Add Task List Shortcut (Ctrl+E, T)
In the Task List window you opened earlier you will need to click the drop-down at the top and click on "Shortcuts".
Now you should see the line of code that you had marked as a shortcut earlier.
First make sure your Task List window is open.
View-Task List (Ctrl+W, T)
Now create a Task List Shortcut by placing the cursor on a line you want to be able to jump too, then choose Edit-Bookmarks-Add Task List Shortcut (Ctrl+E, T)
In the Task List window you opened earlier you will need to click the drop-down at the top and click on "Shortcuts".
Now you should see the line of code that you had marked as a shortcut earlier.
More about Tasks
When you first start a project the Task List window will only show an entry in the drop down to display "User Tasks". This can be used to organize what steps need to be done to complete a project. This include a check-box for completion and the ability to prioritize tasks. All pretty self-explanatory.
But there are other cool ways you can leverage this window. As you are typing your code you may think of something that needs to be added at a later time, but you don't want to tackle it now. If you create a comment with the keyword "TODO" at the beginning, the Task List drop-down will add a section called TODO and will list all of the To Do's you have typed in. You can double click it to navigate to that place in the code.
There are actually three built in tokens you can leverage by default:
Tools-Options
Environment section - Task List
Add the name of the Token you want to create, choose a default priority and click Add.
Now the Task List window will have a section for your custom tokens.
But there are other cool ways you can leverage this window. As you are typing your code you may think of something that needs to be added at a later time, but you don't want to tackle it now. If you create a comment with the keyword "TODO" at the beginning, the Task List drop-down will add a section called TODO and will list all of the To Do's you have typed in. You can double click it to navigate to that place in the code.
There are actually three built in tokens you can leverage by default:
- HACK Indicates a workaround.
- TODO Indicates something to be done.
- UNDONE Indicates a reversal or "roll back" of previously changed or updated code.
But Wait There's More !
You can also create your own custom tokens to track and navigate code.Tools-Options
Environment section - Task List
Add the name of the Token you want to create, choose a default priority and click Add.
Now the Task List window will have a section for your custom tokens.
Tuesday, March 27, 2012
Learning to Code - C# Hello World
Links:
Learning to Code - Introduction
Now save this file as HelloWorld.cs
Now you have a "program" it is a really simple console application that will show the words "Hello, world!" when it is run. But the first thing we have to do is to convert the human readable file (Specifically in the Microsoft .Net C# language) to one that can be read and executed by a machine (Binary Code, think lots or 1's and 0's strung together). This is called "Compiling" and the program that is used to compile this is called CSC.exe.
The compiler can be found at the following location(s) on your computer depending on what version of the .Net compiler is installed :
The x86 locations are...
C:\Windows\Microsoft.NET\Framework\v2.0.50727
C:\Windows\Microsoft.NET\Framework\v3.5
Learning to Code - Introduction
Start
Open Notepad on your windows operating system of choice.
Type the following code into your Notepad window:
class HelloWorld
{
static void Main()
{
System.Console.WriteLine("Hello, world!");
}
}
Now save this file as HelloWorld.cs
Now you have a "program" it is a really simple console application that will show the words "Hello, world!" when it is run. But the first thing we have to do is to convert the human readable file (Specifically in the Microsoft .Net C# language) to one that can be read and executed by a machine (Binary Code, think lots or 1's and 0's strung together). This is called "Compiling" and the program that is used to compile this is called CSC.exe.
The compiler can be found at the following location(s) on your computer depending on what version of the .Net compiler is installed :
The x86 locations are...
C:\Windows\Microsoft.NET\Framework\v2.0.50727
C:\Windows\Microsoft.NET\Framework\v3.5
C:\Windows\Microsoft.NET\Framework\v4.0.30319
The 64bit locations are...
The 64bit locations are...
C:\Windows\Microsoft.NET\Framework64\v2.0.50727
C:\Windows\Microsoft.NET\Framework64\v3.5
C:\Windows\Microsoft.NET\Framework64\v3.5
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Open up either a DOS window, or if your a power user you can open a Powershell window.
Change to the directory where your HelloWorld.cs file is, for example on my machine I would type:
CD D:\jp\prj\HelloWorld
Then call the csc.exe file at the location you chose with one paramater which is the name of your C# Helloworld file for example:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe HelloWorld.cs
This will compile your file into a file that can be executed from your DOS console. It will be named HelloWorld.exe
Now you can run your first C# console application
HelloWorld.exe
Hello, world!
Next we will examine just what that code is doing.
Open up either a DOS window, or if your a power user you can open a Powershell window.
Change to the directory where your HelloWorld.cs file is, for example on my machine I would type:
CD D:\jp\prj\HelloWorld
Then call the csc.exe file at the location you chose with one paramater which is the name of your C# Helloworld file for example:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe HelloWorld.cs
This will compile your file into a file that can be executed from your DOS console. It will be named HelloWorld.exe
Now you can run your first C# console application
HelloWorld.exe
Hello, world!
Next we will examine just what that code is doing.
Monday, March 26, 2012
Learning to code - Introduction
So you want to be a 1337 HAX0R with MAD SK1LZ? (Whats this?)
Want to create a simple family website with simple tools?
Want to create a more complex website with more advanced tools?
Want a deeper understanding about what "Programming" or "Coding" is all about?
Well hopefully this series of articles will help you out.
Want to create a simple family website with simple tools?
Want to create a more complex website with more advanced tools?
Want a deeper understanding about what "Programming" or "Coding" is all about?
Well hopefully this series of articles will help you out.
The Approach
Personally, I am fairly new to blogging so I will be learning new blogging tricks along the way. When I want to learn some new technology, I appreciate simple blogs with lots of examples so this is how I will approach teaching how to write code. However I will intersperse the article with helpful links that may explain a given subject in more detail for those that wish it. But if you just want your computer to be able to "do stuff" you should be able to get up and running in no time.
For these articles, the most accessible language and environment I can think of is the Microsoft .Net platform. It supports multiple languages and can be used with a simple Notepad editor to start creating programs right away. It also has a free version of its IDE (Integrated Development Environment) that can be downloaded and take writing software to the next level.
Lets Start - Hello World
The classic program that all software developers use when starting a new language is "Hello World". This is simply getting enough knowledge of a new language that you can output the words "Hello World" to the computer screen. (Geeky History of HelloWorld) (HelloWorld in a variety of Languages)
I want to follow the C# coding path
I want to follow the HTML (web sites) coding path
Thursday, October 20, 2011
Javascript JQuery passing events weirdness
Back in the day I wrote some pretty cool Javascript, but I got more into a middle layer software world and had not touched UI for a long time.
In the meantime Javascript came a long way with the new JQuery language so I thought I would take a crack at it.
So I found this site http://docs.jquery.com/How_jQuery_Works and started to work on the example and I immediately discovered something that I am sure is understandable, but I don't understand how it works.
The example given is this:
Which worked but I immediately wanted to refactor those anonymous functions to make it more readable so I created this:
function ClickIt()
{
$("a").click(AlertIt(event));
}
function AlertIt(event)
{
alert("As you can see, the link no longer took you to jquery.com");
event.preventDefault();
}
$(document).ready(ClickIt());
The problem was the when I ran the new version the "event" object passed into the AlertIt(event) was null. Odd, so after much playing around I finally discovered that I needed to call AlertIt with no paramaters and it worked. So why is that ? Feel free to comment.
In the meantime Javascript came a long way with the new JQuery language so I thought I would take a crack at it.
So I found this site http://docs.jquery.com/How_jQuery_Works and started to work on the example and I immediately discovered something that I am sure is understandable, but I don't understand how it works.
The example given is this:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery demo</title> </head> <body> <a href="http://jquery.com/">jQuery</a> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script> $(document).ready(function(){ $("a").click(function(event){ alert("As you can see, the link no longer took you to jquery.com"); event.preventDefault(); }); }); </script> </body> </html>
Which worked but I immediately wanted to refactor those anonymous functions to make it more readable so I created this:
function ClickIt()
{
$("a").click(AlertIt(event));
}
function AlertIt(event)
{
alert("As you can see, the link no longer took you to jquery.com");
event.preventDefault();
}
$(document).ready(ClickIt());
The problem was the when I ran the new version the "event" object passed into the AlertIt(event) was null. Odd, so after much playing around I finally discovered that I needed to call AlertIt with no paramaters and it worked. So why is that ? Feel free to comment.
Thursday, June 9, 2011
Protect your site from Phishing and Pharming
These are suggestions for developers to protect against phishing attacks that may use your site to target your users for phising attacks.
Phishing attacks are a social engineering attack that targets the users of your site. At its simplest the phisher will send an email to your users that appears to be from you, and requests they click on a link that will take them to another site, that looks like your site, and asks them to update or verify their personal information. Once that is collected the user then becomes a victim of identity theft by the criminals.
So the main defense involves educating the users on how they can avoid being tricked into responding to these type of attacks.
On your website
Policies
Create a policy that defines precisely what you will do and NOT do during communications with the user. Make the policy as easy to understand as possible, no legalese. Make sure the policy is easily visible on the website.
Encourage end users to install and update anti-virus and anti-spyware software.
Make it easy for users to report possible scams involving your site through a feedback forum or email address.
Place a warning on website that you will prosecute phishers and scammers.
Provide help to users that have been victimized.
Coding
Do not use popups and inform the user you will never use a popup and to inform you if it happens.
Prevent sites that may frame your site
Use the TARGET directive to create a new window
<a href=”http://www.yoursite.com/” target=”_top”>
Check the DOM model to reject any access from frames.
Do a referrer check on your web page, this will stop links from emails.
Protect your site from XSS attacks.
Always use the domain name and not ip addresses for your site.
Disable unused accounts.
Protect your data
Don't store or display data that is not needed by the user.
Don't ever display the password.
Validate that data is internally consistent, for example a florida address with a california zip could be a warning sign..
Setup daily access limits for unverified customers.
Consider only shipping to a users billing address.
When updateing an email or physical address, send notification to both addresses.
Never display passwords, use a one time limited password to recover passwords.
Consider emailing activity logs to user to confirm valid activity.
Limit transactions from a single user in a given time period.
Check for multiple addresses using the same shipping address.
Forensics
Use watermarked images and change the watermarks often, this can give a time frame of when the image was used on a phishing site.
Investigate web logs for spiders that go through all you web pages and images, note ip addresses.
Communicating with users
In emails dont provide links to click if possible, and explain to the users that they should type the url into their browser.
Use consistent branding and a single url for users to access to reduce confusion.
Always inform them that you will never ask for any personal information through email.
Reduce information in email, direct users to your website where you can provide the information.
Consider text only email rather than HTML
Don't use shortened url services, always use our base URL
Don't send email that an account lockout has occurred, simply provide email or phone number for them to call. Or even better phone the person directly.
More information:
Anti-phishing working group
http://www.antiphishing.org/
Phishing attacks are a social engineering attack that targets the users of your site. At its simplest the phisher will send an email to your users that appears to be from you, and requests they click on a link that will take them to another site, that looks like your site, and asks them to update or verify their personal information. Once that is collected the user then becomes a victim of identity theft by the criminals.
So the main defense involves educating the users on how they can avoid being tricked into responding to these type of attacks.
On your website
Policies
Create a policy that defines precisely what you will do and NOT do during communications with the user. Make the policy as easy to understand as possible, no legalese. Make sure the policy is easily visible on the website.
Encourage end users to install and update anti-virus and anti-spyware software.
Make it easy for users to report possible scams involving your site through a feedback forum or email address.
Place a warning on website that you will prosecute phishers and scammers.
Provide help to users that have been victimized.
Coding
Do not use popups and inform the user you will never use a popup and to inform you if it happens.
Prevent sites that may frame your site
Use the TARGET directive to create a new window
<a href=”http://www.yoursite.com/” target=”_top”>
Check the DOM model to reject any access from frames.
Do a referrer check on your web page, this will stop links from emails.
Protect your site from XSS attacks.
Always use the domain name and not ip addresses for your site.
Disable unused accounts.
Protect your data
Don't store or display data that is not needed by the user.
Don't ever display the password.
Validate that data is internally consistent, for example a florida address with a california zip could be a warning sign..
Setup daily access limits for unverified customers.
Consider only shipping to a users billing address.
When updateing an email or physical address, send notification to both addresses.
Never display passwords, use a one time limited password to recover passwords.
Consider emailing activity logs to user to confirm valid activity.
Limit transactions from a single user in a given time period.
Check for multiple addresses using the same shipping address.
Forensics
Use watermarked images and change the watermarks often, this can give a time frame of when the image was used on a phishing site.
Investigate web logs for spiders that go through all you web pages and images, note ip addresses.
Communicating with users
In emails dont provide links to click if possible, and explain to the users that they should type the url into their browser.
Use consistent branding and a single url for users to access to reduce confusion.
Always inform them that you will never ask for any personal information through email.
Reduce information in email, direct users to your website where you can provide the information.
Consider text only email rather than HTML
Don't use shortened url services, always use our base URL
Don't send email that an account lockout has occurred, simply provide email or phone number for them to call. Or even better phone the person directly.
More information:
Anti-phishing working group
http://www.antiphishing.org/
Subscribe to:
Posts (Atom)