Posts

Showing posts from August, 2010

c# - Many-to-One Mapping in NHibernate Not Working? -

i have following example persistent classes: using nhibernate.mapping.attributes; namespace gumidal.domain { [class] public class foo { [id(0)] [generator(1, class="identity")] public virtual int id { get; set; } [property] public virtual string name { get; set; } } [class] public class bar { [id(0)] [generator(1, class = "identity")] public virtual int id { get; set; } [manytoone(name="foo")] public virtual foo foo { get; set; } } } serializing assembly creates following xml: <!-- generated nhibernate.mapping.attributes on 2015-10-02 13:08:49z. --> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="example.domain.foo, exampleassembly"> <id> <generator class="identity"/> </id> <property name="name...

javascript - a tag that scrolling to buttom of page -

this question has answer here: scroll automatically bottom of page 12 answers need make button scroll buttom of site. button: <a href="#" class="button-bord">read more <br /><p class="glyphico glyphicon-chevron-down arrow-down"></p></a> how can make scrolls buttom of site? suggestions :) this jquery: <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> </head> here in script: <script> $('.button-bord').on('click', function() { $('html, body').animate({scrolltop:$(document).height()}, 'slow'); return false; }); </script>

ruby on rails - undefined method `permit' for "**output omitted**":String -

updated: have link_to set deleting object nested resource. prior destroy, have method checks instance of object based on object_params, params sent keep raising undefined method 'permit' "asdfsadf":string when tries reference object_params . button: <%= link_to content_tag('button', '', class: 'btn fa fa-trash-o focus-delete-button'), parent_object_path( :parent_id => focus.z_kf_parent, :id => focus.id, :object => focus), data: {confirm: "are sure want delete '#{focus.name}'"}, method: :delete %> params: {"_method"=>"delete", "authenticity_token"=>"gmlvyhy230y1lqy=", "object"=>"6c1367b1-1d63-4545-bbdb-b8ac9bd39422", "action"=>"destroy", "controller"=>"objects", "parent_id"=>"fa100073-4a0c-4ee0-8fb1-3ec39c61ad39", "id"=>"5-bbdb-b8ac9"}...

vbscript - A bit complex Vbs -

i have create vscript bit complex, @ least me.. if help, thank much! :d these tasks script needs take care of: *-run cmd file located on "c:\program files\paradigm\paradigm-15\services\bin\cli\pg_epos_user_list.cmd" -pns_host localhost that cmd generates list of users so, cmd's output, need check if current logged accountname listed there (check if matches)* -if not listed, run cmd -> "c:\program files\paradigm\paradigm-15\services\bin\cli\pg_epos_user_create.cmd" -pns_host localhost -epos_user -member_list but in case, have input logged userid on each "" on commandline. then, compare content on ini file, stored on shared disk, values on 2 files located on c:\programdata\paradigm\paradigm-15\applications\config\env\common\ 1_epos_license_location & 1_epos_license_location.tcl get license value section "[license]" value stratimagic=**licensevalue** , sure matches license info on both 1_epos_license_location ...

javascript - radius in D3 is being drawn bigger than it should -

i'm building bubble map using d 3, radius of bubbles bigger should doing operation outside of d3 . i'm sure simple i'm missing first bubble map in d3 , can't find is. this code add radius attribute when drawing each bubble: .attr("r", function(d) { return radius(math.sqrt((math.pow(10, (1.5*d.properties.mag)+4.35)/10000000000000)/math.pi)); }); for d.properties.mag of 8.3, resultant bubble rendered is: <circle id="t1442444072620" transform="translate(244.5523934369255,434.147524023737)" r="68.38953170695866" class="selected"> </circle> as see, radius 68.4px . same operation changing d.properties.mag 8.3 console.log(math.sqrt((math.pow(10, (1.5*8.3)+4.35)/10000000000000)/math.pi)) gives me result of radius of 44 px . problem not getting right number on d.properties.mag , checked that. thanks in advance!

c# - How to get class properties in order of declaration when serialize -

Image
i have list<campaignmodel> need serialize using jsonconvert.serializeobject everything works fine except im getting properties in diferent order class declaration. my class declaration is: public class campaignmodel { public string checked { get; set; } public int campaignid { get; set; } public string name { get; set; } public string market { get; set; } public string type { get; set; } public bool isactive { get; set; } public bool active { get; set; } } and order im getting properties in json is: any clue? properties not guaranteed have or maintain specific order in javascript. in c# code can't change "limitation". btw, the same goes .net .

c# - How does IdentityFactoryOptions<AppIdentityUserManager> options get set? -

if you've worked identity 2.0, you've seen piece of code: public static appidentityusermanager create( identityfactoryoptions<appidentityusermanager> options, iowincontext context) { [snip] var dataprotectionprovider = options.dataprotectionprovider; if (dataprotectionprovider != null) { manager.usertokenprovider = new dataprotectortokenprovider<appidentityuser>( dataprotectionprovider.create("asp.net identity")); } return manager; } i understand that. in application options.dataprotectionprovider (obviously passed in parameter) null. how , set (or not case may be?) every place i've looked has exact snippet of code, no explanation setting dataprotectionprovider. edit: read dataprotectionprovider in identity sample project , explains usertokenprovider not explain h...

Cortana VCD Storage Location -

i've been actively creating, debugging, , installing vcd files our application , i've been looking way remove vcd files command definition set. does know how this, if hack (such removing xml file registered)? currently, there isn't way remove registered vcd explicitly, need remove app, , attempt trigger of voice commands vcd registers detect missing app , remove vcd. however, functionality isn't super-robust, , set improved on time become more reliable. (for instance, right now, 2 apps can install same vcd , cause issues difficult clean up).

c - Struggling to get PortAudio to Work with MinGW -

i have mingw install working fine msys. installed , functioning well. i installed portaudio library , did install , got success message after: ./configure make make install when try compile samples: c:\c>gcc patest_mono.c -o pa.exe patest_mono.c:50:23: fatal error: portaudio.h: no such file or directory #include "portaudio.h" ^ compilation terminated. i'm new. have feeling might doing fundamentally wrong way i'm trying create exe compiling. it's been of puzzle quest far, i've tried figure out , think close missing something. path variable ? in portaudio mingw build instructions noticed "the above should create working version though might want provide '–prefix=<path-to-install-dir>' configure. " i've tried adding c:\mingw\portaudio user path. doesn't work. i've tried running commands in bash , come error message "no rule make target 'paexpink'" either make command, , gcc ...

c++ - Force instantiation of friend functions -

assume have template class friend function: template<class t> class { friend operator+ (int, const a&); }; this function implemented somewhere below: template<class t> a<t> operator+ (int i, const a<t>& a) { ... } and there force instantiation of class template further below: template class a<int>; does imply operator+(int, a<int>) compiled? or have force instantiate separately achieve that? template parameters aren't automatically forwarded friend declarations. need specify template parameter function well: template<class t> class { template<class u> friend a<u> operator+ (int, const a<u>&); }; implementation correct, should be template<class t> a<t> operator+ (int i, const a<t>& a) { // ^^^ // ... }

python - Cherrypy expose multiple items to same function -

i have large number of names, should link url correspond names. know generating function each element in list , decorate @cherrypy.expose , wonder if possible link items instead function function without opening same site each item. (something generating appropriate function on fly, lambda function, , passing appropriate argument?) import cherrypy class test(object): @cherrypy.expose def index(self): html1 = '''<html> <head></head> <body> <ul style="list-style: none;">''' html2 = """</ul> </body> </html>""" html3 = "" name in names: html3 += "<li><a href='%s'>%s</a></li>" %(name.lower(), name) return html1 + html3 + html2 @cherrypy.expose def function(self, name=''): print(name) return name you c...

python - Pyodbc on El Capitan -

i'm having trouble installing pyodbc on el capitan. have virtualenv created during yosemite days has pyodbc. i installing pyodbc through following command: pip install --global-option=build_ext --global-option="-i/usr/local/include" --allow-external pyodbc --allow-unverified pyodbc pyodbc it errs out saying cannot find odbc dynamic library. ld: library not found -lodbc the version of python i'm using python 2.7.10(but has similar problems installing in python 2.6.9 too) add /usr/local/lib compiler dynamic library path pip install --global-option=build_ext --global-option="-i/usr/local/include" --global-option="-l/usr/local/lib" --allow-external pyodbc --allow-unverified pyodbc pyodbc

text - Make td characters wrap even if string is unbroken? -

if have td long, unbroken string of text, how can make text start wrapping next line, character character reduce window width? in fiddle, adjust output box width , it'll throw scrollbar, i'd text start wrapping, char char next line. http://jsfiddle.net/kirkbross/mn6at1hg/ <table width="100%" border="1" cellpadding="10" cellspacing="0"> <tr> <td align="right">left td</td> <td align="left">thisisawholebunchoftextiwanttowrapbasedonawidthevenifitdoesntbrea</td> </tr> </table> you can use: table { table-layout: fixed; } td { word-wrap:break-word } the jsfiddle - https://jsfiddle.net/sleaver/tld0g651/4/

javascript - Phantom.js Webdriver.io Error: SyntaxError: DOM Exception 12 -

we doing testing webdriver.io, , phantom.js. following works fine, gives me list of elements: return client .url(config.host) .waitforvisible('#myvenuelist', 2000) .click('#myvenuelist') .elements('li.venue') .then(function(venues) { // make sure there @ least 1 device // scan in before , check size venues.value.length.should.be.at.least(venuelist.length); done(); }); but go on next test, same thing: return client .url(config.host) .waitforvisible('#myvenuelist', 2000) .click('#myvenuelist') .waitforvisible("li.venue[data-id=" + allvenues[0].venue_id + "]", 5000) .click("li.venue[data-id=" + allvenues[0].venue_id + "] a[class='btn primary']") .waitforvisible('a[class="tab beacons"]', 2000) .click('a[class="tab beacons"]') .waitforvisible('a[class="tab bea...

Unable to download unsampled report from Google Analytics using Java -

we have created unsampled report using google console , report got generated under google drive. automate downloading process, trying download report using java. per google analytics api library, can done using report's selflink() method. able print link using method unable download report. there no error download process failing. how can fix this? the selflink property unsampled report resource, self link particular resource. download results of unsampled report, need go set either cloud storage api request or drive api request depending on implementation. for example if unsampled report stored in google drive, make authorized http request file's resource url , include query parameter alt=media. example: get https://www.googleapis.com/drive/v2/files/xxxxxx?alt=media authorization: bearer ya29.ahesvbxtuv5mhmo3ryfms1yjonjzzdtofzwvyoauvhrs where xxxxxxx unsampled report drivedownloaddetails.documentid .

java - DEBUG: Using PENTAHO_JAVA_HOME -

am trying start pentaho, getting below mentioned error debug: using pentaho_java_home debug: _pentaho_java_home=/usr/java/jdk1.7.0_67-cloudera/jre/bin debug: _pentaho_java=/usr/java/jdk1.7.0_67-cloudera/jre/bin/bin/java using catalina_base: /home/nathan/biserver-ce/tomcat using catalina_home: /home/nathan/biserver-ce/tomcat using catalina_tmpdir: /home/nathan/biserver-ce/tomcat/temp using jre_home: /usr/java/jdk1.7.0_67-cloudera/jre/bin using classpath: /home/nathan/biserver-ce/tomcat/bin/bootstrap.jar i have given java_home path too. still getting error , unable start pentaho. please help the clues here: debug: _pentaho_java_home=/usr/java/jdk1.7.0_67-cloudera/jre/bin debug: _pentaho_java=/usr/java/jdk1.7.0_67-cloudera/jre/bin/bin/java it thinks path java command "/usr/java/jdk1.7.0_67-cloudera/jre/bin/bin/java". wrong. (".../bin/bin/..."? really??) working backwards, launch script has done because have pointed _pentaho_j...

Grade Calculator Concatenation JavaScript -

this question has answer here: cannot use + when try add number 4 answers my syntax fixed code , running. having problems adding 2 numbers instead of program concatenating values. help, ben var averagetotal = (grades[j]+averagetotal); here whole code. var numberofgrades = prompt("how many grades want calculate?"); var countingvalue = 0; var grades = []; var tempgrade = 0; var averagetotal = 0; for(var i=0;i<=numberofgrades;i++){ if(countingvalue!=numberofgrades){ if(countingvalue==1){ var tempgrade= prompt("what "+(countingvalue+1)+"st grade?"); grades.push(tempgrade); countingvalue++; } else if(countingvalue!=1){ var tempgrade= prompt("what "+(countingvalue+1)+"th grade?"); grades.push(tempgrade); countingvalue++; } } else if(countingvalue==numberofgrades) ...

Should I use enums or class hierarchy for errors in swift? -

in swift 2 type conforms errortype protocol can thrown , caught. me, makes sense have common error hierarchy , re-use in multiple places. but, apple documentation seems push developers using enums handling errors. for example, hierarchy let me catch , process common validationerror without knowing it's exact sub-type. allow different parts of application extend validationerror. myapperror validationerror invalidpatherror wrongfiletypeerror mixing different styles of defining errors not idea. so, should model error handling around class hierarchies or enums? tl;dr enums shorter, faster write, easier understand potential errors, , compiler make sure catch of errors. the full story errortype empty protocol (there hidden properties _code : int , _domain : string apple takes care of that). i quote swift programming guide (link) swift enumerations particularly suited modeling group of related error conditions, associated values all...

Using a mixin/function to poplulate @import paths in Stylus -

i hoping able following in stylus: variables (spec) "../" + spec + "/css/variables.styl" @import variables(button); @import variables(form); .. there reasoning file structure trying make easier manage repetition in file rather having write: @import "../button/css/variables.styl" @import "../form/css/variables.styl" .. but when try stylus compiler errors "@import string expected" well, need remove space before () , otherwise declaration parsed selector: variables(spec) "../" + spec + "/css/variables.styl" @import variables(button); @import variables(form);

amazon web services - How could I add current pc IP into security group with aws cli -

i want add current working pc's ip security group, and enable traffice it. every time should manually web dashboard. how shell script. the following mose common aws cli commands used. but couldn't find how add ip in specific security group. list_instances(){ aws ec2 describe-instances --query 'reservations[].instances[].[tags[?key==`name`].value,instanceid,publicipaddress,privateipaddress]' --output text } start_instance(){ aws ec2 start-instances --instance-ids $1 } here's script determines current computer's ip address, uses aws command-line interface (cli) add access ports 80 (ssh) , 3389 (rdp) -- safer adding access on ports. # retrieve current ip address ip=`curl -s http://whatismyip.akamai.com/` # authorize access on ports 80 , 3389 aws ec2 authorize-security-group-ingress --group-name "sg-name" --protocol tcp --port 22 --cidr $ip/32 --profile class --output text aws ec2 authorize-security-group-ingress --gro...

c# - Autofac won't resolve class from external dll -

i'm trying create application utilizes autofac , loads external dlls. following code works, if dll located in same folder , program ran same folder: builder.registerassemblytypes(assemblies.toarray()). where(t => typeof(iimageconverter).isassignablefrom(t)). instanceperlifetimescope().asimplementedinterfaces(); now if try run program different location set working directory directory dll located, autofac finds , loads dll, doesn't resolve run it: using (var scope = _container.beginlifetimescope()) { var processors = scope.resolve<ienumerable<iimageconverter>>(); foreach (var process in processors) process.process(); } those autofac lines have. interface defined in shared library , each module implements default. missing? thanks in advance! it depends on values assigned assemblies . autofac not load dlls, scans loaded assemblies. read dynamicic module loading determine how load external dlls. ...

Reverse a map matlab converting array to string keys -

i have map defined as: diagonal = eye(4); v = {diagonal(1,:), diagonal(2,:), diagonal(3,:), diagonal(4,:)} k = {1, 3, 7, 8} class_labels = containers.map(k, v) now need reverse map, matlab not allow key array , hence need convert each array string. so class_labels map like: 1 => [0 0 0 1] 3 => [0 0 1 0] 7 => [0 1 0 0] 8 => [1 0 0 0] i need like: 0001 => 1 0010 => 3 0100 => 7 1000 => 8 you can use keys , values methods associated containers.map class extract keys , values, apply string conversion values concatenating of bits together.... construct containers.map . you'll use cellfun iterate through each cell element of values cell array , apply function such converts sequence of numbers in array concatenated string. let's assume moment don't have access keys , values defined , let's have access containers.map itself. want invert dictionary, , so: %// code diagonal = eye(4); v = {diagonal(1,:), diagonal(2,:),...

javascript - Issue with this.style.borderTop JS -

i trying make border randomly change colour when mouse hovers on changing if top or bottom border changes. if run obj.style.bordertop = "3px solid #dddddd" works. whereas when try concatenate same same line add in randomly generated colours , border doesn't work. js <script type="text/javascript"> "use strict"; var tb = ["borderbottom", "bordertop"]; var colour = ["#16a085", "#8e44ad", "#ee006b", "#27ae60", "#c0392b", "#e67e22", "#2980b9"]; function randcolours(obj) { var randtb = tb[math.floor(math.random() * tb.length)]; var randcolour = colour[math.floor(math.random() * colour.length)]; var final = "obj.style."; var final = final.concat(randtb); var final = final.concat("= '3px solid "); var final = final.concat(randcolour); var final = final.c...

c++ - How to properly manage a vector of void pointers -

first, background: i'm working on project requires me simulate interactions between objects can thought of polygons (usually triangles or quadrilaterals, fewer 7 sides), each side of composed of radius of 2 circles variable (and possibly zero) number of 'rivers' of various constant widths passing between them, , out of polygon through other side. these rivers , circles , widths (and positions of circles) specified @ runtime, 1 of these polygons n sides , m rivers running through can described array of n+2m pointers, each referring relevant rivers/circles, starting arbitrary corner of polygon , passing around (in principal, since rivers can't overlap, should specifiable less data, in practice i'm not sure how implement that). i programming in python, found more complex arrangements performance unacceptably slow. in porting on c++ (chosen because of portability , compatibility sdl, i'm using render result once optimization complete) @ of loss how deal poly...

sonarqube - What's way to get the cyclomatic complexity of a file using sonar rest api? -

i have checked in files under svn , run nightly build publish report files on sonar dashboard. have custom reporting use cyclomatic complexity of files sonar using api. as checked there rest api cc resource id don't have because info available file name absolute path. if go current rest api first how may resource id particular file can cc file using api. someone can me cc using resources or file name using rest api. you don't specify version of platform, i'll assume latest & recommend resource api. http://nemo.sonarqube.org/api/resources/index gives list of projects - id's you can set depth -1 see children, , add list of metrics want included, complexity , whatever else need. e.g. http://nemo.sonarqube.org/api/resources/index?resource=808785&depth=1&metrics=complexity edit here's docs depth : used when resource set: 0: selected resource -1: children, including selected resource >0: depth toward selected...

python - Where is the HTML for a Pandas DataFrame? -

i looking through brandon rhodes' pandas css file , , i'm struggling find html looks pandas dataframe. basically i'm trying figure out how freeze dataframe's header row can view header if scroll down. don't have insight raw html looks can access divs , classes. how find it? you can @ html code given dataframe df calling df.to_html()

ubuntu - Who zeroes pages while calling calloc() in Linux? -

i aware implementer has choice of whether wants 0 malloc page or let os give him zeroed page (for more optimization purposes). my question simple - in ubuntu 14.04 lts comes linux kernel 3.16 , gcc 4.8.4, 0 pages? in user land or kernel land? it can depend on memory came from. calloc code userland, , 0 memory page gets re-used process. happens when memory used , freed, not returned os. however, if page newly allocated process, come cleared 0 os (for security purposes), , not need cleared calloc . means calloc can potentially faster calling malloc followed memset , since can skip memset if knows zeroed.

How to achieve "Insert or Increment" in one MongoDB query? -

i want write query in mongodb insert object in document if doesn't exist or increment field of if exists in specified document. there 2 queries follows example: documents structures: movies: { integer _id, string name, array(object) watchinglist [ { integer userid, integer watchtimes } ..... ] } insert query: db.movies.update({_id:x}, {$push: {watchinglist:{userid:y,watchtimes:1}}}); increment query: db.movies.update({_id:x,"watchinglist.userid":y},{$inc:{"watchinglist.$.watchtimes":1}}); how can combine them 1 or more queries acheive requirement? from question understand need generic update method both insert , update array.it can done using dummy object in array last element , update element in case of insert. i'm giving here example : add dummy object array : > db.m4.update({_id:"id...

Sorting characters in a string into alphabetical order without arrays or maps (Java) -

i trying make program tests if 2 separate phrases anagrams of each other. this, want sort each string phrase alphabetical order , compare results. however, i want without using arrays or maps . far have pretty messy code/pseudocode: import java.util.scanner; public class anagramcomparer{ public static void main(string[] args){ scanner scan = new scanner(system.in); system.out.println("enter sentence."); string sentence = scan.nextline(); sentence = sentence.tolowercase(); string empty1 = ""; for(int = 0; <= sentence.length(); i++){ //if char between 97 & 122 // if char <= charat (0 sentence length - x) if(sentence.charat(i) <= empty1.charat(0)){ empty1.replace(empty1.charat(0), sentence.charat(i)); } else{ empty1 = (empty1 + (sentence.charat(i))); } } system.out.println(empty1); system.out.println(sentence); ...

c# - Addition of times -

i have problem adding times. time addition occur after pm. i give example. arrival time | waiting time | departure time | travel time 10:30 pm | 60 | 11:30 pm | 0 11:30 pm | 5 | 11:35 pm | 5 11:40 pm | 10 | 11:50 pm | 10 the addition goes these formula: departure time = arrival time + waiting time next arrival time = departure time + travel time so problem after addition of 11:50 pm + 10 (min) shows 1.00:20:00 should 12:00 pm you can use timespan this //get time part timeofday datetime dt = new datetime(2015, 10, 3, 11, 50, 00); //03/10/2015 11:50:00 var time = dt.timeofday; //11:50:00 //or timespan directly time = new timespan(11, 50, 00); //11:50:00 //add new timespan var nexttime = time.add(new timespan(0, 10, 00)); //12:00:00 basically, can create instance of timespan specifying hours, minutes, seconds this timespan ts = new timespan(14, 50, 00); //14:50:00 in problem, should u...

MySql - using dynamic table names in one query -

i have following tables: cars id name color bicycles id name number_of_gearshift i need central index table of tables in mysql database , unique id them. this: items id table_name lets say, id in items-table same in corresponding table: items id | table_name 1 | cars 2 | cars 3 | bicycles 4 | cars cars id | name | color 1 | peugeot | red 2 | bmw | green 4 | nissan | blue bicycles id | name | number_of_gearshift 3 | stevens | 24 my question - following situation: have id (for example xxx) of item. want data of item, 1 query. (i know, not work): select table2.* (select table_name items id = xxx) table2 is possible? use can use dynamic sql query achieve this. set @query = null; set @id = 3;/*change according requirement*/ set @tn := (select `table_name` items id = @id); set @query = concat('select * ',@tn,' id = ',@id); prepare stmt @query; execute stmt; deallocate prepa...

php - Select id in multi varchar field -

table category id int description varchar table products id int id_cat varchar etc.. id | id_cat 1 | 1, 2, 3 2 | 3,4,6,2 3 | 1, 5 , 7 . . . i need select * produts id_cat in ( '1','2' ) but not work!? id | id_cat 1 | 1, 2, 3 your database layout not allow having multiple categories per product -- allows 1 product category. need additional table hold product-category relations. also, likes expensive use, recommend using join instead. try structure: create table category ( id int primary key, description varchar(255) ); create table product ( id int primary key, category_id int, description varchar(255) ); create table product_category ( product_id int, category_id int ); you can join tables, using sql similar this: select c.name "category name", p.name "product name" product p inner join productcategory pc on p.productid = pc.productid inner join category c on pc.categoryid = c....

c - Wrong Output using Mutex and Pthread Library -

the purpose of below program learn mutex , pthread library. main() creates 3 thread. (thread 1, 2 & 3). each thread one-by-one sequentially, reads 1 character per file (different file) , stores global constant. example thread 1 reads character 'a' file1, wait thread 2 & 3 same (i.e. read 'b' , 'c' file2 , file3 respective). once reading finished, want main print global constant file.out i have attempted program same getting incorrect output. #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <pthread.h> #include <stdbool.h> char glob_var, strtemp[1024]; pthread_mutex_t lock; int cnt = 0; char inp[3][10] = {"file-1.in", "file-2.in", "file-3.in"}; void * thread_func(void * arg); void * thread_func(void * arg) { file *fp; char * argu = (char *)arg; fp = fopen(argu, "r"); while (1) { pthread_mutex_lock(&lock); glob_var = f...

ios - Swift compiler error after upgrading to El-Capitan -

Image
i working on project developed in swift. project working fine until upgraded el-capitan. opened xcode project getting error opening import file module 'swift': permission denied i had refer similar questions on doesn't solve problem. adding sreenshot more clarity please can provide solution ? appriciated. thank you. yes, got answer. recreated project , copy code previous xcode project. problem compiler not able find required file in project location. follow these steps. quit projects , xcode completely. delete derived data , dt.xcode caches folder. create new xcode project in different location. copy code previous xcode. hope someone.

php - Do you think its worth to make one more classes from an "observer" object? -

there news , newstranslations . every time new created, @ least 1 translation should exists: class newsmodel { public function add() { $newid = sql insert news $this->notifyadd ($newid); } } class newstranslationmodel { public function add ($newid) { sql insert } public function notifyadd($newid) { $this->add ($newid); } } $news = new newsmodel(); $newstranslation = new newstranslationmodel(); $news->attach ($newstranslation); but in way, feel newstranslationmodel has responsibilities. if write this: class newsmodel { public function add() { $newid = sql insert news $this->notifyadd ($newid); } } class newstranslationmodel { public function add ($newid) { sql insert } } class newstranslationobserver { private $newstranslation; public function __constructor ($newstranslation) { $this->newstranslation = $newstranslatio...

F# random class throws BadImageFormatException when calling .NextDouble() -

i have made small application book f#, when call rand.nextdouble() method throws badimageformatexception, @ first glance looks it's images have no idea i'm supposed here. i'm using vs community 2013 using visual f# 2013. have 64 bit windows 7 i know it's nextdouble method that's problem through trying seperate let let create_field num_asteroids = let lerp (x: float<'u>) (y:float<'u>) (a:float) = x*a+y*(1.0-a) let rand = random() [for =1 num_asteroids let m = (lerp earth_mass moon_mass (rand.nextdouble()))* 1.0e-4 let x = lerp 0.0<m> field_size (rand.nextdouble()) let y = lerp 0.0<m> field_size (rand.nextdouble()) let vx = max_velocity*(rand.nextdouble()*2.0-1.0)*0.1 let vy = max_velocity*(rand.nextdouble()*2.0-1.0)*0.1 yield { position = { x = x; y = y } velocity = { x = vx; y = vy } m...

VBScript - Capturing output from stdout -

i know has been answered 1 in question, not understand how done. i trying output of command line program (aria2 downloader) hta script can parsed , download percentage, file size etc can obtained , updated div dynamically. here code have adjusted , have been trying use locks interface until command line has finished , displays output, instead of displaying , when comes through. const wshrunning = 0 const wshfinished = 1 const wshfailed = 2 strcommand = "ping.exe 127.0.0.1" set wshshell = createobject("wscript.shell") set wshshellexec = wshshell.exec(strcommand) while wshshellexec.status = wshrunning window.settimeout "", 100 loop select case wshshellexec.status case wshfinished stroutput = wshshellexec.stdout.readall() case wshfailed stroutput = wshshellexec.stderr.readall() end select set objitem = document.getelementbyid("status") objitem.innerhtml = "" & stroutput & "" ...

html - specifying values for d attribute of path tag in percentage -

how can use percentage values d attribute of path tag? for example: <path stroke-width="4" d="m1% 10% l100% 0" /> does not work. since want reuse elements in svg tag on change in svg size, i'm looking absolute values (in percentage). thanks on advance.. svg path data allow dimensionless numbers, period. if want change size of path, doing transform attributes or establishing new viewport. example, wrap path <svg> element inside outermost <svg> : <svg ...> <svg viewbox="0 0 100 100" x="0" y="10%" width="100%" height="100%"> <path stroke-width="4" d="m1 10 l100 0" /> </svg> </svg> there, define path coordinates absolute values. inner <svg> defines viewbox such path spans amount want. relative sizing , positioning possible x , y , width , height attribute. if want reuse same element multip...

oracle - How to Delete these Records in Netezza(Aginity) -

i written query identify duplicate records. as below. with dups (select a_surveyid, cast(e_responsedate date) e_responsedate, e_lg_vm_survey_type_enum transient..interim_nps_survey_mobile_results_20170909 group a_surveyid, cast(e_responsedate date), e_lg_vm_survey_type_enum having count(*) > 1 ), ranked (select r.drs_record_id, r.a_surveyid, r.e_responsedate , row_number() on ( partition r.a_surveyid, cast(r.e_responsedate date), r.e_lg_vm_survey_type_enum order substr(r.drs_record_id, instr(':', r.drs_record_id, 37) + 1, 14) desc, substr(r.drs_record_id, instr(':', r.drs_record_id, 32) + 1, 4) asc ) dr transient..interim_nps_survey_mobile_results_20170909 r inner join dups on r.a_surveyid = dups.a_surveyid , cast(r.e_responsedate date) = dups.e_responsedate , r.e_lg_vm_survey_type_enum = dups.e_lg_vm_survey_type_enum ) select * transient..interim_nps_survey_mobile_resu...

c# - WPF - DataGrid nested in Expander no scrolling datagrid content -

Image
i have expander nested datagrid on wpf application - creates usercontrols. create control on codebehind each element data (from database) list. finally, have list each element expadned nested datagrid. when develop item see datadrid, when develop many components must scroll content. when cursor there on expander, element scroll works when mouse hover datagrid, scroll doesn't work. sample code: <scrollviewer horizontalalignment="left"> <dockpanel> <expander x:name="expander1" expanded="expander1_expanded"> <expander.content> <datagrid x:name="datagrid1" mouseleftbuttonup="datagrid1_mouseleftbuttondown" scrollviewer.horizontalscrollbarvisibility="hidden" scrollviewer.verticalscrollbarvisibility="hidden" > <datagrid.cellstyle> <style targettype="datagridcell"> ...

string - Reading from a csv file and separating key and value and returning a map in java -

i'm reading csv file has column contains key value pair in 1 of columns. sample csv file: country product baseurl paramandmacro usa oil http://usa.com key={value}&key2={value2}&key3={value3} i'm attempting split column called paramandmacro , store in hashmap key value pair. first attempt, successful @ splitting string using split function: public map<string, string> splitstring(string s) { // string s represents paramandmacro string[] split = s.split("=|\\&"); int length = split.length; map<string, string> maps = new hashmap<>(); (int i=0; i<length; i+=2){ maps.put(split[i], split[i+1]); } return maps; } this works doesn't check corner cases. such "key={value}&key2={value2}&key3=" or "key={value}&key2={value2}&key3=&" throw exception. if value empty store object key , empty value. ex: {key3=} . if k...

Adobe Console OAuth correct URI for LoginIn -

i'm trying authenticate adobe i/o oauth app. i've create app in "developement" mode , has own client_id etc. the adobe docs seems allow login javascript or connecting url: https://marketing.adobe.com/authorize?response_type=code&state=12345&client_id=[client_id] if try connect url error: the client id supplied invalid now, think because i'm targeting wrong url cannot find anywhere correct url redirect user authentication. there sort of generic https://console.adobe.io/oauth/authorize out there?

javascript - How to unit test function having global variable using Chai Mocha and sinon? -

consider function, function upgradeplans (arr, curplan) { var ispaidcustomer = cust && cust.type === "subscriber" && cust.subtype === "paid"; (var = 0, max = arr.length ; < max ; i++) { if (ispaidcustomer) { if (plans_index[arr[i].plansize] > curplan)) { arr[i].upgradeplan = true; } continue; } break; } return arr; }, in function, cust , plans_index global object, test not have access these. now, want unit test function e.g it returns arr when cust not defined it returns arr when cust not subscriber it returns arr when cust not paid subscriber to solve this, tried change upgradeplans function way, function upgradeplans (arr, curplan, cust, plans_index) { // same content above function } to test function having global variable, have pass variable argument. this solves prob...

Java scanner for 2 character combinations -

i have made scanner in java displays how many letters there in input text, how many 'a' letters, 'b' letters, etc. real thing need here fir scanner me display how many "ch", "au", "iu" , other 2 letter combinations there in text. since new coding, have no clue on how it. you can use indexof() method of string class , know number of occurrences. basic google search. else, can use third party libraries apache commons , use api stringutils. countmatches()

video - Ubuntu 16.04 + Radeon HD 3870. OpenGL 4 possible? -

i'm running unreal engine editor on ubuntu 16.04 + radeon hd 3870. there way enable opengl 4 support? right have use 3. thanks! # uname -r 4.10.0-33-generic # lspci | grep vga 03:00.0 vga compatible controller: advanced micro devices, inc. [amd/ati] rv670 [radeon hd 3870] # glxinfo | grep 'version' server glx version string: 1.4 client glx version string: 1.4 glx version: 1.4 max core profile version: 3.3 max compat profile version: 3.0 max gles1 profile version: 1.1 max gles[23] profile version: 3.0 opengl core profile version string: 3.3 (core profile) mesa 17.0.7 opengl core profile shading language version string: 3.30 opengl version string: 3.0 mesa 17.0.7 opengl shading language version string: 1.30 opengl es profile version string: opengl es 3.0 mesa 17.0.7 opengl es profile shading language version string: opengl es glsl es 3.00 radeon hd 3870 support opengl 3.3 or below doesn't officially support opengl 4

python - Is it possible to use wkhtmltopdf on AWS lambda -

there node js github repos this. newbie node, therefore used python try out. problem i getting permission denied error on lambda. below code error code. error { "errormessage": "[errno 13] permission denied", "errortype": "permissionerror", "stacktrace": [ [ "/var/task/htmltopdf.py", 50, "handler", "c=pdfkit.from_string(document,false,configuration=config )" ], [ "/var/task/pdfkit/api.py", 72, "from_string", "return r.to_pdf(output_path)" ], [ "/var/task/pdfkit/pdfkit.py", 129, "to_pdf", "stderr=subprocess.pipe)" ], [ "/var/lang/lib/python3.6/subprocess.py", 707, "__init__", "restor...

javascript - Uncaught ReferenceError: functionXXX is not defined at HTMLInputElement.onclick -

in selenium automation test, using remote webdriver , trying launch html file below. html page opens correctly, @ last part of code, trying click on submit button calls javascript function (actiondeterminator()). when button clicked call js function (actiondeterminator()), see error in console have mentioned @ bottom part. below html: string butnowbutton = "<!doctype html public -//w3c//dtd html 4.0 transitional//en>" + "<html><head>" + "<meta http-equiv='content-type' content='text/html'; charset='utf-8'>" + "<meta content='mshtml 6.00.2900.3157' name='generator'></head>" + "<body>" + "<h1>hello it's testing page</h1>" + "<hr>" + "<p>enter following fields , press button initiate transaction" + "transaction</p>...

php mysql pdo bindparam data not insert -

when call function , shows no error, data not inserted. database connection checked , ok , connection type pdo. public function insert(){ $table = "category"; $data = array( 'cat_id' => 5, 'cat_name_en' => 'science', 'cat_info' => 'all nature', 'cat_tags' => 'physics, chemistry' ); $keys = implode(', ', array_keys($data)); $values = ":".implode(", :", array_keys($data)); echo $sql = "insert $table($keys) values($values)"; $stmt = $this->db->prepare($sql); foreach ($data $key => $value) { $stmt->bindparam(':'.$key, $value); } return $stmt->execute(); } database connection ok. because works on select , delete query, not working insert , update query. not want alternative want bug. please me. trying solve 2 days. windows 10 64b...

java - Executors Schedule in different intervals -

i try schedule executors newsinglethreadscheduledexecutor send report after 10 days(from initialized of system), after 20 days(from initialized of system) , every 1st of month. tried use newsinglethreadscheduledexecutor runs every day , check if today after 10 days.. 20 days , etc. but, think have more elegant way solve executors. have idea how can improve code? the scheduler: scheduler.schedulewithfixeddelay(() -> { try { createreport(); } catch (exception e) { log.error("error create engagement report", e); } }, 1, 1, timeunit.days); and on createreport function - check dates. thanks! eventually, use scheduledexecutorservice schedule initializing in constructor: scheduler.schedule(createtask , nextdayoftask, timeunit.days); so, every time createtask - re-calc when next report should out , update schedule. public runnable createtask = new runnable() { @override public void run() { ...