w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How can I convert text to Pascal case?
First off, you are asking for title case and not camel-case, because in camel-case the first letter of the word is lowercase and your example shows you want the first letter to be uppercase. At any rate, here is how you could achieve your desired result: string textToChange = "WARD_VS_VITAL_SIGNS"; System.Text.StringBuilder resultBuilder = new System.Text.StringBuilder(); foreach(char c in textToChange) { // Replace anything, but letters and digits, with space if(!Char.IsLetterOrDigit(c)) { resultBuilder.Append(" "); } else { resultBuilder.Append(c); } } string result = resultBuilder.ToString(); // Make result string all lowercase, because ToTitleCase does not change all uppercase correctly result = result.ToLower(); // Creates a TextInf

Categories : C#

AngularJS: Controllers / Services should be Pascal Case? (using Yo in yeoman)
It's worth noting that in the Developer Guide in many places (including the linked-to "services" section), the AngularJS devs use camelcase + first lowercase for names of services and other things. So maybe you would consider that a best practice for AngularJS. That said, I think from other languages it is more common to name services and classes with camelcase + first uppercase and actually as it turns out in JavaScript this seems to be of especial importance. Consider that you have a class named user—then what would you call a variable that contains an instance of user? You couldn't call it user without extremely awkward/error-prone shadowing. In AngularJS, your $resource services will end up becoming your classes in OO JavaScript "of old." Look: angular.module('Foo', [], function()

Categories : Angularjs

Replace Capital String with Pascal Case using Regex
for the pascal casing of the identifier once you have matched it, you can use another regex. I've changed your original regex so it uses looking forward and backwards to only capture the identifier as the match This code takes some C# code with your funky naming scheme and replaces it with code with pascal casing :- var code = "public class Blah public int SOMETHING_LESS_COOL { get; set; } }"; var identifierRegex = new Regex(@"(?<=^s*publics[w-]+?(?)?s)[A-Z]+(_[A-Z]+)*(?=s*{s*get;s*set;s*})", RegexOptions.Multiline); var underscoreRegex = new Regex(@"(_|s|^)w"); var pascalCode = identifierRegex.Replace(code, i => underscoreRegex.Replace(i.Value.ToLower(), m => m.Value.ToUpper().Replace("_",""))); While this will c

Categories : Dotnet

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 Pascal's Triangle (Unstable Code)
The last element of the array hasn't been initialized. Write: for (i = 0; i < LEVEL + 1; i++) pTriangle[i] = 0; instead of: for (i = 0; i < LEVEL; i++) pTriangle[i] = 0;

Categories : C

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

How to apply pattern matching in this case
Not a pattern matching, but should do the trick: checkTop(clickedIndex) orElse checkBottom(clickedIndex) orElse checkLeft(clickedIndex) orElse checkRight(clickedIndex) orElse is a method defined for Option. When option is defined, it returns an option itself, otherwise it tries an alternative.

Categories : Scala

Why is mclappy slower than apply in this case?
It looks like mclapply compares pretty well against lapply, but lapply does not compare well against apply. The reason may be that you're iterating over the rows of q with apply, and you're iterating over the columns of q with lapply and mclapply. That may account for the performance difference. If you really do want to iterate over the rows of q, you could create ql using: ql <- lapply(seq_len(nrow(x)), function(i) x[i,]) If you want to iterate over the columns of q, then you should set MARGIN=2 in apply, as suggested by @flodel. Both lapply and mclapply will iterate over the columns of a data frame, so you can create ql with: ql <- as.data.frame(q) This makes sense since a data frame actually is a list.

Categories : R

Query case sensitive in SQL database without setting database to case sensitive
You have to use the IS operator when comparing to null values instead of the normal compare operators (!=/=/<>/...) select * from database.file where IsSeeded IS NULL; Otherwise the result will be unknown for null entries and the condition is false.

Categories : SQL

apply a database program (package, function or script )into oracle database from c#
Just remember, looking at DDL you creating the object in the schema defined by connection. And if the super-user you connecting as is "System", that is the place to look for your object. Your object may be invalid after creation but will be compiled on the first use (if object is compilable) Or, you can add the following alter function <name> compile

Categories : C#

Apply changed code style to existing code in Intellij
You can invoke the Reformat Code action (Ctrl+Alt+L by default, I think) from the Project view. This will cause all files under the currently selected item to be reformatted. So you just need to do this when the root project node is selected, in order to achieve what you want.

Categories : Intellij Idea

How can I get this code to apply the styling only where I want it?
you've set the styling to include every UL and LI tag in the page. to make it specific to only some part, you should use either class names or set ids for them. something like: .ul UL { /* style here */ } HTML: <ul class="ul"> <!-- only this particular UL will be affected --> I see you've used that in your <li> tag with withborder class, you need to do the same with the <ul> tags also.

Categories : HTML

How to apply this code to my audio
I went for this instead because it had no error (it needs to be refactored slightly): function fadeVolume(volume, callback) { var factor = 0.02, speed = 50; if (volume > factor) { setTimeout(function(){ fadeVolume((document.getElementById("introMusic").volume -= factor), callback); }, speed); } else { (typeof(callback) !== 'function') || callback(); } } fadeVolume(document.getElementById("introMusic").volume, function(){ console.log

Categories : Javascript

PHP - Apply code to subpages
Use a regular expression: $matches = array(); if((preg_match('#http://example.com/news/latest/(.*)#', $url, $matches)) === 1) { if(strlen($matches[0]) > 0) { echo "You're at page: $matches[0]"; } else { echo "You're at the root"; } } else { // Error, incorrect URL (should not happen) } EDIT: Fixed, untested so you may have to tweak it a little

Categories : PHP

Switch case, case was not found, but similar to the other case, give suggestion
I can point you in the right direction: http://php.net/manual/en/function.levenshtein.php Is a php function that can be used for your cause, there is a nice example on that page as well. A related stack overflow question has more info on when your strings are longer than 255 characters: String similarity in PHP: levenshtein like function for long strings

Categories : PHP

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

Apply Laravel 4 query cache to all database reads
You might be able to extend the query builder and simply overload the get() method to first call remember(), and then do the get() statement. Practically, though, if you want to cache every single query, you might as well just do this at the database level. MySQL, for example, has a configuration option to automatically cache all queries for a certain amount of time. However, in an application that does a lot of inserts/updates/deletes, this will have poor performance since the cache is cleared for that table on every such call. Using Laravel for every query would also mean getting outdated data if you do inserts/updates/deletes meanwhile, so you'd have to clear the cache every time you update. Best practice would be to diligently decide if a query should be cached or not.

Categories : Laravel

Replacing a cursor with apply to loop through all tables in a database
You can replace the cursor with while loop statement. Try using statement like the following to achive the desired o/p. select name into #table from sys.tables while (select count(*) from #table)>0 begin set rowcount 1 select @Table_Name = name from sys.tables set rowcount 0 ....... ....... delete from #table where name = @Table_Name end The above snippet is from sybase, you might need to make minor modifications for the syntax. I hope that helps.

Categories : SQL

Apply jquery code to multiple textareas
You can target all inputs, or just give them a common class to target, and extract something, I used the class, but data attributes would be easier if the elements had multiple classes etc : $('input').on('keyup', function() { $('.'+this.className).html(this.value); }); FIDDLE EDIT: as noted above, if the elements have multiple classes, use data attributes : <input class="input" data-id="apple" > <input class="input" data-id="orange" > <input class="input" data-id="banana" > JS $('.input').on('keyup', function() { $('.' + $(this).data('id')).html(this.value); }); FIDDLE

Categories : Javascript

Case sensitivity and database projects
There is an option in the project settings called "Validate Casing on Identifiers" which according to the documentation shall detect difference in case. However, it only seems to be relevant if you select a case sensitive collation in the Database Settings of your project. Once I selected SQL_Latin1_General_CP1_CS_AS I was able to detect the changes in a schema name and it scripts the DROP/CREATE schema as expected:

Categories : Sql Server

Case Insensitive MySQL Database
Your collation set to ci (case-insensitive) only affects the way you search in data, not columns. IIRC, column names are case sensitive and table names aren't. Follow a standard naming convention for your database.

Categories : PHP

vb .net with access database, how to apply changes from .accdb to the dataset in visual studio?
If you did something to your columns in your DB especially Insert .. so should change your code if access the column/field by column index .. but if you access them by column name, you shouldn't make any big changes ..

Categories : Dotnet

What's the code for htaccess in my case?
Add this to your .htaccess in your web root / directory RewriteEngine on RewriteBase / RewriteRule ^forum/(d+)/response/[^/]*$ post.php?id=$1 [NC,QSA,L] RewriteRule ^(thread|forum)/(d+)(?:/page/(d+))?/[^/]*$ $1.php?id=$2&page=$3 [NC,QSA,L]

Categories : Apache

Android : Best way to apply code based on screen size
with this you can get the screen width after then compare this screen width with the galaxy mini then set it Display d = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int width = d.getWidth(); int height = d.getHeight();

Categories : Android

Database association, Case model has two People
When you asks for Client.first.cases, In this query Active Record understand, you want all cases to be fetched that belongs to Person table's first record (which id is 3). person_id is client_id, because first client's id in your person table is 3. If you will write : Client.first, In your sql query you will see : SELECT person.* FROM person WHERE person_id = 3 I think, you should try to pass a foreign_key constraint in you Case model like this: class Case < ActiveRecord::Base belongs_to :client, class_name: 'Person', foreign_key: "client_id" belongs_to :opponent, class_name: 'Person',foreign_key: "opponent_id" end Thanks.

Categories : Ruby On Rails

How display Image using value from database in case of ms-Dropdown
Connecting to a database and retrieving the picture is not a good option or not the way to go with displaying images rather you might go with CSS+Javascript or JQuery and display image using a simple image tag Try some code like this, it might work out function showPic(opt){ var selopt = document.getElementById("opt").value; if(selopt == 1){ document.getElementById("lambo").style.display="block"; } if(selopt == 1){ document.getElementById("audi").style.display="block"; } if(selopt == 1){ document.getElementById("ferr").style.display="block"; } } <select id="opt" onChange="showPic;"> <option value=1>Lamborgini</option> <option value=2>Audi</option> <option value=3>Ferrari

Categories : Jquery

Coldfusion - Query a database not case-sensitive
If this is a sql server database you don't have to do anything because it does case insensitive searches on varchar columns. Otherwise, you apply the upper() function to the sql field and ucase() to the ColdFusion variable. Something like this: where upper(firstname) like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#ucase(firstnamevar)#%> However, this will be slow. It might be worthwhile to store an uppercase version of the field in your db, with an index. Then you can do this: where upperCaseFirstName like <cfqueryparam cfsqltype="cf_sql_varchar" value="%#ucase(firstnamevar)#%> By the way, you posted this, WHERE #firstname# LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="%#firstnamevar#%" > Unless you have a variable named firstname, the oct

Categories : SQL

Searching the contacts database for a name without case sensitivity
If your DBMS support function UPPER(), you can do something like this: String name_to_search = edittext.getText().toString().toUpperCase(); String select = "(UPPER(" + ContactsContract.Contacts.DISPLAY_NAME + ") == "" +name_to_search+ "" )"; Cursor c = this.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, CONTACTS_SUMMARY_PROJECTION, select, null, ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"); this.startManagingCursor(c);

Categories : Android

Double saved as int in PostgreSql Database using CASE-WHEN
If you don't want to use the driver's parameter passing, and you should, then at least format it as: string UpdCmd = String.Format(@" UPDATE ""Haus"".""Category"" SET ""Value"" = CASE ""CategoryID"" WHEN 1 THEN {0} WHEN 2 THEN {1} END ", valueCategoryA, valueCategoryB); The double quote escapes another double quote inside a raw (@) string. In a raw string you can have a multi line string. That and the Format method makes it much more readable. Why use var if you know it is a string?

Categories : C#

Apply custom coupon discount code for products in cart
appcodecoreMageSalesModelQuoteAddressTotal Discount.php in $items = $address->getAllItems(); you can get all item and foreach ($items as $item) { in loop you can check your product condition after that you can rewrite this model for Discount.php in your extension

Categories : Magento

modalPopupExtender when shown from code-behind doesnt apply the transparency to the background
I battled this same issue for most of the day today. I have 3 pages with this identical code in them. two of the pages worked as expected, with transparent background, one did not. In that one, the background was always 100% opaque. Finally, I realised i had accidentally deleted the < !DOCTYPE html > line in that page. Adding that one line back into the page fixed the problem instantly. Simple. and a little unexpected. HTH

Categories : Misc

Remove free shipping method after apply coupon code
You can setup price rules for coupon codes in Promotions > Shopping Cart Price Rules Set the conditions for the coupons that they only work if Shipping Method is not [freeshipping] Free This will not hide the option of the free shipping, but the coupon code will not work when selecting the free shipping option (it removes the coupon code when selection it.). If you want to remove the option completly from one page checkout, you will need to code it. (i dont know any other way) something like this should work: <?php $coupon = Mage::getSingleton('checkout/session')->getQuote()->getCouponCode(); if(!$coupon) { FREE SHIPPING CODE FROM ONEPAGECHECKOUT IN HERE, IF NO COUPON CODE FOUND. } ?>

Categories : Magento

Auto-correct case spelling of a word database
You should define a function like this: def capitalize(structure): return [structure[0].capitalize(), (structure[1][0].capitalize(), structure[1][0].capitalize()), structure[2].capitalize()] However this is a very ugly solution. You should probably think at another way to represent data in a more clever way.

Categories : Python

How can I create a case-insensitive database index in Django?
To inject custom sql into the django model management commands check out django-admin.py sqlcustom You would put an sql file containing your create index in <app_name>/sql/<model_name>.sql From the docs on when they are applied: The SQL files are piped directly into the database after all of the models’ table-creation statements have been executed. Use this SQL hook to make any table modifications, or insert any SQL functions into the database. And you can view the custom sql for each app by running manage.py sqlcustom <app_name>

Categories : Database

what is the meaning of arr[i]:0:14 in Pascal?
It's a format for real numbers: writeln( foo:N:M ); prints the value of foo in a field width of N and shows M decimal places. So in C you'd use: printf( "%N.Mf ", foo ); If N is is too small to hold the formatted value (given the size of M), it will use the space it needs to print the number. In Pascal, you may have N and/or M be variables. In that case, in C, you could create the format string as follows: char my_fmt[50]; // could pick a "smarter" length for the string; this is just for example sprintf( my_fmt, "%%%d.%df ", N, M ); printf( my_fmt, foo ); Or even simpler: printf( "%*.*f ", N, M, foo );

Categories : C

BigInteger in Pascal
You will find a few different solutions in this Lazarus forum thread and here.

Categories : Misc

Pascal understanding
type TMakeProd = class(TProduct) .... LiProcProd : TListProcProd; .... end; In this declaration, LiProcProd is a public field. This is described by the documentation.

Categories : Delphi

Captcha code case sensitivity in CodeIgniter
update your validation function to this : I have used strtolower() for this. public function validate_captcha_code() { $cap = strtolower($this->input->post('captcha_code')); if($cap != strtolower($cap_word)) { $this->form_validation->set_message('validate_captcha_code', 'Wrong captcha code, Please try again.'); return false; }else{ return true; } }

Categories : PHP

apply style to genereted html code (multiple divs with no class)
Try this: #block-21 div:last-child { } Use the last-child pseudo selector. Or use the nth-child selector: #block-21 div:nth-child(2) { } Read more about some CSS selectors.

Categories : HTML

How to copy structure of database in newly created database in MySQL through java code?
Hard way: you can create a bash script to export old data and generate the new one based on your exported data and then, let java execute it for you Better way: Use liquibase to migrate your database. You can export your data into Xml file and then, again use Liquibase API to import the data from Xml file to your new database

Categories : Java



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