Posts

Showing posts from February, 2011

server - How to Identify a File is image or not in PHP -

i have tried getimagesize() , finfo , getting mime type function. have noticed can not trust on these function observed it's fails in case image files. have better way identify file image or not. use case : have 1 file php code inside it. have saved file image extension. want block file getting uploaded. try php's inbuilt method check image type, int exif_imagetype ( string $filename ) this method returns false if file not valid image otherwise return integer pointing type of image. also throws notice. may this. if(@exif_imagetype($file)){ //valid image } else { // invalid }

Oracle Apex 5.0.3 Flash Chart Error: -

we have upgraded 4.1 5.0.3. when running our app , navigating page includes flash chart, popup displays with: "flash chart error:". in place of expected flash chart, spinning circle displayed label "getting data". if refresh page, same error. if submit page, page reload , display flash chart no problem. has experienced issue before? looking identify causing instead of hiding submit page on load workaround. thanks.

word vba - How do I insert a QuickParts BuildingBlock in an Outlook appointment using VBA? -

Image
i have quickparts building block in microsoft outlook 2016 called "meeting purpose block." can use navigating through ribbon, cannot figure out how write vba, i.e., macro, same thing. from can tell, building block part of microsoft word template named "normalemail.dotm", assume have use word vba library in code. you need add reference word tlb or change word.* variables variant sub insertbuildingblock() dim oinspector inspector dim odoc word.document dim wordapp word.application dim otemplate word.template dim obuildingblock word.buildingblock ''or inspector other way set oinspector = application.activeinspector if oinspector.editortype = oleditorword ''the property wordeditor word.document set odoc = oinspector.wordeditor ''this inserts firt building block in first template ''this based on simple recording action in word set wordapp = odoc.

ruby - Rails devise after_sign_in first time, check attribute and update another user one time -

after user's first sign in, want see if user referred them referral_code_used column, , increase user's referral_count + 1. currently, user logged in , taken home_path i have tried writing after_sign_in_path_for(resource) method. gets job done, respect referral count. issue takes user users/:id path instead of home. def after_sign_in_path_for(resource) if resource.sign_in_count > 1 puts "sign in count greater 1" elsif resource.sign_in_count === 1 puts "sign in count 1" if resource.referral_code_used != nil referral_code = resource.referral_code.strip length = referral_code.length referral_code = referral_code[5..length] @user_referral_code = referral_code.to_i if user.exists?(id: @user_referral_code) referral_user = user.find_by_id(@user_referral_code) referral_user.referral_count = referral_user.referral_count + 1 referral_user.save end end pu

How do you programmatically add an annotation in Google Analytics? -

this question has answer here: google analytics, annotations api 1 answer svn commit trigger google analytics annotation? 1 answer google analytics supports annotations (see: https://blog.kissmetrics.com/google-analytics-annotations/ ). add call add annotation our google analytics property in our deployment script. i find out cannot, yet . see https://code.google.com/p/analytics-issues/issues/detail?id=53 it feature requested 7 years ago , people keep regularly adding "+1". considering google analytics not have own google product group open discussions (only group notifications users: https://groups.google.com/forum/#!forum/google-analytics-api-notify ), hope in team listening , can bring feature request management.

ecmascript 6 - Reduce javascript object -

i have javascript object : { { long_name: "10", types: [ 0: "street_number" ], }, { long_name: "street", types: [ 0: "route" ], }, { long_name: "paris", types: [ 0: "locality" ], }, ... } and want flatten , have : { street_number: "10", route: "street", locality: "paris", ... } i using es6, can't manage flatten much, i've succeeded having : { {street_number: "10"}, {route: "street"}, {locality: "paris"}, ... } here tried : const flattenedobject = originalobject.map(flatten); ... function flatten(element) { let obj = {}; obj[element.types[0]] = element.long_name; return obj; } thanks help. you use array#reduce computed property , first element array.

java - How should I retrieve the latest version of a Maven project for contract testing? -

we're using maven , nexus distribute components (maven projects) inside our infrastructure. sake of argument, let's have 2 teams: team foo , team bar; , component bar depends on component foo. team bar wants write contract tests checking if component foo behaves expected. tests run every night against latest stable development version of project foo (git master after ci). team bar write maven project bar/pom.xml depends on latest version of foo ? how can go doing that? we're playing idea of solving through version naming. name under development version master-snapshot (or something) , instead of version label going 0.1-snapshot -> 0.1 -> 0.2-snapshot -> 0.2 , go master-snapshot , master-snapshot -> 0.1 -> master-snapshot -> 0.2 . contract testing project bar declare dependency foo com.acme:foo:master-snapshot . but seems clunky (breaks common maven practice , stuff)... there more standard practice kind of thing? should use maven versions p

python - Django: The joined path is located outside of the base path component -

i'm using django 10 , dont know why after collect static files successfuly, when try run server in deployment mode(debug=false) occurs me this: when static file doing: python manage.py findstatic /static/mysite/js/javascript.js django.core.exceptions.suspiciousfileoperation: joined path (/static/mysite/js/javascript.js) located outside of base path component (/home/xxxx/.venvs/mysite/local/lib/python2.7/site-packages/django/contrib/admin/static) i run using virtual env 'mysite'. in settings.py : static_url = '/static/' static_root = os.path.join(base_dir, "static") (i tried 'static') media_root = base_dir + '/mysite/media' media_url = '/media/' my urls.py : urlpatterns = [ url(r'', include('mysite.urls')), ] urlpatterns += staticfiles_urlpatterns() this new me, did django website , never occurs such error. why not considering static_root path? other hand collectstatic works fine. , if

asp.net mvc - How to put TypeScript sources into separate VS project? -

i have long-running web project (3-4 years old), based on asp.net mvc 5. have large client-side codebase too, written in typescript. due earlier conventions, typescript sources part of mvc 5 csproj project, gets compiled back-end. this structure unfortunate due many reasons. few main ones are: violation of srp, coupled backend, no way separately maintain , build backend, no way separately maintain , build front-end, etc. i'd separate client-side codebase new visual studio project, however, have no idea best way be, visual studio doesn't provide way have clean typescript projects (at least far know). i'm using visual studio 2015 typescript 2.0. options have? first, if client-side code (the typescript application) not need own web.config file — is, don't need configure iis authorization, redirects, etc. — can use "html application typescript" project type in visual studio . however, if both client , server code need own web.config , depl

Setting Bash variable to last number in output -

i have bash running command program (afni). command outputs 2 numbers, this: 70.0 13.670712 i need make bash variable whatever last # (in case 13.670712). i've figured out how make print last number, i'm having trouble setting variable. best way this? here code prints 13.670712: test="$(3dbrickstat -mask ../../template/rois.nii -mrange 41 41 -percentile 70 1 70 'stats.s1_ants+tlrc[25]')"; echo "${test}" | awk '{print $2}' just pipe( | ) command output awk . here in example, awk reads stdout of previous command , prints 2nd column de-limited default single white-space character. test="$(3dbrickstat -mask ../../template/rois.nii -mrange 41 41 -percentile 70 1 70 'stats.s1_ants+tlrc[25]' | awk '{print $2}')" printf "%s\n" "$test" 13.670712 (or) using echo echo "$test" 13.670712 this simplest of ways this, if looking other ways in bash -ism, use read command u

arch - How to fit a ARMA-GARCH model in python -

i'm trying make arma-garch model in python , use arch package. but in arch package cannot find arma mean model. i tried use arx mean model , let lags = [1,1], summary doesn't arma model. does package include arma mean model?

menu - How to make responsive sidebar? -

i making website. need sidebar has sub navigation menu responsive. have been searching through web couldn't want. i want this http://www.thomasphilip.com.my/careers/ not sure if there website has tutorial kind of subnav? suggestion? thank you! this require using media query rework navigation. should examine elements of reference web site when set different sizes if want similar. here's resource: http://www.w3schools.com/css/css_rwd_mediaqueries.asp the example shown moves nav around. doesn't change row layout spinner, that's matter of figuring out how want implement each of those.

c# - Pades LTV verification in iTextSharp throws Public key presented not for certificate signature for root CA certificate -

i'm getting org.bouncycastle.security.invalidkeyexception error message public key presented not certificate signature when validating pdf ltvverifier . this problem has arisen after circumventing issue crl ldap uris . code used perform verification same previous post: public static bool validate(byte[] pdfin, x509certificate2 cert) { using (var reader = new pdfreader(pdfin)) { var fields = reader.acrofields; var signames = fields.getsignaturenames(); if (!signames.any(n => fields.signaturecoverswholedocument(n))) throw new exception("none signature covers document"); var verifications = signames.select(n => fields.verifysignature(n)); var invalidsignature = verifications.where(v => !v.verify()); var invalidtimestamp = verifications.where(v => !v.verifytimestampimprint()); if (invalidsignature.any()) throw new

Build opencv with opencv_contrib for iOS -

i want use xfeatures2d in opencv_contrib, can't build opencv2.framework opencv_contrib ios. i have tried build terminal by cmake -dopencv_extra_modules_path=<opencv_contrib>/modules <opencv_source_directory> it give bash /module:permission deny . or if try build cmake-gui when pressed config said error in configuration process, project files may invalid are there solution this? or there better way me use xfeatures2d ios?

ting to Generic stack implementation in C with void pointers -

trying implement simple generic stack went trough bunch of stack overflows , segmentation faults wrote this: #include <stdlib.h> #include <stdio.h> #define nullptr (void *)0 struct s { void *content; struct s *next; }; typedef struct s stack; stack *createstack() { stack *tmp = (stack *) malloc(sizeof(stack)); tmp->content = nullptr; tmp->next = nullptr; return tmp; } stack *pushstack(stack *ptr, void *content) { stack *newstr = createstack(); newstr->content = content; newstr->next = ptr; ptr = newstr; return (ptr); } stack *popstack(stack *ptr, void *value) { stack *todelete = ptr; value = ptr->content; ptr = ptr->next; free(todelete); return (ptr); } stack *stackhandle = nullptr; void printstack(stack *ptr) { int *element; int i; for(i=0; <= 20; i++) { ptr = popstack(ptr, element); printf("%d ", *element); } printf("\n&q

java - How to generate Swagger JSON file for dynamic object manually without using any POJO -

i looking creating swagger file api using program (manually) api deals dynamic objects cannot generalize hence not able use annotation swagger. option left me create manually in java please guide me how create post request accepts employee(id,name) objects , generates response employee(id,name) ...

How can I read files from usb device on android? -

i'm trying create file explorer through connected usb devices(via otg or usb ports on android tv). need path "/storage/sda4" , device identifier, , can work device through simle android class file. sounds simple can't find info this, file explorers can (for example esexplorer). ok, find simple way connected usb devices identifier usbmanager usbmanager = (usbmanager) context.getsystemservice(context.usb_service); usbmanager.getdevicelist(); but how can info path? devicename contains "/dev/bus/usb/00x" can't me, need simple emulated android path ("/storage/sda4"). page https://developer.android.com/guide/topics/connectivity/usb/host.html tells need usbinterfaces , make usbconnection bulk transfer , other bullshit, done didn't find path device or other info usb file list. ok, find way (that don't requires permission!) path connected devices storagemanager storagemanager = (storagemanager) context.getsystemservice(context.stor

vb.net - Visual Studio 2013 - the system cannot find reference specified -

Image
i googled , checked existing post here didn't find relevant post here question. i using vs2013 primium edition. have few class library projects(all using framework 4.0). when these class libraries become part of web solution, reference paths in class library shown , project compiles fine shown below. however, same class library project doesn't load reference paths when becomes part of windows service solution. i doubled checked projects using same framework version. idea whats going wrong? finally able resolve it. after recreated library project inside windows service solution described here . i opened same library project in web solution. somehow, web solution adds nuget restore tags in library project file. <restorepackages>true</restorepackages> <import project="$(solutiondir)\.nuget\nuget.targets" /> <target name="ensurenugetpackagebuildimports" beforetargets="prepareforbuild"> <prope

c# - JObject formatting (json.net) -

i'm trying tables json string (just example) datatable table = new datatable(); table.columns.add("name", typeof(string)); table.rows.add( "david"); var result = row in table.asenumerable() select new { name = (string)row["name"] }; jobject json = jobject.fromobject(new {result}); return json ; i'm getting : "table":{"result":[{"name":"david"}]} but need this: "result":[{"name":"david"}] is there ways format string , rid of "table"/"result"/etc, combining them in 1 ? (may not json.net?) i figure out. needed use jsonconvert.serializeobject instead of jobject

R Shiny: Store the generated PDF report output from Shiny app to Dropbox -

i know how directly store pdf output (using knitr , rmarkdown) shiny app dropbox. here code: server.r: shinyserver(function(input, output) { regformula <- reactive({ as.formula(paste('mpg ~', input$x)) }) output$regplot <- renderplot({ par(mar = c(4, 4, .1, .1)) plot(regformula(), data = mtcars, pch = 19) }) #### change code here. in app, use iris.csv #### example test if possible save file in dropbox. works #### fine. need replace iris.csv my-report.pdf #### generated app. observeevent(input$dropbox, { write.csv(iris,"iris.csv") drop_upload('iris.csv') }) ### end of save process ### output$downloadreport <- downloadhandler( filename = function() { paste('my-report', sep = '.', 'pdf') }, content = function(file) { src <- normalizepath('report.rmd') # temporarily switch temp dir, in case not have write # permission current working directory owd <- setwd(tempdir()) on.exit(setwd(owd)

ios - How to enable only Apple Pay but not in-app purchase? -

when enable apple pay in capabilities of xcode adds key "com.apple.developer.in-app-payments", makes me wonder why adding in-app-payments key , not apple-pay, want have apple pay feature not in-app purchases. when tried submit app, prompted whether had enabled in-app purchase. if yes ? treat apple pay in-app purchase ?. no not allow me submit unless uncheck apple pay capability in xcode.

Rails 5 ActiveRecord Update Serialized Array in Form -

i have field serialized array. it's loaded model , accessed in form: class site < applicationrecord serialize :steps, array end <table class="listing" summary="site list"> <tr class="header"> <th>name</th> <th>step 1</th> <th>step 2</th> <th>step 3</th> <th>actions</th> </tr> <% @sites.each |site| %> <tr> <td><%= site.name %></td> <% site.steps.each |step| %> <td><%= step %></td> <% end %> <td class="actions"> <%= link_to("show", site_path(site), :class => 'action show') %> <%= link_to("edit", edit_site_path(site), :class => 'action edit') %> <%= link_to("delete", delete_site_path(site), :class => 'action delete')

r - Aggregating by unique identifier and concatenating related values into a string -

this question has answer here: collapse / concatenate / aggregate column single comma separated string within each group 2 answers i have need imagine satisfied aggregate or reshape , can't quite figure out. i have list of names ( brand ), , accompanying id number ( id ). data in long form, names can have multiple id's. i'd de-dupicate name ( brand ) , concatenate multiple possible id 's string separated comment. for example: brand id radioshack 2308 rag & bone 4466 ragu 1830 ragu 4518 ralph lauren 1638 ralph lauren 2719 ralph lauren 2720 ralph lauren 2721 ralph lauren 2722 should become: radioshack 2308 rag & bone 4466 ragu 1830,4518 ralph lauren 1638,2719,2720,2721,2722 how accomplish this? let's call data.frame df &

c# - match json data to class properties -

i have used 1 webapi method [frombody] used class object. below: public httpresponsemessage processresource([frombody]filecontent contentvalue) {//some business logic } and below json format sending client machine: {"filecontent":{"resourcestrings":[{"stringkey":"testkey","stringid":1,"value":"testkey"},{"stringkey":"samplekey","stringid":2,"value":"test key 1"},{"stringkey":"homekey","stringid":3,"value":"home dev"},{"stringkey":"custom.wvf.contactform.name","stringid":4,"value":"name"},{"stringkey":"custom.cms.menuitem","stringid":5,"value":"cms.menuitem"}]},} below filecontent class used: public class resourcestring { public string stringkey { get; set; } //

CSS @supports: mixing "not" with "and" or "or" -

i serve portion of css browsers support "display: grid", not ie/ms edge. how mix positive , negative @support queries? can write 'and not' or there similar notation? unfortunately following not work. @supports not (-ms-ime-align:auto) , (display: grid) { display: none; } you need set of parentheses surrounding not expression: @supports (not (-ms-ime-align: auto)) , (display: grid) { .example { display: none; } } <p class=example>you using ie or microsoft edge, or different browser not support <code>display: grid</code>. this make clear not intended negate (-ms-ime-align: auto) expression , not entire @supports expression, endless source of confusion in media queries (in not always negates entire media query, opposed 1 condition when combined more conditions using and ).

python - trying to add element to xmeml format XML with xml.etree.ElementTree -

there's xml file generated video editing software, contains data clip exhange. xml valid software. thing lacks element fielddominance (i need set 'upper' value there) hard part me file structure. here's looks like: <?xml version="1.0" encoding="utf-8"?> <!doctype xmeml> <xmeml version="5"> <sequence> <name>to_color (resolve)</name> <duration>121597</duration> <rate> <!-- ... --> </rate> <in>-1</in> <out>-1</out> <timecode> <!-- ... --> </timecode> <media> <video> <track> <clipitem id="983_0121_01_1_5ff70094c4a64669bc77.mov 0"> <name>983_0121_01_1_5ff70094c4a64669bc77.mov</name> <duration>271</duration> <rate> <timebase>25</timebase> <

ruby on rails - /kernel_require.rb:55:in `require': cannot load such file -- mini_portile -

when setup gitlab sudo -u git -h bundle install --deployment --without development test postgres aws gem::ext::builderror: error: failed build gem native extension. /usr/local/bin/ruby extconf.rb checking if c compiler accepts ... yes building nokogiri using packaged libraries. * extconf.rb failed * not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/ruby --help --clean --use-system-libraries /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot l

javascript - Require JS Object and Functions in Typescript Angular2 project -

i working typescript 2 .1.5 , trying write newer sections of code it. have js library not ready update in typescript. problem i need consume of javascript code in simple typescript component. i have been fetching web way javascript functions called , work in .ts file. unfortunatly informations either outdated (mostly), not clear or not explained @ all. allready tryed whole lot of tricks none works. so question : easiest way , simplest way consume javascript code in ts file (es6) ? there must protocol follow done. any tutorial, link or explanations appreciated , i'am sure others in same situation. for better understanding here code snippets : i start doing import of js file in component.ts var zp = require('./zp.js'); in js file have 2 types of functions. respectively basic 1 , methods object: **export** function logtest(){ console.log("responding"); }//simple function ( *i found while editing, appending keyword "export"

ios - NSFetchedResultsController: no object at index 2147483647 -

need hint, give after spending several hours struggling nsfetchedresultscontroller. the error message is: coredata: error: nsfetchedresultscontroller: no object @ index 2147483647 in section @ index 0 ...but don't know firing error. last piece of code savecontext(), next breakpoint inside didchange. class viewcontroller : uitableviewcontroller, nsfetchedresultscontrollerdelegate private lazy var channelcontroller: nsfetchedresultscontroller<zchannel> = { let appdelegate: appdelegate = uiapplication.shared.delegate as! appdelegate let request: nsfetchrequest<zchannel> = zchannel.fetchrequest() request.sortdescriptors = [nssortdescriptor(key: "kit", ascending: true), nssortdescriptor(key: "name", ascending: true)] let retval: nsfetchedresultscontroller<zchannel> = nsfetchedresultscontroller(fetchrequest: request, managedobjectcont

android - Click on first item in a GridView is not working -

i have activity contains gridview , each element of gridview contains imageview , when activity starts want perform click on first item's imageview . have tried several things did not work: gridview.performitemclick(gridview.getchildat(0), 0, gridview.getadapter().getitemid(0)); and performclick() directly. however think found way calling function ( performemptyclick() ) inside custom gridviewadapter performs click on first item's imageview . my problem performemptyclick() called before adapter's getview() called (from debugging) , therefore onclicklistener() of imageview not set yet. here code: gridview = (gridview) findviewbyid(r.id.foldergridview); folderviewadapter = new folderviewadapter(this, r.layout.folder_item_layout, folderitems); gridview.setadapter(folderviewadapter); bundle extras = getintent().getextras(); nofolder = extras.getboolean("nofolder"); if (nofolder) { folderviewadapter.performemptyclick(); } can me fix this?

elasticsearch: find date with switched numbers -

i want know if it's possible solve following problem. the documents want search have key named "dateofbirth" formatted dd.mm.yyyy . let's say: "dateofbirth": "03.10.1961" now want document 2 different ways the first way perfect match: "dateofbirth": { "query": 03.10.1961 } the second way 1 i'm struggling with. want result searching two switched numbers : "dateofbirth": { "query": 03.01.1961 } or "dateofbirth": { "query": 03.10.1916 } my fist idea solve fuzzi param. thing i don't want reslut searching for: "dateofbirth": { "query": 03.11.1916 } is there way result 03.10.1961 through searching switched chars no result through searching wrong chars ?

oauth - Exchanging a google idToken for local openId token c# -

Image
i using github project https://github.com/openiddict/openiddict-core great. stuck procedures should be, or how implement them, when user uses external identity provider, example, use google. i have angular2 app running, aspnet core webapi. local logins work perfectly, call connect/token username , password, , accesstoken returned. now need implement google external identity provider. have followed steps here implement google login button. opens popup when user logins in. code have created google button. // angular hook allows interaction elements inserted // rendering of view. ngafterviewinit() { // check if google client id in pages meta tags if (document.queryselector("meta[name='google-signin-client_id']")) { // converts google login button stub actual button. gapi.signin2.render( 'google-login-button', { "onsuccess": this.ongoogleloginsuccess, "

Data loss in Arduino-Android usb communication -

i'm transferring data android arduino , vice versa(handshaking done). when i'm transferring 1 byte everything's fine, when try transfer 64bytes packets there data loss. i checked arduino side program , works using monitor of arduino ide, when connected android can not send packets of 64bytes android(i have arduino due). i tried different baudrates , problem persists. thanks in advance.

r - Summing over constant calendar week interval -

i trying aggregate weekly data monthly data, looks this: ups week ap 1111112016 1 385.22 1111112016 2 221.63 1111112016 3 317.47 there 132 different upcs , weeks indicated 1 - 52. however, vary across different upcs. in total have 4,027 rows. aggregate on 4 week interval until next upc category reached. have tried code: z = aggregate(x$ap, by=list(x$upc, cut(x$week, breaks=13, lables = t)), fun = sum) colnames(z) = c("upc", "month", "ap") z = z[order(z$upc),] i following output: upc month ap 1 1111112016 (0.951,4.77] 1098.03 88 1111112016 (4.77,8.54] 1180.03 187 1111112016 (8.54,12.3] 491.18 303 1111112016 (12.3,16.1] 896.31 there several problems here: 1) month value wrong. have numerical value. (1 - 12) 2) first 2 aggregates correct, after sums seem correct , not. here brief example of how data looks like: dput(head(x)) structure(list(upc = c(1111112016, 1111112016, 1111112

python - echo=False by default in pweave -

how can set flag echo=false default code, when precessing python-script file pweave. minimal example: #' # minimal example. #' minimal example, #' says 'hello' you. #+ echo=false print('hello') #' end. which gets processed by # either: py html pypublish test.py # or: py markdown pweave -f pandoc test.py include following lines @ beginning of document: 1.set echo false first code chunk , change false every other code chunk. 2.you can have in documentation http://mpastell.com/pweave/defaults.html #+ echo = false import pweave pweave.rcparams["chunk"]["defaultoptions"].update({'echo' : false, 'f_pos' : "h!"}) following documentation can change other parameters, have picked 'f_pos' documentation.

java - this is my first applet. but when i run is using either eclipse or web browser all i get is an empty applet screen. what went wrong? -

import java.util.*; import java.awt.*; import javax.swing.*; //basic applet public class test2 extends japplet { //print method public void print(graphics g) { super.paint(g); g.drawstring("black mamba", 50, 50); g.drawrect(25, 25, 50, 100); } }

Python Modules doesnot show after install -

i trying install project https://github.com/alvations/pywsd using setup.py command sudo python setup.py install running install running build running build_py running install_lib running install_egg_info removing /usr/local/lib/python2.7/dist-packages/pywsd-1.0.egg-info writing /usr/local/lib/python2.7/dist-packages/pywsd-1.0.egg-info after installing, module available @ /usr/local/lib/python2.7/dist-packages/ but when trying import pywsd in pything script file way import sys import getopt import pywsd the pywsd module not auto suggested @ time of typing , if forcedly write import pywsd , finds location @ /dist-packages/ folder . when run file shows error import pywsd importerror: no module named pywsd

angularjs - ngSticky directive for angular with tables -

Image
i using ngsticky directive ( https://github.com/d-oliveros/ngsticky ) because want fix thead of table when offset=50. width of thead changed when offser=50. correct vision of table: and get: th , tr have different width! my code table is: <div class="table-responsive"> <table class="table table-condensed persist-area"> <thead sticky offset="50"> <tr class="info"> finally use directive cmelo.angularsticky: https://github.com/cmelo/angular-sticky works me. install bower: bower install cmelo-angular-sticky include js file: <script src="../bower_components/cmelo-angular-sticky/cmelo-sticky.js"></script> add module dependency: angular.module('destinator', ['cmelo.angularsticky']) add cmelo-sticky body: <body cmelo-sticky> add cmelo-sticky-top thead: <thead cmelo-sticky-top>

post - LemonLDAP OpenID return "Bad URL" -

i have problem openid authorization. when send form with <input type='hidden' name='url' value='[my real , working url]'> it not shows login form says "bad url". parameter send 'url'. there rules may prevent redirect?

How to keep return code and log of sub function in bash -

i want run sub function(with interactive operation read ) , keep it's log. original #!/bin/bash foo() { echo "error" return 1 } bar() { local data read -p "data=" data echo "ok: $data" return 0 } foo echo "return code=$?" bar echo "return code=$?" after keep log #!/bin/bash foo() { echo "error" return 1 } bar() { local data read -p "data=" data echo "ok: $data" return 0 } log=my.log foo | tee -a $log echo "return code=$?" bar | tee -a $log echo "return code=$?" use named pipe send return value: #!/bin/bash foo() { echo "error" return 1 } bar() { echo "ok" return 0 } rm -f retcode trap 'rm -f retcode' exit mkfifo retcode log=my.log { foo echo $? > retcode } | tee -a $log & read rc < retcode echo "return code=$rc" { bar echo $? > retcode } | tee -a $log & r

python - Share a global variable in flask among multiple gevent workers -

in flask application keep global variable store current states of running tasks, cannot shared different gevent workers. g used store global data in flask application, g reset after each request. how can achieve without use of redis or other storage between processes?

java - Replace All unprediction combination HTML tag using Jsoup -

i fetching html webpage , trying retreive data it. i have html <h3><strong>title</strong><h3> want replace <h2> . but, find unexpected tags inside of content, example: <h3><br/><strong>title</strong></h3> how can remove empty html tags <p><br></p> , <h3><br /><h3> string? you try using jsoup's .text() method on element grab text only, , them putting text inside h3.

CKEditor: Plugin Button is shown but the command is not working -

first of all, thank support. i've tried create first plugin ckeditor. used official tutorial: http://docs.ckeditor.com/#!/guide/plugin_sdk_sample the button appears in toolbar. if click on this, nothing happens. here code of plugin.js ckeditor.plugins.add( 'drmail', { icons: 'drmail', init: function( editor ) { editor.addcommand( 'drmailcommand', { exec: function( editor ) { var = new date(); editor.inserthtml( 'the current date , time is: <em>' + now.tostring() + '</em>' ); } }); editor.ui.addbutton( 'drmail', { label: "e-mail adresse hinzufügen", command: 'drmailcommand', toolbar: 'insert' }); } }); thanks help. i found it. (the hint js-debugger good) had old not functional version of script in cache. dean

Is it possible to test other applications like https://www.google.com using capybara in Rails? -

i new write test case in rails. possible write test cases test other applications https://www.google.com using capybara in rails ? capybara uses racktest default, believe cannot access external urls. if change drive i.e selenium should able access external url: capybara.current_driver = :selenium visit 'https://www.google.com' it can used web crawling.

c++11 - perplexing things in c++ -

i trying copy array of chars, other array of chars in reversed order. this method: void reversstring(char* str){ char* ptr = str; int = 0; // getting length of str/ptr array while (*(ptr + i) != '\0'){ = + 1; } char revstr [i]; char * revstrchar = &revstr[0]; int revstrpos = 0; cout << *(ptr + 3) << endl; } here trying copy in normal order, if print last letter of input ("abcd"), nothings happens. prints empty line. but if delete declaration of new char array: void reversstring(char* str){ char* ptr = str; int = 0; // getting length of str/ptr array while (*(ptr + i) != '\0'){ = + 1; } //char revstr [i]; //char * revstrchar = &revstr[0]; //int revstrpos = 0; cout << *(ptr + 3) << endl; } then prints last letter correctly, "d". not understand how declaring new char array influences output! (compiler mingw, os

php - How to display data in a tree structure basen on column values -

Image
i've table structure : and want display data in following format : a 1 2 3 a1 4 5 a1 a2 6 7 b 8 9 i'm using php mysql , i'm not able think how query db. you can begin following query: select * yourtable order category_1, coalesce(category_2, ''), coalesce(category_3, '')

tsql - Find Non Consecutive date in SQL Server -

i want find missing non-consecutive dates between 2 consecutive date. i posting sql query , temp tables find out results. but not getting proper results here sql query drop table #temp create table #temp(an varchar(20),dt date) insert #temp select '2133783715' , '2016-10-16' union select '5107537880' , '2016-10-15' union select '6619324250' , '2016-10-15' union select '7146586717' , '2016-10-15' union select '7472381321' , '2016-10-12' union select '7472381321' , '2016-10-13' union select '7472381321' , '2016-10-14' union select '7472381321' , '2016-10-24' union select '8186056340' , '2016-10-15' union select '9099457123' , '2016-10-12' union select '9099457123' ,

c# - Pass lambda expression/anonymous method into BackgroundWorker -

suppose have backgroundworker in code. want pass anonymous function/delegate in @ start. code bellow want do: backgroundworker bw = new backgroundworker(); bw.dowork += (object sender, doworkeventargs e) => { func<string> f = (func<string>)e.argument; f("step one"); ... f("step two"); } bw.runworkerasync((string txt) => {console.writeline(txt);} ); // doesn't work // bw.runworkerasync( delegate(string txt) { console.writeline(txt); })); // doesn't work the error: cannot convert anonymous method type 'object' because not delegate type or cannot convert lambda expression type 'object' because not delegate type so how can passinto lambda expression/anonymous method backgroundworker ? here code in c describe need: void func(char *ch) { printf("%s", ch); } void test( void (* f)(char *) ) { f("blabla"); } int main(int argc, char *argv[]) { test(f