Posts

Showing posts from July, 2014

c# - Calling WCF service hosted in Forms Authentication site from a Windows Service -

we have windows service process continually processing messages microsoft messaging queue. when acting upon these messages, calling methods wcf service. that wcf service hosted in asp.net web site not has wcf services end-user front end. generally, wcf methods modifying in-memory data structures, , front end reading them. data being modified , clients need notified of changes immediately. (we using signalr.) everything working great long asp.net site using windows integrated authentication. required front end use forms authentication. this, of course, broke wcf binding. previous binding was: <basichttpbinding> <binding name="basichttpbinding_isessionwebservice"> <security mode="transport"> <transport clientcredentialtype="windows" /> </security> </binding> </basichttpbinding> front-end users not need able call services. (in fact, should not able to.) ideally, i'd wcf serv

php - Ubuntu Error and Email from Cron? -

i have been trying figure out whats going on here... have looked on , nothing seems solid solution. if knows link or information on how fix appreciated. ubuntu 14.04 lts microsoft azure server apache drupal site apc enabled (everything looks on drupal side) keep getting these annoying emails below issue. i added smtp , mailutils server, , getting these errors looks apache / php... -- cron [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime) php warning: php startup: unable load dynamic library '/usr/lib/php5/20121212/apc.so' - /usr/lib/php5/20121212/apc.so: cannot open shared object file: no such file or directory in unknown on line 0 thanks help, -frank these being generated /etc/cron.d/php5 cronjob. if want errors generated here stop being emailed, can set mailto="" on line before command in file. not

testing - Rails Integration Test -

i taking rails class , stuck on integration test. have made simple app user can use share link website. want create test will: get amount of links in database post new link check number of links has increased 1. here have far: test "posts new link , check count" @link = links.all "/links/new" post_via_redirect "/links/new", :url => links(:test_link).url, :description => links(:test_link).description assert_equal '/links/new', path assert_difference("link.count",n) i know doesn't work cannot figure out wording/syntax , appreciate nod in right direction. please let me know if should include other information. this simple. assume use minitest functional tests. the test cases should wrapped class mylinkscontrollertest < actiondispatch::integrationtest mylinkscontrollertest should have same name actual controller. get amount of links in database. test 'should index page'

css - Can't hover over jquery toggled submenu -

i built menu jquery, 4 category buttons on top menu triggering 4 submenus below. works fine, submenus appearing , changing when hover on button, can't hover on submenu, it's dissappearing when "leave" trigger button. jsfiddle example (sorry messy code, can't reproduce entire composition in fiddle, copy-pasted important parts , issue same on site seen on example) this jquery submenu calls: ('active' , 'rotated' changing icons/rotating text on trigger buttons, these triangles , did jquery fanciness them, hope it's still understandable) $('.leisuremenu').hover(function () { $('.leisure_menu').toggleclass('show_menu'); $('.luxury_menu').toggleclass('show_menu'); $('.select-luxury').toggleclass('active'); $('.select-corporate').toggleclass('rotated'); $('.select-luxury').toggleclass('rotated'); }); $('.corporatemenu').hover

javascript - Accessibility of outside variable within a promise in nodejs -

can explain me why don´t work: var outsidevar = 15; myfunc.dosomething().then(function() { console.log("outsidevar: " + outsidevar); }).fail(function(err) { console.log("error: ", err); }); the output error: undefined or outsidevar: undefined (depends if outsidevar variable or property of object. an outside variable should accessible inside function or i´m wrong? edit: i´m using construction spookyjs , seems there issue objects containing long strings. in nodejs, use function error. so: mypromise.then(function() { // callback, executed on successful promise resolution }, function() { // errback, executed on rejection }, function() { // progressback, executed if promise has progress report }); .fail() isn't recognizable function in node, unless have defined .fail() function explicitly. .fail() throwing undefined error. .fail() in nodejs used building unit tests, not promises. https://nodejs.org/api/assert.html otherwise, writt

drupal - Add user role based on Profile2 Field Using Rules -

what trying achieve is: 1) have profile2 field in user registration form called: "firm type" 2) need assign new user role based on selection in field. i have tried following: event: after saving new account condition: data comparison: account:profile-additional-registration-info:field-profile-firm-type action: add user role the above rule works fine when remove condition. add condition rule not work. digging found out rule gets executed after account saved , before profile2 saved. i looked online find these 2 links helpful: https://www.drupal.org/node/1872384 https://www.drupal.org/node/2009878 1 suggestion was: event: after saving new profile condition: data comparison: profile2:field action: heres problem -- cannot account level because on profile event. could please me figure out. appreaciated! thanks! here steps: rules event : after adding new profile after updating existing profile rules condition : negate user has roles: check roles o

Matlab plot: line is not smooth -

i use matlab on osx retina display. when plot points (or line, function), points (or line) not smooth, no matter size x-step choose. but when try resize manually figure window (when plot changes dimensions on screen), points (or line) instantaneously become smoother , better defined. does know how can obtain smooth plot without resizing figure window ? thanks

php - BasicNetwork.performRequest: Unexpected response code 500, Android Registration System -

i started working on android app , needed login , registration system. found tutorial on androidhive.info errors. i'm using volley library sending http requests , error in logcat related library. used public ip address of server on digitalocean , think might have because in tutorial store php scripts on localhost. android activity used registering users: package foi.hr.air.asocijacije.ui; import java.util.hashmap; import java.util.map; import org.json.jsonexception; import org.json.jsonobject; import com.android.volley.request.method; import com.android.volley.response; import com.android.volley.volleyerror; import com.android.volley.toolbox.stringrequest; import android.app.activity; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.toast; import foi.hr.air.asocijacije.r; import foi.hr.air.asocija

xml - Android action bar drop-down menu button doesn't show up -

i'm trying menu button show @ 11:41 in tutorial below. https://www.youtube.com/watch?v=bsb2jugxegs?t=11m41s here's code: first_layout.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".firstactivity" android:clickable="false"> <textview android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textview" /> </relativelayou

javascript - Materializecss dropdown menu not working with AngularJS -

i'm developing web app using materializecss , angularjs front-end, problem dropdown menu component of materialize doesn't work me. here's example dropdown on site $( document ).ready(function(){ $(".dropdown-button").dropdown(); }); <!-- dropdown structure --> <ul id="dropdown1" class="dropdown-content"> <li><a href="#!">one</a></li> <li><a href="#!">two</a></li> <li class="divider"></li> <li><a href="#!">three</a></li> </ul> <nav> <div class="nav-wrapper"> <a href="#!" class="brand-logo">logo</a> <ul class="right hide-on-med-and-down"> <li><a href="sass.html">sass</a></li> <li><a href="components.html">components</a&

if statement - JSON JQ if without else -

i use following jq command filter out json. requirement filter out json message if expected node present. or else, nothing. hence, use if, elif, .... sed -n "s/.*service - //p" $1/response.log* | jq "if (.requests | length) != 0 .requests |= map(select(.id == \"123\")) elif (.result | length ) != 0 .result |= map(select(.id== \"123\")) else " " end" > ~/result.log looks else mandatory here. dont want inside else block. there anyway, can ignore else or print whitespce inside else. in above case, prints double quotes " " in result file. you may want use idiom: if condition whatever else empty end empty filter outputs nothing @ -- not null, after (namely json value). it's bit black hole, blacker -- consume whatever it's offered, unlike black hole, not emit hawking radiation. in case, have "elif" using "else empty" want, reference, above equivalent to: s

Python connect 4 check win function -

i writing connect 4 game in can choose size of board. game works flawlessly board sizes gives me problems when board taller wide. keep getting index out of range errors , im not sure have done wrong. have right in terms of check function part giving me issues. def checkowin(board): boardheight = len(board) boardwidth = len(board[0]) tile = 'o' # check horizontal spaces y in range(boardheight): x in range(boardwidth - 3): if board[x][y] == tile , board[x+1][y] == tile , board[x+2][y] == tile , board[x+3][y] == tile: return true # check vertical spaces x in range(boardwidth): y in range(boardheight - 3): if board[x][y] == tile , board[x][y+1] == tile , board[x][y+2] == tile , board[x][y+3] == tile: return true # check / diagonal spaces x in range(boardwidth - 3): y in range(3, boardheight): if board[x][y] == tile , board[x+1][y-1] == tile , boar

windows - How to add a count to the end of a bat file -

i'm using following ping list of computers text file (shown below) i'm wondering if there way add count end of this. ie there 20 ok machines , 50 failed. @echo off /f "usebackq delims=" %%# in ( "location of .txt file" ) ( echo+ echo [+] pinging: %%# ping -n 1 "%%#" 1>nul && ( echo [ok]) || ( echo [failed]) )>>results.txt pause&exit @echo off setlocal enableextensions disabledelayedexpansion set "up=0" set "down=0" ( /f "usebackq delims=" %%# in ( "location of .txt file" ) ( echo+ echo [+] pinging: %%# ping -n 1 "%%#" 1>nul && ( set /a "up+=1" & echo [ok]) || ( set /a "down+=1" & echo [failed]) ) setlocal enabledelayedexpansion echo : !up! echo down : !down! endlocal )>>res

Need help parsing JSON with PHP to build an URL -

i have json file looks this: { "name": "star_wars", "level": true, "condition": "hot", "actions": [ { "index": 0, "name": "sword_hit", "expectedmodelname": "swordmodel", "params": [ { "name": "language", "values": [ { "value": "gb" } ] }, { "name": "planet_version", "values": [ { "value": "hutta" } ] } ], "newparameters": [], "checks": [] }, { "index": 1, "name": "sword_

How to parse nested JSON objects in spark sql? -

i have schema shown below. how can parse nested objects root |-- apps: array (nullable = true) | |-- element: struct (containsnull = true) | | |-- appname: string (nullable = true) | | |-- apppackage: string (nullable = true) | | |-- ratings: array (nullable = true) | | | |-- element: struct (containsnull = true) | | | | |-- date: string (nullable = true) | | | | |-- rating: long (nullable = true) |-- id: string (nullable = true) assuming read in json file , print schema showing this: dataframe df = sqlcontext.read().json("/path/to/file").todf(); df.registertemptable("df"); df.printschema(); then can select nested objects inside struct type so... dataframe app = df.select("app"); app.registertemptable("app"); app.printschema(); app.show(); dataframe appname = app.select("element.appname"); appname.registertemptable

php - Removing or renaming swift in laravel -

the error getting file: "/var/www/html/goalline/swiftmailer333/swift.php" line: 32 message: "cannot redeclare class swift" type: "symfony\component\debug\exception\fatalerrorexception" i have need remove swift laravel conflicts functions form legacy application laravel app needs call. how can this? whether should irrelevant have use functions legacy application. i've tried commenting 'mail' => 'illuminate\support\facades\mail', , 'illuminate\mail\mailserviceprovider' didn't work. you'll have namespace swift class: <?php namespace yourapp; class swift { } then use way: $swift = new yourapp\swift; another possibility create nasty hack remove laravel installation, you'll have create repository of own , use repository in composer.json file: { "repositories": [ { "type": "vcs", "url": "http

asp classic - ASP Server.Execute - Executed Page is not accessing variables from the former/first page -

i know server.execute(..) not accept query strings. msdn website says variables former website avaible executed page. not work me @ all. idea why? simple example should work not: <% dim strvar strvar = "this text" server.execute("page2.asp") %> page2.asp <% response.write( strvar ) %> any idea why not work? ps. i´m not using "< !--include .. -->" because have conditional outputs. when using server.execute, variables page 1 not available on page 2, design example should not work. here's snippet msdn page server.execute explains available page 1 on page 2. the following collections , properties available executed asp page: application variables, if set in calling page. session properties, if set in calling page. server variables , properties, if set in calling page. request collections , properties, if set in calling page. includes form , querystring data passed call

TCP accept and Go concurrency model -

looking @ net.tcplistener . 1 expect, given go concurrency paradigm, system functionality implemented channel, got chan *net.conn listen() function, or similar that. but seems accept() way, , blocks, system accept. except it's crippled, because: there no proper select() can use it, because go prefers channels there no way set blocking options server sockets. so i'm doing like: acceptchannel = make(chan *connection) go func() { { rw, err := listener.accept() if err != nil { ... handle error ... close(acceptchannel) ... return } s.acceptchannel <-&connection{tcpconn: rw, .... } } }() just can use multiple server sockets in select, or multiplex wait on accept() other channels. missing something? i'm new go, might overlooking things - did go not implement own blocking system functions own concurrency paradigm? need separate goroutine every socket (possibly hundreds or thousands) want listen with? cor

c# - (createchildcontrole) = object reference not set to an instance of an object -

i use visual studio 2012 create usercontrols wrapped on sharepoint 2010 following code of 1 of them public partial class sidebarusercontrol : system.web.ui.usercontrol { protected void page_load(object sender, eventargs e) { lilogout.visible = false; attendance.visible = false; empevaluation.visible = false; objections.visible = false; myeval.visible = false; rates.visible = true; if (pagebase.currentuser == null) { string loginname = spcontext.current.web.currentuser.loginname; loginname = loginname.split(new string[] { "\\" }, stringsplitoptions.removeemptyentries)[1]; if (systemuserbll.isuserexist(loginname, "123456")) { systemuserbll.login(loginname, "123456"); } else response.redirect("login.aspx", true); } if (new userdal().getuserfieldv

Highlight individual observation in density and violin plot in R/ggplot2 -

Image
i trying highlight position of individual in density plot , in violin plot. for instance, in plot generated code bellow, highlight "mazda rx4" in mtcars dataset. adding point or bar value of individual observation in each category #density plot ggplot(data=mtcars,aes(x=drat))+ geom_density() + facet_grid(cyl ~ .) #violin plot library(ggplot2) ggplot(data=mtcars,aes(x=factor(cyl),y=drat, fill=factor(am)))+ geom_violin() edit: 1) based on @dataminer answer bellow able add desired point (code bellow) violin plot. ggplot(data=mtcars,aes(x=factor(cyl),y=drat, fill=factor(am)))+ geom_violin() + geom_point(data = mtcars[rownames(mtcars) == "mazda rx4",]) however, same +geom_point() did not work density plot. how can add point observation density plot? 2) also, possible use marker, line segment or bar (perpendicular base line of distribution) instead of point? try following first part of question (add ggplot-code): geom_point(data = mtcar

Error loading rsa private key - MUP to Deploy Meteor App at Digital Ocean w/SSL -

i have meteor app deploying digital ocean ubuntu server via mup . works great without ssl, can't figure out ssl part. i purchased comodo ssl cert. sent me 4 .crt files. can following command: cat cert1.crt cert2.crt cert3.crt mydomain.crt > ssl.pem i put ssl.pem file in root directory locally. added "ssl": {"pem":"./ssl.pem"} mup.json file , ran mup setup -- succesful until: [45.55.225.190] x verifying ssl configurations (ssl.pem): failed -----------------------------------stderr----------------------------------- trying initialize ssl contexts certificateserror loading rsa private key -----------------------------------stdout----------------------------------- ---------------------------------------------------------------------------- i'm not sure how troubleshoot this. ran quick find on server , ssl.pem there, mup sent file over, seems stud not verifying file or not finding it? turns out running 2

r - CURL handle goes Stale when inside foreach() -

alright, i've figured out can query website behind login screen csv report. thought, wouldn't better concurrently? afterall reports take lot longer produce others , if querying 10 different reports @ once way more efficient. i'm on head twice here playing around https protocols , parallel processing. think frankencode there though gives me "error in ( : task 1 failed - "stale curl handle being passed libcurl" note "curl" current "html" variable did login successfully. happens in it's parallel chunk makes stale. library(rcurl) library(doparallel) registerdoparallel(cores=4) agent="firefox/23.0" options(rcurloptions = list(cainfo = system.file("curlssl", "cacert.pem", package = "rcurl"))) curl = getcurlhandle() curlsetopt( cookiejar = 'cookies.txt' , useragent = agent, followlocation = true , autoreferer = true , curl = curl ) un="username@domain.com" p

How to use null safe operator in drools decision table -

Image
please let me know how use ".?" (null safe operator) in drools decision table(spreadsheet). attached spreadsheet, mdcl object need add null safe operator. please let me know if need add additional information, i'm new drools. the null-safe operator in drools !. , not .? - see documentation . can use inside decision tables when writing rules. in example, change condition mdcl.mdcl_health.get("mdcl").value mdcl!.mdcl_health.get("mdcl").value fire rule if mdcl not null.

android - NDK r10b 32 and 64 bit builder for mac -

Image
here link 32 bit ndk r10b builder http://dl.google.com/android/ndk/android-ndk32-r10b-darwin-x86_64.tar.bz2 here link 64 bit ndk r10b builder http://dl.google.com/android/ndk/android-ndk32-r10b-darwin-x86_64.tar.bz2 both ndk builder seems identical , both marked r10b (64-bit) in release.txt so, doing downloading ndk builders wrong place ? thanks in advance ! the android ndk located here: https://developer.android.com/tools/sdk/ndk/index.html make sure using latest ndk, have r10b when there r10d . also, may have forgotten update release.txt . for mac x86 - 32bit: http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86.bin for mac x86_64 - 64bit: http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86_64.bin

How to read csv using LINQ ,some columns contain , -

i have csv in below way. "india,inc" company name single value contains , in it how values in linq 12321,32432,423423,kevin o'brien,"india,inc",234235,23523452,235235 becuase you're reading values delminated bycommas, spaces shouldn't cause issue if treat them other character. var values = file.readlines(path) selectmany(line => line.split(','));

How to include a PHP file inside WordPress php template? -

this code have inside php tags: include('/wp-content/custom-php/numberedsteps.php'); and error: warning: include(/wp-content/custom-php/numberedsteps.php): failed open stream: no such file or directory in /home/user/public_html/website.com/wp-content/themes/flatsome/woocommerce/archive-product.php on line 85 warning: include(): failed opening '/wp-content/custom-php/numberedsteps.php' inclusion (include_path='.:/usr/local/php56/pear') in /home/user/public_html/website.com/wp-content/themes/flatsome/woocommerce/archive-product.php on line 85 how can error fixed? try getting root path first for php >= 5.3.0 try include(__dir__.'/wp-content/custom-php/numberedsteps.php'); for php < 5.3.0 try include(dirname(__file__).'/wp-content/custom-php/numberedsteps.php');

sql - Append rows to table via Sybase Load statement -

i used 2 consequent loads sybase table via below sql script code. when loading second file, instead of appending overwrites raws. there option avoid overwrite? load table departments ( departmentid, departmentname, departmentheadid ) '/d1/mill1/dept1.txt' thank in advance. if understood correctly, got both files available @ moment doing load. like: load table departments ( departmentid, departmentname, departmentheadid ) '/d1/mill1/dept1.txt','/d1/mill1/dept2.txt';

Disable row count of findAll() / collection resource in Spring Data REST -

i'd prefix fact issue due postgressql , known problem row counting. with tens of millions of rows, call localhost:8080/myobject takes significant amount of time execute because of call count rows. given that, there way disable count call base collection resource in spring data rest / jpa, without writing custom repository implementations use list / iterable / slice return types pageable methods? try this: <mvc:argument-resolvers> <bean class="org.springframework.data.web.pageablehandlermethodargumentresolver"> <property name="fallbackpageable"> <null /> </property> </bean> </mvc:argument-resolvers>

sql - Mysql - Money transfer: Transfer data from one field to another in the same table -

i need simulate money transfer 1 account another. table looks this: create table new_table (id int not null auto_increment, name varchar(50) not null, password varchar(50) not null, dollars double, primary key (id) ); i can't figure out statement in mysql transfer data 1 cell/field (dollars) another. has add transferred amount cell , withdraw same amount cell transfer made from. you nay want select , update , these operations in 1 transaction. did not provide information framework/library use, not able tell how exactly... but need set @payers_money= select dollars new_table name = 'name of paying person'; set @receivers_money=select dollars new_table name = 'name of receiving person'; set @payment=10; -- example set @payers_money=@payers_money-@payment; set @receivers_money=@payers_money+@payment; update new_table set dollars =@payers_money name= 'name of paying person'; update new_table set dollars = @receivers_mon

javascript - Can I apply two shaded color on single image with image filter in fabricjs? -

Image
i have 2 shaded colors this: i want apply gradient colors on single image fabric js image filter. basically added 2 palettes colors. need when change color palettes both colors apply in single image above image. possible? i designing t-shirt below: i want apply 2 colors on big grey image of t-shirt. different color images working separate image , separate object in fabric js , want apply colors on single grey image part. is there way make work? since fabricjs doesn't give natively possibility of apply gradient image , can achieve task imagefilter included in following code snippet. (function(global) { 'use strict'; var fabric = global.fabric || (global.fabric = {}), extend = fabric.util.object.extend; fabric.image.filters.gradienteffect = fabric.util.createclass(fabric.image.filters.basefilter, { type: 'gradienteffect', initialize: function (options) { options =

mongodb - Profile page for member in php -

this code php : login.php: <form action="conn.php" method="post"> username: <input type="text" id="username" name="username" /> password: <input type="password" id="password" name="password" /> <input name="submit" id="submit" type="submit" value="login" /> </form> <?php $success = ""; if(isset($_post['submit']) == "login" ) { $username = strip_tags($_post['username']); $password = strip_tags($_post['password']); $error = array(); // username validation if(empty($username)) { $error[] = " empty or invalid username "; } if(empty($password)){ $error[] = "enter password"; } if(count($error) == 0){ $host = 'localhost'; $database_name = 'projett'; $da

java - Add ServerEndpoint to Tomcat instance without annotations -

how add serverendpoint , onopen , onmessage , onclose event handlers specific class without use of @serverendpoint("/myurl") , @onopen , @onmessage , @onclose annotations within respective class, using embedded tomcat? i believe it's along lines of: tomcat tomcat = new tomcat(); tomcat.setport(8080); context context = tomcat.addwebapp("/", new file(webappdir).getabsolutepath()); context.setsessiontimeout(10080); servercontainer servercontainer = (servercontainer) context.getservletcontext().getattribute(servercontainer.class.getname()); serverendpointconfig serverendpointconfig = serverendpointconfig.builder.create(myclass.class, "myurl").build(); servercontainer.addendpoint(serverendpointconfig); but servercontainer gives java.lang.nullpointerexception , i'm not sure if it's correct way of doing or not. one alternative extend javax.websocket.endpoint : https://blogs.oracle.com/arungupta/entry/websocket_client_and_ser

How to enable KeystoneJS editor for logged in Users? -

is possible enable keystonejs editor logged in users? changing check in generator-keystone default layout if user && user.canaccesskeystone if user not enough. i added wysiwyg class textarea want editor appear.

regex - Ruby convert string to specific array format -

what need convert this: "id,name,user[id,email]" into array: ["id", "name", {"user"=>["id", "email"]}] what best way that? think function split or scan can help, don't have knowledge in regex solve this. just out of curiosity: ▶ str = "id,name,user[id,email]" ▶ eval "[#{str.gsub(/(\w+)\[(.*?)\]/, '{\1=>[\2]}').gsub(/\w+/, ':\0')}]" #⇒ [ # [0] :id, # [1] :name, # [2] { # :user => [ # [0] :id, # [1] :email # ] # } #] disclamer : use eval in production 1 must understand risks. upd safe eval ing (note every ascii \w symbol converted it’s wide pair utf-8 prevent injection; not best way around, works nicely unless have ruby functions named wide characters): ▶ safe = str.gsub(/\w/) |e| ▷ e.each_codepoint.map |cp| ▷ cp + 0xff00 - 0x0020 ▷ end.pack('u') ▷ end #⇒ "id,name,user[id,email]" ▶ eval "[#{saf

plugins - Calling instance methods of function caller in python -

hi everyone, i'm trying create 'plugin' system using python (2.7.6). have class implements basic manipulation on custom hardware board (uses c++ shared library), , i'd developers able extend functionality of class using sort of plugin system. various reasons, functionality should available @ same level (say, 1 class instance), function calls, explicitly implemented or imported plugins, should callable board instance. additionally, functions in these plugins need use functions defined in calling class. example, channelisation plugin need use read , write calls implemented in board class imports it. i've started abstract base class plugins follows: class firmwareblock(object): """ abstract super class must used implement firmware block plugins used access layer """ def __init__(self): """ class initialiser """ # define class abstract class __metaclass__ = a

php - CopiedTxt and CopiedTxt.execCommand doesn't work -

i have code enable me copy clipboard link of current page when click on button. seems it's no longer working. idea how update it? <?php echo ' <script type="text/javascript"> function copytoclipboard() { copiedtxt = index.php?option=com_content&view=article&id='.$articleid.'&lang='.substr($langue, 0, -3).'&itemid='.$itemid.'; copiedtxt.execcommand("copy"); } </script> <form name="form1"> <input type="button" onclick="copytoclipboard()" value="copy link clipboard" /> </form>'; ?> also other way copy text clipboard (using php/javascript only) welcome!

node.js - Node JS - load and modify SVG file -

i'm new node js , want show svg map. i've tried loading html object, doesn't work , if did, want modify map based on variables (more color countries based on query). edit: tried showing svg loading html file containing following line: <object type="image/svg+xml" data="image.svg">nope.</object> the svg did not show in browser. and regarding changes in svg, know how change svg, not how through javascript/nodejs (i new them). i never used node.js, worked on .svg files javascript. anyway, code cannot display svg way, should display html object on page, : ...//html code <div id="svgcontainer"> <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" xmlns:xlink="http://www.w3.org/1999/xlink"> <g> <path class="country" id="spain" d="..." fill="none"></path> <path class=&qu

join - query recursive and others tables in postgresql? -

i have little problem make recursive query , can’t extract data need. i have 3 tables (menu, type_role, privilege) menu ---------------------------------------------------------- | id| parent_id | tittle | controller | action | | 1 | | users | | | | 2 | 1 | create user | users | create | | 3 | 1 | edit user | users | edit | | 4 | 1 | show users | users | show | | 5 | | contacts | | | | 6 | 5 | create contacs | contacts | create | | 7 | 5 | edit contacts | contacts | edit | | 8 | | inventory | | | | 9 | 8 | register piece | pieces | register | | 10| 8 | show pieces | pieces | show | type_role --------------------- | id| role | | 1 | administrator | | 2 | technical | | 3 | operator | privilege -----------------

unix - Script fails when using a variable for paths -

the following script fails. if run manually giving absolute paths instead of dir works. #!/bin/ksh export dir="/clocal/www/logs/ca" find $dir -name "*gz" -mtime +2 -exec ls -lrt {} \; #working line : find . -name "*gz" -mtime +2 -exec ls -lrt {} \; the operating system being run under aix.

Vim opens some files in readonly mode by default even when use sudo -

i have weird issue vim - files doesn't color syntax , opens readonly mode default, if use sudo. chmod file 664, owner of file, shouldn't. i have no set ro in vimrc. i noticed happens after removing .swp file - unfortunately, after this, particular file every time opened in readonly mode. 1 idea - maybe kind of spf13 cache? for other files behavior correct. anyone knows issue? i found solution - more trivial expected. i read vim messages more , saw @ end: if did already, delete swap file `~/.vimswap/urls.py.swp` so did small investigation , found .vimviews inside /home directory. removed it's content , ...it works!

c# - Method must return a value -

the exercise: write method rolls 3 dice. passed number of dice roll , returns number 1 6 each of dice rolled , 0 dice not rolled. have pass 4 parameters , either use out or ref keyword or pass array. now code have far: int moredice() { random rndom = new random(); int nummer = rndom.next(1, 6); boolean[] barr = { true, false, true, false, true, false }; (int = 0; < 3; i++) { if (barr[nummer] == true) { return nummer; } else { return 0; } } } now visual studio tells me have return something, either way. can't seem return null. and inserted else last i in loop isn't reachable. is able me or give me slight push in right direction? there lots of comments being thrown @ , case homework assignments. first off assignment asking 3 dice, not more less therefore method nee

ios - Set up side drawer controller -

Image
basically use mmdrawerviewcontroller side drawer , setup storyboard prototype below and code successful login uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; menuvc *menuviewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"menuvc"]; uiviewcontroller *centerviewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"vc1"]; mmdrawercontroller *drawer = [[mmdrawercontroller alloc] initwithcenterviewcontroller:centerviewcontroller leftdrawerviewcontroller:menuviewcontroller]; ((vc1 * )centerviewcontroller).drawer = drawer; menuviewcontroller.drawer = drawer; [drawer setrestorationidentifier:@"mmdrawer"]; [drawer setopendrawergesturemodemask:mmopendrawergesturemodeall]; [drawer setclosedrawergesturemodemask:mmclosedrawergesturemodeall]; [drawer setdrawervisualstateblock:^(mmdrawercontroller *drawercontroller, mmdrawerside drawerside, cgfloat percentvisible) { mmdr

android studio about inserting event on own mobile calendar -

the programme runs error. however, event doesnt insert own mobile's calendar. know reason that?? mobile pentech a880. or there method insert events? package com.example.lean.myapplication; public class myactivity extends activity { protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.list_fragment); button button = (button) findviewbyid(r.id.button); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent(intent.action_pick, android.provider.mediastore.images.media.external_content_uri); startactivityforresult(intent, 2); } } ); addtocalendar(getapplicationcontext(), "hello","2015/10/10 10:05:33" ); }

javascript - Save cropped image from ng-src -

i have been fooling around ngimgcrop , accept file post the image cropper uses ng-src display example of cropped image: ng-src="data:image/png;base64,... i want save cropped image. problem in front-end, have no idea , how go here. is there way save cropped image? assuming know how upload file: convert base64 string blob. file using file uploader blob properties, uploading blob works same. var file = datauritoblob(datauri, 'image/png'); function datauritoblob(datauri, type) { // convert base64 raw binary data held in string var bytestring = atob(datauri.split(',')[1]); // separate out mime component var mimestring = datauri.split(',')[0].split(':')[1].split(';')[0] // write bytes of string arraybuffer var ab = new arraybuffer(bytestring.length); var ia = new uint8array(ab); (var = 0; < bytestring.length; i++) { ia[i] = bytestring.charcodeat(i); } // write arraybuf

c# - OOP - OOD - Which Method should be in which class? -

i wrote programs in procedural language (mostly vb6) since many years. learning c#. read couple of books , things done ask myself: should method in class or in class or somewhere else. here example: write console program scans files in directory tree , set ntfs security files according rules. each “file type” (i.e. invoices, emails, excel files) have template files correct security settings. my program following: read in myapp.exe.config log file should written start log file fill list details “file types” (currently hard coded) read in myapp.exe.config locations , filenames of template files above list more steps i have classes program main method, filework scans through files, securitywork sets ntfs security rights, , applconfig reads , writes configuration information. now question: should put method step 4 in above list? concerns settings securitywork class read via applconfig class. should method in securitywork class because concerns security settings, or shou