[Solved] If Statement not Working right [closed]

Assuming the statement you’re testing is actually ‘How is the weather’ then your if statement is working as expected. Your checks are seeing if the statement contains ‘weather’ and ‘what’ OR contains the word ‘how’ (note the lower case). As your phrase doesn’t contain the word ‘what’ the first check (for the words ‘weather’ AND … Read more

[Solved] Java code will not compile [closed]

Maybe the right code is: public double getTotalBalance(ArrayList<BankAccount> accounts) { double sum = 0; while (accounts.size() > 0) { BankAccount account = accounts.remove(0); // Not recommended sum = sum + account.getBalance(); } return sum; } solved Java code will not compile [closed]

[Solved] Splitting a string into integers

Since you are sure the string will contain digits, subtract each character from ‘0’ to get their numeric value. int sum = 0; fgets(str, sizeof str, stdin); char *s = &str; while(*s != ‘\0’) { sum += *(s++) – ‘0’; } printf(“the sum of the digits is: %d”, sum); solved Splitting a string into integers

[Solved] Check string format consist of specific words then number then specific words in c# [closed]

It’s really easy to make a regular expression to get matches: string[] input = new string[6] { “[email protected]”, // match “[email protected]”, // match “[email protected]”, // match “[email protected]”, // not a match “[email protected]”, // not a match “[email protected]” // not a match }; string pattern = @”Auto_gen_\d{4}@mail.com”; //\d{4} means 4 digits foreach (string s in input) … Read more

[Solved] PHP MySQL Json data saving [closed]

As ADyson said, you need to get the current state of that column, convert it to an array of objects, add the new object and then write that back to the database // change the connection to use the MYSQLI extension, then you can freely update to PHP 8 $vtbaglan = new mysqli(‘localhost’, ‘userid’, ‘password’, … Read more

[Solved] How to modify an array of objects containing values of the same name?

Something like this might work for you: var i; var k; for(i = 0; i < existingArray.length; i++){ var count = 2; for(k = 0; k < existingArray.length; k ++){ if(i != k && existingArray[i].content.host.name === existingArray[k].content.host.name){ existingArray[k].content.host.name += ‘_’ + count; count++; } } } 3 solved How to modify an array of objects … Read more

[Solved] Calling a PHP variable through button onclick [closed]

I suppose you’re not correctly encoding the content of the variables (known as XSS) You need to urlencode the content of your variables. Also, & needs to be entered as an HTML entity &amp;. Try: $url=”edit_beginningcakephp.php?title=”.urlencode($title).’&amp;author=”.urlencode($author).”&amp;isbn=’.urlencode($isbn).’&amp;year=”.urlencode($year).”&amp;pages=”.urlencode($pages).”&amp;price=”.urlencode($price); PS: >?should be ?> and make sure the URL doesn”t contain any newlines. 4 solved Calling a PHP variable … Read more

[Solved] Android Export Cropping When XXHDPI Taken as Baseline 100% In Photoshop Then How to crop means size of XHDPI, HDPI, MDPI, LDPI

I’m not sure, but don’t you need the resolutions of the images? If so, may I link you to Android Developer support? You can get a lot of information here: A set of six generalized densities: ldpi (low) ~120dpi mdpi (medium) ~160dpi hdpi (high) ~240dpi xhdpi (extra-high) ~320dpi xxhdpi (extra-extra-high) ~480dpi xxxhdpi (extra-extra-extra-high) ~640dpi To … Read more

[Solved] Split list in to sublist in C# [duplicate]

You can use this code. here I’m using string for demo, you can use your guid. var list = new List<string> { “a”, “b”, “c”, “d”, “e” }; var threashold = 2; var total = list.Count(); var taken = 0; var sublists = new List<List<string>>(); //your final result while (taken < total) { var sublst … Read more

[Solved] c# foreach loop formatting

Hmmm, I haven’t tested it. I hope it helps you. I would do it using two foreach inside the main while SearchResultSet results = session.Search(searchRequest); results.GetCount()); IEnumerable columns = results.GetColumns(); bool printColumns = true; while (results.HasNext()) { if(printColumns){ foreach (string column in columns) { Console.WriteLine(String.Format(“{0}|”, column)); //Will print Unique_ID|Address|etc… } } printColumns = false; foreach … Read more

[Solved] What would be the best way to sort events according to its date

First you need to convert it to an array: var events = Object.keys(obj).map((key) => { return Object.assign({}, obj[key], {eventName: key}); }); Then you need to group them by date. We can do this with lodash. var groupBy = require(‘lodash/collection/groupBy’); var eventsWithDay = events.map((event) => { return Object.assign({}, event, {day: new Date(event.date).setHours(0, 0, 0, 0)) }); … Read more

[Solved] class that gets a value from database [closed]

public static class myMethods { public static string getName(){ string name = “”; ConnectionStringSettings myConnectionString = ConfigurationManager.ConnectionStrings[“LibrarySystem.Properties.Settings.LibraryConnectionString”]; using (SqlConnection myDatabaseConnection = new SqlConnection(myConnectionString.ConnectionString)) { myDatabaseConnection.Open(); using (SqlCommand mySqlCommand = new SqlCommand(“select Top 1 * from Setting Order By SettingID Desc”, myDatabaseConnection)) using (SqlDataReader sqlreader = mySqlCommand.ExecuteReader()) { if (sqlreader.Read()) { name = sqlreader[“Name”].ToString(); } } … Read more