« first day (436 days earlier)      last day (3588 days later) » 

11:11 AM
@MadaraUchiha don't do that, I might feel challenged, and then I'd have to learn PHP ...
 
@rolfl Is there a way to simplify this in JDOM 2?
organization.getIbanNumbers().forEach(ibanNumber -> {
    Element ibanElement = new Element("IbanNumber");
    ibanElement.addContent(ibanNumber);
    rootElement.addContent(ibanElement);
});
(ibanNumber is of type String)
 
You can do ibanElement.setText(ibanNumber), but that's just a syntax-sugar thing
otherwise, no, it looks about right.
 
Monking.btw
 
if you knew what was happening behind the scenes you would think it was simple already
 
No factory method that can create an element based on name and content? :(
 
11:23 AM
compare it with DOM ;-)
JDOM decided against the Factory method thing. There are too many possible ways the factory methods would need to be done, and there's always utility methods, and constructors
@skiwi Monking too
 
So i need to lie live with it :)
 
Or write your own (small) factory method if you do it a lot.
in fairness, you have 6 lines of code populating an entire 3-level XML document....
 
Yeah
Evil XMLOutputter.output, it doesn't close my FileWriter
 
it is not supposed to, and it is documented.
2
 
@rolfl That sounded a bit too cryptic
 
11:29 AM
@MadaraUchiha statics aren't that different from instance methods, esp. from a historical perspective
 
evil user does not read docs:
> All of the output*(...) methods will flush the destination Writer or OutputStream before returning, and none of them will close() the destination.
 
in php 5.2 you could declare a method and then call it as either a static or instance method
 
I know... I should've RTFM
 
@DaggNabbit Statics and instance methods are completely different.
There is no difference between static methods and normal functions.
 
11:30 AM
and when you did call it as a static method it would even keep the last $this binding
 
@DaggNabbit There's a very good reason why this isn't the case anymore.
 
0
Q: verifying and inserting details into db

user49198I need to insert the details (name, id , number )of many documents into database if they are not already existing and if they exist i just need to do a update for any changed information. I have arrived at the following code but it doesn't work. I am new to this and need help on this. foreach($A-

0
Q: Assign XSLT file to an XML file inside another XSLT?

user56I wrote an mymap.XSLT file that transforms xmlA.xml to xmlB.xml It renames some nodes, and removes some nodes from the xmlA. I also have a viewBasHTML.xslt that enables viewing xmlB.xml nicely in a browser. I would like to modify mymap.XSLT file so that each resulting xmlB.xml file includes a ...

 
of course there's a good reason
 
try {
    xmlOutputter.output(document, Files.newBufferedWriter(path.resolve("manual.xml")));
} catch (IOException ex) {
    throw new UncheckedIOException(ex);
}
 
Statics aren't OO. They aren't a part of the OOP paradigm, and they shouldn't be used in OO code.
 
11:31 AM
@rolfl But it looked so nice like this
 
my point is, historically, there really wasn't much of a difference between static methods and instance methods, internally
 
Refactoring time then
 
poor @skiwi
 
a method was a function associated with a class. if you called it from an instance of a class it would have a $this binding
 
oh well...
 
11:32 AM
@DaggNabbit How does that reduce anything from this?
38 mins ago, by Madara Uchiha
There is no single good use-case for globals or statics in PHP.
@DaggNabbit The difference is more conceptual than internal/functional.
 
if you called it from a class, it wouldn't have a $this binding (except actually it would)
 
Not to mention that instance methods are properly scoped.
 
I can live with this
try (BufferedWriter bufferedWriter = Files.newBufferedWriter(path.resolve("manual.xml"))) {
    xmlOutputter.output(document, bufferedWriter);
} catch (IOException ex) {
    throw new UncheckedIOException(ex);
}
 
my point is it's not a matter of whether there's a "good" use case or not. Isn't it enough to assume that the people who designed PHP wanted the language to be complete, saw statics in every other language, and implemented it so people didn't whine about there not being statics?
 
@DaggNabbit As someone who is involved with PHP's internals: No, that's not how features are implemented most of the time.
Here's a nice example:
 
11:36 AM
@skiwi: It looks better like:
 
well then, as someone who's involved with php's internals, you should be in a position to answer the question of why statics are in the language yourself
 
@DaggNabbit Because someone decided that it should be, and did so without conferring with anyone else.
 
try (Writer writer = Files.newBufferedWriter(path.resolve("manual.xml"))) {
    xmlOutputter.output(document, writer);
} catch (IOException ex) {
    throw new UncheckedIOException(ex);
}
 
That doesn't make it good.
See the example I posted above
 
how is that datetime thing relevant
 
11:37 AM
Also, skiwi, I see you did that, and also, what if the writer was on a long-lived socket....
 
@rolfl Coding against interface there?
 
not sure what you mean
 
@DaggNabbit It's another piece of crap that someone just decided to have one day, and he did it without asking anyone.
 
How do you mean on a long-lived socket there?
@rolfl You changed BufferedWriter to Writer
 
if JDOM was on the server side of a socket, sending XML to the client, you don't want the writer closed.
 
11:39 AM
Ah, I agree
 
@MadaraUchiha it does look useless, but an isolated thing like that is not really comparable to a language feature like statics
 
As always, you are correct @rolfl
Except when using Java 8 :p sometimes
 
If you give XMLWriter an open writer, then it is the calling code's responsibility to close it
@skiwi Java 8 does not change what is right
 
@DaggNabbit statics was mindlessly taken from other languages without thinking of the reason of why statics need to be used.
 
that's exactly what i'm saying
 
11:40 AM
@rolfl I more meant that you are very experienced (duh) with JDOM2, but not so much with Java 8
 
although i wouldn't have phrased it quite like that
 
@DaggNabbit That doesn't mean you should be using it in PHP!
 
Java8 does not change what's right.
 
Like I already said, in PHP, there are absolutely no use cases for statics. Any pro it has on other languages is nullified by PHP due to the very nature of PHP applications.
 
i'm not saying you should be using it, i'm saying it's there for people who don't know any better
 
11:41 AM
If you need a static method, just use a function!
 
I'm not saying either that JDOM2 needs to be changed because of java 8 or anything
 
@DaggNabbit Hence: My ranting about statics and encouraging people to not use it.
I'm ranting because you should not be using statics in PHP, at all.
scope is a wonderful thing, it helps with garbage collection, with modularity and overall quality of the code, why trample it horribly like that with statics and globals?
 
well, suppose you are porting something from another language to php, and it has statics, because they made sense there. You want the API to be identical to whatever it was in the other language. It had SomeClass::createFromFoo(), so you write SomeClass::createFromFoo(). What's the big deal?
 
@DaggNabbit Because they mean differently.
In Java, you can scope classes
 
@DaggNabbit You will have to adjust the API either way, because you will "lose" the data on a new request either way. So either do it right or don't
 
11:45 AM
So statics are also scoped to whatever scope the class was limited to
 
@MadaraUchiha well make it J2EE (nevermind, wrong scope)
 
PHP has no such concept.
In PHP all classes, functions and statics are inherently global
@Vogel612 Note the distinction between scope and namespacing.
 
@MadaraUchiha note the distinction between scope and scope :(
 
(I honestly have no idea what J2EE is :D)
 
@Vogel612 php is not necessarily just a one-shot cgi-style thing. There can be long-running php programs, even if people don't usually do that
 
11:47 AM
Enterprise Edition
@MadaraUchiha Java EE
@DaggNabbit you still lose all the data when making a new request.
 
@DaggNabbit There can also be webservers in C++, you don't do that, don't you?
 
@MadaraUchiha i don't but some people do
 
in JEE you have Scopes for Backing Beans, that correspond to different lifecycle phases of a website usage.
e.g: @RequestScoped, @ApplicationScoped, @SessionScoped and a few others.
 
@Vogel612 you are missing the point, i'm saying it doesn't have to be a run-once-per-request-and-die type of setup
 
@DaggNabbit If you are looking for that kind of application, PHP is probably not the best tool for the job anyway.
 
11:49 AM
@DaggNabbit you miss the point that it always IS either way. (at least from what I take of the Second Rikudo's comments)
 
@Vogel612 PHP can be run from the command line
It doesn't have be run in web-sapi context.
Although it usually is
However, for these sort of applications, you probably don't want PHP anyway.
 
Monking!
 
And even you do, the use of statics in that is an edge case of an edge case.
 
is that again one of these:
> another piece of crap that someone just decided to have one day, and he did it without asking anyone.
Monking @Mat'sMug ;)
 
@MadaraUchiha probably not, but you can see where language designers would like to think of their language as being more generally useful than whatever people normally want to use it for
 
11:52 AM
You also have something to contribute to our PHP wars?
 
Does a ++ operator even make sense on a Fraction type?
 
@DaggNabbit that's sham
Why not?
 
why not what?
 
@Mat'sMug Yeah, why not
 
Please expand on "increment/decrement operators are broken", I intended {1/2}++ to return {2/2}.. like, var oneThird = new Fraction(1,3); oneThird++; - oneThird is now 2/3. — Mat's Mug 7 hours ago
 
11:53 AM
One problem.,. what's more intuitive::
 
@Mat'sMug I expect ++ to add a whole one.
 
Ah
 
0.5++ = 1.5
 
3/3 ++ = 4/3 || 3/3 ++ = 6/3
 
But that's my opinion
 
11:55 AM
So what I've done is better off in a IncrementNumerator method perhaps
 
meh...
 
Meh mathjax in chat, or meh IncrementNumerator @vogel612? ;)
 
meh matjax in chat & rusty mathjax..
I got a bookmarklet to render mJax 4 me....
but it seems it was invalid.
 
it doesn't render in chat
 
That's why I got that bookmarklet.
 
11:58 AM
43 secs ago, by Vogel612
I got a bookmarklet to render mJax 4 me....
 
lol
 
btw @MadaraUchiha you got some new info on what your mother intends to do concerning the clan / family question on Anime?
that question's in hibernation since our small fight there, and none of us got a checkmark...
 
I'll reimplement ++ and -- as +1 and -1 then. I think there's value in IncrementNumerator
 
++ should add 1, += should add itself.
 
Monking @all.
 
12:04 PM
Hey
 
How goes it?
 
@Vogel612 Link?
 
On holiday, but working ;-)
 
Hmm, not sure
Since they do seem active on the site (last seen 5 hours ago)
 
12:07 PM
@rolfl Something fun I hope?
 
public class CustomerEditTabChangeController {
    private int index;
    public int getActiveTab() {
           return index;
    }
}

public class CustomerEditTabChangeControllerTest{
    CustomerEditTabChangeController cut = new CustomerEditTabChangeController();
    public void testGetActiveTab(){
        int actual = cut.getActiveTab(); //method not found
        cut.ge//Intellisense: getClass()
    }
}
@MadaraUchiha she has no checkmarks awarded... possibly she just doesn't know...
okay. I officially am retarded now... How did I get the glorious idea of naming the test-class the same as the class under test?????
 
CR's offline!
 
12:22 PM
@ckuhn203 not for me...
 
back again
 
Is for me
 
now it's for me too...
 
12:28 PM
Offline for maint
 
Monking!
 
@MadaraUchiha skipped... looked kinda fine to me, but my JS is heavily rusty.
Monking @CodeX
 
That CV, @Madara , is it a compile thing? (I skipped it once as well).
hey CodeX
 
Must have been a transient thing, now it's fine. Go figure.
 
Does anyone know of a good C++ C# password store application?
 
12:31 PM
@rolfl cv-pls = close vote please
But I tried to reproduce the code on jsfiddle and there are errors in it.
 
yes, but I don't know JS well enough to know why.... ;-)
I see now that results appears out of thin air, but, that may be a JS thing too.
 
No, it isn't...
 
And I like being sure for migrated questions.
Migration rejected.
 
0
Q: List of search results using Selenium

ApjuhI have written the following code for looping through webElements in selenium. Can someone please provide me with feedback on how to improve my code public static void checkAbsentSearchResult(String title, String Testgoal) throws IOException{ try{ List<WebEle...

 
ugh, debugging asynchronous code
you just put the thread to sleep in 10 different places
 
12:41 PM
@MadaraUchiha a simple document.write would fix that code :/
 
finally back internet
 
@CodeX document.write is never the solution, it's the problem.
2
 
@MadaraUchiha it would at least make the code working..
 
12:57 PM
I feel like I am using too many stars right now....
3
 
OMG PHP is falling apart it seems!
 
How so?
 
Hi everyone!
 
o/ @Marc-Andre
 
@MadaraUchiha So many developer problems, is PHP not funded yet?
 
1:11 PM
@CodeX Funded?
 
@MadaraUchiha Does PHP have financial backing or is it run on the money of the developers?
 
Isn't PHP owned by Zend?
 
"The company that owns the engine behind PHP is called Zend. Find them at Zend.com

The language itself is controlled by the PHP Language Group"
 
0
Q: How can I turn off the blue clock display when debugging asynchronous code?

Jeroen VannevelOften when debugging an piece of asynchronous code, it will give me this blue screen on my second monitor with a clock on it. This happens often after I pressed 'Continue' from a breakpoint but sometimes it also turns into a black screen. Using the Windows button or dragging a window over it rem...

Where are the blue clock experts
 
@CodeX Then it's completely FOSS.
@JeroenVannevel I read that without the l.
And no, I don't mean bue.
 
1:21 PM
@MadaraUchiha Stay away from the smurfs
2
I'm watching you
 
@JeroenVannevel HAHA!
 
4
A: Rock-Paper-Scissors-Lizard-Spock Challenge

RafeI'm somewhat old-school in that I don't think OO is the right answer to every problem. Here's my effort: void Main() { foreach (var left in Enumerable.Range(0, (int)A.Count).Cast<A>()) { foreach (var right in Enumerable.Range(0, (int)A.Count).Cast<A>()) { Result result; ...

Morning!
 
@Malachi Hello
 
hey!
@Mat'sMug How is the Job going?
@BenVlodgi give me the Checkmark!!! JK LOL how is it going?
 
monking
 
1:28 PM
I got a Motorcycle!
 
@syb0rg here I am with the latest reply
@Malachi its going well :) tnx
 
@BenVlodgi Awesome!
 
Monking @BenVlodgi
 
howdy
 
I really need to learn how to structure my applications in PHP I'm having to refactor thousands of lines of code now.. :/
 
1:35 PM
@Malachi Still thinking about the question/answer
 
@BenVlodgi I was just messing with you. I don't know if that is the most efficient way to do it, do you have some fake data that you can run both against and see which is better?
 
yah, the fake data is in my question
 
I mean like an input table or something, have you tested my answer, I really don't like the CTE's because I have to call the same one twice, @Phrancis could probably give you a better solution with the CTE's maybe...
in case he sees this later
4
Q: Sorting three Decimal values

BenVlodgiI have been given three values. @lLength, @lWidth, @lHeight. I need to take these DECIMAL(4,2) values and set the values of @lMax, @lMid, @lMin with the values I've been given in order of value. So which ever value of Length, Width or Height is the greatest will be stored in Max, and the second c...

 
1:55 PM
0
Q: Parsing arthimetic expression (x + y * a + b *z)

randomAI have this code which I wrote to parse arithmetic expression. However, many people say there are problems with it but don't tell me what the problem is. Please let me know if you see any. Thanks public static Expression parse(String input) { String org = input; input = input.replaceA...

0
Q: Implementing use of 'with custom_class as foo' in own class with DB-Connection

EknoesI'm building a GameClient-Class in Python and have to open & close the connection to the MongoDB Server. I want to know if that is the best practice to implement it, so that I can use it with Pythons "with" statement. Because I want to use different functions of my Client Class, enter has to re...

 
2:15 PM
Hello, World!
 
Hello @Phrancis
Anyone else know the feelign, that as soon as you are out for a week, some (removed curseword-flood) creates classes that violate common sense?
2
just got to work in the project again, and some (more removed cursewords) got the idea to create *Manager.java classes, that are @SessionScoped. And if it couldn't get tedious enough, he just flat-out ignored, that we have a business layer between Services and Controllers...
And now I can fix the mess...
> </rant>
 
Since I work on a project by myself, I have to be very careful to only say nice things about the other people working on the code.
4
 
wb @SimonAndréForsberg
 
2:32 PM
0
Q: C code for hash-consing: how could its performance be increased?

DokkatI've isolated this function, cons, for hash-consing in C. It is where the bottleneck of my program is. How could its performance be improved? var32 cons(var32 x, var32 y){ var32 ptr; uid id, hashedId; map newMap, currentMap; u32 colls; #ifdef __DEBUG__ ++consCount; c...

 
@Vogel612 sorry to hear about this
 
@Phrancis from what you write, I take it's similar to worse at yours...
 
@Vogel612 well I don't write code here, I just answer phone calls and emails. Other people [expletive] things up and it just trickles down.
 
@Malachi coming along nicely, I got OrderHeaders modeled, working on OrderDetails. Then I can follow-up orders and calculate sales and slice & dice figures without bringing down the whole MySql instance :)
@sim hitting 20k this week?
 
2:49 PM
@Phrancis I am not the guy to take phone calls from customers... This would be too much for me.. I can barely contain my anger with people who should know their stuff, what would happen when I get in contact with people who are supposed to not know
3
 
Oh, A fraction of the code went hot!
 
@Mat'sMug Probably next week
 
@sim seen my now-shredded-into-tiny-little-pieces Fraction implementation?
 
@Mat'sMug The first or the second?
Or actually, the answer will be the same: No I haven't :)
 
lol the 2nd :)
I kinda wonder what that would look like in Java
 
2:52 PM
@Mat'sMug link?
 
7
Q: A fraction of the code

Mat's MugFollowing up on this post, and including some major changes suggested, here's the revised code. Changes include: No longer keeping an IFormatProvider at instance level. Removed IFormatProvider constructor parameters. Introduced ToString(IFormatProvider) overload. Changed decimal to float, to l...

 
(nevermind)
 
Some nice answers there, if you have spare votes to spend ;)
(thanks @vogel, phone copy+paste isn't ..ideal)
 
@Mat'sMug
 
@phrancis aw come on, most methods are two-liners!
 
2:55 PM
0
Q: Bit compressing in javascript

Sukhanov NiсkolayI have an bit array var data = []; .... And i have the following function: function getBit(n) { return (data[~~(n / 32)] >> (n % 32)) & 1; } Because this is a bottleneck, I need the fastest cross-browser solution in my code, can anybody do faster? Thanks for all your advices. PS: ~~(n / ...

0
Q: Is this Python pathfinder efficient enough?

RealdeoI'd like to see if my code follows common practice, or is already efficient or fast enough. from random import randint w=[[2,0,0,0,0],[0,0,2,0,0],[0,0,1,0,0],[0,0,0,0,0],[0,0,0,0,0]] #1 represent Mr.Pacman, #2 represent food. for y in xrange(len(w)): #Finding the coordinate of Mr.Pacman for ...

 
@Mat'sMug A lot of it would look the same, but in Java you can't have custom operators, so those would be methods instead
 
Doesn't that shux?
 
@Phrancis actually. no... just C# newlines of doom and darkness...
3
wall of code is stuff where the opening and closing brace aren't on the same screen anymore..
 
lol
2
 
^^TS
 
2:57 PM
@Mat'sMug 11 AM and already ??
 
@Mat'sMug Not really, I've found it a bit weird that you can define custom operators for things... (in other languages)
 
@Vogel612 The only person messing up things in my projects is myself.
3
I just got some very tricky JavaFX thing to work!
Kind-of
 
No, but can't shoot the first star from phone :(
 
@Mat'sMug: There you go
 
@sim I always wanted to implement a type that needed custom operators :)
 
2:59 PM
@Mat'sMug But does it really need them?
Holy cow, Batman. That's a lot of code! — Phrancis 10 hours ago
Pfft, that was only a 18k letter question... that's nothing!
 
lol
@sim as an immutable ValueType, I'd say yes
Oh, Java doesn't have that :p
right?
 
@Mat'sMug Well, I'm not used to value types :)
Yeah, correct.
 
@Phrancis can I write a SELECT INTO in MySQL?
like, create a table just by selecting records?
 
on a related note. This is what I got for merging today:
> Problem: Validation happens on TabChange and pollutes view
> Solution: Disable Tab-Change and Just update Tabs on Click for the Save-Button
 
@Mat'sMug yes but syntax is a bit different: INSERT INTO MyTable SELECT ...
 
3:05 PM
wouldn't that require MyTable to already exist?
 
Nope
 
interesting (/confusing)
 
But it's faster if you create the table first and declare the columns
Then insert
 
yeah... but I'm lazy
 
Do it the right way, @Mat'sMug.
 
3:07 PM
yeah you're right
(thank myself later)
 
0
Q: Simpler way to write my animation code

oddI have wrote some animation code below, and its what i class as oldschool. as you can see there is alot of repeatable code ideally i would like to be able to take the delay and left or right position from a data attribute set on the button itself $(".click").click(function(){ $(this).delay(4...

0
Q: Most elegant way for data read/write from file and sql

MacinI am working on an app, where I have to load some records from file, convert them into defined format, fill missing columns with data from database, and save result into csv file. These are called "Export records" Second functionality I need to implement, is to load diffrerent set of records tha...

 
Here is what confuses me with SQL Server:
 
I think I'm ready to post my submission!
 
It seems you have misunderstood what this site is about. We do not give abstract design advice. For stuff like this you might want to check out Programmers. Please read though their help center first to find out if your question is okay to be asked there, though. — Vogel612 16 secs ago
 
DV'd
 
3:15 PM
@Mat'sMug Very Nice!!!
 
thanks! all without opening Excel!
 
@Mat'sMug Testament to the power of a good title (along with good content).
 
I found out today that at work there is no git, no unit tests and no issue tracker for internal use
2
 
@Phrancis It's a statement terminator.
    Select *
    From foo
    Where bar = 1;
Or
Update foo Set bar = 'I should have used a where';
T-SQL doesn't require it currently, but it may in a future version.
78
Q: When should I use semicolons in SQL Server?

Anwar PintoWhile checking some code on the web and scripts generated by SQL Server Management Studio I have noticed that some statements are ended with a semicolon. So when should I use it?

 
3:32 PM
@ckuhn203 true that
(thanks!)
 
I've not had a chance to thoroughly look at it, but looks like a cool project.
bbl guys.
 
Why didn't anyone tell me that @syb0rg was sneaking up on me?
 
0
Q: Finding common strings among 2 arrays of strings of length 1, sorted alphabetically in O(n) time complexity

Anirudh The problem: Start with two arrays of strings, a and b, each in alphabetical order, possibly with duplicates. Return the count of the number of strings which appear in both arrays. commonTwo({"a", "c", "x"}, {"b", "c", "d", "x"}) → 2 commonTwo({"a", "c", "x"}, {"a", "b", "c...

0
Q: PHP: Optimize If Statement

user1400803New to PHP and just wrote a bunch of if statements to display content based on the current time. Is there a better way of writing the following block of code to easily be maintainable? The only thing that changes in each If statement is the if variables, h4 tag and the $rows variable. <?php ...

 
Almost 3K!
 
3:47 PM
0
Q: Encapsulated text-based RPG using a randomized combat system

JamalFor my rags-to-riches submission, I've decided to improve this code: Text-based RPG game using classes However, I've decided to start off with something different. The original code is more interactive, but mine just runs automatically. I may consider making my code the same, but I wanted to ...

 
3
Q: Encapsulated text-based RPG using a randomized combat system

JamalFor my rags-to-riches submission, I've decided to improve this code: Text-based RPG game using classes However, I've decided to start off with something different. The original code is more interactive, but mine just runs automatically. I may consider making my code the same, but I wanted to ...

 
Hm. I keep getting "An error occurred submitting the answer" any clues what is wrong?
 
no internet, cr down, dns resolve error.... oh and don't forget the cache ;)
 

« first day (436 days earlier)      last day (3588 days later) »