« first day (476 days earlier)      last day (2009 days later) » 
00:00 - 14:0014:00 - 00:00

12:05 AM
I can take a look at it if you like @Mat'sMug, but it's date night.
I've gotta go, but I'm interested in what you have to say about this.
3
Q: UniqueList Class in VBA

ptwalesI often find myself abusing dictionary objects just for the exist method like this, For Each x in Something If Not dict.Exists(x) Then dict.Add x, False Next x Then just exploit the .Exists(x) method. It happens often enough that I thought it merited it's own class. Instead of composing...

And thanks. I was a little distracted when I was writing that. Presenter... duhhh @Ducky.
 
Later!
 
1:09 AM
0
Q: Is this close reason right?

nhgrifLinked list vs array performance for RemoveAt() function [closed] This question was closed with a custom close reason. The comment left for the custom close reason was: This question appears to be off-topic because it is not about reviewing and improving code, it's about analyzing a specifi...

 
0
Q: Is this close reason right?

nhgrifLinked list vs array performance for RemoveAt() function [closed] This question was closed with a custom close reason. The comment left for the custom close reason was: This question appears to be off-topic because it is not about reviewing and improving code, it's about analyzing a specifi...

 
1:29 AM
0
Q: Custom Close Reason Post-Mortem

nhgrifWhy does this Python maze-solver NOT get stuck? [closed] This question was closed using the custom close reason. The comment posted with the custom close reason was: This question appears to be off-topic because it is about explaining what the code is doing, rather than reviewing it. Shou...

 
0
Q: Custom Close Reason Post-Mortem

nhgrifWhy does this Python maze-solver NOT get stuck? [closed] This question was closed using the custom close reason. The comment posted with the custom close reason was: This question appears to be off-topic because it is about explaining what the code is doing, rather than reviewing it. Shou...

 
 
2 hours later…
3:13 AM
0
A: UniqueList Class in VBA

Mat's Mug Note I don't implement an Item(x) method. I don't want users to be able to scramble the data. Ok. But then why expose a NewEnum to enable For Each loops? Without an Item getter (with VB_UserMemId set to 0 to identify the type's default property), it's not clear how a For Each loop might work...

 
3:29 AM
0
Q: JavaScript function that toggles element visibility according checked radio input

Cadence96this function has a set of radio inputs, for each radio there is a hidden text input. When a radio input is checked it shows its chained text input. I'm new with JavaScript, I've done it with a function constructor, I could have done this with closures or with simpler invocation patterns. My ide...

 
3:53 AM
45,000 users!
9
 
4:11 AM
I like the 24k visitors/day
 
4:44 AM
Damn @Mat'sMug chat shows your rep as 25k now, to me at least!
24k a day is a lot of people, all things considered. I also like the fact the question to answer ratio is closing in on 1/2!
Of course that's nowhere near SO's 1/20 question to (mostly bad) answers
 
5:00 AM
1
A: Creating New Scripts Dynamically in Lua

DaggWhy you don't need to generate code What you are doing here is interesting as a learning exercise. Certainly there are worse ways to learn a language than by generating code in the language, with the language. Outside of that, there may not be many practical applications for generated code in a ...

^^ good answer methinks
 
 
1 hour later…
6:12 AM
0
Q: Changing the numpy array into required shape

DrakosI have 2d numpy array of 480 rows and 1440 columns as named by 'data' below: The first element belongs to (49.875S,179.875W), the second element belongs to (49.625S,179.625W), and the last element belongs to (49.875N,179.875E). import os, glob, gdal, numpy as np fname = '3B42RT.2014010606.7.bi...

 
I had a feeling that was causing the downvotes.
 
Feels rude and bossy right off the bat
This guy's been rocking out with his sock out...
ChrisWue, Auckland, New Zealand
9.4k 1 13 57
 
6:33 AM
0
Q: Await and interactive Android ADB shell

Jason GoemaatI'm writing an app to let me interact and debug my android over USB using the android SDK and the ADB command. I create a Process with redirected input and output streams and basically run "ADB shell", and I want to be able to wait for the prompt, enter commands and parse the results. Here's a ...

 
(lack of other context, I mean)
 
0
Q: Numbers to words

Sajal AroraPlease review my code import java.lang.*; import java.util.*; import java.io.*; class NumberToWords { static public boolean HelperConvertNumberToText(int num, String[] result) { String [] strones = { "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Ni...

 
7:06 AM
breaks the silence
 
I was reviewing the above question
And i just hit 2k rep on Code Review :)
9
 
7:48 AM
@Phrancis That's evidence that the plain-English part of the question matters.
 
 
1 hour later…
8:52 AM
0
Q: Stack with minimum implementation

RandolphMy homework is to write an implementation of a stack with minimum. Could you please tell me if my implementation is correct? And, if it is correct, how to make it better? My most concern is about the resize function and push, as they contain the main mechanism of the class. Thank you :) template <

 
 
1 hour later…
10:04 AM
Monking
 
Monking !!
4
Q: Algorithm simulator (bubble and selection sorts)

Bhathiya-JaDogg-PereraI am concerned where it can be improved. Main concerns are coding style. Any other improvements are welcome too. Priority is on JavaScript, review for HTML/CSS are welcome too. What it does: Simulate Bubble Sort graphically with animations. Simulate Selection Sort graphically with animatio...

1
Q: How good is dog-fooding within the scope of CR?

Bhathiya-JaDogg-PereraI can think of the following dog-fooding scenarios: Refer to self made question or answer in CR to base off an answer or a question in CR. Use one's own libraries or frameworks in questions or answers in CR. However meeting these requirements: Questions or answers are valid CR posts. Refere...

^^ should I delete this
 
10:23 AM
0
Q: Perl align text (left, center, right) without additional packages

coinI wrote this short subroutine to left,center,right-align a multiline string. How can make it better ? (shorter|prettier|optimized?) #!/usr/bin/env perl use strict; # A bit of text $_ = <<END; Lorem ipsum dolor sit amet consectetur adipiscing elit Curabitur pretium odio dictum n...

0
Q: beautiful soup , ugly code, looking for a more efficient way edit this html

ElioRubensI am new to beautiful soup and somewhat new to python as well. I notice that BeautifulSoup(html) changes that html string into an object. So after i change it to the object I can no longer use normal python searches and string terms. For example here i am returning a piece html from a larger file...

 
10:40 AM
10
Q: Check list for formatting questions and answers

Bhathiya-JaDogg-PereraI have seen that moderators work hard to format questions and answers. Is there a check list they use (specially for CR), so others can also contribute by editing or properly formatting their own questions or answers?

I've created a PDF from Jamal's answer
 
Welcome to Code Review, If the code works as intended, Nice Question — Bhathiya-JaDogg-Perera 18 mins ago
@Bhathiya-JaDogg-Perera If it's a nice question, you should upvote it.
@Bhathiya-JaDogg-Perera If you want, you can delete it. It wasn't a great meta question.
 
@200_success I cant delete it, Should I flag it ?
 
Does anyone know if on mvnrepository there is a way to download all dependent jars in one go?
 
@200_success Oops, Forgot it :D
@skiwi Doesn't IDE's do that for you ?
 
Not with Netbeans and default Ant
i'll switch to Gradle or amvena t some point, but wasn't plannign to do that for including one single library
 
10:48 AM
oh
@skiwi ^^ Not sure I understand the situation but see above, It also works for Dependencies folder
 
@Bhathiya-JaDogg-Perera True, but I don't think you can add a dependency like that via Netbeans (one on mvnrepo)
Wouldn't be surprised if it became possible in the future as Ant has a plugin called Ivy that can do that
 
Can you unaccept the answer first?
 
@200_success still I cannot delete it, Should I flag it or just leave it be ?
Never mind I'm leaving it
 
11:06 AM
o/
 
@DanPantry you are addicted to this chat room now, aren't you ? Muwahahaha
 
Shh
no feels just reals
to be brutally honest I often suffer from feeling lonely a lot of time and it's nice to have a programming "community" as it's a hobby as well as a job
most of the time I'd just program on my own :b
 
@200_success Thanks
 
What on earth is going on w/ Bukkit? at first it seems it closed down but now it seems mojang have officially acquired it & taken over development
 
What is Bukkit ?
 
11:10 AM
yep
 
Weird stuff when making chat bot...
Caused by: java.net.MalformedURLException: no protocol: /users/login?returnurl=%2fusers%2fchat-login
 
It is basically the leading Minecraft server, but unofficial
@skiwi that's a relative Url
@skiwi it's possible it's complaining because it's not absolute so therefore you have no protocol directive (http, ftp, git, etc)
 
@skiwi yeah what he said
 
In fact I'm pretty sure that's definitely what it is complaining about - try fully qualifying it?
 
Hmm strange thing though is that:
private void loginChat() {
    HtmlDocument chatLoginPage = agent.get("http://stackexchange.com/users/chat-login");
    Form loginForm = chatLoginPage.forms().getAll().get(chatLoginPage.forms().getAll().size() - 1);
    List<SubmitButton> submitButtons = loginForm.findAll("input[type=submit]", SubmitButton.class);
    HtmlDocument response = loginForm.submit(submitButtons.get(submitButtons.size() - 1));
    System.out.println(response.getTitle());
    System.out.println("Chat login attempted.");
I get it here
It happens in the loginForm.submit
 
11:12 AM
Where are you buliding the Url?
Oh
well, that makes sense
submit will be pointing to a relative Url
the HTML element that is
I mean it sucks but yeah, the url is probably relative
in fact if you go to that web page and inspect source
errr
there's no form on that page?
 
How do you inspect source? It usually redirects me instantly
 
nvm
<form id="openid_form" action="/users/authenticate" method="post">

<input type="hidden" name="fkey" value="2e26cb9f409c9b9d4ca2e5b61b3e2b01">

<!-- OAuth form elemnents -->
<input type="hidden" id="oauth_version" name="oauth_version">
<input type="hidden" id="oauth_server" name="oauth_server">

<!-- Simple OpenID Selector -->
<div id="openid_choice" style="display: block;">
<p>
Do you already have an account on one of these sites? Click the logo to
<b>log in</b> with it here:
</p>
<div id="openid_btns"><a title="log in with Stack_Exchange" href="javascript:openid.signin('stack_exchange');"
oh. oops
I didn't mean to copy paste THAT
 
hehe
 
action="/users/authenticate"
I'm not logged into stackexchange it seems
 
I'm just coyping 1:1 @syb0rg's implementation, it may be outdated
 
11:15 AM
which is odd lol
well, the action there is a relative Url
 
Fun thing is... When you manually tst it, it will instantly redirect you
 
Caused by: java.net.MalformedURLException: no protocol: /users/login?returnurl=%2fusers%2fchat-login
interesting that the urls are different
 
Is this even still the correct wayt o log into chat :)
 
maybe I'm just spewing a load of bovine excrement :-)
I don't know man I just sign in automatically and hit notifications -> chat
 
At least this library works way better than yesterday's stuff
 
11:20 AM
10
Q: Check list for formatting questions and answers

Bhathiya-JaDogg-PereraI have seen that moderators work hard to format questions and answers. Is there a check list they use (specially for CR), so others can also contribute by editing or properly formatting their own questions or answers?

I built a PDF from Jamal's answer !
 
TIL the <!-- language: XXX--> syntax
 
@DanPantry keep in mind that it needs to be on a completely separate line..
 
Yeah I gathered that
 
there needs to be a newline before and after that..
 
like lists :p
well almost
 
11:25 AM
@DanPantry also, use "<!-- language-all: XXX -->" to specify the default language of all your code snippets in a post.
 
@amon: I always thought that was inferred by Tags
 
@DanPantry is correct see the above question, Goto Jamal's answer and see the comments
 
Ah yes
 
11:38 AM
@DanPantry well it is... but sometimes a c# question contains xml
and c# highlighting and xml content don't go too well together.
 
0
Q: Limit records printed in a page COBOL

Joorj Pagariganim just asking how could you make a page counter in cobol that limit the output from printing 10 records each page only? thanks in advance here is my code that does not break every 10 pages. IDENTIFICATION DIVISION. PROGRAM-ID. CTB. *AUTHOR. GEORGE. *INSTALLATION. QC. *DATE-WRITTEN. ...

0
Q: Tic Tac Toe in Plain Javascript

SJ-BI have created Tic Tac Toe game using plain Javascript. Can any javascript expert review it and let me know whether the way i have written javascript code is right (preferable). I actually wanted to write the same code in object pattern but i really dont know how to write in any pattern, so if an...

0
Q: RE-enable a button after closing a frame java

Joorj Pagariganso im making a program for my project. and when i clicked a button it must open anohter frame and make the button unclickable. and when you closed the popup frame the button must re enable. so this is my main frame package Option2; import javax.swing.event.*; import javax.swing.*; import java....

 
2
Q: Array not acting as expected in jQuery

Hassan AlthafI'm doing jQuery Ajax with PHP, and after jQuery passes some $_POST data to PHP, PHP validates those data, and prepares an array with all the errors, and once all validation is done, the count of error is found, and if it is greater than 0, the array is encoded in json and it is printed on the sc...

 
@Vogel612 True
 
11:53 AM
2
Q: Tic Tac Toe in Plain Javascript

SJ-BI have created Tic Tac Toe game using plain Javascript. Can any javascript expert review it and let me know whether the way I have written Javascript code that is right (preferable). I am unsure that I wrote the `OnLoad‘ function in a preferable way. I wanted wrap all my code in an immediate inv...

^^ Nice Question !
 
Wait... I saw COBOL somewhere?
 
-1
Q: Limit records printed in a page COBOL

Joorj Pagariganim just asking how could you make a page counter in cobol that limit the output from printing 10 records each page only? thanks in advance here is my code that does not break every 10 pages. IDENTIFICATION DIVISION. PROGRAM-ID. CTB. *AUTHOR. GEORGE. *INSTALLATION. QC. *DATE-WRITTEN. ...

^^ This looks like broken
 
It's COBOL, of course it looks broken.
 
see my comment there
 
How do there even exist noobs at COBOL? Why would you possibly want to learn it now.
 
11:56 AM
I had to learn it
4
Still a noob in it
 
@skiwi Once I went to an interview Those guys were using FoxPro, There might be some people who use COBOL
 
It would be so much more readable if he added some indenting and whitelines
 
i can't even read that
 
and perhaps variable declarations in a separate file
 
@DanPantry I think the issue was that I was not logged in, as it seems liek the URl redirected me to login
@Bhathiya-JaDogg-Perera FoxPro is still being used at work here as well...
 
11:58 AM
@skiwi Fixed it, then?
 
Though it's on the old-software pile luckily, it's not like they want to use it.
@DanPantry Nope, first need to fix why I'm not logged in :)
 
@skiwi Seriously ?
 
@skiwi submitting the form the login form should log you in - but you will need to maintain your cookies somewhere :-)
 
@Bhathiya-JaDogg-Perera Yes
I think the idea is that the MechanizeAgent (similar to Ruby and Perl implementation) does store cookies
 
@skiwi Didn't Microsoft dropped the development ? But still isn't the DB+UI+CODE is tightly coupled if I understood correctly ?
 
12:02 PM
I don't know myself, I don't dare to touch it.
 
@DanPantry what is the C# keyword for private for the namespace ?
 
internal
although it's on assembly level
 
@Bhathiya-JaDogg-Perera As @JeroenVannevel said we don't have namespace private classes in C#
 
ah, But It's close enough
@RubberDuck hello Ducky-san
 
12:07 PM
I think the reason for that is because namespace-only classes would generally violate encapsulation and they were better suited to be in a private nested class in pretty much 99% of all situations
 
Hola @Bhathiya!
 
@DanPantry no worries, Once I finish writing it I will post it for review
 
@Bhathiya-JaDogg-Perera I will go easy on you :-)
 
@DanPantry Don't be
 
Maybe I should just change my name to @Ducky....
 
12:08 PM
haha
 
@RubberDuck when I first saw your name I immediately thought of the idiom "punching the duck"
 
Lol. Never heard that one @DanPantry.
 
I need to change my name too
 
Looks like the intention of the code is to edit HTML, @RubberDuck — nhgrif 3 mins ago
Not the point @nhgrif.
 
@RubberDuck it's also known as monkey patching. It refers to when you add a method to an entire class by using metaprogramming at runtime. The term is a play on words of "duck typing", in that, you are essentially "punching" your method into the duck typing. Hence, "punching the duck"/"duck punching"
2
 
12:10 PM
It's not his code. He wants it explained to him.
 
I know that's not the point, but 200_success already made the point.
 
Ohhh monkey patching! Okay.
 
> "when you add a method to an entire class"
Can you add a method to just part of a class...?
 
you can add a method to a specific instance in Ruby
 
Yup. That ^
And god how I love Ruby. <3
 
12:12 PM
Ah.
 
myObject = Object.new
myObject.foo # Name error
def myObject.foo
 p 'bar'
end
myObject.foo # > 'bar'
 
And I would disagree. I don't think 200 made the point. OP should understand that if he can't explain the code, we can't be expected to.
 
If you add it to the entire class that means everyone in the current runtime so uses your class potentially has access to that method. Which would be especially bad if they rely on their own monkeypatch with the same name :(
 
@RubberDuck He may want the soup object explained, but that doesn't seem to be the main point of his question. The only problem I see is that he doesn't give an overview of what the method does as a whole.
 
Right. Because it's not his code.
 
12:14 PM
If he added an explanation of what the input and output were, it'd be fine.
 
@RubberDuck I wish Ruby was viable for cpu bound game servers :-( 2slow4me
 
@Dan that would be why monkey patching is a bad idea in production code.
I wish Ruby was just viable.
I hate that it has been relegated to being a "toy" language.
 
I don't know enough about high end environments but I would say rails is potentially OK if you throw enough horizontal scaling at it
but these days it feels like "if you like ruby, use node.js with coffeescript"
 
I don't know much about Rails to be honest.
 
@RubberDuck The BeautifulSoup() thing may not be his code. I don't see how you can say that his use of it isn't his code. What prevents BeautifulSoup() from being some 3rd party thing that he's using? He patched this code together as best he can from documentation, and it's producing the expected results even if he doesn't understand the details?
 
12:17 PM
I just know that Ruby is fun. So, Mat accomplished his goal.
 
@nhgrif what question are we talking about here? linky link
 
When I started as an iOS developer, I'd work through examples Apple had and make it work for my scenario. It's not a straight copy and paste, but I didn't understand it 100% either.
-1
Q: beautiful soup, ugly code, looking for a more efficient way edit this html

ElioRubensBasically I want to do a simple find and replace search at this point but since the object is not a string I cannot do that. So here you can see I switched it from soup object back to string several times. Any recommendations on how can avoid moving back and forth? I don't really understand w...

All he says is that he doesn't know what the soup object is, but he knows it's not a string.
 
his code isn't working
therefore it is not code review
 
How do you know that?
 
in the first line he says he cannot achieve his goal
and then gives the code that he is using to achieve it
 
12:20 PM
Oh, I see.
 
Good point @Dan. I missed that.
 
Me too.
 
This is his part of the code based on what he's said
 soup = soup.find("div", { "class" : "addy" })
 #below code will delete tags except /br
 soup = str(soup)
 soup = soup.replace('<br/>' , '^')
 
-1
Q: RE-enable a button after closing a frame java

Joorj Pagariganso im making a program for my project. and when i clicked a button it must open anohter frame and make the button unclickable. and when you closed the popup frame the button must re enable. so this is my main frame package Option2; import javax.swing.event.*; import javax.swing.*; import java....

 
So now it can be VTC for code not yet written / broken code
 
12:21 PM
^^ can someone comment please
 
Let's please use that reason.
 
I mean it's a stackoverflow question as he misunderstands how BeautifulSoup library works
 
One more vote for the appropriate close reason.
 
I can't actually find the appropriate close reason
so I just voted for "mod attention (other)" :|
 
:/ That's kind of the worst reason...
 
12:24 PM
@DanPantry under off-topic
 
derp
 
just a bit.
 
@DanPantry I think the issue is that my client does not follow redirects issued by the website right now, it should have options for that
 
there
 
Oops. We slammed OP with comments.
 
12:25 PM
need 500 to close vote I think
 
@skiwi I'd help more but I don't know enough about the library you're using
I'm at 350 Q.Q
 
I think I can manage... OpenID needs to honor the redirect to be able to log in as far as I know
Once I got it kind of working and figured out how to move credentials to some kind of option file in Spring MVC, I'll put it on github
 
Other guy's question on S/O was stackoverflow.com/questions/25458599/…
 
@skiwi (I'm not sure what you trying to do but) cant you use JavaFX's WebKit Control and Inject JS ?
 
His question was actually answered
and he came to C/R and posted a directly copy pasta of his question there
 
12:28 PM
stackoverflow.com/questions/25458599/… Also, I flagged the comment of the guy who made the suggestion.
 
likewise
 
@DanPantry And that's how the copy-pasta monsters are born
 
@DanPantry You should (AT) the incorrect commenter.
 
@nhgrif fixed, thanks
 
Aww man. Poor guy. New here and both his first questions were way off topic.
 
12:30 PM
-1
Q: Limit records printed in a page COBOL

Joorj Pagariganim just asking how could you make a page counter in cobol that limit the output from printing 10 records each page only? thanks in advance here is my code that does not break every 10 pages. IDENTIFICATION DIVISION. PROGRAM-ID. CTB. *AUTHOR. GEORGE. *INSTALLATION. QC. *DATE-WRITTEN. ...

go easy on the comments eh
 
comment napalm strike should be a c/r meme
2
we've done it at least 3 times in the past half hour
 
Actually, what I think is more interesting is when we send an attack group over to SO to correct someone that recommended a poster here incorrectly.
 
the first response team lol
 
@JoorjPagarigan We help people make their working code better. We don't help people change what their code does. We would be 1000% happy to review your code once it works as intended, so please come back once it is. — RubberDuck 13 secs ago
I enjoy that too @nhgrif.
 
12:35 PM
Some monstrosities were fixed by comment napalms
example
2
Q: Adding string binary numbers

LOsunGMy requirement is to add two binary numbers, say "1001" and "0101" as binary1 and binary2. Partial Class Default2 Inherits System.Web.UI.Page Dim carry As Boolean = False ' Boolean variable to hold the carry if occured Protected Sub Button1_Click(sender As Object, e As System.EventAr...

 
That's a good comment @Bhathiya.
 
> Even though shortening is not always better.



[size matters](http://www.toprosters.com/wp-content/uploads/2011/03/size-matters.jpg)
oh christ alive
|:
 
Don't upvote that answer @Santa. I never finished my review.
 
Comment napalm of us vs stackoverflow made me think of this image
it's even got the right colours
 
Lol. Nice ^
I've gotta go. Take care @all.
 
12:40 PM
hf :)
 
good enough for me
 
If anyone wants to expend any SO ammunition, I've got some things you're welcome to upvote...
http://stackoverflow.com/questions/25255071/does-swift-automatically-clone-arguments
http://stackoverflow.com/questions/21446018/when-a-subclass-overrides-a-method-how-can-we-ensure-at-compile-time-that-the-s/21446076#21446076
http://stackoverflow.com/questions/21205485/ios7-segue-and-storyboards-how-to-create-without-a-button/21205550#21205550
 
@Bhathiya-JaDogg-Perera I don't think that's related to what I need... I'm currently jjust running code inside a deployment script for a web service project using Spring MVC
 
@skiwi I thought you were building a chat application ?
 
12:45 PM
This ones for my Super Answer, It's in Super User btw
http://superuser.com/questions/782692/opened-a-jpg-picture-with-notepad-pasted-all-the-text-to-a-new-notepad-file/782885#782885
Thanks Santa
also
http://superuser.com/questions/640205/how-to-prevent-viruses-from-creating-autorun-inf-in-storage-devices
 
not sure if anyone is stalking my profile but if so thanks santa
 
1:03 PM
@Bhathiya-JaDogg-Perera No, a chatbot that posts messages from a github post hook
@syb0rg is not around much lately on chat, is he?
Is there perhaps anyone else that has experience with Ruby/Perl (or Java port) mechanize module?
It seems to not redirect my client when I hit the 302 - object moved status code
 
I think you need to explicitly react to it maybe?
I'm not 100% obviously
 
It seems like the Ruby counterpart does it automatically
though it's not happening here obviously
 
ruby is magic
:D
have you tried unit testing it?
 
1:21 PM
Libraries without documentation so piss me off.
 
There isn't any useful stuff in it
 
0
Q: Project Euler #2 in Swift

nhgrifI figured working through Project Euler problems in Swift would be a good way to learn any tips or tricks. For example, tuples are something I'm not used to using, but they proved useful here. Using things makes me more confident with them, so perhaps this will help me find other uses for them ...

@skiwi So write your own code to do whatever you're trying to get the library to do?
 
^
if you can't test it and you can't figure it out do it on your own
 
0
Q: Value Iteration Implementation for MDPs, should I templatize everything?

SvalorzenThis is my first post in this particular SE, so if I'm making any mistakes in my questions please let me know. I've been working for a while on a decision theory library, and since I've never really had any formal training in code best practices I'd love to hear your feedback. This particular cl...

0
Q: Project Euler #2 in Swift

nhgrifI figured working through Project Euler problems in Swift would be a good way to learn any tips or tricks. For example, tuples are something I'm not used to using, but they proved useful here. Using things makes me more confident with them, so perhaps this will help me find other uses for them ...

 
1:27 PM
Swift doesn't line up colons like Objective-C. :/
 
@nhgrif If it only were that easy
 
I dont understand why this question was off topic? which names are placeholder? I just provided the test functions and results so that the ScriptWriter "class" would have context programmers.stackexchange.com/questions/254206/…
 
Can the original still be seen on CR? There's no syntax highlighting there.
 
I'm tryign to find out how I can construct a hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/…
 
0
Q: Bitwise operation to get the weekday name

RicardoThe function days_name receive a val (string) corresponding to weekdays in hexadecimal. def days_name(val) value = val.to_i(16) week = Array.new if value.eql? 127 week.push 'All' elsif value.eql? 0 week.push 'No' else week.push 'mon' if (value & 1) > 0 ...

 
1:33 PM
nvm derp
 
It was migrated from CR because someone here determined it was off-topic for CR.
 
Finally, found it
 
@nhgrif IMHO do you really need "I figured working thro...." part ? you can use beginner tag if you are new.
 
I don't feel like I'm new.
 
nvm then :D
 
1:35 PM
I feel like the beginner tag is more for someone who is new to programming or new to big picture concepts in another language--for example moving from C to any OOP language.
 
200_success migrated it. Its no big deal but I do not think it is off topic.. I could easily just repost the ScriptWriter part without the context and that would certainly be on topic, wouldnt it?
 
@nhgrif ah however,
 
Are relative links always relative to the site domain?
 
@nhgrif it says in wiki to add it if you are new to the language, No worries. It was just a suggestion
 
hello
 
1:38 PM
Hey @janos
 
Well, I'm no newer to Swift than any other Swift user.
 
hi @skiwi how's it going?
 
Swift is a new language. Should we therefore tag EVERY Swift question with since EVERYONE is new to it?
 
1:39 PM
hey @Bhathiya-JaDogg-Perera
 
@janos Frustratingly working with some libraries... for the rest, good
 
0
Q: Why was this question migrated away?

nhgrifCreating New Scripts Dynamically in Lua For absolute clarity, here is the code that the questions asks to review (this is lua): local ScriptWriter = {} local twoSpaceIndent = " " local equalsWithSpaces = " = " local newLine = "\n" --scriptNameToCreate must be a string --argumentsForNew and i...

@bazola ^^^
 
thanks @nhgrif :) I was contemplating posting the same thing, just for clarity reasons as well
 
Now to figur eout hwo to determine if http or https was used in the request
 
again it doesn't matter to me and I hope that programmers provides more feedback, but I am new to Lua so I did want a review on the naming and stuff in the ScriptWriter "class"
 
1:44 PM
@skiwi why is that relevant?
 
Likely, if were more popular here, it probably would have received an answer and then probably not migrated.
 
@skiwi surely your code should not be doing that but the library should be handling it
 
I've got this currently:
        this.agent.getClient().setRedirectStrategy(new RedirectStrategy() {
            @Override
            public boolean isRedirected(final HttpRequest httpRequest, final HttpResponse httpResponse, final HttpContext httpContext) throws ProtocolException {
                return (httpResponse.getStatusLine().getStatusCode() == 302);
            }

            @Override
            public HttpUriRequest getRedirect(final HttpRequest httpRequest, final HttpResponse httpResponse, final HttpContext httpContext) throws ProtocolException {
 
@bazola You did get an answer on programmers, but it hardly address what your question was even asking.
 
but for a HttpGet, I need to what protocol to send it to
 
1:47 PM
@bazola I don't know at all. Are their placeholder names in the code I put in the meta question?
 
what do you mean @skiwi? as in what do you mean "what protocol do I send it to"
 
@DanPantry I cannot send a request to say "google.com", I need to send it either to "http://google.com" or "https://google.com"
 
@nhgrif I see no placeholders there
 
@nhgrif no placeholder in there no
 
wasn't that guy here asking about that very question the other day?
@skiwi: imo I would just stick to what the request is already using (like you do w/ cdn links)
 
1:48 PM
@DanPantry If I could only figure that out ;)
 
@skiwi if there isn't a protocol already use http
 
@DanPantry Who? Was 200_success asking about it?
 
@DanPantry I've got requests that need https and others that need http, so I do need to pick the correct one
 
@nhgrif: if we're talking about the Lua artificial intelligence question I remember @bazola asking about the question in chat
he asked whether local self = .. made sense and I replied no because self semantically refers to the instance of the current scope
 
@DanPantry i just posted that question for the first time last night? i posted another, separate question before that though
 
1:51 PM
Oh, well that doesn't make it off-topic for CR though.
 
@Skiwi: with cdn links you can do "//restofthelink.com" and the browser infers the protocl
 
My first instinct in Java is to use this. or whatever, but that's unnecessary.
 
@bazola someone was asking in chat about local self = something :P I only mentioned it might have been you because you are using the same code in there.
@nhgrif I'm saying it's not off-topic
 
That doesn't make it wrong
 
@nhgrif: local self = something is like doing this = something
 
1:52 PM
@DanPantry Hmm I'm doubting that will work, you mean like "//google.com"?
 
I understand.
 
@skiwi: Yep. I'm erring on the side it won't work either, but yeah
 
Nope, doesn't like it :(
 
@DanPantry well you probably are thinking about me, but I have started using local instance = instead of shadowing self :) so thank you for the feedback, it did help
 
I can be very ugly and try http if fails (on exception) try https
 
1:53 PM
Also, there's this meta question which determined that sometimes placeholder things are okay:
4
Q: Are censored URLs considered example code?

nhgrifA c# question was just posted: Set desktop background. One of the lines in the posted code looks like this: string json = webClient.DownloadString("super secret website url"); Clearly, in the actual source code, this is a URL and not an example string. Does this count as example/filler/stu...

 
@bazola: yeah I wasn't saying it was off topic I was just noting that I recognized the code
@skiwi: what class do you have access to in the scope where you're deciding?
 
both https and https run on HTTP/1.1
 
I'll see if I can dig something up
 
@DanPantry To the HttpRequest and HttpResponse from Apache Commons Http Client
 
> both https and https
 
1:54 PM
@skiwi assuming that HttpResponse is the response indicating you should redirect?
 
@DanPantry Yes, and the request is the request that belonged to it
 
@skiwi: rightio...
odd
the location shouldn't be relative
nope, no idea. hue
sorry
 
ima be off, not there until later tomorrow ...
 
As the first request is https and the rst is http I'm goign to do some form of really bad hardcoding
 
00:00 - 14:0014:00 - 00:00

« first day (476 days earlier)      last day (2009 days later) »