Posts

Showing posts from January, 2010

R: how to plot density plots with ggplot2 -

Image
> dput(data) structure(list(vascular_pathology_m = structure(c(1l, 2l, 3l, 1l, 1l, 2l, 4l, 3l, 1l, 2l, 3l, 2l, 1l, 3l, 2l, 3l, 3l, 3l, 4l, 2l, 2l, 2l, 2l, 2l, 3l, 2l, 1l, 3l, 3l, 3l), .label = c("absent", "mild", "mild/moderate", "moderate/severe", "severe"), class = "factor"), output = c(1.01789418758932, 1.05627630598801, 1.49233946102323, 1.38192374975672, 1.13097652937671, 0.861306979571144, 0.707820561413699, 1.16628243128399, 0.983163398006992, 1.23972603843843, 0.822709564829401, 0.90516107062003, 0.79080293468606, 0.886130998081624, 1.2674953773847, 0.984695292355941, 1.1781360057546, 0.858847379047159, 0.772681010534905, 1.04401349705871, 0.998339856427367, 1.12106301647898, 0.835132782324955, 0.710123766831317, 1.01005735218463, 1.05588470743658, 0.913371462992548, 1.10995126470399, 1.18574975368509, 1.17712141366123)), .names = c("vascular_pathology_m", &q

java - How do i use multiple CXF endpoints to call a webservice in Camel? -

i have 2 endpoints: cxf_first_endpoint="cxf:bean:cxfendpoint?{address=first_address}&serviceclass=com.service.class.first" cxf_second_endpoint="cxf:bean:cxfendpoint?{address=second_address}&serviceclass=com.service.class.second" how implement 2 separate web service call after defining endpoints. if use both, , consume endpoints using routes, 1 of endpoints override other , able use one. if comment other endpoint, running successfully. need use both. using messagecontentlist both web service response: messagecontentslist result = (messagecontentslist) exchange.getin().getbody(); thanks, please let me know if need more information here route-definition: from("direct:paymentinfo").routeid("paymentinfo") .bean(billingserviceprocessor, "processbillingpaymentrequest") .to(cxf_billingservice_endpoint) .bean(billingserviceprocessor, "processbillingpaymentresponse") .end(); from("direct

r - Set width and height of graphic made using ggplot, grid, and gridExtra -

Image
if have graphic composed of several plots, 3 plots arranged vertically. gtable object , can drawn page with: grid::grid.newpage() grid::grid.draw(plot) however see plot in rstudio 'smushed up' in screenshot below: as can see in bottom right corner squashed , titles overlap other elements of graphic. if hit zoom , view plot lot bigger: now know, if export gtable plot using pdf() or png() , such devices, can set width , height, , make big enough such plot not squashed. however, instead of 1 of graphic devices, use export.grid , gridsvg package save svg file. if gridsvg::export.grid(plot) then svg file exported looks squashed in rstudio plot window. question is, how can manipulate dimensions of graphic drawn svg without looking squashed? draw plot grid.newpage , grid.draw , wonder perhaps have specify size of page or drawing using grid. thanks, ben.

java - Android JSoup use site css for extracted div class -

i'm working on app displays 1 div class of webpage. problem is, div class (of course) not using site's css anymore. no want add css displayed div class. how can that? here code displaying "events" div: private class loaddata extends asynctask<void,void,void> { string html=new string(); document doc = null; elements ele = null; @override protected void doinbackground(void... params) { try { doc = jsoup.connect(url).timeout(100000).get(); } catch (ioexception e) { e.printstacktrace(); } elements ele = doc.select("div.events"); html = ele.tostring(); return null; } @override protected void onpostexecute(void result) { super.onpostexecute(result); string mime = "text/html"; string encoding = "utf-8"; mywebview.loaddata(html, mime, encoding); } } you can "style"

android - How to apply one effect over another in GPUImageView? -

i using gpuimageview apply effects on images displayed on gpuimageview, want apply 1 effect on another, applied sepia effect first, on top of that, want apply contrast. how can achieve this? you need create gpuimagefiltergroup object , add filters addfilter() . after can apply resulting filter gpuimageview . example: gpuimageview mimageview; private void applyfilters(float contrast, float brightness) { gpuimagefiltergroup filtergroup = new gpuimagefiltergroup(); filtergroup.addfilter(new gpuimagecontrastfilter(contrast)); filtergroup.addfilter(new gpuimagebrightnessfilter(brightness)); mimageview.setfilter(filtergroup); }

javascript - ng-click with variables in a list -

i have list of items in ionic/angular/phonegap application , i'm trying use action sheet , pass in variables. however, ng-repeater on , don't seem have access variable on same line ng-repeater. markup: <ion-view view-title="my pets"> <ion-content> <div class="list card"> <div class="item item-thumbnail-left item-icon-right" ng-repeat="pet in missing" ng-click="actionsheet({{pet.animalcode}})"> <img ng-src="http://*****.com/getimage.ashx?imgid={{pet.picture}}"> <h2>{{pet.name}}</h2> <p>{{pet.type}} - {{pet.subtype}} </p> <p>{{pet.size}} - {{pet.colour1}}</p> <i class="icon ion-chevron-right"></i> </div> </div> </ion-content> </ion-view> backend: $scope.actionsheet = function(petid) { $log.info(petid);

POSIX Shared memory -

what difference between: shm_open("test") mmap() close() munmap() shm_unlink() and: open("/dev/shm/test") mmap() close() munmap() unlink() the difference see second options not need link -lrt it same thing except shm_open(test) posix standard , needs librt library, , open(/dev/shm/test) not posix standard , not need librt library. performance equal both solution.

java - How do I access a package protected class in Maven build? -

some code returns package protected type trying mock. doing using class.forname , maven throws illegalaccesserror now. here sample: class<?> itemsupportclasss = class.forname("com.amazonaws.services.dynamodbv2.document.internal.iteratorsupport"); iterator<item> mockiterator = (iterator<item>) createmock(itemsupportclasss); expect(mockiterator.hasnext()).andreturn(false); itemcollection<queryoutcome> itemcollection = createmock(itemcollection.class); expect(((iterable<item>) itemcollection).iterator()).andreturn(mockiterator); // , on when itemcollection.iterator() called, following error: java.lang.illegalaccesserror: com/amazonaws/services/dynamodbv2/document/internal/iteratorsupport @ com.amazonaws.services.dynamodbv2.document.itemcollection$$enhancerbycglib$$14504e4e.iterator(<generated>) @ com.mycom.myclass(myclass.java:77) @ com.mycom.myclass(myclass.java:230) @ sun.reflect.nativemethodaccessorimpl.invok

google cloud platform - Trouble Looking For Events WITHIN a Session In BigQuery or WITHIN Multiple Sessions -

i wanted second pair of eyes & confirming best way within session @ hit level in bigquery. have read bigquery developer documentation thoroughly that provides insight on working within session. challenge this . let assume write high level query count number of sessions exist , group sessions device.device category below: select device.devicecategory, count(distinct concat (fullvisitorid, string (visitid)), 10000000) sessions (table_date_range([xxxxxx.ga_sessions_], timestamp('2015-01-01'), timestamp('2015-06-30'))) group each device.devicecategory order sessions desc i run follow query following find number of distinct users (client id's): select device.devicecategory, count(distinct fullvisitorid) users (table_date_range([xxxxxx.ga_sessions_], timestamp('2015-01-01'), timestamp('2015-06-30'))) group each device.devicecategory order users desc (note broke because of sheer size of data working produces runs greater 5tb in cases). m

Difference between Swift is and isKindOfClass()? -

is there difference between following expressions? if someinstance someclass { } if someinstance.iskindofclass(someclass) { } i assume .iskindofclass() instance method cocoa. the right side of is can type or protocol, whereas argument of .iskindofclass() must reference type (i.e. class). can test conformance @objc protocol using .conformstoprotocol() instead of .iskindofclass() in same way. the left side of is expression, whereas receiver of .iskindofclass() must object reference. compiler complain if compile-time class of expression not known support .iskindofclass() , can overcome casting left side anyobject . swift classes support .iskindofclass() @ runtime. the right side of is type must hard-coded @ compile-time. argument of .iskindofclass() can variable or other expression value computed @ runtime.

Regex: word boundaries -

i have search words containing capitalized letters or numbers. i use \b[^ ]*[a-z0-9]+[^ ]*\b , instead of [^ ] use [^\b] , selects phrase... this is some text, has s0me num8ers , like boeing-380 or rna-78 . that is great! you may use \w* matching 0 or more word characters. \w*[a-z0-9-]+\w* or \s*[a-z0-9]+\s* and note can't include \b , \b inside character class. achieve result without including both inside character class through other ways. \s* matches 0 or more non-space characters. demo

javascript - want url validation regex -

when put https://gmail.com in url validation through below exception (exp:sorry! cannot include intended website in web tab, intended website restricts content loading inside website.) i want url validate regex please see gist pretty strong regex explainatory comments https://gist.github.com/dperini/729294 edit: can customize removing strings don't want.

Exhaustive search for algorithms - existing works? -

you might have read twice idea becomes clear. please patient. i'm looking existing work exhausive search algorithms given problems. exhaustive search known brute force search, or brute force. other exhaustive search algorithms search solution given problem. usually, solution such problem data fulfills requirements. exhaustive search example : want solution knapsack problem. objects can packed bag there no other combination of objects fit bag , sum bigger value result combination. can solve going on possible combinations (exhaustive) , search 1 fits bag , valuable 1 of combinations. what i'm looking special case of exhaustive search: exhaustive search searches algorithm solution. in end, i'm looking algorithm searches algorithm solves given problem. you might say: go google it. well, yes i've done that. difficulty i'm facing here googling "algorithm searches algorithm" results in same "another search algorithm". obviously, has many

c++ - How to stop a async evaluating function on timeout? -

say have simple async call want kill/terminate/eliminate on timeout // future::wait_for #include <iostream> // std::cout #include <future> // std::async, std::future #include <chrono> // std::chrono::milliseconds // non-optimized way of checking prime numbers: bool is_prime (int x) { (int i=2; i<x; ++i) if (x%i==0) return false; return true; } int main () { // call function asynchronously: std::future<bool> fut = std::async (is_prime,700020007); // while waiting function set future: std::cout << "checking, please wait"; std::chrono::milliseconds span (100); while (fut.wait_for(span)==std::future_status::timeout) std::cout << '.'; bool x = fut.get(); std::cout << "\n700020007 " << (x?"is":"is not") << " prime.\n"; return 0; } we want kill first timeout happens. cant find method in future. the closest find stop

php - How to change max_input_vars? -

my php version 5.4.16 i have form 2500 fields. sounds weird, have excel sheet. read sheet , display data in html table each cell has hidden field able post data , further. i found how increase maximum post variable in php? need change max_input_vars not find it. issue: need change max_input_vars? unable find in php.ini please help!!! if unable find it, add ;) if it's not there in configuration file (which strange) assume default value of 1000 . max_input_vars = 3000 this value not possible set @ runtime using ini_set because in documentation it's specified php_ini_perdir makes sense because request variables have processed php engine before script starts. you can set in .htaccess if want make more specific project without affecting other projects in same server.

python - How to run code on the AWS cluster using Apache-Spark? -

i've written python code on summing numbers in first-column each csv file follow: import os, sys, inspect, csv ### current directory path. curr_dir = os.path.split(inspect.getfile(inspect.currentframe()))[0] ### setup environment variables spark_home_dir = os.path.realpath(os.path.abspath(os.path.join(curr_dir, "../spark"))) python_dir = os.path.realpath(os.path.abspath(os.path.join(spark_home_dir, "./python"))) os.environ["spark_home"] = spark_home_dir os.environ["pythonpath"] = python_dir ### setup pyspark directory path pyspark_dir = python_dir sys.path.append(pyspark_dir) ### import pyspark pyspark import sparkconf, sparkcontext ### specify data file directory, , load data files data_path = os.path.realpath(os.path.abspath(os.path.join(curr_dir, "./test_dir"))) ### myfunc add numbers in first column. def myfunc(s): total = 0 if s.endswith(".csv"): cr = csv.reader(open(s,"rb"))

haskell - Catamorphisms for Church-encoded lists -

i want able use cata recursion-schemes package lists in church encoding. type list1 = forall b . (a -> b -> b) -> b -> b i used second rank type convenience, don't care. feel free add newtype , use gadts etc if feel necessary. the idea of church encoding known , simple: three :: -> -> -> list1 3 b c = \cons nil -> cons $ cons b $ cons c nil basically "abstract unspecified" cons , nil used instead of "normal" constructors. believe can encoded way ( maybe , trees etc) it's easy show list1 indeed isomorphic normal lists: tolist :: list1 -> [a] tolist f = f (:) [] fromlist :: [a] -> list1 fromlist l = \cons nil -> foldr cons nil l so it's base functor same of lists, , should possible implement project , use machinery recursion-schemes . but couldn't, question "how do that?" since cannot pattern-match, have use fold deconstruct top level. write fold-based project normal lists: d

compiler errors - dsymutil missing compiling GNU bash on iOS -

i'm trying compile gnu bash 4.3.30 on (and for) ipad 2, ios 8.4 using clang, ld64, cctools, gnu make , ios 8.1 sdk. when processing bashversion, clang "unable execute dsymutil", , reports "doesn't exist", exiting error 1. $ make (...) "/usr/bin/ld" -demangle -dynamic -arch armv7 -iphoneos_version_min 5.0.0 -syslibroot /var/mobile/iphoneos8.1.sdk -o bashversion -lcrt1.3.1.o -l./lib/termcap /var/tmp/bashversion-814fa1.o buildversion.o -lsystem "dsymutil" -o bashversion.dsym bashversion clang: error: unable execute command: executable "dsymutil" doesn't exist! clang: error: dsymutil command failed exit code 1 (use -v see invocation) make: *** [bashversion] error 1 $ echo $cc clang --sysroot /var/mobile/iphoneos8.1.sdk -v $ clang --version clang version 3.5.0 (trunk) target: armv7-apple-darwin-14.0.0 thread model: posix $ ld -v @(#)program:ld project:ld64- configured support archs: i386 x86_64 armv4t armv5 armv6 armv7

java - In ant, how do I create a path that works on multiple platforms? -

i'm creating ant script parses androidmanifest.xml file. there class, xpathtask, want create taskdef . this, need specify path ant-tasks.jar file in user's filesystem. example, taskdef : <taskdef name="xpath" classname="com.android.ant.xpathtask"> <classpath> <pathelement location="${sdk.dir}/tools/lib/ant-tasks.jar" /> </classpath> </taskdef> i ${sdk.dir} property android build.xml, that's not problem. additional path jar file need (./tools/lib/ant-tasks.jar) needs tacked onto end of it. what i'm doing here works on macos , i'm guessing work on linux. haven't tested on windows yet have hunch fail because file path separators / instead of \ . does ant provide mechanism creating platform-agnostic file paths? or can use have here , ant smart enough know mean? (haha!)

javascript - How to change the keys between two images in Phaser? -

i'm creating game. there profile. user has opportunity change place of elements each other. when user that, keys of images must changed between each other too. and here problem: can't @ all here code i'm trying use: var loader = new phaser.loader(game); loader.image(draggableelement.key, 'path lying element', true); loader.image(lyingelement.key, 'path dragged element', true); loader.onloadcomplete.add(dosmthq); loader.start(); there error uncaught typeerror: failed execute 'drawimage' on 'canvasrenderingcontext2d': provided value not of type '(htmlimageelement or htmlvideoelement or htmlcanvaselement or imagebitmap)' thank in advance! appreciate =)

ios - How would I manually set the arrow direction of an options menu presented by a UIDocumentInteractionController? -

my app includes options menu sharing, presented when uitableviewcell long pressed. if uitableviewcell high on screen, arrow options menu below uitableviewcell . there way set arrow direction manually? the code use show options menu is: self.documentinteractioncontroller = uidocumentinteractioncontroller(url: fileshareurl) self.documentinteractioncontroller.delegate = self self.documentinteractioncontroller.uti = "public.xml" self.documentinteractioncontroller.presentoptionsmenufromrect(self.view.frame, inview: self.view, animated: true) where documentinteractioncontroller defined class variable var documentinteractioncontroller: uidocumentinteractioncontroller! , , fileshareurl nsurl pointing file share. i figured out problem wasn't location of uitableviewcell , presenting options menu from. code presenting options menu top of screen, not cell was.

sql - FInding Duplicate records in a table and deleting those records using postgreSQL -

i have table named "cities" has columns "id", "state" , "cities". there duplicate records found in table. want records found , deleted table. note query should found , delete record if both state , city names same.how can done using postgresql. assuming id unique (as implied question), can use delete id : delete cities c c.id > (select min(c2.id) cities c2 c2.state = c.state , c2.cities = c.cities ); if id can same, can use ctid : delete cities c c.ctid > (select min(c2.ctid) cities c2 c2.state = c.state , c2.cities = c.cities , c2.id = c.id );

java - PebbleKit.registerReceivedDataHandler() is undefined in Eclipse -

eclipse not recognize registerreceiveddatahandler method of pebblekit. have included following imports java file: import com.getpebble.android.kit.*; import com.getpebble.android.kit.util.*; and have installed pebblekit-3.0.0-eclipse.jar in libs directory , added build path (it shows in java build path/libraries). eclipse reports "the constructor pebblekit.pebbledatareceiver() undefined". the methods exposed in intellisense are: pebbledatareceiver, firmwareversioninfo, pebbleackreceiver, pebbledatalogreceiver, pebblenackrerceiver. i able use of pebblekit library since can send messages java file watch with: pebblekit.senddatatopebble(getapplicationcontext(), tactician_uuid, data); i have posted query in pebble sdk forum well, no response. eclipse luna windows 7 any suggestions please? interesting. haven't used eclipse, i've never had issues using android studio. have tried importing ctrl + shift + o instead of including them manually

html - Can't move text button -

Image
i'm creating menu header background image. created text button (the green aphryv thing) can't move it. tried: margin, text-align. can see box , want it. my code : .full-header { width: 100%; height: 500px; background: url(img/header-bg.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } .header { width: 100%; height: 60px; background: rgba(0, 0, 0, 0.45); } .nav { text-align: center; } .nav ul li { display: inline; padding: 20px 10px; line-height: 55px; } .nav ul li { text-decoration: none; color: #fff; font-family: 'source sans pro', arial, sans-serif; font-size: 35px; } .button { font-family: arial; color: #ffffff; font-size: 30px; background: #8edd63; padding: 10px 20px 10px 20px; text-decoration: non

Error C2280 mutex in a class C++ -

i'm having issue declaring mutex in class, whenever attempt instantiate class error c2280 appears. project create simulation of dining philosopher's problem. declaration: class fork { public: struct _position { float x; float y; }; fork(); fork(int num_phil_, int new_index_); _position returnworkposition(){ _position return_position_; /*position_mutex_.lock();*/ return_position_ = work_position_; /*position_mutex_.unlock();*/ return return_position_; }; float returnrotation(){ return rotation_; }; void calculateworkposition(int master_index_); void resetworkposition(){ /*position_mutex_.lock();*/ work_position_ = orig_position_; /*position_mutex_.unlock();*/ }; void takeownership(int master_index_); void relinquishownership(); private: int index_; int num_philosophers_; float rotation_; _position orig_position_; _position work_position_; //std::mutex master_mutex_; //std::mutex position_mutex_; }; instantiation: f

How do I use or create a variable of a private class in Java -

i'm creating inventory system(doing fun) , have chose use queues data structure in java. use private class within public class , when i'm trying run test queue can't declare variable of private class. here's code the class contains private class public class customer {//begining of class private class custque //creating private class use node { private int trn; private string lname; private string fname; private string mname; private string mstatus; private string dob; private string email; private string permanentadd; private string mailingadd; custque next; public custque()//default constructor { trn=0; lname=""; fname=""; mname=""; mstatus=""; dob=""; email=""; permanentadd="";

python - Why the keys of objects are None? -

here class structure class mapping(ndb.model): id = ndb.stringproperty() code = ndb.stringproperty() class doc(ndb.model): mappings = ndb.structuredproperty('mapping', repeated=true) my code scan data set create series of mapping , add instance of doc . @ end, based on criteria, decide save doc instance or not. doc = doc() data in dataset: m = mapping(parent=doc) # need able reference parent m.put() # did key instantiated? doc.mappings.append(m) if good: doc.put() the problem this: when try iterate list of mapping of doc.mapping , want print out key of mapping instance. print m.key.id() but error message: attributeerror: 'nonetype' object has no attribute 'id' why 'key' not instantiated after called put method? models created store in structuredproperties not have key. these entities serialized , stored in property of object. can query on them if have been indexed, not exist indep

c++ - Properly specify constraint for rotate? -

i'm investigating potential speedups respect constant time rotate not violate standards . a rotate on x86/x64 has following. simplicity, i'm going discuss rotating byte (so don't tangled in immediate-8 versus 16, 32 or 64): the "value" can in register or in memory the "count" can in register or immediate the processor expects count in cl when using register. processor performs rotate masking lower 5 bits of count . below, value x , , count y . template<> inline byte rotleft<byte>(byte x, unsigned int y) { __asm__ __volatile__("rolb %b1, %0" : "=mq" (x) : "ci" (y), "0" (x)); return x; } since x both read , write, think should using + somewhere. can't assembler take it. my question is, constraints represented correctly? edit : based on jester's feedback, function changed to: template<> inline byte rotleft<byte>(byte x, unsigned int y) { __as

How to store and print a list of numbers in matrix form(python) -

i have list of numbers output data of ocr operation. there 40 intergers, want print them in form of matrix(8x5). can 1 please me how in python 2.7? dont want enter elements manually.. list of elements being generated using loops, want display them in form of 8x5 matrix. thank you simply use list comprehension , range() function. my_list = [1, 2, 3, ..., 40] array = [[my_list[j*5 + i] in range(5)] j in range(8)] you can use function display matrix: for row in array: print(row) if need matrix "nicely" displayed, can use happyleapsecond's solution : print('\n'.join([''.join(['{:4}'.format(item) item in row]) row in array])) see example: https://ideone.com/yok1i5

android i want to add searchview in actionbar but not got it -

Image
i have layout in on title bar have option button , button work fine want add searchview in action bar dont know how new in android please me solve problem. this activity code. public class thrd extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_thrd); getsupportactionbar().settitle("3rd page"); getsupportactionbar().setdisplayhomeasupenabled(true); colordrawable colordrawable = new colordrawable(color.parsecolor("#20a780")); getsupportactionbar().setbackgrounddrawable(colordrawable); } @override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.main_activity_actions, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid

Docker Exec command does not work properly -

i have script (run.sh) run initialize container through "docker run" command. script runs successfully. can bash instance (through "docker exec -i -t container-name bash") in container , run script (note default have su privileges when bash). however, when run script host through "docker exec -i -t container-name /run.sh" script runs not provide outcome provides through alternative approaches. know runs produces of expected behavior not of them. main question difference between executing script through commandline , running same script through docker exec. appreciate on this.

Development in Microsoft Dynamics CRM -

at organization, i'm working on cloud based application delivers information sales team in dynamics crm. it's required build ui in dynamics crm or integrate ui dynamics. is possible? if so, can link me resources on matter or provide me information feel relevant? i've been doing lot of research haven't found how develop in dynamics (programming languages, development framework both ui (native vs html/hybrid) , backend changes). you question little unclear trying achieve; assuming want custom ui visible within crm recommend: developing ui standalone web application or set of web services , html resources hosting ui within crm external iframe or crm webresource hosting iframe within crm: https://msdn.microsoft.com/en-us/library/gg328034.aspx using crm webservice access crm: https://msdn.microsoft.com/en-us/library/gg328416.aspx

sql - I want to continue looping even when no-data-found and use index by..getting 'no data found error -

i using sqldeveloper. have use index program. department table has id's 10,20,50,60,80,100 . currently program prints dept_names id's 10 , 20 , quits. declare type dept_table_indexby table of departments.department_name%type index pls_integer; dept_table_arr dept_table_indexby; v_department_id departments.department_id%type := 10; begin in 1..10 loop begin select department_name dept_table_arr(i) departments department_id = v_department_id; v_department_id := v_department_id + 10; exception when no_data_found --null; /* tried option, still control exits loop */ dbms_output.put_line('in loop : ' || dept_table_arr(i)); end; end loop; in dept_table_arr.first..dept_table_arr.last loop dbms_output.put_line('department name: outside loop ' || dept_table_arr(i)); end loop; end; im not sure error is. my guess because trying asign null dept_table_arr(i) when id=30 im not familiar oracle sintaxis,

php - Laravel chaining scope queries -

i have 2 scope queries db. the data query looks this: { year: "2015", term: "summer", subject_code: "digm", course_no: "350", instr_type: "lab", instr_method: "face face", section: "003", crn: "42953", course_title: "digital storytelling", credits: "3.0", day: "r", time: "06:30 pm - 09:20 pm", instructor: "teacher name", campus: "university building", max_enroll: "18", enroll: "18", building: "place", room: null, description: "by surfing internet , playing computer games, lectures, assigned readings, class screening, , research projects, class explores impact of digital media on art, design , daily living. writing intensive course. ", pre_reqs: "",

Doctrine DBAL and sqlite problems -

i trying connect sqlite database file doctrine dbal. <?php use doctrine\dbal\drivermanager; require_once 'bootstrap.php'; $connectionparams = [ 'url' => 'sqlite:///crawls.db', ]; $conn = drivermanager::getconnection($connectionparams); but when try execute sql code says table not exist (of course checked manually , there). $conn->exec('select * crawl_item'); outputs php fatal error: uncaught exception 'pdoexception' message 'sqlstate[hy000]: general error: 1 no such table: crawl_item' in /home/px/documents/phpcrawler/vendor/doctrine/dbal/lib/doctrine/dbal/driver/pdoconnection.php:57 stack trace:... may output can helpful var_dump($conn->connect()); var_dump($conn->getdatabase()); bool(true) null if @ abstractsqlitedriver::_constructpdodsn() method see parameter 'path': $connectionparams = [ [ 'driver' => 'pdo_sqlite', 'path' =>

java - send arraylist through the socket -

this question has answer here: java socket/serialization, object won't update 2 answers i have socket (the server , client side). in server side have arraylist . each time new user connect, add arraylist. send arraylist . when client receives arraylist: first client [user1] second client [user1,user2] third client [user1,user2,user3] but if send string , receives correctly. i used objectinputstream , objectoutputstream //server side public void telleveryone(){ iterator = clientoutputstreams.iterator(); while(it.hasnext()){ try{ objectoutputstream oos = (objectoutputstream) it.next(); oos.writeobject(namesmachines); }catch(exception ex){} } } //client side public void run(){ object obj; try{ while((obj=ois.readobject())!=null){ castobject(obj);

c - Determine if ipv4 or ipv6 data structure -

in kernel module, given struct sockaddr sa_family initialized af_unspec , how can reliably determine if struct sockaddr_in or struct sockaddr_in6 ? on linux 3.16.0-4-686-pae (x86). struct sockaddr { unsigned short sa_family; // af_unspec char sa_data[14]; // ? }; struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; char sin_zero[8]; }; struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr sin6_addr; unsigned int sin6_scope_id; }; usually, when calls ke

php - Query builder conditional parameters -

i have user table has related data on belongstomany basis users id first_name skills id name positions id name position_user position_id user_id created_at updated_at skill_user skill_id user_id created_at updated_at in user model public function positions() { return $this->belongstomany('app\position')->withtimestamps(); } and in position public function users() { return $this->belongstomany('app\user')->withtimestamps(); } (the same skills) i passing following view: $users = user::with('skills') ->with('skills') ->with('positions') ->get(); i want able search on various combinations of skills , positions having difficulty creating elegant solution. if select position or positions, pass controller can return info as: if (request::get('positions')) { $positions = request::get('positions'); } where positions

mysql somehow group and then select from tag map -

the table: | tag_id | article_id | |--------|------------| | 1 | 100 | |--------|------------| | 2 | 100 | |--------|------------| | 1 | 200 | |--------|------------| | 1 | 300 | how select 2 first rows the logic: select articles have tag_id 1 , 2 in case article id 100 i use php filter results, mysql neater. to article_ids have both tag_id 1 , 2 can use clause combined group clause limited having clause this: select article_id your_table tag_id in (1,2) group article_id having count(distinct tag_id) = 2; with sample table return article_id = 100. note return articles don't have tag_id 1 , 2, articles have tag_id 1 , 2 plus other tags - limits result articles have at least tag_id 1 , 2 (but have more). if want limit articles have tag_id 1 , 2 add correlated exists predicate instance. sample sql fiddle

c# - After running my project few times i'm getting erorr: Could not resolve COM reference "f8937e53-d444-4e71-9275-35b64210cc3b" what's that? -

this full error: error 1 not resolve com reference "f8937e53-d444-4e71-9275-35b64210cc3b" version 1.0. specified image file did not contain resource section. (exception hresult: 0x80070714) usingautoit never had before google didn't find reference long number , letters. this form1 complete code not long. maybe dllimport make problem ? didn't before. strange error. using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.threading; using autoitx3lib; using system.runtime.interopservices; using system.diagnostics; namespace usingautoit { public partial class form1 : form { [dllimport("user32.dll")] public static extern bool setforegroundwindow(intptr hwnd); static autoitx3lib.autoitx3class au3; static thread thread; static bo

javascript - SVG side by side - rotate 90 all of them -

i have 2 svg ( horizontal view ): <svg id="svgc1" height="52.215796" width="257.597148" xmlns="http://www.w3.org/2000/svg"> <polyline points="0,6.326886 178.017424,6.326886 178.017424,45.888910 0,45.888910" fill="green"></polyline> <polyline points="178.017424,7.892542 257.597148,7.892542 257.597148,44.323254 178.017424,44.323254" fill="blue"></polyline> </svg> <svg id="svgc2" height="52.215796" width="257.597148" xmlns="http://www.w3.org/2000/svg"> <polyline points="0,6.326886 178.017424,6.326886 178.017424,45.888910 0,45.888910" fill="blue"></polyline> <polyline points="178.017424,7.892542 257.597148,7.892542 257.597148,44.323254 178.017424,44.323254" fill="green"></polyline> </svg> jsfiddle example i have tried group polylines ,

java - Finding the mathematical algorithm to which matches an input and output together -

as end result, computer program can accept list of inputs , outputs , apply same algorithm went input/output's on number, i.e: if given list of input/output's 2:4 4:8 100:200 it realize algorithm (input * 2), or (output / 2) depending on wanted. so, if given number 16, , asked produce output program respond 32. , if given number 10 , asked produce input, respond 5. it rather simple 'hardcode' program, although i'd learn how have program teach algorithm is. understand rather complicated rather fast. you can not reliably type of input/output signal dependency instead should support otherwise need kind of ai or very complex neural network + many functional generators insane complexity , unknown reliability of solution ... i simplify dependencies like: polynomial degree (can use interpolation/approximation) y=a0+a1*x+a2*x*x+a3*x*x*x exponential y=a0+a1^x other if want support things sin waves etc need many inputs not few decid

Implementing binary operations on generic class in scala -

i having multiple compile errors trying write class definition this. trait binops[t] { def +(that: vector[t]): vector[t] def -(that: vector[t]): vector[t] def *(that: vector[t]): vector[t] def /(that: vector[t]): vector[t] } trait vector[t] { def tolist(): list[t] def zeros(length: int): vector[t] } object vector { def apply[t](args: t*): vector[t] = new vectorimpl[t](args.tolist) private class vectorimpl[@specialized(double, int, float, long)t](val _data: list[t]) extends vector[t] binops[t] { def +(that: vector[t]): vector[t] = new vectorimpl[t](_data.zip(that).map(elem => elem._1 + elem._2)) def -(that: vector[t]): vector[t] = new vectorimpl[t](_data.zip(that).map(elem => elem._1 - elem._2)) def *(that: vector[t]): vector[t] = new vectorimpl[t](_data.zip(that).map(elem => elem._1 * elem._2)) def /(that: vector[t]): vector[t] = new vectorimpl[t](_dat

javascript - Does getElementsByClassName keep ordering? -

the webpage working contains alphabetically sorted list of div's have same class. if call document.getelementsbyclassname('classname') , can sure array returns sorted in html order? yes. the collection represents view of subtree rooted @ collection’s root, containing nodes match given filter. view linear. in absence of specific requirements contrary, the nodes within collection must sorted in tree order . — https://dom.spec.whatwg.org/#old-style-collections

simulator - LC-3 binary instructions exercise -

this code lc3 simulator have right now: 0011000000000000 0101010010100000 0010011000010000 1111000000100011 0110001011000000 0001100001111100 0000010000001000 1001001001111111 0001001001100001 0001001001000000 0000101000000001 0001010010100001 0001011011100001 0110001011000000 0000111111110110 0010000000000100 0001000000000010 1111000000100001 1111000000100101 0011000100000000 0000000000110000 it's program identitfies single character in entire string , outputs number of times character found.. i have 2 questions.. 1) code works outputs number of times find letter in string... need modify builds list in memory of addresses character found.. need make list start @ memory location x3200 2) code works if character found between 0-9 times.. need modify works 0-99 times i'm not asking answer... appreciate pointers on how approach this... alright think i'm starting understand problem little bit more. created binary file , loaded lc3's simulator produc

entity framework - How can I get distinct results from this LINQ query? -

Image
below erd , sample data. note, i'm using entity framework , code first control database. for project named vacation , return distinct users have "true" value in userbooleanattributes table either parents or teens rows defined in userattributes table. here current attempt: var myquery = p in context.projects join ua in context.userattributes on p.projectid equals ua.projectid join uba in context.userbooleanattributes on ua.userattributeid equals uba.userattributeid join u in context.users on uba.userid equals u.userid p.projectid == 1 uba.value == true (ua.userattributeid == 1 || ua.userattributeid == 2) select new { uba = u }; this returns 6 users, e@acme.org being listed twice. there linq way of returning distinct values? suppose convert list filter, i'd rather have databa

c++ - MoveMemory Byte array -

i'm using code: #include <stdio.h> #include <windows.h> #define address 0x00401054 int main(){ byte values[4] = { 0x00, 0x00, 0x00, 0xb8 }; movememory((*(pvoid*)address), values[0], 4); } but return error intellisense: argument of type "byte" incompatible parameter of type "const void * what do? use &values[0] take address of first element of array. or, use values (instead of &values[0] ), because name of array refers address of first element.

google analytics - Set a Virtual Page View with Universal GA -

this html from. , i'm trying set virtual page view when submitting form can't make work. pls advice <form id="frmcontact" action="post.php" method="post"> <div class="form-right-pnl"> <input type="text" class="required name" size="40" placeholder="×©× ×ž×œ×:" name="full_name"> <input type="text" class="required phone" size="40" placeholder="טלפון:" name="phone"> <input type="text" class="required email" size="40" placeholder='דו×"ל:' name="email"> <span>מ×שר קבלת ×—×•×ž×¨×™× ×¤×¨×¡×•×ž×™×™×</span> <input type="checkbox" class="radio_btn" name=