Search Results

Search found 34176 results on 1368 pages for 'project types'.

Page 83/1368 | < Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >

  • Enumerating all combinations of lists of different types

    - by jball
    Given two IEnumberables of different types, what is the best practice (considering readability and maintainability) for iterating over both lists to perform an action on all possible combinations? My initial solution was to use nested foreach loops, iterating over the first IEnumerable, and then within that loop, iterating over the second IEnumerable and passing the value from the outer and the current loop into the target method. Eg.: enum ParamOne { First, Second, Etc } List<int> paramTwo = new List<int>() { 1, 2, 3 }; void LoopExample() { foreach (ParamOne alpha in Enum.GetValues(typeof(ParamOne))) { foreach (int beta in paramTwo) { DoSomething(alpha, beta); } } } I tried to restructure it with LINQ, but ended up with something that had no obvious advantages and seemed less intuitive. A search here shows lots of questions about nesting foreachs to iterate over child properties, but I couldn't find anything about iterating over two distinct lists.

    Read the article

  • How to customize an OpenFileDialog using nested types?

    - by vitorbal
    Say I wanted to customize an OpenFileDialog and change, for example, the way the filter for file extensions work, as in the case of this question. After I pointed out to the author of said question that the OpenFileDialog is not inheritable, I got a comment with the following: Even though the OpenFileDialog is sealed (not inheritable), you may use it as a nested type. For instance, using a property that will get the NativeDialog. Then, you write your method always using the NativeDialog property and you're done. My question is, can someone provide me with an example code on how would I proceed on doing something like that? I'm kind of new to the concept of nested types so I'm having a hard time figuring that out by myself, and I searched around the web and couldn't find anything too concrete about it. Thanks!

    Read the article

  • Custom Data Types

    - by Tinkerer_CardTracker
    Hello, quick question: I'd like to create some custom data types, but I don't think I'm asking the right question(s). There are "compound Boolean" values used throughout .NET, and I want to design some of my own. I've been using a series of Boolean variables, which works, but just isn't the same. Examples from .NET include: Color.Black Alignment.Centered [fontProperties].Bold* *I forget the actual name, but you get the idea I want to make something like this: ColorSortQualities None DistinguishColor DistinguishNumberOfColors DistinguishColorPattern Once that's been declared, I could do this: if(searchOptions.ColorSortQualities == DistinguishColor) [do stuff] What is this called? Thanks!

    Read the article

  • Why is Decimal('0') > 9999.0 True in Python?

    - by parxier
    This is somehow related to my question Why is ''0 True in Python? In Python 2.6.4: >> Decimal('0') > 9999.0 True From the answer to my original question I understand that when comparing objects of different types in Python 2.x the types are ordered by their name. But in this case: >> type(Decimal('0')).__name__ > type(9999.0).__name__ False Why is Decimal('0') > 9999.0 == True then? UPDATE: I usually work on Ubuntu (Linux 2.6.31-20-generic #57-Ubuntu SMP Mon Feb 8 09:05:19 UTC 2010 i686 GNU/Linux, Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) [GCC 4.4.1] on linux2). On Windows (WinXP Professional SP3, Python 2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit (Intel)] on win32) my original statement works differently: >> Decimal('0') > 9999.0 False I even more puzzled now. %-(

    Read the article

  • error: incompatible types in assignment

    - by ambika
    My C code #include <stdio.h> #include <stdlib.h> #include "help.h" int test(int x, P *ut) { int point = 10; ut->dt[10].max_x = NULL; } int main(int argc, char** argv) { return (EXIT_SUCCESS); } my help.h file code typedef struct{ double max_x; double max_y; }X; typedef struct{ X dt[10]; }P; I got an error i.e error: incompatible types in assignment error comes in here ut->dt[10].max_x = NULL; can anybody help me. thanks in advance.

    Read the article

  • Arrays of different types

    - by Tyler
    Hi - Is it possible to have an array that contains two different types of data? I want to have an array that contains a double and also a string. I attempted: ArrayList<double><String> array; But that didn't work. Sorry for the silly question, but it has been a while since I have used something like this.. Can you refresh my memory on how would I declare and populate such an array? And then to take it a step further, I would like to sort the array by the double if possible? Thanks!

    Read the article

  • dozer custom convertors for primitive types

    - by koti
    the below url has an example on dozer custom convertors.. http://stackoverflow.com/questions/1931212/map-collection-size-in-dozer but when i tried that example its giving the exception like this.. Type: null Source parent class: dozerPackage.Source Source field name: images Source field type: class java.util.ArrayList Source field value: [www, eee] Dest parent class: dozerPackage.Destination Dest field name: numOfImages Dest field type: int org.dozer.MappingException: Destination Type (int) is not accepted by this Custom Converter (dozerPackage.TestCustomFieldConverter)! is there any way that i can return the primitive types from dozer custom convertors..

    Read the article

  • C++ visitor pattern handling templated string types?

    - by Steve the Plant
    I'm trying to use the visitor pattern to serialize the contents of objects. However one snag I'm hitting is when I'm visiting strings. My strings are of a templated type, similar to STL's basic_string. So something like: basic_string<char_type, memory_allocator, other_possible_stuff> \\ many variations possible! Since I can have very many different templated string types, I can't go and add them to my visitor interface. It would be ridiculous. But I can't add templates to my VisitString method because C++ prevents using templates parameters in virtual methods. So what are my options to work around this?

    Read the article

  • iPhone noob - different method types?

    - by codemonkey
    My apologies in advance for what is probably a really dumb question. I'm familiar (or at least getting familiar) with instance and class methods in objective-c, but have also seen method implementations that look like this: #import "Utilities.h" #import "CHAPPAppDelegate.h" #import "AppState.h" @implementation Utilities CHAPPAppDelegate* GetAppDelegate() { return (CHAPPAppDelegate *)[UIApplication sharedApplication].delegate; } AppState* GetAppState() { return [GetAppDelegate() appState]; } @end What are these? While I'm sure this is documented somewhere, I don't know what term to use in searching for an explanation of what's being done here. I like the syntax methods like this let me use when calling them, but I'm not sure exactly what I'm doing, what the implications are, how to send parameters to these types of functions, etc? To clarify how I ended up in this position, I started using these methods in a "utilities" class of mine after reading some online blog describing the author's preference for declaring these functions this way. Now I can't seem to track down a more detailed explanation of what exactly the differences are, etc.

    Read the article

  • Anonymous types based in Interface

    - by Bhaskar
    Can I create anonymous implementations of an interface , in a way similar to the way delegate() { // type impl here , but not implementing any interface} Something on the lines of new IInterface() { // interface methods impl here } The situations where I see them to be useful are for specifying method parameters which are interface types, and where creating a class type is too much code. For example , consider like this : public void RunTest() { Cleanup(delegate() { return "hello from anonymous type"; }); } private void Cleanup(GetString obj) { Console.WriteLine("str from delegate " + obj()); } delegate string GetString(); how would this be achieved if in the above code , the method Cleanup had an interface as a parameter , without writing a class definition ? ( I think Java allows expressions like new Interface() ... )

    Read the article

  • Getting all types from an assembly derived from a base class

    - by CaptnCraig
    I am trying to examine the contents of an assembly and find all classes in it that are directly or indirectly derived from Windows.Forms.UserControl. I am doing this: Assembly dll = Assembly.LoadFrom(filename); var types = dll.GetTypes().Where(x => x.BaseType == typeof(UserControl)); But it is giving an empty list because none of the classes directly extend UserControl. I don't know enough about reflection to do it quickly, and I'd rather not write a recursive function if I don't have to.

    Read the article

  • Behavior with primitive data types' value out of range & C99's PRI* macros

    - by Yktula
    Say we have an 8-bit unsigned integer n (UINT8_MAX=255); what is the behavior of the compiler for n=256? Where can I find a table of default behavior when the value of a data type is out of range for different data types? Is there a pattern to how they behave when set out of range? #include <stdio.h> #include <inttypes.h> uint8_t n = UINT8_MAX; int main() { printf("%hhu ",n++); printf("%hhu",n); return 0; } Compiling with gcc -std=c99 -Wall *.c, this prints: 255 0 Also, is it acceptable to use C99's PRI* macros? How are they named?

    Read the article

  • Inheritance vs specific types in Financial Modelling for cashflows

    - by BlueTrin
    Hello, I have to program some financial applications where I have to represent a schedule of flows. The flows can be of 3 types: - fee flow (just a lump payment at some date) - floating rate flow (the flow is dependant of an interest rate to be determined at a later date) - fixed rate flow (the flow is dependant of an interest rate determined when the deal is done) I need to keep the whole information and I need to represent a schedule of these flows. Originally I wanted to use inheritance and create three classes FeeFlow, FloatingFlow, FixedFlow all inheriting from ICashFlow and implement some method GetFlowType() returning an enum then I could dynamic_cast the object to the correct type. That would allow me to have only one vector to represent my schedule. What do you think of this design, should I rather use three vectors vector, vector and vector to avoid the dynamic casts ?

    Read the article

  • parsing primitive types using java.util.Scanner

    - by Rich Fluckiger
    I'm new to java so forgive the noob question. I have created a swing application that basically has three input strings in JTextFields: loanAmount, interestRate and loanYears and a single submit button with the EventAction. I'm trying to use the java.util.Scanner to parse the input to primitive types that I can use in calculations. I'm getting an error in NetBeans indicating that my variables are not recognized? should I not be calling System.in? private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) { Scanner keyInput = new Scanner(System.in); while (true) try{ double amount = keyInput.nextDouble(loanAmount.getText()); double interest = keyInput.nextDouble(interestRate.getText()); int years = keyInput.nextInt(loanYears.getText()); } catch (NumberFormatException nfe){ } }

    Read the article

  • Visual C++ 2008 doesn't recognize Windows declared types

    - by David Thornley
    I have a program that doesn't seem to recognize declared types in the latest U3D software. There's a line typedef BOOL (WINAPI* GMI)(HMON, LPMONITORINFOEX); which gets the error: Error 1 error C2061: syntax error : identifier 'LPMONITORINFOEX' c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 28 and a line MONITORINFOEX miMon; which gets Error 5 error C2065: 'miMon' : undeclared identifier c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 49 Error 3 error C2065: 'MONITORINFOEX' : undeclared identifier c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 49 The program's first non-comment statement is #include <windows.h>, which includes winuser.h, which defines these identifiers. In Visual Studio, I can right-click on them and go to the definition (a typedef) and from the typedef to the struct. WINAPI is defined in WinDef.h, so that seems to be working. There are no redefinitions of LPMONITORINFOEX or MONITORINFOEX in any other file. So, how can this be happening, and what can I do about it?

    Read the article

  • Ruby on Rails: restrict file type with Paperclip using a flash uploader

    - by aperture
    I have a pretty basic Paperclip Upload model that is attached to a User model through has_many, and am using Uploadify to do the actual uploading. Flash sends all files with the content type of "application/octet-stream" so using validates_attachment_content_type rejects all files. In my create action, I am able to get the mime-type from the original file name, but only after it's been saved, with: def coerce(params) h = Hash.new h[:upload] = Hash.new h[:upload][:attachment].content_type = MIME::Types.type_for(h[:upload][:attachment].original_filename).to_s ... end and def create diff_params = coerce(params) @upload = Upload.new(diff_params[:upload]) ... end What would be the best way of white listing file types? I am thinking a before_validation method, but I'm not sure how that would work. Any ideas would be welcome.

    Read the article

  • Autocomplete for generic types in Eclipse

    - by AvrDragon
    "Refer to objects by their interfaces" is a good practise, as mentioned in Effective Java. So for example i prefer List<String> al = new ArrayList<String>(); over ArrayList<String> al = new ArrayList<String>(); in my code. One annoying thing is that if i type ArrayList<String> al = new and then hit Ctrl+Space in Eclipse i get ArrayList<String>() as propostal. But if i type List al = new and then hit Ctrl+Space i will get only propostal to define anonymous inner class, but not propostals such as new ArrayList<String>(), what is 99% the case, or for example new Vector<String>(). Is there any way to get the subclasses as propostals for generic types?

    Read the article

  • What is the pythonic way to add type information to an object's attributes?

    - by Tikitu
    I'm building classes where I know the types of the attributes, but Python of course doesn't. While it's un-pythonic to want to tell it, supposing I do want to, is there an idiomatic way to do so? Why: I'm reading in serialised data (without type information) involving objects-nested-inside-objects. It's easy to put it into nested dictionaries, but I want it in objects of my class-types, to get the right behaviours as well as the data. For instance: suppose my class Book has an attribute isbn which I will fill with an ISBNumber object. My serialised data gives me the isbn as a string; I would like to be able to look at Book and say "That field should be filled by ISBNumber(theString)." Bonus glee for me if the solution can be applied to classes I get from someone else without editing their code.

    Read the article

  • Covariant return types in Java enums

    - by Kelvin Chung
    As mentioned in another question on this site, something like this is not legal: public enum MyEnum { FOO { public Integer doSomething() { return (Integer) super.doSomething(); } }, BAR { public String doSomething() { return (String) super.doSomething(); } }; public Object doSomething(); } This is due to covariant return types apparently not working on enum constants (again breaking the illusion that enum constants are singleton subclasses of the enum type...) So, how about we add a bit of generics: is this legal? public enum MyEnum2 { FOO { public Class<Integer> doSomething() { return Integer.class; } }, BAR { public Class<String> doSomething() { return String.class; } }; public Class<?> doSomething(); } Here, all three return Class objects, yet the individual constants are "more specific" than the enum type as a whole...

    Read the article

  • user specific persistent cck types in drupal

    - by Fion
    Is there a way to do the following. We need to have a few basic cck types that will allow users to track their chosen parameters over a length of time. For example, one cck type may be called "numeric tracker" It would have a field for labeling the type and a field for entering a number. User A might label one numeric tracker "miles driven". Then each day user A would use this type to enter a number. User B might label a numeric tracker "hours slept". Each day user B would enter a number. Is there a way to use cck in this way?

    Read the article

  • Get all descendants types of base class

    - by user1260827
    I have a base class called BaseEvent and several descendants classes: public class BaseEvent { // the some properties ... } [MapInheritance(MapInheritanceType.ParentTable)] public class Film : BaseEvent { // the some properties ... } [MapInheritance(MapInheritanceType.ParentTable)] public class Concert : BaseEvent { // the some properties ... } I have a code which create the BaseEvent instance at runtime: BaseEvent event = new BaseEvent(); //assign values for a properties ... baseEvent.XPObjectType = Database.XPObjectTypes.SingleOrDefault(t => t.TypeName == "MyApp.Module.BO.Events.BaseEvent"); Now, this event will be shows in BaseEvent list view. I want to do the following: when a user click Edit button then show in list view lookup field with all descendants types. And when user saves record change ObjectType to selected value. How can I do this? Thanks. PS. this is asp.net app.

    Read the article

  • uploading different types of files mostly pdfs

    - by Anders Kitson
    I would like to upload different types of files pressumably pdfs to a certain directory I am currently trying to get this one script working that I found on snipplr but it is not working as I assumed it would, here is my code. <?php if( isset($_POST['submit']) ) { $target_path = "../downloads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name'])." has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } } ?> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data"> <input type="file"> <input type="submit" name="submit" value="submit" /> </form>

    Read the article

  • C++ conversion operator between types in other libraries

    - by Dave
    For convenience, I'd like to be able to cast between two types defined in other libraries. (Specifically, QString from the Qt library and UnicodeString from the ICU library.) Right now, I have created utility functions in a project namespace: namespace MyProject { const icu_44::UnicodeString ToUnicodeString(const QString& value); const QString ToQString(const icu_44::UnicodeString& value); } That's all well and good, but I'm wondering if there's a more elegant way. Ideally, I'd like to be able to convert between them using a cast operator. I do, however, want to retain the explicit nature of the conversion. An implicit conversion should not be possible. Is there a more elegant way to achieve this without modifying the source code of the libraries? Some operator overload syntax, perhaps?

    Read the article

  • 404 on custom post types after updating Wordpress to 3.7

    - by Chris
    Since I updated Wordpress from 3.6 to 3.7, I'm not able to visit the single-pages on my custom post types, then I get a 404 error. I thought this would be a rewrite_rules issue, so I've tried the following: -Go to the Permalink settings, click save (flush rewrites) -Manually deleted the rewrite_rules from the option table in the DB (I was desparate, and it seriously worked for me one time) -Re-check my .htaccess, but this is the exactly same as instructed on the permalink page -switched off the plugins I also tried switching the permalink to the "ugly" url (eg. ?page=35) and check if the articles worked, and they did! So I'm pretty sure it's a permalink issue. Now I rolled back to 3.6 again, but I of course want to upgrade in the near future (security etc.). A remarkable thing was that during the rollback I checked out a single page (notice that I didn't rolled back the database yet, only the files) and surprisingly they worked again. Any suggestions on how to solve this?

    Read the article

  • gmaps Address Component Types get country name

    - by gmapsuser
    hi .. iam trying to get the country name using the Address Component Types available from gmaps V3. i dont know how i can get it the right way.. http://code.google.com/apis/maps/documentation/javascript/services.html#GeocodingAddressTypes iam trying to alert the country name liks here : alert(results[1].address_component[country]); and here`s the code.. any help is really appreciated..thanks function codeLatLng() { var input = document.getElementById("latlng").value; var latlngStr = input.split(",",2); var lat = parseFloat(latlngStr[0]); var lng = parseFloat(latlngStr[1]); var latlng = new google.maps.LatLng(lat, lng); if (geocoder) { geocoder.geocode({'latLng': latlng}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { alert(results[1].address_component[country]); } else { alert("No results found"); } } else { alert("Geocoder failed due to: " + status); } }); } }

    Read the article

< Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >