Posts

asp.net mvc - MVC4 Registering a user with extra details -

i beginer in mvc. want that, user wil have location. want keep locations in seprate table. the models came are: location model: public class location { [key] [databasegeneratedattribute(databasegeneratedoption.identity)] public int locationid { get; set; } public string address { get; set; } public string city { get; set; } public string state { get; set; } public string postalcode { get; set; } } userprofile model: public class userprofile { [key] [databasegeneratedattribute(databasegeneratedoption.identity)] public int userid { get; set; } public string username { get; set; } public string name { get; set; } public virtual location location { get; set; } } register model: public class registermodel { //attributes username , password , confirmpassword public string name { get; set; } public virtual location location { get; set; } } register controller : public actionresult register(registermodel mo...

c++ - Cereal - multiple de-serialization -

i new cereal, , have (possible simple) question: is there way deserialize multiple objects when don't know number of objects inside (xml) archive? i tried like: std::ifstream is("c:\\data.xml"); cereal::xmlinputarchive archive(is); while (is.good() && !is.eof()) { try{ objectin oin; archive(oin); objectlist.push_back(oin); } catch (exception e){ } } let's have 3 objects in xml file , xml receive hasn't containing object number. so, in code, first 3 iteration ok, 4th generates "unhandled exception @ 0x0035395e in cerealtest.exe: 0xc0000005: access violation reading location 0x00000018." do have suggestion? let me ask question before trying answer question: if serializing unknown number of items, why not place items in container designed hold variable number of items? use std::vector store objectin , handle number of them. code like: std::vector<myobjects> v...

javascript - FullCalendar Not Rendering in Tabs -

i have basic custom tabs setup function using click events show/hide divs. fullcalendar isn't showing on 1 of tabs despite using render function ( docs ). $(".tabs .tab").click (e) -> ... $("#calendar").fullcalendar "render" the #calendar div hidden, understanding, render function should force calendar render each click. of other tabs work properly, know it's not problem show/hide functionality @ all. does know might going wrong here? the problem ended being related way showing/hiding divs- the css selector using hide divs broad , ended assigning display: none; calendar div (which child of tab content divs). the solution change: $("#tab-contents div").hide() to: $("#tab-contents").children().hide in html calendar shown (in haml): #tab-contents #tab-calendar #calendar #tab-other ... thanks , suggestions, , should have posted more code in beginning.

php - connection to google cloudsql -

im trying connect google cloudsql appengine, im facing error: no connection made because target machine actively refused my php file, have uploaded appengine: $sql = new mysqli(null, 'myuser', // username 'mypass' 'mydb', null, '/cloudsql/**:**' ); if ($mysqli->connect_error) { echo 'no'; die('connect error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } else { echo 'yes\n'; } the appengine allowed cloud sql. should ? i have been trying replicate error getting unable reproduce when using code sample provided. also code sample has few mistakes, create connection $sql check $mysqli connection errors, should checking $sql. have changed occurances of $mysqli $sql , more conventional way check connection error check connect_errno , read message connect_error $sql = new mysqli(null, 'your-username', // username 'your_password_or_blank_if_using_roo...

python - How do I properly link against OpenGL framework using clang in OS X and Xcode 5.1? -

i trying figure out building bug in older python project, , stumped. project requires library linked against opengl , , setup.py passing -framework opengl flag linking stage of clang. system running 10.9.2 , xcode 5.1. include line in c file is: #include <opengl/glu.h> the call clang , resulting error is: /usr/bin/clang -bundle -undefined dynamic_lookup -l/opt/local/lib -wl,-headerpad_max_install_names -l/opt/local/lib/db46 build/temp.macosx-10.9-x86_64-2.7/src/visual/_polyobject.o -o build/lib.macosx-10.9-x86_64-2.7/trep/visual/_polyobject.so -framework opengl clang: error: unknown argument: '-framework opengl' [-wunused-command-line-argument-hard-error-in-future] clang: note: hard error (cannot downgraded warning) in future error: command '/usr/bin/clang' failed exit status 1 now comes weird part. exact same call clang, done shell script runs fine , links library correctly, no errors or warnings. running clang --help of no help, not describe -fr...

.htaccess - htaccess block users but not bots -

i have wordpress installation in subfolder , used api spa. block users seeing wordpress pages, allow bots crawl them (angularjs app using _escaped_fragment_ serve static content). if user hits /wordpress/ redirect root what htaccess rules this? (doesn't work): rewritecond %{request_uri} ^/wordpress[/]$ rewritecond %{http_user_agent} !=(googlebot|bingbot|baiduspider) [nc] rewriterule ^(.*)$ / [r=301,l]

xml - XSLT Date Formatting -

i have had @ various suggestions on here none problem. due sources xml comes can receive dates in following 3 formats; 04-04-2014(dd-mm-yyyy) 04-apr-2014(dd-mmm-yyyy) 2014-04-04(yyyy-mm-dd) i have function or simple command change of these (other third, yet able recognize third correct) yyyy-mm-dd i have long winded when/when/when currently, there must easier way. current xslt following; <xsl:choose> <xsl:when test="contains(date, 'jan')"> <xsl:value-of select="concat(substring(date,6),'-01-',substring(date,1,2))" /> </xsl:when> <xsl:when test="contains(date, 'feb')"> <xsl:value-of select="concat(substring(date,6),'-02-',substring(date,1,2))" /> </xsl:when> <xsl:when test="contains(date, 'mar')"> <xsl:value-of select="concat(substring(date,6),'-03-',substring(date,1,2))" /...