Posts

Showing posts from September, 2013

python - Adding rows that have the same column value in a pandas dataframe -

i have pandas dataframe dates , hours columns. want add hours of same dates. example make this: 7-1-2016 | 4 7-1-2016 | 2 4-1-2016 | 5 into this: 7-1-2016 | 6 4-1-2016 | 5 is there quick way on big files? here groupby can used provide desired output. dataframe.groupby(by=none, axis=0, level=none, as_index=true, sort=true, group_keys=true, squeeze=false) group series using mapper (dict or key function, apply given function group, return result series) or series of columns. try: df.groupby('date')['hours'].sum()

javascript - How to get the content of a table rows and columns -

can give me idea on how count table column , table row , id, attribute , content of each cell (the cell contenteditable). tools have use. e.g. <table> <tbody> <tr> <td id='1a' rowspan=2>rowspan 2</td> <td id='1b'>22222</td> <td id='1c'>33333</td> </tr> <tr> <td id='2b' colspan='2'> colspan2</td> </tr> <tr> <td id='3a' style='color:red'>whaterver</td> <td id='3b' style='font-weight:bold'>askyourmother</td> <td id='3c'>sigh</td> </tr> </tbody> </table> i'm using jquery (javascript). you can make use of jquery , whatever want it. in case print in console. //for each tr... $('table tr').each(function(){ //for each td.... $(this).find('td').each(function(){ console.log($(this).text()); //do whate...

Oracle SQL using group by: Can you group by a field used to join two tables? -

select b.first_name, b.last_name, sum(t.price_total) brokers b left outer join trades t on b.broker_id=t.broker_id group b.broker_id my problem question asks 'display total value of each broker's trades'. answer groups b.first_name||' '||b.last_name , think group should done via broker's id (i.e. 2 people same name grouped together, wouldn't happen via broker id). yet when running code, error ora-00979: not group expression 00979. 00000 - "not group expression" *cause: *action: error @ line: 1 column: 8 my question is, why can't use b.broker_id column group by? try this: select b.broker_id, b.first_name, b.last_name, sum(t.price_total) brokers b left outer join trades t on b.broker_id=t.broker_id group b.broker_id, b.first_name, b.last_name when use group by, select clause can have columns specified in group , aggregated/calculated fields group sum, average, min, max etc. you can use analytic functions overcome i...

c# - two submit buttons with two different dropdowns working interconnected -

Image
i have 2 dropdown 2 different buttons respective operations. there input dropdown , output dropdown, if file selected input dropdown , click output button working , vicecersa. need should not work should throw alert message. what tried : code tried write in comment below: enter image description here exportlicense , exportlicense1 button id's. working respective dropdown , button. conflicting alternative. i think need group button work dont know how group in mvc view page. me out.

sockets - Python: zmq.error.ZMQError: Address already in use -

i've got virtually "hello world" server: import time import zmq import mutagen import json context = zmq.context() socket = context.socket(zmq.rep) socket.bind("tcp://*:64108") try: while true: # wait next request client message = socket.recv() jsn = message.decode('utf8') rq = json.loads(jsn) reply = 'idle' if rq['request'] == 'settags': audio = mutagen.file(rq['file'], easy=true) if audio: reply = "track number set [{}]".format(rq['tags']['tracknumber']) # debug info tag, value in rq['tags'].items(): audio[tag] = value audio.save() # send reply client socket.send_string(reply) except keyboardinterrupt e: sys.exit(e) any attempt first ends this, quite naturally: $ python /home/alexey/dropbox/procrustes/procrs...

c# - Encrypt/Obfuscate file name -

i store files on shared web server hide content of file. encrypting contents of file aware if had time , knowledge target files based on name. what best method either encrypting file name or obfuscating it? i have looked @ creating separate index file , using dictionary store original , obfuscated file names if same using reversible encryption might easier/less prone disaster if index file lost. hope makes sense. update: clear reversible , ensure files not searchable on drive (i.e. obfuscating paths not sufficient). you add random value url. ex: http://example.com/my-site/943hfkl3w7/secretfile.zip http://example.com/my-site/jf6490fh40/otherfile.zip this way original file name never changed , file locations not guessable.

parsing - Erlang ** exception error: no function clause matching -

hi guys have makings of parser theorem prover. have module tokenises string im inputting: [{bracket,open},{prop,a},{logicop,'and'},{prop,b},{bracket,close}] parser has calls inner function. here code: parse([])-> []; parse(fulllist) -> parseclauses(fulllist,[],[]). parseclauses([{bracket, open}| restoflist], stacklist, parsedlist) -> parseclauses(restoflist, stacklist ++ [{bracket, open}], parsedlist); parseclauses([{prop, any},{logicop, any}| restoflist], stacklist, parsedlist) -> parseclauses(restoflist, stacklist ++ [{logicop, any},{prop, any}], parsedlist); parseclauses([{bracket, close}, {logicop, any}| restoflist],stacklist,parsedlist) -> parseclauses(restoflist, stacklist ++ [{bracket, close}], [{logicop, any}] ++ parsedlist); parseclauses([{bracket, close}|restoflist], stacklist, parsedlist) -> parseclauses(restoflist, ...

SQL Server - select into from statement? -

i have query in sql server: select column table_53; now, want 53 table, want this: select column table_(select id table2); is there way in sql server? you need dynamic sql query here. declare @sqlquery = 'select column table_('; set @sqlquery = @sqlquery + 'select id table2)'; exec (@sqlquery) note :- 1 of cons of using dynamic sql query sql injection. suggest have better table structure or try used parameterized query.

Prolog- Appending a list of lists -

my database follows format: aminotodna (amincoacid, [dna sequence]). here few examples database: aminotodna(a,[g,c,a]). aminotodna(a,[g,c,c]). aminotodna(a,[g,c,g]). aminotodna(a,[g,c,t]). aminotodna(c,[t,g,c]). aminotodna(c,[t,g,t]). aminotodna(d,[g,a,c]). aminotodna(d,[g,a,t]). aminotodna(e,[g,a,a]). aminotodna(e,[g,a,g]). aminotodna(f,[t,t,c]). aminotodna(f,[t,t,t]). some aminoacids have multiple dna sequences. here question, in given list of amino acids example [d,c,e,f] , how can append dna sequences , give combinations, have more 1 sequence. if 2 it, it'd be listamino(x,y) :- aminotodna(x,l), aminotodna(y,m), append(l,m,z), print(z). hitting ; gives combinations. i've tired doing list, attempt, , didnt work: listamino([]). listamino([h|t]) :- aminotodna(h,l), aminotodna(t,m), append(l,m,x), print(x). listamino(t). when describing lists prolog, consider using dcg notation convenience , clarity. example, using...

java - program codings for record videos and store in my database for android app? -

how video can record using camcorder , store in sqlite ? android: record video in same orientation regardless of device orientation how size of movie i'm capturing , update screen during capture? is possible use camcorderprofile without audio source? how protect read/copy/delete video files?

python - Change existing model data with form -

i trying implement view displays form capture data , table captured data of user. table has form 2 buttons per row, either submitting "change" or "delete" object id of object in given table row, using post. my django view looks this: def capturedata(request): form = myform(request.post or none) if request.method == "post": if 'delete' in request.post: # user hits "delete" button in displayed objects table. try: del_object = myobject.objects.filter(user = request.user).get(id = request.post['delete']) del_object.delete() except: # ... return redirect('capturedata') elif 'change' in request.post: # user hits "change" button in displayed objects table. ch_object = myobject.objects.filter(user = request.user).get(id = request.post['change']) ...

C# Windows 10 Mobile Bluetooth BLE - OnAdvertisementReceived -

i'm trying learn how use ble in c# windows 10 mobile smartphone. i'm trying connect oral-b toothbrush in order data off it. unfortnately in code "onadvertisementreceived" never gets called , don't know why, toothbrush ble enabled , using analyzer app on android smartphone can see sending beacons/advertisments in order connected, text of debug- textbox doesn't change. here's complete c# code: public sealed partial class mainpage : page { private bluetoothleadvertisementwatcher watcher; public mainpage() { this.initializecomponent(); // create , initialize new watcher instance. watcher = new bluetoothleadvertisementwatcher(); watcher.signalstrengthfilter.inrangethresholdindbm = -70; watcher.signalstrengthfilter.outofrangethresholdindbm = -75; watcher.signalstrengthfilter.outofrangetimeout = timespan.frommilliseconds(2000); watcher.received += onadvertisementreceived; wa...

logging - Standardize log data in ELK - Elastic Logstash Kibana -

Image
i'm using elk log managment. what best practice manage log level. in 1 log lower case @ other bigger case. where best place resolve this? at logstash? at elastic db? kibana while execute query? and how? two suggestions: normalize string value. whether it's "debug", "debug" or "debug" you. add numerical equivalent . this way, can run queries like: "severity_num:<=3" bad stuff , use string "severity" field in display. more details here .

javascript - Semantic UI Popup doesn't open -

i'm making first steps semantic ui , got first problems can't fix. i want create simple popup trigger here http://semantic-ui.com/modules/popup.html#specifying-a-trigger-event . i've tried copy , paste .html , .js code , inlcuded semantic.min.js , semantic.min.css in page header, doesn't open popup whatever reason. here's html code use: <div class="ui singleimg container"> <div class="ui hidden divider"></div> <div class="ui 2 column stackable grid"> <div class="eleven wide column"> <h1 class="ui dividing header">test</h1> </div> <div class="five wide column"> <div class="ui teal button" data-title="using click events" data-content="clicked popups close if click away, not if click inside popup">download</div> sidebar </div> </d...

php - Update cURL without update Xampp -

i working exchange web service (2007) using php-ews. dependencies "curl ntlm support (7.23.0+ recommended)" in server have old xampp curl 7.21 , code doesn't work. in local have curl 7.42 , code works perfectly. have lot of things in server possible update curl library?? or use curl windows (cli)?? my solution download next portable xampp version , copy "php_curl.dll" php folder old php folder (replacing old dll.) and, of course, restart apache. if php_curl version new dll not going work (xampp configurations problems) important use next version.

sql - Extracting WHERE clause to speed up query -

the query shown in "section 1" below takes on 2.5 hrs complete. have been tasked speeding , have question whether change made legitimate (i.e. not change result). modified code completes in < 30 mins. many thanks. 1) original query select i.fundcd ,i.maxdate ,v1.infocodename parentinfocodename ,v2.infocodename ,fieldvalue ,i.notformatteddecimalvalue fieldvalue ,i.asofdate #tmp_hfri pmw.dbo.vinfocodewithhierarchy v1 inner join pmw.dbo.vinfocodewithhierarchy v2 on v1.codenode = v2.parentcodenode inner join pmw.dbo.vfundinfo on v2.infocodeid = i.codeid v1.infocodeid in ( 692857 ,693600 ) 2) saw clause in last line requires 1 of 2 values present in v1.infocodeid. v1 figured prior select of rows in v1 values of v1.infocodeid , use in query rather rows in v1 (1049 rows) in order speed full query. 3) did: select * #t1 pmw.dbo.vinfocodewithhierarchy v1 v1.infocodeid in (692857,693600) 4) ran query. takes...

javascript - How to extend a mapped knockout viewmodel "on the fly" with additional property? -

i'm getting json object array asp.net web api , map knockout viewmodel ( ko.observablearray ). while binding model document "unable process binding" error. this because json dto api doesen't have editable property defined. how can add on fly while mapping? should false default. here's code: var accessory = function (id, leftonpatient, reject, amount, patchnumber, additionalinfo, editable) { var self = this; self.id = ko.observable(id); self.leftonpatient = ko.observable(leftonpatient); self.reject = ko.observable(reject); self.amount = ko.observable(amount); self.patchnumber = ko.observable(patchnumber); self.additionalinfo = ko.observable(additionalinfo); self.editable = ko.observable(editable); } function medicinesandaccessoriesviewmodel() { var self = this; self.accessories = ko.observablearray([]); self.error = ko.observable(); function getallaccessories() { ajaxhelper(accessoriesuri, 'get').done(function (d...

mysql - Regex not supported in sql command with "contains" clause -

i not seasonal windows user, got task wherein had query window index search table i.e " systemindex " fetching user specific data db. and have match pattern regular expression while fetching data. select system.filename, system.itempathdisplay, system.datecreated, system.datemodified, system.itemname, system.kindtext systemindex contains('“(?=^[a-za-z\d!@#\$%\^&\*\(\)_\+=]{9,32}$)”'); the above allow search stored passwords. but when query db using below command getting error. , later came know "contains" clause not support regular expression. there alternative achieve this? there regexp operator http://dev.mysql.com/doc/refman/5.7/en/regexp.html , use smth this select * systemindex some_column regexp 'your_regex'

javascript - Add Node.js module to Cordova App -

Image
i add discord.io cordova (windows 10 mobile) app. i've executed npm install discord.io in cordova project direcotry. creates node_modules directory , adds discord.io npm-dependencies: if try initialize discord.io lib example github: var discordclient = require('discord.io'); var bot = new discordclient({ autorun: true, email: "my@email.com", password: "secret_passw0rd" }); bot.on('ready', function() { console.log(bot.username + " - (" + bot.id + ")"); }); bot.on('message', function(user, userid, channelid, message, rawevent) { if (message === "ping") { bot.sendmessage({ to: channelid, message: "pong" }); } }); i error message: 0x800a1391 - javascript runtime error: 'require' undefined i tried use cordova.require('discord.io'); , results in error: 0x800a139e - javascript runtime error: module disc...

c# - PowerBI API | Import PBIX -

i have method upload .pbix file powerbi app, method return id expected. reports , datasets doesn't appear on powerbi my method : public static string sendfile() { string[] files = { "d://david/documents//pbix_test.pbix" }; string boundary = "----------------------------" + datetime.now.ticks.tostring("x"); httpwebrequest httpwebrequest = (httpwebrequest)webrequest.create("https://api.powerbi.com/beta/myorg/imports?datasetdisplayname=pbi_testt"); httpwebrequest.contenttype = "multipart/form-data; boundary=" + boundary; httpwebrequest.method = "post"; httpwebrequest.keepalive = true; //httpwebrequest./*credentials*/ = system.net.credentialcache.defaultcredentials; httpwebrequest.headers.add("authorization", string.format("bearer {0}", nstoken.tokensingleton.instance.token.accesstoken)); ...

r - How can I pass higher order functions via ocpu.rpc? -

Image
i'm trying pass function function in opencpu app using ocpu.rpc . know opencpu api can handle because i've tested sapply function in base r (among others) using api test facility . however, i've been unable accomplish same thing ocpu.rpc . see http/1.1 400 bad request . ocpu.rpc("sapply", {fun: "sqrt", x: [1,4,9,16,25,36]}, function(output) { output } }) can provide example how make call (and return json vector) using ocpu.rpc ? i'd ask me create jsfiddle it, have been unable edit fiddles. it turns out can use match.fun turn json argument function expression on r's side. sapply default. had return value wrong. basing code off of lowess example, returns list 2 arguments: x , y . //set cors call "stocks" package on public server ocpu.seturl("//public.opencpu.org/ocpu/library/base/r") //some example data var mydata = [1, 4, 9, 16, 25]; //call r function: stats::var(x=data) $("#sub...

Routing data to API then to Google Analytics? -

this general question tracking data on google analytics. firm has larger average number of individuals opting-out of google analytics privacy reasons -- that's fine -- we'd still capture purchase made , store in google analytics goals (currently these individuals not showing on ga pageviews or on our quoting page). the question is, when individual uses click event make purchase route individual's data page (or api call?) , send on google analytics record of purchase captured? has ever done this? i want respect individual's rights privacy i'd still know capturing 100% of purchases made in google analytics goals. thanks thoughts. since tos state specifically in §7: you must not circumvent privacy features (e.g., opt-out) part of service. you on thin ice here (you can try argue google not circumventing, shouldn't hold breath , terminate account if violate tos). else: sure, use hit builder construct tracking url measurement protocol:...

xml - Drop-in replacement for java.beans.XMLEncoder -

i've got lots xsl transforms rely on java.beans.xmlencoder xml format, , i'm wondering if can find drop-in replacement lib has better performance. i've looked @ xstream serialization format different. i'm looking replace i'm working legacy codebase has forked version of xmlencoder , i'd return more standard, java.beans.xmlencoder has worse performance. for class person (with appropriate getters , setters): public class person { private string name; private list<string> favoritecolors; private date birthdate; private int age; } xmlencoder produces xml following: <?xml version="1.0" encoding="utf-8"?> <java version="1.8.0_66" class="java.beans.xmldecoder"> <object class="person" id="person0"> <void property="age"> <int>40</int> </void> <void property="birthdate"> <object class=...

python - Terminate a gnome-terminal opened with subprocess -

using subprocess , command ' gnome-terminal -e bash ' can open gnome-terminal desired (and have stick around). done either p=subprocess.popen(['gnome-terminal', '-e', 'bash']) or p=subprocess.popen(['gnome-terminal -e bash'], shell=true) but cannot close terminal using p.terminate() or p.kill() . understand, little trickier when using shell=true did not expect run problems otherwise. to terminate terminal , children (in same process group): #!/usr/bin/env python import os import signal import subprocess p = subprocess.popen(['gnome-terminal', '--disable-factory', '-e', 'bash'], preexec_fn=os.setpgrp) # here... os.killpg(p.pid, signal.sigint) --disable-factory used avoid re-using active terminal can kill newly created terminal via subprocess handle os.setpgrp puts gnome-terminal in own process group os.killpg() used send signal group

phpdocumentor2 - How to document a controller in symfony? -

Image
i'm trying document project. want document controller. before action have: /** * description: xxx * @param parameters of function action * @return views of action */ the return value here show: why? thanks edit: a standard controller: public function mycontrolleraction(request $request) { return $this->render('appbundle:default:index.html.twig'); } the @return annotation expects data type first argument, before description. in case you've specified data type views hasn't been included use statement, php assumes belongs current namespace , \appbundle\controllers\views . return type of controller must symfony\component\httpfoundation\response . want: @return \symfony\component\httpfoundation\response description or if have use statement response: @return response description in cases might want more specific if returning specific subclass of response, like: binaryfileresponse jsonresponse redirectresponse stre...

How do I or Can I upload images in the CDN using classic asp and sql without file uploader? -

is possible upload images in cdn using simple input text box , insert button? have use classic asp , sql project. need have input box in have type name of image need uploaded cdn after clicking insert button. also, need make file renameable. know how upload images in server not in cdn. know few cdn. kind of appreciat <input type=text name=inputtxt>&nbsp;&nbsp;<input type=submit name=submit value="insert" class=inputitem> to store file @ aws s3 need make http requests aws. 1 way using http object asp chilkat . i found code here (which untested!) illustrates nicely principle behind it: <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <% ' create http object set http = server.createobject("chilkat_9_5_0.http") success = http.unlockcomponent("anything 30-day trial") if (success <> 1) response.write "<pre>...

.net - Any() is not returning expected result -- alternatives? -

edit2 found solution team members. see comment resolution. after looking, can't seem find real answer problem. i'm trying find users have groups group type blank/null/empty. code: expression = (x => x.persongroups.any(y => y.group.grouptype == null || y.group.grouptype == "")); return expression there many users in our database expression should return. instead, doesn't return any. colleague smarter , more experienced me looked @ generated sql me yesterday, , concluded wonderful example of linq , entity not working together. entity on querying mapped database. i've checked , checked, , piece of code code doing (not before or after). befuddling there other linq queries in our code similar 1 return expected result. so 2 questions: 1) there see doing wrong? 2) without writing raw sql, possible alternatives be? i've been trying read linq can, i'm sure i'm missing something. thanks! (note: haven't found these p...

C# - Access to another application and send keys -

i want control application , send keys application textbox1 , want access app using application.launch("name.exe") application application = application.launch("foo.exe"); window window = application.getwindow("bar", initializeoption.nocache); button button = window.get<button>("save"); button.click(); and need sending keys answer ... dont know how...

java - tomcat 7 how to keep jdbc connection alive for ever -

i have war requires permanent jdbc connection. i've tried (context.xml) maxactive="100" maxidle="3" maxwait="1000" minidle="1" but connection still dies after while. how can keep jdbc connection alive 24/7? thanks first of all: you cannot keep alive forever at point fail / break. network interruption, maintenance of either software or database or else. so "i want one connection can use whenever need, never close automatically" not happen you. instead using connection pool, can have: "i want able valid , working database connection @ point in time" quite easy in comparison. most connection pools ( hikaricp , c3p0 , tomcat database pool, ...) support configuration options guarantee (that is: if database , network connection works) can valid connection when need it.

python - Where best to put the generator.close()? -

i buildt class morning , works sweet , tight since works calling fresh generator every time i'm concerned i'm leaving bunch in memory. i'd love right after yield statement finally. seem little cleaner. class enter: def __init__(self,entries, container=[], keyname = "key", valuename = "value"): self.dict = {} self.entries = entries self.container = container self.keyname = keyname self.valuename = valuename def gen(self,dis): print(dis) yield input("entry: ") def enter(self): ea in range(self.entries): print("\nplease input a", self.keyname, "then a", self.valuename) x = next(self.gen("\nenter " + self.keyname + ":")) y = next(self.gen("\nenter " + self.valuename + ":")) self.dict.update({x:y}) retrun self.dict def enterlist(self): ...

jquery - Sum Checkboxes without POSTING values - Javascript -

i've had around find definitve answer. basically, have total, id im trying automatically update once checkbox clicked. p style="font-size: 1.2em; font-weight: bold;"><b>total cost:</b> £<input value="0.00" readonly="readonly" type="text" id="total"/></p> the checkbox have simple value such 1.50 or similar. (these dynamic) so <input name="product" value="<?php echo $count*0.50 ?>" type="checkbox"> this may simple! im not hands on javascript handling both checking , unchecking box update sum input working jsbin example, assuming using jquery. var sum = 0; var total = $('#total'); var cbox = $('.cbox'); $('.cbox').on('change', function() { if ($(this).prop('checked')) { sum += parsefloat($(this).val()); updatetotal(); } else { sum -= parsefloat($(this).val()); updatetotal(); } });...

jquery - Refresh static page with dynamic contents on load -

i have static page loads , its' background-image changes dynamically using ajax , json . background changes when user swipe left/right or use next/previous buttons. everything fine except photos don't appear when page initiated unless refresh page (f5). tried many ways including .trigger('refersh') , .page('refresh') failed. i have below code load same page whenever user swipe left or right or use navigation buttons. function animation() { $.mobile.changepage( "#gallery", { // #galley static page id. allowsamepagetransition: true, changehash: false, transition: "flow" }); } and 1 show loading ajax. function showmsg() { $.mobile.showpageloadingmsg() settimeout(function() { $.mobile.hidepageloadingmsg() }, 500); } html <div data-role="page" class="demo-page" id="gallery"> <div data-role="header" data-position="fixed" data-fullscreen="true" data-ta...

r - extracting hour minute from non-delimited data -

i have instrument data contains hours , minutes in non-delimited format (e.g., 0, 30, 100, 130, ... 2300, 2300 ). convert column posix object in r (e.g., looks "2016-01-07 11:07:59 est" ) , first step extract out hour , minute data column. (i have corresponding julian date , year columns.) i getting tripped because hour , minutes not delimited , have been unable use strptime function. have searched using both google , (using r , datatime tags on so), have been unable find solution. of examples find on (e.g., here or here ) have hour , minute separated such 0:30 . here mcve: hour <- c(0, 30, 100, 130, 1000, 1030, 2300, 2330) year <- c(2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007) day <- c(2, 2, 2, 2, 2, 2, 2, 2) strptime(hour, "%h%m") so, how extract out hour , minute when have non-delimited data? you can use sprintf add leading 0s hours have less 4 digits: strptime(sprintf("%04d", hour), "%h%m") you can ...

Django AbstractUser error when login in -

i have created abstractuser model add fields standard usermodel. i think set correctly, when log in, error: unbound method save() must called userprofile instance first argument (got nothing instead) here accounts/models.py from django.db import models django.conf import settings django.contrib.auth.models import usermanager, abstractuser class userprofile(abstractuser): mobile = models.charfield(max_length=20, blank=true) homephone = models.charfield(max_length=20, blank=true) updated = models.datetimefield(blank=true, null=true) objects = usermanager() in settings have: auth_user_model = 'accounts.userprofile' my authentication middleware: from django.conf import settings django.contrib.auth import authenticate, login django.contrib.auth.models import user accounts.models import userprofile #authentication middleware using external cookie named authentication class cookiemiddleware(object): def process_request(self, request): ...

c# - server-relative List URL is not working (strange characters in link) -

i have strange issue server object model... creating timerjob, has run item.update() function , rest of work done event receiver. server url - demo2010a:2010 sitecolletion url - http://www.contoso.com/sites/test/ list url - http://www.contoso.com/sites/test/lists/zadania%20naprawcze%20t/ the problem in: spsite site = new spsite("http://www.contoso.com/sites/test/"); spweb web = site.openweb("sites/test"); splist ldk_list = web.getlist("http://www.contoso.com/sites/test/lists/zadania naprawcze t"); //this working fine ! cant use absolute url !!! splistitem item = ldk_list.getitembyid(5); item["title"] = "testestestestes"; item.update(); this "test" code. list name "zadania naprawcze -t" in url strange working http://www.contoso.com/sites/test/lists/zadania naprawcze t want : web.getlist("/sites/zadania naprawcze -t") ; or tried cut - etc. tell...

node.js - Periodically monitor if record is not updated Using Node & Event & setTimeOut -

here scenario : every 1 checks in every 5 minutes if 1 misses , should able keep track of it. if 1 misses n number of times alert should generated. here have implemented far : var report = function(attendence) { this.attendence = attendence; eventemitter.call(this); }; util.inherits(report, eventemitter); report.prototype.addapsstatsdata = function() { var attendencedb = new report(this.attendence); //promise var prsave = attendencedb.save(); var self = this; prsave.then(function(data) { //emitting event data has been saved self.emit('attendencerecieved', data.username); var savetime = date.now(); self.moniterapsstatsdata(data.username, savetime); }).catch(function(err) { self.emit('error', err); }); }; report.prototype.moniterapsstatsdata = function(username, time) { var cachekey = appconfig.cache_key_usertimeinterval + username; var prevtimer = memorycache.get(cachekey); if(!prevtimer) cleartim...

Android - mongodb RESTful integration -

i'm developing app needs export document (csv or txt) server. i'm not best practice in case? read quite lot restful web services, not sure if they'd work in case of files rather simple id related queries. android app not need retrieve mongo, need send text server parses , stores in mongo. how should approach implementing that? many thanks! i've solved problem using spring framework on server side ( https://spring.io/guides/gs/rest-service/ ) , following class on client (android): public class restclient { public restclient() { } public void export(jsonarray data) { requestparams params = new requestparams(); params.put("dataarray", data.tostring()); exporttowebservice(params); } public void exporttowebservice(requestparams params){ asynchttpclient client = new asynchttpclient(); string url = "change url here"; client.get(url, params, new asynchttpresponsehandler() { @override public void...

Trigger a new build via Codeship API from Jenkins -

i have ci/cd setup jenkins server manage our internal ci/cd. have codeship performing our ci/cd our aws work. i'm looking setup jobs on our jenkins server manage when new builds triggered on codeship. the aim being, have our jira dashboard integrated jenkins in such way issue's status changes, specific jobs executed. so i'm trying create job uses codeship's api trigger new build, appears can rerun old build? how trigger fresh build? from docs enter link description here can retrieve information , restart previous builds. you want run specific jobs, must associated specific commit on repository. can identify build specific commit , restart it. builds triggered git repository (github or bitbucket), , codeship highly dependent on keep flow simple possible. don't need upload anywhere , command codeship run build on that. need specify repository , push something. you create internal git server developers push , jenkins can push changes there re...

c++ - How to efficiently find tiles of 2d grid that lay inside a circle sector keeping their relative position information? -

Image
i have 2d grid , circle constant radius. know center of circle, radius, vectors(or angles, have both) define sector, sector has constant amount of degrees between start , end, start , end can change positions on circle. on every update need load data tiles inside sector 1d array of constant size in such way keeps relative position information (if current start,end , radius of sqrt(2)*1.0(tile diag), there 40% of tile on left(ccw), 100% in middle , 40% on right(cw), need null, info, null inside array, , if 80% on left 100% in middle , 0% on right info, info, null). tile counts inside if center point inside, guess. don't need % accuracy. my best idea finding tiles lay inside sector right on every update iterate on tiles inside square region (2*radius + 1) side , check center points using function here copy/paste(changed function bool , added var types): bool areclockwise(vec2d v1, vec2d v2) { return -v1.x*v2.y + v1.y*v2.x > 0; } bool iswithinradius(vec2d v, flo...

java - URLConnection opening weirdness -

having tough time understanding urlconnection , connect() possibly being called implicitly. this code doesn't work: url url = new url(firsturl); httpurlconnection connection = (httpurlconnection) obj.openconnection(); conn.getheaderfield("location"); //returns null connection.setinstancefollowredirects(false); this code works: url url = new url(firsturl); httpurlconnection connection = (httpurlconnection) obj.openconnection(); connection.setinstancefollowredirects(false); conn.getheaderfield("location"); //returns redirect url i'm having tough time understanding this. "getheaderfield" implicitly calling connect? don't see noted in documentation anywhere. it connect, see http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/sun/net/www/protocol/http/httpurlconnection.java#httpurlconnection.getheaderfield%28java.lang.string%29 should mentioned in docs, agree...

c# - Vlc.DotNet - Not able to set the volume before playing an audio -

i downloaded vlc.dotnet project github , have been adding more functionalities sample forms application. goes fine, except on thing: noticed every time start application , play audio, audio sounds volume 100% (or around that) - after set lower value. i tried setting volume before playing audio, didn't work. if debug code, see volume set -1. for instance, if execute following lines of code, after setting volume 40, when debug it, volume still -1: myvlccontrol.play(new fileinfo(filename)); myvlccontrol.audio.volume = 40; change order of lines above doesn't work. the funny thing is, when audio playing , change volume,it changed select value on numericupdown. code below event happens: private void numericupdown1_valuechanged(object sender, eventargs e) { myvlccontrol.audio.volume = (int)numericupdown1.value; } i've been trying solve problem 2 days now. unfortunately, coding skills not close people behind project. have posted problem on issues page on gith...

android - get a string value from a thread -

can tell me, how stringvalue thread mainactivity? i have thread this: public class xmlhandler extends defaulthandler { xmldatacollected data = new xmldatacollected(); ...... ...... public string getinformation() { string information = ""; if (data.getdata().equals("residential")) { information = "stadt"; } return information; } } in mainactivity tried set value textview this: textview.settext(xmlhandler.getinformation()); i not work after all. doing wrong? solutions , advices? in advance if have separatethread class need create 1 interface say public interface fetchvaluelistener{ public void sendvalue(string value_to_send); } and acctivity implementing interface , sendvalue(value_to_send) method added activity. next step when create object of thread class need pass object of interface in paramater follows: public class mythreadclass{ fetchvalueliste...