Posts

Showing posts from August, 2011

gorm - How to create a custom Grails query -

i'm new grails , i've troubles queries. got 2 domain classes this: class cliente { string nombre string cuit string localidad string establecimiento static hasmany = [facturas: factura] } class factura { string proveedor int sucursal string numero string letrafactura cliente cliente date fecha string tipo } i want list elements in facturas client name: result expected: proveedor|sucursal|numero|cliente_nombre|fecha i've tried different ways cliente_id not cliente_nombre . i think know asking: given client name, return list of factura 's, stipulation list of fields should contain client name rather client id. import org.hibernate.criterion.criteriaspecification // given client name def clientnametosearch = 'some name' def crit = factura.createcriteria() def results = crit.list() { createalias('cliente', 'cli') eq('cli.nombre', clientnametosearch)

javascript - Google Chrome extension won't output expected text -

i creating google chrome extension generating passwords. working in html page on extension won't output password in text field. working html page , non working extension does google chrome extensions work differently html? need special in manifest.json? popup.html below <html> <head> <title>random password generator</title> <style> body { font-family: "segoe ui", "lucida grande", tahoma, sans-serif; font-size: 100%; } #status { /* avoid excessively wide status text */ white-space: pre; text-overflow: ellipsis; overflow: hidden; max-width: 1000px; } </style> <!-- - javascript , html must in separate files: see our content security - policy documentation[1] details , explanation. - - [1]: https://developer.chrome.com/extensions/contentsecuritypolicy --> <script src="popu

Regex that matches when item is mid-string or end string -

using regex in iis url rewrite (microsoft) i trying write regex capture companyname/company-name in of following: get-involved/companies/company-name-2 get-involved/companies/company-name get-involved/companies/companyname-5 get-involved/companies/companyname so clear want capture variable companyname may or may not have trailing -[0-9] dont want trailing -[0-9] i have following not right includes -2 when present get-involved/companies/((.*)|((.*)(-[0-9]))) this answer work js or php, noticed @tom zych, little specifications may different iis url rewrite, don't use: it's check. that's said, can use followin regexp: ^get-involved/companies/([^-]*)-?([^-]*)?(?:-[0-9])$ then use following replacement: $1$2

php - In MySQL, how do I select a result where the result contains every value I test for? -

Image
check out sql fiddle simplified version of issue http://sqlfiddle.com/#!9/cf31d3/1 i have 2 tables - chat messages , chat recipients this: sample chatmessages data: sample chatrecipients data: basically want query messages contain set of user ids - example, show messages exchanged between bob, susan, , chelsea. if pull new chat window user ids (1, 2, 3) best way messages involving 3 people? here's simplified version of current query (which not produce correct result): select cm.message_id 'message_id', cm.from_id 'from_id', (select u.user_fname 'fname' users u u.user_id = cm.from_id) 'firstname', (select u.user_lname 'lname' users u u.user_id = cm.from_id) 'lastname', cm.chat_text 'chat_text' chatmessages cm inner join chatrecipients cr on cm.message_id = cr.message_id inner join users u on cm.from_id = u.user_id cm.from_id in ('1', '2', '3') , cr.user_i

ruby on rails - Render simple_form from partial view on application.html.erb -

Image
i want create partial view registration form , add application layout file because shown in navigation bar in dropdown menu. how can create form in partial view using simple_form gem , render on application.html.erb ? <%= simple_form_for(@user, url: account_register_path) |f| %> considering code above way create form , don't know should define @user used in application layout nor if need it. can please clarify this? don't put in partial, have registration view on own, called render ... #app/views/layouts/application.html.erb <%= render "accounts/new" %> #app/views/accounts/new.html.erb <%= simple_form_for :user, url: account_register_path |f| %> ... whilst you can use symbol populate form_for , won't include attributes of model, or various hidden methods give context (such id etc). if wanted populate accounts#new view/action variable, you'll have set in applicationcontroller : #app/controllers/application_

html - Resizing Text Element -

Image
i trying text element vertically centered in larger div, colored in blue. defined height , alignment follows: vertical-align: top; //middle puts lower height: 83px; //the same larger area however, cannot vertically aligned in center of blue box. appreciated! you can in several ways: center division: div.div{ text-align: center; } <div class="div"> hello world! </div> use p tag align text center div.div{ background-color: #00ff00 } p.p{ text-align: center; } <div class="div"> <p class="p">hello world!</p> </div>

c# - Datetime throwing model state is invalid for date posted to Web API (EF Backed) -

this error getting submissions follow specific "pattern" per logging 2016-01-21 01:05:01.5879 error model state invalid, throw bad request. model state: { "tbl_externalcontacts.last_password_change": { "value": null, "errors": [ { "exception": null, "errormessage": "the value '19/05/2009 15:17:35' not valid last_password_change." } ] } } i'm submitting numerous things api , it's occurring when first value in date goes on 12. should point out i'm in uk, our date format dd/mm/yyyy. how tell asp.net validate dates sent in model in format valid processed? example: public static void main() { string[] datevalues = { "30-12-2011", "12-30-2011", "30-12-11", "12-30-11" }; string pattern = "mm-dd-yy"; datetime parseddate; foreach (var datevalue in datevalu

Using way multi TList in Delphi XE5 -

i want use multi tlist in delphi. example: var temp1list : tlist; temp2list : tlist; begin temp1list := tlist.create; temp2list := tlist.create; temp1list.add(temp2list); end; i think not correct because tlist accepts parameter pointer value. is there way use multi tlist ? have @ generic tlist<t> instead, eg: uses ..., system.classes, system.generics.collections; var temp1list : system.generics.collections.tlist<system.classes.tlist>; temp2list : system.classes.tlist; begin temp1list := system.generics.collections.tlist<system.classes.tlist>.create; temp2list := system.classes.tlist.create; temp1list.add(temp2list); // don't forget free them when done... temp1list.free; temp2list.free; end; alternatively, since tlist class type, can use tobjectlist<t> instead, , take advantage of ownsobjects feature: uses ..., system.classes, system.generics.collections; var temp1list : system.generics.collections

Removal of object from realm Fatal signal 11 (SIGSEGV), code 1, fault addr 0x288 in tid 29635 -

i trying remove 1 object realm. keep failing. try update record , see @ same place of remove. works fine. when try remove record, getting fatal signal 11 (sigsegv), code 1, fault addr 0x288 in tid 29635 edit after understanding remove has issue realmobjects having associations other objects, modified code follows, still no luck val deleteddependent = realm.where(user::class.java)?.equalto("id",deletedependentdata.dependentuuid)?.findfirst() info("dependent id=>${deleteddependent?.id}") info("dependent id=>${deleteddependent?.sessions}") info("dependent id=>${deleteddependent?.secondarycaregivers}") realm.executetransaction { //deleteddependent?.removefromrealm() val dependentsessions = deleteddependent?.sessions dependentsessions?.let { for(sess in dependentsessions) { if(sess.temperature != null) {

Mybatis doesn't return all rows, return just 1 row -

here mybatis query <select id="selecttotalstatelist" resultmap="baseresultmap" > select a.loffice_no ,(select soffice_name office loffice_no = a.loffice_no) office_name ,nvl(count(decode(a.total_type,'00',1)),0) auto0 ,nvl(count(decode(a.total_type,'01',1)),0) auto1 ,nvl(count(decode(a.total_type,'02',1)),0) auto2 ,nvl(count(decode(a.total_type,'03',1)),0) auto3 ,nvl(count(decode(a.total_type,'04',1)),0) auto4 ,nvl(count(decode(a.total_type,'05',1)),0) auto5 ,nvl(count(decode(a.total_type,1,1)),0) aws ,nvl(count(decode(a.total_type,2,1)),0) text knpsaws.tbl_disaster_warning_card group rollup(a.loffice_no) order a.loffice_no </select> and here app log query select a.loffice_no ,(select soffice_name office loffice_no = a.loffice_no) office_name ,nvl(count(decode(a.total_type,'00',1)),0) htype ,nvl(count(decode(a.total_type,'01',1)),0) detailed_type ,nvl

javascript - how do i capture which number <div> got clicked on inside my container <div> and store it in a variable -

edit: code held inside $(document).ready(function() {} because of this, , because html code generated inside javascript file on fly, experiencing issues using .click() when applying answer given use $('.movies_cell').click(function(){ var tmp = $(this).index(); }); original: have 20 div elements on page class of .movies_cell generated ajax file. of div's created within container div called #movies. any of .movies_cell div's can clicked bring modal box, because going place information json file in modal depending on gets clicked need know div got clicked, instance, if 5th div want know 5th div clicked , store number in variable, if 2nd, or 3rd want number stored in variable , clear when .movies_cell div gets clicked. how write javascript or jquery script accomplish this? :( thanks! $('#mymovies').click(function () { $.getjson('data/movies.json', function (alldata) { $.each(alldata, function (i, field) {

android - timer.setText("setTextHere") does not work inside the thread -

timer.settext("settexthere") not work inside thread. thread thread1 = new thread(){ textview timer; int t; public void run(){ timer=(textview) findviewbyid(r.id.timer); try{ timer.settext("settexthere"); sleep(5000); } catch(exception e){ e.printstacktrace(); } finally{ intent new1 = new intent("com.example.app1.menu"); startactivity(new1); } } }; thread1.start(); _t = new timer(); _t.scheduleatfixedrate( new timertask() { @override public void run() { _count++; runonuithread(new runnable() //run on ui thread { publi

java - Are the following two "Swap Vowels in a String" solutions computationally equivalent? -

i wondering if following 2 solutions "swap vowels in string" problem computationally equivalent (time complexity & memory). solution 1 (main for loop conditional nested for ) : package practicequestions.p1; import java.util.hashset; public class solution { public static char[] solve (string text) { hashset vowelset = new hashset(); char[] vowels = {'a','e','i','o','u','a','e','i','o','u'}; (char v : vowels) { vowelset.add(v); } char[] aschararray = text.tochararray(); int laststop = aschararray.length; (int = 0; < laststop; i++) { if(vowelset.contains(aschararray[i])) { (int j = laststop - 1; j > i; j--) { if(vowelset.contains(aschararray[j])) { char temp = aschararray[j];

php - PHP_PDO float to string conversion different than SQLSRV itself -

after googling around discovered pdo_sqlsrv returns string values, per php spec pdo however, why pdo return different values sql when sql query has cast value varchar? php: mydbwrapperfunction("select cast(cast(0.03 varchar(250))as float)"); // 2.9999999999999999e-2 mydbwrapperfunction("select 0.03"); // .03 mydbwrapperfunction("select cast(0.03 varchar(250))"); // 0.03 in sql however: select cast(cast(0.03 varchar(250))as float) //0.03 select cast(0.03 varchar(250)) //0.03 select 0.03 //0.03 i expect mydbwrapperfunction("select cast(cast(0.03 varchar(250))as float)"); // 2.9999999999999999e-2 to return same value select cast(0.03 varchar(250)) //0.03 is sql cheating float values? for sql server, need cast using str instead of casting varchar: select str(myfield,10,2) source: http://jwcooney.com/2013/09/25/sql-server-rounds-floats-when-casting-to-varchar/

powerbi - How can you find out the identity of the logged in user on Power BI iPad App -

how can find out identity of logged in user on power bi ipad app? user needs logged power bi them access reports. i want able change filters power bi reports based on user. if can find out or identifying information such email address, ideal. right power bi doesn't support dynamic slicers you're asking about. suggest in powerbi forums or @ ideas forum . that said, in implementing row level security achieve you're trying accomplish.

python - Deleting elements from numpy array with iteration -

what fastest method delete elements numpy array while retreiving initial positions. following code not return elements should: list = [] pos,i in enumerate(array): if < some_condition: list.append(pos) #this loop fails _ in list: array = np.delete(array, _) it feels you're going inefficiently. should using more builtin numpy capabilities -- e.g. np.where , or boolean indexing. using np.delete in loop going kill performance gains using numpy... for example (with boolean indexing): keep = np.ones(array.shape, dtype=bool) pos, val in enumerate(array): if val < some_condition: keep[pos] = false array = array[keep] of course, possibly simplified (and generalized) further: array = array[array >= some_condition] edit you've stated in comments need same mask operate on other arrays -- that's not problem. can keep handle on mask , use other arrays: mask = array >= some_condition array = array[mask] other_arra

android - how to get best current address from List<Address> for same latitude and longitude? -

i building android application detects user's current location.i able best location.but not getting best address when doing this: list<address> addresses = gc.getfromlocation(lat, lng, 1); when retrieving more 1 address same latitude , longitude 1 of address correct. list<address> addresses = gc.getfromlocation(lat, lng, 3); my question how compare list of addresses received best current address.any suggestion highly appreciated.thanks in advance. getfromlocation returns result or results depends on maxresults paramater. if set 1 1 result, if set 3 3 results (if there are). but can not know best, can assume 1. best parameters latitude latitude point search longitude longitude point search maxresults max number of addresses return. smaller numbers (1 5) recommended

java - "GridWorld" for ThinkJava Exercise 5.1 -

newbie completeing thinkjava book , trying figure out 1 of answers exercises. calls me download "gridworld" files , complete following steps: write method named movebug takes bug parameter , invokes move. test method calling main. modify movebug invokes canmove , moves bug if can. modify movebug takes integer, n, parameter, , moves bug n times (if can). modify movebug if bug can’t move, invokes turn instead. i stuck on number 3, can not figure out how pass n "move() method" -please newbie my code: import info.gridworld.actor.actorworld; import info.gridworld.actor.bug; import info.gridworld.actor.rock; public class bugrunner { public static void main(string[] args) { actorworld world = new actorworld(); bug redbug = new bug(); world.add(redbug); world.add(new rock()); world.show(); movebug(redbug,5); system.out.println(redbug.getlocation()); } public static void movebug(bug

ios - How to display an image that is selected in one view in another view -

i used code below in ios pick image photo library. need display image in different view. how should proceed? //delegate methode called after picking photo either camera or library - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { [self dismissviewcontrolleranimated:no completion:nil]; uiimage *image = [info objectforkey:uiimagepickercontrolleroriginalimage]; nsarray *theviewcontrollers = [self.tabbarcontroller viewcontrollers]; [imgview setimage:image]; //set in image view [self performseguewithidentifier:@"nextview" sender:nil]; } i tried below code display image in next view not working?? //delegate methode called after picking photo either camera or library - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { [self dismissviewcontrolleranimated:no completion:nil]; uiimage *image = [info objectforkey:uiima

python - Pass an Object through Django Forms -

i'm trying pass object through form, not working me. in models, subscription model has customer model reference, , time want create or update subscription, need include customer associated it. class subscription(stripeobject): sub_user = models.foreignkey(customer) creation_date = models.datetimefield(auto_now_add=true) in view, getting need, , in template, trying pass customer object view 1 of form input fields. def profile(request): user = request.user.get_full_name() menu_group = recipes.objects.filter(today=true).order_by('-price') apartments = apartment.objects.order_by('apartment') plans = plan.objects.order_by('amount') try: customer = customer.objects.get(user=user) except customer.doesnotexist: customer = customer(stripe_id=user, user=user, account_balance=0, currency="usd") customer.save() customer = customer.objects.get(user=user) try: subsc

php - Mysql complex sorting -

i have query this select videos.*, (select count(comment_id) comments comments.comments_video_id = videos.id) video_comments videos order video_comments desc now if have 2 rows same 'videos_comments' count, how can write between these 2 videos, 1 had latest comment (comments_date) in comments table displayed first select videos.id, count(*) video_comments videos left join comments on comments.comments_video_id = videos.id group videos.id order video_comments desc

coq - Software Foundations: apply ... with ... tactic -

i'm try run simple examples on apply ... ... tactic pierce's "software foundations". it seems examples book doesn't work me: theorem trans_eq: forall (x: type) (n m o: type), n = m -> m = o -> n = o. proof. intros x n m o eq1 eq2. rewrite -> eq1. rewrite -> eq2. reflexivity. qed. example trans_eq_example' : forall (a b c d e f : nat), [a;b] = [c;d] -> [c;d] = [e;f] -> [a;b] = [e;f]. proof. intros b c d e f eq1 eq2. (* if tell coq apply trans_eq @ point, can tell (by matching goal against conclusion of lemma) should instantiate x [nat], n [a,b], , o [e,f]. however, matching process doesn't determine instantiation m: have supply 1 explicitly adding (m:=[c,d]) invocation of apply. *) apply trans_eq (m:=[c;d]). apply eq1. apply eq2. qed. trans_eq_example' failed error: trans_eq_example' < apply trans_eq (m:=[c;d]). toplevel input, character

jquery - Check the SharePoint list item level permission using Rest Api -

Image
as i'm using sharepoint list , need check user has permissions edit item or not , , has done using rest api. have tried in different ways using doesuserhavepermissions , getusereffectivepermission . didn't worked out. can of suggest me best way that. thanks in advance. have updated manifest file app can have access user profiles , retrieve such information? if app not have permissions user profiles not user permissions. your manifest should this: where assign @ least read user profiles app can permissions information sharepoint services.

html - Background Image not working in Ionic/Javascript/Angular -

my background image not working ionic project in css. works if inline html sloppy. remember hearing base64 not sure. know problem be? thanks put images want use within project in www/img folder , set style of in html file. for example: <ion-content style="background: url(img/image_name.jpg) center; background-size: cover;">

Parse File using flex and bison -

i need parse following file using flex , bison: new file begin block blk_rowdec name cell_rowdec size uni_rowdecsize iterate itr_rows direction lgdir_rowdec strap strd1,strd3,strd2 wrap wrd1 via viab,viac,viad ends blk_rowdec i want read above file , write code lex.l %{ #include <iostream> #include <stdio.h> #include "yacc.tab.h" #define yy_decl extern "c" int yylex() using namespace std; %} dot "." colon ":" semicolon ";" comma "," angle_left "<" angle_right ">" @ "@" equal "="

ios - Crash in exit app from backround with twice click on home button -

i have app work in background because add app provides voice on ip services info.plist when app go background , touch twice on home button , exist app background , crashed how can check why happen problem?does event call appdelegate when it? in navigator -> breakpoint navigator: add exception breakpoint now simulate crash, application stuck on line app got stuck, check thread , objects allocations. i guess may out little bit :)

angularjs - How to bind variables to INPUT dynamically -

i have object in controller value getting http request: $scope.myobj = { id1: "1", id2: "5", id3: "", id4: "" }; it can have number of fields ( id... ) values. if id-k not empty id-n n < k not empty too. i need bind input last not empty field of object. best way it? here plnkr update: object position in classificator. in example id of position 1.5 . need allow edit last position in classification. user can change 5 6 , 7 or else, can not change 1 segment if object be $scope.myobj = { id1: "2", id2: "5", id3: "4", id4: "8" }; the classification 2.5.4.8 , user must able edit last segment - 8 . controller ... $scope.myobj = { id1: "1", id2: "5", id3: "6", id4: "" }; $scope.segments = object.keys($scope.myobj) .filter(function(key) { r

python - Formatting csv to allow numpy to make a data frame -

i'm trying read in csv file numpy. i'm following this tutorial data formatted differently example here's csv data and code i'm using: import datetime dt import pandas pd import numpy np na_data = np.loadtxt('btc.csv', delimiter=',', skiprows=2) na_price = na_data[:, 3:4] na_dates = np.str_(na_data[:, 0:1]) print na_price print na_dates valueerror: invalid literal float(): 09/08/2015 i need format date @ beginning, i've been following other peoples q&a's online , realize need this pd.read_csv('btc.csv', dayfirst=true, parse_dates=[0]) but can't figure out how implement it. thank time edit: data taken from here , , wrote script split each line. jezrael's comment, printing data frame produces format similar ! maybe maybe can feed text in directly pandas ? you can use parameter sep arbitary whitespace: \s+ in function read_csv , loc : import pandas pd import io temp=u"""date

credit card - Paypal Payments Standard without creating Paypal account -

i want sell media, , chose paypal payments standard it. according official documentation buyer can make purchase without paypal account. enter card number/cvc, name , other fields , buy. but when click on "buy now" button created paypal button editor - gives 2 options: "pay paypal account" or "create paypal account". there no option pay without creating paypal account. i want not force buyer make account , fill lot of fields. card number, expiration date, cvc , maybe first/last name - that's necessary , sufficient. how make possible? if country country supports feature allows buyers pay credit card without having paypal account, need enable paypal account optional in account. this can done logging account , going profile. once on profile page, need go website payment preferences. may under selling tools, depending on type of account have. once on website payment preferences page, want set paypal account optional "on"

c# - Read properties of derived as well as base class -

i have 2 classes class 1 public class baseclass { public string prop1{get;set;} public string prop2{get;set;} public string prop3{get;set;} } class 2 public class derived:baseclass { public string prop4{get;set;} } now when try read properties following code, obvious returns derived class's properties propertydescriptorcollection properties = typedescriptor.getproperties(typeof(derived)); is there way can read properties of derived baseclass why not use reflection ? propertyinfo[] properties = typeof(derived).getproperties(bindingflags.public | bindingflags.instance); console.write(string.join(envrironment.newline, properties.select(p => p.name)));

memory - Aggregate key-value lines in a file by keys in Java -

i have huge file, composed ~800m rows (60g). rows can duplicates , composed id , value. example: id1 valuea id1 valueb id2 valuea id3 valuec id3 valuea id3 valuec note: ids not in order (and grouped) in example. i want aggregate rows keys, in way: id1 valuea,valueb id2 valuea id3 valuec,valuea there 5000 possible values. the file doesn't fit in memory can't use simple java collections. also, greatest part of lines single (like id2 example) , should written directly in output file. for reason first solution iterate twice file: in first iteration store 2 structures, ids , no values: single value ids (s1) multiple values ids (s2) in second iteration, after discarding single value ids (s1) memory, write directly single values id-value pairs output file checking if not in multiple values ids (s2) the problem can not finish first iteration cause memory limits. i know problem faced in several ways (key-value store, map reduce, extern

node.js - How to parse socket.io handshake cookie -

i using socket.io along express sessions. using middleware cookie in header, like: io.use(function(socket, next) { console.log(socket.handshake.headers.cookie); next(); }); puts console: io=eljqk5v7q-jjz5d_aaaa; connect.sid=s%3a17faf004-46c7-4219-9dac-81853ada8cab.zzfpl%2bphy9hnxemdclesngebuzyu9mowvbznebuhzka ok, great! have cookie, how information out of it. thoroughly confused. my session initialized this: app.use(session({ //using express-session genid: function(req) { return uuid.v4(); }, secret: 'operation', resave: false, saveuninitialized: true })); i've searched far , wide on simple explanation, have not found one. required use sessionstore? if why? i've tried different modules supposedly set handle this, far none of them have worked. using mongodb, wouldn't mind storing them there if necessary, want avoid using redis handle others have. after hours , hours, days , days of searching solution problem found solution work.

javascript - Calling JQuery Function from Server (asp.net) -

in asp.net project c#, need call jquery function code behind. below function include required script: <link rel="stylesheet" href="/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" /> function showfancy(url, title, width, height) { //alert(url); $(".fancybox").fancybox({ 'width': width, 'height': height, 'autoscale': true, 'transitionin': 'elastic', 'transitionout': 'none', 'type': 'iframe', 'overlaycolor': '#000000', 'overlayopacity': 0.7, 'position': 'fixed', 'scrolling': 'yes', 'modal': false, 'target': "_parent", "onclosed": function () { window.locatio

ios - How to set UISearchBar in maps application in Swift? -

i new using swift , want make application uses maps , i'm trying include search bar( uisearchbar ) when try make function makes search error in 1 line. here's code: func performsearch(){ matchingitems.removeall() let request = mklocalsearchrequest() request.naturallanguagequery = searchtext.text request.region = mapview.region let search = mklocalsearch(request: request) search.startwithcompletionhandler{ (response: mklocalsearchresponse!, error: nserror!) in item in response.mapitems{ print("item name = \(item.name)") print("latitude = \(item.placemark.location!.coordinate.latitude)") print("longitude = \(item.placemark.location!.coordinate.longitude)") } } } i error in **startwithcompletionhandler** part says: "cannot convert value of type '(mklocalsearchresponse!, nserror!) -> ()' expected argument type 'mklocalsearchcom

c# - Outlook 2016 plugin AttachmentSelection Issue -

i have created outlook addin selected attachment details of attachment. , working fine in outlook 2010. when build outlook 2016, becomes null. below code in thisaddin.cs:- private void thisaddin_startup(object sender, system.eventargs e) { system.reflection.assembly assemblyinfo = system.reflection.assembly.getexecutingassembly(); uri uricodebase = new uri(assemblyinfo.codebase); string location = path.getdirectoryname(uricodebase.localpath.tostring()); var path = location.split(new string[] { "bin" }, stringsplitoptions.removeemptyentries); var rootdir = path[0].tostring(); var forpermissionsrootdirectory = path.getdirectoryname(rootdir); setpermissions(forpermissionsrootdirectory); app = this.application; app.attachmentcontextmenudisplay += new outlook.applicationevents_11_attachmentcontextmenudisplayeventhandler(app_attachmentcontextmenudisplay);//a

c# - How to refer to the actual element in foreach? -

i used following code step through ienumerable . ienumerable<thing> things = ...; foreach (thing thing in things) thing = method(thing); the compiler disagrees since i'm referring thing iterating variable. of course, intend affect underlying object in list, instead. how do that? for now, went work-around using numerated iteration there 2 issues there. one, it's not coding imho. besides that, requires me change things ienumerable ilist (or should using list ?!), will bite in lower when things big. //list<thing> things = ...; ilist<thing> things = ...; (int = 0; < things.count(); i++) things[i] = method(things[i]); you can project sequence linq: var transformedthings = things.select(t => method(t));

javascript - How to align datepicker icon appearing below the datepicker textbox properly? -

i have datepicker , want datepicker icon appear after datepicker. however, datepicker icon appears below datepicker. have attached jsfiddle. fiddle datepicker $(document).ready(function() { $("#datepicker").datepicker({ changemonth: true, changeyear: true, yearrange: "-100:+0", showon: 'button', buttontext: 'show date', buttonimageonly: true, buttonimage: 'http://jqueryui.com/resources/demos/datepicker/images/calendar.gif', dateformat: 'dd/mm/yy', maxdate: 0 }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap

c# - Reduce Execution Time in MYSQL from ASP.NET -

i have table relevant gps application in mysql. whenever executing asp.net application showing fetal error. have decided run in mysql, take more 1 min(exactly 70 sec) executing sp. possible sort out issues. further information: table 1 : server_gpsdata(it contains gps data. locks every 10 secs gps device). select * server_gpsdata sd inner join mstcab mc on mc.cabid= sd.cabid inner join server_tblstatus ts on ts.statusid= mc.cabstatusid inner join carmaster cm on cm.carid= mc.carid inner join cabtype ct on ct.cabtypeid= cm.sizeid date(sd.cur_datetime) =current_date , mc.cabid not in (select d.cabid trncabdriver d date(d.logintime)=current_date) , sd.gpsdataid in (select max(sgd.gpsdataid) server_gpsdata sgd date(sgd.cur_datetime)=current_date group sgd.cabid); the following should show significant improvement in performance: select sd.*, mc.*, ts.*, cm.*, ct.* (select max(sgd

join - What is wrong with my MySQL query (UNION)? -

i hope can me here. i'm working on pms system , want run simple select statement list of secret codes customers based on of parcels have arrived , transaction type. 'transferconfirmation' table has customer id , secret code , displays 1 row each instance reason, when use following query: select `tc`.`transferid` `transferid`, `c`.`firstname` `firstname`, `c`.`lastname` `lastname`, `tc`.`secretcode` `secretcode`, 'purchase order' `transactiontype` (((((`db`.`transferconfirmation` `tc` join `db`.`customer` `c` on((`tc`.`customerid` = `c`.`customerid`))) join `db`.`transfer` `t` on((`t`.`transferid` = `tc`.`transferid`))) join `db`.`transferentry` `te` on((`t`.`transferid` = `te`.`transferid`))) join `db`.`purchaseorder` `po` on((`te`.`referenceid` = `po`.`purchaseorderid`))) join `db`.`purchaseorderentry` `poe` on(((`po`.`purchaseorderid` = `poe`.`purchaseorderid`)

html5 - In HTML: Different <select> referencing the same list of options -

is possible <select> -lists reference same list of options, similar <input> <datalist> ? i generate list of several entries, (among other things) user selects value of dropdownlist. options in list same each entry, prefer it, if list of options doesn't need re-added each dropdownlist. i can't use <input> <datalist> , since user may choose available entries. you using jquery easily, <datalist id="mylist"> <option value="a"> <option value="b"> <option value="b"> </datalist> <select class="someselect"> <select class="someselect"> $(".someselect").html( $("#mylist").html() ); this replace select list datalist

php - I can't insert data in my database. Where I'm going wrong? -

here code. i'm using php 5.4 , pdo connection! included database connection , other files need. , have registration form wich add values filling them. ridirection made , not problem shown. when check db not added. i'm going wrong? code <?php include'db.php'; include'header.php'; require 'vendndodhje.php'; $vendndodhjeinput = new vendndodhje(); if ( !empty($_post)) { // keep track validation errors $emererror = null; $mbiemerlerror = null; $dtlerror = null; $telerror = null; $emailerror = null; $vendndodhjeerror=null; // keep track post values $emer = $_post['emer']; $mbiemer = $_post['mbiemer']; $datelindje = $_post['datelindje']; $tel = $_post['tel']; $email = $_post['email']; $vendndodhje=$_post['vendndodhje']; //insert values if ($valid) { $pdo = database::connect(); $sql = "insert klienti(emer,mbiemer,datelindje,tel,em

mongodb - Select array inner element -

i have trouble mongodb data below. want data [projects][log][subject] . so, tried this $project':{_id:0, projects.log.subject:1} but not correct syntax.. { "_id": objectid("569f3a3e9d2540764d8bde59"), "a": "book", "server": "us", "projects": [ { "domainarray": [ { ~~~~ } ], "log": [ { ~~~~~, "subject": "i want this" } ], "before": "234234234" }, { "domainarray": [ { ~~~~ } ], "log": [ { ~~~~~, "subject": "i want this" }

php - Optimised function layout -

i trying figure out optimized way layout function. the function has 3 variables, 2 of required. currently, using conditionals first check round_id , inside round_id conditional, check type , inside if category_id exists (which optional). does best way run little conditions possible? function count() { var type = *post*; // required var category_id = *post*; // optional var round_id = *post*; // required if ( round_id == "pre" ) { if ( type == "adult" ) { if ( category_id ) { } else { } } elseif ( type == "youth" ) { if ( category_id ) { } else { } } } elseif ( round_id == "1" ) { if ( type == "adult" ) { if ( category_id ) { } else { } } elseif ( type == "youth" ) { if ( category_id ) { } else {

sql - ListAGG in SQLSERVER -

i'm trying aggregate 'string' field in sqlserver. find same function listagg in oracle . do know how same function or method? for example, field | field b 1 | 1 | b 2 | and result of query 1 | ab 2 | in sql server can use for xml path result: select distinct t1.fielda, stuff((select distinct '' + t2.fieldb yourtable t2 t1.fielda = t2.fielda xml path(''), type ).value('.', 'nvarchar(max)') ,1,0,'') data yourtable t1; see sql fiddle demo

database - Oracle update where select statement returns multiple row error -

hi have table this: id name number 1 john 91234567 2 tom 98765432 3 ken 91357246 ... i trying change number [91234567] number single row query returns more 1 row. my statement: update table set number = '9000000' id = (select id table number = '91234567') perhaps have record same number further down table. since not have access id, how can change statement? thanks. try use in instead of = update table set number = '9000000' id in (select id table number = '91234567')

wix3.9 - [Wix 3.9]How to create a single exe(bootstrapper) localized for multiple languages -

i created wix bootstrapper application , contains 2 msi packages. want localize boostrapper application. aim localize bootstrapper app , should lauch app respect system language. means that, should single exe languages. want support following languages, us english bzl port intl. spanish fr gr russian simplified chinese jp, kr, thai arabic, traditional chinese my first level study, understood need payload files applying localization in bootstrapper automatically applying localization ui translated strings. added 3 payload files 3 languages english,frnch & russian. got exe after build completion. here tried manually selected localizationfile file in bal:wixstandardbootstrapperapplication tag. got 1 .exe should work in language. if need exe other language , need change localizationfile value , build again. want 1 exe invoked according system language. here have following questions, when used payload file , how can launch setup according system language, if

c# - Ploeh AutoFixture was unable to create an instance from System.Runtime.Serialization.ExtensionDataObject -

we have mvc project references wcf services. references added (extensiondataobject)extensiondata property every dto , response object , autofixture fails create anonymous instances of these types. example: public partial class searchresultsdto : object, system.runtime.serialization.iextensibledataobject, system.componentmodel.inotifypropertychanged { [system.nonserializedattribute()] private system.runtime.serialization.extensiondataobject extensiondatafield; [global::system.componentmodel.browsableattribute(false)] public system.runtime.serialization.extensiondataobject extensiondata { { return this.extensiondatafield; } set { this.extensiondatafield = value; } } } code: _fixture = new fixture().customize(new automoqcustomization()); var dto = _fixture.createanonymous<searchresultsdto>(); exception: ploeh.autofixture.objectcreationexception: ploe

javascript - what these notation signifies in jquery plugin -

could please me understand following (numbered listing) notation/syntax/meaning in javascript/jquery plugin. tried googling didn't got right direction. $.fn["printelement"] = function (options) { $.fn["printelement"]["defaults"] = { /* * print jsp in popup * iframe printing not supported in opera , chrome 3.0, popup window shown instead */ (function (window, undefined) { var t = window["document"]; var $ = window["jquery"]; $.fn["printelement"] = function (options) { var mainoptions = $.extend({}, $.fn["printelement"]["defaults"], options); //iframe mode not supported opera , chrome 3.0 (it prints entire page). //http://www.google.com/support/forum/p/webmasters/thread?tid=2cb0f08dce8821c3&hl=en if (mainoptions["printmode"] == 'iframe') { if (/chrome/.test(navigator.useragent.tolowercase()))