Search Results

Search found 245 results on 10 pages for 'lowercase'.

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

  • Why touching "d_name" makes calls to readdir() fail?

    - by Sarah Mani
    Hi, I'm trying to write a little helper for Windows which eventually will accept a file extension as an argument and return the number of files of that kind in the current directory. To do so, I'm reading the file entries in the directories and after getting the extension I'd like to convert it to lowercase to compare it with the yet-to-add specified argument. When converting the extension to lowercase I found that touching even a duplicate string of the d_name variable will cause a strange behaviour, like no more calls to readdir are called. Here is the code I'm using right now (the commented code is preliminary) and outputs for a given directory: #include <ctype.h> #include <dirent.h> #include <stdio.h> #include <string.h> char * strrch(char *string, size_t elements, char character) { char *reverse = string + elements; while (--reverse != string) if (*reverse == character) return reverse; return NULL; } void test(char *string) { // Even being a duplicate will make it fail: char *str = strdup(string); printf("Strings: %s %s\n", string, str); *str = 'a'; printf("Strings: %s %s\n", string, str); //unsigned short int i = 0; //for (; str[i] != '\0', str++; i++) // str[i] = tolower((unsigned char) str[i]); //puts(str); } int main(int argc, char **argv) { DIR *directory; struct dirent *element; if (directory = opendir(".")) { while (element = readdir(directory)) test(strrch(element->d_name, element->d_namlen, '.')); closedir(directory); puts(NULL); } else puts("Couldn't open the directory.\n"); } Output without modifying the duplicate (modification and the second printf call commented): Strings: (null) (null) Strings: . . Strings: .exe .exe Strings: .pdf .pdf Strings: .c .c Strings: .ini .ini Strings: .pdf .pdf Strings: .pdf .pdf Strings: .pdf .pdf Strings: .flac .flac Strings: .FLAC .FLAC Strings: .lnk .lnk Strings: .URL .URL Output of the same directory (with the code above, with the 2 printfs): Strings: (null) (null) Is there anything wrong? Is it a compiler issue? I'm using GCC 4.4.3 in Windows (MinGW) right now. Thank you very much for your help. By the way, is there any other way to work with files and directories in a Windows environment not using the POSIX functions?

    Read the article

  • Preserving all capitalization in BibTeX

    - by Sal
    I have a huge .bib file generated automatically from Papers for Mac and all the capitalization in the .bib is already the way I want it, but it doesn't have {} brackets on word like RNA. Is there a way to force BibTeX to keep the capitalization rather than change some words to lowercase?

    Read the article

  • Dynamic Objects for ASPxGridview

    - by André Snede Hansen
    I have a dictionary that is populated with data from a table, we are doing this so we can hold multiple SQL tables inside this object. This approached cannot be discussed. The Dictionary is mapped as a , and contains SQL column name and the value, and each dictionary resembles one row entry in the Table. Now I need to display this on a editable gridview, preferably the ASPxGridView. I already figured out that I should use Dynamic Objects(C#), and everything worked perfectly, up to the part where I find out that the ASPxGridview is built in .NET 2.0 and not 4.0 where Dynamic objects where implemented, therefor I cannot use it... As you cannot, to my knowledge, add rows to the gridview programmatically, I am out of ideas, and seek your help guys! protected void Page_Load(object sender, EventArgs e) { UserValidationTableDataProvider uvtDataprovider = _DALFactory.getProvider<UserValidationTableDataProvider>(typeof(UserValidationTableEntry)); string[] tableNames = uvtDataprovider.TableNames; UserValidationTableEntry[] entries = uvtDataprovider.getAllrecordsFromTable(tableNames[0]); userValidtionTableGridView.Columns.Clear(); Dictionary<string, string> firstEntry = entries[0].Values; foreach (KeyValuePair<string, string> kvp in firstEntry) { userValidtionTableGridView.Columns.Add(new GridViewDataColumn(kvp.Key)); } var dynamicObjectList = new List<dynamic>(); foreach (UserValidationTableEntry uvt in entries) { //dynamic dynObject = new MyDynamicObject(uvt.Values); dynamicObjectList.Add(new MyDynamicObject(uvt.Values)); } } public class MyDynamicObject : DynamicObject { Dictionary<string, string> properties = new Dictionary<string, string>(); public MyDynamicObject(Dictionary<string, string> dictio) { properties = dictio; } // If you try to get a value of a property // not defined in the class, this method is called. public override bool TryGetMember(GetMemberBinder binder, out object result) { // Converting the property name to lowercase // so that property names become case-insensitive. string name = binder.Name.ToLower(); string RResult; // If the property name is found in a dictionary, // set the result parameter to the property value and return true. // Otherwise, return false. bool wasSuccesfull = properties.TryGetValue(name, out RResult); result = RResult; return wasSuccesfull; } // If you try to set a value of a property that is // not defined in the class, this method is called. public override bool TrySetMember(SetMemberBinder binder, object value) { // Converting the property name to lowercase // so that property names become case-insensitive. properties[binder.Name.ToLower()] = value.ToString(); // You can always add a value to a dictionary, // so this method always returns true. return true; } } Now, I am almost certain that his "Dynamic object" approach, is not the one I can go with from here on. I hope you guys can help me :)!

    Read the article

  • Dynamic mass hosting using mod_wsgi

    - by Virgil Balibanu
    Hi, I am trying to configure an apache server using mod_wsgi for dynamic mass hosting. Each user will have it's own instance of a python application located in /mnt/data/www/domains/[user_name] and there will be a vhost.map telling me which domain maps to each user's directory (the directory will have the same name as the user). What i do not know is how to write the WSGIScriptAliasMatch line so that it also takes the path from the vhost.map file. What i want to do is something like this: I can have on my server different domains like www.virgilbalibanu.com or virgil.balibanu.com and flaviu.balibanu.com where each domain would belog to another user, the user name having no neccesary connection to the domain name. I want to do this beacuse a user, wehn he makes an acoount receives something like virgil.mydomain.com but if he has his own domain he can change it later to that, for example www.virgilbalibanu.ro, and this way I would only need to chenage the line in the vhost.map file So far I have something like this: Alias /media/ /mnt/data/www/iitcms/media/ #all media is taken from here RewriteEngine on RewriteMap lowercase int:tolower # define the map file RewriteMap vhost txt:/mnt/data/www/domains/vhost.map #this does not work either, can;t say why atm RewriteCond %{REQUEST_URI} ^/uploads/ RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$ RewriteCond ${vhost:%1} ^(/.*)$ RewriteRule ^/(.*)$ %1/media/uploads/$1 #---> this I have no ideea how i could do WSGIScriptAliasMatch ^([^/]+) /mnt/data/www/domains/$1/apache/django.wsgi <Directory "/mnt/data/www/domains"> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> <DirectoryMatch ^/mnt/data/www/domains/([^/]+)/apache> AllowOverride None Options FollowSymLinks ExecCGI Order deny,allow Allow from all </DirectoryMatch> <Directory /mnt/data/www/iitcms/media> AllowOverride None Options Indexes FollowSymLinks MultiViews Order allow,deny Allow from all </Directory> <DirectoryMatch ^/mnt/data/www/domains/([^/]+)/media/uploads> AllowOverride None Options Indexes FollowSymLinks MultiViews Order allow,deny Allow from all </DirectoryMatch> I know the part i did with mod_rewrite doesn't work, couldn't really say why not but that's not as important so far, I am curious how could i write the WSGIScriptAliasMatch line so that to accomplish my objective. I would be very grateful for any help, or any other ideas related to how i can deal with this. Also it would be great if I'd manage to get each site to run in wsgi daemon mode, thou that is not as important. Thanks, Virgil

    Read the article

  • Case Insensitive URLs with mod_rewrite

    - by Paul Tarjan
    I'd like for any url that doesn't hit an existing file, to do a lookup on the other possible cases and see if those files exist, and if so, 302 to them. If that's not possible, then I'm ok with these compromises: Only check the lowercase version Only check the first path portion For example http://example.com/CoOl/PaTH/CaMELcaSE should redirect to http://example.com/cool/path/camelCase (assuming the latter exists). but of course a full solution is much more useful to me and others

    Read the article

  • regular expression for letters, numbers and - _ .

    - by Jorre
    I'm having trouble checking in PHP if a value is is any of the following combinations letters (upper or lowercase) numbers (0-9) underscore (_) dash (-) point (.) no spaces! or other characters a few examples: OK: "screen123.css" OK: "screen-new-file.css" OK: "screen_new.js" NOT OK: "screen new file.css" I guess I need a regex for this, since I need to throw an error when a give string has other characters in it than the ones mentioned above.

    Read the article

  • problems with strtolower function

    - by Syom
    i have some text in foreign language in my page, but when i make it lowercase, it starts to look like this... $a = "????? ?????????" echo $b = strtolower($a); //returns ????? ????????? i've set <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> could you tell me why? thanks in advance

    Read the article

  • How to use Spanish characters in Handlebars templates

    - by Jon Rose
    I am wondering what the idiomatic way to render special language characters is using Handlebars.js templates. When I render the normal html I can use something like the Spanish lowercase e, &#233, and it renders as expected. When I pass the same text as a string to my Handlebars template I just see the characters &#233. I have tried creating a Handlebars helper that used jquery to render the text using .html() then returning the .html() of the tmp element and I get the same results.

    Read the article

  • PHP ingore case sensitivity when comparing array values

    - by dan.codes
    I have to modify some code in a application I am working on that is using the array_diff($array1,$array2) method. The problem I am having is it is case sensitive and I need to have it return the correct value if the array values match even if the case is different. I don't want to change the case to lowercase because I need the value returned to keep its case. I'm a little confused as the best method to do this.

    Read the article

  • Creating a unique URL safe hash

    - by Ben Foster
    I want to hash/encode a unique integer (database ID) to create a similarly unique string. It needs to meet the following requirements: Must start with a letter or number, and can contain only letters and numbers. All letters in a container name must be lowercase. Must be from 3 through 63 characters long (although the shorter the better) The result does not need to be reversible, just repeatable - so a 1-way hash would be fine.

    Read the article

  • jQuery - field entry - how to duplicate and convert to seo friendly url

    - by Binyamin
    I have two HTML input fields 'article' and 'url'. How to duplicate field 'article' entry to field 'url' to SEO friendly link!? 'url' allowed symbols 'a-z' (capital letters converted to lowercase), 'url' space symbol replace with dash '-', 'url' other symbols ignored. required typing just in field 'article' <input type="text" name="article"> url field is jquery auto generated and updated by field article value <input type="text" name="url">

    Read the article

  • Matlab regex if statement

    - by Dan
    I want to have matlab take user input but accept both cases of a letter. For example I have: function nothing = checkGC(gcfile) if exist(gcfile) reply = input('file exists, would you like to overwrite? [Y/N]: ', 's'); if (reply == [Yy]) display('You have chosen to overwrite!') else $ Do nothing end end The if statement obviously doesn't work, but basically I want to accept a lowercase or uppcase Y. Whats the best way to do this?

    Read the article

  • Best IDE for Ext JS

    - by KPthunder
    I am wondering what everybody's opinion on the best IDE for Ext JS is. I was using Aptana and spent way too much time tracking down a problem which turned out to be an uppercase instead of lowercase letter. So far I've tried Aptana (with and without Spket) and JetBrains Web Storm. Aptana didn't really do anything and while Web Storm worked, it was incredibly slow. Any recommendations for IDEs and / or configurations to speed up Web Storm?

    Read the article

  • Reset UIKeyboard State

    - by kamziro
    I have a UITextView which the keyboard enters values into. However, if you clear the text value (i.e uitextview.text = @""), the keyboard's state does not reset to the lowercase alphabet keyboard. That is, if I was in the middle of typing "hello.." and the textview gets cleared, the keyboard still shows the symbols, rather than back to the alphabetical letters. Is there a way to get around this?

    Read the article

  • What does capital W do in VIM?

    - by tesmar
    Hi, in VIM sometimes when saving, I accidentally hit capital W instead of its lowercase brother. I am prompted for my system password, so I assume it is running a sudo command of some sort, but do you know what? Thank you!

    Read the article

  • Solution for ora-1017 error for odp.net 2.111.7.0 ?

    - by Prithis
    Hi, As you are aware Oracle 11g has new facility of case sensitive password. We want to make use of it. When my C# application connects to oracle databse using ODP.Net 2.111.7.0 I am getting ora-1017 error. When we switch off this case sensitive feature it works without any change to the connection string. Any idea what is missing? is there any escape sequence we can use to specify lowercase characters in password? Thanks

    Read the article

  • Regex for Password Must be contain at least 8 characters, least 1 number and both lower and uppercase letters and special characters

    - by user2442653
    I want a regular expression to check that Password Must be contain at least 8 characters, including at least 1 number and includes both lower and uppercase letters and special characters (e.g., #, ?, !) Cannot be your old password or contain your username, "password", or "websitename" And here is my validation expression which is for 8 characters including 1 uppercase letter, 1 lowercase letter, 1 number or special character. (?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$" How I can write it for password must be 8 characters including 1 uppercase letter, 1 special character and alphanumeric characters?

    Read the article

  • Hash Table question [closed]

    - by Fatimah
    I need your help to solve this program ... Implement a separate chaining hash table that stores strings. You’ll need a hash function that converts string into an index number. Assume the strings will be lowercase words, so 26 characters will suffice.

    Read the article

  • Are classes in Python in different files?

    - by Asaf
    Much like Java (or php), I'm use to seperating the classes to files. Is it the same deal in Python? plus, how should I name the file? Lowercase like classname.py or the same like ClassName.py? Do I need to do something special if I want to create an object from this class or does the fact that it's in the same "project" (netbeans) makes it ok to create an object from it?

    Read the article

  • Set the right two characters (if there are any) to capitals?

    - by Hyflex
    Below is my data: Data Here 94/452O Data more 94/4522i Data bla 94/111 Data bla 94/459es Data bla 94/444 items is automatically generated by some previous code but it could come out like: items = ["Data Here 94/452O", "Data more 94/4522i", "Data bla 94/111", "Data bla 94/459es", "Data bla 94/444"] Now currently I'm appending the following: "\n".join(items).replace("4ke", "9") with a few other .replaces however I want it to replace/change the characters on the end of the numbers with a capital letter instead of lowercase... Output: Data Here 94/452O Data more 94/4522I Data bla 94/111 Data bla 94/459ES Data bla 94/444

    Read the article

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