How to debug or log ASP.net pages - asp.net

First off I am not a programmer or else I should probably know how to do this already. I have a situation where I am receiving an MS Jscript runtime 800a1391 indicating whereClause is undefined. I am fairly certain in previous portion of the ASP page it is attempting to gather values and is most likely failing to return values or is returning something like a null that is later breaking the script on this line.
Here is the line it is failing on:
{
url += "&chartType=" +chartType + "&selClause=" + selClause + "&whereTrendTimeClause=" + whereClause + "&TrendTypeForReport=" + TrendType + "&ReportDisplayType=" + Request("ReportDisplayType") + showModes + "&whereProtocolClause=" + protocolClause + "&groupClause=" + groupClause + "&joinClause=" + joinClause + "&groupIDClause=" + groupIDClause;
}
What I am trying to figure is how to output (either to text) or even printed to screen the returns each time the whereClause does something within this page. Even if I have to manually enter some bit of code for each instance of whereClause that is fine. I am not looking for an easy solution just a method that works and returns what I need which is a very verbose output. The reason a verbose output is needed is I can compare a working environment vs a non-working one. I just need to get the "logging" to work first.
thanks,

To monitor your variable and see what your variable have you can use Google Chrome, and opening by the Console (right click on the page, click Inspect Element, then Select Console) you can see the errors that you have on page.
And you can use the console.log() to write on it from your javascript code.
You can learn more on this tutorial - Debug the web

Related

Is it possible to set a modifier as a QShortcut?

shortcut = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Shift), MayaMainWindow)
shortcut.setContext(QtCore.Qt.ApplicationShortcut)
I have a system in place for overloading Maya shortcuts, as and when needed. I want to do this with the shift key, however simply writing it as above seems to do nothing. Not even an error message.
I have tried
QtGui.QKeySequence(QtCore.Qt.Key_Shift)
QtGui.QKeySequence(QtCore.Qt.Key_Shift + QtCore.Qt.SHIFT)
QtGui.QKeySequence(QtCore.Qt.Key_Shift + QtCore.Qt.NoModifier)
QtGui.QKeySequence(QtCore.Qt.Key_Shift + QtCore.Qt.NoButton)
I want to run a custom shortcut when only the shift key is pressed.

I need help for gamemaker 2.3

Pls help me
A few weeks ago it came out of gamemaker 2.3, practically in the gamemaker language they changed the scripts into functions, but now after converting the files to be able to reopen them, I double-checked all the scripts and etc but anyway when I start it it remains a black screen, however it doesn't give me any compilation errors or whatever, what could be the problem?
Ps.
I might sound stupid, but if someone has the same program as me I can pass the project to them so they can see the scripts for themselves, so basically it's just the base and there is only the script to make the player walk and for collisions, I know that no one would want to waste time, but I ask the same
Its possible that your code is stuck in an infinite loop, here's an example of what that might look like:
var doloop = true
while(doloop == true){
x += 1
y += 1
}
the "doloop" variable is never changed within the while loop, so it is always equal to true and the loop never ends. Because the code never finishes looping, it can never get around to drawing anything, so you end up with a black screen. The easiest way to check for these is to put a breakpoint/debugging point at the beginning and just after every while/for/do/ect loop and debug it. e.g. (I am using asterisks "*" to represent breakpoints)
var doloop = true
* while(doloop == true){
x += 1
y += 1
}
*
When you get to one of the loops remove the first breakpoint and hit the "continue" button in the debugger. If it (it being the computer) takes an longer than it should to hit the second breakpoint (as in, you wait for a ten seconds to or two minutes (depends on how complex the code is) and it still hasn't hit the second breakpoint), then you should replace the breakpoint at the beginning of the loop to check and make sure it is still in there. If it is still in the loop, then that is likely where the code is getting stuck. Review the loop and everywhere any associated variables are set/changed, and you should be able to find the problem (even if it takes a while).
Majestic_Monkey_ and the commentors are correct: use the debugger. It's easy and it's your friend. Just place a red circle on the very first line of code that runs, and click the little bug icon and you can step through your code easily.
But to address your specific issue (or if anyone in the future has this issue): scripts have changed into files that can have many functions. Where you used to have
//script_name
var num = argument0 + argument1;
return num;
You would now have
function script_name(a, b) {
var num = a + b;
return num;
}
All you have to do is create a decleration for your new function:
function my_function_name(argument_names, etc...)
Then wrap all your old code in { }, and replace all those ugly "argument0" things with actual names. It's that easy. Plus you can have more than one function per script!

Game Maker Multiple variable error

My code is designed to rename a jpeg and capitalize the attributes in order to trick my Nintendo 3DS into thinking it took the image as a photo this code down here is the converter ran on a pc to convert an image to the right type and name.
Prefix = "HNI_";
Midfex = floor(random(9999));
Suffex = ".JPG";
gt_file=get_open_filename("jpeg image|*.jpg", "");
file_rename(gt_file, Prefix + Midfex + Suffex);
Where "Midfex" is, a random number with four digits is created.
and "Prefix" and "Suffex" are, they just what they are called and supposed to do.
When running the game, I get this error:
FATAL ERROR in
action number 1
of Mouse Event for Left Pressed
for object object0:
DoAdd :: Execution Error
at gml_Object_object0_LeftButtonPressed_1 (line 10) - file_rename(gt_file,Prefix + Midfex + Suffex)
There are probably too many variables in the "Rename_File" function. I have tried this on GameMaker 8.0 and it still does not work. How can I fix this?
I am using the standard version of GameMaker Studio, not the free version. I have attached a screenshot of my code in Gm:s Drive.Google.com/file/0b....
When you use + you are trying to add the number Midfex to Prefix and Suffix. Changing it to Prefix + string(Midfex) + Suffex should solve your issue as it is now in a string format.
Also for your convenience you can use irandom(9999) instead of floor(random(9999)) to achieve the same result for Midfex.
You cant use + between string and real.
Prefix = "HNI_";
Midfex = string(irandom(9999));
Suffex = ".JPG";
or
file_rename(gt_file, Prefix + string(Midfex) + Suffex);

Maya MEL shelfbutton

I am pretty new to MEL and as I was exploring around this MEL script, I found out that the user have write some lines that I totally do not get it.
And yet I am interested to know why this person done it..
Anyway, can someone kindly explain why does the following code, first indicate an empty MEL then it goes on to call a Python? Wouldn't it be easier to just put in the Python?
I also tried to disable the command and sourceType, and the script works fine too, it is just that I do not get what is the purpose of command and sourceType doing in this case...
-command ""
-sourceType "mel"
-actionIsSubstitute 0
-commandRepeatable 1
("shelfBtn_" + $parent + "_AOV");
python("import aovsFunction as aovs; aovs.MenuFuncs.aovMenu('"+"shelfBtn_" + $parent + "_AOV"+"')");
By the way, $parent is derived from:
global proc apkg2dnc(string $parent)
Then I tried to change the code into the following, it works as like the one above but...
-command ("import aovsFunction as aovs; aovs.MenuFuncs.aovMenu('"+"shelfBtn_" + $parent + "_AOV"+"')")
-sourceType "python"
When I tried removing the brackets, I was given the Syntax Error message, indicating the first plus sign + that it encounters.
Did tried to add in the ; at the end of the line, it is still giving the Syntax Error, this time indicating at the start of the line
-command "import aovsFunction as aovs; aovs.MenuFuncs.aovMenu('" + "shelfBtn_" + $parent + "_AOV" + "')"
-sourceType "python"
And so, does brackets play a big part in how it is being read in MEL?
Your examples are malformed. In general you can not cut code from switches like you are doing because the code looses meaning. Switches like:
-command ""
are referring to the line before where the actual mel command is invoked (not to be confused with the -command switch). In this case i would guess the entire command is actually:
shelfButton
-command ""
-sourceType "mel"
-actionIsSubstitute 0
-commandRepeatable 1
("shelfBtn_" + $parent + "_AOV");
But it is hard to know. The code looses all meaning if you omit the command being called and can for most part not be understood that way as it has no meaning. Its like a sentence without a subject, predicate and context.
With that clarified we can actually answer the question. Why put a a empty -command? Its a bit redundant, yes but it still has meaning. The reason is that he does not know what to populate the button with. You could omit the command and source type flags shouldn't make a difference. (there is a off chance that omitting source type would end up being subtly wrong)
The next command does the binding:
python(...yada yada ... "('"+"shelfBtn_" + $parent + "_AOV"+"')");
No i have no idea what aovMenu really does but the intention is pretty clear because he is passing the name of the button. Whatever is inside the aovMenu command is changing the command of the button. This would off end up looking like it worked if you put it into -command switch directly (because pushing the button the first time would populate the button). But it would be subtly wrong, nonetheless.
This is a pretty common pattern in maya programming. What you do is you pre-generate the button to know its final name so that you can bind two entities that depend one each other to that name.
goes on to call a Python? Wouldn't it be easier to just put in the Python?
Not really the code would be exactly the same. It might be easier this way, depends on who is calling. You would still need to bootstrap the button and then call the aovMenu function. Its not really any different form calling a function made by somebody else.
The thing is the code is a bit bad, there is a small chance for a subtle error. It wouldn't matter if it was written in python or not but rather how Maya behaves. You can not actually know the button will be called:
("shelfBtn_" + $parent + "_AOV")
Because if that name exists maya will rename it OR worse name it the same as something else and now you have to use the full path name or get a 50% chance of error. the correct way to do this would be thus:
$sButton = `shelfButton
-actionIsSubstitute 0
-commandRepeatable 1
("shelfBtn_" + $parent + "_AOV")`;
python("import aovsFunction as aovs; aovs.MenuFuncs.aovMenu('"+$sButton+"')");

Vendors black box function can only be called successfully once

(first question here, sorry if I am breaking a piece of etiquette)
My site is running on an eCommerce back end provider that I subscribe to. They have everything in classic ASP. They have a black box function called import_products that I use to import a given text file into my site's database.
The problem is that if I call the function more than once, something breaks. Here is my example code:
for blah = 1 to 20
thisfilename = "fullcatalog_" & blah & ".csv"
Response.Write thisfilename & "<br>"
Response.Flush
Call Import_Products(3,thisfilename,1)
Next
Response.End
The first execution of the Import_Products function works fine. The second time I get:
Microsoft VBScript runtime error '800a0009'
Subscript out of range: 'i'
The filenames all exist. That part is fine. There are no bugs in my calling code. I have tried checking the value of "i" before each execution. The first time the value is blank, and before the second execution the value is "2". So I tried setting it to null during each loop iteration, but that didn't change the results at all.
I assume that the function is setting a variable or opening a connection during its execution, but not cleaning it up, and then not expecting it to already be set the second time. Is there any way to find out what this would be? Or somehow reset the condition back to nothing so that the function will be 'fresh'?
The function is in an unreadable include file so I can't see the code. Obviously a better solution would be to go with the company support, and I have a ticket it in with them, but it is like pulling teeth to get them to even acknowledge that there is a problem. Let alone solve it.
Thanks!
EDIT: Here is a further simplified example of calling the function. The first call works. The second call fails with the same error as above.
thisfilename = "fullcatalog_testfile.csv"
Call Import_Products(3,thisfilename,1)
Call Import_Products(3,thisfilename,1)
Response.End
The likely cause of the error are the two numeric parameters for the Import_Products subroutine.
Import_Products(???, FileName, ???)
The values are 3 and 1 in your example but you never explain what they do or what they are documented to do.
EDIT Since correcting the vender subroutine is impossible, but it always works for the first time it's called lets use an HTTP REDIRECT instead of a FOR LOOP so that it technically only gets called once per page execution.
www.mysite.tld/import.asp?current=1&end=20
curr = CInt(Request.QueryString("current"))
end = CInt(Request.QueryString("end"))
If curr <= end Then
thisfilename = "fullcatalog_" & curr & ".csv"
Call Import_Products(3,thisfilename,1)
Response.Redirect("www.mysite.tld/import.asp?current=" & (curr + 1) & "&end=" & end)
End If
note the above was written inside my browser and is untested so syntax errors may exist.

Resources