Useless Blogging

June 6, 2011

Project Euler Problem #1

Filed under: Programming — steegness @ 4:57 pm

Solved in Excel!

=SUMPRODUCT((MOD(ROW(A1:A999), 3)=0)*ROW(A1:A999))+SUMPRODUCT((MOD(ROW(A1:A999), 5)=0)*ROW(A1:A999))-SUMPRODUCT((MOD(ROW(A1:A999), 15)=0)*ROW(A1:A999))

(Project Euler)

September 1, 2010

Awesomer Excel Trick

Filed under: Programming,Work — steegness @ 9:47 am

OK, so the formula that I last posted apparently required a little work. It became immediately obvious that the use of the formula for a named range failed if the matching column was to the right of column Z; ther CHAR() function will only return one character. I needed to make the formula a bit more complex in order to handle that.

=OFFSET(INDIRECT(“Source!$” & IF(MATCH(“MatchingColumn”,Source!$1:$1, 0)>26, CHAR(64+TRUNC(MATCH(“MatchingColumn”,Source!$1:$1, 0)/26)) & CHAR(64+MOD(MATCH(“MatchingColumn”,Source!$1:$1, 0), 26)), CHAR(64+MATCH(“MatchingColumn”,Source!$1:$1, 0))) & “$2”), 0, 0, COUNTA(Source!$A:$A)-1,1)

Go to town!

August 11, 2010

Awesome Excel Trick for Named Ranges

Filed under: Programming,Work — steegness @ 4:04 pm

I had been using the OFFSET() function with named ranges to create ranges with dynamic numbers of rows for a while, which worked very well, except when the source data was updated by moving columns around.  If a column was added or deleted, I needed to update almost every defined name I had.

To counter that, I made a formula for a named range that only cares about the column header:
=OFFSET(INDIRECT(“Source!$” & CHAR(64+MATCH(“ColumnName”,Source!$1:$1, 0)) & “$2”), 0, 0, COUNTA(Source!$A:$A)-1,1)

Now, I can refer to this named range and get the right column no matter where it is on the Source tab!  Tada!

(Yes, I know.  Sue me.)

April 22, 2008

Pligg Template Constants (for my reference)

Filed under: Pligg — steegness @ 10:45 pm

From the admin section of a Pligg installation (under “Modify Language”), a list of the constants used in templates, and their English defaults.

Yes, I know this matters to few of my regular readers, but given how totally unable *I* was to find a list such as this, maybe the internet will like it.

Below the cut (if the cut works). Thank me later.
(more…)

December 16, 2007

Totally Random Crystal/SQL Trick

Filed under: SQL — steegness @ 8:22 pm

I wanted to put this up so I didn’t forget it. This is a trick to turn a field into a toggle, allowing for a default date range or a user-specified one. It’s made for Crystal, but would work for anything Oracle-based, I think, with some tweaking.

whateverdate between (decode(‘{?Timespan}’, ‘DEFAULT’, (Last_Day(Add_Months(SYSDATE, -2)) + 1), ‘{?StartDate}’)) and (decode(‘{?Timespan}’, ‘DEFAULT’, (Last_Day(Add_Months(SYSDATE, -1)) + 1)

Thank you for your time.

May 26, 2007

Things I Never Knew About SQL

Filed under: Programming,SQL — steegness @ 7:46 am

(Speaking Oracle, specifically)
When trying to SELECT INTO a variable, if the query returns no rows, an exception is thrown. I’d have thought that the variable would just be NULL, but noooooooooo…

You can nest BEGIN..END blocks to your heart’s content, but you can’t have more than one autonomous block within a given BEGIN..END block. (not that I’ve found, at least).

Exceptions don’t always tell you that they’ve been raised. Sometimes you have to figure it out by noticing that a NULL is where your return value should be.

That is all for now. Carry on, people, carry on.

May 2, 2007

Pausing ProTip

Filed under: AMXX Plugins,Programming — steegness @ 1:54 pm

When pausing external plugins from within another AMXX plugin, that “c” flag makes all the difference.
pause("acd", "externalplugin.amxx")
Lawdy that’s key… otherwise, the plugin that CALLED it will be the one that stops, and that isn’t likely to be what you’d like to have happen.

February 9, 2007

Combat Communism 0.23

Filed under: AMXX Plugins,Programming — steegness @ 12:39 am

Combat Communism has hit version 0.23.

Changes include:

  • Fixed XP not resetting between rounds
  • Drive XP cut to divide a CVAR by the number of players on the server
  • Comment cleanup

Go forth and be well with this knowledge.

January 28, 2007

More Greasemonkey Stuff You Probably Don’t Care About

Filed under: Greasemonkey,Programming,Uncategorized — steegness @ 3:08 am

Yesterday I stayed up authoring this script to help make it easier for people on the Hollow City boards to nominate worthy posts for experience.

And in this lesson, Sean learns that trying to ship a URL with parameters in a mailto link is decidedly tricky. But I figured it out anyway; the trick, for those who care, was to do a encodeURIComponent() on the URL I was trying to send (as part of the email body), and a plain jane encodeURI() on the rest of the arguments.

See title of post for possible relevance to your life.

November 13, 2006

Combat Communism 0.2

Filed under: AMXX Plugins,Games,Programming — steegness @ 11:13 am

Combat Communism has gone to version 0.2, and seems to work just ducky.

AMXX coding scares me. Python has spoiled me for the rest of the world.

Next Page »