Search Results

Search found 3536 results on 142 pages for 'vendor prefix'.

Page 7/142 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • UpdateModel prefix - ASP.NET MVC

    - by Kristoffer Ahl
    I'm having trouble with TryUpdateModel(). My form fields are named with a prefix but I am using - as my separator and not the default dot. <input type="text" id="Record-Title" name="Record-Title" /> When I try to update the model it does not get updated. If i change the name attribute to Record.Title it works perfectly but that is not what I want to do. bool success = TryUpdateModel(record, "Record"); Is it possible to use a custom separator?

    Read the article

  • Dialing a command prefix on the iPhone

    - by tewha
    Our application lets users call phone numbers. Users would like to be able to block their caller ID. On other platforms, we let the user specify a custom dialing prefix. For instance, on my cell provider it's #31#. I've tried two approaches so far. First: id url = [NSURL URLWithString: @"tel:#31#0000000"] // produces nil Second: id encoder = ["#31#0000000" stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; // produces %2331%230000000 id url = [NSURL URLWithString: [NSString stringWithFormat: @"tel:%@", encoded]]; // produces a valid-looking NSURL which doesn't do anything I'm thinking at this point that I'm just not allowed to dial # and *, even from a Cocoa touch application. (I know it's not allowed from a web app.) Is this true, or am I missing something obvious?

    Read the article

  • Why use I-prefix for interfaces in Java?

    - by Lars Andren
    Is there some reason why people use I-prefix for interfaces in Java? It seems to be a C#-convention spilling over. For C# it makes sense, as the answers to this question explains. However, for Java a class declaration clearly states which class that is extended and which interfaces that are implemented: public class Crow extends Animal implements Bird I think Joshua Bloch didn't suggest this in Effective Java, and I think he usually makes a lot of sense. I get the I-verbing as presented in an answer to the question above, but is there some other use with this convention for Java?

    Read the article

  • Authlogic OpenID integration

    - by Craig
    I'm having difficulty getting OpenId authentication working with Authlogic. It appears that the problem arose with changes to the open_id_authentication plugin. From what I've read so far, one needs to switch from using gems to using plugins. Here's what I done thus far to get Authlogic-OpenID integration working: Removed relevant gems: authlogic authlogic-oid rack-openid ruby-openid * Installed, configured, and started the authlogic sample application (http://github.com/binarylogic/authlogic_example)--works as expected. This required: installing the authlogic (2.1.3) gem ($ sudo gem install authlogic) adding a dependency (config.gem "authlogic") to the environment.rb file. added migration to add open-id support to User model; ran migration; columns added as expected made changes to the UsersController and UserSessionsController to use blocks to save each. made changes to new user-sessions view to support open id (f.text_field :openid_identifier) installed open_id_authentication plugin ($ script/plugin install git://github.com/rails/open_id_authentication.git) installed the authlogic-oid plugin ($ script/plugin install git://github.com/binarylogic/authlogic_openid.git) installed the plugin ($ script/plugin install git://github.com/glebm/ruby-openid.git) restarted mongrel (CTRL-C; $ script/server) Mogrel failed to start, returning the following error: /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- rack/openid (MissingSourceFile) from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/plugins/open_id_authentication/lib/open_id_authentication.rb:3 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/plugins/open_id_authentication/init.rb:5:in `evaluate_init_rb' from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:146:in `evaluate_init_rb' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings' from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:142:in `evaluate_init_rb' from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:48:in `load' from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:38:in `load_plugins' from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `each' from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:37:in `load_plugins' from ./script/../config/../vendor/rails/railties/lib/initializer.rb:348:in `load_plugins' from ./script/../config/../vendor/rails/railties/lib/initializer.rb:163:in `process' from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `send' from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run' from /Users/craibuc/NetBeansProjects/authlogic_example/config/environment.rb:13 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' from /Users/craibuc/NetBeansProjects/authlogic_example/vendor/rails/railties/lib/commands/server.rb:84 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from script/server:3 I suspect this is related the rack-openid gem, but as it was dependent upon the ruby-openid gem, it was removed when the ruby-openid gem was removed. Perhaps this can be installed as a plugin. Any assistance with this matter is greatly appreciated--I'm just about to give up on OpenId integration. * ruby-openid (2.1.2) is installed at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8. I'm not certain if this is affecting anything. In any case, I'm not sure how to uninstall it or if I should. ** edit ** It appears that there are a number of gems in the /Library/Ruby/Gems/1.8/gems directory that may be causing an issue: authlogic-oid (1.0.4) rack-openid (1.0.3) ruby-openid (2.1.7) Questions: - why doesn't the gem list command list these gems? - Why doesn't the gem uninstall command remove these gems?

    Read the article

  • Using LINQ to find a common prefix?

    - by Roger Lipscombe
    I've got two sequences: IEnumerable<string> x = new[] { "a", "b", "c" }; IEnumerable<string> y = new[] { "a", "b", "d", "e" }; I'd like to find the common prefix of these two sequences (i.e. "a", "b"). Is there a succinct way to do this in LINQ? Bear in mind that these aren't really IEnumerable<string>; they're IEnumerable<PathComponent>, where I have an implementation of IEqualityComparer<PathComponent>.

    Read the article

  • How to use Bind Prefix?

    - by chobo2
    Hi Say if I had this table in my db: Product It had ProductId ProductName ProductType Now for whatever reason I can't name my textboxes ProductName and ProductType so now my View Method would look like this public ViewResult Test([Bind(Exclude ="ProductId")] Product) So now through my playing around nothing would be matched in this product since they have different names. So I guess this is where Prefix would come in but I don't know how to use it. Nor how do I use it and Exclude at the same time. Can someone give me an example?

    Read the article

  • Single-letter prefix for PHP class constants?

    - by keithjgrant
    I've noticed many (all?) PHP constants have a single-letter prefix, like E_NOTICE, T_STRING, etc. When defining a set of class constants that work in conjunction with one another, do you prefer to follow similar practice, or do you prefer to be more verbose? class Foo { // let's say 'I' means "input" or some other relevant word const I_STRING = 'string'; const I_INTEGER = 'integer'; const I_FLOAT = 'float'; } or class Bar { const INPUT_STRING = 'string'; const INPUT_INTEGER = 'integer'; const INPUT_FLOAT = 'float'; }

    Read the article

  • Specify test method name prefix for test suite in junit 3

    - by Marko Kocic
    Is it possible to tell JUnit 3 to use additional method name prefix when looking up test method names? The goal is to have additional tests running locally that should not be run on continuous integration server. CI server doesn't use test suites, it look up for all classes which name ends with "Test" and execute all methods that begins with "test". The goal is to be able to locally run not only tests run by integration server, but also tests which method name starts with, for example "nocitest" or something like that. I don't mind having to organize tests into tests suite locally, since CI is just ignoring them.

    Read the article

  • Automatically Add a Prefix to Column Names for @Embeddable Classes

    - by VeeArr
    I am developing a project in which I am persisting some POJOs by adding Hibernate annotations. One problem I am running into is that code like this fails, as Hibernate tries to map the sub-fields within the Time_T onto the same column (i.e. startTime.sec and stopTime.sec both try to map to the colum sec, causing an error). @Entity public class ExampleClass { @Id long eventId; Time_T startTime; Time_T stopTime; } @Embeddable public class Time_T { int sec; int nsec; } As there will be many occurrences like this throughout the system, it would be nice if there was an option to automatically append a prefix to the column name (e.g. make the columns be startTime_sec, startTime_nsec, stopTime_sec, stopTime_nsec), without having to apply overrides on a per-field basis. Does Hibernate have this capability, or is there any other reasonable work-around?

    Read the article

  • How to get the next prefix in C++?

    - by Vicente Botet Escriba
    Given a sequence (for example a string "Xa"), I want to get the next prefix in order lexicographic (i.e "Xb"). As I don't want to reinvent the wheel, I'm wondering if there is any function in C++ STL or boost that can help to define this generic function easily? If not, do you think that this function can be useful? Notes The next of "aZ" should be "b". Even if the examples are strings, the function should work for any Sequence. The lexicographic order should be a template parameter of the function.

    Read the article

  • Getting country calling prefix

    - by Telkitty
    Just wondering whether there are easy ways to retrieve country calling code from a user's phone. For example, my app would like to pre-fill country calling code for the users. If the user is located in the U.S. the code +1 will be returned, +83 for China, +61 for Australia etc. I had a look around but I could only see: NSLocale *locale = [NSLocale currentLocale]; NSString *countryCode = [locale objectForKey: NSLocaleCountryCnode]; Which returns the abbreviation for the country code, not the calling prefix? Help is appreciated!

    Read the article

  • How do I get the namespace prefix?

    - by 1.21 gigawatts
    Is there a way to get the namespace prefix from a class or class instance (an object not XML)? For example, in MXML you could declare something as s:Button or local:MyComponent. Is there some call or approach that will return the "s" or "local" value when given the object? For example, if I have the class TextInput and I wanted to show the style inheritance at runtime I could do something like this: s|TextInput { fontFamily:Arial; } s|TextArea#myTextArea { color:red; } local|MyComponent.myBoldStyle { fontWeight: bold; }

    Read the article

  • Language/tech specific books which improve vendor-neutral development skills

    - by dotnetdev
    If I ask what the following books have in common: "Accelerated C# 2010, C# in Depth, Pro C# 2008", the answer would be that they would help me to improve my understanding of C# and secondly, my general coding skills. What language-specific/tech-specific books (like those named above) would teach me a great deal about general programming techniques and good habits? I'm thinking Java books would be very good for me (I code in C# primarily), as both these languages are similar and so I am sure that specialist books on Java threading, performance tuning, etc, can be applied to C# (not all 100% content of a Java book). Thanks

    Read the article

  • How to use Vendor Properties in Multiple Backgrounds?

    - by barraponto
    I want to use multiple backgrounds in css, which are currently supported by Firefox 3.61, Chrome/Safari, supposedly Opera10.5 (doesn't run on gnu/linux). It is working fine, however i would like to use linear-gradients as a background. it works ok for Firefox, doesn't work at all with Chrome, yet i can't figure out how to make it work for both at the same time. any clues? http://snook.ca/archives/html_and_css/multiple-bg-css-gradients came the closest to match what i need, but i couldn't get it to work with chrome yet.

    Read the article

  • Problem on getting the vendor id and product id of a usb device

    - by new
    Hi... my application comes and prints this "\?\usb#vid_04f2&pid_0111#5&1ba5a77f&0&2#{a5dcbf1 0-6530-11d2-901f-00c04fb951ed}" again it goes to while loop .... here it gets breaked in the else statement... Qt Code: if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { // Change the buffer size. if (buffer) LocalFree(buffer); buffer = (LPTSTR)LocalAlloc(LPTR,buffersize); } else { qDebug ()<<"Here it quits the application"; // Insert error handling here. break; } Any ideas in this.... full source code comes here static GUID GUID_DEVINTERFACE_USB_DEVICE = { 0xA5DCBF10L, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } }; HANDLE hInfo = SetupDiGetClassDevs(&GUID_DEVINTERFACE_USB_DEVICE,NULL,NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE); if ( hInfo == INVALID_HANDLE_VALUE ) { qDebug ()<<"invalid"; } else { qDebug ()<<"valid handle"; SP_DEVINFO_DATA DeviceInfoData; DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); SP_INTERFACE_DEVICE_DATA Interface_Info; Interface_Info.cbSize = sizeof(Interface_Info); BYTE Buf[1024]; DWORD i; DWORD InterfaceNumber= 0; PSP_DEVICE_INTERFACE_DETAIL_DATA pspdidd = (PSP_DEVICE_INTERFACE_DETAIL_DATA) Buf; for (i=0;SetupDiEnumDeviceInfo(hInfo,i,&DeviceInfoData);i++) { DWORD DataT; LPTSTR buffer = NULL; DWORD buffersize = 0; while (!SetupDiGetDeviceRegistryProperty( hInfo, &DeviceInfoData,SPDRP_DEVICEDESC, &DataT,(PBYTE)buffer,buffersize, &buffersize)) { if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { // Change the buffer size. if (buffer) LocalFree(buffer); buffer = (LPTSTR)LocalAlloc(LPTR,buffersize); } else { // Insert error handling here. break; } qDebug ()<<(TEXT("Device Number %i is: %s\n"),i, buffer); if (buffer) LocalFree(buffer); if ( GetLastError() != NO_ERROR && GetLastError() != ERROR_NO_MORE_ITEMS ) { // Insert error handling here. qDebug ()<<"return false"; } InterfaceNumber = 0; // this just returns the first one, you can iterate on this if (SetupDiEnumDeviceInterfaces(hInfo, NULL, &GUID_DEVINTERFACE_USB_DEVICE, InterfaceNumber, &Interface_Info)) { printf("Got interface"); DWORD needed; pspdidd->cbSize = sizeof(*pspdidd); SP_DEVICE_INTERFACE_DETAIL_DATA *pDetData = NULL; DWORD dwDetDataSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA) + 256; pDetData = (SP_DEVICE_INTERFACE_DETAIL_DATA*) malloc (dwDetDataSize); pDetData->cbSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA); SetupDiGetDeviceInterfaceDetail(hInfo,&Interface_Info, pDetData,dwDetDataSize, NULL,&DeviceInfoData); qDebug ()<<pDetData->DevicePath; qDebug ()<<QString::fromWCharArray(pDetData->DevicePath); free(pDetData); } else { printf("\nNo interface"); //ErrorExit((LPTSTR) "SetupDiEnumDeviceInterfaces"); if ( GetLastError() == ERROR_NO_MORE_ITEMS) printf(", since there are no more items found."); else printf(", unknown reason."); } // Cleanup SetupDiDestroyDeviceInfoList(hInfo); } } }

    Read the article

  • Test For CSS3 Radial Gradient Vendor Syntax

    - by Scott Christopherson
    I'm having an issue where I'm trying to update the background gradient of an element with JavaScript based on values I specify. I tried this route: elem.style.backgroundImage = '-webkit-gradient(radial, '+x+' '+y+', 0, '+x+' '+y+', 800, from(#ccc), to(#333)), -moz-radial-gradient('+x+'px '+y+'px, circle cover, #ccc 0, #333 100%)'; Since Webkit and Gecko have two different syntaxes for CSS3 gradients, I need to specify both. However, the above code doesn't work. It works if I only have just the Gecko syntax or just the Webkit syntax, not both. I think you can check for CSS gradient support, but my question is, is there a way to check which syntax needs to be used without browser sniffing? Keep in mind that I need to set my gradients this way since the x and y coordinates of the gradient change dynamically. Hope this makes sense, thanks.

    Read the article

  • Prefix for element not bound

    - by Tim
    Hello! I am a newbie in Flex development and using Flash Builder 4 with SDK 4. Now I get the error that "the prefix "fx" for element "fx:Style" is not bound" in line number 4. I searched for it, and it has sth. to do with namespaces, but I can not solve it by myelf. I have the file called "UserStory.mxml" in the directory "components" to place it via the main.mxml onto the screen: <fx:Script> <![CDATA[ import components.UserStory; private function init():void { var userStory1:UserStory = new UserStory(); userStory1.x = 100; userStory1.y = 100; userStory1.userStoryText = "test"; this.addChild(userStory1); } ]]> </fx:Script> The file in which the error occurs in line no. 4: <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="300" height="150" styleName="userstory"> <fx:Style source="styles/styles.css"/> <fx:Text x="5" y="5" width="275" height="135" text="{userStoryText}" fontFamily="notes" fontSize="18"/> <mx:Script> ... </mx:Script> </mx:Canvas> Can someone tell me what's wrong? Thanks a lot in advance & Best Regards.

    Read the article

  • Row Prefix - ItemsControl with UniformGrid

    - by tenfour
    I am using an ItemsControl to display a List<byte> in hex. The ItemsPanelTemplate is a UniformGrid with a fixed number of columns: <ItemsControl HorizontalAlignment="Left" VerticalAlignment="Top" ItemsSource="{Binding}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Columns="16"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding StringFormat='\{0:X2\}'}" Margin="5,5,5,0"/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> I'd like to prefix each row with an 'Address' column, just like you'd see with the Notepad++ 'HEX-Editor' plugin. That is, since I have 16 columns, each row should be prefixed something like this: 0000 [00 01 02 .... 0F] 0010 [10 11 12 .... 1F] 0020 [20 21 22 .... 2F] ... Any suggestions?

    Read the article

  • This page calls for XML namespace declared with prefix br but no taglibrary exists

    - by Christopher W. Allen-Poole
    I just finished the Netbeans introduction to Hibernate tutorial ( http://netbeans.org/kb/docs/web/hibernate-webapp.html#01 ) and I am getting the following error: "This page calls for XML namespace declared with prefix br but no taglibrary exists" Now, I have seen a similar question somewhere else: http://forums.sun.com/thread.jspa?threadID=5430327 but the answer is not listed there. Or, if it is, then I am clearly missing it -- line one of my index.xhtml file reads "http://www.w3.org/1999/xhtml". It also does not explain why, when I reload localhost:8080, the message disappears. Here is my index.xhtml file: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"> <ui:composition template="./template.xhtml"> <ui:define name="body"> <h:form> <h:commandLink action="#{filmController.previous}" value="Previous #{filmController.pageSize}" rendered="#{filmController.hasPreviousPage}"/> <h:commandLink action="#{filmController.next}" value="Next #{filmController.pageSize}" rendered="#{filmController.hasNextPage}"/> <h:dataTable value="#{filmController.filmTitles}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px"> <h:column> <f:facet name="header"> <h:outputText value="Title"/> </f:facet> <h:outputText value="#{item.title}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Description"/> </f:facet> <h:outputText value="#{item.description}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value=" "/> </f:facet> <h:commandLink action="#{filmController.prepareView}" value="View"/> </h:column> </h:dataTable> <br/> </h:form> </ui:define> </ui:composition> </html>

    Read the article

  • How to do a search from a list with non-prefix keywords

    - by aNui
    First of all, sorry if my english or my post got any mistakes. I am programming a program to search the name from the list and I need to find them if the keyword is not in front of the names (that's what I mean non-prefix) e.g. if I my list is the music instruments and I type "guit" to the search textbox. It should find the names "Guitar, Guitarrón, Acoustic Guitar, Bass Guitar, ..." or something like this Longdo Dictionary's search suggestion. here is my simple and stupid algorithm (that's all I can do) const int SEARCHROWLIMIT = 30; private string[] DoSearch(string Input, string[] ListToSearch) { List<string> FoundNames = new List<string>(); int max = 0; bool over = false; for (int k = 0; !over; k++) { foreach (string item in ListToSearch) { max = (max > item.Length) ? max : item.Length; if (k > item.Length) continue; if (k >= max) { over = true; break; } if (!Input.Equals("Search") && item.Substring(k, item.Length - k).StartsWith(Input, StringComparison.OrdinalIgnoreCase)) { bool exist = false; int i = 0; while (!exist && i < FoundNames.Count) { if (item.Equals(FoundNames[i])) { exist = true; break; } i++; } if (!exist && FoundNames.Count < SEARCHROWLIMIT) FoundNames.Add(item); else if (FoundNames.Count >= SEARCHROWLIMIT) over = true; } } } return FoundNames.ToArray(); } I think this algorithm is too slow for a large number of names and after several trial-and-error, I decided to add SEARCHROWLIMIT to breaks the operation And I also think there're some readymade methods that can do that. And another problem is I need to search music instruments by a category like strings, percussions, ... and by the country of origins. So I need to search them with filter by type and country. please help me. P.S. Me and my friends are just student from Thailand and developing the project to compete in Microsoft Imagine Cup 2010 and please become fan on our facebook page [KRATIB][3]. And we're so sorry we don't have much information in English but you can talk to us in English.

    Read the article

  • How to do a search from a list with non-prefix keywords[Solved]

    - by aNui
    The Problem is Solved. Thanks for every answers. First of all, sorry if my english or my post got any mistakes. I am programming a program to search the name from the list and I need to find them even if the keyword is not in front of the names (that's what I mean non-prefix) e.g. if I my list is the music instruments and I type "guit" to the search textbox. It should find the names "Guitar, Guitarrón, Acoustic Guitar, Bass Guitar, ..." or something like this Longdo Dictionary's search suggestion. here is my simple and stupid algorithm (that's all I can do) const int SEARCHROWLIMIT = 30; private string[] DoSearch(string Input, string[] ListToSearch) { List<string> FoundNames = new List<string>(); int max = 0; bool over = false; for (int k = 0; !over; k++) { foreach (string item in ListToSearch) { max = (max > item.Length) ? max : item.Length; if (k > item.Length) continue; if (k >= max) { over = true; break; } if (!Input.Equals("Search") && item.Substring(k, item.Length - k).StartsWith(Input, StringComparison.OrdinalIgnoreCase)) { bool exist = false; int i = 0; while (!exist && i < FoundNames.Count) { if (item.Equals(FoundNames[i])) { exist = true; break; } i++; } if (!exist && FoundNames.Count < SEARCHROWLIMIT) FoundNames.Add(item); else if (FoundNames.Count >= SEARCHROWLIMIT) over = true; } } } return FoundNames.ToArray(); } I think this algorithm is too slow for a large number of names and after several trial-and-error, I decided to add SEARCHROWLIMIT to breaks the operation And I also think there're some readymade methods that can do that. And another problem is I need to search music instruments by a category like strings, percussions, ... and by the country of origins. So I need to search them with filter by type and country. please help me. P.S. Me and my friends are just student from Thailand and developing the project to compete in Microsoft Imagine Cup 2010 and please become fan on our facebook page [KRATIB][3]. And we're so sorry we don't have much information in English but you can talk to us in English.

    Read the article

  • C++ infix to postfix conversion for logical conditions

    - by Gopalakrishnan Subramani
    I want to evaluate one expression in C++. To evaluate it, I want the expression to be converted to prefix format. Here is an example wstring expression = "Feature1 And Feature2"; Here are possible ways. expression = "Feature1 And (Feature2 Or Feature3)"; expression = "Not Feature1 Or Feature3"; Here And, Or, Not are reserved words and parentheses ("(", )) are used for scope Not has higher precedence And is set next precedence to Not Or is set to next precedence to And WHITE SPACE used for delimiter. Expression has no other elements like TAB, NEWLINE I don't need arithmetic expressions. I can do the evaluation but can somebody help me to convert the strings to prefix notation?

    Read the article

  • [C#] How to do a search from a list with non-prefix keywords

    - by aNui
    First of all, sorry if my english or my post got any mistakes. I am programming a program to search the name from the list and I need to find them if the keyword is not in front of the names (that's what I mean non-prefix) e.g. if I my list is the music instruments and I type "guit" to the search textbox. It should find the names "Guitar, Guitarrón, Acoustic Guitar, Bass Guitar, ..." or something like this Longdo Dictionary's search suggestion. here is my simple and stupid algorithm (that's all I can do) const int SEARCHROWLIMIT = 30; private string[] DoSearch(string Input, string[] ListToSearch) { List<string> FoundNames = new List<string>(); int max = 0; bool over = false; for (int k = 0; !over; k++) { foreach (string item in ListToSearch) { max = (max > item.Length) ? max : item.Length; if (k > item.Length) continue; if (k >= max) { over = true; break; } if (!Input.Equals("Search") && item.Substring(k, item.Length - k).StartsWith(Input, StringComparison.OrdinalIgnoreCase)) { bool exist = false; int i = 0; while (!exist && i < FoundNames.Count) { if (item.Equals(FoundNames[i])) { exist = true; break; } i++; } if (!exist && FoundNames.Count < SEARCHROWLIMIT) FoundNames.Add(item); else if (FoundNames.Count >= SEARCHROWLIMIT) over = true; } } } return FoundNames.ToArray(); } I think this algorithm is too slow for a large number of names and after several trial-and-error, I decided to add SEARCHROWLIMIT to breaks the operation And I also think there're some readymade methods that can do that. And another problem is I need to search music instruments by a category like strings, percussions, ... and by the country of origins. So I need to search them with filter by type and country. please help me. P.S. Me and my friends are just student from Thailand and developing the project to compete in Microsoft Imagine Cup 2010 and please become fan on our facebook page [KRATIB][3]. And we're so sorry we don't have much information in English but you can talk to us in English.

    Read the article

  • ASP.NET MVC 2 - ViewModel Prefix

    - by Cosmo
    I want to use RenderPartial twice in my view with different models associated. The problem is that some properties are present in both models (nickname, password). They have no prefix, so even the id's or names are equal in the output. Now, if I have model errors for nickname or password, both fields get highlighted. Main View: <div> <% Html.RenderPartial("Register", Model.RegisterModel); %> </div> <div> <% Html.RenderPartial("Login", Model.LoginModel); %> </div> Login PartialView: <% using (Html.BeginForm("Login", "Member")) { %> <fieldset> <legend>Login</legend> <p> <%= Html.LabelFor(x => x.Nickname) %> <%= Html.TextBoxFor(x => x.Nickname) %> </p> <p> <%= Html.LabelFor(x => x.Password) %> <%= Html.PasswordFor(x => x.Password) %> </p> <input type="submit" value="Login" /> </fieldset> <% } % Register PartialView: <% using (Html.BeginForm("Register", "Member")) { %> <fieldset> <legend>Register</legend> <p> <%= Html.LabelFor(x => x.Nickname) %> <%= Html.TextBoxFor(x => x.Nickname) %> </p> <p> <%= Html.LabelFor(x => x.Email) %> <%= Html.TextBoxFor(x => x.Email) %> </p> <p> <%= Html.LabelFor(x => x.Password) %> <%= Html.PasswordFor(x => x.Password) %> </p> <p> <%= Html.LabelFor(x => x.PasswordRepeat) %> <%= Html.PasswordFor(x => x.PasswordRepeat) %> </p> <input type="submit" value="Register" /> </fieldset> <% } % How can I change this?

    Read the article

  • How to use XML namespace prefixes without xmlns="..." everywhere? (.NET)

    - by LonelyPixel
    The subject is probably too short to explain it... I'm writing out XML files with no namespace stuff at all, for some application. That part I cannot change. But now I'm going to extend those files with my own application-defined element names, and I'd like to put them in a different namespace. For this, the result should look like this: <doc xmlns:x="urn:my-app-uri"> <a>existing element name</a> <x:addon>my additional element name</x:addon> </doc> I've used an XmlNamespaceManager and added my URI with the prefix "x" to it. I've also passed it to each CreateElement for my additional element names. But the nearest I can get is this: <doc> <a>existing element name</a> <addon xmlns="urn:my-app-uri">my additional element name</addon> </doc> Or maybe also <x:addon xmlns:x="urn:my-app-uri">my additional element name</x:addon> So the point is that my URI is written to every single of my additional elements, and no common prefix is written to the document element where I'd like to have it. How can I get the above XML result with .NET?

    Read the article

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