C++: Road Block – Renamer Tool

I was just coding away with my Renamer Tool and suddenly hit a road block. My Renamer tool is a Csharp WPF application that renames files according to Filter set by the user. It will also features a way to select multiple files from window explorer to be selected and right clicked to open up with the program.

I thought this was simple as I was googling along adding context menu feature. It led me to..

Shell Extensions.

Ugh… it is said that writing a shell extension in managed code like CSharp is discouraged. And mostly the only way is through..

C++ Active Template Library or COM…. went to have a look through how to implement this. Questions upon questions upon questions!

Apparently writing a shell extension in C++ is like diving to a different world of programming, prepare to go back to the old ways as this requires the knowledge of the old windows api calls. Which has specific OS types and classes.

My program is almost there , and knowing me, I like to use this program for my personal use and Im pretty sure others would like to use them as well.

So what now? I do have some basic knowledge of C/C++, but never ever done shell extensions before or COM which is like assembly language.

Wish me luck, cause Im about to dive in!

Helpful Links:

http://stackoverflow.com/questions/8811621/how-to-write-a-shell-extension-in-c

http://softwareengineering.stackexchange.com/questions/194764/what-is-lpctstr

Programming: JQuery Questions

Recently been asked few programming questions, and the heck wasnt ready for those. The questions were 1. whats the difference between .parent() and closest() in JQuery, and surprise surprise I wasnt able to give an answer, all I can think about is parent(), is of course getting the parent of the element but wasnt sure whats the closest() function was. A simple search takes me to Traversing and there it is. I just had a look at the description and yep. closest(selector) takes an argument selector to look for the closest element and traverse to the tree all the way up the root html.

2. create a function isPalindrome($x), this one I just didnt know what palindrome means, went to search again and there it was, the term palindrome any text given and if reverse should be the exact same as the original. when I was cooking dinner.. just thought there might be a function the reverses the string and then match it against the original.meek .. too late.

3. (selector, selector, selector).fadeIn() how do you construct a function so they dont fade at the same time? Ugh another challenge when you are at the moment not using JQuery. Since I havent really delve into much in JQuery lately, top of my head just said just separate each one so they fade in order. Later that day I did a quick search “multiple selection”  and there it is the each() function, then I thought there must be a way to delay it for some milliseconds and there I went and look for the function there it was delay(milliseconds) chain them together with passing each(index) and voila .each(function(index) { $(this).delay(500*index).fadeIn(1000) }); would have been the answer again too late! lol

4. The last question I couldnt put together was to construct a regular expression, I can answer it but I just needed more time to pull up all my symbols expression using these: ^ $ * { } [] a-z 1-9 ? ! + ABC.  I know how to use them and what they means. Again out of time and too late.

Anyways Ive learned something new that day, which Im always happy about. Just so excited in the world of programming, I may not get a good result but it was definitely fun!

Identifying your weakness and strength

Howdy! We all have our strengths and weaknesses as a person and in our profession. You know yourself better than anyone else or maybe someone knows your better than yourself but most likely its yourself your biggest critic.

Its hard to admit that we have them. Its even harder when it shows and everybody notices it. For example Im not scared to admit one of my weaknesses is …. wait for it.

Im slow to pick up cues. I dont usually understand things that are new. I dont usually pick up jokes straight away, I cant even give a quick remarks back to someone being a smart ass. In all Im slow.

I identify it and proven, that is indeed a weakness or perhaps just part of how you as a person . Its just one of those weaknesses that its just there and can never be improved or fixed or maybe it can . So what do you do?

There is something you can do! Focus on your strength! I know Im slow, but I know that I am a also a critical thinker as well, what this makes you? It means you just dont go opening your mouth without thinking of the consequences, it means you never decide things on impulse, it means you analyze the situation as hard as you can to make  better decisions because you consider every options possible.

In this sense when one of your weakness shows up, there is one of your strength to help you out. Never forget the value that you have, identify your short comings if you can improve on them then yes improve on them, but never forget your strength its there to put you back up your feet.

This post is to just to remind us about learning to identify our own weaknesses, learn to accept them, know why you have them and finally how to do get pass them by identifying your strength!

Enter Git: Best way to learn git?

Hello, as a developer you need some sort of version control for your changes to your project or repository,handle them and work with colleagues as you do.

So meet Git, its a very straight forward tool I cannot give a well straight forward instruction but as a  beginner like you and me I found these video that can help us out. In summary these are the commands you will use from your day to day job using Git.

  • git config –global user.name “John Doe” and user.email “[email protected]” – this is for setting up an account
  • git init – starting your repository
  • git status – tell us that our working project are the same in the repository if not then use next command
  • git add .(all) or git add (filename) – you add the changes to the staging stage ready to be committed or made put the repository
  • git commit -m “Your message about the changes” – finally put your changes to the repository
  • git log – these views any commits your team has made then add in –author “Beth” to see Beth’s commit message
  • git help – get help will show list of commands you can use and their usage
  • git diff – show the comparison , and show updates made from the old one, and remember this is before you do a commit. Otherwise there is nothing to show.
  • git diff –staged – compare your “staging” changes to your “repository” otherwise default is between “working” directory and the “repository”

Here is now the video you are waiting for, a very informative  tutorial that can get you started from beginner to advanced.

Credit to the video uploader. I learned alot from this tutorial. And I am sure you will too.

In another note, once you got a good grasp on Git. You might want to put your repository/project online then you know whats coming , GitHub! There’s other repo container out there but GitHub is like the standard. Anyways  thats it for now 🙂

Enter C# Unity Container, Inversion of Control

Coding in C# is pretty straight forward although sometimes you see errors every now and then. Working with WPF(Window Presentation Foundation) and MVVM can get really complex with large projects you can get lost in the sea of codes.

One thing Im going to talk about is Dependency, we use it all the time. Sometimes we need an model object that represent the data in our class and consume it, sometimes we need a database layer class to every object that will communicate with our server.

Inversion of Control is a pattern on how to pass dependency object through constructor. Enter Unity Container, its a Microsoft object that handles dependencies through the use of IoC.

We create the instance of the UnityContainer object and register types so unity will construct our dependency for us. You then resolve the classes that are involved in the dependency by calling obj.Resolve<typeof>(). This will chain up the classes with their dependency object injected.

Check links below for a simple explanation of the architecture.

https://www.youtube.com/watch?v=CWwe9Z0Gyew PART 1
https://www.youtube.com/watch?v=PsIbevgzQQE PART 2

Credit to the author

Whats the go with SSL/TLS ?

Many have been confused to what is the go with SSL(Secure Socket Layer) security  aka TLS (Transport Layer Security). We all know its for security purposes online, to encrypt your communications between websites. We also know how it passes a public key or shared key in order for the client browser to decrypt and the server to decrypt using its private key. And protect communications from frying eyes.. etc etc.

But as I beginner in SSL , how would one implement this? And questions arises .. When I was learning it at these were the question that popped in my head.

  1. Why do we need a CA (Certification Authority)?
    • This Authority identifies who you are or in our case our website. A stranger cant just trust anyone online, let alone giving you their credit card details. So these guys are authorities that will ask a bunch of questions and documents so you can prove your identity and the authority will trust you and the public will trust the authority that trusted you.
  2. When should we implement a Self-signed certificate?
    • You can try to self-signed your own certificate but as mentioned, they will get a confirmation in your browser whether they should trust you or not. Your website will still be secure and protected but the trust issue is still at hand. That means you can generate your keys to encrypt your data line. But efficiency and peace of mind and for your audience in the internet, go with a CA otherwise use your self-signed only a need to need basis in your own network.
  3. Who generates the keys?
  4. What types of certifications are there?
    • Theres a bunch! Positive , wildcards are mostly offered by CA and quick search should point you to the right direction. But first off positive one only secures your yourdomain.com and www.yourdomain.com, wildcards as you may suspect gives your sub-domains plus the with or without www.

There are plenty of articles about how to implement this on your site. Especially a WordPress one like this one.

http://stackoverflow.com/questions/292732/self-signed-ssl-cert-or-ca

Most of the questions above will be answered by the above link.
Useful link below:

What is CSR file for?  https://www.sslshopper.com/what-is-a-csr-certificate-signing-request.html

 

C#: WPF DependencyObject; What is it exactly?

Been developing a Rename Tool in C# using WPF as my window form, and data binding is giving me a bit of trouble understanding. There are other ways to make data binding in WPF, and Dependency Property is the one that boggles the mind.

Alas I have found an article that led me to a more thorough explanation to why you would use it.

http://www.pinfaq.com/32/what-is-dependency-object-in-wpf-where-should-i-use-it

In short Dependency Object is the object where WPF controls derive from and it provides all the validation, notification, updating , callbacks otherwise you would implement yourself which is possible but just time consuming.

This comes down to using Dependency Property  on your own class.

Web Content Accessibility Guidelines 2.0

Us web developers has individual guidelines for ourselves, but there really is a real guidelines out there and its called WCAG 2.0 as in Web Content Accessibility Guidelines to develop a healthy functional and accessible product for a range of audiences.

You can read through them in the w3.org website for thorough explanations.

Here is a good checklist too by Wucag
https://www.wuhcag.com/wcag-checklist/

I can always go back and have a read through for a refresher.

Adding Custom Context menu in Windows and my Rename Tool

I have been thinking of putting a custom context menu entry in my program, and this is the registry place to put your values into.

How to Add Any Application Shortcut to Windows Explorer’s Context Menu

And all you need to do is code your application to add them in your Visual Studio set up install function using the RegistryKey class in C# (at least), or use Inno Installer program to add a section as [Registry], the Inno Setup help is available if you need a reference.

I am thinking of creating a program that lets you rename all the filenames in a folder by adding a prefix or suffix or using regular expressions by right clicking the folder and call upon the program and a windows pops-up confirming your intention to rename.

Its very handy little tool , Im just in the process of putting them together. So the step would be:

  • Make the program
  • Create an installer for the program most likely use Inno Installer
  • Let the installer create the registry entry for you using { yourprogram.exe 1% } where the 1% is the folder path.
  • And run your program base on the folder path otherwise the user can select the folder to rename files.

 

2017 © Ideas, designs and algorithms