Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

tantiboh

@tantiboh
About
Posts
62
Topics
34
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Nifty script + Interesting problem: run javascript without script tags [modified]
    T tantiboh

    It's actually an online correspondence gaming forum for a board game called Diplomacy. You can't get into the forum unless you join the game, so the address wouldn't help you much, but I bet most forums are similarly protected against potentially malicious posts.

    Web Development javascript tools help tutorial question

  • Nifty script + Interesting problem: run javascript without script tags [modified]
    T tantiboh

    Here's a nifty little script I built, almost by accident. Essentially, it takes a string of invisible characters and makes grow to full size in a cascading fashion. Feel free to use it in whatever you want: *************** //<!-- var timeout; function SizeShift(LetterNum) { Grow(LetterNum + 1, 0) if (LetterNum <= 18) { timeout = setTimeout('SizeShift('+(LetterNum + 1)+');', 100); } } function Grow(LetterNum, Size) { var D = document.getElementById(LetterNum); D.style.fontSize = Size; if (Size < 25) { timeout = setTimeout('Grow('+LetterNum+', '+(Size + 1)+');', 10); } } timeout = setTimeout('SizeShift(0);',100); //--> Code Project is Cool! ***************** So, here's the challenge: I want to use this script as a signature for message board-style posts on a site that doesn't accept certain tags, including at least , <LINK>, <IMG>, and <IFRAME>, evidently in an attempt to prevent malicious use. Of course, what's a wall good for if you can't find a way around it? Any ideas on how to make this happen? One approach I've been trying without success is to host the script and signature somewhere then import that page into the innerHTML of, say, a <SPAN> within the post. I can't quite make that one happen. Any other ideas? Proof of concept is requested, if possible. -- modified at 20:47 Friday 26th January, 2007 </x-turndown>

    Web Development javascript tools help tutorial question

  • Fun with setting subproperties through reflection
    T tantiboh

    What I'm trying to do is set up a system that can read records from a database and build a form according to the information contained in those records. I've largely succeeded, but I'm having difficulty setting up a way to set sub-properties. For demonstration purposes, I will use a concrete example. Let's say I'm trying to set up a label. I want to use database records to set the label's properties. One of the properties I want to set is Font. In the case of Font, there are subproperties, i.e. Bold, Italic, Name, Size, etc. In my example, I want the font to be bold, which means I need to set the Font.Bold subproperty to True. I've pulled the applicable data from the database into a dataset called dsMyDataSet, set up as follows: tblTemplateControls ControlID | ControlType 1 | System.Web.UI.WebControls.Label tblControlProperties PropertyID | ControlID | PropertyName | PropertyValue | ParentPropertyID 1 | 1 | Font | NULL | 0 2 | 1 | Bold | True | 1 3 | 1 | Text | Hi, Mom! | 0 Here's the code I'm using: //Instantiate controls. This is well-developed and works great. I include it for context. for (int n = 0; n < this.dsMyDataSet.Tables["tblTemplateControls"].Rows.Count; n++) { dr = this.MyDataSet.Tables["tblTemplateControls"].Rows[n]; Type myControlType = typeof(Control).Assembly.GetType((string)dr["ControlType"]); ConstructorInfo myControlContructor = myControlType.GetConstructor(System.Type.EmptyTypes); Control myControl = (Control)myControlContructor.Invoke(null); myControl.ID = Convert.ToString((int)dr["ControlID"]); //Set the properties of the control. The works well for top-level properties like Text. DataRow[] Properties = this.dsMyDataSet.Tables["tblControlProperties"].Select("ControlID = " + myControl.ID); for (int j = 0; j < Properties.Length; j++) { DataRow Property = Properties[j]; if ((int)Property["ParentPropertyID"] == 0) //This property does not have a parent property. { foreach (PropertyInfo pi in myControlType.GetProperties()) { if (pi.Name == Property["PropertyName"].ToString().Trim())

    C# database design tutorial

  • Fun with generics
    T tantiboh

    Here's a good problem. I'm trying to set up a system where text fields in a database define dynamically-generated controls on the form. In other words, when a user makes a selection on the form, the system will pull all the records that match that selection from a database that contains text information that defines all the controls from one table, and text information that defines each of those controls' properties from a related table. Now, I could set up switch statements that would satisfy many of the possible permutations. But that would require hundreds of lines of code, and it wouldn't be feasible to predict all the possibilities. My idea is to use generics (which I'm just learning about) to dynamically define the controls and their properties. In essense, I need to somehow get text from the database into the utilization of the generic. Conceptually, something along these lines: **** public class GenericControl { **Code to construct the control** } class TestGeneric { private void BuildControl() { //In reality, this string would be retrieved from the database. string controltype = "System.Web.UI.WebControls.TextBox"; //Then the part that won't work: GenericControl MyControl = new GenericControl(); } } **** Now, if I understand correctly, generic utilization requires that you use a defined object where I have "controltype" - which is why the above example won't work. Is there any way to take the string "System.Web.UI.WebControls.TextBox" and use it to get a TextBox object type (or the appropriate object type) - without using a switch statement?

    C# database design regex help tutorial

  • Comma appended to filename of streamed file
    T tantiboh

    I'm generating reports using Business Objects (aka Crystal Reports) XI release 2. I'm running ASP.NET 2.0. Here's the relevant code (C#): CrystalDecisions.CrystalReports.Engine.ReportDocument rdReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); //Uses the full physical file path of the report file on the IIS server. rdReport.Load(strReportFilePath); //Sets the report's data source to the dataset just generated. rdReport.SetDataSource(dsReport); //Clear the current page Response.ClearContent(); Response.ClearHeaders(); //Output the crystal report in PDF format to the page. Response.ContentType = "application/pdf"; Response.AppendHeader("Content-disposition", "inline; filename=test.pdf" ); rdReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, ""); The problem is that that file generated is named "test.pdf," insead of "test.pdf". It doesn't matter what file format the export is (ie .doc, .xls, .pdf, .rtf, etc.), whether or not the extension is included, or whether the "test.pdf" is replaced by a variable. The system always appends a comma to the end of the file name. Any ideas? Thanks for your help!

    ASP.NET csharp help asp-net sysadmin windows-admin

  • Displaying photo from session variable in IE for Mac
    T tantiboh

    Here's an interesting compatibility problem. I've set up an application that pulls a given image from a database then places that image in a session variable. That image is then displayed in an IFrame, which links to a separate page that reads and displays the image from the session variable. The user views the entire database record, then can go back to a list and view a different database record (with a different image). This works great in IE, Firefox, Safari, etc, but IE for Mac screws it up. IE for Mac seems to hold the first image in the session variable, and displays that first image whenever another record is displayed. The only way to display the correct image is to refresh the page while the second record is displayed. Any ideas what is causing this? Any thoughts for fixes?

    ASP.NET question database help discussion

  • Help on ascx
    T tantiboh

    There are navigator bars out there that have been developed for ASP .NET 1.1. They generally use a JavaScript implementation to display fly-out menus. http://aspalliance.com/652#Page7 Take a look at category 6. However, with ASP .NET 2.0, Microsoft has introduced a fully featured menu control which should meet your needs - if you're able to upgrade.

    Web Development csharp visual-studio design help question

  • Extracting user's password for alternate authentication
    T tantiboh

    I'm trying to use the CrystalDecisions assembly to access Crystal Reports. To do this, I need to get the user's authentication information so I can authenticate into Crystal Reports itself. I want to do this with the user's windows authentication so the user is saved the trouble of having to log in. Here's where I'm putting the information: CrystalDecisions.Shared.ConnectionInfo crConnectionInfo = new CrystalDecisions.Shared.ConnectionInfo; crConnectionInfo.ServerName = "ServerName"; crConnectionInfo.DatabaseName = "DBName"; crConnectionInfo.UserID = "UserID"; crConnectionInfo.Password = "Password"; ServerName and DBName are key values in my web.config file, so they're easy. Getting the current user's UserID from System.Security is also pretty straightforward. What I can't find is a way to extract the password from somewhere. I realize there may be security in place specifically to prevent exactly what I'm trying to do, but has anybody come across a way to do it? Perhaps finding the user's object on the AD? Perhaps pulling it from Windows somewhere? Perhaps a way to pass a security token to Crystal Reports? Thanks for your help!

    C# security help question

  • Displaying images in a web form
    T tantiboh

    If that's your chosen method, then you've picked the simpler way to do it from a programmatic standpoint. All you have to do is store the image at a specified URL on your web server, then store that URL as a varchar in the database. Then, just query the database for each URL and stick that string as the src attribute of an image tag in the web page. For example: StringBuilder builder = new StringBuilder(); //...Set up a DataReader called i.e. datardr to read the records from your database... //...Add any html text you want to with builder.Append()... while datardr.Read() { builder.Append(" "); //where [n] is the index of the column containing the image's URL } //Then you can output the HTML string contained in builder any way you want, for example: Response.Write(builder.ToString()); Hope that helps!

    ASP.NET database help tutorial sql-server sysadmin

  • how to explore an image
    T tantiboh

    Your problem is very similar to the post above. See my response there.

    ASP.NET database question tutorial

  • Displaying images in a web form
    T tantiboh

    I just had to solve this problem at work. Basically, you have two ways to do this. One, which "someone" told you to do, is to store the images in a folder on your web server then store a link to their location in the database which you can then slip into an IMG tag in the code. The other way is to actually store the images into the database then retrieve them accordingly. There are advantages and disadvantages to each method. To boil them down, storing the images in a database means faster retrieval and display for your web page and easier administration (especially in server farms), but it also means higher database server load and greater complexity in the system. To perform the latter, you must first get the images into the database. One way to do this is to use an upload control and convert its uploaded file into byte format. That byte stream, in the form of a Byte variable, can then be stored into the SQL Server database's image datatype field via an update or insert query or through a stored procedure, just like any other data. To retrieve the image is a bit tricky. Basically, you need another page. The way I did it was to retrieve the image through a query into a Byte variable in PageA. Then, I saved that variable into a session variable that I could access from PageB. In PageB's code, I set its content type to JPEG (or whatever type your image is), then I simply wrote the Byte variable into the page with Response.Write. I displayed PageB in PageA with an IFRAME. You'll have to adapt the technique slightly to display the images in a datagrid, but I don't expect it'll be too difficult to figure out. You could store all your images in an array as a session variable, then pass some sort of identifier to your PageB so it can access the correct image within the array to write it out. The only concern I might have in this scenario would be server memory - too many or too large pictures would be a big load. I would provide code snippets, but that's all at work and I don't have access to it.

    ASP.NET database help tutorial sql-server sysadmin

  • Using a PHP page to display an ASP.NET control
    T tantiboh

    I'm stretching here, because I know there is a fundamental difference in the way the server interprets the two, but I have a new ASP.NET control that emulates part of the functionality of my legacy PHP pages. Is there any way that anybody has come across to display an ASP.NET control within the PHP page? It's basically a souped-up menu, so the drop-down parts of it exclude use of an IFRAME. Some sort of in-line scripting in an included file, perhaps? It's an interesting problem. Any ideas?

    ASP.NET csharp php asp-net sysadmin help

  • Display an ASP.NET control in PHP?
    T tantiboh

    I'm stretching here, because I know there is a fundamental difference in the way the server interprets the two, but I have a new ASP.NET control that emulates part of the functionality of my legacy PHP pages. Is there any way that anybody has come across to display an ASP.NET control within the PHP page? It's basically a souped-up menu, so the drop-down parts of it exclude use of an IFRAME. Some sort of in-line scripting in an included file, perhaps? It's an interesting problem. Any ideas?

    Web Development csharp php asp-net sysadmin help

  • Problem with Server.MapPath() in ASP.NET 2.0
    T tantiboh

    Thanks, that was the tip I needed.

    ASP.NET help csharp asp-net visual-studio design

  • Problem with Server.MapPath() in ASP.NET 2.0
    T tantiboh

    I built a project in VS 2003 under .NET 1.1 with the following line: ... = Server.MapPath("../includes/navigation_bar.inc"); To be clear, I was referring to the includes directory, located in the directory above my application's root directory. Worked great, that version is still live and running fine. I'm trying to upgrade the program to ASP 2.0 now in VS 2005. The same line gives the following error: System.InvalidOperationException was unhandled by user code Message="Failed to map the path '/includes/navigation_bar.inc'." I've tried for several hours to find a workaround or other solution, but to no avail. Unfortunately, many pages on the website refer to that file, so moving it is not an option. My hunch is that ASP is no longer allowing referrals to files on the server outside of the application's directory, but the purpose behind such a change is puzzling. Any ideas? Anybody know why this is a problem now when it wasn't under .NET 1.1? I appreciate your help! _________________________________________ For information, here are the full details of the error: System.InvalidOperationException was unhandled by user code Message="Failed to map the path '/includes/navigation_bar.inc'." Source="System.Web" StackTrace: at System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) at System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath) at System.Web.VirtualPath.MapPathInternal() at System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping) at System.Web.HttpRequest.MapPath(VirtualPath virtualPath) at System.Web.HttpRequest.MapPath(String virtualPath) at Applicators.referrals.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\Applicators\referrals.aspx.cs:line 57 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    ASP.NET help csharp asp-net visual-studio design

  • Interesting problem: Show image byte[] in web page
    T tantiboh

    I've found a number of articles that deal with the general subject, but I haven't been able to find anything that quite answers my question. I'm storing small JPG images (in binary format) in Sql Server as part of a larger record. When I pull that record, I'm also pulling the image. I can, of course, convert that binary data into an Image object; at that point, though, how do I display that Image object on the web page with the rest of the record's data? Is there a server control that facilitates this? Thanks for your help!

    ASP.NET question help database sql-server sysadmin

  • Simple ASP.NET Output Question
    T tantiboh

    Of course! Thanks.

    ASP.NET csharp question html asp-net help

  • Simple ASP.NET Output Question
    T tantiboh

    Although competent in C#, I'm new at ASP.NET, so this one's got me stumped. I've build a basic aspx page, and I want to write HTML lines to it programmatically through the Page_Load event handler. Here's the code: private void Page_Load(object sender, System.EventArgs e) { SqlCommand cmFAQs = new SqlCommand("SELECT Question, Answer FROM tblWebFAQsQuestion", this.cnFAQs); this.cnFAQs.Open(); SqlDataReader rdrFAQs = cmFAQs.ExecuteReader(CommandBehavior.CloseConnection); int i = 0; while (rdrFAQs.Read()) { this.Page.Response.Output.WriteLine(" "); this.Page.Response.Output.WriteLine(rdrFAQs.GetString(0)); this.Page.Response.Output.WriteLine(" "); this.Page.Response.Output.WriteLine(" "); this.Page.Response.Output.WriteLine("**Answer:** "); this.Page.Response.Output.WriteLine(rdrFAQs.GetString(1)); this.Page.Response.Output.WriteLine(" "); i++; } rdrFAQs.Close(); } It works great, except one thing - which will be obvious to any veteran. The WriteLine method outputs the line to the beginning of the HTML page. I need the output to be placed inside the of the page so I can build a form around it. Is there a (hopefully simple) way to do this? Thanks for your help!

    ASP.NET csharp question html asp-net help

  • Problem with MySQL connection
    T tantiboh

    I'm attempting to connect to a MySQL database from my ASP.NET application (c#). Here's my code: string connString = "Database=games;Data Source=http://[my server's IP]/mysql;User ID=group; Password=" + strSystemPasswords[3]; conn = new MySqlConnection(connString); conn.Open(); The database is contained in the mysql directory under the web server's root. (I added a space between group; and Password to prevent a smiley.) When I run the code, I get the following error for conn.Open(): "The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for " I've researched the problem and have found the standard answer is that the address can't be resolved. However, I am assuming that this is not the problem in my case, as I can navigate to that exact address with my web browser. But I haven't found any alternate causes for this error. Any suggestions? Thanks for your help!

    C# help csharp asp-net database mysql

  • An interesting problem...
    T tantiboh

    I've encountered an interesting problem to which I can't seem to find a solution. I've got an ASP.NET application, written in C#, that returns a variable called TimeToRefresh each time that the page loads. This variable is determined dynamically, represents the number of milliseconds before the page needs to automatically refresh, and could be any positive integer. Since I need an automatic page refresh, that necessitates JavaScript (if there's another client-side method for automatic page refresh that could be adapted to this problem, please let me know). I need to implement, therefore, a JavaScript timer that counts down the number of milliseconds indicated in the TimeToRefresh variable. Here's the rub: I can't find a way to transfer the variable from ASP.NET to JavaScript. I need to either: a.) access an ASP control from JavaScript, or b.) populate an html control from ASP that can then be accessed by JavaScript. I can't seem to do either successfully. Any ideas? Another method entirely, perhaps? Thanks for your help!

    Web Development csharp help javascript html asp-net
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups