Posts

Showing posts from January, 2012

powershell - Can't output any information about a new user created within script -

i have script create , add user groups in active directory. if tell script create active directory user named 'john smith' using new-aduser cmdlet, can't use get-aduser cmdlet pull information 'john smith' until after script has finished executing. in case, script output 'john smith' created before script terminates show successful creation of user. by default new-aduser doesn't return information created account. can change using parameter -passthru . $user = new-aduser ... -passthru if need information if account created: use automatic variable $? check if cmdlet ran or not. new-aduser ... if ($?) { 'account created.' } else { 'account creation failed.' }

wpf - Dynamic Resources and Merged Dictionaries levels -

i have following configuration of resource dictionaries: colorsdic.xaml contains <color x:key="mycolor">#ff39adfb</color> <solidcolorbrush x:key="genericbackcolor" color="{dynamicresource mycolor}"/> <solidcolorbrush x:key="controldark" color="{dynamicresource mycolor}"/> <solidcolorbrush x:key="controllight" color="{dynamicresource mycolor}" opacity="0.3"/> maindic.xaml contains <resourcedictionary.mergeddictionaries > <resourcedictionary source="./recursos/colorsdic.xaml"/> </resourcedictionary.mergeddictionaries > <style x:key="mybuttonstyle" targettype="{x:type button}" > <setter property="background" value="{staticresource genericbackcolor}"></setter> <setter property="foreground" value="{binding path=background,relativesource={relativesource self

css3 - Desing Border css Left Bottom css Code -

Image
i wondering if possible create shape using css. (or svg?) feed dynamicly created news feeds need scroll inside contianer. i got stuck after create container scrolling: .container { width: 300px; height: 500px; background-color: blue; border-radius: 15px; overflow-x: scroll; } .container { display: inline-block; width: 100%; height: 60px; border-bottom: 5px solid rgba(255, 255, 255, 0.5); } .container .icon { display: inline-block; width: 50px; height: 100%; text-indent: 25px; color: white; font-weight: bold; line-height: 50px; } <div class="container"> <a><div class="icon">f</div>text goes in here</a> <a><div class="icon">f</div>text goes in here</a> <a><div class="icon">f</div>text goes in here</a> <a><div class="icon">f</div>text goes in here</a> &l

android - Error when releasing APK with AsyncTask and Jsoup -

i'm getting error: 03-04 09:55:55.915: w/dalvikvm(20171): exception ljava/lang/nullpointerexception; thrown while initializing la/a/b/k; 03-04 09:55:55.915: w/dalvikvm(20171): exception ljava/lang/exceptionininitializererror; thrown while initializing la/a/b/l; 03-04 09:55:55.925: w/dalvikvm(20171): threadid=13: thread exiting uncaught exception (group=0x40ab3300) 03-04 09:55:55.945: e/androidruntime(20171): fatal exception: asynctask #1 03-04 09:55:55.945: e/androidruntime(20171): java.lang.runtimeexception: error occured while executing doinbackground() 03-04 09:55:55.945: e/androidruntime(20171): @ android.os.asynctask$3.done(asynctask.java:299) 03-04 09:55:55.945: e/androidruntime(20171): @ java.util.concurrent.futuretask$sync.innersetexception(futuretask.java:273) 03-04 09:55:55.945: e/androidruntime(20171): @ java.util.concurrent.futuretask.setexception(futuretask.java:124) 03-04 09:55:55.945: e/androidruntime(20171): @ java.util.concurrent.futuretask$sync.i

Java REST jersey produces URL -

Image
i have method return java.net.url , can´t find right mediatype @produces annotation. possible produce url mediatype? my code: @get @produces(mediatype.text_html) //mediatype don´t know @path("terms.html") public url getterms(){ iterator<string> it=definitions.keyset().iterator(); url url,url1=null; try { url = new url("http://localhost:8080/dictionary/definitions/"); url1 = new url(url,it.next()+".html"); } catch (malformedurlexception e) { e.printstacktrace(); } return url1; } what want in rest service that: as far know, there's no content type urls. you can assume url returning piece of plain text , use mediatype.text_plain : @get @path("terms.html") @produces(mediatype.text_plain) public url getterms() { ... } if need, can return html document (using mediatype.text_html ) containing <a> element , referencing url want return.

.net - Retrieve key values of an entity -

for change logging function, need retrieve primary key value of entity. written audit table table name, , changed property names , old , new values. i reflect type of particular entity , [key] property. work in case because use code-first, attributes, , single-column keys. i'm not sure runtime performance of (uncached) reflection use. is there more robust , "official" way value of primary key entity known ef? please stay latest ef version (6.1.3). cannot use solutions ef 4/5 access deprecated or removed functionality. code sample: class myentity1 { [key] public guid keycolumn { get; set; } // ... } class myentity2 { [key] public string entityid { get; set; } // ... } class mycontext : dbcontext { public dbset<myentity1> entities1 { get; set; } public dbset<myentity2> entities2 { get; set; } public object getentitykey(object entity) { return ???(entity); // expected: value of property [ke

Azure api app action being called multiple times -

i have created logical app has 1 trigger , 2 actions. 1 action fetches data database , passes data second. when there lot of records fetched database second app takes time insert data , action being called multiple times. there timeout needs set somewhere. give out more details such codes can understand 'trigger' , 'action'. think it's better fetch records out 1st db , pass them 2nd db @ 1 time. if that, maybe 'action' triggered once.

java - A "Nice" way to get substring between an opening and a matching closing tag (parantheses etc.) -

i quite run task of extracting substring string located between opening tag (such "(") , closing tag (for example ")"), such "level" of opening tag matches "level" of closing tag . for example, in following string, ((a + (b * c) + d) + e) when given index 1 (pointing second opening tag "(" in string), interested in substring (a + (b * c) + d) i'm not interested in part until first closing tag: (a + (b * c) in addition one-character tags, longer strings (e.g., "begin", "end") should work, too. not hard solve this, find running through string in loop quite ugly, possibly inefficient , error-prone. is there nice way this? (maybe there regex hack? won't work directly due need of counting.) i've had similar this, using < , > instead. the best way in opinion iterate string, , keep stack of 'open' , 'close' tags go along. when hit point number of open , c

java - I need to make a program that ends input and calculates the total length of the line when I press -

could please explain how make input end when press . without having press enter , calculate length without advanced stuff since beginner. class userinput//defines class {//class begins public static void main (string[] args) throws ioexception {//main method begins bufferedreader bf = new bufferedreader(newinputstreamreader(system.in)); //tells user program system.out.println("this program give total number of inputed characters."); // tells user how end program system.out.println("to obtain final number of characters, enter ."); system.out.println(""); //tells user type in characters system.out.println("enter characters want:"); string input = bf.readline(); //reads user input , initializes input //initialize , declares variables int length = 0; length = length + anything.length(); //outputs total number of charac

immutability - Why do I have the feeling my F# code could be more concise -

i'm experienced c# developer trying teach myself f#. spent day or 3 reading throught f# wikibook trying know syntax , f# fundamentals. as exercise i'm trying go through project euler problems better feeling of syntax , working language. i've solved problem 5 . i'm not happy hoops had jump through data structure represents solution. i've used this blogpost algorithm solving problem. i wondering if give me pointers how code improved? guess inherent immutability of f# values causing me have perform lot of steps exact data want... this code: let main argv = //calculates prime factors of number let findprimefactors x = let primes = [|2i;3i;5i;7i;11i;13i;17i;19i|] let rec loop acc counter = function | x when x = 1i -> failwith "a prime definition greater 1" | x when primes |> array.contains x -> x :: acc | x when counter = primes.length -> failwith "my list of known primes not big enough"

c# - Select data from table1 and copy it to table2 -

i real novice in c#. i have seen many questions on here. but, on trying, not code. i want columns of row retrieved , transfer table of same database. so basically, retrieve data table1 , copy respective columns of table2 . i have tried code. , confused how call directly check string instead of defining each column in str1 string in " ". string check = "select * custdetails billid = @billid "; sqlcommand cmd1 = new sqlcommand(check , conn); cmd1.parameters.addwithvalue("@billid", billid); dataset ds = new dataset(); sqldataadapter da = new sqldataadapter(cmd1); da.fill(ds); // string str1; int count = ds.tables[0].rows.count; if (count > 0) { string str1 = ds.tables[0].rows[0][""].tostring(); } i dont have idea c#. help. you can using : insert table2 (select * table1 billid = @billid) the above gud when table1 & tab

Map pollution data as a HeatMap? -

i have route (or: list of points) associated weighted pollution value between 0 , 10. want map these points google maps. the first thing came head use google maps heatmaplayer , weightedlocations . weights use pollution values , google maps rest me. however, solution raises 1 issue: displayed heat (green-to-red color) depend on density of points. if 2 points close (and can case data), heat increase, irrespective of weight. is there better solution create such pollution map google maps not take account density of points, takes account weight?

windows - Wix: Install MSMQ component -

i have .net project has 2 components communicate on msmq. i'm building installer using wix because microsoft has inexplicably ceased support installers in visual studio 2012. i'm quite happy process of creating instance of msmq in wix installer, , i'm quite happy process of detecting whether msmq installed on computer (by trying load mqrt.dll). does know how use wix install msmq windows system component itself? there way wix instruct windows install system component? it took long time, found elegant way this. 1) in visual studio create new wix c# custom action project 2) paste following on customaction.cs file: using system; using system.collections.generic; using system.linq; using system.text; using microsoft.deployment.windowsinstaller; using system.runtime.interopservices; using system.diagnostics; using system.io; namespace installmsmq { public class customactions { [customaction] public static actionresult customaction1

javascript - loading images from e folder and display them in html -

hi guys using following code trying read images folder , display them in html file. problem how can see /images/ folder in /fetch/ folder. when images displayed loaded /fetch/frame_1.jpg instead /fetch/images/frame_1.jpg in case display them have use twice images set. 1 in image folder , 1 in fetch folder. can explain me why this? <body> <script type="text/javascript"> var dir = "/fetch/images/"; var fileextension = ".jpg"; $.ajax({ url: dir, success: function (data) { $(data).find("a:contains(" + fileextension + ")").each(function () { var filename = this.href.replace(window.location.host, "").replace("http://", ""); $("body").append("<img src='"+ filename + "'>"); console.log(fil

bash - How to use chmod to change the permissions of a file, with a variable -

i'm trying change permission of file, , have path of file stored in array. chmod 744 ${arrayoffiles[1]} the 1 placeholder, in reality i within loop. whenever run command error: chmod: missing operand after ‘744’ and i'm not sure why. have checked ${arrayoffiles[1]} contains full path , does. i'm not sure why isn't working. thanks in advance. edit: local i=0 filepermission="-rwxr--r--" directorypermission="-rwxr-xr-x" (( i=0; i<=${#arrayoffilepermissions[@]}; i++)) if [ "${arrayoffilepermissions[$i]}" != "$filepermission" ]; echo "file ${arrayoffiles[$i]} has wrong permission: ${arrayoffilepermissions[$i]}" echo ${arrayoffiles[$i]} chmod 744 ${arrayoffiles[$i]} echo "this has been changed to: $filepermission" fi done the array arrayoffiles contain file names, , arrayofpermissions contain permissions. trying make permission rwxr--r-- . the if st

javascript - Why jQuery intermittently fails to detect click? -

why jquery detect click , not? i have #options element when clicked #dropdown-menu shown. when user clicks anywhere outside #dropdown-menu (except on #options element) dropdown hidden. here code of time works , doesn't: jquery( document ).ready( function() { jquery('#options').click( function(){ jquery('#dropdown-menu').slidedown(); }); jquery(document).click( function(event) { if( !jquery(event.target).closest('#dropdown-menu').length && !jquery(event.target).is('#options') ) { if(jquery('#dropdown-menu').is(":visible")) { jquery('#dropdown-menu').hide(); } } }); }); i can't figure out why works intermittently. hard accept code works sometimes. noticed event.target comes empty string somtimes... bug jquery? edited: here fiddle , error can't reproduced. ok, figured out solution problem. warning: si

javascript - Google Maps generates blank grey <div> -

i trying generate several google map elements on single page inside jquery each() function. there several .new-venue-item elements on page, , this: <div class="new-venue-item"> <div class="image"> <div class="image"> <a href="/venue/8121_the-square-bristol-city-of-bristol" title="discover more square"><img src="http://static.weddingvenues.com/venues/200x300/wedding-image-with-logo-rectangular.jpg" class="" width="200" height="300" alt="" title="" item-prop=""></a> </div> <div id="map8121" class="map" data-lng="-2.6101986" data-lat="51.4590031"> </div> <div class="overlay"> <a href="#" class="action-btn btn-wv contact-venue trackit" data-click-type="search-contact" data-

c# - Generation 1 Heap Consuming Gigs of Memory as Free Space -

Image
we've had long term issue 1 of our products consuming gbs of memory when in production. low memory warnings on server, , today had chance sit down memory profiler , see memory going. in development, same database , config, application's private working set 450mb. on production server, amount of memory allocated process 3.7gb. using ants memory profiler, determined 2.906gb of memory being allocated generation 1 heap: this amount of memory utilised on application start load lot of data database generate caches. however, gets cleaned up, can see fact of data in graph above allocated, not used. here's complete overview: as can see, loh pretty empty , not fragmented. know loh doesn't compacted, unless set compactonce applicable gcsettings enum. under impression generation 0-2 heaps compacted , should free space released? or clr assume because memory consumed once, application should keep addressing memory in case needs again? to me, our app should consuming 6

Need help in updating table based on the values from another table using ORACLE SQL -

table (id,amt), table b (id, qty) i need multiply a.amt b.qty , update values on table a. id cols equal in , b. query have created: update set a.amt = (select a.amt * b.qty b join on a.id=b.id) exists (select a.amt * b.qty b join on a.id=b.id) on execution returns error: single-row subquery returns more 1 row. could me out on this. for starters, re-using same table names without aliases on , on again hard through. may causing confusion. i'll try break down. start existing statement: update set a.amt = (select a.amt * b.qty b join on a.id=b.id) you setting a.amount = calculation on every matching a/b pair because not ensuring query related id of row updating! error coming from. instead: update a1 set a1.amt = (select a2.amt * b.qty tot_amt b join a2 on

html - Using AngularJS 1.2.16, unique issue with data escaping for href links -

Image
having issues ng-href can use target="_blank" using angularjs 1.2 ,old post found going on leading me question,i have page has table inside accordian, in js file have angular functions , have this: var capitalrequestmultimillinquirycontroller = function ($scope, $rootscope, $modal, $window, capitalrequestservice, plantservice) { $rootscope.title = 'capital request multi mill inquiry'; $scope.allmills = []; $scope.selectedmill = ''; $scope.jobnumber = ''; $scope.description = ''; $scope.amount = ''; $scope.amountoperator = ''; $scope.openonly = ''; $scope.projectmanager = ''; //$scope.allusers = []; //usersservice.getuserswithid().then(function(objecttypes) { // $scope.allusers = objecttypes //}); //$scope.openurl = function() { // $scope.openurl = function(url) { // $location.path(url, '_blank') // } //} plantservice.getplantid().then(function (mills) { $scope.allmills = mi

php - Inventory with multi - unit support feature -

i have been developing inventory system (php codeigniter & mysql), have setup except 1 feature 1 of clients wants implement system - multi - unit support feature system. currently system supports single unit per item per transaction: item_desc: item1 default_unit: pc reorder: 1 in_stock: 25 remain: 25 in multi - unit feature, become: item_desc: item1 default_unit: pc big_unit: pack pack_size: 50 reorder: 1 in_stock: 25 pack remain: 24 pack 5 pc can give me hint on easy way implement this? want know start on thing. appreciate if share idea regarding on 1 :) we launched v2 of our website , i've gone through 8 months of kinds of questions myself. best way separate tables products, inventory , listings. products holds product specific information only, things never change. inventory holds information current inventory only, ie quantity on hand, backorder, location in warehouse etc. listings how handle multi item support. table hold listing information , dra

angularjs - How to add all possible attributes (including other directives) in my directive? -

i'm trying create directive so: mytemplate.html: <div class="mywidget"> <input type="text" class="someclass blah blah" ng-model="mymodel" ng-change="mychange" /> </div> mydirective: (function () { 'use strict'; angular .module('myapp.mywidgets.somewidget') .directive('somewidget', somewidget); somewidget.$inject = ['$timeout']; function somewidget($timeout) { return { restrict: 'ea', templateurl: 'mytemplate.html', link: link, require: 'ngmodel', scope: { mymodel: '=ngmodel', mychange: '&ngchange', // add other possible attributes here. dont think that's practical. } }; function link(scope, elm, attr) { } } })(); usage: <som

php - API Throttle in Laravel 5.2 -

i seeing this tutorial throttle in laravel 5.2 it seems throttle used apis, why couldn't used other controller stuff, avoid people send 100 times same form through postman. i tell that, because in kernel.php, now, middleware divided between web , apis: kernel.php:laravel 5.2 you can apply web pages well. judging comments, you're confused new features of middleware, middleware groups . 5.2 brought along way group middleware route groups before. in 5.1 like: route::group(['prefix' => 'api', 'middleware'=>'auth,custom_middleware,permission:edit_permissions'], function() { route::post('permissions/{id}/store', ['uses'=>'permissioncontroller@store']); }); that still valid, if wanted add route group same middleware, had either juggle organization nested beneath single route group applied middleware or had copy paste middleware, neither desirable. 5.2, have this: kernel.php protected $midd

python - How to structure code to be able to launch tasks that can kill/replace each other -

i have python program following: 1) endlessly wait on com port command character 2) on character reception, launch new thread execute particular piece of code what need if new command received is: 1) kill previous thread 2) launch new one i read here , there doing not right way proceed. best way knowing need in same process guess need use threads ... i suggest 2 differente approaches: if processes both called internally function, set timeout on first function. if running external script , might want kill process .

php - Nusoap set and get headers in both client and server side -

i developing simple web service using nusoap , having problem when adding authentication. currently using setcredentials() method attach username , password request , getting them using $_server['php_auth_user'] in server side. it works fine, don't want authenticate user every call. need maintain session , according research, after first authentication, server needs send 'session id' attached response header , client should use 'session id' in subsequent calls. but don't know how set , headers in both request , response. help? i'm new soap , session, if there wrong thoughts, please point out. thank much. finally, figured out myself. used simple implementation , insecure, may beginners me. first, observing nusoap code find easy set , soap headers both in client , server. client: $client->getheader(); //return array containing header elements $client->setheaders('headerstring'); server: $se

ubuntu - Vagrant config terminology -

tl;dr; can me understand difference between these "names" defined in vagrantfile? config.vm.define "worker" box.vm.box = "ots-box" box.vm.host_name = "worker" vb.name = "barhost" while trying change hostname of vagrant instance had, lost in vagrantfile syntax. have changed hostname other things (network) isn't working. suspect i've changed has lead vagrant configure box particular way, caused issue. vagrant.configure("2") |config| config.vm.define "worker".to_sym |box| box.vm.box = "ots-box" box.vm.box_url = "http://testing.xxx.com.s3.amazonaws.com/ots-fe.box" box.vm.host_name = "worker" end i suppose it's irrelevant i'm trying create ubuntu box on mac el-capitan oracle virtualbox , vagrant version 1.7.4. documentation says: config.vm.box - configures box machine brought against. value here should name of installed box or shorthand na

php - Wordpress page has an index template -

i created pages templates in wordpress , these don't work. i create pages in wp-admin/post-new.php?post_type=page new template(i selected template @ 'template') , when access every page template index.php/home template.. custom template not showing... can me? thank !

c# - EF Code First Migrations creating extra foreign key -

i'm trying create profile table integrate asp.net identity table: aspnetusers . i'm using code first migrations ef 6.0. here user class: public class applicationuser : identityuser { public applicationuser() { } public virtual string firstname { get; set; } public virtual string lastname { get; set; } public userstatus status { get; set; } public virtual profile profile { get; set; } } here profile class: public class profile { public int id { get; set; } public string applicationuserid { get; set; } public virtual applicationuser applicationuser { get; set; } } i have configuration in datacontext: modelbuilder.entity<profile>() .hasrequired<applicationuser>(m => m.applicationuser); the weird thing when run migration creates applicationuserid , applicationuser_id in database when want create applicationuserid , use foreign key colu

SensorManager.getRotationMatrix always return false on Android Emulator -

i try orientation on android emulator sensormanager.getorientation . before use sensormanager.getrotationmatrix rotation matrix, return false . here code of activity: public class mainactivity extends activity implements surfaceholder.callback, view.onclicklistener{ public final static string debug_tag = "mainactivity"; private sensormanager sensormanager; private surfaceview preview; private float[] mgravs; private float[] mgeomags; private float[] mrotationm; private float[] morientation; private sensor maccelerometer; private sensor mmagneticfield; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().addflags(windowmanager.layoutparams.flag_fullscreen); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.activity_main); preview = (surfaceview)findviewbyid(r.id.surfaceview1); sensormanager = (sensormanager)getsystemservice(sensor_service); maccelerometer

Error activating IProductRepository, ninject issue learning With Apress Pro ASP.NET MVC 5 -

hello i'm reading book "apress pro asp.net mvc 5" have downloaded chapter 7, running application using ninject. first issue 1st issue snagit read ninject issue versión solved adding code sportsstorewebui web.config: enter code here <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="1.0.0.0-5.0.0.0" newversion="5.0.0.0" /> </dependentassembly> </assemblybinding> </runtime> now when try run app issue. error activating iproductrepository no matching bindings available, , type not self-bindable. activation path: 1) injection of dependency iproductrepository parameter productrepository of constructor of type productcontroller 2) request productcontroller suggestions: 1) ensure

java - How to make Glassfish 4.0 WebService use TLSv1.1 or TLSv1.2 -

good day, everyone, have jax-ws (metro) web service running on glassfish 4.0 receives inbound https messages. has been running great (over tlsv1.0), vendor sending messages wants require sent on tlsv1.1 or tlsv1.2. gf4.0 uses jdk7 default supports tlsv1.2 disabled default. how turn on web service can still receive messages?? can in pojo client (outbound), having issues configuring server same (inbound). i have tried going gf admin console\configurations\server-config\jvm settings , adding jvm option -dhttps.protocols=tlsv1.2 seems have no affect... thanks in advance! :) tls 1.2 should enabled default. can disable tls , tls1.1 using following asadmin commands asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.tls-enabled=false asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.tls11-enabled=false if have other https listeners configured other default replace http-listener-

node.js - socket.io not sending to room using socket.to('myroom').emit -

i using socket.io 1.4.0. i trying send message put client in room called 'myroom', send message room client , response room. no response using socket.to('myroom').emit('message', 'what going on, party people?'); here client code: socket.on('connect', function() { // connected, join booking room receive messages room socket.emit('room', 'myroom'); }); socket.on('message', function(msg){ console.log('message: ' + msg); }); socket.emit('booking room message', {roomid: 'myroom', message: 'hello'}); here server code: // set socket.io server var io = require("socket.io")(server) .use(function(socket, next) { // wrap express middleware sessionmiddleware(socket.request, {}, next); }) .on("connection", function(socket) { console.log(socket.request.session); if (socket.request.session.passport)

phpmyadmin/MySQL Time-Event -

i have question relating phpmyadmin respectively mysql in common. wanted ask if there kind of "time event", performs command/operation if specific time reached. example can imagine table 2 columns 'status' , 'date_expiry'. want changing 'status' value 0 1 when current date reaches date given in 'date_expiry' column. hope understand mean. thankful kind of , information. mysql offers event scheduler ( https://dev.mysql.com/doc/refman/5.7/en/event-scheduler.html ) , phpmyadmin offers interface manage (via events menu). so schedule event runs, say, once per day , verifications want.

javascript - Converting a simple function from jS to PHP -

i have simple function hash function in js i'm struggeling converting php (for server side validation), simple math function, , i'm not php expert, of shed light why can't have ($variable)(function) in php next each other? here function in js: function claculate(a,b){ var g=function(a){ return math.round(a/math.pow(10,math.round(math.log10e*math.log(a)))*10) }; var f=function(a){ var h=function(b){ return b(a) }; var j=function(b){ return g(a) }; return a<b?j:h }; var o=((f(a)(g)%2)||(f(a*b)(g)%7*1/7)||11)^f(b)(g); return another_function(a,o); } and here version in php, there error on $o line, , i'm not sure why ... function claculate($a, $b){ $g = function ($r){ return round($r / pow(10, round(m_log10e * log($r))) * 10); }; $f = function ($a) use (&$a, &$b, &$g) { $h = function ($b) use (&$b, &$a) { r

Validating Empty Squares TicTacToe - Javascript only -

first thank individuals helped me question before. ones decided close post without trying first assist me, please refrain closing post if not deciding , calling issue broad. also, i'm not looking of time "optimize" code or corrections how expatiate summary below. now, real issue... i'm trying hand @ building tic-tac-toe game plain vanilla javascript, i'm hoping can stay in boundaries of keeping simple javascript. not optimize code! what require following: need code check each square see if it's filled x or o. if squares still available, no need alert if squares filled, need alert me "no more moves!" i have started function checkempty thank assistance , time! here code have got far: <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>tic tac toe</title> <style> td { border: 1px solid black; height: 250px; width: 250p

javascript - D3: change line stroke color by hovering over legend -

i'm sure it's easy solution. can't find out. i've checked other similar q&a don't fit problem. want highlight line in multiline chart when pass mouse on corresponding legend. mistake not selecting propperly lines. thought had use "path", but... tried other, don't work. here attach pic of code: 1 thanks in advance! sorry guys, fist time making question in stackoverflow. here attach code. mike bostock’s example: http://bl.ocks.org/mbostock/3884955 // margins ------------------------------------------------ var margin = {top: 20, right: 80, bottom: 30, left: 50}, width = 960 - margin.left - margin.right, height = 500 - margin.top - margin.bottom; var parsedate = d3.time.format("%y%m%d").parse; // scales ------------------------------------------------ var x = d3.scale.linear() .range([0, width]); var y = d3.scale.linear() .range([height, 0]); var color = d3.scale.category10(

java - Simplest way to retrieve an int from a mongo result? -

i'm pulling int mongo cursor object so: dbobject mapobj = cursor.next(); int autostart = (int) (double) (double) mapobj.get("autostart"); it seems strange have triple cast integer, there better way? i think looking this: dbobject mapobj = cursor.next(); int autostart = ((number) mapobj.get("autostart")).intvalue(); no conversion string , safe if value gets converted double or long (with potential loss of precision) original integer value. double, long , integer extend number. hth rob

xamarin - how to build pkg for mac console app with mkbundle --static flag -

i have written console mac utility using xamarin studio. created bundle using: mkbundle myapp.exe *.dll -o myapp --deps pkgbuild --analyze --root release name.plist pkgbuild --root release --component-list name.plist --sign "john doe" --install_location /applications/myapp myapp.pkg when installing myapp.pkg on machine , attempting run app, there runtime error "libmonoboehm-2.0.1.dylib' referenced myapp - image not found'. that indicate machine did not have mono runtime installed. , correct, not have mono runtime installed. i tried run mkbundle '--static' option. however, pkgbuild --analyze returns empty component list. my question how build deployment pkg when using mkbundle --static flag? possible? thanks in advance this can not done. mono framework large , toolset not allow functionality. can not create package pkgbuild without dependency list. i solved problem telling user download monolithic mono framework.

python - How to make a Sympy lambdify(ed) function accept array input? -

i’m trying create function in python 2.7 accepts function handle , number of variables in function input , returns new function calculates gradient of input function. have far. import sympy sym import numpy np def getsymbolicgradient(func,numvars): # initialize variables g = numvars * [0] # create symbolic variables x = sym.symarray('x',numvars) # calculate gradients in range(numvars): g[i] = sym.diff(func(x),x[i]) gradfunc = sym.lambdify(x, g, modules="numpy") return gradfunc say use gradfunc following code: def myvecfunc(x): return 2*x[0]**2 + 4*x[1] + 2 gradfunc = getsymbolicgradient(func=myvecfunc, numvars=2) if call using 2 separate arguments works, such following: print( gradfunc(1,2) ) however, if call using single argument (say numpy array), print( gradfunc(np.array([1,2])) ) i following error: typeerror: () takes 2 arguments (1 given) how can lambdify accept input arguments singl