Posts

Showing posts from September, 2010

css - Outlook email mysteriously prefixed with "i>>?" when sending an HTML file -

i have html file i'm going use microsoft outlook email. structure <html> <head> <title>my title </title> </head> <body> ... </body> </html> although i've experimented adding/subtracting doctype declarations, charset declarations, etc. problem email getting prefixed " i>>? " except raquo , upside-down question mark. can see screenshot here: http://i.stack.imgur.com/vamng.png html file looks fine in internet explorer , strange characters show when go "file->send" , preview email or when send email , receive it. any idea why or can experiment try , fix it? that looks utf-8 bom prefix. html files should not have prologs that.

css - Compass and SASS on complex project structure -

i'm developing angular application , i'm using following folder structure: . ├── app │   ├── assets │   │   ├── images │   │   │   ├── brands │   │   │   ├── coletaseletiva │   │   │   ├── quiz │   │   │   └── vidaemlem │   │   │   └── avatars │   │   ├── sass │   │   └── stylesheets │   ├── scripts │   │   └── controllers │   └── views │   └── coleta └── test └── spec └── controllers this yeoman angular generated project. the generated css come sass pointing files following path '/app/assets/...' , because config in @ project's root. my server starting app folder, call assets using /assets/... what should do? should place config.rb inside of app folder , change assets paths? my config.rb looks this: http_path = "/" css_dir = "app/assets/stylesheets" sass_dir = "app/assets/sass" images_dir = "app/assets/images" javascripts_dir = "app/assets/javascripts" relative_assets = true

Batch remove line from text file if word match from other text file -

i have 2 text files. 1 contains filename path before it. , other filename. want remove lines pathnames if filename match. can want files doesn't match in new created text file 3 so list1.txt has: c:\program files\folder1\enter c:\program files\folder1\numbers.txt c:\program files\folder1\files.jpg c:\program files\folder1\movies.jpg and list2.txt has: enter numbers.txt files.jpg outcome has in list3.txt c:\program files\folder1\movies.jpg you shoud read on findstr ( findstr /? command line). also, read what undocumented features , limitations of windows findstr command? . here simple batch script job. @echo off >"list2.txt.mod" (for /f "usebackq delims=|" %%f in ("list2.txt") echo \%%f) findstr /liveg:"list2.txt.mod" "list1.txt" >"list3.txt" del "list2.txt.mod" if change list2.txt like: \enter \numbers.txt \files.jpg then need following command line (no batch needed)

json - Possible bug in angular pristine -

my hope @ fault here , not angular. building dynamic form using ng-repeat , when call form scope tells me pristine true (even when it's not). looks plunker can handle form pristine not dynamic input pristine. have more complex code have boiled down below. results getting when type in "asdf" first input are: $scope.formname.$pristine = false;<br> $scope.formname.inputname.$modelvalue = "asdf";<br> $scope.formname.inputname.$pristine = true;<br> $scope.formname.inputname.$viewvalue = "asdf";<br> $scope.formname.inputname.$$rawmodelvalue = "asdf"; doesn't make sense how form pristine true input pristine false. here basic code: <html ng-app="app"> <head> <link rel="stylesheet" href="style.css"> <script data-semver="1.2.13" src="http://code.angularjs.org/1.2.13/angular.js" data-require="angular.js@1.2.x"></scrip

nlp - programmatically access IME -

is there way access japanese or chinese ime either command line or python? have linux/osx/win8 boxes, ever system exposes easiest accessible api fine. i'm experimenting building japanese kana-kanji conversion algorithm , establish baseline using existing tools. have collections of kana process. preferably along lines of $ ime jp "きしゃのきしゃがきしゃできしゃした" 貴社の記者が汽車で帰社した i've looked @ anthy, mozc , dbus on linux can't find anyway interact them via terminal or scripting (such python) anthy provides cli tool personally, prefer google's ime / mozc better results, perhaps helps. the source anthy ( sourceforge , file anthy-9100h.tar.gz ) includes simple cli program testing. download source file, extract it, run ./configure && make enter directory test contains binary anthy . default, reads test.txt , uses euc_jp encoding. simple test: input file test.txt *にほんごにゅうりょく *もももすももももものうち。 run (using iconv convert utf-8: ./anthy --

What's the container of a base docker image? -

i learning use docker. know each docker image build on base image doesn't have parent. then base image, can customize stuff via containers (maybe short life container) commit new image. so understand process this: base image -> container -> new image 1 -> container -> new image 2 however, inspect json data of base image. still can see has container's information: [{ "architecture": "amd64", "author": "", "comment": "", "config": { "attachstderr": false, "attachstdin": false, "attachstdout": false, "cmd": null, "cpushares": 0, "cpuset": "", "domainname": "", "entrypoint": null, "env": null, "exposedports": null, "hostname": "3f37dbc61890", "image": "", "labels": null,

c# - How to draw text of multiple sizes aligned on line with TextRenderer? -

Image
this question has answer here: how position of text baseline in label , numericupdown? 2 answers i have array of classes contains text , font. want draw text aligned on line independently on font size. thought can subtract font height y-positiontion of line , draw text on new position bit difficult because of top , bottom padding added text gdi. calculation works right, text floats somewhere in middle of rectangle should in. found out can set textformatflags nopadding helps left , right padding , text still floats above line. searching long time way rid of padding, didn't found this. code: public static void drawtextonline(string text, font font, graphics graphics, color color, int x, int dliney) { float uppery = dliney - getfontascent(font); point point = new point(x, (int)uppery); textrenderer.drawtext(graphics, text, font, p

How can I get rsync to show only error messages AND a summary? -

i use rsync backup few thousands of files , pipe output file. given number of files i'd see list of transfers had issues summary show completed. so, using -q flag displays nicely exception error only. using --stats shows helpful summary @ end. the problem cannot combine them because appears -q suppresses stats output. any ideas welcome. this did trick me : rsync -azh --stats <source> <destination>

salesforce - getting file from sfdc with mule -

Image
i need file sfdc , send ftp server. using mulesoft connect sfdc. i have seen below docs in sfdc, getting content , mapping , convert file. instead of this, need file directly sfdc , send file ftp or email. changes in future changed in sfdc no changes required in mulesoft code. sfdc connector edit: below thread reads content of attachment, , making required file format. but, trying directly reading file sfdc , load file local disk. i don't find operation in sfdc connector file sfdc. sfdc forum sfdc apis used read , write data salesforce objects. using soql. not understand statement "i need file sfdc not reading content". please explain? the following link list latest mule sfdc connector apis. metadata apis deals files instead of soql files used read/write model metadata. http://mulesoft.github.io/salesforce-connector/6.1.0/mule/sfdc-config.html

How to declare objects for nested form in rails 4 -

i'm approaching 2nd week of using rails, , have gotten structure of app complete (i think/hope). i'm building staff website charity, part of work collects , wipes computers (before sending them african schools!). i've set app have staff, computer, , wipe models / classes, , nested form wiping details inside form computer details. when create new computer, can enter wiping details without problem, , if edit wiping details of existing computer that has wiping details works great. when go add wiping details existing computer without wiping details following error: undefined method `staff=' nil:nilclass extracted source (around line #49): how correctly set computer.wipe.staff = current user. note edit or submit wiping details user must logged in. my models follows (ignoring irrelevant validations, etc): class staff < activerecord::base has_many :wipes before_save { self.staff_email = staff_email.downcase } validates :staff_name, presence: true, leng

angularjs - Unknown Provider when testing a modal dialog -

preface : i'm quite new angular , new unit-testing. gentle. i'm trying run unit tests on controller bootstrap modal window. when initiating modal passing through object called thisversion : function showsharedialog(thisversion){ var modalinstance = $modal.open({ templateurl: 'app/shares/views/shares-dialogue.tpl.html', controller: 'sharesctrl', resolve:{ thisversion:function(){ return thisversion; } } }); modalinstance.result.then(function (validated) { // .. more code }); } as shares controller instantiated calling method on thisversion thisversion.getlist('shares').then(function(result){ $scope.shares = result; }); thisversion being passed in controller dependency, , works expected. the issue, however, can't seem inject test suites. keep getting error error: [$injec

count number of missing values in netcdf file - R -

is there quick way know how many missing values in netcdf file? possibly using r. currently have hum<-nc_open("rhum.sig995.2008.nc") rhum<-ncvar_get(hum, "rhum") then manually missing value typing 'hum' , copy operation sum(abs(rhum - 9.96920996838687e+36) < -9.96920996838687e+36) is there more direct way, if have work hundreds of files? avoid copying , pasting missing value, , not sure kind of precision number should handled. my suggestion use excellent raster package: install.packages(raster) library(raster) r <- raster("rhum.sig995.2008.nc", var="rhum") nanum <- summary(r)[6]

ajax - Validaton in jquery boostrap modal, dont work correctly. I have press twice the button submit that happen the validation -

Image
i have boostrap modal laravel´s framework. when press event button. dont happened nothing, have press submit button twice validation happened i don't validation in language format. predefined in validation messages:{} @section('modal_body') @if($errors->any()) <div class='alert alert-danger'> <a href="#" class="close" data-dismiss="alert">&times;</a> @foreach($errors->all() $error) {{ $error }} <br/> @endforeach </div> @endif {{ form::open(array('id' =>'formuser-create', 'role' => 'form', 'class' => 'form-horizontal')) }} <div class="form-group"> {{ form::label('user', 'nombre de usuario', array('class' => 'col-md-4 control-label')) }} <div class="

powershell - Active Directory computers not contain certain group -

i have audit whole active directory domain computers software. find out old admin deployed audit software group 'audit_software'. goal find computers in domain dont have 'audit_software' membership. eg. 'audit_software' contain 2x computer accounts 'netbios_pc1' 'netbios_pc2' but whole domain have many more computer accounts without group. how use powershell find computer accounts in ad (all containers) without 'audit_software' group ?? enumerate members of group this: $group = get-adgroup -identity 'audit_software' $members = get-adgroupmember -identity $group | select -expand name then enumerate computers , filter name not in list: get-adcomputer -filter * | ? { $members -notcontains $_.name }

groovy - How to extend the behavior of a Gradle task for a new task type? -

i set few things few test tasks. more specifically, add few environment variables , few system properties, maybe few other things such "dependencies" or "workingdir". regular test task can this, task test1(type:test, dependson:[testprep,testprep1]){ workingdir testworkingpath systemproperty 'property','abs' environment.find { it.key ==~ /(?i)path/ }.value += (system.properties['path.separator'] + mylibpath) environment.ld_library_path = "/usr/lib64:/lib64:${mylibpath}:" + environment.ld_library_path } task test2(type:test, dependson:[testprep]){ workingdir testworkingpath systemproperty 'property','abs' environment.find { it.key ==~ /(?i)path/ }.value += (system.properties['path.separator'] + mylibpath) environment.ld_library_path = "/usr/lib64:/lib64:${mylibpath}:" + environment.ld_library_path systempropety 'newproperty','fdsjfkd

navigationbar - Steroids: NavigationBarButton displayed then vanished -

i'm new steroids , i'm trying display modal view button in native navigation bar (will use later side drawer). note: use of modal view doesn't require override potential existing button on left side. my view , content displayed nice navigationbarbutton "filtres". once view loaded navigation bar reloaded , navigation bar button disappears. any idea why happens , how fix it? here controller code: angular .module('profile-list') .controller('indexcontroller', function($scope, supersonic) { var drawerbutton = new supersonic.ui.navigationbarbutton({ title: "filtres", ontap: function(){ supersonic.logger.debug("click"); } }); var navigationbaroptions = { buttons: { left: [drawerbutton] } }; supersonic.ui.navigationbar.update(navigationbaroptions); });

hibernate - web application can't query from MySQL on server -

i have web application (jsf+hibernate) deployed on tomcat server tries connect mysql database on server, have added web app server ip allowed when connecting mysql server, when start app get 23:55:50,077 warn sqlexceptionhelper:144 - sql error: 1142, sqlstate: 42000 23:55:50,077 error sqlexceptionhelper:146 - select command denied user 'xxx'@'yyyy' table 'zzz' org.hibernate.exception.sqlgrammarexception: not extract resultset ... please note that, have given user privileges, can connect database net beans , query normally. running web application , mysql on local host, working fine. make sure have same database name locally , on remote server. database hosts add prefix or suffix database name in conflict have in hibernate.

c++ - Why does widget.resize() not work? -

my c++ code(use opencv , qt): face_detect::face_detect(qwidget *parent) : qwidget(parent) { imgwidget = new showwidget("d:\\sample.avi"); imgwidget->resize(qsize(640,480)); setwindowtitle(tr("face detection!")); facenumlabel = new qlabel(tr("face_num: ")); num = new qlabel; num->setframestyle(qframe::panel | qframe::sunken); imgsource = new qlabel(tr("image source: ")); vediobtn = new qpushbutton(tr("from vedio")); localimgbtn = new qpushbutton(tr("local image")); leftlayout = new qvboxlayout(); leftlayout->addwidget(imgwidget); leftlayout->addwidget(facenumlabel); leftlayout->addwidget(num); //leftlayout->addwidget(showimagelabel, 3, 0, 1, 2); rightlayout = new qvboxlayout(); rightlayout->addwidget(imgsource); rightlayout->addwidget(vediobtn); rightlayout->addwidget(localimgbtn); rightlayout->addwidget(imgsource); qhboxlayout *mainlayout = ne

scala - "too few argument lists for macro invocation" -

given following code: case class jetdim(dimension: int) { require(dimension > 0) } object jetdim { def build(dimension: int): int = macro jetdimmacro.apply } and macro calls: def apply(dimension: int): int = macro applyimpl def applyimpl(c: context)(dimension: c.expr[int]): c.expr[int] = ... i'm getting compile-time error: [error] few argument lists macro invocation [error] def build(dimension: int): int = macro jetdimmacro.apply why? the macro keyword takes method should have context parameter first parameter list (and many expr arguments in subsequent lists). in jetdim you're giving macro method has macro implementation. isn't valid syntax—you can't "nest" macro this. you'll need either call jetdimmacro.apply directly (as normal method call) in jetdim.build , or use macro jetdimmacro.applyimpl (which more want).

javascript - Bootstrap's Modal box - background doesn't fade out on show -

Image
i'm working on c# mvc application. i'm using twitter's bootstrap's modal boxes 'popup' window. has worked flawlessly in past, reason doesn't right now. result right shown below. don't mind blur, did that. naturally background supposed grey, faded out always, though reason doesn't right now. i've copy pasted code works elsewhere , changed values. double , triple checked make sure didn't make mistake somewhere, can't see it. i've pasted relevant code below. jquery gets loaded in layout file. partial view record <button id="btnaddnewsecurefolder" onclick="openthecreatewindow()" data-toggle="modal" data-target="#modal-new-secfolder" class="btn btn-md btn-default givemesomespace leavemealone">add secure folder</button> @*<button onclick="openthecreatewindow()" class="btn btn-md btn-default givemesomespace leavemealone" id="btnaddn

SAML 2 and ADFS 3.0 IDP - SSO Invalid Status Code First time Login - But succeeds every time after -

we encountering response has invalid status code urn:oasis:names:tc:saml:2.0:status:responder samlexception trying run spring saml sample application. idp adfs 3.0 server , sp uses self-signed url. following url of sp/app https://ec2-52-0-198-40.compute-1.amazonaws.com:8443/spring-security-saml2-sample/ the weird thing happens after authenticating @ idp - first time only. if try url second time, remembers successful login , redirects correctly app/sp. every attempt login after successful. global logout , local logout works too. but, if clear browser of cookies , history , try login again, "invalid status" problem appears first time around. , subsequent logins successful. @vladimír-schäfer : ideas why problem happening? much. one path worth trying make sure https certificate presented site trusted. i've seen cases when page used browsers confirm invalid certificate breaks data sent during saml sso - lead issue you're experiencing.

sort array and input it into another array in php -

this result of array when print it: print_r($frequency); result: array ( [a] => 1 [very] => 1 [nice] => 2 [to] => 3 [tot] => 1 [text] => 2 [something] => 1 [think] => 1 [about] => 1 [if] => 1 [you're] => 1 [into] => 1 ) i want order numbers , input words array. want array: newarray(to,nice,text,a,very,tot,something,think,about,if,your're,into) asort($frequency); sorts array it's value low high , keeps assosiation. i don't know part ne array, don't understand want in that.

javascript - Modal dialog box does not communicate with main HTA window -

i have javascript in hta looks this: var result = null; window.showmodaldialog("dialog.hta", window, "dialogheight:300px; dialogwidth:300px"); alert(result); dialog.hta: <html> <head> <title>dialog box</title> <meta http-equiv="msthemecompatible" content="yes"/> </head> <body style="background:#f0f0f0"> <select id="colors"> <option selected>red</option> <option>blue</option> <option>green</option> <option>yellow</option> </select><br/> <script type="text/javascript"> function ok(){ window.dialogarguments.result = colors.getelementsbytagname("option")[colors.selectedindex].innerhtml; window.close(); } </script> <button onclick="ok()">ok</b

javascript - why is this chrome.browserAction.setIcon method not working? -

i'm looking @ documentation page , can't figure out whats wrong in code: chrome.browseraction.seticon({ details.imagedata = { "48": "icons/iconfavorite48x.png", "64": "icons/iconfavorite64x.png", "128": "icons/iconfavorite128x.png" } }); the documentaion says : note 'details.imagedata = foo' equivalent 'details.imagedata = {'19': foo}' so i'm extremely confused your code big syntax error. javascript object literal expects list of pairs key: value . can't (and don't need) assignments there in key part. so, fixing only syntax error, be: // still wrong: chrome.browseraction.seticon({ imagedata : { "48": "icons/iconfavorite48x.png", "64": "icons/iconfavorite64x.png", "128": "icons/iconfavorite128x.png" } }); this fail. imagedata expects binary blobs of pixel da

c# - ListView MouseClick event not triggered when clicking on empty areas -

i have listview control shows files inside folder in grid layout. , have context menu 3 items should behave this: if user right clicks on file in listview context menu show 3 items if user right clicks on empty space in listview first item of context view should invisible. this add events , code mouseclick event of listview : this.listviewfiles.mouseclick += new system.windows.forms.mouseeventhandler(this.listviewfiles_mouseclick); private void listviewfiles_mouseclick(object sender, mouseeventargs e) { if (e.button == mousebuttons.right) { if (listviewfiles.focuseditem.bounds.contains(e.location) == true) { contextmenufileslistbox.items[0].visible = false; contextmenufileslistbox.items[1].visible = false; } else { contextmenufileslistbox.items[0].visible = true; contextmenufileslistbox.items[1].visible = true;

jsf - How to pass selected column values to a method? -

i need in passing selected row columns' values in <p:datatable> method. in code, getting incorrect values , of them null, can please help. my datatable code is: <p:datatable id="pendingrequests" var="hr" value="#{hrd.pendingrequests}"> <p:column headertext="request date"> <h:outputtext value="#{hr.requestdate}"/> </p:column> <p:column headertext="request no."> <h:outputtext value="#{hr.reqno}"/> </p:column> <p:column headertext="employee code"> <h:outputtext value="#{hr.employeecode}"/> </p:column> <p:column> <f:facet name="header">view</f:facet> <p:lightbox style="align:center;" iframe="true" width="1200px" height="600px"> <h:outputlink value="#{hr.link}&q

ios - Detect active interface controller in WatchKit app? -

i've built watchkit app hierarchical structure can receive actionable push notifications. when notification comes in, action push 1 particular interface controller user can view without having drill down through menus. apple's documentation on handleactionwithidentifier:forremotenotification: states method called on initial interface controller, code handling remote notification in initial interface controller looks this: override func handleactionwithidentifier(identifier: string?, forremotenotification remotenotification: [nsobject : anyobject]) { if let notificationidentifier = identifier { if notificationidentifier == "myactionidentifier" { pushcontrollerwithname("myactioncontroller", context: nil) } } } however, problem is, if user viewing myactioncontroller , had suspended app, , later notification comes in , action taken, app push same myactioncontroller onto stack again. when user taps "back"

java - Are multiple 'if' statements and 'if-else-if' statements the same for mutually exclusive conditions? -

is there difference between writing multiple if statements , if-else-if statements ? when tried write program multiple if statements, did not give expected results, worked if-else-if . the conditions mutually exclusive. when write multiple if statements, it's possible more 1 of them evaluated true, since statements independent of each other. when write single if else-if else-if ... else statement, 1 condition can evaluated true (once first condition evaluates true found, next else-if conditions skipped). you can make multiple if statements behave single if else-if .. else statement if each of condition blocks breaks out of block contains if statements (for example, returning method or breaking loop). for example : public void foo (int x) { if (x>5) { ... return; } if (x>7) { ... return; } } will have same behavior : public void foo (int x) { if (x>5) { ... } else if (x>7)

css - jQuery tabs - content appearing outside the tab border -

Image
update: need use ie8. i want put div's inside jquery tab. content appearing it's outside of tab border: i've tried removing border #tabs {border: none} works i'd rather border there. this html page (stripped down): <div class="ui-widget"> <!-- tabs --> <h2 class="demoheaders"> codes</h2> <div id="tabs"> <ul> <li><a href="#tabs-1">gt2</a></li> <li><a href="#tabs-2">gt3</a></li> <li><a href="#tabs-3">gt4</a></li> </ul> <div id="tabs-1"> <div id="container"> <div id="questionactions"> phasellus mattis tincidunt nibh. cras orci urna, bl </div> <!-------------------------------

How to check if string contains a part of an array in Ruby? -

i have array of banned words in ruby: bw = ["test"] i want check @nick against it. for example @nick = 'justatest' would match. i have tried: if @nick.include?(bw) ## end but doesn't seem right way doesn't catch it. if concern check (as question's title suggests) then: > bw.any? { |word| @nick[word] } => true though might faster convert array of strings regexp: > bw = ["test", "just", "gagan"] > g = /#{bw.join("|")}/ > g === @nick => true

sql server - SQL INNER JOIN - Column name in join is also in select *error* -

i'm still pretty new sql , having issues. using variation of classic northwind database. using microsoft sql server management studio. here problem: /* join products , productvendors display product, product number, average wholesale price, , average retail price. */ here's i've got: select products.productnumber [product number], cast(avg(wholesaleprice) decimal (8,2)) [average wholesale price], cast(avg(retailprice) decimal (8,2)) [average retail price] products inner join productvendors on products.productnumber = productvendors.productnumber here's error get: msg 8120, level 16, state 1, line 2 column 'products.productnumber' invalid in select list because not contained in either aggregate function or group clause. exception text self-explanatory. since you're using aggregate functions ( avg in case) have group products.productnumber too. select products.productnumber aa [product number],

Grails design pattern for parallel queries using dynamic finders -

problem: we're querying our database lot of entries. overall application performance okay. think better if our bottleneck, querying special table, done parallel. we using dynamic finders like: object.findallbyobjectcollectionandparentisnullanddeletedbyuserisnull(objectcollection, [sort: 'attr1.number', fetch: [objecttype: 'eager']]) i think solution: dividing query 2 steps. the first step loads ids in sorted way. the second step ( could done in parallel threads ) loads objects id , inserts resultset. i googled hints that, find nothing. is possible, makes no sense? or there adequate solution in grails standard/extensions? if makes sense , there no solution: can give me hint implementing it? but, need ids in sorted manner, explained in example. we're using grails 2.3.11, hibernate:3.6.10.13 jdk 1.7 under it. i found solution! arraylist<long> objectids = attribute.executequery("select o.id object o, objecttype ot o.obj

javascript - Angular services issue -

i need understand wrong in following angular service code. edit: have few controllers in different js files use crud api like $http.get('/api/sites/' + service.siteid) or need variables directive like templateurl: '../../' + service.template + ' + '.html' so create service share variables between js file instead of making api call in each file. here service app.service('shareddata', function($http) { $http.get('config.json') .success (function(data) { var siteid = data._id; console.log(siteid); // return 553e2d15f91e4bd75d000008 $http.get('/api/sites/' + siteid) .success(function(site) { var template = site.template; console.log(template); // return mytemplate }) .error(function(data) { console.log('error: ' + data); }) }) .error(function(data) { console.log('er

ms access - Open Report based on text field -

i have form button , text box other data. need open report calculated fields based on value entered in text box when button pressed. when user enters value text box open report fields value. currently using private sub command11_click() docmd.openreport "mileage", acviewpreview, , "truck #" & me.frmtruck.value & "'" end sub this work if did not try find text box on opened report named truck #(enteredvalue) sure missing since have done before can't place on how filter based on text box. assuming record source of report includes field named truck # , enclose name in square brackets when create wherecondition option openreport , ie [truck #] then, if datatype of field numeric ... docmd.openreport "mileage", acviewpreview, , "[truck #] = " & me.frmtruck.value or if datatype text ... docmd.openreport "mileage", acviewpreview, , "[truck #] = '" & me.frmtruck.value

dart - Removing empty lines while reading a file in Dartlang -

i have file like: a b c d both readaslines() , readasstring() + string.split('\n') give me: [a, b, , , c, d] what smartest way get? [a,b,c,d] one possibility be: import 'dart:io'; main() { file f = new file('test.txt'); f.readaslines().then((list<string> lines) { print(lines.where((string s) => s.isnotempty)); }); }

httpresponse - How to send parameters with url and get response in android -

i performing login task , getting data php server in json format. in response, getting 'success' tag containing user-id like {"message":"you have been login","success":"75"} i value "uid" in same activity , move next page. in next page, want check user profile. that, have pass "uid" 'params' url , value server. don't understand how that. in next activity page creating asynctask perform action. protected string doinbackground(string... args) { // building parameters list<namevaluepair> params = new arraylist<namevaluepair>(); // getting json string url jsonobject json = jsonparser.makehttprequest(profile_url, "get",params); // check log cat json reponse log.d("profile json: ", json.tostring()); try { // profile json object profile = json.getjsonobject(tag_profile); } catch

java - How to add raw XML text to SOAPBody element -

i have xml text generated application, , need wrap soap envelope around , later make web service call. the following code builds envelope, don't know how add existing xml data soapbody element. string rawxml = "<some-data><some-data-item>1</some-data-item></some-data>"; // start api messagefactory mf = messagefactory.newinstance(); soapmessage request = mf.createmessage(); soappart part = request.getsoappart(); soapenvelope env = part.getenvelope(); // body. how add raw xml directly body? soapbody body = env.getbody(); i have tried body.addtextnode() adds content < , others escaped. the following adds xml document: document document = convertstringtodocument(rawxml); body.adddocument(document); document creation: private static document convertstringtodocument(string xmlstr) { documentbuilderfactory factory = documentbuilderfactory.newinstance(); documentbuilder builder; t

openid - Skip IdentityServer3 login screen -

Image
we have configured client app use identityserver3 authentication via openid connect protocol (it's asp.net mvc app uses owin middleware support oidc). the identityserver3 configured use both local login , external login (azure ad, instance). in regular flow once app need authenticate user redirects him identityserver3 login screen - it's fine. in cases, on per-request basis, want bypass login screen somehow letting identityserver3 know user want login specific external identity provider right away. is possible do? just found solution in identityserver3's authorization/authentication endpoint documentation ! acr_values (optional) allows pass additional authentication related information user service - there values special meaning: idp:name_of_idp bypasses login/home realm screen and forwards user directly selected identity provider (if allowed per client configuration) tenant:name_of_tenant can used pass tenant name user service how p

UIPickerView Width in iOS8 Swift -

i can not find out how width of component on uipickerview. it's not allowing simple (int) needs cgfloat. put in <#code#> section? func pickerview(pickerview: uipickerview, widthforcomponent component: int) -> cgfloat { <#code#> } thank you! that method. doesn't "get width of component..." picker view calls method ask how wide component should be. your method simple as: func pickerview(pickerview: uipickerview, widthforcomponent component: int) -> cgfloat { return cgfloat(25.0) } (or whatever width appropriate picker view...) you need cast result exptected type.

What is the significance of this JavaScript code? -

what think doing looking see if object has been instantiated , exists within scope? why need use triple equal sign determine? function viewmodel(parent) { if (false === (this instanceof viewmodel)) { return new viewmodel(parent); } }; you don't need strict equality comparison there. instanceof yields true or false , entirely sufficient: if (!(this instanceof viewmodel))

c - Issue in passing a structure to a function accepting void * parameter -

i want call function of type foo(void * data) having input parameter struct variable. i have heard when input format of type void, accepts every type of input variable type. nevertheless, error message. struct info{ int element; }; struct info inserter_info; inserter_info.element = 0; inserter(inserter_info); where inserter() prototyped void * inserter(void * data) . i tried casting got error messages. i have heard when input format of type void, accepts every type of input variable type absolutely wrong !!! void means nothing . accepts nothing. however, void * considered generic pointer. quote c11 standard document, chapter 6.3.2.3, pointers, paragaraph 1, a pointer void may converted or pointer object type. pointer object type may converted pointer void , again; result shall compare equal original pointer. using attribute, many times, function parameter written void * that, function can accept different types of pointer , then, insi

Host a RESTful web service in java -

so, developing restful web service in java, , finishing it, , testing purposes want host make application consumes data. running on localhost. have searched here questions, , didn't find useful me. using web logic. i've generated .war file. how can host it? , where? you can use openshift free upto 3 tiers (instances).

c++ - Returning multiple arguments from an overloaded operator -

i may not doing correctly possible multiple return values overload? using overload compare between objects in binary search tree. i have 5 of them, post 2 (they similar anyways). bool extpersontype::operator > (extpersontype bob){ return (this->getlastname() > bob.getlastname()); //return (getdate().getmonth() > bob.getdate().getmonth()); //return (this->getstatus() > bob.getstatus()); } bool extpersontype::operator==(extpersontype bob){ return (this->getlastname() == bob.getlastname()); //return (getdate().getmonth() == bob.getdate().getmonth()); //return (this->getstatus() == bob.getstatus()); } so have 3 functions compare objects of "extpersontype" in bst. tried saw examples no luck (the output spits out randomly , data doesn't make sense). bool extpersontype::operator > (extpersontype bob){ return (this->getlastname() > bob.getlastname() && getdate().getmonth()

regex - scala parsing next line -

i've got text --make_123 say:hello say:bye --make_123-- i need parse map: { makeid : 123 firstnode : hello secondnode : bye } i've got following scala code: class myparser extends regexparsers { def parsetext(input: string): mapcontent = parseall(parserequest, input) match { case success(result, _) => result case nosuccess(msg, _) => throw new someexception(msg) } def parserequest: parser[mapcontent] = parsemakeid ~ parsetext ^^ { case makeid ~ firstnode => { mapcontent( map("makeid" -> makeid) ++ map("firstnode" -> firstnode)) } } def parsemakeid: parser[string] = "--make_" ~> ".*".r def parsetext: parser[string] = "say:" ~> ".*".r } case class mapcontent(map: map[string, string]) well, here receive string matching regex `.*\z$' expected `s' found which second line , first literal of "say:" ho

mysql - Finding an item in a database in php -

using combination of php , mysql, let's have database tables. have page (php or html) allows user enter string; search specific table input , return information on entry if exists, , tell them nothing found otherwise. more specifically, if had table titled zookeepers had row name , wanted page user prompted enter name , return whether there zookeeper name or not , if output information, code that? i'm pretty sure want is: select * zookeepers name = $variable as far query goes, i'm not sure beyond that. use keywork in query name can same multiple rows change select * zookeepers name = $variable to $select="select * zookeepers name '%$variable%'";

linux - socket program unable to receive ethernet packets from ECU in python -

i trying build socket retrieve ethernet packets ecu. when run code on windows there no problem , code runs correctly. when run code on linux gets stuck @ s.recv(65565). have set static ip in /etc/network/interfaces follows: iface eth0 inet static address 160.48.199.91 netmask 255.255.255.0 gateway 160.48.199.254 i tried simple code of socket on raspberry pi. still gets stuck @ s.recv(65565). code below: import socket import sys host = "160.48.199.91" port = 30490 s = socket.socket(socket.af_inet, socket.sock_raw, socket.ipproto_udp) s.bind((host, 30490)) while true: data = s.recvfrom(65565) print(data) could please me problem. also, have been trying recieve 'ip packets' ecu. in windows create socket protocol type socket.ipproto_ip not valid in raspberry pi. how possible in raspberry pi(linux) ? edit: tried implement same program using multicast. problem when create socket icmp protocols see data ecu after using command "ping -i echo 239.192.25

Eclipse Luna Not Storing Proxy Authentication Username and Password -

i'm trying eclipse luna (on debian 8) connect internet via wifi proxy requires authentication. able set proxy host, port, username , password after apply settings , close dialog. next time open it, not have username , password settings, although host , port retained correctly. active provider set manual required. for reason, doesn't seem saving authentication details , i'm not able connect internet. is bug or i'm doing wrong? also, in file eclipse store proxy settings? maybe can go in there , make changes directly if gui problem. edit: @ error log gives vital clue. says: no secure storage modules found. i worked around issue adding proxy settings eclipse.ini file specified in so post . -vmargs -dorg.eclipse.ecf.provider.filetransfer.excludecontributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -dhttp.proxyhost=*myproxyhost* -dhttp.proxyport=*myproxyport* -dhttp.proxyuser=*proxy username* -dhttp.proxypassword=*proxy password* -dhttp.nonprox

changing the tree nodes background colour in extjs4 -

i new js please forgive me if asking basic question. i want change background colour of node in tree have here. ext.application({ name: 'autopsy', launch: function() { ext.create('ext.container.viewport', { layout: 'border', items:[ { ...... ....... }, { region:'west', collapsible: true, resizable: true, title: 'threads (total: {{ num_threads|replace("\n","\\n") }})', width: 200, layout: 'fit', items: [ { xtype: 'treepanel', rootvisible: false, store: threadstore,

multiple form submit buttons for a single form rails 4 -

i'm attempting have form allows me either delete multiple posts based on checked or action. i'm struggling accessing post ids form. if use f.submit tags code works fine. however, when try use bootstrap buttons not work. below view, has form located inside of bootstrap table , submit buttons on outside of table. <%= form_for :pending_forms, html: {method: 'get'} |f| %> <table class="table"> <tbody> <% if @pending_posts.any? %> <% @pending_posts.each |post| %> <tr> <td><%= post.post_name %></td> <td><%= post.created_at %></td> <td><%= check_box_tag 'post_ids[]', post.id %></td> </tr>

How linux device drivers are loaded? -

can explain me in simple terms following thing. how linux drivers loaded kernel space? functions exported, after drivers being loaded? how driver functions called? normally use insmod or modprobe userspace application load module (and possibly dependencies in case of 2nd one). both of them same under hood load single module - read file memory , use init_module system call, providing address of memory module loaded. call tells kernel module should loaded. now kernel modules elf files , not different shared libraries used in userspace. kernel has equivalent of shared library linker, parse files, list of symbols provided it, updating list of functions known kernel. check if symbols module needs in kernel , proper relocations. 1 of last thing call initialization function in module. note cannot compile kernel directly call function provided module. similarly, can call function provided module in module before loading first one. kernel refuse load module symbols not known

python mongodb $match and $group -

i want write simple query gives me user followers has timezone brazil , has tweeted 100 or more times: this line : pipeline = [{'$match':{"user.statuses_count":{"$gt":99},"user.time_zone":"brasilia"}}, {"$group":{"_id": "$user.followers_count","count" :{"$sum":1}}}, {"$sort":{"count":-1}} ] i adapted practice problem. this given example structure : { "_id" : objectid("5304e2e3cc9e684aa98bef97"), "text" : "first week of school on :p", "in_reply_to_status_id" : null, "retweet_count" : null, "contributors" : null, "created_at" : "thu sep 02 18:11:25 +0000 2010", "geo" : null, "source" : "web", "coordinates" : null, "in_reply_to_screen_name" : null, &quo