FroshKiller All American 51911 Posts user info edit post |
I'm not gonna post the code, but here is a stupid, simple hack.
The problem: Adding a new row to a .NET DataTable did not automatically increment the row number column by 1 as expected. Instead, the new row's number was double the value of the previous row, e.g. row 4 was followed by new row 8.
Observation: This only seems to happen when records in the imported CSV file were sorted in descending rather than ascending order on the first column.
Workaround: Fuck debugging, force the ascending sort after import but before handing off the DataTable to have new rows added, kiss my ass with two middle fingers in the air.
[Edited on July 28, 2014 at 2:15 PM. Reason : Peace, we outta here.] 7/28/2014 2:15:07 PM |
shoot All American 7611 Posts user info edit post |
Coder thread! 7/28/2014 3:20:23 PM |
Smath74 All American 93278 Posts user info edit post |
27609 7/28/2014 6:41:05 PM |
BlackSheep Suspended 1575 Posts user info edit post |
System.out.println("Go Fuck Yourself"); 8/5/2014 9:34:01 PM |
FroshKiller All American 51911 Posts user info edit post |
hey look at that
a shit poster posted some java
this shock to my system could hospitalize me 8/6/2014 8:24:06 AM |
FroshKiller All American 51911 Posts user info edit post |
I don't think I'm going to post the code, but I had a good idea that I'm getting to implement.
We have a set of vendors we export information for, but different vendors have different ideas about which records are relevant to them. The rules can be pretty arcane. One vendor might accept records for all widgets, another vendor might only accept records for green widgets, another vendor might only accept records for widgets with at least three widget accessory SKUs.
The requirement I had was this: Modify this widget export configuration screen to show live counts of widgets that match a particular vendor's rules. The screen will currently show, say, 300 widgets that aren't configured for export for a vendor, but when you drill down to see which ones they are, only the 10 matching widgets show. The users want to see up front before drilling down that there aren't 300 widgets, there are only 10 matching.
The first instinct my project leader had was to write a different query per vendor and run each one to get accurate counts. Except that's horseshit when you have several dozen vendors and thousands of widgets. If there are 40,000 widgets in a collection, I don't want to run 60 different queries that return record sets up to 40,000 rows each.
So I suggested that instead, we give each widget a bit field stored as an integer in the database. Then, we assign each existing exclusion rule a power-of-two value. When the export configuration screen is loaded, we run a stored procedure for the current collection to check and set the bits for the exclusion rules. Then we just grab a record set of the widgets including the integer value of the bit field. Each vendor gets a bit value for its exclusion rule, so the line for each vendor on the screen just shows a count of the widgets for which the exclusion rule bit is not set.
P.S. Does this sound familiar to you, vertigo? 2/4/2016 3:19:36 PM |
FroshKiller All American 51911 Posts user info edit post |
I actually improved upon my original idea. Now, I just get the counts grouped by the vendors' bitmasks with the bitmask column as the DataTable's primary key, and to display the correct counts, I just find the row in the DataTable that matches the vendor's bitmask. This works even better since some vendors have the same bitmask. 2/17/2016 9:09:29 AM |
qntmfred retired 40719 Posts user info edit post |
I changed some spaces to tabs today 2/17/2016 6:43:20 PM |
Noen All American 31346 Posts user info edit post |
^^Gah you got to it before I did. For reasons I never want to think about, I've had to deal with bitmasks for storing config flags in Java, Javascript and C++ (COM) in the last few months. It reminds me why I became a designer.
On the flip side, its insanely efficient at doing exactly ^^^ 2/18/2016 1:58:59 AM |
smoothcrim Universal Magnetic! 18966 Posts user info edit post |
won't post the code because, I haven't written it and it would be way too damn long but was trying to figure out how to do data transforms and visualizations. The problem is the data is basically the serialization of hundreds to thousands of legos and what they're connected to. I realized I basically had a semantic network and started using AI techniques to discover structures that make the description and visualization human readable at very high data volumes. 2/18/2016 8:24:08 AM |
krallum2016 All American 1356 Posts user info edit post |
My job won't let me do this starfox 2/18/2016 4:28:43 PM |