Monday, February 27, 2017

C# - if await is missing, async method go into an unpredictable state - result: Exception

In C#,
if you plan to use async functions and wait for their results using await, you're going to be ok.

However, if you forget await in a call, and try to use results of the async operation , you're probably going to see NullReferenceException or something similar. Visual Studio warns about these situation by issuing a green line where await (or Task.Wait) is missing.

Thursday, February 23, 2017

Useful Blender shortcuts and tips

Navigation shortcuts in Blender


SHIFT + F
Move through the scene like in a FPS (using keyboard and mouse)



TAB - Go to Edit mode

In Edit Mode:

CTRL + R (Cut Loop, for spliting planes)
Same effect can be obtained from Tools pallete -> Subdivide



Basic shortcuts in Unity

Select a game object and press:

E->rotation
R->scale




Exporting a Blender model to Unity


Export FBX file from Blender.In Unity, just drag'n'drop over object the UV texture file ( exported from Blender, after seams are done, and unwraped, and colored in GIMP afterwards) over it.

It's going to work.

Also, scripts are added as assets, but they need to be added as components of GameObjects and enabled. The classes are not static!

Wednesday, February 22, 2017

Windows 10 - how to run a blocked application



If Windows 10 has blocked running an app, it's usually a good thing. However, Windows are sometimes overly pessimistic and they block a perfectly valid app.

In that case, if nothing else helps, you can run command prompt as Administrator, cd to your folder, and enter the name of your exe to run it. No more "Application has been blocked for security reasons" for you. :)


Details here:

https://www.howtogeek.com/230063/how-to-circumvent-this-app-has-been-blocked-for-your-protection-to-install-apps-in-windows-10/

Tuesday, February 21, 2017

If your Blender has suddenly became slow and laggy...

Then it's time to look for a new version of your graphic card driver.

This happened to me a few days ago. The program response was so slow that I couldn't work at all. I stopped, went to NVIDIA website and downloaded latest driver for my GT745M. Now it's all good. So, in case Blender response is slow, make sure you try to update your graphic card driver.


In ReactJS, here are some quick fixes for common problems

To prevent common errors,
in your constructur , you should init the state variable like this:


  constructor(){

      super();

      this.state={};

   

  }


This will prevent some "undefinded variable" errors in case you provide the state variables as props of the child components. 

The initial state should be set in call to componentDidMount. Something like this would do:

componentDidMount() {
    
       this.setState(this.getInitialState());

}


getInitialState(){
     return {
          currentOrderMode:"new"

      }

}

This way, you will be able to propagate state variables to child components without errors:

......

<


                <OrderEditor mode={this.state.currentOrderMode} />


.....

Hope this prevents some of setState() cannot be called before component mounted errors, as well as state variables undefined errors. :)

Saturday, February 18, 2017

LESS import is whitespace sensitive

In LESS, this is a proper import statement:

@import (once) "foo.less"

However, without a space between import and once, it's not going to work:

@import(once) "foo.less"


The file is not going to be imported (silent fail).

Thursday, February 16, 2017

How to fix black areas on Instagram photos

Scenario:

You are using Instagram Android app and your Instastory and other images end up with black areas on them (or even the whole photos can turn black).

Solution:

This is a bug in Android Instagram application. In order to fix it, go to Settings->Camera-> Turn off "Use High-quality Image Processing" Option.


If you need more details, check out here:
http://www.the-area51.com/2014/09/how-to-fix-black-instagram-photos-bug.html

Thursday, February 9, 2017

jQuery - never call offset() method on hidden element

In jQuery, a call to .offset() method of a hidden element might lead to wrong coordinates being obtained.

For example, this code is going to produce wrong results:


jQuery(".hover-gallery").offset( jelem.offset() );
jQuery(".hover-gallery").show();

The correct way to do it:

jQuery(".kd-hover-gallery").show();
jQuery(".kd-hover-gallery").offset( jelem.offset() );

More info here:
http://stackoverflow.com/questions/12087670/jquery-offset-top-doesnt-work-correctly

Sunday, February 5, 2017

Nice article on sales:

https://www.entrepreneur.com/article/286806

Select text under quotes in phpStorm - very useful shortcut



Example:


var myContent="abc-acme-test";

If you would like to quickly select all text under quotes (abc-acme-test), in phpStorm, you can do it in 2 quick steps:

1. Point your mouse between quote opening and letter a
2. Hit CTRL + W on keyboard (or Edit->Extend Selection from top menu)

It's a very handy shortcut which can save a lot of your time and concentration! Enjoy.

Saturday, February 4, 2017

It's not (just) about happiness (in business)

Not about happiness. Neuroscience makes a nonobvious prediction about high-trust organizations: Trust combined with Purpose results in Joy at work. Experiments from my lab and others show that working in a high-trust culture modestly increases Joy. Trust effects Joy through the interaction of oxytocin and dopamine (chapter 1), making it feel good to be around trusted team members. Being trusted by others also keeps chronic stress levels low, eliminating a drag on Joy. But understanding the value the organization creates for society, its Purpose, provides a second oxytocin stimulus. Helping others—even at a distance—is a powerful oxytocin booster.


He said he knew it was a job because time passed achingly slowly. Now he has a career and he never has enough time because he has so many exciting projects; in his words, “When you have a career there just ain’t enough time in the day.” The monologue was hilarious, and you get the point: Careers produce Joy; jobs seldom do

Full article is here

Wasting time? Check these quotes

“Don't let yesterday use up too much of today.” 


“The quickest way to run out of time is to think you have enough of it,” 


“One of the very worst uses of time is to do something very well that need not to be done at all.” 


“Worry is like a rocking chair-it keeps you busy but gets you nowhere.” 


“We only get one life. Wasting someone’s time is the subtlest form of murder.” 


“Thinking before taking actions is useful only if you are going to take action, otherwise you are wasting time and insulting your mind.” 


“Don't waste your time chasing things that will never be beneficial to your future.” 


“We all have the same 24/7. What we do with our time, becomes our priority.Avoid priorities by default.” 


“So, whenever you find yourself putting forth great effort without success, you're trying to force something that won't fit under the circumstances. That's a destructive waste of time. And if that isn't enough to keep in mind, your techniques must always be allowed to evolve and change, in relationships, in life, in science, in society. Otherwise you stagnate, and you won't get anywhere in the long run... You know what the philosopher Aldous Huxley said? He said 'Consistency is contrary to nature, contrary to life. The only completely consistent people are the dead.” 


A great list is here:

http://www.goodreads.com/quotes/tag/wasting-time

Friday, February 3, 2017

A nice post on Inbound marketing

Read it here:

https://blog.hubspot.com/insiders/24-hour-marketing-strategy




Just to re-cap what you need to do:
  1. What is your goal?
  2. Who are you targeting?
  3. Where do they live online?
  4. Develop your content calendar.
  5. Create a promotional list.

PSR-1 and PSR-2 coding standards for PHP

Visual aspects of code play a significant role in raising or drowning developer's productivity. In case that there's too much clutte...