Search Results

Search found 7140 results on 286 pages for 'mike tostring'.

Page 4/286 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • return new string vs .ToString()

    - by Leroy Jenkins
    Take the following code: public static string ReverseIt(string myString) { char[] foo = myString.ToCharArray(); Array.Reverse(foo); return new string(foo); } I understand that strings are immutable, but what I dont understand is why a new string needs to be called return new string(foo); instead of return foo.ToString(); I have to assume it has something to do with reassembling the CharArray (but thats just a guess). Whats the difference between the two and how do you know when to return a new string as opposed to returning a System.String that represents the current object?

    Read the article

  • toString() Method question

    - by cdominguez13
    I've been working on this assignemnt here's code: public class Student { private String fname; private String lname; private String studentId; private double gpa; public Student(String studentFname,String studentLname,String stuId,double studentGpa) { fname = studentFname; lname = studentLname; studentId = stuId; gpa = studentGpa; } public double getGpa() { return gpa; } public String getStudentId() { return studentId; } public String getName() { return lname + ", " + fname; } public void setGpa(double gpaReplacement) { if (gpaReplacement >= 0.0 && gpaReplacement <= 4.0) gpa = gpaReplacement; else System.out.println("Invalid GPA! Please try again."); System.exit(0); } } Now I need to create a toString() method that returns a String formatted something like this: Name: Wilson, Mary Ann ID number: 12345 GPA: 3.5

    Read the article

  • concatenation output problem (toString Array) - java

    - by dowln
    Hello, I am trying to display the output as "1(10) 2(23) 3(29)" but instead getting output as "1 2 3 (10)(23)(29)". I would be grateful if someone could have a look the code and possible help me. I don't want to use arraylist. the code this // int[] Groups = {10, 23, 29}; in the constructor public String toString() { String tempStringB = ""; String tempStringA = " "; String tempStringC = " "; for (int x = 1; x<=3; x+=1) { tempStringB = tempStringB + x + " "; } for(int i = 0; i < Group.length;i++) { tempStringA = tempStringA + "(" + Groups[i] + ")"; } tempStringC = tempStringB + tempStringA; return tempStringC; }

    Read the article

  • Generating equals / hashcode / toString using annotation

    - by Bruno Bieth
    I believe I read somewhere people generating equals / hashcode / toString methods during compile time (using APT) by identifying which fields should be part of the hash / equality test. I couldn't find anything like that on the web (I might have dreamed it ?) ... That could be done like that : public class Person { @Id @GeneratedValue private Integer id; @Identity private String firstName, lastName; @Identity private Date dateOfBirth; //... } For an entity (so we want to exlude some fields, like the id). Or like a scala case class i.e a value object : @ValueObject public class Color { private int red, green, blue; } Not only the file becomes more readable and easier to write, but it also helps ensuring that all the attributes are part of the equals / hashcode (in case you add another attribute later on, without updating the methods accordingly). I heard APT isn't very well supported in IDE but I wouldn't see that as a major issue. After all, tests are mainly run by continuous integration servers. Any idea if this has been done already and if not why ? Thanks

    Read the article

  • Permission denied to access property 'toString'

    - by Anders
    I'm trying to find a generic way of getting the name of Constructors. My goal is to create a Convention over configuration framework for KnockoutJS My idea is to iterate over all objects in the window and when I find the contructor i'm looking for then I can use the index to get the name of the contructor The code sofar (function() { constructors = {}; window.findConstructorName = function(instance) { var constructor = instance.constructor; var name = constructors[constructor]; if(name !== undefined) { return name; } var traversed = []; var nestedFind = function(root) { if(typeof root == "function" || traversed[root]) { return } traversed[root] = true; for(var index in root) { if(root[index] == constructor) { return index; } var found = nestedFind(root[index]); if(found !== undefined) { return found; } } } name = nestedFind(window); constructors[constructor] = name; return name; } })(); var MyApp = {}; MyApp.Foo = function() { }; var instance = new MyApp.Foo(); console.log(findConstructorName(instance)); The problem is that I get a Permission denied to access property 'toString' Exception, and i cant even try catch so see which object is causing the problem Fiddle http://jsfiddle.net/4ZwaV/

    Read the article

  • e.Row.Tag .ToString

    - by prince23
    hi, Child data grid is not showing the values in the page for the child datagrid I am binding with an list <sdk:DataGrid MinHeight="100" x:Name="contacts" Margin="51,21,88,98" RowDetailsVisibilityChanged="contacts_RowDetailsVisibilityChanged" LoadingRowDetails="contacts_LoadingRowDetails" RowDetailsVisibilityMode="VisibleWhenSelected" MouseLeftButtonUp="contacts_MouseLeftButtonUp" MouseLeftButtonDown="contacts_MouseLeftButtonDown"> <sdk:DataGrid.Columns> <sdk:DataGridTextColumn Binding="{Binding EmployeeID}" Header="ID" /> <sdk:DataGridTextColumn Binding="{Binding EmployeeFName}" Header="Fname" /> <sdk:DataGridTextColumn Binding="{Binding EmployeeLName}" Header="LName" /> <sdk:DataGridTextColumn Binding="{Binding EmployeeMailID}" Header="MailID" /> </sdk:DataGrid.Columns> <sdk:DataGrid.RowDetailsTemplate> <DataTemplate> <sdk:DataGrid x:Name="dgrdRowDetail" Width="200" AutoGenerateColumns="False" HorizontalAlignment="Center" IsReadOnly="True"> <sdk:DataGrid.Columns> <sdk:DataGridTextColumn Header="CompanyName" Binding="{Binding Company name}"/> <sdk:DataGridTextColumn Header="CompanyName" Binding="{Binding EmpID}"/> </sdk:DataGrid.Columns> </sdk:DataGrid> </DataTemplate> </sdk:DataGrid.RowDetailsTemplate> </sdk:DataGrid> I am having 2 grids "contacts" and "dgrdRowDetail" globally i have defined an variable like this:- DataGrid dgrdRowDetail; in the contacts_RowDetailsVisibilityChanged event I have this code if (e.Row.DataContext != null) { string strEmpID = ((SilverlightApplication1.DBServiceEMP.Employee)((e.DetailsElement).DataContext)).EmployeeID; dgrdRowDetail = (DataGrid)e.DetailsElement.FindName("dgrdRowDetail"); // here i am finding the child datgrid control in contacts datagrid // then in dgrdRowDetail i will be binding this grid with new values if (strEmpID != null) { int EmpID = Convert.ToInt32(strEmpID.ToString()); DBServiceEmp.GetEmployeeIDCompleted += new EventHandler<GetEmployeeIDCompletedEventArgs>(DBServiceEmp_GetEmployeeIDCompleted); DBServiceEmp.GetEmployeeIDAsync(EmpID); } } this is my method void DBServiceEmp_GetEmployeeIDCompleted(object sender, GetEmployeeIDCompletedEventArgs e) { // List<Employee> Employes = new List<Employee>(); List<Employee> rows = new List<Employee>(); for (int i = 0; i < e.Result.Count; i++) { rows.Add(e.Result[i]); } dgrdRowDetail.ItemsSource = rows; // here i am binding the child datagrid with new data source } dgrdRowDetail.ItemsSource = rows// what ever rows i am binding to dgrdRowDetail are not shown in the page if i check the rows i am able to see the value ther. but in the child grid it is not reflecting plz plz help me out i am struck thanks in advance prince

    Read the article

  • php 5.1.6 magic __toString method

    - by NachoF
    In codeigniter Im trying to use this plugin which requires I implement a toString method in my models. My toString method simply does return $this->name On my local machine with php 5.3 everything works just fine but on the production server with php 5.1.6 it shows "Object id#48" where the value of the name property of that object should appear..... I found something about the problem here but I still dont understand... How can I fix this?

    Read the article

  • Web Application : How to upload multiple images at a time

    - by SAMIR BHOGAYTA
    //First add image control into the web form how many you want to upload images at a time //Add one button //Write the below code into the button_click event if (FileUpload1.HasFile) { string imagefile = FileUpload1.FileName; if (CheckFileType(imagefile) == true) { Random rndob = new Random(); int db = rndob.Next(1, 100); filename = System.IO.Path.GetFileNameWithoutExtension(imagefile) + db.ToString() + System.IO.Path.GetExtension(imagefile); String FilePath = "images/" + filename; FileUpload1.SaveAs(Server.MapPath(FilePath)); objimg.ImageName = filename; Image1(); if (Session["imagecount"].ToString() == "1") { Img1.ImageUrl = FilePath; ViewState["img1"] = FilePath; } else if (Session["imagecount"].ToString() == "2") { Img1.ImageUrl = ViewState["img1"].ToString(); Img2.ImageUrl = FilePath; ViewState["img2"] = FilePath; } else if (Session["imagecount"].ToString() == "3") { Img1.ImageUrl = ViewState["img1"].ToString(); Img2.ImageUrl = ViewState["img2"].ToString(); Img3.ImageUrl = FilePath; ViewState["img3"] = FilePath; } else if (Session["imagecount"].ToString() == "4") { Img1.ImageUrl = ViewState["img1"].ToString(); Img2.ImageUrl = ViewState["img2"].ToString(); Img3.ImageUrl = ViewState["img3"].ToString(); Img4.ImageUrl = FilePath; ViewState["img4"] = FilePath; } else if (Session["imagecount"].ToString() == "5") { Img1.ImageUrl = ViewState["img1"].ToString(); Img2.ImageUrl = ViewState["img2"].ToString(); Img3.ImageUrl = ViewState["img3"].ToString(); Img4.ImageUrl = ViewState["img4"].ToString(); Img5.ImageUrl = FilePath; ViewState["img5"] = FilePath; } } } //execption handling else { lblErrMsg.Visible = true; lblErrMsg.Text = ""; lblErrMsg.Text = "please select a file"; } } //if file extension belongs to these list then only allowed public bool CheckFileType(string filename) { string ext; ext = System.IO.Path.GetExtension(filename); switch (ext.ToLower()) { case ".gif": return true; case ".jpeg": return true; case ".jpg": return true; case ".bmp": return true; case ".png": return true; default: return false; } }

    Read the article

  • Returning an array from an activity

    - by Boardy
    I am currently working on an android project and I want to be able to startActivityForResult so that I can return an array of. The array is an ArrayList<Spanned> lets say its called myArray. From what I've read I can't return an array directly from the activty using the set result so I was thinking that once the array has added all the data to the array, I can then call the toString function on it, i.e. myArray.toString(). If I do this, I have no idea how I can then convert this back into the original ArrayList<Spanned>. Thanks for any help you can provide.

    Read the article

  • Arrays (toString) not output correctly

    - by DiscoDude
    Hello, Actually this tread is continuing from the other one. There wasn't enough characters to continue there. Anyway. the problem is that the output is "1(10) 2(23) 3(29)". Even though I could return string for the array values (10,23,29) and used string reference as 1, 2 and 3. My question is it possible to return index values 1,2,3 and as well as array values. Am I making an sense. Here is what I have done... // int[] groups = {10, 23, 29}; in the constructor String tempA = ""; String tempB = " "; int[] temp = new int[4]; int length = groups.length; for (int j = 0; j < length; j++) { temp[j] = groups[j]; tempB = tempB + "("+goups+")"; } groups = temp; Arrays.sort(coingroups); for(int i = 1; i < groups.length;i++) { tempA = tempA+" "+(i)+ "("+groups[i]+")"; } return tempA;

    Read the article

  • Silverlight Cream for January 01, 2011 -- #1020

    - by Dave Campbell
    In this short New Year's Day 2011 Issue, 3 Mikes: Mike Taulty, Mike Snow, and Mike Ormond. Above the Fold: Silverlight: "Native Extensions for Silverlight (NESL)?" Mike Taulty WP7: "Monitoring Memory Usage on Windows Phone 7" Mike Ormond From SilverlightCream.com: Native Extensions for Silverlight (NESL)? Mike Taulty has a really good write-up on Native Extensions for Silverlight... he describes what that project is about and gives guidance on best practices. Win7 Mobile: Uniquely Identifying a Device or User Mike Snow has a post up describing how to uniquely identify the phone or device your app is running on using the Microsoft.Phone.Info.DeviceExtendedProperties namespace Monitoring Memory Usage on Windows Phone 7 Mike Ormond has a post up showing how to turn on and make use of the framerate counters in WP7 Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • What&rsquo;s wrong with See[Mike]Code? (no relation)

    - by mbcrump
    I have been hearing a lot about the website See[Mike]Code. Basically, the site creates an interview url and a job candidate url and lets you see the potential programmer’s code (specifically .NET developer). Below is the candidate’s URL   Below is the interviewer url   So you might think, ah, this is a good thing. We can screen candidates cheaper and more efficiently. In reality, this is only a good thing if you want your programmer to develop using notepad.  I use the most efficient tools that exist to do my job. I would simply fire up VS2010 and type “for” and hit the tab key twice and get the following template.   I have no problem keeping MSDN/Google in one of my monitors. I spend time learning VS macros and using Aurora XAML/Expression to produce my XAML for WPF. Sure, I can write a for loop without using the VS Macro, but the real question is, “Why should I?”. My point being, if you really want to test a .NET programmer knowledge then fire up his native working environment and let him use the features of the IDE to develop the simple 10-line program. For a more sophisticated program, then give him 20 minutes and allow access to msdn/google. If the programmer cannot find at the right path then give him the boot.

    Read the article

  • Map to String in Java

    - by Dan
    When I do System.out.println(map) in Java, I get a nice output in stdout. How can I obtain this same string representation of a Map in a variable without meddling with standard output? Something like String mapAsString = Collections.toString(map)?

    Read the article

  • The counter doesnt seem to increase when ever the edittext changes

    - by Mabulhuda
    Im using Edit-texts and i need when ever an edit-text is changed to increment a counter by one but the counter isnt working , I mean the app starts and everything but the counter doesnt seem to change please help here is the code public class Numersys extends Activity implements TextWatcher { EditText mark1 ,mark2, mark3,mark4,mark5,mark6 , hr1 ,hr2,hr3,hr4,hr5,hr6; EditText passed, currentavg; TextView tvnewavg ; Button calculate; double marks , curAVG , NewAVG ; String newCumAVG; int counter , hrs , curHr , NewHr; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.numersys); mark1=(EditText)findViewById(R.id.mark1n); mark2=(EditText)findViewById(R.id.mark2n); mark3=(EditText)findViewById(R.id.mark3n); mark4=(EditText)findViewById(R.id.mark4n); mark5=(EditText)findViewById(R.id.mark5n); mark6=(EditText)findViewById(R.id.mark6n); hr1=(EditText)findViewById(R.id.ethour1); hr2=(EditText)findViewById(R.id.ethour2); hr3=(EditText)findViewById(R.id.ethour3); hr4=(EditText)findViewById(R.id.ethour4); hr5=(EditText)findViewById(R.id.ethour5); hr6=(EditText)findViewById(R.id.ethour6); passed=(EditText)findViewById(R.id.etPassCn); currentavg=(EditText)findViewById(R.id.etCavgn); tvnewavg=(TextView)findViewById(R.id.tvcAVGn); mark1.addTextChangedListener(this); mark2.addTextChangedListener(this); mark3.addTextChangedListener(this); mark4.addTextChangedListener(this); mark5.addTextChangedListener(this); mark6.addTextChangedListener(this); calculate=(Button)findViewById(R.id.bAvgCalcn); @Override public void onClick(View arg0) { // TODO Auto-generated method stub switch(arg0.getId()) { case 0: break; case 1: hrs=Integer.valueOf(hr1.getText().toString()); marks=Double.valueOf(mark1.getText().toString())*Integer.valueOf(hr1.getText().toString()); curHr=Integer.valueOf(passed.getText().toString()); curAVG=Double.valueOf(currentavg.getText().toString())*curHr; NewHr= curHr+hrs; NewAVG= (marks+curAVG)/NewHr; break; case 2: hrs=Integer.valueOf(hr1.getText().toString())+Integer.valueOf(hr2.getText().toString()); marks=Double.valueOf(mark1.getText().toString())*Integer.valueOf(hr1.getText().toString()) +Double.valueOf(mark2.getText().toString())*Integer.valueOf(hr2.getText().toString()); curHr=Integer.valueOf(passed.getText().toString()); curAVG=Double.valueOf(currentavg.getText().toString())*curHr; NewHr= curHr+hrs; NewAVG= (marks+curAVG)/NewHr; break; case 3: hrs=Integer.valueOf(hr1.getText().toString())+Integer.valueOf(hr2.getText().toString()) +Integer.valueOf(hr3.getText().toString()); marks=Double.valueOf(mark1.getText().toString())*Integer.valueOf(hr1.getText().toString()) +Double.valueOf(mark2.getText().toString())*Integer.valueOf(hr2.getText().toString()) +Double.valueOf(mark3.getText().toString())*Integer.valueOf(hr3.getText().toString()); curHr=Integer.valueOf(passed.getText().toString()); curAVG=Double.valueOf(currentavg.getText().toString())*curHr; NewHr= curHr+hrs; NewAVG= (marks+curAVG)/NewHr; break; case R.id.bAvgCalcn: newCumAVG=String.valueOf(NewAVG); tvnewavg.setText(newCumAVG); } } }); } @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub if(mark1.hasFocus()) { counter = counter+1; } if(mark2.hasFocus()) { counter = counter+1; } if(mark3.hasFocus()) { counter = counter+1; } if(mark4.hasFocus()) { counter = counter+1; } if(mark5.hasFocus()) { counter = counter+1; } if(mark6.hasFocus()) { counter = counter+1; } }

    Read the article

  • Creating a Predicate Builder extension method

    - by Rippo
    I have a Kendo UI Grid that I am currently allowing filtering on multiple columns. I am wondering if there is a an alternative approach removing the outer switch statement? Basically I want to able to create an extension method so I can filter on a IQueryable<T> and I want to drop the outer case statement so I don't have to switch column names. private static IQueryable<Contact> FilterContactList(FilterDescriptor filter, IQueryable<Contact> contactList) { switch (filter.Member) { case "Name": switch (filter.Operator) { case FilterOperator.StartsWith: contactList = contactList.Where(w => w.Firstname.StartsWith(filter.Value.ToString()) || w.Lastname.StartsWith(filter.Value.ToString()) || (w.Firstname + " " + w.Lastname).StartsWith(filter.Value.ToString())); break; case FilterOperator.Contains: contactList = contactList.Where(w => w.Firstname.Contains(filter.Value.ToString()) || w.Lastname.Contains(filter.Value.ToString()) || (w.Firstname + " " + w.Lastname).Contains( filter.Value.ToString())); break; case FilterOperator.IsEqualTo: contactList = contactList.Where(w => w.Firstname == filter.Value.ToString() || w.Lastname == filter.Value.ToString() || (w.Firstname + " " + w.Lastname) == filter.Value.ToString()); break; } break; case "Company": switch (filter.Operator) { case FilterOperator.StartsWith: contactList = contactList.Where(w => w.Company.StartsWith(filter.Value.ToString())); break; case FilterOperator.Contains: contactList = contactList.Where(w => w.Company.Contains(filter.Value.ToString())); break; case FilterOperator.IsEqualTo: contactList = contactList.Where(w => w.Company == filter.Value.ToString()); break; } break; } return contactList; } Some additional information, I am using NHibernate Linq. Also another problem is that the "Name" column on my grid is actually "Firstname" + " " + "LastName" on my contact entity. We can also assume that all filterable columns will be strings.

    Read the article

  • Why MSMQ won't send a space character?

    - by cyclotis04
    I'm exploring MSMQ services, and I wrote a simple console client-server application that sends each of the client's keystrokes to the server. Whenever hit a control character (DEL, ESC, INS, etc) the server understandably throws an error. However, whenever I type a space character, the server receives the packet but doesn't throw an error and doesn't display the space. Server: namespace QIM { class Program { const string QUEUE = @".\Private$\qim"; static MessageQueue _mq; static readonly object _mqLock = new object(); static XmlSerializer xs; static void Main(string[] args) { lock (_mqLock) { if (!MessageQueue.Exists(QUEUE)) _mq = MessageQueue.Create(QUEUE); else _mq = new MessageQueue(QUEUE); } xs = new XmlSerializer(typeof(string)); _mq.BeginReceive(new TimeSpan(0, 1, 0), new object(), OnReceive); while (Console.ReadKey().Key != ConsoleKey.Escape) { } } static void OnReceive(IAsyncResult result) { Message msg; lock (_mqLock) { try { msg = _mq.EndReceive(result); Console.Write("."); Console.Write(xs.Deserialize(msg.BodyStream)); } catch (Exception ex) { Console.Write(ex); } } _mq.BeginReceive(new TimeSpan(0, 1, 0), new object(), OnReceive); } } } Client: namespace QIM_Client { class Program { const string QUEUE = @".\Private$\qim"; static MessageQueue _mq; static void Main(string[] args) { if (!MessageQueue.Exists(QUEUE)) _mq = MessageQueue.Create(QUEUE); else _mq = new MessageQueue(QUEUE); ConsoleKeyInfo key = new ConsoleKeyInfo(); while (key.Key != ConsoleKey.Escape) { key = Console.ReadKey(); _mq.Send(key.KeyChar.ToString()); } } } } Client Input: Testing, Testing... Server Output: .T.e.s.t.i.n.g.,..T.e.s.t.i.n.g...... You'll notice that the space character sends a message, but the character isn't displayed.

    Read the article

  • Unable to install updates on 14.04 LTS

    - by Mike
    I have been getting update notifications for a few weeks now but whenever I attempt to install them I get this message; The upgrade needs a total of 74.6 M free space on disk '/boot'. Please free at least an additional 29.8 M of disk space on '/boot'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'. First of all I don't have permission to access /boot (don't know why as its a standalone machine and i'm the only user). Secondly, I emptied the trash; Thirdly, I launched Terminal and entered sudo apt-get clean I was a asked for a sudo password. I entered my system password. Re-entered sudo apt-get clean. The cursor stopped blinking - I assumed it was doing it's "thing". I let it go for about 10 minutes then exited Terminal. Tried to install the updates but just got the same message. Is there something i'm ignorant of? This is the output I get from the command df -h and I have no idea what it all means! @Tim, What's bash and why am I denied access to fstab and /boot? mike@mike-MS-7800:~$ /etc/fstab bash: /etc/fstab: Permission denied mike@mike-MS-7800:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/ubuntu--vg-root 913G 11G 856G 2% / none 4.0K 0 4.0K 0% /sys/fs/cgroup udev 1.7G 4.0K 1.7G 1% /dev tmpfs 335M 1.6M 333M 1% /run none 5.0M 4.0K 5.0M 1% /run/lock none 1.7G 14M 1.7G 1% /run/shm none 100M 52K 100M 1% /run/user /dev/sda2 237M 182M 43M 81% /boot /dev/sda1 487M 3.4M 483M 1% /boot/efi /dev/sr1 31M 31M 0 100% /media/mike/Optus Mobile mike@mike-MS-7800:~$ I ran this from the terminal and all is now working. dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

    Read the article

  • create new inbox folder and save emails

    - by kasunmit
    i am trying http://www.c-sharpcorner.com/uploadfile/rambab/outlookintegration10282006032802am/outlookintegration.aspx[^] this code for create inbox personal folder and save same mails at the datagrid view (outlook 2007 and vsto 2008) i am able to create inbox folder according to above example but couldn't wire code for save e-mails at that example to save contect they r using following code if (chkVerify.Checked) { OutLook._Application outlookObj = new OutLook.Application(); MyContact cntact = new MyContact(); cntact.CustomProperty = txtProp1.Text.Trim().ToString(); //CREATING CONTACT ITEM OBJECT AND FINDING THE CONTACT ITEM OutLook.ContactItem newContact = (OutLook.ContactItem)FindContactItem(cntact, CustomFolder); //THE VALUES WE CAN GET FROM WEB SERVICES OR DATA BASE OR CLASS. WE HAVE TO ASSIGN THE VALUES //TO OUTLOOK CONTACT ITEM OBJECT . if (newContact != null) { newContact.FirstName = txtFirstName.Text.Trim().ToString(); newContact.LastName = txtLastName.Text.Trim().ToString(); newContact.Email1Address = txtEmail.Text.Trim().ToString(); newContact.Business2TelephoneNumber = txtPhone.Text.Trim().ToString(); newContact.BusinessAddress = txtAddress.Text.Trim().ToString(); if (chkAdd.Checked) { //HERE WE CAN CREATE OUR OWN CUSTOM PROPERTY TO IDENTIFY OUR APPLICATION. if(string.IsNullOrEmpty(txtProp1.Text.Trim().ToString())) { MessageBox.Show("please add value to Your Custom Property"); return; } newContact.UserProperties.Add("myPetName", OutLook.OlUserPropertyType.olText, true, OutLook.OlUserPropertyType.olText); newContact.UserProperties["myPetName"].Value = txtProp1.Text.Trim().ToString(); } newContact.Save(); this.Close(); } else { //IF THE CONTACT DOES NOT EXIST WITH SAME CUSTOM PROPERTY CREATES THE CONTACT. newContact = (OutLook.ContactItem)CustomFolder.Items.Add(OutLook.OlItemType.olContactItem); newContact.FirstName = txtFirstName.Text.Trim().ToString(); newContact.LastName = txtLastName.Text.Trim().ToString(); newContact.Email1Address = txtEmail.Text.Trim().ToString(); newContact.Business2TelephoneNumber = txtPhone.Text.Trim().ToString(); newContact.BusinessAddress = txtAddress.Text.Trim().ToString(); if (chkAdd.Checked) { //HERE WE CAN CREATE OUR OWN CUSTOM PROPERTY TO IDENTIFY OUR APPLICATION. if (string.IsNullOrEmpty(txtProp1.Text.Trim().ToString())) { MessageBox.Show("please add value to Your Custom Property"); return; } newContact.UserProperties.Add("myPetName", OutLook.OlUserPropertyType.olText, true, OutLook.OlUserPropertyType.olText); newContact.UserProperties["myPetName"].Value = txtProp1.Text.Trim().ToString(); } newContact.Save(); this.Close(); } } else { OutLook._Application outlookObj = new OutLook.Application(); OutLook.ContactItem newContact = (OutLook.ContactItem)CustomFolder.Items.Add(OutLook.OlItemType.olContactItem); newContact.FirstName = txtFirstName.Text.Trim().ToString(); newContact.LastName = txtLastName.Text.Trim().ToString(); newContact.Email1Address = txtEmail.Text.Trim().ToString(); newContact.Business2TelephoneNumber = txtPhone.Text.Trim().ToString(); newContact.BusinessAddress = txtAddress.Text.Trim().ToString(); if (chkAdd.Checked) { //HERE WE CAN CREATE OUR OWN CUSTOM PROPERTY TO IDENTIFY OUR APPLICATION. if (string.IsNullOrEmpty(txtProp1.Text.Trim().ToString())) { MessageBox.Show("please add value to Your Custom Property"); return; } newContact.UserProperties.Add("myPetName", OutLook.OlUserPropertyType.olText, true, OutLook.OlUserPropertyType.olText); newContact.UserProperties["myPetName"].Value = txtProp1.Text.Trim().ToString(); } newContact.Save(); this.Close(); } } else { //CREATES THE OUTLOOK CONTACT IN DEFAULT CONTACTS FOLDER. OutLook._Application outlookObj = new OutLook.Application(); OutLook.MAPIFolder fldContacts = (OutLook.MAPIFolder)outlookObj.Session.GetDefaultFolder(OutLook.OlDefaultFolders.olFolderContacts); OutLook.ContactItem newContact = (OutLook.ContactItem)fldContacts.Items.Add(OutLook.OlItemType.olContactItem); //THE VALUES WE CAN GET FROM WEB SERVICES OR DATA BASE OR CLASS. WE HAVE TO ASSIGN THE VALUES //TO OUTLOOK CONTACT ITEM OBJECT . newContact.FirstName = txtFirstName.Text.Trim().ToString(); newContact.LastName = txtLastName.Text.Trim().ToString(); newContact.Email1Address = txtEmail.Text.Trim().ToString(); newContact.Business2TelephoneNumber = txtPhone.Text.Trim().ToString(); newContact.BusinessAddress = txtAddress.Text.Trim().ToString(); newContact.Save(); this.Close(); } } /// /// ENABLING AND DISABLING THE CUSTOM FOLDER AND PROPERY OPTIONS. /// /// /// private void rdoCustom_CheckedChanged(object sender, EventArgs e) { if (rdoCustom.Checked) { txFolder.Enabled = true; chkAdd.Enabled = true; chkVerify.Enabled = true; txtProp1.Enabled = true; } else { txFolder.Enabled = false; chkAdd.Enabled = false; chkVerify.Enabled = false; txtProp1.Enabled = false; } } i don t have idea to convert it to save e-mails in the datagrid view the data gride view i am mentioning here is containing details (sender address, subject etc.) of unread mails and the i i am did was perform some filter for that mails as follows string senderMailAddress = txtMailAddress.Text.ToLower(); List list = (List)dgvUnreadMails.DataSource; List myUnreadMailList; List filteredList = (List)(from ci in list where ci.SenderAddress.StartsWith(senderMailAddress) select ci).ToList(); dgvUnreadMails.DataSource = filteredList; it was done successfully then i need to save those filtered e-mails to that personal inbox folder i created already for that pls give me some help my issue is that how can i assign outlook object just like they assign it to contacts (name, address, e-mail etc.) because in the e-mails we couldn't find it ..

    Read the article

  • SharpPcap - A Packet Capture retring seding messesge problem.

    - by Eyla
    I trying to capture packets using SharpPcap library. I'm able to return the packets details but I'm having problem to get what the message content inside the packet. the packet using .Data to return the message and when I use it it is returning (System.Byte[]). here is the library website: http://www.codeproject.com/KB/IP/sharppcap.aspx here is my code: string packetData; private void packetCapturingThreadMethod() { Packet packet = null; int countOfPacketCaptures = 0; while ((packet = device.GetNextPacket()) != null) { packet = device.GetNextPacket(); if (packet is TCPPacket) { TCPPacket tcp = (TCPPacket)packet; myPacket tempPacket = new myPacket(); tempPacket.packetType = "TCP"; tempPacket.sourceAddress = Convert.ToString(tcp.SourceAddress); tempPacket.destinationAddress = Convert.ToString(tcp.DestinationAddress); tempPacket.sourcePort = Convert.ToString(tcp.SourcePort); tempPacket.destinationPort = Convert.ToString(tcp.DestinationPort); tempPacket.packetMessage = Convert.ToString(tcp.Data); packetsList.Add(tempPacket); packetData = "Type= TCP" + " Source Address = "+ Convert.ToString(tcp.SourceAddress)+ " Destination Address =" +Convert.ToString(tcp.DestinationAddress)+ " SourcePort =" + Convert.ToString(tcp.SourcePort)+ " SourcePort =" +Convert.ToString(tcp.DestinationPort)+ " Messeage =" + Convert.ToString(tcp.Data); txtpackets.Invoke(new UpdatetxtpacketsCallback(this.Updatetxtpackets), new object[] { packetData }); string[] row = { packetsList[countOfPacketCaptures].packetType, packetsList[countOfPacketCaptures].sourceAddress, packetsList[countOfPacketCaptures].destinationAddress, packetsList[countOfPacketCaptures].sourcePort, packetsList[countOfPacketCaptures].destinationPort, packetsList[countOfPacketCaptures].packetMessage }; try { //dgwPacketInfo.Rows.Add(row); countOfPacketCaptures++; //lblCapturesLabels.Text = Convert.ToString(countOfPacketCaptures); } catch (Exception e) { } } else if (packet is UDPPacket) { UDPPacket udp = (UDPPacket)packet; myPacket tempPacket = new myPacket(); tempPacket.packetType = "UDP"; tempPacket.sourceAddress = Convert.ToString(udp.SourceAddress); tempPacket.destinationAddress = Convert.ToString(udp.DestinationAddress); tempPacket.sourcePort = Convert.ToString(udp.SourcePort); tempPacket.destinationPort = Convert.ToString(udp.DestinationPort); tempPacket.packetMessage = udp.Data.ToArray() + "\n"; packetsList.Add(tempPacket); packetData = "Type= UDP" + " Source Address = "+ Convert.ToString(udp.SourceAddress)+ " Destination Address =" +Convert.ToString(udp.DestinationAddress)+ " SourcePort =" + Convert.ToString(udp.SourcePort)+ " SourcePort =" +Convert.ToString(udp.DestinationPort)+ " Messeage =" + udp.Data.ToArray() + "\n"; string[] row = { packetsList[countOfPacketCaptures].packetType, packetsList[countOfPacketCaptures].sourceAddress, packetsList[countOfPacketCaptures].destinationAddress, packetsList[countOfPacketCaptures].sourcePort, packetsList[countOfPacketCaptures].destinationPort, packetsList[countOfPacketCaptures].packetMessage }; try { //dgwPacketInfo.Rows.Add(row); //countOfPacketCaptures++; //lblCapturesLabels.Text = Convert.ToString(countOfPacketCaptures); txtpackets.Invoke(new UpdatetxtpacketsCallback(this.Updatetxtpackets), new object[] { packetData }); } catch (Exception e) { } } } }

    Read the article

  • SharpPcap - A Packet Capture getting messesge problem.

    - by Eyla
    I trying to capture packets using SharpPcap library. I'm able to return the packets details but I'm having problem to get what the message content inside the packet. the packet using .Data to return the message and when I use it it is returning (System.Byte[]). here is the library website: http://www.codeproject.com/KB/IP/sharppcap.aspx here is my code: string packetData; private void packetCapturingThreadMethod() { Packet packet = null; int countOfPacketCaptures = 0; while ((packet = device.GetNextPacket()) != null) { packet = device.GetNextPacket(); if (packet is TCPPacket) { TCPPacket tcp = (TCPPacket)packet; myPacket tempPacket = new myPacket(); tempPacket.packetType = "TCP"; tempPacket.sourceAddress = Convert.ToString(tcp.SourceAddress); tempPacket.destinationAddress = Convert.ToString(tcp.DestinationAddress); tempPacket.sourcePort = Convert.ToString(tcp.SourcePort); tempPacket.destinationPort = Convert.ToString(tcp.DestinationPort); tempPacket.packetMessage = Convert.ToString(tcp.Data); packetsList.Add(tempPacket); packetData = "Type= TCP" + " Source Address = "+ Convert.ToString(tcp.SourceAddress)+ " Destination Address =" +Convert.ToString(tcp.DestinationAddress)+ " SourcePort =" + Convert.ToString(tcp.SourcePort)+ " SourcePort =" +Convert.ToString(tcp.DestinationPort)+ " Messeage =" + Convert.ToString(tcp.Data); txtpackets.Invoke(new UpdatetxtpacketsCallback(this.Updatetxtpackets), new object[] { packetData }); string[] row = { packetsList[countOfPacketCaptures].packetType, packetsList[countOfPacketCaptures].sourceAddress, packetsList[countOfPacketCaptures].destinationAddress, packetsList[countOfPacketCaptures].sourcePort, packetsList[countOfPacketCaptures].destinationPort, packetsList[countOfPacketCaptures].packetMessage }; try { //dgwPacketInfo.Rows.Add(row); countOfPacketCaptures++; //lblCapturesLabels.Text = Convert.ToString(countOfPacketCaptures); } catch (Exception e) { } } else if (packet is UDPPacket) { UDPPacket udp = (UDPPacket)packet; myPacket tempPacket = new myPacket(); tempPacket.packetType = "UDP"; tempPacket.sourceAddress = Convert.ToString(udp.SourceAddress); tempPacket.destinationAddress = Convert.ToString(udp.DestinationAddress); tempPacket.sourcePort = Convert.ToString(udp.SourcePort); tempPacket.destinationPort = Convert.ToString(udp.DestinationPort); tempPacket.packetMessage = udp.Data.ToArray() + "\n"; packetsList.Add(tempPacket); packetData = "Type= UDP" + " Source Address = "+ Convert.ToString(udp.SourceAddress)+ " Destination Address =" +Convert.ToString(udp.DestinationAddress)+ " SourcePort =" + Convert.ToString(udp.SourcePort)+ " SourcePort =" +Convert.ToString(udp.DestinationPort)+ " Messeage =" + udp.Data.ToArray() + "\n"; string[] row = { packetsList[countOfPacketCaptures].packetType, packetsList[countOfPacketCaptures].sourceAddress, packetsList[countOfPacketCaptures].destinationAddress, packetsList[countOfPacketCaptures].sourcePort, packetsList[countOfPacketCaptures].destinationPort, packetsList[countOfPacketCaptures].packetMessage }; try { //dgwPacketInfo.Rows.Add(row); //countOfPacketCaptures++; //lblCapturesLabels.Text = Convert.ToString(countOfPacketCaptures); txtpackets.Invoke(new UpdatetxtpacketsCallback(this.Updatetxtpackets), new object[] { packetData }); } catch (Exception e) { } } } }

    Read the article

  • Display part of an XML file while parsing it

    - by Andy M
    Hey, Consider the following XML file : <cookbook> <recipe xml:id="MushroomSoup"> <title>Quick and Easy Mushroom Soup</title> <ingredient name="Fresh mushrooms" quantity="7" unit="pieces"/> <ingredient name="Garlic" quantity="1" unit="cloves"/> </recipe> <recipe xml:id="AnotherRecipe"> <title>XXXXXXX</title> <ingredient name="Tomatoes" quantity="8" unit="pieces"/> <ingredient name="PineApples" quantity="2" unit="cloves"/> </recipe> </cookbook> Let's say I want to parse this file and gather each recipe as XML, each one as a separated QString. For example, I would like to have a QString that contains : <recipe xml:id="MushroomSoup"> <title>Quick and Easy Mushroom Soup</title> <ingredient name="Fresh mushrooms" quantity="7" unit="pieces"/> <ingredient name="Garlic" quantity="1" unit="cloves"/> </recipe> How could I do this ? Do you guys know a quick and clean method to perform this ? Thanks in advance for your help !

    Read the article

  • Fractional to Decimal Form.

    - by ThePower
    Hi, there probably isn't an answer to this apart from "Create it yourself", but you never know, there might be some string representation for this. Basically, I would like to display number values as fractional instead of decimal when displaying the values as a string. Instead of a value displaying as: 1.1428571428571428571428571428571 I would prefer it to display as 8/7 Is there any way of doing this without writing the functionality myself? Regards Lloyd

    Read the article

  • How are integers converted to strings under the hood?

    - by CrazyJugglerDrummer
    I suppose the real question is how to convert base2/binary to base10. The most common application of this would probably be in creating strings for output: turning a chunk of binary numerical data into an array of characters. How exactly is this done? my guess: Seeing as there probably isn't a string predefined for each numerical value, I'm guessing that the computer goes through each bit of the integer from right to left, each time incrementing the appropriate values in the char array/base10 notation places. If we take the number 160 in binary (10100000), it would know that a 1 in the 8th place means 128, so it places 1 into the third column, 2 in the second, and 8 in the third. The 1 in the 6th column means 32, and it would add those values to the second and first place, carrying over if needed. After this it's an easy conversion to actual char codes.

    Read the article

  • __toString magic and type coercion

    - by TomcatExodus
    I've created a Template class for managing views and their associated data. It implements Iterator and ArrayAccess, and permits "sub-templates" for easy usage like so: <p><?php echo $template['foo']; ?></p> <?php foreach($template->post as $post): ?> <p><?php echo $post['bar']; ?></p> <?php endforeach; ?> Anyways, rather than using inline core functions, such as hash() or date(), I figured it would be useful to create a class called TemplateData, which would act as a wrapper for any data stored in the templates. This way, I can add a list of common methods for formatting, for example: echo $template['foo']->asCase('upper'); echo $template['bar']->asDate('H:i:s'); //etc.. When a value is set via $template['foo'] = 'bar'; in the controllers, the value of 'bar' is stored in it's own TemplateData object. I've used the magic __toString() so when you echo a TemplateData object, it casts to (string) and dumps it's value. However, despite the mantra controllers and views should not modify data, whenever I do something like this: $template['foo'] = 1; echo $template['foo'] + 1; //exception It dies on a Object of class TemplateData could not be converted to int; Unless I recast $template['foo'] to a string: echo ((string) $template['foo']) + 1; //outputs 2 Sort of defeats the purpose having to jump through that hoop. Are there any workarounds for this sort of behavior that exist, or should I just take this as it is, an incidental prevention of data modification in views?

    Read the article

  • Creating a custom format string in a dataGridView

    - by Andy
    I have a dataGridView whose dataSource is a dataTable. My problem is that I want certain columns to be displayed in Hex. I can get that far with using something like this: foreach (DataGridViewColumn c in grid.Columns) { if (DISPLAYED_IN_HEX.Contains(c.Name)) { c.DefaultCellStyle.Format = "X"; } } My issue though is that I want this hex value prepended with 0x so as not to confuse anyone that they are in hexidecimal form. The values in the dataTable are various integral types. I looked into creating a custom IFormatProvider, but I don't think my coding skills are up to that par yet. Any other possible solutions?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >