Search Results

Search found 61 results on 3 pages for 'ruben monteiro'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Change type of control by type

    - by Ruben
    Hi, I'm having following problem. I should convert a control to a certain type, this can be multiple types (for example a custom button or a custom label, ....) Here's an example of what i would like to do: private void ConvertToTypeAndUseCustomProperty(Control c) { Type type = c.getType(); ((type) c).CustomPropertieOfControl = 234567; } Thanks in advance.

    Read the article

  • What parts of .NET require administrative priviliges to be executed?

    - by Ruben Steins
    Which parts of the framework require a user to be more than a Standard User? The reason I'm asking is because I'm trying to compile a list of possible issues with our existing applications when migrating to Windows 7. Now, I can think of a few things myself: Writing to Eventlog Writing to Registry Keys outside of Current_User scope Getting an Environment variable etc... I really would like a more complete list and so far I've not come across a decent resource in which all this stuff is listed. Note that I'm not looking for ways of elevating the priviliges for the exsiting apps (which can be done by using a manifes), I'm simply idenitifying actions in code that might cause issues.

    Read the article

  • Using SqlBulkCopy in a multithread scenario with ThreadPool issue

    - by Ruben F.
    Hi. I'm facing a dilemma (!). In a first scenario, i implemented a solution that replicates data from one data base to another using SQLBulkCopy synchronously and i had no problem at all. Now, using ThreadPool, i implemented the same in a assynchronously scenario, a thread per table, and all works fine, but past some time (usualy 1hour because the operations of copy takes about the same time), the operations sended to the ThreadPool stop being executed. There are one diferent SQLBulkCopy using one diferent SQLConnection per thread. I already see the number of free threads, and they are all free at the begining of the invocation...I have one AutoResetEvent to wait that the threads finish their job before launching again, and a Semaphore FIFO that hold the counter of active threads. There are some issue that I have forgotten or that I should avaliate when using SqlBulkCopy? I apreciate some help, because my ideas are over;) Thanks

    Read the article

  • SQL CE unspecified error

    - by Ruben Trancoso
    Hello, I did a project with MS SQL Server CE that when installed in the 'costumer' machine just raises an unspecified excpetion. Did some research and looks like I did everything mentioned. The dev env has sql compact 3.5 installed and sql tools for vs 2005. Using dotNet 3.5. But to make it run in de dev machine I need to add the sqlcese30, sqlceqp30, sqlceme and sqlcecompact30 dlls and its works fine. The setup project put dotNet 2.0 as dependecy and I also added the dlls but it raises the exception and I cannot see where or what it is. Its just a single 'unspecified error' message. please help :)

    Read the article

  • Overriding LINQ extension methods

    - by Ruben Vermeersch
    Is there a way to override extension methods (provide a better implementation), without explicitly having to cast to them? I'm implementing a data type that is able to handle certain operations more efficiently than the default extension methods, but I'd like to keep the generality of IEnumerable. That way any IEnumerable can be passed, but when my class is passed in, it should be more efficient. As a toy example, consider the following: // Compile: dmcs -out:test.exe test.cs using System; namespace Test { public interface IBoat { void Float (); } public class NiceBoat : IBoat { public void Float () { Console.WriteLine ("NiceBoat floating!"); } } public class NicerBoat : IBoat { public void Float () { Console.WriteLine ("NicerBoat floating!"); } public void BlowHorn () { Console.WriteLine ("NicerBoat: TOOOOOT!"); } } public static class BoatExtensions { public static void BlowHorn (this IBoat boat) { Console.WriteLine ("Patched on horn for {0}: TWEET", boat.GetType().Name); } } public class TestApp { static void Main (string [] args) { IBoat niceboat = new NiceBoat (); IBoat nicerboat = new NicerBoat (); Console.WriteLine ("## Both should float:"); niceboat.Float (); nicerboat.Float (); // Output: // NiceBoat floating! // NicerBoat floating! Console.WriteLine (); Console.WriteLine ("## One has an awesome horn:"); niceboat.BlowHorn (); nicerboat.BlowHorn (); // Output: // Patched on horn for NiceBoat: TWEET // Patched on horn for NicerBoat: TWEET Console.WriteLine (); Console.WriteLine ("## That didn't work, but it does when we cast:"); (niceboat as NiceBoat).BlowHorn (); (nicerboat as NicerBoat).BlowHorn (); // Output: // Patched on horn for NiceBoat: TWEET // NicerBoat: TOOOOOT! Console.WriteLine (); Console.WriteLine ("## Problem is: I don't always know the type of the objects."); Console.WriteLine ("## How can I make it use the class objects when the are"); Console.WriteLine ("## implemented and extension methods when they are not,"); Console.WriteLine ("## without having to explicitely cast?"); } } } Is there a way to get the behavior from the second case, without explict casting? Can this problem be avoided?

    Read the article

  • Format date from SQLCE to display in DataGridView

    - by Ruben Trancoso
    hi folks, I have a DataGridView bound to a table from a .sdf database through a BindSource. The date column display dates like "d/M/yyyy HH:mm:ss". e.: "27/2/1971 00:00:00". I want to make it display just "27/02/1971" in its place. I tried to apply DataGridViewCellStyle {format=dd/MM/yyyy} but nothing happens, event with other pre-built formats. On the the other side, there's a Form with a MasketTextBox with a "dd/MM/yyyy" mask to its input that is bound to the same column and uses a Parse and a Format event handler before display and send it to the db. Binding dataNascimentoBinding = new Binding("Text", this.source, "Nascimento", true); dataNascimentoBinding.Format += new ConvertEventHandler(Util.formatDateConvertEventHandler); dataNascimentoBinding.Parse += new ConvertEventHandler(Util.parseDateConvertEventHandler); this.dataNascimentoTxt.DataBindings.Add(dataNascimentoBinding); public static string convertDateString2DateString(string dateString, string inputFormat, string outputFormat ) { DateTime date = DateTime.ParseExact(dateString, inputFormat, DateTimeFormatInfo.InvariantInfo); return String.Format("{0:" + outputFormat + "}", date); } public static void formatDateConvertEventHandler(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(string)) return; if (e.Value.GetType() != typeof(string)) return; String dateString = (string)e.Value; e.Value = convertDateString2DateString(dateString, "d/M/yyyy HH:mm:ss", "dd/MM/yyyy"); } public static void parseDateConvertEventHandler(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(string)) return; if (e.Value.GetType() != typeof(string)) return; string value = (string)e.Value; try { e.Value = DateTime.ParseExact(value, "dd/MM/yyyy", DateTimeFormatInfo.InvariantInfo); } catch { return; } } Like you can see by the code it was expexted that Date coming from SQL would be a DateTime value as is its column, but my eventHandler is receiving a string instead. Likewise, the result date for parse should be a datetime but its a string also. I'm puzzled dealing with this datetime column.

    Read the article

  • Creating a future proof .NET 3.5 SP1 installer prerequisite for setup.exe AND the .MSI

    - by Ruben Bartelink
    I've demanded .NET 3.5 SP1 a la http://stackoverflow.com/questions/88136/will-a-vs2008-setup-project-update-net-3-5-sp1. This makes the setup.exe check correctly. I've also added a "SP1" launch condition to my MSI so it doesn't let the user install my .NET 3.5SP1 app via launching the MSI (and replaced the [VSDNETMSG] in the Framework condition message with one that actually mentions SP1). From a future proofing point of view, this feels wrong. I want the condition to be: (NETVer=3.5 AND Net35SPLevel=1) OR (NETVer=>3.5) not (NETVer=3.5 AND Net35SPLevel=1) Is there any way to do that? The framework check doesnt have a condition property to allow me to add a sub-condition... Yes, I could also just not worry my pretty little head about it :P If one of the MS versioning experts out there reads this, if you're going to put stuff that code depends on into SPs, can you please make the installer be able to check for it OOTB. (I really wish they had come up with a better numbering scheme - the world and its dog could see that this was going to get confusing)

    Read the article

  • Select newly added Row - DataGridView and BindingSource

    - by Ruben Trancoso
    I'm adding a new Row to a BindingSource that is Bound to a DataGridView source.AddNew(); After this, use BindingSource to get the newly added row is return the next row in the DataGridView when its sorted. ROW "A" ROW "B" <- myBindingSource.AddNew(); ROW "C" myBindingSource.Current gives ROW "C". (it became the selected row in the DataGridView) I need this because I want to update just the newly added row DataRowView drv = (DataRowView)myBindingSource.Current; myTableAdapter.Update(drv.Row); and not the entire table. myTableAdapter.Update(myDataSet.myTable); and also, I would like to have this newly added line selected in the DataGridView after insertion. is it possible in some way?

    Read the article

  • Insert a Row with a sorted DataGridView

    - by Ruben Trancoso
    My DataGridView is bound to the same BindingSource as the Insert Form, and the Name column is sorted. After insert is done, the groupBindingSource.Current is not returning the new inserted DataRowView but the last row in the sort order what makes the Update do nothing. FormGroup formGroup = new FormGroup(); formGroup .Source = groupBindingSource; formGroup .setMode(FormGroup.Mode.Insert); if (formGroup .ShowDialog() == DialogResult.OK) { DataRowView drv = (DataRowView)groupBindingSource.Current; grupoTableAdapter.Update(drv.Row); }

    Read the article

  • disable event-bubbling c# wpf

    - by Ruben
    Hi, I'm having the following problem: When I got two labels into each other: <Label x:Name="First" MouseUp="Label_MouseUp"> <Label x:Name="Second" MouseUp="Label_MouseUp_1">This is a label into another label</Label> </Label> And the following code: private void Label_MouseUp(object sender, MouseButtonEventArgs e) { Console.WriteLine("Do NOT show me"); } private void Label_MouseUp_1(object sender, MouseButtonEventArgs e) { Console.WriteLine("Show me"); } When i click "Second", I want it to trigger only "Label_MouseUp_1". But in my console i get: Show me Do NOT show me Is there a way to turn off the bubbling events? (also, "First" has to be clickable, so removing the event there doesn't solve the problem) Thnx

    Read the article

  • Sync a WinForm with DatagridView

    - by Ruben Trancoso
    I have a Form with a DataGridView which DataSource is a BindingSource to a table. This view will have a single row selection and a button to delete, edit the current selected row in a popup Form and a insert button that will use the same Form as well. My question is how can I sync the pop Form with the current row? I tryied to use the RowStateChanged event to get and store the current selected Row to be used in the Form but I coudnt. After the event I get the row that was selected before. Other thing I dont understand yet in C# how to have a single recordSet and know wich is the current record even if its a new being inserted in a way that once in the Form all data being entered will show up at the same time in the DataGridView.

    Read the article

  • FASM vc MASM trasnlation problem in mov si, offset msg

    - by Ruben Trancoso
    hi folks, just did my first test with MASM and FASM with the same code (almos) and I falled in trouble. The only difference is that to produce just the 104 bytes I need to write to MBR in FASM I put org 7c00h and in MASM 0h. The problem is on the mov si, offset msg that in the first case transletes it to 44 7C (7c44h) and with masm translates to 44 00 (0044h)! but just when I change org 7c00h to org 0h in MASM. Otherwise it will produce the entire segment from 0 to 7dff. how do I solve it? or in short, how to make MASM produce a binary that begins at 7c00h as it first byte and subsequent jumps remain relative to 7c00h? .model TINY .code org 7c00h ; Boot entry point. Address 07c0:0000 on the computer memory xor ax, ax ; Zero out ax mov ds, ax ; Set data segment to base of RAM jmp start ; Jump to the first byte after DOS boot record data ; ---------------------------------------------------------------------- ; DOS boot record data ; ---------------------------------------------------------------------- brINT13Flag db 90h ; 0002h - 0EH for INT13 AH=42 READ brOEM db 'MSDOS5.0' ; 0003h - OEM name & DOS version (8 chars) brBPS dw 512 ; 000Bh - Bytes/sector brSPC db 1 ; 000Dh - Sectors/cluster brResCount dw 1 ; 000Eh - Reserved (boot) sectors brFATs db 2 ; 0010h - FAT copies brRootEntries dw 0E0h ; 0011h - Root directory entries brSectorCount dw 2880 ; 0013h - Sectors in volume, < 32MB brMedia db 240 ; 0015h - Media descriptor brSPF dw 9 ; 0016h - Sectors per FAT brSPH dw 18 ; 0018h - Sectors per track brHPC dw 2 ; 001Ah - Number of Heads brHidden dd 0 ; 001Ch - Hidden sectors brSectors dd 0 ; 0020h - Total number of sectors db 0 ; 0024h - Physical drive no. db 0 ; 0025h - Reserved (FAT32) db 29h ; 0026h - Extended boot record sig brSerialNum dd 404418EAh ; 0027h - Volume serial number (random) brLabel db 'OSAdventure' ; 002Bh - Volume label (11 chars) brFSID db 'FAT12 ' ; 0036h - File System ID (8 chars) ;------------------------------------------------------------------------ ; Boot code ; ---------------------------------------------------------------------- start: mov si, offset msg call showmsg hang: jmp hang msg db 'Loading...',0 showmsg: lodsb cmp al, 0 jz showmsgd push si mov bx, 0007 mov ah, 0eh int 10h pop si jmp showmsg showmsgd: retn ; ---------------------------------------------------------------------- ; Boot record signature ; ---------------------------------------------------------------------- dw 0AA55h ; Boot record signature END

    Read the article

  • Define DataSource bean on code

    - by Ruben Trancoso
    I would like to make a "First Access Database Setup Process" in my spring application and the only thing I can imagine as a solution would be to initialize the DataSource bean programatically. My current bean is defined as: <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/catalog" /> <property name="username" value="condominium" /> <property name="password" value="password" /> <property name="validationQuery" value="SELECT 1" /> <property name="testOnBorrow" value="true" /> <property name="defaultAutoCommit" value="false" /> <property name="maxWait" value="5000" /> </bean> but the ideal thing was to load it by myself in whenever I need it and with the parameter I define. The scenario is that the user (administrator) comes to the application at the first time and I ask him the server, port and catalog to connect. I store it in a embeeded db and next time application start, a bean can check if the parameter are set on the embedded db and load it again. Is it possible?

    Read the article

  • add row to a BindingSource gives different autoincrement value from whats saved into DB

    - by Ruben Trancoso
    I have a DataGridView that shows list of records and when I hit a insert button, a form should add a new record, edit its values and save it. I have a BindingSource bound to a DataGridView. I pass is as a parameter to a NEW RECORD form so // When the form opens it add a new row and de DataGridView display this new record at this time DataRowView currentRow; currentRow = (DataRowView) myBindindSource.AddNew(); when user confirm to save it I do a myBindindSource.EndEdit(); // inside the form and after the form is disposed the new row is saved and the bindingsorce position is updated to the new row DataRowView drv = myForm.CurrentRow; avaliadoTableAdapter.Update(drv.Row); avaliadoBindingSource.Position = avaliadoBindingSource.Find("ID", drv.Row.ItemArray[0]); The problem is that this table has a AUTOINCREMENT field and the value saved may not correspond the the value the bindingSource gives in EDIT TIME. So, when I close and open the DataGridView again the new rowd give its ID based on the available slot in the undelying DB at the momment is was saved and it just ignores the value the BindingSource generated ad EDIT TIME, Since the value given by the binding source should be used by another table as a foreingKey it make the reference insconsistent. There's a way to get the real ID was saved to the database?

    Read the article

  • Conversion type

    - by Ruben
    Hi, I've got the following question. I've got one class "Instellingen" that's a property in 3 other classes public class Instellingen { private int _ID; } public class Class1: Label { private Instellingen _Instellingen; } public class Class2 : Label { private Instellingen _Instellingen; } public class Class3 : Label { private Instellingen _Instellingen; } If I've got another class, that uses the other classes (but it can be anyone of this 3 classes) Do i have to use a switch? or is there an easier way? public class AnotherClass { public AnotherClass () { GetInstellingenFromClass(new Class1()); GetInstellingenFromClass(new Class2()); GetInstellingenFromClass(new Class3()); } private void GetInstellingenFromClass(Control c) { switch (c.GetType.ToString()) { case "Class1": Class1 klasse = (Class1) c; //Do something with the _Instellingen of this class break; case "Class2": Class2 klasse2 = (Class2) c; //Do something with the _Instellingen of this class break; case "Class3": Class3 klasse3 = (Class3)c; //Do something with the _Instellingen of this class break; } } } (does there exists something so i can just do something like c._Instellingen -- without converting it first to the right type, where it doesn't matter what type c is?) I hope you understand my question. Thanks

    Read the article

  • I can't Open my excel file in c#

    - by Ruben Guico
    Hi, Below is my code, i tried to open my excel file in my c# application but the program give's me an error message "Cannot Access "my excel.xls". But when I specify the file path in my string path variable it works, the problem is I need to get the file path from an openFileDialog. using System; using System.IO; using System.Collections.Generic; using System.Text; using System.Data; using System.Windows.Forms; using System.Data.OleDb; using System.Reflection; using MOIE = Microsoft.Office.Interop.Excel; using OFFICE = Microsoft.Office.Core; namespace EmpUploader { public class ExcelCon { private OleDbDataReader reader = null; private OleDbCommand excelCommand = new OleDbCommand(); private OleDbDataAdapter adapter = new OleDbDataAdapter(); private DataTable excelData = new DataTable(); private MOIE.ApplicationClass objExcel = new MOIE.ApplicationClass(); private MOIE.Workbook wb = null; private string myConn = ""; private string strSQL = ""; private string err = ""; private string path2 = ""; private int sheetCount = 0; private OleDbConnection Con = new OleDbConnection(""); #region "excel interop prarameters" private static object xl_missing = Type.Missing; private static object xl_true = true; private static object xl_false = false; private object xl_update_links = xl_missing; private object xl_read_only = xl_missing; private object xl_format = xl_missing; private object xl_password = xl_missing; private object xl_write_res_password = xl_missing; private object xl_ignore_read_only = xl_missing; private object xl_origin = xl_missing; private object xl_delimiter = xl_missing; private object xl_editable = xl_missing; private object xl_notify = xl_missing; private object xl_converter = xl_missing; private object xl_add_to_mru = xl_missing; private object xl_local = xl_missing; private object xl_corrupt_load = xl_missing; #endregion } //MY CODE FOR OPENING THE EXCEL //note that my file path came from an openfiledialog public void InitializeConnection(string path) { //connection string for excel myConn = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + path + "; Extended Properties =Excel 8.0"; Con.ConnectionString = myConn; Con.Open(); //this is the sample specified path that worked when i test my application //path = @"C:\shinetsu p5 emp list.xls"; objExcel.Visible = false; wb = objExcel.Workbooks.Open(path, xl_update_links, xl_read_only, xl_format, xl_password, xl_write_res_password, xl_ignore_read_only, xl_origin, xl_delimiter, xl_editable, xl_notify, xl_converter, xl_add_to_mru, xl_local, xl_corrupt_load); sheetCount = wb.Worksheets.Count; } }

    Read the article

  • 'e-Commerce' scalable database model

    - by Ruben Trancoso
    I would like to understand database scalability so I've just heard a talk about Habits of Highly Scalable Web Applications http://techportal.ibuildings.com/2010/03/02/habits-of-highly-scalable-web-applications/ On it, the presenter mainly talk about relational database scalability. I also have read something about MapReduce and Column oriented tables, big tables, hypertable etc... trying to understand which are the most up to date methods to scale web application data. But the second group, to me, is being hard to understand where it fits. It serves as transactional, reliable data store? or not, its just for large access and processing and to handle fine graned operations we will ever need to rely on RDBMSs? Could someone give a comprehensive landscape for those new technologies and how to use it?

    Read the article

  • Django does not load internal .css files

    - by Rubén Jiménez
    I have created a Django project in local which runs without any kind of problem. But, after an annoying and difficult Cherokee + uWSGI installation on Amazon AWS, my project does not show Django .css internal files. http://f.cl.ly/items/2Q2W3I3R0X1n2X3v0q2P/django_error.jpg <-- /Admin/ looks like The image is a screen of my /admin/, which should have a different style, but .css files are not loaded. [pid: 23206|app: 0|req: 19/19] 83.49.10.217 () {56 vars in 1121 bytes} [Sun Apr 15 05:50:24 2012] GET /static/admin/css/base.css = generated 2896 bytes in 6 msecs (HTTP/1.1 404) 1 headers in 51 bytes (1 switches on core 0) [pid: 23206|app: 0|req: 20/20] 83.49.10.217 () {56 vars in 1125 bytes} [Sun Apr 15 05:50:24 2012] GET /static/admin/css/login.css = generated 2899 bytes in 5 msecs (HTTP/1.1 404) 1 headers in 51 bytes (1 switches on core 0) This is a log from Cherokee. I don't understand why it is looking for the .css files in that path. Cherokee should be searching the files in Django original directory so i didn't change .css files in my project. Any advice? Thanks a lot.

    Read the article

  • log4net initialisation

    - by Ruben Bartelink
    I've looked hard for duplicates but have to ask the following, no matter how basic it may seem, to get it clear once and for all! In a fresh Console app using log4net version 1.2.10.0 on VS28KSP1 on 64 bit W7, I have the following code:- using log4net; using log4net.Config; namespace ConsoleApplication1 { class Program { static readonly ILog _log = LogManager.GetLogger(typeof(Program)); static void Main(string[] args) { _log.Info("Ran"); } } } In my app.config, I have: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> </configSections> <log4net> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="Program.log" /> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> <appendToFile value="true" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="10" /> <maximumFileSize value="1MB" /> <staticLogFileName value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="[%username] %date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /> </layout> </appender> <root> <level value="DEBUG" /> <appender-ref ref="RollingFileAppender" /> </root> </log4net> </configuration> This doesnt write anything, unless I either add an attribute: [ assembly:XmlConfigurator ] Or explicitly initialise it in Main(): _log.Info("This will not go to the log"); XmlConfigurator.Configure(); _log.Info("Ran"); This raises the following questions: I'm almost certain I've seen it working somewhere on some version of log4net without the addition of the assembly attribute or call in Main. Can someone assure me I'm not imagining that? Can someone please point me to where in the doc it explicitly states that both the config section and the initialisation hook are required - hopefully with an explanation of when this changed, if it did? I can easily imagine why this might be the policy -- having the initialisation step explicit to avoid surprises etc., it's just that I seem to recall this not always being the case... (And normally I have the config in a separate file, which generally takes configsections out of the picture)

    Read the article

  • Delete a Row from a DataGridView given its index

    - by Ruben Trancoso
    My DataGridView is a single line selection and theres a rowEnter Event where I get the line index every time the selected line changes. private void rowEnter(object sender, DataGridViewCellEventArgs e) { currentRowIndex = e.RowIndex; } when I press a delete button I use the same index to delete the row myDataSet.Avaliado.Rows[currentRowIndex].Delete(); avaliadoTableAdapter.Update(myDataSet.Avaliado); it works fine if no column in the DataGridView is sorted, otherwise a get an error. What should be the way to know the row index in the dataset that corresponds to the rowindex from the DataGridView?

    Read the article

  • Use different configurations with Simple Injection

    - by Ruben.Canton
    I'm using the library "Simple Injector" (http://simpleinjector.codeplex.com) and it looks cool and nice. But after building a configuration and use it, now I want to know how to change from one configuration to another. Scenario: Let's imagine I've set up a configuration in the Global Asax and I have the public and global Container there. Now I want to make some tests and I want them to use mock classes so I want to change the configuration. I can, of course, build another configuration and assign it to the global Container created by default, so that every time I run a test the alternative configuration will be set. But on doing that and though I'm in development context the Container is changed for everyone, even for normal requests. I know I'm testing in this context and that shouldn't matter, but I have the feeling that this is not the way for doing this... and I wonder how to change from one configuration to another in the correct way. Note: At Simple Injector documentation says that you can ask questions in stackoverflow so that's why I'm here. =P PD: I'm new in this IoC and DI world so try to be easy with me when explaining it :)

    Read the article

  • Get default value of class member ( C# )

    - by Ruben Aster
    Let's assume I have a class ClassWithMember class ClassWithMember { int myIntMember = 10; } How do I get the default value 10 of the myIntMember member by System.Type? I'm currently struggling around with reflections by all I retreive is the default value of int (0) not the classes default member (10)..

    Read the article

  • Android - Parsing XML with XPath

    - by Ruben Deig Ramos
    First of all, thanks to all the people who's going to spend a little time on this question. Second, sorry for my english (not my first language! :D). Well, here is my problem. I'm learning Android and I'm making an app which uses a XML file to store some info. I have no problem creating the file, but trying to read de XML tags with XPath (DOM, XMLPullParser, etc. only gave me problems) I've been able to read, at least, the first one. Let's see the code. Here is the XML file the app generates: <dispositivo> <id>111</id> <nombre>Name</nombre> <intervalo>300</intervalo> </dispositivo> And here is the function which reads the XML file: private void leerXML() { try { XPathFactory factory=XPathFactory.newInstance(); XPath xPath=factory.newXPath(); // Introducimos XML en memoria File xmlDocument = new File("/data/data/com.example.gps/files/devloc_cfg.xml"); InputSource inputSource = new InputSource(new FileInputStream(xmlDocument)); // Definimos expresiones para encontrar valor. XPathExpression tag_id = xPath.compile("/dispositivo/id"); String valor_id = tag_id.evaluate(inputSource); id=valor_id; XPathExpression tag_nombre = xPath.compile("/dispositivo/nombre"); String valor_nombre = tag_nombre.evaluate(inputSource); nombre=valor_nombre; } catch (Exception e) { e.printStackTrace(); } } The app gets correctly the id value and shows it on the screen ("id" and "nombre" variables are assigned to a TextView each one), but the "nombre" is not working. What should I change? :) Thanks for all your time and help. This site is quite helpful! PD: I've been searching for a response on the whole site but didn't found any.

    Read the article

< Previous Page | 1 2 3  | Next Page >