Author: Vitosh

Python – Writing a Logger in Python with a decorator

Functions in Python are objects. If this is the first time you read this sentence, then you will not get a lot from this article, but it will show you, that there is quite a lot to learn about Python.

Tagged with: , ,

Python – DefaultDict Object. Or how to avoid the Key Error.

Have you seen the error below?

Of course you have. And you know, that it is because you have written something extremely unwise like this:

Yeah. You cannot increment the value of a non-existent key. Unless… Unless you

Tagged with: , ,

VBA – Printing Dictionary of a Dictionary of a Dictionary…

Working with dictionaries in VBA is a bit more unpleasant, than working with dictionaries with almost any other language. Because of the VBA IDE, you only see the keys, but not the values. Thus, if you have experience with Visual

Tagged with: , , ,

VBA – Automatically Save Excel File with VBA

Saving Excel files, when working with VBA is unfortunately a bit of pain the ass. You always need to make a new version every now and then, because it does not matter how seasoned VBA developer you are, still there

Tagged with: , , , , ,

VBA – Ubound of Multidimensional Array or How to Get What We Need?

Transforming Range to Array in VBA is actually a one liner – we take the range and we assign it to a variant:

The “strange” part is that the array is converted to 2-dimensional array after this: and working

Tagged with: , , , , , ,

VBA and Python – Intersection of dictionaries

Intersection of dictionary (or of any two lists) is a list with elements, that are present in both other lists. Thus, if we have the following 3 dictionaries in Python:

Then, an intersection of their keys will contain only

Tagged with: , , , , , ,

Python – Class Variable vs Instance Variables

Class variables vs instance variables could seem a bit strange, if you have no OOP experience, but after a few thausand lines of code they become logical. So, in around two days of programming you will be getting it intuitively

Tagged with: , , ,

Python – Difference between __str__ and __repr__

__repr__  and __str__  dunders are quite similar in Python. If you need  a quick summary of these 2, then these 3 points will be enough: __repr__ dunder presents the class object, whenever it is called by the terminal __str__ dunder

Tagged with: , , ,

VBA – Make Excel Comments Beautiful

Everyone, who has worked with Excel more than a year knows that the comments are actually quite useful – they allow us to put info data into a cell, without actually putting data in the cell. However, the standard way

Tagged with: , , , ,

VBA – IIF() vs IF()

What is the difference between IIF() and IF() in #VBA? The idea of IIF() is that it evaluates both the True and the False part of the condition, before evaluating the condition itself. Thus, if the False part throws an

Tagged with: , , , ,

VBA – Hashing in Excel with HMACSHA1

Hashing strings in general is useful. It is one of the good things, that we get from granted by the various .Net libraries and we should not try to do on our own, as the HMACSHA1 is quite a powerful

Tagged with: , , , ,

VBA – Convert Excel Column Number to Letter and Letter to Column Number

Converting Excel column number to letter and letter to column number is actually something that every VBA developer does at least once a day. The easiest way is probably to use the property .Column or .Address of the range object that

Tagged with: , , , ,

Excel – Index(Match) based on multiple columns

Everyone knows the feeling that they need to use the =Index(Match(),Match()) formula in Excel and something tiny was not enough to reach their goal. Some time ago I knew that something is missing I was trying to “filter” with the

Tagged with: , , ,

How to fix – This workbook contains one or more links that cannot be updated…

Ok, if you are visiting this article, then probably the reason is that you have received the following messagebox upon openning of Excel: And after looking all over your cells, with both VBA and “Find”, you have not found anything

Tagged with: , , , ,

VBA – Nested Dictionary

Nested dictionary means a dictionary within a dictionary. Some days ago last week I was trying to build one and it took me some solid 15 minutes to do it, thus I have decided that it is worth an article

Tagged with: , , ,

Json.dump vs json.dumps in Python

The difference between json.dump and json.dumps is actually quite visible: dump()  – dumps into a file or StringIO dumps()  – dumps a string, that could be printed Still, I am going to give a few example with these, as the

Tagged with: , , , ,

Python – Iterators

One of the benefits of having your own blog and not following any schedule for subjects to write about is that you may write for whatever you feel like, whenever you feel like. So, Iterations in Python is the subject

Tagged with: ,

VBA – Folders and Files Functions

Check if folder is empty:

Delete all files in a folder:

Create text file in a given path with text:

All together:

Tagged with: , , ,

Django – CRUD application with Python

Making a CRUD application with Python is actually one of the basic thing a Python Developer should be able to do. Although some may argue it is extremely basic – it is not. Requirements The basic requirements for this one,

Tagged with: , , , , , , ,

Django – Making a simple web app with 4 links

The idea of the article is to show how to make a simple Django App, with 4 links, each of which navigates to a specific page. The whole code of the “app” is in GitHub, here: https://github.com/Vitosh/Python_personal/tree/master/JustProject. In general, these are

Tagged with: , , , , , , ,

Python – Exception handling

Exception handling in python is actually quite an interesting topic. In general, the exceptions in programming could be of three types: syntactic errors – these would be noticed by your IDE or by the interpretor, thus you do not need

Tagged with: , , ,

VBA – Source Control with Git – Video

VBA and source control? Do you know what is VBA? Are you sure we can source control the code, that resides in Excel? Oh, you mean that lengthy way of extracting the modules one by one? But why? Don’t you

Tagged with: , ,

Using API calls with VBA and Python to Read and Write to a Database

Using API calls with VBA and Python to write a database is actually a pretty decent architecture. Here, I would like to say that “It takes the best of the both worlds”, but the truth is that it takes the

Tagged with: , , , , , , , ,

Python – Virtual Environment

This is a short step-by-step introduction on how to build virtual environment in Python and how to use it. Virtual envirnments keep dependencies, required by the specific project separated. Thus, it is the “clean and clear” place of the project,

Tagged with: , , ,

VBA – Compute All Combinations of a Given Set

Yesterday I received an email, refering to some 2 old articles in VitoshAcademy for nested loops without recursion: VBA – Nested loops with recursion (Permutations)  VBA – Avoid nested loops with recursion (Part 2) As far as the person from

Tagged with: , , , , ,

VBA – Cells and Ranges in Excel – Video

Cells and ranges in Excel are quite interesting, as these will always give some points to think of. About an year, after writing the article about VBA – Cells and Ranges in Excel (A bit more than the standard story),

Tagged with: , , , , ,

VBA – How to locate a value in an Excel row?

Most probably you feel like you have a good clue already how to locate a value in a given Excel row. There are plenty of ways – Find() , looking through the cells one by one, looking through the Internet for

Tagged with: , , ,

How to declare as decimal in VBA

More than 3 years ago, I wrote an article about floating point numbers in Excel and a tiny problem with those, concerning all floating point numbers. This article is actually a nice one and it is worth reading – What

Tagged with: , ,

VBA – Convert Month Name to Number and Vice Versa

Convert number to name – [3 -> March] Converting month number to name in VBA is actually coming out of the box with the MonthName() function, which is built-in the stanard VBA  library:

The result is not flabbergasting, but

Tagged with: , , , , ,

VBA Debugging – Video

I have decided to make a 19 minute YouTube video, to explain the basics of VBA debugging, as there are quite a few tricks that not everyone knows. The agenda: Properties Window -> F4 Immediate Window -> Ctrl + G

Tagged with: , , , ,
Top