tgreer 189 Made Her Cry Team Colleague

Consider the following code snippet:

counter = 0;
workOperations = new String [OPERATIONS.Count,2];
foreach ( System.Array o in OPERATIONS)
{
  workOperations[counter,0] = (string) o.GetValue(0,0);
  workOperations[counter,1] = (string) o.GetValue(0,1);
  counter++;
}
ps.Operations = workOperations;

There has got to be a better way to do this! The issue is, the ps.Operations property requries a 2-dimensional string array. (It's a list of operations to peform on a PostScript file, along with the parameters needed for each operation.)

I build that array dynamically, which means creating an ArrayList, which is "OPERATIONS" in the code. The challenge is to get the members of the ArrayList into a suitable string array. The above code is my solution.

There should be a way to do this without resorting to a loop. Just a couple of lines of code with some judicious casting, but I couldn't make anything work.

tgreer 189 Made Her Cry Team Colleague

I think you can expect help. But you listed, if I recall, about 10 sites! I think it would be expecting too much to ask anyone to do an exhaustive XHTML & CSS review, for free, of even one site, let alone nearly a dozen.

Those validators are very simple to use. For example, I clicked your sig to go to your site. I copied the URL from the address bar, then went to the validator page I hyperlinked for you above. One of the options is to validate markup by simply entering a URL and clicking a button. I pasted in your URL, clicked "Check", and viola!:

This Page Is Valid XHTML 1.0 Transitional!

Congratulations. If there were any problems, the validator would tell you exactly what the problem is, and where it's located on the page.

There. I helped you, see?

tgreer 189 Made Her Cry Team Colleague

Your question, as I understood it, was how to remove the toolbar from your opened window. My response was to show you that the window.open() function has an optional "features" parameter to control this.

You need to change this line in your code:

prodWindow=window.open("lgImg.php?modelnum="+modelnum+"","null");

You are passing in "null" as a name, and leaving off the the feature string. Edit it to pass in the features you desire for the pop-up window.

tgreer 189 Made Her Cry Team Colleague

Yes, that's a perfectly reasonable request. Others may feel freel to chime in with an example... if not, then I'll work something up this weekend.

tgreer 189 Made Her Cry Team Colleague

Michelle,

While links are permitted in this particular sub-forum, generally those links are to sites you are trying to develop, to illustrate a particular problem. This was a judgment call on my part, and I elected to remove the list of sites from your post.

You can validate sites on your own, by visiting the w3.org validators, and entering the urls in question.

tgreer 189 Made Her Cry Team Colleague

I would suggest that you define a CSS class for erroneous form elements. Then in your validation script, alter the class for elements that didn't pass. The validation function should simply "return false" to cancel the form submission. The form data will be retained automatically.

tgreer 189 Made Her Cry Team Colleague

The arguments to the window.open() function are: URL, Name, and Features.

URL is self-evident. Name is the name of the opened window, which can be used as an argument for the target attribute of hyperlinks.

Features is an optional list of characteristics of the new window:

For example:

<a href="myimage.gif" 
  onClick="window.open('myimage.gif', 'myWin', 
  'toolbar=no, directories=no, location=no, 
  status=yes, menubar=no, resizable=no, scrollbars=no, 
  width=300, height=200');">my image</a>
tgreer 189 Made Her Cry Team Colleague

The problem with deriving a class from StreamReader itself, is that you don't have access to the private members. ReadLine() leans heavily on private members, such as ReadBuffer().

What I ended up doing, successfully, is to derive a class from TextReader, just as StreamReader itself does. This means, in effect, I created my own StreamReader class, by copying the StreamReader code entirely, rather than deriving from it.

Then, I created a private member named _bytesRead, and exposed it as a public variable, BytesRead. I modifed ReadLine() to keep a running total of the bytes read, including the line-termination characters.

Now I have a "myStreamReader" class with all the functionality of a regular StreamReader, plus a BytesRead property suitable for passing to .BaseStream.Seek().

The "gotchas" involve code that the native StreamReader can access from the System.IO namespace that I cannot. This was mainly the error-event code, which I had to replace with my own. Another was Buffer.InternalBlockCopy(), which was easily enough replaced with Buffer.BlockCopy().

An invaluable resource if you ever find yourself in a similar situation is
http://www.123aspx.com/rotor/.

tgreer 189 Made Her Cry Team Colleague

I'm not sure how to take your post. Humor, I hope? If we've misunderstood the question, just rephrase it. We'll eventually get it right!

tgreer 189 Made Her Cry Team Colleague

The "center" element is deprecated. The orignal poster specifically mentioned the assignment was to implement centering via CSS. Centering, in CSS, is implemented by properly setting the margin property in your block-level elements, and the text-align property in inline elements.

tgreer 189 Made Her Cry Team Colleague

If you have two functions which need to run, everytime, when the page loads, then you simply wrap them both in a third "container" function.

myFunction_01()
{

}

myFunction_02()
{

}

myLoadFunction()
{
  myFunction_01();
  myFunction_02();
}

Then you write the body tag: <body onload="myLoadFunction();">

You have to be patient - sometimes it can take a day or two before anyone can respond to a post - we're all volunteers with day jobs, school, etc.

tgreer 189 Made Her Cry Team Colleague

Dani,

The featured blogs are missing the "views" and "comments" bits. I know that information is still available on the blogs page, but not on the homepage.

I often scan the featured blogs. If the topic doesn't interest me, I move on. However, if I see that there are numerious views and comments, I'll often be moved to read the entire thread, thinking there must be something interesting to have motivated so many comments.

It becomes a self-reinforcing phenomemon: the more comments there are, the more comments there'll be. Likewise with "views".

I suggest you consider adding "Views/Comments" to the featured blogs.

tgreer 189 Made Her Cry Team Colleague

cscgal - the code you provided is IE only, and won't work with strict doctypes.

Bomba - spyware works by sneaking in a program that runs concurrently with or as an extension to the browser. It usually works by the user actually installing the spyware, through accepting a page that wants to install a "plug-in" of some sort. Then whenever the browser starts, the spyware starts. That topic really is best explored in the other forum, this one is to discuss client-side programming.

Original Poster - there is no way, as I explained, to code a button that downloads a file, in a completely client-side manner (aside from the IE-only activeX trick).

The proper way to do this is to stream back the proper mime-type. That's server configuration and server-side programming, not client-side. If the user has his browser configured to support that mime-type with a helper application (think "Acrobat Reader" or "Flash"), the stream will be passed to that application. Otherwise, the user will be asked what they want to do with the stream being served. That's the way the web works.

tgreer 189 Made Her Cry Team Colleague

I don't mind the question, but you're asking it in the wrong spot! Daniweb has a forum specifically for these types of issues: http://www.daniweb.com/techtalkforums/forum64.html

If you'll peruse that forum, I think you'll get the education you seek! If not, feel free to post a new thread there. No one will bite your head off; we try to be a friendly group.

tgreer 189 Made Her Cry Team Colleague

C'mon... someone out there must appreciate a challenge. What was suggested on another forum was to derive my own class from StreamReader, and then override the ReadLine() method to count actual bytes read, including any line termination characters. Then, expose a public property that returns the actual bytes read.

I've done quite a bit of C# coding, but haven't attempted to derive any classes from a base class. Anyone care to lend a hand with this?

The source code for the StreamReader class can be viewed here:

http://www.123aspx.com/rotor/rotorsrc.aspx?rot=42055

I've managed to get this far:

using System;

namespace streamOR
{
	/// <summary>
	/// Summary description for StreamReader2.
	/// </summary>
	public class StreamReader2 : System.IO.StreamReader
	{
		public StreamReader2(String path) : base(path) 
		{
		}
	}
}

That derives a new class from StreamReader. It also defines a constructor, overriding the particular base constructor I wish to use.

Next step is to override ReadLine(). This is where I need help. The StreamReader.ReadLine() method uses a lot of private members, so I cannot simply cut-and-paste the base code and expect it work. What is the proper technique for overriding a method?

Here is the ReadLine() method from the StreamReader class. How would I override ReadLine() to maintain all this functionality, and yet add my own code?

public override String ReadLine() {
            if (stream == null)
__Error.ReaderClosed();

            if (charPos == charLen) {
                if (ReadBuffer() == 0) return null;
}
StringBuilder sb = null;
            do {
int …
tgreer 189 Made Her Cry Team Colleague

I'm revisiting a topic previously discussed in this thread: http://www.daniweb.com/techtalkforums/thread23030.html

The basic issue is this: when using a StreamReader, and ReadLine, to process a text file, you cannot determine where you are "at" within a file.

This is because StreamReader doesn't actually read from a FILE, it reads from a BUFFER. You can know the actual file position, by looking at the .BaseStream.Position property. However, if you want to know the position, in the file, of the record you just read with StreamReader.ReadLine(), you cannot know.

There has to be an elegant solution to this. I haven't found it.

Background:

I'm processing extremely large (4GB+) text files. They are actually PostScript printstreams. I have a number of operations to perform on these files. In fact, I need to perform randon file i/o. As an example, the printstream might mix invoices and credit memos. I need to extract all credit memos to a separate file. Imagine they look exactly alike, only the string "CREDIT MEMO" appears in the middle of page 1 of a credit memo.

I know when a "document" begins. I know when one ends. I know when a document I'm currently "reading" is a credit memo. I need to be able to REPOSITION the stream back to the starting record of the document, and extract until I reach the end of the document.

Specifically, I need to note the byte-position of a particular record, so that I can BaseStream.Seek() …

tgreer 189 Made Her Cry Team Colleague

Research JavaScript's "setTimeout" method. It calls a function you specify at specific time intervals. Presumably that function, which you'll need to write, will check through an array of "messages" to see if any are due.

tgreer 189 Made Her Cry Team Colleague

Yet some valid points were raised in regard to overall CONTRAST of the various forum elements. Don't dismiss them!

tgreer 189 Made Her Cry Team Colleague

Now that you mention it, the buttons do tend to blend in a bit too much. I know someone probably worked very hard to achieve the chrome look, but the buttons would be more functional (and marginally faster loading) if they were a solid color, slightly bigger with larger text, and responded to hovers.

The postbit buttons work well. Perhaps switch the thread-buttons to match?

tgreer 189 Made Her Cry Team Colleague

That just made me do more research, which is good. Where, for example, does "DEBUG" come from? There is a #define directive, where one can define such constants. However, if you do a "#define DEBUG" in your code, then "#if DEBUG" is always true. That negates the purpose of a conditional.

There is also a Configuration Manager. In there, you can define various Builds, such as "Release" and "Debug". You can define your constants, such as DEBUG, in the Configuration Manager. Then, if you're compiling for Release, DEBUG isn't defined, and your conditional code won't execute.

All well and good, but my goal was to have code that would run when I'm actively debugging, and not when I'm not (regardless of whether I'm running a "Release" or 'Debug" version).

The compiler directives are of no use for this!

What I ended up doing: in the Configuration Manager, add a ficticious "command line argument". This will only be present when debugging. When executing the program outside of Visual Studio, no command line argument will be present.

I wrap my conditional code inside a test for the presence of a particular command line argument, one that will only exist while debugging.

What a kludge.

tgreer 189 Made Her Cry Team Colleague

Does C# have a conditional compiler directive for debug mode? I have code that I want to run only if I'm debugging.

tgreer 189 Made Her Cry Team Colleague

How did you create the form? What development tools are you using? If you're using Visual Studio, and dragged the appropriate controls to the WebForm, then all should be well with your tag formation/syntax.


Also, please post in standard, professional English. If you want high-quality replies, you need to ask high-quality questions. Bad punctuation and silly abbreviations create a hard-to-read message, and conveys a tone which grumpy old farts like me find highly irritating, making us less inclined to help.

tgreer 189 Made Her Cry Team Colleague

Complete class and description on PHP screen-scraping here:

http://www.tgreer.com/class_http_php.html

tgreer 189 Made Her Cry Team Colleague

Well, you can only POST a message using a POST query. Any parameters passed via a URL, create a GET query.

Now, you could use JavaScript, to create a form, a lot of invisible variables, populate those variables, then call the form's "submit()" method, which will POST the form. You can only do that on a page you "own", of course.

"AJAX" is a funny little beast - it refers to scripting the XMLHttpRequest object. It doesn't do a POST, it fires off another request, "behind the scenes", so that the user doesn't see any page refresh.

tgreer 189 Made Her Cry Team Colleague

I guess I don't understand the issue. I always use the basic CSS hover pseudo-class in combination with a strict doctype. What specific IE issues are you having?

tgreer 189 Made Her Cry Team Colleague

Simply concatentate URL and ARGs. In fact, you don't even need a separate variable and/or call for "args". They are simply part of the URL.

tgreer 189 Made Her Cry Team Colleague

Search for "suckerfish menus".

tgreer 189 Made Her Cry Team Colleague

1st, the script calls for an argument to be passed in, it appears to be the Event object, yet your call doesn't pass anything in.

Also, the script definition should properly be inside the head section. Lastly, it's a bad idea, in my opinion, to attempt to alter or change the user model.

tgreer 189 Made Her Cry Team Colleague

Hi Dani, a couple of quick comments.

1) the light grey text... could it be darkened up? Not enough contrast with the white background. I would prefer basic black.

2) the reply box is too far away from the thread. In a technical reply, there is often a lot of back-and-forth referencing between the reply and the previous post. The "similar threads" is an interloper and needs to be moved downstream. I also like a previous poster's suggestion of making the ad a banner (he said "leaderboard", banner is my suggestion) instead of a big box.

3) the line-height could be tightened-up in the signatures.

I'm not technically "back" yet, just dropping in quickly.

tgreer 189 Made Her Cry Team Colleague

You can dynamically, through JavaScript, provide a global onmousever handler for all links in your document. Hopefully someone else will catch this thread and give you some more pointers, as I'm travelling and just checking in sporadically.

tgreer 189 Made Her Cry Team Colleague

I generally don't help with homework assignments... that might even be a site-wide policy (it is on most tech-help sites).

I would encourage you to research the CSS "margin" attribute.

tgreer 189 Made Her Cry Team Colleague

Oh good. I should have caught that, but glad I could help at least indirectly.

tgreer 189 Made Her Cry Team Colleague

I assume you already have a server-side method for your inclusion (PHP, or SSI), and that your question is soley "what do I put in the external file": just the HTML code itself should work fine.

If you want an "almost" completely client-side solution, then you can set the contents of your nav element via JavaScript, and include the js with standard syntax:

<script type="text/javascript" src="myNavBar.js"></script>

Place that in the head of your document. The JavaScript file will contain everything except the "script" tags. The code within the JavaScript will "set" the contents of your navbar element.

tgreer 189 Made Her Cry Team Colleague

I see that you're mixing divs and tables... usually one or the other is used for layout, but not both. The "center" tag is deprecated. Also, your leftname style has width set to 100% and also "auto". I doubt anything could be "side-by-side" with a 100% width block-level element.

tgreer 189 Made Her Cry Team Colleague

I notice some table cell tags in there, orphaned: no table row, or table for that matter. You aren't showing us all the relevant code, and that makes it nearly impossible to help you.

tgreer 189 Made Her Cry Team Colleague

Firefox is an alternative browser. It's free. If you're writing/testing code on your local system, then I recommend it. It has a built-in JavaScript debugger, for example. You can get it here: http://www.mozilla.org/products/firefox/

tgreer 189 Made Her Cry Team Colleague

JavaScript run from a page loaded locally, will always give a "security warning" in Internet Explorer. Run the page from a server, or with FireFox, and you'll get no warning.

Invoking "document.write()" mid-page is tricky, in may in fact overwrite the current page. You also have no "document.close()".

I don't think you have any configuration problems, just inexperience with JavaScript.

tgreer 189 Made Her Cry Team Colleague

You cannot do this with HTML alone. Or even, for that matter, JavaScript, which is a language to manipulate things (the web document, the browser, cookies) on the client. You'll need to learn at least a server-side language (may I suggest "PHP"), and likely a database and SQL.

tgreer 189 Made Her Cry Team Colleague

Nope, not nearly clearly enough. It's ok, in this particular section of Daniweb, to post links to the site in question. Show us your page(s). Then explain what you want the external link to do.

What I think you're trying to do is:

mainpage

contents

Those are two separate pages. If I really like something on your contents page, and make a link to it, you really want that link to be redirected to mainpage, but to "load" whatever it was on contents that the link is to. Right?

It would help so much to see your site, please give is a link.

tgreer 189 Made Her Cry Team Colleague

This is impossible to diagnose with the information given. Is the URL to the dynamic page correct? Are the database connection strings correct? Is the web-server properly configured to serve pages in whatever server-side language you're using?

In any case, this is probably a server-side issue, rather than HTML or JavaScript.

tgreer 189 Made Her Cry Team Colleague

If you know PHP and CSS, then what is the question? Simply define two CSS declarations, one for each row color, and apply the CSS class on every other row as you build the table.

tgreer 189 Made Her Cry Team Colleague

You can use CSS to color HTML elements. Let me know where to start: how much to you currently know about CSS?

tgreer 189 Made Her Cry Team Colleague

I'm in California every month... mainly in the OC. Starbucks isn't free, but lots of independent coffee shops are. Buzz Coffee on Sunset is one of them.

tgreer 189 Made Her Cry Team Colleague

I agree. I tend to focus on client-side, since this is the forum for client-side techniques. Also, the user asked which of two client-side methods was better.

However, the BEST way to redirect users is with some server-side technique, as it saves a round-trip.

tgreer 189 Made Her Cry Team Colleague

A particular "name"? Or "ID"? Research "getElementByName()" and "getElementById()".

tgreer 189 Made Her Cry Team Colleague

I moved this thread; it's not a JavaScript programming question. I think you'll get better responses in the Server Configuration forum.

tgreer 189 Made Her Cry Team Colleague

I'm saying, use both.

tgreer 189 Made Her Cry Team Colleague

Hello. 1st, I am a developer, so can write/understand PHP and SQL. I have installed vBulletin and migrated my phpbb forum with no problems.

Now I plan on adding/creating a HOW-TO technical article repository on the site. I want to use the New Thread creation routines from VB for this. I want the article display to of course process the BBCODE tags. However, I want the articles stored in their own table structure. Members will not post replies, and articles will have their own CSS style sheet.

My question is, besides "newthread.php", which files and tables should I look at to get an idea of the structure and necessary changes?

I'm not looking for a step-by-step, but rather a roadmap.

tgreer 189 Made Her Cry Team Colleague

The "standard" answer is that users may have JavaScript disabled. That said, I've never, once, in my career as a web developer (since the web was invented), encountered a user with JavaScript disabled.

tgreer 189 Made Her Cry Team Colleague

Good guess. Where did you get that little piece of information? Please post the link for the benefit of future readers.