Posts

Loading data from file into MySQL table with foreign key constraint -

i need load data file table foreign key constraint. if have parent table populated , want populate child how find appropriate foreign key child. i.e. if have department , employee table employee contains fk_department_id no other identifying information department, how know department employee belongs to. thinking of using temporary tables contained identifying information department (like department name) in employee table , using join appropriate fk's. put info without identifying columns database, don't think best way it. first load data department table, , after execute following using department name in employee csv, ex.: department csv: deptname, manager ("finance","ted smith") department table: de_id, de_name, de_manager emplstrong textoyee csv: name, surname, deptname ("tom", "smith", "finance") employee table: em_id, em_name, em_surname, em_de_id load data low_priority local infile 'c:\\temp\\empl...

.net - How can I embed an configuration-specific manifest file in my c# app? -

i'd embed platform-specific manifest file in c# app. there easy way in visual studio 2008 without using external script called after build finished? in creating c# app, configuration , platform dropdowns disabled application tab, preventing me selecting architecture or configuration specific manifest embed app. i'm forced use 1 manifest whole application. i thought of using post build event call little script embed right manifest based on $(configuration) macro variable, , works, want without calling other script , want know if it's possible without using build events. can embed x86 , x64 assembly references in same manifest file , run time load correct one? you need add app.manifest file. right-click project, select "add" -> "new item...". select "general" entry on left tree view under "visual c# items". "templates" list, locate , select item call "application manifest file". click add. ...

Inserting PHP inside HTML code, ie. inside < ... value="PHP CODE HERE" /> - workaround? -

i have custom fields defined on wordpress in have entered episode number each post have written. want use value in form, need keep form code same , call using shortcode in each post since there way many posts edit manually. i have tried <input type="hidden" name="episode" value="<?php the_meta(); ?>"/> to set value of episode inside form value specific post, php code still able seen on page source code not going through. there workaround? you have echo response. <input type="hidden" name="episode" value="<?php echo the_meta(); ?>"/> of course can use print functions.

php - query not resolving right, how to? -

i have query should return 40 results: $test = mysql_query(" select fname online_all verify_status = 'v' limit 40 "); if (!$test ) {print " - mysql error - ";echo fns_et_mysql_error(mysql_error());} if echo mysql_num_rows($test); 40 . means results when print_r $roww = mysql_fetch_array($test); 1 result. there no php errors. you have loop through results with: while($row = mysql_fetch_array($test)) { // awesomeness $row }

c++ - boost::variant & STL containers - Am I doing it wrong? -

i'm scratching head on one. i'm trying use boost::variant store vector of values of type determined @ run time. vector's internal type doesn't change once known. trying create interface code can add value vector , later retrieve values vector. code not compile. approach wrong? should using polymorphism job? code follows (does not compile): template <typename t> class record_value_visitor : public boost::static_visitor<void> { public: record_value_visitor(t v) : _val(v) {} void operator()(vector<t>& vec) const { vec.push_back(this->_val); } private: t _val; }; class monitor { public: monitor(int type) { switch (type) { case 1: this->_values = vector<int>(); break; case 2: this->_values = vector<string>(); break; default: throw new exception("invalid type...

routing - how to do testing of rails layouts, when they call url_for -

i have test case tests layout. looks see if links present or absent different kinds of users (admin links, instance). worked fine until started localize of our interface. describe "layouts/application" include devise::testhelpers fixtures :users "renders admin link admin user" @admin = users(:admin) sign_in(@admin) @locale = 'en' render rendered.should match(/administration/) end end the layout contains call <%= toggle_language %>, uses url_for generate url current one, :locale parameter changed: def toggle_language case locale when :fr other=:en when :en other=:fr else other=:fr end link_to t(:other_language), url_for(:locale => other) end the problem since have no controller called "layouts", url_for can't generate needs. 1) layouts/application renders admin link admin user failure/error: render actionview::template::error: no route matches {:controller=>...

c# - Openxml Add another different footer to an existing docx -

i trying add different footer after each altchunk added. code changes footers , on last page there 2 footers. adding section break prior adding new footer different text. (c# , openxml) public static void appendfooter(string sfttext, string sfile) { using (wordprocessingdocument wddoc = wordprocessingdocument.open(sfile, true)) { maindocumentpart mypart = wddoc.maindocumentpart; footerpart newftpart = mypart.addnewpart<footerpart>(); string ft_id = mypart.getidofpart(newftpart); makefooterpart(sfttext).save(newftpart); foreach (sectionproperties sectproperties in mypart.document.descendants<sectionproperties>()) { footerreference newftreference = new footerreference() { id = ft_id, type = headerfootervalues.default }; sectproperties.append(newftreference); } // save changes ...