Posts

Showing posts from February, 2011

node.js - Having Problems Installing node-xmpp-server on My 64-bit Windows System -

can me error keep getting trying install node-xmpp-server . installed dependencies. c:\windows\system32\node_modules\node-xmpp-server\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node _gyp (node "c:\program files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebu ild ) else (node rebuild ) gyp: binding.gyp not found (cwd: c:\windows\system32\node_modules\node-xmpp-server\node_modules\ws\node_modules\bufferut il) while trying load binding.gyp gyp err! configure error gyp err! stack error: `gyp` failed exit code: 1 gyp err! stack @ childprocess.oncpexit (c:\program files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configur e.js:355:16) gyp err! stack @ emittwo (events.js:87:13) gyp err! stack @ childprocess.emit (events.js:172:7) gyp err! stack @ process.childprocess._handle.onexit (internal/child_process.js:200:12) gyp err! system windows_nt 6.1.7601 gyp err! command "c:\\progra

Facebook canvas app not working on mobile browser -

my facebook app working fine on web browser or facebook page tab app on desktop. app name : https://apps.facebook.com/app_name/ added platforms in facebook developer console : facbook canvas + website + page tab app url - https://testsite.com/ (it responsive website added same url mobile+canvas+web) if hit same link on mobile browser redirects me website page url parameters ref=web_canvas&code=somegibberish , site doesn't load. example : https://testsite.com/?ref=web_canvas&code=somegibberish if search app name on facebook mobile app, redirects me facebook browser , chrome link mydomain parameter: like https://testsite.com/?ref=unknown&code=somegibberish according research if search app on facebook mobile redirect actual website on browser cause facebook mobile doesn't support page apps guess expected behaviour i'm concerned url parameters it's passing cause not letting website load. should add parameters url( https://testsite.com/ ) wh

html - Prevent text from shifting when hovered -

i'm new flexbox , trying make menu using it. i want links have nice border on bottom when user hovers on them. if set box-sizing: border-box; flex keeps recalculating text position , element 'jumps' instead of predicted behaviour. i have example problem. don't want content inside element jump when hover. is there simple solution/edition code make work expected? know other ways of achieving want: set baseline, use relative/absolute positioning... .item { display: flex; width: 200px; height: 100px; background: #123; color: #fff; text-align: center; justify-content: center; flex-direction: column; } .item:hover { border-bottom: 10px solid lightgreen; box-sizing: border-box; } <div class="item"> content </div> by adding 10px border on hover, changing size of box on hover. reposition surrounding elements... on hover. one solution reserve space border @ times. in other words, have

java - Null values update with Spring Rest Resource -

there class annotated restresource (spring 3.1, jackson 2.3). when try save object that a: {"prop1":1, "prop2":2} it saved successfully. we have following code: a.setprop2(null); entityservice.patch(a); a: {"prop1":1, "prop2":null} after entityservice.patch(a) execution there no changes in db (oracle 11g), want in db prop2 equals null too. is normal behaviour (i think maybe yes, because null-value may understanding not changed)? there simple way change behaviour? when speaking http verbs, patch request describes differences should made existing object. made can create partial updates without exposing particular resource property throught rest. in spring framework, in context of patch request, null value of property means no change property should made. guess spring data rest transpons logic service layer, in order update resource null value should issue call corresponding put semantics

for loop - Use of relational operators when reading a file from CMD -

i trying create command line program outputs numbers file greater (larger than) specified one. there's file output.txt lots of numbers (one per line) , need ones less 5000. here's part of code, doesn't work expected: choice /c 12 set /p comparative_number="input number: " if %errorlevel%==2 goto less_operation /f %%a in (%outputfile%) if %%a gtr %comparative_number% echo %%a echo. & echo end of output & exit /b :less_operation /f %%a in (%outputfile%) if %%a lss %comparative_number% echo %%a echo. & echo end of output & exit /b what doing wrong? the command extensions enabled default. if batch script depends on command extensions when using gtr , lss in if condition advisable enable them explicitly. the integer numbers must listed in file referenced via environment variable outputfile line line, example: 50 23 478 -3425 9071 a batch code worked: @echo off setlocal enableextensions set "outputfile=c:\temp\f

javascript - How to pass selected rows from a table as request parameters on form submit? -

i,m developing web app(jsp) extracts data .doc file. headings uploaded document extracted , listed in table below. generated output on upload-screenshot i have added check-box each row. next want save check-box checked rows xml. know how write xml how checked rows on form submit? question summery is, how can pass checked rows table on form submit request parameters. in advance. creating checkbox array keeping same name checkboxes give want. in java, after submitting form read in servlet 'request.getparametervalues("checkboxname")'. checked checkboxes array returned.

javascript - Behavior of <marquee> tag in HTML (Like cast in the end of film) -

see <marquee>this basic example of marquee</marquee> i need see word "this" on right side of screen when disappear left. thank in advance! this basic example of marquee

xml - Apache solr collection -

hi new apache solr bear me. trying create collection/core remains on admin page every time load solr 4.10.4 on mac. have make new core every time open solr admin page. currently, have solrconfig.xml, schema.xml , solr.xml file , follows. solrconfig.xml: <?xml version="1.0" encoding="utf-8" ?> <config> <lucenematchversion>lucene_43</lucenematchversion> <requestdispatcher handleselect="false"> <httpcaching never304="true" /> </requestdispatcher> <requesthandler name="/select" class="solr.searchhandler" /> <requesthandler name="/update" class="solr.updaterequesthandler" /> <requesthandler name="/admin" class="solr.admin.adminhandlers" /> <requesthandler name="/analysis/field" class="solr. fieldanalysisrequesthandler" startup="lazy" /> </config> schema.xml: <?xml version=&qu

JsResultException - unable to successfully parse json - 2.4x Play Scala -

i have following case class; import java.sql.timestamp case class dose (date: timestamp, pthospitalnumber: string) and in controller following code handle json; import play.api.libs.json._ import play.api.libs.functional.syntax._ implicit val dosereads: reads[dose] = ( (jspath \ "date").read[long].map(long => new timestamp(long)) , (jspath \ "pthospitalnumber").read[string] )(dose.apply _) def adddoses() = action(bodyparsers.parse.json) { implicit request => val doses = (request.body \ "doses" ).as[list[dose]] //then iterate through list , return json response } however, when json sent (from android device list[dose] using org.springframework.http.converter.json.mappingjackson2httpmessageconverter), keep getting error; play.api.libs.json.jsresultexception: jsresultexception(errors:list((,list(validationerror(list([{"date":1445789736831, "hospitalnumber":"a059es21"},{"d

Group with mapreduce mongodb c# driver -

i'm trying transcribe query held in mongodb application layer in c#. how can perform same query using c # imongodriver in method? how mount query, step parameters, etc? this query on mongo: enter image description here

android - Adapter null pointer when filtering in toolbar searchview -

so i'm trying filter list shown in http://www.tutorialsbuzz.com/2015/11/android-filter-recyclerview-using-searchview-in-toolbar.html right when click on search icon star typing filter null pointer exception on adapter.setfilter(filteredmodellist); activity public class createmyteamactivity extends appcompatactivity implements searchview.onquerytextlistener { list<messagedata> messagedatalist = new arraylist<messagedata>(); private recyclerview mrecyclerview; private customrecycleradaptercreateteam adapter; listview userslistview; context context; private static final string tag = "myactivity"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_create_my_team); context = this; mrecyclerview = (recyclerview) findviewbyid(r.id.recycleview); final linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(this); mrecyclerview.setlayo

c# - Access Multiple search filter -

i trying click search button multiple inputs on textbox. have looked around , tried different methods somehow didn't work out. below code click event: private void btn_table_click(object sender, eventargs e) { try { connection.open(); oledbcommand command = new oledbcommand(); command.connection = connection; string query = "select [name],[sex],[number] recordssheet [name] like('" + textbox1.text + "%'),[sex]=('" + textbox2.text + "%'),[number]=('" + textbox3.text + "%'"); command.commandtext = query; oledbdataadapter da = new oledbdataadapter(command); datatable dt = new datatable(); da.fill(dt); datagridview1.datasource = dt; connection.close(); } catch (exception ex) { messagebox.show("error " + ex); } } you mixing equals , syntax on same operations, going result in incorrectly formed

r - RSelenium always shows a redirection -

i trying repeat example code shown in rselenium remotedriver topic. can see commented out responses getting redirection, , same response every rselenium function. how overcome problem? startserver() remdr <- remotedriver$new() remdr$open() # [1] "connecting remote server" # [[1]] # [1] "<html>\r\n<head><title>redirection</title></head>\r\n<body><h1>redirect</h1></body>\r\n" # # $id # [1] na remdr$navigate("http://www.r-project.org") remdr$getpagesource() # [[1]] # [1] "<html>\r\n<head><title>redirection</title></head>\r\n<body><h1>redirect</h1></body>\r\n" # remdr$findelements(value = "//frame") # [[1]] # [1] "remotedriver fields" # $remoteserveraddr # [1] "localhost" # # $port # [1] 4444 # # $browsername # [1] "firefox" # # $version # [1] "" # # $platform # [1] "any&

python - Why do we write [1,1] in the minimize function -

i new optimization techniques , want best function getting optimum value unconstrained multi-variables. why write [1,1] after f in minimize function?? { def f(x): z=(x[0]**2)+(x[1]**2) d=x[0]+x[1] return z+d scipy.optimize import minimize res=minimize(f,[1,1]) print res } i appreciate anyone. it required argument (initial guess) according http://docs.scipy.org/doc/scipy-0.16.0/reference/generated/scipy.optimize.minimize.html

microservices - How to listen two micro services on same port in Node.js -

i new micro service. want create 1 application 2 micro services. don't know how listen both (or more) micro services on same port make 1 application. there tutorial pages available in online ? please suggest me blogpost or tutorial pages or me create application 2 micro services. i trying create bus booking application has 2 services, bus service (which gives bus names & availability) user service (which gives & connect user details bus). i created 2 two nodejs application. need know how combine 2 1 application (with microservice).for can't listen 1 port. if going use 1 port, need have way distinguish between requests each. if identified port number (instead of, eg, each having different path or domain), have change access url (or header) in way. given that, can use npm module, express, distinguish between number of request types interpreting request. you might have: service1.com , service2.com both pointing xxx.xxx.xxx.xxx:2020. distinguish

regex - how to search pattern with numerals in vim -

i want search patterns matching string part numerals. example have file containing foo_1 foo_2 foo_3 foo_33 foo_34 foo_35 foo_65 foo_66 foo_67 and on , want search foo_2 , foo_34 , foo_66 /foo_[2|34|66] this doesn't return me desired search. can here? try /foo_\(2\|34\|66\)$ . see section 27.5 in vim details.

datetime - Convert date variable to numeric -

feels obvious question, stata hasn't yielded answers. stata users interested in converting non-date variable date variable, want opposite. i have date variable date , type long, format %tdccyynn . i'm trying append dataset in same variable date type long , format %12.0g . accurately this, need convert date in first dataset %tdccyynn %12.0g . when format %12.0g date , date values change incorrect ones. let's say, in first dataset, have date=201204 . still want read 201204 , %12.0g variable. there way this? i +1 comments above nick , william , suggest read help datetime . have been using stata few years , still visit file. stata's date/time functionality fantastic , benefit learning earlier rather later. i convert other data stata date format . really . if need convert %td date "integer yyyynn" date, pass through temporary file. if write %td date plain text, keep displayed format , can read integer yyyynn date. // data matches decsri

c++ - gcc throwing error relocation truncated to fit: R_X86_64_32 against `.bss' -

#include <bits/stdc++.h> using namespace std; #define mod 1000000007 int dp[100000][100000]; int main() { long int n; cin>>n; vector <int> a(n); for(long int i=0;i<n;i++) cin>>a[i]; memset(dp,0,sizeof(dp)); long long int maxi=0; for(long int i=0;i<n;i++) { for(long int j=i;j<n;j++) { dp[i][j]=dp[i][j-1]^a[j]; dp[i][j]%=mod; if(maxi<dp[i][j]) maxi=dp[i][j]; } } cout<<maxi; return 0; } compiler throwing error : in function _global__sub_i_dp': (.text.startup+0x185): relocation truncated fit: r_x86_64_32 against .bss' (.text.startup+0x194): relocation truncated fit: r_x86_64_32 against `.bss' error: ld returned 1 exit status error ? your global array takes 40gb, can't put in program's .data section. doesn't fit there. even if did, end gigantic binary, it's bad idea i

sql - Find all INTs BETWEEN multiple ranges -

i'm dealing document parent/child families in discovery tool. is there easy way return numbers between list of multiple ranges? i have #temptable 359 rows containing startingbatesnumber , begatt , , endatt the begatt beginning of bates range, , endatt last document in bates range. here's sample data #temptable : startingbatesnumber begatt endatt ctrl00262209 ctrl00262208 ctrl00262209 ctrl00262295 ctrl00262292 ctrl00262295 ctrl00262325 ctrl00262323 ctrl00262326 ctrl00262348 ctrl00262347 ctrl00262362 ctrl00262398 ctrl00262395 ctrl00262399 ctrl00262518 ctrl00262509 ctrl00262597 ctrl00262575 ctrl00262509 ctrl00262597 ctrl00262946 ctrl00262934 ctrl00262955 ctrl00263301 ctrl00263280 ctrl00263304 ctrl00263342 ctrl00263336 ctrl00263360 ctrl00263602 ctrl00263590 ctrl00263614 ctrl00263649 ctrl00263648 ctrl00263649 ctrl00263810 ctrl00263809 ctrl00263810 ctrl00264691 ctrl00264690 ctrl002646

Prolog Delay Execution of Text -

i write text based adventure game in prolog, therefore have tons of writeline statements. wondering if slow down output processing of text. imagine following scenario: i have textblock gets printed , want 2 sec delay afterwards. textblock b gets printed 2 sec later, without :- sign in prolog. my first idea write loop compares current time currenttime + 2 s cant rid of :- sign. unfortunately; newbie in prolog , ii don't have clue thread handling. that statement might useful doesn't work @ all: delaytext([h|t]) :- put_char(h), flush_output, sleep(0.1), delaytext(t). delaytext([]). neither flush output nor sleep seem work. i'm using prodt in eclipse. in advance, chris. i'm not sure how want realise writing game, sleep/1 used in example code in question can used simple write so: delaytext([]). delaytext([h|t]) :- write(h), sleep(1), % time in seconds delaytext(t).

javascript - Subtract 1 from total if check box is checked -

say have checkbox , beside show numbers, 10 , when user clicks on checkbox 10 becomes 9 if unchecks again becomes 10. <input type="checkbox" id="credits" name="credits" <?php echo $checked;?> /> (10) credit the value of credit fetched database. $(function () { $('#credits').change(function () { var currentvalue = parseint($('#credit-amount').text()); var newvalue = currentvalue + ($(this).prop('checked') ? -1 : 1); $('#credit-amount').text(newvalue); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="checkbox" id="credits" name="credits" /> (<span id="credit-amount">10</span>) credit

c# - Where function on list with multiple conditions returns errors -

i'm trying filter list based on few criteria , .where() function gives me error in 2 parts of same method. if (string.isnullorwhitespace(champs)) { data = dal.getvuetache().where(t => t.projetdescription64.tolower().contains(filtre.tolower()) // *this line || t.projetdescription256.tolower().contains(filtre.tolower()) || t.description256.tolower().contains(filtre.tolower()) ||t.responsablenomcourt.tolower().contains(filtre.tolower()) || t.prioritedesc.tolower().contains(filtre.tolower()) ).tolist(); } if use of previous conditions except 1 on nullable field alone filtered list on criteria, if add or "||" system.nullreferenceexception on first criteria. i have similar issue in part of same method else { data = dal.getvuetache().where(t =>

javascript - How to display inline "input" elements, surrounded by divs -

i have html code, 3 input fields : <div class="field" > <input placeholder="firstname" class="firstname" id="firstname_field" name="firstname" size="30" value="" type="text" > </div> <div class="field" > <input placeholder="lastname" class="lastname" id="lastname_field" name="lastname" size="30" value="" type="text" > </div> <div class="field" > <input placeholder="email" class="email" id="email_field" name="email" size="30" value="" type="text" > </div> currently, because surrounded div's, display in block : http://jsfiddle.net/k2nqp/159/ need 2 first fields display "inline" , not block, , 3rd 1

MySQL-PHP Multiple members and join names to dates -

i have table of 'members' looks following. in trying put mailing list found addresses easy. names on other hand, not much. | id | firstname | lastname | mbrgrpnum | mbrgrpnumid | datejoined | -------------------------------------------------------------------- | 1 | jane | whitmore | 100100 | 01 | 2016-01-01 | | 2 | bob | whitmore | 100100 | 02 | 2014-02-01 | | 3 | carol | evans | 100101 | 01 | 2012-02-01 | | 4 | bob | roahns | 100101 | 02 | 2015-09-28 | | 5 | corry | roahns | 100101 | 03 | 2014-09-28 | the output i'd this, based on mbrgrpnum; 1 whitmore, jane (01/16) & bob (02/14) 2 evans, carol (02/12) & rohns, bob (09/15) & corry (09/14) there 6 individuals same mbrgrpnum (essentially members of household) different mbrgrpnumid 's. use concat concatenate columns in row, , group_concat concatenate in group. select group_concat(

authentication - Custom local URL results in redirect_uri_mismatch -

i using custom local url development of project authenticates both google , adwords using oauth2. the entry in /etc/hosts file looks like: 127.0.0.1 sub.example.dev:3001 in google cloud platform console have oauth 2.0 client id setup with: type: web application authorized javascript origin: http://sub.example.dev:3001 authorized redirect uris: http://sub.example.dev:3001/auth/adwords/callback http://sub.example.dev:3001/auth/google/callback i authenticate with both google , adwords separately. using localhost:3001 instead of custom url working both google , adwords. after switching custom local url google auth still works, when try authenticate adwords redirect_uri_mismatch error. the error page tells me "the redirect uri in request, sub.example.dev:3001/auth/adwords/callback, not match ones authorized oauth client." uri reported here same have authorized redirect uri (minus protocol). why work google oauth, not adwords? how can custom local red

AngularJs Bootstrap pagination using ng-repeat not working properly -

i'm trying implement bootstrap pagination on ng-repeat. html <tr data-ng-repeat="userdetails in data.slice(((currentpage-1)*itemsperpage), ((currentpage)*itemsperpage)) |filter:status:status.status" > <td>{{userdetails.status.status}}</td> <td> {{ userdetails.subdate | date : 'mm-dd-yyyy' }} </td> <td> {{ userdetails.fullname }} </td> <td> {{ userdetails.servicetype.servicename }} </td> <td> {{ userdetails.status.status }} </td> </tr> <select ng-model="viewby" ng-change="setitemsperpage(viewby)"><option>5</option><option>10</option></select> records @ time. <uib-pagination total-items="totalitems" ng-model="currentpage" ng-change="pagechanged()" class="pagination-sm" items-per-page="itemsperpage"></uib-pagination> js $http.get('

css - Why does Chrome browser change the border size and does not set it to the one that I am requesting? -

Image
i trying understand why border size not size setting css rules. here a fiddle , here html: <!doctype html> <html> <head> <meta charset="utf-8"> <title>p inside body</title> <link rel="stylesheet" href="stylesheets/working.css"> </head> <body> <h2>hello world!</h2> <p> sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. ut enim ad minima ven

sql server - SSIS Foreach Flatfile Connection issue -

Image
i have 1 directory of .csv files want load db each table titled after .csv title. i have foreach loop handle this. variable current dir, current file, , tblname defined , modified scripting actions. the last command of foreach loop updates current file variable, not seem refresh flat file connection debugging fails error stating column found in previous csv expected not found in datasource (which next csv in dir) control flow: data flow 'insert new data target' and here's code updating var's @ end of for/each loop. int pos = (int)dts.variables["user::pos"].value; string dirpath = (string)dts.variables["user::sourcefolder"].value; pos++; dts.variables["user::pos"].value = pos; //object ffconnection = dts.connections["csv file"].acquireconnection(dts.transaction); //string filepath = (string)ffconnection; //messagebox.show(ffconnection.tostring()); //dts.connections["csv file&quo

In android, how to make empty TextView stay in the middle vertically? -

in android, want add empty message in middle of screen when gridview empty. layout below makes text in middle-top of screen. how can make text in middle in vertical direction ? gridview gridview = (gridview) findviewbyid(r.id.gridview); textview emptytext = (textview)findviewbyid(r.id.empty); gridview.setemptyview(emptytext); <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <gridview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:columnwidth="100dp" android:numcolumns="auto_fit"

jsf - How to pass special characters to ManagedBean -

reading following questions ( how set charset in primefaces webapp? ), i'm trying pass parameter managedbean specials characters (like i.e.: " '´áéíóúÁÉÍÓÚ& "), using "filterservlet" says in answers of questions it's not working: jbweb000065: http status 500 - /utf8/utf8_test.xhtml @23,153 value="#{testbean.testencoding(''´áéíóúÁÉÍÓÚ&')}" el expression unbalanced: ... #{testbean.testencoding(''´áéíóúÁÉÍÓÚ&')} jbweb000309: type jbweb000066: exception report jbweb000068: message /utf8/utf8_test.xhtml @23,153 value="#{testbean.testencoding(''´áéíóúÁÉÍÓÚ&')}" el expression unbalanced: ... #{testbean.testencoding(''´áéíóúÁÉÍÓÚ&')} jbweb000069: description jbweb000145: server encountered internal error prevented fulfilling request. jbweb000070: exception javax.servlet.servletexception: /utf8/utf8_test.xhtml @23,153 value="#{testbean.testencoding(''´

underscore.js - underscore template vs javascript html -

for medialibrary i've been using underscore javascript library append json data _.template function. media items loaded can filter data later on search function. that's it's basicly ment right? but i've used other items like: buttons, attachments, etc. data created on fly in javascript when select media items. after click on insert button underscore appends small snippets. is little much? should actualy use html strings inside javascript that? have 7 underscore templates small snippets user actions don't realy need underscore templating.... i'm big fan of templates (underscore/mustache.. etc) might little bias. alternative have js string , append things it, thats archaic. or have jquery build structure, thats hard on eyes -- @ least on mine. this me better: <div class="<%= classtype %>"> <label id="<%= id %>"><%= name %></label> <input name="<%= name %>" id=&

php - connection successful but 500 internal error while fetching data from sql server -

this config file. connecting localhost using port forwarding using bit-vise ssh client connection success while excuting query there 500 internal server. <?php try { $hostname = "xx.xx.xx.xx"; $port = 2351; $dbname = "otomax"; $username = "sa"; $pw = "root"; $dbh = new pdo("sqlsrv:server=$hostname,$port;database=$dbname","$username","$pw"); "connect"; } catch (pdoexception $e) { "failed db handle:".$e->getmessage()."\n"; exit; } ?> connection successful 500 internal error while fetching data server please me out <?php include("config.php"); $id=$_session['kode']; $sql = "select * dbo.reseller kode='$id'"; $query = $db->prepare( $sql ); $query->execute(); $result = $query->fetchall( pdo::fetch_assoc ); ?> please see code , me out

ruby on rails - Tables for Orders -

Image
i'm having difficult time setting model/table relationships hobby project i'm working on. have order, order have 1 or many packages, each package has 1 or many products, each product have 1 area assigned to. there can multiple of same product on order , in same package each have different area , different quantity. i'm struggling determine how relationships set up. at end of day need run report shows me order details listing packages on order , products , areas contained in each package. need report shows me order , sum of quantities each product on order (no packages on one). i'm using rails activerecord think believe there couple polymorphic relationships, i'm struggling identify them outside of simple "everything has one-to-many relationship" thinking. =) can please me put these tables in intelligent manner? have searched similar schema diagrams without success , i've been working on couple of days , starting run together. this basics o

php - Find position of console escape code in string -

tl;dr how write strpos($haystack, '^[[h^[[2j') in php? a linux command line app delivers screen-full of data followed console escape code return cursor "home" position in regular loop. access data piped output own script so: $ ./otherapp | php myscript.php it's continuous stream of data use this example non-blocking stream consumption . now decode output need grab full frame/screen full of data. escape codes shown in nano ^[[h , ^[[2j . easiest way seems detecting these escape codes , using output between them. how escape codes represented in php string? can use strpos (or mbstring equivalent) detect position? it seems you're on unix environment. achieve escape codes do, can try echo -en "\033[h" , echo -en "\033[2j" , guess should try strpos('\033[h\033[2j', $haystack) . maybe you'll need add backslash ( '\\\033[h\\\033{2j' ). since \033 means "the byte octal value 33", esc, sho

android - Clear fragment stack to go to another single one -

Image
i'm opening fragments containing list, on , on again, then, ultimately, want clear fragment stack open new fragment once reach end of fragments containing list. i don't know if i'm being clear here i'm doing currently: private final broadcastreceiver onreceivelaunchincident = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { getsupportfragmentmanager().popbackstack(null, fragmentmanager.pop_back_stack_inclusive); // select correct item drawerlayout selectitem(drawerlist.indexof("patrol")); } }; currently goes way when enter broadcastreceiver fragment d ---> fragment a ---> fragment e and want go way: fragment d ---> fragment e private void selectitem(final int position) { addtodrawerifnotexist(position); if (mdrawerlistchild.getcheckeditemposition() == position) { log.i(tag, "same position selected

osx - Visual Studio on MacBook -

i'm new programming, , still learning. anyway, possible use visual studio apache cordova on os x? or have use virtual machine windows? if want make apps both ios , android, need write code twice? (hybrid mobile app). you can use visual studio on mac running windows 8.1 or 10 in virtual machine or using bootcamp boot directly windows 8.1 or 10. i use virtual machine approach development. using mac windows vm can target ios, android, , windows phone. can read blog post here on how setup environment (you might want check out part 1 well): http://trunica.net/building-hybrid-mobile-apps-part-2.html no not need write code twice. that's beauty of cordova! 95% close 100% of code should same across platforms. you can use cordova directly on mac if want , develop both ios , android without using visual studio. recommend using visual studio since adds lot of nice features development (additional emulators, easier configuration, etc...).

Android Wear Watchface with Sensor Data -

apologies lack of code examples, i've tried far has been complete mess. i've tried searching information online, maybe i'm not searching correct terms. i can create watch face using samples in android studio & i've created application retrieve data sensors. can't combine two. what i'm trying create android wear watchface can display various pieces of data collected sensors on board watch. for example, accelerometer on in order enable wrist gestures. can point me in right direction how go solving this, without posting link android api, i've exhausted that. regards, emmett ok, after 3 days of playing around , frustrating errors, i've managed solve it, if else needs figure out: first implement sensoreventlistener: private class engine extends canvaswatchfaceservice.engine implements sensoreventlistener next, within onvisibilitychanged, registered 2 methods i've created: @override public void onvisibilitychang

Setting a variable in a Makefile recipe and then testing it -

in recipe, want git fetch current sha1 hash if git present , i'm in git repository. problem $(git) null. don't understand why yet setting $(hash) , echoing works. what's going on here? how can make execute chunk of code if git installed? hash: ifneq ("$(wildcard .git)", "") $(eval git=`which git`) ifdef $(git) $(eval hash=`git rev-parse head`) @echo $(hash) @echo "#define git_sha1 \"$(hash)\"" > git_sha1.h endif else @echo "not in git repository" endif i want avoid having use shell script this. i want git fetch current sha1 hash if git present , i'm in git repository you like: makefile 1 hash := $(if $(and $(wildcard .git),$(shell git)), \ $(shell git rev-parse head)) hash: ifdef hash @echo $(hash) @echo "#define git_sha1 \"$(hash)\"" > git_sha1.h else @echo "git not installed or not in git repository" endif whic

Adding custom markers to a map for any user who clicks a button on website -

i want make webpage has 2 buttons. 1 add 1 style of marker on google map , other add different styled marker. how can done markers stay visible users. my first thought use kmz layer limited number of them. so, how been done if 1000 users clicked button, there 1000 different markers @ respective locations on map?

Is it possible to inverse inheritance using a Python meta class? -

out of curiosity, i'm interested whether it's possible write meta class causes methods of parent classes have preference on methods of sub classes. i'd play around while. not possible override methods anymore. base class have call sub method explicitly, example using reference base instance. class base(metaclass=invertedinheritance): def apply(self, param): print('validate parameter') result = self.subclass.apply(param) print('validate result') return result class child(base): def apply(self, param): print('compute') result = 42 * param return result child = child() child.apply(2) with output: validate parameter compute validate result if care making lookups on instances go in reverse order (not classes), don't need metaclass. can override __getattribute__ : class reverselookup: def __getattribute__(self, attr): if attr.startswith(&#

unix - trying to connect to an openVMS server -

i running unix based virtual machine , trying write script connect specific openvms server. i don't know why ,but became more difficult discovered that: 1) don't have 'expect' command. 2) when use rlogin -l option , , enter username , server still asks username , asks password (even though supposed ask password). 3) when tried write temp file username , password , use following command : "rlogin server can please give me advice? try adding communication proxy unix user on vms server. tcpip> add proxy vmsuser /host=host /remote_user=unixuser for each host, sure define host name , aliases. or add host ip address. also see http://h71000.www7.hp.com/doc/83final/6526/6526pro_041.html#bottom_041

hide - Hiding Scrolling activity title in android studio -

Image
i have created scrolling activity. i want hide activity title (banglalink latest offers). but i want show activity title @ stage (banglalink latest offers). is possible do? if yes, how? your best bet convert normal activity (with scrollview child), start actionbar hidden (using hide() call below (put inside oncreate()). then put coloured backgroiund @ top of screen inside scrollview. finally, can programmatically toggle between hiding title (and actionbar), showing header background (or vice versa) when needed adding horizontal scroll listener/observer. the listener toggle actionbar , header view depending on how far user has scrolled down. e.g: add observer inside onstart(): hsv.getviewtreeobserver().addonscrollchangedlistener( new viewtreeobserver.onscrollchangedlistener() { @override public void onscrollchanged() { log.i(tag,"scroll:"+hsv.getscrollx());}}); // todo adjust scrollx value de

emokit - cmake source directory does not contain cmake lists -

i trying install emokit on ubuntu partition of macbook pro. step 48 in the instructions , when receive error: matt@mattsubuntu:~/downloads/emokit-master$ cmake . cmake error: source directory "/home/matt/downloads/emokit-master" not appear contain cmakelists.txt. specify --help usage, or press button on cmake gui. what can complete step? i'm 1 of maintainers of emokit. first off, you're running off personal fork, not main repo. main repo c code at http://github.com/openyou/emokit-c the python repo now http://github.com/openyou/emokit that changed in may 2016, it's recent deal. decided keep regular 'emokit' python because emokit users aren't touching c libraries. for other questions may have, file issues in emokit-c repo , i'll can, though i'm way behind on right now.

sql - Update and insert TSQL -

Image
how can modify tsql update statement below insert partid of source table not in partid field of item id ='500224' in destination table. if doesn't exist need insert. use [dbname]; go update m set [partid] = a.[partid] select * [sourcetable] m inner join [desttable] on m.[bomitem] = a.[itemid] , m.bomentry = a.bomentry , m.bomrev = a.rev m.bomrev=a.rev , m.partid <> a.partid , m.linenbr = a.bomentry ; go in source table in destination table for example in pictures above partid 100280 doesn't exist in destination table want add , keep others same. you can insert missing partid destination table, using left join null check. insert [desttable] (bomitem, bomrev, bomenty, linenbr, dtype, partid, revid, qty) select st.itemid, st.rev, st.bomenty, st.linenbr, 0 dtype, st.partid, null revid, st.qty [sourcetable] st left join [desttable] dt on dt.bomitem = st.itemid , dt.partid = st.partid , dt.bomr

mongodb - Problems adding data using onCreateUser() in Meteor -

i trying hook oncreateuser function accounts-password package add information collection when account created. have added piece of code server.js //server.js var shopdetails = { name = "", postcode = "", type = ""; opentime = "", closetime = "", phonenum = 0, dashboarddetails = false //until shop populates these fields createdby = user._id //_id taken function below } accounts.oncreateuser(function(options,user){ var userid = user._id; shoplist.insert(shopdetails); return user; }); the 2 collections have in app - shoplist = new mongo.collection("shoplist") //held in collections folder user collection comes bundled accounts-password once new user has created account, wanted insert object required fields (shopdetails) shoplist collection (for purpose of creating personal da

Couchbase Performance -

i have couchbase community edition v4, build 4047. seems great until started issuing queries against simple view. view projecting documents so, seems harmless: function (doc, meta) { if(doc.applicationid){ emit(doc.applicationid,meta.id); } } i'm using .net client connect , execute query application, though don't think matters. it's single node configuration. i'm clocking time in between actual http requests , queries taking between 4 seconds on 2 minutes if send 15 requests in @ time through fiddler. i using stale index try , boost time, doesn't seem have impact. bucket not large. there couple of documents in bucket. i've allocated 100m ram indexing. i'd think that's fine @ least few documents we're working @ moment. this local development, observing similar behaviors when promoted our servers. servers don't use significant amount of ram either, @ same time aren't storing significant amount of documents. we're ta

r - Density of each group of weighted geom_density sum to one -

how can group density plot , have density of each group sum one, when using weighted data? the ggplot2 geom_density() suggests hack using weighted data: dividing sum of weights. when grouped, means combined density of groups totals one. density of each group total one. i have found 2 clumsy ways this. first treat each group separate dataset: m <- ggplot() m + geom_density(data = movies[movies$action == 0, ], aes(rating, weight = votes/sum(votes)), fill=na, colour="black") + geom_density(data = movies[movies$action == 1, ], aes(rating, weight = votes/sum(votes)), fill=na, colour="blue") obvious disadvantages manual handling of factor levels , aesthetics. tried using windowing functionality of data.table package create new column total votes per action group, dividing instead: movies.dt <- data.table(movies) setkey(movies.dt, action) movies.dt[, votes.per.group := sum(votes), action] m <- ggplot(movies.dt, aes(x=rating, weight=votes/v

jquery - Convert HTML object back to string -

i convert string of html object can manipulate this var htmlstr = "<div><span>testing</span></div><h1>heading</h1><div class='two'>sjdufhs</div>"; var htmldom = $(htmlstr).find("h1").remove(); var newhtmlstr = ??? question: how can convert htmldom string after manipulation? i have tried following: https://stackoverflow.com/a/652771/3758078 converts first element found, , not rest. if theres no element containing other elements. you need save result of parsing html variable, can html after modifying it. you need wrap original html in element, because getting html later .html() return html of first element in collection. var htmlstr = "<div><span>testing</span></div><h1>heading</h1><div class='two'>sjdufhs</div>"; var dom = $('<div>' + htmlstr + '</div>'); dom.find("h1").remove();

Count results with MongoDB 3.0 Java Driver -

i want number of results of query. want know how users online in past 15 minutes. so, set connection with: mongoclient = new mongoclient("localhost", 3001); database = mongoclient.getdatabase("database1"); then in method collection , send query...: mongocollection<document> users = database.getcollection("users"); users.find(and(gte("lastlogin",xvminago),lte("lastlogin",now) i'm not sure if last step right. seems easy in javascript , .count()-opereration can't find in java. , documentation(s), weird , somehow diffrent. (i use mongodb java driver 3.0) use mongocollection's count() method, applying query filter makes use of datetime object joda-time library simplifies date manipulation in java. can check out here . create datetime object 15 minutes current time: datetime dt = new datetime(); datetime = new datetime(); datetime subtracted = dt.minusminutes(15); then use variables construct date