Posts

Showing posts from September, 2012

google spreadsheet - Pre-populating a column in a row based on related rows -

i have following dataset in google spreadsheet +-------------------------------------------+------------------+ |software name |operating system | multiple os? | +--------------------------------------------------------------+ |office |windows |yes | |office |mac |yes | |vmware fusion |mac |no | |vmware fusion |mac |no +---------------+---------------------------+------------------+ i been trying find way automatically populate multiple os field yes/no. should occur when there duplicate software entries different operating systems. i expect...

c# - error in XML document. Unexpected XML declaration. XML declaration must be the first node in the document -

Image
there error in xml document (8, 20). inner 1: unexpected xml declaration. xml declaration must first node in document, , no white space characters allowed appear before it. ok, understand error. how it, however, perplexes me. i create document microsoft's serialize tool. then, turn around , attempt read back, again, using microsoft's deserialize tool. i not in control of writing xml file in correct format - can see. here single routine use read , write. private string xmlpath = system.web.hosting.hostingenvironment.mappath(webconfigurationmanager.appsettings["data_xml"]); private object objlock = new object(); public string errormessage { get; set; } public storedmsgs operation(string from, string message, fileaccess access) { storedmsgs list = null; lock (objlock) { errormessage = null; try { if (!file.exists(xmlpath)) { var root = new xmlrootattribute(rootname); var serializer =...

ruby on rails - country_select display full country name on show action -

i use gem 'country_select' choose country form on rails app when go show or index action see stored value. there method convert value full name string of country? [au] => "australia" the documentation includes how exactly want . country = iso3166::country[country_code] country.translations[i18n.locale.to_s] || country.name

javascript - PHP passing params to new string (learning) -

still learning , still many questions here few go. doing javascript -> php conversion , want make sure these practices correct. $dailyparams->$calories = $calories; correct line? again! javascript dailyparams.create4 = function(/*double*/ calories, /*double*/ carbpercent, /*double*/ sodium, /*double*/ actparam) { if (calories < 0.0) calories = 0.0; if (carbpercent < 0.0) carbpercent = 0.0; if (carbpercent > 100.0) carbpercent = 100.0; if (sodium < 0.0) sodium = 0.0; if (actparam < 0.0) actparam = 0.0; var dailyparams = new dailyparams(); dailyparams.calories = calories; dailyparams.carbpercent = carbpercent; dailyparams.sodium = sodium; dailyparams.actparam = actparam; return dailyparams;} dailyparams.create2 = function(/*intervention*/ inter, /*baseline*/ base) { var dailyparams = new dailyparams(); dailyparams.calories = inter.getcalories(); dailyparams.carbpercent = inter.getcarbinpercent(); dailyparams.sodium = inter.getsodium(); dailyparams.actparam ...

Rails 4 / RSpec - Testing time values persisted to MYSQL database in controller specs -

i'm writing pretty standard rspec controller tests rails app. 1 issue i'm running testing time values have been persisted in update action. in controller have: def update if @derp.update_attributes(derp_params) redirect_to @derp, flash: {success: "updated derp successfully."} else render :edit end end @derp has time attribute of type time. can test of other attributes in update action follows: describe "patch #update" before @attr = { attribute_1: 5, attribute_2: 6, attribute_3: 7, time: time.zone.now } end end the error i'm getting is: 1) derpscontroller logged in patch #update updates derps's attributes failure/error: expect(derp.time).to eq(@attr[:time]) expected: 2015-08-24 18:30:32.096943000 -0400 got: 2000-01-01 18:30:32.000000000 +0000 (compared using ==) diff: @@ -1,2 +1,2 @@ -2015-08-24 18:30:32 -0400 +2000-01-01 18:30:32 utc i've tried using timecop ,...

javascript - should js assertion is wrong? -

i'm using should.js && mocha test framework build application. i'm returning 'true' api method , found out should.js accepting true, not. i set following test: describe('login', function(){ it('should login , return true', function(done){ istrue().should.be.true; done(); }); }); function istrue() { return 'false'; } and powershell + mocha result : ps c:\dev\project> mocha --grep logi* login √ should login , return true 1 passing (27ms) am missing something? you forgot trigger assertion: istrue().should.be.true(); ^--- here if check should.js source code see way should.be.true fulfilled when true (a boolean) returned (which not same 'true' string). assertion.add('true', function() { this.is.exactly(true); });

ASP.NET MVC Antiforgery Token in AngularJS Template -

in razor view can following form generate antiforgery token: <form .....> @html.antiforgerytoken() </form> how can generate these antiforgerytoken outside razor view (vanilla html)? in particularly inside angular html template. have pass value angular application or have make call angular application in order retrieve it? i found workaround using token. need create custom filter, instead of having [validateantiforgerytoken] filter have custom one, picks token header rather cookies. not remember source retrieved here is. created filter class. using system; using system.linq; using system.net.http; using system.web.helpers; using system.web.http.filters; namespace cateringapplication.filters { public sealed class validatecustomantiforgerytokenattribute : actionfilterattribute { public override void onactionexecuting(system.web.http.controllers.httpactioncontext actioncontext) { if (actioncontext == null) ...

c# - Getting "Specified file cannot be found" error when mstest is invoked using Process.Start() -

public bool invokemstest() { //string str = " /testcontainer: d:\\test.dll"; processstartinfo startinfo = new processstartinfo { filename = "mstest.exe", workingdirectory = @"c:\program files (x86)\microsoft visual studio 12.0\common7\ide\\", useshellexecute = true, //arguments = str, }; process.start(startinfo); return true; } when run method using console application, throws "the specified file cannot found" error when attempts process.start(startinfo). have confirmed mstest.exe exist in workingdirectory path provided. doing wrong? if copy same exe path , invoke, works fine. please help

java - Why is my constructor not instantiating the variable? -

why value of clowns equal 0 below? if print numofdecks , prints out 3 , expected. public class cardset { private static int numofdecks; char suits [] = {'a','s','h','c'}; char ranks [] = {'a','2','3','4','5','6','7','8','9','t','j','q','k'}; public cardset(int number){ if (number > 0) { this.numofdecks = number; } else this.numofdecks = 3; } public static int getnumofdecks(){ return numofdecks; } static int clowns = numofdecks; public static void main (string [] args){ cardset cards = new cardset(3); system.out.println(clowns); //prints out 0 system.out.println(numofdecks); // prints out 3 } this sets parameter variable's value: else numberofdecks = 3; which not want do. instead should be: else this.numberofdecks = 3; which sets field's value. or more succinctly do: pu...

laravel 5 - How to setup model that has a many to many relationship to both itself and another model and allow sorting? -

i have collections table, components table, , pivot table many-to-many relationship between collections , components. lets me create 'collections' of 'components'. im using rutorika-sortable enable sorting of components. the issue want possibility collection related collection. tried 'collection-collection' pivot table, , problem ran no longer figure out how deal sorting. example, want component a , collection b , component b belong collection a , displayed in order when viewing collection a . sorting no longer works because order columns in 2 pivots independent of each other. im thinking need sort of polymorhpic relationship, im not sure best way go be. how can achieve results want? im not sure if best approach, resolve added one-to-one relationship collections hasone component in addition existing many-to-many relationship. now, component has collection_id field filled in act sort of alias collection. when go through compone...

javascript - .JS Function will continue executing, with wrong values -

as can see simple application, code seems continue using first if statement though isn't correct/relevant anymore. html <div id="slideshow"> <img id="slide" src="images/slide01.jpg" width="600px" height="450px"> <button type="button" onclick="slideshowtimer()">click me!</button> </div> <!--closing slideshow--> js function slideshowtimer() { var img1 = "images/slide01.jpg"; var img2 = "images/slide02.jpg"; var img3 = "images/slide03.jpg"; var slide = document.getelementbyid('slide').src; if (document.slide === document.img1) { document.getelementbyid('slide').src = "images/slide02.jpg"; * * * //keeps executing once value has changed value of 'img2'*** } else if (document.slide === document.img2) { document.getelementbyid('slide').src = "ima...

javascript - Scrollable Bootstrap Carousel/Slider -

good day. have carousel slides vertically. want controlled mouse wheel. can me on js? here's mark $('#carousel').bind('mousewheel', function(e){$(this).carousel('next');}); <style> <!-- html, body { height: 100%; padding: 0; margin: 0; } body { background: #fff; min-height: 600px; } body * { font-family: arial, geneva, sunsans-regular, sans-serif; font-size: 14px; color: #666; line-height: 22px; }--> #wrapper { width: 100%; min-width: 900px; height: 500px; position: relative; left: 0; } #carousel div { height: 100%; float: left; } #carousel img { min-width: 100%; min-height...

c++ - Trailing class template arguments not deduced -

the code below fails compile gcc 7.1.0, complains providing wrong number of template arguments in second line of main. version of gcc supposed implement template argument deduction of class templates. i think compiler should able deduce class template argument t2 bar, means shouldn't have explicitly specify both arguments ( bar<int, int> ) given paragraph 17.8.1.3 of c++17 draft says, "trailing template arguments can deduced (17.8.2) or obtained default template-arguments may omitted list of explicit template-arguments." am wrong? compiler wrong? oversight or deliberate design? template <typename t> struct foo { foo(t t) {} }; template <typename t1, typename t2> struct bar { bar(t2 t) {} }; template <typename t1, typename t2> void bar(t2 t) {} int main(int argc, char **argv) { foo(42); // works bar<int>(42); // fails compile "wrong number of // template arguments (1, should 2)" ...

ios - Swift: function overload resolution via closure parameter? -

i trying solve separate problem related parsing json. in process, ran afoul of swift compiler, expected use closure template arguments select function overload optional types. i haven't seen explicit in documentation on topic, not expectation else equal, swiftc use arguments of closure parameter in generic function select correct overload? here simplest sample come with: import foundation let os:nsstring = "foo!" let d:[string:anyobject] = ["a": os] struct model { var opt:string? var basic:string = "" } func read<t>(source:anyobject?, set:t -> ()) { if let t:t = source as? t { println("basic: read type: \(t.self) value \(source)") } else { println("failed read basic type \(t.self) value \(source)") } } func read<t>(source:anyobject?, set:t? -> ()) { assert(false, "this not called") if let t:t? = source as? t? { println("option...

java - Test connection failed because of an error in initializing provider (instant client) -

i getting error message: test connection failed because of error in initializing provider. oracle client , networking components not found. these components supplied oracle corporation , part of oracle version 7.3.3 or later client software installation. provider unable function until these components installed i want connection application oracle database application print identification card particular person i have instant_client_10_2 on c drive , added path => c:\instant_client_10_2; created tns_admin , set path there => c:\instant_client_10_2; still have error message popping while connecting software database. while connecting odbc in computer works , test connection successful. i using 64-bit os, , instant client 64-bit

Pinnacle cart website directly showing html css code and not taking any affect -

i have pinnacle cart website. hacked , recovered problem facing website directly showing html tag , css style code below. <b>award winning products</b> | <b>crown , bridge</b> | <b>dentures</b> | <b>impression materials</b> | <b>x-ray processing</b><br><i>one minute @ chairside</i> | <b>anti-fog system</b><br><i>mirror wipe</i> | <b>saliva ejector holder</b> or <div style="font-size:18px;">sore-spotter</div>locate sore spots in seconds website design ok. menu, products, content etc html tag , css style showing directly , not taking affect on browser. why happening ? it helpful if give more code work with, there nothing wrong code provided. however, problem due file names in header or lacking proper .html or .css file extension, , apache server doesn't know better serve them text. you can try troubleshooting @ http...

ios - How To Only Animate Contents of UIImageView -

how animate contents of uiimageview ? if image view centered in middle of screen how animate image slide in left shown within frame of image view? as if looking @ wall window , walks by. don't see them until in frame of window. the code below not it. had few days ago ease , erased , can't remember how did it. pretty simple it's driving me crazy. self.lockimages[button.tag].center.x -= self.lockimages[button.tag].bounds.width uiview.animatewithduration(2.0, delay: 0.0, usingspringwithdamping: 0.5, initialspringvelocity: 1.0, options: nil, animations: { () -> void in self.lockimages[button.tag].center.x += self.lockimages[button.tag].bounds.maxx }, completion: { (bool) -> void in }) uiimageview subclass of uiview , inherits .clipstobounds() method, create desired effect.

Android desing support lib change the Tab indicator -

Image
current there no method set drawable in tabindicator of tablayout design support lib. is there other way set drwable tabindicator? you have set title values yourself see code snippet: public void setuptablayout(tablayout tablayout) { tablayout.settabmode(tablayout.mode_scrollable); tablayout.settabgravity(tablayout.gravity_center); tablayout.setupwithviewpager(mviewpager); textview tab = (textview) layoutinflater.from(this).inflate(r.layout.custom_tab, null); tab.settext("library"); tab.setcompounddrawableswithintrinsicbounds(0, r.drawable.ic_tabbar_library, 0, 0); tablayout.gettabat(0).setcustomview(tab); //.. } custom_tab.xml <?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tab" /> maybe...

java - How can I get all triggers for a job? -

is there way triggers job, job class name? something scheduler.gettriggersofjob(jobkey.forclassname('my.awesome.classname')) no there no direct way. but, can scheduler#getjobkeys(groupmatcher<jobkey> matcher) find job keys group or use jobkey jobkey(string jobname) find key job name. list<trigger> triggerlist = (list<trigger>) yourscheduler.gettriggersofjob(yourjobkey); moreover, if have jobdetail can directly retrieve jobkey jobdetail.getkey()

mysql - SQL substring Issue ( Where substring(...) = (select....) ) -

i'm trying search dirname full path using queries. select `file_name` `tbl_files` substr(`file_path`, locate('/',`file_path`)+1, (char_length(`file_path`) - locate('/',reverse(`file_path`)) - locate('/',`file_path`))) = (select `source_path` `tbl_transcode_folder` `trancode_folder_id` = 1 ) but return me nothing. when replace (select source_path tbl_transcode_folder trancode_folder_id = 1 ) it's result mnt/hd/1 queries below , it's response want dont want in way. select `file_name` `tbl_files` substr(`file_path`, locate('/',`file_path`)+1, (char_length(`file_path`) - locate('/',reverse(`file_path`)) - locate('/',`file_path`))) = `mnt/hd/1` right sub-query returns random row table need define relation between tbl_transcode_folder table, need define relation between outer query , sub-query make them correlated select `file_na...

xmpp - ejabberd consume too much memory when announce all -

when send message mydomain/announce/all, following errors, , message not sent. (ejabberd@localhost) process <0.20027.1> consuming memory: [{old_heap_block_size,45988046}, {heap_block_size,22177879}, {mbuf_size,0}, {stack_size,19}, {old_heap_size,35268382}, {heap_size,7381863}] [{current_function,{lists,reverse,1}}, {initial_call,{erlang,apply,2}}, {message_queue_len,99477}, {links,[<0.20030.1>]}, {dictionary,[]}, {heap_size,22177879}, {stack_size,17}] what's problem? the message come debug module, used troubleshot memory issue when developing ejabberd module. no think should worry it. probably, should not run watchdog in production.

c++ - Error building TMXParser using CMake -

i'm trying build on visual studio 2013. set include , library paths zlib , tinyxml2 , generated projects using cmake. when try build it, these errors: 1>------ build started: project: tmxparser, configuration: debug win32 ------ 2>------ build started: project: tmxparser_static, configuration: debug win32 ------ 1>cl : command line error d8021: invalid numeric argument '/werror=strict-prototypes' 2>cl : command line error d8021: invalid numeric argument '/werror=strict-prototypes' 3>cl : command line error d8021: invalid numeric argument '/werror' 5>------ skipped build: project: install, configuration: debug win32 ------ 5>project not selected build solution configuration ========== build: 1 succeeded, 3 failed, 1 up-to-date, 1 skipped ==========

javascript - jquery code not working with internet explorer - select box option based on another select box -

i have jquery script used show/hide values depending on select box , although works in firefox , chrome, doesn't work in ie var otherselectoption = $('#select1,#select2,#select3').find('option').filter(function(){ return $(this).attr('value') != ""; }); $('#selectlist').change(function(){ var selected = $(this).val(); otherselectoption.hide().filter(function(){ return $(this).attr('value').indexof(selected) > -1; }).show(); }); link demo here: http://jsfiddle.net/8g13wc5g/ also, each time select "---filter---" option rest of bottom 3 select boxes reset default value blank full set of options. you can not in ie. can rather disable/enable options instead of hide/show in case of ie. other solution add/remove options instead of show/hide. not feasible on enable/disable options solution. second part of question can add prop('selected', true) set relevant options selected var o...

How to use flex option -o (--output=FILE) -

i met problem when trying flex abcd.l . wanted redirect output new file instead of default 1 lex.yy.c looked in manual finding option -o(--output=file) changed command flex xx.l -o lex.yy.1.c error occurs. flex: can't open --outfile=lex.yy.1.c /usr/bin/m4:stdin:2621: error: end of file in string my working environment cygwin , windows 7 you need put command line options before positional arguments: flex -o lex.yy.1.c xx.l once positional (filename) argument recognized, flex assumes following arguments filenames. normal form of argument processing command-line utilities, although (gcc, example) allow options follow filenames. (personally, i'd suggest using filename xx.lex.c , principle same.)

ios - ambiguous "use of unresolved identifier" error? -

Image
i'm getting use of unresolved identifier error pretty ambiguous me, appears on following line : however "luttonsdataconverter" initialized in following file : // // luttonsdataconverter.h // imglykit // // created carsten przyluczky on 29/01/15. // copyright (c) 2015 9elements gmbh. rights reserved. // #import <foundation/foundation.h> @interface luttonsdataconverter : nsobject + (nullable nsdata *)colorcubedatafromlutnamed:(nonnull nsstring *)name interpolatedwithidentitylutnamed:(nonnull nsstring *)identityname withintensity:(float)intensity cacheidentitylut:(bool)shouldcache; /* method reads lut image , converts cube color space representation. resulting data can used feed cicolorcube filter, transformation realised lut applied core image standard filter */ + (nullable nsdata *)colorcubedatafromlut:(nonnull nsstring *)name; @end i may add, variable became "unresolved" when dragged whole folder pods project target regular proje...

php - Is google+ api necessary for Laravel's Socialite OAuth ? And also how to limit permissions? -

Image
i using socialite in laravel 5.1 project. using google oauth socialite requires compulsory google+ api enabled or else throws clientexception in middleware.php line 69:client error: 403 even after disabling google api screen don't wish ask who's in circle . want fields returned socialite - id, nickname, name, email-id & avatar the permissions in consent screen controlled scope send. sending scope of https://www.googleapis.com/auth/plus.login . remove , request permissions user, wont able access there google+ data. also cant change permissions scope gives supplied google. if want persons id, nickname, name, email address can try profile scope think gives information should check documentation , test yourself.

machine learning - Features from line segments -

Image
what best feature differentiate line segment groups such following? train line segments extracted images classification. edit: sample each class

c# - Calling JavaScript function from [WebMethod] -

Image
i need call javascript function shows bootstrap modal. have following code: [system.web.services.webmethod()] [system.web.script.services.scriptmethod()] public static void execmodal(string groupname, int zw) { //need generate data first stringbuilder sb = new stringbuilder(); generate gen = new generate(); sb = gen.generatedeepertable(zw, groupname); //insert placeholder //append html string placeholder. fillph(sb); //run javascript function <showmodel> show modal } here how call execmodal method form js: <script type="text/javascript> function callgendeepertable(zw, groupname) { pagemethods.execmodal(groupname, zw); } </script> the function execmodal called javascript function in .aspx site. how can call javascript function showmodal ? your execmodal method on server. have not specified want invoke (call) from, since you've decorated (added attributes method defi...

encryption - Coldfusion "AES/CBC/PKCS5Padding" decryption in Ruby -

i need decrypt text encrypted using aes/cbc/pkcs5padding scheme. encrypted text got generated using coldfusion. cfml example below: <table border="1" cellpadding="5" cellspacing="0"> <tr bgcolor="c0c0c0"> <th>decrypted string</th> <th>3deskey</th> </tr> <cfset variables.algorithm ="aes/cbc/pkcs5padding"> <cfset variables.seed ="c610297ce8570750"> <cfset variables.password = "vza0o49shpie/mr4+4jhxhapmkheyl5o2nzzdxvnqbo="> <cfset variables.decryptedstring = decrypt(variables.password, generate3deskey("#variables.seed#"), "#variables.algorithm#", "base64")> <cfoutput> <tr> <td>#variables.decryptedstring#</td> <td><cfoutput>#generate3deskey("variables.seed")#</cfoutput></td> ...

How to delete a row in a grid in C# windows phone 8.1 -

i have started developing windows phone application i'm creating row in grid dynamically. upon conditions need delete row , content in row. here sample code. result = e.parameter string; string[] acst = result.split('|'); int j = 0; root2.rowdefinitions.add(new rowdefinition() { height = new gridlength(10) }); (int = 6; < acst.length - 1; i++) { textblock mytextblock = new textblock(); mytextblock.name = "txtdetails" + root2.children.count + 1; mytextblock.text = acst[i + 1]; if (mytextblock.text != "") { if (mytextblock.text.trim() != "0.00") // if result 0.00 have delete content in row. { if (j == 0) { mytextblock.fontsize = 14; mytextblock.istextscalefactorenabled = false; ...

spring - Passing of list of type Baseclass between Webservices involving generics and conversion of polymorphic types -

i have 2 rest services using spring boot running on 2 different servers. using rest template communication. there models shared these 2 services. these models of type 'idatatotransferred' . 'idatatotransferred' marker interface implemented various model beans. i need write common logic passing list of these models between these rest services. hence wrote logic uses parameters list<? extends idatatotransferred> sender service receiver service. update: code idatatotransferred.java marker interface datatobesent.java datatobesent implements idatatotransferred{ //simple pojo } senderservice.java senddata(list<? extends idatatotransferred> uploaddataobjectlist){ //some code rest template //resttemplate.postforentity } idatatotransferred interface shared between communicating webservices. datatobereceived.java datatobereceived implements idatatotransferred{ //simple pojo } receiverservice.java receivedata(list<? ext...

php - How to fetch array in correct order -

how fetch array in correct order ? i printing array not fetching in correct order. i want each track value contain array of date , array of number respectively. please give solution .any highly appreciated. my code fetch array are: <?php foreach($posts $post) { $array['track_value'][] = $post->track_value; $array['track_value']['date'][] = $post->date; $array['track_value']['num'][] = $post->num; } ?> from getting wrong value these: <?php array ( [track_value] => array ( [0] => mobile [date] => array ( [0] => 2015-08-23 [1] => 2015-08-24 [2] => 2015-08-23 [3] => 2015-08-24 [4] => 2015-08-22 [5] => 2015...

jboss - Fuse Container is not running -

i'm working on apache camel's fuse project . i'm trying deploy application fabric8. have installed stuffs required . i created container . deployed application via command fabric8:deploy on web-based console, after creating child container (under root container) found out container not running start button child disabled could'nt run it. what should ?.

C++ - Wait for user input but print the next line -

so making gui ascci, wait user input print last line of ascci border. of wait user input , print last ascci border line. there anyway fix this? example of want: login screen ====================================================== welcome bank beta 0.1 ------------------------ (1)login (2)create account user input here ====================================================== example of getting: ====================================================== welcome bank beta 0.1 ------------------------ (1)login (2)create account user input here here's code: void login () { cout << "======================================================" << endl << "\t\twelcome bank beta 0.1" << endl << "\t\t------------------------" << endl << endl << "\t\t (1)login" << endl ...

javascript - Global variables for unit tests in SailsJS app -

i'm working on sails app, , unit tests, need use variable in ./test/bootstrap.test.js , in ./test/unit/controllers/*.test.js. think global variables, how can create them ? i create ./config/mydatatest.js : module.exports.myconf = { anyobject: { bar: "foo" } }; but there way create mydatatest.js in test directory ? i idea of considering test specific environment development or production . create environment-specific file config/env/test.js put configuration: /** * test environment settings */ module.exports = { myconf: { anyobject: { bar: "foo" } } }; then, add node_env=test command launch tests (based on the example documentation ) "scripts": { "start": "node app.js", "debug": "node debug app.js", "test": "node_env=test mocha test/bootstrap.test.js test/unit/**/*.test.js" }, i use technique use sails-memory adapter...

python 2.7 - How to filter fields in one2many base on it's many2one? -

we know class sale_order has sale_order_line . wondering how can filter/set default value fields. here illustration. in class res_partner, add field of type selection: 'part_type' : fields.selection([('child','child'),('adult','adult'),('senior','senior')],'partner type') in sale_order_line, add this: 'rule_applied' : fields.selection([('low','low'),('lower','lower'),('lowest','lowest')],'rule') now, if user selects partner in sale_order , if tries add item on sale_order_line , want set default value of rule_applied according criteria: if partner_type of selected partner child default value of rule_applied lowest, if senior lower , if adult low. i tried method not work: def default_get(self, cr, uid, fields, context=none): res = super(sale_order_line, self).default_get(cr, uid, fields, context=context) _logger.info(...

amazon s3 - how to show video with signed url of s3 object in open edx? -

i have open edx plateform using s3 videos displaying lectures. need display s3 videos signed url new open edx plateform. not able find should make changes. have found video_module not getting change , how know solution big can please me path can work upon it. thank you

php - How to remove breadcrumbs if “home” in wordpress static front page -

i found 1 remove breadcrumbs if "home" in wordpress sadly not working me <body<?php if(! is_home()) echo ' id="homepage"';?>> in header.php body#homepage#breadcrumbs {visibility: hidden;} and added in style.css first change css this. because breadcrumb trail uses class of breadcrumbs , not id. body#homepage .breadcrumbs have tried using is_frontpage() instead of is_home() ? realize @ moment adding homepage id pages not "home" page? don't use ! in if. <body<?php if(is_frontpage()) echo ' id="homepage"';?>> blog postspage = frontpage on site front page: is_front_page() return true is_home() return true static page = frontpage on page assigned display site front page: is_front_page() return true is_home() return false on page assigned display blog posts index: is_front_page() return false is_home() return true

Delete duplicate records from SQL Server 2012 table with identity -

i trying replicate scenario need delete duplicate rows table except one. rows have unique identity column. for making things easier, created small test table student , script below. create table student ( id int, rollno int, name varchar(50), course varchar(50) ) go insert student values(1,1335592,'john','biology') insert student values(2,1335592,'john','biology') insert student values(3,1335592,'john','biology') insert student values(4,1335592,'john','biology') insert student values(5,1335593,'peter','biology') insert student values(6,1335593,'peter','biology') insert student values(7,1335593,'peter','biology') go select * student this generate table below. id rollno name course 1 1335592 john biology 2 1335592 john biology 3 1335592 john biology 4 1335592 john biology 5 1335593 peter biology 6 1335593 peter bio...

Stata: calculating growth rates for observations with same ID -

i want calculate growth rates in stata observations having same id. data looks in simplified way: id year b c d e f 10 2010 2 4 9 8 4 2 10 2011 3 5 4 6 5 4 220 2010 1 6 11 14 2 5 220 2011 6 2 12 10 5 4 334 2010 4 5 4 6 1 4 334 2011 5 5 4 4 3 2 now want calculate each id growth rates variables a-f 2010 2011: for e.g id 10 , variable a be: (3-2)/2, variable b : (5-4)/4 etc. , store results in new variables (e.g. growth_a , growth_b etc). since have on 120k observations , around 300 variables, there efficient way (loop)? my code looks following (simplified): local variables "a b c d e f" foreach x in local variables { bys id: g `x'_gr = (`x'[_n]-`x'[_n-1])/`x'[_n-1] } fyi: variables a-f numeric. but stata says: 'local not found' , not sure whether code correct. have sort year first? the specific error in local variables ...

php - how create afterAction for every method of controller in yii2? -

is afteraction works every action of controller in yii2???? if not how should make afteraction every method of controller??? yes, afteraction() event handler triggers every action in controller. take @ official docs method: this method invoked right after action executed. the method trigger event_after_action event . return value of method used action return value. if override method, code should following: public function afteraction($action, $result) { $result = parent::afteraction($action, $result); // custom code here return $result; } if need limit execution of code specific actions, can use $action variable this: for single action: if ($action->id == '...') { ... } for multiple actions: if (in_array($action->id, [..., ...]) { ... } or can use $action->uniqueid instead.

c# - How to know if Window Close was completed or cancelled? -

wpf application. window1 can open windowa.show(), windowb.show(), windowc.show() when close window1 want close open windows (a, b , c). on window1_closing event call windowa.close(); windowb.close(); windowc.close(); on window closing of of these cancel = true can called , windowa (or b or c) won't close. don't want close window1 (the parent). how know in window1_closing if of child windows cancelled (not closed)? window.closed event fired after window closed. either move logic eventhandler of closed event, or use event send flag: bool isclosed = false; windowa.closed += delegate { isclosed = true; }; windowa.close(); if (isclosed) { } application.current.windows collection of opened windows: windowa.close(); bool isclosed = !application.current.windows.oftype<window>().contains(windowa);

java - How to split a string with preceding Zeros using regular expression? -

how can split string a000101 a000 , 101 , 000101 000 , 101 using same regular expression. i tried "a000101".split("(?<=\\d)(?=\\d)|(?<=\\d)(?=\\d)&(?!=0)") output a , 000101 edit : can a0000 , 0 a00000 using same logic ? it seems easier me use matcher instead of split : string str = "a000101"; pattern p = pattern.compile("([^1-9]*)([1-9]\\d*)"); matcher m = p.matcher(str); if (m.matches()) { string prec = m.group(1); string post = m.group(2); }

music - How to play a playlist on Firefox OS? -

how can play playlist (m3u, pls) on firefox os? if formats aren't support, there other formats or workarounds have own playlists (instead of albums , predefined ones, highest rated)? the <audio> , <video> elements provide support playing audio , video media in firefox-os , w3c html5 specification not support playlist file formats. however, can create own media player or use existing media player libraries. remember, .m3u , .pls plain text formats. can request playlist files device storage api or ajax within apps root folder further parsing . see firefox os media formats (mdn)

java - Spring MockMvcResultMatchers jsonPath lower/greater than -

i'm using mockmvcresultmatchers test controller classes. here sample code requestbuilder request = get("/employee/") .contenttype(mediatype.application_json) .accept(application_json_utf8); mockmvc .perform(request) .andexpect(status().isok()) .andexpect(jsonpath("$.total").exists()); but how can compare $.total value number? i mean, there way find out $.total > 0? json path value method can take org.hamcrest.matcher parameter. can use greaterthan class: jsonpath("['key']").value(new greaterthan(1)) this class org.mockito.internal.matchers package.

backbone.js - backbone validation how to perform an OR condition based validation -

in backbone based project, have form in 1 of set of input fields mandatory. example, input box phone numbers entered, or uploaded file contains phone numbers. i trying use thedersen backbone validation http://thedersen.com/projects/backbone-validation/ . validation patterns , methods seem oriented on per field basis, , not on combination or. is there way write validator 1 of fields mandatory? you define custom "required" validator special case. in function check if @ least 1 option (phone number or file) given. something this: validation: { attribute: { required: function(val, attr, computed) { return !(val || app.models.phonefile) } } }

javascript - Angular data object key rename -

i know i'm missing simple. i have object in $scope value. want reneame 1 of property. so assume have $scope.data = { prop1: value1, prop2: value2} now want object be: $scope.data = { newprop: value1, prop2: value2} i tried $scope.data.prop1 = newprop; delete $scope.data.prop1; but have not success how correctly angular data object? thanks update for more info: i tried update object child controller, called $scope.$parent.data i think meant $scope.data.newprop = $scope.data.prop1; delete $scope.data.prop1; jsfiddle demo