Posts

Showing posts from February, 2010

java - AOT compiling with jRuby to obfuscate Rails code -

we have ror application running in windows server 2012 r2, using iis, jruby, , puma in clients network. production application runs great! problem now, need protect source code in manner through obfuscation. initial thought compile .rb files .class files jruby digest instead of .rb files. tried single file see if work. navigated myapp/app/controllers and... jruby -s jrubyc application_controller.rb that created compiled class file application_controller.class in directory. tried methods mentioned @ link older version of jruby see if work - https://github.com/jruby/jruby/wiki/railsaot but none of them did, either giving me uninitialized constant applicationcontroller, or unable load file application_controller. i tried instructions https://www.ruby-forum.com/topic/216572#939791 given lack of java knowledge, im pretty sure not have correct. last state of application_controller.rb - require 'java' $classpath << 'lib' java_import 'application_contr

mongodb - Can't connect to secondary members in a replica Set -

i've created mongodb replica set 3 members. synchronized, if try connect secondary members via robomongo , via webapp not work. error slaveok set false, i've set rs.slaveok() each member of replica set. if connect via shell not error , can list everything. if secondary member becomes primary can read via robomongo. mongodb shell version: 2.6.10 here rs.status() rs:primary> rs.status() { "set" : "gmrrs", "date" : isodate("2015-06-25t16:14:53z"), "mystate" : 1, "members" : [ { "_id" : 0, "name" : "****", "health" : 1, "state" : 1, "statestr" : "primary", "uptime" : 2014, "optime" : timestamp(1435246594, 1208), "optimedate" : isodate("2015-06-25t15:36:34z"), "elect

matrix - Removing the levels attribute in the output - R -

i new r programming. wrote sample program , returns value of particular column in matrix. when print value this [1] apple 2 levels : 1 2 how value without levels in output. thanks in advance. just expand on a5c1d2h2i1m1n2o1r2t1's comment, following command prints variable apple without levels stuff: as.character(apple) to on command within r type: ?as.character here online r entry command: https://stat.ethz.ch/r-manual/r-devel/library/base/html/character.html

asp.net mvc - Update hierarchy model in Entity Framework -

i have 2 model classes: request: public partial class request { public long id { get; set; } public string username { get; set; } public string description { get; set; } public system.datetime createdate { get; set; } public long deviceid { get; set; } public bool isfinalized { get; set; } public nullable<long> parentid { get; set; } public virtual device device { get; set; } } device: public partial class device { public device() { this.requests = new list<request>(); } public long id { get; set; } public string serial { get; set; } public string assetnumber { get; set; } public system.datetime createddate { get; set; } public virtual icollection<request> requests { get; set; } } i have update models use method public void update(requestviewmodel viewmodel) { var entity = _mappingengine.map<request>(viewmodel); _requests.attach(entity); _uow.

linux - How can I configure a systemd service to restart periodically? -

i have simple systemd service needs periodically restarted keep process bugging out. there configuration option systemd services periodically restart them? of restart* options seem pertain restarting service when exits. yes, can make service restart periodically making service of type=notify . add option in [service] section of service file along restart=always , give watchdogsec=xx , xx time period in second want restart service. here process killed systemd after xx time period , restarted systemd again. eg. [unit] . . [service] type=notify . . watchdogsec=10 restart=always . . [install] wantedby= ....

JavaScript object literal. Why can't I refer to a method via "this"? -

this question has answer here: how access correct `this` inside callback? 5 answers why can't refer method of javscript object using "this"? example in open(); method - why can't call this.init(); ? var mymodule = { //initialize dek. append html structure body init: function() { if (!$('.mwdek').length) { var dek = $(tpl); dek.find('.d-nav-close').on('click', function(e) {e.stoppropagation();e.preventdefault(); this.destroy(); }); dek.appendto('body'); } //var dek = $('.mwdek'); }, //opens deck, makes visible open: function() { if (!$('.mwdek').length) { this.init(); } $('.mwdek

Configuring NServicebus 4.7 with a predefined Autofac container -

i'm bit @ loss here. i'm developing hosted nservicebus (v4.7) windows service , using autofac (v3.5) own type resolution. given nservicebus documentation thought possible add own container in nservicebus's endpoint configuration. no matter do, can't work. current endpointconfig following: using system; using system.configuration; using system.io; using system.linq; using system.reflection; using autofac; using hyflo.base; using nservicebus; using nservicebus.objectbuilder.autofac; using nservicebus.objectbuilder.common.config; namespace hyflo.service { /// <summary> /// endpointconfig /// </summary> public class endpointconfig : iconfigurethisendpoint, ineedinitialization, asa_publisher { public void init() { tracewriter.info("scannning hyflo assemblies .. "); var hyfloassemblies = directory.getfiles(directory.getcurrentdirectory(), "hyflo.*.dll",

swift - Is it possible to change an associated value within an enum? -

i'm playing around swift enums , wondering if there way change assoicated value of enum such code below attempts fails. enum myenum { case somecase(int?) mutating func somefunc() { switch self { case .somecase(let a): if != nil { // = 5 can't of course assigning let var temp = a!; // generates warning temp = 5; } } } } if isn't possible, when mutating enums come xcode? rob napier's answer fine have different understanding of question. have written instead: enum myenum { case somecase(int?) mutating func somefunc() { switch self { case .somecase(.some(_)): self = .somecase(5) default: // or case .somecase(.none): if prefer break } } } with code, enum mutated somefunc if , if associated value not nil . thus, have following results while testing in playground (res

graph - How to compute the average(or sum) of node values in a network? -

consider network(graph) of n nodes , each of them holding value, how design program/algorithm (for each node) allows each node compute average(or sum) of node values in network? assumptions are: direct communication between nodes constrained graph topology, not complete graph. other assumptions, if necessary algorithm, allowable. weakest 1 assume there's loop in graph contains nodes. n finite. n suffiently large such can't store values , compute average (or sum). same reason, can't "remember" value you've received (thus can't redistributing values you've received , add you've not seen buffer , result). (the tags may not right since don't know field kind of problems in, if it's kind of general problem.) that interesting question, here assumptions i've made, before present partial solution: the graph connected (in case of directed graph, connected) the nodes communicate direct neighbours it possible hold , send

javascript - Invalid "ng-model" value with Bootstrap UI datepicker -

i'm trying implement simple datepicker directive in angularjs application. following ui bootstrap documentation error every time: datepicker directive: "ng-model" value must date object, number of milliseconds since 01.01.1970 or string representing rfc2822 or iso 8601 date. i have found few other related issues here , here , neither of them helpful. i tried accessing $parent , $parent.$parent suggested here , rid of error, doesn't update model. here plunker recreating problem: http://plnkr.co/edit/caugqznh77sbknmgtfil?p=preview <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.min.js"></script> <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.13.0.js"></script> </head> <body ng-app="myapp" ng-controller="appcontrol appctrl"> <label>{{dt | date:&

java - Check If String Input Is Not Equal To An Array of Strings -

my current issue checking how create condition output invalid input when user's input not equal of strings in defined array, , continuously ask new input until valid option. code: public class gamemenu { static string choice; int useroption = 0; public void printmainmenu() { [...] /* other code prints out menu */ checkifguesscomputernumberischosen(); } private void checkifguesscomputernumberischosen() { scanner menuinput = createnewscanner(); choice = menuinput.nextline(); /* code goes through array of valid input */ for(; useroption < validguesscomputernumberoptions().length; useroption++) checkifchoiceequalsvalidoption(); } private void checkifchoiceequalsvalidoption() { if(choice.tolowercase().equals(validguesscomputernumberoptions()[useroption])) { playgame()

knockout.js - Error when trying to reset knockout observable -

in searching interwebs following code part of view model should work fine: function myviewmodel() { var self = this; self.name = ko.observable(); self.displayname = ko.observable(); self.description = ko.observable(); self.save = function () { $.post('/my/mvccontroler', { name: self.name(), displayname: self.displayname(), description: self.description() }, function success(data) { self.name(null); self.displayname(null); self.description(null); $('#mydialog').modal('hide'); }); } } however getting error uncaught typeerror: string not function @ name: self.name() . the end goal reset view model on form submission. prefer call ko.applybindings once best practice. edit: after great answer realized this.name being created string somewhere other code. changing variable name resolved issue. you must resetting self.name somewhere else in code. mentioned you've

php - Curl Installation -

i post question , 1 informed me user curl function. dig in detail , got confuse. have install curl , can use curl function pass value ? post_to_url("https://www.msgapp.com/restpostform.aspx", $data); $data= array( "customer"=> "ch", "cke"=>"1", "ownerid"=> "6", "overwrite"=>"0", "triggerid"=> "1950", "pushexternal"=> "1", "city"=> "london", "firstname"=>"test", "lastname"=>"user", "email"=> "jibran@abc.com" ); function post_to_url($url, $data) { $fields = ''; foreach($data $key => $value) { $fields .= $key . '=' . $value . '

Ruby on Rails 4 - structuring database with nested attributes -

Image
i'm having considerable trouble setting database using nested attributes, , after many hours of googling can't find answer. should keep trying fix this, or start on because idea how structure database somehow wrong? my structure is: questions (questions asked in wizard, presented depending on answers previous questions) responses (possible answers questions, user_input save user's input response (e.g. particular number) in connection particular experiment) experiment (the thing wizard assembling) user (has multiple experiments, each separate run of wizard) example seed: question.create( { :title => 'rm power analysis 2', :content => 'look next step should be. maybe display result of power analysis.', :responses_attributes => [ { content: 'seperate measurements per subject:', input_type: 'number 2 20', next_question: 'rm power analysis 2'}, { content: 'seperate measurements per subjec

nginx - asp.net chart control not working on mono 3.6 -

i'm using mono 3.6 on freebsd 10 , want run asp.net pages on mono. problem when load project containing type of ms chart control error appears: system.io.filenotfoundexception not load file or assembly 'system.web.datavisualization, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. system cannot find file specified. description: http 500.error processing request. details: non-web exception. exception origin (name of application or object): mscorlib. i found , copied (manually or add reference) required dlls project nothing changed, copied dlls in /usr/local/lib/mono/[dot net version] dir of freebsd , didnt work. meanwhile tested both in website project , web application! problem have on mono chart control have use ms chart control. has ever encountered damn trouble?! i think should deinstall , install mono again consideration correct setup configuration done!. can accomplished ./configure command in mono port dire

javascript - Update button class with video.js markerReached function -

this 1 has got brain in twist. i'm using great video.js markers plugin , want update menu buttons markerreached callback added plugin, when video hits new chapter corresponding button's class active, until next chapter begins , updates button below. this each button indicates chapter playing active button next it. the buttons navigate timestamp in video: <div class="menu"> <button onclick="setcurtime(2)" type="button" value="2">chapter 1</button> <button onclick="setcurtime(57)" type="button" value="57">chapter 2</button> </div> and here's js chapter markers: // initialize video.js var video = videojs('current_video'); //load marker plugin video.markers({ markers: [ {time: 2, text: "chapter 1"}, {time: 57, text: "chapter 2"}, ] }); so should hook markerreached event into? just add onmarkerreache

swift - Position a view with myView.frame -

i have done simple code: myview.frame = cgrectmake(0, 0, 150, 150) in viewdidload , working expected. but after link view table view , embed navigation controller, doesn't work. did miss something? try set: <targetview>.autoresizessubviews = false;

Why won't the Note Board SharePoint 2013 web part work? -

i trying create dashboard via sharepoint , create section beneath displayed document users can type , submit description of going on in document above. don't want users able edit site page in order add text page believe best solution creation of web part user can create , submit desired description. web parts i've come across note board web part , microfeed web part. microfeed part seems social media page. problem try note board web part whenever insert on page never displays area type in, title "note board". so seems problem came because of way account related particular sharepoint site editing. account doesn't have profile attached , way these notes shared , stored directly relates having 1 of these profiles. note board web part turned out working fine account not capable of posting within it. (i figured i'd answer incase else comes problem.)

html - set height in CSS to get to the bottom of the viewport from the middle of the page -

is possible? have following layout: <div class="toolbar"> </div> <div class="dates-bar"> </div> <div class="search-bar"> </div> <div class="scroll-view"> <table class="table-view"> <tr><td>...</td></tr> </table> </div> i need scroll-view go stretch bottom of viewport, scroll if number of rows * height of row overflow scroll-view. that way can keep blocks above scroll-view "fixed". can't use fixed position elements because inside container , container uses flexbox, don't have width , height. my attempts have been "height: 100%" , "height: 100vh" need "calc(100% - height(.search-bar) - height(.dates-bar) - height(.toolbar)" what can ? don't want use javascript that. if possible flexbox, use it. edit: here fiddle of problem: http://jsfiddle.net/c38p8e70/ i thin

vba - Copy the last non empty cell -

i have been working on code need copy lat non empty cell of column c in spreadsheet called "support2". need paste in spreadsheet "final", on cell a2. update spreadsheet everyday , more values added on column c, that's why needs copy last one. have tried code below not working. appreciate help, thanks! sub test() dim mylastcell range set mylastcell = lastcell(worksheets("support2").range("c:c")) end sub ' copy range: worksheets("support2").range("c:c" & mylastcell.row).copy else msgbox ("there no data in specified range") end if end sub needed sheet("support2) in it sub test() sheets("support2").range("c" & sheets("support2").range("c1").end(xldown).row).copy sheets("final").range("a2").pastespecial (xlpastevalues) end sub

c# - Add columns (column headers) to a list view programatically -

i have array of strings , want these strings columns(column headers or column names) of list view. no. of strings not known until run time , columns added programmatically. want define how many columns there in list view. suppose string contains strings = {"str1","str2","str3"}. want list view contain 3 columns namely "str1" ,"str2" , "str3". want know list view property or method can add these. thank you. i'm not sure if work list view, i've done grid view, setting autogeneratecolumns="true" : datatable dt = new datatable("tablename"); foreach(var col in arrayofstrings) dt.columns.add(col); // add rows datatable // of course, set datasource of listview/gridview listview.datasource = dt; listview.databind();

office interop - c# - Exporting data from externally hosted app and DB -

i'm building web app in c# needs facility export data. had exported excel when testing locally , worked fine, app hosted on external server believe won't work due microsoft.office.interop.excel, correct? you're right in microsoft discourages excel automation in web applications: https://support.microsoft.com/en-us/kb/257757?wa=wsignin1.0 you still have options, though. if need export data, can still write file in csv format export, , should open in excel. if need write in excel formats, can use open xml sdk office ( https://msdn.microsoft.com/en-us/library/office/bb448854.aspx?f=255&mspperror=-2147217396 ). one other option save data , have server run excel automation in batch process outside of iis , send report user.

oracle11g - Delphi XE2 with Zeoslib and Oracle Connection -

can me in setting zeoslib 7.1.4a connect oracle 11g release 2 standard database. currently using delphi xe2, oracle installed , tnsnames.ora file specifies connections our different servers , databases, , set within bde. we need move away bde components no longer available delphi xe3 , upwards. use direct oracle access components, paid 3rd party software, why want move on zeoslib. what settings need set on zconnection component in order connect oracle database, there database parameter , librarylocation parameter looking actual files, , there hostname parameter? i never used oracle, don't think should different firebird, mysql, sql server , others i've tried on zeos. the properties need set are: protocol = oracle ; hostname = database server ip best bet; maybe don't need oracle due tnsnames... try leaving empty database = database name. filename (in server) or database alias; user = user name connect database; password = well, password...

java - google calendar libraries conflict with Evernote SDK on Android -

i have created google calendar sample application following android quickstart . app runs here. want integrate evernote sdk. here build.gradle dependences dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.google.android.gms:play-services:7.3.0' compile 'com.google.api-client:google-api-client:1.20.0' compile 'com.google.api-client:google-api-client-android:1.20.0' compile 'com.google.api-client:google-api-client-gson:1.20.0' compile 'com.google.apis:google-api-services-calendar:v3-rev125-1.20.0' compile 'com.evernote:android-sdk:2.0.0-rc2' } when try run app error appears: error:execution failed task ':app:dexdebug'. com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.7.0_75\bin\java.exe

Need help to INNER JOIN multiple tables and use last value row in MySQL -

i have 3 tables follow: comments |id| |uid| |tid| tracks |id| |uid| notifications |id| |from| |tox| how can update notifications , set tox equal tracks.uid of relative tracks.id equal last comments.tid value? i tried without success: update notifications set tox = ( select uid tracks inner join comments on tracks.id = comments.tid order comments.tid desc limit 1 comments.tid=tracks.id) tox = 0 order id desc limit 1; update first edit , moved order by @ end suggested. after got different error 1052 - column 'typeid' in field list ambiguous . i solved like: update `notifications` set `tox` = ( select tracks.uid `tracks` inner join `comments` on tracks.id = comments.tid order comments.id desc limit 1) `tox` = 0 order `id` desc limit 1; i think problem syntax of subquery: update notifications set tox = (select uid tracks inner join comments on tracks.id = comment

objective c - How to check if WIFI button is enabled (iOS) -

i want able check see if user connected wifi, not connected network. want check state of wifi button on device setting page check if button enabled or disabled. at moment can check see if wifi connected network or not connected network doing following: bool haswifinetwork = no; nsarray *interfaces = cfbridgingrelease(cncopysupportedinterfaces()); (nsstring *interface in interfaces) { nsdictionary *networkinfo = cfbridgingrelease(cncopycurrentnetworkinfo((__bridge cfstringref)(interface))); if (networkinfo != null) { haswifinetwork = yes; break; } else { haswifinetwork = no; break; } } update it turns out isn't possible, there no api/framework/bool value can because apple havn't added kind of ability check see if wifi switched on or off developers. explained nicely here: https://stackoverflow.com/a/12906461/4657588 then post should want: https://stackoverflow.com/a/7938778/4657588 reachability *

Bootstrap form always showing horizontal scroll -

i'm designing system uses bootstrap controls. on every page, horizontal scroll displayed. there seems no control causing this. give example of 1 of pages. think have wrong in head, can not find it. <!doctype html> <?error_reporting(0);?> <? include_once "include/checksession.inc"; ?> <? include_once "include/conexion.inc"; ?> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- above 3 meta tags *must* come first in head; other head content must come *after* these tags --> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="../../favicon.ico"> <title>clínica 25 de

jquery - unable to place javascript into if else statement -

so have nifty little if else statement prepared i.e9 being zombie browser doesn't support things css3 animations (generally) if statement .... if ((old_ie > -1) || (new_ie > -1)) { ms_ie = true; } if (ms_ie) { } else { } $('.submenu-ctn').fadeto(3000, 1); i trying fit script if else statement... $(document).ready(function() { $("body").on("click", ".slide", function(e) { e.preventdefault(); $("#mission,#overview,#music,#potential,#people,#expression,#ethos,#cpd,#workshop,#team,#referrals,#local-links,#family,#mental,#palliative,#autism,#schools,#dementia,#private,#acreditations,#definitions,#research,#contact,#email,#phone,#contact-form,#finley,#councelling,#music-performance,#community-music,.slides").addclass("bounceoutup"); var = this; settimeout(function() { console.log($("#tam-content").load($(that).data("url") + ' ' + $(t

mysql - Are docker-hosted databases somehow exempt from backup best practices? -

as far aware, ms sql, postgresql, , even mysql databases (so, assumed, in general rdbms engines), cannot file system hosted on, need sql-level backup have hope of internal consistency , therefore ability restore. but answers this , indeed the official docs referenced seem suggest 1 can tar away on database data: docker run --volumes-from dbdata -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata these 2 ideas seem @ odds 1 another. there special how docker works makes unnecessary use sql-level backups? if not, missing in understanding? (why used official example when can't use production database? can't right...) under circumstances, should safe use image of database on disk: the database server not running. all persistent data on disk system(s) being backed (logs, tables spaces, temporary storage). all components restored together. you restoring image same server on same path. the last condition important, because aspects of databa

android - Have a trouble with developing an app for smarteyeglass -

recently,i need build app smart eyeglass. official instruction,i have import 3 library project,including smartextensionapi,smartextensionutils smarteyeglassapi.and have develop dependencies project when run app, there lot of error information. such error:(44, 57) com.sonyericsson.extras.liveware.aef.notification not existing;error:(45, 57) com.sonyericsson.extras.liveware.aef.registration not existiong!error:(49, 52)com.sonyericsson.extras.liveware.aef.control not existing,error:(198, 40)registration.intents not existing , on. what's wrong? search help. thanks it seems missing registration extension in application. please take @ sample projects details. can start developing directly using sample projects in sdk.

ios - Stop wkWebView sound when dismissing containing viewController -

in view controller have wkwebview play video sound when dismiss the view controller using: self.presentingviewcontroller?.dismissviewcontrolleranimated(true, completion: nil) the video sounf still play. how can stop it?

webhooks - Add GitLab Web hook for all projects in group -

i projects in gitlab group have shared configuration webhook: <my_jenkins_instance>/git/notifycommit?url=$changed_repository gitlab webhook documentation suggests should possible: if have big set of projects in 1 group convenient configure web hooks globally whole group. can add group level web hooks on group settings page. that sound after though see no such thing on group settings page in gitlab 7.0.0. not able find out if feature not newer in changelog . does feature exist? how use it? that's possible in enterprise version only: in gitlab enterprise edition can configure web hooks globally whole group. can add group level web hooks on group settings page settings > web hooks.

json - Cannot read property 'emit' of undefined in gulp-browserify -

i running problem. have created own seed: https://github.com/damirkusar/leptir-angular-seed gulp, browserify , more. everything worked fine, since had idea update node 10.32 12.5, getting below error. think since then. tried on different machine, same setup, same error. so, after npm install , bower install starting app with: gulp or when trying build project with gulp build i getting error: leptir-angular-seed/node_modules/gulp-browserify/node_modules/browserify/node_modules/module-deps/index.js:162 rs.on('error', function (err) { tr.emit('error', err) }); ^ typeerror: cannot read property 'emit' of undefined @ readstream.<anonymous> (/leptir-angular-seed/node_modules/gulp-browserify/node_modules/browserify/node_modules/module-deps/index.js:162:39) @ readstream.emit (events.js:107:17) @ fs.js:1618:12 @ fsreqwrap.oncomplete (fs.js:95:15) here link package.json: https://github.com/damirkusar/leptir-angu

javascript - How to add the background-color and how to highlight the border of <tr> I am using datatables 1.9.4 version -

is possible highlight border of <tr> , can append background-color same <tr> inside table? according this answer , can style tr borders if border-collapse set on table. css : table {border-collapse:collapse;} tr {border:2px solid black;} html : <table> <tr> <td>cell</td><td>cell</td><td>cell</td> </tr> </table> you can see result in fiddle . i don't understand question tr bgcolors maybe fiddle above give answer.

javascript - Generate array from CSV file selected by input type file -

i want read csv file upload using input type file , feed data array. i'm using angularjs input type file read csv, xls or xlsx file follows: html: <input class="btn btn-default col-xs-6" type="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" onchange="angular.element(this).scope().checkformat(this.files)"> javascript/angularjs: $scope.checkformat = function(files) { var fd = new formdata(); //take first selected file fd.append("file", files[0]); } how can read csv file row row , push each row array? the best way make directive such functionality (say call csvupload , use <csv-upload ng-model="mydata"> ) - way reusable , won't have implement logic in, possibly, many controllers. it's quite convenient too: once have choose file and, bam, have data on $scope.mydata :) this how did it: (to

vb.net - Rotation maths not working correctly in WPF -

i'm using adorner class create rotation thumb controls. here's relevant part of class: private initialangle double private startvector vector private currentpoint, centerpoint point private rotatetransform rotatetransform private rotatethumb thumb public sub new(adornedelement uielement) mybase.new(adornedelement) addhandler rotatethumb.dragstarted, addressof handlerotatestart addhandler rotatethumb.dragdelta, addressof handlerotate end sub private sub handlerotatestart(sender object, e dragstartedeventargs) dim ae frameworkelement = trycast(me.adornedelement, frameworkelement) centerpoint = new point(ae.width / 2, ae.height / 2) dim startpoint point = mouse.getposition(ae.parent) startvector = point.subtract(centerpoint, startpoint) rotatetransform = trycast(ae.rendertransform, rotatetransform) if rotatetransform nothing ae.rendertransform = new rotatetransform(0, centerpoint.x, centerpoint.y) initialangle = 0 else initialangle = rot

c - Get decimal value after dividing by a large number -

i have code: #include <stdio.h> int main(void) { double infre = 11e10; double c = 2.99795e8; double wavelength = c/infre; double delx = 0.600000000e-04; double nperdt = 2*((int)(wavelength/delx)); double dt = 1.0/infre/(double)nperdt; printf("%.11f", dt); return 0; } now dt supposed small. there can value upon division i'm getting 0.0 well can try example increase digits showed after ".". seems value rests somewhere in range of 10^-13 , showing first 11 digits after decimal point. example "%.19f" display non-zero result. additionally can print them in exponential format using %e , preferred solution in situation.

php - 500 Internal Server Error - when assigning data from json_decode to variables -

i sending form data form angularjs app php script. far i've been unable angular send "regular" post request (it sends json data instead), figured i'd decode php , use results i having trouble referencing results. "networkerror: 500 internal server error upon sending data script. here's php code: <?php $data = file_get_contents("php://input"); $data = json_decode($data); var_dump($data); $fromname = $data["fromname"]; $fromemail = $data["fromemail"]; $msg = $data["inputmsg"]; the var_dump($data) returns this: object(stdclass)#1 (3) { ["fromname"]=> string(4) "djea" ["fromemail"]=> string(13) "djea@djea.com" ["inputmsg"]=> string(7) "testmsg" } can please point out i'm doing wrong? thanks pass true second variable json_decode associative array. $data = json_decode($data, true); $fromname = $data[&quo

io - read a file into a list [prolog] -

i have log entries include 4 different terms. log(name1,surname1,street1,belgium). log(name2,surname2,street2,germany). log(name3,surname3,street3,france). log(name4,surname4,street4,france). i saved loginfo.pl. manage read these input file (loginfo.pl) not collect in "list".after need filter using condition " country begin letter 'f'. so @ end want [log(name3,surname3,street3,france),log(name4,surname4,street4,france)] use consult/1 load facts contained in file in prolog kb. use atom_chars/2 split atom characters. use findall/3 collect multiple solutions goal. example: ?- [loginfo]. ?- findall(log(a,b,c,d), (log(a, b, c, d), sub_atom(d, 0, 1, _, 'f')), result). result = [log(name3, surname3, street3, 'france'), log(name4, surname4, street4, 'france')]. [loginfo] shorthand consult(loginfo) . also, if don't repeat yourself: ?- findall(x, (x=log(_, _, _, d), x, sub_atom(d, 0, 1, _, 'f')), r

angular ngmodel - AngularJS ng-bind issue -

i working on angular application. need bind 2 model variable using ng-bind , 2 variables 2 different scope (one parent , other child scope). possible? here code tried: <input tabindex="2" id="{{clientac}}" ng-model="a.clientac" ng-blur="clientfocusout()" ng-keydown="clientkeydown($event)" />

jquery - css selectors after ajax request (comments system) -

problem: after adding comment on webpage works property, mean added comments want them slide down last added comment. think problem css selectors, comments should on last comments on website. 1 selector have type it? anybody can me it? hope clear. $(function() { "use strict"; var commentsform = $('#commentsform'); var errortemplate = '<div class="alert alert-danger"><span class="glyphicon glyphicon-warning-sign"></span>&nbsp;{error}</div>'; var successtemplate = '<div class="alert alert-success"><span class="glyphicon glyphicon-warning-sign"></span>&nbsp;{error}</div>'; var commentstemplate = '<div class="row" id="comments"><div class="col-md-2 col-sm-2 hidden-xs"><figure class="thumbnail">{photo}<figcaption class="text-center">{username}</figcaption

java - How to get distinguished names from certificate using private key? -

my android app receive (by aidl ) user certificate , private key. how can distinguished name certificate? the app sends certificate , private key can have these names keystore initialized form *.pfx file , using password this: keystore keystore = keystore.getinstance("pkcs12"); keystore.load(in, getpassword().tochararray()); and using alias: enumeration enumeration = clientkeystore.aliases(); while (enumeration.hasmoreelements()) { string currentalias = (string) enumeration.nextelement(); .. .. } i can distinguished names x509certificate c = (x509certificate) keystore.getcertificate(currentalias); principal subject = c.getsubjectdn(); string subjectarray[] = subject.tostring().split(","); (string s : subjectarray) { string[] str = s.trim().split("="); string key = str[0]; string value = str[1]; log.d(tag, key + " - " + value); } i cannot pass more information app certificate , private k

Android Studio doesn't read Samsung Galaxy S5 -

Image
i installed latest sdk tools android sdk tools 24.3.3 , android sdk platform-tools 22,and unfortunaly android studio doesn't samsung s5 galaxy. reads offline. can see picture. i tried adb commands kill-server , start-server no result. turned off , on usb debugging developer options.. this gradle file code in case did wrong there. have device connected mac recongised , online. apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "21.1.2" defaultconfig { applicationid "app.victory.walking.thewalkingviktory" minsdkversion 15 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), ' 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcom

osx - scp between two terminal windows (or multihop scp) -

i regularly have connect several systems via ssh using multiple hops. happens want copy file either destination system local system or other way around in simple way (my current work flow copy file external location both machines can see saves me few hops or if file not binary cat , copy/paste other terminal window). there easy way such thing? i using osx , iterm2 (obviously woudn't mind changing latter). so connection (local machine) -> (portal a) -> (machine b) -> (portal c) -> (machine d) so copy files machine machine d in simple way (without copying file via hops or creating 4 tunnels). it's not quite you're asking for, there tricks can play ssh proxying simplify sort of thing enormously. first thing familiar proxying multihop ssh connections on netcat. if have openssh version 5.4 or later on various hosts, add ~/.ssh/config: host b proxycommand ssh -w %h:%p host c proxycommand ssh b -w %h:%p host d proxycommand ssh d -w

Javascript SOAP request cross domain -

i wanted see options have. can't use curl see below. so, in system online system can build form (i not have access server , files). 1 thing system allows me add javascript. so within system a, need call api. api hosted somewhere else. trying make call via javascript cross domain error. now if wondering why dont use php, it's policies. system certified meaning been pentested , secure. same applies api being used. if use php, have host php file on our server (dont have access server) , our server not certified. client not allow , our server certified long process. summarise, can't outside of system a. i have seen potentially use jsonp, works get? stupid question, how know if need make post or request? also, in situation, responsible allowing cross domain request? system (the system in) or api? any advice appreciated

Android Lollipop device not recognised by Android Studio -

i want run app android studio on physical device running lollipop (5.0.2), neither choose device dialog nor adb manager can recognise it. in fact, place on pc can see in device manager (it not show drive). i have tried usual solutions updating driver , such, nothing helps. what wrong? the answer, me, change usb-port to usb 2 port . it not work on usb 3 ports.

c++ - Gnuradio,OOT: correcting send() for tagged stream block? -

i need making gnuradio oot module. trying extending 1 code. i trying make 2 tx 1rx tagged stream block (oot). 1tx 1rx, working fine. trying extend it. problem is, not being able configure send() function. code, 1 transmitter transmits, other not work. subdev specification , frequency , other parameters allocated correctly. checked. if try make test, not show problem. checked every port of usrp x310, working fine. here's code. putting short part deals send , receive buffer. void usrp_echotimer_cc_impl::send() { // data usrp num_tx_samps = d_tx_stream->send(d_in_send1, total_num_samps, d_metadata_tx, total_num_samps/(float)d_samp_rate+d_timeout_tx); num_tx_samps = d_tx_stream->send(d_in_send0, total_num_samps, d_metadata_tx, total_num_samps/(float)d_samp_rate+d_timeout_tx); } int usrp_echotimer_cc_impl::work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { gr_complex *in0 = (gr

java - Enable and select values of Drop-down based on the value selected in another Drop-down -

i have couple of drop-downs on page; after selecting value on first drop-down, second drop-down enable , values loaded accordingly. when running manually, after selecting value in first drop-down, page gets loaded , second drop-down gets enabled , values listed according value selected in first drop-down. however, when automation using selenium webdriver (in java), value of first drop-down gets selected , second drop-down never enabled or loaded values. even tried webdriverwait below, still no luck. webdriverwait wait = new webdriverwait(wd, 50); wait.until(expectedconditions.elementtobeclickable(by.id("event"))); noticed move out page (alt+tab)and come again page page getting loaded , second drop-down enabled. below exception thrown, org.openqa.selenium.timeoutexception: timed out after 50 seconds waiting element clickable: by.id: event please advise. coding page object model: in pom class: //create object page 1 createasset asset = pagefactory.init

Lua saving to file -

i'm working on small project in lua , having problem saving score disk. my code this, , print message. function savehighscore(score) print("high score: "..tostring(score)) local file = io.open("high_score.txt",'w') file:write(tostring(score)) file:close() end anyone out there can help? sure, have solved faster if followed first 2 comment's advices. here how it's done "in case else stuck same problem , came across this": function savehighscore(score) print("high score: "..tostring(score)) local file,err = io.open("high_score.txt",'w') if file file:write(tostring(score)) file:close() else print("error:", err) -- not hard? end end http://www.lua.org/manual/5.3/manual.html#pdf-io.open : io.open (filename [, mode]) this function opens file, in mode specified in string mode. returns new file handle, or, in case o

css - Flexslider showing 1px on right side of sliders -

Image
hi, i'm using negative margin on flexslider container 3 sliders can have margin right in middle items not far right in order align flush top content. it shows when resizing window, seems flexslider cannot calculate correctly because of negative margin. not sure how rid off 1px on screens. http://dusit.syndacast.com/dusitprincess/korat/accommodation/ you have change code. please replace code .offer-list-div { background-color:#f0eeef; margin-top:20px; padding: 1% 7% 20px; } by this .offer-list-div { background-color:#f0eeef; margin-top:20px; padding: 1% 8% 20px; } and issue solved.. let me know if issue still exists..thanx