Posts

Showing posts from May, 2010

rust - How do I avoid 'source trait is private' when using subtraits? -

i'm trying use quickcheck in rust. want define enum instance of arbitrary , can use in tests. #![feature(plugin)] #![plugin(quickcheck_macros)] #[cfg(test)] extern crate quickcheck; use quickcheck::{arbitrary,gen}; #[derive(clone)] enum animal { cat, dog, mouse } impl arbitrary animal { fn arbitrary<g: gen>(g: &mut g) -> animal { let = g.next_u32(); match % 3 { 0 => animal::cat, 1 => animal::dog, 2 => animal::mouse, } } } however, gives me compilation error: src/main.rs:18:17: 18:29 error: source trait private src/main.rs:18 let = g.next_u32(); ^~~~~~~~~~~~ what causes error? know there's this rust issue since gen imported think call .next_u32 . it looks gen has rand::rng parent trait, above works if add extern crate rand after adding rand = "*" cargo.toml. [i had remove #[cfg(test)] above quick...

c - How to open the two udp client socket with same local port -

how open 2 client socket same local port java. in java can mention source port while creating datagrampacket. trying udp hole punching. correct me if done wrong. i have added code here. void udpclientconnect ( string ip , string port ) { wsadata wsa; if ( wsastartup(makeword(2,2),&wsa) != 0 ) { printf ( "startup failed %d\n" , wsagetlasterror() ) ; return ; } int reuse = 1 ; socket s = socket ( af_inet , sock_dgram , ipproto_udp ) ; setsockopt(s, sol_socket, so_reuseaddr,(char*) &reuse, sizeof(int)); struct sockaddr_in si_other; int slen=sizeof(si_other); char buf[buflen]; char message[buflen]; int p = atoi ( port.c_str() ) ; memset((char *) &si_other, 0, sizeof(si_other)); si_other.sin_family = af_inet; si_other.sin_port = htons(p); si_other.sin_addr.s_un.s_addr = inet_addr( ip.c_str() ); strcpy_s ( message , "hello" ) ; //send message if ( sendto ( s , message , strlen(message) , 0 , (struct sockaddr *) &si_other ,...

javascript - Undefined append after an ajax post in rubyonrails -

Image
i'm trying append information after posting ajax this routes: match 'api/people/', to: 'people#people_get_all', via: [:get] match 'api/people/:id', to: 'people#people_get', via: [:get] match 'api/people/', to: 'people#create', via: [:post] this javascript: var $people = $('#people'); var $first_name = $('#first_name'); $('#add_user').on('click', function(){ var person = { person: { first_name: $first_name.val(), last_name: $last_name.val(), location: $location.val(), phone: $phone.val() } }; $.ajax({ type: 'post', url: '/api/people/', data: person, success: function(newperson){ $people.append('<p><strong>first name: </strong>' + newperson.first_name + '</p>'); }, error: function(){ alert...

javascript - jQuery - Bind Unbind click event depending of condition -

i need disable click event jquery mobile button depending if array empty or not. when location loads don't want user able click, once array has values, change that. this have tried: if (points.length != 0){ $('#addplaces').bind('click');} else{$('#addplaces').unbind('click');} i have tried same condition with: $('#addplaces').on('click'); $('#addplaces').off('click'); what doing wrong? thanks! why wanna that. return event when array empty , continue execution otherwise. $('#addplaces').on('click', function() { if (points.length === 0) { return } }); this way need not keep toggling event.

iis 7 - Windows Server 2008, IIS7 - hosting private-bower -

its been ten years since worked iis. windows server 2008 new me. now, need install private-bower service on windows server 2008, , i'm not sure if need iis 7 , iisnode or if there better way. running private-bower, starts server @ http://localhost:5678/ what best way expose service internal network on windows server 2008? or in noob terms: how convert http:localhost:5678 run in win server 2008 , iis7? i can install node/npm. using node option, within iis using iisnode , iis7 (link below) need to? there easier way in iis? i'm not sure start configure :5678 port external service, , how keep running, in remote desktop login. the links i've been using are: private-bower: https://www.npmjs.com/package/private-bower node on iis: http://admin-ahead.com/blog/node-js-installation-windows-2008-r2-server/ iisnode: https://github.com/tjanczuk/iisnode but need window server 2008 , iis 7, possibly link describing ideal service configuration. thanks. ...

java - Fixed Point Perlin Noise returns sum of input points as output -

i have taken fixed-point perlin-noise implementation from: http://mrl.nyu.edu/~perlin/noise/inoise.java , modified compiles under c#. in version 1.0 represented 2^16. when pass in input coordinates (int x, int y, int z) output sum of x , z coordinates. wrong class or input points? here example of returned output: (int y = 0; y < 1; y++) { (int x = 0; x < 16; x++) { (int z = 0; z < 16; z++) { debug.log(perlinnoisefixedpoint.noise3d(x, y, z)); } } } output: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ...

path - unable to create new project in visual studio 2015 -

i not able create new project in visual studio 2015. error access path denied c:\users\good\documents\visual studio 2015\windowsapplication1\windowsapplication1' denied. i had similar problem in visual studio 2017. removed folder working again: c:\users\username\appdata\local\microsoft\visualstudio\15.0_4f8023be 15.0_4f8023be unique hexadecimal number appdata, yours different. it might work removing: c:\users\username\appdata\local\microsoft\visualstudio\15.0_4f8023be\privateregistry.bin and way won't lose settings , extensions.

why is the base64 encode java code doing this -

so i'm trying understand base64 encoding better , came across implementation on wikipedia private static string base64encode(byte[] in) { stringbuffer out = new stringbuffer((in.length * 4) / 3); int b; (int = 0; < in.length; += 3) { b = (in[i] & 0xfc) >> 2; out.append(codes.charat(b)); b = (in[i] & 0x03) << 4; if (i + 1 < in.length) { b |= (in[i + 1] & 0xf0) >> 4; out.append(codes.charat(b)); b = (in[i + 1] & 0x0f) << 2; if (i + 2 < in.length) { b |= (in[i + 2] & 0xc0) >> 6; out.append(codes.charat(b)); b = in[i + 2] & 0x3f; out.append(codes.charat(b)); } else { out.append(codes.charat(b)); out.append('='); }...

What is the minimum Android version supported by Meteor? (for cordova mobile app) -

that's question - quite simple! this latest version of meteor date 1.1.0.2. i understand uses cordova 4.2 has it's own version constraints. ready somewhere supporting android versions more 5% live population. can shed light on truth please? (i particularly interested if 4.1.2 supported.) for meteor 1.2.0.2. tried deploy android 2.3.3(api10) , couldn't make app work version because of unresolved bug: https://github.com/meteor/meteor/issues/2822 i minimum required version vainilla meteor android 4.0(api14) , there many issues when trying deploy older versions. as question, you should fine deploying 4.1.2 version , unless using incompatible third party library.

Submit button not working on login form, using PHP and JavaScript -

i trying code simple login page using javascript , php validate user input values values in database. however, submit button doesn't seem anything... clears fields. here code. there many errors in , apologize that... php code wrote collection of other login pages found on web , started learning javascript couple days ago... edit: have updated code based on mistakes guys pointed out. log in button no longer refreshes instead doesn't anything. try figure out or start scratch since there code don't understand, haha. login.html: `<html> <head> <link href='https://fonts.googleapis.com/css?family=montserrat' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="bootstrap.min.css"> <link type="text/css" rel="stylesheet" href="stylesheet.css" /> <title>login</title> </head> <body> <div class="header"...

windows xp - Detect RDP Session on Remote WinXP machine (not on local network or domain) -

i have set win xp machine @ work use our server, allow rdp connections. allows our staff access server home when needed. not server os, missing many of terminal services features regular server have. machine allows 1 rdp session @ time (which minor inconvenience, not big deal). what bothersome, no 1 can tell if server being used in rdp session, , keep booting each other off. every solution have found online assumes remote computer server os or on local network/domain. our staff's home computers not connected office network , have no domain set @ office. is there way tell if server in rdp session before remoting onto server home? ideally able detect home computer accessing server. if not possible, extremely helpful @ least know rdp session running. we using logmein, tell if remote computer keyboard , mouse active , allow chat user remoted on/physically on machine. extremely convenient, involves logging onto logmein website , going through semi-lengthy process of connecting...

node.js - Why is MongoDB ignoring some of my updates? -

i've been building application in node.js using native mongodb driver - includes contacts, , when user accepts contact, should remove "pending" , "sent" contacts, add "contacts". example code , documents: /* ============================= user "john" ============================= { username: "john", contacts: ["jim"], pending_contacts: ["bob"] } ============================= user "bob" ============================= { username: "bob", contacts: ["dave"], sent_contacts: ["john"] } ============================= should happen ============================= { username: "bob", contacts: ["dave", "john"], sent_contacts: [] }, { username: "john", contacts: ["jim", "bob"], pending_contacts: [] } ============================= happens ============================= { username: "john...

json - Elasticsearch: completion sorting by the number of matched documents -

i implementing tag autocompleter elasticsearch. tags stored inside indexed documents in various string arrays: { ... "skills": { "industries_solutions": [ "project-management" ], "skills_competencies": [ "javascript" ], "highlighted": [], "tag_suggest": { "input": [ "javascript", "hibernate", "project-management" ] }, "job_roles": [ "hibernate" ] } } as can see, included them in tag_suggest object , mapped in way able query _suggest api kind of queries: { "tag_suggest":{ "text":"jav", "completion": { "field" : "skills.tag_suggest", "fuzzy" : { "fuzziness" : 1 } } } } which correctly returns: { "_shards": { "total": 5, "succe...

lua - Inserting spawned objects into a group and removing the scene -

i have 2 main questions based on code block below: (1) in both spawning functions, scenegroup:insert() method returns nil though have named scenegroup , have inserted spawned objects new group. why nil value returned? (2) when go next scene because player dies, how destroy current scene? i've tried obtaining current scene , removing way, hasn't worked. local function spawnobjects() local bananas = display.newgroup() scenegroup:insert(bananas) bananas = display.newimagerect("object_bananas.png", 30, 20); physics.addbody(bananas, "dynamic", {bounce = 0.3, radius = 9.5}); bananas.x = math.random(0, 320); bananas.y = -40; transition.to( bananas, {time = math.random(6000, 10000), x = math.random(10, 310)+1 , y = 600, }); -- function handle collision on bananas function bananas:collision(e) -- perform logic when bananas colliding monkey if (e.other.class == "monkey") updatescore() ...

How to close a window after running each test case in Selenium IntelliJ? -

i have set of 3 test cases, , want avoid keeping open multiple browser windows since automated process in selenium. there way close browser after each test case finished without giving error? using close() , quit() both give me error codes of 1. we use below approach handle these issue. 1) create base class has beforesuite , beforetest , aftertest , aftersuite methods run always. 2) each test plan should extend class create driver , close driver. basepage.java package com.test.test3; import java.lang.reflect.method; import java.util.date; import org.openqa.selenium.webdriver; import org.testng.annotations.aftermethod; import org.testng.annotations.aftersuite; public class basepage { public webdriver driver = null; private date start; /* * below method initialize driver once test method started * execution */ public void initializedriver(webdriver driver) { this.driver = driver; } /* * below method kill driver */ public void teardown() { ...

sql - MySQL column manipulation nonsense -

for sake of example, have column of ints looks this: column1 1 2 3 4 5 i have following code: select column1+1 table which returns you'd expect: column1 2 3 4 5 6 on other hand if do: select column1+avg(column1) table i complete nonsense, single row. sincerely apologize if basic but, have no idea what's going on here. i've tried using cast on every possible combination of "colum1+avg(colum1)" still returns nonsense. when have avg() in select , telling sql have aggregation query. without group by , 1 row. you intend this: select column1 + (select avg(column1) table) table;

Java ask String input with multiple words -

hi having problem asking direct whole name using java. system.out.println("doctor"); system.out.println("enter id number:"); idnumber = scan.next(); system.out.println("enter name"); name = scan.next(); system.out.println("enter field of specialization:"); field = scan.next(); system.out.println("id " + idnumber); system.out.println("name " + name); system.out.println("specializtion " + field ); and when enter information below: id = 100 name = brandon sullano it gives me result id 100 name brandon specializtion sullano i want name dynamic can input 2 words how it? in advance.. try code: import java.util.scanner; public class doctordoctor { public static void main (string [] args) { int idnumber; string name, field; scanner sc = new scanner(system.in); system.out.println("d...

python - Fastest way to initialize numpy array with values given by function -

i interested in ((d1,d2)) numpy arrays (matrices) question makes sense arrays more axes. have function f(i,j) , i'd initialize array operation of function a=np.empty((d1,d2)) in range(d1): j in range(d2): a[i,j]=f(i,j) this readable , works wondering if there faster way since array large , have optimize bit. one way use np.fromfunction . code can replaced line: np.fromfunction(f, shape=(d1, d2)) this implemented in terms of numpy functions , should quite bit faster python for loops larger arrays.

android - Can't seem to get my && operation running -

i have simple code here i'm trying create on android studio can't seem work out. the code follow if (username = "sharesharerocks" && password = "shareshare") { //... } it's not && , you mistake comparing operator change to if(username == "sharesharerocks" && password == "shareshare"){ }

javascript - How to combine two $(document).ready callbacks with jQuery? -

is possible combine these 2 javascript $(document).ready functions together? if so, how? code 1: $(document).ready(function() { $('#example').datatable( { "scrolly": 280, "scrollx": true, "pagingtype": "simple", dom: 't<"clear">lfrtip', tabletools: { "sswfpath": "http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf" } }); }); code 2: $(document).ready(function() { var table = $('#example').datatable(); var tt = new $.fn.datatable.tabletools( table ); $( tt.fncontainer() ).insertbefore('div.datatables_wrapper'); }); i assume asking if can move code inside second ready() first, call ready() 1 time? yes, , this. $(document).ready(function() { $('#example').datatable( { "scrolly": 280, "scrollx": true, "p...

multithreading - shared context with GLUT on Linux -

in current setup, have 2 displays being driven 2 gpus. using glut, create 2 windows (one per display) , render each 1 main thread calling glutsetwindow() in draw call, each window. the draw calls renders texture2d sphere (using glusphere()) texture2d swapped image every few seconds. have set array of 2 texture2d can load next image while current texture2d shown. works long runs in main thread. the problem call glteximage2d(), load next image, hangs draw call, need call glteximage2d() on different thread. calling glteximage2d() on different thread crashes, seems opengl context not shared. glut not seem provide way share context, should able context on linux via glxgetcurrentcontext(). my question if context via call, how can make shared context? , work glut? option has been switch different library replace glut, glfw in case loose handy function such glusphere(). recommendation if context cannot shared glut please? with glx context sharing established @ context creati...

ios - Reproducing exact same physics simulation -

i'm running physics simulation on box. when node stops, change it's position, set it's rotation , apply force. 3 parameters always same, yet physics simulation different . difference in not big, surely noticeable. how avoid , reproduce exact same physics simulation every time? help /// code gets executed repeatedly starnode.physicsbody?.velocity = scnvector3zero applyforce() ///always same starnode.eulerangles = scnvector3make(0, float(90*(m_pi)/180.0), 0) starnode.position = scnvector3make(-0.562, 5.578, -18.529) there minute differences between timings of callings of applyforce() , when set velocity. if have amount of drag, gravity or other force influencing physicsbody's velocity between when set velocity , when apply force, there'll slight difference in outcome because applying force object velocity additive. so each time box slows down little bit more or less before force applied, different result in addition ...

java - Maven project "maven install" error -

[error] failed execute goal on project xserver-api: not resolve dependencies project xgroup:xserver-api:war:1.0.1-snapshot: failed collect dependencies @ xgroup:xserver-lib:jar:1.0.1-snapshot: failed read artifact descriptor xgroup:xserver-lib:jar:1.0.1-snapshot: not find artifact xgroup:xserver:pom:1.0.1-snapshot -> [help 1] who can me solve problem? thank much! blow pom file : don't know has problem: <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <name>xserver api</name> <packaging>war</packaging> <artifactid>xserver-api</artifactid> <parent> <groupid>xgroup</groupid> <artifactid>xserver</artifactid> <version>1.0.1-snapshot</versio...

Prepend a word to all ajax urls by some configuration change in rails app -

i have rails app in have used ajax calls url. want append project name ajax urls. 1 way edit urls. there other simpler way same? to prepend word (let project_name) ajax calls in application write following code in js file: $.ajaxsetup({ beforesend: function(data, settings) { var url = "/project_name"+ settings.url; settings.url = url; } });

angularjs - Using latest version of TypeScript Definition with older JavaScript libraries -

i using older version of angularjs - v1.3. looking out corresponding type-script definition files. will latest type-script definition compatible older library version? https://www.nuget.org/packages/angularjs.typescript.definitelytyped/ its difficult find mappings between angular js type-script definitions file version & angular js library version. can go ahead latest version of typescript definition available. edit: had compare 2 nuget repositories & took version angular.d.ts comment changed // type definitions angular js 1.3+ // type definitions angular js 1.4+ usually can search previous versions' definitions running following command tsd : tsd query angular -v then install specific version want (ex. tsd install angular -v 1.0.0 ). there's problem though. reason there seems 2 other versions of angular available: - angularjs / angular - angularjs / angular-v1.0.0 - angularjs / angular-v1.2.0 for reason, suggest take @ commit histor...

javascript - Get Coordinates of tile in google map api v3 -

in example below maptype overlay https://developers.google.com/maps/documentation/javascript/examples/maptype-overlay i want county names covered under tile, when click tile. tried attaching event overlay object as: var gridoverlay = new coordmaptype(new google.maps.size(256, 256)); map.overlaymaptypes.insertat(0, gridoverlay); google.maps.event.addlistener(gridoverlay, 'click', function(evt) { // tile coords console.log(evt); });

pandas - bar plot with different colors in python -

Image
i have data : import pandas pd import matplotlib.pyplot plt index={'a','b','c','d','e'} d={'typ':[1,2,2,2,1],'value':[10,25,15,17,13]} df=pd.dataframe(d,index=index) i want plot dataframe in horizontal bars different colors reffering column 'typ' you can use color parameter of matplotlib's barh function: import pandas pd import matplotlib.pyplot plt index={'a','b','c','d','e'} d={'typ':[1,2,2,2,1],'value':[10,25,15,17,13]} df=pd.dataframe(d,index=index) # define colors each type colors = {1:'blue', 2:'red'} # plot bars plt.bar(range(len(df)), df['value'], align='center', color=[colors[t] t in df['typ']])

php - How to add a registration form another field Symfony 2.7 in FOSUserBundle -

how add field on registration form ? so: \\src\userbundle\form\type\registrationformtype.php <?php namespace userbundle\form\type; //use symfony\component\form\abstracttype; use symfony\component\form\formbuilderinterface; use fos\userbundle\form\type\registrationformtype basetype; class registrationformtype extends basetype { public function buildform(formbuilderinterface $builder, array $options) { parent::buildform($builder, $options); $builder->add('realname'); } public function getparent() { return 'fos_user_registration'; } public function getname() { return 'app_user_registration'; } } \\src\userbundle\resources\config services: app_user.registration.form.type: class: userbundle\form\type\registrationformtype arguments: [%fos_user.model.user.class%] tags: ...

sql server - SQL TSQL for Workers per Hour -

i have log fingerprint timestamps follows: usr timestamp ------------------------- 1 2015-07-01 08:01:00 2 2015-07-01 08:05:00 3 2015-07-01 08:07:00 1 2015-07-01 10:05:00 3 2015-07-01 11:00:00 1 2015-07-01 12:01:00 2 2015-07-01 13:03:00 2 2015-07-01 14:02:00 1 2015-07-01 16:03:00 2 2015-07-01 18:04:00 and wish output of workers per hour (rounding nearest hour) theoretical output should be: 7:00 0 8:00 3 9:00 3 10:00 2 11:00 1 12:00 2 13:00 1 14:00 2 15:00 2 16:00 1 17:00 1 18:00 0 19:00 0 can think on how approach sql or if no other way, through tsql? edit: timestamps logins , logouts of different users. @ 8am 3 users logged in , same 3 still working @ 9am. 1 of them leaves @ 10am. etc to start can use datepart hours days following , use group user select datepart(hour, getdate()); sql fiddle select convert(varchar(5),datepart(hour, timestamp)) + ':00' time, count(usr) users tbl group datepar...

javascript - XML file to AngularJS Charts App -

i have plunker here shows have far. i'm new angular , having trouble figuring out how exchange current static parameters chart data in xml file i'm uploading. have myapp.service module getting xml file , converting json using x2js library, i'm not sure enter the function of controller. there aren't many helpful resources on web (i've been trying figure out day now). appreciated. here: http://plnkr.co/edit/gdwrc1p40w4rhoehana1?p=preview i didn't use xml, moved json object you're using demonstrate proper use of service , $http module. you'll have model xml data useable json object yourself... in service: return promise: get: function() { return $http.get( 'data.json', { transformresponse: function(data) { return json.parse(data) } } ) } and use in controller: datasource.get().then(function(data) { //this xml data can used $scope.data = data.data $s...

Convert slider to external javascript -

hi have slider on page updates number using javascript. need put javascript out of html external js file. appreciated. sorry if explanation not clear. thanks. <script> function outputupdate(n) { document.queryselector('.names').value = n; } </script> <form name="infonum"> <textarea rows="3" name="output" onclick="this.select()"></textarea><br /> <input type="button" class="button" value="go" onclick="populateform(this.form.names.value)"><br /> <input type=range class=rangeinput name="numnames" min=1 value=1 max=15 step=1 oninput="outputupdate(value)"><br /> <output for=rangeinput class=names>5</output> </form> you need create new file myjsfile.js , paste code (inside tag). external java script files reference follows in html <html> <head> <script type="text/javsc...

java - Cache object without it being a side effect [Play Framework] -

this question in reference play 2.2 java. i have list of items retrieved web service. list required frequently, caching list locally. i have set method client code may call list transparently. method first check cache, falling web service if list not present locally. the issue have in regenerating cached list web service. can't use cache.getorelse method, because requires instance of list, , play.libs.ws returns promise<ws.response> map promise<list> . my current strategy looks following: query cache list, , return result wrapped in promise flatmap promise , returning wrapped list if present, or calling web service adapter, , returning returned promise<list> now, before return promise web service adapter in step 2, register callback on promise add list cache when redeemed. what want know is: there way can add list form web service cache, without being side effect of process? i had tried strategy, mapped returned promise , cached it, , re...

drupal - Drush command terminated abnormally due to an unrecoverable error -

i have centos 6.6 php 5.5.27 , drupal 7.34 php 5.5.27 (cli) (built: jul 10 2015 23:40:40) copyright (c) 1997-2015 php group zend engine v2.5.0, copyright (c) 1998-2015 zend technologies i've tried latest 6,7,8 branches of drush. when type "drush -d -v status" unrecoverable error (the error same on branches of drush): drush bootstrap phase : bootstrap_drupal_full() [0.19 sec, 5.13 mb] [bootstrap] cannot modify header information - headers sent (output started @ [warning] /root/.composer/vendor/drush/drush/includes/output.inc:38) common.inc:698 [0.96 sec, 31.89 МБ] drush command terminated abnormally due unrecoverable error. [1.06 sec, 32.8 МБ] i can't figure out what's wrong. can advise please? thanks in advance. as mentioned in comment, closing ?> tags @ end of custom modules, blank spaces after >...but remove ?> in compliance. a way fix disabl...

hadoop - How can I automate Azure Spark from c#? -

i can create cluster how automate scripts? var clusterinfo = new clustercreateparametersv2 { name = clusterconfig.clustername, ... clustertype = clustertype.spark };` cluster.runscript() ? can sparkcontext? https://azure.microsoft.com/en-us/documentation/articles/hdinsight-apache-spark-use-bi-tools/ today use livy server on hdinsight spark cluster on linux. see documetation here: https://azure.microsoft.com/en-us/documentation/articles/hdinsight-apache-spark-livy-rest-interface/

c# - How to find out EventProperty name? -

my c# application subscribes windows event log messages: var subscriptionquery = new eventlogquery(settings.default.logpath, pathtype.logname, settings.default.logquery); _watcher = new eventlogwatcher(subscriptionquery); _watcher.eventrecordwritten += eventlogeventread; when message occurs eventlogeventread handler reseives system.diagnostics.eventing.reader.eventlogrecord object, containing event data. information includes collection of eventproperty objects. problem is: eventproperty defines value, not name of property. however, when open same event in windows event log viewer, shows properties names. question is: how event propery names? there 2 ways go (that know of), both involve parsing xml. eventrecord has function toxml includes userdata section, containing values block. the other option bit more complicated: create providermetadata , find eventmetadata describes current eventrecord , , parse template member. template member explains how interpre...

profiling - How to search MongoDB-Documents on different nesting levels? -

i'm analyzing system.profile -collection of mongodb-database. i'd find queries have stage collscan oder ixscan . problem is, field stage can occur on several levels ( ... : shortened json): { "op" : "query", "ns" : "spt.coll", "query" : { "user" : "userc" }, "ntoreturn" : 1, ... "millis" : 0, "execstats" : { "stage" : "projection", "nreturned" : 1, ... "transformby" : { "settings.arr" : 1 }, "inputstage" : { "stage" : "fetch", "nreturned" : 1, ... "alreadyhasobj" : 0, "inputstage" : { "stage" : "ixscan", "nreturned" : 1, ... ...

dependency injection - What's the equivalent of the DictionaryAdapterFactory of Windsor in Ninject? -

i'm trying reproduce below configuration of windsor on ninject. know ninject has factory extension it's far away dictionary adapter windsor have. windsorcontainer container = new windsorcontainer(); container.addfacility<castle.facilities.factorysupport.factorysupportfacility>(); container.register( component.for<iapplicationsettings>().usingfactorymethod( () => new dictionaryadapterfactory() .getadapter<iapplicationsettings>(configurationmanager.appsettings))); does know factory extension ninject dictionary adaptation? the factory extension allows provide own iinstanceprovider . can use return values config: class program { static void main(string[] args) { var kernel = new standardkernel(); kernel.bind<iapplicationsettings>().tofactory(() => new appsettingprovider()); var settings = kernel.get<iapplicationsettings>(); console.writeline("one: " + settings.one...

chat - Foreground method is not working in Jellybean in Android -

i have implemented service chat application , concept should online , last seen whatsapp. when implemented online , last seen service app , when checked lollipop lollipop working 100% fine when checked same thing jellybean lollipop not working more. @override protected void onstop() { super.onstop(); if (utils.isappsenttobackground(getapplicationcontext())) { // call web service here // log.e("angel", "in back"); utils.setinbackground(getapplicationcontext(), true); callonlineofflineservice("0"); } } // code resume called @override protected void onresume() { super.onresume(); setrequestedorientation(activityinfo.screen_orientation_portrait); if (utils.isinbackground(getapplicationcontext())) { // log.e("angel", "from back"); utils.setinbackground(getapplicationcontext(), false); ...

javascript - Getting the id of the anchor tag which was clicked -

this list representation of data coming php database.the list fetched using foreach php loop , data inside achor tag populated accordingly. <?php foreach($array $iterate):?> <div class="col-sm-3"> <div class="panel panel-default"> **<a onclick='thefunction();' id="hello" href="#mymodal" style="text-decoration:none;">** <div class="panel-heading"> <img src ="audi_sillhouete.jpg" style="height:100%; width:100%;"> <p id="10" style="position:absolute; top:10%; padding-left:5%; padding-right:15%;"><?php echo $iterate->test_name ?></p> </div> </a> </div> </div> <?php endforeach;?> as can see here, inside anchor tag have href-ed modal box show message whenever user clicks on of link. there button in modal window take user different page. issu...

Convert datetime formate dd/mm/yyyy 12:14 to dd/july/yyyy using javascript -

i want convert date time dd/july/yyyy using javascript. have variable var v = 29/09/2015 12:00 and want convert 29-july-2015 . i assume var in quotes. // note js months 0 based var month = ["january","february","march","april","may","june","july","august","september","october","november","december"]; function conv(str) { var dateparts = str.split(" ")[0].split("/"); return dateparts[0]+"-"+month[dateparts[1]-1]+"-"+dateparts[2]; } alert(conv("29/09/2015 12:00"));

python - SQLAlchemy alembic AmbiguousForeignKeysError for declarative type but not for equivalent non-declarative type -

i have following alembic migration: revision = '535f7a49839' down_revision = '46c675c68f4' alembic import op import sqlalchemy sa sqlalchemy.ext.declarative import declarative_base sqlalchemy.orm import sessionmaker datetime import datetime session = sessionmaker() base = declarative_base() metadata = sa.metadata() # table definition works organisations = sa.table( 'organisations', metadata, sa.column('id', sa.integer, primary_key=true), sa.column('creator_id', sa.integer), sa.column('creator_staff_member_id', sa.integer), ) """ # doesn't... class organisations(base): __tablename__ = 'organisations' id = sa.column(sa.integer, primary_key=true) creator_id = sa.column(sa.integer) creator_staff_member_id = sa.column(sa.integer) """ def upgrade(): bind = op.get_bind() session = session(bind=bind) session._model_changes = {} # if using flask-...

javascript - How to match a document with the value of an object attribute in Mongodb -

i'm trying match document in mongodb: my document model : profile: { languages: [ {"name": "french", "level": 1}, {"name": "english", "level": 2}, {"name": "spanish", "level": 4} ] } what (can) have search result set: lang = ["french", "english"]; objlang = [ {name: "french"}, {name: "english"} ]; what need db.find() documents match @ least 1 of languages, example : profile.languages.name = "french" or profile.languages.name = "english" what mean if have french or english in option set, need users have element of languages array name match 1 of options, no matter level of languages. so, unless i'm wrong, can't db.find({"profile.languages": {$in: [{name: "french"}, {name: "english"}]}); how proceed ? thanks lot. david actually, right: ...

ios - Swift Array Resetting Itself -

i have 2 arrays: pointhistory , datehistory . have nstimer , , when timer runs out, action called. in action appending int pointhistory , , current date string datehistory . here timer action: func timeraction() { let steppervalue = int(stepper.value) employee.numberofpoints = steppervalue networking.saveemployee(employee, completion: { (error) -> void in if error != nil { let alert = uialertcontroller(title: "error", message: "there error updating \(self.employee.name)'s points", preferredstyle: .alert) let alertaction = uialertaction(title: "ok", style: .cancel, handler: nil) alert.addaction(alertaction) self.presentviewcontroller(alert, animated: true, completion: nil) } }) var dateformatter = nsdateformatter() dateformatter.dateformat = "mm-dd-yyyy" dateformatter.timezone = nstimezone.localtimezone() var date = nsdate() var ...