Coding: Fleeting Thoughts

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

Moderators: phlip, Moderators General, Prelates

User avatar
PM 2Ring
Posts: 3713
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: Coding: Fleeting Thoughts

Postby PM 2Ring » Fri Aug 06, 2010 3:06 pm UTC

Thanks again, Maelstrom, and thanks for that script, phlip.

* goes off to play with jsonp stuff *

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

Re: Coding: Fleeting Thoughts

Postby Xanthir » Fri Aug 06, 2010 6:24 pm UTC

Put in a slightly shorter fashion: scripts break the declarative model of HTML. They not only do non-declarative things, but they're very sensitive to precisely when they're run, and what state the document is in at that point.

Also: they're totally fucking crazy. Blame authors of the past. They were ALL RETARDED, and now we have to deal with their bullshit.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

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

Re: Coding: Fleeting Thoughts

Postby Pesto » Fri Aug 06, 2010 6:32 pm UTC

FT: What happens when you try to inline a recursive function?

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

Re: Coding: Fleeting Thoughts

Postby Xanthir » Fri Aug 06, 2010 6:42 pm UTC

Either the compiler says "fuck you", or it unfolds it into a non-recursive version and inlines it as normal.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

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 Aug 06, 2010 6:47 pm UTC

Pesto wrote:FT: What happens when you try to inline a recursive function?

I've tried that once. I didn't examine the compiled assembly, but it seemed to work like a normal recursive function.

EDIT: GCC doesn't seem to do anything different with the assembly if it's inlined, even if it's not recursive. Apparently it's just a suggestion to the compiler to make it inline.
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
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: Coding: Fleeting Thoughts

Postby Berengal » Fri Aug 06, 2010 9:08 pm UTC

Pesto wrote:FT: What happens when you try to inline a recursive function?

Code: Select all

data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCiAgPGhlYWQ+DQogICAgPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiIHNyYz0iaHR0cDovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjQuMi9qcXVlcnkubWluLmpzIj48L3NjcmlwdD4NCiAgICA8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+DQogICAgICAkKGRvY3VtZW50KS5yZWFkeShmdW5jdGlvbigpew0KICAgICAgICB2YXIgc3RhcnQgPSAkKCIjc3RhcnQiKTsNCiAgICAgICAgdmFyIGVuZCA9ICQoIiNlbmQiKTsNCiAgICAgICAgdmFyIGNvdW50ZXIgPSAkKCIjY291bnRlciIpOw0KICAgICAgICAkKCIjZm9sZHIiKS5jbGljayhmdW5jdGlvbigpew0KICAgICAgICAgIHN0YXJ0LnRleHQoZnVuY3Rpb24oXyxvbGQpe3JldHVybiBvbGQgKyBjb3VudGVyLnRleHQoKSArICIgKyAoIjt9KTsNCiAgICAgICAgICBlbmQudGV4dChmdW5jdGlvbihfLG9sZCl7cmV0dXJuICIpIiArIG9sZDt9KTsNCiAgICAgICAgICBjb3VudGVyLnRleHQoZnVuY3Rpb24oXyxvbGQpe3JldHVybiBwYXJzZUludChvbGQpICsgMTt9KTsNCiAgICAgICAgICByZXR1cm4gZmFsc2U7DQogICAgICAgIH0pOw0KICAgICAgfSk7DQogICAgPC9zY3JpcHQ+DQogICAgPHN0eWxlPg0KICAgIDwvc3R5bGU+DQogIDwvaGVhZD4NCiAgPGJvZHk+DQogICAgPHByZT48c3BhbiBpZD0ic3RhcnQiPjwvc3Bhbj48YSBpZD0iZm9sZHIiIGhyZWY9IiMiPmZvbGRyPC9hPiAoMSspIDAgWzxzcGFuIGlkPSJjb3VudGVyIj4xPC9zcGFuPi4uXTxzcGFuIGlkPSJlbmQiPjwvc3Bhbj48L3ByZT4NCiAgPC9ib2R5Pg0KPC9odG1sPg==

(The original foldr.com is gone for some reason)
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

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 Aug 06, 2010 9:21 pm UTC

TheChewanater wrote:
Pesto wrote:FT: What happens when you try to inline a recursive function?

I've tried that once. I didn't examine the compiled assembly, but it seemed to work like a normal recursive function.

EDIT: GCC doesn't seem to do anything different with the assembly if it's inlined, even if it's not recursive. Apparently it's just a suggestion to the compiler to make it inline.


Yakk tells it like it is. Or in short, inline affects linking behavior in a way that causes some compilers to inline more. And it's also quite evil.
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 » Sat Aug 07, 2010 7:08 am UTC

Fleeting thought:

My textbook has a lot of multiple choice questions about which are valid keywords in Java. It also colors every valid keyword purple.
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
PM 2Ring
Posts: 3713
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: Coding: Fleeting Thoughts

Postby PM 2Ring » Sat Aug 07, 2010 2:00 pm UTC

Maelstrom. wrote:

Code: Select all

<script src="http://example.com/request.jsonp?callback=jsonp_callback"></script>


This will then go fetch the JSONP feed, and execute it as if it is a normal JavaScript code block. To create this script block, I think you can just use normal DOM methods like

Code: Select all

var jsonp_callback = function(data) {
    // do something with the data here
}
var jsonpFeedUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=29053b7ff74d5086a97cb14ad3ba0aba&_render=json&url=http%3A%2F%2Fxkcd.com%2Finfo.0.json&_callback=jsonp_callback";
var script = document.createElement('script');
script.src = jsonpFeedUrl;
document.body.appendChild(script);


I have never done it that way myself. I usually use frameworks that take care of this stuff for me.

Unfortunately, I couldn't get that to work. I eventually managed to write a script that does the job, but I couldn't have done it without your help.

phlip wrote:
RoadieRich wrote:I'm probably missing something, but what's wrong with putting the script block in manually?

Nothing... and if you just want a static page that, say, shows the current comic, then you could have a page that has the script block in there directly... something along the lines of:

Code: Select all

<script type="text/javascript">
var details = {};
function dataloaded(o)
{
  details = o;
}
function pageloaded()
{
  with(document.getElementById("image"))
  {
    src = details.img;
    alt = details.title;
    title = details.alt;
  }
}
</script>
<script type="text/javascript" src="<a class="linkification-ext" href="http://dynamic.xkcd.com/api-0/jsonp/comic/?callback=dataloaded" title="Linkification: http://dynamic.xkcd.com/api-0/jsonp/comic/?callback=dataloaded">http://dynamic.xkcd.com/api-0/jsonp/comic/?callback=dataloaded</a>"></script>
<body onload="pageloaded()"><img id="image"></body>

However, if you want to be able to change the image dynamically, then you're going to want to add those external script tags on the fly, depending on what comic you want to display.
That was very helpful, phlip.
I wanted to make a script that'd let you load any comic by number, but I decided that the cleanest way to load a new comic was to refresh the script, rather than to have a button that adds a new script for each comic. I'll post my latest effort in the "Getting the most recent comic" thread, as that seems an appropriate place for it, and it'd soon get "buried" in this thread.

User avatar
Area Man
Posts: 256
Joined: Thu Dec 25, 2008 8:08 pm UTC
Location: Local

Re: Coding: Fleeting Thoughts

Postby Area Man » Sat Aug 07, 2010 5:40 pm UTC

TheChewanater wrote:
Pesto wrote:FT: What happens when you try to inline a recursive function?

I've tried that once. I didn't examine the compiled assembly, but it seemed to work like a normal recursive function.

EDIT: GCC doesn't seem to do anything different with the assembly if it's inlined, even if it's not recursive. Apparently it's just a suggestion to the compiler to make it inline.


Inlined functions should be defined in headers.

Recursive functions can be inlined (and the first call often is), but there's (obv) a static depth limit and a callable function still has to be generated.

You may be interested in what the (C++ draft §7.1.2, 9.3.3) standard has to say.
More info:
http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Inline.html
http://msdn.microsoft.com/en-us/library ... 80%29.aspx
http://publib.boulder.ibm.com/infocente ... plr243.htm
Bisquick boxes are a dead medium.

qbg
Posts: 586
Joined: Tue Dec 18, 2007 3:37 pm UTC

Re: Coding: Fleeting Thoughts

Postby qbg » Mon Aug 09, 2010 12:04 am UTC

I've been thinking about how one might type check dynamically typed languages. Where as type checkers for statically typed languages reject programs if they can't prove that the program has no type errors, my idea currently revolves around the idea of a type checker that only rejects programs if it can prove that a type error will occur. (Perhaps people who like dynamically typed languages live in a mirror universe than those who like statically typed ones?)

The big disadvantage of such an approach is that you make the guarantees provided by the type checker much weaker. For instance, if Bar is a subtype of Foo, calling a function that takes a Foo with a Bar will work as usual, but the type checker will not reject a program that calls a function that takes a Bar with a Foo because the object of type Foo might actually be a Bar.

All is not lost with such an approach; this perversion of types can be narrowly contained in the type checker, allowing an easy extension of it that will allow printing of a note or rejection of the code if the user so desires, however, for such options to be useful, the type model must be more sophisticated than it would otherwise need to be to accept code that obviously works. For instance, if fib has the type (Integer) -> Integer, and n has type Integer, then one needs to support polymorphism to the degree to allow - to have the type (Integer, Integer) -> Integer as well as its normal type of (Number, Number) -> Number to allow (fib (- n 1)) to pass type checking.

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 » Mon Aug 09, 2010 2:47 am UTC

FT:

I just saw this is a CAPTCHA:
screenshot1.png
screenshot1.png (17.07 KiB) Viewed 6076 times


Yes, I had to refresh a few times to get that, but the reason I was refreshing was that it kept coming up with weird non-Latin letters. Once it had a long squiggly line.
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? » Mon Aug 09, 2010 6:24 am UTC

The sad part is that many CAPTCHAs today are so efficient I require more attempts than decent CAPTCHA-breaking software does.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

Maelstrom.
Posts: 76
Joined: Tue Oct 21, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Maelstrom. » Mon Aug 09, 2010 6:42 am UTC

You, sir, name? wrote:The sad part is that many CAPTCHAs today are so efficient I require more attempts than decent CAPTCHA-breaking software does.

And you were doing so well! I'm afraid that you just failed the Turing test. Better luck next time!

Posi
Posts: 111
Joined: Mon Jul 16, 2007 6:08 am UTC

Re: Coding: Fleeting Thoughts

Postby Posi » Mon Aug 09, 2010 9:58 pm UTC

I was going to post yesterday about my newfound love of Ruby, but didn't out of a combination of laziness and desire to keep coding.

However, I am going to post because I want to punch Ruby's Qt binding straight in the face. It has actually worked quite well so far (which is what makes it all the more frustrating). In general QString become's Ruby's built in string class, and QClassName becomes Qt::ClassName. All functions work the same and take the same parameters. Except Qt::TableWidgetItem. It's constructor does not take a string, nor does it have the setText method. This renders it pretty useless since the whole point of the class is to store a string for Qt::TableWidget to use. FML.

Now the funny part is, using Qt::TableWidget was only meant to be a temporary solution. It was only chosen as a holdover to get the proof of concept working. The next step would be to replace it with a customized widget. Still, I've kinda nerd snipped myself and want to get it to work with Qt::TableWidget so I can say I did.

Anyways, that was my weekend.

troyp
Posts: 557
Joined: Thu May 22, 2008 9:20 pm UTC
Location: Lismore, NSW

Re: Coding: Fleeting Thoughts

Postby troyp » Mon Aug 09, 2010 10:37 pm UTC

I discovered something new just now.
I remembering ages ago investigating the "is" operator, which tests object identity. I found that it would give True for a comparison of two identical string literals: it seems Python caches these for reuse (I later learned it's called "string interning"). However, if you assign the literals to variables, it makes new string objects and they compare False under "is".
Small numbers also compared equal under "is", but this was different. You could assign them to variables and they still gave True. When I used "id" to check the addresses of integer constants, consecutive numbers had consecutive increasing addresses that were independent of the order in which I introduced them. It appears that Python preloads a bunch of integers into memory when it loads. As expected, there's a limit on the sizes of integers that this works for: when I used a loop to test it, I found a fairly small limit.

Anyhow, I was just thinking about this and I couldn't remember the limit: I'm thinking a few hundred, but I have this memory that it works with much bigger numbers... So I wrote another loop to find it. However, this time I used an eval function with string interpolation like this...

Code: Select all

while eval("%d is %d"%(5,5)):
   i += 1
...it took *forever*. I'm waiting, thinking "wow, this eval is *really* slow!". So I halted it and checked i: it's up to 2.6 million. Still, this eval is really slow. I wrote another loop using parallel variables...it failed at i=257 :idea: [1]
I tried using id on numbers over 256:

Code: Select all

>>> id(500)
11272864
>>> id(400)
11272948
>>> id(200)
9725836
>>> id(100)
9725052
Sure enough, numbers up to 256 have their addresses preassigned; over 256 they get them when you first use them. Over 256, they compare identical under "is" when compared as literals, but *not* when assigned to variables.

So it seems as well as preloading small integers, Python also caches large ones, just like it does with strings.

Who knew?

[1] Fortunately, I was anal enough to reset i to 1.

qbg
Posts: 586
Joined: Tue Dec 18, 2007 3:37 pm UTC

Re: Coding: Fleeting Thoughts

Postby qbg » Mon Aug 09, 2010 11:54 pm UTC

troyp wrote:So it seems as well as preloading small integers, Python also caches large ones, just like it does with strings.

Who knew?

If Python used fixnums, then that would hold for a much wider range of integers.

troyp
Posts: 557
Joined: Thu May 22, 2008 9:20 pm UTC
Location: Lismore, NSW

Re: Coding: Fleeting Thoughts

Postby troyp » Tue Aug 10, 2010 4:59 am UTC

Hmm...Ruby has fixnums, as well as Lisp, right?
How do they work exactly? Would it mean that a variable name is associated with a value rather than a reference, but with the language "pretending" these values are normal, numerical objects? So if two fixnum variables had the same value, that value would be stored twice (albeit just as efficiently as a reference to an object), but when Python looks at them it checks the values and says "these are the same object, which is an instance of class Fixnum".
Or have I got it all wrong?

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

Re: Coding: Fleeting Thoughts

Postby Xanthir » Tue Aug 10, 2010 2:52 pm UTC

A fixnum is just what you call an "int" in C (modulo some possible size differences).

But yeah, it can store them nice and efficiently by value, with a simple tag indicating their class (that's why fixnums aren't usually actually 32-bit - they usually reserve a few bits for tagging purposes).
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

|Erasmus|
Branson
Posts: 2643
Joined: Tue Oct 30, 2007 7:53 am UTC
Location: Sydney, Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby |Erasmus| » Wed Aug 11, 2010 6:47 am UTC

I believe I have deleted approximately 7 times as much code as I have written so far this week. I have also fixed a number of bugs... Sometimes I worry about some of the people I work with.

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 Aug 12, 2010 7:50 pm UTC

FT:

Graphical "Hello world" in the Genie programming language: (259 bytes)

Code: Select all

class MainWindow: Gtk.Window
  construct 
()
    var b = new Gtk.Button.with_label ("Hello, world!")
    b.clicked.connect (Gtk.main_quit)
    add (b)
    show_all ()

init
  Gtk
.init (ref args)
  var window = new MainWindow
  Gtk
.main () 


Exact duplicate in Python: (335 bytes)

Code: Select all

#!/usr/bin/python

import gtk;

class MainWindow ():
  def __init__ (self):
    self.window = gtk.Window (gtk.WINDOW_TOPLEVEL)
    self.= gtk.Button ("Hello, world!")
    self.b.connect ("clicked", gtk.main_quit)
    self.window.add (self.b)
    self.window.show_all ()

def init ():
  window = MainWindow ()
  gtk.main ()
  
init 
() 

Not to mention that it compiles to native code and works with just about any C library.
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
Moo
Oh man! I'm going to be so rebellious! I'm gonna...
Posts: 6437
Joined: Thu Aug 16, 2007 3:15 pm UTC
Location: Beyond the goblin city
Contact:

Re: Coding: Fleeting Thoughts

Postby Moo » Fri Aug 13, 2010 7:42 am UTC

Fleeting thought: this subforum just creates feelings of inadequacy in my C# writing, functional language ignorant, self. I need to learn something new. Maybe Project Euler is worth revisiting to this end.
Proverbs 9:7-8 wrote:Anyone who rebukes a mocker will get an insult in return. Anyone who corrects the wicked will get hurt. So don't bother correcting mockers; they will only hate you.
Hawknc wrote:FFT: I didn't realise Proverbs 9:7-8 was the first recorded instance of "haters gonna hate"

elminster
Posts: 1560
Joined: Mon Feb 26, 2007 1:56 pm UTC
Location: London, UK, Dimensions 1 to 42.
Contact:

Re: Coding: Fleeting Thoughts

Postby elminster » Fri Aug 13, 2010 1:21 pm UTC

Moo wrote:Fleeting thought: this subforum just creates feelings of inadequacy in my C# writing, functional language ignorant, self. I need to learn something new. Maybe Project Euler is worth revisiting to this end.
I was writing up a tool in C# recently, one part of it I hacked together just for the time being; it worked fine, looked clean, but wasn't the "correct" way to do it. I came to replace it later on, C# had a mechanism for it, after going through pages and pages of documentation I implemented it and it almost worked properly but, for some reason, part of it wasn't working correctly* (Namely data binding on scroll bars doesn't always work as expected when scrolling in a certain way). I thought "fk it", and left it since it wasn't even that important.
However, result of reading so much documentation is the understanding of how many powerful features C# has; it just made me wish I knew them all.

*Also validation events don't fire on some menustrip items, despite saying "causes validation: true". I can't be bothered to deal with it =/

I never had a look at QT until now. It is actually pretty cool.
Last edited by elminster on Sat Aug 14, 2010 5:15 pm UTC, edited 1 time in total.
Image

User avatar
Xeio
Friends, Faidites, Countrymen
Posts: 5101
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\
Contact:

Re: Coding: Fleeting Thoughts

Postby Xeio » Fri Aug 13, 2010 1:57 pm UTC

I'm pretty sure validation is universally painful unless you need to do only the most trivial things. :P

User avatar
Cxo
Posts: 14
Joined: Thu Aug 12, 2010 6:58 pm UTC

Re: Coding: Fleeting Thoughts

Postby Cxo » Fri Aug 13, 2010 5:13 pm UTC

Moo wrote:Fleeting thought: this subforum just creates feelings of inadequacy in my C# writing, functional language ignorant, self. I need to learn something new. Maybe Project Euler is worth revisiting to this end.


Have you considered F#? It's a first class .NET language in which you can do both functional and object oriented programming, and it is a good step into a functional language if you're used to C#.

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

Re: Coding: Fleeting Thoughts

Postby Pesto » Fri Aug 13, 2010 10:02 pm UTC

Oh me yarm, I love git.

In svn when you "move" a file, svn does this by deleting the old file, then creating the new file. Git has an actual "move" command so it knows that "foo.src" became "bar.src". Well, I moved a file without using the git mv command, so it showed up as an added file and a deleted file. Except, when I added the new file and the deleted file to the index, git detected that they were the same file and marked them as moved, even though I had already made edits. I'm guessing it checked the inode number, or some such.

In short: How spiffy!

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

Re: Coding: Fleeting Thoughts

Postby Pesto » Fri Aug 13, 2010 11:10 pm UTC

Dammit, I need an IDE.

Until now I've been developing in PuTTY windows using vim, and it has worked well enough. I have three windows open. One to write unit tests, one to write code, and one to run unit tests. That has been no problem.

I had to open a fourth window for something I was doing and my brain exploded trying to keep track of them.

|Erasmus|
Branson
Posts: 2643
Joined: Tue Oct 30, 2007 7:53 am UTC
Location: Sydney, Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby |Erasmus| » Fri Aug 13, 2010 11:38 pm UTC

Pesto wrote:Gee Willikers, I love git.

In svn when you "move" a file, svn does this by deleting the old file, then creating the new file. Git has an actual "move" command so it knows that "foo.src" became "bar.src". Well, I moved a file without using the git mv command, so it showed up as an added file and a deleted file. Except, when I added the new file and the deleted file to the index, git detected that they were the same file and marked them as moved, even though I had already made edits. I'm guessing it checked the inode number, or some such.

In short: How spiffy!

I believe it actually just detects that if you delete a file, and create a new file with similar (not sure how similar will trigger this!) content, it will preserve the history of the deleted file for the new one.

cogman
Posts: 112
Joined: Sun May 18, 2008 2:17 pm UTC

Re: Coding: Fleeting Thoughts

Postby cogman » Sat Aug 14, 2010 12:30 am UTC

VS is the greatest IDE on the planet... End of story.

User avatar
headprogrammingczar
Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

Re: Coding: Fleeting Thoughts

Postby headprogrammingczar » Sat Aug 14, 2010 2:15 pm UTC

Pesto wrote:Dammit, I need an IDE.

Until now I've been developing in PuTTY windows using vim, and it has worked well enough. I have three windows open. One to write unit tests, one to write code, and one to run unit tests. That has been no problem.

I had to open a fourth window for something I was doing and my brain exploded trying to keep track of them.

When I get overloaded by windows, it usually means I am trying to multitask too much. If you need to do something else, you don't need to run unit tests at the same time, so use that window.
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Weeks> You're the goddamn headprogrammingspock!
<Cheese> I love you

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

Re: Coding: Fleeting Thoughts

Postby Xanthir » Sat Aug 14, 2010 7:48 pm UTC

Use multiple workspaces/desktops. Every desktop has windows for a different task. That way you never get overloaded with too many windows on one screen.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

squareroot
Posts: 548
Joined: Tue Jan 12, 2010 1:04 am UTC
Contact:

Re: Coding: Fleeting Thoughts

Postby squareroot » Sat Aug 14, 2010 8:37 pm UTC

When browsing the web, I'll easily have around 150 tabs open at a time. And they'll be spread across three or four windows.
<signature content="" style="tag:html;" overused meta />
Good fucking job Will Yu, you found me - __ -

User avatar
Dason
Posts: 1311
Joined: Wed Dec 02, 2009 7:06 am UTC
Location: ~/

Re: Coding: Fleeting Thoughts

Postby Dason » Sat Aug 14, 2010 8:39 pm UTC

squareroot wrote:When browsing the web, I'll easily have around 150 tabs open at a time. And they'll be spread across three or four windows.

Impressive. The most I usually have open is like 20. And that's when browsing the forums. I just open a bunch of threads that I want to read and then read them sequentially instead of going back to an index every time.
double epsilon = -.0000001;

User avatar
NieXS
Why's the rum gone?
Posts: 286
Joined: Wed Mar 12, 2008 3:10 am UTC
Location: Brazil

Re: Coding: Fleeting Thoughts

Postby NieXS » Mon Aug 16, 2010 4:16 am UTC

Best stack trace ever:
Spoiler:

Code: Select all

[Seg 10/08/16 01:08 BRT][pts/2][x86_64/linux-gnu/2.6.34-ARCH][4.3.10]
<eduardo@numenor:~>                                                                                                                                                                 
zsh/4 1004 % qbittorrent
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 14 (X_GetGeometry)
  Resource id:  0x3a00002
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 14 (X_GetGeometry)
  Resource id:  0x3a00002
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
  Major opcode: 14 (X_GetGeometry)
  Resource id:  0x3a00002
Peer ID: -qB2300-
HTTP user agent is qBittorrent v2.3.0


*************************************************************
Catching SIGSEGV, please report a bug at http://bug.qbittorrent.org
and provide the following backtrace:
stack trace:
  /lib/libc.so.6 : ()+0x325e0  [0x7f47f0eb25e0]
  /usr/lib/gtk-2.0/2.10.0/engines/libqt4engine.so : ()+0xe544  [0x7f47e3e8e544]
  /usr/lib/gtk-2.0/2.10.0/engines/libqt4engine.so : ()+0xa80f  [0x7f47e3e8a80f]
  /usr/lib/libQtGui.so.4 : ()+0x515f3a  [0x7f47f261cf3a]
  /usr/lib/libQtGui.so.4 : QGtkStyle::drawPrimitive(QStyle::PrimitiveElement, QStyleOption const*, QPainter*, QWidget const*) const+0x15fe  [0x7f47f260d4ae]
  /usr/lib/libQtGui.so.4 : ()+0x4c17b4  [0x7f47f25c87b4]
  /usr/lib/libQtGui.so.4 : QTabWidget::paintEvent(QPaintEvent*)+0x468  [0x7f47f2700ef8]
  /usr/lib/libQtGui.so.4 : QWidget::event(QEvent*)+0x654  [0x7f47f2303244]
  /usr/lib/libQtGui.so.4 : QApplicationPrivate::notify_helper(QObject*, QEvent*)+0xb4  [0x7f47f22b3854]
  /usr/lib/libQtGui.so.4 : QApplication::notify(QObject*, QEvent*)+0x11a  [0x7f47f22b793a]
  /usr/lib/libQtCore.so.4 : QCoreApplication::notifyInternal(QObject*, QEvent*)+0x8c  [0x7f47f1ad5d3c]
  /usr/lib/libQtGui.so.4 : QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)+0x3d8  [0x7f47f22fe678]
  /usr/lib/libQtGui.so.4 : QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)+0x46f  [0x7f47f22ff23f]
  /usr/lib/libQtGui.so.4 : QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)+0x11a  [0x7f47f22fe3ba]
  /usr/lib/libQtGui.so.4 : QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)+0x46f  [0x7f47f22ff23f]
  /usr/lib/libQtGui.so.4 : QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*)+0x32c  [0x7f47f22ff0fc]
zsh: segmentation fault  qbittorrent
In related news, I found out what happens if you set GTK to use Qt's rendering engine, and Qt to use GTK's.
she/her


User avatar
Moo
Oh man! I'm going to be so rebellious! I'm gonna...
Posts: 6437
Joined: Thu Aug 16, 2007 3:15 pm UTC
Location: Beyond the goblin city
Contact:

Re: Coding: Fleeting Thoughts

Postby Moo » Mon Aug 16, 2010 8:57 am UTC

Cxo wrote:Have you considered F#? It's a first class .NET language in which you can do both functional and object oriented programming, and it is a good step into a functional language if you're used to C#.
Thank you, I will check it out.
Proverbs 9:7-8 wrote:Anyone who rebukes a mocker will get an insult in return. Anyone who corrects the wicked will get hurt. So don't bother correcting mockers; they will only hate you.
Hawknc wrote:FFT: I didn't realise Proverbs 9:7-8 was the first recorded instance of "haters gonna hate"

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 » Tue Aug 17, 2010 3:09 am UTC

FT: I ought to write a note of the back of my hand saying, "ARRAYS START WITH [0], IDIOT!!!".

See the segfault?

Code: Select all

while (active > shapes.size ()) --active;
shapes[active].draw (ctx);
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.

0xBADFEED
Posts: 687
Joined: Mon May 05, 2008 2:14 am UTC

Re: Coding: Fleeting Thoughts

Postby 0xBADFEED » Thu Aug 19, 2010 2:50 pm UTC

cogman wrote:VS is the greatest IDE on the planet... End of story.

Why oh why did they put the "Rebuild" right next to "Build" in the C++ project context menu? Thanks VS I really wanted a 20 minute full rebuild when a 10-second incremental build would have been fine, because my pointer was off by a few pixels.

Axidos
Posts: 167
Joined: Tue Jan 20, 2009 12:02 pm UTC
Location: trapped in a profile factory please send help

Re: Coding: Fleeting Thoughts

Postby Axidos » Thu Aug 19, 2010 3:06 pm UTC

0xBADFEED wrote:
cogman wrote:VS is the greatest IDE on the planet... End of story.

Why oh why did they put the "Rebuild" right next to "Build" in the C++ project context menu? Thanks VS I really wanted a 20 minute full rebuild when a 10-second incremental build would have been fine, because my pointer was off by a few pixels.

Would the hotkey be more convenient/safe? I think it is F6.

0xBADFEED
Posts: 687
Joined: Mon May 05, 2008 2:14 am UTC

Re: Coding: Fleeting Thoughts

Postby 0xBADFEED » Thu Aug 19, 2010 3:22 pm UTC

Axidos wrote:Would the hotkey be more convenient/safe? I think it is F6.

I use the hotkeys, but sometimes I'm already at my mouse and it's more convenient to use the context menu. And sometimes I want an incremental build of a specific project, without building any other higher-level projects and it's easier to just go the context menu of that project. And if your solution is "don't use the context menu" then that's pretty strong vindication that the build context menu is thoroughly borked.

But seriously full rebuilds are so infrequent I don't really think it deserves a place on the context menu. Or at least not a place so incredibly close to the item for a fairly frequent event. It's like putting the "Destroy Universe" button next to the "Free Coffee" button.

User avatar
Dason
Posts: 1311
Joined: Wed Dec 02, 2009 7:06 am UTC
Location: ~/

Re: Coding: Fleeting Thoughts

Postby Dason » Thu Aug 19, 2010 6:58 pm UTC

0xBADFEED wrote:It's like putting the "Destroy Universe" button next to the "Free Coffee" button.

To be fair both of those are fine choices.
double epsilon = -.0000001;


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 9 guests