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
Fergus Mac Roich
Nov 5, 2008

Soiled Meat

Finally my CSound expertise is valuable!

Adbot
ADBOT LOVES YOU

Rubellavator
Aug 16, 2007

code:
SELECT a.id,
b.id,
c.id,
a.last_updated_on,
a.last_updated_by,
b.last_updated_on,
b.last_updated_by,
c.last_updated_on,
c.last_updated_by,
MAX( 
    GREATEST( 
             a.last_updated_on, 
             b.last_updated_on, 
             c.last_updated_on 
            ) OVER ( PARTITION BY a.id )
   ) AS last_updated_on,
(SELECT first_name || ' ' || last_name 
 FROM usr
 WHERE usr.id = (SELECT regexp_substr(
                                      MAX(
                                          GREATEST(
                                                   TO_CHAR( NVL( a.last_updated_on, '1-JAN-1970' ), 'YYYY MM DD H24:MI:SS.FF9' ) 
                                                        || ' by: ' ||  a.last_updated_by,
                                                   TO_CHAR( NVL( b.last_updated_on, '1-JAN-1970' ), 'YYYY MM DD H24:MI:SS.FF9' ) 
                                                        || ' by: ' ||  b.last_updated_by,
                                                   TO_CHAR( NVL( c.last_updated_on, '1-JAN-1970' ), 'YYYY MM DD H24:MI:SS.FF9' ) 
                                                        || ' by: ' ||  c.last_updated_by
                                                  )
                                         ) OVER (PARTITION BY a.id),
                                      'by: (.*)$', 
                                      1, 
                                      1, 
                                      NULL, 
                                      1
                                     )
                 FROM dual
                )
) AS last_updated_by
FROM a
LEFT JOIN b ON a.id = b.a_id
LEFT JOIN c ON c.b_id = b.id
I had a laugh while writing this today. The goal was to find who/when touched table a or any of it's children/grandchildren and provide a user-readable name. I call it the MAX GREATEST REGEX trick and I am ashamed of myself.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



That monstrosity is no longer SQL. Not sure what it is, but it's bad, and it's wrong, and it's not SQL.

String-manipulating in order to get a date-order going is just pure crap.

SirViver
Oct 22, 2008
Out of curiosity, would something like this work?
code:
WITH flattened AS (
  SELECT a.id, a.last_updated_on, a.last_updated_by
    FROM a
 UNION
  SELECT a.id, b.last_updated_on, b.last_updated_by
    FROM a
         JOIN b ON b.a_id = a.id
 UNION
  SELECT a.id, c.last_updated_on, c.last_updated_by
    FROM a
         JOIN b ON b.a_id = a.id
         JOIN c ON c.b_id = b.id
),
ordered AS (
  SELECT id, last_updated_on, last_updated_by,
         ROW_NUMBER() OVER (PARTITION BY id ORDER BY last_updated_on DESC) AS rn
)
SELECT o.id,
       TO_CHAR( NVL( o.last_updated_on, '1-JAN-1970' ), 'YYYY MM DD H24:MI:SS.FF9' ) 
       || ' by: ' || usr.first_name || ' ' || usr.last_name AS last_modified
  FROM ordered o
       JOIN usr ON usr.id = o.last_updated_by
 WHERE o.rn = 1
Really - no idea if that actually works or how efficient it is. My understanding was you wanted to know for each record in "a" when it (or any of its children) was last touched and by whom. If it's for the whole of table "a" then you can just order by o.last_updated_on descending and take the top record of that.

Impotence
Nov 8, 2010
Lipstick Apathy

TheresaJayne posted:

I saw a website the other day that insisted on >8 characters must have Upper and Lower case + Numerals - Special Characters not allowed including space

Only lowercase numbers are allowed.

Westie
May 30, 2013



Baboon Simulator

the 90s want their Server Side Includes back

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

:siren: WARNING :siren: Not for the faint of heart.

https://msdn.microsoft.com/en-us/magazine/mt795187

quote:

Editor’s Note

When I approached MSDN Magazine Senior Contributing Editor James McCaffrey to review the preliminary draft of this article, he came away fairly outraged by some of the opinions and ideas put forward by the author. Most days, that would spell curtains for an article draft. But as McCaffrey notes, it’s all too common for new ideas in software engineering to be dismissed simply because they’re new. And while McCaffrey says he’s still outraged by many of the statements in this article, we both agree that it may provoke a lot of thought about software design and methodology paradigms.

Well, that's an encouraging start.

quote:

What I’m presenting here isn’t an alternative to Agile or other such methodologies. Agile is, after all, a management framework, not an architectural design pattern. Instead, I’m proposing a design methodology that allows you to more easily become Agile because you can prepare up front for change. Over the past few years I’ve developed a design pattern I call “Active Events.”

Go on...

quote:

My guess is that your project and class dependencies look like they do in most other projects. It’s highly likely your project’s dependency graph resembles spaghetti. Sorry for being brutally honest, but that’s what my experiences indicate. But, relax, you’re not alone. Although I don’t have hard data, I would claim 98 percent of the world’s code suffers from the same problem. Besides, I wouldn’t force you to confront this issue unless I had a solution for you.

Active Events facilitates zero dependencies across your classes and projects. When it comes to software entanglement, zero is the only acceptable number!

Zero entanglement? No more spaghetti code? Oh boy, am I listening! :iamafag:

quote:

The Active Events design pattern is actually surprisingly easy to understand. Instead of creating interfaces to separate the implementation and consumer of a piece of logic, you simply mark your methods with an attribute. Here’s an example:
code:
[ActiveEvent (Name = “foo.bar”)]
protected static void foo_bar(ApplicationContext context, ActiveEventArgs e)
{
  var input = e.Args[“input”].Value as string;
  e.Args.Add(“output”, “Hello there ” + var);
}

wait

quote:

To invoke a method that has been defined using the Active Event paradigm is equally simple. Instead of invoking your method directly, you indirectly invoke it through its Active Event name:

code:
/* ... some method in another assembly ... */
var args = new Node ();
args.Add ("input", "John Doe");
/* context is your ApplicationContext instance, which keeps
   track of your Active Events */
var result = context.Raise ("foo.bar", args)["output"].Value as string;

wait wat

quote:

Also notice that all Active Events have the exact same signature. Hence, classes, interfaces, and methods move a bit behind the scene and become less a focus in the source code.

wait WAT :stonk:

quote:

However, because no signatures or types need to be known and shared between the consumer and the implementation of an active event, you have more of a black box environment than you might have with OOP. This allows you to easily exchange, for instance, SaveToDatabase with InvokeWebService or SaveToFile.

:psyduck:

quote:

Polymorphism is as easy as changing a string. Here’s an example of how to implement polymorphism using Active Events:

code:
string myEvent = "some-active-event";
if (usePolymorphism) {
  myEvent = "some-other-active-event";
}
context.Raise (myEvent);

:psyboom:

quote:

This is polymorphism without types. This is polymorphism dynamically determined during runtime. By taking all traditional ideas about polymorphism out of the equation, and refactoring the very essence of polymorphism, you end up with actual working polymorphism—encapsulation and polymorphism, without classes, types, interfaces or design patterns. Chaining your Active Events becomes as easy as combining atoms into molecules. That is agile software!

:gooncamp:

JawnV6
Jul 4, 2004

So hot ...
Reminds me of that enterprise Java fizz buzz example. No, the other one, where it's "a single line of code" and he's just depressed at how many programmers stroll through his interviews without that glorious insight and pollute his whiteboards with conditionals and such.

nielsm
Jun 1, 2009



ActiveX is too dead, we definitely needed a new Active thing.

hobbesmaster
Jan 28, 2008

NihilCredo posted:

:siren: WARNING :siren: Not for the faint of heart.

https://msdn.microsoft.com/en-us/magazine/mt795187


Well, that's an encouraging start.


Go on...


Zero entanglement? No more spaghetti code? Oh boy, am I listening! :iamafag:


wait


wait wat


wait WAT :stonk:


:psyduck:


:psyboom:


:gooncamp:

The author works at Microsoft right? Is this some kind of roundabout way to get Raymond Chen to drop by and explain DCOM to him or something?

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
TIL that if your compiler cannot statically validate the contracts associated with a dependency, it doesn't exist.

Wish me luck, folks- gonna go cover my eyes and use the resulting invisibility to rob a bank.

darthbob88
Oct 13, 2011

YOSPOS

JawnV6 posted:

Reminds me of that enterprise Java fizz buzz example. No, the other one, where it's "a single line of code" and he's just depressed at how many programmers stroll through his interviews without that glorious insight and pollute his whiteboards with conditionals and such.
Mind posting it? I assume it's a single line (with a shitload of abstraction and polymorphism behind it)?

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

NihilCredo posted:

:siren: WARNING :siren: Not for the faint of heart.

quote:

In this project I created a new programming language, Hyperlambda, for creating Active Events hooks. This allows me to change the implementation of my for-each and while statements if I want. I can also scale out my else statements, to be executed on another server. And I can easily extend the programming language to create my own domain-specific keywords, for doing whatever my domain problems require.

~~~HYPERLAMBDA~~~

There's no way it can possibly be serious, the author is a masterful troll.

Winter Stormer
Oct 17, 2012

I think they accidentally posted that a month early

Edit: vvvv holy yikes, I've changed my mind and this is the real deal

Winter Stormer fucked around with this message at 00:24 on Mar 14, 2017

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Hammerite posted:

~~~HYPERLAMBDA~~~

There's no way it can possibly be serious, the author is a masterful troll.

Well then that's one heck of an effortful troll:

https://github.com/polterguy/phosphorusfive

code:
p5.web.widgets.create-container
  parent:content
  widgets
    sys42.widgets.tree
      _crawl:true
      _items
        root:/
      .on-get-items
        p5.io.folder.list-folders:x:/../*/_item-id?value
        for-each:x:/-/*?name
          p5.io.folder.list-folders:x:/./*/_dp?value
          p5.string.split:x:/./*/_dp?value
            =:/
          add:x:/../*/return/*
            src:@"{0}:{1}"
              :x:/..for-each/*/p5.string.split/0/-?name
              :x:/..for-each/*/_dp?value
          if:x:/./*/p5.io.folder.list-folders/*
            not
            add:x:/../*/return/*/_items/0/-
              src
                _class:tree-leaf
        return
          _items
Still, the half-baked frontend DSL isn't nearly as much of a trainwreck as the "Active Events" masterpiece.

NihilCredo fucked around with this message at 01:27 on Mar 14, 2017

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

NihilCredo posted:

Well then that's one heck of an effortful troll:

https://github.com/polterguy/phosphorusfive

I choose not to look too closely lest I be forced to entertain the notion that it's actually sincere, because then I might turn into the funny cgi pig from that xtranormal video and start talking about becoming a farmer shovelling pigshit or whatever.

B-Nasty
May 25, 2005

I knew it had to be a troll when I saw:

quote:

If your Node class conforms to these constraints, you can easily transform almost all possible objects to a Node instance.

code:
class Node
{
  public string Name;
  public object Value;
  public List<Node> Children;
}
The only thing that would've made this troll masterful would've been to use reflection to invoke methods based on strings and pass around a datatable.

I think it's a tongue-in-cheek dig at javascript and dynamic languages in general

Absurd Alhazred
Mar 27, 2010

by Athanatos
Is there a thread for the opposite of coding horrors? I just started my first use of NVENC, Nvidia's on-chip video encoding library, and it's just a masterpiece of low-level API documentation. A walk-through programming guide and really informative inline comments in the header file. Would code again.

Eela6
May 25, 2007
Shredded Hen
If the last year has taught me anything, whenever you think "this can't be serious - no one could believe this is a good idea" - you are wrong.

Man that code is bad. It's just filled with noise comments too. 'Documentation' that just obscures.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

darthbob88 posted:

Mind posting it? I assume it's a single line (with a shitload of abstraction and polymorphism behind it)?

How about this?

code:
{(x;4_t;4#t;t:"FizzBuzz")@2/~3 5!\:x}'1+!100
:v:

Eela6
May 25, 2007
Shredded Hen
Apl?

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Close; K.

Athas
Aug 6, 2007

fuck that joker
Does that run particularly fast, or is it only the array primitives that are optimised?

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
It's constructing a heterogenous list and it's forced to do so in a scalar context because I need the index, so not insanely fast. To give you an idea, here's a comparison of the entire program versus a parallel, vectorizable version of its heart which just determines the classification raw number/buzz/fizz/fizzbuzz. Timings are in milliseconds:

code:
ij@kbox:~$ rlwrap ./k
2016.12.02 (c) arthur whitney

 \t {(x;4_t;4#t;t:"FizzBuzz")@2/~3 5!\:x}'1+!100000
84
 \t {2/~3 5!\:x}1+!100000
7
 \t 2/~3 5!\:1+!100000
5

 2/~3 5!\:1+!20
0 0 2 0 1 2 0 0 2 1 0 2 0 0 3 0 0 2 0 1
Does that answer the question?

Internet Janitor fucked around with this message at 14:00 on Mar 14, 2017

Athas
Aug 6, 2007

fuck that joker
I'm not quite sure what the '{2/~3 5!\:x}'-function is doing. Some kind of reduction? I wrote a version in another language that simply produces a list of results, and that executes in about 900us on my CPU (i5-5300U, early 2015), and 480us on my Intel GPU.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



B-Nasty posted:

I think it's a tongue-in-cheek dig at javascript and dynamic languages in general

I think that's the case.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Hammerite posted:

~~~HYPERLAMBDA~~~

There's no way it can possibly be serious, the author is a masterful troll.

He's pretty committed: https://gaiasoul.com/author/phosphorusfive/

edit:
https://gaiasoul.com/2017/03/14/i-said-i-want-to-kill-friend of the family-president-barack-obama/

quote:

And for the record, even though I perceive Barack Obama as a selfish prick, tyrant, and destroyer of democracy, I have no plans, and have never had any for that matter, to actually go out and snuff him. I also have no prejudice towards black men. Some of my best friends have been “men of colour”.

Bognar fucked around with this message at 20:05 on Mar 14, 2017

Eela6
May 25, 2007
Shredded Hen

I like K and APL because they remind me of what looking at code was like before I learned how to program. It makes me more patient with beginners :)

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe

Stop! At some point you're supposed to stop descending into the rabbit hole.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Athas posted:

I'm not quite sure what the '{2/~3 5!\:x}'-function is doing.

3 5!\:x is "(3;5) modulo each-left x". Note that the K modulo operator takes its arguments in the opposite order of most languages. This ends up being very convenient in combination with the right-to-left execution order.

code:
  1+!15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

  3 5!\:1+!15
(1 2 0 1 2 0 1 2 0 1 2 0 1 2 0
 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0)
~ logically negates. 2/ is "2 encode"- turn our two columns of bitflags into a base-2 number. Encode can handle mixed bases, too, if the left argument is a vector- this is handy for lots of fun tricks.

code:
  ~3 5!\:1+!15
(0 0 1 0 0 1 0 0 1 0 0 1 0 0 1
 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1)

  2/~3 5!\:1+!15
0 0 2 0 1 2 0 0 2 1 0 2 0 0 3
Doesn't surprise me that a compiled language can get better performance. K doesn't perform loop fusion at all, which adds overhead, potentially leads to cache misses and can also lead to more allocations than strictly necessary. "encode" may not be implemented as a primitive either, but a naive replacement of it with +/2 1* seems to be slower.

I do think that this approach to the problem is pleasant and easy to understand, modulo unfamiliar syntax. It was very easy to build up and verify as I wrote it in a REPL.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Internet Janitor posted:

modulo unfamiliar syntax

:hfive:

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.
trying to check out a project that eventually generates videos or something, but the guy who's been on it up til now dumped like 20+ gigs of video artifacts into git.

I wonder how many weeks until this thing finishes cloning.

Meat Beat Agent
Aug 5, 2007

felonious assault with a sproinging boner
ACB (Always Commit Binaries)

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Munkeymon posted:

I think that's the case.


gently caress look how wrong I was. That headline is two clicks and some scrolling from that MSDN article, too.

Cypriot expelled from the US for threatening to kill the president but is looking for work posted:

Unfortunately, I cannot provide you with references, since most people who I work for, seem to not wanting to admit that I have been working for them – Since I am quite controversial.

:allears:

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Munkeymon posted:

gently caress look how wrong I was. That headline is two clicks and some scrolling from that MSDN article, too.


:allears:

In order for him to be "controversial" I think he would need to actually divide opinion, which if everyone agrees you're a piece of poo poo, you don't do.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
it's the web framework version of templos

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
There's no way they didn't just post that to make fun of the dude. just no

quote:

It took me seven years to unlearn what I had previously learned and to trust my intuition.

Like, I wonder where would be a good place to put all of my method signatures ... hmmmmmmmmmm .......

Creating an undecipherable DSL and then doing contract work with it isn't the worst idea though.

dougdrums fucked around with this message at 00:36 on Mar 16, 2017

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun
I once, on a lark, wrote an application that'd create a REST API with Flask from a JSON spec.

I quit when I realized that anything more than simple SQL insert/select and schema updates were going to be nearly impossible to do without building out a DSL that embeds within the JSON.

This guy saw that and said "good idea."

RandomBlue
Dec 30, 2012

hay guys!


Biscuit Hider

Ghost of Reagan Past posted:

I once, on a lark, wrote an application that'd create a REST API with Flask from a JSON spec.

I quit when I realized that anything more than simple SQL insert/select and schema updates were going to be nearly impossible to do without building out a DSL that embeds within the JSON.

This guy saw that and said "good idea."

The whole thing seems like almost a copy of windows message handling in the pre-event driven days. He just needs to throw in a central messaging handling loop and a message queue and he'd be set. Welcome to Windows programming before Delphi, C++ Builder and VB (or Visual C++ for almost 10 years after that).

I remember trying to work with VC++ AFTER working with C++ Builder in the mid 90's. Holy poo poo no.

Adbot
ADBOT LOVES YOU

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug
Does "modifying your program to display a political message every time it's run" constitute a coding horror? There's even a GitHub issue about it that's just waiting to turn into a shitfest.

Only registered members can see post attachments!

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