Search Results

Search found 186 results on 8 pages for 'ashish ashu'.

Page 6/8 | < Previous Page | 2 3 4 5 6 7 8  | Next Page >

  • protobuf-net NOT faster than binary serialization?

    - by Ashish Gupta
    I wrote a program to serialize a 'Person' class using XMLSerializer, BinaryFormatter and ProtoBuf. I thought protobuf-net should be faster than the other two. Protobuf serialization was faster than XMLSerialization but much slower than the binary serialization. Is my understanding incorrect? Please make me understand this. Thank you for the help. Following is the output:- Person got created using protocol buffer in 347 milliseconds Person got created using XML in 1462 milliseconds Person got created using binary in 2 milliseconds Code below using System; using System.Collections.Generic; using System.Linq; using System.Text; using ProtoBuf; using System.IO; using System.Diagnostics; using System.Runtime.Serialization.Formatters.Binary; namespace ProtocolBuffers { class Program { static void Main(string[] args) { string XMLSerializedFileName = "PersonXMLSerialized.xml"; string ProtocolBufferFileName = "PersonProtocalBuffer.bin"; string BinarySerializedFileName = "PersonBinary.bin"; var person = new Person { Id = 12345, Name = "Fred", Address = new Address { Line1 = "Flat 1", Line2 = "The Meadows" } }; Stopwatch watch = Stopwatch.StartNew(); watch.Start(); using (var file = File.Create(ProtocolBufferFileName)) { Serializer.Serialize(file, person); } watch.Stop(); Console.WriteLine(watch.ElapsedMilliseconds.ToString()); Console.WriteLine("Person got created using protocol buffer in " + watch.ElapsedMilliseconds.ToString() + " milliseconds " ); watch.Reset(); watch.Start(); System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(person.GetType()); using (TextWriter w = new StreamWriter(XMLSerializedFileName)) { x.Serialize(w, person); } watch.Stop(); Console.WriteLine(watch.ElapsedMilliseconds.ToString()); Console.WriteLine("Person got created using XML in " + watch.ElapsedMilliseconds.ToString() + " milliseconds"); watch.Reset(); watch.Start(); using (Stream stream = File.Open(BinarySerializedFileName, FileMode.Create)) { BinaryFormatter bformatter = new BinaryFormatter(); //Console.WriteLine("Writing Employee Information"); bformatter.Serialize(stream, person); } watch.Stop(); Console.WriteLine(watch.ElapsedMilliseconds.ToString()); Console.WriteLine("Person got created using binary in " + watch.ElapsedMilliseconds.ToString() + " milliseconds"); Console.ReadLine(); } } [ProtoContract] [Serializable] public class Person { [ProtoMember(1)] public int Id {get;set;} [ProtoMember(2)] public string Name { get; set; } [ProtoMember(3)] public Address Address {get;set;} } [ProtoContract] [Serializable] public class Address { [ProtoMember(1)] public string Line1 {get;set;} [ProtoMember(2)] public string Line2 {get;set;} } }

    Read the article

  • How to take input for a character pointer without using fget?

    - by ashish yadav
    consider the code #include<stdio.h> int main() { char* a; scanf("%s",a);//&a and &a[0] give same results-crashes printf("%s",); return 0; } why does this code results in crashing?whereas this code using character array works fine? #include<stdio.h> int main() { char a[100]; scanf("%s",&a[0]);//works fine printf("%s",a); return 0; } the difference being character array and pointer?but i knew that pointer just points to the first element that is &a[0] should work fine but upper code crashes for all three that is a,&a and &a[0]? the main thing i would to gather is how can i take input of a character pointer if i insist on using scanf only? i apologize if i am not clear. thanks in advance:)

    Read the article

  • castle dynamic proxy creation

    - by ashish.s
    I am implementing a design where my layer would sit between client and server, and whatever objects i get from server, i would wrap it in a transparent proxy and give to the client, that way i can keep a track of what changed in the object, so when saving it back, i would only send changed information. I looked at castle dynamic proxy, linfu, although they can generate a proxy type, but they cant take existing objects and wrap them instead. Wondering if its possible to do with these frameworks, or if there any other frameworks that enable this...

    Read the article

  • zeromq installtion on mac os snow leopard

    - by Ashish
    I have installed zeromq 2.1.11 on mac os x using the steps given on http://www.zeromq.org/area:download Then i installed pyzmq (python bindings ) But i get the following error : import zmq Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> import zmq File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/zmq/__init__.py", line 35, in <module> from zmq.utils import initthreads # initialize threads ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/zmq/utils/initthreads.so, 2): no suitable image found. Did find: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/zmq/utils/initthreads.so: no matching architecture in universal wrapper

    Read the article

  • play background music continuously

    - by Ashish Rajan
    I am playing a background on my webpage by using miniswfloopplayer, now I want the music to play continuously throughout the website, currently the music starts all over again when a page loads which is quite obvious. I am looking for a approach where I can avoid the above situation. I know similar questions have been posted here, but they are inactive from a long time.

    Read the article

  • Single log file for multiple webapps

    - by Ashish Aggarwal
    In my tomcat there are multiple webapps deployed and they communicate with each other. Currently they all have their own log file. But when there is some issue comes from call I have to 1st check with the app to whom I made a call and check log file of respective apps involved in the call. So I want that, as all apps is deployed in same tomcat and sharing a common log4j, if a call made to any app then all logs should be in a single log file and no matters how my webapps are involved all error comes from any webapp during the call should be in a single log file. I have no idea how can I achieve this. So any help is appreciable. Edited: I think my question is not cleared so updated with use case: I have three webapps A, B, C having logs files as A.log, B.log and C.log. I made two calls. 1st one to A (that internally calls C) and 2nd to B (that internally calls C). Now logging of first call must be in A.log (with the logs of every step performed inside the webapp c) and second call must be in B.log (with the logs of every step performed inside the webapp c).

    Read the article

  • Please help me to allow my `JTable` to search the text even the table is in editable mode on key-press

    - by Ashish Pancholi
    If user starts pressing keys using keyboards then JTable is supposed to be searched the matching text for him and if user double clicks on cell then Table should allow him to edit the text. And the issue is - Table is only searching text when the table is in non-editable mode and if Table is editable and user starts typing the text-using keyboard, cell is allowing him to edit the cell rather then search. Mr mKorbel has just solved my issue to allow edit only if double click on Table cell. Please help me to allow my JTable to search the text even the table is in editable mode on key-press.

    Read the article

  • what happens when two exceptions occur?

    - by ashish yadav
    what will the operating system and compiler behave when they have two exceptions. And none of them have been caught yet. what type of handler will be called . lets say both the exceptions were of different type. i apologize if i am not clear but i feel i have made myself clear enough. thank you!!!

    Read the article

  • explain interfaces in C#

    - by Ashish
    //inteface i11 public interface i11 { void m11(); } //interface i22 public interface i22 { void m11(); } //class ab implements interfaces i11 and i22 public class ab : i11, i22 { public void m11() { Console.WriteLine("class"); } } now when in Main() method we create an object of class ab which interface method will get called please explain all.

    Read the article

  • Retruning reference to object not changing the address in c++

    - by ashish-sangwan
    I am trying to understand function returning reference. For that i have written a simple program :- include using namespace std; class test { int i; friend test& func(); public: test(int j){i=j;} void show(){cout< }; test& func() { test temp(10); return temp; //// Address of temp=0xbfcb2874 } int main() { test obj1(50); // Address of obj1=0xbfcb28a0 func()=obj1; <= Problem:The address of obj1 is not changing obj1.show(); // // Address of obj1=0xbfcb28a0 return 0; } I run the program using gdb and observed that the address of obj1 still remains same but i expect it to get changed to 0xbfcb2874. I am not clear with the concept. Please help. Thanks in advance

    Read the article

  • Returning reference to object is not changing the address in c++

    - by ashish-sangwan
    I am trying to understand functions returning a reference. For that I have written a simple program: #include<iostream> using namespace std; class test { int i; friend test& func(); public: test(int j){i=j;} void show(){cout<<i<<endl;} }; test& func() { test temp(10); return temp; //// Address of temp=0xbfcb2874 } int main() { test obj1(50); // Address of obj1=0xbfcb28a0 func()=obj1; <= Problem:The address of obj1 is not changing obj1.show(); // // Address of obj1=0xbfcb28a0 return 0; } I ran the program using gdb and observed that the address of obj1 still remains same, but I expect it to get changed to 0xbfcb2874. I am not clear with the concept. Please help.

    Read the article

  • [c]how to take input for a character pionter without using fget?

    - by ashish yadav
    consider the code include int main() {char* a; scanf("%s",a);//&a and &a[0] give same results-crashes printf("%s",); return 0; } why does this code results in crashing?whereas this code using character array works fine? include int main() {char a[100]; scanf("%s",&a[0]);//works fine printf("%s",a); return 0; } the difference being character array and pointer?but i knew that pointer just points to the first element that is &a[0] should work fine but upper code crashes for all three that is a,&a and &a[0]? the main thing i would to gather is how can i take input of a character pointer if i insist on using scanf only? i apologize if i am not clear. thanks in advance:)

    Read the article

  • Focus problem with multiple EditText's.

    - by Ashish
    I have an activity with two edittext controls. I am calling the requestFocus on the second edittext field since by default the focus goes to the first edittext control. The focus appears to be in the second edittext field (the second one gets the highlighted border), but if we try to enter any characters using the hardware keyboard the text appears in the first edittext control. Any ideas why it would be happening?

    Read the article

< Previous Page | 2 3 4 5 6 7 8  | Next Page >