|
Richard Noggin posted:I don't believe there's an option to do that in the GD control panel. It would help if you told us what your co-worker is trying to do. If he's trying to read what files are on the webserver, that sounds horribly insecure and I'm not in the least surprised that it's not allowed.
|
# ? Apr 9, 2008 16:56 |
|
|
# ? Jun 10, 2024 19:13 |
|
uXs posted:It would help if you told us what your co-worker is trying to do. If he's trying to read what files are on the webserver, that sounds horribly insecure and I'm not in the least surprised that it's not allowed. This will be used to display random images from a directory on a web site. The directory is a subdirectory of the site (e.g. /images).
|
# ? Apr 9, 2008 17:05 |
|
This is killing me, all I'm trying to do is create an appdomain so I can unload assembly files. I've looked just about everywhere for setting this up and I've looked over the Fusion log. This dll is simply an example, the dll I'm using is a .NET assembly and I have loaded it using only the assembly class before (but using the LoadFile method). code:
Of course if I have the dll file within the bin directory of my project it does load the assembly, so my assumption is that I'm misunderstanding how setting these directory paths work. This is frustrating Fusion log, again, replaced paths/dll names: *** Assembly Binder Log Entry (4/9/2008 @ 4:31:51 PM) *** The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified. Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll Running under executable C:\blah\testapp\testapp\bin\testapp.exe --- A detailed error log follows. === Pre-bind state information === LOG: DisplayName = twain_32 (Partial) LOG: Appbase = C:\blah\testapp\testapp\bin\ LOG: Initial PrivatePath = C:\Windows LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = NULL Calling assembly : (Unknown). === LOG: Processing DEVPATH. LOG: DEVPATH is not set. Falling through to regular bind. LOG: Attempting application configuration file download. LOG: Download of application configuration file was attempted from file:///C:/blah/testapp/testapp/bin/testapp.exe.config. LOG: Application configuration file does not exist. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: twain_32 WRN: Not probing location file:///C:/Windows/twain_32.DLL, because the location falls outside of the appbase. WRN: Not probing location file:///C:/Windows/twain_32/twain_32.DLL, because the location falls outside of the appbase. WRN: Not probing location file:///C:/Windows/twain_32.EXE, because the location falls outside of the appbase. WRN: Not probing location file:///C:/Windows/twain_32/twain_32.EXE, because the location falls outside of the appbase. LOG: Attempting download of new URL file:///C:/blah/testapp/testapp/bin/twain_32.DLL. LOG: Attempting download of new URL file:///C:/blah/testapp/testapp/bin/twain_32/twain_32.DLL. LOG: Attempting download of new URL file:///C:/blah/testapp/testapp/bin/twain_32.EXE. LOG: Attempting download of new URL file:///C:/blah/testapp/testapp/bin/twain_32/twain_32.EXE. LOG: All probing URLs attempted and failed. If I hardcode the two directories passed in as "C:" and "C:\Windows" I get the error about the serialization - " Insufficient state to deserialize the object. More information is needed." Here's the log: *** Assembly Binder Log Entry (4/9/2008 @ 4:55:37 PM) *** The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified. Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll Running under executable C:\blah\testapp\testapp\bin\testapp.exe --- A detailed error log follows. === Pre-bind state information === LOG: DisplayName = twain_32, Version=3.7.0.7, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = C:\blah\testapp\testapp\bin\ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = NULL Calling assembly : (Unknown). === LOG: Processing DEVPATH. LOG: DEVPATH is not set. Falling through to regular bind. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: twain_32, Version=3.7.0.7, Culture=neutral, PublicKeyToken=null LOG: Attempting download of new URL file:///C:/blah/testapp/testapp/bin/MEMY001.DLL. LOG: Attempting download of new URL file:///C:/blah/testapp/testapp/bin/MEMY001/MEMY001.DLL. LOG: Attempting download of new URL file:///C:/blah/testapp/testapp/bin/MEMY001.EXE. LOG: Attempting download of new URL file:///C:/blah/testapp/testapp/bin/MEMY001/MEMY001.EXE. LOG: All probing URLs attempted and failed. NotAok fucked around with this message at 21:57 on Apr 9, 2008 |
# ? Apr 9, 2008 21:25 |
|
AppDomain.Load has a bunch of semantics that are probably defeating what you're trying to do. For example, the code that you posted would actually load the assembly into the target AppDomain and the calling AppDomain, which would nix the benefit of unloading the assembly later. See the below-linked article for details. Aside from that rather serious problem that you'll have to address (hint hint ), try the AppDomain.Load(AssemblyName) overload, setting the AssemblyName.CodeBase property might be what you need.
|
# ? Apr 9, 2008 21:57 |
|
I was wondering if anyone could shed light on this. I've got a small application which monitors one folder and mirrors it in another using filesystemwatcher. I wanted it to update a text box with actions so that I could monitor what was going on, then maybe save this to a file on exit or something, I dunno yet but I thought it'd be nice to have. Anyway, I had it functioning as a flat file thing, files could be created but they were just copied with no directory structure to the destination folder. When it did this I had the text box spitting out information no problem. I then reworked the code so that it would start mirroring the folder structure too, and all of a sudden I get cross thread errors. I'm assuming I've missed something completely basic here, but who knows. Here's the relevant code: Delegate methods: code:
code:
These methods are called from the relevant file system methods, such as this one: code:
The file copying itself works as intended, it's just these silly cross calls causing me the problem.
|
# ? Apr 10, 2008 00:52 |
|
MORE CURLY FRIES posted:
This is only invoking that property getter, unless I'm misreading it. The actual setting of txtLog.Text is what needs to be Invoke()d, since that's what's actually modifying the UI. edit: So what you want is something along the lines of: code:
Actually, all your code is doing is invoking a return of the string you pass in onto the UI thread, but the problem still stands. The setting of txtLog.Text is what needs to be Invoke()d. chglcu fucked around with this message at 03:57 on Apr 10, 2008 |
# ? Apr 10, 2008 03:47 |
|
Richard Noggin posted:This will be used to display random images from a directory on a web site. The directory is a subdirectory of the site (e.g. /images). Is there any way you can keep a list of files, so you don't have to read the directory content ? It might be easier to do that than to gently caress around with permission problems. Those are hard enough when you have full control over the server, it will be even harder when you don't.
|
# ? Apr 10, 2008 08:23 |
|
uXs posted:Is there any way you can keep a list of files, so you don't have to read the directory content ? It might be easier to do that than to gently caress around with permission problems. Those are hard enough when you have full control over the server, it will be even harder when you don't. If I can't even parse a directory, how do I read a list of files without putting it in the code-behind? Is this normal - not being able to have file-level access in your own virtual directory structure?
|
# ? Apr 10, 2008 11:56 |
|
Richard Noggin posted:If I can't even parse a directory, how do I read a list of files without putting it in the code-behind? Is this normal - not being able to have file-level access in your own virtual directory structure? By default, medium trust in ASP.NET 2.0 should allow you access to the files within your application's virtual directory hierarchy. If you're getting FileIOPermission exceptions, it means one of two things: they either tightened the security (which if I'm not mistaken would break ASP.NET entirely), or you're trying to access the filesystem wrong; either the wrong directory, or you're not qualifying your path names right. Use something like Path.Combine(Request.PhysicalApplicationPath, "Images") to get the full path to your images directory, that you can then read through.
|
# ? Apr 10, 2008 14:53 |
|
csammis posted:AppDomain.Load has a bunch of semantics that are probably defeating what you're trying to do. For example, the code that you posted would actually load the assembly into the target AppDomain and the calling AppDomain, which would nix the benefit of unloading the assembly later. See the below-linked article for details. Ok thanks for the tip on the reference. I looked into the assemblyname class and I think it would work much better but I'm running into the same problem as before though, " Insufficient state to deserialize the object. More information is needed." code:
LOG: Post-policy reference: twain_32, Version=3.7.0.7, Culture=neutral, PublicKeyToken=null edit: Also, if I simply use blah.Load instead of TestDomain.Load, it actually does load the assembly. It must have to do with the appdomain. NotAok fucked around with this message at 18:26 on Apr 10, 2008 |
# ? Apr 10, 2008 18:00 |
|
Is it impossible to a store a reference in C#? Something to the general effect of: code:
I've worked in C and C++ before. So I'm comfortable with "unsafe" code. But my c# complains when I declare a pointer to or attempt to get the address of a "managed type". riggsninja fucked around with this message at 21:28 on Apr 10, 2008 |
# ? Apr 10, 2008 21:17 |
|
riggsninja posted:I've worked in C and C++ before. So I'm comfortable with "unsafe" code. But my c# complains when I declare a pointer to or attempt to get the address of a "managed type". C# struct semantics are different from both C and C++. This: code:
code:
edit: I think I see the root of your problem: ref isn't a way to get a pointer.
|
# ? Apr 10, 2008 21:43 |
|
I had no idea Point was a struct, Im not used to structs having constructors. I fully realize that code was no good. I was just trying to convey the logic of what I was getting at. Basically what I'm asking is: How do I translate this to C#: code:
|
# ? Apr 10, 2008 23:04 |
|
riggsninja posted:How do I translate this to C#: You would just do code:
|
# ? Apr 10, 2008 23:38 |
|
object o = new object(); is not equivalent to what I want. Your statement would be equivalent to something like Object* o = (Object*)malloc(sizeof(Object)); (For C, in C++ it would pretty much look the same as the C# version). I want this translated: code:
So that I could something like this: code:
|
# ? Apr 10, 2008 23:55 |
|
Is your type a class or a struct? Edit: I guess it's a struct, going by your example. If you want to keep the type as a value type, then yes, it's possible, but it would require either unsafe code or boxing (which is clunky and generally undesirable). Technically you shouldn't be mixing value types with reference type semantics like that, at least in C#. If you want reference type semantics, then just make the type a reference type in the first place. This may sound like a lame solution if you're coming straight from C/C++ but honestly in the two years I've been using C# it hasn't once even seemed unnatural. In fact, before I learned C++ I couldn't even understand why you'd want to use pointers :p Btw, how did you do it in Java if it's not working in C#? Inquisitus fucked around with this message at 00:14 on Apr 11, 2008 |
# ? Apr 11, 2008 00:04 |
|
The reason your idea above doesn't work is because, as csammis pointed out, Point is a struct. If it was a class, that would have worked. You would need to remove the "ref" as well.
|
# ? Apr 11, 2008 00:07 |
|
Try this:code:
|
# ? Apr 11, 2008 00:11 |
|
my stepdads beer posted:Try this: I think he wants AnObject to be a value type and yet be able to obtain a reference to an instance of it.
|
# ? Apr 11, 2008 00:16 |
|
Inquisitus posted:I think he wants AnObject to be a value type and yet be able to obtain a reference to an instance of it. Could he wrap it in an object? Or is that bad?
|
# ? Apr 11, 2008 00:20 |
|
Inquisitus posted:Btw, how did you do it in Java if it's not working in C#? code:
As far as classes and structs, I dont care which, since they seem to be basically the same thing in C#. Except that structs break lists for some reason.
|
# ? Apr 11, 2008 00:28 |
|
my stepdads beer posted:Could he wrap it in an object? Or is that bad? He could but it's a lame way of doing what would be much better achieved by rewriting it so that the semantics riggsninja wants aren't even necessary (which is possible and simpler to do 9 times out of 10). riggsninja posted:
I assume you're declaring MyObject as a struct? Change it to a class and all should work as expected. riggsninja posted:As far as classes and structs, I dont care which, since they seem to be basically the same thing in C#. Except that structs break lists for some reason. This is true in C++; the only difference is member accessibility. In C#, however, there's a rather crucial difference (and some other less significant ones too): structs are allocated on the stack, whereas classes are allocated on the managed heap, and have implicit reference-type semantics. For example, this in C#: code:
code:
code:
http://www.jaggersoft.com/pubs/StructsVsClasses.htm http://www.c-sharpcorner.com/UploadFile/rajeshvs/StructuresInCS11112005234341PM/StructuresInCS.aspx http://msdn2.microsoft.com/en-us/library/ms173109(VS.80).aspx Inquisitus fucked around with this message at 01:07 on Apr 11, 2008 |
# ? Apr 11, 2008 00:51 |
|
Okay, case closed, I suppose. Sorry about that. I had been using structs instead of classes, because of earlier efforts to get a pointer and forgot to switch back.. It seems using classes allows me to do the Java method of doing things. But, really, I swear to god I tried that way and didnt get the values I expected. So thanks to everybody. It's last week before finals and everything's due, so I'm a little bit sleep deprived. The problem is, it's not always clear if C# is using references or pointers. the operator = apperently handles references in for classes but not structs for example. It makes, sense, but the reference bit is a little unclear. Anyways, once again, thanks, and sorry for the stupid error.
|
# ? Apr 11, 2008 01:02 |
|
riggsninja posted:Anyways, once again, thanks, and sorry for the stupid error. No problems And yeah I agree that it's a little unclear how C# handles references with respect to classes and structs. C/C++ is certainly more explicit about it.
|
# ? Apr 11, 2008 01:06 |
|
I can't seem to find an answer for this anywhere.. I'm developing a touchscreen application using C#. I need controls that are much bigger than what is offered in .NET. For example, a vertical scrollbar. I am able to adjust the width of this bar no problem. However, the up and down buttons remain a fixed 16 pixels tall (at least on windows xp, it's probably different per OS or skin). I can't seem to find 1) where this button height is stored 2) how to change this button height For example, I have included a picture... The left picture shows what happens when you resize a VScrollBar. The width is great, I am ok with this. However, I want the scrollbar's up and down arrow buttons to be the same height as they are wide. The right picture shows this (which I did via MS Paint). Is this possible to do via .NET? I really want to avoid writing my own control just for this. It's almost impossible to touch the scrollbar when the up and down arrows are only 16 pixels tall. Also, I am not sure if there is a way to change the minimum thumb bar size (which needs to be bigger obviously, because of the same issue). I previously wrote all my touchscreen software in C++ using my OpenGL control library but I want to avoid using this because the development time is too costly for reinventing the wheel (which is what I did). joe87653 fucked around with this message at 17:03 on Oct 1, 2011 |
# ? Apr 11, 2008 06:11 |
|
Are you using Windows Forms or WPF? If WPF, try this tutorial on custom controls. You might be able to modify the RepeatButtons without needing an entire custom control, but I'm not sure.
|
# ? Apr 11, 2008 07:35 |
|
SLOSifl posted:With the Windows Forms calendar control, you would set the MinDate property to DateTime.Today. I can't tell if you're talking about Win Forms, WPF or ASP.NET though, so please clarify. Just general ASP.NET
|
# ? Apr 11, 2008 09:49 |
|
my stepdads beer posted:Are you using Windows Forms or WPF? If WPF, try this tutorial on custom controls. Judging from the picture he's probably using Winforms (it's straight out of the designer), but I was going to suggest WPF. It's made for this sort of thing.
|
# ? Apr 11, 2008 13:37 |
|
Eararaldor posted:Just general ASP.NET Take the date the select, get the current date and then if the date they've selected is less than the current date it's in the past and you can reject it. Edit: Also I was wondering if there was a simple way in C# winforms to detect when a storage device had been mounted. This is for the sync thing I'm messing with, and I'd like to be able to recognise when something's mounted or removed and then I can take an appropriate action. Mainly when something's mounted I can pop up another form and populate it with a list of drives and devices, and then allow the user to browse it to select a location, and when it's removed I want to check whether the program's listening to it and if it is, stop the syncing. I've been looking around and a lot of tutorials seem to suggest having to mess around with hooking into the registry or something, but I can't beieve there isn't a basic argument or function I can use, seeing as this is a MS/Windows framework to start with. MORE CURLY FRIES fucked around with this message at 14:23 on Apr 11, 2008 |
# ? Apr 11, 2008 13:50 |
|
MORE CURLY FRIES, you have to override the WndProc method in a WinForm. When a device is added or removed, a message is sent to all windows notifying them of the change. I did this before, but I can't seem to find the code & I can't remember off the top of my head. edit: found this, I think it's what you're looking for Potassium Problems fucked around with this message at 16:42 on Apr 11, 2008 |
# ? Apr 11, 2008 16:40 |
|
Lone_Strider posted:MORE CURLY FRIES, you have to override the WndProc method in a WinForm. When a device is added or removed, a message is sent to all windows notifying them of the change. I did this before, but I can't seem to find the code & I can't remember off the top of my head. That's interesting, I was also reading up on the Drive Info class, I could put a thread in my main form and refresh devices every so often too I guess?
|
# ? Apr 11, 2008 18:40 |
|
MORE CURLY FRIES posted:That's interesting, I was also reading up on the Drive Info class, I could put a thread in my main form and refresh devices every so often too I guess? You could, but polling for information when there's an event-driven notification available should only be done if you absolutely positively with good reason can't use the notification
|
# ? Apr 11, 2008 18:50 |
|
csammis posted:You could, but polling for information when there's an event-driven notification available should only be done if you absolutely positively with good reason can't use the notification True, I'll look into overriding the method, and I can use the drive info thing on a button prompt or something.
|
# ? Apr 11, 2008 19:01 |
|
biznatchio posted:By default, medium trust in ASP.NET 2.0 should allow you access to the files within your application's virtual directory hierarchy. If you're getting FileIOPermission exceptions, it means one of two things: they either tightened the security (which if I'm not mistaken would break ASP.NET entirely), or you're trying to access the filesystem wrong; either the wrong directory, or you're not qualifying your path names right. This was it exactly. Thanks!
|
# ? Apr 11, 2008 19:28 |
|
Is there a way to specify multiple exception types in a catch block? I'd like to merge two blocks that are similar to code:
|
# ? Apr 11, 2008 21:55 |
|
Does anyone have experience using a tool like Dotfuscator? How well do tools like this stop people from stealing your source code? Are the claims of reduced size and increased speed true? It seems like there's a possibility of it screwing up the code in some way. Most of the 'secrets' in the code are hidden away in C++ DLLs but my manager asked me to look into obfuscation technology. I personally don't think it's important to our app but I thought I'd see if anyone here has any experience with the tools. My guess is that if someone in China wants to rip off your source they'll figure out some way to do it no matter what the barrier.
|
# ? Apr 11, 2008 23:13 |
|
fankey posted:Does anyone have experience using a tool like Dotfuscator? How well do tools like this stop people from stealing your source code? Are the claims of reduced size and increased speed true? It seems like there's a possibility of it screwing up the code in some way. About a year and a half ago a gentleman on this very forum challenged me to break the key system on his Dotfuscated software. It took about thirty minutes and I'd made a keygen. Granted this was the Community edition, but with tools like Reflector it's almost painfully easy to do given enough time and motivation. If the "secrets" have to be on the client's machine, putting them in non-managed DLLs is about as good as you can ask for, because you're right, some teenager in eastern Europe will make you his bitch in less than a week if he really wants your software. If your manager wants proof, use the Dotfuscator tool to obfuscate a copy of your application, then load the un-crapped-up copy and the Dotfuscated copy side-by-side in Reflector, set it to show the disassembly. About all it'll do is name-mangling, but it should get the point across: programs follow a logical flow, and obfuscation doesn't change that, it only makes the path less followable by a human. Reduced size and speed? Maybe, but I couldn't prove it one way or another...it'll reduce the byte size of the named symbol table at least by giving them one-letter names
|
# ? Apr 11, 2008 23:25 |
|
I've recently had to write my own implementation of ASCII85, and I want to get feedback because for large files, it runs pretty slowly. For example, it takes about 1 second to encode a 7 MB file, and 2.5 seconds to decode it back to its native format. Anyone have any suggestions? http://pastebin.com/m5c907653
|
# ? Apr 12, 2008 02:19 |
|
fankey posted:Does anyone have experience using a tool like Dotfuscator? How well do tools like this stop people from stealing your source code? Are the claims of reduced size and increased speed true? It seems like there's a possibility of it screwing up the code in some way. code:
However, a dedicated reverser can still take the time to work it out - all Dotfuscator does is make the process much more lengthy, tedious, and loving annoying (speaking from experience myself!). gibbed fucked around with this message at 03:55 on Apr 12, 2008 |
# ? Apr 12, 2008 03:52 |
|
|
# ? Jun 10, 2024 19:13 |
|
gibbed posted:csammis is wrong about that it only does name mangling though Which is why I qualified my example by saying it was the Community edition
|
# ? Apr 12, 2008 04:01 |