« first day (817 days earlier)      last day (3217 days later) » 

8:00 PM
@EBrown what is the problem about serializing that _PackedValue field?
 
Well it's inefficient, to use it like that.
Because every time I access A/R/G/B I have to use (albeit fairly cheap) CPU computations.
 
I don't think that's inefficient really.
 
It seems to feel that way.
 
Have you performed any benchmarking?
 
You should see the actual serialization code. (It wasn't in that post.)
No, not yet.
It passes all the unit tests, but it is required to be very fast (live action gaming).
 
8:01 PM
How many such color structure objects do you have floating around?
 
The thing is, according to the metrics, the _PackedValue field is used more than the A/R/G/B properties.
Hundreds of thousands.
Alright, maybe only tens of thousands.
Which is why it's compressed so well.
 
As I see it, you got to choose between memory and performance. Using separate fields might be a bit more efficient, but I expect it to require a bit more memory. Unless you can use a unsigned byte of course?
 
Well I can use plain byte fields.
Which would be 8-bits each.
The problem is, I still have to somehow pack them for the serialization.
Though, the serialization works with a byte-array (not pictured, I added it late).
Let me edit the question quick.
 
@tinstaafl The field holds all four byte values, I could make them four single-byte fields, but that would mean that the underlying memory order would depend on the order the fields appear in the structure, which would change how the network serializes them. — EBrown 2 hours ago
 
Yes.
That is important as well.
I cannot have the order of bytes ever be different by chance.
The other thing I'm thinking of, since I've changed how serialization is working, is to just replace that private uint with a private byte[] that has four indices.
Since each value is only a byte.
 
8:06 PM
What do you use to serialize?
 
(This won't work for the other objects like this though.)
    public byte[] GetBytes()
    {
        byte[] result = new byte[SizeInBytes];

        uint t = _PackedValue;
        Array.Copy(_PackedValue.ToByteArray(), result, 4);

        return result;
    }
 
How often do you need to serialize?
 
That's a member of the Color object.
Often.
 
In a loop?
 
That is sent "over-the-wire" of the network.
 
8:06 PM
What do you do with the result from GetBytes() ?
 
I don't know it's that often, but when I do have to serialize anything I have to serialize everything.
It goes in a network packet, that is then transferred.
 
May I see some code?
 
Let me find some.
Oh snap.
You just made me think of something.
No wait, nevermind.
 
Are you thinking of the same thing that I'm working on writing?
 
Possibly? I may be able to eliminate the network transfer of this altogether.
 
8:09 PM
okay, that was not what I am working on writing...
 
Ah, well continue with your idea then, I'm up for all suggestions with this one.
 
A big disadvantage of your current code is that you create a new byte array every single time you serialize, for each of the objects. That will slow things down, and put pressure on the Garbage Collection. It would be better if you passed a stream along to the GetBytes method (which can be renamed Serialize or WriteBytes). Then you can call stream.WriteByte(...);
 
0
Q: Overall utility tool for a project that will create account lists for pulls, as well as give information from various files

flybonzaiI'm creating a meta-utility tool for a project that I'm on that has a lot of repetitive tasks that can eat up a lot of time. My goal with this tool is to eventually be able to automate, or at least facilitate, the vast-majority of grunt-work. I eventually hope to add Django functionality to cre...

 
Well here's another thought: it would be trivial to replace that uint with a byte[], as each A/R/G/B value is exactly one byte.
Because 99% of the workings of this deal with the byte-array, not with the actual uint.
But then again.
 
@SimonAndréForsberg Since memory storage isn't a problem usually, as long as it's more efficient it's a good trade. Within reason of-course, there is such a thing as using too much. But it doesn't happen often.
 
8:13 PM
I think I'm prematurely optimizing. D:
 
@EBrown and return that byte array directly from the byte[] method? That might cause problems if your application is multithreaded and something writes to the color object at the same time as you are passing it through the serialization.
 
@EBrown Probably ^^
 
Well the Color object is immutable.
Nevermind.
It should be, but it's not.
Carp.
I have to fix that.
This whole design is borked.
I think I need to scrap this section.
The other thing is, the way I'm using it, Colour objects will only every be serialized and deserialized once.
Each object will be sent one time.
It's never returned.
Or reused.
 
Are you using any possible value on the Color object? Or are you only using a limited amount of them?
for example, can you use the color 0x7FFA7D93 ?
 
Anything can go, I have some presets but there are 4.3 billion possible colours, and of those anything with an alpha 0xFF, 0x7F, and 0x3F is expected.
So yes, that is a very expected value.
And 0xBF.
 
8:18 PM
Why will objects only be serialized and deserialized once and sent one time? I feel like I'm missing the big picture here
 
Zero boyfriend? :o
 
Well each colour is sent as part of a larger digest.
I.e. a player's favourite colour, form colours, pixel colours.
Some of these digests are small.
Some of them are huge.
I use this struct to send .png images, for example.
 
heh
"missing the big picture"
 
Something tells me I'm using it wrong though.
 
What kind of network requests are these?
 
8:20 PM
Requests for tilesets, spritepacks, etc.
 
@EBrown like, actual .png files? For those, just send the binary data of the file.
 
I mean... what protocol?
 
UDP
 
And yes, why not just send the binary data of the file?
 
Well they aren't files.
They are dynamically generated.
PNG was a bad example.
They are heightmaps.
 
8:21 PM
...
why are you using a 4-byte color for height maps?
Why are you using RGBA height maps? I thought heightmaps were grayscale.
You have one value per pixel.
 
Because each colour represents a different aspect of the terrain. Red is temp, green is vegetation, blue is water, and alpha is elevation.
 
hmm
 
I use each channel to represent a portion of it.
 
Then calling the class "Color" is extraordinarily misleading.
class MapDataPoint
 
Well, that depends on where they are represented.
 
8:23 PM
@EBrown Have you gotten the game to work fully, and are experiencing any issues with performance?
 
@SimonAndréForsberg Haven't even gotten that far. The thing I'm worried of right now is maintainability.
 
9 mins ago, by EBrown
I think I'm prematurely optimizing. D:
I think you're making this a bigger problem than it needs to be.
 
Well I think part of the problem is I am using the Colour class for more than just colours.
 
Well, that's not necessarily a problem, just a potential code smell.
 
Though, technically I am not. I am using the colour class for colours, though I use images for more than just images.
The server has a class MapConfiguration.
In MapConfiguration (which is fairly large, so I won't post it all) it has an Image for Image MapSeed.
 
8:26 PM
There's not really a problem using images for more than just images...
heightmap is a common use for images...
 
The Image is loaded from a .png file (it's a System.Drawing.Image).
 
0
Q: How to organise model that consists of several lists

BentenI have a model that consists of several lists that are used in a news feed. For example, there are different lists for sport stories and car stories. I am wondering how I should organise these. class NewsFeed{ public List<SportStory> sportStories; public List<CarStory> carStories; ...

 
Well, it's loaded from four .png files.
Each .png file contains a grayscale image.
 
That still seems fine
You're just compressing data.
 
Then an array of Color points is made, with the A of each point being set to the respective gray value of the Heightmap, the R is set to the Tempmap, etc.
Then they are normalized, and a chunk is generated.
 
8:28 PM
You shouldn't call them colors though
Because they're not colors...
Even if they have a color representation
 
No, I think they should be Vector4 objects.
I think that's where I'm making my mistake.
 
They're MapDataPoints
 
Yeah.
I need to rewrite that part.
Damnit.
Ok, so now I know what I need to change.
Except they still get sent when I send over the tilesets.
But, I suppose I could rewrite that to just stream the binary file.
 
8:50 PM
Anyone here work with Access much anymore?
 
0
Q: Should I always check the arguments type inside every functions?

Axel IsouardI want my Javascript library to be lightweight and I would like to have your advice about the following snippet : /** * @function DataStream#seek * @param {Number} position * @throws {TypeError|RangeError} * @return {Number} */ DataStream.prototype.seek = function seek(position) { if (typ...

 
Minor selfie
 
@Jamal ... in costa rica... got your ping. Good luck. Next week remind me and I will see what's up there. I do a lot of work with Austin folk. My boss's boss is moving there.
On a mobile in the hotel lobby... seriously sucks..... well chat sucks. Not the hotel!!!
3
 
I just got done with my Cerner interview. It actually turned out better than the first one, but I sort of stumbled on two technical questions (something about data types for a class and how I worked through a bug in one of my projects or someone else's).
@rolfl Nice! It would be great to get an Austin job with them, and I believe I know where in Austin they're situated.
 
9:06 PM
I don't hang out on CodeReview so apologies if what I'm recommending is off-topic there (be sure to check first!), but based on the text of your question it seems that you should post the code of your middleware on codereview.stackexchange.com to get these recommendations. — Two-Bit Alchemist 55 secs ago
Questions about improving working code are best suited to Code Review. — TigerhawkT3 29 secs ago
 
@Two-BitAlchemist If OP is willing to include actual code (stub code and example code are not allowed on Code Review), it would be a good fit. — Mast 47 secs ago
 
@nhgrif I'm not sure if I should laugh or cringe about that.
 
9:21 PM
1
Q: How to EFFICIENTLY update a .csv file

codycrossleyHere's the scenario: I have a CSV file, call it csv_file. It has the following content: Username, Password name1, pass1 name2, pass2 ... I also have a dictionary, call it mydict. It has the following content: mydict = { "name2" : "pass2", "name3" : "pass3" ... } I want to update my CSV fi...

 
I'm voting to close this question as off-topic because this belongs (and is now posted: codereview.stackexchange.com/questions/98627/…) in Code Review. — wflynny 5 secs ago
 
@CaptainObvious That's not updating...
 
Did you watch both parts?
> It's a getter-getter, innit?
 
I'm going for a walk, watch the second part after that.
 
9:44 PM
I just can't look.
 
another good Javascript answer here that might be getting overlooked, it came in late --> codereview.stackexchange.com/a/98513/18427
 
Would a question about dynamic SQL generated from Excel source data be on-topic here? (granted all the SQL and Excel queries are provided)
(never seen one is why I am asking)
 
No-ish?
Unless you can change the generator, you can't really change how it generates the code
Unless you just happened to generate the SQL via these tools, but intend to use it by other means, in which case the generated code is just the starting point
 
Yeah, there's not that much to it
DSQL is pretty cool though, I'm sure it'll come in handy for the new job
 
10:06 PM
Hmm... this is quite interesting. Facebook has blocked all sharing of jesperwhu.blogg.se , which is a blog by a guy that used to be a member of a certain far-right political party in Sweden. His most recent blog entry was about why he left that political party. Facebook won't allow any sharings of jesperwhu.blogg.se at all, my guess is that this is because of enough people having reported the site as abusive (which it really isn't). Makes you wonder what power Facebook has...
 
@nhgrif What evil sorcery is that...
@SimonAndréForsberg Facebook, Google, Microsoft, Apple, they're all giants and all have more power than they should. But hey, the people give it to them anyway.
 
@Mast And if they abuse that power, what happens then?
 
@SimonAndréForsberg People get pissed.
But in the end, they'll forgive them.
The average user is a moron.
 
I'm afraid that's true ^^
 
10:45 PM
I've been told that I should always consider the end user to be a moron when I develop software.
 
yes
 
"Can somebody review my code" - No. Stack Overflow is not about performing code reviews, it's about fixing actual problems that exist in the code. — Captain Obvlious 15 secs ago
 
@Duga "Captain Oblivious"?
Did we find @CaptainObvious's long lost sibling?
 
11:01 PM
With so many issues, your question is probably better off on a site like Code Review. StackOverflow is meant for specific questions about specific issues. But let me throw one more bone your way. Use Set WMI = GetObject("winmgmts:\\.\root\CIMV2") to create a WMI object to query the local machine. Also, you're declaring your WMI variable in QADHelper but using it in WaitForProcess. That's not going to work. — Bond 9 secs ago
 
OMG wow. Sorry about that. It runs now but I'm getting a compilation error at the "Set WMI" line saying that the remote server machine is not available or does not exist. — DtheHut 3 hours ago
 
@Bond CR is for working code only, please oh please read A Guide to Code Review for Stack Overflow usersSimon André Forsberg 57 secs ago
 
"It runs now but I'm getting a compilation error..." how on earth...?
 
@SimonAndréForsberg Maybe he's/she's using an IDE and the IDE is using the last successful build automatically.
 
shell + vbscript.
I have no idea.
 
11:10 PM
Sounds worthy for code review codereview.stackexchange.com as per your a) b) c) — Fred -ii- 12 secs ago
 
11:23 PM
@Fred-ii- It's close, but not quite. This code has been stripped of context, it's just example code here right now. Code Review only reviews real code. Have you read A Guide to Code Review for Stack Overflow users? — Simon André Forsberg 39 secs ago
@Fred-ii- I didn't say Stack Overflow was the right place. Indeed this is too broad or primarily opinion based for Stack Overflow. I'm just saying that Code Review is not the right place for this question either, as it is just example code here. — Simon André Forsberg 48 secs ago
 
0
Q: A standard script for api requests using php

Walker FarrowI am setting up some PHP pages to provide api services to users (and my applications). In it's most basic form, it looks like this: <?php require("include.php"); $page = new Page(); $authZone="general"; $auth = $page->authenticate($mySystemUserId,$authZone); if ($auth[0]!="AUTHORIZED") { ...

 
@CaptainObvious off-Topic?
 
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.comBrent Washburne 53 secs ago
 
@Malachi It looks hypothetical.
 
11:45 PM
that is what I thought
 
I know it's technically advertising for the competition, but perhaps someone wants to create an ad for exercism.io ? — RubberDuck 21 secs ago
 
Some SO user tries to be funny and shares links to his questions, a lot. He gets badges:
49
Q: User gets Publicist badge almost daily

MarkoI was looking at badges and have stumbled upon Publicist badge, it has been awarded 552 times. Looking through the list of users that got it one stands out. Lately he gets it almost every day, sometimes more than one. He has 100 posts and 30 Publicist badges. The odds of this happening are pret...

Sock-puppets expected.
 
1
Q: speeding up Prim's algorithm?

Clark KentIs there a way to speed up this code so it is O(n^2) instead of O(n^3)? I'd appreciate if someone showed me how to do so. Thanks! public void minimalSpanning(int sVertex) { source = sVertex; boolean[] mstv = new boolean[maxSize]; for (int j = 0; j < gSize; j++) { mstv[j...

0
Q: What should constitue a term/definition and how to check if something is a term/definition

dylanI would like to know the best way to check if the arguments to my dictionary member functions are valid terms/definitions. I have thought of two possible solutions, but I am open to any other solutions. I could either check the arguments passed in to the functions or make a term and definition ...

 
Anyone want to help me pick a question to put a bounty on?
 
3
Q: CAPTCHA reader and maker

NoaalI've made some CAPTCHA reader and maker in Python using Tkinter. Do you know if it's possible to keep image and output files in "memory" not writing them on disc? Because right now everything is 'stiffly' made. And what would you do differently? gui.py import tkinter as tk from PIL import Imag...

 

« first day (817 days earlier)      last day (3217 days later) »