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

16:00
Is it the case you can't really do DDL in dynamic SQL?
@Phrancis Really? That seems peculiar. You should not have a GO between the DECLARE lines.
You should be able to (I've done it before.)
I'm running the query on SEDE (no access to SSMS)
I am trying to find a database that I can play on
What was the original syntax error?
Oh
I see it
You have a parenthesis missing.
I just saw that
16:01
DECLARE @OrderNum VARCHAR(30 = 'Order Number';
Bad bad things.
:)
dang you fast
lol
Haha, it seems that Boost.Test got some inspiration from Catch.
@Jamal What's audio layout? haha.
Does anyone know if, in C#, it is necessary to override the GetHashCode, Equals, operator == and operator != methods for value-comparisons on a struct?
I want Color colora = new Color(0,0,0); Color colorb = new Color(0,0,0); return colora == colorb; to return true. With a class it won't, but with a struct should it always return true?
(I wrote Color myself.)
16:08
The temp table is dropped after you hit the GO.
Oh shit, really?
IIrc.
The EXEC command creates the Temp Table just fine, but the GO drops it right afterwards. (Otherwise, how would it be TEMP. :P)
Still getting same error after removing GO
> Note to self: Stop using GO.
GO is evil.
It separates transaction groups and isolates them. :)
Good to know. Seems like every example on MSDN uses it all the time...
16:11
0
Q: How to use stack pointer to create an array of 16 bit integers in assembly language?

Do3Allocate two arrays v1 and v2 of 16-bit integers of 10 elements each , and write a function using pass parameters on the stack that creates a new array v3 stack whose elements are calculated using v3 [ i] = v1 [ i] + v [ i - 10 ] . Write a function that prints out the contents of v3 and write the...

Well it helps isolate transaction groups. GO undefines any DECLARE statements before it.
Etc.
Looks like the error happens in the select at the end
Let me see what I can re-dig up on Temp Tables.
Yeah.
@Phrancis no copy pasta!
can you create Temp Tables on SEDE? SE might have that functionality turned off for SEDE
16:12
They might.
@Phrancis can you link to it
@Malachi Temp tables are allowed on SEDE
temp tables or table variables?
Both I'm pretty sure. It just disallows permanent writes AFAIK
they are different. Temp Tables are technically permanent until they are dropped I thought
16:14
@Malachi I think you are right on that.
And they are session-isolated.
Temp tables exist for a session, AFAIK, then they are dropped automagically
CREATE TABLE #Foo (ID int)
INSERT INTO #Foo VALUES (14)
SELECT * FROM #Foo
That works.
Something is borky for you.
Try to write that as dynamic?
Working on it.
Dynamic is borken.
EXEC('CREATE TABLE #Foo (ID int)')
INSERT INTO #Foo VALUES (14)
SELECT * FROM #Foo
Doesn't work.
Yeah.
Dynamic SQL temp tables are even further isolated it seems.
are you allowed to run dynamic queries on SEDE?
I took out the Transaction commands and this is what I got when I tried to run the query
16:18
EXEC('CREATE TABLE #Foo (ID int); INSERT INTO #Foo VALUES (14); SELECT * FROM #Foo;')
> Something unexpected went wrong while running your query. Don't worry, blame is already being assigned.
That works.
So yes, Dynamic SQL works.
Something is isolated hard-core in SEDE or MSSQL Temporary Tables with DSQL.
Ah, let me try moving the select in dynamic
Has to be same-statement dynamic.
1
Q: Using Grand Central Dispatch to fetch data from Parse.com and update UI asynchronously

PSU SabesThis works, and the UI is snappy in the simulator, but since this is my first time really using GCD, I'd just like this code to be reviewed before I start using it everywhere. Note that this is inside a PFQueryTableViewController my function func tableRefresh() { // get quality of...

16:19
DECLARE @SqlCreateTable VARCHAR(MAX) = 'CREATE TABLE #TracFone (
['+ @InvoiceNum +'] VARCHAR(30),
['+ @InvoiceDate +'] DATE,
['+ @DueDate +'] DATE,
['+ @PoNum +'] VARCHAR(30),
['+ @OrderNum +'] VARCHAR(30),
['+ @BalanceDue +'] DECIMAL(8,2),
['+ @OriginalEsn +'] VARCHAR(50),
['+ @ReplacementEsn +'] VARCHAR(50)
);
SELECT * FROM #TracFone;'
EXEC(@SqlCreateTable);
^^ works
The Temp table is probably destroyed once the execution is finished.
Good good. :)
Well, we found the issue!
-- Works
EXEC('CREATE TABLE #Foo (ID int); INSERT INTO #Foo VALUES (14); SELECT * FROM #Foo;')
-- Works
CREATE TABLE #Foo (ID int)
INSERT INTO #Foo VALUES (15)
SELECT * FROM #Foo
-- Doesn't Work
EXEC('CREATE TABLE #Foo (ID int)')
EXEC('INSERT INTO #Foo VALUES (16)')
EXEC('SELECT * FROM #Foo')
That should help you.
The temp table persists until the end of the execution of the entire transaction.
0
Q: HackerRank Regex Challenge:Detect HTML Tags

aa1992 Problem Statement In this problem you will use regular expressions to help you detect the various Tags used in an HTML document. Here are a few examples of tags: The "p" tag for paragraphs: This is a paragraph It is also okay to have one or more spaces before or af...

16:32
-- Works
EXEC('CREATE TABLE #Foo (ID int);'
  + 'INSERT INTO #Foo VALUES (16);'
  + 'SELECT * FROM #Foo;'
  + 'DROP TABLE #Foo;');

-- Works
DECLARE @create VARCHAR(MAX) = 'CREATE TABLE #Foo (ID int);';
DECLARE @insert VARCHAR(MAX) = 'INSERT INTO #Foo VALUES (17);';
DECLARE @select VARCHAR(MAX) = 'SELECT * FROM #Foo;';
DECLARE @drop VARCHAR(MAX) = 'DROP TABLE #Foo;';
EXEC(@create + @insert + @select + @drop);
^^ @EBrown @Malachi
Even better. :)
So, today's lesson: Don't EXECuntil the very end.
Indeed.
I think it's because each EXEC is a new session.
ssc
ssc
@EBrown I think it's a new transaction, not session, correct me if I am wrong
@ssc You may be right, either way, it would be considered a new batch of temp tables and declare statements and such. :)
ssc
ssc
16:35
@EBrown :D Okay but technically session and transaction are two widely different concepts
So, I was just trying to make my understanding clear
Indeed, they are very separate.
ssc
ssc
Best place to learn regex?
So, today's lesson: Don't EXEC until the very end.
Calling EXEC is effectively the equivalent of running the script you have typed in. It doesn't know anything about anything outside what's in the "EXEC"
Or rather, nothing else knows anything about what's in the EXEC.
You would think, though, that the effects of the EXEC would persist through the entire transaction.
16:37
Why?
Also, @Phrancis, another workaround is global temp tables.
If SEDE allows global temp tables...
@nhgrif Well because it's all part of the same transaction set, unless the EXEC statement creates a sub-transaction.
SEDE may not be his eventual deployment platform./
He may be testing in SEDE due to lack of access to the MSSQL SSMS.
It's not a transation
or a subtransaction.
It's a batch.
That explains a lot, then.
16:39
0
Q: Double and Float equals in C#

user2934236Here is code that I lifted from Microsoft's internal utility library. I know that the subject is quite complicated, but nevertheless I wanted to verify that Microsoft got it right. public static bool NearlyEqual(double a, double b) { //this is ok despite warning (no arithmetic co...

0
Q: Good way to make a Ruby array into ranges, then back to fixnums

DaniG2kI'm essentially trying to do two things: if a document id is added to an object, I want to return a new array of ranges. if a document id is deleted from an object, I want to return a new array of ranges with that document id removed. This is what I've come up with: module ArrayExtensions ...

Executing dynamic sql in an EXEC is the same as running it non-dynamically with a GO statement at the bottom.
And GO isn't evil...
@CaptainObvious Off-topic. Not user's code.
That would make sense, I forgot that GO was the end of the batch. (Forgot the exact technicalities of it, only the odd side-effects.)
It's almost sort of like calling an SP.
Or function.
-- Also Works!
DECLARE @create VARCHAR(MAX) = 'CREATE TABLE ##Foo (ID int);';
DECLARE @insert VARCHAR(MAX) = 'INSERT INTO ##Foo VALUES (18);';
EXEC(@create + @insert)
SELECT * FROM ##Foo;
DROP TABLE ##Foo;;
Looks like ##Globals are supported in SEDE, good to know
16:42
Yeah, global temp tables are allowed on SEDE apparently.
@nhgrif Yeah, it's been a while since I've had to recall the intimacies of MSSQL.
Probably not necessarily the right option.
My mistake on those incorrect statements.
You can use OUTPUT variables with EXEC apparently.
Yeah, I recall that as well.
Though not how to do it. :)
Just posted a C# question for anyone who has time to answer it.
It's relatively short.
DECLARE tables_cursor CURSOR
   FOR
   SELECT s.name, t.name
   FROM sys.objects AS t
   JOIN sys.schemas AS s ON s.schema_id = t.schema_id
   WHERE t.type = 'U';
OPEN tables_cursor;
DECLARE @schemaname sysname;
DECLARE @tablename sysname;
FETCH NEXT FROM tables_cursor INTO @schemaname, @tablename;
WHILE (@@FETCH_STATUS <> -1)
BEGIN;
   EXECUTE ('ALTER INDEX ALL ON ' + @schemaname + '.' + @tablename + ' REBUILD;');
   FETCH NEXT FROM tables_cursor INTO @schemaname, @tablename;
END;
PRINT 'The indexes on all tables have been rebuilt.';
@Phrancis ^^^
16:47
0
Q: Optimize Color Structure: One backing field for several properties

EBrownI'll get right to it, this struct is used a lot throughout my programme. This class is responsible for only things regarding colour, not anything else. I'm largely concerned of the bitwise operations, and the fact that I store four byte values in a uint but access them with bitwise flags. This i...

If anyone could comment on that, I'd be grateful!
Or answer it, whatever works.
0
Q: Optimize Color Structure: One backing field for several properties

EBrownI'll get right to it, this struct is used a lot throughout my programme. This class is responsible for only things regarding colour, not anything else. I'm largely concerned of the bitwise operations, and the fact that I store four byte values in a uint but access them with bitwise flags. This i...

Oh finally.
Takes @CaptainObvious four minutes to post it.
I don't think there's an advantage to storing a 4-byte value versus 4 1-byte values...
I might be wrong, and I'm not a C# expert.
In most languages though, the memory size of the object would be the same.
But storing as a 4-byte value means spending CPU time all the time wrapping unwrapping into useful values.
That is true.
ssc
ssc
0
A: Linked list implementation - follow-up

sscAs far as OOP paradigm is to be considered, I do not see any problem with the implementation and as per my knowledge and experience of OOP, I can not find any mistake or make any suggestion for any improvement. Well, here are few pointers that I will consider if I will implement the same thing: ...

16:51
BTW @nhgrif I got the job, not sure if I told you. Starting on Aug 10 :)
Cool.
ssc
ssc
Congrats
Figure out how to get mobile dev or Java web experience there
ssc
ssc
And better luck @Phrancis
and then come apply here
16:52
Would switching to Threads make sense in my case? - I think not, because of GIL limitation. multiprocessing is your last resort I guess. Maybe if you show the code, people should be able to suggest improvements. Also, this question might be well suited for codereview.stackexchange.com — thefourtheye 34 secs ago
@nhgrif They have a mobile dev team for Android / Java, but most of their stack is C#/MS SQL
I don't think this is a proper question for StackOverflow. It seems more like a question for SeverFault because it's about high performance servers, or for CodeReview, because it's about further optimizing code which already works. StackOverflow is more about finding out the why and how of code working (or not working). — ArtOfWarfare 12 secs ago
@rolfl: I have applied to an Information Developer position at IBM. It's mostly technical writing, but it's also entry-level and requires CS skills.
Also, @nhgrif I know that C# can change how the byte-representation of an object is represented (order of the fields) by the actual order they are placed within the structure, which is actually extremely important for my situation. (The order cannot ever change.) This is one advantage of using a single field and bitwise combinations but it does leave a lot of CPU work later.
But, GTGTL.
Everything working great now!
16:57
@EBrown Why does it matter what order the fields are in...? As long as you're always getting what you want. Is this some sort of encoding/decoding issue?
17:11
I'm afraid this is off-topic. StackOverflow questions are about specific error in the code. If you seek code review, consider to ask it on codereview.stackexchange.comAlexAtNet 5 secs ago
ssc
ssc
@Jamal Which office?
Austin, TX
17:27
0
Q: Java Home work Instructions and Code Below..what am I missing

IyvWrite a Java application that prompts the user for pairs of inputs of a product number (1-5), and then an integer quantity of units sold (these are two separate prompts for input values). You must use a switch statement and a sentinel-controlled loop (i.e., a loop that stops execution when an out...

0
Q: golang create a resource

alioyguri am new in golang. i am coming from php. now i writing a test web application in golang. here is my create post handler. type NewPostReq struct { Title string `validate:"required"` Description string `validate:"required"` Body string `validate:"required"` Tags ...

0
Q: C++ - Overloading operator >>

etfI'm implementing my string class. Here is code: #include <iostream> #include <cstring> using std::cout; using std::endl; class MyString{ private: char * content; int length; void copy(const MyString & source); public: MyString(); MyString(const char * source); ~...

0
Q: Laravel Controller including sort and search

Ron BrouwersI am posting this piece of code here to see what I can improve, change, remove, and so on. I just want to learn from it, since I am still learning Laravel, PHP, OOP, and so on. First of all, I am using this code on my own personal website (my personal administration site) so it doesn't need any s...

17:45
ps. Another option is Splatting, as shown here: codereview.stackexchange.com/questions/80154/…JohnLBevan 23 secs ago
http://www.commitstrip.com/en/2015/07/30/coders-weaknesses-1-the-trycatch/
CommitStrip - Blog relating the daily life of web agencies developers
Coder’s Weaknesses #1 – The Try/Catch
CommitStrip
1438277738
2
@Jamal Let me know when you hear back from Metova. I know obviously you'd prefer working locally, which is completely understandable. But just let me know how things go.
Sure thing. They'll be calling me in about an hour.
I have already read up in some company info anyway.
And it looks like someone else will be joining the interview.
0
Q: App has stopped working after adding parse notification module

hamzihere is the code,one of my activities.my app works fine but when i add parse module in app..its works fine but shows the error app has stopped working at background ..app works fine ..no error during app operation but shows the error when unlock the app from lock pattern.here is the code of activ...

Yeah. Usually the calls have multiple Metova people. 2-4
_PackedValue = (_PackedValue & ~0x000000FFu) | ((uint)value << 0x00);
That seems wrong.
Shouldn't the | and & be reversed....?
hmm no
Oh wait, now I see the ~ that makes it work...
17:58
@nhgrif What does that even do? Is it encryption or something?
I'm still confused why he re-implemented the framework Color class
No.
He's representing R, G, B, A bytes with a single 4-byte value.
But I don't understand why.
It's not more memory efficient.
What "code review" tool is this? A plug-in, or something built into Mars' JDT (which I haven't tried yet)? — erickson 57 secs ago
18:00
It's more expensive from a CPU standpoint (maybe insignificantly so, but nonetheless)
0
Q: Better way to search within multiple objects of the bucket

user3054204I have millions of files in the Google cloud storage's bucket. I want to search within files with .index extension and retrieve the contents. This is currently what I am doing, but the time required for overall process is large. I was wondering if there is any better and faster way to do this? ...

@nhgrif Even if it was an optimization, it's usually not worth it anyway unless you're working with very much data, real-time.
don't prematurely optimize
I've seen one case where they merged 4 bytes into 3 to keep the packet at the standard size. That was pure genius and worth it.
Network packet.
@nhgrif I need the alignment of the bytes to always be the same. I serialize the memory for transportation over the network.
18:08
thing_ids = range(1000000)
p.map(do_the_stuff, thing_ids)
Totally not example code ^^
Just making sure. :-)
RBA
Now it was self-deleted. I don't think the OP would be able to post another question, though.
@Duga Where's the code?
@Mihai Thank you, I wasn't aware of that site, I'll post there — BJH 29 secs ago
18:17
@Jamal Better keep your eye open. O.o
I should've posted a comment earlier, but I was distracted.
@Mast That's what I'm trying to do with this. The network packet for new Color(0, 255, 255, 255) can never differ. If I used byte fields backing each property, accidental refactoring could change the order it's sent out.
Perhaps I should look into an alternative network packet operation.
@Jamal I added a (hopefully) helpful comment.
@BJH Keep in mind that Code Review requires the full, working code for a question to be accepted. This snippet is example code and will likely not be received well. If you are posting the entire scenario there (including use-case) then we greatly welcome it. :) — EBrown 40 secs ago
0
Q: Unit tests for a simple decorator

JakobI do a lot of unit testing(tdd) and would like some comments about my style. Here is a simple example from a decorator. Is there anything I could improve? public class ChangedClaimsServiceComposite : IChangedClaimsService { private readonly IChangedClaimsService[] changedClaimsServices; ...

@EBrown Then write a serialization method.
18:30
Well, I might be able to rewrite it and maintain functionality without rewriting the rest of the project.
So I am asking for code review then if this is a horrible way. Maybe answer with a code example of how you would do it different — We Do TDD 22 secs ago
I just went and did a quick reference lookup, and the most commonly used methods there are: public Color(uint packedValue), and public uint GetPackedValue() which "technically" serialize and deserialize it. (Though not really so much as serialization goes.)
Either way, I would still greatly appreciate any other comments on that code. :)
The problem comes in with consistency.
I have other structures that follow this bitwise combination idea, but they cannot easily be converted to use strong types.
I also forgot about my ISerializableByteArray interface...>.>
18:44
Think I'm going to delete that question, the code in it would be way outdated before I get any answers.
19:02
This question would be even less on topic on Code Review. CR is only for "feedback on a specific working piece of code." — resueman 43 secs ago
@nhgrif: Okay, it's done. He mostly asked me about my Java experience and how I knew you, and he will get back to me in a few days.
is Simon around?
@ManushinIgor I don't see code review functionality listed in that link for TFS 2015. I do see some more Git+TFS features, but not the code review that I'm used to for TFSVC. — Steve Kennedy 22 secs ago
@BenVlodgi came in and didn't even Monking @ping me?
@Malachi He seems to be gone. :(
19:13
@Malachi monking!
what's up?
@Jamal Did it go well?
I think so. I still stuttered quite a bit (as expected), but I was still able to answer questions. My next one today will be with HR for another company, and I'm still not sure how I'm going to answer the typical basic HR questions.
I haven't done a basic HR interview in a while.
I never even did an HR interview for this Web Developer job I have.
@Malachi working like a hog... or like a log
you?
19:19
Greetings
Greetings
Greetings
Greetings
@BenVlodgi same
@Jamal Does it take mod action to push a delete of my own post through perm?
19:19
How's it going around here?
@EBrown No
I just one of @SimonAndréForsberg Questions
You can delete your stuff at any time (except questions with an upvoted answer)
Whats an appropriate name for a function that takes two byte arrays, and two integers, and copies byte-array two into byte array 1 beginning at position start, and ending after length?
@Malachi Did you applied any answer given on Simon's question?
@EBrown What will you do with the result?
0
Q: Desktop Notifications for Queue Items

MalachiI wasn't satisfied with Simon's alert on the orange alert. I wanted to know if even 1 review item was available, so I made some modifications to the userscript so that it runs on the Review page, and only alerts you when there are reviews that show a positive number. This is Simon's Version ►►...

0
Q: Custom dynamically generated slide show container

glampertI've created a custom slide-show container to use with Jekyll. This platform is used by the Github pages and works by converting plain-text markdown to HTML. I wanted to be able to embed the slide-shows in the markdown as inline HTML, so the following is a usage example: some_file.markdown: ......

0
Q: Prevent SQL Injection

S ChaudhuriI know that I can use prepared statement to prevent SQL injection. I can do it using MySQLi or PDO. But I have a developed a large CRM using PHP/ MySQL (mysql_query). If I have to change each and every query into PDO or MySQLi, it will take at least a month. The script got more that 500 MySQL que...

19:26
That is the result. It takes value (a small byte-array) and places it into destination (a larger byte-array) replacing values from start in destination until length has been covered.
@Malachi You did not. Almost any answer given on Simon's question can be used on your question. This is what I would do: Ask Simon for an updated version and then apply your changes on it
@EBrown That is what the function will do.
public static void Mid(this byte[] destination, byte[] source, int startCopy, int startReplace, int length = 0)
What is the purpose of that function?
Does that look acceptible?
Well, I want to copy the source byte array into the destination byte array without having to resize or anything.
extract_bytes?
19:28
Y U NO USE System.arraycopy?
@CaptainObvious #DoItRightFirst #HaveFunWithThat
Does ArrayCopy do that?
that C#?
Yeah.
Let me look at System.ArrayCopy quick.
Oh, Array.Copy.
That one.
Perfect. :)
Thanks @Vogel612. Don't know why I immediately went to the "roll-your-own" strategy.
Well, TTGH
19:34
@Malachi I'm not sure it's fitting, it's more like a follow-up.
I am reading through the answers right now... but I should be working on work at work.
I made the updates from the answers on @SimonAndréForsberg's question to my code and pasted it in there on my question
@Malachi I'm disappointed you didn't rags-to-rich my Brainfuck Fizzbuzz!
just kidding. Nice to see your script
@SimonAndréForsberg that might take some acid or shrooms for me to be able to make it happen, along with a long weekend away from distractions
@SimonAndréForsberg I tested it on SO Review page.
19:49
@Malachi Nah, just acid and shrooms.
I really need to get to 3k and help out on closing some of those
I think it might be a lie to get people to 3k rep though
@Malachi or you might want to use the script on Code Review instead
@SimonAndréForsberg oh I am.
that was why I wanted it in the first place, but knew I could test on SO
I still haven't done any reviews on SO today
took me an hour to figure out what I was doing with that script
@SimonAndréForsberg They are overfanatic today, every time I check the queue it's empty.
I just spent an hour working on a binary serializer just to give up cause 'ck it.
19:55
@erickson we are using RAD , it is software analyzer , right click on files or project , you will see software analyzer then created new configuration select code review rules and run . — Stuck in Java 37 secs ago
@EBrown Spend another hour.
@SimonAndréForsberg I see no point in it, there's got to be a better way to do what I am.
I think this entire project is unsalvageable.
It's not even dirty code, is the worst part.
@Mast I checked the queue earlier today and processed about 4 items.
I wonder if it will work on a Meta Review? when they pop up in the review queue on the main site
@EBrown what are you doing?
19:56
@SimonAndréForsberg You must have gotten lucky.
@Malachi Meta and Main are two different sites. You need to run the script on both to get notifications for both
@SimonAndréForsberg Well part of this huge project is this Colour struct. The problem with it is the fact that I serialize that _PackedValue field. Mind you, this is not the only struct that I have to serialize like that.
I'm also largely confused, looking back at my own code.
@Mast not really, it was quite a while and it seemed like no one was doing anything with the queue.
@Malachi It's just a hyperlink.
19:58
"Code Review Meta Stack Exchange"
That's a mouthful.
@Mast not when there are reviews over there, I think it shows numbers.
there hasn't been anything in the review queue over there for a while, at least while I have been online
@Malachi as far as I know, no it doesn't.

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