Posts

java - Hibernate entity virtual column error? -

i have defined virtual column distanceinkm in entity distance calculation , giving response user along distanceinkm virtual column not column in table,and it's working (case 1) . now using same entity fetching values table getting com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: unknown column 'restaurant0_.distanceinkm' in 'field list' . (case 2) i came know usage of @transiant annotation virtual columns used calculation.but if using virtual column not serialized/added user response in (case 1) .i need implement both api ie , case 1 & case 2 using 1 entity @entity @table(name = "restaurants") public class restaurants implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.identity) @column(name = "restaurant_id") private int restaurantid; @column(name = "restaurant_name") pr...

google maps - Javascript setter function -

i creating class function in js following create new google maps. i have problem having default value zoom variable , able change after object has been created. here piece of code of function: function gmap(lat,lng){ this.latitude = lat; this.longitude = lng; this.mapcenter = new google.maps.latlng(lat, lng); this.map = null; this.zoom = 20; // default value this.setzoom = function(value) { this.zoom = value; } this.getzoom = function() { return this.zoom; } this.mapoptions = { center: this.mapcenter, zoom: this.zoom }; this.createmap = function(htmlelement) { map = new google.maps.map(document.getelementbyid(htmlelement), this.mapoptions); return this.map; } } i calling above this: var gmap= new gmap(10, 20); gmap.setzoom(9); console.log(gmap.getzoom()); //returns 9 google.maps.event.adddomlistener(window, 'load', gmap.createmap('map...

inno setup - InnoSetup: FileSize -

i need size of file. need check if file more 100b example: if filesize('c:\program files\myprogramm\myapp.exe') > 100 msgbox ('file more 100', mbinformation,mb_ok) else msgbox ('file less 100', mbinformation,mb_ok) i function filesize(const name: string; var size: integer): boolean; , it's work if need check - size correct or not. cann't check on more or less the var keyword in function prototype means need declare variable of given type , pass function. variable receives value. here example filesize function: var size: integer; begin // second parameter of filesize function defined 'var size: integer', // need pass there variable of type integer, size variable // declared above if filesize('c:\thefile.any', size) begin if size > 100 msgbox('the file bigger 100b in size.', mbinformation, mb_ok) else msgbox('the file smaller 100b in size.', mbinf...

c# - Selenium webdriver - driver.Navigate on same page -

i doing testings, .net webdriver. the first test, opens windows ok, , next steps, want using same (current web page), , not opening new window browser each time. my code driver.navigate().gotourl(baseurl + "/tableaubord"); everytime, need tests of suite link, open me new window, , test fail. i found codes driver.to()...but compiler doesn' t propose choice. can me out cheers you check system properties possible solution e.g. system.setproperty("restart.browser.each.scenario", "false"); might you. otherwise try properties using system.getproperties().tostring() and check if there property fits need (or maybe find list properties via google).

java - Valid members of polymorphic array of an Interface type -

following sample class design hope me ask question: public interface foo { int somemethod(); } public abstract class bar implements foo { public int somemethod() { return 1; } } public class baz extends bar { } public class quz extends bar { public int somemethod() { return 2; } } public class norf extends baz { public static void main(string[] args) { foo[] arr = new foo[4]; // code take advantage of polymorphism } } in norf class , have created polymorphic array of type foo (which interface). trying understand objects of classes allowed member/element of array. from understand , if making polymorphic array of class , objects created sub-class (any of descendant in inheritance tree) can member of array. i trying formulate rule polymorphic array of interface. coming sample class design , following seems valid (i typed out in ide , did not complain) arr[0] = new baz(); arr[1] = ne...

c# - Executing powershell threads in IIS as impersonated user -

Image
i've been working on web application makes use of powershell scripts. reason, asp.net impersonation, getting "access denied" errors on commands require elevated access. the web application deployed via iis 7.5 running on windows 2008 r2 standard sp1 server. i've checked exception logged in event viewer , noticed account being used in spawned thread network service account : from can tell, means impersonation not being carried powershell cmdlet threads. confident user impersonated should have access run script looks permissions being used of network service account not goal. i've made following changes aspnet.config file suggested in few articles i've read no avail: <legacyimpersonationpolicy enabled="false"/> <alwaysflowimpersonationpolicy enabled="true"/> here's snippet of asp net c# code explain situation: //create runspace runspaceconfiguration psconfig = runspacec...

powershell - Detect application close based on app user's name -

been trying create script detect user's application crash. (assume computer used multiple users) so far managed come out below code query application (based on user name) not app close or crash gwmi -query "select * win32_process name='calc.exe'" | %{if($_.getowner().user -eq 'myuser'){ #do when app crash }} you can use register-wmievent cmdlet register event win32_processstoptrace event class. the win32_processstoptrace doesn't have getowner() method, can use current code gather process id's of processes you're interested in, , use in event query: $username = 'myuser' $processname = 'calc.exe' $pidfilters = get-wmiobject -query "select * win32_process name='$processname'" |where-object { $_.getowner().user -eq $username } |select-object -expandproperty processid |foreach-object { "processid={0}" -f $_ } $wmifilter = $pidfilters -join " or " now, have ...