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
A

AikinX

@AikinX
About
Posts
20
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Stateless server definition
    A AikinX

    I re-read the definition and found that this one is a definition for stateless, not for stateless server. I didn't saw that before. It is a very useful one. Thanks. But I don't think it is fully related to a "stateless server", because the one doesn't have it's own "persistent state". A server is a container for applications that are ran into the one. So It can only provide underlying applications with a more usable request to clients. Yes, it can store some information, but not for itself -- for it's applications. So, I think is better to use it's own definition: a stateless server[^] A stateless server is a server that treats each request as an independent transaction that is unrelated to any previous request. Although this definition is very useful to understand next ones: a stateless application, a stateless session, ... Thanks again, led mike.

    Design and Architecture question database com sysadmin discussion

  • Stateless server definition
    A AikinX

    Yes, I saw this definition, but it told me nothing else :)

    Design and Architecture question database com sysadmin discussion

  • Stateless server definition
    A AikinX

    Stop, I've just realized. The Google seacher is not a server. It is an application running into the server No, more questions, thanks.

    Design and Architecture question database com sysadmin discussion

  • Stateless server definition
    A AikinX

    Hi, Everyone. Can someone describe me what is the "stateless server"? My thoughts (I still want to get an explanation about the term above): I asked google[^]. The best definition I found is "A stateless server considers each page request independently". So, I think, the main accent is that the stateless server doesn't do any differences between users' requests. It thinks like every request is a new, from a new user. Let's imagine a google search server that only search functionality, a very-very simple search functionality: just go to an "indexed sites DB" for results. Is that one a stateless? I think -- yes. Because it doesn't bother itself with questions: "Is that user a new, what he did last time,...". It just parses the request, goes to the DB and answers. It uses no information about last requests, so "considers each page request independently". Am I right? Thanks, Aikin

    Design and Architecture question database com sysadmin discussion

  • Packing a class into a byte array - would [Serializable] do the trick?
    A AikinX

    I don't like pointers too. But it is the only way to do the serialization in general for any class. So, I think you have to choose built-in serialization or do it manually. Best Regards

    C# data-structures tutorial question

  • Prompt user to close outlook during install/uninstall
    A AikinX

    You can get all processes by some name: Process [] localByName = Process.GetProcessesByName("notepad"); But it is not a strong solution. User can modify name of a file executes an outlook so you didn't get it :(

    C# question csharp workspace

  • Point in Polygon?
    A AikinX

    It is easy to get the answer for a Region: Region r = new Region(new Rectangle(0, 0, 100, 100)); Point p = new Point(99,10); bool b = r.IsVisible(p); If you region is not simple one you have to use GraphicsPath to build the region: GraphicsPath path = new GraphicsPath(); path.AddRectangle(new Rectangle(0, 4, 2, 5)); path.AddEllipse (new Rectangle(4, 2, 7, 10)); //...... Region region = new Region(path); path.Dispose();

    C# csharp com graphics algorithms question

  • NmericUpDown - set the Value outside the range. HELP!!!
    A AikinX

    julgri wrote:

    Is there any way to do that?

    You can inherit this class to realize this feature for derived class.

    julgri wrote:

    I also need the Min and Max to be set, so the user knows the bounds.

    How a user can understand the Min and Max when he CAN input more or less?

    C# question help

  • Packing a class into a byte array - would [Serializable] do the trick?
    A AikinX

    I've done the copying for value object (structure). One thing I can't make is to get a pointer (IntPtr) from reference object (class). public struct myStuct { public byte myByte1; public byte myByte2; public ushort myUshort1; public ushort myUshort2; private const int MY_SIZE = 6; public static byte[] ToByteArray(myStuct source) { // Allocating an unmanagement memory for marshaling IntPtr pointer = System.Runtime.InteropServices.Marshal.AllocHGlobal(MY_SIZE); // Copying instance to allocated memory System.Runtime.InteropServices.Marshal.StructureToPtr(source, pointer, false); byte[] result = new byte[MY_SIZE]; // Coping filled memory to byte array System.Runtime.InteropServices.Marshal.Copy(pointer, result, 0, MY_SIZE); return result; } public static myStuct FromByteArray(byte[] source) { if (source == null) throw new ArgumentNullException("Source array can not be null"); if (source.Length != MY_SIZE) throw new ArgumentException("Source array's size has to be " + MY_SIZE + " bytes"); // Allocating an unmanagement memory for marshaling IntPtr pointer = System.Runtime.InteropServices.Marshal.AllocHGlobal(MY_SIZE); // Coping byte array to allocated memory System.Runtime.InteropServices.Marshal.Copy(source, 0, pointer, MY_SIZE); // Creating instance from unmanagment memory myStuct result = (myStuct)System.Runtime.InteropServices.Marshal.PtrToStructure(pointer, typeof(myStuct)); return result; } }

    C# data-structures tutorial question

  • Packing a class into a byte array - would [Serializable] do the trick?
    A AikinX

    Dewald, last night I got an idea: in unmanaged C++ we just need to look at the object as byte array: // Some & and * have to be added to next code to say we are working with references MyClass myCl = new MyClass(); byte[] array = meCl; // this operation is allowed fo references // coping this array to new one or sending it as is through TCP socet But in .Net we haven't references (that is very good, in my opinion), but we have some classes that allow to work with objects by references way. One of them is System.Runtime.InteropServices.Marshal I have never worked with, just herad about it. I have being looking through this and find some pairs of static methods wich can help you (I guess): To get IntPTR from your object: public static extern void StructureToPtr(object structure, IntPtr ptr, bool fDeleteOld); public static object PtrToStructure(IntPtr ptr, Type structureType) To copy to byte array: public static void Copy(IntPtr source, byte[] destination, int startIndex, int length); public static void Copy(byte[] source, int startIndex, IntPtr destination, int length) Or public static extern byte ReadByte(object ptr, int ofs); public static extern void WriteByte(IntPtr ptr, int ofs, byte val); Regards. P.S. IntPtr (intPointer) is Net analog of C++ pointers -- modified at 2:48 Saturday 9th June, 2007

    C# data-structures tutorial question

  • Packing a class into a byte array - would [Serializable] do the trick?
    A AikinX

    Sorry, I have no ideas how to help you this case. If you message is more than 6 byte the volume of valuable information will be more. Also you may try to zip it by DeflateStream....

    C# data-structures tutorial question

  • Packing a class into a byte array - would [Serializable] do the trick?
    A AikinX

    Dewald wrote:

    Aha, that makes sense. So does that mean that [Serializable] would not be the proper route then?

    Yes, if the array size is not critical. If critical you have to realize you own convertion like: public class myClass { public byte myByte1; public byte myByte2; public ushort myUshort1; public ushort myUshort2; public myClass() { } public static byte[] ToByteArray(myClass value) { byte[] result = new byte[6]; result[0] = value.myByte1; result[1] = value.myByte2; unchecked { result[2] = (byte)(value.myUshort1 / 256); result[3] = (byte)(value.myUshort1 - result[2] * 256); result[4] = (byte)(value.myUshort2 / 256); result[5] = (byte)(value.myUshort2 - result[4] * 256); } return result; } public static myClass FromByteArray(byte[] array) { myClass result = new myClass(); result.myByte1 = array[0]; result.myByte2 = array[1]; result.myUshort1 = (ushort)(array[2] * 256 + array[3]); result.myUshort2 = (ushort)(array[4] * 256 + array[5]); return result; } } P.S. usort is 16-bit type so we need to store it into two bytes.

    C# data-structures tutorial question

  • Packing a class into a byte array - would [Serializable] do the trick?
    A AikinX

    Here are many additional information is added with serialization like assembly name, version, class name, structure, ........ All this information is necessary to deserialize this object

    C# data-structures tutorial question

  • How to get checkbox cell's value of datagrid(WinForm) at runtime ?
    A AikinX

    int rowNumber = 3; int cellNumber = 2; bool b = (bool)dataGridView1.Rows[rowNumber].Cells[cellNumber].Value; But one tricky thing is here: if a value you are getting was not set (nobody checks or unchecks this checkbox) the value of it is null. We need handle this case. int rowNumber = 3; int cellNumber = 2; bool b = false; if (dataGridView1.Rows[rowNumber].Cells[cellNumber].Value != null) { b = (bool)dataGridView1.Rows[rowNumber].Cells[cellNumber].Value; }

    C# help tutorial question

  • Passing Objects to threads..
    A AikinX

    If threads need different parameters we can name each thread (or group of) and use static hash table (dictionary) to store the parameters. P.S. I think it is good way to solve this. But I have never worked with FW 1.1. May be it has a different recommended solution

    C# question csharp

  • Database Connectivity Error....
    A AikinX

    sajan ss wrote:

    "Failed to convert parameter value from a String to a Int32."

    sajan ss, This error says that you mistakenly provide String instead of int to stored procedure. Could you give us more code for analyze. I want to get the listing where you are filling the stored procedure parameters and signature of calling stored procedure.

    C# csharp database help

  • query: Oledb database and a BindingList
    A AikinX

    >> And as you say, i need to limit the data getting. Do you want to get a code with splitting by 1000 (for example) Ids? >> So restricting the logic of data getting. I meant "restructuring", sorry. So change the logic of the app. To group some ID into groups... I need to see you task to give you more ideas. >> How do i get the BindingList TableId into a table? >>And after I have a dataset with the two tables... I gues i can figure that out. No, you will have one table with full data in it. But you will display only necessary information. To do that you have to bind you table to DataGridView (for example) through BindingSource: BindingSource bs = new BindingSource(someDataSet, "SomeMember"); someDataGridView.DataSource = bs; // then in an other place you can filter: Filter condition, like: bs.Filter = "SomeColumn = 'id1' OR SomeColumn = 'id2' OR ..... ";

    C# database help question

  • query: Oledb database and a BindingList
    A AikinX

    sharp source, the problem is: you do to many connections to DB. I can propose two different solutions: 1) We can include all of this in one SQL: 'OR' version: string queryCondition = ""; foreach (string id in TableId) { queryCondition += tableRecordIDColumn + " = '" + id + "' OR "; } // We need to cat ' OR ' from the end of the string (4 letters) if (queryCondition != "") queryCondition = queryCondition.Remove(queryCondition.Length - 4); string query = "SELECT * FROM " + tableName + " WHERE (" + queryCondition + "') ORDER BY " + tableRecordIDColumn; 'In' version: string queryCondition = ""; foreach (string id in TableId) { queryCondition += "'" + id + "', "; } // We need to cat ', ' from the end of the string (2 letters) if (queryCondition != "") queryCondition = queryCondition.Remove(queryCondition.Length - 2); queryCondition = tableRecordIDColumn + " in (" + queryCondition + ")"; string query = "SELECT * FROM " + tableName + " WHERE (" + queryCondition + "') ORDER BY " + tableRecordIDColumn; Remark: You can get an exception like "the query is too long" (because of 2000 :omg: entries). You can split them to 100th packs, for example 2) Restricting the logic of data getting (I think it is better) I think you can find an way to get more simple selecting condition >>Would there be any way to create a dataset with two tables on wich i could excecute a select query wich an inner join on the record id's?? You can. You can load all data to data. Then you just need to filter the data by using BindingSource class. But this solution is valid when you have to filter data many times per minute. -- modified at 9:13 Thursday 7th June, 2007

    C# database help question

  • create dynamic text boxes
    A AikinX

    There is no reason to call method show. Any control is shown up on the form at time it has been added to form's component container P.S. Chintan.Desai, there were many syntax mistakes in you post

    C# csharp tutorial

  • create dynamic text boxes
    A AikinX

    What did you mean: "dynamic text boxes"? May be you wanted to say how to create text boxes dynamically? There is the solution: private void Form1_Load(object sender, EventArgs e) { TextBox myDynamicTextbox = new TextBox(); myDynamicTextbox.Size = new Size(100, 20); myDynamicTextbox.Location = new System.Drawing.Point(10, 10); this.Controls.Add(myDynamicTextbox); }

    C# csharp tutorial
  • Login

  • Don't have an account? Register

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