Posts

c# - EntityFrameworks inserts already inserted related item -

im trying create user, connect user model called event. var user = new applicationuser { name = "test", email = "test@test.com" }; var userresult = usermanager.create(user, "password"); if (userresult.succeeded) { signinmanager.signinasync(user, ispersistent: false, rememberbrowser: true); @event.createdby = user; @event.createdbyid = new guid(user.id); db.events.add(@event); db.savechanges(); } but db.savechanges() throws validation error on applicationuser model: user email exists: test@test.com (even though didnt exists before request) so seem ef trying reinserted inserted user. the event model have these setters/getters public virtual applicationuser createdby { get; set; } public virtual guid createdbyid { get; set; } and works great if current singned in user instead of signing new one. i have tried set @event.createdbyid , skip @event.createdby , ef doesnt save reference database. this line crea...

javascript - AJAX: Asynchronously posting a file to a server -

i want post file server asynchronously without posting form. have following code: var fileinput = document.getelementbyid('fileinput'); var file = fileinput.files[0]; var formdata = new formdata(); formdata.append('file', file, file.name); var xhr = new xmlhttprequest(); xhr.open('post', 'http://servername/controllername/analysefile', true); xhr.setrequestheader('content-type', 'multipart/form-data'); xhr.send(formdata); however, when method executed on server, post body contains no files. following asp.net mvc4: [httppost] public jsonresult analysefile() { int filescount = request.files.count; if(filescount == 0) { throw new exception('no files...'); } // stuff } the files collection contains no files , can't figure out why. appreciated. in view, can do: <form> <input name="input1" id="input1"/> <input name="input2" id="input2"/> <input ...

node.js - Proper way to create indexes during deployment -

i creating expressjs api , using mongodb. have decent understanding of indexes , understand expensive create when there data in database. in ms sql server create indexes when creating database tables. question handle creation of indexes in post call in express app or achieve using scripts when deploymening application? for example need geospatial indexing. would index creation handled in express app this? //express post call let col = db.collection( 'collection' ); col.createindex( // someindex ); col.insertone( //some document ); i looking best method creating 'initial' state of mongodb , creating indexes need collections before these collections contain documents. so, may happen, have lot of data in database while deployment , not want indexing terrible. here's mongodb can help. can indexing in background not prevent read , write operations database while index builds.a simple command: db.collection.createindex( { a: 1 }, { background: tr...

javascript - beforeunload event and JQuery Dialog immediately closes after switch screen -

good day, here structure of .php main.php of navibar here. there's iframe screen contents. content1.php content 1 contains textfields. jquery dialog if leaving screens. content1 code : $(window).bind('beforeunload', function(e){ dialog(); }); dialog(); $('form[name="rowform"]').on('submit', function (e) { e.preventdefault(); }); var fieldnamestocheck = xxxxx; var previousvaluefieldnames = xxxxx; if (detectchangesoninputs(fieldnamestocheck, previousvaluefieldnames)) { $("#unsaved-values-confirmation-dialog").dialog("open"); $('.ui-dialog :button').blur(); } for close , refresh event, beforeunload event fine. when start hitting navibar, happen is, dialog shows , closes. is there wrong in codes? thanks!

java - radio button not doing it's action -

every time click radio button in2cm , try convert, there nothing showing when click convert button. if possible show me how use list box, put on list box , make gui more easier use. buttongroup convertgroup=new buttongroup(); jr=new jradiobutton[10]; jr[0]=new jradiobutton("inch cm"); l1 = new jtextfield(25); l2 = new jtextfield(25); length1 = new jlabel("ft", swingconstants.left); length2 = new jlabel("cm", swingconstants.left); convertgroup.add(jr[0]); jr[1]=new jradiobutton("meter feet"); length = new jlabel("m = ", swingconstants.left); l1 = new jtextfield(25); l2 = new jtextfield(25); length1 = new jlabel("ft", swingconstants.left); length2 = new jlabel("cm", swingconstants.left); convertgroup.add(jr[1]); jr[2]=new jradiobutton("mile km"); mi2km = new jtextfield(25); km2mi = new jtextfield(25); length3 = new jlabel("mile", swingconstants.left); length4 = new jlabel("km...

sap - Employee Qualification Infotype 0024 -

in transaction pa30 after enter personnel number , select infotype 0024, display qualifications of employee (if have any). i want create report 3 parameters ('qualification group', 'name' , 'proficency' ) , after user inserts data, display employees have skills. if access table pa0024, has no entries, question is: in table (or where) can find employees qualifications? other suggestions on how make report help. as recall, qualifications can stored in pd tables. qualifications objets type 'q' stored in hrp1000. relations between employee , qualifications stored hrp1001. field adatanr of relation key entry in table hrpad31 (i think) contains rating of employee qualification. others tables t77ts (holds qualification ids , text) , t77tp (holds qualification scale ids , texts) there function module in function group "rhpp", such rhpp_q_profile_read (using p objects in objects parameter)

xampp - How do I find what causes a blank white screen in WordPress? -

am trying build test environment wordpress project using xamp. apache listening on localhost:8080 mysql 3306 root no password changes did in wp-config dbname wp-db dbhost locallhost:8080 dbuser root wordpress root folder in c:/xamp/htdocs/wordpress before changing dbhost local host localhost:8080 getting "error establishing connection database" jus getting full white screen. please advise. million in advance. white screens php errors. try debug , see php errors getting. may have error in wp-config.php or missing core wordpress file or folder. add define( 'wp_debug', true ); define( 'wp_debug_log', true ); in wp-config.php , debug.log file in wp-content. add line define( 'wp_debug_display', true); to wp-config.php log , dump them browser. see https://codex.wordpress.org/wp_debug