« first day (1076 days earlier)      last day (3238 days later) » 

00:21
Any thoughts on this migrated post?
0
Q: AVX2 method to average 4x4 block of UINT16s

PatrickPhotogConsider the code snippet: uint16_t ave_uint16_4x4_matrix(int xx, int yy, uint16_t **mat) { register uint32_t tot=0U, xi, yi; // Sum 4 by 4 square for(yi=yy; yi < yy+4; yi++) { for(xi=xx; xi < xx+4; xi++) { tot += mat[yi][xi]; } } tot >>= 4; // BitShift to do quick Gozint...

00:48
At best, I could argue unclear based on the several days old comment that never got a reply
But there is also this
> The intent is to average a 4x4 chunk of a larger uint16_t matrix and produce a single result which should fit in a ushort (not tested).
> (not tested)
01:29
#OldBookmarks
01:56
Swift initializers man...
0
A: Why convenience keyword is even needed in Swift?

nhgrifThe existing answers only tell half of the convenience story. The other half of the story, the half that none of the existing answers cover, answers the question Desmond has posted in the comments: Why would Swift force me to put convenience in front of my initializer just because I need to ...

0
Q: Leaky DAL or anemic BLL?

SnixtorParticularly for the sake of unit testing, I'm trying to implement an application with a layered architecture. I'm coding in C# and using ASP.NET Web API for the service layer. I'm aiming at a 3-layer architecture: Service Layer Business Logic Layer Data Access Layer The Problem I'm uncomfor...

0
Q: JavaScript, insert an interval into a list of sorted disjoint intervals

Daniel JacobsonThe code works on my one test case. What do you think about it, can it be simplified? /* if the interval list is [[1,5], [10,15], [20,25]] and you need to insert the interval [12,27], then your program should return the new list: [[1,5], [10,27]]. */ var insertInterval = function(insert, in...

0
Q: Update record with CSV

Drew OgryzekI'm using Rails 4.2.5, and I'd like to update existing records with a csv file with two fields: id,category. Where if the category field is blank, it defaults to misc. Here's an example csv file: id,category 123-123-123,0 123-123-124,1 123-123-125, 123-123-126,2 So, I've created some tasks, u...

02:34
0
Q: Understanding why this is the output of the code snippet?

D. ChangThe output of this code is aaa 3. I was wondering why this is the case. Is this because there is no return value on the mystery method? Thanks for the input. public static void main(String[] args) { String[] arr = { "aaa", "bbb", "ccc" }; mystery(arr); System.out.println...

@Jamal I don't know if it'd be high quality, but it'd be on-topic on SO.
@CaptainObvious feels very much examplish/hypothetical/illustrative-code-for-design to me
but on 2nd read it's too borderline to be fair to hammer, so I've reopened.
0
A: Extending UITableViewCell to preserve UIView background color when selecting the cell

nhgrifThis is a very strange approach for quite a few reasons. First, the fact that this is an extension of UITableViewCell makes absolutely no sense to me. The method is completely procedural. It takes in an array of views (any views... from any where). From these views, it creates an array of col...

02:57
how's this for
03:11
remonking
monking!
I'm 594 points short of 10K on SO!
nice
Eric Lippert has only downvoted on CR
LOL
and only one upvote on SO
that's an accident
IIRC
he has the rep to edit and remove it anyway
03:40
> The mathjax-fu is strong with this one
1
Q: Determining which vehicle Rob wants to buy

david Rob is looking to buy a used pickup truck. He will spend a maximum of $10,000 but would like to spend as little as possible. He will spend up to $3000 for a 2000 or older model, $5000 for a 2001-05 model, $7000 for a 2006-09 model, $9000 for a 2010 or newer model. Rob will not buy a re...

0
Q: one way hash using ascii

davidAssume the built-in function Ascii(c), where c is a one character string, will return an integer containing the Ascii value of that character. Write a function that accepts a string, uses Ascii(c) and additional processing to produce a one way hash value from the string, and returns the hash valu...

0
Q: Can you help make this more efficient??? FFT with Frequency Peak Output

NateyPythonCode: http://pastebin.com/wRMbT64i This code will perform fft using scipy. The phase angle is also found along with the maximums that correlate to a frequency. My main problem is that some of the frequencies are not found by the getPeaks function, even though they are above the set threshold '...

03:55
Programming homework is the stupidest thing since... uh how do I finish this phrase?
> write a function using nested if/else statements
yeah....
gotta start somewhere
04:13
0
Q: Associative table in sql server

davidIf I have 4 tables (Army, Navy, Air Force, Marines), all have serial number as primary key, and name. And I have a table operation which has op_num as primary key and op_name. I also have a table operation member, which associates the operation table to other 4 tables, how can I write a single SQ...

> nested
gross
just added my code — david 36 secs ago
I don't know whether it works, but he added it at least
I don't understand what that question is trying to ask in the first place
as-is, I think it'd probably be closed as unclear
04:52
0
Q: Google Chrome and Sublime not reading my code?

Jocelyn Wong<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Jocelyn Wong</title> <link rel="stylesheet" type="text/css" href="bootstrap.css"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script type= "text/javscript" src="script.js"></script> <script src="http://code.jquery.c...

Monking
Well, stats for CR from yesterday generated. Anyone want to see them?
05:13
Well, since no one is here...
Yesterday, we got 18 more accepted answers, 30 more questions were answered, 57 more answers were posted, 154 badges were earned, 196 comments were left, 41 more questions were asked, 11 more questions were unanswered, 105 more users joined, and 408 votes were created.
2
total rep generated?
Our Question Answer Accept Rate went down by 0.0188%.
Our question answer rate went down by 0.0252%, and our answer accept rate went down by 0.0034%.
@Mat'sMug I don't have that data.
I'm going to start working on my bot to get it to post these stats up.
That way we don't have to rely on my remembering to do it every day after work. :P
We just need to come up with a format we want it in.
If anyone wants to see what data points I have, I'll post them up.
05:34
Wow, I learned more from your comment than a semester of school :) thank you a lot — david 3 mins ago
SO did really badly yesterday, compared to the previous days.
are you analyzing Tuesday as equivalent to Monday?
i.e. are all days of the week treated equally?
Yes.
Though I'll be plotting them differently as far as weekday, weekend, etc.
I'm pretty sure weekend figures are lower
I think so as well.
Though, on Monday, SO got a large number of accepts.
Must be people going back to work after the weekend and realizing the SO question got a helpful answer.
05:40
exactly haha
I'll be allowing people to classify graphs by the day of the week and the type of day of the week (weekday/weekend).
So you can say: "show me the graph for Answers Per Minute for Monday's."
aye, I just said "show me the graph for answers per minute for Mondays"
Right.
:P
My SiteStats table is already 264KB, with only 5 days of data in it.
The ApiLog is already 2.4MB, with only 5 days of data in it.
I wonder if I should build an API for access to this data.
@Mat'sMug @200_success and I think the bug you pointed out isn't a bug. :P
05:52
I know, I know lol just edited it... I missed a bullet in the specs!
fixed!
but seriously, that spec... tells you what to name your variables... with Hungarian Notation. sheesh
0
Q: Associative table in SQL Server

AddieIf I have 4 tables (Army, Navy, Air Force, Marines), all have serial number as primary key, and name. And I have a table operation which has op_num as primary key and op_name. I also have a table operation member, which associates the operation table to other 4 tables, how can I write a single SQ...

0
Q: How can I solve this problem about decreasing values?

oliv_94I'm a beginner to programming (starting with Javascript), and I'm making my own exercises for practice. I successfully completed problem 1 that I created, but need help implementing problem 2. I've been stuck for an hour. Problem # 1 There are 250,000 infected computers. Every 20 minutes the n...

@CaptainObvious broken
0
Q: Optimizing jQuery list filtering

JuxhinScenario Currently filtering through a list of ~3100 rows of data presented to the end-user in the form of an index (think, list of car models). This is done in such a way that every item is available in a long list to the end-user however they have the possibility to filter down their results...

06:35
0
Q: Play around with wait and notify in Java

soufrkThe following is an a self-tutored attempt to take a leap into understanding simple usage of wait() and notify() methods. The code is responsible for scanning a directory structure with each directory being scanned by a new thread, for the files present in it. All results to get accumulated in a...

@CaptainObvious Migrated.
07:16
0
Q: in Php Need to get an algorithm to generate strings to number in Condition that they dont repeat

Hracho Avagyanfor example I got string '555abc', need to generate 333012 ,333013 ,333023 ,333213 ,333231 and so on.... until all combinations will output.. not allowed to reapeat combinations and letters also, for example 333011 or 333010. so have to check with if statement 2 times, one that check to generat...

07:30
@CaptainObvious Gimme the codez
07:56
MOnking
Kaz
Kaz
Monking @all
This deserves some upvotes
1
A: Benchmarking things in C#

Nikita BYou've got some pretty poor variable names there. For example, what's m2 supposed to mean? I don't like the fact, that result generates itself. I would rather have two separate classes: one to run a benchmark and one to represent benchmark result. Also calling some Benchmark.Run method makes m...

Naruto answer; accepted non-selfie answer with 0 score: Application container design
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Displaying a currency value
Oh no.
We have problems with dates and time zones in our app.
2
@DanPantry conga rats, you're officially not having a good week ahead of you
Basically, the app is displaying all times in GMT.
This is fine.. but DST happened.
And so now all some (which is arguably worse) dates are displaying as 10am GMT+1 even though it's 9am.
2
Kaz
Kaz
08:09
@DanPantry Not just datetime errors but inconsistent datetime errors. Yeah. Have fun with that :P
0
Q: Code for finding repeated entries with different data

Satwik PasaniFollowing is the code I wrote in R. project is the data frame. For the purpose of the code, HOUSE.NO is a column of the type character, and NO..OF.FAMILY.MEMBER is another column of the type integer. My aim was to find out the house numbers which repeated, and then find out if the no of family m...

Well , If I know the code I will write it myself :) actually I know why this site created just to look at code and see how much its properly written, but here people react fastly then at stackoverflow for example so therefor I post it here, you actually can be much cool if you answer my question and not dislike :) thanks — Hracho Avagyan 41 mins ago
08:29
2016-04-14T09:00:00Z
The above time is 9am right?
"Thu Apr 14 2016 10:00:00 GMT+0100"
Zulu, yea
Yeah, 10am in GMT+1...
so 9am in GMT
Okay so a better question then is why the hell is it being recorded in GMT but displayed in GMT+1
> I don't always visit SE sites, but when I do, I spend my time filling "About Me" section of my profile to get a badge.
0
Q: Returning functions within JSON

YogeschAfter coming across Douglas Crockford's views on class-free OOP, and doing away with new and this in Javascript I tried defining an object with its own variable and function, and returning it in JSON, as shown below: var newObj = function (name, lang){ var obj = { "name":name, ...

08:44
wtf it gets even more confusing :D
the same date string is also being parsed as 8am sometimes
the suggested edit on that should be rejected
wtf.
var offset = -scheduler.view().startDate().getTimezoneOffset() * 60000;

var start = new Date(scheduler.view().startDate().getTime() + offset).toISOString();
I guess that's why the scheduler works and nothing else does
oh.. oh dear
I think that means all dates are being recorded without respecting the timezone
3
@DanPantry Shouldn't localisation fix that?
@DanPantry There's your problem :P
to be clear, I'm not 100% sure
But that would certainly explain why when I type in 9am in the GMT+1 timezone it is recording 10am GMT+1
it is also just very possible that the server itself is returning the wrong date/time
data seems to be being recorded correctly, but we lose timezone info. :s
Okay so here's the detailed rundown even though ya probably don't care, basically timezone info isn't being stored in the DB. We sent a string to the server saying it's 9AM GMT+1. The server then discards the flag and just stores 9AM in the DB. Then when it retrieves the date/time, it slaps a UTC flag on it.
The client then assumes that it is UTC and so it goes ah so I'm in GMT+1, so it's 10am!
And the reason why we haven't noticed it is some asshole previous developer decided to remove the entire timezone offset in the front end
09:05
Multiple places where you could fix that, are all involved parties open for modification?
This is going to get messy.
0
Q: Simple function to generate an HTML-safe string. Or isn't it safe?

Ismael MiguelSometimes, we have to do some fixing to insert a string into an HTML property. Or just to display it. But not everything is safe! Consider the following example: document.getElementById('name').innerHTML = prompt('What is your name?'); This allows to introduce HTML vulnerabilities quite eas...

09:30
@MAst luckily only the DB is really affected
So i mean that's a good and bad thing
also holy crap its pay review time already..
@CaptainObvious dont try to hand-roll your own sanitisation strategy mate
Zak
Zak
> As a general rule, if you have to ask "is this safe?" then it's not.
If you want it to be safe, you don't roll your own.
09:51
Also the issue would be solved with just using input and sanitising inputs before doing anything with them on the server side (which you should be doing)
if you set innerHTML in a response to user input you did it wrong (generally)
@DanPantry I've seen many apps do such trickery.
Generally being the keyword
Of course at some point you will have to set .innerHTML
        private static string SanitiseHtml(byte[] notes)
        {
            string stringNotes = Encoding.Default.GetString(notes ?? new byte[] { });

            return stringNotes
                .Replace(TerminatorCharacter, string.Empty)
                .Replace(Environment.NewLine, "<br/>")
                .Replace("<FONT", "<span")
                .Replace("</FONT", "</span");
        }
oh dear. i guess i should fix my own code before telling other people to fix theirs.
lol
It is almost never overkill when it comes to security measures in code. — Dan Pantry just now
My colleague has an amazing ability to make me think I am wrong I am not.
"You need to send UTC dates from the client" "We are" "Yes but you need to send UTC dates from the client"
"2016-04-14T09:50:00.000Z" - client just sent this, so the client si definitely not wrong, the issue is the DB. >.>
@DanPantry Perhaps he means to send the UTC flag with it?
Otherwise it's just a date which happens to be collected in UTC.
09:57
@Mast "2016-04-14T09:50:00.000Z" is a time already set to UTC time
But without the stamp, it isn't UTC date.
so it was recorded at 10:50 GMT+1, which is 9:50 GMT / UTC
The client is already normalising dates to UTC
So the client takes UTC, sends UTC and the database saves it as UTC?
I think the issue is in that last step
I don't think the server is taking into accoutn timezone when saving
It's just taking date/time from the date/time object and saving it as is
or, rather, it is saving 10:50
i don't even know any more ._. this is so confusing
It shouldn't, it should save as UTC.
Don't let the database do the calculations for you.
09:59
s/db/server
So what kind of magic happens between the client and the db, server-side?
That's what I'm attempting to diagnose
0
Q: Category filtration

kil lieI have built a jQuery category filtration script that calls a WordPress calendar page with a category querystring. This works but I'm wondering if the code can be optimized at all for a smoother experience. I also get an issue that if I click the buttons too quickly, two instances of the calendar...

ahhhhh
I see the issue
The date pickers are recording dates in GMT
so when I pick 11am I am actually picking 11am GMT
i hate date times
10:15
in my 1-1 with my boss he said he might consider React if I could present a small demo of it
10:33
0
Q: JavaScript function for to toggle multiple CSS-classes at once

st88The method toggle of Element.classList expects a parameter which names a CSS-class. You can't assign multiple classes at once by using for example an array. So you have to write something like ... div.classList.toggle("hidden-element"); div.classList.toggle("border-defs"); div.classList.toggl...

10:45
      const timeZoneOffset = new Date().getTimezoneOffset()
      const items = response.data.Items.map(function (item) {
        const newDate = kendo.parseDate(item.Date)
        newDate.setTime(newDate.getTime() + (timeZoneOffset * 60000))
that is the most disgusting piece of code I have ever written, ew
2
10:57
oooo I'm all over the starwall hi mom
2
11:10
you are the starwall
> Customer: "I get this error when I check my mail. It says, 'There are no new messages.'"
@DanPantry Does it fix the problem?
11:27
Basically re-wrote that post, haha
I dunno @Quill, the edits fixed typos and then broke the code up into form page and active page... Maybe increased some readability in that manner.
It's a harmful change, you shouldn't change the code in a question
@Quill Nuked.
I always get a bit suss that they're the same person and the accounts should be merged
rare occurence though
@WaymanBellIII OP puts his code up for review. Unknown party changes the code up for review. That's not how it works.
11:31
that doesn't make it their code anymore
@Quill In that case they should contact a moderator, not our problem.
they usually don't know that it's a problem
@Mast Visually, yes.
Doesn't fix the crap data problem
@DanPantry So your boss will think the whole problem is fixed and won't understand why you're not moving on to something more pressing. Got it.
lol
It's funny because it's true
But, no, he asked for me to fix it visually, he understands there's a deeper issue @ play here
My boss is fairly reasonable most of the time
He's worked in IT so he knows things arent' as simple as they seem
11:36
Some people are really good at really analogies for these things
> at really analogies
nap time for Quill I think
I had a long day >_<
I had to literally run alongside the bus to the next stop today
wot, something is changing my values to null
or maybe they're never set?
No, they are set.
14 is what it should be, something is changing it after the fact
mom's spaghetti
mom's spaghetti is changing it
This is, by the way, two way data binding sucks.
And also why mutability sucks, because that is what is causing the issue.. durr
hahaha
caution fbombs in that thread
11:50
1
A: Football game using factory and command patterns

forsvarirThis is some initial feedback, based on your unit tests. If you're going to submit unit tests as part of an interview application, treat them as first class citizens. My personal opinion is that it would be better not to submit unit tests for the work you've done, than to submit unit tests that...

nice first answer
0
Q: Refactor Java Code

BaigKindly accept my apologies as Java is something my mind cannot digest no matter what I do. At the moment I have an assignment and have written a piece of code and have used Constructor (I think so) but not sure if I have used it correctly and if Yes then will need some guidance in order to refact...

I'm seeing a pattern ;-;
0
Q: combine multiple queries to a single query

sum1I have these three query SELECT CONCAT("You sent track request to ",u.username) AS ACTION, h.`dateTime` FROM login_user u LEFT JOIN history h ON u.id = h.`toUserId` WHERE h.`fromUserId`=28 AND h.`Action`="Request"; SELECT CONCAT("You Accepted track request from ",u.username) AS ACTION, h....

12:09
so I'm supposed to do a website project for web tech class
we're at the project plan phase, and we're supposed to detail the site
later on, they're also supposed to give us a MySQL database (yes that means PHP ;-;), but they don't tell us what the data in the database will be
group project classwork
gross
meaning we can't design the site to what we want, because we get a dataset later on
the project is a mess; the assignment task sheet is riddled with redundancy and spelling mistakes
@nhgrif no, individual work
Seriously though, a basic web template takes a few hours, and the "backend" a few more
If we're supposed to display searchable/categorisable data, doesn't that kinda imply a CMS style thing? ;-;
can I just have my piece of paper and go back to work pls
0
Q: Java: Book Library transaction simulator

MaitiuThe following piece of code is giving me a massive headache. It only kind of does what I want it to do, which is take an inputted string, and then search the arraylist of book objects by the object's classification (a string) and then return that book object. Currently the code below works as lon...

0
Q: combine multiple queries to a single query

sum1I have these three query SELECT CONCAT("You sent track request to ",u.username) AS ACTION, h.`dateTime` FROM login_user u LEFT JOIN history h ON u.id = h.`toUserId` WHERE h.`fromUserId`=28 AND h.`Action`="Request"; SELECT CONCAT("You Accepted track request from ",u.username) AS ACTION, h....

oh god why
also looks like unwritten code request
the answer is a SO style answer as well
Broken code Java: Book Library transaction simulator - Maitiu - 2016-04-14 12:07:51Z
The dutch leading the way in awesome again.
12:22
I think I am just used to having higher privileges on so. There is an invalidation via two edits on this question. I want to roll it back to 2 revs ago to Jamal's edit.
3
Q: Create share folder and AD security group and apply security to new folder

Shane JohnsonI think I'm finally done with my code and was hoping for some pointers. My goal for this script was to: Create new folder Create AD group FS-TESTSHARE-R Create AD group FS-TESTSHARE-RW Apply both groups to the new share folder Set full read permissions to FS-TESTSHARE-R Set full read/Rights per...

You're pretty close to getting the privilege I guess
Reverted to janos' edit before invalidations
Man, I hope @Duga is back soon. :(
also the new pc budget has been left in the hands of our CTO now, so I think we will be getting new laptops sometime this year
@DanPantry jamal's, right?
@Vogel612 Uh, yeah, that.
12:28
starts with ja, five letters, has a diamond
I just see "ja" and stop reading. I should have thought it was Jamal because he edits everything
close enough
@DanPantry 200 also has an edit in there
which reminds me.. I wanted to try to fix Duga
@Vogel612 Yeah, but that was before the invalidations. I just looked for the first edit before invalidations.
@DanPantry I was quite confused by the dates in there...
Could it be that the Revisions timestamps are in local time?
12:29
    if (e.event['taskId'] && $scope.ShareSvc.UserPreferences.OpenCompanyOnCalendarClick &&
        ($scope.ShareData.CompanyId != e.event['Contact']['CompanyId'])) {
        $scope.ShareData.CompanyId = e.event['Contact']['CompanyId']
        $scope.$apply()
what the f..
Haha, no, they aren't @Vogel612
because the Post timestamps are in Zulu-Time, but the invalidating edit was "10 minutes before" the answer was even posted
The timestamps for me are showing in GMT
@DanPantry that is local time for you ....
No, local time is GMT+1.
some fields show in local time others in UTC, there was a mse fr to standardise the displayed time
12:30
It's 13:29 here right now, but the rollback timestamp is showing 12:24
(our clocks are out by 3 minutes)
So I guess SE has the same bug I did this morning :D
hmm... Revision 9 is at 2016-04-14 00:33:..Z
I am seeing the exact same thing as you though
and Answer was posted at 2016-04-13 00:47:..Z
......so we done goofed
s/we/i
comparing date-strings is a pain
Answer was 1 day before invalidation
almost exactly
12:32
oh... yeah >.>
the day field.. that exists
@DanPantry you need the global flag for that ;)
I was so incredibly confused it took me ages to press "rollback"
I've already rolled back @Vogel612
I know
I've read too many date time strings today.
Far too many.
Why can't I just go back to when I was 16 and slept so much I literally couldn't remember what day it was
12:34
Thanks for the help @DanPantry
I never appreciated quite how hard it was to read one-line if statements without braces until now
@DanPantry my brain only knows three dates: Not friday or weekend, friday, weekend
3
@DanPantry Your mom should stop messing around with code.

« first day (1076 days earlier)      last day (3238 days later) »