« first day (429 days earlier)      last day (3587 days later) » 

3:00 PM
And of course always one guy actually manages to make it
 
I believe it's not that hard to do actually.
 
It should be doable surely
yea
Then the golfing part is something I simply don't understand
 
I've never understood PCG.
 
which is why I'm on CR and not on PCG
 
new answer▼▼▼
0
A: Determining numeric palindromes

MalachiI am kind of thinking like SteveB I think that you should shorten up your code a little bit and make it straight to the point static void Main(string[] args) { long result = 0; for (int i = 100; i < 1000; i++) { for (int k = 100; k < 1000; k++) ...

 
3:09 PM
@Malachi ... to a two year old question!
 
:)
that's how I roll!!
 
Which part of "It's against my company's policy to give pricing to consumers, you will have to get pricing from a participating dealership" is ambiguous?
 
I didn't realize it was that old. it was from @rolfl's SEDE query
 
Emily L answered it recently, which is why it was recently active.
Hey GraceNote ... long time ;-)
 
Shi, just got a WhatsApp that an exam grote is known
 
3:15 PM
Just finished a task but I won't go home for 5 more minutes. Time to put the tests fullscreen and run them over and over
 
Oh nevermind, it was a different exam for which someone had his grade
 
3:27 PM
Yay, Grace is around. That is always interesting. What do you have in store for us this time, @GraceNote? Or are you just here to hang out?
 
I had a thing to poke about a question that was migrated, but it already got addressed.
 
@GraceNote - just FYI, there is a lot of interest in getting CR graduated on day 1337 of Beta ;-)
 
0
Q: Nodes and Boundary Conditions in Finite Element Method

topherThe problem: a Node is located in a specific coordinate (x, y, z). a Node can be one of these types: None, Hinge, Roll, Fixed. (it is called Boundary Condition) Different boundary condition type determine a Node's Degree of Freedom. Here's my code, I have one Abstract NodeBase class and multiple...

 
@GraceNote - yesterday was Code Review's 4'th birthday.
 
3:30 PM
@rolfl s/day 1337 of Beta/ASAP/
3
 
I can't make any promises for that. I'll say the same as I told the Code Golf folks - even if I were to say "Yay you guys are on the road the graduating!", there's no guarantee that we'd actually have all the components in place for your wanted time. Right now our site design queue is backed up to I believe 3 sites?
 
heh, well, if any of those sites need a review ..... ;-) ?
3
 
Although what's probably more interesting than graduation is to know how we're doing with
 
I will say that we're thus far quite happy with how this site is looking now, but without one of us going into a new review session I can't give much stats on that department.
 
Alright. Well, we're doing what we can with the data we get from SEDE.
 
3:33 PM
@GraceNote - Movies got the word they are graduating, but as you say the "when" is still pretty much indefinite.
 
OK, well, that was a really promising thing you just said, and, we can still be patient (I think).
 
@GraceNote Are there any time plan for when our next review will be?
 
I don't have the schedule on-hand.
 
@SimonAndréForsberg (what, you think we can rig something ....? ;-)
 
s/I don't have the schedule on-hand/It's not been decided yet./
@rolfl Not primarily what I was thinking.... I'm just really looking forward to reading another meta post all about.... us!
 
3:37 PM
@Malachi
 
@Vogel612 thank you. I am thinking about someone else's answer on there now. I think that I can optimize their answer with not repeating Multiplication using a more complex for loop.
still in the thought process though
 
I'm making progress into cleaning up my tabs!
 
@skiwi LOL
2
 
0
Q: DB Abstraction,private methods in OOP php Library

steveBKThis library registers a new user. Questions:1. Where should the DB class instantiation happen for user class. I tried instantiation in the constructor but that property doesn't seem to be available to the rest of the user class. As a work-around im creating a new instance with every function tha...

 
3:53 PM
@Malachi lol - Auto-star
 
I think we should call that "BAM!"
 
       $sql="INSERT INTO users (fname,lname, password,salt, email)
                 VALUES (:fname,:lname, :password,:salt,:email)";
^^ $this->sucks
 
Argh @Jamal - why should I edit things when you get there first and save just before me ;-)
 
@rolfl Maybe you should warn me ahead of time? ;-)
 
 
3:57 PM
@Phrancis
$query = 'UPDATE wcx_articles SET article_active = ? WHERE article_id = ?';
$stmt = $backend->prepareIt($query);
$stmt->bind_param('ii', $active, $articleid);
$stmt->execute();
$stmt->close();
$result = $stmt->execute();
^^ $this->sucks > $that
 
@rolfl Probably at this point, that bar should just read "nope". :P
 
Now to figure out how to bind an array.. call_user_func_array.. :/
 
@CodeX at least he used PDO that's better than the average PHP code monkey.
 
code monkeys are a good thing.
 
Has anyone here even quit a company with as reason that the company was using the "wrong coding style" in their language?
 
4:00 PM
@Phrancis I'm using MySQLi.. Therefore i am "average" (INSERT PROCEDURE HERE)
 
@skiwi Anyone, or anyone here?
 
I quit a multi-million pound company because they were ALL assholes, does that count?
 
In a previous lifetime a debate about tabs and spaces became really heated, and one of the guy's threatened to quit if we had to use spaces.
2
 
@CodeX Then you should use PDO ;-)
 
@rolfl Well... both would be okay
 
4:02 PM
Funnily enough, he's still there, and he's using spaces now, and I'm not.... and I'm still using spaces ;-)
 
Though the former has most likely taken place in real ;-)
 
@Phrancis I have a PDO version of my application but i want to learn MySQLi too
 
Cool
 
I just know that I would be quite pissed initially if I would need to work together with someone having a different style in the same project... but I could g3t over it I hope
Wondering though for open source projects... Usually when a pull request is being made, the other person has invested quite some work in it. Is it correct to just reject & comment if the coding style is "wrong"?
 
@Phrancis It's probably pointless lol
 
4:08 PM
But yeah @CodeX I think this guy could afford to CREATE PROCEDURE sp_insertUser
 
@Phrancis Would be a wise decision, did you tell him/her?
 
Not yet. Got some actual work to do first lol...
 
@skiwi Speaking of pull requests... have you figured out how to do them?
 
@skiwi - how about this:
> I'm tired of it. I have better things to do with my time, things I want to create, software I want to support, hobbies and interests I want to pursue. Debating brace placement, tabs vs spaces (for the umpteenth time), or whether or not annotations have a place in programming in a dynamic language? Not so much.
 
@rolfl He was probably doing
 
4:11 PM
Leading PHP developer quit over a tabs vs. spaces row ;-) groups.google.com/d/msg/php-fig/PlRDNJlX1Y8/8pCm4RCIfFgJ
2
 
I see a common thread here:
 
> It is a very sad thing to see him resign, I can understand his frustration (I stopped reading halfway through the tabs vs. spaces threads due to the level of hostility).
 
"How can I improve this code? Answer:
2
 
0
Q: C++ builder/named argument/fluent interface pattern with unique_ptr

Richard CookI'm trying to figure out the cleanest way to implement a fluent interface with unique_ptr and other "modern" C++ language constructs. Here's my first attempt: #include <iostream> #include <memory> #include <vector> // Backported from C++14 template<typename T, typename ...Args> std::unique_ptr<T>...

 
Does PDO prevent PHP from passing SQL reserved characters to a db?
Like ;
 
4:16 PM
Do you mean on an INSERT?
 
@Phrancis No. Why would it? If they're inside a string, they're perfectly fine.
Otherwise, there would be problems...
 
OK
So... what does PDO actually do?
 
> PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data.
Basically, Perl created DBI about 10 years before, and PHP copied it after not learning the perl lessons the first time.
 
6
A: Splitting company name into 3 strings

Bjørn-Roger KringsjåJust for the fun of it, here's a one-liner using LINQ. Dim names = (From i In {0, 35, 70} Where i < input.Length Select input.Substring(i, Math.Min(35, (input.Length - i)))) Example Dim names As String() = (From i In {0, 35, 70} Where i < input.Length Select input.Substring(i, Math.Min(35, (i...

 
@rolfl so in actuality, PDO doesn't do much/anything that prevents injection in other words?
 
4:27 PM
PDO does provide a convenient way to do named parameter replacements in a quoted-sensitive way
Essentially, it makes the raw SQL easily preparable.
 
   $sql="INSERT INTO users (fname,lname, password,salt, email)
             VALUES (:fname,:lname, :password,:salt,:email)";
 
Because the parameterized version of PDO queries are easy, and standard, people tend not to do the wrong version which is "select * from " + somecode + " where " + ....
 
So if I set my email here as phrancis@somewhere.com; SELECT * FROM users; it would just take it?
 
^^^ yes, and your e-mail, in the database column, would be: phrancis@somewhere.com; SELECT * FROM users;
 
What if I did this: phrancis@somewhere.com'; SELECT * FROM users (added quotation mark)
 
4:32 PM
PDO will conver tthe statement to: INSERT INTO users (fname,lname, password,salt, email) VALUES (?,?, ?,?,?)
then it will order the parameters for binding in the same order as the namevd values.
It will prepare the statement, bind the values, and execute it.
If you use the named parameters, it will 'do the right thing'.
(including if you put quotes in the input).
 
Is there a way to break it, that you know of? (i.e. inject SQL)
 
Sure, you can do:
$sql="INSERT INTO users (fname,lname, password,salt, email)
             VALUES ('" + $fname + "', '" + $lname + ", " + $password + ", " + $salt + ", " + $email + "')"
Also, there's the ever-present, though somewhat hard to contain problem of people trusting previously stored data.
 
I mean, assuming the programmer did use PDO
 
Even if your insert is 'safe', you could have SQL code embedded in values in the database.
If you have the code: "select email from users where id = 10"; then that is 'safe', but, now you do:
 
@SimonAndréForsberg Not completely yet, but there should be nothing special about it
 
4:37 PM
 "select * from emails where toaddress = '" + $email + "' "
^^^ trusting values in your database just because they are stored in your database successflly, is stupid.
 
Doesn't PDO hook into the SQL drivers that offer parametrized queries? So it never even constructs a raw query request?
 
It may do, but, the point is that you need to use the parameterized version for any values that are 'tainted'.
and tainted SQL is anything that has touched any non-trusted user or system.
 
@rolfl If this was my code I would be tempted to write more of it in SQL into a transaction that checks for exiting user name or email, and COMMIT if it they are unique or ROLLBACK if they are not...
 
I still think there's a future in creating a tool that allows you to switch coding style conventions :) but making it would be another story
Does anyone know if a mechanical keyboard can 'break'?
Keys aren't the issue as they are replacable
 
What is it not doing?
 
4:48 PM
@Phrancis What do you mean exactly?
 
The keyboard, what's wrong with it?
 
Nothing is wrong... this one is all perfect ;)
But just wondering
> Things you can do...

Play StarCraft 2 for 1,388 hours at 600APM
 
1
Q: Generic deque implementation

kharandziukI implemented a generic deque data structure. Deque.java: import java.util.Iterator; import java.util.NoSuchElementException; class Deque<T> implements Iterable<T> { private class Node<T> { public Node<T> left, right; private final T item; public Node(T item) { // FIXME: m...

 
@skiwi I suppose bad wiring could happen if it were handled roughly... LEDs can go out... I suppose electronics (e.g. chip, capacitor, etc.) could fail
 
Fair enough I guess
 
4:52 PM
Wireless kb could have a bluetooth related failure
 
I just hope my Corsair Vengeance K70 will never leave me down :)
 
Or battery failure (e.g. leak)
 
Are you using a mechnical as well?
Mine is wired luckily
 
Why is it you can't bind multiple values automagically?
in MySQLi
 
@skiwi that's a pricy kb, nice
 
4:57 PM
@Phrancis And the M95 mouse is even more awesome... living without all those extra buttons is genuinely hard
 
I have a button that makes me tea and sandwiches!
Wait, i say button.. It's my wife..
2
 
@skiwi Well, a keyboard does have a Pause/Break button...
@Phrancis As long as you use parametrized queries with PDO or MySQLi, you are safe.
 
@SimonAndréForsberg Looked at keyboard to check it; confirmed.
 
@skiwi Tried it to see if it breaks?
 
how do i produce an array of i's from a number for example 6?
 
5:02 PM
@SimonAndréForsberg Pressed it, nothing happened.
What is that key even for?
Wow appereantly Windows + Pause/Break = System properties (Only on Windows)
 
@SimonAndréForsberg how would I see if it is parametrized as opposed to... what? Is it that thing you keep saying about not concatenating SQL into PHP?
 
Also interesting, by reading history I would've expected for example games to keep that key
 
@skiwi I believe Ctrl + Pause/Break was used in some old MS DOS programs to either pause or terminate. Don't remember. The button is actually used in Age of Empires III to pause the game.
@Phrancis Yes. Parametrized queries are when you use PDO properly, to where you replace all the parameters with either ? or :parametername and call methods on PDO to put the PHP variables there.
You can use PDO and prepared queries without using parametrized queries, which is just as dangerous as if it would be regular concatenated SQL - because it is in that case concatenated SQL.
 
Good to know
 
Is this how i am supposed to get the result $result = $stmt->execute(); ??
not from the $stmt->close(); ?
 
5:13 PM
@CodeX yes.
 
@SimonAndréForsberg Thanks
 
result from calling close? What?
 
Confusion!
 
0
Q: Casting base to derived class according to a type flag

TheArtistThe following question has been originally posted in stackoverflow.com (original thread here) but i was suggested that Code Review is a better place for these kind of questions, so i decided to move it here. So I have been writing an event class for my game engine and i came across to the follo...

 
I like these prepared statements but what if i wanted to delete multiple random rows using varying "types" of data
I would need to automatically assign the types and create an array based on the count(); of an array
 
5:20 PM
@CodeX to do that you would probably need to JOIN INFORMATION_SCHEMA but varies depending what RDBMS
 
Im not sure JOIN would be needed unless coming from different TABLES
 
d'awww this makes me feel all warm and fuzzy.
@ckuhn203 , thank you very much for the bounty!! This really livened things up :-) I will test everything before the end of the bounty and get back to you. Million thanks! — Wim 9 hours ago
 
If you're talking about SQL data types, those are not stored with the data in the schema (e.g. myDatabase.dbo.table but rather myDatabase.INFORMATION_SCHEMA.columns )
 
consider this
$id = $id << This is an array of ID's
To delete all rows with the ID's in the array i can do a simple PREPARE, BIND EXECUTE like so.
$where = implode(',',$id);
$query = 'DELETE FROM wcx_articles WHERE article_id IN (?) ';
$stmt = $backend->prepareIt($query);
$stmt->bind_param('i', $where);
as all ID's are integers
what if i wanted to delete a string an integer and a double?
but didn't know the amount of each
I think ive found a bug on this page
 
This is also an interesting read for Java programmers: wikis.oracle.com/display/HotSpotInternals/PerformanceTechniques
 
5:25 PM
i stretched my input box now its out of the screen
 
you just need to stretch the browser window across monitors, so you can re-size the input box back
or you could refresh the page, but that's not as cool
 
@CodeX that is an interesting query programming question.
 
Hyperlink 404 checks should really be mandatory for websites!
 
this is much better!
#input-area {
position: relative;
}
#chat {
padding-bottom: 50px;
}
 
@CodeX You only have... 3 starred messages?
 
5:35 PM
I dont know...
@skiwi Where do i find that out?
 
@CodeX It's your screen resolution NI guess, not much you can do about it I'm afraid
Good answer there @rolfl, I knew you would answer that one from when the question was born!
 
Thanks ;-)
 
5:56 PM
0
Q: How to optimize K-nearest neighbours in C# for large number of dimensions?

ubuntunoobI'm implementing the K-nearest neighbours classification algorithm in C# for a training and testing set of about 20,000 samples and 25 dimensions. There are only two classes, represented by '0' and '1' in my implementation. For now, I have the following simple implementation : // testSamples ...

 
Monking @all
 
Hi @Nobody
 
Monking @Nobody.
 
I think that I might want to change my Avatar.....any suggestions?
finally passed @Syb0rg for rep gained this year!!! codereview.stackexchange.com/…
 
6:12 PM
Hey cr
 
@skiwi There's a "show 7 more" link showing. It's just not showing all of them.
Ever since I started mentioning "Scottish Notation" I'm starting to see signs of it everywhere!
2
 
Hey @AlexL
@AlexL good answer
 
@ckuhn203 LOL
2
 
@AlexL: By the way, you may accept my answer as I've already fulfilled that request.
 
6:23 PM
@Phrancis, how do I keep a Dataset from being run based on parameters given to the report in SSRS?
 
@AlexL Hey
 
@Malachi I would probably write a statement like START TRANSACTION /* work here */ ROLLBACK /* conditions here */ COMMIT;
 
where do you put the statements though in SSRS? this is that deal where I want to keep it from running the datasets at all because it will run reports that end in an error because there is no information to query
 
Can you post the SQL code you have right now in here?
 
@Phrancis Thanks! @Jamal Gotcha, wasn't sure when i was supposed to accept, so I just left it @CodeX Any work done on the site!?
 
6:31 PM
@AlexL All sorted, working on too many things, i need to prioritise!
 
@CodeX Ha, makes sense, the site shouldn't really be a priority
 
1
Q: Sessions and Authentication

salivanI've a feeling I'm overdoing my Auth class, and that it could be done in a simple more understandable way? Could you give me an advice on this, please? Note this is for my learning process... I just want to learn. This is why I am 'reinventing the wheel' class Auth { protected $pdo; p...

 
@AlexL Took the offending script off so should be ok now ;)
 
@Phrancis Did you ever find out whether the CTE or the temp table solution was faster?
 
6:47 PM
@200_success no, I found out our IT dept doesn't like when non-IT staff modify their "creations" no matter how bad they are. I should make me a folder and just make my own however unfortunately all I have access to is the web-browser based interface so making reports from there is a PITA.
 
That's the kind of attitude that encourages people to keep all their data in a spreadsheet.
 
I'm looking to actually apply for our data services team soon maybe I can get into IT myself and make reports that actually work predictably. You're not going to see SELECT DISTINCT * when I make a report ;)
 
@Phrancis Drop a DVD on their desk with a video of you pointing out all their mistakes in a "cheeky twat" sort of way ;)
 
@CodeX I'm sure that's going to work in my favor...
 
@Phrancis Seriously. What is that shit?
Please tell me you didn't find that somewhere.
 
6:52 PM
I did. On an INNER JOIN to two tables, one of which is over one hundred million records deep and 200+ columns wide. No wonder it took like 45 minutes to run.
 
 
and the other being a #tempTable
 
@Phrancis Just wow
 
I'm assuming that no one considered a 45 min. query to be a problem.
 
Nice update to iPhone app!
 
6:59 PM
Well, no one other than me seemed to think that was unusual. All this work just to find duplicate entries? ... how about WHERE COUNT(Serial_Number) > 1
 
@CodeX What's up?
 
@ckuhn203 Not much man, just chilling right now with a glass of Red Wine
2
 
I meant with the app. lol
 
^^ lol
 
7:07 PM
HAHAA
Achievements Page, Real time Notifications, Customizable Tabs, Much much more..
 
Here is a piece of code I found attached to a ticket I submitted. This will give you an idea of the skill level of our SQL programmers.
 
INSERT a potato INTO an_animal WHERE hole='huge';
 
Ah it wont post
 
Thats terrible Phrancis..
My attempt at levity...
 
Select * from dbo.contract_detail WITH (NOLOCK) where contract_number = '32749588' and sequence_number = '001' SELECT * from dbo.contract_detail WITH (NOLOCK) where contract_number = '31687032' and sequence_number = '001' UNION ALL
^^ continue this like 50 more times
 
7:16 PM
No.
 
SELECT * ... interesting, did they need everything?
 
@Phrancis Select * from dbo.contract_detail WITH (NOLOCK) where contract_number in ('32749588', '31687032') and sequence_number = '001' <--- is that better?
 
They had actual columns but you get the idea
@SimonAndréForsberg Yes, that is how I would write it
 
@SimonAndréForsberg Yeah. There's a lot of overhead with a union.
A LOT.
 
@Phrancis And I don't even consider myself a real SQL developer...
 
7:18 PM
sequence_number should = 007..
 
It doesn't help that Contract_Number and Sequence_Number are VARCHAR instead of what they should obviously be, INT
 
Number. Sequence Number.
 
or DECIMAL(12,0)
 
And they didn't appreciate your input?
 
So, I stumbled on this beta. I like it. Lots.
 
7:21 PM
It's also very shy on standards... In 3 different tables we have the following primary keys Contract_Number .. Product_ID .. Brand_Code
(all VARCHAR of course)
 
@Phrancis Sounds like a job for
 
INSERT somethingSharp INTO yourEmployers WHERE theyLive;
 
@skiwi More like DROP SCHEMA dbo
 
@Phrancis For the primary key (if one of those are that), I'd agree. For the rest, it often makes sense to keep it as a string. Consider a phone number for example. It should be stored as a string rather than a number.
ALTER TABLE DROP `Contract_Number`; -- Oops.
 
@SimonAndréForsberg Yes but for indexing it treats VARCHAR funny... like 1234 and 1234567 would be next to each other even though one is orders of magnitude larger
 
7:24 PM
@Phrancis Yes, I know.
 
So new contract loads are indexed on the same pages as old contracts
 
@Phrancis But isn't that one the primary key for the table?
 
Yep
 
Then that definitely should be int / bigint
 
@ckuhn203 My dad practices Buddhism, its the most sensible way of thinking
 
7:27 PM
The problem with a mass edit is that the people that designed our apps are not very good programmers either
 
Well, it's at least practical @CodeX.
I like the concept of Mu. I've found it useful when programming.
 
@ckuhn203 Nothing?
 
Speaking of, I should probably be stumbling through a about now...
 
@Phrancis What did you expect? It's . It's probably one of @Mat'sMug's old coworkers that did it.
4
 
Unask the question.
 
7:30 PM
Mu is a negative i think
 
All the SQL is hard-coded into VB and passed ad hoc each time the application calls the db. Which is, constantly. With close to 500 users querying 24/7. It would require a redeploy of all applications after someone goes into to remove all the quotation marks.
2
USE STORED PROCEDURE STUPID
 
It's when you've been staring at your screen for an hour wondering how you're going to shove this Foo into that Bar and still have something that's going to work. But it's not going to work. Then you say "Mu. Unask the question. What's the real problem here." Then it's easy to see that you shouldn't shove Foo into Bar, but you need to refactor them both and add a Baz @CodeX.
I don't see how that can be a negative.
 
@ckuhn203 That is often so true.
 
@ckuhn203 I got confused with the Chinese / Japanese meaning of Mu, Buddhism Mu is neither yes or no
 
7:34 PM
@ckuhn203 Very Wise (bows)
 
Namaste.
 
Indeed..
 
I have to go now, my ass is hurting from this stool..
@Phrancis PROCEDURE THAT SHIT!
Goodbye ;)
 
Seeya @CodeX
 
7:38 PM
@Phrancis Cache bloat. That's what that is.
 
Definitely the wrong approach. Standardize, people
 
@Phrancis Nobody there heard about tools?
 
They know about spreadsheets here, that's about it
 
The spreadsheet they put onto their bread?
 
No that one is their
2
 
7:42 PM
We should all just form a company and start coding properly.
17
 
I've seen in one of our tables a column named unused HUH?
 
I'm so sad I'm out of stars right now.
 
@skiwi Sooner or later we'd just start arguing about Hungarian notation.
 
@skiwi I would guess so. @Nobody, you must have heard about tools, right?
 
This kind of stuff is worrysome:
0
Q: Android Pulling Contacts

JeffComptonI'm trying to loop through android contacts and upload them to our server. What I have now is unusably slow. The query itself is taking about two and a half minutes for 10,000 contacts and it appears to stop parsing data after the first batch. private static void syncContacts() { Res...

 
7:46 PM
0
Q: Android Pulling Contacts

JeffComptonI'm trying to loop through android contacts and upload them to our server. What I have now is unusably slow. The query itself is taking about two and a half minutes for 10,000 contacts and it appears to stop parsing data after the first batch. private static void syncContacts() { Res...

 
Why the hell would they need to upload all my contacts to their server?
 
Yeah. That ^
wtf?
 
I'll have to refuse to review that one
 
Could be an app like Skype where you can use it to call their phone with Skype
 
@skiwi Pin time!
 
7:49 PM
@skiwi It's broken code anyway.
 
@SimonAndréForsberg I feel honored now, my second pin!
First one was one day only though
Can it be edited to end with "and start coding properly."?
The English in there is too broken for a pin!
 
@skiwi Ask a moderator to do that.
 
Room owner not good enough?
To edit :o
 
I can't guarantee how long this one will be up there though, but I'd expect it to be there for more than a day
Nope, room owner is not good enough
 
Break time yay!
 
8:02 PM
Hammer is good enough ;-)
 
0
Q: Solr: Expected 3 Values but got 4. How do I prevent Solr from reading 4 fields in a 3-column CSV?

TaraBelow is a sample of the CSV file I'm trying to index with Solr (I can't change the first line displaying as a header here). As you can see it has 3 columns of data. I assumed that it read 4 fields from the first line, but when I take that out it throws an error saying the document is missing a...

 
@rolfl Thanks ;-)
 
@skiwi this is actually really, really common
 
And it shouldn't be.
 
facebook was probably one of the first ones to do it
and there it was kinda justified because they wanted to figure out who to tell you to be friends with
 
8:13 PM
Those big guys I can understand, it is not desirable, but I know that they will do such things... But I don't want a random app to do so
 
since then it's gotten pretty out of hand though
 
If he added the extra information originally to the question, then I would've understood
 
even random apps might be justified though
 
Yeah. It's pretty much needed for what they're trying to do.
 
if it's an app where you can do anything involving other people, it makes just as much sense
that could be anything from a file sharing thing to an MMO
 
8:14 PM
Not necessarily @DaggNabbit. I wouldn't say anything.
No. There's no need to download a users entire address book for either of those things.
 
of course there's no need to. FB didn't need to do it either
 
Perhaps you need temporary local access to it, but to upload it to your own server? No.
People always think "My code is safe. My server won't be cracked." Until it is.
 
doesn't matter. user willingly gives that information.
 
And if you never stored information you didn't need in the first place it wouldn't be a problem.
 
There's no way, as API provider, that you can ensure that the data will not leave the app, or is there?
 
8:17 PM
Are cursors as bad in Java as they are in SQL?
 
I mean you need to read a string to process it, it can be copied... and then it's already gone
 
@skiwi But does it have to be processed server side? That guy, yeah. Sure, but most use cases?
 
@ckuhn203 i don't know how you are going to correlate phone numbers with internal user identities without uploading to the server
not to mention do any meaningful data mining
 
@Skiwi: You can cut off all communication to prevent that
 
@DaggNabbit I've conceded that this guy needs to upload those contacts, but I'd like to know how you justify say, an MMO doing the same thing.
 
8:25 PM
@SimonAndréForsberg tools?
 
@ckuhn203 because they want to tell you if your friends are playing too, so you can friend them in-game
also they don't just look at your contacts to see who you should be friends with, they look at everyone's contacts to see if you show up in there
that's why they really need to be on server
 
@Phrancis I don't know how bad they are in SQL, but in Java they can be necessary. There is a Cursor class somewhere that is used for iterating through the resultset.
@Nobody Never mind, just an ordinary @Nobody joke.
 
Sounds like that Android guy could use some more SQL in his life. Seems overkill to make a Cursor to go through that many records, it would be a trivial task even for MySQL engine to move all this data at once
 
@ckuhn203 even systems that don't have friend lists use it for data mining though. If a bunch of your contacts are interested in X, they are going to assume you might also be interested in X
and again not just your contacts but people who have you in their contacts
 
@SimonAndréForsberg in SQL you want to avoid cursors unless absolutely necessary. Imagine his 150,000 records, suppose you have one INSERT INTO .. SELECT query that takes 5 seconds to do on the the whole table at once, your execution time with a cursor instead would be approximately (150,000 * 5) seconds
 
8:34 PM
@Phrancis But if he wants the data to his Android app, then he needs to use a Java-Cursor to do the iteration. I don't think a Java-cursor is the same as a SQL-Cursor.
 
Makes sense. I think the closest equivalent to SQL cursor would be like a forEach type of loop
 
A Java-Cursor is often used with a loop, to read all the results.
 
But all the SQL cursor does, basically, is take the query you write inside the cursor, and go through the dataset(s) and executes the query once for each record, so you can imagine how slow it is
 
0
Q: Basic timer from one minute to 0, easier way to do it?

user37605I'm a beginner in js and I am sure that there is a better way to do it (basic one minute timer from 01:00 to 00:00 running from pageload): window.onload=function(){ (function(){ setInterval(function(){ cro(); document.getElementById('unminut').innerHTML="0"+jocminut+":"+jocsecunda...

 
@Phrancis In Java there's no such thing as writing a query inside the cursor.
 
8:45 PM
Phrancis, Simon, the Java implementation of JDBC to the database imposes a virtual cursor on every resultset. Sometimes that virtual cursor is implemented with a real cursor on the database.
So, even running something like "select * from customers" has a Cursor.
Also, Oracle, only had cursors available for a while, IIRC.
 
@rolfl OK, that makes sense.
 
@rolfl this code is giving me an error I haven't seen before. Trying to emulate a cursor-like behavior on SEDE
DECLARE @start INT = 1, @stop INT = (SELECT MAX(User.ID) FROM Users)
WHILE @start < @stop
BEGIN
SELECT User.Id, User.Reputation FROM Users WHERE User.Id = @start
SET @start = @start + 1
END
Cannot call methods on nvarchar.Cannot call methods on nvarchar.
 
@Phrancis Doesn't the SEDE already supports cursors?
 
It does
I don't know how to write them though :)
 
@Phrancis neither do I :)
 
8:50 PM
Try this:
 
But you get the idea. In this case if @stop INT = (SELECT MAX(User.ID) FROM Users) was 10,000 then it would SELECT User.Id, User.Reputation FROM Users WHERE User.Id = @start 10,000 times (assuming continuous User.ID)
 
DECLARE @start INT = 1, @stop INT;
select @stop = MAX(User.ID) FROM Users;

WHILE @start < @stop
BEGIN
    SELECT User.Id, User.Reputation FROM Users WHERE User.Id = @start;
    select @start = @start + 1;
END
Note, additional semicolons everywhere, and change set to select.
 
Instead of just scanning through the whole table once
 
Also, you probably want the while to be <= instead of just <
 
I get confused where to put semicolons in SQL Server
I tried your method but got the same error
OK it looks like the RDBMS that's installed with Android software is SQLite. I would be tempted to take the user data, shove it into a temp table or extract it to a file, and pass that along to the server... thoughts?
 

« first day (429 days earlier)      last day (3587 days later) »