FPDF extension writetag.ext for Classic ASP - asp-classic

I am trying to convert a FPDF extension to Classic Asp. I have installed FPDF for Classic Asp on our server (please no flame war regarding why we still use classic ASP). It works well for all that I have tried. Now I want to have the functionality of WriteTag.php as posted on GitHub under by CREACION DE HORARIOS.
In converting the php code I run into trouble with foreach(this.PileStyle as xval) in the function code below.
I have no idea where "this.PileStyle" comes from. It is this line that gives trouble, which at this time I can't describe, other than that the browser throws the "500 - Internal server error".
Note: there is more to this function, but the foreach shown in the code below is where the error first shows up. My testing so far involves adding small pieces of code to the "writetag.ext" file until an error shows up. I have worked on being able to get the extension loaded in when my "writetag.asp" file starts, until the error appeared. I have not been able to progress to and functional tests.
I have searched both, the PHP and the Classic ASP libraries for FPDF, and find no occurance of help for Classic ASP in this regard.
Any help, or instructions how to proceed, will be greatly appreciated.
this.FindStyle=function FindStyle(tag, ind) //Inheritance from parent elements
{
tag=trim(tag);
// Family
if(this.TagStyle[tag]["family"]!="")
family=this.TagStyle[tag]["family"];
else
{
foreach(this.PileStyle as val)
{
val=trim(val);
if(this.TagStyle[val]["family"]!="")
{
family=this.TagStyle[val]["family"];
break;
}
}
}

Related

No Way to get the console handle (Dev-Pascal)

I've tried the simple program for my exercise but if i compiled, it turned give a message "No Way to get the console handle" (Dev-Pascal).
Here's my code:
program square;
uses crt;
var
side,circumference,broad:real;
begin
write('Input the side value of the square: ');
readln(side);
circumference := 4 * side;
broad := side * side;
writeln('The circumference value of the square = ', circumference);
writeln('The abroad value of the square = ', broad);
writeln();
write('Press any key...');
readkey();
end.
thank you for helping and teaching me
i would appreciate
Dev-pascal comes with a 10+ years old Free Pascal version. I really have no idea. Try to run the example on the cmdline to see if dev-pascal is the cause or something else. Temporarily disable security software might also be something to try.
I suppose, you've created a Window Skeleton project.
It has it's description: A Windows skeleton application (no window).
In this case you'll get this error though you code compiles (I've got this error too with your code).
Try to create Console Application project which has it's own description: A standard console-based (MS-DOS) application (Your code has compiled and the program worked as well).
P.S. Can't say what exactly happens -- couldn't find any documentation about errors in Dev-Pas (1.9.2).
My assumption is that skeleton program doesn't imply console window for execution program while console application does.
just close the project and then re-open the pascal source file (.pas). And maybe put "readln;" just before "END.".

Websphere & Tivoli: NPE while trying to create PDAuthorizationContext

I am getting the following error when I try to start my Application...
[java.lang.IllegalStateException: java.lang.NullPointerException^M
at com.tivoli.pd.jutil.kb$1.run(kb$1.java:41)^M
at java.security.AccessController.doPrivileged(AccessController.java:229
)^M
at com.tivoli.pd.jutil.kb.c(kb.java:141)^M
at com.tivoli.pd.jutil.kb.(kb.java:56)^M
at com.tivoli.pd.jutil.PDContext.(PDContext.java:76)^M
at com.tivoli.pd.jazn.PDAuthorizationContext.(PDAuthorizationConte
xt.java:66)^M
I double checked the config file was accessible and I could read it. The code I am using looks as follows...
aC = new PDAuthorizationContext(cFile);
Is there a way to get more information on what is causing the NPE?
More information!!!
After debuging a bit, it appears the issue comes from this code (they use progaurd so it is a little hard to be 100% confident)...
Certificate[] arrayOfCertificate1 = ((KeyStore)???).getCertificateChain("DefaultID");
//Throws Null pointer (presumably because array is null)
Certificate localCertificate1 = arrayOfCertificate1[0];
EVEN MORE INFO
This appears to be some kind of dependency conflict (guess), because if I just create a sample App using PDAuthorizationContext it works fine.
Problem was related to the PD.jar version that I was using. Although I thought I was using one version I was using another. This was because on version was registered in my WebSphere library (under build path in eclipse). Once the proper library was introduced everything worked.

Web Resource was not found

I've spent the last day trying to get a checkbox validator to work. I found some starting code on the 4GuysFromRolla website, however this was coded back in 2006 and doesn't play alongside updatepanels.
I've made changes and now it works. As I'd made quite a few changes I wanted to standardise it and use it alongside other utility classes, so I created a new class project and copied the code verbatim.
The problem is that the original works, but I get a WebResource not found error on my new class project.
The differences are: The original was a web application project:
my new project is simply a class library project.
The original assembly and namespace have changed.
Both contain a single class and a resource file (.js)
Both resource files are contained in the root directory
Both resource files are set to embed resource
I'm running out of ideas, and have exhausted the answers I've found on the web with no success.
Is there an issue with the fact that its a class library? Have I perhaps overlooked something else?
Its pretty difficult to see beyond those 2 questions because the project is so small and insignificant.
Here's the code that does work:
if (this.RenderUplevel && this.Page != null)
{
ScriptManager.RegisterClientScriptResource(Page, this.GetType(), "skmValidators.skmValidators.js");
}
Here's the code that doesn't:
if (this.RenderUplevel && Page != null)
{
ScriptManager.RegisterClientScriptResource(Page, this.GetType(), "ValidationExtender.EvaluationFunctions.js");
}
Anyone give any ideas?
Thanks in advance.
The error turned out to be a mismatch between the dll's in the test page.

Error handling for ASP based sites and forms

I'm working on a asp based (not .net) site, which spans about 400 odd pages... Now, throughout the site there're ASP and VBScript errors, such as:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'Cdate'
/MySite/page.asp, line 71
(The above happened when I put in characters into a 'date' field. I know its VBScript in this case, but I get plenty all over.)
Now, I know I can avoid this scenario with client side validation (jQuery for example), but when such things do happen, how do I code up a default 'error' page? You hit the error, and instead of showing you the above, you get redirected to a generic 'error' page?
I've looked up some of this, and found the ASP 'On Error Resume Next' thing, but I haven't found any viable examples. Each one is tailored to a specific error (like dividing 5 by 0), and I really don't want to code up like 400+ potential error messages.
You could create custom error pages, via IIS. I'm not sure what version you're running, etc - but this should give you a good jumping off point. http://support.microsoft.com/kb/224070
You add following code in top in your page.
<% on error resume next%>
.
..
....
(Other code is above instead of point(.))
Then you add
<% if err then
response.redirect("err.page?code="&err.code)
end if%>
And you define error message in your generic error page according to error number.
if you ask same question for client side. You can try and catch code block for possible code clock that will can throw.
For examle
<script language="text/javascript">
try
{
//Code that will can throw error is here.
}
catch(err)
{
document.href.location="genericerrorpage.asp?err=" + err.code;
}
}
</script>

Add Source file link to the default ASP.NET Server Error page?

Has anyone ever thought to attempt to modify the default ASP.NET Server error page to provide a link BACK to the error source in Visual Studio?
Consider the following standard error page in ASP.NET:
Server Error in '/myproject'
Application.
Invalid object name 'usp_DoSomething'.
Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.
Exception Details:
System.Data.SqlClient.SqlException:
Invalid object name 'usp_DoSomething'.
Source Error:
Line 4323: cmd.CommandText = "usp_DoSomething";
Line 4324:
Line 4325: using (var dr = cmd.ExecuteReader())
Line 4326: {
Line 4327: if (dr != null)
Source File:
c:\development\myproject\myproject.components\providers\sql\sqldataprovider.cs
Line: 4325
When an error like this is generated, the HTML has the source back to the file the error occurs in and the line number. Has anyone ever written or thought of writing some mechanism to turn the text into a link back to the error in Visual Studio?
I've never seen anything that does it, but it just seems like it would be a helluva nice feature and I think about it in the back of my mind every time an error occurs when I have to manually go find it in the source. It would just be nice to be able to click a link to take me straight there.
Anyone written any, or know of any solutions for this. I use Chrome or Firefox as my browsers of choice, but I'd even consider using IE again if someone found a plugin that did this.
Thanks,
Max
Well, I had been hoping for some means of hacking the error page to turn this:
c:\development\myproject\myproject.components\providers\sql\sqldataprovider.cs Line: 4325
into a link back into my source code in Visual Studio... being that the file name and line number is provided. I was thinking of a browser plugin or something, but apparently no one has built anything like that before... oh well. Was worth a shot.

Resources