/ WordFriday
enterprise, noun
enterprise, noun a project or undertaking that is especially bold, complicated or arduous readiness to engage in undertakings of difficulty, risk, danger or daring a design of which the execution is attempted a commercial or industrial undertaking a firm, company or business a unit of economic organisation or activity Concise Oxford English Dictionary Oxford English Dictionary Merriam-Webster's Collegiate Dictionary
enterprise, noun a project or undertaking that is especially bold, complicated or arduous readiness to engage in undertakings of difficulty, risk, danger or daring a design of which the execution is attempted a commercial or industrial undertaking a firm, company or business a unit of economic organisation or activity Concise Oxford English Dictionary Oxford English Dictionary Merriam-Webster's Collegiate Dictionary
code, noun a set of instructions for a computer a computer program, or a portion thereof a system of words, figures or symbols used to represent others, especially for the purposes of secrecy a set of conventions or principles governing behaviour or activity in a particular domain Concise Oxford English Dictionary Oxford English Dictionary Merriam-Webster's Collegiate Dictionary
Fizz buzz is a group word game for children to teach them about division. http://en.wikipedia.org/wiki/fizz_buzz
Players generally sit in a circle. The player designated to go first says the number "1", and each player thenceforth counts one number in turn. However, any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. A player who hesitates or makes a mistake is eliminated from the game. http://en.wikipedia.org/wiki/fizz_buzz
Players generally sit in a circle. The player designated to go first says the number "1", and each player thenceforth counts one number in turn. However, any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. A player who hesitates or makes a mistake is eliminated from the game. http://en.wikipedia.org/wiki/fizz_buzz
Players generally sit in a circle. The player designated to go first says the number "1", and each player thenceforth counts one number in turn. However, any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. A player who hesitates or makes a mistake is eliminated from the game. http://en.wikipedia.org/wiki/fizz_buzz
Adults may play Fizz buzz as a drinking game, where making a mistake leads to the player having to make a drinking-related forfeit. [citation needed] http://en.wikipedia.org/wiki/fizz_buzz
Fizz buzz has been used as an interview screening device for computer programmers. http://en.wikipedia.org/wiki/fizz_buzz
FizzBuzz was invented to avoid the awkwardness of realising that nobody in the room can binary search an array. https://twitter.com/richardadalton/status/591534529086693376
I have yet to see any problem, however complicated, which, when you looked at it in the right way, did not become still more complicated. Anderson's Law
https://github.com/enterprisequalitycoding/fizzbuzzenterpriseedition
https://github.com/enterprisequalitycoding/fizzbuzzenterpriseedition
Architecture is the art of how to waste space. Philip Johnson
/ WordFriday
bi-quinary coded decimal, noun A system of representing numbers based on counting in fives, with an additional indicator to show whether the count is in the first or second half of the decimal range, i.e., whether the number represented is in the range 0 4 or 5 9. This system is found in many abacus systems, with paired columns of counters (normally aligned) representing each bi-quinary range. The Roman numeral system is also a form of biquinary coded decimal.
Signal-to-noise ratio (often abbreviated SNR or S/N) is a measure used in science and engineering that compares the level of a desired signal to the level of background noise. Signal-to-noise ratio is sometimes used informally to refer to the ratio of useful information to false or irrelevant data in a conversation or exchange. http://en.wikipedia.org/wiki/signal_to_noise_ratio
http://www.bonkersworld.net/object-world/
OBJECT-ORIENTED VenetianBlind Door Television Glass Picture Peephole TelevisionRemoteControl Sofa http://www.bonkersworld.net/object-world/
http://classnamer.com/
http://methodnamer.com/
public interface BookEntity... public interface BookEntityFactory... public interface ISBNValidator... public interface CatalogueRepository... public interface CatalogueRepositoryProvider... public abstract class AbstractBookEntity implements BookEntity public class BookEntityImpl extends AbstractBookEntity... public class BookEntityFactoryImpl implements BookEntityFactory... public class ISBNValidatorImpl implements ISBNValidator... public class CatalogueRepositoryImpl implements CatalogueRepository... public class CatalogueRepositoryProviderImpl implements CatalogueRepositoryProvider...
public interface Book... public final class ISBN... public interface Catalogue... public class DescriptionOfCatalogueImplementation implements Catalogue...
Naomi Epel The Observation Deck
People will be using the words you choose in their conversation for the next 20 years. You want to be sure you do it right.
package com.sun...;
Public APIs, like diamonds, are forever. Joshua Bloch "Bumper-Sticker API Design" http://www.infoq.com/articles/api-design-joshua-bloch
People will be using the words you choose in their conversation for the next 20 years. You want to be sure you do it right. Unfortunately, many people get all formal [...]. Just calling it what it is isn't enough.
They have to tack on a flowery, computer science-y, impressive sounding, but ultimately meaningless word, like Object, Thing, Component, Part, Manager, Entity, or Item.
public class ConfigurationManager...
public class Configuration...
public interface ConditionChecker boolean checkcondition();
public interface Condition boolean istrue();
Connection Factory Connection Connection Impl
Connection Pool Connection Pooled Connection
Parser Builder Tree
Parser Builder Tree BuilderImpl
Parser ParserListener Tree Builder
Parser ParserListener Builder Tree
Cargo cult programming is a style of computer programming characterized by the ritual inclusion of code or program structures that serve no real purpose. http://en.wikipedia.org/wiki/cargo_cult_programming
https://twitter.com/expertbeginner1/status/603188084725981185
Cargo cult programming is a style of computer programming characterized by the ritual inclusion of code or program structures that serve no real purpose. Cargo cult programming can also refer to the results of applying a design pattern or coding style blindly without understanding the reasons behind that design principle. http://en.wikipedia.org/wiki/cargo_cult_programming
Rien n'est plus dangereux qu'une idée, quand on n'a qu'une idée. Émile-Auguste Chartier
Nothing is more dangerous than an idea, when you have only one idea. Émile-Auguste Chartier
Nothing is more dangerous than an IDE, when you have only one IDE.
I currently have an average of 15-25 imports in each source file, which is seriously making my code mixed-up and confusing. Is too many imports in your code a bad thing? Is there any way around this? http://stackoverflow.com/questions/8485689/too-many-imports-spamming-my-code
It's normal in Java world to have a lot of imports. Not importing whole packages is good practice. It's a good practice to import class by class instead of importing whole packages. http://stackoverflow.com/questions/8485689/too-many-imports-spamming-my-code
Why?
It is not a problem. Any IDE will manage imports and show them to you only when needed. Most IDEs support code folding where all the imports are folded down to one line. I rarely even see my imports these days as the IDE manages them and hides them as well. Any good IDE, such as Eclipse, will collapse the imports in one line, and you can expand them when needed, so they won't clutter your view. http://stackoverflow.com/questions/8485689/too-many-imports-spamming-my-code
It is not a problem. Any IDE will manage imports and show them to you only when needed. Most IDEs support code folding where all the imports are folded down to one line. I rarely even see my imports these days as the IDE manages them and hides them as well. Any good IDE, such as Eclipse, will collapse the imports in one line, and you can expand them when needed, so they won't clutter your view. http://stackoverflow.com/questions/8485689/too-many-imports-spamming-my-code
It is not a problem. Any IDE will manage imports and show them to you only when needed. Most IDEs support code folding where all the imports are folded down to one line. I rarely even see my imports these days as the IDE manages them and hides them as well. Any good IDE, such as Eclipse, will collapse the imports in one line, and you can expand them when needed, so they won't clutter your view. http://stackoverflow.com/questions/8485689/too-many-imports-spamming-my-code
What is the Matrix? Control. The Matrix is a computer-generated dream world built to keep us under control in order to change a human being into this. Warner Bros.
I currently have an average of 15-25 imports in each source file, which is seriously making my code mixed-up and confusing. Is too many imports in your code a bad thing? Is there any way around this? Yes? Yes. Yes!
Avoid Long Import Lists by Using Wildcards Long lists of imports are daunting to the reader. We don't want to clutter up the tops of our modules with 80 lines of imports. Rather we want the imports to be a concise statement about which packages we collaborate with.
import java.util.arraylist; import java.util.collection; import java.util.hashmap; import java.util.hashset; import java.util.linkedhashmap; import java.util.linkedhashset; import java.util.linkedlist; import java.util.list; import java.util.map; import java.util.navigablemap; import java.util.navigableset; import java.util.set; import java.util.sortedmap; import java.util.sortedset; import java.util.treemap; import java.util.treeset;
import java.util.*;
import java.beans.introspector; import java.lang.reflect.array; import java.lang.reflect.constructor; import java.lang.reflect.method; import java.lang.reflect.modifier; import java.lang.reflect.proxy; import java.util.arrays; import java.util.collection; import java.util.collections; import java.util.hashmap; import java.util.hashset; import java.util.iterator; import java.util.linkedhashset; import java.util.map; import java.util.set;
import java.beans.*; import java.lang.reflect.*; import java.util.*;
import java.awt.*; import java.util.*; List?
import java.awt.*; import java.util.*; import java.util.list;
Connection * CreateServerConnection() // Declarations char buffer[1024]; std::string cfgaddress; unsigned long address; std::string cfgport; unsigned short port; Connection * result; // Get address and check that its OK (throw an exception if its not) cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); // Convert adress to bytes and check that its OK (throw an exception if its not) address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); // Get port and check that its OK (throw an exception if its not) cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); // Convert port too bytes port = htons(atoi(cfgport.data())); // Creation connection and check that its OK (throw an exception if its not) result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); // Return the connection return result;
Connection * CreateServerConnection() // Declarations char buffer[1024]; std::string cfgaddress; unsigned long address; std::string cfgport; unsigned short port; Connection * result;...
Connection * CreateServerConnection()... // Get address and check that its OK (throw an exception if its not) cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer);...
Connection * CreateServerConnection()... // Convert adress to bytes and check that its OK (throw an exception if its not) address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer);...
Connection * CreateServerConnection()... // Get port and check that its OK (throw an exception if its not) cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer);...
Connection * CreateServerConnection()... // Convert port too bytes port = htons(atoi(cfgport.data()));...
Connection * CreateServerConnection()... // Creation connection and check that its OK (throw an exception if its not) result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer);...
Connection * CreateServerConnection()... // Return the connection return result;
Connection * CreateServerConnection() // Declarations... // Get address and check that its OK (throw an exception if its not)... // Convert adress to bytes and check that its OK (throw an exception if its not)... // Get port and check that its OK (throw an exception if its not)... // Convert port too bytes... // Creation connection and check that its OK (throw an exception if its not)... // Return the connection...
Connection * CreateServerConnection() // Declarations... // Get address and check that it's OK (throw an exception if it's not)... // Convert address to bytes and check that it's OK (throw an exception if it's not)... // Get port and check that it's OK (throw an exception if it's not)... // Convert port to bytes... // Creation connection and check that it's OK (throw an exception if it's not)... // Return the connection...
Connection * CreateServerConnection().....................
Connection * CreateServerConnection() char buffer[1024]; std::string cfgaddress; unsigned long address; std::string cfgport; unsigned short port; Connection * result; cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); port = htons(atoi(cfgport.data())); result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;
Connection * CreateServerConnection() char buffer[1024]; std::string cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); unsigned long address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); std::string cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); unsigned short port = htons(atoi(cfgport.data())); Connection * result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;
Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(atoi(cfgport.data())); Connection * result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;
Connection * CreateServerConnection()... Connection * result = new Connection(address, port); if(!result!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;
Connection * CreateServerConnection()... Connection * result = new Connection(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;
std::auto_ptr<connection> CreateServerConnection()... std::auto_ptr<connection> result(new Connection(address, port)); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;
std::unique_ptr<connection> CreateServerConnection()... auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result;
Connection * CreateServerConnection()... auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();
Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(atoi(cfgport.data())); auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();
Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.data()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(atoi(cfgport.data())); auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.data(), cfgport.data()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();
Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(atoi(cfgport.c_str())); auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.c_str(), cfgport.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();
Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.c_str(), cfgport.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();
Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) sprintf(buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) sprintf(buffer, "Invalid address: %s", cfgaddress.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) sprintf(buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) sprintf(buffer, "Failed to connect: %s:%s", cfgaddress.c_str(), cfgport.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();
Connection * CreateServerConnection() char buffer[1024]; auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) snprintf(buffer, sizeof buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) snprintf(buffer, sizeof buffer, "Invalid address: %s", cfgaddress.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) snprintf(buffer, sizeof buffer, "Configuration value missing: %s", "port"); Log::Instance().Write(buffer); throw ConnectionException(buffer); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) snprintf(buffer, sizeof buffer, "Failed to connect: %s:%s", cfgaddress.c_str(), cfgport.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer); return result.release();
Connection * CreateServerConnection() char buffer[1024];... if(cfgaddress.empty()) snprintf(buffer, sizeof buffer, "Configuration value missing: %s", "address"); Log::Instance().Write(buffer); throw ConnectionException(buffer);... if(address == -1) snprintf(buffer, sizeof buffer, "Invalid address: %s", cfgaddress.c_str()); Log::Instance().Write(buffer); throw ConnectionException(buffer);...
Connection * CreateServerConnection()... if(cfgaddress.empty()) std::stringstream buffer; buffer << "Configuration value missing: " << "address"; Log::Instance().Write(buffer.str()); throw ConnectionException(buffer.str());... if(address == -1) std::stringstream buffer; buffer << "Invalid address: " << cfgaddress; Log::Instance().Write(buffer.str()); throw ConnectionException(buffer.str());...
Connection * CreateServerConnection()... if(cfgaddress.empty()) static const char * logmessage = "Configuration value missing: address"; Log::Instance().Write(logMessage); throw ConnectionException(logMessage);... if(address == -1) auto logmessage = "Invalid address: " + cfgaddress; Log::Instance().Write(logMessage); throw ConnectionException(logMessage);...
Connection * CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) static const char * logmessage = "Configuration value missing: address"; Log::Instance().Write(logMessage); throw ConnectionException(logMessage); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) auto logmessage = "Invalid address: " + cfgaddress; Log::Instance().Write(logMessage); throw ConnectionException(logMessage); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) static const char * logmessage = "Configuration value missing: port"); Log::Instance().Write(logMessage); throw ConnectionException(logMessage); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) auto logmessage = "Failed to connect: " + cfgaddress + ":" + cfgport; Log::Instance().Write(logMessage); throw ConnectionException(logMessage); return result.release();
Connection * CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result.release();
Connection * CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result.release();
Connection * CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result.release();
std::unique_ptr<connection> CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result;
std::unique_ptr<connection> CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().GetValue("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().GetValue("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result;
std::unique_ptr<connection> CreateServerConnection() auto cfgaddress = ConfigurationManager::Instance().ValueOf("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = ConfigurationManager::Instance().ValueOf("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result;
std::unique_ptr<connection> CreateServerConnection() auto cfgaddress = Configuration::Instance().ValueOf("address"); if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); auto cfgport = Configuration::Instance().ValueOf("port"); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result;
std::unique_ptr<connection> CreateServerConnection( const std::string & cfgaddress, const std::string & cfgport) if(cfgaddress.empty()) FailedToConnect("Configuration value missing: address"); auto address = inet_addr(cfgaddress.c_str()); if(address == -1) FailedToConnect("Invalid address: " + cfgaddress); if(cfgport.empty()) FailedToConnect("Configuration value missing: port"); auto port = htons(stoi(cfgport)); auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect("Failed to connect: " + cfgaddress + ":" + cfgport); return result;
std::unique_ptr<connection> CreateServerConnection( in_addr_t address, in_port_t port) auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect(address, port); return result;
std::unique_ptr<connection> ConnectToServer(in_addr_t address, in_port_t port) auto result = std::make_unique<connection>(address, port); if(!result->isok()) FailedToConnect(address, port); return result;
std::unique_ptr<connection> ConnectToServer(in_addr_t address, in_port_t port) return std::make_unique<connection>(address, port);