Posts

Showing posts from May, 2013

Use Hashtable with switch case in PowerShell -

i need make decisions in powershell based on values in hashtable. basically need assign users' upn in active directory according attribute, company one, , thought create hashtable containing keys , values this key value company1 @company1.com company2 @company2.com the issue facing don't know how tell powershell use value rather based on company attribute, don't know how cycle/check company attribute against key in hashtable. i've tried use switches $a -match $hashtable or $a -contains $hashtable with little success. i think hashtable need here, of course open suggestion using external files match number of companies need match rather high. while mathias presented proper solution i'd add more explanation. hashtables , switch statements 2 different solutions same problem: transform input value corresponding output. → "foo" b → "bar" c → "baz" ... hashtables simpler (and faster) appr

performance - SQL Server Stored Procedures Execution difference -

i have sql server 2016. there 2 absolutely same stored procedures different names, execute differently. first completes in 17 minutes, other in 18 second. first created before index on 1 of elements created, recompiled , cleared plans plan cache. result not change. what problem can , how reconfigure execution plan? to improve performance of stored procedure must executed script lower. can recreate execution plan. exec sp_recompile n'procedurename'; go dbcc freeproccache no_infomsgs; go exec sp_updatestats; go

php - Echo variable which has been set in another classes function -

i trying access contents of variable class. have code below, expecting 'test' returned, nothing. i assume because getting $abc_rank empty. required variable populated in function itself. therefore how can $abc_rank hold echo , output via other class? <?php class class1 { public static $abc_rank; public function __construct() { $this->add_text(); } public function add_text() { $this->abc_rank = 'test'; } } class class2 { public function __construct() { $this->display(); } public function display() { $test = class1::$abc_rank; echo $test; } } $go = new class2(); ?> i know can do: public static $abc_rank = 'test'; but population of variable must in function. i have read of other related answers , can't seem work. in class1 : replace $this->abc_rank = 'test'; $this::$abc_rank='test'; ($abc_rank static proper

ios - Only two selection tableView (Shortcut code) -

in controller user can multiple selection (two) only, code working fine develop ourselves looking wonderful shortcut code, need make nice view of code think liked see ideas -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { if (self.firstindex) { if (indexpath == self.firstindex) { // return of first selection uitableviewcell *oldcell = [tableview cellforrowatindexpath:indexpath]; if (indexpath.row % 2) oldcell.backgroundcolor = [uicolor whitecolor]; else oldcell.backgroundcolor = [viewcontroller colorfromhexstring:@"#f4f6f9"]; oldcell.textlabel.textcolor = [uicolor blackcolor]; self.firstindex = nil; } else { // selection if (self.secondindex) { if (indexpath == self.secondindex) { // return uitableviewcell *oldcell = [tableview cellforro

javascript - Ionic: integrate into iMessage on iOS -

everybody. i'm stuck... i'm implementing ios chat on ionic framework, , use angular 1. have idea... in google can't find information implementing imessage app (or otherwise, doesn't matter). for example, service do some ideas i've got here: https://github.com/matiastucci/socket-chat-client you can create imessage app (an app shows in keyboard area when in imessage app). but, can not create app show incoming imessages or send imessage someone. information on building imessage app

Powershell w32tm command error: Getting AD DC list for default domain...GetDcList failed with error code: 0x80070774 -

i trying run script return w32tm status of host, run this- $serverlist = @(w32tm /monitor | where-object{$_.startswith(" ntp:") -and !$_.startswith(" ntp: error")}) to list of ntp sources , time offsets when run domain account works fine, when run local system account error- getting ad dc list default domain...getdclist failed error code: 0x80070774. exiting error 0x80070774 is there way can around this? don't want change user account script runs under other reasons w32time /monitor gets information domain controller (pdc). for same reason, needs domain admin credentials fetch it. but if wish information locally, should use: w32tm /query /configuration hope can understand difference.

r - How to convert a named list of named vectors to a data.frame conveniently? -

suppose have following named list of named vectors: structure(list(var1 = structure(c(-0.59588185761272, -1.40360179042903, -0.930940964040855, 0.627327161612272, 2.5718263501814, -0.494398712878508 ), .names = c("w", "x", "j", "v", "y", "a")), var2 = structure(0.845082248473655, .names = "k"), var3 = structure(c(-0.0445511021832538, 1.29597344526442), .names = c("b", "c"))), .names = c("var1", "var2", "var3")) # $var1 # w x j v y # -0.5958819 -1.4036018 -0.9309410 0.6273272 2.5718264 -0.4943987 # # $var2 # k # 0.8450822 # # $var3 # b c # -0.0445511 1.2959734 how derive data.frame of values, names of vectors , names of lists. derived output looks this: # values vec var.name # 1 -0.5958819 w var1 # 2 -1.4036018 x var1 # 3 -0.9309410 j v

play pause toggle in android listview -

i have listview play image button in every row ... play , pause function @override public void playpauseonclick(int position) { product product = songlist.get(position); if (product.paused) { product.setplaypauseid(r.drawable.ic_pause); product.paused=false; }else { product.setplaypauseid(r.drawable.ic_play); product.paused = true; } adapter.notifydatasetchanged(); } this works fine , have no problem... but need achieve set clicked position play icon before setting new position pause. can me this, please !!? i've modified hitesh gehlot's answer: @override public void playpauseonclick(int position) { product product = movielist.get(position); if (product.paused) { for(int i=0;i< movielist.size();i++) { movielist.get(i).setplaypauseid(r.drawable.ic_play); movielist.get(i).paused = true; } product.setplaypauseid(r.drawable.ic_pause);

javascript - Timing issue: How can I get the correct value of a variable from angular2 service -

in angular2 service raise value of variable inside replace function. i able access value component, starting value. so -> 0. able gat value if change in constructor of service, not need. here service.ts: export class myservice { colletion: object = { foo: [], bar: [], somethig: [] } counter: = 0; constructor() { getsomedata(); } getsomedata() { //do stuff data server, call: cleanstrings(); } cleanstrings() { (var = 0; < result.length; i++) { this.colletion[key][i] = key + " " + result[i].expression .replace(/string/g, match => { //here raise value this.counter++; return 'field-' + this.counter + '" />'; }); } } } so guess run timing issue. here how try value of 'counter' - app.component.ts: import { component, viewchild, querylist, viewchildren } '@a

dynamics crm - Error with OutParameter in custom Action -

there error: the type outargument`1 of property result not supported. , there code [output("result")] public outargument<entitycollection> result { get; set; } i error when try update assembly. ideas? you cannot use type entitycollection in generic outargument<t> properties. supported types are: boolean datetime decimal double entityreference int32 money optionsetvalue string see msdn .

SQL Server Padding 0's with RIGHT Not Working -

i using sql server 2008. i have varchar(30) column holds check numbers. if payment made using credit card, checknbr zero-length string. need pad data leading zeroes such entire output ten digits long. if there no check number, should ten zeroes. here data see: 0000000000 0000000000 0000000114 0000000105 0000000007 here query have been using , stuck on: select right((case when len(checknbr) = 0 '0000000000' else '0000000000'+checknbr end),10) checknbr payhistory number = 12345678 and get: 0000000000 0000000000 114 105 7 trying way: select right('0000000000'+checknbr,10) payhistory number = 3861821 and same results. oddly enough, have varchar(10) column right('0000'+edc.databasenumber,4) yields results after. missing here? quirk right function? thanks in advance if using sql server 2012 or try following: select right(co

html5 - HTML form autocomplete address semantics -

i working on registration form requires home , work addresses upon submitting. fields follows: <html> <form> <input name="street-address" autocomplete="home street-address" required /> <input name="postal-code" autocomplete="home postal-code" required /> <input name="locality" autocomplete="home locality" required /> <!-- or "home city" --> <input name="organization" autocomplete="organization" required /> <!-- addressee or department withing organization. optional field --> <input name="addressee" autocomplete="????????" /> <input name="work-street-address" autocomplete="work street-address" required /> <input name="work-postal-code" autocomplete="work postal-code" required /> <input name="work-locality" autocomplet

css - Knockout js star rating "value not get cleared" -

i using knockout js star binding.its working first time when page loaded.when select 2 star out of 5 start first time gives me value correctly,after value not cleared , cant able select of stars.need in it. ko.bindinghandlers.starrating = { init: function (element, valueaccessor) { console.log(valueaccessor); $(element).addclass("starrating"); (var = 0; < 5; i++) $("<span>").appendto(element); $("span", element).each(function (index) { $(this).hover( function () { $(this).prevall().add(this).addclass("hoverchosen") }, function () { $(this).prevall().add(this).removeclass("hoverchosen") } ).click(function () { var observable = valueaccessor(); console.log(observable) observable(index + 1); window.localstorage.setitem("star", observable()); }); });

c# - Custom serializing nested collection objects -

i trying serialize c# object restsharp's xmlserializer. my model is: public class person { public string name { get; set; } public list<address> addresses { get; set; } } public class address { public string city { get; set; } } client code this, nothing fancy here. list<address> addresses = new list<address>(); addresses.add(new address { city = "ny" }); addresses.add(new address { city = "istanbul" }); person person = new person { name = "mike", addresses = addresses }; console.writeline(new restsharp.serializers.xmlserializer().serialize(person)); the output is, expected, this: <person> <name>mike</name> <addresses> <address> <city>ny</city> </address> <address> <city>istanbul</city> </address> </addresses> </person> is there way following resu

Vscode react-typescript + mocha: breakpoints stop in .js files -

Image
i'm facing problem breakpoints in typescript files not stopping, stopping instead in generated .js files. (i have asked similar question here . setup testing mocha, using typescript. snippet of project structure (especially test folder) this lauch.json configuration: unfortunately when set breakpoints in ts files, hit in .js files instead. , during debug, inside .ts file, red dot of breakpoint moved different line. i have looked @ few similar questions here , here . still have not been able breakpoints stop inside .ts files @ appropriate line. possible debug mocha test written in typescript , using vscode? one person said gave , moved jasmine. your suggestions useful.

linux - Fastest way to delete files from a directory tree whose names contain a certain string -

i have directory containing subdirectories delete files names contain out . fastest method of doing this? i have tried several things. a simple: rm */*out* perl: perl -e 'for ( <*/*out*> ) { ( (stat)[9] < (unlink) ) }' each of seem take serious amount of time. 1,000 subdirectories, each of contain around 50 files matching *out* , takes: perl: ~25 mins rm */*out* : ~18 mins i tried rsync , moving files folder first , syncing delete, took ages. does have faster way of getting rid of these files, seems inordinately slow me? i find test3 fastest (11-25 sec). why not test yourself? your filesystem can have big impact on performance. the test uses gnu parallel . # make test set: 150000 files, 50000 named *.seq testset() { doit() { mkdir -p $1 ; cd $1 && parallel --results ./{} seq ::: {1..50}; } export -f doit seq 1000 | parallel --bar doit >/dev/null # drop caches before starting test echo 3 | sudo tee /proc

Arduino Uno Wifi - WiFi Mode keeps changing -

i have adruino uno wifi device turned on time (whole day , night). wifi mode set 'sta'. time time switches 'ap+sta' mode automatically device visible in network access point, not want. there way prevent arduino uno switch wifi mode itself? can done via code maybe? thank help. i found workaround problem. if interested, i've posted answer on arduino stackexchange forums here

How to remove span with class name around selected text in javascript -

i using javascript highlight selected text , remove selected text when user wants. have done everything, stuck when comes remove style of selected text. want remove span class name highlight around selected text not remove other styles available inside selected text. here the plunk i've made : function removehighlight() { var sel = window.getselection(); if (sel.rangecount > 0) { var range = sel.getrangeat(0); var selectedtextnode = document.createtextnode(range.tostring()); console.log(selectedtextnode); range.deletecontents(); range.insertnode(selectedtextnode); range.selectnode(selectedtextnode); sel.removeallranges(); sel.addrange(range); } } what proper way remove highlighted span around selected text ? you can use remove method of classlist property: // spans have highlight class var spans = document.queryselectorall("span.highlight"); // loop on spans , remove classs for(var = 0; < spans.length;

aspnetboilerplate - Add tenant name to the url after authentication in asp.net zero -

i want redirect url after authentication in multi-tenant application. when user enters credentials on login page(url: domain_name.com) , after successful authentication, browser url must changed {tenancy_name}.domain_name.com i got tenancy name using email address , password. now, want put tenancy name browser url identified user. this case when user forgot put tenancy name in url means user enters url like: domain_name.com then after successful authentication, tenancy name must added url like: {tenancy_name}.domain_name.com and must redirect dashboard page. following login post method: [httppost] [unitofwork] public virtual async task<actionresult> login(loginviewmodel loginmodel, int paymentflag, string returnurl = "", string returnurlhash = "") { try { var tenant = await _tenantmanager.findbytenancynameasync(loginmodel.tenancyname); if (tenant.isactive

php - codeigniter pass data from view to model -

i need show category , sub category, model right show static $id can see attempted write $id = 4 (for testing only), it's show subcategory $id = 4 in every category. public function get_subkriterias($id = 4) { $this->db->select('kriterias.nama kriterias_nama, kriterias.id, sub_kriterias.id, sub_kriterias.nama, sub_kriterias.nilai'); $this->db->from('kriterias'); $this->db->join('sub_kriterias', 'kriterias.id = sub_kriterias.kriteria_id', 'left'); $this->db->where('kriteria_id', $id); $this->db->order_by('kriterias.id'); $query = $this->db->get(); return $query->result_array(); } this controller public function index() { $data['kriterias'] = $this->subkriterias_model->tampil(); $data['sub_kriterias'] = $this->subkriterias_model->get_subkriterias(); $this->load->view('sub_kriterias/tampil

javascript - post data-id using ajax form -

Image
i've question ajax form. so, can see following ajax code have data-id . i'm getting id in .pmsc div. when press #upmsc uploading image not getting error, getting result chrome developer console, no upload, no inserting image name in database. i'm doing wrong here. then ajax submit form this $('body').on('change', '#upmsc', function(e) { e.preventdefault(); var id = $(".pmsc").attr("data-id"); var data = 'id=' + id; $("#musicform").ajaxform({ type: "post", data: data, cache: false, target: '.appended', beforesubmit: function() { // }, success: function(response) { // $(".showecho").html(response); }, error: function() {} }).submit(); }); my html form this: <form id="cfrm" class="options-form" method="post" enctype="multipart/form-data

sql server - SQL Insert Into Where Record Not Exists -

i have automated process appends data table1 every week. has 4 columns [reason, number of occurences, sent date, , program] . table1 keeps growing , not care duplicate records. (there 26 records each week , 4 columns performance/space not issue) i have table table2 want distinct records table1 . if record exists in table 2 not want insert record. thought below statement work, not: begin transaction insert [database]..[table2] select distinct * [database]..[table1] not exists (select * [database]..[table2]) (0 row(s) affected) if comment out clause, work, insert records exist in table2 begin transaction insert [database]..[table2] select distinct * [database]..[table1] --where not exists (select * [database]..[table2]) (83 row(s) affected) how check distinct records in table1 , if record not exist in table2 , insert record? i using ms sql server version 11.0.6020.0 in sql server, use except . assuming tables have same columns: insert [datab

php - How to generate a unique key for an array? -

i'd generate unique identifier based on content of array. initial approach do: $key = md5(json_encode($array)); however, i'd absolutely sure key unique , there remote possibility 2 distinct arrays can produce same md5 hash. current idea do: $key = base64_encode(json_encode($array)); this guaranteed unique produces quite long key. can use sha512 or type of hash have same potential key collision md5? there way generate shorter key base64 method 100% guaranteed unique? to 100% clear, question is: how can generate shortest possible 100% unique identifier set of data? if want 100% guaranteed unique key match content, way use full length of content. can use json_encoded string as-is, or run through base64_encode() or bin2hex() or similar if want string doesn't have "special" characters. hash function md5, sha1, sha256 etc cannot 100% unique - because have fixed length, , due https://en.wikipedia.org/wiki/pigeonhole_principle there must non-un

update multiple rows of one column by single submit button : AngularJS with PHP -

i need update column (fraisfact) of several lines, each line identifier (codecompletecolumn), how can angularjs , php knowing managed display inofrmation of each code ( ng-repeat) , can not predict number of codes displayed , have update "fraisfact" of each "codeenvoicolis" fichier.html <ion-list ng-repeat="x in namesf3 " > <div class="item item-divider center-text" name="codee" ng-model="codee" value={{x.codeenvoicolis}} > {{x.codeenvoicolis}} </div> <label class="item item-input"> <input type="text" placeholder="frais" name="frais" ng-model="frais"></div> </label> </ion-list> <a class="button button-info" href="#/factureadmin" ng- click=updatefactfact(x.frais)> ajouter </a> app.js : $scope.insertfact = function(frais){

CMake with Microsoft Visual C++ Build Tools -

edit: having posted issue tracker , stepped through cmake devs, isn't cmake problem. broken msbuild installation causes return "the operation completed successfully." error. still no resolution on issue overall, narrows down potential causes. i'm trying build cmake project on windows using ms visual c++ build tools 2015 (note: not full visual studio). cmake, however, apparently unable find cl.exe cmake .. -- building for: visual studio 14 2015 -- c compiler identification unknown -- cxx compiler identification unknown cmake error @ cmakelists.txt:4 (project): no cmake_c_compiler found. cmake error @ cmakelists.txt:4 (project): no cmake_cxx_compiler found. i suspect because cmake expecting find compiler in visual studio installation perhaps standalone build tools install in different location? possible configure cmake elsewhere compiler? edit: head possibility off @ pass, cl.exe installed. when open visual c++ shell (adds tools path) cl.exe output

html - width:auto overwrite inline width of image -

a client asked me problem having on wp site. when adding external image post, original size of 800x640. can resize image via wordpress wysiwyg editor to, 400x320. html part when inspecing element firebug on front end or in text tab of editor: <img class="" src="http://xxx.nl/images/externalimage.jpg" alt="" width="400" height="320" /> but on front end image shown @ original 800x640 size. when inspecting element firebug shows: img { height: auto; max-width: 100%; vertical-align: top; width: auto; } if disable 'width' line in firebug image resizes 400x320. how can resolve issue, client can thing images in editor. i can solve myself on individual case basis adding width containing span/p tag, client doesn't know css or html , can't manually edit widths of containing tags every time posts new. the images inside 'post' wrap container, has own class. apart auto, set 'inherit&

cygwin - rdiff-backup on WindowsOS: cannot get "--exclude C:/target/stuff" to work -

i working on backing number of local , non-local files windows machine. familiar rdiff-backup other linux boxes use. have installed rdiff-backup using instructions etc here, http://www.nongnu.org/rdiff-backup/index.html i have rdiff-backup installed , appears working "almost" fine. problem have directory want exclude. on linux os do, rdiff-backup --exclude c:/target/stuff c:/ d:/backup however not work on windowsos machine. using suggested formatting posted here: http://www.nongnu.org/rdiff-backup/windows-readme.txt i have tried following, rdiff-backup --exclude "c:/target/stuff" c:/ d:/backup also escape characters... rdiff-backup --exclude c:\\/target\\/stuff c:/ d:/backup as doing "c:/" directory, with no luck @ all.

select - How to add a html datalist field to a meteor aldeed:autoform? -

i populated select input field collection in aldeed:autoform. field declaration {{> afformgroup name="patientid" type="select" options=patientids}} helper patientids:function () { return meteor.users.find({}).map(function (user) { return {label: user.profile.firstname, value: user._id}; }); } but turned out drop down large select option. therefore need implement functionality similar html datalist in autoform. how implement in meteor aldeed:autoform? there select2 add-on autoform, might want. see here .

wordpress - How to submit wp favorite posts plugin using Ajax? -

i'm using wp favorite posts plugin add posts favorite posts, , wokr uisng code <?php wpfp_link(); ?> when click on add favorite button reload page. how can using ajax not reload page. with no code it's hard solve exact problem. however, including return false; into javascript function called when button clicked, should prevent reloading page.

osx - sed command with -i option failing on Mac, but works on Linux -

i've used following sed command search/replace text in linux: sed -i 's/old_link/new_link/g' * however, when try on mac os x, get: "command c expects \ followed text" i thought mac runs normal bash shell. what's up? edit: according @high performance, due mac sed being of different (bsd) flavor, question therefore how replicate command in bsd sed ? edit: here actual example causes this: sed -i 's/hello/gbye/g' * if use -i option need provide extension backups. if have: file1.txt file2.cfg the command: sed -i '.original' 's/old_link/new_link/g' * create 2 backup files like: file1.txt.original file2.cfg.original there no portable way avoid making backup files because impossible find mix of sed commands works on cases: sed -i -e ... - not work on os x creates -e backups sed -i'' -e ... - not work on os x 10.6 works on 10.9+ sed -i '' -e ... - not working on gnu

stanford nlp - Dedicated Server Configuration Error -

when running command, sudo ln -s /etc/init.d/corenlp /etc/rc.d/rc2.d/s75corenlp i keep receiving following error: ln: failed create symbolic link '/etc/rc.d/rc2.d/s75corenlp': no such file or directory my ubuntu 16.10 build not have '/etc/rc.d/' directory. missing necessary package? should utilize '/etc/init.d/' directory instead? research has me believe '/etc/rc.d/' used in older debian builds , has been replaced '/etc/init.d/'.

How can I deallocate memory from three.js objects? -

i have three.js interactive program loading multiple models. after initial run, program resets, removing models , clearing out of variables, memory usage not decrease. the .json models taking lot of memory, interfering on many levels. trying reduce size of models, going go far if memory can't reallocated. from research i've done, .deallocate() has been deprecated. loading using three.objectloader(), i'm not sure how .dispose() work in instance. tried: scene.remove(basketcontents[type][i]); basketcontents[type][i].geometry.dispose(); basketcontents[type][i].material.dispose(); basketcontents[type][i].texture.dispose(); but gives me errors .geometry.dispose(), etc. not exist. how can remove object memory memory can used other objects?

react jsx - How do you get ESLint to work for jsx in VS2017? -

i've noticed vs-2017 has eslint built in. works great javascript files. there way work jsx files? react-jsx if possible. after bit of searching found jsx support works best when file .js instead of .jsx. changed extension , eslint began complaining :)

sql - Months Between 2 dates for each Project -

hi trying run query return row each month between 2 dates each project have. see example data: project start end 1 1/1/2015 3/1/2015 2 2/1/2015 4/1/2015 end data needed: project month 1 1/1/2015 1 2/1/2015 1 3/1/2015 2 2/1/2015 2 3/1/2015 2 4/1/2015 i have several projects , need query of them @ same time. how can in sql server? another option cross apply ad-hoc tally table select a.project ,month = b.d yourtable cross apply ( select top (datediff(month,a.start,a.[end])+1) d=dateadd(month,-1+row_number() on (order by(select null)),a.start) master..spt_values ) b returns project month 1 2015-01-01 1 2015-02-01 1 2015-03-01 2 2015-02-01 2 2015-03-01 2 2015-04-01

How can I run a meteor app and have it use the mup.json and settings.json file inside the staging folder? -

when run app meteor --settings staging/settings.json not use mongo database on staging/mup.json file i have following files in staging folder: mup.json mupc.json settings.json online have read filename mup.js on rep have mup.son how can run app database on staging/mup.json file ? i believe mup.json file used set environment vars on deploy server. it's not meant running app locally. in order run app locally , connect mongo, you'll need set env var. // mac or linux $ export mongo_url=mongodb://yourmongouri // windows $ set mongo_url=mongodb://yourmongouri

javascript - d3.js chemical tube bar chart -

Image
i interested in creating liquid bar chart of sorts. pointers/dotted markers pulling off side shown. 22 april - latest code work dynamic data http://jsfiddle.net/nyeax/1855/ latest bar chart code http://jsfiddle.net/nyeax/1827/ latest cleaned water wave code http://jsfiddle.net/qh9x5/10331/ //i want strip down waterwave code http://jsfiddle.net/qh9x5/10091/ //progress chart http://jsfiddle.net/nyeax/1740/ latest base code bar chart. http://jsfiddle.net/nyeax/1822/ var $this = $("#checmicalbars"); var data = [{ "label": "rendering", "value": 90, "startcolor": "#c3da54", "endcolor": "#c1e500" }, { "label": "character design", "value": 95, "startcolor": "#e94adc", "endcolor": "#aae3dd" }, { "label": "sketching", "value": 80, "startcolor"

Runtime Error for 'COOMILK' on CodeChef (Python 3.4) -

hi new python programming here. practicing on www.codechef.com not able find solution error on code. i using python 3.4, trying solve problem https://www.codechef.com/problems/coomilk while code running on idle giving runtime error when trying submit code. tried searches , first fixed eoferror getting on compilation not able fix runtime error. t = int(input()) loop in range(t): failed = false n = int(input()) activities = input().split() check in range(n): if len(activities)==1 , activities[check]== 'cookie': print ("no") failed = true elif activities[check] == 'cookie' , activities[check+1]!= 'milk': print ("no") failed = true if not failed: print("yes") it great if me out in finding out problem, have checked code providing input required , giving desired output somehow giving runtime error on submission. i appreciate suggestions on improving code. thank :)

3d graphics from scratch -

what minimum configuration program need build 3d graphics scratch , example have sfml working 2d graphics , need implement camera object can move & rotate in space where start , how implement vector3d -> vector2d conversion functions , other neccessary things all have is: angles phi, xi, epsilon 1-3 , object can draw on screen following formula x/y = center.x/y + scale.x/y * dot(point[i], epsilon1/epsilon2) but way im transforming "world" axis, not object points first need implement transform matrix , vector math: mathematically compute simple graphics pipeline understanding 4x4 homogenous transform matrices the rest depends on kind of rendering want achieve: boundary polygonal mesh rendering this kind of rendering native nowadays gfx cards. need implement buffers for: depth (for filled polygons without z-sorting) screen (to avoid flickering , serves canvas) shadow,stencil,aux (for advanced rendering techniques) they have

assembly - MIPS: Lower to uppercase -

i need one. i'm trying make function converts lower case upper. example: "hi everyone!" -> "hi everyone! this have far (i know it's not don't know how move on here, been trying hours) to_upper: #pseudocode: # load byte # send ascii-function # check if ascii upper or lower # store/save somewhere - if upper # if lower, subtract 20 in hexadecimal , store other upper # print #### code: la $t0, str_str j check_if_upper check_if_upper: lb $t1, 0($t0) ble $t1, 96, is_upper j is_lower is_upper: is_lower: exit_to_upper: jr $ra i hope following code works you. used mars mips simulator . .data input: .space 20 newline: .asciiz "\n" .text main: li $v0, 8 li $a1, 20 la $a0, input syscall li $v0, 4 li $t0, 0 loop: lb $t1, input($t0) beq $t1, 0, exit blt $t1, 'a', case bgt $t1, 'z', case sub $t1, $t1, 32 sb $t1, input($t0) case: addi

jsf 2 - Primefaces component which allows hiding a trailing part of the text, but never all of it -

i'm looking primefaces component allows variable trailing part of text, never of hidden, e.g. lorem ipsum dolor sit amet, consectetuer adipiscing elit. aenean commodo ligula eget dolor. aenean massa. cum sociis natoque penatibus et [...](clickable) which expands to lorem ipsum dolor sit amet, consectetuer adipiscing elit. aenean commodo ligula eget dolor. aenean massa. cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. nulla consequat massa quis enim. donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. in enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. nullam dictum felis eu pede mollis pretium. integer tincidunt. cras dapibus. vivamus elementum semper nisi.[less](clickable) and back. i know done output label, backing bean , commandlink , why reinvent wheel. i'm using primefaces 6.0 in java ee 7 application. afaik, , looki

python - Unexpected result when comparing value received from socket to integer -

i'm receiving data socket, saving 1 of elements recentnumb . when print before if statement correctly prints it's 0. unfortunately if statement behaves if recentnumb different 0, no matter how modify expression. explain me why if statement not see recentnumb 0? r = wrappedsocket.recv(1024) v = r.split() recentnumb = v[1] print recentnumb if recentnumb != 0: dothis() else: ordothis() the docs state socket.recv() "return value string representing data received", might try int(v[1]) .

javascript - How to get item from JSON object when there is only one item? -

i have following json : var x = [{"email":"info@test.nl"}] how email in javascript ? x.email doesn't work me. bart you need reference element of array, access property. var x = [{"email":"info@test.nl"}] console.log(x[0].email)

javascript - AngularJS ng-repeat filter works when hardcoded but not when passed as controller variable -

so want make drop down menu changes filter value of ng-repeat this: <div ng-repeat="{{filter}}"> so have line in controller right hard-coded $scope.filter = 'lang in langs | filter:{type:\'interpreted\'}'; and can verify {{filter}} spit out string, ng-repeat doesn't work when given string double bracket variable, when it's hard-coded in. can not pass angular controller variables other angular functions ng-repeat? why not inject $filter service controller , filtering there. can filter langs in controller so: $scope.filteredlangs = $filter('filter')($scope.langs, {type:'interpreted'}); then can repeat filtered langs via ngrepeat directive: <div ng-repeat="lang in filteredlangs"> remember, ngrepeat directive evaluates expression not need curly braces have in example. if looking change type in filter update variable in controller: $scope.mytype = "interpreted"; in vie

php - Doctrine cascade/fetch type on generate -

if generate entities such: php app/console generate:doctrine:entity you 80 percent of work done. able set fetch type @ level. if cant, can trickery after ive generated it, because want set of manytoones fetch lazy because end doing. it in head: php app/console generate:doctrine:entity --fetch-type:user:roles=eager --cascade:user:roles:persist this understanding of whats possible: http://symfony.com/doc/current/bundles/sensiogeneratorbundle/commands/generate_doctrine_entity.html the end game dont want alter entity ever after generation, can regenerate should database change , not missing logic. id sort of tools or approach close gap as possible.

DJI Bridge App Tutorial No Video Stream in Swift - Phantom 4 Pro -

i going trough dji bridge app tutorial. using swift bridge header imports videopreviewer. app compiles fine. can connect product. can register. bridging app working fine. stuck video stream. have got ideas? method "func videofeed(_ videofeed: djivideofeed, didupdatevideodata videodata: data) is called correctly. when reading bytes data object. receiving values. sending these values videpreviewer as func videofeed(_ videofeed: djivideofeed, didupdatevideodata videodata: data) { var result = videodata.withunsafebytes { (pointer: unsafepointer<uint8>) -> uint8 in return pointer.pointee } print (result) print("stream info:\(videopreviewer.instance().currentstreaminfo.framerate)") videopreviewer.instance().push(&result, length: int32(videodata.count)) print(videopreviewer.instance().isdefaultpreviewer) }" however correct? djivideostreambasicinfo(framesize: (0.0, 0.0), framerate: 15, encodertype: 1).

xamarin.ios - Changing global tintColor does not change button colors on xamarin forms targeting iOS -

i trying change "branding color" ios target of xamaring froms app. read should change global tint color this: uiapplication.sharedapplication.delegate.getwindow().tintcolor = uicolor.fromrgb((nfloat)(0x0d/256.0),(nfloat)(0x77/256.0),(nfloat)(0x6e/256.0)); this changes color of buttons in navigation bar. not change color of other button. is behavior intended? can somehow change color of buttons , other elements using "ios blue"?

swift - What does "fatal error: unexpectedly found nil while unwrapping an Optional value" mean? -

Image
my swift program crashing exc_bad_instruction , error. mean, , how fix it? fatal error: unexpectedly found nil while unwrapping optional value this post intended collect answers "unexpectedly found nil" issues, not scattered , hard find. feel free add own answer or edit existing wiki answer. this answer community wiki . if feel made better, feel free edit it ! background: what’s optional? in swift, optional generic type can contain value (of kind), or no value @ all. in many other programming languages, particular "sentinel" value used indicate lack of value . in objective-c, example, nil (the null pointer ) indicates lack of object. gets more tricky when working primitive types — should -1 used indicate absence of integer, or perhaps int_min , or other integer? if particular value chosen mean "no integer", means can no longer treated valid value. swift type-safe language, means language helps clear types of values cod