Posts

Showing posts from August, 2014

arrays - Manipulating a struct which is a class property in MATLAB -

i've been trying work matlab classes & structs in order develop traffic simulation. have not worked actively matlab classes before, gets bit tricky @ times. questions involves manipulating struct, property of class. top-level access vehicles_handle = vehicleshandle; vehicles_handle.createvehicles(initialtrafficdensity); vehicles_handle.vehicles(1) class definition classdef vehicleshandle %vehicleshandle summary of class goes here % detailed explanation goes here properties active_vehicles_count vehicles end methods (access = public) function obj = vehicleshandle obj.active_vehicles_count = 0; obj.vehicles = struct('lane',0,'position',0,'velocity',0); end function obj = createvehicles(obj,initialtrafficdensity) obj.active_vehicles_count = obj.active_vehicles_count + 1; obj.vehicles(1).lane = 1; obj.vehicles(1).position ...

Plexum install gives error C:\php\php-cgi.exe - The FastCGI process exited unexpectedly -

i have configured php fast cgi module iis. when install plexum software (by run plexum_setup.php file) gives error c:\php\php-cgi.exe - fastcgi process exited unexpectedly when run phpinfo.php run successfully. version info > php non thread safety version 5.6.25, server iis, zend loader supported version tried solutions > i installed visual c++ redistributable visual studio 2012 update 4 still no success. created new application pool "classic" pipeline mode , "no managed code" , enabled 32 bit true same issue still exists. anyone have idea please tell us. thanks so after big r & d, have found there permission issues not working windows server. have set required software plexum on linux server , plexum installed successfully. plexum support linux server well. thanks

javascript - valid() method of jquery validator is always returning true -

i using jquery validator, input field left blank , showing value empty, jquery valid() method returning true. there several tabs inside form, , each click of next next tab shown , previous hidden. cant validate form @ once validation rule given as: $('#wizard_example_1').validate({ rules: { link_client_name: { required: true }, link_page_url: { required: true, url: true }, link_title: { required: true }, link_message: { required: true }, link_text: { required: true }, link_url: { required: true, url: true } } }); and jquery code check elements specificaly if valid or not as $('.next-btn').on('click', function (e) { e.preventdefault(); count++; if (obj['camp_type'] === "1") { var valid = false; $.each($(...

javascript - .Datatable is not a function -

i try table feature https://datatables.net/examples/basic_init/scroll_xy.html i have dropdown , date picker add links table , datetime picker links add table , use script when select datetime picker calendar not display when check console show error i try export table data in excel webform1.aspx:34 uncaught typeerror: $(...).datatable not function code <%--for tabledata--%> <script type="text/javascript" src="//code.jquery.com/jquery-1.12.3.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.datatables.min.js"></script> <link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/jquery.datatables.min.css" /> <link href="styles/stylechart.css" rel="stylesheet" /> <!--for date--%>--> <link rel="stylesheet" href="https://code.jquery.com/ui...

What is the naming convention for ASP.NET Core projects? -

in asp.net core convention projects seems to put asp.net core projects inside src\ folder, , test projects inside test\ folder. what other conventions there, ie. should web (front-end only) project located? the honest answer "it depends." src , test folders @ root common structure seen in code repositories today. here common root folders , may contain: test - unit tests, ui tests, integration tests, etc. src - source code projects tools - strong-name files and/or 3rd party tools may used tests or builds build - scripts perform various builds on project docs - documentation files project how organize web (front-end only) project inside asp.net core directory structure? the advice can give without knowing project, , people interacting it, keep simple. haven't found need add more root folders beyond what's seen above. keep in mind there folders default project template going use: by default, grunt set in css , js , , lib folders...

generics - Issue with protocol conformance in Swift using associatedtype -

i cannot make classes compliant protocols use associatedtype . in playground, i've typed brief , simple example show issue: producer produces itemtype compliant items , consumer which consumes them. follows: protocol itemtype { } protocol producer: class { associatedtype t: itemtype func registerconsumer<c: consumer c.t == t>(consumer: c) } protocol consumer: class { associatedtype t: itemtype func consume<p: producer p.t == t>(producer: p, item: t) } struct emptyitem: itemtype { } class dummyproducer: producer { var consumer: dummyconsumer? func registerconsumer(consumer: dummyconsumer) { self.consumer = consumer } } class dummyconsumer: consumer { func consume(producer: dummyproducer, item: emptyitem) { print("received \(item) producer \(producer)") } } xcode warns me following errors: playground execution failed: myplaygroundyeye.playground:14:7: error: type 'dummyproducer' not con...

php - Remove memory limit -

i have ms sql server , table name 'files'. table column type 'image' (or blob) there saved pdf files. , try select in php. code like $sql = "select datalength(file) len, file files id = 1"; $stmt = $dbh->prepare($sql); $stmt->execute(); while ($row = $stmt->fetch()) { $filelength = $row['len']; $file = $row['file']; break; } echo $filelength; echo strlen($file); in display showed 1448484 , 64512. variable $file took 64512. file memory in database 1.4 mb. in php code variable $file takes 64kb. in fact, variable size of $file must 1.4 mb. why? how change limit? me, please. sorry english

php - WooCommerce custom stock status -

i trying overwrite woocommerce_product_is_in_stock filter/hook, have found answer: additional stock options in woocommerce add_filter('woocommerce_product_is_in_stock', 'woocommerce_product_is_in_stock' ); function woocommerce_product_is_in_stock( $is_in_stock ) { global $product; // array of custom stock statuses have add cart button $stock_statuses = array('onrequest','preorder'); if (!$is_in_stock && in_array($product->stock_status, $stock_statuses )) { $is_in_stock = true; } return $is_in_stock; } but helps me partway, return product in stock instances whenever try view cart product cannot found. global $product seems "null" whenever var_dump it. how can change code cart allow me order product own custom stock status? thanks in advance! i did updating woocommerce is_in_stock() function in woocommerce -> includes -> abstracts -> abstract-wc-product.php public func...

How to access logs in Azure Service Fabric cluster? -

i created app package guest executable without visual studio. consoleredirection configured create logs apps stdout , errout . works on local service fabric cluster. , logs can located in file system. how can access these logs in azure cloud? update: loekd pointed out remote desktop protocol can used access nodes in service fabric cluster. admin account name located in load balancer's automation script in virtualmachineprofile section. there's description here explains how discover log files stored. 'check running application' you can use rdp access machine, explained here .

How to display columns that start with 0 and sum values in output string? AWK -

there file 3 columns. display sum of second , third number each string if first number of columns 0. 1,2,3 3,4,5 0,1,2 0,0,7 result: 3 7 i trying reason receive 2 0 result: awk '$1 ~ /^0/ {print $2 + $3}' zadanie.csv as file comma separated need provide awk value of input field separator comma in case. awk -f, '$1 ~/^0/ {print $2+$3}' foo 3 7

php - Does SimpleSAMLphp SP need to communicate with IdP? -

i stumbling through docs , several pages while unable find answer. question pretty simple: can host idp in local network (idp not available outside) whilst sp available via internet? if set idp , sp locally fine. if set idp/sp on public servers fine. if set idp locally , sp on public server end in nostate error. i know sp wants make use of idp available when on specific network not make sense. problem have deal situation. ;) when analyzing workflow via apache access logs not see direct communication between sp , idp. seems handled users browser itself. therefor guess should possible? if should possible have fix nostate error. if not possible, nostate error missleading , not able solve problem. any ideas or experiences? saml supports front channel binding (what looking for) , channel binding sp needs communicate directly idp. vast majority of deployments i've seen use front channel, done through user's browser. as scenario, yes possible. use qui...

ios - Insert counter enemies killed -

i'm developing simple 2d play , implement counter every enemy killed , keep displayed on display until game over. how this? i'm using xcode 7.3.1 my enemies code : func frecciaincollisioneconnemico(freccia:skspritenode, nemico:skspritenode) { print("freccia ha colpito un nemico") freccia.removefromparent() nemico.removefromparent() nemicidistrutti += 1 print("hai distrutto \(nemicidistrutti) nemici") if (nemicidistrutti >= 20) { let rivela = sktransition.fliphorizontalwithduration(0.5) let gameoverscene = gameoverscene(size: self.size, vinto: true) self.view?.presentscene(gameoverscene, transition: rivela) } } you should able answer question easy. create label class gamescene: skscene { let enemieskilledlabel = sklabelnode(fontnamed: "helveticaneue") override func didmovetoview(view: skview) { loadenemieskilledlabel() } private func loadenem...

python - Override get_instance import-export django -

i have basic problem in django/ python. don't know right answer. i have override "get_instance" in django-import-export.instance_loaders actually change code directly in function. know not clever. don#t understand should override function. in mymodelresource or where? hope can me. thanks basically, need define custom instanceloader class in resource inner meta class: class bookresource(resources.modelresource): class meta: model = book fields = ('id', 'name', 'price',) instance_loader_class = mycustominstanceloaderclass class mycustominstanceloaderclass(baseinstanceloader): def get_instance(self, row): # implementation here something should you.

ASP.NET Web API Contract Versioning -

we achieve version based api using content negotiation in accept header. we able achieve controller & api methods inheritance , extending default http selector. controller inheritance achieved using following sample code, public abstract class abstractbasecontroller : apicontroller { // common methods api } public abstract class abstractstudentcontroller : abstractbasecontroller { // common methods student related api'sample public abstract post(student student); public abstract patch(student student); } public class studentv1controller : abstractstudentcontroller { public override post([frombody]student student) // student should instance of studentv1 json { // do: insert v1 student } public override patch([frombody]student student) // student should instance of studentv1 json { // do: patch v1 student } } public class studentv2controller : abstractstudentcontroller { // public override post([fromb...

What are the possible use-case for tableau and hadoop integration -

i analytics on data present on hadoop. how can connect tableau hadoop? scenario-1: tableau desktop user can connect hiveserver or hiveserver2 have connectors. there no odbc drivers available of connecting apache hive directly tableau. scenario-2: cloudera provides odbc drivers tableau integration hadoop via cloudera hive server. http://www.cloudera.com/downloads/connectors/hive/odbc/2-5-20.html hope these information help!!

python - Traversing multiple dataframes simultaneously -

Image
i have 3 dataframes of 3 users same column names time, compass data,accelerometer data, gyroscope data , camera panning information. want traverse dataframes simultaneously check particular time user has performed camera panning , return user(like in data frame panning has been detected particular time). have tried using dash achieving parallelism in vain. below code import pandas pd import glob import numpy np import math scipy.signal import butter, lfilter order=3 fs=30 cutoff=4.0 data=[] gx=[] gy=[] g_x2=[] g_y2=[] datalist = glob.glob(r'c:\users\chaitanya\desktop\thesis\*.csv') csv in datalist: data.append(pd.read_csv(csv)) in range(0, len(data)): data[i] = data[i].groupby("time").agg(lambda x: x.value_counts().index[0]) data[i].reset_index(level=0, inplace=true) def butter_lowpass(cutoff,fs,order=5): nyq=0.5 * fs nor=cutoff / nyq b,a=butter(order,nor,btype='low', analog=false) return b,a def lowpass_filter(data,cutoff,...

android - AccessToken.getCurrentAccessToken() is null -

i integrated facebook in app , getting proper token. if token exists assigns it, , if it's first time make request token. however, token not being received. here code: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); facebooksdk.sdkinitialize(this.getapplicationcontext()); callbackmanager = callbackmanager.factory.create(); accesstokentracker = new accesstokentracker() { @override protected void oncurrentaccesstokenchanged( accesstoken oldaccesstoken, accesstoken currentaccesstoken) { // set access token using // currentaccesstoken when it's loaded or set. } }; // if access token available assign it. accesstoken = accesstoken.getcurrentaccesstoken(); setcontentview(r.layout.activity_signup); were able solve this? have noticed graphrequest...

AutoIt send command in IE in Kiosk mode -

i'm new coding (like new) managed wanted autoit. means: launch ie automatically on web page in kiosk mode. far good. but before not in kiosk mode input sent worked can't find problem why not work more. shellexecutewait("c:\program files\internet explorer\iexplore.exe", "-k http://website.com", "") winwaitactive("website.com  login - internet explorer","") send("login{tab}password{enter}") the website launched, i'm directly in login box, nothing typed in it. ideas? like @steve said in comments, can try use controlfocus when window shown, send credentials. shellexecutewait("c:\program files\internet explorer\iexplore.exe", "-k http://website.com", "") ; store returned window handle use in controlfocus call local $hwnd = winwaitactive("website.com login - internet explorer","") controlfocus($hwnd, "", "edit1") send("...

javascript - Typescript module export not work when import something -

i trying create powerbi custom visual , must use typescript that. i'm not familiar typescript. got 2 ts files under same namespace(i using vs code editor): visual.ts module powerbi.extensibility.visual { export class visual implements ivisual { private target: htmlelement; private updatecount: number; constructor(options: visualconstructoroptions) { console.log('visual constructor', options); this.target = options.element; this.updatecount = 0; } public update(options: visualupdateoptions) { console.log('visual update', options); console.log(testfunc()); $('#datepicker').datepicker(); this.target.innerhtml = `<p>update count: <em>${(this.updatecount++)}</em></p>`; } public destroy(): void { //todo: perform cleanup tasks here } } } test.ts import react=require('react'); import reactdom=require('react-dom...

java - Tomcat 8 - LDAP: NameNotFoundException error code 32, remaining name empty string -

Image
trying migrate application weblogic 12.2.1 tomcat 8.5.4 , under weblogic entry foreign jndi providers ldap connection has been migrated new resource under tomcat. following this advice on stack overflow, custom ldapcontextfactory has been packaged new jar file under tomcat lib folder. in tomcat server.xml file following globalnamingresources/resource has been configured: <resource name="ldapconnection" auth="container" type="javax.naming.ldap.ldapcontext" factory="com.sample.custom.ldapcontextfactory" singleton="false" java.naming.referral="follow" java.naming.factory.initial="com.sun.jndi.ldap.ldapctxfactory" java.naming.provider.url="ldap://some.host:389" java.naming.security.authentication="simple" java.naming.security.principal="cn=some,ou=some,ou=some,dc=some,dc=a,dc=b" java.na...

javascript - How do I force jQuery to not automatically close a tag? -

i have link , want create nav tag before link tag, close after a tag. code: <a href="" id="test">link test</a> i want code this: <nav class="link-effect"> <a href="" id="test">link test</a> </nav> i tried following .before() , .after() , .append() , .prepend() closing tag created automatically. use .wrap function of jquery. $( "#test" ).wrap( '<nav class="link-effect"></nav>' ); please check below snippet. $( "#test" ).wrap( '<nav class="link-effect"></nav>' ); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <a href="" id="test">link test</a>

css - Is it still relevant to specify width and heigth attribute on images in HTML? -

i found a similar question here , answer: " you should define width , height in image tag ." 2009. in meantime, many things has changed on frontend. doing responsive page design now, many devices , sizes simultaneously (mobile, tablet, desktop...). so, wonder still necessary specify width , height attributes in 2016, , reason (for responsive, page speed, seo...)? an img element has width , height attributes, they're not required under doctype . width , height attributes 'required' or relevant reserve space on page , prevent page moving around loads - important. can achieved using css instead providing css loads enough - load before images anyway, should good. it possible (and valid) specify 1 attribute, width or height , browser calculate omitted value in order maintain correct aspect ratio. you can specify percent values in attributes if required. don't need use css this, if implying. also, relevant add - under html5 width , height ...

asp.net mvc - Azure Deployment Slot swap redirects to same domain -

my scenario follows. i have website.azurewebsites.net main site redirects https://website.dk (i bought domain) , created deployment slot called website-dev.azurewebsites.net. when want visit 'dev' 1 still being redirected https://website.dk has changes website.azurewebsites.net. how can access website-dev.azurewebsites.net without being redirected main one? edit: maybe redirect in web.config file, have commented out redirect part , published? i have found solution, turns out had comment entire <rewrite> block in web.config. <!--<rewrite> <rules> <rule name="force https" enabled="true"> <match url="(.*)" ignorecase="false" /> <conditions> <add input="{https}" pattern="off" /> </conditions> <action type="redirect" url="https://website.dk/" appendquerystring="true" redirecttype=...

wordpress - Is there any way to hide wp-config.php inside Google App Engine? -

just that. i mean. i'm bit noob in gae. have wp web running inside , want protect bit. if using, example, apache, can put thing inside .htaccess file: <files wp-config.php> order allow,deny deny </files> and if try access (directly, www.foo.bar/wp-config.php) going obtain 403 forbidden error, can't find similar same results using app.yaml file. gae managing differently kind of attack? have other option, apart of change location of file? thanks. according wordpress docs, can place wp-config.php file 1 directory above equivalent of root or public_html , wordpress core able find it. see https://codex.wordpress.org/editing_wp-config.php if have similar directory structure in gae (i'm not user of gae), try that. but there questions if beneficial: https://wordpress.stackexchange.com/questions/58391/is-moving-wp-config-outside-the-web-root-really-beneficial

windows - Firemonkey Scrambles graphics on laptop -

Image
i have application plots quarter degree blocks on map using timage stacked on each other. add records drawing them on separate layer. the problem have firemonkey (or windows) scrambles graphics, on computers, , think affected computers laptops. see following links screenshots: the correct image should this: on laptops scrambling may take 3 repaints of layers, (on same code) happens after 1 or 2 times. while inconsistent in how many repaints takes, guaranteed happen after no more 3 paints. so have come conclusion must graphics driver issue. have nvidia geforce 950m on laptop (asus nj551 windows 10), if understand code correctly using windows direct2d acceleration nvidia drivers shouldn't affect things? i set following flag default: globalusedx10software := true; //use directx generate graphics, not seem make difference still scrambles when set false. i prefer windows acceleration users may not have graphics card installed. friend using hp laptop (not sure o...

android - Whitelisting app users in Google Play Store (outside the organisation) -

my goal place application in google play store , let users download (access granted google account). 1 of possible solutions use google play private channel ( https://support.google.com/a/answer/2494992?hl=en ) users' accounts limited domain, in case impossible. other options? consider using closed beta tests in google play. here can find detailed info.

java - JsonMappingException: Can not find a deserializer for non-concrete Map type -

string str = commonclient.authorizedrequestbuilder(commonclient.webtarget .path("/apps/get_current_version/default/"+appname+"/"+appname) .queryparam("object_type", "app")) .accept(mediatype.application_json_type) .get() .readentity(string.class); i str = {"versions": {"ap": "not set", "am": "topic-test-publisher-1.0.16", "il": "topic-test-publisher-1.0.16", "row": "topic-test-publisher-1.0.49"}, "provider": "gce"} then have changed code version version = commonclient.authorizedrequestbuilder(commonclient.webtarget .path("/apps/get_current_version/default/"+appname+"/"+appname) .queryparam("object_type", "app")) .accept(mediatype.application_json_type) .get(clientresponse.c...

py.test - Disable PyTest Recursion Checking? -

when run pytest, tests failing with .... !!! recursion detected (same locals & position) however when run tests manually, see there no infinite recursion. code weird stuff trick's pytest's recursion detector. is there way disable recursion checking tests? i'm running pytest 3.0.1 if setting return_value on mocked function referenced recursive code, use side_effect instead.

Memory error trying to free pointers in struct - C -

code: #include <stdio.h> #include <stdlib.h> typedef struct nodo{ int valor; struct nodo* hijo1; struct nodo* hijo2; }nodo; typedef nodo* arreglo; arreglo inic_arr(int longitud); void imp_arr(arreglo a,int longitud); void inic_arbol(arreglo a, int longitud); void free_arbol(arreglo a, int longitud); int main(){ arreglo a; int longitud = 10; = inic_arr(10); inic_arbol(a,longitud); imp_arr(a,longitud); free_arbol(a,longitud); return 0; } arreglo inic_arr(int longitud){ int i; arreglo = (arreglo)calloc(longitud,sizeof(nodo)); for(i = 0; < longitud; i++){ a[i].valor = rand()%10; } return a; } void imp_arr(arreglo a,int longitud){ int i; for(i = 0;i < longitud; i++){ printf("[%d,",a[i].valor); if(a[i].hijo1 == null){ printf("-,"); } else{ printf("%d,",(*(a[i].hijo1)).valor); } if(a[i]....

android - Include aar in sbt build -

i have android project here includes local file aars in gradle via dependencies { compile project(':packagename_0.3') } i unable translate appropriate sbt syntax during build sbt able resolve dependencies. have idea ? checked scala on android still did not manage find working way. have suggestion? well ended extracting jars aars , adding them default unmanagedbase folder ( src/main/libs ).

post - How to remove $_POST in php -

i writing php page, player voting. using $post method. when cast vote if(isset($_post['amla'])){ $amla = "update players set amla=amla+1"; $run_amla =mysqli_query($conn , $amla); $_post = array(); echo "<script>alert('your vote casted'); </script>"; } so when use print_r statement after check value of $_post ooutput : array(); but when refresh page $_post variable appear previous value rather empty array causes logical error cast vote automatically. how can clear $_post still clear after page refreshed. replace $_post = array(); with unset($_post); now post statement should empty.

How to create build variable using Groovy in Jenkins 2.x -

before update 2.7.x version of jenkins, used code create build variable in job using 'execute system groovy script': import hudson.model.* build.addaction(new parametersaction(new stringparametervalue("var_name", 'foo'))) after update doesn't work, in log see: warning hudson.model.run getenvvars deprecated call run.getenvvars @ sun.reflect.generatedmethodaccessor1108.invoke(unknown source) is there workaround, or how create variable using groovy now?

SetSPN using powershell to run CMD commands -

i trying make script runs cmd command set spn: in effect of each item in list run setspn -s (name of spn) domain\service account have hard time running command line need able change (name of spn go though list) $list = get-content c:\users\mycomputer\desktop\lists.txt foreach($pn in $list){ $semper_fi = @' cmd.exe /c setspn –s "some spn name\corp.com:1000" corporatedomain\serviceaccount1 '@ invoke-expression -command:$semper_fi } -s suppose in ad , if name doesn't exist adds or otherwise moves next item , on. gives me error: + categoryinfo : notspecified: (unknown paramet...eck usage.:string) [], remoteexception + fullyqualifiederrorid : nativecommanderror so every name in list: (check see if not in ad add this) (this spn) setspn -s serversql1/pop1.company.com:2500 (under service account)...

hibernate - how to properly generate .hbn.xml mapping files for a java class, which corresponds to a table with a composite primary key? -

in postgresql erp database, have table "custtable", has composite primary key, made following fields: accountnum (string) partition (long) dataareaid (string) as understand, because of composite key, have implement separat pojo, serve id field "custtable" hibernate class: public class custtableid { private string accountnum; private long partition; private string dataareaid; public custtableid(){ } public string getaccountnum(){ return accountnum; } public void setaccountnum( string ) { accountnum = an; } public long getpartition(){ return partition; } public void setpartition(long part){ partition = part; } then, can use id class in main class: @entity public class custtable implements java.io.serializable { @id private custtableid custtableid; having done that, when use eclipse hibernate tools menu generate .hbn.xml mapping file main class, fo...