Search Results

Search found 369 results on 15 pages for 'pooja gupta'.

Page 9/15 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15  | 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

  • DataGridView's SelectionChange event firing more than once on DataBinding

    - by Shantanu Gupta
    This Code triggers selection change event twice. how can I prevent it ? Currently i m using a flag or focused property to prevent this. But what is the actual way ? I am using it on winfoms EDIT Mistake in writing Question, here is the correct code that i wanted to ask private void frmGuestInfo_Load(object sender, EventArgs e) { this.dgvGuestInfo.SelectionChanged -= new System.EventHandler(this.dgvGuestInfo_SelectionChanged); dgvGuestInfo.DataSource=dsFillControls.Tables["tblName"]; this.dgvGuestInfo.SelectionChanged += new System.EventHandler(this.dgvGuestInfo_SelectionChanged); } private void dgvGuestInfo_SelectionChanged(object sender, EventArgs e) { }

    Read the article

  • I want to set the AutoCompleteMode property in ApplyCellStyleToEditingControl subroutine

    - by Ranjan Gupta
    Hi, I am creating a DataGridView Column. and it is working well. now I want to customise this column with AutoCompleteMode, and AutoCompleteSource properties to show the customised data. I made the properties for this columns, and these are also working well. but these properties are not working in the "ApplyCellStyleToEditingControl" subroutine. Please help me to use these column properties in the "ApplyCellStyleToEditingControl" subroutine. Public Class DataGridViewDataValueColumn Inherits DataGridViewColumn Dim m_AutoCompleteMode As AutoCompleteMode, _ m_AutoCompleteSource As AutoCompleteSource, _ m_AutoCompleteStringCollection As AutoCompleteStringCollection Public Sub New() MyBase.New(New DataValueCell()) End Sub Public Overrides Property CellTemplate() As DataGridViewCell Get Return MyBase.CellTemplate End Get Set(ByVal value As DataGridViewCell) ' Ensure that the cell used for the template is a DataValueCell. If (value IsNot Nothing) AndAlso _ Not value.GetType().IsAssignableFrom(GetType(DataValueCell)) _ Then Throw New InvalidCastException("Must be a DataValueCell") End If MyBase.CellTemplate = value End Set End Property Region "User Defined Properties" '&*--------------------------------------*&' <Description("Indicates the text completion behaviour of the combo box."), DefaultValue(AutoCompleteMode.None)> _ Public Property AutoCompleteMode() As AutoCompleteMode Get Return m_AutoCompleteMode End Get Set(ByVal value As AutoCompleteMode) m_AutoCompleteMode = value End Set End Property <Description("The source of complete strings used to automatic completion."), DefaultValue(AutoCompleteSource.None)> _ Public Property AutoCompleteSource() As AutoCompleteSource Get Return m_AutoCompleteSource End Get Set(ByVal value As AutoCompleteSource) m_AutoCompleteSource = value End Set End Property <Description("The autocomplete custom source.")> _ Public Property AutoCompleteCustomSource() As AutoCompleteStringCollection Get Return m_AutoCompleteStringCollection End Get Set(ByVal value As AutoCompleteStringCollection) m_AutoCompleteStringCollection = value End Set End Property End Region End Class '&*--------------------------------------*&' Class DataValueCell Inherits DataGridViewTextBoxCell Public Sub New() ' End Sub Public Overrides ReadOnly Property EditType As Type Get Return GetType(PCLDataGridViewTextBoxEditingControl) End Get End Property End Class '&*--------------------------------------*&' '&* Edit DataGridView Columns *&' '&*--------------------------------------*&' Class PCLDataGridViewTextBoxEditingControl Inherits DataGridViewTextBoxEditingControl Public Overrides Function EditingControlWantsInputKey(ByVal keyData As Keys, ByVal dataGridViewWantsInputKey As Boolean) As Boolean Select Case ((keyData And Keys.KeyCode)) Case Keys.Prior, Keys.Next, Keys.End, Keys.Home, Keys.Left, Keys.Up, Keys.Right, Keys.Down, Keys.Delete Return True End Select Return MyBase.EditingControlWantsInputKey(keyData, dataGridViewWantsInputKey) End Function Public Overrides Sub ApplyCellStyleToEditingControl(ByVal dataGridViewCellStyle As DataGridViewCellStyle) With DirectCast(Me, TextBox) '.AutoCompleteMode = DataGridViewDataValueColumn.AutoCompleteMode_Value '.AutoCompleteSource = DataGridViewDataValueColumn.AutoCompleteSource_Value '.AutoCompleteCustomSource = MyBase.AutoCompleteCustomSource End With End Sub End Class

    Read the article

  • Mathematics for AI/Machine learning ?

    - by Ankur Gupta
    I intend to build a simple recommendation systems for fun. I read a little on the net and figured being good at math would enable on to build a good recommendation system. My math skills are not good. I am willing to put considerable efforts and time in learning maths. Can you please tell me what mathematics topics should I cover? Also if any of you folks can point me to some online material to learn from it would be great. I am aware of MIT OCW, book like collective intelligence. Math Topics to cover and from where to read would really help.

    Read the article

  • Single Query returning me 4 tables, How to get all of them back into dataset ?

    - by Shantanu Gupta
    How to fill multiple tables in a dataset. I m using a query that returns me four tables. At the frontend I am trying to fill all the four resultant table into dataset. Here is my Query. Query is not complete. But it is just a refrence for my Ques Select * from tblxyz compute sum(col1) suppose this query returns more than one table, I want to fill all the tables into my dataset I am filling result like this con.open(); adp.fill(dset); con.close(); Now when i checks this dataset. It shows me that it has four tables but only first table data is being displayed into it. rest 3 dont even have schema also. What i need to do to get desired output

    Read the article

  • Weird output of Throwable getMessage()

    - by Ravi Gupta
    Hi I have below pseudo code with throws an exception like this throw new MyException("Bad thing happened","com.stuff.errorCode"); where MyException extends Exception class. So the problem is when I try to get the message from MyException class by calling myEx.getMessage() it returns ???en_US.Bad thing happened??? instead of my original message i.e. Bad thing happened I have checked that MyException class doesn't overrides Throwable class's getMessage() behavior. Below is the how the call passes from MyException.getMessage() to Throwable.getMessage() public MyException(String msg, String sErrorCode){ super(msg); this.sErrorCode = sErrorCode; this.iSeverity = 0; } which then calls public Exception(String message) { super(message); } and finally public Throwable(String message) { fillInStackTrace(); detailMessage = message; } when I do a getMessage on myexception it calls Throwable's getMessage as below public String getMessage() { return detailMessage; } So ideally it should return the original message as I set when throwing the exception. What's the ???en_US thing ?

    Read the article

  • how to run vibrate continuously in iphone?

    - by aman-gupta
    Hi, In my application I m using following coding pattern to vibrate my iPhone device Header File:- AudioServices.h AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); //////////////////////////////////////////////////////////////// My problem is that when I run my application it gets vibrate but only for second but I want that it will vibrate continuously until I will stop it. How it could be possible .Please help me out its urgent Thanks in Advance

    Read the article

  • iPhone code forUIImageViewControllerPickerSourceTypeCamera

    - by aman-gupta
    - (IBAction)pickAndDecode:(id) sender { UIImagePickerControllerSourceType sourceType; int i = [sender tag]; switch (i) { case 0: sourceType = UIImagePickerControllerSourceTypeCamera; break; case 1: sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; break; case 2: sourceType = UIImagePickerControllerSourceTypePhotoLibrary; break; default: sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; } [self pickAndDecodeFromSource:sourceType]; } - (void) updateToolbar { self.cameraBarItem.enabled = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]; self.savedPhotosBarItem.enabled = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]; self.libraryBarItem.enabled = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]; self.archiveBarItem.enabled = true; self.actionBarItem.enabled = (self.result != nil) && ([self.result actions] != nil) && ([self.result actions].count > 0); } - (void)pickAndDecodeFromSource:(UIImagePickerControllerSourceType) sourceType { [self reset]; // Create the Image Picker if ([UIImagePickerController isSourceTypeAvailable:sourceType]) { UIImagePickerController* picker = [[UIImagePickerController alloc] init]; picker.sourceType = sourceType; picker.delegate = self; picker.allowsImageEditing = YES; // [[NSUserDefaults standardUserDefaults] boolForKey:@"allowEditing"]; // Picker is displayed asynchronously. [self presentModalViewController:picker animated:YES]; } else { NSLog(@"Attempted to pick an image with illegal source type '%d'", sourceType); } } Where I Put this line in my above codes; [picker setShowsCameraControls:FALSE]; please help me so that i can change the real view of iPhone camera according to my view which i have designed

    Read the article

  • How to restrict an access to some of the functions at third level in Classes (OOPs)

    - by Shantanu Gupta
    I have created a class say A which has some functions defined as protected. Now Class B inherits A and class C inherits B. Class A has private default constructor and protected parameterized constructor. I want Class B to be able to access all the protected functions defined in Class A but class C can have access on some of the functions only not all the functions and class C is inheriting class B. How can I restrict access to some of the functions of Class A from Class C ? Class A { private A(){} protected A(int ){} } Class B : A {} CLass C:B { }

    Read the article

  • When using Query Syntax in C# "Enumeration yielded no results". How to retrieve output

    - by Shantanu Gupta
    I have created this query to fetch some result from database. Here is my table structure. What exaclty is happening. DtMapGuestDepartment as Table 1 DtDepartment as Table 2 Are being used var dept_list= from map in DtMapGuestDepartment.AsEnumerable() where map.Field<Nullable<long>>("GUEST_ID") == DRowGuestPI.Field<Nullable<long>>("PK_GUEST_ID") join dept in DtDepartment.AsEnumerable() on map.Field<Nullable<long>>("DEPARTMENT_ID") equals dept.Field<Nullable<long>>("DEPARTMENT_ID") select dept.Field<string>("DEPARTMENT_ID"); I am performing this query on DataTables and expect it to return me a datatable. Here I want to select distinct department from Table 1 as well which will be my next quest. Please answer to that also if possible.

    Read the article

  • How to download file from particular url???

    - by greshi gupta
    NSURL * url = @"http://192.168.100.161/UploadWhiteB/wh.txt"; NSData * data = [NSData dataWithContentsOfURL:url]; if (data != nil) { NSLog(@"\nis not nil"); NSString *readdata = [[NSString alloc] initWithContentsOfURL:(NSData *)data ]; I write this code to download a file from given url... but i get an error on line NSData * data = [NSData dataWithContentsOfURL:url]; uncaught exception....so please help me out..

    Read the article

  • Copy constructor with more than one parameter

    - by Ravi Gupta
    I am learning C++ and was reading copy constructor from the C++: The Complete Reference. The books says that It is permissible for a copy constructor to have additional parameters as long as they have default arguments defined for them. However, in all cases the first parameter must be a reference to the object doing the initializing. But I am confused that how we are going to pass those additional parameters? I am sure there should be some way which is not given in the book and which I am unable to figure out. Can anyone help me out? EDIT: Also is it possible to pass these extra parameters in all three cases i.e. ¦ When one object explicitly initializes another, such as in a declaration ¦ When a copy of an object is made to be passed to a function ¦ When a temporary object is generated (most commonly, as a return value)

    Read the article

  • Stable URL of acts_as_taggable plugin in Ruby on Rails

    - by Rakesh Gupta
    Hi, In one of my applications on Ruby on Rails, I am using acts_as_taggable plugin. Coding was doing fine and suddenly it started giving following error. RuntimeError (acts_as_taggable_on_steroids has been moved to github: http://github.com/jviney/acts_as_taggable_on_steroids): app/models/post.rb:2 app/controllers/post_controller.rb:324:in post_scoper' app/controllers/post_controller.rb:221:indefault' C:\MyApp\script\server:3 -e:2:in `load' -e:2 Rendered rescues/_trace (94.0ms) Rendered rescues/_request_and_response (15.0ms) Rendering rescues/layout (internal_server_error) When trying installing the plugin from above URL, it says plugin has been moved. Does anyone have idea, what is the stable URL of acts_as_taggable plugin? Thanks in advance

    Read the article

  • I want to get 2 values returned by my query. How to do, using linq-to-entity

    - by Shantanu Gupta
    var dept_list = (from map in DtMapGuestDepartment.AsEnumerable() where map.Field<Nullable<long>>("GUEST_ID") == DRowGuestPI.Field<Nullable<long>>("PK_GUEST_ID") join dept in DtDepartment.AsEnumerable() on map.Field<Nullable<long>>("DEPARTMENT_ID") equals dept.Field<Nullable<long>>("DEPARTMENT_ID") select new { dept_id=dept.Field<long>("DEPARTMENT_ID") ,dept_name=dept.Field<long>("DEPARTMENT_NAME") }).Distinct(); DataTable dt = new DataTable(); dt.Columns.Add("DEPARTMENT_ID"); dt.Columns.Add("DEPARTMENT_NAME"); foreach (long? dept_ in dept_list) { dt.Rows.Add(dept_[0], dept_[1]); } EDIT In the previous question asked by me. I got an answer like this for single value. What is the difference between the two ? foreach (long? dept in dept_list) { dt.Rows.Add(dept); }

    Read the article

  • Reading bmp file for encrypting and decrypting txt file into it

    - by Shantanu Gupta
    I am trying to read a bmp file in C++(Turbo). But i m not able to print binary stream. I want to encode txt file into it and decrypt it. How can i do this. I read that bmp file header is of 54 byte. But how and where should i append txt file in bmp file. ? I know only Turbo C++, so it would be helpfull for me if u provide solution or suggestion related to topic for the same. int main() { ifstream fr; //reads ofstream fw; // wrrites to file char c; int random; clrscr(); char file[2][100]={"s.bmp","s.txt"}; fr.open(file[0],ios::binary);//file name, mode of open, here input mode i.e. read only if(!fr) cout<<"File can not be opened."; fw.open(file[1],ios::app);//file will be appended if(!fw) cout<<"File can not be opened"; while(!fr) cout<<fr.get(); // error should be here. but not able to find out what error is it fr.close(); fw.close(); getch(); } This code is running fine when i pass txt file in binary mode

    Read the article

  • Using Jquery to add items in Listbox from Textbox

    - by Pratik Gupta
    I am stuck somewhere using jquery to append the list box from a text box. here is my jquery $("#btnAddSvc").click(function () { var svc = $("#<%= txtServiceName.ClientID %>").val(); //Its Let you know the textbox's value svc.appendTo("#<%=lstSvcName.ClientID %>"); }); I am using asp.net (c#) to develop my code <asp:Button ID="btnAddSvc" runat="server" Text=">>" Font-Size="Medium" /> <asp:ListBox ID="lstSvcName" runat="server" SelectionMode="Multiple" ToolTip="Selected Service Names" Width="169px"></asp:ListBox> can someone please help as i am not able to get the values in list box.

    Read the article

  • When should we use Views, Temporary Tables and Direct Queries ? What are the Performance issues in a

    - by Shantanu Gupta
    I want to know the performance of using Views, Temp Tables and Direct Queries Usage in a Stored Procedure. I have a table that gets created every time when a trigger gets fired. I know this trigger will be fired very rare and only once at the time of setup. Now I have to use that created table from triggers at many places for fetching data and I confirms it that no one make any changes in that table. i.e ReadOnly Table. I have to use this tables data along with multiple tables to join and fetch result for further queries say select * from triggertable By Using temp table select ... into #tx from triggertable join t2 join t3 and so on select a,b, c from #tx --do something select d,e,f from #tx ---do somethign --and so on --around 6-7 queries in a row in a stored procedure. By Using Views create view viewname ( select ... from triggertable join t2 join t3 and so on ) select a,b, c from viewname --do something select d,e,f from viewname ---do somethign --and so on --around 6-7 queries in a row in a stored procedure. This View can be used in other places as well. So I will be creating at database rather than at sp By Using Direct Query select a,b, c from select ... into #tx from triggertable join t2 join t3 join ... --do something select a,b, c from select ... into #tx from triggertable join t2 join t3 join ... --do something . . --and so on --around 6-7 queries in a row in a stored procedure. Now I can create a view/temporary table/ directly query usage in all upcoming queries. What would be the best to use in this case.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15  | Next Page >