Posts

Showing posts from August, 2015

javascript - Is there a callback for ng-bind-html-unsafe in AngularJS -

i remove of elements brought dom this... <div ng-bind-html-unsafe="whatever"></div> i wrote function remove elements, need way trigger function after ng-bind-html-unsafe complete. there callback ng-bind-html-unsafe or better approach? ng-bind-html-unsafe has been removed current version (1.2+) of angular. recommend using $sanitize service in new version of angular. you'll need include sanitize library , add module. that way can whatever want once sanitize operation complete , not worry callback. a quick , dirty implementation: <!doctype html> <html lang="en"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.js"></script> <script src="libs/angular/angular-sanitize.js"></script> </head> <body ng-app="myapp"> <div ng-controller="mycontroller"> <div>{{sanitized}}</div> &l

android - Positioning a progress bar behind a button -

Image
i have button defined in relativelayout follows: <button android:id="@+id/search_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/current_location" android:layout_marginleft="5dp" android:layout_marginright="5dp" android:paddingbottom="30dp" android:paddingtop="30dp" android:text="@string/search" /> i add progressbar behind button occupies exact same space button, when button disabled (translucent), can see progress bar behind it. how this? to had define button in main.xml first, followed progress bar follows: <button android:id="@+id/search_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/current_location" android:layout_m

oop - Clarification needed on Concept of a listener anonymous class in java -

i'm new java. purpose of listener anonymous inner class design? heard anonymous classes used listeners in java. , no 1 creates inner classes or static inner classes. i'm not sure means. 1 explain these concepts bit? listener design , how created via anonymous class. thank in advance. an anonymous listener this: mycontrol.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { // handle event } }); using inner class accomplish same goal this: public void init() { mycontrol.addactionlistener(new myactionlistener()); } private class myactionlistener implements actionlistener { public void actionperformed(actionevent e) { // handle event } } now consider 2 in scope of larger program. anonymous listener still right there @ spot you're adding it. inner class may somewhere else in source file entirely. ide, difference can minimized (such members browser), there need entirely new class you

java - Why does trim() not remove the trailing white spaces in this example? -

i revising java here: http://java-success.blogspot.com.au/2012/06/core-java-coding-questions-frequently.html , came along question: "q1. output of following code snippet? string s = " hello "; s += " world "; s.trim( ); system.out.println(s); a1. output be " hello world " with leading , trailing spaces. expect trimmed "hello world". so, concepts question try test? string objects immutable , there trick in s.trim( ) line. understanding object references , unreachable objects eligible garbage collection." can explain why trailing white spaces not removed? the method trim() doesn't modify string , immutable. returns trimmed string , promptly ignored, leaving s unchanged. replace s.trim( ); with s = s.trim( );

c++ - Trouble figuring out what's wrong with this code on Linux -

i'm having trouble figuring out why code not working on linux. i'm getting errors shared_ptrs like: (partial list) roject.cpp:21: error: iso c++ forbids declaration of 'shared_ptr' no type project.cpp:21: error: expected ';' before '<' token project.cpp:22: error: iso c++ forbids declaration of 'shared_ptr' no type project.cpp:22: error: expected ';' before '<' token project.cpp:23: error: iso c++ forbids declaration of 'shared_ptr' no type project.cpp:23: error: expected ';' before '<' token project.cpp:30: error: iso c++ forbids declaration of 'shared_ptr' no type project.cpp:30: error: expected ';' before '<' token project.cpp:37: error: iso c++ forbids declaration of 'shared_ptr' no type project.cpp:37: error: expected ';' before '<' token project.cpp:82: error: 'shared_ptr' has not been declared project.cpp:82: error: expected

Python Parsing XML Response -

i have soap response trying parse elementtree doc = et.parse(response_xml) cust in doc.findall('.//{http://www.starstandards.org/webservices/2005/10/transport}content'): custnumber = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}customernumber') custfname = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}firstname') custlname = cust.findtext('{http://www.starstandards.org/webservices/2005/10/transport}lastname') return custnumber, custfname, custlname i trying information out of response , keep getting following error: no such file or directory does response_xml need saved file before can parse it? why can't use memory? et.parse() needs file name. might want try et.fromstring() instead.

gruntjs - unexpected identifier error in grunt.js file -

can tell me why getting following error in terminal when running following grunt.js file? module.exports = function(grunt) { grunt.initconfig({ pkg: grunt.file.readjson('package.json'), concat: { // here our concatenating dist: { src: [ 'components/js/*.js' // in src js folder ], dest: 'js/script.js', } } uglify: { build: { src: 'js/script.js', dest: 'js/script.min.js' } } }); //add plugins here grunt.loadnpmtasks('grunt-contrib-concat'); grunt.loadnpmtasks('grunt-contrib-uglify'); //what happens when type 'grunt' in terminal grunt.registertask('default', ['concat', 'uglify']); }; the error is: loading "gruntfile.js" tasks...error syntaxerror: unexpected identifier warning: task "default" not found. use --force continue. thanks! you have missing comma: grunt.initcon

visual studio 2012 - windows form that Calculate area and perimeter using C# -

i trying create program calculate area , perimeter of square using c# using forum app having hard time starting program have form made need code part of it. can help? this how calculate area of square using system; namespace myapp { class program { static void main(string[] args) { double dlength; double darea; console.writeline("enter length of side of square :"); dlength = convert.todouble(console.readline()); darea = dlength * dlength; console.writeline("the area of square is: " + darea); console.readline(); } } }

javascript - MongoDB query for document older than 30 seconds -

does have approach query against collection documents older 30 seconds. i'm creating cleanup worker marks items failed after have been in specific state more 30 seconds. not matters, i'm using mongojs one. every document has created time associated it. we assuming have created_at or similar field in document has time inserted or otherwise modified depending on important you. rather iterate on results might want @ multi option in update apply change documents match query. setting time want past should straightforward in shell syntax, should pretty same of driver: db.collection.update({ created_at: {$lt: time }, state: oldstate }, {$set: { state: newstate } }, false, true ) the first false being upserts not make sense in usage , second true marking multi document update. if documents indeed going short lived , have no other need them afterwards, might consider capped collections . can have total size or time live option these , natu

SQL: Divide the sum of values in one table with the count of rows in another -

is possible to, in single query, sum bunch of values in 1 table, , divide count of rows in another? there common id/key in both tables... fyi, win points least info provided in question. answer it's possible...here psuedo code since i'm guessing @ tables , columns select summing / counting whynot (select id, sum(whatever) summing where_ever ) inner join (select id, count(1) counting what_ever)b on a.id = b.id question = 'vague' group a.id

sql - Select all entities which do not have children -- getting a lot of rows back, is this correct? -

i've got 84,000 rows in users table. users created automatically. so, thought nice see how many users did after being created. wrote query: select count(*) users u join folders f on userid = u.id join playlists p on folderid = f.id 0 = (select count(*) playlistitems playlistid = p.id) my intent count users have no playlist items in of playlists. query returned 74,000 results seems high. i'm wondering if query selecting users have @ least 1 playlist no items in it. is, if user has 2 playlists -- 1 empty , 1 populated -- still counted in query? and, if so, how can modify select users have empty playlists. if that's vastly more difficult might try hand @ counting users 1 playlist empty. the database structure is: many users. 1:1 user:folder, 1:many folder:playlists, 1:many playlists:playlistitems a better pattern counting every single playlist , comparing finding users don't have in playlist. not exists this: select count(u.id) dbo.users u

The best way to get years between two dates in R -

this question has answer here: get difference between dates in terms of weeks, months, quarters, , years 6 answers i'd calculate difference between 2 dates in years decimal values. let's have "1978-08-25" , "2014-02-05" (%y-%m-%d). how can calculate difference between these 2 dates in years decimal values (ie. not 35 years, 35.95...years)? thank in advance. you check out zoo package. x = as.yearmon("2014-02-05") y = as.yearmon("1978-08-25") x - y [1] 35.5

sap - xsodata service without authentication -

i trying create xsodata services using sap hana xs engine. have created .xsaccess file @ global folder level has following content: { "exposed": true, "authentication" : null } i have services folder inside parent folder have created test service. content of service is service namespace "example.services" { "testuser1"."testdb" "testdb"; } but when hit url: /example/services/example.xsodata/testdb 403 error. verify if .xsaccess if working fine, created dummy html file in same folder example.xsodata service. if hit link, works fine , not ask me authentication. to extend further, added .xsaccess file in services folder , added same content mentioned above. still gives 403 error example.xsodata service. try further, made services/.xsaccess have content { "exposed": true, "authentication" : [{"method":"basic"}] } this prompted me username/password , when

ios - Why presenting controller's view.transform gets reset on dismissal? -

Image
i started custom uiviewcontroller transitions using uiviewcontrolleranimatedtransitioning . went fine, when dismiss view, topography of presenting view beneath (green) gets reset. you can see cover , , push transitions. | click gif | if listen cover transition carefully, can see problem. click dismiss, presenting (green) view get's transformed fullscreen , while it's alpha works expect (!). stays on 0.5 , animate toward 1.0 should be. not case transform of frame properties. same goes push transition, presenting controller's view gets reset right after click. modal view fine. i've put the project github , made helper class cut down boilerplate, you'll point. see eppzpartialcover transition implementation. because of animation option uiviewanimationoptionbeginfromcurrentstate . removed animation option, , transition works expected.

apache - Silex in subdirectory on localhost : "Sorry, the page you are looking for could not be found" -

Image
i know there several similar questions asked on topic. i've looked @ of them , none of them have solved issues. here's have done far: already considered using virtual host (i dont want to, several reasons) made sure mod_rewrite on (yes, is!) written .htaccess file contains default silex webserver configuration. posted [here](http://silex.sensiolabs.org/doc/web_servers.html) , contained inside silex/ directory. code below successfully reached silex/web/index.php page via localhost/~username/silex (so mod_rewrite working). code below well i echo out "here!" statement , on silex/web/index.php i tried 1 solution consisted of placing second .htaccess file in silex/web/ dir .htaccess file: options -multiviews rewriteengine on ## uncommented because silex in subdir rewritebase /~username/silex/web rewritecond %{request_filename} !-f rewriterule ^ index.php [qsa,l] /silex/web/index.php file: require_once __dir__.'/../vendor/autoload.php'; $app =

Java xml parser compatible with android -

i working on getting of code within project run java application instead of android app: https://code.google.com/p/pandoroid/ i working on pandora client , use api developed within project, seems rely on android dependencies when comes xml parser. can recommend library compatible minimum code editing? errors revolve around: import org.xmlpull.v1.xmlpullparser; import org.xmlpull.v1.xmlpullparserexception; import org.xmlpull.v1.xmlpullparserfactory; import org.xmlpull.v1.xmlserializer; (i solved these googling , finding libraries) and more importantly import android.util.xml; thanks in advance! i enjoy using xml tool . it's fluent api, can write short statements accomplish need.

Matlab - for loop over cell array "foreach"-like syntax loops only over the first element -

this question has answer here: is there foreach in matlab? if so, how behave if underlying data changes? 9 answers i thought if write for x = cell_array ... end then loop run on elements of cell_array , in following case doesn't: >> tags tags = 'dset3' 'dset4' 'cpl1' >> class(tags) ans = cell >> t = tags tmp = t{:} %no semicolon: i.e. print it. end tmp = dset3 so works first element. what's problem? according the documentation , for x = cell_array iterate on columns of cell array. the reason confusion in question how {:} expansion behaves: >> = {3;4} = [3] [4] >> b = a{:} b = 3 in above, a{:} akin typing in comma-separated list elements elements of cell array a . except not quite! if write such list explicitly, get: >>

javascript - css triangle not working -

visit http://onecraftyshop.com you see grey box on first section star. if @ html under #av_section_2 .arrow-down. i'm inserting .arrow-down class using jquery. jquery('#av_section_2').prepend(jquery('<div class="arrow-down"></div>')); and here css styling: .arrow-down { width: 0; height: 0; border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 20px solid #eeeeee; position: absolute; top: 0px; left: 50%; } so i'm sure jquery fine displaying on page, reason can't css make triangle. how can fix this? corrected css great! if need other info let me know! thanks you need more specific because other rules in style sheet over-riding it. .avia-section .arrow-down { width: 0; height: 0; border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 20px solid #eeeeee; position: absolute; top: 0px; left: 50%; }

ember.js - Empty request payload when saving new record - Ember-data -

what i'm trying: persist new record reason request payload empty though record has data. here's fiddle: http://jsfiddle.net/brancusi/m8vrb/16/ (disregard firebase, it's there can inspect request payload on save.) explanation: you notice when save record, request payload empty. ideally request payload this: { "inventory": { "entry_time": "2014-02-05", "client_id": 1, "user_id": 1, "product_stock_levels": [ { "product_id": 1, "quantity": 2 }, { "product_id": 2, "quantity": 0 }, { "product_id": 3, "quantity": 8 } ] } } notes: this seems problem when it's new record. updating existing records send correct payload.

animated HTML/CSS/jQuery Skills Graph -

so trying make 'skills' graphic loads when page opened. using html, css, , jquery; cannot figure out why little progress bars won't display load action.i'm hoping can lead me in right direction (hint) or find out whats wrong! here is: fiddle <!doctype html> <html> <head> <meta charset="utf-8"> <title>skills</title> <style> #resumeproficiencies { float: left; clear: right; width: 500px; margin: 20px 0px 30px 30px; } #resumeproficienciestop { float: left; clear: right; width: 100%; margin: -5px 0px 0px 0px; text-align: left; font-weight: 600; } #resumeproficienciesbottom { float: left; clear: right; width: 80%; margin: 2px 0px 0px 0px; } .progress { background:#e9e5e2; background-image: -webkit-gradient(linear, left top, left bottom, from(#dddddd), to(#e9e5e2)); background-image: -webkit-linear-gradient(top, #dddddd, #e9e5e2); backgro

AngularJS routes - views not loading -

i attempting load 2 different partials page. routes seem working. i.e i'm redirected #/view1 default, want. when partials/view1.html not loaded page, , same true when manually navigate #/view2. can't seem figure out missing. here index.html: <!doctype html> <html ng-app="demoapp"> <head> <title>using angularjs directives , data binding</title> </head> <body> <div> <div ng-view> <!-- placeholder views --> </div> </div> <script src="scripts/angular.min.js"></script> <script src="scripts/angular-route.min.js"></script> <script> var demoapp = angular.module('demoapp', ['ngroute']); demoapp.config(['$routeprovider', function ($routeprovider) { $routeprovider .when('/view1', {

android - How to update values while method is running - Java -

so have weird problem cannot understand why doesn't work. building strobe light part of app , have created separate strobelight class. when call turnon method or update method, intervals never changed. guess make easier explain using code: public class strobelight{ private int delayon, delayoff; public void turnstrobeon(){...} public void update(int a_delayon, int a_delayoff){ delayon = a_delayon; delayoff = a_delayoff; } public void turnon(int a_delayon, int a_delayoff){ delayon = a_delayon; delayoff = a_delayoff; this.turnstrobeon(); } depending on whether strobe light on or not, 1 of these methods called change turn on strobe light specified intervals or change intervals. instead of changing intervals custom, application uses smallest possible intervals when calling thread.sleep() flashlight being on or off edit: thread code, , code turns flashlight on public void turnstrobeon(){ ( int = 0; < 3; i++){ isincycle = true;

java - Neither user 10031 nor current process has android.permission.INSTALL_PACKAGES -

i want use packagemanager install self apk, have problems. packagemanager pm = getpackagemanager(); pm.installpackage(uri.fromfile(file), null, packagemanager.install_replace_existing, pakcagename); java.lang.securityexception: neither user 10031 nor current process has android.permission.install_packages. @ android.os.parcel.readexception(parcel.java:1322) @ android.os.parcel.readexception(parcel.java:1276) @ android.content.pm.ipackagemanager$stub$proxy.installpackage(ipackagemanager.java:1951) @ android.app.contextimpl$applicationpackagemanager.installpackage(contextimpl.java:2549) as error says, app not have permission install packages. put: <uses-permission name="android.permission.install_packages"/> in manifest should started.

jQuery addClass & removeClass -

i new in jquery. have 2 div id="widget", default there .active class div1. want remove class when click on div2 , add .active class div2. there html: <div class="progress_widget"> <div id="widget" class="step1 active"> <h1>1</h1> <h3>step 1 of 2</h3><h3 class="hide">choose heating system<br> estimate</h3> </div> <div class="step2" id="widget"> <h1>2</h1> <h3>step 2 of 2</h3><h3 class="hide">tell how contact <br>you</h3> </div> </div> please me!! firstly, can have 1 unique id per page so changed them classes, so <div class="widget step1 active"> <h1>1</h1> <h3>step 1 of 2</h3><h3 class="hide">choose heating system<br> estimate</h3> </div>

class - How to set the central widget of existing MainWidnow in Python PyQt4? -

i have code consists of 3 classes . classes widget1 , widget2 inherit qframe class , consists of several lineedit , combobox user enter information. so, want is: when program launched, firstly bring qmainwindow class widget1 set central widget . the widget1 has check function connected button on it. check button check whether condition true based on data entered user on page. if condition true. want widget2 set central wiget of mainwindow replace existing central widget , widget1 . my question is, how set widget2 central widget of existing mainwidnow class instance? this format of code: class widget1(qtgui.qframe): def __init__(self,parent = none): ...... ...... def check(self): if (condition): #set widget2 central widget on mainwindow class widget2(qtgui.qframe): def __int__(self,parent = none): ..... ..... class mainwindow(qtgui.qmainwindow): def __init__(self,parent = none): qt

text files - how to Write Content into textfile in vb.net -

i created validccc.txt , need write content text file, content shown below content : 00 a0 00 a1 00 a2 10 a0 10 a1 my code follows : filepath = filepath + "\" + strsubmenu + "\" if (not system.io.directory.exists(filepath)) system.io.directory.createdirectory(filepath) end if filepath = filepath + "matrix\" if (not system.io.directory.exists(filepath)) system.io.directory.createdirectory(filepath) end if filepath = filepath + "validccc.txt" if (not system.io.directory.exists(filepath)) file.create(filepath) end if file.writealltext(filepath, string.empty) dim objwriter new system.io.streamwriter(filepath, true) each customeritem listitem in customercodedvlistbox.items each cccitem listitem in ccclistbox.items objwriter.writeline(customeritem.tostring() + space(4) + cccitem.tostring()) next next i have 2 listboxes combination of listbox seleted values should write textfile. before writing

css - How to overlay footer over background -

i in process of build layout , need footer appear following: http://i.stack.imgur.com/v56hd.png currently, footer sits inside of background, while need inside of white area on top of footer background shown: here code have on footer: <footer id="footer"> <div class="container"> <div class="row-fluid"> <div class="column span2"> <h3 class="header"><?php echo $text_information; ?> <i class="icon-caret-down"></i></h3> <ul class="content"> <?php $i=1; foreach ($informations $information) { ?> <li id="inf<?php echo $i;?>"><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a></li>

algorithm - What is the asymptotic time complexity of the following piece of code? -

how come big o notation? float sum = 0 ; ( int = 1; < n ; i++) { sum + = a[i]; } cout << sum; great asked this. went on in class , asked same question. big o notation used describe how efficient or complex algorithm is. o(1) algorithm execute in same time. efficient type of algorithm. example bool bigo(string[] big) { if(big[0] == null) { return false; } return true; } there o(n) depend on size of input. example bool bigo(string[] strings, string value) { for(int = 0; < strings.length; i++) { if(strings[i] == value) { return true; } } return false; } as can tell method can take longer execute depending on input. if strings.length small quick if large length take while. and there o(n^2). involves multiple loops within self. can o(n^3) depending on how deep nested iterations. example bool bigo(string[] strings) { for(int = 0; < strings.length; i++) { for(int j = 0; j < strings.length; j++)

javascript - Drag URL into IE 10 -

i have website, has textarea on can drag , drop urls. when dropped url, display url. in general if drag , drop url ie browser open webpage of url. in ie 8, website, if drop url textarea showing url in textbox, if drop outside textarea opening url page but, in ie 10, eventhough drop textarea opening website of url, instead of showing in textarea! any ideas? basically want override url reading of ie browser when user dropping text on control! example: below code working in ie 8 not in ie 10. (drag url) <html> <head> <script type="text/javascript"> function showresults() { alert("hi"); } </script> </head> <body> <p>drag url onto textbox</p> <input id=txtdragorigin value="" ondrop="showresults()" > </body> </html>

php - CakePHP, How to getting value from another table -

i have 2 table on model , table1 , table2 column on table1 id | content1 column on table2 id | table1_id | content2 i want display content in table1 on table2 , how join column? thanks advance! model\model1.php <?php app::uses('appmodel', 'model'); class model1 extends appmodel { public $usetable = 'table1'; } model\model2.php <?php app::uses('appmodel', 'model'); class model2 extends appmodel { public $usetable = 'table2'; public $belongsto = array( 'model1' => array( 'classname' => 'model1', 'foreignkey' => 'table1_id' ) ); } in controller: $data = $this->model2->find('all'); the generated query select `model2`.`id`, `model2`.`table1_id`, `model2`.`content2`, `model1`.`id`, `model1`.`content1` `db`.`table2` `model2` left join `cake244`.`table1` `model1` on (`model2`.`tab

hadoop - is there any way to control inputsplit in map reduce -

i have lots of small(150-300 kb) text file 9000 per hour,i need process them through map reduce. created simple mr process file , create single output file. when run job job 1 hour data, took 45 min. started digging reason of poor performance, found takes many input-split number of file. guessing 1 reason poor performance. is there way control input split can 1000 file entertained 1 input split/map. hadoop designed huge files in small numbers , not other way. there ways around preprocessing data, using combinefileinputformat .

ios - Auto Layout Constraint from UICollectionViewCell to View from ViewController -

Image
i have uicollectionview can scroll horizontally. cell add constraint main view viewcontroller. because cell of uicollectionview , not subview, xcode report error hierarchy wrong. how that? edit : the purpose or effect want : i have uicollectionview scrolling horizontal. cells of collection view screen pages. on screens labels. when user scroll through pages in collection view label scroll left/right edge of screen stay there , disappear page. group table view section header horizontally. thanks answers, nothing works me. did create 2 constraints: cell.left equal label.left : priority 499 cell.right greateorequal label.right i save left constraint on scroll move did: - (void) scrolloffsetchange: (cgpoint) offset { int x = abs(((int)offset.x%(int)self.frame.size.width)); self.toplableleftconstraint.constant = x; self.toplabels.alpha = 1 - (x/self.frame.size.width)*(x/self.frame.size.width); [self layoutifneeded]; } and ended disappear effe

linux - Page migration fails from CMA(contiguous memory allocator) area -

i facing problem cma. trying allocate device memory through cma(contiguous memory allocation) arm based target board running linux 3.8 kernel. while requesting memory allocation through private cma node, results "no memin cma area". eventhough have reserved required memory. while debugging "_alloc_contig_migrate_range" function found migration of pages failed , resulted in no mem in cma area. while pages satisfying following condition in "migrate_page_move_mapping(migrate.c)" function being migrated. if (!mapping) { /* anonymous page without mapping */ if (page_count(page) != 1) { return -eagain; } return migratepage_success; } other pages fail , returns in migrate_page_move_mapping() if (page_count(page) != expected_count || radix_tree_deref_slot_protected(pslot, &mapping->tree_lock) != page) { spin_unlock_

database - Truncate tables only with on schema -

i'm looking way truncate tables on 1 schema only. i'm getting list of tables on schema: *select name, object_id sys.objects schema_id = (select schema_id('seg'))* but i'm struggling find way truncate result set. thanks points! refer link or try script declare @sql nvarchar(max) = '' select @sql = ( select 'truncate table [' + s.name + '].[' + o.name + ']' + char(13) sys.objects o (nowait) join sys.schemas s (nowait) on o.[schema_id] = s.[schema_id] o.[type] = 'u' , s.name = 'dbo' xml path(''), type).value('.', 'nvarchar(max)') print @sql --exec sys.sp_executesql @sql

Select unique value in many lists in python -

i'd select unique value in many lists, don't know how that: a = [1,2,3,4,5] b = [2,3,4,5,6] c = [5,6,7,8,9] i'd make 1 new list [1,2,3,4,5,6,7,8,9] i know using following done, searching quicker way that. for in (a, b, c): j in eachvalueineachlist: newlist.append(j) list(set(newlist) by way, there thousand of lists in real program. thank much. >>> = [1,2,3,4,5] >>> b = [2,3,4,5,6] >>> c = [5,6,7,8,9] >>> list(set(a + b + c)) [1, 2, 3, 4, 5, 6, 7, 8, 9] to avoid creating temporary list, use itertools.chain : >>> import itertools >>> list(set(itertools.chain(a, b, c))) [1, 2, 3, 4, 5, 6, 7, 8, 9] update (answer comment) if have list of lists, use itertools.chain.from_iterable : list(set(itertools.chain.from_iterable(a_list_of_lists)))

embedded - c code for receiving 8 bit data from hyperterminal to 89c51 -

i doing home automation project don’t know how enable particular pin i.e p1.0 enable when 8 bit data received description: consider, when send 10011101 hyper terminal p1.0 pin enabled when send 10111100 hyper terminal p1.1 pin enabled please send me c code first thing should understand is, need program 89c51 controller receive uart data. can following it should initialize uart baud rate in computer operating. write uart receive function receives uart data , writes in buffer. compare received data data expected. if matches turn on corresponding pin of micro controller. you can find related information here , here

Add a page to wordpress -

i'm in process of building own wordpress plugin.so need create new page(or post) automatically added word press when plugin activated.and removed when plugin deactivated.content in page content typing in plugin. how can that? you can use wp_insert_post function create page or post check http://codex.wordpress.org/function_reference/wp_insert_post ex. // create post object $my_post = array( 'post_title' => 'my post', 'post_content' => 'this post.', 'post_status' => 'publish', 'post_author' => 1, 'post_category' => array(8,39) ); // insert post database $post_id = wp_insert_post( $my_post); you can use $post_id withing add_post_meta or update_post_meta or use post_meta varible install , uninstall page.

sql - Upper case in ALIAS for column Name not working -

in following select statement firstname , middlename alias not appear. want column header in uppercase. select dbo.employee.title sal, dbo.employee.firstname firstname, dbo.employee.middlename middlename dbo.employee i have tried , works fine me. however, here suggested change sql may assist. select title [sal], firstname [firstname], middlename [middlename] dbo.employee

c# - Transpose columns to rows and date row to columns -

this asp.net mvc project. have table like: skill date offered answered abandoned sampleskill1 12/1/2013 53585 52549 1036 sampleskill2 12/1/2013 7170 6997 173 sampleskill1 11/1/2013 45635 45189 446 sampleskill2 11/1/2013 6481 6378 103 sampleskill1 10/1/2013 54838 54208 630 sampleskill2 10/1/2013 7361 7235 126 i trying data in table like: sampleskill1 type oct nov dec offered 53585 52549 1036 answered 45635 45189 446 abandoned 54838 54208 630 the closest have been able doing this: var statslist = db.stats.where(c => c.skill == "sampleskill1").tolist(); var offeredstatsquery = statslist .groupby(c => c.skill) .select(g => new statspivot { skill = g.key, oct = g.where(c => c.date.month == 10).sum(c => c.offered), nov = g.where(c => c.date.month ==

c++ - OpenCV filter2D: Filtering only part of the matrix/image -

i encountered following problem. need filter matrix/image linear filter, want filter pixels have sufficient number of neighbors around (according kernel size). concretely result of filtering 32x32 image 5x5 kernel should of 28x28 size. possible such processing in relatively simple way opencv built-in functions? int kernel_size = 3; cv::mat in_img, out_img; cv::mat kernel = mat::ones( kernel_size, kernel_size, cv_32f )/ (float)(kernel_size*kernel_size); cv::filter2d(in_img, out_img, -1 , kernel); //filtering cv::size size = in_img.size(); cv::rect roi(kernel_size, kernel_size,size.width - 2*kernel_size, size.height - 2*kernel_size); cv::mat cropped = in_img(roi).clone(); //cropping

android - how to read wpa_supplicant.conf file -

can me read /data/misc/wifi/wpa_supplicant.conf file in android device through android app programmatically. i tried below code read information stored in wpa_supplicant.conf file , display information in textview.but returns nothing. try { process psproc = runtime.getruntime().exec(new string[]{"su","-c"});//root file path=environment.getdatadirectory(); file myfile = new file("/data/misc/wifi/wpa_supplicant.conf"); fileinputstream fin = new fileinputstream(myfile); bufferedreader myreader = new bufferedreader( new inputstreamreader(fin)); string adatarow = ""; string abuffer = ""; while ((adatarow = myreader.readline()) != null) { abuffer += adatarow + "\n"; } tv.settext(abuffer); myreader.close(); toast.maketext(getbasecontext(),"done reading sd 'textareaappender.java'", toast.length_short).show(); } catch (exception e)

How to resolve java.lang.NoClassDefFoundError in android? -

Image
i included import.io jar android project, tried run example , got following: fatal exception: main java.lang.noclassdeffounderror: com.importio.api.clientlite.json.jacksonjsonimplementation$1 @ com.importio.api.clientlite.json.jacksonjsonimplementation.<init>(jacksonjsonimplementation.java:17) @ com.importio.api.clientlite.importio.connect(importio.java:235) @ com.gomel.data.importiotest.showandgetdata(importiotest.java:33) @ com.gomel.activities.detailedarticleactivity$1.onclick(detailedarticleactivity.java:40) @ android.view.view.performclick(view.java:4247) @ android.view.view$performclick.run(view.java:17733) @ android.os.handler.handlecallback(handler.java:730) @ android.os.handler.dispatchmessage(handler.java:92) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5289) @ java.lang.reflect.m