« first day (462 days earlier)      last day (3554 days later) » 
00:00 - 22:0022:00 - 00:00

10:00 PM
Happy weekend @all
 
0
Q: Extract Leaves of a Binary Tree in a Doubly Linked List

JavaDeveloper Given a Binary Tree, extract all leaves of it in a Doubly Linked List (DLL). Note that the DLL need to be created in-place. Assume that the node structure of DLL and Binary Tree is same, only the meaning of left and right pointers are different. In DLL, left means previous pointer and right me...

 
@Jamal REVIEW MY CODE!111
 
WHAT CODE?
 
int a = 0;
int b = 0;
^
 
WHO IS THAT GUY
?!?!??!@!?!@!@!
 
10:10 PM
@hichris123 USE DESCRIPTIVE NAMES
 
Uhm... why is it going weird with formatting?
@Jamal int 0 = 0;
Will that compile?
 
> closed as example code by Jamal ♦
 
lol
But really... can a number be a variable name?
 
Yes, it'll compile. holds in laugh
 
Or will your compiler hate you forever?
 
10:13 PM
It may depend on the language. I know that C, C++, and Java do not allow it.
 
PHP and Python don't, either.
@Jamal Obj-C? cries out in pain
 
Coldfusion will allow it
 
Coldfusion?
 
crappiest language ever
It's like PHP and html together
but now more powerful
 
Ugh.
 
10:19 PM
also it's actually java
but not really
 
...
 
I mean you have java objects, sure
but == has vanished
 
The worst parts of each language combined? :P
 
Yeah
 
@Pimgd Uhm... how do you compare objects then?
 
10:20 PM
PHP and HTML together... and regex?
 
... depending on type;
structCompare
listCompare
etc...
 
Ugh. Ugh. Ugh.
 
Or you write a hax that uses Java unsafe library and compares memory location
But wait, there's more!
HTML can print whitespace, yes?
well, and characters!
 
The <center> cannot hold
 
You just type without a tag! and then stuff appears on the screen!
Well, coldfusion has that too.
So anything not in coldfusion tag is outputted.
Did I mention whitespace?
 
10:22 PM
That sounds dreadful
 
So a for loop doesn't only do what the for loop does
 
@Jamal Took care of it.
 
it also prints A LOT of whitespace.
2
In fact one of the performance optimizations is to add a comment that starts at the end of your tag... and ends at the start of the next tag (on the next line)
 
@Pimgd ... who thought that was a good idea?
 
D:
 
10:24 PM
Uh... well, the same person who thought programming tags was a good idea?
<!--- This view-only example shows the use of StructFind. --->
<p>This file is identical to addemployee.cfm, which is called by StructNew,
    StructClear, and StructDelete. It adds employees. Employee information
    is passed through the employee structure (EMPINFO attribute). In UNIX,
    you must also add the Emp_ID.
<!--- <cfswitch expression = "#ThisTag.ExecutionMode#">
<cfcase value = "start">
 <cfif StructIsEmpty(attributes.EMPINFO)>
<cfoutput>Error. No employee data was passed.</cfoutput>
 
@syb0rg Cool!
 
Some random snippets from the docs, on how to use StructFind
creepy syntax
Of course, people don't like the idea that you poop so much whitespace when running code that doesn't print anything.
So they added <cfsilent>.
Which prevents the printing of anything at all.
Nice!
Except it also includes stacktraces, so if your program crashes you see ... nothing.
 
Ugh... concatenated SQL :(
 
@Pimgd lolwut?
 
Coldfusion sounds like some intentionally wanted to make a bad language...
 
10:29 PM
This is the most absurd language I've heard of.
 
More absurd than it sounds like
 
Best article ever. Remember, this is official documentation
> <cfset age="4a"> <cfset age=age + 7>
 
I notice... do you have to put cf into each tag, otherwise it thinks it's... I guess HTML?
 
> Treat the variable age as 4:00 am, convert it to the date-time value 0.16666666667, and add 7 to make it 7.16666666667.
@Phrancis Yeah
They came with a solution to that though
you start with <cfscript>
and then you can type code as normal
... well, mostly normal, as not all functions were supported when writing code in cfscript tags
 
> Short strings, such as 1a and 2P, can produce unexpected results. ColdFusion can interpret a single "a" as AM and a single "P" as PM. This can cause ColdFusion to interpret strings as date-time values in cases where this was not intended.
Did Adobe make CF??
 
10:34 PM
yeah?
It's to help you!
 
Allows for easy date manipulation =D
Oh yeah it runs on Java
But if you get null back from Java
and you store it in a variable
things might crash
... eventually.
 
You can store null into a variable???
 
There's no explanation how or why, just a lot of "don't EVER store NULL in a variable"
 
0
Q: Remove all nodes which don’t lie in any path with sum>= k

JavaDeveloper Given a binary tree, a complete path is defined as a path from root to a leaf. The sum of all nodes on that path is defined as the sum of that path. Given a number K, you have to remove (prune the tree) all nodes which don’t lie in any path with sum>=k. Note: A node can be part of multipl...

 
10:37 PM
WHY?
 
well you can call java functions and you need to be able to pass null to java
... but if you store said java null object then fun stuff happens
 
I understand passing null may be necessary, but storing null makes literally no sense...
 
> Note: Do not assign the results of JavaCast("null","") to a ColdFusion variable. Unexpected results will occur.
2
 
Because that's storing, literally nothing.
 
well...
A java function might return null?
 
10:39 PM
Sure
 
If you store that then Unexpected results will occur.
So sayeth the docs
 
Wow.
 
It has redeeming functions though - it has built in mail, sql, ldap and all other sorts of corporate stuff
It's glue, basically
 
Looks like ColdFusion is taking every possible bad idea and bug and bundling it into one nice convenient package.
 
one sticky mess but good for taping things together
like PHP and Java
Oh yeah
There's a built-in List
... It's a string with commas
 
10:43 PM
...
 
I managed to survive ColdFusion 6 months
then I left in search of another job
 
I don't blame you
 
Boss said it was a shame; it's hard to find good ColdFusion developers.
Oh yeaaaaah
ColdFusion has built-in ORM!
 
I wonder why.........
 
@Pimgd same thing happened to me years ago
 
10:46 PM
Take Entity A (from table Entities)
And Entity B (from table Entities)
 
why anyone would want to create a scripting language that looks like a markup language, I'll never know
 
Alter Entity A
Start a transaction... save entity A
do a rollback
Alter entity B
start a transaction, save entity B
commit
Both Entity A and Entity B are now saved.
 
oh wtf
bug?
 
"But Pim that's because you edited the Entities outside of the transactions!"
 
._.
 
10:48 PM
Start a transaction... alter Entity A, save entity A
do a rollback
start a transaction, Alter entity B, save entity B
commit
Both Entity A and Entity B are now saved.
 
-.-
 
Same thing happens.
Why?
 
I give up, why?
 
Because it saves per table, and if a single EntitySave call has been made for an entity for that table, it will flush all changes for that table
Rolling back resets ALL counters.
 
uhh
so how is the transaction useful?
 
10:50 PM
Usually rollback is done via database
 
ColdFusion uses Hibernate's Session Storage as a database
This bug is something I found out after bad data kept being saved in the database
how?
Well, we had a bad table scheme, so responses and log objects belonged to the same table
(with a type-column, eww)
If something went wrong, then rollback the transaction! (Yay!)
And create a log object! and save it! and commit!
And then you have bad data in your database
 
would love to know the name of that table
select all from ResponsesAndLogObjects
 
MO10000LC.dbo.Responses2
 
._____.
 
10:52 PM
There is no Responses table
but Responses2 yeah sure
 
Ouch.
 
MO10000LC is a great name
 
I think the whole idea behind the language was to make programming easier to learn for front-end people
 
i like how it sneakily mixes O and zero
 
you know, those guys that write HTML and JS all day
We can't have them write REAL code, that would be too hard!
Oh wait!
If we use tags, it will be a familiar environment!
 
10:55 PM
what horrible reason
nobody just writes HTML or XML
 
@Pimgd I will have to admit, you are possibly the most cynical person I have ever encountered. Coming from me, take it as a compliment.
 
(or do they?)
 
well, graphical designers?
 
the ones i know won't touch it
 
I guess if all you know is HTML and XML, everything looks like a <tag>...
2
 
10:57 PM
It has arrays too
you can create them with ArrayNew()
but that's a runtime error
cause you need to supply the dimensions of your array
ArrayNew(1)
supports upto 3 dimensions
 
lol!
why 3
 
... YAGNI?
 
i can only imagine how that's implemented
 
of course, array size is unheard of
  array = ArrayNew(1);
  array[10000] = "a";
is perfectly valid
 
that's just weird
 
10:59 PM
the rest will just be 0
oh wait sorry no
empty string
 
WHAT
 
there's no difference between numerics and strings
 
don't they have null?
 
null?
You can't assign null to a variable, ...
See starred messages to the right
Unexpected results will occur.
 
man I'm glad I forgot all this stuff
All I remember is it had angle brackets everywhere
and getting drunk every day after work
 
11:02 PM
hmm okay I was wrong
there is a difference between numerics and strings
but ColdFusion doesn't adhere to types much
so it might change depending on context
query -> coldfusion sql.QueryTable
struct -> coldfusion.runtime.Struct
array -> java.util.Vector
simple value -> java.lang.String
simple numeric value -> java.lang.Double
 
ah right, it's not an OO language is it
good old struct
 
Struct is your friend
Local variables are scoped via struct
that's how you can make a number be a variable
 
I'm waiting for @Pimgd to say "It has OO too, but..."
 
Well, it's Java, right?
you can have classes
Ah yeah!
You can have classes
I made a class ORMObject
Whose goal it was to keep track of it's state
and only save the changed values if a boolean was set
or something like that.
Then I made a class that extended that
that worked fine
but when I hit the third layer of inheritance
said boolean was gone
 
<<<<<<<<<<<<<<<<<<<<OMG>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<cfOMG>>>>>>>>>>>>>>>>>>>>
 
11:07 PM
You inherit from your parent
And that's it
so if A has a method abstractMethod
 
so it will resolve properties in the superclass, but not the whole inheritance chain
 
And B has a method abstractMethod which it implements using some getters that A provides
And you dare you have a C that extends B
then all of a sudden your getters are gone
and with those getters my dreams of refactoring the madness that were the applications we had to maintain
I used to be a nice guy then coldfusion came along
The only redeeming feature of coldfusion is this
You print a struct?
That comes on the screen.
And you can click it and it will collapse.
 
hahah that looks familiar
Wrinkle*
 
Of course, if you dump a large struct for debugging purposes and it contains too much stuff then you'll get a error message that it timed out on cfdump
complete with cryptic stacktrace
the community in coldfusion doesn't help either
they're amazed by the fact that it works on JAVA!!!
 
JD has posted a third question just now, while the first two today haven't yet been answered.
 
11:16 PM
Did you know you can use contains and indexOf on collections like Arrays?
and that then warrants a blog post
 
0
Q: Delete alternate nodes of linkedlist

JavaDeveloper If linkedlist is 1->2->3->4 then the output should be 1->3, if the linkedlist is 1->2->3->4->5, then the output should be 1->2->5. The question is attributed to GeeksForGeeks.Looking for code-review, best practices and optimizations. public class DeleteAlternate<T> { private Node<T> fi...

 
... I don't wanna see another linked list
It'll kill me
noooo
 
0
Q: More imitation of Enumerable in VBA

ckuhn203I was inspired by Me How's question to see how far I could push an imitation of .Net's Enumerable Class. The new functions can obviously handle Collections, but can also handle any collection-type object whose items have a default value. If a collectionObject's items don't have a default value,...

 
11:36 PM
0
Q: Git hook that checks out branch that was pushed to this repository

jb.If you install this hook in your repository and push branch foo-automerge to this repository, this hook will merge this branch into working copy if: currently checked out branch is named foo. working directory is clean merge would be fast-forward Reasons why I need it are outlined on my qu...

 
00:00 - 22:0022:00 - 00:00

« first day (462 days earlier)      last day (3554 days later) »