Posts

Showing posts from 2010

matrix - Matrices in R Programming -

i new r programming , have few questions regarding matrices in r. i have function returns matrix. want check if returned matrix empty or not. how check in r? if integer can check is.null(someinteger) . how check same in case of matrices? also, integer can initialized x <- null . if have want initialize matrix. initialize mat <- matrix() or there other way? mat can of size. thankyou. there question of meant "empty" here test if matrix m has 0 length: length(m) == 0 regarding initializing matrix initializes 0x0 matrix: m <- matrix(, 0, 0) and initalizes 1x1 matrix containing na: m <- matrix() and initializes nr nc matrix of na values: m <- matrix(, nr, nc) not clear whether of these useful. may want describe trying accomplish. why need initialize @ all?

php - Access a specific value from Multidimensional array -

i have multidimensional array , want access specific value without doing loop.. possible? here's array: array ( [0] => stdclass object ( [akeebasubs_user_id] => 205 [user_id] => 268 [isbusiness] => 0 [businessname] => sci555 [occupation] => [vatnumber] => [viesregistered] => 0 [taxauthority] => [address1] => ma. cristina st. [address2] => negros oriental [city] => dumaguete [state] => ia [zip] => 6200 [country] => bs [params] => {"work_telephone":"232424","hospital_company":"sci5","company_introductory":"test","organization_type":"","applicant_url":"www","user_title":"","year_established":"","parent_company":"","r_01":"",...

java - How to format the given time string and convert to date/time object -

i getting time object in form of string rest service . need extract time , time operation.the given time string "2015-06-16t14:58:48z". tried below code , convert string time , , getting incorrect values. string time = "2015-06-16t14:58:48z"; simpledateformat formatter = new simpledateformat("yyyy-mm-dd't'hh:mm:ss'z'", locale.us); string dateinstring = "2015-06-16t14:58:48z"; date date = formatter.parse(dateinstring); system.out.println("original string : " + time); system.out.println("after converting time : " + formatter.format(date)); the output getting below: original string : 2015-06-16t14:58:48z after converting time : 2015-12-362t02:58:48z the converted date somehow getting wrong value.please suggest mistake.thanks. you format string has couple of mistakes: y means week year , not year , y d means day of year . should have used d , means day of month . ...

Nix and Haskell-ng install error : attribute ‘nixpkgs’ in selection path ‘nixpkgs.haskellEnv’ not found -

i following this guide set nix , haskell-ng. when step nix-env -ia nixpkgs.haskellenv then error: error: attribute ‘nixpkgs’ in selection path ‘nixpkgs.haskellenv’ not found any idea going wrong? the command nix-env -f "<nixpkgs>" -ia haskellenv should work. citing http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure : attribute paths deterministic inside of nixpkgs, path necessary reach nixpkgs varies system system. dodged problem giving nix-env explicit -f "<nixpkgs>" parameter, if call nix-env without flag, chances invocation fails: $ nix-env -ia haskellpackages.cabal-install error: attribute ‘haskellpackages’ in selection path ‘haskellpackages.cabal-install’ not found on nixos, example, nixpkgs not exist in top-level namespace default. figure out proper attribute path, it's easiest query path of well-known nixpkgs package, i.e.: $ nix-env -qap coreutils n...

Simple scripting language for embing in program? -

i provide simple scripting interface program i'm working on. program expose functions called script. don't need much, maybe variables, if/else, , loops. 2 popular languages seem lua, , python. not lua days of writing world of warcraft plugins , both seem lot more complicated need. other languages available? try ring programming language ( http://ring-lang.net ) the compiler + virtual machine 15,000 lines of c code the ring can embedded in c/c++ projects, extended using c/c++ code and/or used standalone language. the language simple, trying natural, encourage organization , comes transparent implementation. comes compact syntax , group of features enable programmer create natural interfaces , declarative domain-specific languages in fraction of time. small, fast , comes smart garbage collector puts memory under programmer control. supports many programming paradigms, comes useful , practical libraries. language designed productivity , developing high quality s...

linux - binutils-2.20 install failed -

i trying install binutils in mac. configure works: sudo ./configure --target=i386-elf --disable-nls --disable-werror but make command gives me fatal error: i386-dis.c:6671:21: fatal error: bracket nesting level exceeded maximum of 256 { prefix_table (prefix_vex_3832) }, any idea can me out?

R-Project Barplot Colors -

Image
i new r, , trying create simple barplot. have been able create barplot correct values, single color bars. if change code ( using table() instead of as.table() ), wrong values, correct colors on graph. how can as.table() accept multiple colors in graph? here altered version of code: a=30 b=20 c=10 d=15 x=matrix(c(a,b,c,d),ncol=4,byrow=true) colnames(x)=c("label1","label2","label3","label4") rownames(x)=c("percentage") x=as.table(x) color=c("red","blue","green","orange") barplot(x,main="x",ylab="percent",cex.names=0.75,col=color) passing in vector instead of table should trick: barplot(x[1, ], main="x", ylab="percent", cex.names=0.75, col=color) or barplot(x["percentage", ], main="x",ylab="percent",cex.names=0.75, col=color)

google maps - Dynamically searching for a location -

i developing java web application. in application (jsp pages), in search bar (searching location), when user types few letters, must able see related places dynamically. can please tell me, api's can used implement this. thanks, jitty

jquery - Get video duration with YouTube Data API? -

basically, i'm trying video duration of each video shows in results when search. have neat little demo set mess with! also - when duration mean length of video in m/s format (0:00).. demo http://codepen.io/mistkaes/pen/6b6a347c7d24edee15b3491420db4ecd jquery: var apikey = '<api key>'; $(function() { var searchfield = $('#search-input'); $('#search-form').submit(function(e) { e.preventdefault(); }); }); function search() { $('#results').html(''); q = $('#search-input').val(); $.get( "https://www.googleapis.com/youtube/v3/search", { part: 'snippet, id', q: q, maxresults: 50, type: 'video', key: apikey }, function(data) { $.each(data.items, function(i, item) { var output = getresults(item); $('#results').append(output); ...

ios - Obj-C can't parse HTML -

i parsing html, , keep getting node nil, when know not , have evaluated same xpath string in both safari , chrome , takes me want here code. in viewdidload self.url = @"https://rpi.sodexomyway.com/dining-choices/res/index.html"; [self getmenuitems:self.url]; in getmenuitems: //i data async nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring:url]]; [nsurlconnection sendasynchronousrequest:request queue:[nsoperationqueue mainqueue] completionhandler:^(nsurlresponse *response, nsdata *data, nserror *connectionerror) { [self getdata:data]; }]; in getdata: tfhpple *parser = [tfhpple hpplewithhtmldata:factdata]; nsstring *planstring = @"/html[@class='cufon-active cufon-ready']/body/div[@id='main-content']/div[@id='subs-container']/div[@class='main-corners']/div[@class='column-66 float-left']/div[@class='pane-accord']/div[@id='hideinse']/div[@id='accordion_23471']/div[@i...

html - Javascript Counters Not Working -

going through rounds making simple rock paper scissors game in javascript. game functions correctly, none of counters working. want count number of wins/losses/ties , count down 10 amount of rounds played (i'll add loop later ends game when counter reaches zero). i've moved these counters in , out of functions, moved them around in if/else statements , i'm @ point need tell me put them or do, because nothing seems working. the code messy, know , i'm sorry, made mistake of tweaking , retweaking , moving things around , not saving original. know have counters in multiple places, can't them work no matter put them though, left them in both functions now. if me counters working (or @ least 1 of them , explain i'm doing wrong rest) appreciate it. thanks! here jsfiddle: http://jsfiddle.net/nbxk4ofo/1/ (thanks tip!) here's relevant code: html <div id="gamescreen"> <img src="image/logo.png" /> <br /> ...

javascript - gulp watch only runs twice -

i'm in process of switching grunt gulp. working find under grunt (mentioning in case helps). with gulpfile below test task (mocha) run when file changes, works twice. if change file, task run, successive changes same file don't trigger run. in other words: touch file a, task runs touch file again, task runs touch file again, task doesn't run touch file b, task runs touch file b again, task doesn't run the test passes , output see gulp start/stop (i.e. i'm not seeing errors break watch) osx 10.10.3 / gulp 3.9.0 my gulpfile: 'use strict'; var gulp = require('gulp'); var mocha = require('gulp-mocha'); gulp.task('test', function() { gulp.src('test/unit/**/*.js') .pipe(mocha()); }); gulp.task('watch', function() { gulp.watch('lib/**/*.js', ['test']); }); it's weird , don't know why same thing happened me , started working once started watching tes...

c++ - CMake/Ninja attempting to compile deleted `.cpp` file -

i've found when delete cpp files project using cmake , ninja , can't compile without first deleting build directory , starting scratch. cmake and/or ninja apparently squirrels away number of references cpp files compiles, deleting cmake cache before re-running cmake doesn't remove references. is known issue? there solution? i've run rm $(grep -r <filename> <builddir>) , that's terrible kludge. edit: appears mistaken, have not been able duplicate problem. manually re-running cmake appears always generate correct list of .cpp files, using glob generate lists of sources. turning comments answer collecting source files file(glob ...) yes, cmake won't know new or deleted source files when collecting source files file(glob ...) command. known restriction cmake. i've changed cmake project(s) list source files individually because of this. out of convenience i'm still collecting header files file(glob ...) command. quo...

android - Drawer Layout Will not preview. What's wrong? -

Image
i have browsed through questions , have tried absolutely find. have tried adding dependency v4, v7, v13 graddle copied v4 , v13 jars libs folder tried switch compiled skd version, min sdk version, , target sdk version i cannot drawer layout preview. app works fine when installed on device , emulator. getting frustrated tweeking layout , having launch way device check how layout looks. can figure 1 out? <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> set minsdkversion 14, change 17 (in build.gradle) , renders correctly

How to write regex for this javascript string -

how write string below "(22.0796251, 82.13914120000004),36", "(22.744108, 77.73696700000005),48",...and on like this: (22.0796251, 82.13914120000004) 36 (22.744108, 77.73696700000005) 48 ...and on.................. .. how using regex in javscript ? my try this: substring = test.split(','); where test contains data formatted. wrong you should use ability of split split on regular expressions , keep them in results . this, put capturing group in regexp. in case, "split" on things in double quote marks: pieces = test.split(/(".*?")/) ^^^^^^^ capture group // ["", ""(22.0796251, 82.13914120000004),36"", ", ", ""(22.744108, 77.73696700000005),48"", ""] the question mark make sure doesn't eat characters through last quote in input. makes * quantifier "non-greedy". now rid of junk (empty ...

php - WooCommerce Dynamic Surchage based on radio button in checkout -

how radio button group update surchage listed in checkout total on woocommerce checkout page when 1 selected, other. selection of radio button needs add 0.05 percent surcharge as, radio button b add 0.10 percent. i know can add static surcharge following: add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' ); function woocommerce_custom_surcharge() { global $woocommerce; if ( is_admin() && ! defined( 'doing_ajax' ) ) return; // $percentage change based on button selected or b // not executed after page loaded $percentage = 0.05; $surcharge = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total ) * $percentage; $woocommerce->cart->add_fee( 'service fee', $surcharge, true, 'standard' ); } maybe started. don't think automatically add fee, haven't tested , idea: jquery(document).ready(function($){ if ( typeof wc_checkout_form === ...

java - Android studio project is messed up due to moving files around -

Image
i tried create new packages organize java folder moved them out of new package. having issues. mainactivity not being recognized in androidmanifest.xml the files green colored? how can restore files working condition, suggestions? try doing gradle sync in tools>android. otherwise, copy activities before moved them. move them using refactor menu (right-click on java class, go refactor submenu , hit move).

ios - How to implement a class in Swift to create a global user for application? -

i'm making application has 1 mainuser class should accessible throughout application. example, mainuser class has variable fullname contains string full name of user. want able access variable on other scene of application maybe things like, "welcome fullname !" how should go doing this? right now, making object of mainuser class in launch screen of application, , planning pass object along every following screen. doesn't seem efficient in mind, i'm wondering if there global method (although searched , found global variables rather unstable , unpopular.) application have 1 user, there 1 object ever created entire extent of app. any ideas? i have lot of experience object-oriented programming in java but, can tell question, i've grown rusty because i've been pretty inactive more year. am not in swift hence posting code objective c. think can translate that. here main user class contains properties. the .h file here #import <foun...

user interface - Python: Tkinter Entry widget is not working -

from tkinter import * root = tk() ticker1 = stringvar() ticker2 = stringvar() root.title("choose companies") label(root, text = "company no. 1", fg = "black", font ="helvetica 16 italic").pack() name = entry(root,name = ticker1 ).pack() label(root, text = "company no. 2", fg = "black", font ="helvetica 16 italic").pack() name1 = entry(root,name1 = ticker2).pack() root.mainloop() the code not work gives me error: exceptions.typeerror: cannot concatenate 'str' , 'instance' objects the format entry widget in python gui looks correct. i'm using python 2.7 windows 8.1 the entry class constructor has no keyword parameter named name1 , can pass stringvar instance textvariable keyword parameter , retrieve text calling get() method on stringvar instance. alternately, can call get() method on entry instance itsel...

jquery - Update Rails Variable in ERB using Ajax -

i have dropdown menu of patients. when user selects patient dropdown menu, want use jquery patient's id, make ajax call server return patient variable can use in view. dropdown: <%= f.select :patient_id, content_tag(:option,'select patient...',:value=>"")+content_tag(:option,'new patient',:value=>"")+options_from_collection_for_select(@patients, 'id', 'full_name'), :class=>"form-control" %> js: $('#assessment_patient_id').change(function(){ var e = document.getelementbyid("assessment_patient_id"); var patient_id = (e.options[e.selectedindex].value) if (patient_id == 0) { window.location.href = "/patients/new" } else { $.ajax({ type: "post", url: "get-patient", data: {patient_id: patient_id}, success: function(data){ console.log(data) }, error: function(err){ console.log(err); } }); } contr...

c++ - Temporary variable destroyed with overloaded + and += operator -

i getting segfault because believe temporary variable being destroyed (freeing allocated memory) before operators done using it. code in main: int main(int argc, char *argv[]) { bcd b1 = bcd(100), b2 = bcd(20), b3 = bcd(50); b3 += b1 + b2; return 0; } i put print statement in destructor , output follows: sum destroying 120 sum segmentation fault i don't understand why occur. appears temporary variable b1+b2 being destroyed before can used second time sum. shouldn't temporary variable b1+b2 valid until end of line in main? did implement operator overloading functions incorrectly or there other problem code not considering? my custom class defined follows: class bcd { public: bcd(); bcd(const char* num); bcd(const bcd &num); bcd(const int num); ~bcd(); int getlength() const; bcd& operator=(const bcd &rhs); bcd& operator+=(const bcd &rhs); const bcd& operator +(const bcd &rhs) const; std::string tostring() cons...

jboss - How To find a WebSocket from a REST bean -

i have javascript client connects server via websockets , sends data via ajax server. once server finished processing data, want send message via websocket client. problem is: how find websocket rest bean (hopefully in same session...) a websocket connection starts http handshake. on handshake receive cookies (e.g. session id cookie) access http session. from jsr 356 java api websocket spec: because websocket connections initiated http request, there association between httpsession under client operating , websockets established within httpsession. api allows access in opening handshake unique httpsession corresponding same client. that's point associate http session websocket connection in whatever way find fit.

winapi - How to use JNA PostMessage in Java 8 -

the following code worked in older java versions, seems have quit working in java 8. know why happened, , how fix it? public static string notifyexternalapplication() { stringbuffer buf = new stringbuffer(""); try { user32.hwnd fusionmsg = user32.instance.findwindow("tfusionhdtvtray","hdtv tray"); int wmuserplusoffset = 0x400 + 5014; user32.wparam 2 = new user32.wparam(2l); user32.lparam 0 = new user32.lparam(0l); boolean fusresult = user32.instance.postmessage(fusionmsg, wmuserplusoffset, two, zero); buf.append(" fusresult " + fusresult + "\n"); } catch (runtimeexception e) { e.printstacktrace(); buf.append(" " + e.getmessage()); } return new string(buf); } edit: when code runs in os's, returns " fusresult true". it's in newer java version, seems have no effect. edit2: research done - ran same code on same syst...

Whole Oracle database in memory -

suppose have oracle database data files 256 gb in size. idea use server with, say, 384 gb ram in order host entire database in ram? is there difference if have, say, 128 gb ram? i'm talking caching , oracle inner workings, not memory based filesystem. suppose oltp, , 100 gb working set. regards, use views v$sga_target_advice , v$pga_target_advice predict performance improvement of additional memory. oracle records many statistics physical (disk) , logical (total) i/o requests. people used obsess on buffer cache hit ratio . can helpful number doesn't tell whole story. if ratio 99% cache sufficient , adding more memory won't help. if it's low might benefit more memory, or perhaps processes use disk aren't time critical. be careful before request more memory. i've seen lot of memory wasted because people assume more memory solve everything. oracle has many i/o features reduce memory requirements. "in-memory database" fad h...

javascript - XSL stylesheet active content being blocked by browser -

hi have xsl stylesheet using transform xml document see so question transform works beautifully, treeview expands , collapses when user clicks on nodes advertised. on of client machines i've run on has active content disabled (ie8/9), message being ie has restricted file showing active content... it's easy enough click allow blocked content... on machines in question cannot (absolutely) must not done. it's verboten. can't go changing browser settings question how can around without changing browser settings. can transform on "server side" using lxml transform xml like import lxml.etree et dom = et.parse(xml_filename) xslt = et.parse(xsl_filename) transform = et.xslt(xslt) newdom = transform(dom) print(et.tostring(newdom, pretty_print=true)) will allow resulting xml shown on client machine remain dynamic? need fire little python webserver? suggestions welcome my question how can around without changing browser settings. use...

java - SetLayout Function main purpose -

public void init_numsolvers() { (x = 0; x < 9; x++) { n++; num[x] = new button("" + n); add(num[x]); num[x].setbounds(num_x, num_y, 40, 40); setlayout(null); num_x += 40; } why setbounds() function doesn't work without setlayout(null) want understand main purpose of setlayout(null) function you want read tutorials , api spell out setbounds , setlayout does, briefly: the setlayout(...) method allows set layout of container, jpanel, flowlayout, borderlayout, gridlayout, null layout, or whatever layout desired. layout manager helps lay out components held container. the setbounds(...) method used set location , size of single component, , useful if null layout used container holds component. when set layout null, tell container using no layout @ all, , programmer responsible setting sizes , positions of components added container. having said this, should strive avoid using null layouts , se...

javascript - Pass in isolated scope object into angular custom directive template? -

i'm having trouble figuring out how use object in angular template in custom directive. here's plunker explain kind of trouble i'm having. after fiddling around came conclusion need use scope: {address: '='} in order pass in object directive's template instead of scope: {street: '@'} used street value. throwing parsing error, , not displaying address's country correctly. can explain i'm doing wrong here? i've looked @ dozens of examples can't quite figure out how fix it. here's simple working example of i'm trying achieve reason can't replicate this remove double braces around object. <address-b address="user.address"></address-b>

Clojure core.typed annotation for apply inside a 3rd-party macro -

i'm using slingshot's throw+ macro raise exception looks like: (throw+ {:type ::urlparse}) the type checker doesn't it: type error (stream2es/http.clj:79:17) bad arguments apply: target: [string t/any * -> string] arguments: (persistentlist string) in: (clojure.core/apply clojure.core/format (clojure.core/list "throw+: %s" (clojure.core/pr-str %))) type checker: found 1 error the macro in slingshot looks like: (defmacro throw+ ([object] `(throw+ ~object "throw+: %s" (pr-str ~'%))) ([object message] `(throw+ ~object "%s" ~message)) ([object fmt arg & args] `(let [environment# (s/environment) ~'% ~object message# (apply format (list ~fmt ~arg ~@args)) stack-trace# (s/stack-trace)] (s/throw-context ~'% message# stack-trace# environment#))) ([] `(s/rethrow))) i've tried various ann ^:no-check forms on apply , format , none...

osx - Building a cross compile of binutils on OS X Yosemite -

i'm trying build binutils generating mips code on mac os x. i found site ( http://www.theairportwiki.com/index.php/building_a_cross_compile_of_gcc_for_mips_on_os_x ) how build gcc 4.8.x on mac os x host mips target , , followed instructions. i install gcc-4.8 brew, , installed source code of binutils , gcc. compilation option setup. $ export cc=/usr/local/bin/gcc-4.8 $ export cxx=/usr/local/bin/g++-4.8 $ export cpp=/usr/local/bin/cpp-4.8 $ export ld=/usr/local/bin/gcc-4.8 $ export prefix=/opt/cross/gcc-mips $ export cflags=-wno-error=deprecated-declarations then configure, , make bintuils. the issue after building static libraries have error message archive not built x86_64 , , have bunch of undefined symbol error. ignoring file ./../intl/libintl.a, file built archive not architecture being linked (x86_64): ./../intl/libintl.a undefined symbols architecture x86_64: "__bfd_abort", referenced from: _fix_new_internal in write.o _size_seg in wr...

c# - MOQ object setup scope / context being lost with builder pattern unit test and web api controller -

i writing unit test controllers , running issue seems mocked object not getting setup when inject it. if create mocked object in controller end point works fine. further complicate things doing unit testing via fluent builder pattern. first here working snip: public httpresponsemessage addslot(addslotrequest requestlist) { var errorinfo = new list<errorinfo>(); mock<idatrepository> _xrepository = new mock<idatrepository>(); _xrepository.setup(x => x.getdat(it.isany<guid>(), ref errorinfo)) .returns(new dat()); ....snip.... var crt = _xrepository.object.getdat(datid, ref errorinfo); //crt object returned expected mock ....snip } now heads gets little more involved. first have controller being created builder: public class addslotcontrollerbuilder { //private backing field fluent methods act upon private mock<idatrepository> _xrepository = new mock<idatrepository>(); //exposed property external int...

java - BlueCove with Bluez chucks "Can not open SDP session. [2] No such file or directory" -

i trying write simple bluetooth server accepts connection heartrate-device (bluetooth le) raises exception javax.bluetooth.serviceregistrationexception: can not open sdp session. [2] no such file or directory @ com.intel.bluetooth.bluetoothstackbluez.opensdpsessionimpl(native method) ~[bluecove-gpl-2.1.1-snapshot-63.jar:2.1.1-snapshot] @ com.intel.bluetooth.bluetoothstackbluez.getsdpsession(bluetoothstackbluez.java:518) ~[bluecove-gpl-2.1.1-snapshot-63.jar:2.1.1-snapshot] @ com.intel.bluetooth.bluetoothstackbluez.registersdprecord(bluetoothstackbluez.java:543) ~[bluecove-gpl-2.1.1-snapshot-63.jar:2.1.1-snapshot] @ com.intel.bluetooth.bluetoothstackbluez.rfserveropen(bluetoothstackbluez.java:607) ~[bluecove-gpl-2.1.1-snapshot-63.jar:2.1.1-snapshot] @ com.intel.bluetooth.bluetoothrfcommconnectionnotifier.<init>(bluetoothrfcommconnectionnotifier.java:42) ~[bluecove-2.1.1-snapshot-63.jar:2.1.1-snapshot] @ com.intel.bluetooth.microeditionconnector.openimpl(microeditionconnector....

How do I save an entire string as a txt file in Go? -

i'm creating simple word processing program in go. command line, have 2 prompts: $enter title: $enter body: the program supposed save document txt file , print command line. program works if user user types in one-word title , one-word body. if user types in several-word title, happen: $enter title: here title $enter body: s $ title -bash: title: command not found here code have far: package main import ( "fmt" "io/ioutil" ) //create struct document type document struct { title string body []byte } //save document txt file func (p *document) save() error { filename := p.title + ".txt" return ioutil.writefile(filename, p.body, 0600) } //load document func loadpage(title string) (*document, error) { filename := title + ".txt" body, err := ioutil.readfile(filename) if err != nil { return nil, err } return &document{title: title, body: body}, nil } //input document...

html - CSS doesnt show part of code -

im learning html & css , after few tutorials decided write webpage nothing. i've got problem. when add "display: inline" in css .nav , ignores . nav css properties, including "display: inline" . here's code: html <!doctype html> <html> <head> <link href="main.css" rel="stylesheet"> <title>neni okurka, nebudou caciky</title> </head> <body> <div class="nav"> <ul> <li class="active"><a href="#">navigation 1</a></li> <li><a href="#">navigation 2</a></li> <li><a href="#">navigation 3</a></li> <li><a href="#">navigation 4</a></li> <li><a href="#">navigation 5</a...

stanford nlp - What are dictionary based features in Chinese Word Segmentation in core NLP -

i see dictionary based features in chinese word segmentation in core nlp there no explanation on or signify. traced code see calculated , see in "sighan2005documentreaderandwriter.java" file in function "adddictionaryfeatures". still don't understand details of it. there no comments in code or in file. great if explain going on in function or point me place does.

Get non normalized eigenvectors in scipy -

scipy , numpy returns eigenvectors normalized. trying use vectors physical application , need them not normalized. for example a = np.matrix('-3, 2; -1, 0') w,v = spl.eig(a) scipy returns eigenvalues (w) of [-2,-1] , modal matrix (v) (eigenvalues columns) [[ 0.89442719 0.70710678][ 0.4472136 0.70710678]] i need original modal matrix [[2 1][1 1]] according various related threads (1) (2) (3) , there no such thing "non normalized" eigenvector. indeed, eigenvector v corresponding eigenvalue l of matrix a defined by, a*v = l*v and can therefore multiplied scalar , remain valid. while depending on algorithm, computed eigenvector can have norm different 1, not hold particular meaning (physical or otherwise), , should not relied on. customary return normalized eigenvector in numerical libraries (scipy, r, matlab, etc).

visual studio - Emulate Devenv/Runexit under MSBuild -

i new msbuild , busy automating tests of visual studio solutions. i worked command line of devenv , provides convenient /runexit mode of operation. manual: /runexit (devenv.exe) compiles , runs specified solution, minimizes ide when solution run, , closes ide after solution has finished running. this functionality need. migrating msbuild. have discovered project files in solution can directly used building, default target precisely build. what can handle different target, have same effect /runexit ? can me through maze ? this basic target runs projects' output file: <target name="runtarget"> <exec command="$(targetpath)" /> </target> for c++ unittests use this; it's property sheet it's easy add project without needing manually modify it. automatcially runs output after build there no need specify target , works same vs , command line. in vs you'll unittest errors frameworks unittest++ or catch display...

html - DIV and TEXTAREA elements interpreted 'width' CSS attribute differently? -

was bit confused when next html code <div>some text insize div</div> <textarea>some text insize textarea</textarea> with css div { background-color: #eee; width: 25em; } textarea { width: 25em; } displayed div , textarea different width... reason? jsfiddle example here em s measured based on font-size , each of elements have different font size. div font-size: 16px , textarea font-size: 11px @ least default in chrome. if set elements same font-size same width. remaining difference because textarea has padding , border too. if set css this, elements same size: div { background-color: #eee; width: 25em; font-size: 16px; box-sizing: border-box; } textarea { width: 25em; font-size: 16px; box-sizing: border-box; } because both have same font-size, , widths based on border-box instead of content-box, padding , borders included in width. references: font-size ems (mozilla developer n...

ios - fatal error: Array index out of range with Parse.com -

i have application swift 2 , parse.com. added uisearchcontroller, , when use it, application crash. , shows error "fatal error: array index out of range" . there error in string "if var pffiltered = dataforsearchcontroller?[indexpath.row]" exc_bad_instruction when touch in search bar. override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath, object: pfobject?) -> pftableviewcell? { var searchtext = searchcontroller.searchbar.text let cellindentifier: string = "newscell" var cell: parsetableviewcell? = tableview.dequeuereusablecellwithidentifier(cellindentifier) as? parsetableviewcell if searchcontroller.active == false { if (cell == nil) { cell = parsetableviewcell(style: uitableviewcellstyle.default, reuseidentifier: cellindentifier) } if let pfobject = object { //cell?.textlabel?.text = pfobject["textnews"] as? string ...

vba - Fill Down until Last Empty Row or Next Filled Cell -

i know how code in order fill down column, have few conditions can't find out how implement. i want fill down until last row (that contains value @ all) or next cell within column contains information. the data looks this a 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 b 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 c 1 2 3 4 5 6 7 8 9 10 d 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 e 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 so can see, code needs recognize how stop @ b (and not copy on it) when copying down column. code needs stop @ last row values in when dra...

python - Cannot identify image file ImageFieldFile -

i'm using django python, in models.py declared tournament model , attribute image, save method: import datetime django.db import models django.utils import timezone tinymce.models import htmlfield rules.models import rule news.models import tag, news courts.models import court news.models import replace_spaces datetime import datetime sorl.thumbnail import imagefield, get_thumbnail pil import image django.core.files.storage import default_storage storage django.conf import settings class tournament(models.model): name = models.charfield(max_length=50, default='', verbose_name='nombre') name_url = models.charfield(max_length=200, default='', editable=false) inscription_opening_date = models.datefield('fecha de apertura de inscripcion') inscription_closing_date = models.datefield('fecha de cierre de inscripcion') tournament_starting_date = models.datefield('fecha de inicio del torneo') tournament_ending_da...

regex - Parsing a CSV string while ignoring commas inside the individual columns -

i trying split csv string comma delimiter. val string ="a,b,"hi,there",c,d" i cannot use string.split(",") because split "hi,there" 2 different columns. can use regex solve this? came around scala-csv parser dont want use. hope there better method solve problem.i know not trivial problem. it'll helpful if people can share approaches solve problem. use univocity-parsers csvparser instead of parsing hand. csv harder think , there many corner cases cover. found one. in short, need library read csv reliably. univocity-parsers used other scala projects (e.g. spark-csv) i'll put example using plain java here, because don't know scala, you'll idea: public static void main(string ... args){ csvparsersettings settings = new csvparsersettings(); //many options here, check documentation csvparser parser = new csvparser(settings); string[] row = parser.parseline("a,b,\"hi,there\",c,d");...

android - AppCompat-styled dialog containing a fragment -

i want appcompat-styled dialog - background, title, button position, button tint etc. - containing fragment. with custom dialogfragment oncreatedialog() can return appcompatdialog , in oncreateview() new layout can inflated , childfragmentmanager can used replace placeholder view fragment. resulting dialog otherwise empty box no buttons. can manually added dialog's layout no styling appcompat. the same applies if make target fragment extend dialogfragment . to appcompat buttons can use alertdialog.builder , , use .setview() set layout, can't find way set fragment content. if try childfragmentmanager.begintransaction().replace() oncreatedialog() get: java.lang.illegalstateexception: fragment not have view this seems because, after using builder.setview() or dialog.create() dialog.setview() , oncreateview() , getview() return null. the second answer here seems cover quite comprehensively doesn't suggest favourable solution: https://stackoverflow....

delphi - how to connect to a NIC card or network adapter knowing its IP address? -

say have 2 nic or adapter card on system , found ip address through following code: procedure tform4.retrievelocaladapterinformation(strings: tmemo); var padapterinfo, ptempadapterinfo: pip_adapter_info; adapterinfo: ip_adapter_info; buflen: dword; status: dword; strmac: string; i: integer; begin strings.clear; buflen:= sizeof(adapterinfo); padapterinfo:= @adapterinfo; status:= getadaptersinfo(nil, buflen); padapterinfo:= allocmem(buflen); try status:= getadaptersinfo(padapterinfo, buflen); if (status <> error_success) begin case status of error_not_supported: strings.lines.add('getadaptersinfo not supported operating ' + 'system running on local computer.'); error_no_data: strings.lines.add('no network adapter on local computer.'); else strings.lines.add('getadaptersinfo failed error #' + inttostr(status)); end; dispose(padapterin...

javascript - Updating two stores from one ajax response -

i'm using react js flux architecture , having trouble resolving issue asyncronous request affects more 1 store. have form store , results store. submitting form component sends off action results store (rather dispatcher registers in results store) fires ajax request external api fetches data based on serialized form info (from results store). response populates results store, initializes results component state. works expected. issue comes when there errors in form. if there errors (but still 200 response code) make through api sends me error response object. issue is, i'm in results store, , need these errors form store. following flux kata, action required update form store, doesnt seem right fire action store. flux cycle have going formcomponent --> resultsaction.fetchresults(relaventformdata) --> resultstoredal.fetchresults --> $.ajax.success: if (response.errors){ //update formstore response.errors } formcomponent gets states formstore (which h...