Coding: Fleeting Thoughts

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

Re: Coding: Fleeting Thoughts

Postby Cosmologicon » Fri Aug 19, 2011 5:01 pm UTC

There are tons of example interview questions on the web. I would use those to look for gaps in your knowledge. I think the five areas in five essential phone-screen questions are a pretty good starting point. They are: coding, object-oriented design, scripting and regular expressions, data structures, and bits and bytes. Different interviewers focus on different areas, so even if some types of questions seem irrelevant or unimportant (bitwise operations are often scoffed at, whereas I don't care for regexes myself), you can't count on the interviewer to not ask them.

For a non-technical tip, definitely practice giving good, short answers. If you're not prepared, you'll start talking too much and wind up hanging yourself with enough rope. I made that mistake when I was asked what a closure was and realized too late that I had trouble explaining it. Even if you understand the concepts, you should practice giving good, short answers. Preferably with a friend.

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Fri Aug 19, 2011 10:01 pm UTC

Yes, being able to give good, snappy answers is critical. Practice melding your words carefully so you can illustrate any concept in one line. Just go over some concepts and practice, and you'll find it easier to find ones for other concepts gradually. Avoid metaphors, "it's like X, but Y" and too-technical responses. Some of the best programmers I've talked to are so because they're good at communicating - remember, your employer wants you to communicate well too!
In Minecraft, I use the username Rirez.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Sat Aug 20, 2011 1:38 pm UTC

Thanks a lot, guys. This both gave me confidence in my abilities, as well as an idea of things to improve.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
mister_m
Posts: 34
Joined: Fri Feb 04, 2011 2:51 am UTC

Re: Coding: Fleeting Thoughts

Postby mister_m » Wed Aug 24, 2011 3:09 am UTC



Thank you for this resource.

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Wed Aug 24, 2011 8:42 am UTC

Wait, PHP has built-in validation functions?

I... I didn't know.
In Minecraft, I use the username Rirez.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Wed Aug 24, 2011 10:33 am UTC

Steax wrote:Wait, PHP has built-in validation functions?

I... I didn't know.


This is one wheel that's re-invented all too often.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Wed Aug 24, 2011 12:21 pm UTC

The PHP SPL is really... surprisingly useful. I only just learned about it, but it's literally changed how my code works. It also allows for strict and fast data structures, as well as an OOP version of php's ridiculously procedural file handling functions. $file->fwrite yay!
In Minecraft, I use the username Rirez.

User avatar
b.i.o
Green is the loneliest number
Posts: 2519
Joined: Fri Jul 27, 2007 4:38 pm UTC
Location: Hong Kong

Re: Coding: Fleeting Thoughts

Postby b.i.o » Thu Aug 25, 2011 12:27 am UTC

Re: phone screen questions.

When I was finding a job a couple of months ago, I noticed that things mostly fell into one of two types of questions: the "do you understand computer science concepts" questions, and the "do you know how to do X thing with Y technology we're using" questions. Some places ask a bit of both, but most lean heavily in one direction. (Google, Amazon, etc. are going to be more heavily slanted towards the CS-y stuff, while many web startups ask much more about specific languages/technologies.) Figuring out what to expect will be very helpful in preparing.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Thu Aug 25, 2011 8:41 pm UTC

I went to the interview, but one of the people who were supposed to be there wasn't for some undisclosed reason, so I only got to do a brief non-technical interview (which went pretty well I think). So I'm going to be called for another interview later.

I really should work on some sort of portfolio. I've been putting Tunguska on my resume, but as it's fairly old (and I haven't really worked on it for a few years, and some parts has primordial C-code from back in late 2007), it's like a gallery of bad programming practices and dubious OOP design.

I think I'll write some C++ wrappers for Linux systems programming stuff or something.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
mister_m
Posts: 34
Joined: Fri Feb 04, 2011 2:51 am UTC

Re: Coding: Fleeting Thoughts

Postby mister_m » Tue Aug 30, 2011 11:22 pm UTC

You, sir, name? wrote:I really should work on some sort of portfolio. I've been putting Tunguska on my resume, but as it's fairly old (and I haven't really worked on it for a few years, and some parts has primordial C-code from back in late 2007), it's like a gallery of bad programming practices and dubious OOP design.

I think I'll write some C++ wrappers for Linux systems programming stuff or something.


I am working on a sort of 'code portfolio' for myself as well. I suppose it is more of a "past projects that might be worth talking about" folio. I want to show that I am active outside of school. Right now I did some work on a silly maze generator in C++. I have to learn about A* so I can find the spot with the most distance from the entrance and place an exit before it is completed though. After that I'd like to try to make a game out of it. Anyway my question is - if I don't have a lot to put into a sort of coding portfolio, how would you recommend approaching the problem of creating a code portfolio? I was planning on writing articles about various programming-related things on my personal website to sort of accompany the code.

Also, how would you write a C++ wrapper for linux syscalls? Would that be C++ code that calls the C functions internally while encapsulating it all in an OO fashion?

letterX
Posts: 535
Joined: Fri Feb 22, 2008 4:00 am UTC
Location: Ithaca, NY

Re: Coding: Fleeting Thoughts

Postby letterX » Wed Aug 31, 2011 4:51 am UTC

mister_m wrote:I have to learn about A* so I can find the spot with the most distance from the entrance and place an exit before it is completed though.


Actually, for finding the furthest point from the entrance, single-source shortest-paths is the easiest (and probably optimal?) solution, which is just breadth-first search from the source. A* is overkill.

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Coding: Fleeting Thoughts

Postby EvanED » Wed Aug 31, 2011 8:04 pm UTC

Shell question. How can I invert a path?

In other words, suppose i have a path from the current directory to a file, say dir1/dir2/file.txt. (The path is relative, but you can assume it's in canonical form (no ..s) if you like.) What I want is a path from the directory containing that file to the current directory, so ../../ in that example.

With the "canonical form" assumption this just means a sequence of ../ with the same number of path components as the original path, minus the file. The following is probably good enough for me, but is very unsatisfying on a few counts:

Code: Select all

echo dir1/dir2/file.txt | xargs dirname | sed -e 's/[a-zA-Z0-9_-]*/../g'

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Wed Aug 31, 2011 8:59 pm UTC

Get both absolute paths, remove the initial part they have in common, and replace all the directories in one of them with ..s?

mister_m wrote:Also, how would you write a C++ wrapper for linux syscalls? Would that be C++ code that calls the C functions internally while encapsulating it all in an OO fashion?


Exactly. As a first step, mirroring the API in a not-very-OOP fashion with classes that wrap around file descriptors and similar and replace their error reporting with exceptions, and then adding more layers of abstraction.

Wrapping pthreads in C++ objects turned out to be a quite nice idea. Not only to get away from all the tedious error checking, but encapsulation and polymorphism also helps quite a lot. For example, instead of like pthreads having two nearly identical types mutex and spinlock, I have Mutex that is super-class to BasicMutex and Spinlock, and a factory-method to request the creation of a spinlock, that gives you a plain old mutex if the system has only one core.

I'm working on some useful objects to help multi-threading. A thread safe wrapper for std::queue seems quite useful.

I tried to create a thread pool, but I haven't gotten it working quite yet. It just reminded me how big of a headache debugging multi-threaded applications gives me.

Hm. I may limit my project to only wrapping pthreads. Seems more manageable.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Thu Sep 01, 2011 9:56 am UTC

Design thing, but still code.

Image

Image

Image

No images were harmed during the creation of these (in-browser) screenshots. No non-semantic markup wasted during production.

CSS 3 rocks.

A whole website with only 2 design images - the client logo (and accompanying backdrop).
In Minecraft, I use the username Rirez.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Thu Sep 01, 2011 1:18 pm UTC

What's the kosher way of disabling copy constructors in C++ nowadays? I know c++0x has a new delete keyword that disables it altogether, but in older versions of the language? Is it enough to just declare it explicit and private have an empty body, or do I throw an exception, or what?
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Coding: Fleeting Thoughts

Postby EvanED » Thu Sep 01, 2011 3:27 pm UTC

Check out Boost's noncopyable. You don't necessarily have to use their code if you're not already using boost, but you can easily make your own. (It's also a rare header from them that you could probably just swipe and don't need anything else.)

But basically, make them private and then don't implement them at all.

User avatar
Xanthir
My HERO!!!
Posts: 5336
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Coding: Fleeting Thoughts

Postby Xanthir » Thu Sep 01, 2011 4:57 pm UTC

Steax wrote:Design thing, but still code.

(clipped sweet images)

No images were harmed during the creation of these (in-browser) screenshots. No non-semantic markup wasted during production.

CSS 3 rocks.

A whole website with only 2 design images - the client logo (and accompanying backdrop).

You're welcome.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Thu Sep 01, 2011 5:11 pm UTC

Xanthir, you're part of the Chrome team, are you not?

I've met some trouble recently in chrome (could be webkit too, but I can't upgrade to 5.1 with the proper -webkit-radial-gradient syntax, *grumblegrumble* OS X 10.6 *grumblegrumble*). I've made faux soft gradients - basically a large radial gradient with lots of small ones plotted on top, giving these "blobs of light" effects. It makes for excellent and rich backdrops without requiring heavy images, and I can even give parallax effects to them when scrolling, giving depth.

Now, Firefox renders this really quickly - I can scroll up and down the page smoothly. On chrome, though, it lags a bit. Not much, but it's noticeable. I guess it might have to do with getting hardware rendering for these gradients. I would attach a full page for you to test, but alas, client work. Maybe in a few weeks.

Still, thank you for helping make CSS 3 work.
Spoiler:
And thank you for not making me add -chrome-linear-gradient to these already giant stockpiles of prefixed code. I NEED LESS.APP DAMMIT. WHY WONT IT WORK FOR OS X 10.5?! WHYYYYYYYYYYY IS THERE NO OLD VERSION ;______;


For added frustration-releasing effects: here's the code for that airmail-themed red/blue pattern.

Code: Select all

#rightarea{
   width: 340px;
   float: left;
   margin-left: 40px;
   background: white;
   
   background: -moz-linear-gradient(-45deg,
      transparent 0, transparent 7.14%,
      #CB8085 7.14%, #CB8085 14.29%,
      transparent 14.29%, transparent 17.86%,
      #CB8085 17.86%, #CB8085 25%,
      transparent 25%, transparent 32.14%,
      #80CCE8 32.14%, #80CCE8 39.29%,
      transparent 39.29%, transparent 42.86%,
      #80CCE8 42.86%, #80CCE8 50%,
      transparent 50%, transparent 57.14%,
      #CB8085 57.14%, #CB8085 64.29%,
      transparent 64.29%, transparent 67.86%,
      #CB8085 67.86%, #CB8085 75%,
      transparent 75%, transparent 82.14%,
      #80CCE8 82.14%, #80CCE8 89.29%,
      transparent 89.29%, transparent 92.86%,
      #80CCE8 92.86%, #80CCE8 100%
   
   ), -moz-linear-gradient(top, #fff, #eee);
   
   background: -webkit-linear-gradient(-45deg,
      transparent 0, transparent 7.14%,
      #CB8085 7.14%, #CB8085 14.29%,
      transparent 14.29%, transparent 17.86%,
      #CB8085 17.86%, #CB8085 25%,
      transparent 25%, transparent 32.14%,
      #80CCE8 32.14%, #80CCE8 39.29%,
      transparent 39.29%, transparent 42.86%,
      #80CCE8 42.86%, #80CCE8 50%,
      transparent 50%, transparent 57.14%,
      #CB8085 57.14%, #CB8085 64.29%,
      transparent 64.29%, transparent 67.86%,
      #CB8085 67.86%, #CB8085 75%,
      transparent 75%, transparent 82.14%,
      #80CCE8 82.14%, #80CCE8 89.29%,
      transparent 89.29%, transparent 92.86%,
      #80CCE8 92.86%, #80CCE8 100%
   
   ), -webkit-linear-gradient(top, #fff, #eee);
   
   background: linear-gradient(-45deg,
      transparent 0, transparent 7.14%,
      #CB8085 7.14%, #CB8085 14.29%,
      transparent 14.29%, transparent 17.86%,
      #CB8085 17.86%, #CB8085 25%,
      transparent 25%, transparent 32.14%,
      #80CCE8 32.14%, #80CCE8 39.29%,
      transparent 39.29%, transparent 42.86%,
      #80CCE8 42.86%, #80CCE8 50%,
      transparent 50%, transparent 57.14%,
      #CB8085 57.14%, #CB8085 64.29%,
      transparent 64.29%, transparent 67.86%,
      #CB8085 67.86%, #CB8085 75%,
      transparent 75%, transparent 82.14%,
      #80CCE8 82.14%, #80CCE8 89.29%,
      transparent 89.29%, transparent 92.86%,
      #80CCE8 92.86%, #80CCE8 100%
   
   ), linear-gradient(top, #fff, #eee);
   background-size: 80px 80px, 100% 100%;
   box-shadow: inset 0 0 0 1px rgba(255,255,255,0.6), inset 0 0 5px rgba(0,0,0,0.3), 0 0 5px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.02), 0 10px 10px -5px rgba(0,0,0,0.3);
}
In Minecraft, I use the username Rirez.

User avatar
mister_m
Posts: 34
Joined: Fri Feb 04, 2011 2:51 am UTC

Re: Coding: Fleeting Thoughts

Postby mister_m » Thu Sep 01, 2011 6:08 pm UTC

You, sir, name? wrote:What's the kosher way of disabling copy constructors in C++ nowadays? I know c++0x has a new delete keyword that disables it altogether, but in older versions of the language? Is it enough to just declare it explicit and private have an empty body, or do I throw an exception, or what?


I checked in my hilaiously and sadly neglected copy of Effective C++ and there is a bullet point on Item 6 (explicitly disallow the use of compiler generated functions you do not want) that says the following:
To disallow functionality automatically provided by compilers, declare the corresponding member functions private and give no implementations.


There is an example in the chapter about using a base class called "Uncopyable" to do this:

Code: Select all

class Uncopyable{
protected:
    Uncopyable(){}
    ~Uncopyable(){}
private:
    Uncopyable(const Uncopyable&);
    Uncopyable& operator=(const Uncopyable&);
};


Then you could just utilize it like this:

Code: Select all

class YadaYada : private Uncopyable{
    ...
};


Okay having given that explanation straight from the book, I have a question - as my C++ isn't that sharp. in the two private methods of Uncopyable - what does "const uncopyable&" mean? I know a const variable can't be modified, but what does the ampersand after the variable name mean? That is a const reference to an Uncopyable variable right? Why the const when it is passed by reference? To ensure that the data passed to the function by reference is safe from being changed at all? Also, what the heck is going on in the return type of the copy assignment operator?

User avatar
chridd
Has a vermicelli title
Posts: 829
Joined: Tue Aug 19, 2008 10:07 am UTC
Location: ...Earth, I guess?
Contact:

Re: Coding: Fleeting Thoughts

Postby chridd » Thu Sep 01, 2011 6:30 pm UTC

mister_m wrote:There is an example in the chapter about using a base class called "Uncopyable" to do this:
That's the same as Boost's header above, except without the namespaces and include guards.
mister_m wrote:Okay having given that explanation straight from the book, I have a question - as my C++ isn't that sharp. in the two private methods of Uncopyable - what does "const uncopyable&" mean? I know a const variable can't be modified, but what does the ampersand after the variable name mean? That is a const reference to an Uncopyable variable right? Why the const when it is passed by reference? To ensure that the data passed to the function by reference is safe from being changed at all?
That's the normal declaration for a copy constructor (i.e., not specific to making something uncopyable). The object you're copying from isn't going to be modified, hence the const. It's a reference because otherwise the compiler would need to make a copy of the object before calling the copy constructor, and to do that it would need to use the copy constructor. (For the assignment operator, it's for efficiency.)
Also, what the heck is going on in the return type of the copy assignment operator?
You can do things like x = y = z to assign both x and y the value z. This is done by having (y = z) return the value y.
~ chri d. d. /tʃɹɪ.di.di/ (Phonotactics, schmphonotactics) · she(?)(?(?)(?))(?(?(?))(?))(?) · Forum game scores
mittfh wrote:I wish this post was very quotable...
chridd (on Discord) wrote:
Dummy wrote:Sorry You're Gay Dads
SYG'D
marionic (on Discord) wrote:sleep in grave

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Fri Sep 02, 2011 12:11 am UTC

FT: libsigc++ lambdas are awesome.

Code: Select all

#include <iostream>
#include <sigc++/sigc++.h>

int main ()
{
  using namespace std;
  using namespace sigc;
  
  auto slope 
= (_4 - _2) / (_3 - _1);
  auto intercept = _2 - slope * _1;
  
  float x1 
= 3, y1 = 2, x2 = 6, y2 = 8;
  
  cout 
<< "y = " << slope(x1, y1, x2, y2) << "x + " << intercept(x1, y1, x2, y2) << '\n';
}
 
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Fri Sep 02, 2011 10:55 am UTC

Why not use C++0x lambdas when you're already using c++0x auto variables?
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Fri Sep 02, 2011 11:12 am UTC

You, sir, name? wrote:Why not use C++0x lambdas when you're already using c++0x auto variables?

I was using sigc++ for something else when I discovered that feature. I didn't know c++11 supports lambas.
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Fri Sep 02, 2011 11:20 am UTC

I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Fri Sep 02, 2011 2:25 pm UTC

Second job interview today. Choked on one ridiculously trivial question I should have been able to answer (how to search in a binary search tree), but otherwise it went fine.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
PM 2Ring
Posts: 3652
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Mid north coast, NSW, Australia

Re: Coding: Fleeting Thoughts

Postby PM 2Ring » Fri Sep 02, 2011 2:40 pm UTC

You, sir, name? wrote:Second job interview today. Choked on one ridiculously trivial question I should have been able to answer (how to search in a binary search tree), but otherwise it went fine.

Oops! :)

Good luck, Ysn.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Fri Sep 02, 2011 3:47 pm UTC

The potential boss seemed optimistic, so hopefully they realize that this stuff happens in a stressful situation. Especially since I nailed pretty much everything else (and knew what properties BSTs obey).
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
mister_m
Posts: 34
Joined: Fri Feb 04, 2011 2:51 am UTC

Re: Coding: Fleeting Thoughts

Postby mister_m » Fri Sep 02, 2011 5:30 pm UTC

The biggest thing I am worried about after graduating is starting to do interviews. I don't feel like I would be very good at them, and I took my data structures and algorithms classes in my first year so a lot of time has passed before I was really engaged in the material. I suppose the interview difficulty would depend on where exactly you interview, but I plan on spending time this year preparing myself.

You sir, name? where did you interview if you don't mind my asking?

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Fri Sep 02, 2011 6:37 pm UTC

You, sir, name? wrote:Read all about it.

Oh, right. For some reason I completely forgot about that since I last used C++0x. I still think the libsigc version is more convenient, but, now that I know about that, I'd rather use a built-in language feature.
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
Xanthir
My HERO!!!
Posts: 5336
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Coding: Fleeting Thoughts

Postby Xanthir » Fri Sep 02, 2011 6:49 pm UTC

Steax wrote:Xanthir, you're part of the Chrome team, are you not?

Yup, though I mostly write specs rather than browser code.

I've met some trouble recently in chrome (could be webkit too, but I can't upgrade to 5.1 with the proper -webkit-radial-gradient syntax, *grumblegrumble* OS X 10.6 *grumblegrumble*). I've made faux soft gradients - basically a large radial gradient with lots of small ones plotted on top, giving these "blobs of light" effects. It makes for excellent and rich backdrops without requiring heavy images, and I can even give parallax effects to them when scrolling, giving depth.

Now, Firefox renders this really quickly - I can scroll up and down the page smoothly. On chrome, though, it lags a bit. Not much, but it's noticeable. I guess it might have to do with getting hardware rendering for these gradients. I would attach a full page for you to test, but alas, client work. Maybe in a few weeks.

Yeah, without an example, dunno. I sit next to the guys who deal with scrolling, and it's dark voodoo magic.

Still, thank you for helping make CSS 3 work.
Spoiler:
And thank you for not making me add -chrome-linear-gradient to these already giant stockpiles of prefixed code. I NEED LESS.APP DAMMIT. WHY WONT IT WORK FOR OS X 10.5?! WHYYYYYYYYYYY IS THERE NO OLD VERSION ;______;

And hey, I'm working on getting Image Values to advance down the standards track, so you'll be able to drop prefixes in a few months.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Fri Sep 02, 2011 9:02 pm UTC

mister_m wrote:The biggest thing I am worried about after graduating is starting to do interviews. I don't feel like I would be very good at them, and I took my data structures and algorithms classes in my first year so a lot of time has passed before I was really engaged in the material. I suppose the interview difficulty would depend on where exactly you interview, but I plan on spending time this year preparing myself.


Refreshing that stuff turned out not to be that much work.

mister_m wrote:You sir, name? where did you interview if you don't mind my asking?


Don't want to say where until I know if I'm hired, but the job consists of developing in-house software for a major investment bank.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Wed Sep 07, 2011 6:31 pm UTC

FT: Valgrind is giving me this message in my OpenGL/SDL application. Does anyone know if this is normal, or is there a problem with my video driver?

Code: Select all

==25700== 262,132 bytes in 1 blocks are definitely lost in loss record 320 of 321
==25700==    at 0x4C28FAC: malloc (vg_replace_malloc.c:236)
==
25700==    by 0x513E8AA: ??? (in /usr/lib/nvidia-current/libGL.so.270.41.06)
==
25700==    by 0x7FEFFFB2F: ??? 
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
You, sir, name?
Posts: 6983
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Wed Sep 07, 2011 7:05 pm UTC

Unless you keep initialize and shut down down OpenGL in a loop in your program, how is this a problem?



Anyway, they called from the job, and wanted me. Just some formalities and contracts to take care of, and I'm a white collar worker instead of an unemployed slob.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

Anonymously Famous
Posts: 241
Joined: Thu Nov 18, 2010 4:01 am UTC

Re: Coding: Fleeting Thoughts

Postby Anonymously Famous » Wed Sep 07, 2011 7:57 pm UTC

Congratulations! :)

Laguana
Posts: 49
Joined: Sat Jan 19, 2008 10:13 pm UTC

Re: Coding: Fleeting Thoughts

Postby Laguana » Wed Sep 07, 2011 11:24 pm UTC

TheChewanater wrote:FT: Valgrind is giving me this message in my OpenGL/SDL application. Does anyone know if this is normal, or is there a problem with my video driver?

Code: Select all

==25700== 262,132 bytes in 1 blocks are definitely lost in loss record 320 of 321
==25700==    at 0x4C28FAC: malloc (vg_replace_malloc.c:236)
==
25700==    by 0x513E8AA: ??? (in /usr/lib/nvidia-current/libGL.so.270.41.06)
==
25700==    by 0x7FEFFFB2F: ??? 



This is purely anecdotal, but a while back I was playing around with pthreads and valgrind kept complaining that libpthreads was losing 1 block from initialisation as well. I could be wrong, but I've just put it down to "library magic". I recall finding some documentation from valgrind talking about how to suppress library errors since you can't do anything with those, so you might want to look into that so you only find your own errors.

User avatar
TheChewanater
Posts: 1279
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Thu Sep 08, 2011 12:38 am UTC

You, sir, name? wrote:Unless you keep initialize and shut down down OpenGL in a loop in your program, how is this a problem?

Because I don't know for sure if it's happening when OpenGL is initialized, or somewhere else. I have heard somewhere that drivers sometimes don't free textures when you ask them to, but I guess there's no plausible way of finding out. I could eliminate some possibilities like that one experimentally, but I guess it doesn't matter, since I can't do much to fix it in my application.
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

User avatar
Pesto
Posts: 737
Joined: Wed Sep 05, 2007 5:33 pm UTC
Location: Berkeley, CA

Re: Coding: Fleeting Thoughts

Postby Pesto » Thu Sep 08, 2011 4:28 am UTC

Not coding, but something I just discovered.

If you want to move a tab between windows in Chrome, you can just shut the tab in one window, open a new tab in the other window and select that page from the Recently Closed Tab list, since that list is shared between windows. This is especially useful if you have two maximized windows.

Am I retarded for not discovering this sooner?

User avatar
Steax
SecondTalon's Goon Squad
Posts: 3038
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Thu Sep 08, 2011 4:47 am UTC

That gets even better when you can use gestures (like jitouch for macs) to make half-a-second closing-and-re-opening tabs simple. It becomes second nature after a while.
In Minecraft, I use the username Rirez.

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Coding: Fleeting Thoughts

Postby EvanED » Thu Sep 08, 2011 5:27 am UTC

Can't you drag tabs between windows in Chrome? (I don't use it on Windows and can't test right now.)

User avatar
e^iπ+1=0
Much, much better than Gooder
Posts: 2065
Joined: Sun Feb 15, 2009 9:41 am UTC
Location: Lancaster

Re: Coding: Fleeting Thoughts

Postby e^iπ+1=0 » Thu Sep 08, 2011 5:48 am UTC

Well I know you can in safari, which leads me to think you probably can in chrome.
poxic wrote:You, sir, have heroic hair.
poxic wrote:I note that the hair is not slowing down. It appears to have progressed from heroic to rocking.

(Avatar by Sungura)


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 8 guests