Posts

java - Is there a way to use Postgresql copy (loading CSV in table) from Hibernate? -

in current application using hibernate + postgresql. particular case need use copy functionality available in postgres load data csv file. there way use copy using hibernate. postgres version : 9.4 hibernate version : 5.0.6 based on @a-horse-with-no-name comment, put following code session.dowork deprecated. sessionfactory factory = hibernateutil.getsessionfactory(); session session = factory.opensession(); sessionimplementor sessimpl = (sessionimplementor) session; connection conn = null; conn = sessimpl.getjdbcconnectionaccess().obtainconnection(); copymanager copymanager = new copymanager((baseconnection) conn); file tf =file.createtempfile("temp-file", "tmp"); string temppath =tf.getparent(); file tempfile = new file(temppath + file.separator + filename); filereader filereader = new filereader(tempfile); copymanager.copyin("copy testdata (col1, col2, col3) stdin csv", filereader ); hope helps readers.

multithreading - SignalR, Outlook add-in and multithread exception -

in outlook have code... _connection = new hubconnection(me._url) _connection.credentials = credentialcache.defaultcredentials _hub = _connection.createhubproxy(me._hubname) _hub.on(of string)("newmessage", function(message) dim f new testform f.show() return "" end function) _connection.start() but showing form "testform" crashes since in main thread , signalr on thread. any idea how can make work? your best attempt use dedicated thread signalr jobs , on main sta thread accessing outlook object model or displaying forms/wpf components. this how can "continue" work on main thread: hooked events outlook vsto continuing job on main thread

c# - MVC: Delay jquery script execution until after Layout script has completed -

i'm developing asp.net project uses quite bit of client side jquery scripting. in layout.cshtml page have ajax call returns information logged in user. pages in application depend on information. therefore need mechanism don't execute script in individual views until call on layout page has completed. generally use jquery deferreds quite difficult calls in 2 unconnected files (e.g. layout.cshtml , individual view cshtml). other options can think of make initial call synchronous don't want or have sort of wait loop (e.g. settimeout(checkval, 200), neither solution appeals me. below simplistic sample of trying do. layout.cshtml $(document).ready() { function loaduserdata() { return $.ajax({ type: "get", contenttype: "application/json", datatype: "json", url: baseurl + "/account/getusermeta", success: function (res) { ...

select option selection in php -

i have form input order, there 2 fields, branch , customer model. before click button "search", must select branch , customer fields. after filled field, click button search, data appears. problem is, after data appears, condition branch , customer models filled, want create search, changed branch field (customer model field same previous search), change branch field 'a' 'b' , click button search, data not appears / empty (whereas data exists in database). branch field,the field when changed b, after click button search, branch filled changed 'select' (branch option select -> , b). i'm confused problem.. here code : <?php if ($_post) { $_session['data_id'] = $_post['data_id']; $_session['branch'] = $_post['branch']; $_session['customer_model'] = $_post['customer_model']; } ?> <form id="search" class="formular" method="po...

ios - Navigationbar Translucent property -

Image
i having requirement first view controller has self.navigationcontroller.navigationbar.translucent = yes; and second view controller has self.navigationcontroller.navigationbar.translucent = no; so while navigating first view controller second view controller can see white space on top... can me smooth navigation. try insert following code viewdidload: if( [self respondstoselector:@selector(edgesforextendedlayout)] ) { self.edgesforextendedlayout = uirectedgenone; }

javascript - Use Onload on image tag in ember -

i have template in photos being displayed in frame ( each frame different different images) .i have written function uses images original height , width , gives me customized width , height particular frame inorder restore aspect ratio.now have called function through onload images loads on particular moment. my feed.hbs( template) <img src = "{{photo.0.photo_url}}" onload = "onimageload(event);" {{action "imgoverlay0" photo}}/> function function onimageload(evt) { var img = evt.currenttarget; // what's size of image , it's parent var w = $(img).width(); var h = $(img).height(); var tw = $(img).parent().width(); var th = $(img).parent().height(); // compute new size , offsets var result = scaling(w, h, tw, th,false); // adjust image coordinates , size img.width = result.width; img.height = result.height; $(img).css("margin-left", result.targetleft); $(img).css(...

excel vba - Vba Powerpoint name a table -

i pasted table excel powerpoint code: pptapp.commandbars.executemso ("pasteastablesourceformatting") there other shapes on slide. how can make powerpoint find pasted table on slide , name it? whenever paste in powerpoint appears on topmost layer can reference , optionally set name function: option explicit ' *********************************************************** ' purpose: topmost shape current slide. ' inputs: sname - optionally rename shape ' outputs: returns shape object if slide not empty. ' author: jamie garroch ' company: youpresent ltd. http://youpresent.co.uk/ ' *********************************************************** function getpastedshape(optional sname string) shape dim lcurslide long ' current slide index lcurslide = activewindow.view.slide.slideindex activepresentation.slides(lcurslide) if .shapes.count = 0 exit function ' set reference shape on top layer set getpastedshape ...