w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
This code snippet is not working for both upper case and lower case letters
This modified code will work: def scrabble_score(word): count=0 word = word.lower() #assign the result of word.lower() to word word.lower() returns the modified word, it doesn't modify the string inplace. Strings are immutable in Python. The fact that .lower() returns a string is defined as such: >>> help(str.lower) Help on method_descriptor: lower(...) S.lower() -> string Return a copy of the string S converted to lowercase.

Categories : Python

VBA automatically changes upper to lower case letters
VBA will only automatically change the name if it finds something associated with that name. Check all your DIM statements, and make sure your form name is correct. Also, save yourself the headache later and NEVER use "reserved" words for field names. You obviously have a field or textbox named "Name"; you should change that to JudgeName or JName or something OTHER than "Name". Trust me, you'll thank me for that.

Categories : Ms Access

Convert filename in a folder from upper case to lower case (Windows Command Prompt or PowerShell)
In PowerShell: Get-ChildItem | Rename-Item -NewName { $_.Basename.ToUpper() + $_.Extension } or shorter: ls | ren -n { $_.Basename.ToUpper() + $_.Extension }

Categories : Windows

vb.net how to check case of label.text i.e lower case, upper case
isUpper and isLower apply to single characters within a string. I think a better solution is to create a temporary string that is formatted the way you want it and return the comparison. As an example (for ProperCase) If String.Format(yourString, vbStrConv.ProperCase) = yourString then 'your code for proper case End If With this, you should be able to get most of your comparisons going. As for toggle case, you are going to have to write an algorithm that does the string conversion for you. See http://www.codeproject.com/Tips/162540/Letter-Case-Conversion-Algorithms-Title-Case-Toggl for a fairly useful algorithm.

Categories : Vb.Net

When i use Activity in camel case it gives error but works fine in upper case spelled
You probably want to be defining an intent for a specific component: Intent startUpIntent = new Intent(Startup.this, MainActivity.class); Then you don't need to bother with an <intent-filter> for MainActivity in your manifest.

Categories : Android

Batch Script to find Folder Length of 2 alpha-numerics only and delete thos folders
this will delete all empty folders with two characters or less: for /f %%i in ('dir /b /ad ??') do rd %%i If you want also not-empty folders to be deleted: for /f %%i in ('dir /b /ad ??') do rd %%i /s /q If you use it not within a batchfile but as a single command, replace every %%i with %i EDIT (exclude a folder): for /f %%i in ('dir /b /ad ??') do ( if "%%i" neq "FP" rd %%i /s /q )

Categories : Regex

When to use upper case and when to use lower case for names
You need to read, understand and use the Oracle java coding guidelines, here you go: http://www.oracle.com/technetwork/java/codeconv-138413.html Naming section: http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-135099.html#367

Categories : Java

Rails server command generates another folder in project's folder with default folders and files
This is because you are using rails 2 gem version, you can check by rails -v. As well you can see, there is no app/assets folder. there are only public/javascripts etc rails2 style directories Try to install rails 3 by gem install rails --version '>3.0.0'

Categories : Ruby On Rails

Test for Upper Case - T-Sql
Using collations eg: if ('a'='A' Collate Latin1_General_CI_AI) print'same 1' else print 'different 1' if ('a'='A' Collate Latin1_General_CS_AI) print'same 2' else print 'different 2' The CS in the collation name indicates Case Sensitive (and CI, Case Insensitive). The AI/AS relates to accent sensitivity. or in your example SUBSTRING(author,1,1) <> LOWER(SUBSTRING(author,1,1)) COLLATE Latin1_General_CS_AI

Categories : SQL

Replacing every member of a structure in upper case
If you have 100 string members, I think the best would be to refactor this class to have a vector of strings instead of those members. In this case any operation on all fields will be trivial - just iterate through container. I can hardly imagine how can you manage 100 members in the class.

Categories : C++

How do you convert the first word of a phrase to all upper case?
Assuming that your words are separated by space, you can use the following way to make your first word uppercase: String str = "This is a space separated string"; String newString = str.substring(0, str.indexOf(" ")).toUpperCase() + str.substring(str.indexOf(" ")); Note that, String#charAt method takes an index, and returns the character at that index. You need to use String#indexOf which gives the first index of the passed sequence, or character. In the above code: str.substring(0, str.indexOf(" ")) returns the first word in your string, and invoking toUpperCase() on the returned string converts the string to uppercase. Then you concatenate with the remaining string.

Categories : Java

Convert a unicode String In C++ To Upper Case
You can iterate through a wstring and use towupper / towlower for (wstring::iterator it = a.begin(); it != a.end(); ++it) *it = towupper(*it);

Categories : C++

.htaccess URL rewrite to upper-case characters in domain
What you want to do is impossible because a domain name can't contain uppercase, but just numbers, lowercases and hyphens. Consequently, when you redirect your domain name with lowercases to your domain name with uppercases, your browser will do the opposite : it will redirect your domain name with uppercases to your domain name with lowercases. So, the loop will never end.

Categories : Apache

Why ResultSet meteData getColumnName got all Upper case column name
getColumnName(i) always returns the designated column's name, so, this problem is not related with the method but your database. I think you've better check your database and see how the column names set. UPDATE: I used this method with MYSql and Sqlite and MS Acces, I didn't face any problem like that.

Categories : Java

Not allow special characters and only upper case p:inputText Primefaces
"Renato".toUpperCase() will convert the string to uppercase. Take a look at java.text.Normalizer for converting (some, not all) accented characters to standard. To disallow lowercase and/or special characters then you should use a validator. A simple regex will identify special characters [^a-zA-Z0-9] or special and lowercase characters [^A-Z0-9]. The validator can also modify the input using the two methods indicated above - though you may want to make sure the user knows this is happening.

Categories : JSF

Converting lower & upper case ASCII characters
The simplest way is probably to use the % modulus operator: int letter_add = ((input.at(i) - 'a' + cmd_int) % 26) + 'a'; You'll need a symmetrical line for capital letters (or just make the 'a' a variable too).

Categories : C++

changing an array to an Object (upper case) by adding a value using a dot
If you look at the underscore.js source, you will see that the isArray function is defined as: _.isArray = nativeIsArray || function(obj) { return toString.call(obj) == '[object Array]'; }; The brower's native Array.isArray says it's an array because that's what it has been instantiated as. If the browser doesn't have a native isArray, then underscore.js uses the second option: comparing toString on the object to see if it matches the string [object Array]. Simply adding a property is not enough to change the type of the object (according to the JavaScript virtual machine, it is still an object that happens to be an array). JavaScript is a dynamic language which means that you can add properties to in-built objects, but doing so does not change what they are; you have merely ext

Categories : Javascript

upper case html tags encoded in lxml
The HTML parser converters all tag names to lower case. This is why xpath('//TR') returns an empty list. I'm not able to reproduce the second problem, where upper case tags get printed as '. Can you modify the code below to demonstrate the problem? import lxml.etree as ET content = ''' <TR> <TR vAlign="top" align="left"> <!--<TD><B onmouseover="tips.Display('Metadata_WEB', event)" onmouseout="tips.Hide('Metadata_WEB')">Meta Data:</B></TD>--> <TD></TD> </TR> </TR>''' root = ET.HTML(content) print(root.xpath('//TR')) # [] print(root.xpath('//tr/node()')) # [<!--<TD><B onmouseover="tips.Display('Metadata_WEB', event)" onmouseout="tips.Hide('Metadata_WEB')">Meta Data:</B>

Categories : Python

Upper-Case Method on Database or in Java Code?
I believe always my code should be database independent. String upper = string.toUpperCase(); Because,it's database independent.If I shift my database to some other,I need not to change my code. In a nutshell your specific requirements should take in to consideration.

Categories : Java

Creating different GUID for same lowercase and upper case strings
Your strings are hexadecimal representations of the same value because hexadecimal is not case sensitive. Your request is like saying that you don't want 0.5 to equal 1 / 2. They are different representations of the same value. Perhaps you need a different method of generating GUIDs.

Categories : C#

ImageButton upper folder issue
Try this instead: <asp:ImageButton ID ="imgb" runat ="server" Width="125px" Height="125px" ImageUrl ='<%# "../" + Eval("ustkategoriresim").ToString() %>' CommandArgument = '<%#Eval("ustkatID") %>' />

Categories : HTML

Angular directive name: only lower case letters allowed?
AngularJS attempts to make everyone happy! Some people prefer to use data attributes, like data-abc-abc, I assume to keep validators happy. Other people prefer to use namespaces like abc:abc, and others prefer to use the actual directive name abcAbc. Or even all caps ABC_ABC. Or extension attributes like x-abc-abc. AngularJS normalises the name used in HTML to attempt to cover all of these cases. data- and x- are stripped, the remainder camelcased with :, - and _ as word boundaries. This makes abcAbc from the cases mentioned above, which is used to look up the directive declared in JavaScript. This is all called attribute normalisation (US: attribute normalization) and can be found in the AngularJS documentation and source code.

Categories : Angularjs

how to Make lower case letters for unicode characters
If your project uses the Unicode Character Set (project properties), CString::MakeLower() should work -- note that this will not convert the contents of the string, it returns a new string, see this MSDN article: CString s1(_T("ABC")), s2; s2 = s1.MakeLower(); ASSERT(s2 == _T("abc")); EDIT: CString::MakeLower() does change the contentrs of the string, it also returns a reference to the converted string

Categories : C++

MySQL, sort single letters first, then double letters, then triple letters
For the data you have provided, you can just use the length: order by length(letters), letters; This assumes that the letters are as described in the question, with no additional letters afterwards. If these are prefixes, the brute force approach would be: order by ((substring(letters, 1, 1) = substring(letters, 2, 1)) + (substring(letters, 1, 1) = substring(letters, 3, 1) ), letters; That is, compare the initial character to the next two. The above returns 0, when the first and second characters are different; 1, when the first and second are the same but the third different; and 2 for three character prefixes.

Categories : Mysql

How to remove repeated letters in java using (Regular Expressions) and being case Insensitive
Use Matcher#group() instead of $1 here if (matcher.find()) { System.out.println(matcher.replaceAll(matcher.group(1) .toLowerCase())); } Lets you make use of toLowerCase() then. EDIT : (in response to OP's comments) Matcher#group(n) is same as $n -- it refers to the n'th capture group. So, group(1) and $1 both capture O except that you can switch the capture toLowerCase(). The loop is being run by replaceAll() not by the find(). Matcher#find() is required to initialize the groups, so that group(1) returns the capture before replaceAll() is invoked. But, this also means the capture stays the same which suffices your requirements but would require the matcher to be reset for a string like BOobbOobboObbOoObbooOoOoOoOoOOb (notice the double b

Categories : Java

Copy folders and exclude folder
I'd suggest splitting the problem into 4 subs. Firstly two subs to allow users to select a folder they desire for source and destination. The a button click event that starts the copying and finally a sub that actually handles the copying. Try this on for size: Dim CopyFromPath As String Dim CopyToPath As String Private Sub TextBox1_MouseClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.MouseClick Dim fldbroser1 As New FolderBrowserDialog fldbroser1.RootFolder = Environment.SpecialFolder.MyMusic fldbroser1.ShowDialog() CopyFromPath = fldbroser1.SelectedPath End Sub Private Sub TextBox2_MouseClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.MouseClick Dim fldbroser1 As New FolderBrowserDialog f

Categories : Vb.Net

Forward any route with upper case character to equivalent lowercase route in Kohana 3.3
If you do not want any of your routes to be case-sensitive, simply extend the route class: class Route extends Kohana_Route { public static function compile($uri, array $regex = NULL) { return parent::compile($uri, $regex).'i'; } }

Categories : Misc

delete all the folders inside a parent folder
Try this : function del($dir) { foreach(glob($dir . '/*') as $file) { if(is_dir($file)) del($file); } rmdir($dir); } It will also delete nested folders

Categories : PHP

Items_ItemAdd listener for folder and it's sub folders in Outlook
You need to install the event sink on each folder's Items collection. To make sure all Items objects are alive while your app runs, store Items in a list (e.g. List<Outlook.Items>)

Categories : C#

How can I split a folder with thousands of images into multiple sub-folders?
awk one-liner can do that. Consider this awk command: find . -name "*.JPG" | awk '!(++cnt%100) {"mkdir sub_" ++d|getline}' Run it inside the folder with 5000 images. This will create 50 folders with the names sub_1, sub_2...sub_50. Also to move files into these newly created directories: find . -type f | awk '{ a[++cnt] = $0 } cnt==100 { subd = "sub_" ++d; system("mkdir " subd); for (f in a) system("mv " a[f] " " subd); cnt=0 }'

Categories : Osx

XCOPY files in batch to another folder but with structure of folders
Ah, finally found it. Putting an asterisk * behind the filename will do the trick. So, for any of you with the same problem: XCOPY "abcdef01.jpg" "D: ewphotosabcdef01.jpg*" This does the trick.

Categories : Misc

Efficient way to find the index of the max upper triangular entry in a numpy array?
You can use np.triu_indices_from: >>> np.vstack(np.triu_indices_from(a,k=1)).T array([[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3]]) >>> inds=inds[inds[:,1]>2] #Or whatever columns you want to start from. >>> inds array([[0, 3], [1, 3], [2, 3]]) >>> a[inds[:,0],inds[:,1]] array([1, 4, 6]) >>> max_index = np.argmax(a[inds[:,0],inds[:,1]]) >>> inds[max_index] array([2, 3]]) Or: >>> inds=np.triu_indices_from(a,k=1) >>> mask = (inds[1]>2) #Again change 2 for whatever columns you want to start at. >>> a[inds][mask] array([1, 4, 6]) >>> max_index = np.argmax(a[inds][mask]) >>> inds[mask][max_index] array([2, 3]]) For the above you

Categories : Python

Batch Renaming Folders in AppleScript, Will Only Change Names of Every Other Folder
Jart, the main issue was with the second loop, you need to be looping through every folder of the x folder variable instead. It appears that looping through the folder worked, but when you renamed them it caused an index issue resulting in only reading every 2nd folder. Here is a little reworking. renamed your variables from y and x to be less cryptic. changed the length test to support names > 9. i was unsure about the item at the end of the new name, and if it should be an incremented number instead. (you can easily revert) left in some log calls for your reference, these can help debug stuff tell application "Finder" -- Defining Pro Folders set pro_folder to folder POSIX file "/Users/Jart/Desktop/test" set all_pro_folders to every folder of pro_folder -- Iter

Categories : Osx

How to recursively retrieve files from folders returning file name and its Folder name
You may want to use folderFullPath.lastIndexOf(File.separator) in order to find the index of the character before the folder name and then use substring to extract the folder name from the full-path.

Categories : Java

Create the same multiple folder in all sub directory folders from excel list using VBA
Use an array for the subfolders and loop through that for each of your 1st level folders. Change this line vSubfolders = Array("A", "B", "C") to add/remove your second level folders Sub MakeFolders() Dim xdir As String Dim fso As Object Dim lstrow As Long Dim i As Long Dim vSubfolders Dim vSubFolder vSubfolders = Array("A", "B", "C") Set fso = CreateObject("Scripting.FileSystemObject") lstrow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row Application.ScreenUpdating = False For i = 1 To lstrow xdir = "C:UsersNikkiSharedVIC" & Range("A" & i).Value If Not fso.FolderExists(xdir) Then fso.CreateFolder (xdir) End If For Each vSubFolder In vSubfolders If Not fso.FolderExists(xdir & "" & vSubFolder) Then fso.CreateFolder (xdir & "" & vSubFolder) End If Ne

Categories : Excel

Randomly select 20 folders out of 50 in php, and then enumerate (thumbs) folder in each for thumbnails
First, save all galleries in an array. $storage = glob($galdir . '*', GLOB_ONLYDIR); Now, shuffle the array. shuffle($storage); You now have an array with all your galleries randomly sorted. Loop through them again. for($i = 0; $i < 20; $i++) { //Only 20 echo $storage[$i]; //Directory name. Add your HTML stuff here }

Categories : PHP

Rename files within folders to folder names while retaining extensions
Here's something simple: find * -type f -maxdepth 1 | while read file do dirname="$(dirname "$file")" new_name="${dirname##*/}" file_ext=${file##*.} if [ -n "$file_ext" -a -n "$dirname" -a -n "$new_name" ] then echo "mv '$file' '$dirname/$new_name.$file_ext'" fi done The find * says to run find on all items in the current directory. The -type f says you only are interested in files, and -maxdepth 1 limits the depth of the search to the immediate directory. The ${file##*.} is using a pattern match. The ## says the largest left hand match to *. which is basically pulling everything off to the file extension. The file_dir="$(dirname "$file")" gets the directory name. Note quotes everywhere! You have to be careful about white spaces. By the way, I echo i

Categories : Bash

A Shell script to find and cd into a folder taking a folder name as argument in one step
You must run cd in your current shell. Running it in another shell won't work, as you've seen. Create a function. Example: mycd (){ cd "${1}foo" }

Categories : Linux

Hadoop HDFS Copy Files from multiple folders to one destination folder
There is DistCp which is an map-reduce job which copies files from one or multiple source folders to one target folder in an parallel manner. However, its not merging files. But maybe you could use filecrush to do that! (let me know how this goes!)

Categories : Hadoop

Run a batch file that would delete files in a folder (and its sub folders) that are older then 30 days
I did some copy and paste for you from here: forfiles -p "C:whatever" -s -m *.* /D -30 /C "cmd /c del @path" See forfile documentation for more details.

Categories : Windows



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.