Taswar Bhatti
The synonyms of software simplicity

I had this printer which is not a wifi built-in printer but nevertheless its a laser printer and I wanted to use it to print from any machine on my local network. I thought to myself why not use a raspberry pi and use cups. Thus my post on how to Setup Brother 1110 Printer on Raspberry Pi, I actually reuse the pi I had that is running pihole to block all the ads coming into my home network. Long story short I thought CUPS would be easy to setup and hoped everything will work, well of course things don’t just work without me tinkering on it, so here are the steps I used to finally to get it to work and hopefully it may help you also in your journey 🙂

First things first what is CUPS?

CUPS is a modular printing system for Unix-like computer operating systems which allows a computer to act as a print server. To install CUPS on a PI you can use the commands below.

Install cups and drivers from the Brother website
Login to your pi

Brother only provides i386 driver but as you may know Pi is a Arm processor so we need to somehow get them to work but first lets download the deb packages.

We will also add the architecture

We will also need to use Kali linux libc6 in order for this to work.

We will then extract the libc into a directory so that we dont need to mess with apt and then copy them over.

As you can see above we have 3 directories etc, lib and usr extracted into data directory. Now we will copy them over.

We will also add this to our env variable to build and then we can install our packages. You can ignore the warning, also you will get this error in cups also when you print so you can ignore that also.

Now lets install the cups wrapper.

Finally we need to restart our cups server

If you wish to manage cups with pi user use the commands below and then you can access cups with the web user interface on http://localhost:631

If you are using windows 10 you dont really need to install Samba you will be able to see your pi printer by just opening printer and add it will auto scan your network for it. Hopefully this will help you out 🙂


I needed to increase my disk size of my Windows 2016 server on AWS EC2. I though I will share this just in case it can help you or myself in the future on How to increase the disk size of a Windows EC2 machine?. First thing first you need to increase the volume space that you have, easiest way is to use the aws console.

Below I have logged in and am on the windows ec2 machine and have clicked on storage tab to find the volume I wish to increase.

Note: You can only increase there is no decrease



Click on the storage volume link and it will take you to the storage section on the console. Right click and choose Modify Volume.
A window will show up like below, enter the size of the volume you wish to increase it into.



Once successful you will see the message like below.



At this point you might be thinking you have completed and it will automagically increase your size. Unfortunately that is not the case, and you will be required to restart your instance and Remote desktop into it to increase it inside of windows also.

We will need to restart the instance and once restarted let us check the disk size.
As it states it is still 300G, we have changed it to 400G but nothing has changed. What the hell???



We will need to launch disk manager (diskmgmt.msc) and we will see that there is 100G that is not allocated yet.



We will need to right click on our existing volume and choose extend volume like below.



It will bring up a wizard where you click next, next and it will increase your volume like below.




I hope this helped in showing how to increase the volume size for your windows server running on EC2.


If you are using AWS S3 C# TransferUtilityUploadRequest and when you try to upload objects onto S3 you can potentially get Access Denied. The reason could your IAM Role is not defined to have access or your bucket name is incorrect.

What do you mean bucket name is incorrect? Basically it boils down to that buckets used with Amazon S3 Transfer Acceleration can’t have dots (.) in their names. So if you created a bucket with name e.g “my.fancy.bucket.” this will not work with TransferUtilityUploadRequest. You will need to change the name to “my-fancy-bucket” rather.

Example below I am using this code to upload some excel data.

Now if you change the code to use dash for the bucket name it will succeed in uploading, make sure you do have a bucket with that name already created.

Make sure to check the Role given to the lambda function also, use least privileges for s3 if possible to and if you are logging any information you need to give the Cloudwatch permission to your lambda also.

Hope this helps 🙂


If you are working on AWS Lambda Dotnet with C# and find out that you are getting something like an error like below.

Error message
Could not find the specified handler assembly with the file name ‘LambdaTest, Culture=neutral, PublicKeyToken=null’. The assembly should be located in the root of your uploaded .zip file.: LambdaException
[WARN] (invoke@invoke.c:331 errno: No such file or directory) run_dotnet(dotnet_path, &args) failed
START RequestId: b7bb069b-3f44-4cd6-8b63-43a37098cd5e Version: $LATEST
Could not find the specified handler assembly with the file name ‘LambdaTest, Culture=neutral, PublicKeyToken=null’. The assembly should be located in the root of your uploaded .zip file.: LambdaException

The main reason is that you most likely created the lambda on the console first and then tried to upload the code using dotnet cli e.g dotnet lambda deploy-function “functionName”.

In order to fix it, its quite simple you have to go back on the console and into the configuration section of the lambda function in console. Find the Runtime Settings and click on Edit and change the Handler to the function name you are using. E.g MyTransformFunc::MyTransformFunc.Function::ProcessFile as you can see the ProcessFile is my method that I have in my code that needs to be executed based on the namespace I am using.

I hope this helps 🙂


In C#7 there is an enhancement in the main method Async Main in C# that will allow you to await in your main method. Let me show you an example of how it was in C#6 and then how it has changed in C#7.

You will remember this most likely

One will need to get the Awaiter and then GetResult in order for it to work. But now in C#7 you can write it like below.

And to add cherry to the icing, if you have a method that doesn’t return a value you can also just return Task.


The above code shows the ease that C#7 provides with its main method an great improvement from C#6 I would say, hope that helps you in learning C#.


In C#7 there is an improvement on using out parameter. Some of you may remember writing code like below.

The improvement that C#7 brings is you can now declare out variables in the argument list of a method call, rather than writing a separate declaration statement like below:

And it doesn’t end there we can also use the var keyword if we choose to.


What are the benefits of this out parameter, well it does make the code is easier to read. You are not declaring it where you use it. Not to mention you don’t need to initialize the variable either.


In C# 7 there the new feature called Local functions in C#. Basically Local functions allow one to write a function within the body of another method or function. It comes in handly in the case lets say you are creating a helper function that are mostly just used in one class or where the declaration makes the code clear of the intention. Local functions also come in handly to write recursive functions rather than using a Lambda for it.

Here are some places where you can use local functions.

  • Methods, especially iterator methods and async methods
  • Constructors
  • Property accessors
  • Event accessors
  • Anonymous methods
  • Lambda expressions
  • Finalizers
  • Other local functions

Below is an example where I Anonymize a string of emails, you can see that I am actually calling the local function below the return statement. Therefore where you can declare a local function below a return statement and also the Pattern variable is available inside the local function, since it is within its scope.

If you wish to read more on local functions take a look at the Microsoft documentation of local functions.


In C#7 there are Expression Bodied Accessors which allows you to write getter and setters somewhat more functional way like lambda’ish. Let me show you an example. You may remember the old way of writing getter and setters like below.

When using C#7 you can use Expression Bodied Accessors like below which makes the code way cleaner in my opinion. As you can see below I have also added the null exception into the setter.


As you can see above how Expression Bodied Accessors can make your code way cleaner and easier to understand, not to mention that you can include exception into the setter since Exceptions are also Expression now. Btw you can also use the Expression Accessors for Constructors and Destructors.


In C#7 there are Digit Separators and Binary Literals which were added. One may wonder what these are? Basically you can replace long number values with underscore (_) such that code readability is improved.

Let me give you couple of examples of it to make it clear.

Neat but it doesn’t end there you can also use it for Binary literals and Hex also, like the examples below, where they all are 2020 the year we all despise 🙂


I hope the C#7 Digital Separators and Binary Literals will give you a hand in writing more clear code 🙂


So one may ask “What is the advantage of using discards in C#?”, and if you don’t know what discards are you can check out the MS C#7 Documentation about it.

Basically discards are variables in simple terms, and the declaration of the variable as a discard is by assigning it the underscore (_) as its name. Let’s look at an example of it using tuples. And if you want to know more about tuples look at my older post on tuples.

Example discard in C#

As you can see above I have declare lastname as a discard, the advantage is that the lastname variable may not even be allocated any storage. Thus in a sense discards can reduce memory allocations, that is one of the main advantage of discards. Not to mention that it the intent of the code above clearer, readability wise and maintainability wise. There are other places you can use discards also.

Out parameters methods

The code below shows using discard in a TryParse method like below, where we use the out method for getting the value, but if we don’t really care about the value discards comes in handy here.

Pattern Matching

One can also use discards in pattern matching in C#. In the below example I am using pattern matching to process a user where a user can be a student or partime student, and they both are process the same way for example.

Deconstruct method

In C# you can also use discards for deconstruct methods, where you use a method name Deconstruct with out parameters, let’s look at an example of it. It is another handy way to get data out of class, structures and get them into tuples.


I hope this helps in explaining where you can see potentials of using discards in C#, it is a way of intentionally not wanting a variable, the plus side of it, allows one to read the code more clearly.