Skip to main content

Posts

Showing posts from 2019

Error: the type or namespace name does not exist in the namespace using visual studio 2017

When compiling an error will occur that a name space does not exist. An example error like the message below:
The type or namespace name 'Microsoft.Office.Interop.Outlook' does not exist in the namespace 'Microsoft'(are you missing an assembly reference?)
The system is trying to find a reference for a specific namespace or dll.
One solution for this is to add the reference to the missing namespace.
Find the “solution explorer” window like the image below:


After opening the “solution explorer” window, right click the name of the project just below the solution explorer. Beside the C# icon.
A new window will open like the image below. Click “Add”, then click “Reference”.



After clicking “Reference”, the “Reference Manager” window will open.
Click “COM” option, then use the filter option to go directly to the desired namespace or reference. Since the error is a Microsoft namespace, type “Microsoft” and “Microsoft” namespace will be filtered from the list. See image below…

Copy or migrate shared folders to another server

Migrating or copying files to another server and retaining the permissions is a common task when migrating a file server.
If all permissions are successfully retained it will make the migration seamless and nobody will ever notice that a migration has taken place.
If there are shared folders and with different permissions, re-sharing the folder by scratch is just time consuming and giving access denied to users will be inevitable.
But how to copy files and folders, like it was exactly done on the old server?
In Windows environment, just 3 steps are needed. 3 steps sound easy and quick.
Steps below will work for NTFS permissions and folder access rights solely depends on it.
a.Copy the files to the new server and retaining its permissions while files and folders are being copied b.Export the shares registry (old server) c.Import the shares registry (new server)
The link below from Microsoft website shows how xcopy can copy folder and retain the permissions.
https://support.microsoft.com/…

PowerShell Insert Multiple Lines or text to another file dynamically

Copying and pasting text to another file is a common thing to do, copy and paste done. Boom!
In PowerShell scripting copying and pasting text from one file to another dynamically isn’t as easy as it is done in a spreadsheet or document. Dynamically while the code is running  and doing things in the background without human intervention.
As the odds say, if there’s a will there’s a way. And making things efficient and easy is a good way in life.
If ever a scenario occurs that you need to copy text or lines in a file from one file to another, without breaking the code execution. Script below works just fine. Just insert the code where it is needed.

PowerShell code snippet:
#================================
$reader=[System.IO.File]::OpenText("D:\test-read-paste\main1.txt") #get-content can also be used
$lineNumberx=3 #adjust this number where you need to start inserting the text
#Loop line by line and process while($null-ne ($line=$reader.ReadLine())) {
$textToAdd=$line
$newLineToAd…

PowerShell repeat spaces or characters

Example code of repeatingspaces within a string:
$xrepeat = ' ' * 11 $string_with_spaces = “ Hello World of Spaces!!!”
Write-output $xrepeat $string_with_spaces
Output image:

To indent or tab a string:
$Tab = [char]9 Write-Output "$Tab Hello Tab Indention!!!"
Output image:

To add other HTML character in PowerShell string:
$Euro_symbol = [char]8364 Write-Output "$Euro_symbol Hello Euro Symbol in PowerShell!!!"
Output image:


================================ Free Android Apps:
Click  links below to find out more:
Excel Keyboard guide: https://play.google.com/store/apps/details?id=chrisjoms.myexcelapplicationguide

Heaven's Dew Fall  Prayer app for Android :
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Catholic Rosary Guide  for Android:
https://play.google.com/store/apps/details?id=com.myrosaryapp
http://quickbytesstuff.blogspot.sg/2014/09/how-to-recite-rosary.html

Excel Macro get cell values but skip other rows

Raw data that comes in pattern is easy to handle for further processing.
For example, if you have a data that has final value in every 7th row, so basically 1 to 6 is not needed and 7th row is needed, likewise 8th row to 13th row is not needed and 14th row is needed and the pattern goes on that every 7th row is the final data from the previous 6 rows.
If the pattern continues, it will be like: 1-6, 7 final value, 7 -13, 14 final value, 15 to 20, 21 final value, 22 to 27, 28 final value and the pattern goes on up to hundreds or thousands. It will be time consuming to get every 7th row manually.
For graphical representation it will be like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
From the image above every 7th row (green color) is needed and the rest is discarded.
Other issue comes in if the data has to be processed further in another sheet, doing this manually is so tedious and prone to error.
This is where VBA or Excel macro comes into play and simplify the process. The “step” keyword in VBA or even VB…

Working with text in PowerShell

Working with a text file or text format in PowerShell is a good thing to learn.
Getting or monitoring output from PowerShell for further processing or analysis and having it in text file format can easily be imported to other applications.
Working with text or other format, requires these basic operations: Save, Overwrite, Append and Save As.
Save, overwrite, append and save as is a common operation when editing word documents, excel file and other office applications since it’s freely available on the menu of the application. But can we do this in PowerShell? The answer is a resounding, yes.


So, how to do it? Examples below shows how to work with text files in PowerShell and do the operation mentioned above.

Equivalent operations for Save, Overwrite, Append and Save As in PowerShell:
===Set-content ==== will overwrite the file ===Add-content ==== will just add or append something to the file ===Out-File ==== is like "Save As" since you have the option to save the file to a…

Disable Maximize and Minimize control in a form using Visual Studio

How to disable minimizing and maximizing a form in C# or VB.net?
How to create a border less form in Visual Studio?
Images below shows how to disable maximize and minimize control in a form.
Image below shows how to deactivate maximize option in a form:


Image of a form that does not allow maximizing:


Image below shows how to create a border less form, creating a border less form should provide an option within the form how to close the application.


Image of a border less form:



Till next time.. Have fun creating apps in Visual Studio...

================================ Free Android Apps:
Click  links below to find out more:
Excel Keyboard guide: https://play.google.com/store/apps/details?id=chrisjoms.myexcelapplicationguide

Heaven's Dew Fall  Prayer app for Android :
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Catholic Rosary Guide  for Android:
https://play.google.com/store/apps/details?id=com.myrosaryapp
http://quickbytesstuff.blogspot.sg/2014/09/how-to-reci…

Add a remote folder in Linux

Adding a remote folder in Linux or basically mounting a folder in Linux system is quite easy.
Like in copying and moving files or folder, it requires a source and a destination.
A simple copy command in Linux is:
cp --source or any file to be copied--  --destination or where to copy the file--

In mounting a folder, using mount command does require also a source and a destination. man mount will display the available options for this command.
Since source and destination is a pre-requisite in cp, mv ormount command.
In mounting a remote folder, the destination folder must be ready or created first before typing the mount command.

Linux has default destination for mounting folder which is /mnt folder.
Mounting a remote folder can be also done on other location such /home /usr or other preferred locations.

To mount a folder in /mnt directory, a sub folder must be created first.
To create a folder, type: mkdir /mnt/remote_folder_101

Once the sub folder or the destination folder is created…