[Solved] Delete rows that DON’T meet VBA criteria

This will delete rows that don’t equal a whole number when divided by 50 Sub Button1_Click() Dim FrstRng As Range, Lrw As Long Dim UnionRng As Range Dim c As Range Lrw = Cells(Rows.Count, “A”).End(xlUp).Row Set FrstRng = Range(“A2:A” & Lrw) For Each c In FrstRng.Cells If Int(c / 50) / (c / 50) <> … Read more

[Solved] T-SQL to generate expect result

Assuming that I understand the problem: you have a number of rows with sections (“Cates”) and symbols (“Type”); if there are any symbols ending in a minus sign then these indicate a row without a minus sign should be removed; symbols are never “mixed” per section, i.e. a section can never have “A” and “B-“; … Read more

[Solved] Cpp program not working as expected [closed]

You are setting all of your valuables to 0 at the beginning. Try: int radius: at the beginning, this will create your variable but not give it a value, then after cin >> radius; you can do basically what you had before: cin >> radius; auto area = radius*radius * 3.14; auto amount = area … Read more

[Solved] C++ Issues with vector

You did not show the code which adds the Child*s to the vector, but the symptoms you describe provide compelling evidence that you used pointers to some kind of local or temporary objects, which go out of scope (are destroyed) while the vector still holds the pointers. Your program hangs as a result of using … Read more

[Solved] C++ Object Variables

Try this. ClassA example; example.a =.01; You were using pointers in your code, and it looks like you need practice with other ideas before starting with pointers. 11 solved C++ Object Variables

[Solved] Return correct time measurements from a date [closed]

This is an overly simplified example of what you could do, using only .NET classes: public static string TimeSinceEvent(DateTime eventTime) { TimeSpan timeSince = DateTine.Now – eventTime; if (timeSince.Hours > 0) return string.Format(“Added {0} hours ago”, timeSince.Hours); else if (timeSince.Minutes > 0) return string.Format(“Added {0} minutes ago”, timeSince.Minutes); else return string.Format(“Added {0} seconds ago”, timeSince.Seconds); … Read more

[Solved] What is the simplest way to access array (not vector) element from middle to outermost?

An algorithm to list the elements from innermost to outermost is to pull off the last and first entries (pop and shift) in the array in alternation until no elements are left, then reverse the list of what you have pulled off. This works for odd and even-length arrays naturally. For example, 1,2,3,4,5,6 1,2,3,4,5 6 … Read more

[Solved] Will these implementations cause memory leakage?

The 1st alternative will cause a memory leak whether you pass true or false to the constructor of Derived. Exactly one Structure will be allocated on the heap, which is then copied by the default copy constructor of Structure when the assignment var = structure; is executed. If you: replace the internal var variable type … Read more

[Solved] Fast comparing array to the number

TL;DR: do it the obvious way, and make sure your compiler optimizes it. It’s hard to reason about performance without a full, reproducible program example. So let’s start with a straightforward implementation: #include <array> #include <algorithm> std::array<int, 362856427> a = {}; int main() { a[500] = 1; a[5000] = 1; a[50000] = 1; a[500000] = … Read more

[Solved] How can I send the same email message to more than 3000 customers [closed]

List<Customer> customerList = GetAllCustomers(); string subject = “Hello World”; string content = GetContent(); // Loop through all customers and send e-mail to each foreach(Customer customer in customerList) { MailMessage newMail = new MailMessage(“[email protected]”, customer.Email, subject, content); newMail.IsBodyHtml = true; SmtpClient sender = new SmtpClient(); sender.Send(newMail); } You can move the GetContent() within the loop if … Read more

[Solved] Comparing strings is “1”

A comparison of Strings in Java is done character by character. Each character has a specific ranking to it based on where it appears in the Unicode character table (for this case, we can use ASCII, since it’s English). “1” would be considered less than “7”, as well as “T”. To invoke (place this inside … Read more

[Solved] What would be the value of variable after executing the following statement

It throws a NumberFormatException. From the Javadoc on Integer.parseInt(String s): Throws: NumberFormatException – if the String does not contain a parsable int. Retrieving the ASCII value of a character is done like this: char ch=”a”; System.out.println((int)ch); 1 solved What would be the value of variable after executing the following statement