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

Does Google Analytics count the visit if someone references an image from my site?

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.

My question was:

 

Well, the question is in the title. I searched SO (obviously) but nothing similar came up. Additional reading material (if you happen to know one) will be helpful to solve this mystery for me.

The answer, by user Eike Pierstorff, was:

No, not by default at least.

It is technically possible to contrive a serverside solution that measures referenced assets. But usually (i.e. when you use the javascript tracking code) Google Analytics will only measure documents that have the tracking code embedded. Since you cannot embed javascript code in image files they will not be tracked.

If you want to see which images have been called from other domains you can instead have a look in your webservers access logs which keeps track of all requests to your server and usually includes the address of the referring site.

Angular

ng-wat is the funniest video about Angular you’ll ever see

ng-wat is the most awesome video I’ve seen presented at any official conference. It was presented by the ever so slightly awesome developer Shai Reznik.

Anyways, take a look and see for yourself, and if promise you, you’ll laugh like hell.

https://www.youtube.com/watch?v=M_Wp-2XA9ZU

The line I like the most is:

Every time you want to complain, make a pull request instead.

Books

Creativity for sale – Jason Surfrapp

My notes from the book Creativity for sale: How I Made $1,000,000 Wearing T-Shirts and How You Can Turn Your Passion Into Profit, Too by Jason Surfrapp:

Do work that matters to you, and don’t be afraid to do things wildly differently from other people.

There was one question I always asked myself when it came to dealing with a customer service issue of any kind:’How would i want to be treated in this situation?’

Under promise and over deliver.

I’m happy to work until I’m 100 years old if I truly enjoy what I’m doing.

The freedom to understand that I don’t need things, I just want them, and that these feelings will often pass (normally when I stop watching TV).

Miscellaneou$

I just got an email from Google saying that someone logged in to my account using some different email address!?

This got me pretty alarmed:

GoogleHackAttemptFullMail

I immediately checked the devices from which it was accessed but couldn’t see any different from what I use usually. Nevertheless, even though I use two-factor authentication, I changed my password immediately.

Now, has any one of you had a similar experience? I thought the “problem” could be related with Google ignoring the dot (.) in the email thus for example [email protected] and [email protected] would come to the same email address. But, someone used the added numbers 33, so this hardly would pass as the same use case.

Anyways, still kind of baffled about it, so would appreciate some insight from more knowledgeable users.

edit: I asked this question on another StackExchange site (StackOverflow is a part of StackExchange btw) called Web Applications and will see if I get some explanation  there.

edit2: The answer, as that usually is the case with StackExchange sites, came pretty swiftly. User Al E. responded:

It’s hard to tell exactly what you’ve got here. (I don’t speak or read the language. (Slovenian? Croatian?)) I suspect one of two possibilities:

  1. Someone logged in (or tried to log in) from an area where you usually aren’t. (I might get a message if someone tried to log in from China, when I’m on the East Coast of the U.S.)
  2. More likely, I think, is someone has set your email address to be their recovery email or alternate email, and probably by mistake

I think you’ve done the responsible thing. You’re already using two-step authentication and you’ve changed your password. This probably won’t ever come up again. I wouldn’t worry any more about it.

And my comment on it was:

Thanks for your answer. Sorry for not translating Croatian (very close guess btw!), but essentially what it says is that someone just signed in to my account [email protected], then some details and then the question with a link if I don’t recognize this activity. Since this email isn’t mine I’m inclined to thinking that the possibility 2 really is the case, be it intentional or unintentional. But yeah, I probably should have a peace of mind having changed the pass immediately and since I have a two-way auth enabled. Thanks for reassurance! –

Stack Overflow

How to rewrite php echo with <<

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.

My question was:

I am wondering how to rewrite this code to work with qq:

  $containerRight = <<<qq
    <div class="container_right">
        {echoLikeBox()}

        <div class="join_us"><a href="#"><img src="images/join_us.png" width="304" height="44" alt=""></a></div>

        <div class="box2"><a href="#"><img src="images/twitter_big.gif" width="304" height="292" alt=""></a></div>

        <div class="box3"><a href="#"><img src="images/facebook.jpg" width="304" height="257" alt=""></a></div>

        <div class="box4"><a href="#"><img src="images/google_ads.gif" width="304" height="164" alt=""></a></div>
    <!-- container_right end --></div>;
    qq;
    echo $containerRight;

The problem is that I don’t know how to echo function inside the <<<. The code for the echoLikBox() is this:

function echoLikeBox()
{
    $likeBox = <<<qq
    <div class="box1">
            <div class="box1_lft"><a href="#"><img src="images/tweet.jpg" width="108" height="20" alt=""></a></div>
            <div class="box1_rht"><a href="#"><img src="images/like.jpg" width="82" height="20" alt=""></a></div>
            <div class="clear"></div>
    </div><!-- box1 end -->
    qq;
    echo $likeBox;
}

edit: found the solution here: Calling PHP functions within HEREDOC strings

 

The answer, by user Gavin Anderegg, was:

You may want to change the “echoLikeBox()” function to, instead of echoing its contents, store them as a string. You can’t make a call to a function inside of heredoc strings, but you can output variables. So, for example, you could have:

function echoLikeBox()
{
    $likeBox = <<<qq
    <div class="box1">
            <div class="box1_lft"><a href="#"><img src="images/tweet.jpg" width="108" height="20" alt=""></a></div>
            <div class="box1_rht"><a href="#"><img src="images/like.jpg" width="82" height="20" alt=""></a></div>
            <div class="clear"></div>
    </div><!-- box1 end -->
qq;
    return $likeBox;
}

and then just

$likeBox = echoLikeBox();

$containerRight = <<<qq
    <div class="container_right">
        $likeBox

        ...

inside of the main body.

Miscellaneou$

Webfestival 2015

I was just accepted to the Webfestival 2015 competition, so fingers crossed!

C/P from the official site (since, well, this is for Croatian users – so, fellow citizens, do join in!):

Tema ovogodišnjeg Webfestivala su osobne web stranice koje se u kontekstu natjecanja promatraju kao zbirka digitalnih sadržaja koje prikazuju napredak, razvoj i postignuća nekog pojedinca.

Cilj natjecanje je ukazati na potencijal i važnost osobnih web stranica u vremenu cjeloživotnog učenja i kontinuiranog stručnog usavršavanja te potaknuti CARNetove korisnike, ali i sve ostale, na izradu osobnih web stranica. Također, tijekom trajanja natjecanja ćemo kroz radionice i webinare upoznati korisnike s pojedinim alatima i mogućnostima za izradu osobnih web stranica te ćemo naposljetku autore najboljih osobnih web stranica i nagraditi vrijednim nagradama.

Svi zainteresirani autori mogu se prijaviti u dvije kategorije – Osobne stranice u obrazovanju ili Profesionalne osobne web stranice putem prijavnice dostupne nahttp://webfestival.carnet.hr/2015_prijava . Prijava na natjecanje će biti moguća do 30. rujna 2015. kada će Ocjenjivački sud započeti s ocjenjivanjem pristiglih prijava.

Autorima osobnih web stranica koje stručni Ocjenjivački sud ocijeni najboljima u svakoj kategoriji bit će dodijeljena nagrada u okviru CARNetove korisničke konferencije CUC 2015 koja se ove godine održava u Dubrovniku od 18. –  20. 11. 2015.

Pozivamo sve zainteresirane da se s detaljima natjecanja, pravilima sudjelovanja te kriterijima ocjenjivanja upoznaju na webu natjecanja  te da se prijave na natjecanje.

Books

Zločin u židovskoj četvrti – Ernesto Mallo

My notes (on Croatian [did you notice I added the translate functionality?]) from the book Zločin u židovskoj četvrti by Ernesto Mallo:

Smrt je jedino što ne dopušta repliku.

Bol ima vrlinu da osobe načini dubljima.

Kad se čovjek rodi kao bogataš, doživljava siromaštvo kao nepravdu.

Strah je kruh vojnika.

Svako biće, samom činjenicom što živi, odašilje zračenje koje se projicira u prostoru. Kao u slučaju zvijezda, to zračenje dalje putuje, možda vječno, čak i kad je onak koji ga je odašiljao nestao.

Ne voljeti iz straha od patnje je kao ne živjeti zbog straha od umiranja.

Stack Overflow

Merge two sorted arrays and the resulting array should also be sorted

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.

My question was:

Let’s say you have two arrays of arrays with the same structure but different count of arrays in them:

$arr1 = array(array(1,"b"), array(2,"a"), array(5,"c"));  
$arr2 = array(array(3,"e"));

Now, the data in the $arr1 and $arr2 is sorted, and now what I would like it to merge these two arrays, so I did this:

$res = array_merge($arr1, $arr2);

And then I get an output like this:

1-b  
2-a
5-c  
3-e

But, I would like to have a sorted $res also like this:

1-b  
2-a
3-e  
5-c

I wonder if there’s a function in PHP to do this automatically, without me having to write my own function? Or, please advise me on which is the best approach for this if I want to (later on) add sorting by the next parameter so the output would be like this

2-a  
1-b
5-c  
3-e

 

The answer, by user fieg, was:

You can first merge the arrays and then sort the final array.

You are probably looking for a multi-sort function. I usually use this function (I found this functions somewhere on the internet years ago, credits go to the original author):

/*
 * sort a multi demensional array on a column
 *
 * @param array $array array with hash array
 * @param mixed $column key that you want to sort on
 * @param enum $order asc or desc
 */
function array_qsort2 (&$array, $column=0, $order="ASC") {
    $oper = ($order == "ASC")?">":"<";
    if(!is_array($array)) return;
    usort($array, create_function('$a,$b',"return (\$a['$column'] $oper \$b['$column']);")); 
    reset($array);
}

You can use it like this:

array_qsort2($res, 0, "ASC");
Breaking News, Ionic

Ionic has a bright future by partnering with IBM

This is indeed awesome, as it hopefully means that Ionic is here to stay, so that all of us who use it won’t have to fear for it’s future – since it’s all awesome and stuff :). True, this seems more inclined towards business people, but the sole fact that with this more people will know about Ionic and won’t look you strangely when you say you’re developing iOS/Android apps with it by using one codebase.

Some news coverage about this:

  • IBM and Ionic Empower Business Users to Accelerate Mobile App Development
  • Make everyone a hacker: IBM MobileFirst & Ionic empower business users to prototype their own apps
Books

Start with why – Simon Sinek

My quotes from the book Start with why by Simon Sinek:

There are leaders and there are those who lead. Leaders hold a position of power or influence. Those who lead inspire us.

…quicker, cheaper option over the better long-term solution. Just like the habitual dieter. They never had the time or money to do it right the first time, but they always seem to have enough time and money to do it again.

Companies try to sell us what they do, but we buy why they do it.

Creative advertised their MP3 player as a 5GB MP3 player. It is exactly the same message as Apple’s ‘a thousand songs in your pocket’. Creative told us what their product was and Apple told us why we need it.

People with Apple laptop computers believe that they convey a message when opening them up on the airports, and that’s why the love to do it.

To be a good salesman you have to believe in that what you are selling.

When you compete against someone else, no one wants to help you. But when you compete against your self everyone wants to help.

What if we show up to work every day, just to be better than our selves? Be better than you were yesterday, and not than someone else.

Page 38 of 54« First...102030«37383940»50...Last »

Recent posts

  • FOMO as a Developer: You’re Not Behind, You’re Just Human
  • If only life had an XP bar
  • Are Book Summaries Worth It?
  • Book review: 5 Love Languages
  • Why You Should Start Blogging (Even If Nobody Will Read It)

Categories

  • Android (3)
  • Books (115)
    • Programming (22)
  • CodeProject (36)
  • Daily Thoughts (78)
  • DevThink (8)
  • Go (3)
  • iOS (5)
  • JavaScript (128)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (3)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (84)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (44)
  • Servers (8)
    • Heroku (1)
    • Linux (3)
  • Stack Overflow (82)
  • Unity3D (9)
  • VibeCoding (2)
  • 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