Posts

Showing posts from May, 2012

android - Material Design FloatingActionButton global styling -

creating app api21+ devices, using meterial design theme: <resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- base application theme. --> <style name="apptheme" parent="android:theme.material.light.darkactionbar"> <!-- custom theme --> <item name="android:colorprimary">@color/colorprimary</item> <item name="android:colorprimarydark">@color/colorprimarydark</item> <item name="android:coloraccent">@color/coloraccent</item> ... i want overwrite floatingactionbutton style: <item name="android:actionbuttonstyle">@style/appfloatingactionbutton</item> ... <!-- floatingactionbutton --> <style name="appfloatingactionbutton" parent="android:widget.material.actionbutton"> <item name="ripplecolor">@color/coloraccent</item> </style&g

How to do caseinsensitive in dataTable() using fnFilter() in jquery? -

trying search table irrespective of case using fnfilter datatable() $('#search-users').on('keyup',function(){ if(tblactive){ tableactive._fnfilter($(this).val()); tableactive._fndraw(); } }); unable caseinsensitive data filter. want table search values irrespective of case. tried giving tableactive._fnfilter($(this).val(),true); but unable search caseinsensitive data. 1.10.4 jquery.datatables.js then use api! datatables filtering is case insensitive default. either : var tableactive = $(<selector>).datatable({ .. }); $('#search-users').on('keyup', function() { tableactive.search( this.value ).draw(); }) or id use oldschool datatable() initialisation bacause need jquery instance : var tableactive = $(<selector>).datatable({ .. }); $('#search-users').on('keyup',function() { tableactive.api().search( this.value ).draw(); }) only if want

phpquery - Php sum value once when loop start -

hi have value in variable want add value first time when loop start not always. example <?php $balance = 100; while($row = mysql_fetch_array($query) { echo $row['amount'] + $balance; // example $row['amount'] 50, 20 , 30; } ?> i want result follow <?php 150 170 200 ?> sample code.. $balance = 100; $counter=1; $total=0; while($row = mysql_fetch_array($query) { if($counter==1) { $total=$row['amount'] + $balance; // example $row['amount'] 50, 20 , 30; } else { $total = $row['amount']+$total; } echo $total.'<br>'; $counter++; }

generics - java open closed principle for multiple services -

let's wanted define interface represents call remote service. both services have different request , response public interface executesservice<t,s> { public t executefirstservice(s obj); public t executesecondservice(s obj); public t executethirdservice(s obj); public t executefourthservice(s obj); } now, let's see implementation public class servicea implements executesservice<response1,request1> { public response1 executefirstservice(request1 obj) { //this service call should not executed class throw new unsupportedoperationexception("this method should not called class"); } public response1 executesecondservice(request1 obj) { //execute service } public response1 executethirdservice(request1 obj) { //execute service } public response1 executefourthservice(request1 obj) { //execute service } } public class serviceb implements executesservice<response2,request2> { publi

Why is this Jekyll parses markdown in posts but NOT pages? -

Image
i have this jekyll site open project part of. it's sitting on gh-pages (you can see files here , , problem happens both there , locally. for each post, [this one]( https://raw.githubusercontent.com/equalitytime/communikate/gh-pages/_posts/2014-09-23-main-3.markdown , markdown renders , displays want. however, have file called translation.md in root directory ( raw version . this appears this: which is... sub optimial. can tell me going on here? change page.content content in _layouts/singlepage.html , jekyll process markdown correctly: .... <div class="lead"> {{content}} </div> ...

android - How to raise an Exception while inserting to firebase if the data is not synced to server immediately? -

i inserting values firebase. want mark insert operation failed if data not synced server after few second delay. tried oncompletelistener , onfailurelistener on task , onfailurelistener doesn't fire if device offline then, oncompletelistener fires after successful sync firebase server (the device comes online). want fire onfailurelistener if device offline. how can achieve that? you can check availability of network before inserting values using following function public static boolean isnetworkavailable(context context){ connectivitymanager manager = (connectivitymanager) context.getsystemservice(context.connectivity_service); networkinfo info = manager.getactivenetworkinfo(); return info != null; } update you can check if internet working or not if it's connected. public static boolean hasactiveinternetconnection(context context){ if(isnetworkavailable(context)) { try { httpurlconnection connection = (httpurlconn

dynamic excel array based on input -

Image
i looking little in making formula based dynamic array in excel. kpi | tgt | number | weight fcr | 0% | 1 | 45% fcr | 60% | 2 | 45% fcr | 80% | 3 | 45% leads | 45% | 4 | 25% leads | 50% | 5 | 25% leads | 200% | 6 | 25% attrition | 8% | 7 | 10% attrition | 12% | 8 | 10% attrition | 100% | 9 | 10% abandon | 1% | 10 | 20% abandon | 5% | 11 | 20% abandon | 200% | 12 | 20% so if have leads score in cell e2 3%, want output in f2 number 4 <45% hence 4. ps: have spreadsheet don't know how attach it. try in f2: =index(c:c,aggregate(15,6,row(b:b)/((b:b>=e2)*(a:a="leads")),1)) this return matches rows "leads" in column a. can made reference if have or want put cell instead. edit: based on you're comment below, formula works if entered array (ctrl + shift + enter): =index(c:c,match(1,(a:a="leads")*(b:b&g

java - How to do a split string and store into a variable for future use? -

i have android app receives data excel file. im using libray text excel textview.i have 3 columns in excel receiving. reason want divide string receive 3 positions in order save in sqlite information excel gives , put them in respective rows of sqlite database.i want know how proper string split , store information. this output of app receives excel in advanced. try { assetmanager am=getassets(); inputstream is=am.open("book1.xls"); workbook wb =workbook.getworkbook(is); sheet s=wb.getsheet(0); int row =s.getrows(); int col=s.getcolumns(); string xx=""; for(int i=0;i<row;i++) { (int c=0;c<col;c++) { cell z=s.getcell(c,i); xx=xx+z.getcontents()+"\n";

javascript - Slider for video (ASP.NET) -

Image
i have ajax call - end displaying videos <script> $('#display').click(function () { var vacancyid = $("#vacancy").val(); var model = { vacancyid: vacancyid }; $.ajax({ url: '@url.action("links", "questions")', contenttype: 'application/json; charset=utf-8', data: json.stringify(model), type: 'post', datatype: 'json', processdata: false, success: function (data) { var question2 = data; (var = 0; <= question2.length - 1; i++) { var videohtml = '<video width="320" height="240" style="margin-left: 130px;margin-top: 20px;" controls>'; videohtml += '<source src="' + document.location.origin + "/uploads/" + question2[i].linkes + ".webm" + '" type="video/webm">'; videohtml += '</video>'; $(".videolist").append(videohtml);

windows - Install a python module ignoring version requirement -

is there way use pip, easy install or other method ignore python version requirements when installing module? i'd use unofficial wheel pyside2 python 3.6 despite being version 3.5 code has problems 3.5. several issues visual studio making impossible me compile scratch.

ios - Unowned Reference causes leak , weak doesn't -

i'm experiencing kind of memory management issue. have subclass of uiviewcontroller , set view manually in order have reference viewcontroller , avoid reference cycle use weak/unowned . problem , if use unowned have memory leak if use weak don't have one. can't figure out why happens? update: seems it's bug. console output: removing vc view controller deinitialized custom view deinitialized i'm using xcode 8.3.1 func application(_ application: uiapplication, didfinishlaunchingwithoptions launchoptions: [uiapplicationlaunchoptionskey: any]?) -> bool { window = uiwindow(frame: uiscreen.main.bounds) window?.rootviewcontroller = viewcontroller(nibname: nil, bundle: nil) window?.makekeyandvisible() dispatchqueue.main.asyncafter(deadline: .now() + 5) { print("removing vc") self.window?.rootviewcontroller = nil } return true } class viewcontroller: uiviewcontroller { override func loadview()

python - sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 74 supplied -

def insert(array): connection=sqlite3.connect('images.db') cursor=connection.cursor() cnt=0 while cnt != len(array): img = array[cnt] print(array[cnt]) cursor.execute('insert images values(?)', (img)) cnt+= 1 connection.commit() connection.close() i cannot figure out why giving me error, actual string trying insert 74 chars long, it's: "/gifs/epic-fail-photos-there-i-fixed-it-aww-man-the-tire-pressures-low.gif" i've tried str(array[cnt]) before inserting it, same issue happening, database has 1 column, text value. i've been @ hours , cannot figure out going on. you need pass in sequence, forgot comma make parameters tuple: cursor.execute('insert images values(?)', (img,)) without comma, (img) grouped expression, not tuple, , img string treated input sequence. if string 74 characters long, python sees 74 separate bind values, each 1 character lon

Calling MATLAB functions in python -

Image
problem occurred while calling matlab function in python after importing matlab functions python package. error shown in python shell: here, barcode name of package generated using matlab library compiler , barcodepy function in package. it not necessary use barcodepy example: your code : import barcode a=barcodepy.initialize() a=barcode.barcodepy.initialize() correct code: import barcode a=barcode.initialize()

javascript - React router not working when deployed -

i new heroku , deployment. created project using create-react-app , using redux framework. having issue react router when deploying heroku. when click on links in app, router works, when refresh page, throws 404 not found error. this index.js import { router, route, browserhistory, indexroute } 'react-router' import { synchistorywithstore } 'react-router-redux' import { provider } 'react-redux' import reactdom 'react-dom' import react 'react' import app './containers/app' import configure './store' import dashboard './components/v1/dashboard/dashboard'; import login './components/v1/login/login'; const store = configure(); const history = synchistorywithstore(browserhistory, store); reactdom.render( <provider store={store}> <router history={history}> <route path="/" component={app}> <indexroute component={login} /> <router path="/dashb

Java android Fragment tabs (changed fragment only when swipe) don't work click on tabs name -

i have activity in have 2 fragments , when swipe on tabs fragments change , when click on tabs name apk doesn't change view. stay on same fragments. this activity : public class objectlistactivity extends appcompatactivity { private toolbar toolbar; private tablayout tablayout; private viewpager viewpager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_object_list2); toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); hidesoftkeyboard(); android.support.v7.app.actionbar actionbar = getsupportactionbar(); actionbar.setnavigationmode(android.app.actionbar.navigation_mode_standard); actionbar.settitle(""); getsupportactionbar().setdisplayhomeasupenabled(false); viewpager = (viewpager) findviewbyid(r.id.viewpager); setupviewpager(viewpager);

apache - .htaccess 3 types of authentications -

i want have 3 types authentication .htaccess file, satisfying 1 or of other 2. from desired referer. from specific ip or range of ips or domains. from valid user. so want authenticate 1 or 2 or 3, using 1 .htaccess file. know how this? now, i'm using required-user. any clues ?

c++ - CComPtr and reference count -

i using objects of type ccomptr . having memory leak problems. in particular, have following code: ccomptr<id2d1bitmap> bitmap = create_bitmap(bitmapsize); auto n = count_ref((id2d1bitmap*)bitmap); where: template<class interface> ulong count_ref(interface* pinterface) noexcept { if (pinterface) { pinterface->addref(); return pinterface->release(); } return 0; } and: id2d1bitmap* create_bitmap(const d2d1_size_u& size) { id2d1bitmap* bitmap; createbitmap(&bitmap); return bitmap; } i expecting value of n equal 1 equal 2. why reference count of ccomptr not 1? am using ccomptr object properly? and when process terminates following memory leak: an interface [072b1f50] created not released. use 'dps 072b1f20' view allocation stack. object type: id2d1bitmap device-dependent size: 1000 x 600 device-independent size: 1000.00 x 600.00 format: dxgi_format_b8g8r8a8_unorm alpha m

angularjs - Angular Controller can inject service just fine but $injector.get can't? -

i have extremely edge case scenario have callback method have define during config. means no scope, no factories, etc... work around use root injector ($injector) , other modules @ runtime. however, when call $injector.get('myservicename') in call (after application running) "unknown provider". same service has no problem (and is) being injected before line of code running. if call $injector.get("myservicenameprovider") can provider in callback.. service has factory can't @ all. so in extremely bad practice, how can snag service configured. heck can't seem $rootscope.. angular inits providers first, factories/services - services not available in app.config . you can deo this: app.config(... window.on('scroll', function() { // executed later $injector.get()... }) or use app.run services available.

asp.net core - Use IdentityServer4 with external Active Directory on Windows Server 2008R2 -

an external partner wants authenticate on our systems, using active directory. want use active directory external provider in identityserver4. unfortunately ad @ location runs on windows server 2008r2 (functional level 2003) our best options here integrate identityserver4? simply "turn on" windows authentication in identityserver. see docs: https://identityserver4.readthedocs.io/en/release/topics/windows.html if windows authentication should happen on different machine 1 (main) identityserver installed, create "mini identityserver" runs on machine joined right domain , federate using openid connect. the whole purpose of "mini is" turn windows token jwt (very similar adfs in nutshell).

git - Why does jenkins build from multiple commits when it shouldn't? -

i have parameterized job in jenkins. receives git hash , runs checkout commit hash (commit hash in branches parameter). problem when jenkins offline time , in meantime new commits pushed repo. when jenkins online again, receives commit hash , when supposed build 1 commit, takes commits were'nt built in meantime despite 1 hash passed checkout. why happen , how can avoided? edit: here's job log: [pipeline] node running on master in /var/lib/jenkins/workspace/tester [pipeline] { [pipeline] stage (checkout) using ‘stage’ step without block argument deprecated entering stage checkout proceeding [pipeline] checkout > git rev-parse --is-inside-work-tree # timeout=10 fetching changes remote git repository > git config remote.origin.url http://testrepo.git # timeout=10 fetching upstream changes http://testrepo.git > git --version # timeout=10 > git fetch --tags --progress http://testrepo.git +refs/heads/*:refs/remotes/origin/* > git rev-parse <mycommithash>

ruby on rails - Search form don't update table in RoR -

i'm trying write filter table. here code: .../models/message.rb class message < activerecord::base include filterable belongs_to :user default_scope -> { order('created_at desc') } validates :user_id, presence: true validates :content, presence: { message: "Выберите файл послания для загрузки!" }, file_size: { less_than_or_equal_to: 20.megabytes } validates :fromdate, presence: true validates :tilldate, presence: true mount_uploader :content, contentuploader scope :id, -> (id) {where id: id } scope :tariff, -> (tariff) { tariff: tariff } scope :status, -> (status) { where("status ?", "#{status}%")} end .../controllers/concerns/filterable.rb module filterable extend activesupport::concern module classmethods def filter(filtering_params) results = self.where(nil) filtering_params.each |key, value| results = results.public_send(key, value) if value.present? end

php - Symfony Console Ask helper not working if called from composer -

in application i'm using symfony/console package (v. 3.2.7) , created several commands works fine. now i'm trying automate tasks , added in composer.json scripts sections "scripts": { "test": [ "@php app/console myproject:setup" ] } and code in command is <?php namespace myproject\command; use symfony\component\console\command\command; use symfony\component\console\input\inputinterface; use symfony\component\console\output\outputinterface; use symfony\component\console\question\confirmationquestion; /** * class setupcommand * @package wpskeletoncli\command */ class setupcommand extends command { protected function configure() { $this->setname('myproject:setup'); $this->setdescription('a setup wizard brand new skeleton based project.'); } protected function execute(inputinterface $input, outputinterface $output) { $this->gethelp

javascript - Why does `var exports = module.exports = {};` works but not `let exports = module.exports = {};`? -

during code optimisation of project, replacing instances of var keyword let because think there no particular use left var . did 'find & replace' in files this. in custom modules had used statements like: var exports = module.exports = {}; which worked fine. now, after replacing let , became: let exports = module.exports = {}; it not work , gives error syntaxerror: identifier 'exports' has been declared though can use var , avoid problem, still want know reason behind this. edit: have not used let exports = <something>; anywhere in same module file. statement have declared exports variable. the reason because exports initialized in nodejs module system. https://nodejs.org/api/modules.html#modules_module_exports the object exists, module.exports when module loads. since let scope specific preventing limiting scope. const fail.

php - how to redirect our website with https in laravel5.2? -

i getting stuck on have ssl certificate website. problemm when access website enter code here www.example.com this redirect me without https i.e (www.example.com) enter code here when type https://example.com redirect https i.e(https://example.com) can me how resolve issue using laravel 5.2 , know have update in htaccess in advance :)

How select a name contains the second letter is "s" using LINQ? -

enter image description here how select name database contains second letter "s" using linq ? using lambda expressions: var str = new string[] { "tsr", "mrg", "d" }; var result = str.where(s => s.length>1 && s[1] == 's'); the result variable contain "tsr" value, , checking word have @ least 2 characters otherwise exception thrown

installation - knowing you have the right processor before installing python -

hi there im newbie , started learn how code using python recently. im having problems installing though. prompt keeps bringing error says 'this installation package not supported processor type. contact vendor" mean , how can resolve it? i'm using intel(r) core(tm)2 duo cpu 2.20ghz 2 gig ram if have 2gb of ram, you're using 32-bit os. want 32-bit python. make sure select correct os when choosing python exe download. if you're using 32-bit windows, believe x86 here: https://www.python.org/ftp/python/3.6.1/python-3.6.1.exe

JavaScript recursion, reversing array -

i can't understand why following code snippet leads error. ideas? maximum call stack size exceeded function reversearrayinplace(array, low, high) { if (low == undefined) { low = 0; } if (high == undefined) { high = array.length - 1; } if (low >= high) { return; } var temp = array[low]; array[low] = array[high]; array[high] = temp; return reversearrayinplace(array, low++, high--); } var arrayvalue = [1, 2, 3, 4, 5]; reversearrayinplace(arrayvalue); console.log(arrayvalue); it's because you're using post-increment , post-decrement. increments/decrements variable, returns old value, you're passing old value in recursion. result, recursive call identical original call, , recurse infinitely. pre-increment/decrement -- ++low , --high -- work correctly. don't need update variables @ all, since never use them again. normal addition/subtraction. there's no point in using retu

java - How to iterate over String array? -

when settext in textview shows first 3 lines of array,i need way result = result + xx.split("\n"); in string array not possible can teach me other way that? string xx=""; string result[] = {}; for(int i=0;i<row;i++) { for(int c=0;c<col;c++) { cell z=s.getcell(c,i); //need alternative because cannot in string array result = result+ xx.split("\n"); } } textview.settext(resultado[0]+"--"+resultado[1]+"--"+resultado[2]); you need more specific on trying achieve basic iteration on array. string numbers = new string[] {"1", "2", "3", "4", "5"}; string mystring = ""; (string anumber : numbers) { mystring += anumber; } textview.settext(mystring);

ruby - How to fix "pre receive hook declined" error when deploying to Heroku -

i need build application school , using https://github.com/zendesk/call_roulette permission. when deploying heroku "pre receive hook declined" error. i followed these steps: installed ruby, heroku , git. downloaded repository mentioned above. opened terminal , changed directory downloaded repository. git init , git add . , git commit , heroku create , git heroku push master . that's "pre receive hook declined" error. error when try deploy through heroku's site linking github repository. what did wrong?

python - Jupyter & Anaconda: installing new kernel removes the old one -

when try install additional kernel server running python (anaconda) + jupyter, proceed follows (example): conda create -n mynewvenv python=3.5 source activate mynewvenv (mynewvenv) conda install pandas matplotlib jupyter notebook scipy ... (mynewvenv) conda install notebook ipykernel (mynewvenv) ipython kernel install --user --display-name mynewkernel (mynewvenv) source deactivate to restart jupyter: kill 7133 <---- kill jupyter process jupyter notebook & disown unfortunately, had python 3.5 kernel, seems lost. new kernel available, though. max. number of selectable kernels in jupyter seems 2. doing wrong here?

html - JavaScript How to Get Keyboard to Push() new Input via Buttons -

the title kinda confusing because find hard explain. basically, can 1 input button have 1 id name javascript function store variable , display replacing empty paragraph tag variable. however, can't work multiple buttons same function, since i'm trying number keypad going buttons, , having display result. think need use push() method somehow add values, click submit button, have resulting string displayed. know how use push known variables, don't know how implement unknown variables, though: var fruits = ["banana", "orange", "apple", "mango"]; fruits.push("kiwi"); anyways, code here, input buttons 1 button i, , etc. jquery answers welcome, don't prefer jquery, i'm asking javascript. <!doctype html> <html> <head> <title>desperate</title> <script type="text/javascript"> function othername() { var inputinput = document.getelementbyid("

html - How to increase a css value, rather than concatenate it? -

i'm using line: $(this).css("z-index", z + 10); the set z-index value 1200. edit: variable z = $(this).css("z-index"); when debugging in developer console noticed z-index value '120010' rather expected '1210'. how can change above line increase value 10, rather concatenating value end. (also using word right? i'm not 100% sure) you need use parseint() function on z variable. should work: z = parseint($(this).css("z-index")); $(this).css("z-index", z + 10); one thing careful though, z-index can have value not number, example auto if run parseint() on element that's z-index auto, break. in order combat this, recommend using zindex() (part of jquery ui) instead of css() so: z = $(this).zindex(); $(this).css("z-index", z + 10); this of course means have use jqueryui, if using it, i'd recommend approach. edit: looks zindex() has been removed jquery ui, stick first s

winforms - Awesomium in C# Exception Fix? -

Image
i've been working on c# winform project has part in when user keys "enter" button, backgroundworker set new uri in source property of awesomium instance . however, i'm encountering aweinvalidoperationexception ("the calling thread cannot access object because different thread owns it."). here's sample code of part of work: private void txt_to_keyup(object sender, keyeventargs e) { if (e.keycode == keys.enter) { backgroundworker.runworkerasync(); } } private void backgroundworker_dowork(object sender, system.componentmodel.doworkeventargs e) { //get values xml file , (not included here anymore it's long) awesomiuminstance.source = new uri("http://maps.google.com?saddr=" + txt_from.text.replace(" ", "+") + "&daddr=" + txt_to.text.replace(" ", "+") + flag + "&view=m

linux - What is a 'slot' in sd-bus (C language) -

there several apis in systemd's sd-bus.h file optionally take slot argument. here's examples: int sd_bus_call_async(sd_bus *bus, sd_bus_slot **slot, sd_bus_message *m, sd_bus_message_handler_t callback, void *userdata, uint64_t usec); int sd_bus_add_filter(sd_bus *bus, sd_bus_slot **slot, sd_bus_message_handler_t callback, void *userdata); int sd_bus_add_fallback(sd_bus *bus, sd_bus_slot **slot, const char *prefix, sd_bus_message_handler_t callback, void *userdata); if calling code specifies null becomes "floating slot" guess means calling code doesn't need worry it. most of example source code see out there example project: https://github.com/tasleson/dbus-signals/blob/6d0e43d02d24ed51a17ce7df15a3a0a64ec0170d/spamsignals.c#l160 it takes slot, , sometime later unreferences slot. doesn't it. passing own slot makes sd-bus-match life being entangled 1 of slot. way, when unreference slot, destroying match. otherwise, passing null bound mat

Batch file that opens a program, wait 5 seconds, then press 2 keyboard keys -

i have windows 10 pro. i need .bat file open teamspeak.exe, wait 5 seconds, , press hotkey "insert" , press combination "ctrl + delete" in order mute microfone , sound. searched code , did not work me: @if (@codesection == @batch) @then @echo off cscript //nologo //e:jscript "%~f0" start ts3client_win64.exe -nc goto :eof @end ping 1.1.1.1 -n 1 -w 4000 > nul wscript.createobject("wscript.shell").sendkeys("{insert}"); when run in cmd, error msg: c:\program files\teamspeak 3 client\test.bat(1, 6) compilation error microsoft jscript: ';' expected you can use powershell (see provide input applications powershell ) add-type -assemblyname microsoft.visualbasic add-type -assemblyname system.windows.forms start-process "c:/path/to/teamspeak.exe" start-sleep -seconds 5 [microsoft.visualbasic.interaction]::appactivate("teamspeak") [system.windows.forms.sendkeys]::sendwait("{insert}")

Java - How to navigate through object array with buttons -

i'm trying implement "previous" , "next" button. issue cannot figure out how navigate through object array buttons , display on fields. to clarify button iterate through object array , display fields according pointer each click. an example of want do: button click display myproduct @ pointer 0 button click display myproduct @ pointer 1 button click display myproduct @ pointer 2 so far i've managed this: product[] myproduct = new product[]{ new product("dr.pepper", 5, 1.00), new product("coca cola", 6, 1.00), new product("fanta", 7, 1.00), new product("sprite", 8, 1.00), new product("redbull", 9, 1.00), new product("orange juice", 10, 1.00) }; if(source.equals(nextbutton)){ getnamefield.settext(myproduct[++pointer].getname()); getstocklevelfield.settext(string.valueof(myproduct[++pointer].getstockleve

python - Get value of a fact set with 'set_fact' inside a callback plugin -

ansible 2.3 i have callback plugin notifies external service when playbook finished. during play, callback plugin collects different information play variables , error messages, sent http request. example: { "status": 1, "activity": 270, "error": "task xyz failed message: failure message", "files": [ "a.txt", "b.cfg" ] } some of information comes variables set during play itself, relevant play: path file, list of changed resources, etc. right i'm doing particularly ugly collect need based on task names: def v2_runner_on_ok(self, result): if result._task.action == 'archive': if result._task.name == 'create archive foo': self.body['path'] = result._result['path'] if result._task.action == 'ec2': if result._task.name == 'start instance bar': self.body['ec2_id'] = result._result[

excel - Find average of several cells then autofill -

i looking find average of cells a2:d2 , place them e2 auto fill equation rest of 500 or e cells. here have far: sub average () dim nrows integer dim ncols integer ncols = range(range("a2"), range("a2").end(xltoright)).columns.count nrows = range(range("a2"), range("a2").end(xldown)).rows.count range("e2").formular1c1 = "=average(r[]c[ " & ncols & "]:r[]c[])" end sub the macro below put average of d in column e each row , pull formula down last row of worksheet. sub average() dim lrow long dim acell string dim col string range("e2").select activecell.formular1c1 = "=average(rc[-4]:rc[-1])" lrow = worksheetfunction.max(range("a65536").end(xlup).row, range("b65536").end(xlup).row, range("c65536").end(xlup).row) acell = range("e2").address(rowabsolute:=false, columnabsolute:=false) col = left(acell, 1) ra

php - Laravel: N to N (mysql) relation using Eloquent ORM -

i got 4 tables: // table countries +----+------+ | id | name | +----+------+ | 1 | usa | | 2 | gb | +----+------+ // table platforms +----+---------+ | id | name | +----+---------+ | 1 | windows | | 2 | linux | +----+---------+ // table users +----+-------+------------+-------------+ | id | name | country_id | platform_id | +----+-------+------------+-------------+ | 1 | admin | 1 | 1 | | 2 | test | 2 | 1 | +----+-------+------------+-------------+ // table posts +----+-----------+------------+-------------+---------+ | id | title | country_id | platform_id | user_id | +----+-----------+------------+-------------+---------+ | 1 | testpost1 | 2 | 1 | 1 | | 2 | testpost2 | 2 | 2 | null | +----+-----------+------------+-------------+---------+ the database should able implement following relations: user (n) <-> (n) platform user (n) <-> (n) country user

Python - Use to tablib to import Excel (xls, xlsx) files -

i'm having trouble figuring out how import excel files python script. i'm few days python i'm guessing it's obvious i'm missing. i'm using python 3 , tablib module. examples on tablib site, i've worked out how save files in xls format def savexls(self, name, data): # form dataset accompanying headers datatab = tablib.dataset() datatab.headers = data[0][:] in range(1,len(data)): datatab.append(data[i][:]) open(self.savedir + name + ".xls", 'wb') f: f.write(datatab.xls) (i know loop horrible , un-pythonic, it's important results @ moment it's work). @ moment, open excel workbook , save text file (i should point out data tab-delimited , consists of strings, numbers). i open this def loadtxt(self,name, filetype, data): if( filetype == "txt"): open(self.currentworkingdir + "\\" +

Angular 4 plugin for eclipse -

i have started project using angular 4. want create angular project in eclipse. please suggest me free plugin create angular 4 project in eclipse. i have tried angular ide not free plugin. thanks in advance.

angular - routerLinkActive matching routes with different query parameters -

this code generates handful of links like /reports /reports?collection=foo /reports?collection=bar all links shown active. how can show 1 exact link active? <li [routerlinkactive]="['link-active']" [routerlinkactiveoptions]="{exact: true}"> <a [routerlink]="['/reports']"> <span class='glyphicon glyphicon-expand'></span> reports </a> </li> <li [routerlinkactive]="['link-active']" [routerlinkactiveoptions]="{exact: true}" *ngfor="let collection of collections"> <a [routerlink]="['/reports']" [queryparams]="{collection: collection}"> <span class='glyphicon glyphicon-unchecked'></span><span>{{collection}}</span> </a> </li> query , optional parameters not included when specifying route configuration , when matching routes. that's why exact

d3.js - shp2json produces GeoJSON with bounding and coordinates not in (-180,180) range -

i doing @mbostock's tutorial on command line cartography 1. here i've done: 1) download zip file wget https://www.arb.ca.gov/ei/gislib/gislib.htm/ca_air_basins.zip (from california air resources board site ) 2) manually unzip clicking .zip file ( unzip command did not work because downloaded file didn't have 'end-of-central-directory signature') 2) convert shapefile geojson shp2json caairbasin.shp -o ca.json 3) make geojson projection using california albers (specified in caairbasin.prj file): geoproject 'd3.geoconicequalarea().parallels([34, 40.5]).rotate([120, 0]).fitsize([960, 960], d)' < ca.json > ca-albers.json result : ca-albers.json (223m) bigger ca.json (6.3m). in census tract shapefile used in tutorial, file size increases 10 14 m. update : seems problem shp2json step instead of geoproject step. looking @ caairbasin.shp.xml, there 2 sets of bounding, bounding , lbounding. in case, lbounding , coordinate values

python - Mongoengine: Query a MapField -

i have map field want query by. like: class user(mongoengine.document): email = mongoengine.emailfield(required=false, unique=false) username = mongoengine.stringfield(max_length=30, min_length=6, required=true, unique=true) password = mongoengine.stringfield(max_length=500, min_length=6, required=true) profiles = mongoengine.mapfield(mongoengine.embeddeddocumentfield(deviceprofile)) so in field, profiles , store objects so: device_id: deviceprofile object . i tried: user.objects(profiles__device_id=device_id) no avail. how query return user objects have specific key in profiles field? basically, want query user documents contain deviceprofile object based on device id. leaving here else runs problem. in order retrieve mongoengine document key of map field, use exists operator. example, query can constructed , passed object method: qry = { 'profiles__{}__exists'.format(key): true, '_cls': 'user' } user.object(**q

rust - Why doesn't ops::Range<T> implement Copy, even if T is Copy? -

recently, wanted write type holding parameters 3d projection: use std::ops::range; #[derive(clone, copy)] struct camproj { /// near , far plane proj_range: range<f32>, /// field of view fov: cgmath::rad<f32>, // `rad` derives `copy` /// width divided height aspect_ratio: f32, } however, got error: error[e0204]: trait `copy` may not implemented type --> <anon>:3:21 | 3 | #[derive(clone, copy)] | ^^^^ ... 6 | proj_range: range<f32>, | ---------------------- field not implement `copy` so apparently, range<t> never implements copy , if t copy , f32 is. why that? thought range<t> pair of t s? surely implement copy ? because range<t> used iterator, , having iterators copy was discovered footgun . one specific example had thinking iterator advanced, when in reality copy advanced: for x in { // *copy* of iterator used here // .. }

python - Gurobipy from spyder Qt console -

i have installed gurobipy on linux mint , able import gurobipy bash python , ipython. import gurobipy spyder qt console. know make work. @ moment getting following error qt console: importerror: libgurobi70.so: cannot open shared object file: no such file or directory at moment have added following .bashrc: export gurobi_home="/home/smail/gurobi702/linux64" export path="${path}:${gurobi_home}/bin" export ld_library_path="${ld_library_path}:${gurobi_home}/lib" export grb_license_file="/home/smail/gurobi_license/gurobi.lic"

javascript - Animate navbar collapse using pure JS & CSS -

i want remove jquery bootstrap template don't use js components. removed , added fallback code navbar-toggle in pure js (check attatched jsfiddle). want animate navbar toggle (using css or pure js). i tried transition property max-height. don't know final height there's dropdown inside. if use big height, collapse delayed. i have created jsfiddle using example template getbootstrap: https://jsfiddle.net/c5f82stw/ // navbar , dropdowns var toggle = document.getelementsbyclassname('navbar-toggle')[0], collapse = document.getelementsbyclassname('navbar-collapse')[0], dropdowns = document.getelementsbyclassname('dropdown');; // toggle if navbar menu open or closed function togglemenu() { collapse.classlist.toggle('collapse'); collapse.classlist.toggle('in'); } // close dropdown menus function closemenus() { (var j = 0; j < dropdowns.length; j++) { dropdowns[j].getelementsbyclassname('drop