« first day (409 days earlier)      last day (3609 days later) » 

5:00 PM
@Phrancis !
 
How do you do it for links?
 
[some text](url)
 
Ah
Roger
 
lol
 
@Mat'sMug Could you do me a favor and fix the indentation on my answer ?
 
5:09 PM
Yay, a upvote!! I'm getting a new tag badge tonight!
3
 
This version of IE I have to use at work is screwy and won't let me do it properly. Point # 5
 
@Phrancis Please double-check to see if I haven't messed up anything ;)
 
0
Q: Checking if variable is defined before accessing its properties

blahshawI didn't write this but I noticed it in our codebase at work. var data = object && object.attribute && object.attribute.data ? object.attribute.data : {}; I get that the programmer is trying to check that the variable object.attribute.datais defined before using it, but is seems like so much re...

 
@Mat'sMug nice!!!
 
(sorry :()
 
5:13 PM
@CaptainObvious Off-topic
 
@Mat'sMug have you received the goods yet?
 
not that know of.. have you?
@Jamal really?
 
@Mat'sMug That's perfect, exactly what I was going for. I don't think I missed anything but I appreciate upvotes :)
 
@Mat'sMug Or not, if this falls under "maintain"
 
I'd think so. the post could use a bit more context though. This is basically asking for a review of.. a ternary operator.. lame.
 
5:17 PM
Pretty much
 
edited/retagged
Welcome to Code Review! Are you asking for alternatives for a ternary operator? I'd bet your question would get more lovin' if you included the whole function instead, and mentioned that you're worried about the readability of the ternary operator. — Mat's Mug 6 secs ago
YAFPRQTIM
(Yet Another First Post Review Queue That I Missed)
 
um, reviewed, or something
 
nice!
 
feels more like a comment but idk what else to say
 
Hey all
 
5:23 PM
@Mat'sMug I will find out when I get home in an hour and a half
 
it's not real code, there isn't enough to review there, even if it were real code, that is how we know it isn't real.
 
Why?
Looks real? It works too?
I'm not opposing the votes, just curious!
 
I am sure it works
it's a general coding idea
 
so is this one then:
The ternary operator isn't my concern here. I'm trying to figure out the best way to check that object.attribute.data is defined before assigning it to another var. object && object.attribute && object.attribute.data seems like a bad practice since it violates "Do not repeat yourself." I don't think the rest of the function is relevant. — blahshaw 3 mins ago
 
5:26 PM
Hey Mat can I get a link to that one?
 
i won't lose any sleep if that gets closed
 
@AlexL click the "3 mins ago" timestamp (works for all timestamps across SE ;)
 
Well would you look at that. Thanks :)
"I didn't write this", well there's one reason to close that one
 
@AlexL Actually, the original code does not do the same as your answer. I'm not so sure the original code is working.
@AlexL But it's from a project he maintains. So no, that's not a reason to close it.
 
I'd VTC for being too narrow, but that's not a close reason.
 
5:30 PM
who VTC'd that one....????
 
@SimonAndréForsberg I'll try it out rn
 
@Malachi It could have been a flag ?
 
flags don't count as close votes
 
@Mat'sMug But it put the question in the queue
 
was going to say :)
 
5:33 PM
0
Q: Flood fill algorithm python and numpy

AesirI am implementing a flood fill algorithm using python & numpy. I have written the following fill function which works fine def fill(self, data, xsize, ysize, x_start, y_start): stack = [(x_start, y_start)] while stack: x, y, stack = stack[0][0], stack[0][1], stack[1:] ...

0
Q: Send Image over TCP in android applications

Dany19I'm trying to make two android applications connected with TCP protocol. Client has an imageView and when you push the button, it is supposed to send that image to the server and after server reads it, it is suppose to display the image. but I haven't been able to display the sent image in server...

 
^^^^ CAPS LOCK
And off-topic
 
WELCOME TO CODE REVIEW! ... ^^ what Simon says. — Mat's Mug 17 secs ago
@SimonAndréForsberg (that was the point!)
 
And please turn off caps lock next time. (That applies to you too @Mat'sMug) — Simon André Forsberg 24 secs ago
 
I deleted it
 
@Mat'sMug Thanks. I don't think using caps-lock back at them works unfortunately.
3
 
5:38 PM
lol
 
@SimonAndréForsberg Caps lock is never a solution! It's the root of all evil on the internet!
 
@SimonAndréForsberg It does, on SO. :-P
 
Anyways, how's everyone doing today?
 
@Mat'sMug You forgot underlined
@Marc-Andre Yeah, well... that and SO.
 
how do you underline in markdown?
 
5:42 PM
Why does visual basic (no matter the flavor) always end up looking like this?
4
Q: Program falls over with larger input files

Guy F-WI have been translating a solution from C# into VB.Net, because I know more VB and wanted to understand it better. I have a version up and running that replicates the C# performance with small input files; however with an input file over ~8MB the memory usage skyrockets and it will keep chugging ...

 
No idea :)
 
It bothers me. It really does. It doesn't have to be.
It's possible to write clean code with vb! lol ugh....
 
@Mat'sMug you don't; underlines are for hyperlinks ;)
 
Just on hover.
 
5:47 PM
ah! (facepalm)
 
point is that underlined on the web is going to be mistaken for a hyperlink
so it's bad form to underline stuff
 
meta-post incoming
@DaggNabbit you're absolutely right, can you tell I need to do more web dev!?
 
can you tell i need to do less? ;)
 
0
Q: When should we vote to close for "unclear what you're asking"?

Mat's MugThis question looks like OP is worried about DRY and perhaps readability of a one-liner ternary. I have a bias against one-liners and other narrowed-down questions, but there's a consensus about them being reviewable and on-topic, and besides there's no "too narrow" close reason. Regardless of ...

 
Add [specific-question]
 
5:53 PM
@Jamal I thought of doing that, ..but is it appropriate if the question is "When is it ever appropriate to cast an "unclear what you're asking" close vote?"
 
i would vtc that as example code if anything
although example code seems to slide by a lot, so idk how strict we are about that
 
Idk if it's on topic, but it's certainly not off topic for the reason given.
 
@Jamal you're right, the question's body is pretty much dedicated to that specific post
retagged
 
It's real code and it's code he maintains.
 
seems 200 agreed
 
5:56 PM
@200_success thanks, I'm always on a fence with one-liners...
 
so can we also close "alfred says" as example code?
or do we just use example code as a loophole for questions we don't like
 
I apologize, it's not real code.
@DaggNabbit Alfred says?
 
it could be though. the only way to tell would be if OP included the actual function, if anything OP isn't asking for code to be reviewed, hence my thinking of closing as "unclear what you're asking".
 
@Mat'sMug which question?
 
5:59 PM
1
Q: Checking if variable is defined before accessing its properties

blahshawI didn't write this but I noticed it in our codebase at work. var data = object && object.attribute && object.attribute.data ? object.attribute.data : {}; I get that the programmer is trying to check that the variable object.attribute.datais defined before using it, but is seems like so much r...

 
well that was going to get closed somehow
i'm more interested in alfred
sure as hell looks like example code to me
 
@DaggNabbit It's simple, and should perhaps be tagged with beginner, but it's real functioning code. I don't think it's example code.
 
@ckuhn203 that looks like real code from a real project to you?
not just something he wrote up as an example of the patterns he's trying to apply?
 
1
Q: Should we close this one-liner ternary as "unclear what you're asking"?

Mat's MugThis question looks like OP is worried about DRY and perhaps readability of a one-liner ternary. I have a bias against one-liners and other narrowed-down questions, but there's a consensus about them being reviewable and on-topic, and besides there's no "too narrow" close reason. Regardless of ...

 
Yes. Not a professional project, but perhaps an enthusiast project.
 
6:02 PM
^^ that
 
@Mat'sMug I was on the fence about that one too, I didn't want to nominate for close because it was getting some valuable feedback. Glad it is closed though.
 
I think mod-hammer closing might have been the only appropriate call here
 
@Mat'sMug I'm not, I hate those ! I completely ignore those one-liners.
 
OP didn't get it:
My intention is that nothing with access to "Alfred" should be able to access or manipulate anything in a way that was not intended, so Principle of Least Knowledge/Law of Demeter is closer (although "has nothing to do with" is a bit of a stretch...). — Josef Ottosson 2 hours ago
 
@Marc-Andre there was a close vote on it and everyone that reviewed it voted to leave open
 
6:04 PM
Downvote the oneliners, if they don't violate any of the 6 magic rules.
 
Ignore the oneliners, if you're
 
Incoming (PHP OOP)
 
@DaggNabbit Should that one be closed ? (I'm just trying to grasp your concept of example code not reviewable) codereview.stackexchange.com/questions/54129/…
 
@Marc-Andre it doesn't look like example code to me, does it to you?
 
when in doubt, it.
 
6:07 PM
@DaggNabbit But it is actually an made up project to test a design pattern
 
@Marc-Andre how can you tell?
 
@Marc-Andre Made up projects are also real.
 
with "alfred says" there is at least one clear giveaway:
    return function(method, args) {
        return controller[method](model, view, args);
    };
 
@DaggNabbit From the question : I have implemented the following scenario for the Mediator pattern sample:
 
0
Q: PHP OOP: two functions in a class - differ only in SQL query

suz I write a simple class which should: - get 10 top cars and 10 top bicycles from database - write them into 2 different arrays It works, but I try to look after better - simpler and more clear - solution. What I got: class TopVehicles extends Connection { private $sql1 = 'SELECT model, pr...

0
Q: Linear algebra, reduced row echelon form

user1235831i am new here so please be ruthless to me ;-) Coding is only a hobby but I want to get better. The code that I am sharing here for you to review today, is a segment of a javascript library that I am going to write as time goes by for fun. It is only the two functions in the following code: ...

 
6:08 PM
you can only pass one argument to any function in the controller
 
I vote for + to be merged into
6
 
@SimonAndréForsberg I know and I've myself considered it on-topic since I answered it, I'm rying to see where does exemple code start and finish.
 
@Marc-Andre the word "sample?"
sample != example
could just be a sample from his real code
 
don't overthink it. If it's clearly "just an example to show the idea", then close as such. If it's reviewable, by all means, review it!
2
 
Thanks for that. I get what you are telling. But all I wanted to do is not a real implementation of a Mailing List, but to simulate a scenario to understand how the Mediator Pattern works. — Sowmiya Jun 13 at 16:41
 
6:10 PM
so you seriously think that "alfred says" is not "just an example to show the idea?"
i have a really hard time buying that
 
No I know it is, but I think that like the question I've linked it still have enough meat to be reviewable.
2
 
@Marc-Andre aha, didn't see that comment
it seems like he made enough effort to write realistic code and didn't just do a bunch of foo(bar) crap
 
Maybe since I'm not as good as you in JavaScript I see the Alfred question as having enough meat to be reviewable.
 
@Marc-Andre would you eat a 16 ounce steak if one ounce was rotten?
 
I think this post should be migrated to DBA... thoughts?
 
6:16 PM
@Phrancis I flagged it as such
 
@Marc-Andre the problem i have with "alfred" is that in order to do a real review, i'd want to know why we are applying that pattern
because there's likely a more idiomatic or better pattern
 
@Phrancis the Delphi code is reviewable here, but the OP's question looks like it would be better answered on DBA, indeed.
 
but without real code, i can't
 
@Phrancis I flagged it as such
I am lagging again. I need to work for these last 45 minutes at least
 
@Malachi I don't know what your point is, but probably not I'm very strict with my food.
 
6:19 PM
@Marc-Andre "meat" == code to be reviewed ;)
 
a lot of flags coming from the English site's chatroom.
@Marc-Andre like @Mat'sMug is with his VB code?
 
@Mat'sMug Thanks ! So I would say yes I would, you can "ignore" the ounce that is rotten, there is still 15 good ounces.
2
 
@Marc-Andre lol
 
0
Q: Refactor Oracle Entity Framework lambda query

MargusI had a ugly problem and wrote an ugly query. Query creates a cache that is used to get person id when I have {full_name, id_code?, birth_date?}. By question mark I mean that it is perfectly valid for person not to have {id_code, birth_date} entered. var searchvalue1 = String.Format("{0} {1}",...

 
Do you guys normally remove irrelevant tags if there is little to no code of that language in the OP? This for example I was thinking of removing
 
6:21 PM
@DaggNabbit then you can probably write an excellent review about the OP's mediator implementation, and when is it (and when is it not) appropriate to use the pattern in question. That would be a very, very nice answer (I'd think)!
@Phrancis you linked to the edit page ;)
 
$nums = mysqli_fetch_row($this->execute_query("select count(post_id) from Post"));
I'd keep it
 
I see why, they keep posting this video... this person hasn't said anything yet.... at 2 minutes in
 
someone is pissy in there
must be some British english speakers in that chat room using some coarse English
I couldn't get through it
 
6:27 PM
@Marc-Andre at least she didn't write "corretced tyop"
4
 
@Mat'sMug my point is that the mediator pattern is not suitable for small-scale stuff like this, but even if it were, you'd usually see it implemented with signals/events/whatever
 
@SimonAndréForsberg feel like tearing up someone's PHP again? ;)
 
@Mat'sMug here's a decent example: addyosmani.com/largescalejavascript/#mediatorpattern
going down that road, it seems crazy to implement an entire event emitter / mediator thing so alfred can say two phrases
iow, example code, impossible to review
 
@Phrancis I can't find much to tear up there. I'm not that good in PHP, especially not in
 
If it appears a system may have too many relationships between modules in your code, it may be time to have a central point of control, which is where the pattern fits in.
 
6:34 PM
@DaggNabbit Well in fact, I find that you've just review his code but you know that is my opinion!
 
0
Q: Implementing Simple Diff in Rebol

rgchris I've taken a crack at implementing Simple Diff in Rebol (versions 2 and 3). Simple Diff works by finding the longest common sequence in two series, then recursively applies itself either side of this sequence until there is nothing further in common. It returns a block containing additions (+),...

 
@DaggNabbit What's wrong with "Your code is too simple for a mediator implementation, because xyz; you should use the mediator pattern when [...]. That said your code has a couple of issues: [...]"?
 
@Marc-Andre that's an interesting way to look at it... so take the code at face value, tell him the pattern is too much of a sledgehammer for his problem domain, and suggest a rewrite consisting of like 2 LOC
2
 
lol
 
@DaggNabbit Why not coconut! It may seems rude/unhelpful but there is a lot of problems that come down to : I've used an over-complicated solution to a simple problem.
 
6:41 PM
can I run code on github?
 
@Marc-Andre lol why not peanut
(I'm not sure that's funny outside of Qc though ;)
 
@Mat'sMug Yeah I guess ... I'm not good with "cultural" things ;)
 
I lol'd anyway
 
Yay I get to use SQL for my job for once, need to crunch through a bunch of duplicate sales and serial numbers to find "true" duplicate sales as opposed to only duplicate records in the report
 
@Phrancis <sarcasm> that sounds like fun </sarcasm>
 
6:49 PM
@Malachi right... Also I have to do it in Access since I don't have MS SQL/MySQL on this machine
 
0
Q: How to increase performance/speed of code that uses .Count() on Lists?

SEDThe Test PublicQuestion_ComplexTest is taking around 1600ms (1.6 seconds) to run, but used to take 92ms. I have a feeling this is because of recent code changes that include .Count() in many places within these 2 functions: RemoveSmallerLengthNumberListsThatContainSameNumberCombinationAsLarg...

 
@Phrancis oh man, I don't think I have ever run SQL in Access. or used access more than a couple of days for an intro. I got kicked out of a highschool computer class when I asked the teacher if we were going to go over access/databases, he told me "you will never use them" I told him he was an idiot.
2
 
I might post my code after I'm done, I'm thinking self-joins will help me here. I'm looking at policy numbers, invoice numbers, serial numbers, vendor numbers and status (all in VARCHAR of course because the DB was designed by an idiot)
 
@Phrancis ugh!
 
@Malachi, who's the idiot now right!
 
6:52 PM
I don't think he made it to the second semester that year....
 
I took the final without the rest of the class and nearly aced it without taking the class, so it shows up on my highschool transcript twice, once as a fail and once as a Pass
 
@Jamal meta you know, it doesn't need to be that strict !
 
I need to edit more on there, then!
 
@Jamal LOL
 
6:55 PM
@Jamal lol i thought about making that edit myself
 
@Jamal Well I think when you have edit privilege anywahere they will be more relax to let minors edits come true on meta, since well it;s meta
 
@Phrancis Access is the bane of my existence.
 
six uses of "folks" and one "double folks" was a bit too much for me
 
@ckuhn203 I don't mind the SQL part of it so much, it's ugly but at least functional
I've never used the VB side of it, never had a need really.
 
When you're supposed to, obviously. I don't see how integrating this with existing VTC best practises is hard: make the internet better, skip it if you can't. Making the internet better can be polishing a gem or trashing a turd. Do we really need a Grand Unified Theory to integrate this answer's advice with what we already know? Are the gems and turds so hard to distinguish? If we do and they are, we don't actually deserve the rep by our names, do we. — SevenSidedDie 15 mins ago
I like that comment
 
7:01 PM
Anybody here knowledgeable in natural language processing?
I think @Corbin may be...
 
@syb0rg adding a speech recognition module to your robot side?
 
@Mat'sMug Actually, yes.
But now it's more of an issue of processing what I say, rather than the actual recognition.
 
7:16 PM
0
A: Authenticating with the official Mojang (Minecraft) server

przemekprzemek andrzejewski bla bla bla bla bla bla bla bla bla bla bla

spam? @Jamal
 
0
Q: Sorting an input file by a key

Ricky MutschlechnerI'm working on some assignments for a course I have coming up in the Fall, and I was wondering what you guys think of my solution (I know it's not the best, but I want to know what I could do better): http://pastebin.com/mQnbqatM Without having to actually read my code, what I did, is read in e...

 
@Phrancis I have to use it as a front end to our SQL Server...
It would have been ok 5-10 years ago...
 
Do you use Access syntax or MS SQL syntax within it?
 
@Marc-Andre "przemek andrzejewski" seems to be a very common name in Poland. I wouldn't say it's Spam, but it's NAA at least.
The consequences for Spam = Possible permanent ban on all Stack Exchange sites. I don't think this is that bad.
 
@SimonAndréForsberg I flagged it as NAA already, was waiting to see if we deem this as spam
 
7:22 PM
Why can't I see the active flags anymore? Did they remove that feature for users with enough reputation so that only moderators handle flags these days?
 
ADODB recordsets, so it's all TSQL.
 
@Marc-Andre Not quite, but still deleted.
 
Yeah, not quite.... but...
 
@SimonAndréForsberg Yes, the 10K flag queue was taken down.
 
@Jamal Do you know why?
 
7:25 PM
Let me find that post
93
Q: Let's get rid of the 10K flag queue

Shog9The 10K tools are pretty cool... You get a birds-eye view of activity on the site, a "dashboard" view of what's happening. Some of the individual tools haven't scaled particularly well with Stack Overflow's growth, but the concept behind them is still sound: we trust you to enough to be a bee wat...

 
@skiwi well I got it working for now. my java 8 is running. now let me check what I can do ;)
2
 
Honestly, from a moderator standpoint, I prefer this. The whole disputed flag thing was just frustrating.
 
You've been golfing too much. You should visit Code Review instead where we do things right! — Simon André Forsberg 12 secs ago
4
^^ Spreading propaganda
@Jamal Thanks for the link. And yeah, I agree. I miss it a bit though (don't get so many helpful flags anymore). Considering that real mods had to step in either way to clear the flags, I think it was a wise move to remove it.
 
On the other hand, I feel that it makes 10K less-desirable (you can pretty much only see deleted posts, vote to delete questions, and view some lists).
 
I agree. Although I think just the ability to see deleted posts and vote to delete is worth it.
 
7:35 PM
@Vogel612 Nice
 
Although, on this site, we rarely have to delete a question. Trusted user is nicer with answer-deletion, but it's twice the rep.
 
also I should finally get it running, that I can pull directly from your repo and just put on a pull-request for the tests ;)#
 
0
Q: Odd output when reading and printing from file in C

Magister LudiI wrote a program that will read from and output the contents of its own source file. My purpose is primarily just learning how to use I/O streams and the "FILE" type. I wrote the program in a plain text document on Linux Ubuntu 14.04 and used the terminal to compile and run the program. This ...

 
88.7% test coverage, that will do for now.
 
7:43 PM
Exactly :)
 
but soon...
 
@rolfl and @DaggNabbit You said that you could find the solutions for the 4x4 map with the 1-3 pattern, but you had problems reducing it to probabilities. How would you describe the solutions you found? (What would be the result of your probably unimplemented solution.toString()?)
 
0
Q: Bootstrap 3 glyph icons don't show up in jsfiddle

Csaba TothCan anyone tell my why glyphs don't show up in this jsfiddle? http://jsfiddle.net/csabatoth/yB84b/2/ HTML: <a id="blabla" href="#"><i class="icon-pencil"></i></a> JavaScript: // Overall viewmodel for this screen, along with initial state function ViewModel() { var self = this; } ko.appl...

 
^^ off-topic
 
Welcome to Code Review! It seems like you have misunderstood what this site is about. We help with improving the cleanliness of existing, working code. We are not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! — Simon André Forsberg 23 secs ago
 
8:00 PM
Wow I find myself today going back to debug one of our Data "Analyst"s code today because the duplication issues look like they are largely due to bad code and not so much bad data
 
That's disappointing.
Kind of.
It's easier to deal with a bad design in my opinion.
It's nice to know you have solid data though.
 
8:12 PM
wow somehow installing stuff on linux freaks me out..
either you can have it easy as f*ck: sudo apt-get install exactly-what-i-wanted
 
sudo make-me-a-sandwich
 
or you gotta copy stuff around and add desktop files and [tag;ohmagod]
@Mat'sMug User not in sudoers file
 
I think yuu meant samich @Mat'sMug
 
lmao
 
8:14 PM
I know. I just didn't wanna fly to canada to make you your sandwitch.
2
so I revoked your sudo privileges ;)
 
hehe
 
okay maybe I can import maven projects now that I have reinstalled eclipse and redownloaded all these plugins..
 
Randall's Ted Talk ^^
 
@syb0rg depends on which part of it you're talking about. I have a passing familiarity with NLP, but as far as the actual speech recognition goes, I have no idea. (And with NLP, my knowledge isn't much deeper than "this is the vague direction you should look.")
 
It took SSRS almost 30 minutes to run this query, there's got to be something wrong with it.
 
8:17 PM
@Corbin I just need to process some text that is taken from speech recognition. It has to decide what to do with what I say.
 
@Phrancis well that depends, but ?
 
Simple SELECT into a temp table, 3 joins... then JOIN back into the tables into the DB... WHY
 
At first I thought to somewhat make my own hackish NLP library, using bsearch and strstr. But then I found out that those two functions don't really work too well with each other.
 
How complicated of recognition are you trying to achieve? Do you have some form of list of recogized words, or are you going all out and trying to recognize semantics?
If you're fine with a small list of words, just make a multimap of words -> actions with as many synonyms as you can think of. If you're concerned with semantics, it unfortunately gets much, much more complicated since you have to take phrases and boil them down to some kind of semantic meaning rather than words.
 
8:22 PM
@Corbin Hmm, I'll probably go all out semantics in the future. Right now I have this though: codereview.stackexchange.com/q/54112/27623
 
@syb0rg Hmmm, ok. I will take a look in a bit.
 
@Corbin What I actually have is a bit longer than that, but it's only more functions and more array members. The general framework is the same.
@ckuhn203 "A careful reading of official Major League Baseball Rule 6.08(b) suggests that in this situation, the batter would be considered "hit by pitch", and would be eligible to advance to first base."
 
If first base still existed.
@Phrancis you still here? I can't remember. Do I want the most unique field in a composite key to be first, or last?
 
@ckuhn203 So you live in Ohio?
 
8:31 PM
@syb0rg yeah, really I'd just have to agree with chux and vnp. You need an O(1) lookup for large datasets. Using a void* as an integer is also pretty gross, but they seem to have covered that (indirectly) too.
 
Yeah. Outside Columbus.
 
@SimonAndréForsberg i was just thinking of taking all possible combinations, adding the number of bombs in a position for each combination, and dividing by the number of combinations
 
@ckuhn203 First I would say, that's how we are set up here anyways
 
so for example if you had a 3x1 grid with 2 bombs the combinations would be
**_, *_*, _**
 
E.g., Invoice_ID then Line_ID
 
8:32 PM
@ckuhn203 I used to live in a smaller town named Dublin which was near Columbus.
 
@syb0rg I would consider using some kind of scripting language or a simple C program to take your list of name -> command pairs and generate a hash table of them with linear probing as the fall back. Then, you can just embed the generated array into the actual program, and boom--relatively easy hash table in C.
 
Oh dude. @syb0rg. That's right up the road. I have friends that live in Dublin.
Thanks @Phrancis.
 
(Of course this buys you nearly nothing for the future if you go into semantics. It's just worthwhile if you have performance problems with your current lookup.)
 
@SimonAndréForsberg 2 bombs in each position divided by 3 permutations = 2/3 chance for a bomb to be in any given position
 
@Corbin I don't have current performance problems, but I foresee some of them in the future.
 
8:34 PM
@DaggNabbit Sounds like it would work
 
it should, but sounds expensive and wrong
brute-force basically
 
@syb0rg Well, you could always go the route of just hiding it away in some kind of CommandFn* findCommand(const char* name); function so that you can replace it without the code that uses the function pointer ever having to know. That lets you tackle the problem when you get to it.
 
TTQW - later @all!
 
I suspect a binary search solution should be fine for a few hundred thousand. Some kind of hash structure with O(1) lookup and decent cache coherency will be miles better though. (But might be wholly unnecessary if you're talking about 0.0003 vs 0.0001 seconds)
 
@ckuhn203 So you live in Marysville then?
 
8:37 PM
Grove City
 
Ahh.
 
@DaggNabbit Expensive, yes. Wrong, not necessarily. It would work. But there are faster ways yes.
 
Ah I think I found part of the boo-boo with the query... SELECT DISTINCT * that sounds like a very expensive operation working on tables joining millions of records.
Thoughts @ckuhn203?
 
@Corbin Do you have any suggestions on getting bsearch to work with strstr as the searching function?
 
oUCH.
 
8:39 PM
Hello @HugoRune
 
Yeah. Make sure you just get the fields needed.
The Distinct is definitely expensive, but you said there were concerns with duplicates. Might not be a way around that.
 
@SimonAndréForsberg I considered an iterative solution, like find all places there are definitely bombs, then find all places there are definitely not bombs, then find places where there are maybe bombs, then distribute the remainder over the rest of the cells that aren't touching anything
but i think it could be simplified
 
@syb0rg hmmm, why strstr? Are you wanting to match substrings too or something?
 
Well, my hackish way of NLP was to take what I said - "What is the time?", and have that be searched through to match any of my structure commands in the array.
So it would match the "time" member and then access it's function.
 
The short answer is that without a lot of nasty hackery, you can't use strstr with bsearch. strstr does not establish any kind of ordering. Additionally, it alone can't be used to establish ordering and equality. You would have to use strcmp too, and it would get very, very gross.
Instead, just split the string into words and search each word against the command list. (Though that of course requires m searches instead of 1. Not sure if there's a pleasant way around that though.)
 
8:45 PM
@DaggNabbit Yes it can. Or made more complicated, depending on how you look at it :)
 
@Corbin That's the conclusion I came to as well, since the return value of strcmp is an integral value indicating the relationship between the strings; strstr just points to the first character where the match first occurs.
 
@ckuhn203 what I'm thinking of doing is to shove my basic result set into a CTE (list of all policies under a particular set of account), and self INNER JOIN where the serial number is the same but the policy number is different, that should return only duplicate policies
 
@syb0rg exactly
 
0
Q: Output in one window

user3693592This is a beginner 1st real code. Can anyone give me feedback please? I used what I have learnt so far mainly ; Methods, Loops and Arrays. I would like you view based on these topics...However comments on how to improve are welcome. /*ask the user for 10 numbers store them in an array print the...

 
I was kinda hoping there was some sort of angle I wasn't thinking about though :P
To make it work.
 
8:48 PM
@SimonAndréForsberg how did you come up with your solution, experimentation or looked it up somewhere?
or applied some principle i don't know about?
 
@Phrancis Sounds like that will give you the dupes to be dealt with, but you might want to tune that process a bit. Sounds like there's performance to be gained.
 
@Corbin Can we continue the semantics discussion later? I'm curious as to what I would have to do, but unfortunately I have to go right now.
 
@syb0rg I haven't thought it through in any kind of formal way, but I'm fairly certain that it's not possible to perform a binary search with a phrase as the search key, and single words as the target keys.
 
No doubt. In fact I may stick with a temp table instead of CTE, so I can break it down to a smaller result table
Then perform the self join on that table
 
8:50 PM
@syb0rg sure, though all I can tell you about it is that it gets deep into statistical machine learning, and that you're going to end up either needing to find a library that fits your needs or spending a lot of time doing a lot of complicated leg work to build some kind of ML machine to do what you want.
 
@DaggNabbit Not so much experimentation as analyzing. I analyzed a whole lot of game situations by hand multiple times (not too complicated ones of course as that would take too much time). It took a while to figure things out how to make it faster. The first versions of the algorithm weren't at all as fast as the one I have now. I have create the entire thing from scratch.
 
0
Q: Given suffix array and a pattern, search if given pattern exists

JavaDeveloperGiven a suffix array for a word, check if patten (consecutive chars) exist. Example.. A suffix array constructed for "ameya" should return true for "ame" but false for "foo" or false for "ameyp". This algoritm is case sensitive. Looking for code-review, best practices and optimizations. public ...

 
@SimonAndréForsberg i might try that, the example you posted here was interesting for sure
 
@DaggNabbit Yes, the 4x4 is one of the situations I have calculated manually the most.
 
are you able to do it with a single pass through all of the cells (grabbing neighbor cells along the way)?
 
8:58 PM
No.
 
i couldn't find a way to do that either
 

« first day (409 days earlier)      last day (3609 days later) »