He Everyone,
I was wondering what some good hosting companies are. I am looking to put up a website for a programming I trying to get going (had our first meeting of the summer last Saturday!) and I am not sure who to host with. Who should I go with and why?
- Codecall
- → Viewing Profile: Topics: agnl666
Check out our Community Blogs
Community Stats
- Group Advanced Member
- Active Posts 172
- Profile Views 4472
- Member Title CC Addict
- Age 27 years old
- Birthday November 18, 1993
-
Gender
Male
-
Programming Language
C
Java
C++ -
Learning
Python
Assembly
-
Biography
I am 18 and have been programming for 2 years. I got my first programming job as a Research assistant when I was 17 and in grade 12 and though that project ended, I am currently working for a security company on a not yet released product as a programmer. I admit, I am addicted. I spend on average 30 to 40 hours per week and I love it.
-
Location
Halifax
-
Interests
Longboarding, Programming, Music
-
Occupation
Network Security Programmer
Topics I've Started
Web Hosting
26 June 2012 - 10:03 AM
Java Regex Troubles
29 May 2012 - 08:40 AM
Hello and thank you in advance for any help I am given.
I am curruntly working on parsing a string recieved from a query sent to a remote database. The format of the string is :
blah blah blah blah tag1: value I want tag1: value I don't want tag2: value I don't want tag3: .... (more stuff) tag1: value I don't want tag2: value I don't want blah blah blah blah
It may also come in the form :
blah blah blah blah tag1: value I want tag2: value I don't want tag3: .... (more stuff) tag1: value I don't want tag2: value I don't want blah blah blah blah
Where tag 1 only occurs once initially. As far as I know there is no limit to the number of times a tag may be in repetition though I only ever want the value of the first tag. Also, I am using the term tag though the field is really only denoted by a string with a colon at the end.
I am using regular expressions to parse the values I want out of the string though as the regular expressions are greedy by nature I am having trouble getting the contents of only the first tag.
The regex I am currently attempting to use : .+(tag1:){1}?\\s+(.+)\\s+(tag1:|tag2:){1}?.+
and what I am looking to attain is group 2 of this regex.
Any help with building this regex is appreciated. Thanks
I am curruntly working on parsing a string recieved from a query sent to a remote database. The format of the string is :
blah blah blah blah tag1: value I want tag1: value I don't want tag2: value I don't want tag3: .... (more stuff) tag1: value I don't want tag2: value I don't want blah blah blah blah
It may also come in the form :
blah blah blah blah tag1: value I want tag2: value I don't want tag3: .... (more stuff) tag1: value I don't want tag2: value I don't want blah blah blah blah
Where tag 1 only occurs once initially. As far as I know there is no limit to the number of times a tag may be in repetition though I only ever want the value of the first tag. Also, I am using the term tag though the field is really only denoted by a string with a colon at the end.
I am using regular expressions to parse the values I want out of the string though as the regular expressions are greedy by nature I am having trouble getting the contents of only the first tag.
The regex I am currently attempting to use : .+(tag1:){1}?\\s+(.+)\\s+(tag1:|tag2:){1}?.+
and what I am looking to attain is group 2 of this regex.
Any help with building this regex is appreciated. Thanks

Mysql Foreign Key Troubles
09 May 2012 - 06:45 AM
Hi and thanks in advance for any help.
I am currently having troubles inserting into a table with foreign keys. Bellow are the table dumps, my insert statement, and the error message I am recieving. I am not very knowledgable when it comes to mysql though I know enough to get by and would love to learn more!
Tables :
And the table I am attempting to insert into :
And my insert statement :
INSERT INTO Users (UserCountry, UserName) VALUES (0, 'some@email.com');
And the error I am getting :
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`UserDb`.`Users`, CONSTRAINT `fk_Users_Country1` FOREIGN KEY (`UserCountry`) REFERENCES `LocationDb`.`Country` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
I do not think there is a flaw with my query, I blieve the flaw is in my database structure. I spent some time crawling google looking for a solution though could find none so if any one could point me in the right direction to figure this out I would greatly appreciate it.
Thanks.
I am currently having troubles inserting into a table with foreign keys. Bellow are the table dumps, my insert statement, and the error message I am recieving. I am not very knowledgable when it comes to mysql though I know enough to get by and would love to learn more!
Tables :
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `LocationDb` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `LocationDb`; -- -- Table structure for table `Country` -- DROP TABLE IF EXISTS `Country`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Country` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Country` varchar(45) NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Country` -- LOCK TABLES `Country` WRITE; /*!40000 ALTER TABLE `Country` DISABLE KEYS */; INSERT INTO `Country` VALUES (0,'Canada'),(1,'United States'); /*!40000 ALTER TABLE `Country` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `Province` -- DROP TABLE IF EXISTS `Province`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Province` ( `Province` varchar(45) NOT NULL, `Country_Id` int(10) unsigned NOT NULL, `Timezone_Id` int(10) unsigned NOT NULL, FOREIGN KEY (`Country_Id`) REFERENCES `Country` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION, FOREIGN KEY (`Timezone_Id`) REFERENCES `Timezone` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Province` -- LOCK TABLES `Province` WRITE; /*!40000 ALTER TABLE `Province` DISABLE KEYS */; INSERT INTO `Province` VALUES ('Alberta',0,0),('British Columbia',0,1),('Manitoba',0,2),('New Brunswick',0,3),('Newfoundland-Labrador',0,3),('Nova Scotia',0,3),('Prince Edward Island',0,3),('Northwest Territories',0,0),('Nunavut',0,5),('Ontario',0,5),('Quebec',0,5),('Saskatchewan',0,2),('Yukon',0,4),('Alabama',1,2),('Arizona',1,0),('Alaska',1,7),('Arkansas',1,2),('California',1,1),('Connecticut',1,5),('Colorado',1,0),('Delaware',1,5),('Florida',1,5),('Georgia',1,5),('Hawaii',1,6),('Idaho',1,0),('Illinois',1,2),('Indiana',1,5),('Iowa',1,2),('Kansas',1,2),('Kentucky',1,2),('Lousiana',1,2),('Maine',1,5),('Maryland',1,5),('Massachusetts',1,5),('Michigan',1,5),('Minnesota',1,2),('Mississippi',1,2),('Missouri',1,2),('Montana',1,0),('Nebraska',1,2),('Nevada',1,1),('New Hampshire',1,5),('New Jersey',1,5),('New Mexico',1,0),('New York',1,5),('North Carolina',1,5),('North Dakota',1,2),('Ohio',1,5),('Oklahoma',1,2),('Oregon',1,1),('Pennsylvania',1,5),('Rhode Island',1,5),('South Carolina',1,5),('South Dakota',1,2),('Tennessee',1,2),('Texas',1,2),('Utah',1,0),('Virginia',1,5),('Vermont',1,5),('Washington',1,1),('West Virginia',1,5),('Wisconsin',1,2),('Wyoming',1,0); /*!40000 ALTER TABLE `Province` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `Timezone` -- DROP TABLE IF EXISTS `Timezone`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Timezone` ( `Id` int(10) unsigned NOT NULL, `Timezone` varchar(12) NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Timezone` -- LOCK TABLES `Timezone` WRITE; /*!40000 ALTER TABLE `Timezone` DISABLE KEYS */; INSERT INTO `Timezone` VALUES (0,'MST'),(1,'PST'),(2,'CST'),(3,'Etc/GMT+4'),(4,'YST'),(5,'EST'),(6,'HST'),(7,'AST'); /*!40000 ALTER TABLE `Timezone` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
And the table I am attempting to insert into :
DROP TABLE IF EXISTS `Users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Users` ( `UserId` int(10) unsigned NOT NULL AUTO_INCREMENT, `UserCountry` int(10) unsigned NOT NULL, `UserName` varchar(45) COLLATE latin1_bin NOT NULL, DEFAULT NULL, PRIMARY KEY (`UserId`), UNIQUE KEY `UserName_UNIQUE` (`UserName`), KEY `fk_Users_Country1` (`UserCountry`), CONSTRAINT `fk_Users_Country1` FOREIGN KEY (`UserCountry`) REFERENCES `LocationDb`.`Country` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_bin; /*!40101 SET character_set_client = @saved_cs_client */;
And my insert statement :
INSERT INTO Users (UserCountry, UserName) VALUES (0, 'some@email.com');
And the error I am getting :
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`UserDb`.`Users`, CONSTRAINT `fk_Users_Country1` FOREIGN KEY (`UserCountry`) REFERENCES `LocationDb`.`Country` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
I do not think there is a flaw with my query, I blieve the flaw is in my database structure. I spent some time crawling google looking for a solution though could find none so if any one could point me in the right direction to figure this out I would greatly appreciate it.
Thanks.
C++ Mysql Vs C Mysql
18 April 2012 - 11:34 AM
Hi,
I am currently working on an application using the C mysql connectors. I am wondering if it more efficient to use the c++ or c mysql APIs. The piece of code I am working on is going to be writing to a table within a mysql database possibly several thousand times within a 2 - 10 minutes period. The table the application will be writting to is also going to be readable by another application during the time the writes are taking place.
Thank you in advance.
I am currently working on an application using the C mysql connectors. I am wondering if it more efficient to use the c++ or c mysql APIs. The piece of code I am working on is going to be writing to a table within a mysql database possibly several thousand times within a 2 - 10 minutes period. The table the application will be writting to is also going to be readable by another application during the time the writes are taking place.
Thank you in advance.
Expected Primary-Expression
17 April 2012 - 04:06 PM
Hello,
I am currently working on a piece of code that is giving me a lot of strife though after about an hour and a half of crawling google I am still at a loss.
The troubleing piece of code is rather straight forward in concept. I am writing a data object to a mysql database using the C mysql connector API. I have a previous version of this code working using only C code though have been rewritting it in C++.
The data object is as fallows.
The method that is giving me trouble is
And the add_string_parameter method :
The MyObj class also has several methods and a constructor. It can also be assumed that MYSQL *conn and MYSQL_STMT *stmt_handle have been prepaired and initialized properly and that the data members of the MyObj object have been initialized.
Further more the error I am recieving is :
"error: expected primary-expression before ‘.’ token"
Which is occuring several times and is refering to "bind[0] = add_string_parameter((char*)obj.Field_1.c_str(), obj.Field_1.SourceIP.size());" lines.
I am currently working on a piece of code that is giving me a lot of strife though after about an hour and a half of crawling google I am still at a loss.
The troubleing piece of code is rather straight forward in concept. I am writing a data object to a mysql database using the C mysql connector API. I have a previous version of this code working using only C code though have been rewritting it in C++.
The data object is as fallows.
/* name : dawson reid date : April 12th, 2012 */ #include <string> using namespace std; #ifndef MYOBJ_H #define MYOBJ_H class MyObj { public : // DATA MEMBERS string Field_1, Field_2, Field_3; }; #endif /* MYOBJ_H */
The method that is giving me trouble is
bool writeMyObjToDb ( MyObj obj, MYSQL *conn, MYSQL_STMT *stmt_handle ) { if (conn == NULL) return false; else if (stmt_handle == NULL) return false; MYSQL_BIND bind[3]; memset(bind, 0, sizeof(bind)); // bind all variables bind[0] = add_string_parameter((char*)obj.Field_1.c_str(), obj.Field_1.size()); bind[1] = add_string_parameter((char*)obj.Field_2.c_str(), obj.Field_2.size()); bind[2] = add_string_parameter((char*)obj.Field_3.c_str(), obj.Field_3.size()); // handle execution and errors int mysql_return_code = mysql_stmt_bind_param(stmt_handle, bind); if (0 != mysql_return_code) { cout << "Error : Stmt bind failed." << endl; mysql_stmt_close(stmt_handle); return false; } mysql_return_code = mysql_stmt_execute(stmt_handle); if (0 != mysql_return_code) { cout << "Error : Stmt execute failed." << endl; mysql_stmt_close(stmt_handle); return false; } return true; }
And the add_string_parameter method :
MYSQL_BIND add_string_parameter(char* param, long unsigned int *param_length) { MYSQL_BIND temp_bind; memset(&temp_bind, 0, sizeof (temp_bind)); temp_bind.buffer_type = MYSQL_TYPE_VAR_STRING; temp_bind.is_null = 0; temp_bind.length = param_length; temp_bind.buffer_length = *param_length; temp_bind.buffer = param; return temp_bind; }
The MyObj class also has several methods and a constructor. It can also be assumed that MYSQL *conn and MYSQL_STMT *stmt_handle have been prepaired and initialized properly and that the data members of the MyObj object have been initialized.
Further more the error I am recieving is :
"error: expected primary-expression before ‘.’ token"
Which is occuring several times and is refering to "bind[0] = add_string_parameter((char*)obj.Field_1.c_str(), obj.Field_1.SourceIP.size());" lines.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download
- Codecall
- → Viewing Profile: Topics: agnl666
- Privacy Policy
- Guidelines ·