ASP.NET Variable issues - asp.net

I have some terribly written ASP.NET code that is just not working right (go figure).
I'm charged with maintaining and bug fixing this code, but I can barely make head or high water of it
Unfortunately I don't have the time to rewrite it.
If someone could help this would be great:
(the code): given to you here (some minimal obfuscation necessary):
http://mastergeektheater.com/issues.txt
What it's supposed to do:
Receives an order from a shopping cart application, and creates a table of textboxes based on the quantity of said object ordered.
Once the whole thing is validated (submit_Click()), then it reveals a div with further instructions and grays out the input fields so you can still see what was entered, but can't affect anymore. Emails are sent to each inputted email address.
What it actually does:
Receives the order, and correctly displays the inputs. On Submit, all of the "required field validators fire - if they are Vaild, then the comparison validators fire. SOMEWHERE AROUND HERE, it all goes south."
All of the input areas in the table except the first user disappear. if the comparisons success, then it postsback, and the first user is there (greyed out) and the other users are gone. if the comparisons fail, then it doesn't successfully postback, and stays on the input form, but all of the input fields except the first user still disappear
I know this is a little too specific to be a really well formed Stack Overflow question, but I've tried to break it down to things I think were wrong and I asked other questions that were more specific to try to fix it. Unfortunately, it hasn't worked. The code got better, but the whole thing is still broken. At this point I'm desperate.
If anyone could help, it would be a huge lifesaver. Thanks in advance for all of you who pour through this terrible code (and terrible question) for even a minute...

I guess the problem could be due to this line.
Session["quantity"] =(null != Request["quantity1"]) ? Request["quantity1"].ToString() : "1";
Do you have a field (hidden/input) named quantity1 on the form?
Is it being passed to querystring or as part of form item collection?
It will be 1 (when the form posts back to itself) & hence the loop will only run once.

Related

How do I fix NPCs not showing a cast bar for some custom spells?

I am currently creating a module that creates custom boss fights in vanilla dungeons. To accomplish this without having to make edits to existing spells used by other creatures, I've been using Stoneharry Spell Editor to create custom spells that the bosses use.
The spells that I created are doing exactly what I want them to do but the majority of the spells that aren't instant cast will not have a cast timer shown while the boss is casting the spell.
Some of these spells haven't been edited aside from the damage. Just a straight up copy of a basic spell like Lightning Bolt. I searched through all of the attributes and there was no difference between spells that would show the cast timer and those that wouldn't.
What determines whether or not a spell with have a visible cast bar and how do I fix the spells that don't?
I have gone through the process of creating a custom MPQ file to patch my client in addition to the server side DBC file.
I was unable to find the cause of why some of these spells were not showing a cast bar but I did find a flag that can be set to force the display of the cast bar as a fix to the issue.
Setting AttributeEx4 with the value 268435456 (hex value 0x10000000) will force it to display. I confirmed this flag worked with all of the spells that were previously not showing a cast bar.
Might be related, might be unrelated, but from what I understand the 3.3.5 client and blizz's own UI uses events in the combat log to show stuff like cast bars in the UI frame. And because 3.3.5 client famously has bugs that the combat log gets frozen and stuck, sometimes these things disappear. People also call this famous bug other names like the "recount bug", since it leads to addons like Recount showing the wrong values for damage and such, because they stop receiving the correct events from the combat log. Notable thing is though the bug is very strange, it does not always completely freeze everything but rather still let some of the events through, leading the numbers in damage meter addons to change but be completely wrong.
I have stumbled to the same problem with regular mobs and bosses, noticed that some of them suddenly stop showing things like cast bars and buffs/debuffs after the combat log bug happens. The bosses still make their animations for casting and stuff properly, but they don't show in the UI. That's what lead me to think that the stuff happening in the "world" are handled by server sending opcodes but the stuff that is shown in your UI frame are from the combat log.
So first make sure you're using a combat log clearing addon or a macro, like this one:
https://github.com/anzz1/CLFix
Yes, I know that code runs the CombatLogClearEntires() every single frame, but from what I have tested I simply found every other addon that clears the log more infrequently to the combat log bug sometimes happening. Only running it every frame has spared me from any more combat log bugs. See, the thing about that bug is that you have to clear the log before it happens, clearing it afterwards won't usually help and you need to reload the whole UI.
Secondly, what you could do is check what your client sees happening in the combat log by printing the combat log events and comparing the different spell events that way. This can be achieved easily by making a frame, registering the COMBAT_LOG_EVENT_UNFILTERED event and printing the results.
Like this, just wrap that code into a .lua addon to see what's what:
local f = CreateFrame("Frame", nil, UIParent)
f:SetScript("OnEvent", function(self, event, ...)
-- timestamp, eventType, srcGUID, sourceName, srcFlags, destGUID, destName, destFlags, spellID, spellName, arg1, arg2, arg3, ...
print(...)
end)
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")

design issue when no textbox delimiter is present

I Got a design question pertaining to just my issue. My client asked me to have just 1 big text box in a pop up.Beneath it i have labels that user can see(Equipname,(LL,BB,PA),ClientName,Personnel). So he has to enter equipment name,either of(LL,BB,PA) ,cname,pname. An example row can look like "75 LL XYZCompany John". There is no delimiter between the entries. How can I make sure he is entering the corresponding values correctly. I mean instead of entering "XYZCompanyname" , he enters "John" and for john he enters xyzcompanyname..what then?I gave them multiple textboxes first,but they did not want it. any idea how to proceed?
I see no way of validating or ensuring the integrity of what is entered by only using one textbox for multiple fields, especially without some kind delimiter.
From experience with non-technical clients who sometimes want odd implementations like this, my suggestion would be to stick to your guns and provide proper input fields that you can validate and explain clearly to them the consequences that having invalid data can have.
Not to mention that when implementing it the way the customer wants it now and when it inevitably falls apart, the fingers are going to be pointed at you for 'not doing your job' correctly.

Determine if page was loaded from history or from QR Code scan

Here's the situation. I am trying to implement a system in a restaurant where each table has its unique QR Code. The QR Code is fixed and hard printed on the table. My application is basically a web page and the QR Code is simply a web page address with an encrypted parameter which identifies the table.
This system is already protected (to a certain degree) from pranksters by only allowing orders to come from the IP address of the Wifi connection. So you need to be at least connected to the restaurant's wifi to use this page. Doesn't protect from people outside the building, but that is another issue.
The problem occurs if a user comes today and scans the code for table 3 and places an order. If the user comes later and sits at table 5, I don't know how to stop them from loading the previously scanned link (for table 3) and place an order for table 3.
Having constantly changing time stamped QR Codes would address the problem, but that is impossible since the QR codes are fixed.
Is there a way for the page to "know" that it has been loaded from a QR Code Scan, or whether it was loaded from the browsing history? We are talking about pages loaded on a smartphone, so I guess that complicates matters.
Any help or pointers would be greatly appreciated! :)
In short, no. There's usually no "refer" header which will tell you that a page has been loaded from a bookmark or retrieved from a scanner's history rather than scanned directly.
Having an ever changing QR code is not impossible (using eInk or a small display) but that doesn't solve the problem.
Here's how I would fix it.
User scans a code - example.com/table3 - the first thing they see is a map with table 3 highlighted on it.
Text says "If you're not at table 3, please scan the code on your table. If you are - click here to order." Or something like that.
Explain to the user that if they're not sitting at the correct table - someone else will get their food!

How to get the back button and session state to work together?

There may be an easy answer to this and I just don't see it b/c I am too close to the project - so be it.
I have an asp.net 2.0 search application. It is a series of pages that start with a search form and end with the results being displayed to the user. Between the search and results page is a filter page that displays a series of filters the user can filter down the search results to. I execute the initial search on the search page and store the results in the session. If the initial search results total more than a certain number (let us say 50 for the sake of the example), the user is taken to the filters page. There they are presented with a number of filters they can apply to the results.
Once the selected filters have been applied to the search results, if the count is still more than 50 they stay on the page with only the filters they have not selected still displayed on the page. If the count is less than 50, they are taken to the results page. Now if they are on the filters page but wish to see the results, there is a button that takes the current state of the results and takes the user to the results page.
Here is my problem - if I am on the results page after applying some filters and click on the back button (none of the pages cache), how can i get the previous state of the search results BEFORE whatever filters I selected had been applied? Even further, if I got to the results page after a series of say 4 "apply filters" (apply filter - still over 50, apply other filter - still over 50, apply yet another filter - still over 50, and finally apply another filter - yay! under 50 go to results page), how do I get each version of the ever shrinking search results from the session if I keep hitting the back button?
Sorry if this is a bit weird and not that easy to understand - this is one of the problems that is not simple enough to just wrap it in a few simple sentences.
I am most eager for any thoughts (pertaining to the question at hand) or questions.
UPDATE -
FYI, I did not decide on the mult-page design. A requirement stated that it follow the flow of an existing third-party search app (reverse engineering is wonderful right?).
Thanks
Not to be too critical, but what you described sounds like a seriously jacked up way of handling search.
Typically, your search criteria and results are on the same page. When you modify the criteria and click search you should just display the top 50 results and let them know there are more. This can't be any more expensive an operation that what you've described because you have to run the queries under both circumstances anyway.
Take a look at NewEgg.com and try their "advanced search" from this page. You'll notice there are about 20 different criteria factors on the left. As you add a new criteria, the bread crumb at the top of the page changes. They have a little (x) next to each in the bread crumb so you can quickly eliminate any criteria from your search results. Voila no back button needed.
Note that at no point do you need session state to handle this. At most you could use hidden form fields which would still support back button usage in the browser, if they really wanted to.
Use your current session-based parameters as is, but let any querystring-parameter override them. This way you keep your values w/o assigning them to every url, yet adjusts to any previous manual data-enrty (querystrings in the browser-history).
(And don't use POST for search.)

Drupal vote_up_down module reporting incorrect points

I am working on a project using Drupal 6 (6.11 at the moment, haven't yet upgraded to 6.12) and part of the core functionality is the ability to vote on nodes. I'm having some rather weird behaviour that has taken me an age to track down and now I have, I still can't fix it.
This is what I've managed to figure out so far:
The template file sites/default/modules/vote_up_down/theme/vote_up_down_points.tpl.php automatically calls the function template_preprocess_vote_up_down_points() from vote_up_down.module.
vote_up_down.module then queries the database using the values stored in the $variables array that is passed to it
On only one of the 3 occasions this is called on a typical node (in this case forum posts) $variables doesn't have a value for $variables['cid'].
That one occasion is when it reads the score so as to display it below the post itself. And, instead of locating the current post's score, it locates the first-ever-voted-on post's score. (This is because instead of returning the score of one post, it returns the score of all posts and then uses the first one from the list).
I am assuming that $variables is a system-wide constant (looking at the content of it using print_r seems to confirm that) and so perhaps this is a core bug as it should always be the same. I checked the contents of $variables and the only 4 parts of around 50 that are different in the one that doesn't work are: cid - blank, tag - blank (although this is discovered by the function and correctly substituted as 'vote'), zebra - even & id - 2. I imagine the last 2 are not really important for this, so the key must be in why $variables['cid'] is not being passed through.
So, my questions are:
Has anyone had this problem before and how did you fix it?
If not, do you have any tips as to how I can figure out why this is not working correctly?
I can't tell you the answer, but you'll probably have better luck posting this in the module's issue queue, since then the maintainer and others using it will see it.
I can't believe I didn't try this before, but I just upgraded to the latest development snapshot of vote_up_down and the problem went away. A 2 minute fix in the end vs about 6 hours of trying to tie the problem down.
Lesson learnt!

Resources