Posts

Showing posts from February, 2013

c# - cannot use Directory.GetFiles to get the server path -

in view mode, use following code, works for (int i=1; i<=3; i++) { string imgpath = "/temp/2490/" + i.tostring() + ".jpg"; <img width="200" height="200" src="@url.content(imgpath)" /> } i want let user view documents , download it, use following code , folder routes c:/temp/2490, , chrome don't let me view local files, wrong following codes? foreach (var file in directory.getfiles(@url.content("/temp/2490"), "*.jpg, *.pdf", searchoption.alldirectories)) { <li> <a href="@url.content(file)">document</a> </li> } directory.getfiles takes path parameter. not url. here want pass @"c:\temp\2490 .

python - Can InsecureRequestWarnings be disabled in the requests module? -

this post explains how disable warnings in urllib3, i'm using session object requests module. warnings occurring because verify (ssl) parameter set false in order access page. e.g. url = "https://www.booking.com/searchresults.en-gb.html" querystring = {"label":"gen173nr-1dcaeoggjcalhysdnibw5vcmvmcgv1c19vcogbazgbmbgbb8gbddgba-gbafgbapicaxmoagm","lang":"en-gb","sid":"5f9b0b3af27a0a0b48017c6c387d8224","track_lsso":"2","sb":"1","src":"searchresults","src_elem":"sb","error_url":"https://www.booking.com/searchresults.en-gb.html?label=gen173nr-1dcaeoggjcalhysdnibw5vcmvmcgv1c19vcogbazgbmbgbb8gbddgba-gbafgbapicaxmoagm;sid=5f9b0b3af27a0a0b48017c6c387d8224;class_interval=1;dest_id=30;dest_type=country;dtdisc=0;group_adults=1;group_children=0;inac=0;index_postcard=0;label_click=undef;mih=0;no_rooms=1;offset=0;postcard=

Get Wordpress to URL-Encode Image uploads -

wordpress 4.4 appears have bug images added through editor in visual composer (tinymce?) not url-encoded. cause errors on image paths spaces when wp automatically generates srcset attribute. eg: <img src="/name spaces/image.jpg"> should be: <img src="/name%20with%20spaces/image.jpg"> due plugin/theme incompatibilities can't upgrade newer version of wp (yet) wondering if has run before , knows fix. fix has happen in php when page saved because otherwise wordpress generates srcset attribute invalid, eg: <img src="/name spaces/image.jpg" srcset="/name spaces/image-50x50.jpg 50w"> spaces in srcset cannot "safely" ignored browser in src because spaces delimiter between urls , sizes.

c# - How to flush socket pools and clear Dns cache in all browsers pragmatically -

after changing hosts file >> need clear dns cache , flush socket pools without restarting browsers doing following link in windows 7 flush command line using ipconfig /flushdns , nbtstat -r still need close browsers changing host check update in production server , local server there way code using c# or executable tool??

tidyverse - Match associated factors into new columns in R -

using below data, make generalized convert single column factors separate linked columns. here 'letters' column create 2 new columns 'a' , 'b'. data <- data.frame(letters = c("a", "a", "b", "c"),ints = c(1, 2, 1, 1), reals = c(.01, .22, .01, .02)) letters ints reals 1 0.01 2 0.22 b 1 0.01 b 1 0.02 would return this. ints b 1 .01 na 2 .22 na 1 na .01 1 na .02 is there way using tidytext example? or perhaps expanding on work: model.matrix( ints ~ letters + reals, data = data ) there should not c in letters variable showed in data.frame. you can using dplyr , tidyr if have many letters data1 <- data %>% dplyr::mutate(id=seq_len(nrow(.))) %>% tidyr::spread(letters, reals) %>% dplyr::arrange(id) > data1 ints id b 1 1 1 0.01 na 2 2 2 0.22 na 3 1 3 na 0.01 4 1 4

swift3 - Multiple Animated Transitions in Swift -

i have nested uistackview holds uiimageviews. want each uiimageview flip progressively reveal single large uiimageview. code shows single view, there no animation it...it shows immediately. can't figure out why there isn't cascading effect on few seconds. newimage full screen image. imagearray randomized array of smaller images should flipping disappear. private func flipimage(newimage: uiimage, imagearray: [uiimageview]) { let randomimage = imagearray.first! let abscoordinates = randomimage.convert(self.view.frame, to: super.view) let absframe = cgrect(x: abscoordinates.origin.x, y: abscoordinates.origin.y, width: randomimage.frame.width, height: randomimage.frame.height) if let croppedimage = newimage.cgimage?.cropping(to: absframe) { let croppedimageview = uiimageview(frame: absframe) croppedimageview.image = uiimage(cgimage: croppedimage) croppedimageview.ishidden = true self.view.addsubview(croppedimageview)

python - ImportError: No module named blahblah, but it's in the working directory -

i'm not python programmer, assume rookie question. i'm importing cython file script in python (the file extension of cython file pyx if makes difference). using this; from im2col_cython import col2im_cython, im2col_cython here error get; from im2col_cython import col2im_cython, im2col_cython importerror: no module named im2col_cython the file in same folder script imported in, have set working directory folder (just incase there issue that). i'm using anaconda, python 2.7, windows 7. i've been trying fix around 4 hours, seems simple error first real foray python.

ios - How to pass data from view controller to a navigation controller and then to another view controller? -

i have data view controller want pass view controller, have set present modally, have navigation controller between them. how pass data first view controller through navigation controller second view controller? i have code in first view controller: override func prepare(for segue: uistoryboardsegue, sender: any?) { if segue.identifier == "presentpopup" { let destviewcontroller = segue.destination as! navigationviewcontroller destviewcontroller.mydata2 = mydata } // new view controller using segue.destinationviewcontroller. // pass selected object new view controller. } then code in navigation controller: override func prepare(for segue: uistoryboardsegue, sender: any?) { let destviewcontroller = segue.destination as! secondviewcontroller destviewcontroller.mydata3 = mydata2 } but doesn't work. you can use in first viewcontroller: override func prepare(for segue: uistoryboardsegue, sender: any?) { if

django - ImportError: No module named corsheaders -

installed_apps = [ 'login.apps.loginconfig', 'mainsaaas.apps.mainsaaasconfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', ] middleware = [ 'django.middleware.security.securitymiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'corsheaders.middleware.corsmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', ] cors_origin_allow_all = true even installed pip install django-cors-headers. shows import error corshea

javascript - Trying to remove html from a package I downloaded -

i've downloaded trumbowyg wysiwyg editor: http://alex-d.github.io/trumbowyg/ site. toolbar has lot of buttons text align, quoting, etc., don't need. want remove it, i'm not sure how because there isn't html file, because buttons seem generated javascript. i've gone js file lists buttons this: btns: [/* ['viewhtml'], ['undo', 'redo'],*/ ['formatting'], 'btngrp-semantic', /*['superscript', 'subscript'], ['link'],*/ ['insertimage'],/* 'btngrp-justify', 'btngrp-lists', ['horizontalrule'], ['removeformat'], ['fullscreen']*/ ], as can see i've left couple buttons. doesn't anything. buttons still appear. can set buttons display:none , isn't semantically. , doesn't work each button nested i

Multiple MySQL catalogs on EMR/PrestoDB -

i'm able create catalog called mysql on emr using presto-connector-mysql configuration options on emr. however , i'd connect multiple mysql datasources. adding 2nd datasource /etc/presto/conf/catalog , doing restart presto-server isn't quite right, because while can query mysql datasource correctly , 2nd catalog shows up, querying table there gives: query 20170407_040307_00008_qjgse failed: no nodes available run query is there way reset whole cluster? need install new catalog on nodes? you need install new catalog in /etc/presto/conf/catalog on of nodes, , restart presto. should work fine you.

node.js - Slackbot running on express server, add response to store -

i trying make a simple slack bot work, @ time of day, private message sent out asking team member has learnt day, , want store response data store, , array of objects, team can reference when need know knows what, etc. i using slackbots node wrapper calls, , bot running on express server want use hand db stuff (it filesystem db @ moment diskdb). can functions of bot work, easy enough, don't know how can save message response db. the bot code this const slackbot = require('slackbots'); const http = require('http'); const bot = new slackbot({ token: 'xoxb-161286416421-euhc2t0a96gsykddjpk2zjrt', name: 'botivate' }); const params = { icon_emoji: ':robot_face:' } const options = { host: 'localhost', port: '9000', path: '/responses', method: 'post' }; bot.on('start', function() { bot.postmessagetouser('locky', 'botivate online', params); }); bot.on('message&

javascript - Express 4 use multer as middleware got error -

var express = require('express'); var router = express.router(), multer = require('multer'); var uploading = multer({ dest: __dirname + '../public/uploads/', }) router.post('/upload', uploading, function(req, res) { console.log('uploaded'); }) i got error route.post() requires callback functions error following photo upload tutorial here. maybe it's cause newer version of expresss? remember above way how put middle in route, why here doesn't work? basing on multer docs , seems have use uploading.single() or uploading.array() middleware. example obtained example usage in multer docs: var upload = multer({ dest: 'uploads/' }) app.post('/profile', upload.single('avatar'), function (req, res, next) { // req.file `avatar` file // req.body hold text fields, if there })

c++ - Reading Linked List from txt file (comma separated) -

i wondering what's best way read linked list text file? i've got write file system working, i'm unsure of how can "reverse" such , populate linked list? he's current write file code: void linkedlist::writefile() { ofstream myfile; node* thisnode = head; myfile.open("example.txt"); { myfile << thisnode->shape<< ","; myfile << thisnode->colour << ","; myfile << thisnode->size << ","; myfile << thisnode->type << ","; myfile << thisnode->volume << ","; myfile << thisnode->density << ","; myfile << thisnode->capacity << ","; myfile << "\n"; thisnode = thisnode->nextnode; } while (thisnode != null); myfile.close(); } i'm open suggestions! :) thanks

java - xxx.hbm.xml not found but it actually exists -

Image
i error when run tomcat: caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory' defined in class path resource [beans.xml]: invocation of init method failed; nested exception is org.hibernate.mappingnotfoundexception: resource: com/itheima/elec/domain/electext.hbm.xml not found but exists in project: and in hibernate configuration below: <session-factory> ... <mapping resource="com/itheima/elec/domain/electext.hbm.xml"/> <mapping resource="com/itheima/elec/domain/eleccommonmsg.hbm.xml"/> </session-factory> i don't know issue is, can friend me? please use @annotations classes inside domain folder,then no need use hbm.xml files. after in hibernate.cfg.xml file use ''

php - Escaping text in Wordpress using built in functions -

not sure extent need escape in wordpress. building child theme on local machine, , want make sure secure. so when ever echo data contained in variable using this: esc_html_e( $user_info->first_name, 'onepress' ); now if have html element following: <span class="subscribetext">subscribe</span> would need escape this: <span class="subscribetext"><?php esc_html_e( 'subscribe', 'onepress' ); ?></span> or going far. cheers

php - What is the best WooCommerce hook for implementing custom coupons? -

i have plugin allows using coupons stored on separate system. using various filters (e.g., woocommerce_get_shop_coupon_data ) coupon code entered checked against web api see if it's valid remote coupon. it's added cart , reflected in total normal wc coupon. the issue arises when want update coupon (e.g., increase usage count, decrease balance) when order placed. right using woocommerce_order_status_processing. triggered late , when redeeming coupon fails, order placed anyway (even though throw exception). what need payment , coupon redeeming atomic process. biggest problem right people can place orders invalid coupon codes (again, these not wc coupons!). p.s. coupons cannot added cart if they're invalid. issues arises when adds valid coupon 2 carts, places order each card -- second order may have refused here.

bash - Executing A complex Shell command read as String from a File in Python -

i have configuration file user can specify set of shell commands. commands chain of pipe-separated shell commands. cmd1 = grep "someotherstring" | grep "xx" | cut -d":" -f9 | cut -d"," -f1 cmd2 = grep "someotherstring" | tail -1| cut -d":" -f9 | cut -d"," -f1 | cut -d"[" -f2 | cut -d"]" -f1 i able read commands in python scripts. question how able run these read command strings in python , output. any solution subprocess , plumbum , sh acceptable. use subprocess.check_output () output = subprocess.check_output(output) something aware of unlike other subprocess commands, subprocess.calledprocesserror raised if non-zero error code returned. you shouldn't need this, in case comes in handy out there, did run experience once reason above solution did not work, , so, instead, did following. stdout_fh = io.stringio() stderr_fh = io.stringio() redirect_stderr

Angular 2 how to display .pdf file -

i new in angular2. i have pdf file want display on popup open time angular2 module or component can use show pdf file. thanks. have taken @ module https://www.npmjs.com/package/ng2-pdf-viewer ? remember declare in module so import { browsermodule } '@angular/platform-browser'; import { ngmodule } '@angular/core'; import { formsmodule } '@angular/forms'; import { httpmodule } '@angular/http'; import { pdfviewercomponent } 'ng2-pdf-viewer'; import { appcomponent } './app.component'; @ngmodule({ declarations: [ appcomponent, pdfviewercomponent ], imports: [ browsermodule, formsmodule, httpmodule ], providers: [], bootstrap: [appcomponent] }) export class appmodule { }

Amazon S3 server logging : configure how often log files are generated -

i have bucket on s3 wish special information (how many times files downloaded, how many unique people, etc.). s3 not provide such information through api, enabled server access logging . however, each log file seems have 1 single entry, means lot of files not info. docs : amazon s3 periodically collects access log records, consolidates records in log files, , uploads log files target bucket log objects. not sure periodically means them, love have way 1 log file/day, example. have yet find way configure way. anyone encountered same problem ? thanks its random, in not regular intervals. have seen 5 per hour , single lines per file on low traffic buckets , 5 per minute high traffic buckets many lines per file. have aggregate logs anyway. seem have small log files maybe use script this . if lots of traffic may want use log analysis service.

android - ref counts can't go to zero here: stable=0 unstable=0 -

// caused by: java.lang.illegalstateexception: ref counts can't go 0 here: stable=0 unstable=0 // @ android.os.parcel.readexception(parcel.java:1628) // @ android.os.parcel.readexception(parcel.java:1573) // @ android.app.activitymanagerproxy.refcontentprovider(activitymanagernative.java:3601) // @ android.app.activitythread.releaseprovider(activitythread.java:4950) // @ android.app.contextimpl$applicationcontentresolver.releaseunstableprovider(contextimpl.java:2025) // @ android.content.contentresolver.opentypedassetfiledescriptor(contentresolver.java:1157) // @ android.content.contenter code hereentresolver.openassetfiledescriptor(contentresolver.java:944) // @ android.content.contentresolver.openinputstream(contentresolver.java:664) // @ com.android.music.musicutils.getartwork(musicutils.java:1239) // @ com.android.music.mediaplaybackservice$notificationasynctask.doinbackground(mediaplaybackservice.java:1809) // @ com.android.music.mediaplaybackservice$notific

php - Woocommerce Subscriptions how to force sending renewal order email? -

i have payment gateway plugin works wcs hook woocommerce_scheduled_subscription_payment_ works fine not customers has recurring payments enabled them informed new order created. seems wcs not send such kind of emails if payment gateway announced supporting recurring payments. if autopay fails try execute wc_subscriptions_email::send_renewal_order_email($order->id); but doesn't send email @ all.

html - How to convert two views into partial views and add to a view. The two views also include separate actions in a controller -

requirement: 2 views separate actions each exists in controller. need convert 2 views single view making them partial view. how can it, there exists 2 separate actions. how invoke them simultaneously. please provide solution. existing scenario: 1.view1.cshtml action1 2.view2.cshtml action2 required scenario: 1. newview partialview1 , partialview2 actions @{ viewbag.title = "intake"; } <div class="row"> @html.action("newintake", "intake") </div> <div class="row"> @html.action("searchintake","intake") </div> actions: public async task<actionresult> newintake(int? trackingnumber = null) { ... } public async task<actionresult> searchintake() { ... } i tried above approach create view. facing below issue. `{"error executing child request handler 'system.web.mvc.httphandlerutil+serverexecutehttphandlerasyncwrapper'."}`

Ignite C++ client mode, Near cache -

i have ignite server running in replicated mode , many clients on same node has near cache enabled. don't find significant performance difference when run client near cache , without near cache. my understanding of near cache used key , value stored on client itself, there won't actual get() call made server. please correct me if wrong. can share working near cache configuration xml. server config: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <bean id="grid.cfg" class="org.apache.ignite.configurati

How to create multiple folders inside another folder using php? -

initially created folder name coming sql result stored in variable after creating folder want create 2 folders inside folder.so below 3 lines have written creating folders. mkdir($r,0777,true); //creating first folder without error mkdir($r/'input',0777,true); // not able create folder inside first folder mkdir($r/'output',0777,true); //not able create folder inside first folder $r/'input' not valid path here. it's not string, because you're doing arithmetic operation here. need put / string , concatenate $r using dot: $r . '/input' the same output folder. try do: mkdir($r,0777,true); mkdir($r . '/input',0777,true); mkdir($r . '/output',0777,true);

javascript - Check for checkbox value after Google Map has loaded -

i think i'm missing basic javascript. use help! scenario: after clicking "search" google map loads. loads, checkbox appears says, "redo results when map moved" (similar yelp). if map dragged or zoomed, results update. part works fine. problem: value of checkbox (true or false) recognized redo() function when map loads, , doesn't check again after (because though redo() updating results it's not reloading map). if toggle checkbox, "redo" function doesn't notice! simplified code: //haml %input{:type => "checkbox", :id => "followcheck", :name => "followcheck", :onclick => 'handleclick();'} //load map function showlocations() { map = new google.maps.map(document.getelementbyid("map_canvas"), { bunch of map stuff; map.fitbounds(bounds); redo(); //this redo function, see below } } function handleclick(checkbox) { var chk = document.getelementbyid(&q

javascript - JQuery trigger() not working -

$(function(){ $('.parent-class h3').click(function(){ $(this).siblings('p').find('a').trigger( "click" ); //var h = $(this).siblings('p').find('a').attr( "href" ); //alert(h); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <div class="parent-class"> <p class="child-class"> <a href="hello.jpg" data-rel="lightbox-1">lightbox image</a> </p> <h3>title here</h3> </div> i have used lightbox in website. want show lightbox while click on h3 tag. have alert a href(commented line) working fine. not working trigger. please see above code. , tell me why trigger('click') not working in code. thank you edit - forgot lightbox. simple anchor link not working. change

javascript - Changing the text size for subtitles in Shaka Player -

we looking use shaka player , have played around demo of player here: https://shaka-player-demo.appspot.com/demo/ . 1 of requirements have user able change text size of closed captions. see have option toggle cc option in demo, couldn't find related modifying displayed text. i did debug this.player_ object see if there available tweak displayed subtitle text, couldn't find anything. is there api available or not possible this? thanks help! you can change appearance altering style - using css - of shadow dom elements generated when subtitles injected shaka. in case using ::cue pseudoelement this: ::cue { font-size: 12px; } see more here: https://w3c.github.io/webvtt/#styling (note not mentioned there may implemented in current browsers)

sas - Transpose rows to columns -

Image
my input data: preferred output data: my best try: which wrong because includes idnumber 2 , 4. data: data work.transpose_csv; length idnumber 8 start_end $ 5 date 8 ; format idnumber best1. start_end $char5. date yymmdd10. ; informat idnumber best1. start_end $char5. date yymmdd10. ; input idnumber : ?? best1. start_end : $char5. date : ?? yymmdd10. ; datalines; 2 start 1994-05-01 2 end 1996-11-04 4 start 1979-07-18 5 start 2005-02-01 5 end 2009-09-17 5 start 2010-10-01 5 end 2012-10-06 ; run; my best try: proc transpose data=transpose_csv out =wide; idnumber; id start_end ; run; as shown post can done in r, need in sas: spread duplicate identifiers (using tidyverse , %>%) the problem proc transpose here can have multiple

Android TV application doesn't support Amazon FireTV -

Image
while creating android tv app minimum sdk level can select api-21(lollipop). creating android tv app android studio supports amazon firetv have select minimum sdk level api-17 (jellybean), amazon fire tv add-on available in api-17. can please correct me if wrong/ please me out how can create app supports fire tv. i have amazon firetv testing , default android studio tv project , runs fine, maybe problem isn't sdk source itself.

wordpress - installed jetpack on localhost does not work -

i have installed , activated jetpack on local host site ( http://localhost:8080/portal/ ), not work. after installing can not see button "connect wordpress.com " , jet pack has been added dashboard. read on net after installing , activating, green picture of jet pack icon comes top of page , can click "connect wordpress.com" , me nothing happened , can not see button "connect wordpress.com "

Which package is better among WPAPI and wordpress-rest-api on NPM -

links both packages here wordpress-rest-api wpapi which of these packages better use , why? i'm author of both, can clarify this: they're different versions of same package! wordpress-rest-api older version, renamed wpapi consistency , brevity prior our 1.0 release. if install wordpress-rest-api should deprecation notice instructing use wpapi instead. wpapi used going forward future releases.

c# - How to add foreign key in AspNetUser Asp.net MVC -

i searched answer 2 days , still did not find easy step-by-step answer question. as can see, point need have connection between 'boeking' , 'aspnetuser'. 1 aspnetuser can have multiple 'boeking'. this screenshot of mssql: enter image description here what should write, in place have connection? thank sincerely taking time , effort me. this boeking class: public partial class boeking { [system.diagnostics.codeanalysis.suppressmessage("microsoft.usage", "ca2214:donotcalloverridablemethodsinconstructors")] public boeking() { this.hotelboekings = new hashset<hotelboeking>(); this.tickets = new hashset<ticket>(); } public string netuserid { get; set; } public int boekingid { get; set; } public int trajectid { get; set; } public system.datetime datumboeking { get; set; } public system.datetime vertrekdatum { get; set; } public int reservatienr { get; set; } pub

insert large sequenced list into mysql delicatedly -

assuming target table's structure id,number ,now want insert 100,000 records number value 1 100,000. there delicated way? for me, concat values string insert test(number) values(1),(2),... . , if inserted num big,spit sql several insert sql avoid packettoobigexception in jdbc.

c++ - Passing template parameters to base class, concise notation -

is there more consice way pass parameters base template class? template <class ii, class ici> class graphbase : public graphbaseofbase<ii, ici> { ... }; template <> class graphbase<std::vector<int>::iterator, std::vector<int>::const_iterator> : public graphbaseofbase< std::vector<int>::iterator, std::vector<int>::const_iterator> { ... }; you might use using shorten primary types used, like: using vec_it = typename std::vector<int>::iterator; using vec_cit = std::vector<int>::iterator; and then template <> class graphbase : public graphbaseofbase<vec_it, vec_cit> { //... };

php - How do i open a Prestashop 1.6.1.x Back office controller in a fancybox? -

i'm developing prestashop 1.6.1.x module has office settings page. page want have link index.php?controller=adminthemes , have open in modal/fancybox. how load fancybox js , css, can use class="fancybox" on link? how tokenize link? is possible link controller "naked", not including header, footer, , left menubar? ps: want echo out in php, not smarty, if share both php , smarty-way, think helpful more people. fancybox automatically loaded on every admin page. basically need display simple link in page. <a class="fancybox" href="{$link->getadminlink('adminthemes')}&litedisplaying=1">link description</a> and add javascript (function ($) { $(document).ready(function () { $('.fancybox').fancybox({ width: '90%', height: '90%', type: 'iframe', title: '' }); }); })(jquery); $link-&g

javascript anonymous function add arguments dynamic -

i hava question javascript anonymous function. the origin function: !function (n) { return n[0].call(1, 2,3); } ([function (n, t, i) {alert(1);}, function (t) {} ]); my problem how add new function dynamicly anonymous function ' arguments this !function (n) { return n[0].call(1, 2,3); } ([function (n, t, i) {alert(1);}, function (t) {},function (t) {alert('new function');} ]); if asking how dynamically add function array of functions: function f(n) { return n[2].call(1, 2,3); } var functionarray=[ function (n, t, i) {alert(i);}, function (t) {} ]; var fnew= function (t) {alert('new function');} functionarray.push(fnew) f(functionarray);

sql server - Incorrect syntax when import sql file from MySQL to MS SQL via SQLCMD -

i have large .sql files exported mysql, , try import them ms sql(localdb) via sqlcmd . when type in following command-prompt: sqlcmd.exe -s (localdb)\mssqllocaldb -i c:\users\administrator\desktop\1\sqlquery4.sql i got following error message: incorrect syntax near 'tblo' i checked .sql file, seems sqlcmd can't understand double quotes e.g. insert "tblo" values (2,'dtt','10000286','dp','y',2,38,'2010-02-22 11:03:51','2010-02-22 11:03:51'); however, it's fine ssms any idea solve problem? i found solution myself: can add --skip-quote-names flag when dump data mysql e.g. mysqldump.exe -hlocalhost -uusername -ppassword --compatible=mssql --no-create-info --skip-quote-names --skip-add-locks database tblo > d:\test\dump.sql result in dump.sql like: insert tblo values (2,'dtt','10000286','dp','y',2,38,'2010-02-22 11:

ios - How can I get location from app in background/foreground after every 5 min -

how can it? -(void)updatelocation { [self performselector:@selector(updatelocation) withobject:nil afterdelay:300]; [self.locationtracker updatelocationtoserver]; } but it's not working every time. try use nstimer nsinteger minutes = 5; [nstimer scheduledtimerwithtimeinterval:60 * minutes target:self selector:@selector(updatelocation) userinfo:nil repeats:yes];

php extension - where is the openssl.so file located in the system? -

working on linux system. openssl extension enabled shows in phpinfo(). openssl.so file in system. running command :"php -v" gives following error "unale load dynamic library- usr/lib/php/20131226/openssl.so -no such file or directory" i naive. might stupid ques. shall grateful help.

python - Applying a custom function on Group By if row count greater than 1 -

how apply function dataframe after grouping if want apply function on groups group has membership greater 1. e.g df1 = df.groupyby(['x','y']).count() > 1.apply(f) f(x) : secondly being passed function - elements on group or group itself. i think need size : df1 = df.groupby(['x','y']).size() df1[df1 > 1] = df1[df1 > 1].apply(f) aggregating size , count - differences . sample: df = pd.dataframe({'x':[1,1,3], 'y':[5,5,6], 'c':[7,8,9]}) print (df) c x y 0 7 1 5 1 8 1 5 2 9 3 6 def f(x) : return x + 2 df1 = df.groupby(['x','y']).size() s = df1[df1.count > 1].set_index('x')['y'] print (s) x 1 5 name: y, dtype: int64 mask = df.set_index('x')['y'].isin(s).values print (mask) [ true true false] df[mask] = df[mask].apply(f) print (df) c x y 0 9 3 7 1 10 3 7 2 9 3

math - How to write \x in python without scape error -

kind of new in python enjoying much. situation: i'm writing docstring of functions in python 2.7 encoding standard (ascii presume). have write \xi of course gives me escape error problem: need write comments correctly interpreted restructured text (using rst2pdf example). moreover, math part of comments should in latex style later re-usage of code. mandatory since several reasons @ work place, math formulas in eventual final report must come directly surge code. usage of .. math:: \xi ideal since meets both needs, if not escape error question: how avoid error? there way restructuredtext-compatible tell python ignore or interpret in special way doctest? or way rewrite without changing latex style math? note: whatever possible modifier may use comments, these can have doctest necessary not interfere that. thx, welcome, again kind of rookie here.

ruby - How to use Domainatrix.parse("STRING").host from a string instead of static url -

i want use line of code in ruby: domainatrix.parse("string").host on "string" place, want use string contains multiple links. when insert string on place, error doesn't know .parse. when insert static url, works. but how can use string in parse multiple links? thanks! result = [] urls.map |url| result << domainatrix.parse(url).host end

java - Spring Mail, Failure sending HELO comand to SMTP Server -

This summary is not available. Please click here to view the post.

c# - Specified argument was out of the range of valid values. oracle parameter -

var orclparam=new oracleparameter("p_amount",0); i getting error, specified argument out of range of valid values so 1 correct bellow, var orclparam=new oracleparameter("p_amount",0.tostring()); or var orclparam=new oracleparameter("p_amount","0");

excel - Selection outline in search results (from GUI) on a sheet that is set to xlNoSelection -

i have sheet set sheet.enableselection = xlnoselection . reasons need xlnoselection remain: the user must able both sort , filter table resides in sheet using table's gui. the user must not able in way alter (including adding or removing) contents of cell inside table. sorting table not count against criteria though excel considers sort process "changing cell contents". the user must not able insert/remove columns or rows. xlnoselection in conjunction locking sheet (while cells' locked -property false) solution have found solves this, , setup operational is. thing lacking selection outline during "binocular search" home ribbon. i'm observing search function in fact select cell (and cell contents in part visible in formula bar), there no selection outline around selected cell (i guess feature of xlnoselection ). my question: there way can selection outline while retaining xlnoselection ? outline necessary during search, doesn't mat

perl - Compare Files and print difference using print unless -

i got following function , dont know how put output variable. sub checkfiles { # declaration $origdir="/home/hbo/test/chksum/"; $tmpdir="/home/hbo/test/tmp/"; # directory inventory opendir( dir, $origdir); @files = sort ( grep { !/^\.|\.\.}$/ } readdir(dir) ); closedir(dir); foreach $file (@files) { if ( !-r $origdir.$file) { print $origdir.$file, "does not exist"; next;} # open filehandles open $a_fh, '<', $origdir.$file or die "$origdir.$file: $!"; open $b_fh, '<', $tmpdir.$file or die "$tmpdir.$file: $!"; # map difference %tmpdirfile; @tmpdirfile{map { unpack 'a*', $_ } <$b_fh>} = (); # print difference while (<$a_fh>) { print unless exists $tmpdirfile{unpack 'a*', $_}; } close $a_fh; close $b_fh; } } the line got questions "print unless exists $tmpdirfile{unpack 'a*', $_};" want put output variable array can decide between &

php - How to set up a configuration of LDAP in a Laravel project -

i new use ldap, , should set ldap in laravel project stores users' information. have used following library below , experienced troubles. https://github.com/adldap2/adldap2-laravel 1) can test ldap on localhost? (without domains) following setting not work. $config = [ // mandatory configuration options 'domain_controllers' => ['corp.localhost'], 'base_dn' => 'dc=localhost', 'admin_username' => 'username', 'admin_password' => 'password' ] 2) relation between db , ldap? for example, facade below affected both 'user' table on db , 'user' information on ldap? use adldap\laravel\facades\adldap; // finding user. $user = adldap::search()->users()->find('john doe'); // searching user. $search = adldap::search()->where('cn', '=', 'john doe')

java - Lambda + stream to fetch List<A> to A Single List -

i have class class testa { private list<a> lista; //getters , setters } and class class a{ int id; } now if want collect list below code list<testa> somelist ; //containing testa list<a> completelist = new linkedlist<a>(); for(testa test:somelist) { if(test.getlista() != null) { completelist.addall(lista); } } how can completelist using lambda + stream . in advance. it should this... somelist.stream() .map(testa::getlista) .filter(testa -> testa != null && !testa.isempty()) .flatmap(list::stream) .collect(collectors.tolist());

maven - Netbeans project specific settings resetting -

i having problem project specific settings resetting while working. i trying configure project use ide wide formatting configurations, after small while settings project reset use default project specific settings. i assume related automatic build in background doing removing project configuration file haven't found out more related that. other points note: the project huge the project maven configured i 1 working in netbeans aware of the project has parent maven project have open in ide the project in git repository believe have set ignore netbeans config files.

javascript - Development server of create-react-app does not auto refresh -

i following tutorial on react using create-react-app. application created create-react-app v1.3.0 create-react-app my-app the dev server run by npm start after changing code several times, browser not updated live / hot reload changes. refreshing browser not help. stopping dev server , starting on again capture new changes code. have seen “troubleshooting” section of user guide? describes a few common causes of problem : when save file while npm start running, browser should refresh updated code. if doesn’t happen, try 1 of following workarounds: if project in dropbox folder, try moving out. if watcher doesn’t see file called index.js , you’re referencing folder name, need restart watcher due webpack bug. some editors vim , intellij have “safe write” feature breaks watcher. need disable it. follow instructions in “working editors supporting safe write” . if project path contains parentheses, try moving project path without them.

javascript - I am trying to modify server side js. which takes an json file as input and render the data to produce html file. -

Image
attached code takes json input , trying render data using script comes in proper format. we need modify "json html.txt" server-side js, output in html input json . attached image shows output @ right side.this output must in format. <!doctype html> <html> <body> <p id="demo"></p> <script> var statement, i, j, x = ""; statement = { "financial statement:": ["netincomeloss = ","- netincomelossattributabletononcontrollinginterest","+ profitloss = "," + incomelossfromdiscontinuedoperationsneto..."," + incomelossfromcontinuingoperationsinclud... = "," + apd_incomelossfromcontinuingoperationsbeforetaxes = "," + operatingincomeloss = "," + salesrevenuenet"," - costofgoodsandservicessold"," - sellinggeneralandadministrativeexpense"," - researchandd

c# - Open application after install not working on install for "everyone" -

i'm using setup project, i've created installer class: using system; using system.componentmodel; using system.runtime.remoting.contexts; namespace client.common { [runinstaller(true)] public class installer : system.configuration.install.installer { public installer() { } public override void commit(system.collections.idictionary savedstate) { try { base.commit(savedstate); system.diagnostics.process.start(context.parameters["targetdir"] + "client.ui.exe"); base.dispose(); } catch (exception ex) { } } } } and setting customactiondata of commit custom action to: /targetdir="[targetdir]\" this works fine when run msi install "just me", opens exe, when install "everyone" not run exe. am missing enable happen "everyone"

Spring kafka performance vs native kafka api -

i developer using spring kafka producing/consuming, have question performance. performance difference between spring kafka vs native kafka api? there performance drop using spring kafka comparing native kafka api? has tried performance before , know answer? thanks. you should not see significant performance differences.

Render PNG images using OpenGL in Haskell -

i new haskell , building chess game using opengl (using graphics.ui.glut ) ui. trying render png images chess pieces. i read images can converted textureobject , rendered, not find helpful resources know how it. this code looks generating chess board drawsquare :: boardsquare -> io () drawsquare ((x,y,z),(r,g,b)) = preservingmatrix $ color $ color3 r g b translate $ vector3 x y z drawcube -- draw square of appropriate size -- display callback display :: ioref gamestate -> displaycallback display gamestate = gstate <- gamestate clear [colorbuffer] form_ (getboardpoints gstate) $ drawsquare -- drawing 64 squares here flush can me render png image @ given x , y coordinates of window given file path? suggestion : since new haskell, instead of diving straight raw opengl chess game, have looked @ libraries make opengl easier? recommend gloss , looks gloss-game has helper function load .png file memory ready used game. luck!

python - Clear cookies on scrapy completely instead of changing them -

i noticed blocked while scraping because of session cookie being used on many pages. there way clear cookies during crawling initial state of crawler? facing similar situation myself. can away here, 1 idea have subclass cookiemiddleware , write method tweak jar variable directly. it's dirty, maybe worth consideration. another option write feature request @ least have function clear cookies. can take year implement, if deemed needed @ all, don't particularly trust scrapy devs here. just occured me, can use own cookiejar meta, , if want return clean state, use different value (something incrementing integer do).

amazon web services - How to redirect traffic from non www domain name to www.example.com in AWS Route 53 -

Image
i own domain name in aws route 53 'www.derbyware.com', have web application running @ ' http://node147934-env-7029269.phx.enscaled.us ' on jelastic. users want them access web application using www.derbyware.com not ugly url ' http://node147934-env-7029269.phx.enscaled.us '. made www.derbyware.com act domain name web application. non www 'derbyware.com' not work. you can test urls. this solution aws support resolution: use following procedure redirect domain. in example, redirect example.com example.net. requirements: a hosted zone domain example.com hosted in amazon route 53. you have permissions add resource records hosted zone of example.com. you have permissions create amazon s3 bucket. you able create s3 bucket exact name example.com. note: sites must http, because redirect cannot connect s3 on https. in amazon s3 console, create s3 bucket exact name example.com. note: s3 bucket names must globally unique. if bu

protege - OWL, adding a property to all instances of a class -

i'm looking way add object property instances of given class. example problem: let's i'd define 3 classes. religious_person supreme_being christian subclass of religious_person. now i'd have object property "devotes" has domain of religous_person , range of supreme_being. i have 3 instances of christian: marck, bob , cathy. have 1 instance of supreme_being: god. now i'd state marck devotes god, bob devotes god, , cathy devotes god. seems tedious every instance, i'd express each instance of class christian devotes god default. ofcourse might confusing example might seem i'd want each , every religious_person devote 1 supreme_being, not case. example: let's jackandjillian religious_person devotes both jack , jill. i'd each instance of jackandjillian devote both jack , jill (whom both instances of supreme_being). it feels me "devotes" should object property of class christian, not possible due classes not having

php - Looping in a complex array -

hope fine today. have xml file online stored array using file_get_contents(), simplexml_load_string() json_encode , json_decode; using above methods gave array this: [data] => array ( [transaction] => array ( [0] => array ( [fields] => array ( [transactionid] => 90397725 [transactionreference] => 90397725 [transactiontime] => 14:34:56 [transactiondate] => 2016-04-08 [upgauthcode] => 649192 [cardnumber] => ***************5104 [cardholdersname] => miss jane k doe [switchnumber] => array ( )