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

tmagoo

@tmagoo
About
Posts
14
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Inserting files into database table
    T tmagoo

    I have been reading various articles where bitmaps, excel files, pdf files, etc... are being inserting into a column of a database table. Out of curiosity, why are developers doing this and what are the benefits? :-D

    Database

  • Conversion problem Updating part of an ASP.NET page
    T tmagoo

    ;)Leppie, thanks for your help. You seem to know your stuff pretty well. I think I know what is needed to accomplish my task. I am currently trying to access the web service but, I keep getting "Access Denied". I am pulling my hair out trying to figure this one out. Once I fix this problem, I believe that I can refresh portions of my web page at least 1 every 5 seconds.:) Thanks, Tom

    ASP.NET

  • Conversion problem Updating part of an ASP.NET page
    T tmagoo

    OK, I will leave ASP.NET out ;). I was using Visual Studio.NET to build the aspx page. I was trying to find a way to update portions of the aspx page from the server-side without success. I would really like to know if this can be done and how!!! Since I couldn't find anything that would work on the server-side, I decided to try writing some JavaScript Code that would update a HTML control every second from a WebService. I was able to get this to work by passing a simple integer. Now I want to expand by passing an array of bytes or some type of array "I don't know if Web service behavior can accept a byte array". :~ As far as the IFRAME, I am not too sure what it will do for me in the sense of converting the 16 bytes to "int, float, float and float". :~ Where can I find such an example? Thanks for the reply, Tom

    ASP.NET

  • Conversion problem Updating part of an ASP.NET page
    T tmagoo

    I am having problems with dynamically updating part of a ASP.NET page without reloading the whole page. I am using JavaScript to call a Web Service Method every 5 seconds. The method returns a 16 byte array declared as byte[] within the Web Service. I want to convert the 16 bytes into 4 seperate variables represented as "int, float, float and float". Once converted, I can update HTML text boxes with the 4 variables. Does anyone know how to do this? Here is my code "just in case you wanted to see": <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="LearningDisplay.WebForm1" %> function InitTimer() { GetVAXData(); setInterval("GetVAXData()",1000); } function GetVAXData() { Service.useService("LearningService.asmx?WSDL","LearningService"); iReturnID = Service.LearningService.callService("GetLearningData"); } function ReturnedData() { //This is where I am having problems //I want to use something like txtInt.innerText = event.result.value; txtInt.innerText = event.result.value; } WebForm1

    ASP.NET

  • Question about global common areas
    T tmagoo

    :)Thanks for the answer. This is what I have been looking for. Your help is greatly appreciated.:) Tom

    C#

  • Question about global common areas
    T tmagoo

    X| I am looking at using something more time dedicated other than socket routines. I was hoping to see if anyone has implemented something close to the kernel32.lib routines "CreateFileMapping and MapViewOfFile". I have used "CreateFileMapping and MapViewOfFile" with Visual Basic 6.0 and Visual C++ 6.0 and it worked as I expected it to. Does C# have anything like these routines? Can C# use the kernel32.lib? X|

    C#

  • Question about global common areas
    T tmagoo

    :~ I have done very little with .Net Remoting. I am under the impression that .Net Remoting simply uses network sockets to pass objects between applications "behind the scenes". I am worried that this will not be fast enough for the updates that I need. I may be wrong about the above. Anymore ideas?:~ Tom

    C#

  • Question about global common areas
    T tmagoo

    Does anyone have any information, examples, or ideas about Global Common, Shared memory, File Mapping, etc...? I am trying to share a structure of information between 3 different applications. The shared area needs to be accessed every 100 milliseconds. Any kind of idea will be appreciated. Thanks, Tom

    C#

  • Using Interfaces with .NET Remoting
    T tmagoo

    After many hours of banging my head, I finally realized that the interface should of belonged to the class Entry point. Once I did this, I was able to do what I wanted. Here is a tidbit of the code I used. using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; using RemoteInterfacecls; //Code not proviced at this time using System.Runtime.Serialization; namespace RemotingInterfaceServer { public class dataStuff { public byte [] mystuff; } public class EntryPoint { dataStuff dS = new dataStuff(); public static void Main(string[] args) { //Here is the initializaton ds.mystuff = System.Text.Encoding.ASCII.GetBytes("This is a test"); TcpServerChannel channel = new TcpServerChannel(2566); ChannelServices.RegisterChannel(channel); RemotingConfiguration.RegisterWellKnownServiceType( typeof(RemoteExample), "RemoteExample", WellKnownObjectMode.SingleCall); System.Console.WriteLine("Hit Key to Exit"); System.Console.ReadLine(); } public class RemoteExample : MarshalByRefObject, IRemoteExample { public RemotingExample() { Console.WriteLine("Constructor Called "); } public IByteArray GetByteArray() { ByteArray byteArray; byteArray.bytesRead = dS.mystuff; return (IByteArray)byteArray; } } [Serializable] public class ByteArray : MarshalByRefObject, IByteArray { public byte [] bytesRead; } } } Tom McDaniel

    C#

  • Using Interfaces with .NET Remoting
    T tmagoo

    I have created a simple client/server remoting interface that basically allows the client to get a byte array from the server. I am wanting to develop something that will allow the main thread on the server to initialize a byte array and allow the client to access this byte array from the interface. Does anyone have experience doing such a thing? Below is an example of what I want to do; but, don't know how to make it work. Look for initialization and How do I do this within the code comments. using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; using RemoteInterfacecls; //Code not proviced at this time using System.Runtime.Serialization; namespace RemotingInterfaceServer { public class dataStuff { public byte [] mystuff; } public class EntryPoint { public static void Main(string[] args) { dataStuff dS = new dataStuff(); //Here is the initializaton ds.mystuff = System.Text.Encoding.ASCII.GetBytes("This is a test"); TcpServerChannel channel = new TcpServerChannel(2566); ChannelServices.RegisterChannel(channel); RemotingConfiguration.RegisterWellKnownServiceType( typeof(RemoteExample), "RemoteExample", WellKnownObjectMode.SingleCall); System.Console.WriteLine("Hit Key to Exit"); System.Console.ReadLine(); } } public class RemoteExample : MarshalByRefObject, IRemoteExample { public RemotingExample() { Console.WriteLine("Constructor Called "); } public IByteArray GetByteArray() { ByteArray byteArray; //This is the from the main initialization // How do I do this ??????????? byteArray.bytesRead = mystuff; return (IByteArray)byteArray; } } [Serializable] public class ByteArray : MarshalByRefObject, IByteArray { public byte [] bytesRead; } Tom McDaniel

    C#

  • Sockets/Objects/Serializable
    T tmagoo

    Thanks again James. This is what I expected to see out of the byte array. Yes, I would also be interested in knowing a "short and sweet" version of the ToByteArray. Before using this forum, I was trying to do the same thing with C# pointers; but, I could never get what I needed. Then I started looking for a "memcpy" function in C#. I am guessing that the Marshal Object sort of does the same thing as the C++ memcpy function. Thanks again, Tom McDaniel

    C#

  • Sockets/Objects/Serializable
    T tmagoo

    The GetObjectBytes does not return the bytes as expected. Consider the following code. using System; using System.IO; using System.Threading; using System.Text; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; namespace CBinFormatter { /// /// Summary description for Class1. /// class CBinFormatter { [Serializable()] public struct sValues { public int iFirst; public int iSecond; public int iThird; } /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { // // TODO: Add code to start application here // sValues sVal = new sValues(); sVal.iFirst = 100; sVal.iSecond = 300; sVal.iThird = 400; byte [] btVal = GetObjectBytes(sVal); Console.WriteLine("The size of the btVal is " + btVal.Length); } static byte[] GetObjectBytes(object o) { MemoryStream memstream = new MemoryStream(); IFormatter formatter = new BinaryFormatter(); formatter.Serialize(memstream, o); memstream.Close(); // Prevent further writing return memstream.GetBuffer(); } static object GetObjectFromBytes(byte [] bytes) { MemoryStream memstream = new MemoryStream(bytes); IFormatter formatter = new BinaryFormatter(); object o = formatter.Deserialize(memstream); memstream.Close(); return o; } } } The Binary Serializer will return a size which is greater than the three int variables from the structure. Plus, when looking at the byte values within the debugger, I can't find the 100, 300, 400. I would of expected that the bytes returned would of been the size of 12 bytes " 3 int values - 4 bytes each". Do you know what I am missing here? Tom McDaniel

    C#

  • Sockets/Objects/Serializable
    T tmagoo

    Paddy thanks for starting this discussion. I knew there was an easier way of doing what we wanted. It just takes time to learn and get help on the in's and out's of the language. Thank you James for your help. You've solved the problem that I am having. Thanks again, Tom McDaniel

    C#

  • Sockets/Objects/Serializable
    T tmagoo

    I am having sort of the same problems as you are. Instead I am trying to make class variables equal to the bytes returned from the socket. I sort of understand what James T. Johnson is giving you advise on; but, I don't know how to make a custom object in C#. Since I am using class variables instead of objects, I am leaving you this test code to show you how I convert the byte types to the variables in a class. This example requires the knowledge of byte masking and the use of Reflection. I am hoping to get some feedback plus maybe show you something new dealing with Reflection. using System; using System.Reflection; namespace ConvertTypes { /// /// Summary description for ConvertTypes. /// /// class ConvertClass { public int x; public int y; public bool z; public ConvertClass(int i, int j, bool k) { x = i; y = j; z = k; } // Set the converted value public void SetConvertClass(int i, string sName) { if(sName == "x") x = i; else y = i; } } class clsConvertTypes { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { ConvertClass mCls = new ConvertClass(0,0,true); //Declare 8 Bytes for 2 int's byte [] bTest = new Byte[8]; // get a Type Object representing ConvertClass Type t = typeof(ConvertClass); // get the fields from the Type object (ie int x, int y) FieldInfo [] fi = t.GetFields(); // Start at index 0 which represents the x field int iIndex = 0; //Build the x value as 500000 and the y value as 400000 bTest[0] = 0x00; // 0x0007A120 = 500000 bTest[1] = 0x07; bTest[2] = 0xA1; bTest[3] = 0x20; bTest[4] = 0x00; // 0x00061A80 = 400000 bTest[5] = 0x06; bTest[6] = 0x1A; bTest[7] = 0x80; foreach(FieldInfo FI in fi) { if(FI.FieldType == typeof(int)) { // Declare a temporary integer variable int iTemp; // Mask the byte array into a single integer iTemp = (int)((bTest[iIndex]<<24) | (bTest[iIndex+1] << 16) | (bTest[iIndex+2] << 8) | bTest[iIndex+3]); // increment the index by 4 bytes since it is a int iIndex = iIndex + 4; // Declare an object which will be used to pass // parameters to the SetConvertClass method object[] targs = new Object[2]; targs[0] = iTemp; //First argument targs[1] = FI.Name; //Second argument (x or y) /

    C#
  • Login

  • Don't have an account? Register

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