Posts

Showing posts from June, 2015

connection - Can the HTTP version of response differ from the HTTP version of the request -

if use curl websites data sends packet header (with empty body): get / http/1.1 user-agent: curl/7.38.0 host: someurl.com accept: */* http version 1.1 used here. my question: happen server answers 200 ok response different http version. e.g.: http/1.0 200 ok ...

javascript - New to nodejs. what is the equivalent of PHP's session_start() in nodejs? -

i generate session id, have unique browser, not per tab. all able find type of stuff >> http://blog.modulus.io/nodejs-and-express-sessions which demonstrates how use sessions store data, limited in each tab ends new session. looking for, browser gets unique session id generated automatically , accessible other tabs. trying stay away browser storage until has matured point users have feature. since still have quite number of users using older browsers not support local storage, random session id ideal. i using unique id private 'room' users of chat program join support. each user in own private room, can access same room across tabs. know it's bit sloppy, beginner in nodejs's perspective simpler use unique key browsers instance deal cross-tab socket open/close detection, etc. realize using method, each tab have it's own socket connection server ok -- now. i have tried following (which looks me use sockets session, , not browser session if did

javascript - Wrapping long-running function in asynchronous call -

i have code causing browser "hang" or "stop responding" due slowness of call rest. browser timeout afaik. (this done way due legacy code, in case might ask why did not use jquery or something--where there stuff in c++ code (activex) needed before calling rest api) so here's code: for (var = 0; < rowelems.length; i++) { var resp = activexobject.writetorest(_rowtodata(rowelems[i])); } how write asynchronous callback activexobject.writetorest call wrapped , not cause timeout issue? passing parameters , getting response back. i can't use jquery since javascript environment code runs not have jquery.

python - how to support my existing django app with new linkedin api changes? -

i have used linkedin oauth2 in application, used api https://api.linkedin.com/v1/people/~/connections but new api changes not allow me details of person. i getting error httperror @ /complete/linkedin-oauth2/ 403 client error: forbidden starting may 12, 2015 , linkedin has limited open apis. access connections requires apply , granted access information linkedin. you have apply become member of relevant partner program. linkedin team review application , reply within 15 business days. eligibilty criteria linkedin parner program: (taken linkedin page. ) you can use apis if: you developing application designed linkedin members more productive , successful across web; example, augmenting profile , professional brand in application publishing, discussing , sharing content like-minded professionals. your application not expected to: have more 250,000 lifetime members; make more 500,000 daily calls api; make more 500,000 lifetime people search calls api;

xml - Executing php sctipt with cyrilic gives internal 500 error -

i trying tackle issue since quite time.with few words, add additional node existing xml structure (using simplexmlelement) cyrilic word.for example : $mainnode->addchild('topic','Город'); i tried several tricks , functions iconv etc, each time try execute script in server returns internal 500 server error message, if delete line, executes fine.any ideas welcomed just experiencing similar issue, guess happen type of scripts, arabic,chinese etc. it turned out default_charset in php.ini file left empty after putting default_charset = "utf-8" now works fine

java - How to call a servlet from a HTML form -

Image
this question has answer here: how call servlet class html form 2 answers i have problems connecting html form servlet in web application. here's html file: <form method="post" class="/login" action="/login"> <fieldset class="textbox"> <label class="textbox_field"> <span>username or email</span> <input id="username" name="username" value="" type="text" autocomplete="on" placeholder="username"> </label> <label class="textbox_field"> <span>password</span> <input id="password" name="pass

unix - Renumber everything that is in a specific column -

1) how renumber second column numbered 33 through 64 instead of 1 through 32? 2) how renumber 5th column add +5 every number shown? i.e. first 21 rows have 6 in fifth column. next 10 rows have 7 in fifth column. atom 1 n phe 1 -475.892 131.360 18.903 1.00 0.00 prt atom 2 ht1 phe 1 -474.916 131.490 19.239 1.00 0.00 prt atom 3 ht2 phe 1 -476.183 130.447 19.307 1.00 0.00 prt atom 4 ht3 phe 1 -475.832 131.151 17.886 1.00 0.00 prt atom 5 ca phe 1 -476.789 132.490 19.345 1.00 0.00 prt atom 6 ha phe 1 -476.569 132.728 20.375 1.00 0.00 prt atom 7 cb phe 1 -478.274 131.952 19.117 1.00 0.00 prt atom 8 hb1 phe 1 -478.456 131.739 18.042 1.00 0.00 prt atom 9 hb2 phe 1 -478.286 131.075 19.799 1.00 0.00 prt atom 10 cg phe 1 -479.371 132.856 19.681 1.00 0.00 prt atom 1

c# - fill dropdownlist from onselectindexchanged -

im using asp.net , c# im using 2 dropdownlist dd1,dd2 how fill 2nd dropdownlist dd2 dd1 onselectindexchanged my code is, <asp:dropdownlist id="ddmedtype" runat="server" cssclass="drop" autopostback="true" onselectedindexchanged="ddmedtype_selectedindexchanged"> <asp:listitem value="0">-select-</asp:listitem> <asp:listitem value="tablet">tablet</asp:listitem> <asp:listitem value="tonic">tonic</asp:listitem> <asp:listitem value="capsules">capsules</asp:listitem> <asp:listitem value="dispotab">disposable tablet</asp:listitem> </asp:dropdownlist> <asp:dropdownlist id="ddmedname" runat="server" cssclass="drop" > <asp:listitem value="0">-select-</a

java - Argument type mismatch in JUnit -

i'm new selenium webdriver , java, used selenium ide. i'm trying read testdata excel sheet. written eclipse console, works, , should used execute actual test, doesn't work. actual test not executed because error argument type mismatch. code looks this: package test_excel; import java.io.fileinputstream; import java.io.ioexception; import java.util.arrays; import org.junit.assert; import org.junit.test; import org.junit.runner.runwith; import org.junit.runners.parameterized; import org.junit.runners.parameterized.parameters; import jxl.sheet; import jxl.workbook; import jxl.read.biff.biffexception; @runwith(parameterized.class) public class testwithexceldata { // our 2 parameters private final int input; private final int resultexpected; // constructor public testwithexceldata(int input, int result) { this.input = input; this.resultexpected = result; } @parameters public static iterable<object []> data() throws

angularjs - opening a new tab loses the arraylist in local storage javascript stack overflow -

my application work tries store data on local storage works fine when not opening new tab or window, when open new tab, array loses previous stored data , stores current data. please suggest doing wrong here. my code this: getcurrreqidlist = []; localstorage.setitem('getcurrreqidlist', json.stringify(getcurrreqidlist)); var retrieveddata = localstorage.getitem('getcurrreqidlist'); var getfinalreqidlist = json.parse(retrieveddata); if(getfinalreqidlist.length > maxcurrentconnectionlength) { console.log('hello'); getfinalreqidlist.shift(); getcurrreqidlist.shift(); localstorage.setitem('getcurrreqidlist',json.stringify(getfinalreqidlist)); } the post bit confusing, bet have lines getcurrreqidlist = []; localstorage.setitem('getcurrreqidlist', json.stringify(getcurrreqidlist)); running every time load page, initializing store. when open new tab, loads page , override local storage value empty array. y

node.js - Can't start mongodb on AWS instance -

i have worked on mongodb database. have installed in server & worked on this. facing problem. mongodb database not responding. when giving command : mongo mongodb shell version: 2.6.10 connecting to: test 2015-07-02t06:22:11.363+0000 warning: failed connect 127.0.0.1:27017, reason: errno:111 connection refused 2015-07-02t06:22:11.364+0000 error: couldn't connect server 127.0.0.1:27017 (127.0.0.1), connection attempt failed @ src/mongo/shell/mongo.js:146 exception: connect failed i have delete lock file, repair mongodb restart mongodb. cant solve problem. here mongodb.log file: 2015-07-02t06:30:48.789+0000 [initandlisten] mongodb starting : pid=5551 port=27017 dbpath=/var/lib/mongodb 64-bit host=ip-172-31-5-213 2015-07-02t06:30:48.789+0000 [initandlisten] db version v2.6.10 2015-07-02t06:30:48.789+0000 [initandlisten] git version: 5901dbfb49d16eaef6f2c2c50fba534d23ac7f6c 2015-07-02t06:30:48.789+0000 [initandlisten] build info: linux build18.nj1.10gen.cc 2.6.32-431.

githooks - Git Hook to detect branch creation -

we need write client-side git hook detect new branch creation master. whenever new branch created, folder needs deleted branch. i not sure hook best place check or how identify if branch has been created. a client hook tricky, as: it can bypassed client, , is not deployed on clients. a server hook easier ( update hook ), since receives 0 sha new refs. same hook can list content of commit git diff-tree --no-commit-id --name-only -r <sha1> # or git ls-tree -d --name-only -r <sha1> if specific folder still there, can reject push helpful message.

angularjs - ngCart checkout button always 404s -

i feel being stupid. in docs says ngcart render checkout button this: <ngcart-checkout service="http" settings="{ url:'/checkout' }"></ngcart-checkout> however returns 404. have setup checkout view , added routeprovider (which works normal link) i have tried variations (add hashbang etc) , links non-angular pages 404s ngcart's example seem invoke checkout button so: <div ng-if="service=='http' || service == 'log'"> <button class="btn btn-primary" ng-click="checkout()" ng-disabled="!ngcart.gettotalitems()" ng-transclude>checkout</button> </div> this returns: provider.checkout not function - expected haven't declared it. wouldn't know start creating function open checkout page. any awesome! try changing code this: <ngcart-checkout service="http" settings="{ url:'/#/checkout' }"></ngc

javascript - AngularJS ng-repeat for XML attributes -

working first angularjs project , ran issue. using xml, converted json x2js . i want display student names: "ed frank jimmy sally" my current code outputs "ed jimmy" because accessing student[0]._name . how can cycle through name attributes using ng-repeat? xml <school> <teacher name="williams"> <student name="ed"/> <student name="frank"/> </teacher> <teacher name="ramos"> <student name="jimmy"/> <student name="sally"/> </teacher> </school> json { "school": { "__cnt": 5, "teacher": [ { "__cnt": 6, "student": [ { "__cnt": 1, "_name": "ed" },

C# LINQ GroupBy with NULL values -

i have object dates: class myobj { public datetime? date {get; set;} } as can see date nullable. possible use linq 's groupby method group list<myobj> dates including null s? to like: {elements_with_date_1, elements_with_date_2, ..., elements_with_no_date} ? the groupby -method extension-method, means static method accepts date parameter. written listwithnulls.groupby() treated groupby(listwithnulls) . because of behavior, null -values can handled , don't nullreferenceexception . have @ extension-methods definition. helps understand how can work them: public static ienumerable<igrouping<tkey, tsource>> groupby<tsource, tkey>(this ienumerable<tsource> source, func<tsource, tkey> keyselector); you can see first argument written this ienumerable<tsource> source , enables short-handle source.groupby() .

Where is the temporary file generated by chrome extension? -

a chrome extension generated image file, opened in chrome tab, url of tab filesystem:chrome-extension://fdpohaocaechififmbbbbbknoalclacl/temporary/screencapture-www-google-com-webhp-1436884653249.png is possible locate temporary file in os? fyi. here code generate file window.webkitrequestfilesystem(window.temporary, size, function(fs){ fs.root.getfile(name, {create: true}, function(fileentry) { fileentry.createwriter(function(filewriter) { filewriter.onwriteend = onwriteend; filewriter.write(blob); }, errorhandler); }, errorhandler); }, errorhandler); the chrome extension installed on win7 pc at: c:\users\{myname}\appdata\local\google\chrome\user data\profile 1\extensions\fdpohaocaechififmbbbbbknoalclacl\0.0.15_0 but cannot find temporary file/folder. for windows os ,please follow below steps: 1-go c:\users{username}\appdata\local\google\chrome\user data\default\file system 2-sort folders according date mo

linux - Exploring a directory using a for loop in python - does the order change? -

one of folders has json files, , i'm reading data contain classification svm. question had based on code: filename in os.listdir(os.getcwd()): if re.search('.json$',filename): try: open(filename) json_data: print filename each time pipe output, find filenames printed in same order, so: 95231464576.json 131777220274261.json 17151210249.json 122624927762214.json 159287900855286.json 155273941171682.json 5265971983.json 169635939813776.json 159429967503904.json 169114363192327.json 170797436313930.json 155963124522916.json there few text files, , python files in directory. question here is: determines order in these files printed? for loop have way of looking files? tried examining whether order based on size (max min or min max) or last modified(i had no reason these tests,i tried them since can't think of other insight). tried snippet 4 times, , order

android - G.Maps javascript Multiple directions from my position. Reload page -

then have code geolocation of position , number of places want go .i used service driving directions google have problem , read first target while others work if select , reload page . have solutions ? there quite few issues in code. start not defined when call calcroute() function. want use mylocation instead. you should use 1 infowindow object , use setcontent() method change content (in click event listener).

Django CSV file -database upload error -

i have csv file , trying populate them sqlite database. have no error message , works fine loads last line of file. md= md() database = options.get('database') filename = options.get('filename') datareader = csv.reader(open(filename)) row in datareader: if row[0] != 'id': bb= 1 if row[3] == 'yes' else 0 pro = 'yes' if row[4] == 'pro' else 'no' md.id = row[0] md.mol = row[1] md.phase = row[2] md.warning = black_box md.pro = pro md.status = type.objects.get(description=row[5]) md.name = row[6] md.stem = row[7] md.year = row[8] md.iname = row[9] md.iyear = row[10] print row[1], row[2],row[3],row[4],row[5],row[6

Android prepare Resume Ability to download manager -

this below code simple download manager , i'm trying add resume ability that. @daniel nugent share code. public class mainactivity extends actionbaractivity { private imageview image; private bitmap bmp; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); image = (imageview) findviewbyid(r.id.imageview); new postasync().execute(); } @override protected void onresume() { super.onresume(); //put on resume functionality here.... } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home

Editing variable labels for dotplot of (g)lmer object with R/Lattice -

Image
i'm using glmer() function lme4 package estimate complex mixed effects models multiple random effects. after model estimated, i'm using dotplot() function lattice package create dotplot of random effects, include varying slopes. inquiry concerns how edit variable labels in dotplot a simple reproducible example of problem goes follows. library(lattice) library(lme4) data(sleepstudy) sleepstudy$x <- rnorm(180) m1 <- lmer(reaction ~ days + x + (days + x | subject), sleepstudy) dotplot(ranef(m1, condvar=true), ylab="levels", main=false, scales = list(x =list(relation = 'free')))[["subject"]] this produces following dotplot, approximates want. what edit variable labels. namely, i'd remove parentheses "(intercept)", , change labels both varying slopes other variable names called glmer() . possible? i'm sure , it's "strip" option, though i'm not sure be. i'd open ggplot2 solution well.

azure - Where is located the ServiceDefinition.csdef file? -

i'm following tutorial https://msdn.microsoft.com/en-us/library/azure/gg433110.aspx configure web role multiple web sites, in tutorial should open servicedefinition.csdef file, not know file located, route find file? use visual studio create file (and other necessary files project) prior configure web role: 1) install sdk chosen language. http://azure.microsoft.com/pt-br/downloads/ 2) in visual studo, create new cloud project 3) add roles want use, ie. website, add web role. if don't want use visual studio, can create standard cloud service project using powershell cmdlet. layer goes above web project. new-azureserviceproject https://msdn.microsoft.com/en-us/library/azure/dn495188.aspx

linux - check file existence cron job -

i trying write cronjob action if replicationtest.txt not exist , replicationtestseen.txt exist in specific directory. right doing not working. here doing: 0 3 * * 0 [ [ ! -e /dv1/replicationtest/replicationtest.txt ] && [ -e /dv1/replicationtest/replicationtestseen.txt ] ] && echo 'replication passed' | mail -s 'replication test passed' myemail@email.com || echo ' replication failed' | mail -s 'replication failed' myemail@email.com even when conditions right cron email replication passed still emails replication failed. you’re mixing test s. pattern of [ [ ... ] && [ ... ] ] should not work. see this answer details. if change tests should work: [[ ! -e ... ]] && [[ -e /dv1/... ]] test conditions outside of cron before putting them crontab. , make sure of which shell cron set use .

spring boot - Apply further configuration to Jackson2ObjectMapperBuilder before it is used -

springboot comes own pre-configured jackson2objectmapperbuilder used through framework configure various objectmapper . the builder doesn't expose facets of objectmapper , wondering how apply additional configuration builder before used? i can provide own jackson2objectmapperbuilder instance loose default initialisation provided springboot... is there way? create beans extend com.fasterxml.jackson.databind.module.simplemodule, there configure example own seriealizers , deserializers. in newer spring versions (dont know since when @ least since spring 4 ) these beans picked automatically. in older versions of spring may need add modules manually objectmapper, tricky, because spring creates many beans of type objetmapper , not easy find right one.

What font-families should I use to display all major languages in my pdf in all operating systems? -

i'm working on project convert html content pdf using apache fop. i'm working different languages , i'm not sure if font-family i'm using work on linux. don't have access linux machine right now. i'm using feature in fop configuration pick fonts respective os. right i'm using arial,ms mincho,sans-serif families. ms mincho comes office package. fear languages such japanese , chinese not rendered in linux. there other families common both oss?

fiware - Configuration Wilma Pep proxy 4.3 - Keyrock 4.3 local instance - IDAS -

we have installed keyrock instance (horizon + keystone) through automated tools in local enviroment (ubuntu 14.0.4 lts). have followed guide keystone host: ubuntuhost keystone port: 5000 horizon host: ubuntuhost horizon port: 8000 we have installed pep proxy wilma in local enviroment (centos 6.6): pep proxy wilma host: centoshost pep proxy wilma port: 80800 we want configure pep proxy wilma attack instance of idas installed in same enviroment pep proxy wilma: idas host: centoshost idas port: 8080 in order have put following configuration file of pep proxy wilma: config.account_host = 'ubuntuhost:8000'; config.keystone_host = 'ubuntuhost'; config.keystone_port = 5000; config.app_host = 'centoshost'; config.app_port = '8080'; config.username = 'idm'; config.password = 'idm'; // in seconds config.chache_time = 300; when try run pep proxy wilma server, following error shows up

OSX - Start and Stoping of Nginx error -

i install nginx via home brew , when try start or stop following error ➜ ~ sudo nginx -s stop nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: no such file or directory) ➜ ~ sudo nginx nginx: [emerg] bind() 0.0.0.0:8080 failed (48: address in use) nginx: [emerg] bind() 0.0.0.0:8080 failed (48: address in use) nginx: [emerg] bind() 0.0.0.0:8080 failed (48: address in use) nginx: [emerg] bind() 0.0.0.0:8080 failed (48: address in use) nginx: [emerg] bind() 0.0.0.0:8080 failed (48: address in use) nginx: [emerg] still not bind() file structure ➜ ~ /usr/local/var/run ➜ run git:(master) ls nginx ➜ run git:(master) cd nginx ➜ nginx git:(master) ls client_body_temp fastcgi_temp proxy_temp scgi_temp uwsgi_temp ➜ nginx git:(master) to check if nginx running ➜ ~ ps waux | grep nginx harshamv 963 0.0 0.0 2432772 656 s000 s+ 1:32pm 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=.cvs --exclude-dir

c++ - DFS Recursion of a Tree, need assistance with visited issue -

i'm having issues when trying navigate tree contains cycles. code enters infinite loop , core dumps. problem code isnt setting nodes visited after visiting them loops forever. appreciated. #include "graphcode.h" //#define ebug /****************************************************************************** static const string tag = "graphcode: "; /****************************************************************************** * constructor **/ graphcode::graphcode() { } /****************************************************************************** * destructor **/ graphcode::~graphcode() { } /****************************************************************************** * accessors , mutators **/ /****************************************************************************** * general functions. **/ /****************************************************************************** * function 'creategraph'. * read data input stream , crea

Wamp Server phpmyadmin blank screen -

i read many things problem didn't find solution. have wamp , bitnami installed on same pc , , think brings me conflict problem. , changed apachi wamp port 80 8888. when write l ocalhost:8888 can see main wamp page. if write localhost:8888/phpmyadmin have blank page. tried write http:localhost:8888/phpmyadmin , nothing seems work. don' want unistall bitnami. should fix problem?

ios - Custom modal view controller looks odd after dismissing MFMailComposeViewController -

here code have used, when return mail compose controller previous modal view controller size reduced. not able find set controller size make effect on presenting view controller. - (void)mailcomposecontroller:(mfmailcomposeviewcontroller*)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror*)error { switch (result) { case mfmailcomposeresultcancelled: nslog(@"mail cancelled: cancelled operation , no email message queued."); break; case mfmailcomposeresultsaved: nslog(@"mail saved: saved email message in drafts folder."); break; case mfmailcomposeresultsent: nslog(@"mail send: email message queued in outbox. ready send."); break; case mfmailcomposeresultfailed: nslog(@"mail failed: email message not saved or queued, possibly due error."); break; default: nslog(@"mail not sent."); break; } // remove mail view [

javascript - Intersection point of a line with cardinal interpolation and a line with linear interpolation in D3 -

i need find intersection point of line cardinal interpolation i.e. var line = d3.svg.line() .interpolate("cardinal") .x(function(d, i) { return x(d.x); }) .y(function(d, i) { return y(d.y); }); and line between 2 points i.e. svg.append('line').attr('x1',x1).attr('y1',y1).attr('x2',x2).attr('y2',y2) is there way find intersection of above mentioned lines? or can equation of cardinal spline given default value cardinal interpolation in d3 '0.7' ?

resources - WPF StaticResource vs DynamicResource -

i have xaml below <window.resources> <solidcolorbrush x:key="brushme" color="red"/> <solidcolorbrush x:key="freezebrushme" po:freeze="true" color="yellow"/> </window.resources> <stackpanel> <button background="{staticresource brushme}">static</button> <button background="{dynamicresource brushme}">dynamic</button> <button click="button_click">changecolorproperty</button> <button click="button1_click">changebrushobject</button> <!--<button background="{staticresource notexistresource}" click="button_click_1">generateresourceforstatic</button>--> <button background="{dynamicresource notexistresource}" click="button_click_1">generateresourcefordynamic</button> <button background="green" click

java - How the consume can notify the JMS queue to hold the message -

my scenario is, listen queue. if message posted, consume , forward app. is possible when finding app is down, can notify queue, in way, hold message don't message. when app come back, notify queue can process message again. it seems "client_acknowledge" mode doesn't on situation. help in regard appreciated. in advance. in general, have 2 possibilities: just stop consuming messages. in case, messages stay in queue until resume processing. generate queue channel , send stop/start messages on queue producer of messages. can regarded implementation of backpressure. imho, 1. should sufficient in cases. 2. necessary, if amount of messages generated leads large resource (memory/disk) consumption want avoid. still use combination of two, e.g. if app down more time, notify producer.

android - How do I position menu items in ActionBar? -

my actionbar consists of logo , text. done inflating following menu : <menu xmlns:android="http://schemas.android.com/apk/res/android" tools:context="com.example.sv_laptop.myapp.register"> <item android:id="@+id/action_settings" android:title="@string/signup" android:orderincategory="1" app:showasaction="always" /> <item android:id="@+id/icon" android:title="icon" android:icon="@drawable/icon" android:orderincategory="0" app:showasaction="always" /> </menu> however, shows both items on far right hand side of actionbar together. want achieve logo being on far left hand side , text/title being in middle. does know how can this? problem displays image small - highly appreciate if give me walkthrough on how scale it. this how i'm inflating menu public boolean oncreateo

How to Fire event on scrollBar visible in javaFX? -

at time of scroll bar visible or occur want fire event. till i've done private scrollbar getverticalscrollbar() { scrollbar result = null; (node n : scrollpaneid.lookupall(".scroll-bar")) { if (n instanceof scrollbar) { scrollbar bar = (scrollbar) n; if (bar.getorientation().equals(orientation.vertical)) { result = bar; } } } return result; } scrollbar bar = getverticalscrollbar(); through can check if scroll bar appear or not if(bar.isvisible()) { } but works after scrollbar visible. requirement fire event when scrollbar appear you can try adding changelistener visible property.something below fire every time visibility changes put logic inside changed method according requirement result.visibleproperty().addlistener(new changelistener<boolean>() { @ove

r - roxygen2 how to not run example file -

i aware of how have roxygen not run example when code directly in roxygen comments. however, example may verbose or want examples compiled in examples directory. in case @example file_path works fine can't figure out how have roxygen not run (i.e. \dontrun ) example file . this admitted similar this question comments show problem not answered. test.r # not work #' @title test_fun #' @example \dontrun{examples/test_example.r} test <- function(){ print("hello") } # #' @title test #' @examples #' \dontrun{ #' test() #' } test <- function(){ print("hello") } test_example.r test() how can former approach work? it seems i'm able accomplish using roxygen2-style comments \dontrun{} block in example file. gets around limitation in michal's answer . create example file looks this: #' \dontrun{ test() #' } more reliably, can wrap example in if(interactive()) {} block, won'

vba - export data from access to excel 2007 -

i new vba coding , facing problem. i need transfer table access db excel but whenever try run code gives error says table not present in db my code: sub hello() call transfertoexcel end sub public function transfertoexcel() on error goto errorhandler dim strtable string dim worksheetpath string worksheetpath = "c:\users\desktop\test.xlsx" strtable = "testtable" docmd.transferspreadsheet transfertype:=acexport, _ spreadsheettype:=acspreadsheettypeexcel12, _ tablename:=strtable, filename:=worksheetpath, _ hasfieldnames:=true errorhandlerexit: exit function errorhandler: msgbox "error no:" & err.number _ & "; description: " & err.description resume errorhandlerexit end function

java - Cardbuilder to another cardbuilder -

i have implemented cardbuilder in cardscrollview show information individual cardbuilder. due limited view on glass, want populate more information if user taps on cardbuilder. is possible have cardbuilder show more information of cardbuilder when being tapped on? how best implemented? want every cardbuilder on first level. please help. of course can. when card tapped start activity containing cardscrollview.

java - org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update [Due to Unique Constraint] -

error: org.hibernate.exception.constraintviolationexception: not execute jdbc batch update java.sql.batchupdateexception: duplicate entry '24-0-es_reservation_detail' key 'questionid_referenceid_referencetype' i going save reservation object. reservation object contains collection of reservaitondetails objects , each reservation detail object contains collection of questionanswers objects. the main problem unique constraint on questionanswer table unqiue constraint: question_id, reference_id, reference_type. when system save reservation object: system first save reservation, collection of reservation details , question answers 0 (reference_id). while adding question 0 reference id, system throws exception because unique constraint violated. reservationdetail.hbm.xml ............. ............. <set name="questionanswers" lazy="true" cascade="all-delete-orphan" where="reference_type = 'es_reservation_detail'

hadoop - How to use Zookeeper with Azure HDInsight Linux cluster? -

obviously need start zookeeper server on 1 of cluster machines, need other client machines connect server. way did used ssh connect headnode, found zk server running on port 2181. so, used ifconfig machine's ip address (for example 10.0.0.8) , had worker nodes connect to: 10.0.0.8:2181. however, mr job completes works , output not correct. suspect i'm doing wrong zookeeper, didn't follow tutorial , improvised steps. hdinsight has multiple zookeeper servers. not sure if specifying 1 might cause of problem seeing. i wrote example while uses storm write hbase (both servers on same azure virtual network,) , part of configuration, had specify 3 zookeeper servers component writes hbase. ( https://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/ article.) from cluster head node, can ping zookeeper0, zookeeper1, , zookeeper2 find ip address of each.

How to set environment variables in Python -

i need set environment variables in python script , want other scripts called python (shell scripts) child process see environment variables set. value number. if os.environ["debussy"] = 1 , complains saying 1 has string. want know how read environment variables in python (in later part of script) once set it. environment variables must strings, use os.environ["debussy"] = "1" to set variable debussy string 1 . access variable later, use print os.environ["debussy"] child processes automatically inherit environment of parent process -- no special action on part required.

matrix - Use values from 2 matrices to index a third in R -

i'm optimizing more complex code, got stuck problem. a<-array(sample(c(1:10),100,replace=true),c(10,10)) m<-array(sample(c(1:10),100,replace=true),c(10,10)) f<-array(sample(c(1:10),100,replace=true),c(10,10)) g<-array(na,c(10,10)) i need use values in & m index f , assign value f g i.e. g[1,1]<-f[a[1,1],m[1,1]] except indexes, , optimally/fast possible i make loop me seems rather dumb , slow. seems should able in apply family, i've had no luck figuring out how that. need keep data structured here can use matrix operations in different parts of code. i've been searching answer haven't found particularly helpful yet. g[] <- f[cbind(c(a), c(m))] this takes advantage of fact matrices can addressed vectors , using matrix index.

objective c - iOS cannot parse KML / XML downloaded from server -

a kml file include in project parses correctly whereas same file downloaded server not?! i modified apple's kml parsing example parse kml file. if add kml file directly xcode project parses correctly , displays it's polylines, annotations, etc. on map expected. if download same kml file server, save disk , attempt parse it, parsing not work. i.e. parser not find elements parse in file nothing displayed on map! firstly have verified file downloads , saves disk correctly. checked simulator's data ( simpholders handy tool this) file , compare original 1 in case of corruption, no problem there, downloads , saves correctly, no corruption. i next checked url file pass kml parser ensure correct , fine. used nsfilemanager fileexistsatpath determine this, kml file @ path provide parser. in map view controller's viewdidload method download file server , pass parser. - (void)viewdidload { [super viewdidload]; [[kmldownloader sharedkmldownloader] downloadf

cmd - batch file exit /B -

i wish leave cmd.exe window open upon completion of batch file following. test launching windows 7 explorer, cmd.exe version 6.1.7601. beeps , pause work fine, want leave cmd open issue subsequent commands. @echo off :: wschloss jul 2015 :: batch runs if laptop's core temp close critical :: determined "core temp" utility @ :: "c:\orion\system information\coretemp\64bit\core temp.exe" :: http://www.alcpu.com/coretemp/ :: color 1f :: white on blue :: beeps! echo . type c:\bill\beep.txt :: causes laptop beep attention cls :: echo . echo laptop critical temperature approaches! echo . echo save data , cool me down now! echo . pause color exit /b :: eop this seems trivial missing something. help. add cmd /k end of file redirect program command prompt. (it end program, then, in same window, open command prompt) @echo off :: wschloss jul 2015 :: batch runs if laptop's core temp close critical :: deter

complexity theory - If a deterministic Turing Machine decides a language L, does it mean that it also decides L's complement? -

suppose there deterministic turing machine, e.g. 1 runs in polynomial time, , decides language l. does automatically means decides l's complement language? when saying l's complement language, of course mean language k, such that: k = {x : x not in l} suppose have deterministic turing machine bounded running time, can build turing machine accepts complement of l reversing answer. however, requires turing machine stop on every input (which case if decides language l , stops on every input). machine not decider complement of l, because decider of language has accept it. in general case machine merely accepts (only has stop on inputs "yes"-answers) not decides (stops on every input) language l endless loop inputs not in l, therefore there possibly no explicit "no"-answer reversed.

Check if function can be called: Javascript -

i'm trying write javascript function calls dosomething() continuously, long some_condition true. if some_condition becomes false, should check after 5 seconds whether some_condition has again become true, , if not, display error message on screen. i have of function written, confused whether doing correctly. help. while (some_condition) { dosomething(); else { ??? } no, should not use while loop. javascript single threaded, , if have while loop never returns, browser (or javascript environment of choice) become unresponsive. you need use settimeout schedule function. function enqueuesomething() { if (some_condition) dosomething(); // enqueue ourselves run again without blocking thread of execution settimeout(enqueuesomething); else // wait 5 seconds, try again settimeout(enqueuesomething, 5000); } you'll need maintain state indicates whether you've waiting 5 seconds, , add error-alerting code.

c++ - Qt5.4 How can I create an app based in plugins? -

i have app in qt 5.4 when need include new functionality, need recompile app, take time, need know how create or modified app use plugins created me. a plugin-based architecture requires binary compatible , stable interfaces. once have these, full-project recompilation should take time recompiling single plugin. most likely, have interdependencies in code preclude maintaining binary compatibility anyway - if didn't, changes localized enough recompilation touch couple of files. what you're trying come solution wrong problem. fix structure of code, , recompilation times drop. no need plugins.

sql - Reformatting data in column -

have kinda weird here. have database that's called fldoc. in has column called sentence contains 7 numbers represent length of time. example: 0050000 0750000 0000600 0040615 0000110 in 7 digits length of type since digits represent yyymmdd so i'd script can convert this: 5y 00m 00d 75y 00m 00d 6m (or 000y 6m 00d fine well) 4y 6m 15d etc etc thanks in advance... concat new sql server 2012. if have previous version of sql server, instead achieve desired output: select sentence ,( case when cast(left(sentence, 3) int) > 0 cast(cast(left(sentence, 3) int) varchar(3)) + 'y ' else cast(left(sentence, 3) varchar(3)) + 'y ' end + case when cast(substring(sentence, 4, 2) int) > 0 cast(cast(substring(sentence, 4, 2) int) varchar(2)) + 'm ' else cast(substring(sentence, 4, 2) varchar(2)) + 'm ' end +

rstudio - R: Cannot use 0-cloud to install.packages -

when try install packages 0-cloud doesn't work > install.packages("lfactors") --- please select cran mirror use in session --- then select 0-cloud list of repositories. , r returns warning: unable access index repository https://cran.rstudio.com/src/contrib warning: unable access index repository https://cran.rstudio.com/bin/windows/contrib/3.2 warning message: package ‘lfactors’ not available (for r version 3.2.1) but, when run code , select repository work. i tried turning off proxy server, , visiting site proxy server on , can visit in browser no issue. any ideas? edit: based on comment, ran this capabilities()["libcurl"] libcurl true so think it's not that. your r binary may have been built without curl support, , cannot access https servers. see returns: r> capabilities()["libcurl"] libcurl true r> in case false you, 2 things: change options("repos") use http instead of http