Posts

Showing posts from April, 2010

java.sql.SQLException Path to 'path' does not exist -

i writing because created simple login gui app test sqlite database student of database systems , new it, used java through eclipse, whenever run application message java.sql.sqlexception path c:user//path not exist error screenshot i have searched lot on google couldn't find solution there similar question on stackoverflow there not enough answer related problem, want know how change code make application work , connect database? any appreciated.thanks here code: package dbms; import java.sql.*; import javax.swing.*; public class dbconnection { connection conn = null; public static connection dbconnector(){ try{ class.forname("org.sqlite.jdbc"); connection conn = drivermanager.getconnection("jdbc:sqlite:‪‪‪c:\\users\\chusm\\workspace\\dbms\\sqlite\\dbms.sqlite"); joptionpane.showmessagedialog(null, "connection successful!!!"); return conn; } catch(exception e){ joptionpane.

Why does my Xcode 8 GM have 50+ Simulator versions to choose from? -

Image
how can fix this? have 2.5 full pages of this: go window -> devices. select simulators don't want , delete them (by hitting delete key, or right-clicking). you can un-select "show in run destinations menu" item (when right-click).

node.js - How to set a global object when I use cluster? -

i'm working in app express , socket.io. when started develop in app there not many information cluster. i'm trying implement cluster have problems this. i think problems can resolve global object can access cluster. so, questions two: there way create global object access values cluster? there way modify values of global object , value in cluster? thank you! so there can 2 approaches external storage : in cluster mode multiple processes act clusters , not recommend sharing global object , managing sessions keep these objects in sync between processes. recommend using redis or similar database (recommend redis quick , suites use case) global objects : yes, can create/modify objects copy of object in each process , have keep objects in sync. can use process.send() process , worker.send() workers master process. option see using libraries same : memored npm module or strongloops strong store cluster i prefer keeping process independent , use com

angularjs - Access Angular scope of controller in nested partial -

in angular project each page has controller. include partial used on multiple pages. in each controller initialize values access them inside partial. $scope.checkeditems = []; the in partial bind data it. <input type="checkbox" checklist-model="$parent.$parent.$parent.$parent.$parent.checkeditems" checklist-value="item.id"> the partial nested have use $parent multiple times access parameter within controller's scope. ugly. also, partial included in different places on different pages, scope depth isn't consistent. therefore on pages need go 5 levels, 8 levels, 4 levels, etc. is there easier way access controller's scope? it'd great if following worked. <input type="checkbox" checklist-model="$controllerscope.checkeditems" checklist-value="item.id"> create 1 service data exchange between controllers nested tree option in service create object parent->child structure,

php - Select as total columns in a table based on the same ID -

i working on website (php , mysql) - involves management cpanel (database) of phone products. i have issues on page, want display results: my actual code is: <table data-order='[[0, "desc"]]' id="datatable-buttons" class="table table-hover m-0 table-bordered"> <thead> <tr> <th>entry id</th> <th>producer</th> <th>model</th> <th>date</th> <th>total sum</th> <th>expenses</th> <th>profit</th> </tr> </thead> <tbody> <?php $result = mysql_query("select receptie.id , receptie.marca_tel , receptie.model , receptie.data_primire , articole_service.pret_sol

javascript - Create new view at "Admin Dashboard" Template from ExtJs 6 -

i'm starting extjs 6 . i installed "admin dashboard" template in application , i'm having trouble creating new menu item , see opens up. which steps need add item without build application , avoid "[ext.create] unrecognized class name / alias: widget. [...]" error ? well, extjs has pretty long learning curve, has pretty documentation , tutorials. should check out core concepts , architecture , tutorial putting aside, seeing [ext.create] unrecognized class name / alias: widget. [...] error, because ext can't find class want create. every time want create class using ext.create("my_app.view.my_class") should make sure javascript file containing my_app.view.my_class gets loaded. usually can use requires in application.js or view/main.js load js file ext.define('my_app.view.main', { extend: 'ext.window.window', requires: ['my_app.view.my_class'], xtype: 'mainview' }); plea

android - IBM Mobilefirst 7.0 - JSONStore Error during provision cannot locate symbol "CBB_add_u16" -

i'm deploying app built ibm mobilefirst platform studio v 7.0.0.00.20160526-2153 on android 7 - nexus 5 (aosp_hammerhead-userdbug 7.0 nrd90m) , it's tracing next error related jsonstore: 09-12 14:19:39.761 17860-17902/com.myapp.mobileapp e/jsonstore: jsonstorelogger.logerror in jsonstorelogger.java:189 :: error during provision java.lang.unsatisfiedlinkerror: dlopen failed: cannot locate symbol "cbb_add_u16" referenced "/system/lib/libssl.so"... @ java.lang.runtime.loadlibrary0(runtime.java:977) @ java.lang.system.loadlibrary(system.java:1530) @ net.sqlcipher.database.sqlitedatabase.loadlibs(sqlitedatabase.java:143)

Ruby: rake:22: undefined method `activate_bin_path' for Gem:Module (NoMethodError) -

i had problems in ruby 1.8.7-p374. when try run "rake db:migrate" got error: rubygems installed following executables: /home/wellington/.rbenv/versions/1.8.7-p374/bin/gem rubygems system software updated /home/wellington/.rbenv/versions/1.8.7-p374/bin/rake:22: undefined method `activate_bin_path' gem:module (nomethoderror) its occurs on deploy rails apps. any ideas solve this? i resolved updating gem , bundler gem update --system gem update bundler

Google Tag Manager and sending data offline -

i have question following case. want track content platform using google tag manager. however, not every time platform online gtm send data our internal server. therefore our concern if data collected during offline period kept or if loose them. know if there period during data collected offline through google tag manager kept , once gets online sent google analytics? thank you, lukas no, not how google tag manager works. gtm web javascript injection engine. bundles configured tags,triggers , variables selector engine , injects page. there no serverside component stores data. i'm sure 1 come solution problem - e.g. store data localstorage in browser, poll server see if available, , when it's online send data queue time parameter google analytics. has nothing gtm. having said this, hard understand use case - if server offline, data come ?

r - Why is as.Date is being returned as type 'double'? -

i'm having trouble working as.date function in r. have vector of dates i'm reading in .csv file coming in factor of integers or character (depending on how read in file, doesn't seem have issue), formatted %m/%d/%y . i'm going through file row row, pulling out date field , trying convert use elsewhere using following code: tmpdtm<-as.date(as.character(tempdf$mydate), "%m/%d/%y") this seems give me want, example, if starting value of 12/30/2014, value "2014-12-30" returned. however, if examine value using typeof() , r tells me data type 'double'. additionally, if try bind other values , store in data frame using c() or cbind() , in data frame, winds being stored 16434, looks me sort of different internal storage value of date. i'm pretty sure that's because if try convert value again using as.date() , throws error asking origin. so, 2 questions: expected? if so, there more appropriate way convert date end date-t

apache pig - Pig calculating avg of delay fails -

i have file airplanes data, having airplane dest , delay(delay can negative or positve number) a = load ‘flightdelays’ using pigstorage(‘,’); b = foreach generate $14 delay:int, $17 dest:chararray; c = group b all; -- failing cast error, error failed read data input file.. d =foreach c generate b.dest, avg(b.delay); when execute , 0 records read source file , mapreduce job failed.. why not able calculate avg? check extension/path of file.is file comma separated? also,there plenty of case issues script. pigstorage - s small in load statement. a = load ‘flightdelays’ using pigstorage(‘,’); b = foreach generate $14 delay:int, $17 dest:chararray; there no relation called a,b,c.you loading data relation , on.

html - How to resize an element to full viewable height -

Image
i'm attempting make div resizes full page height, between header , footer. don't want there scrolling on page, i've looked around , can't find solution has worked me. here picture of webpage. i want black bordered box expand way down drawn red line, no matter zoom ratio on browser. width works, cannot life of me height. here code: <div class="row" style="height:100%;"> <div class="col-md-2" style="border:1px solid black;"> <div class="panel panel-success"> <div class="panel-heading"> <h3 class="panel-title">links</h3> </div> <div class="panel-body"> panel content </div> </div> </div> <div class="col-md-10" style="border:1px solid black"> <div class="panel panel-prim

go - How to fix delve "can't load package: package internal" error -

so installed vscode on windows machine main golang ide , guess overall lack of go knowledge making me experience seemingly unsolvable error: installed delve , wanted use debugger in vscode-go. did mentioned in readme on https://github.com/microsoft/vscode-go , yet reason when run dlv debug error "can't load package: package internal: no buildable go source files in c:\go\src\internal exit status 1". couldn't find related folder on internet, have never myself entered path src/internal in of config files. making me confused, since thought if common folder should have atleast gotten same error once. it occurs both in vscode , in command prompt, if dlv test run. know not issue folder structure/env variables since complains package files missing if remove them in addition giving same c:\go\src\internal error. seems if there setting somewhere check folder source files too, can't find setting , dlv debug crashes after giving me error. got same issue late

javascript - Calculation with jQuery accordion slider plugin writing -

i'm trying write jquery plugin making accordion. all items inside container need reduce width items shown on 1 line. on item hover, rest of items should reduce width hover item shown @ original width. the error occurs when trying initial set items: last item disappears. math is: slider-width / all-items-width and then: each-item * (slider-width / all-items-width) what calculating wrong? jquery(function($) { $.fn.shadeaccordion = function(elmwrap, sliderh) { var $this = $(this), //get slider countiner slider = $this, sliderwidth = slider.width(), // slider should inherit parent witdth thumba = slider.find('a'), // images should wrap tag thumbmount = thumba.length, // count number of images thumbimg = thumba.find('img'); // find acctual imgaes var imgaeswidth = 0; thumbimg.each(function(index, el) { imgaeswidth += $(el).width(); }); console.log(imgaeswidth); var margineach = sliderwidth / imgaeswidth; console.log(margineach); //som

while loop - Powershell Multijob script. Make file open when job completes instead of waiting until all jobs complete -

i'm writing script ping multiple sites , open file show results. results open finish. instead waits until jobs finished before opening files. i've had issues open of files. appreciated $count = 500 $sites = "www.google.com","8.8.8.8","127.0.0.1" foreach ($site in $sites) { remove-item "c:\wfsupport\self service tool\$site.txt" start-job -name $site -scriptblock { param ($count,$site) ping -n $count $site } -argumentlist $count, $site } while ((get-job).state -match 'running') { foreach ($job in get-job | {$_.hasmoredata}) { $jobname = $job.name receive-job $job | out-file -encoding ascii -append "c:\wfsupport\self service tool\$jobname.txt" } start-sleep -seconds 10 } while ((get-job).state -match 'completed') { foreach ($job in get-job | {$_.hasmoredata}) { $jobname = $job.name receive-job $job | out-file -encoding ascii -append "c:\wfsupport\self service tool\$jobname.txt" invoke-it

javascript - How to send data to MongoDB that is calculated after page loads? -

i using node.js express , mongodb. i have page, '/score' calculates user's score quiz taken on previous page. '/score' route below: app.get('/score', stormpath.getuser, function(req, res) { var quiz = req.session.mostrecentquiz; db.collection('quizzes').find(quiz).toarray(function (err, docs) { assert.equal(err, null); var quiz; docs.foreach(function (doc) { quiz = doc.quiz; }); res.render('score', {quiz: quiz}); }); db.collection('users').update({user: req.user.username}, { $set: {"mostrecentquiz": quiz } }, function (err, result) { if (err) throw err; console.log(result); } ); }); after getting quiz answers db, use client-side javascript on /score page calculate user's score , report user. however, same score mongodb, not sure how best accomplish that. can use ajax accomplish this, or better redirect new page?

Piping in my own C shell -

i've implemented beginning of c shell below. far have redirection working, , thought implement | in similar way having difficulty. can help? begin checking pipe operator, saving sa[i-1] , sa[i+1] 2 separate commands, i'm not sure how fork() , exec() after this. int startprocess (stringarray sa) { int pid; int status; int fd1; int fd2; int current_in; int current_out; int fd0; int fd00; int in = 0; int out = 0; char input[64]=""; char output[64]=""; char cmd1[64] =""; char cmd2[64] =""; int fd[2]; int pipe = 0; switch( pid = fork()){ case -1://this error perror("failure of child."); return 1; case 0: // child // redirection /* finds '<' or '>' occurs , make sa[i] = null , ensure command wont' read that*/ for(int i=0;sa[i]!='\0';i++) { if(strcmp(sa[i],"<")==0) { sa[i]=null

scala - How to model enum types in phantom dsl? -

my case class contains enum parameter follows: case class user(role: userrole.userrole, name: string) object userrole extends enumeration { type userrole = value val admin, user = value } how model case in example: https://github.com/thiagoandrade6/cassandra-phantom/blob/master/src/main/scala/com/cassandra/phantom/modeling/model/genericsongsmodel.scala ? any code samples provided helpful. you need use enumcolumn , created reason. if want use enum key, need create primitive using default helper methods. you can use both flavours of defining enum. object records extends enumeration { type records = value val typeone, typetwo, typethree = value } object namedrecords extends enumeration { type namedrecords = value val 1 = value("one") val 2 = value("two") } object enum extends enumcolumn[records.type](this, records) in case be: object role extends enumcolumn[userrole.type](this, userrole) to use index, need: implicit val

c# - Saving an arbitrary array of bytes as a string -

i've got bunch of data need serialized string stored in kvp. i've got tons of ints , bools , , floats . take each one, bitconverter byte[] buffer.blockcopying single large byte[] . i need save large array of bytes string in keyvaluepair<string, string> . tried using encoding.ascii.getstring() big byte[] created, , tried reload level string code achieved using encoding.ascii.getbytes() . m_levelcode = encoding.ascii.getstring( bytes ); the array of bytes has tons of 0's, i'm guessing that's why m_levelcode string empty string. is there better approach i'm trying do? have 650 bytes worth of integers , booleans , , floats . need them saved string. 1 step further, i'd comma separate 5 of these single kvp conserve on individual keys since every area has 5 levels. there many ways convert bytes string string base64 = convert.tobase64string(bytes); string hex = bitconverter.tostring(bytes); var jss = new javascriptserializer(); st

c++ - Calling QueryInterface with custom identity -

issue: i call cosetproxyblanket on proxy (if that's right term it) , call queryinterface on same proxy, receive result of 0x80070005 ("access denied"). however, if first call coinitializesecurity (which trying avoid) same credentials call succeeds. question: how can interface need without having call coinitializesecurity? understand, process can call method once not compatible making dll , can substituted calls cosetproxyblanket. details: i experimenting building own opc client can communicate computers running on different domains without matching user accounts. first, create identity structure domain, username, , password valid on server: coauthinfo authinfo; coauthidentity authidentity; authidentity.domain = (unsigned short *) w_domain; authidentity.domainlength = wcslen( w_domain); authidentity.flags = sec_winnt_auth_identity_unicode; authidentity.password = (unsigned short *) w_password; authidentity

installation - Python 3.x - How to get the directory where user installed package -

suppose building python package following folder tree: main |-- setup.py |-- the_package |--globar_vars.py |--the_main_script.py when user performs anyway install it, like: sudo python setup.py install python setup.py install --user python setup.py install --prefix=/usr/local or well, using pip: pip install 'someproject' i want folder package installed saved on global_vars.py , in variable, eg: globarl_vars.py #!/usr/bin/env python3 user_installed_pkg = '/some/path/where/the/package/was/installed' there someway it? in advance. assuming someproject package well-formed python package (which can done using setuptools ), user can derive location use pkg_resources module provided setuptools package information. example: >>> pkg_resources import working_set >>> pkg_resources import requirement >>> working_set.find(requirement.parse('requests')) requests 2.2.1 (/usr/lib/python3/dist-packages) >

json - Firebase returning null for Data values in Android -

all data.getvalue() returning null. can child key return fine. can write firbase fine. data.getvalue returning null unknown reason. have other classes working fine using exact same format. //method retrieving info firebase has notifications private void retrieveinfo(){ firebase ref = new firebase("https://fitnectapp.firebaseio.com/"); // attach listener read data @ our posts reference ref.addchildeventlistener(new childeventlistener() { // retrieve new posts added database @override public void onchildadded(datasnapshot snapshot, string previouschildkey) { getupdates(snapshot); } @override public void onchildremoved(datasnapshot snapshot) { getupdates(snapshot); } @override public void onchildchanged(datasnapshot snapshot, string previouschildkey) { getupdates(snapshot); } @override public void onchildmoved(datasnapshot snapsho

Getting Access is denied while connecting with restful backend in Angular 2 -

i getting following error: "error: access denied.\r\n\n @ anonymous function (eval code:1343:17)\n @ observable.prototype.subscribe (eval code:52:9)\n @ observable.prototype._subscribe (eval code:109:9)\n @ mapoperator.prototype.call (eval code:54:9)\n @ observable.prototype.subscribe (eval code:52:9)\n @ observable.prototype._subscribe (eval code:109:9)\n @ catchoperator.prototype.call (eval code:29:9)\n @ observable.prototype.subscribe (eval code:52:9)\n @ searchcustomercomponent.prototype.onsearch (eval code:21:9)\n @ _view_searchcustomercomponent0.prototype._handle_ngsubmit_2_0 (function code:232:3)" here code: // searchcustomer.component.ts import { component, oninit } '@angular/core'; import { ngform } '@angular/forms'; import { customeracct } '../models/customer-acct'; import { customerservice } '../services/customer.service'; @component ({ selector: 'search-customer', templateurl: '

c - Free function fails -

i writing simple program in linux. purpose display gnu version number. seems free() function screams @ me. when execute program. shows following: * error in `./a.out': munmap_chunk(): invalid pointer: 0x00007fa89f028d8a * and backtrace , memory map. below code: # include <stdio.h> # include <gnu/libc-version.h> # include <string.h> # include <stdlib.h> int main(void){ const char *s; s = (const char *)malloc(16*sizeof(char)); s = gnu_get_libc_version(); printf("%s\n",s); free((char *)s); return 0; } you have lost pointer returned malloc moment reinitialized s return value of gnu_get_libc_version . trying free pointer returned gnu_get_libc_version has not been allocated malloc . you need not malloc before calling gnu_get_libc_version , not need free after calling it.

Forcing a terminal windowl of set size to open in C++ -

my question regards c++ , trying create window ensure output fit single line. way can think force window open upon running program , have output appear there. does know how this? i using xcode on mac. helps! the best can adjust code format line within bounds of terminal using. this, on osx, need use (and link) against termcap (short 'terminal capabilities') see this one .

PHP Curl site is responding javascript not enabled. How does it know? -

$curl = curl_init("http://example.com/"); curl_setopt($curl, curlopt_returntransfer, 1); curl_setopt($curl, curlopt_cookiejar, 'cookie.txt'); curl_setopt($curl, curlopt_httpheader, array("host: example.com", "connection: keep-alive", "upgrade-insecure-requests: 1", "user-agent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/52.0.2743.116 safari/537.36", "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "accept-language: en-us,en;q=0.8")); curl_setopt($curl, curlopt_verbose, true); $result = curl_exec ($curl); echo $result; the response <html><title>you being redirected...</title&

codenameone - Issues with Mirah -

i using mirah library in codename 1 object mapper between json , java classes. i running issue mirah trying map classes not declared in .mirah class. example .mirah class has data mapper product data_mapper product:productmapper but error complaining iuser interface , not product class! starter, don't understand why mirah complain class not declared datamapper. missing ? please keep in mind in current code, product has primitive data type variables , absolutely no reference iuser interface or user implementing class. nbproject\mirah-build-cn1.xml:152: java.lang.runtimeexception: not find stub interface iuser @ ca.weblite.asm.javaextendedstubcompiler$2.visitclass(javaextendedstubcompiler.java:694) @ com.sun.tools.javac.tree.jctree$jcclassdecl.accept(jctree.java:720) @ com.sun.source.util.treepathscanner.scan(treepathscanner.java:68) @ com.sun.source.util.treescanner.scan(treescanner.java:91) @ com.sun.source.util.treescanner.scanandred

cq5 - Unable to compile class for JSP: An error occurred at line: 31 in the jsp file: /libs/foundation/components/primary/cq/Page/proxy.jsp -

while accessing page .xml extension getting error org.apache.sling.scripting.jsp.jasper.jasperexception: unable compile class jsp: an error occurred @ line: 31 in jsp file: /libs/foundation/components/primary/cq/page/proxy.jsp type java.lang.charsequence cannot resolved. indirectly referenced required .class files

php - Recursive function in Laravel 5.2 -

i want make recursive function , pass view build category, sub-category in laravel 5.2 , how create route , view , contrller code ..... code ..can me ? <?php mysql_connect('localhost', 'root','123'); mysql_select_db('test'); $qry="select * treeview_items"; $result=mysql_query($qry); $arraycategories = array(); while($row = mysql_fetch_assoc($result)) { $arraycategories[$row['id']] = array("parent_id" => $row['parent_id'], "name" =>$row['name']); } function createtree($array, $currentparent, $currlevel = 0, $prevlevel = -1) { foreach ($array $categoryid => $category) { if ($currentparent == $category['parent_id']) { if ($currlevel > $prevlevel) echo " <ul class='tree'> "; if ($currlevel == $prevlevel) echo " </li> "; echo '<li>

node.js - angular-cli@webpack with primeng 404 issues -

i following errors in starter project angular2, angular-cli@webpack , primeng. ui component primeng dropdown renders , has values no css theme applied ever.(see errors below in regards css). not sure why error , have spent countless hours no result @ loss @ point. component generated ng command , ng serve runs web server. idea? have tried both node.js 6.5.0 , 4.5.0 (switching , managing them nvm). any appreciated deeply. failed load resource: server responded status of 404 (not found) http://localhost:3000/node_modules/primeng/resources/primeng.min.css failed load resource: server responded status of 404 (not found) http://localhost:3000/src/app/resources/css/font-awesome-4.6.3/css/font-awesome.min.css failed load resource: server responded status of 404 (not found) http://localhost:3000/node_modules/primeui/primeui-ng-all.min.css failed load resource: server responded status of 404 by way posted code in: https://github.com/greghila/primeng-angular-cl

python - Celery worker not reconnecting on network change/IP Change -

i deployed celery tasks need performed @ workplace. these tasks huge , bought few high-spec machines performing these. before detail issue, let me brief i've deployed: rabbitmq broker on remote server producer pushes tasks on remote server workers @ 3 machines deployed @ workplace now, when started whole process smooth tested , process great! the problem unfortunately, forgot consult network guy fixed ip address, , per our location, not have fixed ip address our isp. celery workers upon network disconnect freeze , nothing. when network running, because ip address changed, , connection broker not being recreated or worker not retrying connection. have tried configuration broker_connection_max_retries = 0 , broker_heartbeat = 10 . had no option post out here , experts on matter! ps: cannot restart workers manually everytime network changes ip address kill -9

python - Shape of numpy array is changing while saving the data -

i've defined following arrays: self._list = np.zeros((1, 180)) in init method of class and lidar_data = np.zeros((1, 180)) in call method of same class call method called indefinitely. i save data lidar sensor , analyze i'm doing, self._list = np.vstack((self._list, lidar_data[none, :])) when print lidar_data.shape , comes (1, 180) when self._list = np.vstack((self._list, lidar_data[none, :])) is commented out, when not commented, lidar_data.shape comes out (1, 0) and because of i'm unable save data , following error file "/usr/local/lib/python2.7/dist-packages/numpy/core/shape_base.py", line 230, in vstack return _nx.concatenate([atleast_2d(_m) _m in tup], 0) valueerror: input array dimensions except concatenation axis must match why value of lidar_data.shape changing? better way of saving data this? edit: though lidar_data has shape of (1, 180) initially, after data taken it's shape (180, ) doing lidar_data[

android - Ads Mob Sdk updation in eclipse -

i received email google on 17th oct on-wards stop displaying ads methods got deprecated.i studied on links follows :- https://firebase.google.com/docs/admob/android/quick-start https://github.com/googleads/googleads-mobile-android-examples the above github link , sample provided google new sdk , android -studio , applications in market past 2 years. need migrate whole project android studio ? or there way updation in eclipse ? i found link states if using google play services version higher 4 our ads not effected google here link :- upgrade android google mobile ads sdk ensure ads keep serving here google play service version detail :- android:versioncode="5089000" android:versionname="5.0.89-000" method using ads :- private void getads() { try { adrequest adrequest = new adrequest.builder() .addtestdevice(adrequest.device_id_emulator) .addtestdevice("").build(); adview.loadad(ad

r - Horizontal barplot labels overlapping on each other -

i using dataset create horizontal in horizontal orientation. similar has been proposed solution in r: how can make barplot labels parallel (horizontal) bars . however, number of labels in y axis of horizontal barplot chart little many (due problem in hand) , hence, overlapping on each other. is there way preserve barplot bin size , show subset of y labels in horizontal orientation of barplot? thanks, rajat here's 1 way it, can use nice solution interleave names data blanks: generate data set.seed(123) df1 <- data.frame(x = replicate(50, paste(sample(letters, 2, replace = t), collapse = '')), y = sample(1:10, 50, replace = t), stringsasfactors = false) make barplot, using subset of names barplot(df1$y, names.arg = c(rbind(df1$x, rep('', 50)))[1:50], horiz = t, las = 1) the main trick names.arg = c(rbind(df1$x, rep('',50)))[1:50] line. interleaves blanks between names data. effectively, replacing half of name

python - How do I test multiple variables against a value? -

i'm trying make function compare multiple variables integer , output string of 3 letters. wondering if there way translate python. say: x = 0 y = 1 z = 3 mylist = [] if x or y or z == 0 : mylist.append("c") if x or y or z == 1 : mylist.append("d") if x or y or z == 2 : mylist.append("e") if x or y or z == 3 : mylist.append("f") which return list of ["c", "d", "f"] is possible? you misunderstand how boolean expressions work; don't work english sentence , guess talking same comparison names here. looking for: if x == 1 or y == 1 or z == 1: x , y otherwise evaluated on own ( false if 0 , true otherwise). you can shorten to: if 1 in (x, y, z): or better still: if 1 in {x, y, z}: using set take advantage of constant-cost membership test ( in takes fixed amount of time whatever left-hand operand is). when use or , python sees each side of operator separat

php - HTTP Post with Header Fields and XML data in C# -

i new c# , want post http request 1 specific url along http headers , xml data. having php code don't know how write same in c#. php code bellow. $url ="https://datasend.getdata.com"; $session= $_request["session"]; $token= $_request["token"]; $xpost ="<envelope> <header> <version>1</version> <reqversion>1</reqversion> <tallyrequest>export</tallyrequest> <type>data</type> <id>tpgetcompanies</id> <sessionid>$session</sessionid> <token>$token</token> </header> <body> <desc> <staticvariables> <svinclude>connected</svinclude> </staticvariables> </desc> </body> </envelope>"; $headers = array(); $headers[] = 'id:tpgetcompanies'; $headers[] = 'source:mazenettech'; $headers[] = 'target: tns'; $headers[] = 'content-type:text/xml;charset=utf-8'; $headers[] =

c++ - an iterator for an abstract class -

i have abstract class, example class represents geometrical shape. have concrete classes inheriting shape , such rectangle , triangle. i iterate on points (another class) shape composed of, shape must supply interface it. iteration should in manner: for(point p : shapeobject){ ... code} but don't want shape class determine child class containers use. example, rectangle have std::array<point, 4> container while triangle have std::array<point, 3> container. so question here is, elegant c++ way this? a simple way solve "problem" * in particular case points stored in containers supporting random access iteration (such std::array or std::vector use plain pointers iterators: struct point {}; struct shape { typedef point* iterator; typedef const point* const_iterator; virtual iterator begin() = 0; virtual const_iterator begin() const = 0; virtual iterator end() = 0; virtual const_iterator end() const = 0; vir

bootstrap css: can i have reference from CDN and folder path both in a same page? -

i have reference of bootstrap files in html cdn: <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"> i have own custom css file reference in html folder path: <link rel="stylesheet" href="css/mystyles.css"> but seems style rules custom css file not working. illegal way of giving reference ? should proper way ? here own css style: .row-header { margin:0px auto; padding:0px auto; } .row-content { margin:0px auto; padding:50px 0px 50px 0px; border-bottom:1px ridge; min-height:400px; } .row-footer { backgroud-color:#afafaf; margin:0px auto; padding:20px 0px 20px 0px; } .jumbotron { padding:70px 30px 70px 30px; margin:0px auto; backgroud:#7986cb; color:floralwhite; } address { font-size:80%; margin:0px; color:#0f0f0f; } try html &l

java - RxJava: How to unit test that an Observable is observed on and subscribed on the right scheduler? -

i have following scenario: interface itemsrepository { observable<list<item>> getitems(); } class getitems { private scheduler ioscheduler; private scheduler mainscheduler; private itemsrepository itemsrepository; getitems(scheduler ioscheduler, scheduler mainscheduler, itemsrepository itemsrepository) { this.ioscheduler = ioscheduler; this.mainscheduler = mainscheduler; this.itemsrepository = itemsrepository; } observable execute(susbscriber subscriber) { return itemsrepository.getitems() .subscribeon(ioscheduler) .observeon(mainscheduler) .subscribe(subscriber); } } now want unit test subscribeon , observeon called using correct scheduler s. the way did writing 2 unit tests follows: @runwith(mockitojunitrunner.class) class getitemstest { private getitems getitems;

logging - Spring boot: How to pass variable from application-env.properties to another properties file? -

i have application-local.properties , application-dev.properties in spring boot following value: logging.level.file=info and in property file, log4j.properties, want above value based on running environment. tried use ${logging.level.file} , fail (empty string). how should it? this not easy. default, spring-boot comes logback configuration. however, there possibility activate log4j too, discussed in following thread: log4j.properties in spring boot .

ruby on rails - CarrierWave version path -

i have model catagory class category < activerecord::base mount_uploader :image, categoryimageuploader end i need save image name (id saved category) class categoryimageuploader < carrierwave::uploader::base include carrierwave::rmagick storage :file mounted: def store_dir #"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end def store_path(for_file = filename) "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}/#{for_file}" end version :small process resize_to_fit: [48, 48] def filename(uploaded_file = file) if uploaded_file.present? "small_#{model.id}.#{uploaded_file.extension}" end end end version :big process resize_to_fit: [200, 200] def filename(uploaded_file = file) if uploaded_file.present? "big_#{model.id}.#{uploaded_fil

android - How do i display a textview over a button with custom layout? -

Image
how display textview on custom button (that uses png res/drawable)? i trying create ui wearable square watch android wear. created custom backgrounds change of 2 buttons want layout consist of. when add textview layout, placed under button, , never visible. i have searched solutions, problem people using wrong layout. have tried both frame , relative layout, should both stack content on top of each other, doesn't. although use text field in button itself, rather have dedicated textview text written inside. can't figure out problem is. <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:id="@+id/textview" android:layout_width="wrap_content" android:l