Allegro.cc - Online Community
Post Reply

Allegro.cc Forums » Allegro.cc Comments » Thread locks too soon

rss feed Print
Thread locks too soon
Neil Roy
Member #2,229
April 2002

Cool video, Neil. Do you have the frame-rate locked to 30?

Nah, it's just rendering A LOT of polygons with zero optimization. I am pushing it at the moment. Once I add in frustum culling the frame rate will soar, but I needed to figure out this other stuff first. I worked on properly organizing my data for this so I can work with it easier. The terrain following was the first test of that improved data organization. I have more I want to do, like combine polygons which are on t he same plane into one large polygon to reduce the number rendered, stuff like that, but that's a pretty big task, for me anyhow. But it should be fun to see what I can accomplish with this.

Edit: Also, the FPS is normally around 40 for this terrain (gets like 140 for small terrains), but FRAPS slowed it down to around 30 as well. Not that it matters much as this is not optimized at all yet.

Also... REPLY #2100! :)

bamccaig
Member #7,536
July 2006
avatar

It's probably doing a check before it attempts the insert without holding a transaction open (and locking the table) for the insert itself. If there's a point in between when it has decided you are able to post, but before posting, then another thread/process is able to also do the same insert. 99% of the time this doesn't happen because the site is fast enough to do both the check and the insert before the next request can, but when the site hangs like that for whatever reason the race becomes almost guaranteed. I typically try to include that condition in the insert itself, which if the DBMS does automatic locking should be enough to prevent this I think (the data it is checking cannot have been updated by a different connection):

#SelectExpand
1// T-SQL syntax, just an example.. 2INSERT INTO post(thread_id, user_id, ... columnN) 3SELECT 4 X.thread_id, X.user_id,... X.columnN 5FROM ( 6 VALUES ('value1', 'value2',... 'valueN') 7 ) AS X(thread_id, user_id,... columnN) 8WHERE X.user_id != ( 9 SELECT TOP 1 10 user_id 11 FROM post 12 WHERE thread_id = X.thread_id 13 ORDER BY id DESC 14 ); 15 16IF @@ROWCOUNT = 0 BEGIN 17 RETURN -999; -- ERROR: You probably double posted. 18END;

The (VALUES ()) AS X() thing is a way of defining a resultset to select from or join to with literal values inline so think of the whole thing as a temporary table sort of thing aliased as X within the query.

Append

I tried to post this an hour or more ago, but apparently it failed. I've never seen this before:

{"name":"611278","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/4\/74f60ea3e7289453418db1360bd9e4d8.png","w":805,"h":662,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/4\/74f60ea3e7289453418db1360bd9e4d8"}611278

It might give another hint about what's going on in the background. :) It seems there is supposed to be some kind of locking mechanism to serialize posts. Unless this was literally just added/activated it begs the question of how it goes wrong. :)

Chris Katko
Member #1,881
January 2002
avatar

LennyLen said:

I don't think many people realize this. Pretty much any encounter that someone with social anxiety takes up a lot of energy, and it all builds up.

What he describes also fits into introversion not anxiety.

I'm an introvert. I "recharge" my emotional energy by being away from people--even if it's people I'm comfortable with and enjoy being around with no stress. (Though I also have to recharge my sense of friendship if I go too long.)

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

LennyLen
Member #5,313
December 2004
avatar

What he describes also fits into introversion not anxiety.

One often follows the other. For some the anxiety comes from feeling like there won't be a place to be alone. I'm the other way around. I didn't use to be introverted, I was just as happy being alone as with others, but after a while all the anxiety made me avoid people so much that I became introverted, and couldn't be happy unless I was alone. I usually feel more lonely if I'm with other people than if I'm alone as well.

In any case, if there is anxiety, it will be exhausting if it continues too long.

Chris Katko
Member #1,881
January 2002
avatar

I am not spreading racism. The white supremacists twisted it into something it was not.

I was clearly joking. ::)

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

Edgar Reynaldo
Member #8,592
May 2007
avatar

Katko,

I know you weren't accusing me of racism, but Neil did. He basically said what I believe was a fabrication made up to endorse racism when all I did was show him proof that Satan has children. For the sake of keeping the topics separate, I made another thread. I will reply to what he said there when I have time.

Neil Roy
Member #2,229
April 2002

{"name":"611281","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/c\/9cded056fe1fb2e3577ee97d15d44181.jpg","w":620,"h":350,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/c\/9cded056fe1fb2e3577ee97d15d44181"}611281

Chris Katko
Member #1,881
January 2002
avatar

Okay, just making sure. :)

Enjoy your religious thread in the other one. ;D

Anyone here play around with neural nets?

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

Neil Roy
Member #2,229
April 2002

Anyone here play around with neural nets?

No, but I did once program a TIC-TAC-TOE game that learned. I put no code in it at all that told the game how to win. It stored your moves and when you won, it learned how you won and then developed moves to block you. Winning against it was easy at first, but you could never win the same way twice. Eventually it got so that the best you could achieve was a stalemate. It was fun to program. I done that in BASIC back in the late 80s on my C64.

Edgar Reynaldo
Member #8,592
May 2007
avatar

Neil Roy said:

I done that

Every time you say that I lose a little more respect for you. The proper word to use is 'did' - I did that I did this I did something else. OR I have done this I have done that. But to mix the two is incorrect.

Chris Katko
Member #1,881
January 2002
avatar

Every time you say that I lose a little more respect for you.

Put the arguing in the other thread. It's getting ridiculous now.

BACK TO NEURAL NETS

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

Neil Roy
Member #2,229
April 2002

I programmed the game at the time to keep track of all moves and then whomever won, it would store the moves which lead to a win. When it played later, it would compare your moves with moves it had stored and then try and predict your next move, and then place it's mark at that location to block you. It of course, would also use the same idea to choose it's next move to win if there were no ways to block you.

I forget the algorithm used at the time, but it was fascinating. I think I had a book on artificial intelligence I was reading at the time.

Fascinating subject, I should putter around with it again sometime.

Chris Katko
Member #1,881
January 2002
avatar

That's really cool!

I'm restarting my old "Megalib" project which was an image to ASCII converter. The original version wasn't real-time.

I'm looking into cutting the dimensionality down and maybe optimizing with some learning methods / neural nets.

Most recently I was thinking about using an edge filter pass and match those edges to ASCII instead of raw pixel to pixel.

Old version: (Gamecube screenshot of Mario Kart: Double Dash)
{"name":"FpYc4vF.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/9\/c910456374d45d18ee86df1332acf1c2.png","w":800,"h":600,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/9\/c910456374d45d18ee86df1332acf1c2"}FpYc4vF.png

You can actually make out Mario's face if you look carefully. I think that's Peace in 2nd, and Diddy Kong as the third place back seat.

Some game map:

{"name":"K3F5d8O.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/3\/63e96b50edb279b7e45032018a6038b7.png","w":642,"h":502,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/3\/63e96b50edb279b7e45032018a6038b7"}K3F5d8O.png

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

MiquelFire
Member #3,110
January 2003
avatar

Wow, I actually had a reason to uncomment some member post hiding code in my custom CSS here.

How long ago did someone pissed me off enough to do that? Clearly, I was forward-thinking and just commented out the code at some point when I assume I didn't have to worry about it.

---

Also, I just thought about it today, with how little snow we had gotten over the past few winters, the snow removal company that plows our complex didn't put down the orange sticks to know where the pavement was for this winter... and I think we got more snow TODAY alone then we got the past two winters combined. And the news reported that the record for most snowfall in a winter was only the 2013-14 season... and so far, we're only halfway there.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red | +Me
Windows 8 is a toned, stylish, polished professional athlete. But it’s wearing clown makeup, and that creates a serious image problem. ~PCWorld Article

bamccaig
Member #7,536
July 2006
avatar

How long ago did someone pissed me off enough to do that? Clearly, I was forward-thinking and just commented out the code at some point when I assume I didn't have to worry about it.

Hi, jerk. >:( :D

Neil Roy
Member #2,229
April 2002

I'm restarting my old "Megalib" project which was an image to ASCII converter. The original version wasn't real-time.

Very nice! Have you checked out this guy's page? ALL of his games and projects he has are 100% Windows console text mode and they are amazing! He sets the font size so small they are practically pixels. If you like text stuff, you may just love this. And he makes all of his source available.

https://www.youtube.com/channel/UC-yuWVUplUJZvieEligKBkA

Wow, I actually had a reason to uncomment some member post hiding code in my custom CSS here.

Oh please please please share that with me! I use the block feature A LOT on Facebook, but don't have the luxury of that here. ;)

bamccaig
Member #7,536
July 2006
avatar

Neil, it's just a bit of custom CSS to hide the posts of somebody you don't like. It's actually pretty terrible because posts will just not make sense without the context of who they're replying to. It should only be used for extreme measures. I think I built that functionality into my "acc.js" library actually, which shows a UI to show hidden posts at least, but not sure if it still works... I don't like to silence anybody. I only blocked "Inphernic" or something for a while because at the time his avatar was unbearable..

Append:

Neil Roy said:

Very nice! Have you checked out this guy's page? ALL of his games and projects he has are 100% Windows console text mode and they are amazing! He sets the font size so small they are practically pixels. If you like text stuff, you may just love this. And he makes all of his source available.

How the Hell does he make the Windows console fast enough for games. Compared to Linux consoles it's stupidly slow. :P

Neil Roy
Member #2,229
April 2002

bamccaig said:

It should only be used for extreme measures.

Like say, when people want to argue about everything you type? I don't like to do it either, but if someone mocks me or just wants to endlessly argue, I use it. You should see my block list on Facebook, it is massive as I just won't argue with people. I love civilized conversation and have had many with people who are atheists etc and they have been productive and respectful. But others who get angry and mocking, I just have no desire to communicate with them ever again.

Would be nice to know the CSS code to add people. I wouldn't add many, only one I can think off at the moment on here.

Quote:

How the Hell does he make the Windows console fast enough for games. Compared to Linux consoles it's stupidly slow. :P

I don't know, but if you look at what he does, it's REALLY impressive and he gives away all his source code as well as a nice console game engine he developed. I may mess around with it sometime. His latest is a Mario clone, thought it was actual game graphics this time, but nope, a console. I done my own console "3D text" game, but nothing like what he did. He even has a Wolfenstien clone, in console, with sprites and colour! Kewl stuff.

video

bamccaig
Member #7,536
July 2006
avatar

I believe you can add this to your custom CSS where 9999999 is the member ID.

.m9999999 { display: none; }

The posts by that member will have a "class" attribute containing the string "m9999999". The CSS rule means any element containing the CSS class "m9999999" should not be displayed at all (should take up no space in the page).

But again, it's a pain not being able to see what even stupid people post sometimes. Even the worst offenders are productive sometimes. If you want, try my library out instead. It likely still works somewhat for this, and then you'll be able to see when posts are missing and show them or hide them if you like. If you don't like it, it's easy to remove it again.

Append:

You should be able to add it by adding the following script URLs:

https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js
https://castopulence.org/js/acc.min.js

Then in the code box add:

if(typeof bam !== "undefined") {
  bam.ignoreMember(9999999);
}

That should work. You should see subtle additions to the links at the top right if it's working, and if you find a post by "member id here" you should see some simple UI indicating that it's hidden, but can be expanded. I haven't tested that functionality recently, but I doubt it has changed.

Caveat:

When I tried using this UI I found myself more compelled to view the hidden content than ignore it. It doesn't really work. :P That's why I haven't used it in forever.

Eric Johnson
Member #14,841
January 2013
avatar

I think that's Peace in 2nd, and Diddy Kong as the third place back seat.

"Peace", huh? Is that a hippie ROM hack of Double Dash? :P It's easy to identify the characters and most of the detail if you blur your eyes. Looks like Baby Mario and Donkey Kong in first, followed by Peach and Wario in second, and then Waluigi and Diddy Kong in third. Is the track Yoshi Circuit? I loved Double Dash as a kid. :D

As far as account-blocking CSS goes, maybe a better alternative would be to set a given user's text to transparent, rather than outright hiding it. That way you'd still know they posted, but you'd have to highlight their text to see any of it.

EDIT

#SelectExpand
1<style> 2 3 .m7536 * { 4 5 color: transparent !important; 6 } 7</style>

That changes the text in bam's posts (for example) and all child styles to transparent. So you still see that he's posted, but you have to highlight his posts to actually see anything. ;)

{"name":"611282","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/5\/85afaa5c55f70a85bd73d39e671d4da6.png","w":1600,"h":900,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/5\/85afaa5c55f70a85bd73d39e671d4da6"}611282

Neil Roy
Member #2,229
April 2002

bamccaig said:

.m9999999 { display: none; }

Thanks, this worked like a charm. Peace of mind at last! :)

Edit: I tried the transparent idea out, but, I would be too tempted to highlight and read the text which would defeat the purpose. Not knowing a post exists is the best bet.

One other thing about the transparent text, my swearing filter shows censored words in red, so I seen a large blank post, with these red swear words that were not transparent! It was quite funny. ;)

Edgar Reynaldo
Member #8,592
May 2007
avatar

Chris Katko
Member #1,881
January 2002
avatar

[dbl]

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

Chris Katko
Member #1,881
January 2002
avatar

Neil Roy said:

Thanks, this worked like a charm. Peace of mind at last! :)

It's amazing how childish the "adults" are being on this forum right now. There's like FIVE ACTIVE POSTERS on this forum right now. Grow up and accept people say and think things you don't. ::)

I don't agree with ANYONE here fully, at all. And? Nobody cares. Life goes on. I'm still able to converse objectively.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

Neil Roy
Member #2,229
April 2002

For the record, I haven't actually blocked anyone... yet. It's just good to know how to if the need arises.

I took the CSS I was shown above, tested it out, made sure it worked, then commented it out so I have it if needed. :)

Be careful about making assumptions.

Post Reply


Go to: