Posts

Showing posts from January, 2013

javascript - Loading of data before angular 2 loads router-outlets -

i using angular 2 release version. during app initialisation, need call service fetches user , menu related information. since user related information required components, using *ngif show div containing router-outlet once data loaded successfully. working deprecated router, because of race condition, angular throws error saying not able find router-outlet tag switch between components. how handle such scenario?

c# - iterate through objects with Lists of the object -

i have small program should create simple menu. current problem have object should fill main menu point , under menu points. question is, ilist can have second or third ilist , have no idea how interate on n ilists example: mainnodeobj: nodedtoid = 1, itemcode = 'a' ilist<nodedto> childmenunodes { mainnodeobj: nodedtoid = 2, itemcode = '2', ilist<nodedto> childmenunodes { mainnodeobj: nodedtoid = 3, itemcode = '3', } my problem each childnode can have new childnode , each child node create new object...sounds easy dont know how iterate on n new childnodes methods: private ienumerable<nodedto> sortednodes(int id) { var nodes = loadmenunodes(id); foreach (menunode menunode in nodes .where(s => s.menuitemid == null && s.parentnodeid == null) .orderby(x => x?.sequence)) { nodedto tmpmenunode = new nodedt

c# - .NET Capitalization Rules for Identifiers and property System.Text.Encoding.UTF8 -

why name of property system.text.encoding.utf8 uppercase? according capitalization rules identifiers , fact utf acronym longer 2 characters property should named system.text.encoding.utf8 or wrong? it's uppercase because authored way. the design , implementation of .net 1.0 (and encoding.utf8 goes way there) precedes framework design guidelines in current form, let alone enforcement. result, can find plenty of violations in framework of guidelines. small sample: system.security.cryptography.rngcryptoserviceprovider (and plenty of other classes in system.security.cryptography ) system.text.asciiencoding system.runtime.interopservices.comexception and systematic search show many more. this isn't silly looks: whole reason people come guidelines in first place because notice inconsistencies this, , sit down , come set of rules best reflects current practices. going change capitalization on current classes (and breaking existing software in process) isn

html - Populate input using @Input inside Bootstrap 4 modal -

Image
i have main page table when row clicked on, uses @output send out row's data (i've confirmed data being sent using in place in project). have bootstrap 4 modal pops when click button on left below says "data point information". need take data row clicked on, , populate form inside modal it. main page: modal: html modal: <div class="modal fade" id="mymodal2" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog bodywidth"> <div class="modal-content wide"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">update data point</h4> </div> <div class="modal-body"> <form class="form-inline"

python - Run function after Flask server starts -

this question has answer here: what's right approach calling functions after flask app run? 2 answers i'm trying run after flask server has started. thing found run thread sleep. how can this? this not duplicate because need server listen when method want run, executes. i want notify server sends requests server server listening. problem other server checks if service up. use before_first_request decorator. run function before first request received. here's example @app.before_first_request def startup(): conn.execute("create table if not exists users...") conn.commit() print("database tables created")

ruby - Find last " in strings where " are written as "" -

i'm trying write (ruby) regex capturing double quote closes eviews string. in eviews, strings enclosed double quotes , include actual double quotes in string, write double double quotes: mystr = "item1 item2 item3" mystr2 = """item1"" ""item2"" ""item3""" strings can appear wherever on line, i'm not helped using beginnings , endings of lines. what have far is: ((?<="")|(?<!"))(")(?!") that is, find double quote preceded either 2 double quotes or no double quote , not succeeded double quote. captures closing double quote, sadly opening one. on side note, reason need i'm working yaml file describing eviews syntax sublime text 3. capturing strings, have far: strings: - match: '"' scope: punctuation.definition.string.begin.eviews push: string string: - meta_scope: string.quoted.double.eviews - match: '"' #((?&l

flags - How to decode hex into separate bits in Perl? -

a byte stored 2 hex numbers contains set of flags. need extract these flags, 0's , 1's. iterating on entries in file with: foreach(<>) { @line = split(/ /,$_); $torr = !!((hex $line[4]) & 0x3); # bit 0 or 1 $tory = !!((hex $line[4]) & 0x4); # bit 2 $torg = !!((hex $line[4]) & 0x8); # bit 3 print "$torr,$tory,$torg\n"; } run on data file: 796.129 [1f/01] len:7< 02 01 d5 01 8b 0a 8e 796.224 [1f/01] len:7< 02 01 d4 03 09 a9 b8 796.320 [1f/01] len:7< 00 01 d4 03 07 49 5a 796.415 [1f/01] len:7< 00 01 d4 00 11 a0 ee 796.515 [1f/01] len:7< 00 01 d4 00 00 31 4c 796.627 [1f/01] len:7< 02 01 d4 01 89 c1 fd 796.724 [1f/01] len:7< 02 01 d3 03 06 39 fd 796.820 [1f/01] len:7< 08 01 d4 03 08 40 6f 796.915 [1f/01] len:7< 08 01 d5 00 13 3d a4 797.015 [1f/01] len:7< 08 01 d4 00 00 34 04 actual result - 1,, 1,, ,, ,, ,, 1,, 1,, ,,1 ,,1 ,,1 desired result: 1,0,0 1,0,0 0,0,0 0,0,0 0,0,0 1,0,0 1,0,0 0,0,1 0,0,

rust - How to access a vector multiple times within an 'Option'? -

how access vector within option without rust moving on first access? fn maybe_push(v_option: option<&mut vec<usize>>) -> usize { let mut c = 0; if let some(v) = v_option { in 0..10 { v.push(i); c += i; } } else { in 0..10 { c += i; } } // second access, fails if let some(v) = v_option { in 10..20 { v.push(i); c += i; } } else { in 10..20 { c += i; } } return c; } fn main() { let mut v: vec<usize> = vec![]; println!("{}", maybe_push(some(&mut v))); println!("{}", maybe_push(none)); println!("{:?}", v); } this gives error: error[e0382]: use of partially moved value: `v_option` --> src/main.rs:16:22 | 4 | if let some(v) = v_option { | - value moved here ... 16 | if let some(v) = v_option { |

centos - cvsroot not taken into account or incorrect -

on centos release 6.7 (final) : i've set cvsroot using set cvsroot=:pserver:jay:pwd@hostname.fr:2401:/cvsdata/bus-2010 where jay susername, pwd password, , hostname.fr hostname. i've launch add: cvs add yd and error message : cvs add: cvsroot may specify positive, non-zero, integer port (not `2401:'). cvs add: perhaps entered relative pathname? cvs add: in directory .: cvs add: ignoring cvs/root because not contain valid root. cvs add: no cvsroot specified! please use `-d' option cvs [add aborted]: or set cvsroot environment variable. so i've made change removing ':' after port number : set cvsroot=:pserver:jay:pwd@hostname.fr:2401/cvsdata/bus-2010 and seems taken account : $ echo $cvsroot :pserver:jay:pwd@hostname.fr:2401/cvsdata/bus-2010 but still have same error : $ cvs add yd cvs add: cvsroot may specify positive, non-zero, integer port (not `2401:'). cvs add: perhaps entered relative pathname? what did miss?

composer php - symfony 2.7 base bundle class not found in AppKernel -

i've created symfony 2.7 bundle via generator command , got generated under src/bundle/bundlename, want use bundle via composer able use in project moved bundle files created composer.json bundle { "name" : "extremesolution/payment-handler-vodafone-bundle", "type" : "symfony-bundle", "description": "vodafone redpoints payment handler bundle", "authors": [ { "name": "hazem taha", "email": "hazem.taha@extremesolution.com" } ], "require" : { "php": "^5.5" }, "require-dev": { "phpunit/phpunit": "~3.7" }, "autoload" : { "psr-4" : { "extremesolution\\bundle\\extremesolutionpaymenthandlervodafonebundle\\" : "" } } } and pushed bitbucket private repo , required bundle inside project composer.json , provided repository url ,

c++ - Runge-Kutta 4th order method cumulative errors when iterating -

i trying numerical solution on simple chase problem (moving target+rocket constant speed module) every iteration speed module decreases bit, adding error; , after couple of hundred iteration error blows , speed drops dramatically. however, not case euler method(code below big block) , popping when using rk4 method. i not sure error , why it's happening, input appreciated #include <fstream> #include <iostream> #include <vector> #include <cmath> #include <cstring> #define vx(t,x,y) n*v*((t)*(v)-(x))/pow(((t)*(v)-(x))*((t)*(v)-(x))+((h)-(y))*((h)-(y)),0.5) #define vy(t,y,x) n*v*((h)-(y))/pow(((t)*(v)-(x))*((t)*(v)-(x))+((h)-(y))*((h)-(y)),0.5) using namespace std; class vector { public: double x,y; vector(double xx, double yy):x(xx), y(yy){}; virtual ~vector(){} vector operator-() {return vector(-x,-y);}; friend vector operator-(const vector &, const vector &); friend vector operator+(const vector &, cons

ASP.NET Web API media mapping extensions and help pages -

i've done media type mapping in api can specify format want data in: ie host/api/values.json or host/api/values.xml. have following routes can specify extension on controller or controller/id: config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}.{ext}", defaults: new { id = routeparameter.optional } ); config.routes.maphttproute( name: "api2", routetemplate: "api/{controller}/{id}.{ext}", defaults: new { id = routeparameter.optional } ); the pages generated default ones come new vs 2015 webapi/mvc app template it's autogenerated. when generates shows following examples: get api/values.{ext} api/values/.{ext} <------- notice 1 api/values/{id}.{ext} the first , last 1 work , make sense. it's generating middle 1 doesn't make sense , doesn't work when type in browser. since aut

swift - iOS Action Extension slow loading time -

so, i'm trying decrease loading times action extension i'm writing ios. according to: https://developer.apple.com/library/content/documentation/general/conceptual/extensibilitypg/extensioncreation.html#//apple_ref/doc/uid/tp40014214-ch5-sw7 i should aim loading time below 1 second (if takes long might shut down system prematurely) right loads in around 4 seconds on ipad (a bit faster in simulator) - far ios haven't shut down extension, destructive user experience. as far i'm aware don't have access appdelegate.swift file when working extensions, i'm having hard time figuring out causing slow loading times. does have idea or maybe experience this? thanks! the reason slow loading times launched app extension in debug mode. running app without debugger faster. did not consider @ all, works charm :)

python - Real-time video from numpy array, Python3 -

i have real-time input of array, below: 275 242 280 263 235 179 234 236 233 195 203 190 202... approximately once 10 ms. every array pixel's value of image. want make video stream data. how possible? linux, python 3.4 i found ways, i'm not sure: 1) tkinter 2) matplotlib 3) opencv 4) scipy many thanks

sql - Merge with only 'when matched then update' In Oracle 9i -

i working @ company oracle 9i 9.2, , unable upgrade. a merge update on matched, not insert on not-matched, seems not work in version. i trying do: merge cdlrefwork.pricing d --table insert using v_rec s --table source on ( d.item_id = s.item_id , d.line_type = s.line_type , d.price_code =s.price_code ) when matched update set d.application_id='cpmasi', d.sys_update_date=sysdate, d.operator_id=nvl(s.operator_id, d.operator_id), d.location_id=nvl(s.location_id,d.location_id), d.item_id= nvl(s.item_id,d.item_id), d.line_type= nvl(s. line_type, d.line_type), d.expiration_date=nvl(s.expiration_date,d.expiration_date), d.price_code= nvl(s.price_code,d.price_code), d.to_qty=nvl(s.to_qty,d.to_qty), d.price= nvl(s.price,d.price), d.charge_code=nvl(s.charge_code,d.charge_code), d.soc=nvl(s.soc,d.soc), d.commitment=nvl(s.commitment,d.commitment), d.cambiazo_code=nvl(s.cambiazo_code,d.cam

android - Java POJO not showing null fields in MongoDB -

i new in android , need ask question. have mongodb database post , get records. have pojo in app through send whole object database not showing null fields. want show data this { "name" : "xyz", "logd" : null } but not showing null fields @ all. tried jackson's @jsoninclude.include.always no use. have solution this. thanks. though specifying using jackson library, can't configure mongodb store property if there null.

ibm midrange - Printing unicode using a formatfile -

Image
i'm facing problem trying print spool file has unicode characters (arabic characters), select prtb assign formatfile-prfatcap organization sequential. thing it's working on machine, , doesn't on another, , can't figure out configuration made make arabic printing works. i've made sure graphic character set set 235 , code page set 420 . there else can try make print file able print unicode characters?

Code-Deploy is seccessful but then autoscale terminates all instances -

a new issue has started yesterday months of working correctly nothing being changed jenkins or aws settings i have 5 machines in autoscale group git push triggering jenkins build , use jenkins aws codedeploy module push code-deploy. have deployment set oneatatime. the issue starts when 5 successful , deployment marked successful. new deployment being triggered with: initiated autoscaling deployment config codedeploydefault.allatonce minimum healthy hosts 0 of 1 instances for 5 individual deployments , 5 instances shutting down , terminated. managed grab 1 during net deployment , checked , nothing looks wrong. no errors. cdedeploy daemon running etc. after 5 individual deployments successful servers running fine. what causing of sudden? the new deployment has autoscaling creator caused instance scale event in asg. when deployment group created asg, , has been deployed, every time instance scaled up, deployment triggered sync new instance r

javascript - Slider with setTimeout - 'removeClass is not a function error' -

so asked similar question earlier today, i'm trying upgrade in code had. i'm trying create slider settimeout function, keep getting removeclass not function error on jquery object. here codepen code once again in advance. index.html <div class=container> <img class='isactive' src="http://placehold.it/350x150"> <img class='ishidden' src="http://placehold.it/350x150"> <img class='ishidden' src="http://placehold.it/350x150"> <img class='ishidden'src="http://placehold.it/350x150"> </div> index.scss html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; } body { background: black; } .container { display: inline; //border: 1px solid white; } .slide { } .isactive { visibility: visible; } .ishidden { visibility: hidden; } index.js $(function() { var timer; var $allimgitems = $('img'); var $it

java - NatTable sorting with custom comparator -

i looking @ (509_sortheaderlayer.java) example reference point. i add custom comparator directly sortedlist shown in example below. however, when click on columns in debugger, custom comparator never reaches breakpoint set in first line of compare() method. if add comparator abstractregistryconfiguration works expected (the breakpoint reached when click on column). why setting comparator in sortedlists constructor not work expected? general code snippets shown below: public void setsortcomparatorworks() { sortedlist<t> sortedlist = new sortedlist<>(eventlist, null); init(sortedlist); getnattable().addconfiguration(new abstractregistryconfiguration() { @override public void configureregistry(iconfigregistry configregistry) { configregistry.registerconfigattribute(sortconfigattributes. sort_comparator, new mycomparator<t>(), displaymode.normal); } }); getnattable().configu

ghostscript converting to pdf-a - icc file correct? -

i'm using ghostscript 9.19 on windows system. when run ghostscript batch file, creates pdf. when ghostscript scheduled program, creates pdf without content - there's 1 blank page. command line same in both cases (one long line, split below due formating): gswin32c.exe -sstdout=d:\my_data\gs_stdout.log -dpdfa=1 -dbatch -dnopause -dnooutersave -scolorconversionstrategy=/rgb -soutputiccprofile=d:\my_ps_files\adobergb1998.icc -sdevice=pdfwrite -soutputfile=d:\my_data\my_hopeful_pdfa_pdfa.pdf -dpdfacompatibilitypolicy=1 "d:\my_ps_files/pdfa_def.ps" "d:\my_data\my_hopeful_pdfa_pdfa.ps" > d:\my_data\my_hopeful_pdfa_gs_out.log my_hopefule_pdfa_gs_out.log never gets created. gs_stdout.log created. whether pdf gets created appears related whether or not *.icc file present in directory ghostscript runs. i different output in stdout.log file. when works get: gpl ghostscript 9.19 (2016

javascript - socket.io: multiple connects to same port -

we have client application multiple, independent frames. each frame should able connect separately node.js server on same port. each frame receive different messages. xsp.addonload(function() { var channel= new messagechannel("system.sjef-bosman"); channel.on('company', function(thismessage) {if(thismessage.id=="dd3a") xsp.partialrefreshget("view:_id1:_id4:cccompanypanel", {});}); channel.on('contact', function(thismessage) {if(thismessage.id=="dd3e") xsp.partialrefreshget("view:_id1:_id4:cccontactpanel", {});}); }) xsp global object, dojo. a messagechannel created every frame, using following code: function messagechannel(channelname) { var _this= this; this.socket = io('http://' + window.location.hostname + ':3000'); this.callbacks= {}; this.on= function(evt, callback) { this.callbacks[evt]= callback; }; this.off= function(evt) {

html - How to hide an element from screen reader/voiceover -

i have added following html <a href="url" aria-hidden="true">read more</a> to hide element screen reader screen reader still read more i have tried tabindex=-1 anchor tag , outer div still screen reader read read more text. is there way hide screen reader? may helpful: notes on using aria in html fourth rule of aria use do not use role="presentation" or aria-hidden="true" on visible focusable element .

javascript - Office.js Excel Range getRow gives wrong range address -

Image
in excel tab pane addin want rows range based on active selected rows. initially data located in "sheet1!h5:i16", , select in worksheet rows without tables f.e. "sheet1!8:10" for detect selected rows selected range , load options: excel.run(function (ctx) { var selectedrange = ctx.workbook.getselectedrange(); selectedrange.load(['address', 'rowindex', 'rowcount']); return ctx.sync().then(function() { console.log(selectedrange.address); }); }); it gives me address "sheet1!8:10" , selectedrange.rowindex=7 , selectedrange.rowcount=3 now subtract range row selection: var subsindex = selectedrange.rowindex - 5 // 5 start index h5 and here have row inside data range rowindex, 3. again: whole worksheet rowindex 7, selection, intersected data range, row index 3. now want first row of inside data range rowindex(it must sheet1!h8:i10) whole data sheet1!h5:i16 based on selected rows(selectedr

javascript - The page keeps on refreshing when finally logged in -

so me , group trying make website user has sign , login , go new html page , checks whether user logged on or not, we're using firebase , don't know why page keeps on refreshing constantly.. our code below. firebase.auth().onauthstatechanged(function(user) { if (user) { console.log("logged in"); window.location.href = "home.html"; return false; } else { console.log("not logged in"); } });

javascript - Angular page redirection if returned value is false -

Image
in controller have code logged_status . app.controller('dashboardctrl', function($scope, $stateparams, $http) { $scope.displaysn = ''; $scope.studentnumber = sessionstorage.getitem('student_number'); $scope.get_logged_status = sessionstorage.getitem('logged_status'); console.log("dashboard page logged status: " + $scope.get_logged_status); if(!$scope.get_logged_status) { console.log('should redirect because false'); }else{ console.log('should stay because true'); } }) it getting correct value when test value of , log statement, im getting unexpected result. in image below, instead of getting should redirect because false because $scope.get_logged_status valued false , im getting opposite result. please. coding wrong? please see image here try : if($scope.get_logged_status=="false") maybe item logged_status in sessionstorage considered strin

javascript - Is it possible for a Firefox WebExtension to uninstall itself prior to Firefox version 51? -

is possible uninstall my own firefox webextension (not based on add-on sdk) programmatically in firefox versions prior 51 management.uninstallself api method will available ? well, no. extensions sandboxed enough cannot interact management functions exception of management api. if wasn't implemented in webextensions until ff 51, you're out of luck. can invoke chrome.runtime.openoptionspage (supported since ff 48) present user ui explicitly has "remove" button.

ruby on rails - undefined method `request_uri' ActionDispatch -

i want create mobile version of website i want when visit site mobile device redirect him subdomain m.mywebsite.com but there choice go full site stored in cookies here config app/controllers/application_controller.rb: class applicationcontroller < actioncontroller::base # prevent csrf attacks raising exception. # apis, may want use :null_session instead. protect_from_forgery with: :exception before_filter :set_mobile_preferences before_filter :redirect_to_mobile_if_applicable before_filter :prepend_view_path_if_mobile private def not_authenticated flash[:warning] = 'you have authenticate access page.' redirect_to login_path end def expirated_reset_token redirect_to root_path end # mobile subdomain def set_mobile_preferences if params[:mobile_site] cookies.delete(:prefer_full_site) elsif params[:full_site] cookies.permanent[:prefer_full_site] = 1 redirect_t

json - Python 'ascii' codec can't encode character with request.get -

i have python program crawls data site , returns json. crawled site has meta tag charset = iso-8859-1. here source code: url = 'https://www.example.com' source_code = requests.get(url) plain_text = source_code.text after getting information beautiful soup , creating json. problem is, symbols i.e. € symbol displayed \u0080 or \x80 (in python) can't use or decode them in php. tried plain_text.decode('iso-8859-1) , plain_text.decode('cp1252') encode them afterwards utf-8 every time error: 'ascii' codec can't encode character u'\xf6' in position 8496: ordinal not in range(128). edit the new code after @chriskoston suggestion using .content instead of .text url = 'https://www.example.com' source_code = requests.get(url) plain_text = source_code.content the_sourcecode = plain_text.decode('cp1252').encode('utf-8') soup = beautifulsoup(the_sourcecode, 'html.parser') encoding , decoding possible stil

osx - How can I recursively replace file and directory names using Terminal? -

using terminal on macos, want recursively replace word name of both directory , file name. instance, have angular app , module name article, of file names, , directory names contain word article. i've done find , replace replace articles apples in code. want same file structure both file names , directories share same convention. just information, i've tried use newest yeoman generator create new files, there seems issue it. alternative duplicate directory , rename of files, quite time consuming. got work following script var=$1 if [ -n "$var" ]; crudname=$1 crudnameuppercase=`echo ${crudname:0:1} | tr '[a-z]' '[a-z]'`${crudname:1} foldername=$crudname's' # create new folder cp -r modules/articles modules/$foldername # find/replace in files find modules/$foldername -type f -print0 | xargs -0 sed -i -e 's/article/'$crudnameuppercase'/g' find modules/$foldername -type f -print0 | x

node.js - Create new Folder with Formidable -

i have next code: router.post('/subirarchivo', function (req, res){ var form = new formidable.incomingform(); form.parse(req); form.on('filebegin', function (name, file){ file.path = path.join(__dirname,'../../../../uploads/', file.name); }); form.on('file', function (name, file){ console.log('uploaded ' + file.name); }); res.sendfile(path.join(__dirname,'../../../client/views/fasevinculacion', 'busquedavinculacion.html')) upload file it's fine, but, how create new folder not exists? first need add fs-extra (easier way) , in post, add: fs.mkdirssync(__dirname + '/../public/dist'); form.uploaddir = __dirname + '/../public/dist'; more details: if (req.url == '/upload') { var form = new formidable.incomingform(), files = [], fields = []; fs.mkdirssync(__dirname + '/../public/dist'); form.uploaddir = __dirname + '/../public/dist&#

ruby on rails - Instagram API Unauthorized token although it is a live token? -

i building app instagram's api can search photos tags. unfortunately getting error although have live token (not sandbox one): 400: request requires scope=public_content, access token not authorized scope. user must re-authorize application scope=public_content granted permissions. you have app in live mode basic permission. basic permission getting own photos via api. to access other user's content , search need login scope public_content , approved instagram public_content permission (which not easy btw, try it)

C# File upload to sql database will not work -

i creating page adds product sql table. have seen , modified snippet of code need. string contenttype = imageupld.postedfile.contenttype; using (stream fs = imageupld.postedfile.inputstream) { using (binaryreader br = new binaryreader(fs)) { byte[] bytes = br.readbytes((int32)fs.length); sqlconnection conn = new sqlconnection(webconfigurationmanager.connectionstrings["connectionstring"].connectionstring); sqlcommand cmd = new sqlcommand("insert products (name, image, price, desc, author, preview, contenttype ) values ('" + nametxt.text + "', '" + bytes + "', '" + pricetxt.text + "', '" + desctxt.text + "', '" + session["username"] + "', '" + previewtxt.text + "')", conn); cmd.commandtype = commandtype.text; using (conn) { conn.ope

salesforce - Adding a mass update feature to UI-Grid (AngularJS) -

we calling ui-grid in angularjs salesforce visualforce page. used create editor external users can see list of students , update student information. my goal add function allow user update multiple rows @ once fields/values (defined in menus). appreciate advice whether i'm on right track here or more efficient/functional methodology. the normal row save working, implemented in controller $scope.saverow = function(studentterm) { var promise = $q.defer(); $scope.gridapi.rowedit.setsavepromise(studentterm, promise.promise); var updatablefieldsonstudentterm = { studenttermid: studentterm.studenttermid, appliedforasset: studentterm.appliedforasset, studentidatcollege: studentterm.studentidatcollege, comments: studentterm.comments, dsfscholarshipstatus: studentterm.dsfscholarshipstatus, eligibilityallrequirementsforaward: studentterm.eligibilityallrequirementsforaward, //eligibilityhsgpamet: studentterm.eli

python - PEP8 naming convention on test classes -

i have been looking @ pep 8 -- style guide python code , pep8 -- advanced usage clues on how name test classes. however, never mentioned on both sites, many other sites have looked at, such unittest page in python documentation. consistent style see "capwords". in unittest documentation have examples testsequencefunctions defaultwidgetsizetestcase. what trying find out whether use "name"test or test"name". methods use test_"name" , that's pretty established. regards classes struggling find convention if there's one. would appreciate forum's on this. the documentation unittest suggests, e.g.: class testsequencefunctions(unittest.testcase): def test_shuffle(self): ... def test_choice(self): ... commenting the 3 individual tests defined methods names start letters test . naming convention informs test runner methods represent tests.

java - Select elements from joined ElementCollection -

problem description suppose have data model looks (simplified keep short): @entity class unit { ... } @embeddable class numberwithunit { double value; @manytoone ( fetch = fetchtype.lazy, optional = false ) @joincolumn(name = "unitid") unit unit; } @entity class product { @id int id; @elementcollection @collectiontable( name = "sisu" ) list<numberwithunit> sizeinseveralunits; } that model might not make sense shows structure need work with. now we'd issue query this: select p.id, s product p join p.sizeinseveralunits s the problem, however, hibernate 4.3.11 doesn't produce correct sql statement query , don't know (yet) how fix that. the sql produced looks select product_.id, sisu_.id product product_ join sisu sisu_ on product_.id = sisu_.productid that query fails of course, since there no column sisu_.id . instead hibernate should solve select sisu_.value, sisu_.unitid . in fact, if we'd u

excel - VBA: Loop through different tabs(Charts) to refresh & change the data range -

so gods of vba, require assistance! i need macro runs through 80 tabs, each of them containing single chart plots % vs time. the data plots refer contained in tab; these data scarcely populated (there empty spaces between them) , updated; new lines added in upper part of spreadsheet , measurements reported. of course charts won't update automatically require macro (so far not complicated) far had 1 macro refreshed data range on whole range, , 1 "switch view" last year. thing new columns might added data , in between them, makes fixed ranged referencing useless changed... this it's how has been done until today: sheets("bh1").select activechart.seriescollection(1).xvalues = "='sk'!$c$11:$c$130" activechart.seriescollection(1).values = "='sk'!$d$11:$d$130" sheets("bh2").select activechart.seriescollection(1).xvalues = "='sk'!$f$11:$f$130" activechart.seriescollection(1).values = "

matlab - How do I paste the audioinfo of a music file? -

Image
i want able update text box audioinfo of sound file. the current solution have gives me error info = audioinfo('music1.mp3'); set(handles.edit1,'string',info); running info in console gives me information sound file , stores in workspace right of matlab. want information update textbox ( edit1 ). error: while setting 'string' property of 'uicontrol': string should char, numeric or cell array datatype. can help? i recommend using uitable rather 'edit' uicontrol object . 'edit' uicontrol objects can 1 line can't used anyway, , alternative, 'listbox' can 1 column need sprintf / fprintf data fit. for example: % generate audio file load handel.mat filename = 'handel.wav'; audiowrite(filename,y,fs); clear y fs % build dummy gui f = figure('toolbar', 'none'); t = uitable('parent', f, 'units', 'normalized', 'position', [0.1 0.1 0.8 0.8]); % r

c++ i cant understand the difference between const char* and char* -

this question has answer here: what difference between const int*, const int * const, , int const *? 12 answers i know duplpicate belive me read alot of articles still cant understand diffrence im giving 2 examples. 1. int strlen(const char* string) { int = 0; while (string[i] != '\0') { ++i; } return i; } 2. int strlen(char* string) { int = 0; while (string[i] != '\0') { ++i; } return i; } main: int main() { char str[] = "hello"; cout << strlen(str) << endl; } the second work , wont errors while first wont. case 1: can not change value of string , it's read-only. it's used prevent function changing value of parameter ( principle of least privilege ) case 2: can change value of string . also, check link comments.

jquery - Responsive Navigation SharePoint 2013 Collapse Issue -

i using sharepoint 2013 navigation problem in mobile version when user open menu , taps on child item the parent item collapes , gets clossed. looked out solution found 2 urls how both not working know other workaround make work mobile devices. the links tried under. http://artykul8.com/2015/04/sharepoint-navigation-and-mobile/ http://artykul8.com/2015/04/sharepoint-navigation-and-mobile/

.htaccess - Embedding Custom Font at Blogger -

i try embed custom font within blogger.com-blog. error "downloadable font: download failed" because of "bad uri or cross-site access not allowed", though allowed access on source server via .htaccess; or having trouble google proxy server "source: https://lh3.googleusercontent.com/proxy/ ...". is there way done? greetings vhs

python - settings.database is improperly configured when using Amazon RDS postgres database -

i using django , when load code works when signing admin login. when proceeding after logging in comes database being improperly configured please specify engine value. have added else statement , have tried using local database it. comes 500 http error whenever add in local database. help! if 'database' in os.environ: databases = { 'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': os.environ['database'], 'user': os.environ['datauser'], 'password': os.environ['data!aa'], 'host': os.environ['xxxxxxxxxxxxxxxxxxxxxxxxxxx'], 'port': os.environ['xxxx'], } } i using mac(osx)

android - ontrigger event of cordova local notification plugin not working when the iOS app is in background -

i want auto run function once local notification gets triggered in cordova ios app. t he cordova local notification plugin's ontrigger event working fine when app in foreground stops working moment when app in background ... have used combination of various cordova background plugins .. none worked out.. app strictly requires local notifications so, can't use push notifications instead.. upon research, found ontrigger makes use of didrecievelocalnotification method ios runs in foreground ... ideas guys ??? counting on super nerd power of community ... lol, save boat ...

apache spark - How to load only the data of the last partition -

i have data partitioned way: /data/year=2016/month=9/version=0 /data/year=2016/month=10/version=0 /data/year=2016/month=10/version=1 /data/year=2016/month=10/version=2 /data/year=2016/month=10/version=3 /data/year=2016/month=11/version=0 /data/year=2016/month=11/version=1 when using data, i'd load last version of each month. a simple way load("/data/year=2016/month=11/version=3") instead of doing load("/data") . drawback of solution loss of partitioning information such year , month , means not possible apply operations based on year or month anymore. is possible ask spark load last version of each month? how go this? well, spark supports predicate push-down, if provide filter following load , read in data fulfilling criteria in filter . this: spark.read.option("basepath", "/data").load("/data").filter('version === 3) and keep partitioning information :)

mezzanine - Is there a way to have custom content with mezzanie/Django -

i'm new using mezzanine , figured out how set-up pages can manage content admin page. have static pages, want store content , being able control content admin page. is can mezzanine? i imagine need create model richtext field add model admin interface , somehow access model through templatage. but exact example appreciated. thanks! see docs on creating custom content types . primary approach subclass page model , add custom fields. alternatively, if custom content conceptually independent pages, might make sense create independent models relational fields richtextpage model , edit them through inlines . note mezzanine docs on custom content types , django docs on inlines use same author/book example can compare 2 strategies.

Replace iOS app emoji with twitter open source twemoji -

Image
i want replace standard ios emoji uilable or uitextview twitters open source twemoji . i can't find library or documentation in ios. have solution not involve me implementing scratch? the solution needs efficient , work offline. the question got me intrigued, , after bit of searching on how possible replace all standard ios emoji custom set, noticed twitter's own ios app doesn't use twemoji: in end, came same conclusion you: i can't find library or documentation in ios. so, created a framework in swift exact purpose. it work you, if want implement own solution, i'll describe below how replace all standard emoji twemoji. 1. document characters can represented emoji there 1126 base characters have emoji representations, , on thousand additional representations formed sequences. although base characters confined 6 unicode blocks , 1 of these blocks mixed non-emoji characters and/or unassigned code points. remaining base character

legacy - How to read old Visual Source Safe repository -

i have old (from 2005) visual source safe repository need access research purposes. apparently (and reason) vss software no longer available. there way can read repository? files seem in binary no way dig them directly without sort of interface. actually, never mind, see can still software msdn.

c++ - Invalid unicode while sending a POST request to django with libcurl and jsoncpp -

i've created rest endpoint in django using rest-framework module; simple code goes below: models.py class data(models.model): name = models.charfield(max_length=256) description = models.textfield() def __str__(self): return self.name serializers.py class dataserializer(serializers.modelserializer): class meta: model = data fields = ('name', 'description') views.py def data_list(request): """ list data. """ if request.method == 'get': categories = data.objects.all() serializer = dataserializer(categories, many=true) return jsonresponse(serializer.data) elif request.method == 'post': data = jsonparser().parse(request) serializer = dataserializer(data=data) if serializer.is_valid(): serializer.save() return jsonresponse(serializer.data, status=201) return jsonresponse