Posts

Showing posts from May, 2010

node.js - how to set read Preference secondary using mongoclient in nodejs mongodb driver? -

i using mongodb replica set. have following config : { "members": [ { "host": "db1.example.com", "port": "27017" }, { "host": "db2.example.com", "port": "27017" } ] } i connecting db name myapplicationdb using following nodejs code : using mongodb driver version 1.4.38. var mongoclient = require('mongodb').mongoclient; var server = require('mongodb').server; var url = 'mongodb://'; var options = { server: { slaveok: true, readpreference: server.read_secondary, socketoptions: {"connecttimeoutms": 30000} }, db: { readpreference: server.read_secondary }, replset: { rs_name: "replicaname", readpreference: server.read_secondary } } members.fo

java - Extract Tabular Data from PDF - RAEX File -

i want extract , parse data tables on pdf file structured (raex file ). the raex file s gsma roaming database , contain many tables datas of operators. there's api tabular extracting data not automatised have extract , clean data hand. tried pdftables api it's limited , not free. please need route parse tabulars data java. purpose make readily accessible front-end please help,

html - Getting image properties from Javascript Image() Element constructor -

i'm using new image() , preload images so: function preload() { var imgs = []; (i = 0; < arguments.length; i++) { imgs[i] = new image(); imgs[i].src = arguments[i]; } return imgs; } //function being called var paths = ["../images/image01.jpg","../images/image02.jpg", ...]; var images = preload.apply(null, paths); this returns array of img objects ... of properties emptied when displayed console.log() my question - how can width , height of every preloaded image? or more - possible in mysterious way dimensions earlier (some sort of pre-reading-pre-loaded-pre-image), create preloaded images particular size? i'm sorry if don't understand obvious on "how these things works", happens me quite often. just clarification as @waterscroll pointed out, loading images takes time, getting image properties has done when .onload event occurs. later on, images can handled callback function . feel free take @ other answers

python - pandas dataframe data retrieval -

here sample pandas data frame icd_code from_date paid_amount claim_id ckey-7724339 719.43 2015-09-26 300.09 ckey-5008998 722.2 2015-04-21 11.65 ckey-7896598 722 2015-02-23 17.19 ckey-7758556 850.9 2014-03-13 414.02 ckey-7749118 847.0 2012-07-18 4.42 ckey-10383160 854.00 2015-06-16 751.68 ckey-10678452 607.84 2015-07-07 11.13 ckey-10734364 882.2 2015-07-22 5625.00 ckey-3500566 307.89 2011-08-09 500.00 ckey-10766667 344.1 2013-12-03 139.41 when use .loc retrieve, output follows $ indexed_data.loc['ckey-10766667'] icd_code 344.1 from_date 2013-12-03 paid_amount 139.41 name: ckey-10766667, dtype: object ~~~~~~~~expected output ~~~~~~~~~~ ckey-10766667 344.1 2013-12-03 139.41 can point me what's wrong in above code note : have call data.set_index('claim_id') on o

c++ - How can I delete a QSharedPointer -

i have written wrapper around qtextedit use qiodevice. want able use multiple wrapper same qtextedit, may use different text color each wrapper. to make wrapper thread-safe added qmutex protect usage of qtextedit. thinking must use 1 mutex protect 1 qtextedit. i end following implementation, using qsharedpointer protect qtextedit. texteditiodevice.h class texteditiodevice : public qiodevice { q_object public: texteditiodevice(qtextedit * qtextedit, qcolor color, qobject * parent); virtual ~texteditiodevice(); protected: qint64 readdata(char *data, qint64 maxlen); qint64 writedata(const char *data, qint64 len); private: /** * @brief pointer qtextedit */ qpointer<qtextedit> textedit; /** * @brief text color */ qcolor color; /** * @brief shared pointer qtextedit associated mutex */ qsharedpointer<qmutex> mutex; /** * @brief storage qtextedit associated mutexes */ sta

android - Why is their Parameter of type View for an onClick Method -

.... android:onclick = "activity1"; .... public void activity1(view view) { ..... } why parameter function of type view you can set onclicklistener on view. means that listener not know kind of element set listener on. since elements can set onclicklistener on extend view , gives view because knows sure element view . you can detect element clicked, , can cast specific element if want.

ios - textfiled is not empty when i return from log-out to log in screen [ SWIFT ] -

hope did work login , log out.but when try logout working fine.but when return login screen username/password remain there. needed how when logout or return login screen text field should empty. here vc.swift struct storyboard { static let showloginsegue = "sss" } @iboutlet weak var userfield: uitextfield! @iboutlet weak var passfield: uitextfield! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. self.userfield.delegate = self self.passfield.delegate = self } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } @ibaction func loginbut(sender: anyobject) { let klak = "" let qwqw = "" if userfield.text == klak && passfield.text == qwqw { print("correct") performseguewithidentifier(storyboard.showloginsegue, sender: nil) } else {

vb.net - Programmatically adding/displaying/inserting images to OneNote 2013 -

i'm having trouble adding image page in onenote 2013. can create sections, notebooks , pages content, i'm having trouble adding image page. i call updatepagecontent , pass in xml invalid xml message (hresult 0x80042001) back. assistance appreciated. here complete code use create xml i'm trying update page with: sub createnewpage(byval pagename string) dim onenote microsoft.office.interop.onenote.application onenote = new microsoft.office.interop.onenote.application ' of notebook nodes. dim nodes msxml2.ixmldomnodelist nodes = getfirstonenotenotebooknodes(onenote) if not nodes nothing ' first onenote notebook in xml document. dim node msxml2.ixmldomnode node = nodes(0) dim notebookname string = "" notebookname = node.attributes.getnameditem("name").text ' id notebook code can retrieve ' list of sections. dim notebookid string noteb

json - visualizing a mapping in d3js- model to be used -

Image
i trying visualize m:n mapping between 2 entities in d3js. want achieve attached i familiar d3 force layout relationships central node , tree diagram , checked out examples couldn't find relevant base models. http://techslides.com/over-1000-d3-js-examples-and-demos what base model should use represent m:n relationship? thanks pointers you need network diagram . check this dragable network d3 wiki gallery sample network sankey diagrams nice show networks: sankey diagrams - editable sankey play some samples data: here's force layout data here 's sankey diagram

Google Drive Api: I get a positive response when trying to remove a permission but the permission hasn’t been removed -

i've got similar this one , no solution has been given. i'm working on python script tidy company googledrive . problem have when removing user our domain shared files still have user permission on them. we can manually delete them ideally we'd script it. but when using permissions().delete() permission still there , not receive error. i tried using try it! on google drive api reference same thing got positive response (204) permission wasn’t removed. note when user has been deleted permission on drive permissions.list() show empty domain, email, , name rest (role, type, id, etag ...) still show.

css - Easing out transition in React -

i'm starting react , running issue expecting quite simple. i'm trying have block of text fade in , fade out based on simple trigger, can't fade out. the code below , i've got button makes message appear. fading in fine , disappearing after 2 seconds, expecting message fade out upon leaving... i'm misunderstanding meaning of in react-ish transition css. here react component: class messagesender extends react.component { render() { let sent_element = null; if (this.state.linksent) { sent_element = <animatedtext/>; } return ( <div> {sent_element} </div> ); //a fetch triggers: ...then((json) => { if (json.success) { _this.setstate({ linksent: true }) settimeout( function(){ _this.setstate({linksent:false}); },2000 ) } }); } class animatedtext extends react.component { render() { return <r

How to style Menu Items in Navigation Drawer in Android? -

Image
i want add style menu items inside navigation drawer unable so. have looked answers couldn't done it. can help, grateful. i using following theme theme.appcompat.light.darkactionbar <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:id="@+id/group1" android:checkablebehavior="single"> <item android:title="book now!"> <menu> <item android:title="item 1" android:id="@+id/item1" android:icon="@drawable/ic_menu_gallery"/> <item android:title="item 2" android:id="@+id/item2" android:icon="@drawable/ic_menu_gallery"/> <item android:title="item 3" android:id="@+id/item3" android:icon="@drawable/

node.js - How to create DB users in mongodb using mongoose -

i can create users mongo shell using createuser() function. have requirement need create users gui(using nodej,express).im using mongoose multiple connections db. cant see functions in mongoose. there functions or packages supports features createuser, delete user this. connect using db = mongoose.mongo.mongoclient('mongodb://'+username+':'+passwor‌​d+'@localhost/dbtoco‌​nnect, function(err, db){}); using db object admin access first. can use admin collection , authenticate using admin username , password using admin_db.authenticate('adminusername', 'password'); using adduser function can add users

dictionary - Convert interface{} to map in Golang -

i trying create function accept following *struct []*struct map[string]*struct here struct struct not specific one. converting interface *struct or []*struct working fine. giving error map. after reflect shows map[] giving error when try iterate on range. here code package main import ( "fmt" "reflect" ) type book struct { id int title string year int } func process(in interface{}, isslice bool, ismap bool) { v := reflect.valueof(in) if isslice { := 0; < v.len(); i++ { strct := v.index(i).interface() //... proccess struct } return } if ismap { fmt.printf("type: %v\n", v) // map[] _, s := range v { // error: cannot range on v (type reflect.value) fmt.printf("value: %v\n", s.interface()) } } } func main() { b := book{} b.title = "learn go language" b.year

php - Laravel Auth login -

i'm using laravel 5.1 schema::create('users',function(blueprint $table){ $table->increments('id'); $table->string('usr_username'); $table->string('password'); $table->integer('usr_peopleid') ->length(10) ->unsigned(); $table->timestamps(); $table->softdeletes(); $table->integer('usr_groupid') ->unsigned() ->length(10); $table->integer('usr_deletedid') ->unsigned() ->length(10); $table->integer('usr_updatedid') ->unsigned() ->length(10) ->nullable(); $table->integer('usr_createdid') ->unsigned() ->length(10) ->nullable(); this migration code users table , routes.php route::get('/login', 'auth\authcontroller@getlogin'); route::post('/login', 'auth\authcontroller@postlogin')

angularjs - Why isn't my directive's selection being bound to the controller? -

i've got simple directive i'm working - it's small wrapper around dropdown. want expose attribute, "selectedoption" (well, selected-option) can two-way bind controller. i've set property in scope of directive (and set = thought allow two-way binding), exposed property on main controller. i've attached example. have expected default item shown "beta". , if changed selections alpha, controller value updated "a". doesn't happen - appear isolated though i've specified property should available controller. what magic bit of code missing here? angular .module('app', []); angular.module('app').controller('test', function(){ var vm = this; vm.inv = 'b'; vm.displayinv = function () { alert('inv:' + vm.inv); }; }); angular.module('app') .directive('inventorytest', function () { return { restric

unable to use selenium via ASP.NET and C# -

i have read alot of answer on here question, not help, because try has not worked i using selenium via asp.net c# on web app. want able login , webpage , parse page. my problem continues cannot find binary(chrome or firefox). environment path contains location both. add binary path , still nothing. code have attempted below: var ffbinary = new firefoxbinary(@"c:\program files\mozilla firefox\firefox.exe"); var firefoxprofile = new firefoxprofile(profilepath); var driver = new firefoxdriver(firefoxprofile); this tells me cannot find binary firefox, executable in location var options = new openqa.selenium.chrome.chromeoptions(); options.binarylocation = "c:\\program files\\google\\chrome\\application\\chrome.exe"; var driver = new chromedriver(appdomain.currentdomain.basedirectory + @"\scripts", options, timespan.fromseconds(180)); i mean looks fine, getting nowhere. can me conundrum? here error: specified firefox binary location not exis

assembly - Can RAM modification damage hardware? -

can real mode program can write arbitrary memory areas, damage hardware? not included in scenario interrupt calls or other things can done in real mode - pure writing memory. this page shows memory map of x86 systems, , see stuff bios data area; fear writing area might persistent changes bios, or @ least change bios settings unexpected values. more things can destroyed. i read hardware access in real mode can destroy hardware; not explain circumstances have made. since asking writing access without invoking interrupts, main question is, if changes memory can persistent changes; , if yes, , why? assuming modern 80x86 hardware; things won't cause persistent changes and/or damage include: changing reset when computer reset; including contents of ram, caches, cpu's micro-code, etc. writing area legacy roms copied ram (the area 0x000c0000 0x000fffff). note ram, set "ignore writes" in memory controller after post. writing area contains firmware (t

c# - instead of error page redirection show error message in live site -

i want redirect error page when http error occurs in web site , working in locally in live site returns messages instead of default redirection. i use following code part in web config enter image description here remove existingresponse='replace' other wise follow below link error solution

google apps script - How to find if sheet is empty? -

i getting data range of sheet , using range.getnumrows() number of rows in google spreadsheet using google apps script. but when sheet happens empty, range.getnumrows() still returns 1 instead of 0. guessing because range has have @ least 1 cell. is there (simple) way number of rows in sheet without having problem? i know loop through cells in sheet check empty, doesn't seem efficient. i stumbled across answer on app script documentation. i using sheet.getlastrow() now

ios - How to change height of custom cell on button's click? -

i have issue regarding height of custom cell. need increase height of cell when 1 button on cell clicked. know use 2 methods (heightforrow , didselectrow) confuse when clicked on button time custom method button action called , using 2 methods in controller.i attached code: in customcell.m - (ibaction)btnrestplusclicked:(id)sender { uibutton *btn = (id)sender; btn.selected =!btn.selected; if (btn.selected) { nslog(@"selected"); // _viewextrascheduleamount.hidden = false;//i need make event on button action , same time increase height of cell. } else { btn.tag = 0; // _viewextrascheduleamount.hidden = true; } now need when button clicked time row's height increase. - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { //if (ceel.btnrestplusclicked.selected) //{ // return 100; // } // return 60; know wrong here how use method? } pl

r - peculiar installation warning causing packages to malfunction -

i want install package xgboost in r per instructions: install.packages("drat", repos="https://cran.rstudio.com") drat:::addrepo("dmlc") install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source") the installation of first 2 packages seems work fine: install.packages("drat", repos="https://cran.rstudio.com") % total % received % xferd average speed time time time current dload upload total spent left speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 49369 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0100 49369 100 49369 0 0 40981 0 0:00:01 0:00:01 --:--:-- 41004 downloaded binary packages in /var/folders/sx/c5z57jp103s493xxcn9bhvwc0000gn/t//rtmpluolul/downloaded_packages drat:::addrepo("dmlc") but final installation of xgboost irregul

bluetooth - What replaced libbluetooth1-dev for C programming using BlueZ? -

i'm trying work on bluetooth project in c using bluez on linux , i'm following tutorial guidance, it's quite few years old , think library uses deprecated ( libbluetooth1-dev ). here tutorial, compilation line in section requires library bluetooth believe have got performing this page of tutorial, running apt-get command on page results in error: package bluez-utils not available, referred package. may mean package missing, has been obsoleted, or available source following packages replace it: bluez e: unable locate package libbluetooth1-dev e: package 'bluez-utils' has no installation candidate any appreciated. managed sort out in case after finding another stackoverflow question - needed run apt-get install libbluetooth-dev (not libbluetooth1-dev tutorial said) , compile instructed. apt-get installed libbluetooth-dev , libbluetooth3 current version of libbluetooth.

C++ program wont compile with expected expression and function not allowed here -

#include <iostream> using namespace std; const int lab8 = 10; int labarray[lab8]; void promptuser(int [], int); void sortarray(int [], int); void showarray(const int[], int); int searcharray(const int [], int, int value); int x = 0; int results = 0; int main() { promptuser(labarray, lab8); sortarray(labarray, lab8); showarray(labarray, lab8); cout << "choose integer want search array: " << endl; cin >> x; results = searcharray(labarray, lab8, x); if (results == -1) { cout << "that number not exist in array. \n"; else { cout << "the integer searched @ element " << results; cout << " in array. \n"; } } void promptuser(int numbers[], int size) { int index; (index = 0; index <= size - 1;index++ ) { cout << "please enter ten numbers fill array " << endl << (index + 1) << ": "; cin >> numbers

spring - ERROR o.s.test.context.TestContextManager - Caught exception while allowing TestExecutionListener -

in spring boot 1.4.0.build-snapshot application i'm faced following issue when run tests @ ubuntu server(locally work fine): error o.s.test.context.testcontextmanager - caught exception while allowing testexecutionlistener [org.springframework.boot.test.autoconfigure.autoconfigurereporttestexecutionlistener@3b0090a4] prepare test instance [com.example.api.controller.v1.index.indexcontrollertest@3af9c5b7] java.lang.illegalstateexception: failed load applicationcontext @ org.springframework.test.context.cache.defaultcacheawarecontextloaderdelegate.loadcontext(defaultcacheawarecontextloaderdelegate.java:124) @ org.springframework.test.context.support.defaulttestcontext.getapplicationcontext(defaulttestcontext.java:83) @ org.springframework.boot.test.autoconfigure.autoconfigurereporttestexecutionlistener.preparetestinstance(autoconfigurereporttestexecutionlistener.java:49) @ org.springframework.test.context.testcontextmanager.preparetestinstance(testcontextmanage

java - How to set the javac compiler flags to generate 1.7 bytecode? -

i trying follow instructions on this page install google app engine on ubuntu 16.04. i stuck on third point in 'installing on linux' is: the app engine java sdk requires java 7 bytecode level. can use either java 7 or java 8; sure set javac compiler flags generate 1.7 bytecode: -source 1.7 -target 1.7 what have tried is: javac -source 1.7 -target 1.7 but gives me error javac: no source files use -help list of possible options the command given below give same error javac -source 1.7 however javac -target 1.7 gives following error javac: target release 1.7 conflicts default source release 1.8 any advice on how tackle problem highly appreciated. further information: javac -version gives javac 1.8.0_92 output. java -version gives output: java version "1.8.0_92" java(tm) se runtime environment (build 1.8.0_92-b14) java hotspot(tm) 64-bit server vm (build 25.92-b14, mixed mode) you use -source

sql server - Keyboard shortcut to switch to result tab in SSMS -

does know if there shortcut switch tabs (editot,result, messages) in sql management studio? in configuration have enalbled option "disply result in separate tab" please use f6 toggle between different tabs of ssms. thanks, sree

dependencies - Abaqus strain depedent damping and stiffness -

i want model equivalent linear soil meterial in abaqus, has strain dependent stiffness , damping. damping due stead state analysis, better of type structural. how can implement dependency of stiffness , damping on strain? with umat? with dependencies? (but suppose not solution dependent) other suggestions? however, not know if although implemented if can run steady state analysis. if has example of soultion dependent material properties great help. i posting answer external link: http://www-h.eng.cam.ac.uk/help/programs/fe/abaqus/faq68/abaqusf11.html *"in material properties under keyword *material elastic specify range of values of e , corresponding shear strain values in ascending order. here use deviatoric shear strain values field variable 1. *material, name=sheardepend elastic, dependencies=1 1.2e5, 0.3, , 0.0001 1.5e5, 0.3, , 0.0010 2.0e5, 0.3, , 0.002 dependencies parameter specifies how many field variables being used. example 1. note om

python - Applying datetime format in pandas for sorting -

in pandas, have column dates of format: %y/%m/%d (e.g. 2015/10/31). want change format like: %d-%m-%y (e.g. 31-10-15). turning column correct object later sorting: df['date'] = pd.to_datetime(df['date']) applying strptime: df['date'] = df['date'].apply(lambda x: datetime.strptime(x,'%d-%m-%y')) typeerror: must str, not timestamp also, oddly, if dates enter pandas dataframe in other default iso standard weird results occur on sorting. such inconsistent formats and/or not sorting: 0 2015-01-31 1 2016-15-01 because dealing datetime object already, getting error because strptime requires string , not timestamp object. definition of strptime : def strptime(cls, date_string, format): 'string, format -> new datetime parsed string (like time.strptime()).' what looking first convert datetime format require in string using strftime : def strftime(self, format): """return stri

Algolia: What happens if I import records, that have different properties, into an index? -

for example, if send recordone property "color" property "price". second record in set, recordtwo, has property "price" not property "color". what happens both records indexed :) indices schemaless, have no obligation push records identical attributes same index. it have consequences though, depending on index configuration. if index attributestoindex parameter includes color attribute, recordone record searchable using attribute, whereas recordtwo record won't. the engine ignore missing attributes on objects , use what's available. let's have index containing 2 objects: [{ "objectid": "recordone", "name": "colorful object", "color": "green", "price": 19.99 }, { "objectid": "recordtwo", "name": "colorless object", "price": 25 }] with attributestoindex = ['name', 

Cross Domain ajax OPTIONS error 403 (Django) -

i'm developing site aaa.com django, sends cross-domain ajax "get" requests receive json data bbb.com running on django , using rest framework. @ point works pretty fine adding crossdomain: true; withcredentials:true . , of course configurated on server-side of aaa.com. ...-allow-credentials: true; ...-allow-origin: bbb.com the main issue comes when aaa.com trying make put post delete ajax requests. according cors documentation: [ https://www.w3.org/tr/cors/#cross-origin-request-with-preflight-0] , client side ajax request correct, and ...-allow-headers, ...-allow-methods matched with ...-request-headers, ...-request-methods so request not 'simple' , first of browser sends preflight request aaa.com bbb.com ask if custom headers , methods allowed. everything ok i'm still getting 403 error. here request/response: general: request url:http://bbb.com/api/someapipage/ request method:options status code:403 forbidden remote address:some ip:80 res

java - open the object in JSON package -

i ran problem can not have way solve. hope understand me better. code guidefragment.java package ru.yktdevelopers.childrensofasia; import android.os.bundle; import android.support.annotation.nullable; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.listview; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import java.util.arraylist; import ru.yktdevelopers.childrensofasia.download_data.download_complete; public class guidefragment extends fragment implements download_complete { public listview list; public arraylist<countries> countries = new arraylist<countries>(); public listadapter adapter; @nullable @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.guide_fragment, null); list = (l

regex - JavaScript - A simple character count according to Twitter rules -

i had implement remaining character count functionality (according twitter rules ). can point me js library/function can use directly? twitter provide twitter text javascript library - contains official character count. twttr.txt.gettweetlength() function need.

mysql - SQLite and STRFTIME -

in sqlite database, have time field minutes, seconds, , centiseconds: 00:01:100 i want select row max value in milliseconds , fount strftime function. i'm trying with: select max(strftime("%m:%s:%sss", field)) table; but doesn't works. because isn't in list of allowed formats, have first edit it's supported. then run strftime function select max(strftime("%h:%m:%f", "00:" || substr(field,1,3) || replace(':','.',substr(field,4)))) table; this should not work edit so, update. why doesn't work: strftime useful when have time in format , want convert format. you have item in non-supported format. ( list of formats here ). so, have saved in default text format. so, need write query takes text converts correct format , compares it. kind of have write own maximization function, convert text max function can handle. this done combination of substrings , casting. i've done in

java - Error using HtmlUnit 2.18 for crawl webpages -

i have following code: webclient webclient = new webclient(browserversion.getdefault()); htmlpage page; list<htmlanchor> anchor=new arraylist<htmlanchor>(); try { system.out.println("querying"); page = webclient.getpage("https://www.amazon.com/gp/goldbox"); anchor = page.getanchors(); for(htmlanchor s:anchor) { system.out.println(s.getattribute("href")); } system.out.println("success"); } querying exception in thread "main" java.lang.nosuchfielderror: instance @ org.apache.http.impl.io.defaulthttprequestwriterfactory.<init>(defaulthttprequestwriterfactory.java:52) @ org.apache.http.impl.io.defaulthttprequestwriterfactory.<init>(defaulthttprequestwriterfactory.java:56) @ org.apache.http.impl.io.defaulthttprequestwriterfactory.<clinit>(defaulthttprequestwriterfactory.java:46) @ org.apache.http.impl.conn.managedhttpclientconnectionfactory.<init>

Shell Script to modify a text file for SQL usage -

i have text file process. sample input: 'edmonton event', '2013-11-16-14.00.00', 'ww', 'ww', 'keeper' 'edmonton event', '2013-11-16-14.00.00', 'ww', 'aw', 'seeker' 'edmonton event', '2013-11-16-14.00.00', 'ww', 'iw', 'left beater' 'edmonton event', '2013-11-16-14.00.00', 'ww', 'sw', 'right beater' can tell me how add { ....... }, @ both ends of each line using shell script? sample output: {'edmonton event', '2013-11-16-14.00.00', 'ww', 'ww', 'keeper'}, {'edmonton event', '2013-11-16-14.00.00', 'ww', 'aw', 'seeker'}, {'edmonton event', '2013-11-16-14.00.00', 'ww', 'iw', 'left beater'}, {'edmonton event', '2013-11-16-14.00.00', '

how does wireshark identify DNS traffic when it also uses a Radius port in UDP port? And how can I tell? -

my program doing packet analysis. have problem around dns/radius. dns uses udp port 53 radius uses udp port 1645/1646/1812/1813 logic if see 53 dns packet; if see 1812... radius packets. problem comes, dns packets use radius ports e.g. udp port src 53/dst 1812 or vice verse. program cannot handle this. but wireshark doesn't confused, wondering how capable of knowing true protocol. attempt decode payload? , tell? or underline libpcap or has ability tell true protocol type. if take use code libpcap, libpcap provide functionality of telling carrying protocols? can please help? googled while got no results yet. thanks kang wireshark uses various techniques identify protocols. dns , radius, based on port number. code looks numerically lower port number first and, if doesn't find dissector port number, looks numerically higher port number, packet going between ports 53 , 1812 identified dns rather radius because 53, port dns, numerically lower 1812, port radiu

r - Use a small amount of C++-level code from another package -

there r package defines handy functions extracting files zip archives std::string in c++. i'd use functions in own packages, can't link them because header not in inst/include directory of original package. my question based on understanding c++-level code isn't available outside package unless header in inst/include . to use code, options are: ask package maintainer move c++ header file inst/include directory can call package linkingto in description file. copy , acknowledge code, means propagating gpl-3 licence own package. copy , pointlessly alter code evade copyright. copy code, 20 lines, don't alter it, don't acknowledge it, , don't propagate gpl-3 licence. create separate, tiny package makes code want available in inst/include , acknowledges original author, , propogates gpl-3 licence (but not actual package, includes it). are there other options? have misunderstood writing r extensions or rcpp ? clarification : not @ condone o

swift - What is this Override error and how do I fix it? -

this question has answer here: overriding method selector 'touchesbegan:withevent:' has incompatible type '(nsset, uievent) -> ()' 7 answers i making ios game moving character , rotating weapon, worked took month break , ios got update 9. code no longer works , gives me error. error , more importantly how go fixing it? override func touchesmoved(touches: set<nsobject>, withevent event: uievent) { touch in (touches as! set<uitouch>) { let location = touch.locationinnode(self) if (leftbutton.containspoint(location)){ leftpressed = true }else{ leftpressed = false } if (rightbutton.containspoint(location)){ rightpressed = true }else{ rightpressed = false } } } that 1 of code snippets gets error. here error: method not overrid

PHP Symfony Silex, response is not sent before finish() -

what i'm trying this: user makes api call, give response, , start doing actions take long such sending emails. (emails take long because i'm using smtp, swiftmailer in synchronous way.) according documentation finish() should called after response has been sent. when test however, seems not case. client side stays waiting until finish() done. server side code: $app = new silex\application(); $app->get('/hello', function (request $r) use($app) { return $app->json("i should load within few milliseconds."); }); $app->finish(function() use () { //pretend slow action afterwards sleep(5); }); $app->run(); now if load page http://localhost/hello take 5 seconds load. while expectation load instantaneous. misunderstanding documentation? update: technically accepted answer did asked it. practically found different solution: i looking way emails sent in way end-user wouldn't have wait it. purposes switched on using sw

Convert Sage List of list of list to R list of list of list -

i have sage list of list of list result of function applied on r list of list of list (converted sage format) the code goes this: %r my_r_list<-load("my_r_list.rdata") d in range(d): s in range(s): c in range(c): my_sage_list[d][s][c] = ("my_r_list")[[d+1]][[s+1]][[c+1]]._sage_() output_my_sage_list[d][s][c] = some_function(my_sage_list[d][s][c]) i convert output_my_sage_list r list save .rdata file documentation on interface sage r going r sage not other way around. this question concerns converting sagemath matrix r matrix using r.matrix()' tried using 'r.list()' no luck. tried simple output_my_r_list = r(output_my_sage_list) which gives no error output not correct doing output_my_r_list[0][0]` doesn't give last level of list directly values. a reproducible code (bypassing r sage part) be: output_d = [[] _ in range(9)] d in range(9): output_s = [[] _ in range(4)] out

regex - How to distinguish UPS Mail Innovations from USPS tracking number -

i'm struggling identify shipping carrier tracking number provided, if ups mail innovations number. i"m writing small c# library complete task , best resource i've ever found ruby based 1 called tracking_number , not handle ups mi. gets decoded usps according possible validations i've tried. example, tracking number "92748999955488513006484872" decoded usps, while ups mi number (it tracked via ups mi site www.ups-mi.net ). question: rules distinguish ups mail innovations usps tracking number? according united parcel service (ups) customer support, ups mail innovation tracking numbers same format usps tracking number , can't distinguished. once package arrives usps tracked there.

How to defind data member in c# wcf -

i have made data member this public class logon { [datamember] public string username { get; set; } [datamember] public string password { get; set; } [datamember] public templatestatusinfo status; } public class templatestatusinfo { [datamember] one; two; } when call service need thing this oop.client oclient = new oop.client(); oclient.status = oop.templatestatusinfo.one; //or oclient.status = oop.templatestatusinfo.two; change templatestatusinfo class enumeration. [datacontract] public enum templatestatusinfo { [enummember] one; [enummember] two; }

MarkLogic: how to search for an XPath using cts:uris -

is possible search uri document contains xpath using cts:uris() ? thought may quicker returning uris cts:search . here have currently: declare function local:xpath-search($collection) { $i in cts:search(//a/b, cts:and-query((cts:collection-query($collection)) ))[1] return fn:base-uri($i) } ; is there quicker way return documents contain match xpath //a/b , using cts:uris() ? you can use cts:element-query() construct cts:query functions similar xpath expression //a/b searching documents have a elements have b element descendants. isn't same, , might give false positives, because more akin //a//b , might acceptable , can used cts:uris() . xquery version "1.0-ml"; declare function local:xpath-search($collection) { cts:uris("", (), cts:and-query(( cts:collection-query($collection), cts:element-query(xs:qname("a"), cts:element-query(xs:qname("b"), cts:and-query(()) ) ) )) ) };

node.js - How to exclude library files from browserify bundle -

i want avoid cluttering distribution bundle library files , use separate script tags them in html. one way this... m1.js module.exports = "first module"; m2.js module.exports = "second module"; cnd-m1.js var m1 = "first module"; main.js var m1 = this.m1 || require("./src/m1"); var m2 = require("./src/m2"); console.log(m1); console.log(m2); index.html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>browserify test</title> </head> <body> <script type="text/javascript" src="src/cdn-m1.js"></script> <script type="text/javascript" src="dist/bundle.js"></script> </body> </html> where cdn-m1.js library example. the way figure out make work put short-circuit fallback in require statement , --ignore file in build. in package.json