Category Archives: Developer Twin

The posts for computer, programming, learners and fellow programmers! The posts may (or may not be) posted on my programming blog.

Another good library for developers — Easy solution

Today, I am happy to share the blog about a .NET library for developers that enables them to create documents in different formats for office and online use. Spire.Doc library is a library for developers trying to solve the interoperability problems with Microsoft Word, PDF, Rich Text Format and HTML format. It was a very amazing library as I went through it and the developer of library has provided a very efficient solution for the API guide along with the product itself.

I have written the review for the API and provided a simple, but a very general example of the usage that a developer can try out, in their applications, for dynamically generating the PDF file and sending it to client. Perhaps, I missed most of the things about the term dynamic in the review post. But, you know… You can always add variables instead of hard-coded strings and objects. Among review, I have provided a couple of scenarios in which the API is very much useful,

  1. Converting documents from one format to another
  2. Reading existing document, or making changes to them
  3. Generating documents on run-time
  4. Sending dynamically created office format files to potential clients
  5. Many more

So, read my review at: [Review] Spire.Doc .NET library for cross-file format document creation and share it with your friends also if they are new to this library, or are still wasting their time thinking what to do and how to solve the interoperability problem with Microsoft office and other file formats. I have provided most of the information bundled into sections. If you find a part missing, or faulty, do hit me with a comment reply. I would look into it.

I will post more stuff for developers, soon!

Count your 9s before blaming your CPU

Recently I was working on a Windows Forms application and I tried to create an async model, to see how long does it take to perform the loops. Although it doesn’t take much time for our CPU to calculate the results for our general loops; thousands, or hundred thousand maximum. I created the model for performing the loop as,

// loops, seconds are defined to be long variables.
private async void runAsync() 
{ 
     long res = await result();  
      resultLabel.Text = String.Format("Result of {0} loop addition is {1}.", loops, res);  
  
      // Done.. Stop the timer..  
      timer.Stop();  
      timerLabel.Text = String.Format("{0} seconds took to calculate result of {1} loops", seconds, loops);  
      seconds = 0;  
}  
  
private async Task<long> result()  
{  
     long res = 0;  
     return await Task.Run(() =>  
     {  
          for (var i = 0; i < loops; i++)  
          {  
               res += i;  
          }  
          return res;  
     });  
}

Well, it probably does what it is asked to do so. The only case of interest is, when the value is given to the loop. Let me show you the results for each of these cases…

Having 0-8 9s.

In case of 9s from 0 to 8, the execution takes only a fraction of one second.

Continuing to 8th result now,

Quite similar behavior being shown in these cases. Which shows that CPU is pretty much fast to calculate this much loops easily and to provide the result; if the result is not correct, please avoid mentioning it.

Adding a 9th 9

With a new 9th 9 being added to the loop; the results now amplify, instead of 1 2 or 3 seconds, it takes up to 8  seconds to execute the loop and provide the results.

That shows the significance of a 9 in the row of loops…

Adding a 10th 9

By using another 9 in the loop, I was finally able to manage to make the CPU work for a longer time… Much much longer time. My CPU doesn’t provide any result for this calculation, and took more than 7 or 8 hundred seconds.

Not bad, eh?

I will not say, CPU was not efficient as it was able to calculate the results for 0-8 9s and then started to topple the time by an increment of each 9 (each 9 made the first 9 in the left side tens, from ones, and hundreds from ones and so on making the loop counter to be billions). The number for the loops was, nine billion nine hundred ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-nine. Which is quite reasonable for the CPU to take this much time.

This reminds me of the “Transistor as an amplifier“, current moves and at a critical level, voltage rises and just keeps rising… I am really glad I found this and took time to write a blog about it. 🙂 Hopefully, next time you will count your nines before saying your CPU is fast!

Don’t be shy – afraid

Most of the new programmers who’re new into this field are usually concerned about their information and knowledge about programming and the concepts. I, have been a part of this community where people; usually with no knowledge on language, are acting like they’ve mastered the skills and are already the perfect programmers.

They try to act like programming was the first thing they ever did, even before the po-po ca-ca; ewww! No one did that, usually I get to hear a lot from friends, some speciall friends and buddies that they’re perfect in this thing, they hacked this, they cracked that software, they successfully sent a bug to that and all that.

But, guys listen up! This is not a race to prove yourself. I don’t even know why and when did I change myself and became an optimist of the computing industry and the divine software programmer. But, yes I am a good guy and I believe that the new thing that you do, you learn, you test or you show off is nothing to smile or dance for. You’ve got a lot of new things in front of you, to prove yourself at, to prove that you’ve got enough guts to prove your perfection in every stage.

A master is not the one who can write the software application with first attempt, he is not the one who can crack a software, neither is the one who can easily hack into his neighbour’s Wi-fi connection and nor is the one who can hash the password of the friend – ewww, a programmer is never a criminal.

I can’t afford to live a life where I am never going to see an error again. I still love those nights when I pulled my hairs in agression when a simple “System.NullReferenceException” made me stay awake entire night and understand and fix the error. That taste, that feeling is just perfection and no other feeling can even match it. Feeling of getting an error in your programming is the feeling of having those masalas added to your chicken – hmmm, yummy!

A master is the one, who gets to learn from his mistakes, who is not afraid to make a mistake even if that causes a havoc in his life, those mistakes make him understand what programming is what he needs to do what happens when he does what and all other such concepts. A master can never be a pessimist, that is why mostly people don’t get to this stage and it is never about the fame – we all are after. Once fame gets in your head you can never show your best and your skills will start to wither away. You can try pissing yourself off – run for fame, it will run away, run for your self show your best, fame will come for you, searching like a dead zombie searching for flesh.

A programmer can never think of anything bad, he is the one who is responsible for a good computing world – for a good environment for people to come and sit together share their views assets and others. If criminals would start to create internet and other technology assets there won’t be anything left at all to smile at – to have our faith in. We build programs, not for fame, we build it because we want to, we start a new framework and foundation because we want to help our fellows get more sleep at night, not to get a chance to come on the television to tell our cell phone number to the public – specially the women. Do think about your identity first, computer programming is not a field for fame or money. We are a family, don’t call us a community, it is a family, where elders are respected, juniors are taught and everyone loves everyone! There is no offense, no hate and just a happy and peacefull environment – untill people who love fame enter.

Software to convert Numbers from one base to another

I have just developed a software that converts the number system from one base to another base. It was developed using C# and XAML. Windows Presentation Foundation model was the main thing to thank for the development of the Graphical User Interfact. The Software requries .NET Framework 4.5 and Visual Studio to compile. Feel free to build, compile and share the software with others.

The GUI includes three basic controls for better handling the Software and the RunTime.

  1. Input Control
    For getting the value from the User that has to be converted.
  2. ComboBox Control
    For controlling the type of the initial base of the number. This also settles down the software to work accurately.
  3. Button
    Well, this run the execution of the math.

This the the program at all.

You can get the values from each of the number system base into all other 3 types of number system base.

Feel free to get it, share it! Don’t forget to +1 the source code as a thanks.

From GitHub, from MSDN sample gallery.