11 Nov 2020
A Little About BLAZOR
As a .Net developer, we are usually using c# or VB.net for server-side development and javascript frameworks for client-side development and the learning curve are huge here. In this situation, our mind raises more questions like
Why should I learn too many JavaScript frameworks?
Is C# not enough for my web development?
can I create web application by using only c#?
BLAZOR is the answer to the above questions. Yes, Blazor enables developers to build interactive and reusable web UIs using C# or C or Rust instead of javascript. Here you might be thinking browsers understand and execute only JavaScript, then how our c# code works in client-side the answer is Blazor Web Assembly(WASM) that is a language that runs natively in browsers.
Components
Components is a Razor component with C# code and HTML, and its is reusable and can be nested.
Note: Component name must start with uppercase, if it's in lower case it could not be recognized.
Hosting models:
Two type of hosting models available.
- Blazor Web assembly
- Blazor server
Blazor web assembly entirely runs in the client machine. Once the app is started all wanted things downloaded from the client machine and connection is not required. But in 1st time it will take more time to download.
Blazor server entirely runs on the server machine and it is too fast. UI updates, event handling, and JavaScript calls are handled over a SignalR connection.
We can choose any one of the hosting model based on our requirement.
Main Features:
- Contains latest web features like Routing, Validations, Dependency injection etc.
- No plugins needed.
- Live reloading in the browsers during the development.
- Fast and efficient build time.
14 Oct 2020
Keep these things in mind when you start to create SP
Before to discuss the points we just go through what is stored procedure and where its used.
When we are using SQL as a back-end we need some queries frequently used in our application. Here we have to go stored procedures, we can save the query as Stored procedure and we can use where ever we want over and over again.
While creating stored procedure we should keep some standards for more efficiency.
Use (nolock)
Normally (nolock) is not a necessary one, but without (nolock) sometimes we might face timeout issues in our application.
For example, we are in the middle of some transaction, SQL locks the table until the traction ends. At that time if our SP runs SQL prevents all other operations, So we couldn't get the result.
we can overcome the above problem by using (nolock), Where ever you used SQL table in your procedure you just add (nolock) after that as a best practice.
select * from tbl_employeemaster (nolock)
Don't Nested
Nested SP makes more complex to fine error.
Avoid multiple sp too
Nested Stored procedure
Select specific Columns
Use transactions
Maintain blocks
14 Aug 2020
Python I/O functions
I am primarily a .NET developer who has her eyes on python for a few months now, I am really in love with python for its simplicity and its power to do almost anything I can think of. I am mostly playing with it by scraping websites and reading/writing files.
When doing file i/o there is one thing I have always found little confusing to me which are the file i/o modes. I often had to look up what each mode does and I thought I should document my learning for others and for my future reference as well.
Basic file operation that we commonly used in excel or text related operations is READ, WRITE, and APPEND.
Python I/O modes:
There are 6 modes available for the file i/o as follows.
r → Only for reading. Starting position is Zero.
r+ → For reading and writing. Position is zero.
w → Only for writing if the file exists, otherwise it creates a new file for writing at 0th position.
w+ → For reading and writing at 0th position or create if the file not exists.
a → Only for writing if the file exists, otherwise it creates a new file for writing at last position.
a+ → For reading and writing at last position or create if the file not exists.
Above all the modes are very similar with small differences.Based on our requirement we have to choose the mode. ****
So when to choose one mode over the other?
Choose r:
If you have an existing file and all you need to do is just read the content from the 0th position.
Choose r+:
****If you have an existing file, and you need to read the content from the 0th position and overwrite previous content with new.
It deletes all the content from the 0th position and write the new content what you have provided.
Choose w:
****If you want to create a new file or replace the old file with new. It checks the given file name if the file is not exists it will create a new one otherwise it delete all content from old that is over write.here also the starting position is zero.
Note: The only difference between r+ and w is w can create a new file and can’t read the content.
Choose w+:
If you want to read an existing file content from the 0th position and overwrite the content and need to create a new file if the file does not exist.
Note: It like a combination on r+ and w. Here we can create or replace the file and as well we can read and write the file from the 0th position.
Choose a:
****If you want to append the content with the previous one or you need to create a new file.
In all the above cases the position will be zero(means it deletes the previous file and write as new),but in this mode the position is the end of the file(means it append the content with the old one).
Note: It exactly similar with w, but the only difference is the position of writing.
Choose a+:
****If you want to read the file and append the content with the previous one or you need to create a new file.
Note:It exactly similar with w+, but the only difference is the position of writing.
We have some extra modes for some extra features. If you want the file in a binary modes means we can use the below modes.
wb → Its performs like w with binary mode.
wb+ → Its performs like w+ with binary mode.
ab → Its performs like a with binary mode.
ab+ → Its performs like a+ with binary mode.
Thanks for reading so far. I hope I have covered all the available modes and explained myself the best I could do, this is my first blog post and I would love to hear your thoughts and feedback.