Avançar para o conteúdo principal

Mensagens

Upgrading Windows 10 Home to Pro

 So I have been thinking about upgrading my Windows 10 Home Edition to the Pro version, but I always get to the point where it seems that I had to reinstall the entire SO and quit. After some investigating I have done it this way: - following this post  on the microsoft site I use one of the default keys for Windows 10 Pro and went to Settings > Update & Security > Activation > Change the product key; - next, Windows will activate the Pro functionalities and asks to restart; - now you have the Pro version but it's not activated, so you have to buy a Windows Pro Key. I went to UR cdkeys  and bought a key for less then €20; - and with the new key went to Change the product key and activated; - and it's done. Disclaimer : I have nothing to do with UR cdkeys so you can use any site to buy you cd key and your experience may vary from mine.
Mensagens recentes

Single Page App with C# WPF/XAML

 In this post we are going to create a single page app. The app will have multiple pages that get rendered in the main window. We will be using Visual Studio, C#, WPF and XAML. Let's start by creating a new project in Visual Studio of this type: Next, in the MainWindow, we define the interface structure. On the left side we place a menu and on the right side a DockPanel with a Frame in it. The Frame is the element that is used to render de pages content. Now let's add the new pages. In this example I will add two pages. Click in the Solution Explorer with the mouse right button, then choose Add and Page. The project looks like this. The app content goes on the recently create pages. Because this is just an example I will just change the background color and add a small text. Page1 Page2 Finally the code. Back to the MainWindow we need to create the click events on the menu items. So, in the MenuItem line add the click event and pick New Event Handler. If that option doesn't

C# IEnumerator and IEnumerable interfaces

In this article we will learn how to use the IEnumerator interface to allow you to use a foreach loop in a data set or collection. Most collections (lists and others) already implement the interface, but in this case we will customize the way we browse through the list. When we use code like this: foreach(Class c in Collection) { ... } The compiler convertes this code in something like this: IEnumerator cc = Collection.GetEnumerator() while(cc.MoveNext()) { c=(Class)cc.Current; ... } Implementing the IEnumerable interface means that the class implements a version of the GetEnumerator () function that must return a class that implements the IEnumerator interface. Let's explore an example. We start with the client class: This class will allow you to store customer data, and there is a field to indicate whether the customer is still active or not. Next is a class that defines a client list and implements the IEnumerable interface that returns an object

Unity 3D Coroutines Part II

Coroutines are functions useful to implement tasks that need to happen across multiple frames. In this post we will see how to make the camera animate from one point to other across some time, the amount of time will be set in a variable so it can be changed. The function will be called when the user press the space bar. void Update () {         if (Input.GetKeyDown(KeyCode.Space))         {             if(func!=null)                 StopCoroutine(func);             func = StartCoroutine(smoothMoveCamera());// moveCamera());         } } We need some variables in the class:     public float duration = 2.0f;     public float xStart = -5.0f;     public float xFinish = 5.0f;     Coroutine func; The first variable sets the number of seconds the animation will endure. Second is the start point and the third the final point, both are points in the x axis. Then there's a reference to the coroutine so we can stop it if needed. The coroutine code is this:     IEnumer

Unity3D Coroutines

Coroutines are functions that maintain status while returning code execution to the method that called them. They are useful for the development of games to allow the execution of certain code over several frames. For example to animate the camera of the game we could execute the following code: for(int i=0;i<100;i++){     transform.position += new Vector3(1, 0,0); } If this code is within a function that is executed normally it is not possible to see the camera moving along the X axis since the game scenario update only occurs at the end of the cycle and not during the execution of this. In order to see the movement of the camera, it is necessary to perform an iteration of the cycle and then update the scene (rendering) and then continue the cycle with one more iteration and refresh the scene again, in this case what's needed is to interrupt the execution and to resume without losing the state, for this we can implement a coroutine. A coroutine is just an IEnumera

ASP.NET MVC with Entity, Identity and Migrations Part 3 - File Upload

In the third part of this MVC tutorial we add two new controllers and models with the ability to upload files to our web site. The Room model is pretty simple:  public class Room {         [Key]         public int nr { get; set; }         [Required(ErrorMessage = "Deve indicar o piso do quarto")]         public int piso { get; set; }         [Required(ErrorMessage = "Deve indicar a lotação")]         public int lotacao { get; set; }         [Required(ErrorMessage = "Deve indicar o estado do quarto")]         public bool estado { get; set; }         [DataType(DataType.Currency)]         [Required(ErrorMessage = "Deve indicar o preço por dia do quarto")]         public decimal custo_dia { get; set; }     } Just add the controller with Entity framework and that's it. Next add the Client model:     public class Client {         [Key]         public int ClientId { get; set; }         [Required(ErrorMessage = "Tem

TensorFlow Variables and Placeholders

In this second part of the introduction to TensorFlow we add two new node types: variables and placeholders. Let's use the same example that we have used in the first part. We start by importing TensorFlow: import tensorflow as tf Next we start a session, but before let's make a reset to the graph internal state: tf.reset_default_graph() sess=tf.Session() And now we create two variables of type 32 bit float: x = tf.Variable(2.0,tf.float32) y = tf.Variable(3.0,tf.float32) Since we are using variables we must initialize them: init = tf.global_variables_initializer() sess.run(init) The mathematical expression is this: sumnodes = x + y To evaluate the expression: print(sess.run(sumnodes)) Because we are using variables we can change the values like so: sess.run(x.assign(5.0)) As always we must execute the assign operation inside a TF session. To make multiple assigns we create references to the operations and execu