« first day (1783 days earlier)      last day (3206 days later) » 
00:00 - 18:0018:00 - 22:00

user41796
6:00 PM
> I'm voting to close as this belongs on Programmers.SE
 
Does anyone else have problems getting their Reddit frontpage RSS feed into Feedly?
 
6:17 PM
@GlenH7 If only.
 
user41796
It would be hilarious to do if there was any reasonable reason to make the claim
 
hi
 
hi
 
has any one read the brainfuck source code ? :P
 
lol
 
6:21 PM
I actually had a few questions ... first is why use a linked list rather than a stack ...
and second is github.com/fabianm/brainfuck/blob/master/include/… what the purpose of this.. is it normal in a compiler design ?
 
@blackbee you mean, like, why would you ever do it?
 
@Ixrec umm, I actually don't know ... is it a linked list by design or can be a stack too.. I don't have much of CS background .. I was trying to read Compiler Design from here and there ... but reading understanding and then again reading will take months.. :P so if I could get some key hints then I could actually see and write and understand as I write ... that makes faster :P
@durron597 looking
@durron597 that's the 3 file brainfuck souce in this few lines in erlang ?
" inspiring many a programmer to write up their own Brainf*ck compiler, interpreter, or quine" ah so I am not the only one ... cool
"another tuple representing the state of the Brainf*ck tape" what does it mean "state" of the tape ?
 
I'm not sure if I fully understand the interpreter code but I've probably looked at it long enough
"state" is a very general term, it basically means any information that persists after a given operation is performed
 
6:37 PM
ok .. so it would be useful in case of loops ..
 
the value of a variable is often considered "state" if it lasts long enough, typically across several function calls
in OOP the fields on an object are almost always "state" in some sense
 
yeah ... ok ..
 
a low level example would be that every time an arithmetic CPU instruction gets executed, various "flags" in the CPU are set; the status of those flags would be another kind of "state"
 
0
A: Handling if-statements with a known duration

Nick AlexeevWhat you are proposing looks like a Replace Type Code [or a conditional] with State/Strategy refactoring. Reasons for doing it [coming up] Reasons for not doing it [coming up] p.s. I think what you are describing is a kind of a state pattern rather than stategy pattern. Having said that, sta...

should I downvote or give this guy a few minutes
 
also, in C, you'll often build the stack via linked list since it's easy to pop
 
6:39 PM
@Telastyn easier than an array implementation?
 
user41796
@whatsisname In that particular case, give him a pass
 
I'm having trouble thinking of an advantage other than it being a stable data strucutre
 
user41796
I left him a comment though. Nick's dropped in here a few times and is a mod over on EE. Normally, he doesn't put out answers like that on Progs
 
@ixrec - it's a pain to realloc arrays in C, and since you don't know how large your brainfuck is going to be.
 
ah, good point, it's been too long since I did proper C
 
6:41 PM
what is that TAPE_SIZE 3000 for ?
 
"too long" hah
 
that's part of the definition of the Brainfuck language
 
user41796
@blackbee to provide a longer rope with which to tie the noose that will go around your neck.
 
:D
 
it is the default execution context size. brainfuck.c:42
 
6:42 PM
"The brainfuck language uses a simple machine model consisting of the program and instruction pointer, as well as an array of at least 30,000 byte cells initialized to zero; a movable data pointer (initialized to point to the leftmost byte of the array); and two streams of bytes for input and output (most often connected to a keyboard and a monitor respectively, and using the ASCII character encoding)."
I assume the 3000 comes from that
#define BRAINFUCK_CELL_TYPE int
...
char* tape = malloc(sizeof(BRAINFUCK_CELL_TYPE) * size);
 
yeah, but brainfuck programs are so long .. I guess that is used for computation purpose like any caching of intermidiate result .. maybe .. dunno
 
hm, ok, never mind, apparently it's giving you 3000 ints instead of 30000 bytes
that might be a violation of spec
it's nothing that complicated, all programming languages of any kind need some way of storing values
 
ok..
 
in a normal language you'd get "variables", but Brainfuck just gives you one big array for everything
 
I expect it's taking the Turing machine tape literally.
 
6:47 PM
Guys, I need a suggestion. My app will have user accounts, groups that they can create and be invited to and simple data entries in those groups. The app will be HTML5 hybrid (Phonegap, Ionic, etc.). The problem: app needs to work offline and sync with main database when online. What's the easiest way to achieve that? Users should only be able to access groups that they belong to. I considered PouchBD, but it would be too insecure.
 
yeah, it probably is an allusion to that
@Andrew are you asking us to recommend a client-side persistence library or an app framework that completely handles this issue?
(I can't help with either but may as well clarify the question now)
@blackbee any questions that we haven't answered yet? it was a bit confusing at the beginning
 
@Ixrec no.. I have a little more insight now.. the other parts will get more clearer as I type the codes.. for now I will just do the simple + and ">" ... hopefully those won't be complex like looping.. .. thanks for the help .. to bothof ya
@Andrew nothing on client side is supposed to be secure ... that's why people come up with persistant login mechanisms .. I would say.. not to allow users to do stuff that needs sending request to server and validating stuffs .. and other than that .. I like indexedDB , but then I never did pouchDB :P
 
@andrew - the easiest way is to not require it. Synchronization is notoriously difficult to do in an automated fashion. After that, restricting what the user can do disconnected helps. Mostly, it helps to have a single source of truth so you can say "server wins" and resolve conflicts easily.
 
@blackbee it's not inherently insecure as long as authentication is done on the server before accepting any changes; the hard part is getting synchronization right in every conceivable corner case
 
6:57 PM
yep .. plus there can be things like .. id: 1 sent a friend request to id: 2, now that gets stored in my localStorage and then I a hacker(black..ish) tamper that data, replicate it and change the id's :P .. so better not to allow such stuff... ( I am not saying that its not possible by modifying the request data on the fly.. if someone wats to crack he/she will crack)
 
whether the client tries to do offline stuff doesn't add any new places for the evil client to fiddle with things; the server should just do what it always does
 
hm.. that's true
 
Are there any solutions to help with syncing? Or should I just use my favorite language and write an API for the app to communicate with?
I'm reading something on Couchbase Lite now, but still not sure if it's what I want
 
in theory your server-side API should not have to change at all; when an offline client comes back online it can just send the same requests it would've sent if it never went offline to begin with
 
@Ixre
 
7:03 PM
nods server shouldn't know if client is "online" or "offline"
 
um.. you could use the a localStorage that would save those offline requests.. and then if you have Connection object.. that can have a status... (ping the server to see if there is a connection, or someother way) and watch that object (MutationObserver) and when you have a connection..just execute the requests from the localStorage ..
 
yup, pretty much ^that
 
otherwise you're doubling your headache
twice the aspirin, think about it
 
the real nuisances are mostly UX issues, and the fact that race conditions (two users updating the same thing) become far more likely when introducing offline-ness
ideally, you already have ways of dealing with "this item was already updated, discarding your changes" or "saving to some other file" or whatever, and those ways work just as well when offline-ness was involved
 
yeah, if you need the server to calculate something, will you duplicate the code? and have it on the client too?
or you will say "sorry" to the user?
you need to think this carefully, Telastyn advice is good. think what your client can do offline
 
7:07 PM
also have to keep in mind the case of a single client trying to update something from multiple devices (presumably because the first one failed; this happens to me all the time)
 
nods
 
I wont need updating in my app, only adding or deleting entries, so that's not a problem. I guess the "client was never offline" approach is reasonable. The only problem is - I need to to emulate the API when offline somehow, so the app can still work. Not sure if I expressed myself clearly.
 
yeah, if you're offline, use another instance of the API interface, that queues requests
 
user55340
Ant mapper regexp task, you are beautiful.
 
when online, send those
 
7:09 PM
what he said
if your client-side code has a clean separation between business logic, presentation logic and "talking to the server" logic, it should be straightforward
 
things can get a bit messy if a error occurs too
how you will handle it? will you clear the queue?
will you let the client retry?
as in restore the client to the point he can edit the data and send it again?
 
I think he partially covered that with "only adding or deleting entries"
that does rule out a lot of the nastier potential conflicts
 
well, if you fail server side validation
I wrote a validation api that was the same on both side, that was neat
 
deleting the same item twice and adding duplicate items are the only things I can think of, but even those can be easily done while leaving the server side state mostly sensible
 
nods
 
7:13 PM
the really fun part is when you have an app with undo/redo that lets multiple people work on a document or whatever at once
 
fun as in headaches?
 
fun as in someone else on my team did it and it works very nicely
 
sweet! :D
It sounds a complex task
 
yep, there were one or two architecture meetings to ensure we got it right
each command object we pass around comes with hashes of the document state before and after, so we can immediately detect a multiple editors problem
and so on and so forth
 
cool, it managed to merge the changes or you rolled back the newer changes?
 
7:17 PM
for this app, the desired behavior is as soon as we detect that, the "slower" editor gets an error saying "someone else just changed this"
we don't want to merge commands because of the risk of people accidentally doing things they didn't want to do
 
nods sounds reasonable, kudos
 
it's not quite like google docs where, if you're in the app at all, that almost always means you want to edit it; our app mostly stays put and gets watched all day, then occasionally edited when the user decides they want a change
(it's for monitoring real-time financial data)
 
My app is gonna pretty simple - users can create and belongs to multiple groups. Every group will have a very rarely-changing list of items. Users will be able to create or delete new entries which will contain a few numbers and checkboxes for each item in that group (that's called one-to-many relationship, right)?. I think that storing offline requests in localStorage and executing them later will be fine. The main reason to use the app is to see the summary computed from all the entries.
So the only problem left is how do I do calculations when adding new entries offline.
 
when you add an entry, do you make a server request and then do a "full refresh", or do you update the client state directly alongside the server request?
 
Haven't thought about that yet. Maybe the answer to offline calculations could be to have detailed enough total numbers loaded so I can add or subtract from them when adding new entries.
 
7:28 PM
yep, can't do much in offline mode if you didn't get all the server's data first
 
The entries are very small in size and they won't be added very often - probably a few entries per day per group at most. I guess doing a full refresh would be easier to code?
 
both are same complexity methinks
 
by "full refresh" I meant asking the server for all of the necessary state again
whatever UI widgets you use to display the data may or may not "refresh" in some sense, but for an offline mode to work the client-side state definitely needs to be updated "directly" on each command, rather than waiting for a server response
usually "direct" updates make for snappier UX anyway
our app does both, using the server's response solely to double-check that nothing weird happened
 
How many people have run out every single day on programmers.SE in the past 90 days? — durron597 12 secs ago
 
@durron597 surely you've learned now how to design good schemes for such things, yes?
 
7:36 PM
@JimmyHoffa I just thought you might like to answer it because you enjoy it
 
@durron597 appreciated; I actually would but I haven't the time right now (gots to make the codes...)
It's a good exercise though - tell me, when you read it, did you realize the synchronize on key solution immediately?
 
@JimmyHoffa I didn't read it carefully enough because I also gots to make the codes
 
@Ixrec thanks for the help. Now I'm thinking how I should handle localStorage more easily. Download all the entries into a JS array or only download first N entries and the summary numbers. Getting the whole list from the server and recreating my storage array should be easier I guess? That'd be more data to transmit, but it's gonna be very light anyway.
 
user41796
@durron597 The answer is "zero"
 
Ah well, when you have a little time - it's a good example of a common scenario where there's a few different good schemes available. Try and come up with a couple different approaches. Synchronize on key is the naive solution to the problem, and not a bad one.
 
7:41 PM
@Andrew yeah, at this point it depends on what the data looks like
 
user41796
even with the STCI cleanup, Programmers doesn't have enough sustained volume for any of the users to run out of close votes 90 days running
 
keeping the full list around is certainly a lot simpler (and more flexible) than keeping part of the list plus totals, so I'd prefer the former unless you have a serious performance issue
 
@GlenH7 should be a badge for that
 
user41796
I want to say that Shog pulled numbers on who routinely runs out of close votes here, and it pretty well aligned with the crowd that you'd expect
 
@GlenH7 I may have missed one day since may 1.
may.
 
7:43 PM
@durron597 which may are you emphasizing there?
 
user41796
Shog is reluctant to increase the close vote limit because he thinks it will lead to faster burnout from the close voters. But I don't think he's weighed that against the negative effects of feeling cut off or blocked from being able to improve the site on a daily basis, especially when a tide of crap questions rolls in.
 
@JimmyHoffa the first, but i suppose it makes sense to emphasize the second as well
 
user41796
IMO, it puts more burden on the close voters as they have to go back through the questions to find ones that they would have VTC'd if they had votes available when they first saw it
 
wouldn't you expect burnout to happen faster when we're forced to spread our close voting out across several days?
 
user41796
So I'd argue his concerns about burnout are actually leading to a greater likelihood of burnout.
 
user41796
7:46 PM
@Ixrec I agree with you - I think the current system encourages the sense of burnout.
2
 
user41796
But I also accept that Shog doesn't see it that way and I haven't come up with a different way of presenting things, so that particular conversation appears to be dead at the moment.
 
8:23 PM
that's pretty cool youtube.com/…
 
8:40 PM
P.SE is also unique in its active chat and (probably) unique in its high ratio of blatantly off topic questions
reply-all "thanks" emails are so annoying
 
user15026
@enderland This does drive me crazy.
 
Is PouchDB in browser ever used in real world? The way I see it if you connect to database directly from client-side, it's very easy to mess with the system.
 
"mess with the system"?
 
I mean if client-side code communicates with the database, I can inspect it and do malicious stuff
 
you can also do malicious stuff with any local variables; I'm not quite seeing the distinction
 
8:55 PM
I can store any unvalidated data for example
 
which will then fail validation when you try to send it to the server, right?
 
Can a CouchDB server do data validation? I'm talking about a no-backend app
Only client-side and CouchDB database
Is that a usable solution for anything?
 
I don't know anything about CouchDB specifically, but I can't imagine any DB making it impossible to write code that validates the data before running any SQL
 
Status :

Closed
as Won't Fix
 
9:00 PM
@RobertHarvey ?
 
1 min ago, by Robert Harvey
https://connect.microsoft.com/SQLServer/feedback/details/283575/ssms-new-constra‌​int-dialog-needs-to-be-easier-to-cancel
 
@RobertHarvey Oh, duh.
 
It's those kinds of things that make life unpleasant for programmers.
 
@Ixrec but the code only runs on client-side, so the user can change anything. Skip validation, for example.
 
9:02 PM
I'm not getting this fear of all things happening on the client
yes, the user can mess with any code running on their machine; 99% of the time they'll just break it and it'll be entirely their fault, and as long as everything is validated/authenticated server-side they can't breach anything that way
 
@RobertHarvey I'm only somewhat depressed I recognized the name of the person reporting it as a high rep SO user
 
Seems like he's the resident SQL Server expert.
 
@RobertHarvey Well, after marc_s maybe
 
How many records do you need to have in a table before adding an index starts to make sense?
A thousand or so?
If you're just looking up one record.
 
@Ixrec Sorry, I'm not highly experienced in this, just trying to understand how is PouchDB usable. There is no server-side when PouchDB runs in browser and syncs with a CouchDB. So any validation can be changed by the user. pouchdb.com
 
9:05 PM
66
Q: How to determine if an Index is required or necessary

misterjayteeI've been running an auto-index tool on our MS SQL database (I modified a script originating from Microsoft that looks at the index statistics tables - Automated Auto Indexing). From the stats, I now have a list of recommendations for indexes that need creating. Edit: The Indexes described above...

 
that criticism applies equally to all client-side code
 
user55340
@Ixrec couch doesn't use sql. It is possible to do validation though.
 
user55340
Server side.
 
@durron597 Thanks.
 
9:08 PM
in SO Close Vote Reviewers on Stack Overflow Chat, 1 min ago, by Artjom B.
A user asked this question and posted a bounty on it. After the bounty was posted, I ran the code and it turns out, the user simply copied the "result" of the code from somewhere instead of running it himself. There was no problem. Should that question be closed (by a moderator) as unreproducible or does the answer provide any value? I think not, but I'm not entirely sure.
@RobertHarvey I've flagged the question in question ^^^
 
9:24 PM
I feel funny robbing Richard of his bounty.
 
@MichaelT oh, so CouchDB is not just a database like MySQL! Gotta go read all that validation stuff. So it's possible to have a secure multi-user syncing web app that communicates directly with CouchDB?
 
user55340
Think of couch as a JSON document storage accessed via rest running server side JavaScript for views, insert and map reduce queries.
 
user55340
Employer^ used couch for server config and client settings.
 
...wonder if you read what hirig tag says, "DO NOT USE..." — gnat 3 mins ago
^^^ given question content (and title), I wouldn't be surprised if they retag to :)
 
9:39 PM
@MichaelT let's say I want to build an app that has user accounts, users can create groups and invite others to them, and they can add 2 types of simple entries to those groups. User actions should of course be validated so they don't access other groups' data etc. This should work offline and sync with main database. Is CouchDB accessed directly from client-side a reasonable solution?
 
user55340
Nope. You are describing relations there. Couch is not a relational database. Those "joins" would all be code rather than db optimized.
 
user55340
It's a "sure, you can do it." But what happens when you delete a group or user. Answer: you crawl the entire db doing updates to the JSON documents.
 
I'm only considering CouchDB because it would be easy to sync using PouchDB. Otherwise I need to write my own API that would sit between an SQL server and the app. Does that sound better?
 
user55340
Couch / couch sync is quite easy.
 
user55340
Consider your core logic and what it needs.
 
user55340
9:47 PM
Everything is a trade off.
 
So the only clear problem with my described app using CouchDB right now would be handling relations on delete and update?
Well, relations in general. Creating too.
 
user55340
And the issue of permissions. It's a all rest. If you are sharing via syncing, I can modify the data or grab my own couch and full sync of the data.
 
user55340
Grab a copy of couch. Poke at it. It's useful to know.
 
Thanks, I'll play with it. But considering everything you said, probably gonna stick with what I know for my app backend - PHP (or Python) and SQL. Could you give me a few examples of what CouchDB is the right tool for (not necessarily the only one)?
 
user55340
54
Q: When to use CouchDB vs RDBMS

Andrew WhitehouseI am looking at CouchDB, which has a number of appealing features over relational databases including: intuitive REST/HTTP interface easy replication data stored as documents, rather than normalised tables I appreciate that this is not a mature product so should be adopted with caution, but a...

 
00:00 - 18:0018:00 - 22:00

« first day (1783 days earlier)      last day (3206 days later) »