Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
nbv4
Aug 21, 2002

by Duchess Gummybuns

Avenging Dentist posted:

Get rid of the newlines in the regex (obviously don't do this in the post :)).

aw super, that did the trick. I feel dumb now.

Adbot
ADBOT LOVES YOU

talaena
Aug 30, 2003

Danger Mouse! Power House!
I was hoping someone could enlighten me on a PHP/SSL problem I am experiencing. I have narrowed this down to one very simple PHP command that works through firefox, but fails via the php cli. Esentially, I can't load any url that starts with https:

/ # cat t.php
<?
echo "HTTPS:\n".file_get_contents('https://www.google.co.uk/ig?hl=en');
?>
/ #

Simple command to go get a web page. If I load it through firefox, I get the google webpage. If I go to a command line and run 'php t.php' I get:

Warning: file_get_contents(): SSL: No such file or directory in t.php on line 2
Warning: file_get_contents(): Failed to enable crypto in t.php on line 2
Warning: file_get_contents(https://www.google.co.uk/ig?hl=en): failed to open stream: Invalid argument in t.php on line 2

If I change it to http: it loads just fine on the command-line and via firefox. I'm assuming I've either compiled PHP incorrectly and/or I am missing something glaringly obvious. My searches through google haven't been successful, but I think that's mainly due to my inexperience with PHP; I've only been working with this for a couple weeks. I don't really know what to search google for beyond the error code s themselves.

I am Running HP/UX 11.11 with php 5.2.5 and apache 2.0.58.

/ # uname -a
HP-UX bob B.11.11 U 9000/800 2002324811 unlimited-user license

/# php -v
PHP 5.2.5 (cli) (built: Feb 27 2008 13:58:33)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

bitprophet
Jul 22, 2004
Taco Defender
Yea, you probably managed to compile the CLI version of PHP without SSL support, but mod_php (which is often a separate package in package managers) with. I don't remember if phpinfo() gives meaningful output when run via CLI, but if it does, that should make it explicit - it would list the build args and all the modules it's got set up.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Who loves pthreads? You, I hope!!

I could wax poetic about my complaints with my operating systems class, but suffice it to say that I'm a bit lost when it comes to the pthread part of the current assignment.

The assignment is to write a server for a subset of HTTP - technically, we do this three times: once using fork(), once using pthreads, and once using select() to handle concurrent queries. Since, strangely, he hasn't said word one about pthreads in class, I'm rather lost on this.

So we would like the server to be able to handle an arbitrary number of queries at the same time, so I would like to do something like

code:
if (accept(...) > 0)
{
  pthread_t theThread;

  pthread_create(&theThread, NULL, handle_connection, 0);
}
Where handle_connection is the entry point for the thread, etc, etc. But from what I can gleam from the internet, obviously, if another connection is attempted as the first one is still going on, the variable theThread will be overwritten and horrible things would happen, since (I'm told) each thread maintains a stack frame starting from the entry point to the thread, not the calling function thereof. So, what about

code:
if (accept(...) > 0)
{
  pthread_create((pthread *)malloc(sizeof(pthread_t)), NULL, handle_connection, 0);
}
? Obviously this is bad because we can't free that memory. So we have a chicken/egg problem, and yet I feel like this something that commonly happens in real-world software, so there has to be a solution (and, I would argue, a simple one at that).

Oh god, tell me what to do so I can go back to writing Java ( :v: )

KaeseEs
Feb 23, 2007

by Fragmaster
e: this was some very wrong information, ignore

KaeseEs fucked around with this message at 12:22 on Mar 5, 2008

more falafel please
Feb 26, 2005

forums poster

Mercurial question, couldn't think of a better place to ask:

I'm setting up Mercurial to mirror an SVN repository with hgsvn. I'm on OS X. I installed mercurial with the usual sudo make install, and it seems to have installed the modules to /usr/local/lib/python-2.5/site-packages. With my PYTHONPATH set to that directory, I'm able to run 'hg' without it failing import, so that seems to be working. But when I run hgimportsvn, it fails:
code:
$ hgimportsvn [url]http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/Editra[/url]
* svn 'info' '--xml' 'http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/Editra'
* svn 'log' '--xml' '-v' '--stop-on-copy' '-r' '1:52326' '--limit' '1' 'http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/Editra'
SVN branch isn't a copy
* hg '--encoding' 'utf-8' 'init'
Traceback (most recent call last):
  File "/usr/local/bin/hgimportsvn", line 8, in <module>
    load_entry_point('hgsvn==0.1.5', 'console_scripts', 'hgimportsvn')()
  File "/Library/Python/2.5/site-packages/hgsvn-0.1.5-py2.5.egg/hgsvn/run/hgimportsvn.py", line 96, in main
  File "/Library/Python/2.5/site-packages/hgsvn-0.1.5-py2.5.egg/hgsvn/common.py", line 170, in run_hg
  File "/Library/Python/2.5/site-packages/hgsvn-0.1.5-py2.5.egg/hgsvn/common.py", line 122, in run_command
  File "/Library/Python/2.5/site-packages/hgsvn-0.1.5-py2.5.egg/hgsvn/common.py", line 96, in _run_raw_command
hgsvn.errors.ExternalCommandFailed: External program failed (return code 1): hg '--encoding' 'utf-8' 'init'
Traceback (most recent call last):
  File "/usr/local/bin/hg", line 11, in <module>
    from mercurial import demandimport; demandimport.enable()
ImportError: No module named mercurial
I also tried with:
code:
$ PYTHONPATH=/usr/local/lib/python-2.5/site-packages hgimportsvn [url]http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/Editra[/url]
And get the same error.

Anyone used hgsvn on OS X before and have some suggestions?

Allie
Jan 17, 2004

I normally run "sudo python setup.py install" when I install Mercurial. I don't know if the Makefile differs, but the local site-packages directory is in /Library/Python/2.5/site-packages/ on 10.5, and I believe it lives inside the Python.framework folder on 2.4.

more falafel please
Feb 26, 2005

forums poster

Milde posted:

I normally run "sudo python setup.py install" when I install Mercurial. I don't know if the Makefile differs, but the local site-packages directory is in /Library/Python/2.5/site-packages/ on 10.5, and I believe it lives inside the Python.framework folder on 2.4.

That worked. Thanks!

talaena
Aug 30, 2003

Danger Mouse! Power House!

bitprophet posted:

Yea, you probably managed to compile the CLI version of PHP without SSL support, but mod_php (which is often a separate package in package managers) with. I don't remember if phpinfo() gives meaningful output when run via CLI, but if it does, that should make it explicit - it would list the build args and all the modules it's got set up.


I run php -m from the command line and I get:
/ # p -m
[PHP Modules]
ctype
...
openssl
...
[Zend Modules]
/ #

That leads me to believe I have openssl compiled properly, I think. Since the apache/php combo works, perhaps Apache loads some kind of environment variable that I do not have set at the shell. "SSL: No such file or directory" is so incredibly non-descriptive, I have no clue what to look for. I wish I could print more detailed error message about what it is expecting.

Careful Drums
Oct 30, 2007

by FactsAreUseless
In Assembly, I need to print out the string

"The sum of the integers is"

And after hauling rear end doing messed up packed binary addition in Assembly, I can't do this WAAGH HALP

csammis
Aug 26, 2003

Mental Institution

Careful Drums posted:

In Assembly, I need to print out the string

"The sum of the integers is"

And after hauling rear end doing messed up packed binary addition in Assembly, I can't do this WAAGH HALP

What kind of assembly? What architecture? Are you using a library, or pure assembly code?

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
You need to answer csammis's questions but generally your assembler should have some way to store a string constant as a variable in memory. Now all you have to do is send that variable as an argument to whatever function you are using to print.

If your using 16 bit x86 DOS you can just call int 21h.

quote:

INT 21 - DOS 1+ - WRITE STRING TO STANDARD OUTPUT
AH = 09h
DS : DX -> '$'-terminated string
Return: AL = 24h (the '$' terminating the string, despite official docs which
state that nothing is returned) (at least DOS 2.1-7.0 and
NWDOS)
Notes: ^C/^Break are checked, and INT 23 is called if either pressed
standard output is always the screen under DOS 1.x, but may be
redirected under DOS 2+
under the FlashTek X-32 DOS extender, the pointer is in DS:EDX
SeeAlso: AH=02h,AH=06h"OUTPUT"

Here's a tiny example, but be advised that this isn't the best way to do it since it's old school DOS.
code:
message db 'Hello World!$'
print:
   mov dx, offset message
   mov ah, 09
   int 21h

Janitor Prime fucked around with this message at 10:36 on Mar 6, 2008

Alan Greenspan
Jun 17, 2001

I have no clue about graphics programming so I don't know what keywords to google for. I have a set of rectangles I need to draw onto a 2D plane and I need to find out which rectangles are actually visible and which are hidden by other rectangles and don't need to be drawn (I have a Z-order on the rectangles).

Since I'm pretty drat sure that this is a problem that was solved at least 40 years ago I don't want to invent my own algorithm.

What keywords can I google for? What standard algorithms exist?

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender
If you're actually drawing filled rectangles, and you have a strong z-ordering, then a very simple, fast, and easy to optimize algorithm is to simply draw all of them, starting from the back and moving to the front. This is the simplest kind of fragment rendering, imposes almost no overhead when there are few overlaps, and can be implemented in very small code with no conditionals that only has to consider one rectangle at a time.

If you just want to find out which rectangles are visible, there are a few things you can do. Possibly the best is to render them as above into an off-screen buffer somewhere, each with a separate color, then check all the pixels in your buffer to determine which colors are visible. Other algorithms exist, but tend to have higher complexity in the number of objects in exchange for not being pixel-bound as the rendering approach is, and are usually only worthwhile when you have more complicated objects than rectangles.

Alan Greenspan
Jun 17, 2001

ShoulderDaemon posted:

If you're actually drawing filled rectangles, and you have a strong z-ordering, then a very simple, fast, and easy to optimize algorithm is to simply draw all of them, starting from the back and moving to the front. This is the simplest kind of fragment rendering, imposes almost no overhead when there are few overlaps, and can be implemented in very small code with no conditionals that only has to consider one rectangle at a time.
Unfortunately just drawing them is not possible. In the application a realistic number of rectangles is up to 200K and I want to be able to handle up to 1 million rectangles. Furthermore the rectangles are non-trivial to draw because of their content.

The good news is that the average screen is so small that more than like 100 rectangles are probably not visible at the same time unless the user is an rear end in a top hat Asperger headcase who gives each rectangle exactly one pixel of screen space in which case a single redraw probably takes half an hour. However I still need to find out which 100 rectangles to draw and which 999.900 not to draw.

quote:

Possibly the best is to render them as above into an off-screen buffer somewhere, each with a separate color, then check all the pixels in your buffer to determine which colors are visible.

This is actually really cute. Thanks for the suggestion.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Alan Greenspan posted:

I want to be able to handle up to 1 million rectangles.

At this many geometry elements, you're not going to be able to do much better than the offscreen drawing mechanism, and caching the result. You're far more geometry-dominated than pixel-dominated, so many of the common alternative algorithms are going to be worse than the naive algorithm. If the rectangles move around, especially if they only move by small amounts, then there may be some updateable structures that will work marginally better than the naive method, but frankly at this point you'll have the most luck with naive drawing to an offscreen buffer, and making your drawing code as small and condition-free as you can, so you can run out of cache and avoid stalling.

iamstinky
Feb 4, 2004

This is not as easy as it looks.
Does anyone know how to dynamically add an image to a pdf form using an xfdf or fdf or similar technique?

I would like to be able to generate a bunch of server side data including a photo, but I have to be able to create the information at run time.

We use xfdfs to populate forms at runtime, but I cannot for the life of me figure out how to add an image at run time at all.

axolotl farmer
May 17, 2007

Now I'm going to sing the Perry Mason theme

I'm making a bash script where I need to echo $VARIABLE number of something on a line, let's say Xs.

Like this, the unknown command is [?]:

alice=5
bob=7
echo "Alice [?]"
echo "Bob [?]"


...and get this output:

Alice XXXXX
Bob XXXXXXX

odi3
Dec 17, 2003
Is there a better method to put a struct into a buffer in c using sprintf instead of referencing each of the doubles seperately?
This method seems to defeat the idea of using a structure....

code:

struct Car {
	int PlayerID;
	double PositionX;
	double PositionY;
	double PositionZ;
	double VelocityX;
	double VelocityY;
	double VelocityZ;
	double OrientationX;
	double OrientationY;
	double OrientationZ;
} myCar;

sprintf (buffer, "%d/%d/%d/%d/%d/%d/%d/%d/%d/%d ", 
myCar.PlayerID, myCar.PositionX, myCar.PositionY, myCar.PositionZ, 
myCar.VelocityX, myCar.VelocityY, myCar.VelocityZ, myCar.OrientationX, 
myCar.OrientationY, myCar.OrientationZ);

odi3 fucked around with this message at 05:21 on Mar 8, 2008

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Unless you want to use C++, the only way I can think of would be to use preprocessor macros. Something like
code:
#define CAR_FORMAT "%d/%d/%d/%d/%d/%d/%d/%d/%d/%d"
#define PRINT_CAR(car) (car).PlayerID,(car).PositionX,(car).PositionY, \
	(car).PositionZ,(car).VelocityX,(car).VelocityY,(car).VelocityZ, \
	(car).OrientationX,(car).OrientationY,(car).OrientationZ



printf("Here is my car: " CAR_FORMAT,PRINT_CAR(myCar));

more falafel please
Feb 26, 2005

forums poster

Avenging Dentist posted:

Unless you want to use C++, the only way I can think of would be to use preprocessor macros. Something like
code:
#define CAR_FORMAT "%d/%d/%d/%d/%d/%d/%d/%d/%d/%d"
#define PRINT_CAR(car) (car).PlayerID,(car).PositionX,(car).PositionY, \
	(car).PositionZ,(car).VelocityX,(car).VelocityY,(car).VelocityZ, \
	(car).OrientationX,(car).OrientationY,(car).OrientationZ



printf("Here is my car: " CAR_FORMAT,PRINT_CAR(myCar));

Couldn't you just write a function? Unless you want to sprintf other stuff as well -- like:
code:
sprintf(buffer, "Car name is %s and looks like: " CAR_FORMAT "\n", car_name, PRINT_CAR(car));

Wuhao
Apr 22, 2002

Pimpin' Lenin
Is there an algorithm for exhaustively generating all unordered subsets of a particular set?

Basically, if you imagine a set of 6 elements, each of which can be an integer 0-9, then there are 5005 unique, unordered sets (eg. { 0 0 0 0 0 1 } and { 1 0 0 0 0 0 } are identical). I'd like to generate all 5005 of these, without wasting any time generating duplicates (obviously, I could walk through generating all 1,000,000 ordered sets -- but then I'd just feel silly!). Is anyone aware of an algorithm which does this?

more falafel please
Feb 26, 2005

forums poster

Wuhao posted:

Is there an algorithm for exhaustively generating all unordered subsets of a particular set?

Basically, if you imagine a set of 6 elements, each of which can be an integer 0-9, then there are 5005 unique, unordered sets (eg. { 0 0 0 0 0 1 } and { 1 0 0 0 0 0 } are identical). I'd like to generate all 5005 of these, without wasting any time generating duplicates (obviously, I could walk through generating all 1,000,000 ordered sets -- but then I'd just feel silly!). Is anyone aware of an algorithm which does this?

Sounds like you want the power set (the set of all subsets of a set). It's relatively nontrivial, your best bet is a dynamic programming approach where you memoize the sets you've already generated so that you don't generate duplicates.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

more falafel please posted:

Sounds like you want the power set (the set of all subsets of a set). It's relatively nontrivial, your best bet is a dynamic programming approach where you memoize the sets you've already generated so that you don't generate duplicates.

He doesn't want power set, he wants the subsets of a power set where all elements are length n length n unordered lists generated by a set.

code:
The sets function takes a size and a range,
and produces all sets of that size over that range.

> sets :: Integer -> (Integer,Integer) -> [[Integer]]

There is only one size-zero set.

> sets 0 _ = [[]]

To generate the higher-order sets, we iterate through the range,
and generate all sets of one less order with a lower bound at least
as high as the first element.

> sets n (l,h) = concat [[x:s | s <- sets (n-1) (x,h)] | x <- [l,h]]

Easy. All I've done is generated the sets in a sorted order, by building them piece-by-piece and never adding an element to a set if there is already a higher element in that set.

Edit: Completely untested Perl:

code:
sub sets {
  my ( $length, $low, $high ) = @_;

  if ( $length == 0 ) {
    return [[]];
  } else {

    my @ret;

    foreach my $x ($low..$high) {

      my $tails = sets( $length - 1, $x, $high );

      foreach my $list ( @$tails ) {
        unshift @$list, $x;
        push @ret, $list;
      };

    };

   return \@ret;

  };

};

ShoulderDaemon fucked around with this message at 20:06 on Mar 8, 2008

Incoherence
May 22, 2004

POYO AND TEAR

ShoulderDaemon posted:

Easy. All I've done is generated the sets in a sorted order, by building them piece-by-piece and never adding an element to a set if there is already a higher element in that set.
I thought about that, but wouldn't that fall down when there are duplicate elements in the input set?

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Incoherence posted:

I thought about that, but wouldn't that fall down when there are duplicate elements in the input set?

Well, then it's not an input set, it's an input list, and you can do it by explicitly passing around the list of remaining elements, and chopping off prefixes of it. Or just keep the list out of band, and use an input set of integers from zero to (length of list)-1, then use those as indexes into the list.

Edit: The only time you can't do this is if there isn't a strong ordering you can impose on the input, which means the input has to be nonfinite, and hence the only length that terminates is length 0, so it doesn't matter.

ShoulderDaemon fucked around with this message at 20:08 on Mar 8, 2008

Incoherence
May 22, 2004

POYO AND TEAR

ShoulderDaemon posted:

Well, then it's not an input set, it's an input list, and you can do it by explicitly passing around the list of remaining elements, and chopping off prefixes of it. Or just keep the list out of band, and use an input set of integers from zero to (length of list)-1, then use those as indexes into the list.
You're not solving the problem: if your input set is {0, 1, 1, 2, 3} and you want all subsets of length 3, {1, 2, 3} using the first 1 is the same as {1, 2, 3} using the second 1. Example:
code:
sets({0, 1, 1, 2, 3}, 3) = union of
cons(0, sets({1, 1, 2, 3}, 2}) //a
cons(1, sets({1, 2, 3}, 2})    //b
cons(1, sets({2, 3}, 2})       //c
We'll ignore a for the moment. The recursive call in b will give you {1, 2} and {2, 3}, so you have {1, 1, 2} and {1, 2, 3}. The recursive call in c is trivially {2, 3}, so you have {1, 2, 3} again. Look, a duplicate!

Now that I look at it, you could solve that by not recurring on c, since b will necessarily return a superset of c. In other words, you'd need to add to ShoulderDaemon's algorithm that if the current element is equal to the previous element, don't recur.

Plastic Jesus
Aug 26, 2006

I'm cranky most of the time.

axolotl farmer posted:

I'm making a bash script where I need to echo $VARIABLE number of something on a line, let's say Xs.

Like this, the unknown command is [?]:

alice=5
bob=7
echo "Alice [?]"
echo "Bob [?]"


...and get this output:

Alice XXXXX
Bob XXXXXXX

I totally misread this and thought that you wanted to print the number of characters in a string. Which is actually awesome because I learned how to find out the length of a string in bash (it's ${#var_name} btw).

All that you need to do is
code:
alice=5
for(( i = 0; i < alice; i++ ))
do
   echo -n "X"
done
echo

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Incoherence posted:

You're not solving the problem: if your input set is {0, 1, 1, 2, 3} and you want all subsets of length 3, {1, 2, 3} using the first 1 is the same as {1, 2, 3} using the second 1.

Oh. I'd assumed that if you wanted to specify an input collection with duplicates, then that meant you wanted to break order invariance for the duplicated elements, because why else would you bother to have a representation of the input that even allowed duplicates? Transforming the input to a complete integer range and never passing around big partial collections seems far more reasonable, because you don't have to worry about sorting or uniqueness or any of that mess.

If you want the same behavior as if the input collection doesn't allow duplicates, but you still want to provide duplicates of some elements for some reason, then I'd just prefilter the input collection to remove them, which we can trivially do for a max of n ln n complexity cost (I think you can do n, but it's too late at night for me to be sure). Considering the rest of the algorithm is massively more complex by sheer size of output, there's no reason at all to try to do anything clever. The trivial construction involves a size n lookup table, but that's dwarfed by everything else and it's not like we're using memory for anything but the stack anyway.

axolotl farmer
May 17, 2007

Now I'm going to sing the Perry Mason theme

Plastic Jesus posted:

I totally misread this and thought that you wanted to print the number of characters in a string. Which is actually awesome because I learned how to find out the length of a string in bash (it's ${#var_name} btw).

All that you need to do is
code:
alice=5
for(( i = 0; i < alice; i++ ))
do
   echo -n "X"
done
echo

That was exactly what I needed. That get lenght of a string thing will be very useful for me too. I did that by

stringlength=`echo $string | wc -l`

x1o
Aug 5, 2005

My focus is UNPARALLELED!
What's the best or most flexible language to use for *nix scripting? Trying to write scripts in bash is quickly becoming an exercise in frustration.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Most *nix installs have Perl installed by default, so that might be your best choice.

zootm
Aug 8, 2006

We used to be better friends.
Perl tends to be the standard, yeah. I see a lot of scripts written in Ruby, of all things, these days too though, and Python support is pretty ubiquitous these days so that may be a good choice. Use whichever one you like so long as you know it's available to you.

x1o
Aug 5, 2005

My focus is UNPARALLELED!
I'll go with Perl for the moment, as I've been meaning to learn it for years.

FrontLine
Sep 17, 2003
I gave Mr. Adequate hot, steamy man love and all he bought me was a custom title!
If anybody can offer suggestions and ideas on this it'd be very much appreciated.

Situation: I've got a Python script that uploads a file to a certain site, waits for and then processes the reply into a specified format. This part works fine.

Problem: I now need a to create a front end for this script. I want a user to be able to visit a web page, select a file just like you would if visisted WaffleImages or such, and have the results processed.

Steps that need to be completed:
  • Have the previously mentioned Python script output the results in an XML file that is validated against a XML Schema file that I create.
  • The results are then displayed on another web page and is formatted according to a CSS file that I create and references that XML file from before.

Anything, and I mean anything, you guys have to offer would be greatly appreciated. Any tutorials, recommendations, suggestions etc. would be recommended. Please also suggest methods to accomplish what I've mentioned.

Also, what would be the best way to approach the XML part? I've been looking around but nothing in terms of 'Python on XML' documentation has been low level enough to help a newbie :(

Note: I posted this here 'cause I felt it was to broad for the Python thread or any of the others.

Nubile Cactus
Aug 1, 2004
I am a cactus. :)
Are there any good books or documents (preferably free, but if it's great I don't mind paying) on programming style and writing clean and easy to maintain code?

This is a bit vague, but I'd like to work on this as I think it's the weakest aspect of my programming abilities and I'd like to improve it. I have trouble separating code into different files to make it more readable and maintainable and I have an absolutely terrible habit of trying to write everything in one file.

I'm not sure if this is just from a lack of experience, but I hope someone has a few suggestions on this topic.

tef
May 30, 2004

-> some l-system crap ->
The Practice of Programming by Kernighan and Pike is an excellent tome on style and methodology.

It's short, concise and well written. A very accessible book with broad coverage with summaries at the end of each Chapter.

http://plan9.bell-labs.com/cm/cs/tpop/


If anything you will gain most experience from reviewing your own code and others, and asking people to do the same for your code (don't forget to write more code). A book will encourage you to think in a good way, but it will take time for the new practices to become standard.


P.s. feel free the resurect the last book thread

csammis
Aug 26, 2003

Mental Institution
:siren: Adding a link to the Cavern Reading List in the OP :siren:

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
What's the easiest way to go about making a toolbar button for the Windows Explorer? Creating a new toolbar is also an option, but probably overkill since I only want to add a single button.

Adbot
ADBOT LOVES YOU

FigBug
Apr 27, 2002

Lemon Party - Lest we Forget

Avenging Dentist posted:

What's the easiest way to go about making a toolbar button for the Windows Explorer? Creating a new toolbar is also an option, but probably overkill since I only want to add a single button.

I don't think you can add a single button, you'll need to make a toolbar with only one button.

Tutorial here: http://www.codeproject.com/KB/shell/dotnetbandobjects.aspx

I've never created a toolbar, but every other shell extension I've done has been a world of pain.

You program will run in explorer's process space, you'll probably want to shut down explorer and then run it from your debugger.

To shut down explorer:

* On XP, or classic menu in Vista: Click on the Start button -> shut down -> and then on the "Shutdown Windows" dialog box, hold down Ctrl+Alt+Shift and press the Cancel button.
* On Vista: Click on the Start button -> hold down Ctrl+Shift -> right click on either an empty area on the menu or on the power buttons -> pick the menu option "Exit Explorer".

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply