Showing posts with label Technology. Show all posts
Showing posts with label Technology. Show all posts

Thursday, July 12, 2018

Dirty Read Phenomena - (Explained by Example)

In IGeometry we discuss interesting software engineering topics by example. In this video we explain isolation, the third property of a relational database. Problems arise from isolation are many, and we discuss the first one which is Dirty read. We illustrate this using instagram as example .


Software Engineering Content on IGeometry —————————————————————— - [x] Stateful vs Stateless Applications  https://goo.gl/Fubfi6 - [x] Database ACID - Atomicity https://goo.gl/ER9PPj - [x] Database ACID - Consistency https://goo.gl/VpLAeN - [x] Database ACID - Dirty read https://goo.gl/88wf6y - [x] Database ACID - Phantom read https://goo.gl/rnyzuA - [x] Database ACID - Non repeatable read https://goo.gl/8kgEjN - [x] Database ACID - Read uncommitted https://goo.gl/4igWUq - [x] Database ACID - Read committed https://goo.gl/twgAKL - [x] Database ACID - Repeatable read https://goo.gl/vDcP6M - [x] Virtual Machines vs Containers https://goo.gl/fiECVb Boost your GIS knowledge by grabbing my books ——————————————————————— - [x] Learning ArcGIS Geodatabase https://goo.gl/csQdCX - [x] Administering ArcGIS for Server https://goo.gl/zvYCRg - [x] ArcGIS By Example  https://goo.gl/yJKSqB - [x] Building Web Applications with ArcGIS https://goo.gl/brgKUJ Watch my top GIS videos ———————————— - [x] Support IGeometry on paypal: https://goo.gl/wZ8hSh - [x] Full ArcGIS Javascript API Series Playlist http://bit.ly/2zf7G80 - [x] Full Multi-User Geodatabase Playlist https://goo.gl/nSgYnM - [x] Full ArcGIS Pro 2.x Playlist https://goo.gl/2j4NoZ - [x] Full ArcGIS By Example (C#) [Phonatech] Playlist https://goo.gl/FwdrHa - [x] Full ArcGIS Server Playlist https://goo.gl/nkfM6Q

Sunday, March 11, 2018

Software Engineer Reacts YouTube Series

This is a new series that I started where I pick a popular app and i react to how it was developed and try to guess the technologies that have been implemented. What requests do the application make? inspect the results and try to guess why the devs decide to show the results in this way versus another. If you are interested in user experience and software engineering consider checking this series out.

The first episode is Instagram! Enjoy guys let me know what you think about this and do suggest another app! Want to watch more Software Engineering Reacts videos?


Sunday, March 4, 2018

Who is Hussein Nasser?


I recently recorded a video talking about my story, where did I come from? what did I study? what jobs did I have? Why did I start my blog and Youtube Channel? How did I write my books? How did I move to the United States? and much more.. 

Stay Awesome guys and Enjoy the video.
Hussein 



Saturday, March 3, 2018

Why is JSON popular?

I asked my self this question before and I never understood the reason why JSON was popular until I actually worked with JSON and javascript. For someone who worked with XML and C#, I really appreciated JSON. The beauty of reading JSON of Javascript is so satisfying. Here is a podcast enjoy.



Friday, December 15, 2017

ArcGIS Javascript API #esrijs 4.x - 15 - Building an attributes viewer table ( like ArcMap and Pro)

Full ArcGIS Javascript API Series Playlist http://bit.ly/2zf7G80



The moment where we finally built the attributes viewer successfully 34:10





Support IGeometry:  http://bit.ly/2Bgt4vc



Building the Attribute Table that views the list of features in a given layer. Just like the standard attribute viewer/editor in ArcMap and Pro.



https://github.com/hnasr/jsapi4x/tree/episode15







Stay Awesome!

Hussein Nasser





Friday, February 12, 2016

Class v. Object: The simplest explanation possible


  • Take a cupcake pan and assume it has only one hole for one cupcake.
  • Prepare a cake mix with vanilla flavor and pour it in the pan.
  • Put the cupcake pan in the oven. And wait until it is cooked.
  • Take it out of the oven and you now have vanilla cupcake.
  • Prepare a cake mix with raspberry flavor this time and put it in the same pan.
  • Put the cupcake pan in the oven. And wait until it is cooked.
  • Take it out and you now have raspberry cupcake.
  • Put each Cupcake on its own plate. You only have two plates.
  • Similarly try bake a lemon cupcake, but wait, you don't have a plate to put it on so you can't bake just yet.
  • Eat the raspberry cupcake.
  • Now bake a lemon cupcake, take it out of the oven and put it on the empty plate where the raspberry cake was.
Illustrated:
The Cupcake pan is the class.
Cupcake();
The vanilla cupcake is the an object made from the class.
Cupcake vanillaCupcake = new Cupcake();
The raspberry cupcake is a second object made from the same class.
Cupcake raspberryCupcake = new Cupcake();
Class is the same, objects are made from a class, objects from the same class can have different attributes.
vanillaCupcake.Flavor = "Vanilla";
raspberryCupcake.Flavor = "Raspberry";
The time the cupcake was in the oven cooking is the object initialization time. How much time it take to create an object, store it in memory and all this shit.
creationTime = Now; //08:01:05 AM 
Cupcake vanillaCupcake = new Cupcake();
initializationTime = Now - creationTime; //08:01:07 AM  
//initializationTime is 2 seconds
The lemon cupcake could be created but no plate for it, this is insufficient memory to create an object.
Cupcake lemonCupcake = new Cupcake(); //ERROR
Eating the raspberry is basically destroying the object and removing it from the memory.
raspberryCupcake = null;
Now that we have an extra plate, we can put our lemon cake in it. We have enough memoery to create another object.
Cupcake lemonCupcake = new Cupcake();
lemonCupcake = "Lemon"
Cupcake are just to explain what class and object are but if you really want to understand it, I do believe OOP is learned in a real life project context. So I started a Youtube channel to teach OOP within a context of a real life project where we build a project from scratch and add functionality episode by episode.
I don't even have ads on this thing, I have a day job and I do this in my free time. I just genuinely want to share my knowledge out there.

My post on reddit
-Hussein

Sunday, September 27, 2015

ArcObjects by Example Book by Hussein Nasser





 Buy ArcGIS by Example


Last month I recorded a video on general channel and life update. In that video (or podcast) I mentioned that I'm working on a new book.

The book titled "ArcGIS By Example" has been successfully published. I would have named it ArcObjects by Example really, but the publisher suggested this name so.

The book is extremely useful for those who want to get started with programming with ArcGIS and do really cool stuff with ArcGIS that is not provided out of the box. It discusses how to develop using Add-ins and extending ArcObjects techniques. The beauty of this book is that it uses an example approach, which is a real life scenario project where you build a software to satisfy certain requirements. Not only that, you have 3 examples that you will never find anywhere on the net because simply I made them up. Unless the future version of me beat me to it and published it before I did?

You only need ArcGIS and ArcObjects SDK to work on the book and of course Visual studio express which is free. The book is written for ArcGIS 10.3.1 but you can work with ArcGIS 10.1 up 10.3.1 safely. The book has the list of software requirements too.

Since I'm a gamer, the book references some video games characters and location. Shoot me an email if you did figure them out with the page number :)

Thank you guys for buying my book! Enjoy it and check out my 200+ free video tutorials on IGeometry YouTube channel. 





Monday, October 13, 2014

Night's Watch: the Software that allows you to watch your machines

As software get more complicated, better hardware is needed to support it. More servers are installed, and thus they all need to be maintained. This project is initiated as an attempt to capture the performance of multiple servers connected on the same network. The product captures the cpu utilization, RAM usage and availability and other information and allows the user to process and analyze this information. There is a live web interface which provides an active state of the servers and whether they are online and up and running. The solution is designed carefully to be scalable and portable, currently only supported for windows machines.
Today, I bring you the alpha version of a software that I have been working on for a while. The Nights Watch.

Night’s Watch is an easily configured application that allows you to monitor network connected Windows machines from a web interface and see their CPU and RAM usage, whether they are connected or not. The real power of the Night’s Watch is that you don’t require installing any client software in the machines that need to be monitored. Which makes the installation and scaling very easy to implement.




It is a matter of simply adding the machines that you want to monitor into a configuration file and the Night's Watch takes care of the rest. 


Try it out guys and let me know, here is me shipping it finally.

Wednesday, September 3, 2014

9223372036854775807 is a special number

The number 9223372036854775807 is a very special number in programming but why?

Take a look at this small program in .NET, I have declared a long integer and saved this number in it.




I will now increase this number by 1 and try to store it. I will try to store the 9223372036854775808 number Note the compile error I got in this code.



The reason it overflowed is because n is a signed long integer variable, which means it is a 64 bit number. This means it can hold up to 2^63 -1 only and the computer cannot store the extra number.


Avoid Overflows! Make sure your calculations doesn't exceed this number in your future code!

Want to learn programming and software engineering? Follow my YouTube Channel 

Saturday, August 30, 2014

Build something small that scales

If you are starting a new project, you don't want to build something large. Instead build something small that scales easily.
You might ask how can one build something small that scales into something large. Well, I always ask myself while designing a new software, "What if tomorrow a company wants to buy this software and run it on a multi million user environment? Will they be able to add more hardware, reboot and just play?"

If the answer is no, I redesign it and ask the same question again until I get a yes.

Only then I start coding. 

Sunday, September 22, 2013

Ten things I hate about my HTC One

HTC One is a powerful piece of hardware. The battery life is amazing, charging curve is off the roof. The design itself is sleek not to mention the beats audio component which is a plus. The blinkfeed is my favorite news aggregator I ever used, it is so initiative and simple as if am holding a refreshing newspaper.

However, there are some key software features which makes it really annoying, I have compiled this list not because I'm moving from HTC but to somehow deliver this post to mobile makers to remind them that they are making a smart phone, manufacturers tend to forget that. Some of you will reckon that most of these items in the list can be achieved with apps, workarounds and little tweaking, the problem is that a phone is suppose to deliver these out of the box. 

This list may apply to other smart phones as well.

EDITED in 29-Oct-2010 after Android 4.3 Update Sense 5.5, HTC fixed few of the things in the HTC making it much better.



1. Phone Only Option
Although RIM lost track of their goal recently, the Blackberry had some wonderful options which make a core phone including this option. In meetings or while you sleep you can keep your phone in Phone Only mode thus making all notifications silent yet make calls active. 
Android 4.3 Update Sense 5.5 introduced this function DO NOT DISTURB, good but still it you have to go and add exceptions for that to work.


2. Panels Limitation
Panels are the place holder for apps, HTC allows up to 5 panels only. Android 4.3 Update Sense 5.5 added one extra panel to make them 6 panels. I really don't get the limitation here, If it is a kind of a Zen thing it is not working. I use a whole panel for a calendar, another one for a blink feed another one for a TV widget.

3. ScreenShot Sharing
When you take a screenshot the usual common sense is that I want to share it. I have to go and dig for it in the gallery to find it open it then share it from there.
Android 4.3 Update Sense 5.5 introduced this function 


4. Making Phone Silent
Here are the steps to make a phone silent, Switch on phone, Unlock Phone, Pull Down Notification, Then click twice on the sound icon to make it silent. Such operation should be available in a slightly simpler approach don't you agree? Like holding the power button and make silent for instance?

5. Downloading a New App
When i download a new app it is supposed to naturally be found at the end of the apps list. Someone made a decision to sort the apps alphabetically confusing us by default and I had to change this option to most recent so I can see them. You see the options are there, however configuring them is hectic, these should go for granted.

6. Shortcut



Have you tried creating a shortcut to the panel. It is like a puzzle. You hold the app and you have to drag it a small icon on the top of the screen which then allows you to drag . I don't know about you but I usually hold my phone with one hand and use my thumb to click and drag it is physically impossible to do that, see picture my thumb cannot reach the shortcut menu. The panels should pop up automatically whenever I drag an app.


7. Sharing contact
What attracted me to Android is the flexibility. One of the features is the ability to share almost any object. In HTC surprisingly you cannot share a contact via email or whatsapp, you can only send a contact via SMS. To me and you this is probably ancient technology plus it costs money.

8. Cannot share downloaded image


When you download an image from the web or I receive it on whatsapp or any other application there is no option to share it or interact with it. You can only see the image details, this is one of the most frustrating missing features in HTC One. See image below



9. What day is it?





Can you imagine how frustrating it is that you carry a quad core device with 2 Gigabytes of memory that you have to struggle with it to tell you what day is it? To find out what day is it first i turn on my device. I unlock it. Then i drag the notification window down to find out that it is Sunday.  Seriously this should be available on the lock screen. I don't get it seriously how difficult is to think of intuitive essential things.


10. Accessibilities
Calculator, notes and calendar are not available instantly. These apps or widgets are important and should be accessed with ease.

I LOVED what HTC did to fix this, they added an option to add a panel on the lock screen, I added my calculator there.



11. Pinch and Zoom 
Apparently there is a limit to which you can zoom in to a picture. I don't know why

Monday, August 12, 2013

Smartphone Market is Almost Saturated but there is still Room for a New Category





The question: Which smartphone should I get? has become irrelevant. Whether iPhone or Samsung or HTC or Sony or LG or Nokia or even those Chinese replica, they all do the same thing. You can still call, browse, text, chat, play and email. Having an eye tracking option or water resistivity is something that sounds attractive but it is not a deal breaker. Not even putting the volume controls behind the phone will do.

It started with the introduction of the iPhone when Steve Jobs re-invented the smartphone,  every company then started to follow that paved path. If I could divide the market into segments, I would say there are about two segments now, the average cost devices which everyone is getting, like iPhones, Samsung, HTC. Then there is the low cost devices which samsung and other companies are targeting as well, cheap smart phones for low income, they are not as smooth as the original ones but they do that job.



This market is satisfied, Steve Jobs realized this back in 2010 and moved on, just three years after the iPhone is released the SmartPhone market is getting saturated slowly specially with the Android coming into picture and the fleet of devices that came with it. Jobs refocused and saw a gap in the market for a device larger than the SmartPhone and smaller than the laptop, he squeezed-in the iPad and it was a great hit ending up harvesting an entirely new market for tablets.

However I believe that smartphone market has a hidden segment, this segment has settled with average cost phones whereas they could afford much more. Those are the luxury or high cost phones, if a new company could come up with smartphone that shares the same software as an iOS or Android but with high end specs and distinctive luxurious design. So those who get it can brag about it, the 60% market segment will be slashed into two segments like follows.




This segment should not be completely different when it comes to software, remember those rich people and celebrities still want to play candy crush and minion rush. It should just make phone into a piece of accessory. Vertu is trying to space this segment slowly by its introduction with the Android phone. But still something is missing, someone should figure out what flavor is missing and add it. You can't just slam a ready made android software into a luxury phone, it should be customized I believe to be luxurious.

Five things this smartphone should have:

1) It should be extremely simpleSince it is designed for celebrities and rich people, those people probably want the simplest things in a phone basic stuff, adding more will confuse them.  3 to 4 Apps tops by default, of course they can install and buy if they want.

2) No Gimmicks 
Tons of camera options and settings are not for this segment, they want to click a button to take a picture of them while enjoying their time in The Hamptons and send it. They don't want to know or care what HDR or 1080p means.

3) Extensive sharing options 
Forgot other phones, and focus on enabling easy sharing between similar phone models only. Always enabled NFC will be nice for them.

4) Compact Size
Not too small yet not too big, remember it should fit into a fancy clutch.

5) Robust 
Since it is going to be expensive it better be strong


Monday, June 24, 2013

Play NES Games on your Android Device

We were talking the other day me and wife on how she misses the old NES games, and how really addicted there were compared to current mobile games.

I told her you know you can still play them on your android. She was delighted when I showed her how. 


Here you go as well.


1) Download NES Emulator from here, the app which will allow you to play the games.
2) Download your favorite game and save it to your phone





































3) Run the program and it will list all your games




Monday, June 17, 2013

Water Thumb Drive




Digital Thumb drives can hold Gigabytes of data and transfer up to whatever USB 3.0 can handle.

Water thumb drives could hold Exabytes of data (the number of sand grains on Earth and Mars combined) and transfer up to whatever the molecular bonds can support.


Save one bit in a Hydrogen atom and we'll get there.

Saturday, June 15, 2013

Web Services, best invention since sliced bread






Probably you read about it in a tech blog or heard it in a conference.
If you end up here from a google search, you're probably searching for an easy definition for a web service.
Consider the following scenario:

Scenario #1
You at home watching TV in the living room, your mother is in the kitchen making dinner. She is out of cheese, so she asks you to get some from the store. You leave the house, buy some cheese, return home and hand the cheese.

Scenario #2
You are outside jogging in the park, your mother is at home making dinner. She is out of cheese, so she calls your cell, you answer, she asks you to get some cheese, so on your way you go to the store, buy some cheese, return home and hand the cheese.


First scenario is an application for local function calling. You have a software installed locally on your machine (kitchen and living room) that does something (getting the cheese)

Second scenario is a case where that function is online and you can access it from anywhere (home and the park) using a communication protocol (cell phone).


If a software can be called from anywhere it is called a web service. It is that simple, but some IT folks like to use words to make them sound sophisticated. Like REST and SOAP and SAAS etc...


It is its simplicity which makes it beautiful with so many applications.

Thursday, June 13, 2013

The Prestige in Programming

Please read this quote from the movie Prestige very carefully.

"Every great magic trick consists of three parts or acts. The first part is called "The Pledge". The magician shows you something ordinary: a deck of cards, a bird or a man. He shows you this object. Perhaps he asks you to inspect it to see if it is indeed real, unaltered, normal. But of course...it probably isn't. The second act is called "The Turn". The magician takes the ordinary something and makes it do something extraordinary. Now you're looking for the secret... but you won't find it, because of course you're not really looking. You don't really want to know. You want to be fooled. But you wouldn't clap yet. Because making something disappear isn't enough; you have to bring it back. That's why every magic trick has a third act, the hardest part, the part we call "The Prestige".



Every programmer has his own tricks on how he make his application stands out. Everyone see the output program or script or functionality and like it, let them enjoy the output, don't tell them anything else.

Once your programming prestige is revealed, that is it. You will start hear things like

"Oh, that's how he did it. I thought It's more complicated. "
"Aha you used that feature, everyone can do that" 
"No, my level of thinking and implementation was way beyond this"
"Instagram? I thought of that application before but didn't implement it"
"No my idea is way more sophisticated." 


Programmers are like magicians, they shouldn't reveal their tricks. Create tricks and keep them to yourself. Learn from others.

Friday, April 19, 2013

Fetch URL Text from Android/Java Application

I searched a lot for a straight forward clean multithreaded code to do this simple task, read data from a URL and get the output. All I found were segments of codes that force close.

So I wrote a simple class do this task.

Create a new Class name it FetchURL and past this whole thing into it.

//Hussein Nasser 19-4-2013
//www.husseinnasser.com 
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
 public class FetchURL {

 private String output;
 private String url;
 
 public FetchURL()
 {
  output = "";
 }
 
 public String getOutput()
 {
  return output;
 }
 
 
 public void Run(String u)
 {
   url = u;
    Thread t =  new Thread() {
         
       public void run() {
                   
         // Toast.makeText( mycontext , "running thread bitch", Toast.LENGTH_LONG).show();
                   
                    URL textUrl;
               try {
                 
                textUrl = new URL(url);
                
                BufferedReader bufferReader = new BufferedReader(new InputStreamReader(textUrl.openStream()));
                 
                String StringBuffer;
                      String stringText = "";
                while ((StringBuffer = bufferReader.readLine()) != null) {
                 stringText += StringBuffer;
                }
                      bufferReader.close();
                 
                      output = stringText;
                    
               } catch (Exception e) {
                // TODO Auto-generated catch block
                //e.printStackTrace();
                 
                output= e.toString();
               }
              
                }
            };
             
           t.start();
      try {
   t.join();
  } catch (InterruptedException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  
 }
 
 
 
 
}



To use the code in your main activity

//Create an Instance of our Class
     FetchURL fu = new FetchURL();
     
     //run this shit (this will pause your current activity until you get the result, this should return 123 
     fu.Run("http://geshout.com/version.txt"); 
     
     //You are clear, your activity is now active and get your string and do Whatever you want 
     String o = fu.getOutput();
     
     //Cheers!
     Toast.makeText(this, "output " +   fu.getOutput(), Toast.LENGTH_LONG).show();
     

This code allows you to read and execute PHP URL, almost anything that returns HTML I guess, anyway report any bugs to me. This code uses threading to execute the network capability And oh, make sure you have the internet permission on your Android Manifest.

Wednesday, January 16, 2013

.NET Microsoft Performance Counter does not match Task Manager

I have been struggling with this for a while now. I was asked to display the CPU usage for a list of windows servers remotely from one machine. So I wrote a piece of code that does just that using the Performance Counter. Only to find out that it returns inaccurate CPU data. I tried reading more than once, taking the normal distribution of a list of values nothing worked.

After a while it appears that you have to read .netValue once then sleep a while then read it again . Yes that is it. This fixed the problem.
Here is the code to get the real value of CPU matching the Task Manager


    Public Function getCPUPerformance(ByVal remoteHost As String) As String

        Dim userHandle As New IntPtr(0)
        LogonUser("username", "domain", "password", LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, userHandle)
        Dim identity As New WindowsIdentity(userHandle)

        Dim context As WindowsImpersonationContext = identity.Impersonate()
        Dim cpuUsage As PerformanceCounter

        cpuUsage = New PerformanceCounter("Processor", "% Processor Time", "_Total", remoteHost)

        Dim val1 As Single = cpuUsage.NextValue()

        val1 = cpuUsage.NextValue()

        Thread.Sleep(50) 'You have to Sleep, otherwise you will get kinky results    
  
        val1 = cpuUsage.NextValue()


        Return val1

    End Function





Monday, December 17, 2012

He's dead, Jim! [Chrome Error]

Its the 18 of December, I just returned to work from a 4 days vacation national day. I started checking my blog only to get this new error message from google chrome that I never seen before.



Who is Jim Google?

Sunday, November 25, 2012

First Android Game: Guess the Shoes





Really simple game I wrote for android phones just for the ladies, guess the shoe designer and get points , score as much as you can!

Download game here