Posts

Showing posts from January, 2015

python - TypeError: __init__() takes exactly 2 arguments (3 given) when I try to permute -

how shall permute rows , columns in following example? input_shape = (input_dim, input_features) inputs = input(input_shape) net = reshape(input_shape + (1, ), input_shape=input_shape)(inputs) net passed conv2d. when use inpute_shape = permute(2,1) got error __init__() takes 2 arguments (3 given) thanks! this recent traceback after tried options: traceback (most recent call last): file "app.py", line 372, in <module> train(model_filename=args.model, epochs=args.epochs, dim=args.dim) file "app.py", line 61, in train output_classes=reader.classes) file "/home/ubuntu/calypso_v2/model.py", line 53, in build_model net = permute(3,2)(net) typeerror: __init__() takes 2 arguments (3 given) permute() takes tuple positional argument. instead of tuple (2,1) , you've specified 2 ints 2 , , 1 . try this: inpute_shape = permute((2,1))

ios - How to add a attachment in outlook programatically swift 3 -

i have opened outlook app , send file in it. able open outlook , set to,subject , body not sure how attach file in document directory file @ path var paths = nssearchpathfordirectoriesindomains(.documentdirectory, .userdomainmask, true) let documentsdirectory = paths[0] let filename = "supportdata.log" let logfilepath = (documentsdirectory nsstring).appendingpathcomponent(filename) let scheme : string = "ms-outlook://compose?tosupport@tech.com&subject=support data &body=please find attached file" if let url = url(string: scheme) { uiapplication.shared.open(url, options: [:], completionhandler: { (success) in if (success) { print("open \(scheme): \(success)") } }) }

Android: are coordinate hardcore value's responsive? -

Image
have 3 different type image. when click each section it's going different rooms. tried use https://github.com/lukle/clickableareasimages , https://github.com/catchthecows/androidimagemap these libraries. reason it's not worked.(maybe can't run it) and when runned (not worked thought) 1 idea: clickableareas.add(new clickablearea(500, 200, 125, 200, new character("homer", "simpson"))); clickableareas.add(new clickablearea(600, 440, 130, 160, new character("bart", "simpson"))); my idea: when click image in real device x, y coordination. , when x, y coordination writed following: imageview.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view view, motionevent motionevent) { float x = motionevent.getx(); float y = motionevent.gety(); if(motionevent.getaction() == motionevent.action_down) { ...

javascript - Embedding Tradingview widget in wordpress page -

i extremely beginner of wordpress. need add tradingview widget on wordpress page. code below. <!-- tradingview widget begin --> <span id="tradingview-copyright"><a ref="nofollow noopener" target="_blank" href="http://www.tradingview.com" style="color: rgb(173, 174, 176); font-family: &quot;trebuchet ms&quot;,tahoma,arial,sans-serif; font-size: 13px;">forex heat map <span style="color: #3bb3e4">tradingview</span></a></span> <script src="https://s3.tradingview.com/external-embedding/embed-widget-forex-heat-map.js">{ "currencies": [ "eur", "usd", "jpy", "gbp", "inr" ], "width": "450", "height": "500", "locale": "en" }</script> <!-- tradingview widget end --> the...

Webpack sass-loader Invalid CSS -

i error whenever running build. invalid css after "module.exports": expected "{", '= "data:text/x-scss' i've tried using vanilla js webpack config , same error, it's not typescript config. tried extract-text-webpack-plugin same error. actual app working fine, has no css. here config. import * path 'path'; import * webpack 'webpack' const config: webpack.configuration = { entry: { app: ['./js/main.ts'] }, output: { path: path.resolve(__dirname, './dist/js'), filename: '[name].js' }, module: { rules:[ { test: /\.html$/, loader: 'ngtemplate-loader?prefix=/&module=app&relativeto=' + (path.resolve(__dirname, './js/app')) + '/!html-loader' }, { test: /\.ts$/, loader: 'awesome-typescript-loader' }, ...

d3.js - How to make svg as a layer in Leaflet.js -

recently, doing bubble map using leaflet.js. become painful when want make different layers show bubbles different colors. came 2 solutions, none of them can totally solve problems. solution 1: problem: don't know how assign svg layer like: var tiles = new l.layergroup(); tiles.addto(alltiles); i confused code: map._initpathroot() here code link: http://bl.ocks.org/d3noob/9267535 solution 2: can draw different layers based on code, problem is: zoomed d3.js circles fixed in geographic location on leaflet map constant size. here code link: http://bl.ocks.org/xevil/4921fff1d70f5601d159 i wonder have references can use? thank you.

cocoa touch - iOS 11 & iPhone X: UINavigationBar's toolbar spacing incorrect when embedded in UITabBarController -

Image
i experiencing annoying problem testing newest ios 11 on iphone x simulator. i have uitabbarcontroller , inside each tab there uinavigationcontroller , each uinavigationbar has defined bottom toolbar ( settoolbarhidden: ), , default show @ bottom, on tabbar. it has been working fine far , seems work fine in upcomming iphone 8 , 8 plus models, on iphone x there gap between toolbar , tabbar. guess toolbar doesn't realize displayed inside tabbar , leaves accommodating space @ bottom. i guess way fix using custom toolbar , display/animate myself instead of using defaults uinavigationbar , hear other options :) this how looks on iphone 8. and here problem on iphone x.

Error creating Azure Table using C# -

following steps in article ( https://docs.microsoft.com/en-us/azure/cosmos-db/table-storage-how-to-use-dotnet ), created console application , added following code main method: string connection = "defaultendpointsprotocol=https;accountname=mystorageaccountname;accountkey=myaccountkey;endpointsuffix=core.windows.net"; cloudstorageaccount account; if (!cloudstorageaccount.tryparse(connection, out account)) { throw new exception("unable parse storage account connection string."); } cloudtableclient tableclient = account.createcloudtableclient(); cloudtable table = tableclient.gettablereference("mytable"); // line @ error: table.createifnotexists(); however, got following error when executing last line: could not load file or assembly 'microsoft.data.odata, version=5.6.2.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. loca...

How to export two HTML widgets in the same HTML page in R? -

we intend create html page using r contains 2 (or more) widgets. 1 widget holds timeline , other holds data table dataframe. we able create 2 separate html pages follows: library(timevis) library(htmlwidgets) data <- data.frame( id = 1:4, content = c("item one", "item two", "ranged item", "item four"), start = c("2016-01-10", "2016-01-11", "2016-01-20", "2016-02-14 15:00:00"), end = c(na, na, "2016-02-04", na) ) timevis(data) htmlwidgets::savewidget(timevis(data), "timeline.html", selfcontained = f) the other widget data table follows: acs <- read.csv(url("http://stat511.cwick.co.nz/homeworks/acs_or.csv")) acs_temp <- datatable(acs, options = list(pagelength = 10)) htmlwidgets::savewidget(acs_temp, "page2.html", selfcontained = f) this saves 2 separate webpages hold timeline visualization , html ...

"invalid host header" starting Skeleton Web Application for Hyperledger Developer Guide tutorial -

i'm going through hyperledger developer guide tutorial . i've done steps through generate rest api without trouble. after going through generate skeleton web application section, don't see problems in shell output when try navigate port 4200 instructed, mostly-blank screen says invalid host header . in #composer channel on rocketchat, saw have similar problem . suggested was: because directory specified in hlfv1 profile under keyvalstore cannot created or accessed. have specified directory such /home/fred/.hfc-key-store user fred doesn't exist directory /home/fred doesn't exist. 1 solution create directory path yourself. i checked , directory ok: ibmadmin@pfuntner1:~/repos$ cat /home/ibmadmin/.composer-connection-profiles/hlfv1/connection.json { "type": "hlfv1", "orderers": [ { "url" : "grpc://localhost:7050" } ], "ca": { "url": "http://loca...

php - Why I can't change language in wordpress dashboard? -

Image
good evening, have problem changing language in wp dashboard. in wp-content/languages when change language english in wp settings nothing changed in dashboard , language stay english. new language applied top thank's help! try change language in user profile settings.

Do I need an Apex Class or just a Trigger in order to update a lookup field in Salesforce? -

i working out of sandbox , trying automatically update vendor_rep__c(lookup field) under custom object member_vendor_del__c. update vendor rep when member vendor record created or edited. i have created visualforce page, starting believe no longer need acheive need. also, help, have created following code apex class: public class contactsearch { public list<contact>searchcontact(string contacttype, string memberstate, string vendorid) { return [select name contact contact_type__c = 'vendor rep' , states__c = :memberstate , contact_vendor_id__c = :vendorid limit 1]; } } also, after reading several questions posted, few apex developer guide articles, , watching few tutorial videos, created trigger below. (im not sure need class in order achieve need) trigger vendorrepupdatetrigger on member_vendor_del__c (before insert, before update) { (member_vendor_del__c u : trigger.new){ if (u.vendor_rep__c == null){ u.vendor_rep__c = [se...

ios - How to center view with dynamic height using auto layout -

Image
i'm trying programmatically create view centered inside designated superview. can achieve behavior, centered view not respect dynamic height of content. here function created make happen: static func overlaywithbutton(onview view: uiview, buttontext: string, theme: theme = .dark, action: action? = nil) -> uiview { // create overlay let overlay = uiview() overlay.translatesautoresizingmaskintoconstraints = false let leftinset: cgfloat = 20 let rightinset: cgfloat = 20 // style overlay overlay.backgroundcolor = theme == .dark ? uicolor.black : uicolor.white overlay.alpha = 0.75 overlay.cornerradius = 10 // create button let button = uibutton(frame: cgrect(x: 0, y: 0, width: 100, height: 100)) button.translatesautoresizingmaskintoconstraints = false // style button button.backgroundcolor = uicolor.clear button.settitle(buttontext, for: .normal) button.settitlecolor(theme == .dark ? lightbluebuttontext : uicolo...

python - Selenium finds element but can't send text to it -

Image
i'm trying send text google flights departure city input box. able find when try , send text send_keys error element not visible . how possible selenium able find input box when send keys not available. did not have error until switched firefox chrome webdriver. code below import selenium import webdriver selenium.webdriver.common.keys import keys selenium.webdriver.common.by import selenium.webdriver.support.ui import webdriverwait selenium.webdriver.support import expected_conditions ec class bot: def __init__(self): # self.browser = webdriver.firefox(executable_path='./geckodriver') self.browser = webdriver.chrome('./chromedriver') self.departure_city = "cou" self.destination_city = "hnd" self.departure_day = "december 1" self.return_day = "december 10" self.prices = [] self.run() def run(self): try: self.setflight() ...

PIVOT two tables in SQL server without aggregation -

i have problem converting rows columns. my structure this: select [id_kpi] ,[kpi_value] [dbo].[fact_kpi] select id_kpi ,kpi_label [dbo].[dim_kpi] input and output i'm trying achieve select [nb_departure] ,[nb_arrival] ,[headcount] [dbo].[fact_hr] output you can use pivot below: select nb_departure, nb_arrival, headcount ( select d.kpi_label, f.kpi_value , rown = row_number() over(order d.id_kpi) dbo.fact_kpi f join dbo.dim_kpi d on f.id_kpi = d.id_kpi ) pivot (max(kpi_value) kpi_label in ([nb_departure],[nb_arrival],[headcount])) p output below: +--------------+------------+-----------+ | nb_departure | nb_arrival | headcount | +--------------+------------+-----------+ | 25 | null | null | | 30 | null | null | | null | 15 | null | | null | 7 | null | | null | null | 12 | | null | ...

Switching between iframes using selenium web driver python -

i have come across examples site , others on subject, still have problem figuring out do. i trying switch between frames, , frame header looks this: <iframe frameborder="0" id="mif-comp-ext-gen-top349-264685" name="mif-comp- ext-gen-top349-264685" src="/blah/blah/" style="width: 838px; height: 822px;" title="display changes?"></iframe> the id mif-comp-ext-gen-top349-264685 keeps changing every page load not unique. this have come doesn't work: driver.switch_to.frame(driver.find_element_by_link_text("/blah/blah/")) this wrong because "/blah/blah/" src= not link. how switch frame? use name locator driver.switch_to.frame(driver.find_element_by_name("mif-comp- ext-gen-top349-264685")); or xpath driver.switch_to.frame(driver.find_element_by_xpath("//iframe [@name='mif-comp- ext-gen-top349-264685']"));

storing a .txt file in android -

i have .txt file in android want read. first stored in raw directory want file in many languages , android read file according language of device. know , how should store file? store default text file — want use if nothing else matches — in res/raw/ now. store translations of file other languages in peer directories (e.g., spanish in res/raw-es/ ). this how string resources work in res/values-.../ directories. applying technique text files in res/raw-.../ directories.

android - Packages for cordova are not loading when deployed to a device -

Image
i've got cordova app works great when deployed browser, or loaded browser. however, when app sent device via cordova run android plugins not found. using chrome remote device inspector, can see plugis failing load in expect normal location. in snippet below copy of config.xml items censored. <?xml version='1.0' encoding='utf-8'?> <widget defaultlocale="en-us" id="---censored---" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps"> <name>---censored---</name> <description>---censored---</description> <author email="---censored---" href="---censored---">---censored---</author> <vs:template-name>blankjs</vs:template-name> <content src="index.html" /> <access origin="*...

How Do I Access a Windows Shared Folder on Remote Machine as if It Were Local? -

i've created shortcut shared folder remote machine. however, i'd run scripts folder on remote machine without cutting, pasting, etc. right now, i'm able access folder shortcut. i'd folder on remote machine regular folder. btw, i'm using windows 7 on remote machine, , 10 on local.

c# - Add DbContext to all Classes not just controllers in .NET Core -

i want add current dbcontext whatever class use, moment i'm passing _context common variable. in controller example pass _context every time want create item [httppost("receta/{id}")] [apiauth("medico")] public iactionresult postitemsreceta(int id, [frombody]data[] items) { var tran = _context.database.begintransaction(); //dbb transaction begins try { foreach (data item in items) new item(id, item, _context); //i pass _context this. tran.commit(); return ok(); } catch (exception e) { tran.rollback(); return badrequest("not inserted!!"); } } and in class item have this public class item { [key] public int id { get; set; } public datetime? fcaducidad { get; set; } public string nombre { get; set; } public int32 diagnostico { get; set; } public item() { } public item (int receta, data i, mydbcontext _context) { try { ...

ms access - PowerShell run great but does not run as a scheduled task -

i have powershell script - opens ms access database, run vba script, , later close itself. runs manually. scheduled user in 'administrator' of computer , e local drive. however, when schedule windows task, hangs. codes below. tell me went wrong? $access = new-object -com access.application $access.opencurrentdatabase("e:\audit\audit.accdb") $access.run("fun_run") $access.closecurrentdatabase() $access.quit() [system.runtime.interopservices.marshal]::releasecomobject($access) remove-variable access

swift - Reusable cell or wrong asynchronous image download from JSON data in TableView -

i have application downloads json data api , sets in tableview cells. @ point scrolling up/down in random cell image may change several times before has right image in it. no problems text data whatsoever. @ first thought problem reusability of cell, need destroy data before set new image. added method of tableviewcell cellforrowat path destroy data before setting cell: func destroycelldata() { self.newsimageview.image = nil self.newstitlelabel.text = nil self.taglabel.text = nil } then actual method setting cell: override func tableview(_ tableview: uitableview, cellforrowat indexpath: indexpath) -> uitableviewcell { guard let cell = tableview.dequeuereusablecell(withidentifier: "newscell") as? newstableviewcell else { print("no such cell") exit(14) } cell.loadingimageindicator.startanimating() let data = datamanager.getdata() let datatoinsert = data[indexpath.row] cell.destroycelldata() cel...

artificial intelligence - How to approach making a checkers playing AI based on neural networks? -

i want create neural network based checkers playing ai final year project. don't know start , theory need learn before approaching problem. need know how approach design of neural network particular problem. i ready learn new topics advice helpful.

ghci - parse error (possibly incorrect indentation or mismatched brackets) for Haskell -

i've been writing code in haskell, , ran error above. i've looked on here answer, couldn't find answer fixed problem. makectordecls :: randomgen g => string -> randomstate g [ctordecl] makectordecls tp = rng <- (randomrs (5 :: int, 7 :: int) let listofctordecl = replicatecountm rng (makectordecl (tp)) return listofctordecl replicatecountm :: (applicative m) => int -> (int -> m a) -> m [a] replicatecountm cnt0 f = loop cnt0 loop cnt | cnt <= 0 = pure [] | otherwise = lifta2 (:) (f cnt) (loop (cnt - 1)) it saying failing parse @ "let listofctordecl...." you forgot close paren on line: rng <- (randomrs (5 :: int, 7 :: int) it should be: rng <- (randomrs (5 :: int, 7 :: int))

rest - Instagram Private API: method "upload/photo" return 502 err code -

send request: post https://i.instagram.com/api/v1/upload/photo/ http/1.1 host: i.instagram.com accept: / x-ig-capabilities: 3q4= user-agent: instagram 10.26.0 android (18/4.3; 320dpi; 720x1280; xiaomi; hm 1sw; armani; qcom; en_us) content-type: multipart/form-data, boundary=08115eb7e9ab4b2d91cbd909da597f68 accept-encoding: gzip, deflate, sdch accept-language: en-us x-ig-connection-type: wifi cookie: sessionid=igsce75d8682d023c3fb49d8f36d6b3baaa1d65fb1de6ec3a2e60093609dc641736b%3azysykn402331ai9xkwqurrcsdvv4sw5g%3a%7b%22_auth_user_id%22%3a5967392865%2c%22[...] connection: close cookie2: $version=1 content-length: 76564 --08115eb7e9ab4b2d91cbd909da597f68 content-disposition: form-data; name="upload_id" 1505336507000 --08115eb7e9ab4b2d91cbd909da597f68 content-disposition: form-data; name="_uuid" 08115eb7e9ab4b2d91cbd909da597f68 --08115eb7e9ab4b2d91cbd909da597f68 content-disposi...

wordpress - PHP Woocomerce get product brand name -

i create plugin , want brand name woocomerce. in fist time post product no.1 plugin it's work , product brand wish when create product post no.2 , no.3 brand name product no.1 whats wrong ? if ( class_exists( 'woocommerce' ) ) { $kode = $product->get_sku(); $terms = wp_get_post_terms( $product_id, 'brand', array('orderby'=>'name')); $brands = get_terms( 'brand', array( 'orderby' => 'name' //,'product__in' => $product->id // orderby arguments ('name', 'slug','term_group', 'term_id', 'id', 'description') ) ); foreach ( $brands $key => $brand ) : $brand_name = $brand->name; endforeach; $merk = $brand_name; //this want print brand name echo "<strong>stock ".$merk." ".$kode."</strong><br/>...

sabre - EnhancedSeatMapRQ -SOAP - How to get seat availability for all cabins? -

is there way seat availability cabins available booking without knowing aircraft class/fare types? i checked service documentation , wsdl file couldn't find way that. sample request <ns6:enhancedseatmaprq > <ns6:seatmapqueryenhanced correlationid="50468727"> <ns6:requesttype>payload</ns6:requesttype> <ns6:flight destination="txl" origin="vie"> <ns6:departuredate>2016-02-24</ns6:departuredate> <ns6:operating carrier="ab">8401</ns6:operating> <ns6:marketing carrier="ab">8401</ns6:marketing> <ns6:arrivaldate>2016-02-24</ns6:arrivaldate> </ns6:flight> <ns6:cabindefinition> <ns6:rbd>m</ns6:rbd> </ns6:cabindefinition> <ns6:currency>usd</ns6:currency> <ns6:pos company="ab" multihost="ab"> <ns6:a...

How to account for spaces when using INFILE for txt file in SAS? -

i'm importing following data .txt file. george washington 02/22/1732 12/14/1799 john adams 10/19/1735 07/04/1826 thomas jefferson 04/13/1743 07/04/1826 james madison 03/16/1751 06/28/1836 james monroe 04/28/1758 07/04/1831 andrew jackson 03/15/1767 06/08/1845 john quincy adams 07/11/1767 02/23/1848 william henry harrison 02/09/1773 04/04/1841 i'm using following code: data presidents; infile "g:\deadpresidents.txt"; input name $23. birth mmddyy10. death mmddyy10.; run; this allows me read in name , birthdate correctly, won't read in date of death, because sas thinks space between 2 dates part of death variable. if change birth mmddyy10. to birth mmddyy11. works fine. is there way have sas account spaces separate variables in txt file? able use mmddyy10 since that's length of actual date variable. you move cursor. relative motion input name $23. birth mmddyy10. +1 d...

osx - How to execute robot command in jenkins job on mac? -

i have installed jenkins on mac, set up. in job configuration, execute shell , other command works date, pwd etc. my scripts in location /users/abcd/project/ under project, there multiple folders, never mind. scripts executed project folder execute shell cd /users/abcd/project/ robot --outputdir /users/some_folder --variablefile variables_folder/variable.py testsuites_folder/testsuites/test.robot job fails robot command not found. same command works fine terminal. missing path settings ? missing jenkins config ? it sounds indeed missing path setting. systems in path variable find executables. if location of robot isn't in path, there's no way system find it. either add location of robot program in path, or hard-code full path robot in jenkins command.

python - What change needs to be made to the main function so that each player has exactly three turns? -

currently players have 1 turn each , winner of game never displayed. change needs made main function give each player exactly 3 turns? def main(): display_welcome() #1 number_of_turns = 3 score_player1 = 0 score_player2 = 0 name_player1 = "olivia" name_player2 = "ned" turn_num = 1 first_player_num = random.randrange(1, number_of_turns + 1) if first_player_num == 2: temp = name_player1 name_player1 = name_player2 name_player2 = temp score1 = have_one_turn(turn_num, name_player1) score2 = have_one_turn(turn_num, name_player2) score_player1 = score_player1 + score1 score_player2 = score_player2 + score2 if turn_num < number_of_turns: display_turn_results(name_player1, score_player1, name_player2, score_player2, false) #10 else: display_turn_results(name_player1, score_player1, name_player2, score_player2, true) try following code :: def ma...

objective c - Obj-c - How can I check if NSString contains one OR the other? -

i want check if nsstring 'name' contains "brittany" or "bob", following code doesn't seem trick? viewcontroller.m nspredicate *p = [nspredicate predicatewithformat:@"name contains[cd] %@ or name contains[cd] %@", @"brittany", @"bob"]; nsarray *filtered = [self.messages filteredarrayusingpredicate:p]; any idea should instead? can't seem syntax right. issue 'filtered' not returning arrays in string name containing "bob", ones in name contains "brittany". here self.messages contains: messages data ( { body = "hi"; endswaptime = "<null>"; "first name" = brittany; name = brittany; nid = 1803; "node_title" = "re:"; }, { body = "it brittany"; endswaptime = "<null>"; ...

c - Regex with no 2 consecutive a's and b's -

i have been trying out regular expressions lately. now, have 3 symbols a, b , c. i first looked @ case don't want 2 consecutive a's. regex like: ((b|c + a(b|c))*(a + epsilon) now i'm wondering if there's way generalize problem like: a regular expression no 2 consecutive a's , no 2 consecutive b's. tried stuff like: (a(b|c) + b(a|c) + c)* (a + b + epsilon) but accepts inputs such as"abba" or "baab" have 2 consecutive a's (or b's) not want. can suggest me way out? if can't negative match perhaps can use negative lookahead exclude strings matching aa , bb ? following (see regex 101 more information): (?!.*(aa|bb).*)^.*$

algorithm - How do I determine whether angle A or B is closer to angle C? -

i want calculate whether angle or b closer angle c. i'm sure easy way angles return 0 @ 360 , vice versa confusing me how i'm supposed compare them. right i'm doing this, wrong: similarity1 := degree - targetangle1 if (similarity1 > 360){ similarty1 := 360 - similarity1 } similarity2 := degree - targetangle2 if (similarity2 > 360){ similarty2 := 360 - similarity2 } if (similarity1 < similarity2){ degree := similarity1 } else { degree := similarity2 } the answer must simple reason problem has me confused. if work numbers in range of -180 180, can compare absolute value see less. to numbers -180 180 range, must recognize adding or subtracting 360 angle doesn't change @ all. similarity1 := degree - targetangle1 if (similarity1 > 180){ similarty1 := similarity1 - 360 } else if (similarity1 < -180){ similarity1 := similarity1 + 360 } similarity2 := degree - targe...

How to run a Twisted (python) program in MAC? -

i have installed twisted in mac. $ python python 2.7.10 (default, oct 23 2015, 18:05:06) [gcc 4.2.1 compatible apple llvm 7.0.0 (clang-700.0.59.5)] on darwin type "help", "copyright", "credits" or "license" more information. >>> import twisted >>> twisted.__version__ '13.1.0' >>> import openssl >>> import twisted.internet.ssl >>> twisted.internet.ssl.ssl <module 'openssl.ssl' '/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/openssl/ssl.so'> >>> i have test program named test.tac how can run in mac? can run python script? p.s: im totally new python if that's python script yes, can run on mac. also check twisted documentation page ? http://twistedmatrix.com/documents/current/core/howto/index.html

html - What invisible content to add to a div so it shows up in the page? -

i'm trying make contentless div show in page: <div class="modal-border"></div> .modal-border { background-color: $primary-color width: 5px height: 100% &:before { content: ' ' } } i thought content: ' ' make trick ... div shows when content: 'content' . however, don't want show content. what's best way deal this? for content, add unicode \00a0 non-breaking space. so, div::before { content: "\00a0"; } note it's two colons. you don't need height property , may not need width property. if want set width, you'll need display:inline-block; or block ::before property. make sure specify utf-8 in <head> <meta charset="utf-8">

operators - Write C statement that clears two bits without disturbing the other bits -

my assignment write 1 or more c statements clears (i.e. sets 0) bits 11 , 12 of variable "x" without disturbing other bits using bit-level c-operators. professor says: "the variable "mask", declared below, may helpful." int mask = 0x00001800; int x = arbitrary_value; should using shift operations combined bit-level operations? i'm bit unclear how make happen. @garrett, force or mask values use bitwise operands (&, |, ~, ^). how you. can create mask, 1 created 0x00001800. if convert mask binary this: ‭1100000000000‬. can see starting right bits 11 , 12 ones stay high. now, use mask mask value need know want do. case want force bits 11 , 12 of variable 0, so, force 0 can use , bitwise operand (&) passing 0 want force 0 , 1 want stay how on other variable. if want use mask 0x1800 operation must first invert bits, because want 0s right mask has 1s , 1s right has 0s. invert bits can use not bitwise operand, like: int mask = 0...

hibernate - java.lang.IllegalArgumentException: Unable to locate persister -

i working on project migrated wls8 wildfly 10. hibernate 3.3 (implementation of jpa) used in wls8. however, wildfly 10 doesn't support version use default hibernate (version 5) bundled wildfly 10. but got run time error: error [stderr] (default task-32) java.lang.illegalargumentexception: unable locate persister: com.x.switch.entity.loc here file/class structure in .war : --web-inf   --classes     --com     --meta-inf       --persistence.xml   --lib   --web.xml   --jboss-web.xml i couldn't figure out why entity not found (as under classes , packaged in war file). ironically after list entities in persistence.xml, error gone. it's fixed still don't understand why need since every entity annotated.

jquery - Ajax Count all hydra:totalItems -

Image
i have make ajax counts month of submitted ticket, example, jan:4 tickets, feb:12 tickets, etc. here code: function createdatchart(callback, createat) { $.ajax({ url: '/api', type: 'post', data: { module: 'helpdesk/tickets', method: 'get', // params: [{'createdat':createat}] params: [ { 'createdat' : { 'before': createat } } ] }, success: function (data, textstatus, jqxhr) { var data = json.parse(data); var total = data['hydra:totalitems']; console.log(total); //output 68 var d = moment(data.createdat).month();// output 8 //8 means september createat = d; console.log('total = ', total); // output = 68 ...

ios - Extension for view controller using Bool in Swift -

i'm try make extension view controller. simple view tap recognizer. if pushed once, background color should change magenta orange. next push should magenta again. if concrete vc, let say, startvc, works. here code: import uikit class startvc: uiviewcontroller { // bool var colorchanged = false override func viewdidload() { super.viewdidload() view.backgroundcolor = uicolor.magenta setmytouchableview2() } } extension startvc { // make touchable view func setmytouchableview2() { let myview = uiimageview(frame: cgrect(x: 100, y: 100, width: 50, height: 50)) myview.backgroundcolor = uicolor.yellow // add gesture recognizer let tapgesturerecognizer = uitapgesturerecognizer(target: self, action: #selector(changecolor2(_:))) myview.addgesturerecognizer(tapgesturerecognizer) myview.isuserinteractionenabled = true view.addsubview(myview) } func changecolor2(_ recog...

email - make a variable the text inside a cell -

i sending emails spreadsheet. want value of b2 body of email. way can type cell b2 want in message. have script set send charts , data contained in sheet, , works. when tried set body of email value of cell b2, sends message says "range" , adds charts. my code looks far function emailparentsupdates(sheet,emails,emailsubject){ var targetspreadsheet = spreadsheetapp.getactivespreadsheet(); var sheet = targetspreadsheet.getactivesheet(); var emailsubject = 'grades update'; var charts = sheet.getcharts(); var startrow = 1; // first row of data process var numrows = 1; // number of rows process var datarange = sheet.getrange(startrow, 1, numrows, 1) var data = datarange.getvalues(); (i in data) { var row = data[i]; var emailaddress = row[0]; // first column var teacheremail = "efazekas@dcsdk12.org" if(charts.length==0){ mailapp.sendemail({ to: teacheremail, subject: "error:"+emailsubject...

algorithm - Min number of Elements To generate all other elements using xor -

i have n integers a_1, ..., a_n . want pick minimum number of them xor forms others. for example, consider [1,2,3] , 1^3=2 don't need 2 in array. can remove it. end [1,3] . min number of elements 2 , can form original elements in array xoring 2 of them. greedy approach work here? or dp? edit: explain thinking. greedy approach thought due fact if a^b=c a^c=b , b^c=a . first delete duplicates. first in beginning list pairs each element can pair form element in array. takes o(n^3) preprocessing. pick element least contribution , delete , subsequently subtract 1 each of other elements. repeat until elements have <=2 pairs. , stop. take o(n^3) total of o(n^3) . greedy approach work? there dp way it? if n bounded 50 think backtracking should work. suppose @ step have selected subset s of numbers (that should produce others) , want include new number subset. can following: consider remaining numbers r , include in s numbers can't produced others (in...

php - Passing class from another class or dependency injection -

i'm having difficulties understand given code , reason behind dependency injection. i've got following error: uncaught error: call undefined method question::getfullname() in c:\xampp\htdocs\oop\index.php:10 stack trace: #0 {main} thrown in c:\xampp\htdocs\oop\index.php on line 10. even if instantiate object of author class in constructor, keep getting string in question class once try use getquestion() . require 'author.php'; class question { private $author; private $question; public function __construct($question, author $author) { $this->author = $author; $this->question = $question; } public function getauthor() { $firstname = $this->author->getfirstname(); $lastname = $this->author->getlastname(); $fullaname = $firstname . $lastname; return $this; } public function getquestion() { return $this->question; } } <?php class author { private $firstname; private $lastname; p...

xampp - PHP : I need to read value from ur "www.smple.com/sample.php/value in php -

i need read value url in php code. below sample url . passing value after php file name. know can use query string "www.smple.com/sample.php?name=value" but requirement url need filename/value, value dynamic. please 1 can me solve issue. url : www.smple.com/sample.php/value use parse_url path url , use explode split segments. $uri_path = parse_url($_server['request_uri'], php_url_path); $uri_segments = explode('/', $uri_path); echo $uri_segments[1];

Is it necessary to first connect raspberry pi 3 with adb then develop the android things project -

i new android things. tried build android things app on android studio 2.3.3 25 sdk. when wrote android things support library dependency of app module app.gradle file. , pressed 'synce now' button, gives me error... "install repository sync" plz me. loved develop android things app... you don't need connect raspberry pi develop android things project. there 3 points have keep in mind while developing android things: update sdk tools version 25.0.3 or higher. update sdk android 8.0 (api 26) or higher. in order access new apis things, must create project or modify existing project targets android 8.0 (api level 26) or higher. add library. in case, need install latest bulid tools, , repositories develop android things project. build.gradle should this: apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "25.0.3" defaultconfig { applicationid "com.android.androidthings.id...

Ajax, PHP, SQL, and JavaScript -

i ran issue cannot find answer, ask questions here, rather stumped. assistance shall appreciated. this php receives ajax call. <?php session_start(); $_session["my_data"] = $_post['action']; $db_hostname = 'localhost'; $db_username = 'username'; $db_password = 'password'; $link2 = mysqli_connect($db_hostname,$db_username,$db_password) or die('unable establish db1 connection'); mysqli_select_db($link2, '$db_username'); $orderquery = mysqli_query($link2, "select * table id='".$_session['my_data']."'"); $orderquery = mysqli_fetch_assoc($orderquery); $orderinfo = " <table class='table table-striped'> <tbody> <tr> <td>#: </td> <td>". $_session['my_data'] ."</td> </tr> <tr> ...

Linux Server Configuration -

when configure cron scripts automatically manage package updates typing in terminal: sudo apt-get install unattended-upgrades` sudo dpkg-reconfigure --priority=low unattended-upgrades` terminal screenshot why these commands don't install?

angular - IONIC 2 native Network.onDisconnect() running code twice -

i working ionic 2 rc1 , using sublime text editor. need check if network connection connected or not. purpose using ionic native network purpose. facing problem network.ondisconnect() observable. have edited initializeapp() method in check network connection , show alert if connection got disconnected. have following code written in app.component.ts showalert(title, msg) { let alert = this.alertctrl.create({ title: title, subtitle: msg, buttons: ['ok'] }); alert.present(); } initializeapp() { this.platform.ready().then(() => { // okay, platform ready , our plugins available. // here can higher level native things might need. let disconnectsubscription = network.ondisconnect().subscribe(() => { this.showalert("error", "no internet connection"); }); statusbar.styledefault(); }); } the problem facing alert shown twice if application disconnected internet. have ...

design patterns - Keep camel route active during a specific time range -

i have camel route consuming jms queue. have ensure, route runs during specific time range , stopped otherwise. what best design pattern that? can't find appropriate enterprise pattern or component option. my idea quartz-job start/stops route. thx have @ http://camel.apache.org/cronscheduledroutepolicy.html you can write cron expression , add route startup policy.

c# - Google docs embedded document not showing until resize? -

Image
i have problem in sometimes (not clear when exactly), displaying embedded document docs.google.com not show document until resize browser window. grab popcorn, here's movie shows problem: here's code: html: <iframe runat="server" id="frame" style="width:100%;height:600px;border:0;"></iframe> c# code begind (in page_load method): frame.attributes["src"] = "https://docs.google.com/gview?url=https://example.com/1.doc&embedded=true"; i tried reproducing browsing directly https://docs.google.com/gview?url=https://example.com/1.doc&embedded=true never happens way. note : document never displayd @ all, if never loaded, , iframe remains totaly blank. any ideas how fix this? you try setup default document size. print envelopes google docs var envelope10={}; envelope10[documentapp.attribute.page_height]=296; envelope10[documentapp.attribute.page_width]=684; envelope10[docu...

security - ID token or /userinfo for Identity assertion -

after authenticating provider, application receive both id token , access token on behalf of user. seems there 2 ways assert user is. verify id token , read id token. pass access token userinfo endpoint , read json response. both seem acceptable avenues, there scenarios in 1 or other should used? if have both tokens , id token contains info need, can use either way. below few differences came mind: verifying , reading id token can done without accessing oauth2 server (if have certificate downloaded locally), makes faster , there fewer possible errors deal - no network requests. if user info changing often, id token contain obsolete data, it's hardly ever case. access tokens can revoked (id tokens cannot), if need it, job better.