Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

04-23-2013 , 08:40 AM
So I finally got fed up with SO and hacker news not opening external links in a new tab, and I made this tiny tampermonkey script for chrome. Figured some of you might share my annoyance:

Code:
// ==UserScript==
// @name       Always Open External Links In New Tab
// @namespace  http://use.i.E.your.homepage/
// @version    0.1
// @description  enter something useful
// @match      *://*/*
// @copyright  2012+, You
// ==/UserScript==

var nodeList = document.getElementsByTagName("a");
for (var i=0; i<nodeList.length; i++) {
    var link = nodeList[i];
    if (link.href.indexOf(location.hostname) == -1)
        link.target = "_blank";
}
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-23-2013 , 09:41 AM
Quote:
Originally Posted by WishICouldLAG
It depends entirely on the culture at that particular company. For some companies with this policy, taking any vacation is looked down upon and it will hurt how you're perceived by others in the company. At others, it's actually encouraged to take vacation especially after you've been grinding really hard on a project for a while.

It's definitely something you want to find out during the interview if vacation time is important to you. I would probably be blunt and ask "How much vacation does a developer here typically take in a year?" If employees actually take vacation then people in the interview will probably smile and answer truthfully because they are proud that the company lets them take vacation freely. If they don't take vacation, it could get awkward for a few moments and they'll probably just repeat the company line of "as much as you need".

If you're worried that asking might affect your chances of getting the job then wait to ask until after you have an offer.
If they frown an any paid leave contracting at an hourly rate for time and materials with the rate adjusted accordingly would be my preferred option.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-23-2013 , 01:07 PM
How the hell can actuary be #1 on any such list. Lol?!

Military general as 180...I see, I see...Journalist last...I see, I see, senior cooperate executive 155...I see, I see
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-23-2013 , 01:25 PM
I love "Computer Systems Analyst". I don't know if I've ever met someone who actually uses that job title in day-to-day life. I just automatically read it as Canadian software engineer who is working in the US on a TN visa.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-23-2013 , 01:37 PM
Quote:
Originally Posted by jjshabado
I love "Computer Systems Analyst". I don't know if I've ever met someone who actually uses that job title in day-to-day life. I just automatically read it as Canadian software engineer who is working in the US on a TN visa.
http://youtu.be/SgKiIAjtrR4
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-23-2013 , 01:58 PM
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-23-2013 , 03:19 PM
Quote:
Originally Posted by gaming_mouse
So I finally got fed up with SO and hacker news not opening external links in a new tab, and I made this tiny tampermonkey script for chrome. Figured some of you might share my annoyance:

Code:
// ==UserScript==
// @name       Always Open External Links In New Tab
// @namespace  http://use.i.E.your.homepage/
// @version    0.1
// @description  enter something useful
// @match      *://*/*
// @copyright  2012+, You
// ==/UserScript==

var nodeList = document.getElementsByTagName("a");
for (var i=0; i<nodeList.length; i++) {
    var link = nodeList[i];
    if (link.href.indexOf(location.hostname) == -1)
        link.target = "_blank";
}
That's a pretty cool hack, but two things:

CTR + Click (or Enter) opens in another tab. I know you're a vimmer, but just saying.

I switched back to Firefox. Not only is it much faster these days, but when you go back to the original page, the link you just clicked is highlighted in a dotted box, which is pretty damn cool and sort of makes that desire to open in new tabs go away.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-23-2013 , 03:21 PM
Quote:
Originally Posted by gaming_mouse
I'm up on them, seeing how I just earned the ability to edit questions and answers. And I am going to abuse the **** out that privilege!!!
I have less than 100 rep and I can do that.

I just had my first upvote for an answer. I only answered two questions in the past 8 months or so.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-23-2013 , 03:24 PM
Quote:
Originally Posted by daveT
I have less than 100 rep and I can do that.

I just had my first upvote for an answer. I only answered two questions in the past 8 months or so.
But when you do it, it needs to get approved before it shows up. You get the ability to do it unsupervised at 2k.

Re: the link thing, I know you can do that, but the thing is I literally never want it to stay on in the same tab when I open an external site, so I want it to be the default. It's odd that it's not a browser configuration setting, but I couldn't find it if it is.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-23-2013 , 03:42 PM
I've searched for said setting as well and couldn't find it either. I agree that it should be available too.

Congrats on your new-found editing power.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-23-2013 , 04:12 PM
gaming_mouse,

thanks for that
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 02:22 PM
I have an interview for an internship. If I do bad, I'll be crushed.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 09:17 PM
GL!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 09:28 PM
spent some time tonight checking out browserify -- looks awesome.

i think a bunch of you guys would love the philosophy behind it, and the author, James Halliday, makes an eloquent case here for shoe lace's jquery hate.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 09:39 PM
Need a little (what should be) basic PHP help please. I have a javascript background so I'm confused why this is so ****ing dumb. Essentially I have an array that looks like:

Code:
[foo, bar, foo, x, y, x]
and I want the non uniques gone. array_unique returns essentially
Code:
[foo, bar, , x, y, ]
which would be fine except, bizarrely, $array[2] and [5] throws an error even when using something like
Code:
if ($array[$j]) {
// do something
}
in a normal for statement through count($array). What am I missing? I spent some time on SO etc but nothing easy came up. And it seems so ****ing dumb to keep the keys in there essentially pointing to errors instead of just having array_unique returning [foo, bar, x, y] in this case.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 09:46 PM
Quote:
Originally Posted by gaming_mouse
i think a bunch of you guys would love the philosophy behind it, and the author, James Halliday, makes an eloquent case here for shoe lace's jquery hate.
i'm on board with minimizing dependencies and avoiding versioning hell. i also favor using generic variants over technology-specific variants[1], so the examples like this seem useful:

Code:
To query for elements based on css selectors, instead of:

$('.foo .bar')
to get a single element, do:

document.querySelector('.foo .bar')
and to get a list of elements do:

document.querySelectorAll('.foo .bar')
the generic form has the additional advantage of being more readable (if a bit wordy) imo.


but then he includes an example like this:

Code:
To set css styles, instead of:

$(element).css(name, value)
you can do:

element.style[name] = value
This should work in all browsers but note that you'll sometimes need to attach the element to the document body before its style property will be set. You can if (!element.style) element.style = {} to get around that.
this kind of nonsense is one of the main problems that jquery solves, so this seems like an example of when *not* to use the generic form.


[1] i probably posted it before but i made a colleague buy me coffee after his choice to use mysql-only `if` instead of supported-by-everyone `case` lost me an hour when the integration test i was writing -- running in sqlite -- didn't work.

(no, i don't want to debate the validity of integration tests that use a different db technology, kthx )
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 09:50 PM
grue,

idk anything about php but:

0. don't use php

1. is there a different array uniquing function that does what you want? php is notorious for many slightly different functions that do mostly similar things.

2. failing that, how about running it through some kind of squash to remove the empty values?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 10:31 PM
Quote:
this kind of nonsense is one of the main problems that jquery solves, so this seems like an example of when *not* to use the generic form.
while i certainly agree with this, and i hate nothing more than wasting time learning the quirks of incompetently designed browsers, there are lots of projects or pages where the vanilla stuff would cover you entirely it seems.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 10:37 PM
Grue:

Code:
$a = array('foo', 'bar', 'foo', 'x', 'y', 'x');
$b = array_values(array_unique($a));
var_dump($b);
Just gotta know your tools
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 10:53 PM
g_m,




php,

Quote:
Code:
$a = array('foo', 'bar', 'foo', 'x', 'y', 'x');
$b = array_values(array_unique($a));
var_dump($b);
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 11:26 PM
Quote:
Originally Posted by daveT
I have an interview for an internship. If I do bad, I'll be crushed.
Quote:
Originally Posted by _dave_
GL!
Luck?

It was interesting experience. The guy called me last night and we talked a bit about what little I know of OO and for some reason I was sitting in his office today and he was asking me questions about OO design and concepts. Turns out that I don't a damn thing. I mean, I really know nothing.

The next series of questions turned to databases and I did pretty good on that part. The questions were meant to be tough and I couldn't answer the last question since I honestly didn't know that answer.

He was really nice. He offered highly detailed answers to the OO stuff and explained in considerable depth about the issues surrounding some database stuff (I was able to nail a few points on the issues myself). It was a good experience for me since I got a decent view into how an expert thinks. Totally eye-opening experience. He was kind of surprised I knew as much about databases as I did.

I guess my chances are < 50%, but eh, I wasn't expecting to do that well anyways. The takeaway is that the needs of the "real world" are considerably different than the land I reside in, so at least I see now the areas I should work on in the future. I ought to get familiar with OOP at some point.

Ultimately, I wanted to run out screaming and tell the guy I am a stupid fraud and this whole situation is insane. I think he asked the OO stuff first just to see how much I would bs or see how I'd do under pressure.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 11:29 PM
Quote:
Originally Posted by gaming_mouse
Grue:

Code:
$a = array('foo', 'bar', 'foo', 'x', 'y', 'x');
$b = array_values(array_unique($a));
var_dump($b);
at least in this regard this still doesn't work.

Code:
$result = mysql_query($query);
$rows = mysql_num_rows($result);
for ($j = 0; $j < $rows; ++$j) {
	$result2[] = mysql_result($result, $j, 'type');
}
$result3 = array_values(array_unique($result2));
function filterTypes($array) {
	$arrayLength = count($array);
	for ($i = 0; $i <= $arrayLength; ++$i) {
		echo "<option value='" . $array[$i] . "'>" . $array[$i] . "</option>";
		}
	}
filterTypes($result3);
errors out. Again I have a JS background so almost certainly suck at PHP but yeah, what's wrong here? This is inside of an html select of course.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 11:39 PM
Can't you just throw a distinct into that $query?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-24-2013 , 11:40 PM
A lot of your functions are deprecated as of 5.5. Not sure if that is the total issue, but perhaps there are better things to use that are unified.

http://php.net/manual/en/function.mysql-num-rows.php

http://php.net/manual/en/function.mysql-query.php

http://php.net/manual/en/function.mysql-result.php
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m