Nikola Brežnjak blog - Tackling software development with a dose of humor
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Home
Daily Thoughts
Ionic
Stack Overflow
Books
About me
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Nikola Brežnjak blog - Tackling software development with a dose of humor
Stack Overflow

Wait for images to load and then execute all other code

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

So, my question was as follows:

What I want to do is: wait until all images are preloaded and only then execute all other javascript code. As far as I’m concerned it can (but not a must) have a “loading…” message.

The fact is that I have a pretty big image in the body background and 2 other images which are also bigger, and so I would like to preload them so that then they would show instantly and would not have that ugly “loading” image effect.

This is what I’m using now but it’s not good:

$(document).ready(function()
{    
     preloadImages();
     ...some other code...

    function preloadImages(){
         imagePreloader([
            'images/1.png',
            'images/2.jpg',
            'images/3.png',                
         ]);
     } 

     function imagePreloader(arrayOfImages) {
         $(arrayOfImages).each(function(){
             (new Image()).src = this;
         });
     }   
}

I don’t know, maybe I should call this preloader somewhere out of the .ready()? or something like that? Btw, yes, I also read this post and I don’t know why but .ready() works faster for me.

The answer, by user Kevin Ennis, was this:

Instead of trying to preload, you could just execute your script on…

window.onload =function(){..}

That doesn’t fire until all images have been loaded.

My own solution was this:

Ok, so finally I got this thing to work. My problem? I was setting the waiting div wrong. This is my code now: I have the loading div which I show above everything and then when all images load (using $(window).load(function(){…}); as suggested I, hide that div.

<divid="loading"><divid="waiting"><imgclass="loadingGif"src="images/loading.gif"></div></div>

#loading
{
   background-size: 100%;
   background-color:#000;
   width: 100%;
   height: 100%;
   margin: 0px;
   padding: 0px;
   z-index:999;
}  

#waiting
{
   margin-left: auto;
   margin-right: auto;    
   position:absolute;
   top: 39%;
   left: 27.81%;
   width: 45%;
   height: 150px;    
   background-color: #FFF;
   border: 12px solid #FF771C;
   text-align: center;
}

And my jQuery code is this:

$(window).load(function(){    
    $('#loading').addClass('hidden');...}

Additionally, user Alex had a great answer too:

I  have a plugin named waitForImages that lets you attach a callback when descendent images have loaded.

In your case, if you wanted to wait for all assets to download, $(window).load() may be fine. But you could do it a bit cooler with my plugin 🙂

var loading = $('#loading');

$('body').waitForImages(function(){    
    loading.addClass('hidden');},function(loaded, total){
    loading.html(loaded +' of '+ total);});
Books

Think and grow rich – Napoleon Hill

My favourite quotes from the book Think and grow rich by Napoleon Hill:

All earned riches have a beginning and an idea.

We refuse to believe that which we do not understand.

We are the masters of our faith, the captains of our souls, because we have the power to control our thoughts.

Our brains become magnetized with the dominating thoughts that we hold in our minds, and these magnets attract to us the forces, the people, the circumstances of life which harmonize with the nature of our dominating thoughts.

Desire – the first step towards riches.

He did not say “I will try, he knew he would make it”.

Fix an exact amount you want in your head. Determine how much will you give back. Establish a definite date. Create a definite plan for carrying out your desire and begin at once. Write this all down. Read this statement twice a day. See yourself in possession of the money.

The object is to want money and to become so determined to have it that you convince yourself that you will have it.

No one ever is defeated until defeat is accepted as reality.

No one is ready for a thing until he believes that he can acquire it.

Our only limitations are those that we set up in our own minds.

Desire backed by faith knows no limit.

If you think poorly about yourself, your subconscious mind will take this and translate into physical equivalent.

Fate is a premise for everything.

Any idea, plan or purpose may be placed into mind by repetition of thought. That’s why you have to read/write your definite chief aim.

You come to believe what you constantly repeat to yourself.

If you think you’re beaten, you are. If you think you dare not, you don’t. If you like to win, but you think you can’t it’s almost certain you won’t. If you think you will lose, you lost. It’s all in the state of mind. You have to be sure of yourself before you ever win a prize. The man who wins is the man who thinks he can.

Any man is educated who knows where to get knowledge when he needs it, and to organize that knowledge into plans of action.

Anything acquired without effort and without cost is generally unappreciated, often discredited.

The person who stops studying merely because he finished school is forever hopelessly doomed to mediocrity.

There is no fixed price in an excellent idea.

The idea is the main thing. Specialized knowledge can be found just around the corner.

The only limitation is that which one sets up in one’s own mind.

No man is ever wiped, until he quits – in his own mind.

A quitter never wins, and the winner never quits.

The greatest among you shall be servant of all.

The world does not pay a man for that which they know, but for what they do, or induce others to do.

Every company has room for a man who has a definite plan of action which is to the advantage of that company.

Money without brains is always dangerous.

Riches do not come without effort.

With persistence will come success.

1. Definite purpose backed by a burning desire for its fulfillment.

2. A different plan expressed in continuous action.

3. Mind closed tightly against all negative and discouraging influences, including negative suggestions of relatives, friends and acquaintances.

4. A friendly alliance with one or more persons who will encourage one to follow through with the plan and purpose.

The sex energy must be transmuted from desire for physical contact into some other desire or action.

Faith and fear make poor bedfellows.

Pray for a thing and believe you will receive it.

Stack Overflow

Is there a PHP function to evaluate string like “2-1” as arithmetic 2-1=1

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

So, my question was if there is a PHP function which would take the string like “2-1” and produce the arithmetic result of it (1)? Or will I have to do this manually with explode() to get the values left and right of the arithmetic operator?

The answer, by user Jon, was quite elaborating:

I know this question is old, but I came across it last night while searching for something that wasn’t quite related, and every single answer here is bad. Not just bad, very bad. The examples I give here will be from a class that I created back in 2005 and spent the past few hours updating for PHP5 because of this question. Other systems do exist, and were around before this question was posted, so it baffles me why every answer here tells you to use eval, when the caution from PHP is:

The eval() language construct is very dangerous because it allows execution of arbitrary PHP code. Its use thus is discouraged. If you have carefully verified that there is no other option than to use this construct, pay special attention not to pass any user provided data into it without properly validating it beforehand.

Before I jump in to the example, the places to get the class I will be using is on either PHPClasses orGitHub. Both the eos.class.php and stack.class.php are required, but can be combined in to the same file.

The reason for using a class like this is that it includes and infix to postfix(RPN) parser, and then an RPN Solver. With these, you never have to use the eval function and open your system up to vulnerabilities. Once you have the classes, the following code is all that is needed to solve a simple (to more complex) equation such as your 2-1 example.

require_once "eos.class.php";
$equation ="2-1";
$eq =new eqEOS();
$result = $eq->solveIF($equation);

That’s it! You can use a parser like this for most equations, however complicated and nested without ever having to resort to the ‘evil eval‘.

Because I really don’t want this only only to have my class in it, here are some other options. I am just familiar with my own since I’ve been using it for 8 years. ^^

Wolfram|Alpha API
Sage
A fairly bad parser
phpdicecalc

Not quite sure what happened to others that I had found previously – came across another one on GitHub before as well, unfortunately I didn’t bookmark it, but it was related to large float operations that included a parser as well.

Anyways, I wanted to make sure an answer to solving equations in PHP on here wasn’t pointing all future searchers to eval as this was at the top of a google search.

Books

The greatest salesman in the world – Og Mandino

My favourite quotes from the book The greatest salesman in the world by Og Mandino:

It is indeed a simple task, provided one is willing to pay the price in time and concentration until each principal becomes a part of one’s personality.

Do not aspire for wealth and labor not only to be rich. Strive instead for happiness to be loved and to love and more importantly to acquire peace of mind and serenity.

I consider poverty to be lack of ability, or lack of ambition.

Rewards are great if one succeeds. But the rewards are great only because so few succeed.

Never feel shame for trying and failing, for he who has never failed is he who has never tried.

Failure will never overtake me if my determination to succeed is strong enough.

Although I consider myself a good salesman I cannot sell death on departing from my door.

You’re an old man nods wisely and speaks stupidly.

For what is success than the state of mind.

Failure is man’s inability to reach his goals in life, whatever they may be.

I could bestow upon you great wealth but this would do you great disservice, far better is if you become the world’s greatest salesman on your own.

The only difference between those who have failed and those who have succeeded lies in the difference of their habits. Good habits are the key to all success. Bad habits are the unlocked doors to failure.

Only a habit can subdue another habit.

As I repeat the words daily it will soon become the part of my active mind, but more importantly it will also slip into my other mind. That mysterious source that never sleeps, which creates my dreams, and often makes me act ways I do not comprehend.

I will not hear those who weep and complain for their disease is contagious. Let them join the sheep. The slaughterhouse of failure is not my destiny. I will persist until I succeed.

The prizes of life are at the end of each journey, not at the beginning. And it is not given to me to know how many steps are necessary in order to reach my goal. Failure I may still encounter at 1000th step, yet success hides behind the next bend in the road. Never will I know how close it hides unless I turn the corner. Always will I take another step. If that is of no avail, I will take another and yet another. I will persist until I succeed.

There is no room in the marketplace for my family. Nor is there a place for market at my home.

If I persist long enough I will win.

Never has there been a map however carefully executed to detail and scale which carried its owner over even 1 inch ground, never has there been a parchment of law that prevented one crime. Never has there been a scroll that produced a penny. Action is the food and drink that will nourish my success. I will act now.

I will pray, but my cries for help will only be cries for guidance. Never will I pray for material things of the world. Only for guidance will I pray.

Oh creator of all things help me, for this day I go out to the world naked and alone, and without your hand to guide me. I will wonder far from the path which leads to success and happiness, I ask not for gold or even opportunities equal to my ability. Instead guide me that I may acquire ability equal to my opportunity. You have taught the lion and the eagle how to hunt and prosper with the teeth and claw. Teach me how to hunt with words and prosper with love so that I may be a lion among men and the eagle at the marketplace. Help me to remain humble through obstacles and failures. Confront me with fears that will temper my spirit, yet indulge me with courage to laugh at my misgivings. Spare me some sufficient days to reach my goals, yet help me to live this day, as that would be my last. Guide me in my words that they may be a fruit, yet silence me from gossip that none be malign. Discipline me in the habit of trying and trying again, yet show me the way to use the law of the averages. Favor me with alertness to favor the opportunity, yet enable me with patients which will concentrate my strength. Bade me in good habits that the bad ones may drown, grant me compassion for weaknesses in others. Let me know that all things shall pass, yet help me to count the blessings of today. Expose me to hate, yet not be a stranger, yet fill my cup with love to turn strangers into friends. But all these things be of thy will. I’m small and lonely grape clutched divine yet that has made me different from all of us. Fairly, there must be a special place for me, guide me, help me, show me the way. Let me become all that you planned for me when my seed was planted and selected by you to sprout in the vineyard of the world. Helpe this humble salesman, guide me God!

Quick tips

How to compare today’s date with the one you have in the MySQL timestamp field

Say you have a field called date in your MySQL table and its type is timestamp (example: ‘2014-08-23 08:37:57’), and you want to get all the records for today (so, all the records who’s dates are ‘2014-08-23’ neverminding the time). Here’s how yo do that:

SELECT * FROM `the_table` WHERE date(date) = curdate();

So, we’re using date() and curdate() functions here to help us achieve that.

NodeJS, Quick tips

How to delete node_modules folder on Windows machine?

Due to its folder nesting Windows can’t delete the folder as its name is too long. To solve this, install RimRaf:

npm install rimraf -g

and delete the node_modules folder easily with:

rimraf node_modules

 

edit: If you happen to get an “error” like this:

C:\Users\Nikola\Desktop>npm install -g rimraf
C:\Users\Nikola\AppData\Roaming\npm\rimraf -> C:\Users\Nikola\AppData\Roaming\npm\node_modules\rimraf\bin.js
npm WARN unmet dependency C:\Users\Nikola\AppData\Roaming\npm\node_modules\generator-ionic requires cordova@'^4.2.0' but will load
npm WARN unmet dependency C:\Users\Nikola\AppData\Roaming\npm\node_modules\cordova,
npm WARN unmet dependency which is version 5.1.1
npm WARN unmet dependency C:\Users\Nikola\AppData\Roaming\npm\node_modules\bower\node_modules\bower-registry-client requires request@'~2.51.0' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm WARN unmet dependency C:\Users\Nikola\AppData\Roaming\npm\node_modules\bower\node_modules\fstream-ignore requires fstream@'^1.0.0' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined
npm ERR! peerinvalid The package node-inspector does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants node-inspector@~0.7.0

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\NodeJS\\\\node.exe" "C:\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "rimraf"
npm ERR! cwd C:\Users\Nikola\Desktop
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\Nikola\Desktop\npm-debug.log
npm ERR! not ok code 0

Don’t panic :), just try to run rimraf instead, as noted above. In most cases, all will be okay and you’ll be able to use it without a problem. If not, head to the comments, and we’ll take care of it together! For those who don’t care much about comments, here’s the post in which I address this node-inspector issue.

How to delete node_modules folder on Windows machine? http://t.co/0pV4OSTG1L #nodejs #windows #node_modules

— Nikola Brežnjak (@HitmanHR) July 28, 2015

Stack Overflow

How to add three dots in a multiline span

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

So, my question was that I actually found the solution to this in another StackOverflow question, and that the solution is pretty simple. The link to the jsFiddle for the example is here, and also copied here for reference. HTML code:

<span>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen look</span>​

CSS code:

span{
    display:inline-block;
    width:180px;
    white-space: nowrap;
    overflow:hidden !important;
    text-overflow: ellipsis;
}

And it works like expected, it prints: Lorem Ipsum is simply du…

However, when I tried this in another example. JsFiddle is here. HTML code:

<div class="textContainer">                
    <img src="#" class="image" alt="the_image">
    <span class="text">"The quick brown fox jumps over the lazy dog" is an english-language pangram, that is, a phrase that contains all of the letters of the English alphabet. It has been used to test typewriters and computer keyboards, and in other applications involving all of the letters in the English alphabet. Owing to its brevity and coherence, it has become widely known.</span>
</div>

CSS code:

.textContainer{
    width: 430px;
    float: left;
    margin-top: 10px;
    border: 1px solid black;                
}

.text {
    font-size: 24px;
    line-height: 24px;
    font-weight: bold;
    color: #047F04;
    display: block;
    white-space: normal;
    overflow: hidden !important;
    text-overflow: ellipsis;
    height: 99px;
}

.image {
    float: right;
    position: absolute;
    top: 85px;
    right: 10px;
    width: 108px;
    height: 42px;
}

So my question was how could I achieve to put … on the end of the string in my example?

The answer, by user devundef, was:

The specification for the text-overflow property says that this is not possible for multiline text:

This property specifies rendering when inline content overflows its block container element (“the block”) in its inline progression direction that has ‘overflow’ other than ‘visible’. Text can overflow for example when it is prevented from wrapping (e.g. due to ‘white-space:nowrap’ or a single word is too long to fit).

In other words, only works on single line text blocks.

source: http://dev.w3.org/csswg/css3-ui/#text-overflow

EDIT This fiddle has a workaround using jquery: http://jsfiddle.net/k5VET/ (source: Cross browsers mult-lines text overflow with ellipsis appended within a width&height fixed div?)

Stack Overflow

Serialize form not working in jQuery

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

So, my question was if, for example, we have this HTML form code:

<form action="#" id="gamesForm">
    <p>                                                        
        <input id="gName" type="text" class="medium" />
        <span class="notification information">Game name</span>
    </p>

    <p>                            
        <span class="notification information">Enabled:</span>
        <input id="gEnabled" type="checkbox" />              
    </p>


    <br />
    <!--Additional data for extra type-->
    <div id="extraAdditionalData" class="hidden">                            
        <p>
            <input id="rRacers" type="text" class="medium" />
            <span class="notification information">Racers</span>
        </p>

        <p>
            <input id="rVideoSet" type="text" class="medium" />
            <span class="notification information">Video set</span>
        </p>                                                         
     </div>                
</form>

<a href="#" id="saveConfiguration" class="graybuttonBig">Save everything!</a>

And this js code:

$(document).ready(function(){
    $("#saveConfiguration").click(function(){
        alert( $("form").serialize() );   
    });
});

How come that all I get in the alert is an empty string?

The answer, by user Felix Kling, was:

You have to give your form elements names!

This is independent of jQuery. Every form element must have a name to be considered for form submission as successful control:

A successful control is “valid” for submission. Every successful control has its control name paired with its current value as part of the submitted form data set. A successful control must be defined within a FORM element and must have a control name.

jQuery just ignores those elements that don’t have a name (or, depending on how it gets the elements, it might not even see them as the form itself has no reference to them).

Books

The Hobbit – J. R. R. Tolkien

My favourite quotes from the book The Hobbit by J. R. R. Tolkien:

You are not easy to carry around, not even after few weeks of your starvation.

This would be a much happier world if more of us would stick to the eating, singing and happiness than to the vast piles of gold.

Programming

Notes from Sams Teach Yourself WPF in 24 hours

This is the new section that I’ll be posting in Programming category (parent Books); whenever I read a book I always take notes, so here they are now for easier access and search.

All in all I gave this book 5/5 in my Shelfari account as I think that it’s great, for beginners especially. This StackOverflow question may be useful if you’re searching for a good book on learning WPF.

WPF is an API for building graphical user interfaces (UI) for desktop applications with the .NET Framework.

WPF differs fundamentally in that it builds on top of DirectX. It also means that WPF will take advantage of hardware acceleration when it is available.

Graphics in WPF are vector based, in contrast to raster based. A general rule of thumb is that vector graphics are good for geometrical or cartoonish images and that raster is better for photographs and realistic images.

There are two types of templates in WPF: control templates and data templates.

WPF requires the .NET Framework 3.0 or later.

XAML (pronounced zammel) is the language used for creating user interfaces in WPF.

When you create a WPF application with Visual Studio, the XAML used in the application is compiled into the resulting executable.

Element in XAML is an instance of an object and attributes are properties on that object.

x:Name is not a property on the Button class. Instead, it’s a special attribute that provides a unique identifier for the object for accessing it in code. It is important to understand that any XAML element you want to reference, in code or elsewhere in the XAML, must have a unique value for x:Name. It’s pretty easy to get into trouble using the Name property, though, and unless you have a specific need, we recommend sticking with x:Name. It’s the convention that is generally adopted.

The child element is referred to as a property element. Property elements take the form of <ClassName.PropertyName />.

<Button Background=”{StaticResource ResourceKey=myColor}” Content=”Click Me” />
Markup extensions are indentified by the presence of curly brackets ({})

App.xaml represents the application itself. It is not visual, and it is primarily used to store resources that will be used throughout an application. App.xaml also defines which  window opens when the application launches.

MainWindow.xaml is the main window for the application. Its markup contains all the visual elements that represent the application on the screen, as well as declaring our application’s behavior.

The concept of partial classes was introduced with .NET 2.0. The essential idea is that a single class can be defined across multiple files. Each file contains a portion of the class. The files can even be of different file types; such as .cs and .xaml. The compiler is  responsible for dynamically combining the code into a single class as it is compiled.

Refactoring code means that you improve the maintainability of the code without changing the behavior.

Margin, present on all FrameworkElements, represents the amount of space around the outside of the element. Padding – amount of space inside itself.

Every Panel has a Children collection. This collection can be used to add or remove controls from the panel’s layout at runtime.

StackPanel organizes its child elements by stacking them one on top of the other. StackPanel also has an Orientation property that can be set to Horizontal, causing the panel to stack its children from left to right.

DockPanel is capable of attaching its children to any of its four sides and is often used as the root layout control of an application’s UI.

The Grid is WPF’s all-purpose layout panel. It can achieve most of the same behavior as the previous controls and much more. This power comes with a price; the requirement of  additional XAML and more attached properties.

<Grid ShowGridLines=”True” TextBlock.FontSize=”20”>
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>
    
    <Grid.ColumnDefinitions>
	<ColumnDefinition />
	<ColumnDefinition />
    </Grid.ColumnDefinitions>

    <Button Content=”0,0” />
    <Button Grid.Column=”1” Content=”0,1” />
    <Button Grid.Row=”1” Content=”1,0” />
    <Button Grid.Row=”1” Grid.Column=”1” Content=”1,1” />
</Grid>
<ColumnDefinition Width=”34” />
<ColumnDefinition Width=”1.5*” />
<ColumnDefinition Width=”2*” />
<ColumnDefinition Width=”auto” />

In this case, the first column would be 34 pixels wide, the last column would auto size to content and the middle columns would split the remaining space with the ratio 1.5:2.

The GridSplitter is a special control capable of letting a user resize rows or columns of a Grid at runtime.

WrapPanel is like a StackPanel, but it has the ability to “wrap” what it is stacking to the next line or column if it runs out of space.

Canvas does not add any special dynamic layout behavior to its child controls. A canvas must have an exact Width and Height, and all its child elements must have an exact size and position as well. Canvas arranges controls at strict Left (x) and Top (y) positions using attached properties. Although most panels will size to fit their children, if no size is declared for a Canvas it will collapse to zero.

Decorators – Border and Viewbox.

A Panel has a collection of Children that it arranges according to various rules, based on the type of panel. A Decorator, on the other hand, has only one Child to which it applies some additional set of behavior.

 TextBlock has many options (note LineBreak for, well, new line):

<TextBlock FontSize=”14” TextWrapping=”Wrap”>
    <Bold><Italic>Instructions:</Italic></Bold>
    <LineBreak />
    Select a <Underline>font</Underline> to view from the list
    <Italic>below</Italic>.
    <Span FontSize=”10”>You can change the text by typing in the region at the bottom.</Span>
</TextBlock>

Allow ENTER, TAB and wrap:

<TextBox x:Name="additionalNotes"
                 Grid.Row="3"
                 Grid.Column="1"
                 MinLines="5"
                 AcceptsReturn="True"
                 AcceptsTab="True"
                 TextWrapping="Wrap" />

In <Window definition make a habit of adding this:

FocusManager.FocusedElement=”{Binding ElementName=firstName}”

Use Label rather than TextBlock for forms as they provide shortcuts if you press Alt on the keyboard. In the listing below, the F would be underlined when Alt would be pressed.

<Label Content="_First Name:" Target="{Binding ElementName=firstName}" />

Using the tooltip:

<TextBox x:Name="SampleText" DockPanel.Dock="Bottom" MinLines="4" Margin="8 0" TextWrapping="Wrap">
            <TextBox.ToolTip>
                <TextBlock>
					<Italic Foreground="Red">Instructions: </Italic>
					Type here to change the preview text.
                </TextBlock>
            </TextBox.ToolTip>

            The quick brown fox jumps over the lazy dog.
</TextBox>

Data binding is a means of connecting the elements of a user interface with the underlying data that the application is interested in. Data binding is declarative rather than imperative. Declarative means that instead of writing a series of commands to be executed, you describe the relation that the data has to the elements in the UI.

Markup extensions are identified by curly brackets ({}), and a data binding extension always begins with the word Binding.

Two way binding:

<TextBox Text="{Binding ElementName=mySlider,Path=Value,Mode=TwoWay}" />
<Slider x:Name="mySlider" Minimum="0" Maximum="100" TickFrequency="1" IsSnapToTickEnabled="True"/>

{x:Static Fonts.SystemFontFamilies} – this markup extension is used for referencing static  value members on a class (fields, properties, constants, and enumeration values).

The WPF property system allows properties to participate in data binding, styling, animation, and several other exciting features. A property that is registered with the WPF property system is called a dependency property. A property must be a dependency  property to be the target of a data binding.

<TextBox Text=”{Binding Path=FirstName,Mode=TwoWay}” Margin=”4”/>

public Window1()
{
    InitializeComponent();
    DataContext = new Person(); //new class with only FirstName property
}

Remember, WPF automatically looks for an event based on the property’s name.

public string FirstName {get; set;}

public event EventHandler FirstNameChanged;
private void OnFirstNameChanged()
{
    if (FirstNameChanged != null)
        FirstNameChanged(this, EventArgs.Empty);
}

For dynamic size of the text inside the TextBlock, wrap it with a ViewBox, but without any additional sizes (width, height, font) set:

<Viewbox>
    <TextBlock TextWrapping="Wrap" Text="Some Text" />
</Viewbox>

XAML application, FontViewer for example, can work in IE if you change Window tag to Page and remove the IntegerUpDown control.

User controls are similar to windows and pages. They allow you to easily define your own controls that can be reused throughout your application. Do not confuse them with  custom controls. Custom controls are another way to create reusable elements for the UI, but I do not recommend them for a newcomer to WPF.

Open MainWindow.xaml and add the following Xml Namespace declaration to the Window: xmlns:local=”clr-namespace:TextEditor” in order to be able to load user controls like this:

<local:TextEditorToolbar x:Name=”toolbar” DockPanel.Dock=”Top” />

A TextRange represents a concrete selection of content within a document.

_currentFile = dlg.FileName;
using (Stream stream = dlg.OpenFile())
{
    TextRange range = new TextRange(
        _textBox.Document.ContentStart,
        _textBox.Document.ContentEnd
    );
    
    range.Load(stream, DataFormats.Rtf);
}

An application in WPF consists of many elements in a tree. If a user clicks the Image in our preceding example, WPF would route the event along the tree of elements until a handler was found. If no handler is implemented, the event continues beyond the Border all the way to the root element (which can be a Window or a Page).

Routed events are handled the same way except that the basic signature uses a
RoutedEventArgs.

void Handle_RoutedEvent(object sender, RoutedEventArgs e)

So how does PreviewKeyDown differ from the KeyDown event, which is also owned by
UIElement? Both of these are routed events, but the difference between the two is that one bubbles and the other tunnels. Remember we mentioned earlier that bubbling means the event is moving up toward the root element, and tunneling means the event is moving down toward its origin. The prefix Preview is a convention adopted in WPF to show that an event is a counterpart to another event. Thus PreviewKeyDown is the counterpart to KeyDown. When you press a key with an element in focus, first the PreviewKeyDown event is raised by the root element and tunnels down the tree to the actual element that was
in focus; then the KeyDown event is raised and bubbles back up to the root.

In WPF, a command is a function or action that can be bound to an input gesture. WPF binds the EditingCommands. ToggleBold command to the keyboard gesture Ctrl+B by default.

<ToggleButton x:Name=”boldButton” Command=”EditingCommands.ToggleBold” ToolTip=”Bold”>
<MenuItem Header=”_Edit”>
    <MenuItem Command=”ApplicationCommands.Undo” />
    <MenuItem Command=”ApplicationCommands.Redo” />

    <Separator />

    <MenuItem Command=”ApplicationCommands.Cut” />
    <MenuItem Command=”ApplicationCommands.Copy” />
    <MenuItem Command=”ApplicationCommands.Paste” />
    <MenuItem Command=”EditingCommands.Delete” />
</MenuItem>
<Window.InputBindings>
    <MouseBinding Gesture=”Control+WheelClick” Command=”ApplicationCommands.SaveAs” />
</Window.InputBindings>
<Window.CommandBindings>
    <CommandBinding Command=”ApplicationCommands.New” Executed=”NewDocument” />
</Window.CommandBindings>
<Window.InputBindings>
    <KeyBinding Key=”S” Modifiers=”Shift” Command=”ApplicationCommands.SaveAs” />
</Window.InputBindings>

We have talked about dependency properties before, but have not detailed how to create
them. We typically use this technique only when we need a property on a Window, UserControl, or custom control that must support data binding or other FrameworkElement-related features, such as animation or styling. The typical procedure for creating a dependency property is to declare a public, static field using
DependencyProperty.Register. It is advised that you append the word “Property” onto the field name. There are several overloads of the Register method, but at a minimum you must declare the actual property name, type, and owning type. You should then create instance getters and setters by using the static GetValue and SetValue methods inherited from DependencyObject. Use your dependency property’s field as the key to these  methods.

Use Path.Combine to safely and correctly build up directory and file paths.

All elements that are renderable must inherit from Visual.

MVC, despite its popularity, is commonly misunderstood. This may be because it tends to manifest itself differently in different scenarios—that is, web versus desktop applications.

Controllers traditionally functioned as mediators between the human and the application by handling user input from the mouse or keyboard. Controller doesn’t seem to fit exactly with modern UI toolkits like WPF. Very rarely would one need to write code to manually handle user input. What is really needed is an application-centric component that
can mediate between the View and the Model. This component would be capable of
responding to View interactions and translating those into application commands.
In the context of a contact manager, these commands would be actions like
SaveContact, DeleteContact, Search, and the like.

The mismatch between the MVC pattern and modern UI frameworks has been recognized by many people. Over time a new pattern called Model-View-Presenter has evolved from MVC.

Start a new project and add the following folders to the solution: Model, Presenters, Resources, UserControls and Views.

<TextBlock Text="Contacts" FontSize="14" FontWeight="Bold">
    <TextBlock.LayoutTransform>
        <RotateTransform Angle="90" />
    </TextBlock.LayoutTransform>
</TextBlock>

The Expander is a simple control whose primary purpose is to allow the user to collapse or expand a named region of the interface.

To serialize to disk .NET requires the [Serializable] attribute on the classes.

The important part of a repository is that it abstracts away the actual data store so that other parts of the application are able to work with a high-level API and not concern themselves with how the data is stored.

In a typical application, there is a need for an Application Controller or Application Presenter. This special type of presenter provides common application-level functionality to other presenters and manages various other cross-presenter issues.

This technique is known as constructor injection and is a specific type of dependency injection. DI is a technique that is commonly used to help enforce the principle of Separation of Concerns (SoC).

WPF uses a special type called a ResourceDictionary to store reusable “pieces” of an application. Everything that inherits from FrameworkElement has a Resources property. Colors cannot be applied to most WPF element properties like Background or
Foreground. These properties require the use of a Brush.

<SolidColorBrush x:Key=”brownBrush” Color=”{StaticResource brownColor}” />

<Color x:Key=”brownColor”>#FF513100</Color>

You will recall from earlier hours that Binding is a markup extension. Binding, along with StaticResource, make up the two most common extensions that you will use in WPF.

Refactoring the Resource files; in App.xaml instead of having all the mumbo jumbo, refactor to another file:

<ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source=”Resources\ColorsAndBrushes.xaml” />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

Simply put, DynamicResource allows the resource to change after the point of reference, whereas StaticResource does not. This most often applies when you’re using system resources. For example, if you wanted to use a color from SystemColors, you would use a DynamicResource. This allows for the scenario where the user changed the system color theme while your application was running. If a DynamicResource was used, your application would update its colors on-the-fly whereas they would remain the same with a StaticResource. Because of the dynamic nature of the so-named resource, it is more resource intensive and less performant than StaticResource. You should prefer to use StaticResource and fall back to DynamicResource only when you need the special  capabilities it offers.

A Style resource is a special case because its key can be implicitly based on its TargetType value.

<Style x:Key=”header” TargetType=”{x:Type Border}”>
    <Setter Property=”Background” Value=”{StaticResource darkBlueBrush}” />
</Style>

<Border DockPanel.Dock=”Top”&nbsp;Style=”{StaticResource header}”>

WPF has a simple facility for letting you inherit styles one from another by using the BasedOn property:

<Style x:Key=”baseControlStyle” TargetType=”{x:Type Control}”>
    <Setter Property=”FontFamily” Value=”Arial” />
    <Setter Property=”FontSize” Value=”12” />
</Style>

<Style TargetType=”{x:Type Label}” BasedOn=”{StaticResource baseControlStyle}”>
    <Setter Property=”HorizontalAlignment” Value=”Right” />
    <Setter Property=”FontWeight” Value=”Bold” />
</Style>

By using the BasedOn property you can reference other styles and effectively enable
style inheritance. The basic constraint is that you must determine a compatible base
class for all the styles involved. In this case, both Button and Label inherit from
Control.

When WPF needs to find a resource, it first examines the Resources of the current element. If the resource with the requested Key is not found, WPF will look at that element’s parent’s Resources. WPF will follow this pattern until it reaches the root element in the UI. If the resource has not yet been found, it will look at the Application.Resources.

Styles can be applied by TargetType or Key. If an element has a specific style declared with a key, that style will override all other styles applied to that element. If no style is explicitly set, WPF will search for a style defined with a matching TargetType and apply it if found within the visible scopes; otherwise, the WPF default style will be used. A developer can always override individual aspects of a style by explicitly setting the properties on an element.

Binding headerBinding = new Binding(presenter.TabHeaderPath);

is equal to

{Binding Path=TabHeader}

Data templates are one of the two types of templates used in WPF. They provide a way to describe how data should be visualized in terms of UI elements. This is different from deciding how to render a DateTime value, or formatting a telephone number.

Styles are the simplest of the three, so if you are able to achieve what you want using styles, that is the best choice. Keep in mind that styles allow you to set nonvisual properties as well.

Control templates define the UI elements that compose a given control. That’s a lot more complicated than merely setting some properties. You should use control templates only when you really need to.

Data templates resemble control templates in that they allow you to compose UI elements. They are often used with list controls to define how items in a list
should be rendered.

We could state that the primary difference between these two base classes is that ContentControl supports the rendering of a single item, whereas ItemsControl supports the rendering of multiple items.

The important part is the call to Application. Current.Dispatcher.Invoke. This method executes the delegate on the UI thread according to the specified DispatcherPriority. This is important because WPF is not guaranteed to work properly with events firing on threads other than the UI thread.

Transformations:

<Canvas Height="600" Width="800">
    <TextBlock Text="No Transform" />
        
    <TextBlock Canvas.Left="200" Canvas.Top="100" Text="Skew Transform">
        <TextBlock.RenderTransform>
            <SkewTransform AngleX="45" />
        </TextBlock.RenderTransform>
    </TextBlock>
</Canvas>

When applying multiple transforms by using a TransformGroup, remember that
the order of the transforms can have a strong impact on the result.

Using a LayoutTransform allows an element to be transformed while still playing by the layout rules of the Panel in which it lives. WPF has such rich layout capabilities that it would be unfortunate if all transforms broke the layout rules. Essentially, a LayoutTransform occurs before a Panel performs layout; thus, any transforms that occur are taken into account when the Panel arranges its children. A RenderTransform happens independently of the layout mechanism.

Every UIElement has a BitmapEffect property that can be used to add various special shader-like effects to the element:

<Button Content="Blur">
    <Button.BitmapEffect>
        <BlurBitmapEffect Radius="4" />
    </Button.BitmapEffect>
</Button>

Control templates:

<Window.Resources>
    <Canvas x:Key=”Smiley” Width=”48” Height=”48”>
        <Ellipse Width=”48” Height=”48” Fill=”Yellow” />
        <Ellipse Width=”8” Height=”8” Canvas.Top=”12” Canvas.Left=”12” Fill=”Black”/>
        <Ellipse Width=”8” Height=”8” Canvas.Top=”12” Canvas.Right=”12” Fill=”Black” />
        <Path Data=”M10,30 C18,38 30,38 38,30” Stroke=”Black” />
    </Canvas>
</Window.Resources>

<Button HorizontalAlignment=”Center” VerticalAlignment=”Center”>
	<Button.Template>
		<ControlTemplate>
			<Border Background=”Black” Padding=”4” CornerRadius=”4” Child=”{StaticResource Smiley}” />
		</ControlTemplate>
	</Button.Template>
</Button>

Anytime you implement a control template, you’ll have to handle these effects yourself with triggers.

Templates are composed out of UI elements. Templates need to be explicitly told what type of control they are targeting. Use the TargetType attribute to do this. Templates need to know what to do with the control content. We used the ContentPresenter element to handle this for a button.

In style:

<Style TargetType=”{x:Type Slider}”>
	<Setter Property=”Template”>
		<Setter.Value>
			<ControlTemplate TargetType=”{x:Type Slider}”>
				<Grid x:Name=”root”>
					<Border Height=”4” CornerRadius=”2” Background=”{StaticResource sliderBg}”>
					</Border>

					<Track x:Name=”PART_Track”>
						<Track.Thumb>
							<Thumb />
						</Track.Thumb>
					</Track>
				</Grid>
			</ControlTemplate>
		</Setter.Value>
	</Setter>
</Style>

We can bind elements in a template to the actual control:

<ControlTemplate x:Key=”CircleButton” TargetType=”{x:Type Button}”>
	<Grid HorizontalAlignment=”Center” VerticalAlignment=”Center” MinHeight=”36” MinWidth=”36”>
		<Ellipse Fill=”{TemplateBinding Background}” />
		<ContentPresenter />
	</Grid>
</ControlTemplate>

In this example, the Fill property on the Ellipse will be set to the Background property of the button that the template is applied to.

It is a common practice to keep a control template flexible through the use of template
binding. The idea is that you create a default style for your controls that sets the control template. However, you use template binding and set as many of the properties as possible in the style. That way, you can inherit from the default style, overriding specifics as needed, while retaining your control template.

This data binding:

{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}

is the equivalent of this template binding:

{TemplateBinding Background}

Triggers are a special feature of Style, ControlTemplate, DataTemplate, and FrameworkElement. Through the careful use of triggers, you can declaratively enable your UI and graphics to respond to mouse events, changes in dependency properties, and even changes in your application’s data model.

<ControlTemplate.Triggers>
	<Trigger Property="IsMouseOver" Value="True">
		<Setter TargetName="highlight" Property="Visibility" Value="Visible" />
	</Trigger>

	<Trigger Property="IsPressed" Value="True">
		<Setter TargetName="highlight" Property="Opacity" Value="0.5" />
	</Trigger>
</ControlTemplate.Triggers>

If multiple triggers alter the same UI properties, the last one wins.

<Style.Triggers>
	<DataTrigger Binding="{Binding Path=IsMuted, ElementName=mediaElement}" Value="True">
		<Setter Property="Visibility" Value="Visible" />
	</DataTrigger>
</Style.Triggers>

EventTrigger is the final type of trigger that WPF currently offers

<ControlTemplate.Triggers>
	<EventTrigger RoutedEvent=”UIElement.MouseEnter”>
		<BeginStoryboard>
			<Storyboard Storyboard.TargetName=”chromeEdge” Storyboard.TargetProperty=”RenderTransform.Angle”>
				<DoubleAnimation To=”90” Duration=”0:0:0.10” />
			</Storyboard>
		</BeginStoryboard>
	</EventTrigger>

	<EventTrigger RoutedEvent=”UIElement.MouseLeave”>
		<BeginStoryboard>
			<Storyboard Storyboard.TargetName=”chromeEdge” Storyboard.TargetProperty=”RenderTransform.Angle”>
				<DoubleAnimation To=”0” Duration=”0:0:0.10” />
			</Storyboard>
		</BeginStoryboard>
	</EventTrigger>
</ControlTemplate>

Notice the important RoutedEvent property, which is used to declare which event will trigger the action.

Sometimes a situation arises in which a simple Trigger can’t express the conditions under which a collection of setters should be applied. For these scenarios, WPF provides the MultiTrigger and the MultiDataTrigger. These represent more advanced versions of Trigger and DataTrigger, respectively. Instead of having a simple Property or Binding and a Value, they each have a collection called Conditions. To leverage this functionality, you add multiple Condition instances to this collection.

<DataTemplate.Triggers>
	<MultiDataTrigger>
		<MultiDataTrigger.Conditions>
			<Condition Binding=”{Binding Organization}” Value=”Blue Spire Consulting, Inc.” />
			<Condition Binding=”{Binding Address.City}” Value=”Tallahassee” />
		</MultiDataTrigger.Conditions>
	
		<MultiDataTrigger.Setters>
			<Setter TargetName=”border” Property=”Background” Value=”Blue” />
		</MultiDataTrigger.Setters>
	</MultiDataTrigger>
</DataTemplate.Triggers>

At its root, an animation is a series of images shown in rapid succession to give the illusion of motion. The individual images in an animation are referred to as frames. The number of frames per second (fps) is called the frame rate. Most television and film is somewhere between 20 and 30fps. The higher the frame rate, the smoother the animation will seem. Computer graphics generally target a frame rate around 60fps. Key frames are
the frames that represent significant points in the motion, such as the start and  end points. All the remaining frames, those in between the key frames, are called tweens. A timeline is a segment of time; it has a beginning point and duration.

<Window x:Class="LearningAnimation.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300">
    <Window.Triggers>
        <EventTrigger RoutedEvent="Window.Loaded">
            <BeginStoryboard>
                <Storyboard Storyboard.TargetName="Ball" Storyboard.TargetProperty="(Canvas.Left)">
                    <DoubleAnimation By="300" Duration="0:0:07.5"/>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Window.Triggers>
    
    <Canvas>
        <Ellipse x:Name="Ball" Width="20" Height="20" Fill="Red" Canvas.Top="50" Canvas.Left="0"></Ellipse>
    </Canvas>
</Window>

The Storyboard has a single child. It’s a DoubleAnimation because Canvas.Left is of type double.

<DataTemplate x:Key="PictureDataTemplate">
        <Image Source="{Binding Path=Thumbnail}" Width="75" Height="75" Margin="4">
            <Image.Triggers>
                <EventTrigger RoutedEvent="Image.MouseEnter">
                    <BeginStoryboard>
                        <Storyboard Storyboard.TargetProperty="Width">
                            <DoubleAnimation By="25" Duration="0:0:0.25" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
                <EventTrigger RoutedEvent="Image.MouseLeave">
                    <BeginStoryboard>
                        <Storyboard Storyboard.TargetProperty="Width">
                            <DoubleAnimation To="{TemplateBinding Width}" Duration="0:0:0.25" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Image.Triggers>
        </Image>
    </DataTemplate>

Very basically a ControlTemplate describes how to display a Control while a DataTemplate  describes how to display Data.

Any element can trigger an animation. In addition to this technique, animations can be triggered from styles, control templates, and data templates. Inside of a Style, you cannot use Storyboard.TargetName. When you create an animation in a style, it will always target the element that the style is applied to. Likewise, you cannot specify the SourceName on a trigger. On the whole, a storyboard inside a style cannot reference dynamic resources or data bind.

<DoubleAnimation By=”300” AccelerationRatio=”0.4” DecelerationRatio=”0.4” Duration=”0:0:10”/>

With this markup, the ball will start at a speed of 0 and accelerate for 4 seconds. Then, beginning at the sixth second, it will slow down for 4 seconds.

<Button x:Name="button" Content="mybutton">
            <Button.Triggers>
                <EventTrigger RoutedEvent="Button.Click">
                    <BeginStoryboard>
                    <Storyboard Storyboard.TargetName="Ball" Storyboard.TargetProperty="(Canvas.Top)">
                        <DoubleAnimation By="300" Duration="0:0:07.5"/>
                    </Storyboard>
                </BeginStoryboard>
                <BeginStoryboard>
                    <Storyboard Storyboard.TargetName="Ball" Storyboard.TargetProperty="(Canvas.Left)">
                        <DoubleAnimation By="300"
AccelerationRatio="0.4"
DecelerationRatio="0.4"
Duration="0:0:10"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
            </Button.Triggers>
        </Button>
        <Ellipse x:Name="Ball" Width="20" Height="20" Fill="Red" Canvas.Top="50" Canvas.Left="0"></Ellipse>
    </Canvas>

 

<Window.Triggers>
        <EventTrigger RoutedEvent="Window.Loaded">
            <BeginStoryboard x:Name="BallStoryboard">
                <Storyboard Storyboard.TargetName="Ball" Storyboard.TargetProperty="(Canvas.Left)">
                    <DoubleAnimation By="300" Duration="0:0:07.5"/>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
        <EventTrigger RoutedEvent="Button.Click" SourceName="Pause">
            <PauseStoryboard BeginStoryboardName="BallStoryboard" />
        </EventTrigger>
        <EventTrigger RoutedEvent="Button.Click" SourceName="Resume">
            <ResumeStoryboard BeginStoryboardName="BallStoryboard" />
        </EventTrigger>
    </Window.Triggers>
    <StackPanel>
        <StackPanel Orientation="Horizontal">
            <Button x:Name="Pause">Pause</Button>
            <Button x:Name="Resume">Resume</Button>
        </StackPanel>
        <Canvas>
            <Ellipse x:Name="Ball" Width="20" Height="20" Fill="Red" Canvas.Top="50" Canvas.Left="0"></Ellipse>
        </Canvas>
    </StackPanel>

Setting animation in code behind:

var animation = new ColorAnimation
{
From = Colors.Blue,
To = Colors.Yellow,
Duration = new Duration(TimeSpan.FromSeconds(2))
};
var button = new Button();
button.BeginAnimation(Button.BackgroundProperty,animation);

Ortogonality – things that are independent of one another.

Single Responsibility Principle – there should never be more than one reason for a class to change.

Separation of Concerns – embodies a “divide and conquer” approach to programming. Rather than having huge, complex classes, our system should be built from smaller, more focused components that work together.

Don’t Repeat Yourself – the key point is if you find yourself writing the same sort of
code over and over again, there’s something wrong.

Inversion of Control => The constructor signature is shown next:

public ApplicationPresenter(Shell view, ContactRepository contactRepository)

ApplicationPresenter is dependent on both a Shell view and a ContactRepository. It cannot function without these other components, yet it doesn’t take the responsibility of creating them. This is called Inversion of Control, often abbreviated IoC.

Dependency Injection – the control of dependency creation is inverted because the presenter has given up its right to create the components it depends on. It is relying on some outside source to hand it the pieces it needs to work. These dependencies are then
injected into the class via the constructor. This is known as Dependency Injection, or
DI, and it adds a great deal of flexibility and extensibility to your software design.

Ya Aren’t Gonna Need It – well, you just ain’t so why bother feature-stacking?

Page 46 of 51« First...102030«45464748»50...Last »

Recent posts

  • Discipline is also a talent
  • Play for the fun of it
  • The importance of failing
  • A fresh start
  • Perseverance

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (35)
  • Daily Thoughts (77)
  • Go (3)
  • iOS (5)
  • JavaScript (127)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (2)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (77)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (40)
  • Servers (8)
    • Heroku (1)
    • Linux (3)
  • Stack Overflow (81)
  • Unity3D (9)
  • Windows (8)
    • C# (2)
    • WPF (3)
  • Wordpress (2)

"There's no short-term solution for a long-term result." ~ Greg Plitt

"Everything around you that you call life was made up by people that were no smarter than you." ~ S. Jobs

"Hard work beats talent when talent doesn't work hard." ~ Tim Notke

© since 2016 - Nikola Brežnjak