How to Move Images with Arrow Keys in a Windows WPF App

In Image Processing applications it is sometimes necessary to move a selected image (or part of image) to place at a specific position. For example, it is applicable to Form Processing, where predefined templates of different forms exist. When you select an image and place a predefined template on top of the image, it may happen that the position of the image needs to be adjusted to align it with the template. In such cases, you can use keyboard arrow keys to move the image horizontally and/or vertically.

We are exploring the same in a Windows app built with .NET, C#, and WPF. We have found several ways of moving the image when the image control is placed within a Canvas. Canvas is used as a container in WPF, where you can place several controls, but this case is a bit different. Here the image control is not placed within a Canvas – a different container has been used to place the image.

To achieve the image movement functionality, the PreviewKeyDown event can be used for Image control. This event occurs when a key is pressed, while the focus is on the image control. So, the first part is over, i.e., connect the arrow keys with the image control. The next question is how to move the image? For this set the image control’s margin whenever a specific keyboard key is pressed. Here is some code to alter the margin for the image control.

private void OnPreviewKeyDown(object sender, KeyEventArgs e)

{

switch(e.Key)

{

case Key.Left:

leftMargin -= 5;

e.Handled = true;

break;

case Key.Right:

leftMargin += 5;

e.Handled = true;

break;

case Key.Up:

topMargin -= 5;

e.Handled = true;

break;

case Key.Down:

topMargin += 5;

e.Handled = true;

break;

default:

MessageBox.Show(“Invalid key pressed”);

break;

}

this.image1.Margin = new Thickness(leftMargin,

topMargin,

rightMargin,

bottomMargin

);

}

In the above code, say the image control currently has the focus and you want to move the image to the left. For that just press the left arrow key. Then the PreviewKeyDown event is called and it comes to the Key.Left case, which decreases the left margin by 5. In effect, you will see the image move to the left. The movements toward right, top, and bottom also work the same way.

Please remember the following points:

  1. The image control must have focus.
  2. Set the KeyPressEventArgs.Handled property to TRUE – it will cancel the KeyPress event; otherwise, the image control will loose focus and the PreviewKeyDown event will not called on arrow key press.

Enjoy playing with images in a WPF application on Windows.

Detecting Prohibited Software

What is a ‘Prohibited software’?
Prohibited software refers to a software program or application, which is deemed inappropriate and not allowed to be installed in any computer in a specific IT environment. The reason in general are security vulnerability / threat that it can create to that computer or even to the entire IT environment. It’s a kind of banning or blacklisting a particular software for a specific IT environment. The reason for putting a software in such a category differs from organization to organization, depending on the domain of operation, data sensitivity, security concerns etc. Therefore, a software that is “prohibited” or blacklisted in one organization might be freely used in another, and vice versa. However, certain kinds of software are more likely to be marked as prohibited in workplaces.

Importance of detecting ‘Prohibited Software
Computer users of an IT network often install different kinds of software – within the organization (e.g., on a server share), from a friend / colleague, download from the Internet, and such. Many of these software turn out to be failing in the security standards and cause vulnerability / threat to the entire network. New software of various types and increasing complexity are emerging on a regular basis. There are a lot of free software available on the Internet that are quite useful. For example, Adobe PDF Reader, Internet browsers (Firefox, Chrome, IE, Safari, Opera), Skype etc. are from highly reputed software publishers and widely used at home as well as in small to large organizations. There are also many popular games, media players, chat applications etc. From our own experience, a widely used “free” media player app also tries to install a bunch of other software, and even if you opt out of all of them, they still silently slip in a couple of questionable software into your computer! First of all, these are unknown software, on top of that they sneak into your system. How comfortable / happy does that make you feel? In most cases, the adverse effect of such software on the IT system is unknown for a while. As a result, IT network security threat increases significantly as more such software are installed. Software from commercial software providers are regularly reviewed and updated, but some of the commonly used software do not go through proper follow-up and are rarely updated. Any security flaw in such software remains and create a backdoor for hackers and malicious programs to penetrate an organization’s IT network.
On the other hand, there are some popular software including gaming, media, and social networking, usage of which is likely to affect focus and productivity of employees. Presence of such software in workplace can also lead to various compliance issues. Also, if employees in an office downloads various software from the Internet and installs on work computers, it can lead to serious legal issues, such as license violations.
That’s why every organization needs to know what software are installed on its computers and if those are required and acceptable for business reasons. If not, such software should be identified as “prohibited” and arrangements made to stop those from being installed on any work computer. Controlling software installation is not a choice anymore; it’s a required step to address security, productivity, legal, and compliance issues.

Importance of ‘Software Asset Management’ in this regard
Detection of ‘Prohibited Software’ is a part of the bigger area ‘Software Asset Management’. Software asset management (SAM) is a business practice that involves managing and optimizing the purchase, deployment, maintenance, utilization, and disposal of software applications within an organization.
Proper software asset management is necessary for effective security practices to help combat cyber-attacks that can damage an organization in various ways. An effective SAM practice delivers intelligence on software across the network, providing clear visibility of entire network inventory that helps Network Administrator to take more informed software security decisions. SAM helps to minimize the attack-surface of an organization by detecting unauthorized and unsupported software and preventing them from being installed, or at least to be removed.

Methods of tracking ‘Prohibited Software’
Traditionally, the method known as ‘application blacklisting’ is used to track the unwanted applications. This method works by maintaining a list of applications that are to be denied system access and preventing them from being installed and executed. However, since the number, variety, and complexity of applications are increasing day by day, that approach is hard to follow these days.
The opposite approach to ‘blacklisting’ is ‘application whitelisting’. In this approach, an authorized list of applications is maintained. When a new application is going to be installed, it is automatically checked against the “authorized list”. If the application is not in the list, it’s not permitted to be installed. This depends more on the honor system.

Are these methods full-proof?
Nowadays applications are coming with increasing levels of complexity, variety, in increasing numbers. So, ‘application blacklisting’ process is not likely to be full-proof. On the other hand, the ‘application whitelisting’ method also might not be practical, because of the administrative resources required to create and maintain an effective whitelist often turns out to be inadequate.

Any way out of this problem?
Considering the possible threat to the IT network, it’s not recommended to rely on manual processes to detect the unwanted software. Rather we have to rely on an automated system that can detect such applications automatically without any manual intervention – a system that continuously monitors the IT network and immediately informs about the presence of any unknown or unwanted software.
SARANGSoft SysExpertez provides this functionality along with full-fledged IT Asset Management (tracking of hardware, software, and users) in a Windows network. Let’s see how SysExpertez helps detect the unauthorized / unwanted software within a Windows network.

Role of SysExpertez in detecting ‘Prohibited Software’
SysExpertez categories installed software broadly in three distinct categories.
1. Licensed: is associated with legal copies of commercially published software from reputed providers, license for which are purchased and budget is allocated for such software to be renewed / upgraded; e.g., Microsoft Office, SQL Server, Adobe Photoshop, Oracle database, AutoCAD etc.

2. Approved: There are many free but wonderful software available. Depending on an organization’s needs and policies, its IT team can identify some of those as “Approved”; e.g., Adobe PDF Reader, Skype, Firefox and Chrome browsers, some text editors (like Notepad++, TextPad) etc., which are suitable / beneficial for use in workplace;

3. Prohibited: There are some software that an organization might choose not to allow in its network for various reasons – security threat, productivity loss, legal / compliance issues etc. These generally include games, media players, chat apps etc. Any installation of such software within the IT network should be detected ASAP, and immediately acted upon (such as uninstall and prevent future occurrences);

SysExpertez helps put the known and relevant software into one of above three (3) categories – Licensed, Approved, and Prohibited. If any software outside these three lists is installed on any computer within the network, SysExpertez can detect that, classify it as an “Unknown”, and immediately notify the IT Administrator about it. The IT Administrator can investigate the case, and either

  1. Accept it as one of the first two categories (i.e., Licensed or Approved), or
  2. Put it in the Prohibited category and instruct the user(s) of the concerned PC(s) to immediately uninstall the software (and refrain from installing it in the future).

Monitoring of software assets helps keep the network safer and comply with legal and standards requirements.

Preventing data loss on your computers

Introduction
Data have become intrinsic part of modern human life. We are constantly searching for data, right from the time we wake up every morning. While some of the data are live and online, a lot of data are collected, processed, organized, and stored for quick and easy access at any time. These data (stored in files and folders) are valuable for our personal needs. Those can be photos, videos, music, research outcomes, write-ups, important documents and so on. If those are lost for any reason, it would significantly affect our lives, professionally and/or personally (often emotionally). That’s why it’s easily understandable why we often fear of losing such data due to some unexpected problem.

Types of data loss and some precautionary steps
Though we often think about “data protection”, which includes guarding it against preying eyes and hands of hackers and such, “data backup” is intricately involved in the process. The term ‘data backup’ means to copy data files to another medium (such as a disk or tape) as a precaution, in case the original storage medium (generally the hard disk built into the computer) fails. Data backup is crucial for businesses as well as individuals.

There are many ways that your data can be lost. The common reasons are hardware failure, corrupted files, virus / malware, accidental deletions, and of course natural disasters (storm, earthquake, flood etc.) or man-made disasters (vandalism, theft, terrorist attack, arson etc.). Let’s look at few safekeeping approaches to prevent data loss as part of a comprehensive data protection plan.

a) Create a standardized file / folder organization
It helps to develop a standard way of organizing and storing your files, so that you (and your users) will know where a particular kind of file are expected to be. Once this first step is done, backing up data files will be more accurate and precise, and it will save time and hassle while retrieving any lost data to its original location.

Organizing files and folders is the key to a data protection and restoration plan.

b) Identify which (kind of) files need to be preserved
Once you have organized your files and folders, determine which are important for you. Though you are the best judge deciding what are your important files, here are some ideas for your convenience.

The following types of files are important:
  • The files you can’t do without
  • The files you will need in the future
  • The files related to products & services you sell (for businesses)
  • Files that you cannot re-create
  • Files that you can re-create but don’t want to
  • Files you regularly use and/or refer to and/or update

On the other hand, the following types of files are less important:
  • Files you have not used (not viewed or edited) for a few years.

The following types of files might be good candidates to not be included in backup (or should even be deleted from your computer to keep it clean):
  • Files you cannot remember why those are there.
  • Files you know are not useful for you any more or are known be outdated.

c) Avoid storing documents on the same drive where Operating System is installed
On Windows, most document editing applications save the document file in the ‘My Document’ folder, which is very well known. As a result, malwares and virus often target the files there, making the files vulnerable.

Whether it is a virus or software failure, the majority of computer problems affect the Operating System. Quite often the solution is to reinstall Windows, and at times after reformatting that drive. In such an instance, you must make sure to copy / backup all of your own files (not the system or application files) from the drive, including the ‘My Documents’ folder; otherwise everything on the drive will be lost. You can create a separate drive on the same physical hard disk, and store all your own files and folders on the second drive. If the OS drive needs to be reset, your data drive will still be unaffected.

It is also possible for the hard disk itself to go bad (disk crash), in which case all drives on that disk will be lost. You can replace the hard disk and reinstall Windows and the applications to get it back to working condition, but in this case your files and folders on the data drive has also been lost. To handle such cases, you can use an external hard disk to store your data files. Or you can just use regular backup from your data drive to an external disk.

d) Backup regularly
You can alert yourself to take a set of security measures to protect data loss, but if your data is not backed up, it’s very likely that you WILL LOSE IT. So, ensure that your data is backed up regularly, and test the backup to ensure that your data can be recovered when you need it.

How often should you back up? That depends on how much data you can allow to lose if your system crashes completely. A week’s work? A day’s work? An hour’s work? Depending on that you have to schedule your backups.
There are numerous backup programs with varieties of features. You can easily try out
  • SARANGSoft filexpertez (file-expert-ease) for backing up a Windows PC. It’s a comprehensive file and folder management tool for home, office, school / college, everywhere.
  • SARANGSoft WinBackup Business for backing up all PCs and servers in a Windows network (domain or workgroup) through a centrally managed arrangement.

Both the products are feature-rich and flexible, yet easy to understand and use. These do not cost much, and there is a no-obligation 30-day free trial available.

e) Automate your backup procedures
All of us are busy. There are too many things to do every day, and too little time! Even though you might be very sincere about regular data backup, it’s quite possible that you forget to run backup at times, and that leads to an inconsistent data backup arrangement. Ideally, backup should be arranged to run in a consistent manner without any manual intervention. Depending on the importance of your data, you may schedule the backup operation to run it automatically. The only thing you should bother about is to check that the backup are really happening. It helps if the backup program can send you a notification when it backup is done, either successfully or ending in failure (in which case you can look into the issue and fix it).

f) Encrypt your data while backing up
Using encryption during backup of your data is another layer of protection for the data.
Encryption changes the backed up data in a way to making it unreadable by anyone, except who has the password “key”, which allows him/her to decrypt the data back to its original usable form.
There are various types of encryption mechanism available, and some programs use it.

g) Create a local backup arrangement
All the important files should be backed up locally first. Make sure that the backed up files are available at your office / home. That ensures for easy access and recovery, as well as control of the data.

h) Create an off-site backup arrangement
It’s a great idea to arrange for a different location than your office / home to keep a copy of the backed up files. It provides “redundancy” as well as prepares for “disasters”.
If the local backup is damaged or lost for any reason, the off-site backup copy will save your day.

i) Use of “cloud” as remote storage for backed up data
Nowadays, it’s increasingly common to use cloud as the remote data storage. There are many benefits to using cloud storage, most notable being the virtual indestructibility of cloud storage and its accessibility. Files stored in the cloud are assured beyond any other level for reliability and those can be accessed at any time from any place with Internet access and your own user credentials. As far as the disaster recovery is concerned, data from cloud can be restored without any hassle. Also, the cost of cloud data storage and restoration is significantly lower than traditional data storage and restoration.
SARANGSoft CloudScape is a unique cloud storage browser for the Windows platform to seamlessly integrate cloud storage (AWS-S3 and Azure) with local storage (PC’s hard drive). Its Windows Explorer-like user interface enables easy transfer (including drag & drop) of files and folders to and from cloud, thereby making cloud storage an extension of your local PC storage. It maintains full folder hierarchy between a PC and cloud storage, which is not very common for such tools.

Ending Note
Making plans and implementing those takes time, effort, resources, and costs money. That’s why many of us defer doing it. However, the cost of not backing up data can be so severe, the upfront effort for the backup process is worth everything you put into it.

SARANGSoft: Over the past 15 Years

The last 15 years went by pretty quickly! In early 2000, we were in discussion with a few friends about the software industry, its strengths vs. weaknesses, then most prevalent “body shopping” model, the future potential and challenges.  We knew right then “body shopping” won’t work; needed a model that would be both cost-effective and logistically viable. On the other hand, we wanted to start something from the city we are so intimate with – Kolkata.  It supplied, and still does, a lot of technical talent across the world, but wasn’t a recognized spot on the IT map, not even within India.  We felt it was possible to tap the raw talent from the area and build a team that can deliver quality software to two markets – USA (where some of us are located) and India (where the core team is) –   to start with.  To be very honest, the whole decision was based on more emotion and gut feelings than serious business analysis.  Still, SARANGSoft Corporation and SARANGSoft India Pvt Ltd or SIPL (then called SARANG Infotech and Software Solutions) were started in 2000.  The first set of people came on board and we started with a modest setup.

In early 2001, we got a big break to work with a major medical insurance provider, who was migrating a massive legacy system (IBM mainframe-based) to Unix & RDBMS environment. Our team started working on-site, offsite, and offshore – at its peak involving total 10 engineers.  It went on for about two years, during which we moved to better offices and added more to the team.  In 2003, we took a different turn – after the legacy system migration project ended, we moved away from that area and focused more on Windows and Linux.  Around the same time, we started working as a direct vendor of Microsoft.  That brought a number of interesting projects in the Windows Operating System and multimedia in particular.  The team expanded even more, new offices were setup, and also came a lot of excitement and learning in the process.  There were several ups and downs too.  At times it felt like end of the road, while at other times we could barely keep up with customers’ requirements.  We worked with several small and mid-size companies too, and each was different in significant ways.

The downturn of 2008-2009 had a serious effect on our business as it did for most organizations.  All the customers clammed up in uncertainty, new projects stopped, existing projects stalled / shrunk, some customers couldn’t / didn’t pay as agreed upon.  We went through a couple of horrible years.  Some of our long-time clients continued to work with us, and some new clients did start during this time.  We are happy that most of those relationships are stronger today.  As the market sentiment improved over the last couple of years, we have expanded our business and feel much better now.

During the downtime, we started focusing more on our own software products, and released a number of those starting in 2009.  We offer Data Backup – for Windows PC (filexpertez) to entire Windows network (WinBackup Business), Document Digitization and Management (digipaper), IT Configuration Management (SysExpertez), Cloud Data Browsing & Transfer (CloudScape), Developer Tools (Logastic and Testology), and more.  We didn’t actively market those; actually we are not good in marketing ourselves. Still, some people have noticed the products, tried out a few those, liked what they saw, and purchased.  Based on customer feedback, we have been making improvements to our products, and newer versions are being released frequently.

Over the past 7-8 years, we have concentrated on some specific areas.  Windows platform remains our core strength as before.  We can do almost anything on Windows – at OS level or with apps, components, tools, system services.  Our other area of strength is the web platform – .NET and Open Source.  We design and develop websites, web apps, web services, and anything in between.  For the past 4 years we have also been working with Cloud technologies, especially AWS and Azure.  We are increasingly moving apps and services to appropriate cloud platforms.  We are also working on mobile apps, but not the typical native apps for each of the two dominant platforms.  We prefer to build a common cloud backend for the app core and a lightweight frontend for each mobile platform.

Today we are at an important point in our journey.  After a long stormy night, we are at the break of a new dawn.  Our team of about thirty people is motivated and dedicated.  Our product and service offerings are rich.  We are strong on skills, experience, and innovation.  And we are as committed as we have always been to deliver the best to our customers and partners.

visit: www.theappsolutions.com and see more

Welcome to SARANGSoft New Blog

Welcome to our new blog. It took us a long time to transition from our earlier setup (website and blog) to this new version. Hopefully the blog will be better and more active from now on.

The goal of our blog is to share our thoughts, actions, findings (and more) with a wide audience. While working on various projects – building our own software products as well as developing custom software solutions for our customers, we come across different questions and challenges, which we sometimes solve by ourselves and at times depend on the wisdom shared by others like us in the industry. We know firsthand how much information-sharing helps, and we greatly appreciate that. In this day and age of collaboration and networking, we would like to put forward some of the hard lessons we learn as part of our work, so that others do not have to reinvent the same wheel or go through similar frustrations. We all win through sharing, because it goes both ways.

Our posts will be mostly technical in nature, but there will also be some business-related topics, because we are in “technology business”! We develop and use technology for business – to make those more capable and efficient. That’s where the value of technology is – enabling new possibilities, improving existing processes, and even identifying fresh opportunities.

We welcome all meaningful and relevant discussions, including constructive criticism, of our posts. The different viewpoints from all concerned will enrich all of us in various ways.