|
No thats what i dont want to but i very new in C#, so how can i do it more easy?
|
|
|
|
|
Create a complete html or javascript file and store it as a resource.
only two letters away from being an asset
|
|
|
|
|
Sorry i ask agian but how do i load it into the program?
|
|
|
|
|
|
Thanks !
|
|
|
|
|
Files or file segments can also be stored to memo/text fields and assembled on the fly. Generally you would not want to deploy individual JavaScript routines individually, so unless you are archiving them for research, I don't see what the point of separating them would be. What we need to know is what purpose you have. Your design should be driven by that purpose (which indicates available resources, limitations, etc.). The approach to storage and retrieval otherwise is practically unlimited. Given a purpose and working environment, you always want to store as much together as possible. You should not be writing a head tag, meta tags, and finally a head conclusion tag. Write them all together unless there is a purpose that is served by separating them. Even then, separation can be avoided. Build the whole head section for instance with an author field content in it by replacing an author field token in the whole head section. Write the whole result of such a process to a file, and it can be displayed as a page.
A principle of development is to minimize operations. It looks like you are multiplying operations unnecessarily here.
|
|
|
|
|
sorry if i missed to say it... but i doesn't use the html/javascripts in the program.
It just for archive them in the app
|
|
|
|
|
That's fine, but the reason that I stipulated "for research" is this...
If you have a page which is downloaded by a user agent, or if you have many pages which are downloaded by user agents... it would be a very inefficient thing to do to try to logically predetermine what JavaScript functions are required in the particular page, and serve those out with the page.
Why?
If you have 4 scripts, W, X, Y, and Z, and if page 1 uses W and Z, page 2 uses Y and Z... and so many further pages call any possible further combination of the other scripts, the proper way to develop your site is to write the scripts in a separate JavaScript file linked to your pages. This way your scripts only cross bandwidth once. Each additional page request merely checks if the JavaScript resouce file is still valid.
Doing this so also eliminates your logical and assembly processes.
Furthermore, with today's security concerns, it is an ever worse idea to use JavaScript or ActiveX any more... and I should warn you that if you use either, the chances are very great that anyone running proper security *can never view your material*.
Personally, I've run the gamut of JavaScript implementations over many years, and have reverted to using JavaScript for one thing only -- copying code snippets from text fields in online documentation. If you use FireFox intelligently, you'll notice that most users will have JavaScript disabled, and will make a decision whether the functionality or material of your site justifies allowing your site to act on their system. If *I* am that visitor, I will ask myself why you built the functionality with JavaScript... find you don't have a good enough reason for me to disable my security... and move on.
|
|
|
|
|
I'm trying to make a small console application to grab some Access databases off a network drive and store them in a SQL server database (for archiving/backup). The problem is, if any user has a database open in Access on their computer I get an IOException about how it can't access the file because another process is already using it. Thats fine, but all I want to do is read the bytes, not change anything. I can open explorer, navigate to the directory, and manually copy the .mdb file when its open, but my program won't open it?
I have tried it like this:
<br />
bu.File = File.ReadAllBytes(dr["path"].ToString());<br />
Where bu is an instance of my class that stores backup information, bu.File is a byte[], and dr is a DataRow containing connection information.
and more explicitly like this:
<br />
FileStream fs = new FileStream(dr["path"].ToString(), FileMode.Open, FileAccess.Read);<br />
BinaryReader br = new BinaryReader(fs);<br />
bu.File = br.ReadBytes(Convert.ToInt32(fs.Length));<br />
Any suggestions?
|
|
|
|
|
Would it be possible to copy the file to a temporary location and read it from there rather than the locked file?
only two letters away from being an asset
|
|
|
|
|
Thanks for the reply, but I just figured it out. There is another overload for FileStream to set the sharing property so my program isn't trying to do an exclusive open.
<br />
FileStream fs = new FileStream(dr["path"].ToString(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);<br />
<code>
|
|
|
|
|
Forgive me for a stupid question but how do you read from the SQL backup back into a Access DB?
God Bless,
Jason
Programmer: A biological machine designed to convert caffeine into code. Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
Store the entire .mdb file in an image column and read it out as byte[].
|
|
|
|
|
It's probably not a good idea to do it this way - you really should assert that absolutely nobody is modifying the mdb during your entire read operation. If you're busy copying bytes from the mdb while some guy is saving the mdb, the bytes you get will most likely end up being a corrupted mdb. Some of the bytes you read will be from the "unmodified" mdb, and the rest of the bytes will be from the "newly modified" mdb, and there's no telling which bytes are which.
It'd be best to attempt to open the file for Read access and allow only Read Sharing. If that succeeds, you're guaranteed that nobody can modify the mdb during your copying operation. If it fails, have your program back off, send out some manner of warning (an email or similar), and try again in a few minutes.
"I hope he can see this, because I'm doing it as hard as I can" - Ignignot
|
|
|
|
|
Wouldn't Access itself prevent the user from saving data while another process is reading it? I tried setting FileShare.Read, but I get the IOException.
|
|
|
|
|
eggsovereasy wrote: Wouldn't Access itself prevent the user from saving data while another process is reading it? I tried setting FileShare.Read, but I get the IOException.
Drop back to not specifying any FileShare stuff in the FileStream constructor - that should be the equivalent of FileShare.None. I'm not sure why I suggested FileShare.Read: it won't do you any good, and there may be some goofiness in doing that over a network share. When Access opens the mdb file, I'm willing to bet it opens it with the equivalent of FileShare.None as well, because Access (well, the MS Jet DB engine underneath it all) was never designed to be a multi-user DB system, to my knowledge.
BTW: Typically, you can tell if someone else has the FileName.mdb open by looking for a file named FileName.ldb in the same directory. Access creates the FileName.ldb while it has the FileName.mdb open, and removes it when it closes FileName.mdb. It's not a 100% guarantee, however, because if Access doesn't exit cleanly the FileName.ldb sticks around until someone opens up the FileName.mdb again and exits Access cleanly.
"I hope he can see this, because I'm doing it as hard as I can" - Ignignot
|
|
|
|
|
Hi all
I hv used a repeater to display panels on my form. I am using CollapsiblePanelExtender(ASP.NET AJAX 1.0) to expand or collapse the panels generated by the repeater.
My problem is in one of the panels i hv used a linkbutton.on click event of linkbutton i want to access the text of linkbutton, but whn i click the linkbutton client-side coding of collapsible panel gets called n i can't access server side coding of repeater_ItemCommand event.
Plz can anyone help me out...
|
|
|
|
|
I'm looking for information on the right way to draw to two different windows using a single DirectX device. The biggest key is
device.Present(overrideWindow)
but SwapBuffers also seem to be involved, and perhaps the Viewport settings may make a difference.
I'd appreciate pointers to a good resource, comments, or suggestions. Working source code, of course, is even better.
- - - -
further detail:
I am currently drawing one window with 2 viewports and Present() it. Then I draw the other window with a single viewport and Present(win2) it. The second window's viewport size gets misinterpreted, somehow, and it doesn't fill the second window even though it is explicitly set to use the window's full width and height. The first window's display is (not suprisingly) duplicated in the region not filled by the viewport on the second window. Drawing withing the viewport on the second window is correct. I do not have a separate SwapBuffer for the second window, since it doesn't seem necessary, and it is unclear to me what benefit it would provide.
- - - -
Mark
|
|
|
|
|
Hi,
I have a basic command line application and I want to store a username and password it can use to access a web service. Is there a simple way of doing this using System.Configuration ?
Also I'd like to store my password in an encrypted format. Is there some way of doing this?
Thanks
|
|
|
|
|
|
I often have trouble with class names because I am very pedantic in nature. Two days before deadline I should not be worrying about this at all, but I am. I often get uncertain naming classes that perform only one task, such as one I have now that submits a document to a web service. I don’t favour the clumsy sounding “DocumentSubmitter”, and “DocumentSubmit” sounds much better, but now my class name is no longer a noun. Are there any guidelines on this?
|
|
|
|
|
|
DocumentSumissionHandler?
Isn't there a Document class? Couldn't the document submit itself, removing the need for a special class for it?
---
single minded; short sighted; long gone;
|
|
|
|
|
No, I am of the design school that doesn't permit the document knowledge of the submission process[1]. This allows diverse submission channels without impacting the document. In this I could use your name or DocumentSubmissionEngine, to stick to the noun guideline, but these seem overly verbose, and the Handler suffix may incorrectly hint at a callback method.
[1] On something of a tangent, my favourite example of this debunks the popular OO example where a Customer knows how to Save itself. A real world customer is not aware of how the bank stores his details, nor of how the library stores his details. He is only aware of his details and how to derive certain facts from them.
|
|
|
|
|
Hi All
I have an application which requires me to use the PC com port to communicate with a PIC (16f877) micro-controller. I am planning to use the PC to fill a serial EEPROM with data which constitutes a digitized waveform of 100 samples. In other words the program on the PC needs to take in a text file which holds the values for 100 samples (in hex string/decimal string?) and transmit them on command to the PIC. The pic then takes the data and fills each address in the attached serial EEPROM with a sample value. So for instance, each sample can be between 0x00 and 0xFF (0 to 255) and I need to transmit it as a single byte so the PIC can deal with it.
In the past I have used outportb quite successfully. However, I am now using C# in Visual Studio 2005 and I was wondering if anyone has any suggestions how I can do the same/equivalent? I am having some trouble converting from a string to a byte... What I mean by this is that if the string is 255, I can only convert to a byte array which gives me a byte for 2, then 5 then 5..... What I really want is the byte equivalent to 255 (ie 1111 1111)... I hope this makes sense...
Any help would be gratefully appreciated.
Jamie
|
|
|
|