Posts

Showing posts from March, 2010

googletest - how to test static functions of C using google test -

i have c file contains static functions, how use google test test static function? header file: test.h int accessdata(); source file: test.c static int value; static int getdata() { return value; } int accessdata() { if(value != 0) { return getdata(); } return 0; } static function called global function, how test static function using google test? one way achieve #include c source file test source. then, static function part of same translation unit test code, , can called it: #include "test.c" /* here follow tests of getdata() */ the downside in test.c gets compiled again, obvious impact on build times. if gets problem, might consider extracting static functions tested own source file (e.g. test_p.c , _p meaning private/internal). #include "test_p.c" both test.c , unit test.

php - Inserting values from a drop down list into database -

i'm trying insert/update 2 values in database questiontext , type. questiontext being inserted upon adding row, , successful updated when in need to. i'm not successful in either inserting type nor updating it. help? case 'addquiz': $sql = "select id,questiontext,type questioninfo order type desc "; $result = mysqli_query($con,$sql); $selectedtable = "<form method='post' action=''>\n"; $selectedtable .= "<table class='sortable'>\n<tr><th>question</th><th>type</th></tr>\n"; while($row = mysqli_fetch_assoc($result)) { $rowid = $row['id']; $text = $row['questiontext']; $type = $row['type']; $selectedtable .= "<tr> <td><input type='text' name='questiontext[$rowid]' value='$text'></td><

Regular Expression to validate ApplicationUser email address in ASP.net MVC5 -

i creating webapp in asp.net mvc5 allow people domain sign up. from understand easiest way use regular expression. there way use data annotations change model, or have play around view achieve this? probably bit late suggest follows: i've have app in need modify of applicationuser properties, trying haven't tested on real life yet, unit tests passing far, useful you. override email property in applicationuser, , add custom validation annotation: [validateemaildomain(errormessage = "not valid email domain.")] public override string email { get; set; } validateemaildomain code: using system.componentmodel.dataannotations; using system.web; namespace wathever { public class validateemaildomain: requiredattribute { public override bool isvalid(object value) { //code } } } note validateemaildomain inherits requiredattribute become obligatory, if don't want way, validate when it's null.

scala - Move file from local to HDFS -

my environment uses spark, pig , hive. i having trouble write code in scala (or other language compatible environment) copy file local file system hdfs. does have advices on how should proceed? you write scala job using hadoop filesystem api. , use ioutils apache commons copy data inputstream outputstream import org.apache.hadoop.conf.configuration; import org.apache.hadoop.fs.filesystem; import org.apache.hadoop.fs.path; import org.apache.commons.io.ioutils; val hadoopconf = new configuration(); val fs = filesystem.get(hadoopconf); //create output stream hdfs file val outfilestream = fs.create(new path("hedf://<namenode>:<port>/<filename>)) //create input stream local file val instream = fs.open(new path("file://<input_file>")) ioutils.copy(instream, outfilestream) //close both files instream.close() outfilestream.close()

windows - What requests “/adform/IFrameManager.html” -

i'm running live-beta-test new application , see requests towards /adform/iframemanager.html what makes these requests towards site? is maybe windows 10? it's adform configuration request google's doubleclick ad exchange real-time bidding protocol. -- https://developers.google.com/ad-exchange/rtb/response-guide/expandables#vendor

parsing - Split text in text file on the basis of comma and space (python) -

i need parse text of text file 2 categories: university location(example: lahore, peshawar, jamshoro, faisalabad) but text file contain following text: "imperial college of business studies, lahore" "government college university faisalabad" "imperial college of business studies lahore" "university of peshawar, peshawar" "university of sindh, jamshoro" "london school of economics" "lahore school of economics, lahore" i have written code separate locations on basis of 'comma'. below code work first line of file , prints 'lahore' after give following error 'list index out of range'. file = open(path,'r') content = file.read().split('\n') line in content: rep = line.replace('"','') loc = rep.split(',')[1] print "uni: "+replace print "loc: "+str(loc) please i'm stuck on this. thanks it

javascript - How to add padding between Graph and X/Y-Scale in chart.js? -

Image
i've got simple line-chart using chart.js. it should this: http://fs1.directupload.net/images/150819/ktkgs9pw.jpg (photoshop, marked paddings red lines) what looks @ moment chart.js: http://fs2.directupload.net/images/150819/ql5l3jez.png as can see, outline of graph-points overlaps x-scale @ bottom, "2:00 pm" example , y-scale on left, "0" example. my line-chart-code: html: <canvas id="server-usage"></canvas> global chartsettings: chart.defaults.global = { // boolean - whether animate chart animation: false, // number - number of animation steps animationsteps: 60, // string - animation easing effect // possible effects are: // [easeinoutquart, linear, easeoutbounce, easeinback, easeinoutquad, // easeoutquart, easeoutquad, easeinoutbounce, easeoutsine, easeinoutcubic, // easeinexpo, easeinoutback, easeincirc,

xml namespaces - WPF - Combine xmlns -

1) have 3 assemblies. a,b , ui 2) b references a. 3) ui references b , a. 4) in a's assemblyinfo.cs [assembly: xmlnsdefinition("http://www.cmp.com/a", "a.controls")] 5) in b's assemblyinfo.cs [assembly: xmlnsdefinition("http://www.cmp.com/b", "b.controls.extensions")] 6) in ui have view <usercontrol xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:a="http://www.cmp.com/a" xmlns:b="http://www.cmp.com/b"> <textbox a:textboxextensions.ext1="red" b:textboxextensions.ext1="blue" /> </usercontrol> is there way combine both " http://www.cmp.com/a " , " http://www.cmp.com/b " under same xmlns or atlist under same prefix ? sure, need map both namespaces same url: in a's assemblyinfo.cs [assembly

intentfilter - Android intent-filter to be notified of an attempt to view a CSV file in the Download Manager -

what's required magic incantation register app notified user trying view csv file they've previously downloaded via download manager . i've had brief play , following filter happily intercept notifications generated by: dropbox, box, google drive, sky drive, chrome..... , offer open files, app isn't getting when user attempts view file via download manager. <intent-filter> <action android:name="com.my.testimportapp.launch" /> <action android:name="android.intent.action.send" /> <action android:name="android.intent.action.view" /> <action android:name="android.intent.action.edit" /> <action android:name="android.intent.action.paste" /> <action android:name="android.intent.action.open_document" /> <action android:name="android.intent.action.get_content" />

javascript - Expanding Sticky sidebar with fixed position: push down content, how -

i have sidebar want sticky when hits header - wrote script gives fixed class when scroll reaches correct position, gave fixed position. sp far good- sidebar has expanding column, , being fixed expandes sidebar down , out of page. how can make stick still push content down? you can not using pure css because: an element position: fixed; positioned relative viewport, means stays in same place if page scrolled. top, right, bottom, , left properties used position element. a fixed element not leave gap in page have been located. so out of document's flow but can use js achieve want this: $(document).ready(function () { $('#expander').click(function () { $('.content').toggleclass('nav-expanded'); }) }); .navbar { position: fixed !important; width: 100%; } p { text-align: center; } .header{ padding: 10px; } .content { padding-top: 60px; transition: .35s; } .nav-e

java - Twice click command button primefaces for download PDF -

my xhtml is <h:form id="ibform"> <p:commandbutton value="yazdır" ajax="false" action="#{islemibitenlerbean.run_rpr('pdf')}" icon="ui-icon-print" immediate="true"/> </h:form> backing bean (conversation scope) public void run_rpr(string tip) throws ioexception, jrexception, classnotfoundexception, sqlexception { hashmap m = new hashmap(); m.put("belgeno", selectedbelge.getbelgeno()); reports.preparetreport(raporturu.pdf, "reports//rapor//onaybelgesi.jrxml", "onay belgesi", m); } and preparetreport method is public void preparetreport(raporturu tur, string filepath, string filename, hashmap jasperparameter) throws jrexception, ioexception, classnotfoundexception, sqlexception { connection connection; class.forname("oracle.jdbc.oracledriver"); connection = drivermanager.getconnection("jdbc:oracle:thin:@--------"

Track user journey with MS Application Insights -

with application insights can add user(name) , session details. there option complete events of journey during session particular user. looking have kind of support when user calls in. if in diagnostic search pane, , drill specific event (like server side request), there option @ bottom titled "all telemetry user session". can click it, starts new diagnostic search particular user session (for whatever definition of user session might be, perhaps iis sessionid i'm not positive). appear collate both server side requests , client side page views. we store ad domain username custom "username" property on telemetry (both server side , client side), once find event user care there corresponding "diagnostic search" in "..." context menu custom property, search telemetry matching custom property value, allowing see telemetry related user. nice scenario describing!

computer architecture - What' s the advantage of LL/SC comparing with CAS(compare and swap) -

what' s advantage of ll/sc comparing cas(compare , swap) in computer architecture? think ll/sc can case livelock in many-core system, , case aba problem, cas not. can not find out advantage of ll/sc comparing cas. can tell me? since nobody has answered, ll/sc not suffer aba problem since conditional store fail if address referenced ll modified. furthermore, can't livelock since 1 or more ll/sc pairs failing implies succeeded. cas potentially more expensive, since may require invalidate queue flushed.

Inno-Setup: use own button texts on messagebox -

it common practice in gui design not use yes-no-messageboxes give buttons real names, e.g. save or discard. how can achieve in messageboxes displayed msgbox in innosetup, @ least ones show in code section? the msgbox function uses internally messagebox windows api function allows use specific set of predefined buttons or button groups. what's worse, buttons cannot localized (without hook like this ). so, have custom button texts need use such hook , change texts before showing dialog, show dialog , after change them common texts (because inno setup uses dialog too). another, easier option making custom form.

html - Media Print CSS Issue not showing in the Print Preview -

i have print specific layout helps show receipt. layout follows. <!-- receipts print screen specific layout --> <div id="receiptsprintscreenwrapper" class="row"> <div class="row"> <div class="col col-md-3"></div> <div class="col col-md-6"> <img class="receiptslogo" src="./assets/imgs/sfc.gif" /> </div> <div class="col col-md-3"></div> </div> <div id="staticreceiptsinfo" class="row text-center"> <div class="col col-md-3"></div> <div class="col col-md-6"> <p>xxxxxxxxxxxxxxxxxxxxxx</p> <p>xxxxxxxxxxxxxxxxxxxxxx</p> <p>xxxxxxxxxxxxxxxxxxxxxx</p> </div> <div class="col col-md-3 text-right">

cocoapods - podspec lint failing with latest Xcode beta -

i'm running pod spec lint --verbose , following output: - creating pods project - adding source files pods project - adding frameworks pods project - adding libraries pods project - adding resources pods project - linking headers - installing targets - installing target `pods-reachabilityswift` ios 8.0 - generating info.plist file @ `../../../private/var/folders/0t/w_3ytpbj79d8s6mtwlf351440000gn/t/cocoapods/lint/pods/target support files/pods-reachabilityswift/info.plist` - generating module map file @ `../../../private/var/folders/0t/w_3ytpbj79d8s6mtwlf351440000gn/t/cocoapods/lint/pods/target support files/pods-reachabilityswift/pods-reachabilityswift.modulemap` - generating umbrella header @ `../../../private/var/folders/0t/w_3ytpbj79d8s6mtwlf351440000gn/t/cocoapods/lint/pods/target support files/pods-reachabilityswift/pods-reachabilityswift-umbrella.h` - installing target `pods` ios 8.0 - generating info.plist

html - Background behind my text goes to the very end of the page instead of stopping -

Image
well want add kind of transparent, blurred out background behind text image text on still can visible. kind of this.... but problem though transparent background appears planned, goes on "forever" right until hits edge of page, instead of stopping text ends. thoughts how can fix that? css .text { position: absolute; z-index: 100; color: white; width: 100%; top: 300px; left: 10px; background-color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0.7); } you have width: 100%; in styles. remove , make width: auto; . , that's css not html! .text { position: absolute; z-index: 100; color: white; width: auto; /* epic miss */ top: 300px; left: 10px; background-color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0.7); display: inline; } also giving display: inline help.

linux - in Shell, How to do arithmetic operation on a number which is part of a string? -

this question has answer here: how use shell variables in awk script? 6 answers i wanted add 100 insertions, tried below, adding $1 instead ? #!/bin/bash change_summary="17 files changed, 441 insertions(+), 49 deletions(-)" lines_added="100" echo $change_summary echo $change_summary | awk '{ print $1 " " $2 " " $3 " " $4+$lines_added " " $5 " " $6 " " $7}' it prints 17 files changed, 441 insertions(+), 49 deletions(-) 17 files changed, 458 insertions(+), 49 deletions(-) i expecting print 541 insertions. is there better way same? use awk variable (tested gnu awk): awk -v l=$lines_added '{ print $1 " " $2 " " $3 " " $4+l " " $5 " " $6 " " $7}' or more succinctly: $ echo $change_summary | a

Android - Setting up Google Maps in eclipse -

i have old tutorial on android development lynda instructor "lee brimlow" on using google maps in android development, yet tutorial recorded in time of using android api 2.2 . the instructor says in order use maps must download "google api" , ... searched "google api 22" , find out tutorials on net must use "google play service" downloaded this link and have problem installing ... should install this? i use eclipse adt reason doesn't show update packages, have download them manually. and kindly explain me happened "google apis" ? read in fact part of "android apis" default. thanks.

android - Error: Multiple dex files define Landroid/support/annotations/AnimRes with Admob and Facebook Cordova plugins -

Image
i'm building app using cordova , ionic framework. i'm using wizcorp facebook plugin: https://github.com/wizcorp/phonegap-facebook-plugin . and added google admob plugin: https://github.com/floatinghotpot/cordova-admob-pro however when build project i'm met error: unexpected top-level exception: com.android.dex.dexexception: multiple dex files define landroid/support/annotations/animres; other solutions mention multiple android-support-v4.jar files conflicting, android-support-v4.jar file can find within facebook plugin. another solution mentioned conflicting versions (i.e android-support-v4.jar conflicting android-support-v13.jar ) - again, cannot see references android-support-v13.jar within project. another solution conflicting android-support-annotations.jar , android-support-v4.jar : multiple dex files define landroid/support/annotation/animres . cannot find android-support-annotations.jar files within project, except created in: myproject\

How to negatively match a specific value with RegEx -

i want negatively match specific value (let's 42) using (javascript) regex. i know how positively match value: /^42$/.test(42); // true /^42$/.test(43); // false /^42$/.test(422); // false i looking inverse of this: /somemagic/.test(42); // false /somemagic/.test(43); // true /somemagic/.test(422); // true the solutions google-fu turned didn't work use case because care matching entire value being tested, not piece of it. i have searched endlessly this... appreciated! thanks! you need anchored negative lookahead: document.write(/^(?!42$)\d+$/.test(42) + "<br/>"); document.write(/^(?!42$)\d+$/.test(43) + "<br/>"); document.write(/^(?!42$)\d+$/.test(422)); the (?!42$) lookahead checks @ beginning of string if string 42 (since $ asserts end of string). thus, 42 not match \d+ pattern. this technique add exceptions more generic patterns, shorthand or character classes, , patterns optional groups.

c# - LINQ to Entities does not recognize the method 'System.String IfNullOrWhiteSpace' -

so, have search query giving me error now. (it didn't used too, fyi...) anyway, it's throwing "linq entities not recognize method 'system.string ifnullorwhitespace"... is there beter way of doing this? var stringresults = _propertyrepository .getproperties() .where( // standard fields x => x.address.ifnullorwhitespace("").contains(searchstring) || x.city.ifnullorwhitespace("").contains(searchstring) || x.websiteurl.ifnullorwhitespace("").contains(searchstring) || x.zip.ifnullorwhitespace("").contains(searchstring) // overrides possible || (x.descriptionoverride ? x.descriptionoverridevalue.contains(searchstring) : x.description.ifnullorwhitespace("").contains(searchstring)) || (x.nameoverride ? x.nameoverridevalue.contains(se

When are changes locally merged with `git checkout`? -

suppose on master branch. there file in working directory called "master.txt" contains single text line "asdf". suppose git checkout f364f96d34fb2af20dbd8cccd91a83a1e277bcfe , takes me older commit on master branch head. i edit file "master.txt" (which still, @ point, has line "asdf") deleting line "asdf". i git checkout master . it appears master.txt still empty (i.e., no "asdf)! question: way things supposed work? reading textbook on git, thought changes locally merged on git checkout if no conflicts arose. deleting "asdf" creates conflict, no? when checkout commit without specifying paths, working tree updated match contents of tree of commit, current index (cache/staging area) left unchanged. what see extension of behavior: if don't add change index, git reapply on top of new working tree don't lose it. you can checkout head path of file remove change, or add index , commit it.

PHP MySQL Combine Multiple Rows from query into one result with 1 similar column -

so have database used history purposes display businesses start , end dates, affiliated persons, historical notes, , associated newspaper clippings. currently, when user searches, example (see current results), arnold & dunn, 2 results return, 1 affiliated person 'arnold', , other affiliated person 'dunn". group in sql query on returns first affiliated person. wondering how take x number of results names , concat them in php show under 1 company result? current results: arnold & dunn bicycle sales affiliated person: edwin l. arnold year established: 1886 year closed: 1888 product/service: sporting goods stores naics: 451110 arnold & dunn bicycle sales affiliated person: james r. dunn year established: 1886 year closed: 1888 product/service: sporting goods stores naics: 451110 expected results: arnold & dunn bicycle sales affiliated person: edwin l. arnold, james r. dunn year established: 1886 year closed: 1888

xcode - "Line by line" debug with custom Makefile -

i working xcode , c project developed in linux. thing has custom makefiles had create new target specifying external build system, , when run project outputs bin file, no matter if there breakpoints. program run within xcode can debug (line line). the "main" makefile is: all: $(make) -c src mkdir -p bin mv src/program bin/program debug: $(make) -c src debug mkdir -p bin mv src/program bin/program clean: $(make) -c src clean rm -f bin/program and in src folder makefile: src=[whatever] obj=$(src:.c=.o) cc=gcc rm=rm -f cflags=[whatever] ldflags=[whatever] %.o : %.c $(cc) $(cflags) -c $< : program program : $(obj) $(cc) $(obj) -o program $(ldflags) debug : cflags += -ddebug -ggdb debug : program clean : $(rm) *.o program (the [whatever]'s added me). question is: should (modify makefiles,...) can debug program breakpoints , line line xcode?

r - Enable rmarkdown / pandoc-citeproc citations in Jekyll blog via servr -

Image
i'm basing rmarkdown -jekyll-blog off of yihui's fantastic boilerplate using servr::jekyll() , in turn wraps knitr . everything's dandy, except can't rmarkdown -citations work (which in turn wrap pandoc-citeproc , believe). so when add bibliography.bib @manual{yihui-2015, title = {knitr: general-purpose package dynamic report generation in r}, author = {yihui xie}, year = {2015}, note = {r package version 1.11}, url = {http://yihui.name/knitr/}, } to directory, amend preamble of boilerplate 2014-09-28-jekyll-with-knitr.rmd bibliography: ../bibliography.bib or bibliography: bibliography.bib (see below) , add boilerplate itself: ## citations work this: [@yihui-2015] see references @ bottom. this get: [ just confirm setup is, in fact, correct, ran library(rmarkdown) render(input = "_source/2014-09-28-jekyll-with-knitr.rmd") which produces html with citations, expected: [ in way, not surprising, because a

html - Can I restrict viewport manipulation in X3DOM to prevent zooming? -

i have 3d model need display on webpage, using x3dom. i visitors page able click , drag image, rotating on axis, don't want them have ability zoom. can figure out how give them rotational ability , zoom. can't figure out how restrict zoom aspects of viewport. <x3d id='someuniqueid' showstat='false' showlog='false' x='0px' y='0px' width='1920px' height='1080px'> <scene> <navigationinfo type='"turntable"'></navigationinfo> <inline url='models/model.x3d' inline> <scene> </x3d> the turntable type has typeparams feature, i've tried. doesn't seem restrict zoom. thoughts on how can allow rotation, while preventing zoom. adding speed = 0 navigationinfo should that. <navigationinfo type="turntable" speed="0"/>

java ee - j2ee - User with multiple security roles -

i developing java servlets webapp use container based security authenticate users in. question can user mapped more 1 security role ? for example in case-: a user can a teacher co-ordinator ( can teacher) admin (who can teacher) now admin have privileges access more functionality teacher. how possible container based security container tomcat ? i not using framework spring security or apache shiro. in short - user or better group - can mapped many security roles. easiest define security roles in web.xml, this: <security-role> <role-name>teacher</role-name> </security-role> .... and use in <security-constraint> specify role has access given set of resources. finally need map these roles users, server specific. you can find basic information regarding security roles , constraints in websphere application server v7.0 security guide in securing web application chapter. instead of using tomcat, i'd suggest us

Java HTML Parsing a Page with Infinite Scroll -

how can grab page's html in java if page has infinite scroll? i'm grabbing page way: url url = new url(stringurl); urlconnection con = url.openconnection(); inputstream in = con.getinputstream(); string encoding = con.getcontentencoding(); encoding = encoding == null ? "utf-8" : encoding; string html = ioutils.tostring(in, encoding); document document = jsoup.parse(html); but doesn't return of content associated infinite scroll section of page. how can trigger scrolling on html page jsoup document contains section? infinite scroll describes technique page not contain content. javascript code runs in browser, sends request server addiional content , adds page. when scroll towards end of available content, javascript code repeats process: sends request , adds additional content. therefore, need web browser javascript engine can run javascript code , produce events cause code load content.

rust - Why should lifetime parameters be declared before type parameters? -

i trying out simple function when got compiler error. actual reason behind this? in case (following code), writing type parameter before lifetime parameter has no effect. shouldn't compiler know better? use std::fmt::debug; fn random_func<t : debug, 'a>(parameter : &'a mut t) { println!("{:?}", parameter); } fn main(){ let mut name : string = "random".to_string(); random_func(&mut name); println!("{:?}", "compiled successfully"); } error: life_time_trait.rs:3:27: 3:29 error: lifetime parameters must declared prior type parameters life_time_trait.rs:3 fn random_func<t : debug, 'a>(parameter : &'a mut t) { ^~ i'm not sure the reason, remember type parameters can have lifetime bounds, lifetime parameters can't have type bounds. putting them first means don't need deal non-forward declarations. personally, think

javascript - How do I utilize $.Deferred() to handle a callback function and ajax call -

i beginning wrap head around using promises , use guidance on how scenario work. code below larger plugin file have included pieces think relevant. there callback function(callbackbeforesend) performing async geolocation stuff(i've got working) , need hold ajax call until functions have completed. i see in code using $.deferred() handle ajax response , wondering if there way tie callback function , initial ajax call $.deferred() handle proper execution order of everything. so happen is callback function fires async stuff happens in callback , returns lat, lng, address ajax fires lat, lng, address returned callback any appreciated. still don't understand promises trying learn. thanks! $.extend(plugin.prototype, { _getdata: function (lat, lng, address) { var _this = this; var d = $.deferred(); if (this.settings.callbackbeforesend) { this.settings.callbackbeforesend.call(this, lat, lng, address); } $.aja

angularjs - Manipulate the results stored within a 'promise' -

i have service wish use first grab object json file , return selected data said object, depending on user requests. this service may used multiple times per visit, don't wan user have wait while data retrieved on every occasion. i have set service request json file once per page load, i'm having trouble extracting data wish return. my idea take clone of initial promise object (referred promiseall in code) , manipulate data within, before returning cloned object (referred 'promiseselected') user. what have below works, if users requests list of type searchable , every future request has results request. i'm not sure i'm doing wrong (or if there better way this), i'd apprciate pointers. here how using service - app.controller('searchctrl', ['$scope', '$localstorage', '$stationslist', function($scope, $localstorage, $stationslist){ $stationslist.getlist('searchable').then(function(data){

ios - Swift casting statement with CF -> NS classes -

while trying integrate address book framework , converting cf types ns classes swift classes, noticed strange: abrecordcopycompositename(record)?.takeretainedvalue() as? nsstring returns nil abrecordcopycompositename(record)?.takeretainedvalue() nsstring? returns optional("john smith") my question isn't as? nsstring synonymous as nsstring? as? nsstring ? (if so, why not?) therefore, abrecordcopycompositename(record)?.takeretainedvalue() as? nsstring should equivalent abrecordcopycompositename(record)?.takeretainedvalue() nsstring? as? nsstring should return "john smith". (this working on ios 8.3, ios 8.4 broke addressbook feature.) as (ns)string? no supported syntax, might work in way. either can cast forced ( as! ) or optional ( as? ) or can bridge ( as ) , there's no exclamation/question mark after type. abaddressbookcopyarrayofallpeople() returns unmanaged<cfarray>! , abrecordcopycompositename() returns unmanaged

How to authorize an internal server (no public URL) OAuth 2.0 origin for a Google API? -

when creating oauth 2.0 client id use google api, 1 must add authorized origin providing server's url (at google developer console -> api & auths -> credentials tab). however, server not have public url. this page mentions , suggests using localhost, tried , did not work. ideas?

Excel VBA Rounding -

i trying use following code replace each cell within selected range rounded number of cell within range continue error. sub add_round() dim rng range each rng in selection rng.value = round(rng.value, -4) next rng end sub thank you! i believe need make function yourself, follows (i'm not aware of function in vba works excel's native round function, allows round nearest 1000 etc): sub add_round() dim rng range each rng in selection rng.value = round(rng.value / 10000, 0) * 10000 next rng end sub alternatively can tell vba use native excel function this: sub add_round() dim rng range each rng in selection rng.value = application.worksheetfunction.round(rng.value, - 4) next rng end sub

python - Django autoincrement IntergerField by rule -

i have special case, customer requires specific (legacy) format of booking numbers, first 1 starts current year: 2015-12345 every year have start 0 the other 1 starting foreign-key: 7-123 first document created every user gets number 1, , on. unfortunately there long lists starting booking number, fetching records , calculating booking number not option. have thought overriding save() method, reading , auto-incrementing manually, simultaneous inserts? the best , reliable way sql trigger eliminate worries simultaneous inserts. overriding save method workable. explicitly declare primary key field , choose integer it. in save method if primary key none means saving new record, query database determine should new primary key, asign , save. wherever call save method need have atomic transaction , retry save if fails. btw, starting 0 each year. that's going leading conflicts. have prefix primary key year , strip out @ time display it. (believe me don't want mess

php - Paypal Pro Iframe opencart -

i got email paypal saying (below). , cant find me fix it, im using opencart standard payment gateway called "paypal website payment pro iframe" , not know how update it. appreciated. we contacting regarding change required make 30th august 2015. paypal has detected have hard coded following pro hosted solution url in code:(had remove link) paypal not recommend hard coding. instead, should read url button creation api response. if must hard code url, need update following: https://securepayments.paypal.com/webap ... ionprocess you can find comprehensive instructions regarding required integration changes on our technical support centre: https://ppmts.custhelp.com/app/answers/detail/a_id/1231 click above link or visit paypal technical support centre , search article id ‘1231’ or ‘updating api integration pro hosted’ instructions on ensuring payment processing not interrupted when stop supporting current hardcoded url. important: must either read url butt

java - Initialized 2d array of int prints out zero -

i'm trying initialize 2d array using braces notation follows: int[][] matrix = {{0, 2, 1}, {1, 2, 3}, {3, 2, 1}}; int[][] out = rotate(matrix); for(int = 0; < 3; i++){ for(int j = 0; j < 3; j++){ system.out.print(matrix[i][j] + " "); } system.out.println(""); } for output, getting 0 0 0 0 0 0 0 0 0 can tell me problem?

design patterns - how to refactor this Haskell chain of functions code? -

i have software design experience, , learning haskell now. in many real world software developments, 1 faces situation 1 given, instance, below: suppose, have code f1 b c d = e e1 = f2 b c (f3 a) e2 = f4 d e = e1 + e2 f2 b c d = n + c + d n = f5 b f5 n = n*n f3 = * 2 f4 = + 3 now if want change f5 takes yet parameter, have change chain of functions right upto f1. can done shown below. note added parameter x. f1 b c d x = e -- f1 needs changed e1 = f2 b c (f3 a) x e2 = f4 d e = e1 + e2 f2 b c d x = n + c + d -- f2 needs changed n = f5 b x f5 n x = n*n -- f5 changed (**bang**) f3 = * 2 f4 = + 3 is normal haskell way of doing type of thing or there better (more haskell-ish) way? know such change in api disturb client code, how impact can kept minimum , there hasekll way it? on more general level: how haskell perform in such cases (especially taking consideration immutable state feature)? has offer developers in regard? or haskell has got no ro

node.js - Deleting a document from Cloudant Database in nodejs -

this may basic question i've looked through github cloudant library , cloudant documentation , deleting specific document database mentioned never thoroughly explained. it's frustrating. closest i've gotten deleting document using http request rather functions cloudant library offers , continuously "document update conflict" though i'm passing through _rev of document. can explain deleting document cloudant database using nodejs example sort out. thanks. it depends node module using communicating cloudant. nano driver, can use destroy method delete document. see following code example: var nano = require("nano")("cloudanturl"), db = nano.db.use("yourdb"); db.destroy(docuniqueid, docrevnum, function(err, body, header) { if (!err) { console.log("successfully deleted doc", docuniqueid); } }); key cloudanturl - url of cloudant instance, username , password embedded yourdb - database name doc

c++ - template function to a function pointer inside a struct -

i wanted use template function(s) referencing via pointer using function pointer available inside structure like typedef struct arithmeticfunc { string funcname; int (*funptr)(int,int); }; for example: int add(int a, int b) return (a+b); int sub(int a, int b) return (a-b); arithmeticfunc func[2] = { {"addition", &add}, {"subtract", &sub} }; for(int = 0; < 2; i++) { printf("result of function : %s %d",func[i].funcname.c_str(),func[i]->funcptr(2,1)); } now need use template function instead of normal static function. kindly let me know, doing on right method. if understand question, want struct , functions templates? template <typename t> struct arithmeticfunc { std::string funcname; t (*funptr)(t, t); }; template <typename t> t add(t a, t b) { return a+b; } template <typename t> t sub(t a, t b) { return a-b; } then use

c# - Error converting value "Any Value" to type 'System.Web.Http.IHttpActionResult' -

i'm getting error when call web api method returns bool ( edit - object, error comes hub attribute ): error converting value true type 'system.web.http.ihttpactionresult this method: [httpget] [hub(name = "servicelog", incomingmethod = "logincoming", outgoingmethod = "logoutgoing")] [responsetype(typeof(bool))] public async task<ihttpactionresult> testmethodasync(int i) { var result = await _repository.testmethodasync(i).configureawait(false); return ok(result); } edit: offending code in hub attribute: public override async void onactionexecuted(httpactionexecutedcontext actionexecutedcontext) { ... if (hub != null) { // line throws error var response = await actionexecutedcontext.response.content.readasasync(actionexecutedcontext.actioncontext.actiondescriptor.returntype); hub.clients.all.invoke(outgoingmet

c# - How to play wav file in IE 10/11 -

i want play .wav file in ie 10/11. have tried playing .wav files in ie 10/11 not work properly. i looking specificaly .wav file support in ie 10 /11 , other ie versions. what trying? <embed src="themesong.wav" hidden="true" autostart="true" loop="1"> for automatic and <a href="clicknoise.wav">play sound</a> for click should work.

groovy - How to partially mock service in Grails integration test -

i attempting write test controller calls service method. mock dependent method within service. my spec follows: mycontroller mycontroller = new mycontroller() def mockmyservice def "my spy should called"() { when: mockmyservice = spy(myservice) { methodtospy() >> { println "methodtospy called" } // stub out content of fn } mycontroller.myservice = mockmyservice mycontroller.callservice() then: 1 * mockmyservice.methodtospy() } when attempt run test, following error: failure: | spy should called(spybug.mycontrollerspec) | few invocations for: 1 * mockmyservice.methodtospy() (0 invocations) unmatched invocations (ordered similarity): 1 * mockmyservice.servicemethod() 1 * mockmyservice.invokemethod('methodtospy', []) 1 * mockmyservice.invokemethod('println', ['in servicemethod call methodtospy']) 1 * mockmyservice.invokemethod('

javascript - Why does Infinity passed to interval does not wait forever in Rx.js? -

can please explain me why following snippet outputs digits 0 6 ? rx.observable.interval(1/0).take(6).foreach(x => console.log(x)); output: 0 1 2 3 4 5 you can see the source code of rxjs observable.interval expects (and uses) input integer: module rx { export interface observablestatic { /** * returns observable sequence produces value after each period. * * @example * 1 - res = rx.observable.interval(1000); * 2 - res = rx.observable.interval(1000, rx.scheduler.timeout); * * @param {number} period period producing values in resulting sequence (specified integer denoting milliseconds). * @param {scheduler} [scheduler] scheduler run timer on. if not specified, rx.scheduler.timeout used. * @returns {observable} observable sequence produces value after each period. */ interval(period: number, scheduler?: ischeduler): observable<number>; } }