Posts

Showing posts from May, 2011

angularjs - $scope.$on executing more than once -

i using broadcast , $scope.$on , method in $scope.$on executing multiple times. here code. in controller: $scope.selectitem = function(index, item){ baseservice.hideview(); }, $scope.$on("closeview",function(){ $log.debug("insideon: calling hidevieweditem"); $scope.hidevieweditem(); }); in baseservice : app.factory('baseservice', function ($rootscope, $log, $location) { return { hideview :function(){ $log.debug("calling closeview"); $rootscope.$broadcast("closeview", 1); } } }); here calling hideview once hidevieweditem calling 3 times. in console getting these messages. calling closeview insideon: calling hidevieweditem insideon: calling hidevieweditem insideon: calling hidevieweditem how make call once?

C# fastest way to insert data into SQL database -

i receiving (streamed) data external source (over lightstreamer) c# application. c# application receives data listener. data listener stored in queue (concurrentqueue). queue getting cleaned every 0.5 seconds trydequeue datatable. datatable copy sql database using sqlbulkcopy. sql database processes newly data arrived staging table final table. receive around 300'000 rows per day (can increae within next weeks strongly) , goal stay under 1 second time receive data until available in final sql table. maximum rows per seconds have process around 50 rows. unfortunately, since receiving more , more data, logic getting slower in performance (still far under 1 second, wanna keep improving). main bottleneck (so far) processing of staging data (on sql database) final table. in order improve performance, switch staging table memory-optimized table. final table memory-optimized table work fine sure. my questions: is there way use sqlbulkcopy (out of c#) memory-optimized tables? (...

c# - Better way to copy text in a textbox to datagridview -

good day! i have problem every text change in text box, selected item in datagriview should copy value. have code lags when type(like fast) in textbox. is there better way w/o lagging? please help... here's have far: private void txttext_textchanged(object sender, eventargs e) { datagridview1[2, pos].value = txttext.text; } you may need limit number of events handled. requirements allow use textbox validated or lostfocus events instead? if not rx , throttle textchanged event. can achieved so: iobservable<eventpattern<eventargs>> observable = observable.fromeventpattern( txttext, "textchanged").throttle(timespan.frommilliseconds(500)) .subscribe(ep=> datagridview1[2, pos].value = txttext.text;); you throttle timer . timer mytimer = new timer(); mytimer.interval = 500; mytimer.tick = ontimertick; private void ontimertick(object o, eventargs e) { mytimer.stop(); datagridview1[2, pos].value = txttext....

java - Spark SQL - DataFrameReader load method with where condition -

i trying use dataframereader.load("table name") load hive table records , return dataframe . but dont want load entire records, wanted fetch records specific date (which 1 of field in hive table). if add condition in returned dataframe, load entire table first filter records based on date? because hive tables huge , partitioned based on date field. basically want achieve select * table date='date' using load method without loading entire table. recent versions of spark support feature called "predicate push-down". want: pushes, possible, sql clauses source. i'm not sure if predicate push-down works hive data source (it works parquet, jdbc , others sources). see does spark predicate pushdown work jdbc?

weka - csv loader failed to load reason wrong number of values .Read 10,expected 8 ,read token [EOL] ,line 17 -

i trying convert csv arff using weka's csvloader gui. in options set enclosure character strings , . following error: weka.core.converters.csvloader failed load reason wrong number of values .read 10,expected 8 ,read token eol ,line 17 here lines 17 opensource:indicator-7fb1f287-3e7d-4069-8c41-ae7699055c81 sid:2405035 | "et cnc shadowserver reported cnc server port 6667 group 11" | rev:3590 ip watchlist snort rule emergingthreats | alert tcp $home_net -> [217.146.93.144,217.146.93.146,217.188.63.252,217.195.122.2,217.208.43.77,220.99.77.147,222.73.84.17,222.122.47.78] 6667 (msg:"et cnc shadowserver reported cnc server port 6667 group 11"; flags:s; reference:url,doc.emergingthreats.net/bin/view/main/botcc; reference:url,www.shadowserver.org; threshold: type limit, track by_src, seconds 360, count 1; classtype:trojan-activity; flowbits:set,et.evil; flowbits:set,et.botccip; sid:2405035; rev:3590;) opensource:observable-fe41db2c-da28-4e1e-96e...

exception - Advancing Python generator function to just before the first yield -

this question has answer here: how can run initialization code generator function immediately, rather @ first call? 5 answers when instantiate generator function, won't execute code until call next on it. it means if generator function contains kind of of initialization code, won't executed until it's iterated on. consider example: def generator(filename): open(filename) f: data = f.read() while true: yield data gen = generator('/tmp/some_file') # @ point, no generator code executed # initialization code executed @ first iteration x in gen: pass if file not exist, exception raised @ loop. i'd code before first yield execute before generator iterated over, exceptions during initialization raised @ generator instantiation. is there clean pythonic way so? wrap regular function around generator ,...

hidden - How to set the jQuery slideUp() Method to hide elements when the page loads -

i using slideup , slidedown jquery function display images on webpage slide text down once clicked on. in following code have js set when load page text down. slide function works, have page load text hidden/up. any suggestions how can alter code have text hidden when page loads highly appreciated. thank in advance taking time @ this! here code: jquery(document).ready(function($) { $(".pic").click(function(e) { var more = $(this).find('.more'); if ( $(more).is(':visible') ) { $(more).slideup('fast') } else { $(more).slidedown() } $('.more').not( $(more)).slideup() }) }); you have 2 options. either set initial .pic state hidden in css so: .more { display: none; } or trigger javascript event after setting callback, because they're presently visible, hide them. can done so: jquery(document).ready(function($) { $(".pic").click(function(e) { var more = $(this).find('.more'...

android - Disable Login with Email in Account Kit -

Image
just wondering if it's possible disable users logging in email using new facebook account kit sdk. clear, want them able login via facebook or phone # (but not email). tried going through docs, haven't found answer yet. yes possible. unfortunately facebook has not specified in documentation. here's screenshot facebook developer console verify that.

node.js - iOS Safari fails to connect to secure websocket, but works on desktop -

i have node.js https server using non -self-signed certificates. believe godaddy, not sure though. employer provided me key , cert files. server: var fs = require('fs') , server = require('https').createserver({ key: fs.readfilesync( __dirname + "/key.pem" ), cert: fs.readfilesync(__dirname + "/cert.pem" ) }) , websocketserver = require('ws').server , websocketserver = new websocketserver({ server: server, }) , port = 8080; server.listen(port, function(){ console.log('listening on ' + server.address().port) }); client: var websocket = new websocket('wss://my.website.com:8080'); this code works expected on desktop chrome, safari, , firefox. client able connect the secure websocket. however, trying on ios 9.3.1 safari gives me following error: the operation couldn't completed.(osstatus error -9807.) osstatus showed me caused invalid certificate chain. unfortunately, here ...

osx - brew install - permission denied (after chown -R `whoami` ) -

$ brew install fontconfig error: permission denied - /library/caches/homebrew/formula/fontconfig.brewing $ sudo chown -r `whoami` /usr/local $ brew install fontconfig error: permission denied - /library/caches/homebrew/formula/fontconfig.brewing not sure go here. ran brew doctor fix existing issues, can't seem past this. trojanfoe 's answer helped. there permission issue library/logs folder wasn't assigned to, somehow library/caches/homebrew folder didn't exist. created that, subfolder formula , , changed permission , installed fine. cleared lot of errors having. thanks everyone. update @fet's 1 liner works great. mkdir -p ~/library/caches/homebrew/formula

c# - UWP Manipulation with Rotation, Scale, and Pan -

we building c# universal windows app has drawings live-rendered overlays on it. need able rotate, zoom, , pan image of overlays following it. in future overlays should sizable , movable via screen's coordinate system. we using viewbox our control contains image , overlays. creating transformgroup contains matrixtransform , compositetransform have seen in of samples. during each manipulation event on viewbox, resetting composite transform transform group's value, making composite transform delta transform. we have rotation, scaling, , panning working. however, need able set zoom factor on matrix, seem unable do, can make sure doesn't go above or below our max/min zoom factor. need ensure viewbox doesn't "fly off" screen when reaches edge. it great if didn't have reset transformmatrix every time, removing delta factor transform (we set zoom scale then). however, can't seem find center points rotation , zoom when this. here sample app cre...

Access SQL query select with a specific pattern -

i want select each 5 rows unique , select pattern applies rest of result (i.e if result contains 10 records expecting have 2 set of 5 unique rows) example: what have: 1 1 5 3 4 5 2 4 2 3 result want achieve: 1 2 3 4 5 1 2 3 4 5 i have tried , searched lot couldn't find close want achieve. assuming can somehow order rows within sets of 5: select t.row % 5, t.row #t t order t.row , t.row % 5 we closer truth more details data looks , you're trying do.

ruby - disable nfs pruning in vagrant -

most (not sure why) vagrant (1.8.1) started asking root password. @ work no root privileges given (no sodoer) i looking way tell vargant stop nfs pruning together sadly documentation not how modify particular flag , don't know ruby code gives away there should flag can't figure out put "false" in there i intend disable nfs or skip part together. both welcome. my starting point ~/.vagrant.d/vagrantfile vagrant.configure('2') |config| config.vagrant.host :nfs_prune => false end error message is: pruning invalid nfs exports. administrator privileges required... ps: no, not use nfs in shared folders you should able disable using config.nfs.functional = false functional (bool) - defaults true. if false, nfs not used synced folder type. if synced folder requests nfs, error. vagrantfile can loaded multiple sources, see load order , merging vagrant loads series of vagrantfiles, merging settings goes. allows vagra...

input - Calculating rotation degrees based on delta x,y movement of touch or mouse -

i have object in 2d space want rotate based on how input in 2d space moves. basically, think move finger or mouse around on screen either clockwise or counter clockwise, , object rotates relative how rotate finger. position of object not matter @ all, meaning rotation translated object finger movement, , there no relation between object's position , finger movement position. i using libgdx , x , y delta movement (positive , negative integers depending on direction of movement) in call method "touchdragged". how can use delta x , y calculate degrees of movement can apply object. preferably i'd add radian or degree value. i can work fine if using 1 axis. i.e. if move finger or down, or rotates either clock-wise or counter-clockwise. problem getting work result of both x , y movement. ps: did bit of looking around before posting question , know there similar questions couldn't figure out based on them. don't know why seemed different questions tacklin...

html - Background div menu issue -

i want make menu colored background. use simple "background" or "background-color" on div containing of menu don't see color. know it's dumb i'm stuck.. here html : <header class="menu-top"> <div class="menu"> <ul> <li><a>home</a></li> <li><a>portfolio</a></li> <li><a>contact</a></li> </ul> </div> </header> here jsfiddle : https://jsfiddle.net/szf1xksv/ an alternative use: .menu > ul > li { display: inline-block; } this preserve height of list items.

Capturing keystrokes in visual studio code extension -

i able capture keystrokes in visual studio code extension. need know new text either added or removed , position of change in file. i have registered listener: vscode.window.ondidchangetexteditorselection(handlechange) and getting updates on every single caret move having hard time getting added/removed text , positions event passed in. currently, doing in handler: function handlechange(event) { console.log("change in text editor"); for(var = 0;i < event.selections.length;i++) { var selection = event.selections[i]; console.log("start- line: (" + selection.start.line + ") col: (" + selection.start.character + ") end- line: (" + selection.end.line + ") col: (" + selection.end.character + ")"); } console.log(event); } the documentation mentions called textdocumentcontentchangeevent seems need don't know how register handler receive these. i discovered problem in or...

MIPS32 aluipc instruction implemented in java -

i'm implementing mips32 instruction set in java build simulator. have come aluipc instruction , i'm unsure whether i'm doing correct of not. in docs mips 32 "this instruction performs pc-relative address calculation. 16-bit immediate shifted left 16 bits, signextended, , added address of aluipc instruction. low 16 bits of result cleared, result aligned on 64k boundary. result placed in gpr rs." and operation example give : gpr[rs] <- ~0x0ffff & ( pc + sign_extend( immediate << 16 ) ) my code is: 0x0ffff & (v1 + (v2 << 16)); where v1 pc , v2 immediate, correct in thinking simple store in int , thats answer? or clear 16 lower bits , store high 16?

MySQL Hexadecimal Binary Limit -

i have table 2 columns: 'id' (datatype=int) , 'representation' (datatype=binary). want store hexadecimal value in form of binary digits in 'representation' column. max number of binary digits can store in 'representation' column ? mysql binary the mysql docs on binary data type , mention: the permissible maximum length same binary , varbinary char , varchar , except length binary , varbinary length in bytes rather in characters. so binary put on same level char , , varbinary varchar . the docs on char data type , mention: the length of char column fixed length declare when create table. length can value 0 255. so maximum size binary therefore achieved this: create table mytable ( id int, representation binary(255) ) this corresponds 255 bytes of data, corresponds 510 hexadecimal digits, or 2040 bits. varbinary the varbinary type can store 65,535 bytes, sizes of other columns must subtracted....

linode - I don't understand this Python TypeError -

i trying use linode api along linode-python sdk manage linode servers. however, i'm getting typeerror don't understand when run linode-disk-list() command. this how linode-python api defines method i'm calling. can see, linodeid required. @__api_request(required=['linodeid'], returns=[{u'create_dt': u'yyyy-mm-dd hh:mm:ss.0', u'diskid': 'disk id', u'isreadonly': '0 or 1', u'label': 'disk label', u'linodeid': 'linode id', u'size': 'size of disk (mb)', u'status': 'status flag', u'type': "in ['ext3', 'swap', 'raw']", u'update_dt': u'yyyy-mm-dd hh:mm:ss.0'}]) d...

mysql - every derived table must have its own alias -

i running query on mysql select id ( select id, msisdn ( select * tt2 ) ); and giving error: every derived table must have own alias. what wrong ? every derived table (aka sub-query) must indeed have alias. i.e. each query in brackets must given alias ( as whatever ), can used refer in rest of outer query. select id ( select id, msisdn ( select * tt2 ) t ) t in case, of course, entire query replaced with: select id tt2

PHP How to correctly handle critical errors notification on a production server. -

generally errors log , such. should important errors need attention on production server. example if deleting series of orm models in process , somewhere during process model fails delete. want process delete many objects possible , not throw exceptions user. want developers or admin notified of important errors can instantly fixed. in past had added in script email me error under circumstances. if in dev environment throw , exception, when in production die silently , email error. is there of way high-lite exceptions more critical , hence can enable developers take action? create more generic solution. eg if critical error/exception thrown emailed admin on production, else follows normal procedure (such log). there amazing packages provide solution i'm looking more native if possible. you can put htaccess file on site root following lines. # php error handling production servers php_flag display_startup_errors off php_flag display_errors off php_flag html_err...

javascript - Google Drive File Iterator within Folder iterator -

i trying write code file iterator through google scripts goes through particular folder in google drive, searching files (within subfolders) of particular name. my current iterator bring files of name if in immediate folder, not in subfolders. var folder = driveapp.getfolderbyid('folderid') var files = folder.getfilesbyname("file name"); while (files.hasnext()) { var file = files.next(); is there way make iterator sift through subfolders find files given name? from pure comp sci 101 perspective, need put code function call recursively descend folder hierarchy. however ... don't that. ... fetch of folders in single call , build memory model of hierarchy. use model create list of candidate folder ids, search file name, , compare parent ids of matches list of candidate folder ids.

Haskell type class instantiation -

i trying set (polya a) , (polyb a) instances of class polynomial, want implement coeffs, fromcoeffs, coeffsb, fromcoeffsb. not quite sure doing wrong, because receive error message saying functions not visible class polynomial. please? class polynomial p --default implementations data polya = coeffs [a] deriving (show) data polyb = const | x (polyb a) deriving (show) --instances instance polynomial (polya a) coeffs (coeffs f)=f fromcoeffs f= coeffs f instance polynomial (polyb a) coeffsb (const f)= [f] coeffsb (x f a)= coeffsb f ++ [a] fromcoeffsb [] = error "wrong input!" fromcoeffsb [f]= const f fromcoeffsb lis@(_:t)= x (fromcoeffsb (init lis)) (last lis) the following code compiles me: class polynomial p coeffs :: p -> [a] fromcoeffs :: [a] -> p --default implementations data polya = coeffs [a] deriving (show) data polyb = const | x (polyb a) deriving (show) --instances instance polyn...

cookie create with php can't be read in wordpress -

i create simple cookie the cookie there, exists, can't read inside wordpress shortcode or function. php cookie_create.php $data = $_post['v1']; setcookie( 'namecookie', $data, time() + 3600); inside wordpress try read it function.php or in main file of plugin. if(isset($_cookie['namecookie'])) { echo "all right"; } else { echo "something wrong"; } no matter do, prints else wordpress has it's own cookie functions. using make things simpler: how can set, , destroy cookies in wordpress?

c# - Debugging exception through multiple nested async calls -

per answer this question , form capturing exception thrown asynchronous method looks this: public async void dofoo() { try { await foo(); } catch (protocolexception ex) { /* exception caught because you've awaited call. */ } } great. seems disintegrate if want bubble several levels of asynchrony though. here's exception originates: internal static async task makepdfpagesfrompdf(pdf pdf, byte[] pdfbytes, int jobid) { ienumerable<image> pdfasimages = pdfoperations.pdftoimagespdfium(pdfbytes, dpi); if(pdfasimages.count() < 1) { throw new argumentexception("pdf has no pages."); } // ... more code ... } here's method calls makepdfpagesfrompdf : internal static async task processbase64pdf(pdf pdf, int jobid, string componentdesignname) { byte[] pdfbytes = convertbase64topdfbytearray(pdf.url); // base64 data in pdf.url await uploadpdftoawss3(pdf, pdfbytes, jobid, compon...

DSPACE: Passing the authority via OAI -

i wonder if via oai authority of metadata can passed ? metadata value have text_value , authority. can authority passed ? many in advance yes, can expose authority key via oai (that's assuming you're on xoai -- became standard in dspace 3). here example custom metadata format, org_theses , exposing text value ( org_theses:name ) , authority key ( org_theses:id ) dc.contributor.advisor entries: <xsl:for-each select="doc:metadata/doc:element[@name='dc']/doc:element[@name='contributor']/doc:element[@name='advisor']/doc:element"> <org_theses:supervisor> <org_theses:name> <xsl:value-of select="doc:field[@name='value']" /> </org_theses:name> <org_theses:id> <xsl:value-of select="doc:field[@name='authority']" /> </org_theses:id> </org_theses:supervisor> </xsl:for-each> place in appropriate file in [dspac...

c++ - Computing a 3D power spectrum in fftw -

i trying compute 3d power spectrum -- is, averaged power in frequency shells. think i'm doing calculation of shell densities correctly, i'm not sure how determine frequency of each shell. supposing sampling rate fs same in each dimension, , length of original samples in each dimension same value n . shell "index" idx = sqrt(i*i + j*j + k*k) i, j, , k extent in each direction. how compute frequency of shell? it's simpler think: vector (i, j, k) wave vector , associated frequency taking length , dividing length of edge of cube. f = sqrt(i*i + j*j + k*k)/edgelength the result spacial frequency. if looking temporal frequency, need additional information links 2 together. the thing need take care of, location of 0 frequency within fft transformed cube: algorithms place @ upper left corner, others place in center. wherever is, need take care don't misinterpret low frequency aliased high frequency in opposite direction, i. e. absolute value of...

google app engine - set 404 page for php -

i have create dynamic page error code 404. how can set same in app.yml? i tried setting error handlers in app.yml not working. error_handlers: - error_code: 404 file: page404.php it keeps on giving: the url <wrong url> not match handlers. a couple of things note. you don't have use error handlers deal 404. , there no specific 404 error handler. there following error_handler types a default handlers , over_quota , indicates app has exceeded resource quota; dos_api_denial , served client blocked app's dos protection configuration; timeout , served if deadline reached before there response app. see docs https://developers.google.com/appengine/docs/php/config/appconfig#custom_error_responses in addition custom error handler not render php script need static html, if want 404 response page run php need use normal handler catches not matching 1 of handlers, per other answer.

.net - Testing DataContractSerializer with String -

i'm testing sending complex message object on wcf service , getting various serialization errors. in order simplify things i'm trying cut down testing datacontractserializer , i've written following test based on code here : dim message tlamessage = mockfactory.getmessage dim dcs datacontractserializer = new datacontractserializer(gettype(tlamessage)) dim xml string = string.empty using stream new stringwriter(), writer xmlwriter = xmlwriter.create(stream) dcs.writeobject(writer, message) xml = stream.tostring end using debug.print(xml) dim newmessage tlamessage dim sr new stringreader(xml) dim reader xmlreader = xmlreader.create(sr) dcs = new datacontractserializer(gettype(tlamessage)) newmessage = ctype(dcs.readobject(reader, true), tlamessage) 'error here reader.close() sr.close() assert.istrue(newmessage isnot nothing) however gets unusual error in on call readobject : unexpected end of file while parsing name has occurred. line 1, position 6144 ...

How to create two days AllDay Event with Google Apps Script? -

i want use google apps script createalldayevent(title, date) create day google calendar, there 1 date parameter, create 1 day allday google calendar. now need create 2 days allday google calendar (e.g.:from jun 28, 2013 jun 29, 2013), how do? thanks help! you need use createalldayeventseries() , accepts recurrence parameter. var recurrence = calendarapp.newrecurrence().adddailyrule().times(2); var eventseries = calendarapp.getdefaultcalendar().createalldayeventseries('my day event', new date('june 28, 2013'), recurrence, {guests: 'everyone@example.com'}); logger.log('event series id: ' + eventseries.getid());

php - How to send mail in zend with linode sendmail server -

my project set-up on linode web-server , developed in zend framework 1.12. trying send mail, using zend_mail() function not able succeed. not give error can not able send mail. while checking server configuration in phpinfo found server has send mail library directive sendmail_path /usr/sbin/sendmail -t -i my code below $mail = new zend_mail(); $mail->setbodytext('this text of mail.') ->setfrom('somebody@example.com', 'some sender') ->addto('somebody_else@example.com', 'some recipient') ->setsubject('testsubject') ->send(); can me regarding changes in above code

opengl - Orders of Modifying the Shape -

Image
i started learning transformations in opengl, , confused steps of modifying shape different position, angles or sizes. for example, have house in 2d scene follow: let's want transforms scene in (a) scene in part (b) of house, how should decide whether should scale it, translate or rotate first ? outcome going different ? thank you. the outcome going different based on order of transforms. here pseudocode answers question directly (assuming each function takes x,y,z parameters): translate(-6, 0, 0) rotate(0, 0, 135) scale(2, 1, 1) now let's @ why order matters! first, have without transforms: next, let's see happens when rotate counter-clockwise 45° , translate along positive x axis: notice how translation caused square move toward top-right corner? because rotation transform modifies local axes. positive x points top-right. if rotated 180° +x point towards left instead of right. now let's @ happens when perform same transforms in reve...

extjs4 - How to get ExtJS Grid scroll so last row is at the top of view -

i make extjs cause grid row scroll top of grid can float component below it. seems issue if target row 1 of last rows. thinking might resize height of 's parent container hoping there might trick in framework. this project uses extjs version 4.2.2

Julia dataframe where a column is an array of arrays? -

i'm trying create table each row has time-series data associated particular test-case. julia> df = dataframe(var1 = int64[], var2 = int64[], ts = array{array{int64, 1}, 1}) 0x3 dataframes.dataframe i'm able create data frame. each var1 , var2 pair intended have associated time series. i want generate data in loop , want append dataframe using push! i've tried julia> push!(df, [1, 2, [3,4,5]]) error: argumenterror: length of iterable not match dataframe column count. in push! @ /users/stro/.julia/v0.4/dataframes/src/dataframe/dataframe.jl:871 and julia> push!(df, (1, 2, [3,4,5])) error: argumenterror: error adding [3,4,5] column :ts. possible type mis-match. in push! @ /users/stro/.julia/v0.4/dataframes/src/dataframe/dataframe.jl:883 what's best way go this? intended approach right path? you've accidentally put type of vector in instead of actual vector. declaration work: df = dataframe(var1 = int64[], var2 = int64[], ts = ...

javascript - Angular2 http display json specific values -

i have code reads json data: import {component} 'angular2/core'; import {http, response} 'angular2/http'; @component({ selector: 'my-app', template: ` <h2>basic request</h2> <button type="button" (click)="makerequest()">make request</button> <div *ngif="loading">loading...</div> <pre>{{data | json}}</pre> ` }) export class appcomponent { data: object; loading: boolean; constructor(public http: http) { } makerequest(): void { this.loading = true; this.http.request('http://jsonplaceholder.typicode.com/photos/1') .subscribe((res: response) => { this.data = res.json(); this.loading = false; }); } } returned json: { "albumid": 1, "id": 1, "title": "accusamus beatae ad facilis cum similique qui sunt...

javascript - Parsing _utmz cookie substrings to Google Tag Manager variables -

i'm attempting set custom javascript variables in google tag manager utmcsr, utmccn, utmcmd, , utmctr portions of google's legacy analytics _utmz cookie. the _utmz cookie looks this: utmz=123456789.1234567890.1.1.utmcsr=[source]|utmgclid=[ad click id]|utmccn=[campaign]|utmcmd[medium]|utmctr=[keyword] i'm not great @ javascript or regex, here's closest i've gotten gtm doesn't give me token error. grabbed bit website , attempted modify grab utmcsr. function() { var __utmzcookie = document.cookie.match(/utmcsr=(.*)/); if(__utmzcookie && __utmzcookie[1]) { var utmzvals = __utmzcookie[1].split('.'); if(utmzvals[2]) { return utmzvals[1] + '.' + utmzvals[2]; } } }

javascript - IE8 doesn't append object -

i'm having issues ie8 not appending elements want, please see code below coffee testsite.create_featured_related_product = (modifier) -> __link = $('<a href="#">') __img = $('<img src="http://localhost:9000/img/img.png"/>') __link.append(__img) $( '.product-relation__group-' + modifier ).prepend (__link) @ javascript testsite.create_featured_related_product = function(modifier) { var __img, __link; __link = $('<a href="#">'); __img = $('<img src="http://localhost:9000/img/img.png"/>'); __link.append(__img); $('.product-relation__group-' + modifier).prepend(__link); return this; }; nothing of above ( <a> , <img> ) gets appended <div class="group"> . error ie8 console is: 'undefined' null or not object jquery-with-plugs__0.3.1.js, line 963 character 13 that line seems part of jquery , says ...

How to split the matrix in r with different size column sizes -

n <- c(12,24) mu<-c(6.573,6.5) sigma<-sqrt(0.25) diseased.data<-round(rnorm(n[1], mu[1], sigma), 4) healthy.data<-round(rnorm(n[2], mu[2], sigma), 4) g <- c(2,3,4) for(i in 1:3){ pool.dis.data <- matrix(na,n[1]/g[i],n[1]/g[i]) for(j in n[1]/g[i]){ pool.dis.data <- replicate(n[1]/g[i],mean(sample(diseased.data,g[i]))) } } when run code, answer last element of g. need each columns matrix should have element each element in g, example matrix should m<- cbind(a1,a2,a3,a4,a5,a6), m1 <- cbind(b1,b2,b3,b4), m2<- cbind(c1,c2,c3)

excel - VBA Count Table Rows which Contain data -

Image
this question has answer here: error in finding last used cell in vba 10 answers follow on earlier question . trying count number of rows in table contain data (not counting number of rows part of table). for example, table is: my code is: with thisworkbook.worksheets(1) set atb = .listobjects("table1") .activate numberrows = .cells(.rows.count, "a").end(xlup).row end with` this returns wrong number (trust me column has same data count) likewise, want use vba resize table nicely need row count that. try this sub check() thisworkbook.worksheets("sheet1") set atb = .listobjects("table1") .activate numberrows = application.counta(.range("a:a")) end end sub

amazon web services - AWS Lambda S3Event deserialization -

has implemented java based request handler s3 events? my class: package example; import com.amazonaws.services.lambda.runtime.context; import com.amazonaws.services.lambda.runtime.requesthandler; import com.amazonaws.services.s3.model.s3event; public class hello implements requesthandler<s3event, string> { public string handlerequest(s3event event, context context) { return "success"; } } error message: an error occurred during json parsing: java.lang.runtimeexception java.lang.runtimeexception: error occurred during json parsing caused by: java.io.uncheckedioexception: com.fasterxml.jackson.databind.jsonmappingexception: can not deserialize instance of com.amazonaws.services.s3.model.s3event out of start_object token @ [source: lambdainternal.util.nativememoryasinputstream@6108b2d7; line: 1, column: 1] caused by: com.fasterxml.jackson.databind.jsonmappingexception: can not deserialize instance of com.amazonaws.services.s3.model.s3event out...

pip - ValueError ['path'] failed building wheel for python-crfsuite -

i trying install python-crfsuite using command: pip install python-crfsuite before use set vs90comntools=%vs140comntools% since using visual studio 2015. after running installation command following error: file "c:\python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall raise valueerror(str(list(result.keys()))) valueerror: ['path'] ---------------------------------------- failed building wheel python-crfsuite if has faced same problem or has installed crfsuite on windows has knowledge please me solve error i tried workaround. installed mingw link http://sourceforge.net/projects/mingw/files , used link http://versioneye.com/python/python-crfsuite/0.8.1 install pycrfsuite using command : pip install https://pypi.python.org/packages/source/p/python-crfsuite/python-crfsuite-0.8.1.‌​tar.gz and worked!! don't understand why though

sql server - Passing Source and Destination for SSIS package created from Export/Import Wizard of SSMS -

i have created ssis package sql server management studio. , working. but pass source connection string , destination connection string ssis package when run this. one approach planning run package dtexec tool. there other options? overview ssis, via import export wizard, available in editions of sql server. however, sql server express not allow ability save package generated using wizard. , saved package operating on. what can make dynamic you have correctly identified can change connection strings within ssis package. future readers, connection string not specify table, or schema, name. if want make object name dynamic, cannot accomplish packages built using import/export wizard. how change connection strings we have established packages have been saved out of import/export wizard although package built using bids/ssdt-bi equally valid. mechanics of running package commonly performed through dtexec utility . among other things, allows specify new value conn...

ios - Set image and title for bar button item? -

i have custom navigation controller bar button items text buttons. possible keep title of bar button items set them images (icon image + title underneath). class navigationcontroller: uinavigationcontroller { var mode: navigationmode = .swipe { didset { self.setbuttonattributes() } } private var leftbarbutton: uibarbuttonitem! private var middlebarbutton: uibarbuttonitem! private var rightbarbutton: uibarbuttonitem! private var rightbarbutton2: uibarbuttonitem! override func viewdidload() { super.viewdidload() } func configurenavigationitem(navigationitem: uinavigationitem) { //configure bar buttons text , actions if (self.leftbarbutton == nil) { self.leftbarbutton = uibarbuttonitem(title: "menu1", style: .plain,target: self, action: "menu1pressed:") } if (self.middlebarbutton == nil) { self.middlebarbutton = uibarbuttoni...

node.js - Get Google Plus user access_token in Azure webapp server -

i have set azure webapp running node.js express , added google plus authentication using built in azure google "authentication / authorization". auth process works fine using ssl , and able users authenticated. now, know auth process calling https://mysite.azurewebsites.net/.auth/login/google/callback user access_token future api calls in case azure "intercepts" (instead of happen - on won server). the question - there why , use token on server? i have tried add route .auth/login/google/callback , somewho code router.get('/.auth/login/google/callback', function (req, res, next) { console.log("callback"); next(); }); to no avail... the auth info google+ set in request headers. if list request headers in router function like: res.send(json.stringify(req.headers)); you can auth info set in headers prefix x-ms-token-google- . refer https://azure.microsoft.com/en-us/documentation/articles/app-service-api-authenticatio...

How do I define a constrained type in Swift? -

i keep bumping onto problem repeatedly. in real life see sets of numbers represent particular quality have difficulties express them distinct type in swift. for example percent type. let says want have percent type integers. percent never able go on 100 or below zero. i express in pure c union, members ranging 0 100. using swift enum underlying value type doesn't seem me correct approach. or it? let's pick one. bribor interbank interest rate. know range between 0 , 20 percent. number decimal 2 decimal places. what's correct way deal problem in swift? generics perhaps? as michael says in comment, this: struct intpercent { let value : int8 init?(_ v : int) { guard v >= 0 && v <= 100 else { return nil } value = int8(v) } } (note: use struct, not class base value that) if lot, can improve little using protocols, so: protocol restrictedvalue { associatedtype t : comparable static var range : ( t, t ) { } var value :...

javascript - Why duplicate HostOnly JS Cookies aren't being removed by host? -

i'm trying clean-up duplicate cookies. issue initially, these cookies scoped current sub-domain set them. changed scope of these cookies globally scoped domain. left duplicate cookies different domains scoped. wanted remove these domain scoped cookies code doesn't work unless "hostonly" flag manually deactivated? thought if same domain set cookies, served code remove cookies wouldn't have worry "hostonly" flag? doesn't appear true? understand why isn't deleting cookies , how/if can? try{ function clearcookie(name, domain, path){ var domain = domain || document.domain; var path = path || "/"; document.cookie = name + "=; expires=thu, 01 jan 1970 00:00:01 gmt; domain=" + domain + "; path=" + path; }; clearcookie("visitcount","www.mysite.com","/"); clearcookie("lastvisit","www.mysite.com","/"); clearcookie("visitedpreviously","www.mysite.c...

nginx reverse proxy + Spring ResourceSupport produces wrong URL path prefix -

spring hateoas resourcesupport generating incorrect urls in responses. using tomcat spring , nginx reverse proxy. spring generated url: http://localhost:8080/spring-ng-seed project url: https://spring-ng-seed.dev/ (serves static content), web api url: https://spring-ng-seed.dev/wapi/ all requests /wapi/ work fine spring hateoas's resourcesupport generating urls like: https://spring-ng-seed.dev/spring-ng-seed/foo/bar instead of https://spring-ng-seed.dev/wapi/foo/bar for example, self rel when call https://spring-ng-seed.dev/wapi/foo/bar end https://spring-ng-seed.dev/spring-ng-seed/foo/bar coming self rel incorrect. /spring-ng-seed/foo/bar should /wapi/foo/bar in response links. i not sure configured wrong, nginx, tomcat or spring cannot find on anywhere else. i using angularjs on front end doubt problem lays front end rather nginx reverse proxy or tomcat. can please? nginx config: server { charset utf-8; listen 80; listen 443 ssl; ...

Google API for location, based on user IP address -

i looking api return user's current location(city) based on it's ip adress.i searched , found http://freegeoip.net/json but client big time google fan , insisting available google api, can 1 me out this. google appends location data requests coming gae (see request header documentation go , java , php , python ). should interested x-appengine-country , x-appengine-region , x-appengine-city , x-appengine-citylatlong headers. an example looks this: x-appengine-country:us x-appengine-region:ca x-appengine-city:norwalk x-appengine-citylatlong:33.902237,-118.081733

javascript - Gulp. Compile all .jade files when child (_*.jade) included -

i have next structure: jade ├── _skeleton.jade ├── _header.jade ├── _footer.jade | ├── includes │ └── _include-on-index.jade │ └── _include-on-page-1.jade │ └── _include-on-all-pages.jade | ├── pages │ └── index.jade │ └── page-1.jade │ └── page-2.jade │ └── page-3.jade and need setup jade compile, apps, (for example prepros). it means if edit page-3.jade need compile page-3.jade, if edit file start _ .jade, don`t need compile exectly _ .jade file html, need compile .jade files included _*.jade file for example when edit file _header.jade, need compile files included _header.jade, if edit _include-on-index.jade need compile file without _ included _include-on-index.jade i`m trying module gulp-jade-find-affected , works incorrect, , compile files start _*.jade html. here gulpfile.js: var gulp = require('gulp'), jade = require('gulp-jade'), watch = require('gulp-watch'), affected = require('gulp-jade-find-affected'); gulp.tas...

removing via from emails sent by mailgun -

our customers use our cloud software send emails. use mailgun send emails. our customers email recipients see "via go.livehive.com". told if our customers add txt record, example below, via go away. customer @ abc.com adds "include:go.livehive.com" existing txt record, v=spf1 include:go.livehive.com include:spf.protection.outlook.com ~all some gmail documentation stated should use 1 spf record why there 2 includes in txt record. far has not worked, doing wrong?

sql - DB2 return first match -

in db2 (a.k.a. db2/400) @ v6r1, want write sql select statement returns columns header record , columns 1 of matching detail records. can of matching records, want info 1 of them. able accomplish following query below, i'm thinking there has easier way using clause. i'll use if need it, keep thinking, "there must easier way". essentially, i'm returning firstname , lastname person table ... plus 1 of matching email-addresses personemail table. thanks! theminimumones ( select personid, min(emailtype) emailtype personemail group personid ) select p.personid, p.firstname, p.lastname, pe.emailaddress person p left outer join theminimumones tmo on tmo.personid = p.personid left outer join personemail pe on pe.personid = tmo.personid , pe.emailtype = tmo.emailtype personid firstname lastname emailad...

python - Odoo quotation product field missing -

Image
when try add products quotation, can't find "product" field. is bug? missing something? i had similar problem , fixed unchecking portal in right user window.

opengl es - Issues drawing multiple image textures with some disapearing -

Image
i'm looking use opengl blend 4 images screen. first image contains background , other 3 images contain cartoon transparency. goal render 4 images @ once. @ every call render i'm updating top 3 images new images compose new frame. i'm new opengl , far i'm able achieve blending images i'm noticing horrible issues when render. i'm seeing of top 3 images missing or rendered cropped invisible man... each lines represents different image. image cropped issue: image cropped , 1 image missing: how should like: any figuring out issue appreciate it! below code i'm using. here code use render images. void moviepreview::preparetexture (gluint texture, glint format, int w, int h) { // bind generated texture glbindtexture(gl_texture_2d, texture); gltexparameterf(gl_texture_2d, gl_texture_min_filter, gl_linear); gltexparameterf(gl_texture_2d, gl_texture_mag_filter, gl_linear); glshademodel(gl_flat); //glshademodel(gl_sm...

mongodb - Mongoimport to merge/upsert fields -

i'm trying import , merge multiple csvs mongo, documents getting replaced rather merged. for example, if have one.csv: key1, first column, second column and two.csv: key1, third column i end with: key1, first column, second column, third column but instead i'm getting: key1,third column currently i'm using: mongoimport.exe --ftype csv --file first.csv --fields key,firstcolumn,secondcolumn mongoimport.exe --ftype csv --file second.csv --fields key,thirdcolumn --upsert --upsertfields key1 that's way mongoimport works. there's existing new feature request merge imports, now, you'll have write own import provide merge behavior.