Posts

Showing posts from January, 2015

tfs2013 - Create bug on failed release -

i have customized xaml tfs build building sql server project , it's deploying .dacpac file target database. in case of failure build creating bug in tfs. i'd move "deploy" part tfs build release management area. it's possible accomplish same result tfs release management? in case of release failure automatically create bug in tfs. update 1: referring vnext templates. out of box? no. you write powershell script or .net application uses tfs api create bug, call in "rollback always" block within rm release template, though.

javascript - Sum all properties in object -

i have following object: {"speed":299,"equipment":49,"teleabb":49,"additional":50,"optional":"299"} i want sum values , print out. how can sum properties values? :) iterate on object properties using for(var in) use parseint since of integers in string form var obj = {"speed":299,"equipment":49,"teleabb":49,"additional":50,"optional":"299"}; var sum = 0; for(var key in obj){ sum += parseint(obj[key]); } document.write(sum);

magento - Creation of bundle products in a loop -

i have loop create several bundle products programmatically. creation of new bundles works fine, if have existing bundle , try add/remove options, fails. if run import code first time, bundles created. second time, options removed , last bundle of array has options set. $ids = [8663,8665,8664]; foreach ($ids $id) { createbundle($id); } function createbundle($id) { mage::unregister('product'); try { $bundleproduct = mage::getmodel('catalog/product')->load($id); mage::register('product', $bundleproduct); // try assigned options , remove them $selectioncollection = $bundleproduct->gettypeinstance(true)->getselectionscollection( $bundleproduct->gettypeinstance(true)->getoptionsids($bundleproduct), $bundleproduct ); // remove assigned options // works fine foreach ($selectioncollection $option) { $optionmodel = mage::getmodel('bu...

sql - How to find list of tables used in stored procedure without "With (nolock)" words -

i have large table data , each table need end statement (nolock) @ end , please me find in stored procedure. example: if store-procedure used 2 tables , b , 1 table b doesn't end (nolock) need return following details. sp_name,table_name if understand correctly, looking store procedure names have nolock keyword: select routine_name, routine_definition information_schema.routines routine_definition '%nolock%' , routine_type='procedure'

user interface - Creating a vertically draggable container in Adobe Flex 3.5 -

i attempting create container can drag bottom edge down increase height of container. cannot find container default or 1 apply functionality setting property (resizable="true"). the vdividedbox has dragging functionality similar looking for, however, can used drag divider located between 2 panels within preset height, cannot increase height of vdivivdedbox need happen. i have found few examples use wrapper class wraps uicomponent implement dragability. however, trying avoid adding several different classes achieve effect. the source code below uses mx:hbox contain , display text, however, willing use different container if allows me implement vertical dragability need. if has solution, or link solution, greatful. .... <?xml version="1.0" encoding="utf-8"?> <mx:windowedapplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="750" width="1080" xmlns:a...

java - Using intent between activities, in reverse - Android -

i quite new android programming (aswell java in general) , have run issue has me stumped. building basic app (for practice) accesses built website www.shodan.io . far know there no android app particular site yet , quite enjoy research. have app has 4 activities, of load beautifully (after stack forums). are: loadingpage, mainactivity, searchpage, , exploitsearch. on mainactivity, have webview display different pages, buttons switch between, logos, etc. search , exploit buttons each load respective pages without issue. question/problem. i have search , exploit activities take input (which purpose), save said input string, accessible mainactivty , used search query url. my search far has turned many forums telling how take data activity1 , have readable activity2 using "intent". however, cant seem find resources doing reverse, or saving string (maybe in temp file, , preferably can recalled later... kinda "input"+\n not overwritten) thank time (ps. let me k...

python - How to slice middle element from list -

rather simple question. have list like: a = [3, 4, 54, 8, 96, 2] can use slicing leave out element around middle of list produce this? a[some_slicing] [3, 4, 8, 96, 2] were element 54 left out. would've guessed trick: a[:2:] but result not expected: [3, 4] you cannot emulate pop single slice, since slice gives single start , end index. you can, however, use 2 slices: >>> = [3, 4, 54, 8, 96, 2] >>> a[:2] + a[3:] [3, 4, 8, 96, 2] you wrap function: >>> def cutout(seq, idx): """ remove element @ `idx` `seq`. todo: error checks. """ return seq[:idx] + seq[idx + 1:] >>> cutout([3, 4, 54, 8, 96, 2], 2) [3, 4, 8, 96, 2] however, pop faster . list pop function defined in listobject.c .

c++ - Eclipse error parser ignores template "call stack" -

g++ outputs template instantiation errors like: in file included ... file : in instantiation of ... file:line:pos required ... file2:line:pos required ... and on but error parser detects first "required from" line effect can't jump directly source code position. possible change that? find myself in need check complete callstack find mistake , quite convenient...

javascript - How can print out my object properties base on my dropdown-menu? -

i have dropdown-menu option : a, b. have 2 objects : a, b. their property var = { name:"andrew", age:26, country:"united states" }; var b = { name:"barry", age:23, country:"italy" }; i want display information when selected drop-down menu, , vice of versa. <!doctype html> <html> <head> <title>json</title> </head> <body> <form> student : <select id="dd" onchange="mystudent()"> <option value="a">a</option> <option value="b">b</option> </select> <p>selected student : <input type="text" id="student" size="2" value="a"> </p> </form> <div id="result">details : <br> </div> </body> <script type="text/javascript"> funct...

Capybara: is there opportunity to pass Capybara::Node::Element to jquery? -

i try write code can used while page has lot of elements same selectors , values. need things particular element capybara not know - add or remove class, change background color. when need select particular element many array of capybara::node::element after searching of .all , example. there opportunity pass 1 of such elements jquery in understandable format jq? simple passing same way pass css selectors gives error unknown error: syntax error, unrecognized expression: #<capybara::node::element:0x00000003e60d90> alternatives known me :nth-of-type() /which tried, , did not work stable me, still cannot understand why worked in majority of cases/ straight in jquery: collecting similar selectors array, slicing through , making stuff need. acceptable, has disadvantage: provides more scripts in capybara. is there chance straightly pass result of search of .all jquery or other alternatives? p.s. resuming briefly, issue 1 result can understandable both capybara , ...

actionscript 3 - How can i get a function to use any movie clip? -

i'm little lost in understanding kind of function, feeling has been asked thousand times cannot find explanation of code doing. basically want movie clip instance name box something, reuse function other movie clips afterwards a little this, working. many thanks //my function used on "instance name" box myfunc (box); function myfunc (); { while (this happening); { //in case box.x = goes ever put .x = goes here .y = goes here } } sorry it's not quite english, communication skills terrible sure can that. give function parameter, refer parameter change properties. such simple movement function accept displayobject - distant superclass of movieclip , superclass many other possible classes of objects can displayed flash. function myfunc(param:displayobject):void { // no semicolon after declaring function! while (somethingishappening(param)) { // why not call query on object? param.x+=1; // move rig...

c++ - defining copy constructor and assignment operator -

this question has answer here: what rule of three? 8 answers it's first time dealing classes in c++. wondering if me design copy constructor , assignment operator following class. the following post talks rule of threes, what rule of three? although, not clear how implement code. info.h #ifndef info_h #define info_h class info{ public: std::string label, type; unsigned int num; double x, y, z, velx, vely, velz; void print(std::ostream& stream); void mod_print(std::ostream& stream); void read(std::istream& stream); void mod_read(std::istream& stream); double distance(info *i,double l); info(std::istream& stream); info(){}; }; #endif info.cpp #include "info.h" void info::print(std::ostream& stream) { stream << label <...

Changing Row Color by specific Condition WPF Datagrid -

i have exact same problem guy: how change row color in datagridview? the differenence use wpf. .rows doesnt exist. of have clue how solve this? i solved this: private void dganzeigekostenstelle_loadingrow(object sender, datagridroweventargs e) { try { if (convert.toint32(((system.data.datarowview)(e.row.datacontext)).row.itemarray[5]) > convert.toint32(((system.data.datarowview)(e.row.datacontext)).row.itemarray[4])) { e.row.background = new solidcolorbrush(colors.orangered); } } catch { } }

javascript - if Android Device and not google chrome (conditional) -

anyway write conditional; only if android device , not google chrome something. so, detect if android (easy via below) based on if android and not google chrome; instance android users not using google chrome. any ideas if possible add such condition in similar format below? (this works detecting android, need add condition if android , not chrome > something) // var ua = navigator.useragent.tolowercase(); // var isandroid = ua.indexof("android") > -1; //&& ua.indexof("mobile"); // if(isandroid) { // alert("android!"); // } and found can detect chrome below (no way combine them?) var is_chrome = navigator.useragent.tolowercase().indexof('chrome') > -1;

java - Enabling a jbutton at startup -

i have login form , mainform. in mainform have disabled jbutton . want enable jbutton if username login form "admin". have singleton controller instantiated in both forms. if(controller.admin=="admin"){jbutton.setenabled(true)}; but i’m new swing , don't know use code. tried using in mainform's constructor didn't work. if((controller.admin).equals("admin")) { jbutton.setenabled(true); } this correct code .please describe questions code

Difficulty installing python modules after installing anaconda -

Image
i started working anaconda. earlier working python 2.7 on system. writing script devices connected laptop via usb. this, needed usb module/package. tried doing in python 27. installed using: easy_install libusb1 the output ( screenshot there) : searching libusb1 best match: libusb1 1.4.0 processing libusb1-1.4.0-py3.4.egg libusb1 1.4.0 active version in easy-install.pth using c:\users\eku\anaconda3\lib\site-packages\libusb1-1.4.0-py3.4.egg processing dependencies libusb1 finished processing dependencies libusb1 c:\users\eku\anaconda3\ : path according system name eku. installing pip shows error unknown command libusb1 because have installed package before, screenshot shows correct result package installed. locatio anaconda's site-packages there. why occurring , how should correct this. want keep both anaconda , other 2.7 version separate. (if has path variable, yes confused same). as can seen above output libusb gets installed in in anaconda, tried running sa...

android - Null pointer Exception in Custom Adapter while set the value for list item -

i want display conditional data in list view when user request or click on button. each list row has 2 value 1 value name , 2nd description. when user press button fire command , fetch information peripheral , match value different condition 1 one, conditions match value put 1 list row value in adapter after conditions check assign adapter list view, display adapter data display in list view. this code public class dtcode extends activity { private final static string tag = dtcode.class.getsimplename(); final static string extra_device_address = "device_address"; public string mdeviceaddress; public bluetoothleservice mbluetoothleservice; private boolean mconnected = false; button btnread, btnclear; string receivedata = ""; listview mylist; errorsadapter adapter; arraylist<error> arrayoferrors; error error; listview listerror; //code service; private final serviceconnection mserviceconnection = new serviceconnection() { @override ...

multi log4net instances using different configurations from the same config file -

i writing application require 2 different loggers, each logging in totally different way. when create each instance of log4net logger how can read own config section within same app.config file. possible have seen far taking default you can log 2 or more things independently without using separate config files. logmanager.getlogger("log1") logmanager.getlogger("log2") then in config file can create them this <logger name="log1" additivity="false"> <level value="info" /> <appender-ref ref="logfileappender1" /> </logger> <logger name="log2" additivity="false"> <level value="info" /> <appender-ref ref="logfileappender2" /> </logger> by selecting additivity false log separately. can populate appenders write info needed.

c# - Cannot find file path - image -

i trying send image on ftp on android. tried lot of possible ways accomplish that, , same problem persists: error telling path/directory/file doesn't exist. my code right using camerasample xamarin , getting picture taken camera , trying send on ftp. when try that, receive error: enoent (no such file or directory) here code: protected override void onactivityresult(int requestcode, result resultcode, intent data) { base.onactivityresult(requestcode, resultcode, data); // make available in gallery intent mediascanintent = new intent(intent.actionmediascannerscanfile); uri contenturi = uri.fromfile(_file); system.console.writeline (contenturi.tostring ()); mediascanintent.setdata(contenturi); sendbroadcast(mediascanintent); // display in imageview. resize bitmap fit display // loading full sized image consume memory // , cause application crash. int height = _imageview.h...

java - throws x extends Exception method signature -

reading javadoc of optional , bumped in weird method signature; never saw in life: public <x extends throwable> t orelsethrow(supplier<? extends x> exceptionsupplier) throws x extends throwable at first glance, wondered how generic exception <x extends throwable> possible, since can't ( here , , here ). on second thought, starts make sense, here bind supplier ... supplier knows type should be, before generics. but second line hit me: throws x complete generic exception type. and then: x extends throwable , in world this mean? x bound in method signature. will means, solve generic exception restriction? why not throws throwable , rest erased type erasure? and one, not directly related question: will method required caught catch(throwable t) , or provided supplier 's type; since can't checked @ runtime? treat other generic code you've read. here's formal signature see in ...

python - Extracting specific src attributes from script tags -

i want js file names input content contains jquery substring re. this code: step 1: extract js file content. >>> data = """ <script type="text/javascript" src="js/jquery-1.9.1.min.js"/> ... <script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"/> ... <script type="text/javascript" src="js/jquery-ui.min.js"/> ... <script type="text/javascript" src="js/abc_bsub.js"/> ... <script type="text/javascript" src="js/abc_core.js"/> ... <script type="text/javascript" src="js/abc_explore.js"/> ... <script type="text/javascript" src="js/abc_qaa.js"/>""" >>> import re >>> re.findall('src="js/([^"]+)"', data) ['jquery-1.9.1.min.js', 'jquery-migrate-1.2.1.min.js', 'jquery-ui...

html - Hide element behind transparent div -

Image
i make next animation: logo should reveal div moving down. div has transparent background. it possible hide overlaying part of logo behind transparent div? <div class="transparent">some content</div> <div class="logo"></div> .transparent { position: relative } .logo { position: absolute } i doubt if clip or mask behind transparent element. so, perhaps need rethink "hiding behind" part , consider other options. perhaps animating height: * { padding: 0; margin: 0; } .transparent { height: 2em; line-height: 2em; border-bottom: 1px solid grey; position: relative; } .logo { height: 0; background: orange; position: absolute; top: 100%; width: 100px; transition: height 0.5s ease; } .transparent:hover .logo { height: 25px; /* assuming height known */ } <div class="transparent">some content <div class="logo"></div> </d...

user interface - Gtkmm - Save Gtk::DrawingArea to file -

i have gtk::drawingarea inside gtk::scrolledwindow. i'm trying save drawingarea file, following in drawingarea signal_draw()'s handler : cairo::refptr<cairo::surface> surf = context -> get_target(); surf -> write_to_png("image"); but saves part of drawing area visible in scrolledwindow. how save full image, including part not visible? also, can in handler of signal_draw, because there can cairo::context. posible context anywhere else? edit: thanks andlabs's link got working: #include <gtkmm.h> #include <cairomm/context.h> #include <cairomm/enums.h> bool draw(const cairo::refptr<cairo::context>& c){ c->set_source_rgb(0,0,0); c->rectangle(400,50,50,50); c->fill(); return true; } int main(int argc, char* argv[]){ glib::refptr<gtk::application> app = gtk::application::create(argc, argv, "my.test"); glib::refptr<gtk::builder> builder = gtk::builder::create(); ...

windows - C diceroll game -

i wanted create dice game it's saying guess wrong , idk why. understand how make rand function random btw :d think it's because array isn't storing strings correctly. int main() { srand(time(null)); int dice1 = 1, dice2 = 1, dice3 = 1, sum, key = 0; int dice4 = 1, dice5 = 1, dice6 = 1, sum2; char randomnumber[10]; printf("diceroll-game \n\n"); printf("the first sum is:\n"); dice1 = (rand()%6 + 1); dice2 = (rand()%6 + 1); dice3 = (rand()%6 + 1); sum = dice1 + dice2 + dice3; printf("%d\n", sum); printf("will next sum of 3 dices higher(hi), lower (lo) or same(sa) (hi, lo, sa)?\n"); printf("type hi, lo or sa\n"); scanf("%c \n", &randomnumber); dice4 = (rand()%6 + 1); dice5 = (rand()%6 + 1); dice6 = (rand()%6 + 1); sum2 = dice4 + dice5 + dice6; if (randomnumber == "hi" && sum2 > sum) { printf("you right !\n\a"); }else { if (key == 0) { printf("you wrong....

c++ - Is this "trick" to throw exceptions across DLL boundaries a bad idea? -

i building shared library want abi compatible between different compilers (like msvc , gcc on windows). took inspiration this blog post . thing missed ability throw exceptions across dll boundaries... made little trick : mylibrary.hpp class thrower{ static void(*m_thowfunc)(const char*); public: static void setthrowfunction(void(*func)(const char*)){ m_thowfunc = func; } static void throwexception(const char* msg){ m_thowfunc(msg); } }; extern "c" { export void mylibrary_setthrowfunction(void(*func)(const char*)); export void mylibrary_foo(); } mylibrary.cpp extern "c" { export void mylibrary_setthrowfunction(void(*func)(const char*)){ thrower::setthrowfunction(func); } export void mylibrary_foo(){ thrower::throwexception("oops, error occured..."); } } and in client code void defaultthrowfunction(const char* msg){ throw std::runtime_error(msg); } int main()...

javascript - jQuery function callback does not work in custom class/object -

so newbie programming excuse me if novice question. creating simple wave effect create illusion of moving water. did simple function in jquery , worked fine. learning oop code more organized project working on. created class handle animation. animation works fires once. need keep firing create illusion. function callback works normal procedual way not seem work within object class. have researched , researched , can not find answer specific problem. appreciated. code below. function waves(selector){ this.selector = selector; this.animatewaves = function(forward,backward,speed){ $(selector).velocity({translatex: forward},speed); $(selector).velocity({translatex: backward},speed,animatewaves); }; }; var surfacewaves = new waves('#topwaves'); surfacewaves.animatewaves('+=40','-=40','1000'); edit actually, first solution not work because context of callback element, not object. here w...

javascript - dojo stop dropdown button from closing on checkbox select -

here html: <button data-dojo-attach-point="pinfilterbutton" data-dojo-type="dijit/form/dropdownbutton"> <span>proj. pin</span> <select multiple="true" name="multiselect" data-dojo-attach-point="pinfilter" data-dojo-type="dojox.form.checkedmultiselect"></select> </button> i want stop dropdown closing when checkbox selected. here tried: on(t.pinfilterbutton.dropdowncontainer, 'close', function (e) { e.stoppropogation(); }) among other variations.

c# - Expand BIML files programmatically -

has tried programatically compile biml files dtsx packages? i'm writing application in c#.net users can update metadata. when data has been updated, biml files needs re-compiled, ssis packages added/removed upon re-compiling. in question, suggested copy functionality bids helper: automatically generate ssis package biml script i have tried this, error saying: bimlengine may executed bidshelper this code: list<string> bimlscriptpaths = new list<string>(); bimlscriptpaths.add(@"c:\users\soren\documents\visual studio 2013\projects\integration services project2\integration services project2\bimlscript.biml"); string temptargetdirectory = "c:\\"; string projectdirectory = @"c:\users\soren\documents\visual studio 2013\projects\integration services project2"; validationreporter v = bidshelper.compilebiml( typeof(astnode).assembly, "varigence.biml.bidshelperph...

Android - Get item from listview with custom adapter through checkbox -

i have listview custom adapter (extends baseadapter). it recieves list of objects have populate listview. one of object's atribute boolean called "checked". on method getview, atribute responsible checking or not checking checkbox on view. everything working fine , when activity loads, listview itens apear on list of objects (which received database), checked , not checked. but when check 1 of listview's checkbox, need update object , therefore it's value on database. problem is: "how know item (object) have update checking checkbox?" "don't have same name?" i have listview.setonitemclicklistener(...) can object it's position, works when click on "row" of list view itself, not on checkbox... thought using check/uncheck checkbox... how that? can use position specific checkbox listview? in end, thought best method use "listview.setonitemclicklistener(...)" check checkbox, once easier user check 1 ...

php - Laravel-5 'LIKE' equivalent (Eloquent) -

i'm using below code pull results database laravel 5. bookingdates::where('email', input::get('email'))->orwhere('name', 'like', input::get('name'))->get() however, orwherelike doesn't seem matching results. code produce in terms of mysql statements? i'm trying achieve following: select * booking_dates email='my@email.com' or name '%john%' thanks in advance. if want see run in database use dd(db::getquerylog()) see queries run. try this bookingdates::where('email', input::get('email')) ->orwhere('name', 'like', '%' . input::get('name') . '%')->get();

javascript - How to combine different event triggers -

i new jquery , hope can me this. i have js function triggered various elements / classes difference of them event triggered click , others on keyup etc. so far have following example works intended wondering if there way combine these difference here trigger (click, keyup etc.) , avoid duplicating code. if there other suggestions write different please let me know well. my jquery (example): $(document).on('keyup', '.calcminus, .calcplus', function(e){ var row = $(e.target); $(row).closest('table').find('td.calcsum').each(function(index){ calculatesums(row, index); }); }); $(document).on('click', '.tradd, .trdelete, .trdown, .trup', function(e){ var row = $(e.target); $(row).closest('table').find('td.calcsum').each(function(index){ calculatesums(row, index); }); }); // ... my js function: function calculatesums(row, index){ // stuff } many in advance, mike ...

ios - Xcode 7 can't find header files from framework -

i'm trying add passslot project, says can't find .h file. i'm following correctly here: https://github.com/passslot/passslot-ios-sdk is xcode 7 problem? working fine , opened project in xcode 7, giving me problem. reopened on xcode 6 , starts showing problem well. i think dinesy right. solves problem me. i've noticed xcode7 doesn't automatically fill in required framework search paths when import 3rd party 1 (i believe xcode6 did this). check if yours empty going project -> build settings -> search paths -> framework search paths. fill in wherever frameworks live. if it's under project can use $(project_dir)

Scala Implicit Type Conversion of Classes with Type Parameters -

i'm trying add functionality scala.collection.iterable trait, more specifically, printerate function iterates through elements , prints them out (to console if there no parameters, otherwise outputstream param). i'm using predefined extension method created object, printself(). however, causing compiler error, 'value printself not member of type parameter object.' i'd have separate file it's easy me use between several projects , applications. here's current code conversion file: import java.io.outputstream import scala.collection.iterable package conversion{ class convert { implicit def object2superobject(o:object) = new convertobject(o) implicit def iterable2superiterable[object](i:iterable[object]) = new convertiterable[object](i) } class convertobject(o:object){ def printself(){ println(o.tostring()) } def printself(os:outputstream){ os.write(o.tostring().getbytes()) } } class convertiterable[object...

linux - terminal command for running sublime text 3 from on ubuntu -

i've installed new dev machine using ubuntu 14.02. have installed relevant software. php/apache2/sublime/composer etc. i'd able open files sublime or subl command in terminal, can't seem find command point things correctly. my sublime executable resides here... /opt/sublime_text/sublime_text in /usr/bin/subl have command #!/bin/sh exec /opt/sublime_text/sublime_text "$@" i can't find command in terminal make happen. sublime documentation points mac instructions, i'm newby translate. any suggestions? $@ in shell script copies arguments given shell script (after name of script) , places them @ point during execution of script. for example, if run subl test.txt , though running exec /opt/sublime_text/sublime_text "test.txt" . now, /opt/sublime_text/sublime_text --help or subl --help gives text shows usage well. sublime text build 3065 usage: sublime_text [arguments] [files] edit given files or: sublime_t...

javascript - How do I access my viewmodel variables in my knockout component template? -

i trying create list of instruction steps using knockout components/templates. the ul going contain list of steps (using knockout-registered custom element sidebar-step ) template of <li></li> . have value this.testvar part of model contain attribute of <li> such class , or maybe "data-customattribute" . my question is, how include testvar value template? want might output line like: <sidebar-step class=*testvar* params="vm: sidebarstepmodel">message 1</sidebar-step> fiddle: https://jsfiddle.net/uu4hzc41/1/ html: <ul> <sidebar-step params="vm: sidebarstepmodel"></sidebar-step> </ul> javascript: ko.components.register("sidebar-step", { viewmodel: function (params) { this.vm = params.vm; }, template: "<li data-bind=\'text: vm.message\'></li>" }); var sidebarstepmodel = function () { this.message = ko.observable(...

ctest - How to do code coverage in cmake -

i want use code coverage tools(lcov) in cmake project. read example here https://github.com/bilke/cmake-modules/blob/master/codecoverage.cmake tests added in project using 'add_test()' cmake function. i want create custom target, called 'test_coverage', when invoked execution should run tests, collect coverage data , generate html(using genhtml) in directory 'code_coverage'. is there way list of tests in project , directory paths, in custom target 'test_coverage' execute each test individually , collect coverage data ? you can either execute 'ctest -vv' command line, , if tests created using add_test, execute. if want custom build target same, can use code: add_custom_target(run_tests command "ctest -vv" ) i have lot of cmake code code coverage , unit testing show, doesn't make sense copy/paste here yet since sounds you're getting started.

python - Issues while encoding, decoding arabic language in terminal -

in script cosine similarity need first, convert arabic string vector before perform cosine similarity on terminal under linux --> problem while convert arabic string vector producing arabic as: [u'\u0627\u0644\u0634\u0645\u0633 \u0645\u0634\u0631\u0642\u0647 \u0646\u0647\u0627\u0631\u0627', u'\u0627\u0644\u0633\u0645\u0627\u0621 \u0632\u0631\u0642\u0627\u0621'] my script: train_set = ["السماء زرقاء", "الشمس مشرقه نهارا"] #documents test_set = ["الشمس التى فى السماء مشرقه","السماء زرقاء"] #query stopwords = set(stopwords.words('english')) vectorizer = countvectorizer(stop_words = stopwords) transformer = tfidftransformer() trainvectorizerarray = vectorizer.fit_transform(train_set).toarray() testvectorizerarray = vectorizer.transform(test_set).toarray() print 'fit vectorizer train set', trainvectorizerarray print 'transform vectorizer test set', testvectorizerarray cx = lambda a, b : round(np.i...

php - How to add custom tab to CMS selection in magento admin menu -

please me. have module - feedback. want add tab cms selection in magento admin menu, cms->feedback. in tab want show grid of received messages. write code in module config.xml file. <config> <adminhtml> <menu> <cms> <children> <feedback module="feedback"> <title>feedback</title> <sort_order>10</sort_order> <action>feedback/adminhtml_feedback</action> </feedback > </children> </cms> </menu> </adminhtml> </config>

c# - Binding Shapes.Path items to a ItemsControl -

i have been trying figure out how bind observablecollection<frameworkelements> itemscontrol. have existing project relies heavily on code behind , canvas's without binding trying update use mvvm , prism. the observablecollection going populated number of path items. generated extermal library use. library functions correctly when manually manipulate canvas itself. here snippet of code viewmodel: observablecollection<frameworkelement> _items; observablecollection<frameworkelement> items { { return _items; } set { _items = value; this.notifypropertychanged("items"); } } public event propertychangedeventhandler propertychanged; private void notifypropertychanged(string propertyname) { if (this.propertychanged != null) { this.propertychanged(this, new propertychangedeventargs(propertyname)); } } supporting xaml <...

java - Find what number it used to be before element reset -

given array size, in case array size 5 . this array contains numbers 1 5 (must contain of them) [1 | 2 | 3 | 4 | 5] 0 1 2 3 4 and now, 1 element reset , set 0 , , mission find number used before turned 0. so have simple solution: explained: first, loop 1 5, create inner loop check if i first loop exists in whole array, if doesn't exist, means value used before 0, because array contained numbers 1 5 or 1 100 (doesn't matter) , there's on'y 1 rested element. code: int[] numbers = new int[]{1, 2, 3, 4, 5}; numbers[1] = 0; int lost = -1; loop: (int = 1; <= numbers.length; i++) { (int j = 0; j < numbers.length; j++) { if (numbers[j] == i) { continue loop; } } lost = i; break loop; } system.out.println(lost); that solution not bad, think there's better solution, more stable. i have thought mathematically, in our example: 1 + x + ...

token - Meteor app deploying with Modulus -

i'm getting error when try typing $modulus deploy terminal app directory: determining meteor version... meteor version: 1.1.0.2 bundling meteor app... undefined [error] error: command failed: /bin/sh -c cd /users/xx/projects/project1 && meteor bundle --directory /users/xx/projects/project1/.demeteorized command has been deprecated in favor of 'meteor build', allows build multiple platforms , outputs directory instead of single tarball. see 'meteor build'for more information. warning: output directory under source tree. errors prevented bundling: while building application: client/project1.js:138:29: unexpected token = i same result $demeteorizer . worked on old version of app, added features in new branch, merged, , i'm getting error. already tried: sudo npm update -g modulus turns out actual error in code. had closing curly brace somewhere.

ruby - Recursive method with condition -

using ruby 2.0. here's code: module test class def initialize(x) @x = x foo end def foo p @x update(@x) # if it's test::c object or called test::c end end end module test class b < def foo @x += 2 super end end end module test class c < def foo @x += 1 super end end end def update(x) if x > 100 test::b.new(x) else test::c.new(x) end end x = 100 update(x) here's trying achieve: in test::a#foo , update(@x) should called if called test::c#foo or it's test::c object. the first time update(x) called, x = 100 , operation should +1 , move on test::b#foo once. how achieve this? the parent class should not have care subclasses. design have here implies needs know, broken , over-complicates things. in case, if need trap cases: case (self) when test::a, test::b # ... stuff update(@x) end if test::a , test::b care operation, ...

ubuntu - Nginx redirect http subdomains to https -

i have 1 domain 3 subdomains: - example.com (main domain) - api.example.com - blog.example.com - support.example.com (just cname point zendesk) and have 3 configuration on nginx : api # http server server { listen 80; server_name api.example.com; return 301 https://api.example.com$request_uri; } # https server server { ssl on; listen 443; server_name api.example.com; ssl_certificate apicert.crt; ssl_certificate_key apicert.key; #root configuration..... } blog server { listen 80; server_name blog.example.com; root /var/www/blog; index index.php index.html index.htm; site/main domain server { listen 80; listen 443 ssl; server_name www.example.com; return 301 https://example.com$request_uri; location ~ \.(php|html)$ { deny all; } } server { listen 80; server_name example.com; return 301 https://example.com$request_uri; location ~ \.(p...

javascript - cant get data From data-n in element -

i have span : <span class="span-link" id="2" data-state="true" onclick="javascript: changestate(this.id);">change state</span> and in javascript function use code value : function changestate(_thingid) { alert(_thingid); var tt = $(this).attr("data-state"); alert(tt); } i getting undefinded data-state . test $(this).data("state") , getting undefined . whats problems? you referencing id, not object, change this: var tt = $('#'+_thingid).attr("data-state"); https://jsfiddle.net/6ne5b8zm/

jquery - javascript checkbox check all -

Image
i'm working on check button, i'm bit unfamiliar javascript part. essentially, have checkbox @ top of page, , when check it, goes through , changes checkbox in each row of table checked. i've looked around @ similar questions , know have use ~~~~.prop('checked', ...) this checkbox have check boxes in table. <div class="disc-opt" style="float:left"> adjust <div class="make-switch"> <input type="checkbox" class="create-adjustments" /> </div> </div> this table row layout. <tr class="<?= $data['adjusted'] ? "success" : "" ?>"> <td> stuff </td> <td><?= $data['products_name'] ?></td> <td><?= $data['total_final_quantity'] ?></td> <td><?= $data['total_onhand'] ?>...

How to make text field compulsory only when the checkbox is checked with symfony annotation validations in model classes -

it simple question i've run out of juice here. vat field compulsory when isvatable checkbox check user otherwise can ignored. how achieve group validation (annotations) in model class, not entity? i checked validation groups , group sequence honest didn't head around. formtype class usertype extends abstracttype { public function buildform(formbuilderinterface $builder, array $options = []) { $builder ->setmethod($options['method']) ->setaction($options['action']) ->add('vat', 'text') ->add('isvatable', 'checkbox') ; } public function getname() { return 'user'; } public function setdefaultoptions(optionsresolverinterface $resolver) { $resolver->setdefaults( ['data_class' => 'my\frontendbundle\model\usermodel'] ); } } modelclass class us...