Posts

Showing posts from April, 2010

c# - Should I hide DTOs and View Models behind interfaces or abstractions? -

in there value in using ioc resolvable interfaces specify dtos? fer example: private readonly igettransactionsquery _query; private readonly icreatetransactioncommand _createcommand; public transactionscontroller( igettransactionsquery query, icreatetransactioncommand createcommand) { _query = query; _createcommand = createcommand; } [enablequery] public iqueryable<itransactionquerymodel> get() { return _query.execute(); } public async task<ihttpactionresult> post(icreatetransactionmodel transaction) { if (!modelstate.isvalid) { return badrequest(modelstate); } await _createcommand.execute(transaction); return created(transaction); } here, using itransactionquerymodel , icreatetransactionmodel, instead of concretions. there business value here? scenarios can benefit approach? can think of few, wanted consensus of use case scenarios note: referring controller "action" methods, not constructor, benefit

python - Why does the collision detection not function correctly? -

import random, pygame, sys, json, time, os import colours c import xml.etree.elementtree et pygame.init() open('config.json') config_file: config = json.load(config_file) gamedisplay = pygame.display.set_mode((config['screen_resolution'])) pygame.display.set_caption('bee rpg tycoon') pygame.display.update() #collisions gameexit = false x = 300 y = 300 x_change = 0 y_change = 0 clock = pygame.time.clock() class spritesheet: #loads atlas image def __init__(self, imgfile, datafile): self.spritesheet = pygame.image.load(imgfile).convert() if datafile: tree = et.parse(datafile) self.map = {} node in tree.iter(): if node.attrib.get('name'): name = node.attrib.get('name') self.map[name]={} self.map[name]['x'] = int(node.attrib.get('x')) self.map[name]['y']

.net - C# WPF : ComboBox editabled with TreeView -

i have seen lot of topic creating combobox using treeview not editable 1 (the topics shows things no use of comboboxes). i using combobox grid panel. here xaml using : <window x:class="danddadventures.xaml.addpjwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:danddadventures.xaml" xmlns:sys="clr-namespace:system;assembly=mscorlib" mc:ignorable="d" title="example" height="300" width="300"> <dockpanel> <grid verticalalignment="top"> <grid.columndefinitions> <columndefinition width="1*&quo

android - Push up content inside view pager when soft keyboard shown up -

Image
i have gone through many answers here similar issues, non of them solved problem. i have parent activity contains 1 header stepper indicator, viewpager container in middle , @ bottom footer next or step. inside viewpager have 3 fragments, , 1 includes recyclerview. i'm trying next: when keyboard activated want push whole content including recyclerview, footer , stepper indicator it's adjusted right. screenshot attached below: how looks when keyboard not activated: and how screen looks when keyboard activated. list hidden behind keyboard. maybe scrollview here? however, here code have used these layouts: parent activity <?xml version="1.0" encoding="utf-8"?> <imageview android:id="@+id/background" android:layout_width="match_parent" android:layout_height="match_parent" android:scaletype="matrix"/> <com.solaris.timster.widgets.nonswipeableviewpager android:id=

python - Hungarian/munkres algorithm that is able to not link a point based on a max "price" -

i have been using of hungarian/munkres algorithms have been implemented in python (munkres package , scipy linear_sum_assignment specific) , both work (they based on same c implementation think anyway), lacking feature need. to give context tracking points 1 image another, cost matrix distance between point in image 1 points in image 2. the issue arises in specific case, if point image 1 lost in second image, new different point detected in image 2, 1 of image 1 points matched new point. , hungarian algorithm working intended, dont me wrong. need hungarian algorithm return "no match" point if point wants match far away. in matlab there example of on file exchange called simpletracker.m, , munkres implementation there can allow case theres no link. if have 2 images 5 particles, might link 2 of particles, cause can use max linking distance parameter decide whether assignment should made or not. as simple example, if have image1 2 points @ (1,1) , (10,1), , sake of arg

Playing an audio/sound with Javascript when time expires is not working on Android and IOS -

i have custom made countdowntimer in javascript shows mini seconds, seconds & minutes. can see full code below, in javascript code can assign values these variables in double digits : var minutes = 05; var seconds = 00; var tens = 00; so after assigning above values, can see 5 mins. in browser show 05:00:00 . in html , have 3 buttons start , stop , reset . when press start timer start running out. now in javascript created variable var sound , assigned audio file it. there function countdowntimer { } @ end of javascript code doing work timer, in function first if statement how know timer expired. in if statement play sound sound.play(); problem : now of works fine on desktop on mobile devices android , ios, hear no sound when timer expired. ideas on how play sound when timer expired on android , ios appreciated. thank you! full html , javascript timer below. html <div class="countdown"> <p class="audtitle">count down</p&

javascript - Show VB6 forms when click a link in html page of webbrowser -

i working vb6 webbrowser, here need open vb6 form when user click particular link of webbrowser 's link like in html <html> <head> <body> <a href="--show vb6 form--">click show vb6 form2</a> </body> </html> i do't have idea how it. thought sometime can done third text file when link clicked write cod 002 in text file. and in vb form timer check once second file, when timer detect file contains 002 show form. can method? or else shorter can except? pick better naming scheme like: <a href="#vb-showform2">click show vb6 form2</a> <a href="#vb-waffles">waffles</a> then intercept link clicks via beforenavigate2 event, @ url , if matches #vb-* run code: private sub webbrowserctrl_beforenavigate2(byval pdisp object, url variant, flags variant, targetframename variant, postdata variant, headers variant, cancel boolean) '// #vb-xxx command url di

Kendo mvc grid template format -

my application mvc5 c#; using kendo mvc grid, need format currency item. columns.bound(p => p.isfree).template(@<text> @if (item.isfree) { <span>free</span> } else { <span>@item.price </span> }</text>).title("cost"); could not find documentation how format @item.price currency. you can use clienttemplate instead of template if else condition below columns.bound(c => c.isfree).clienttemplate("# if(isfree) {# <span>free</span> #} else{# <span>#= kendo.tostring(price, 'c') #</span> #}#").title("cost")

php - logout link not working when on nav bar using laravel -

my logout link not working navigation bar; however, if add link on home page, or if go directly route ( http://localhost/dico/public/logout ) works , user logged out. when review page source code, confirmed href in logout link correct. if click on link source code, user gets logged out. route route::get('logout', 'sessionscontroller@destroy'); controller <?php namespace app\http\controllers; use illuminate\http\request; class sessionscontroller extends controller { public function __construct() {...} public function create() {...} public function store() {...} public function destroy() { auth()->logout(); return redirect('/login'); } } the view <li><a href="{{ url::to('logout') }}"><i class="fa fa-sign-out fa-fw"></i> logout</a></li> i tried logout you should try may you: need ch

Efficiently pass Java data to Javascript for chart plotting purpose -

i aware there numerous java chart libraries available of plotting style old fashioned such jfreechart , gral. javafx chart nice not support boxplot . thinking of javascript more fashioned style , more interactive. worried performance when converting datasets javascript string datasets 10k. any suggestion java chart library more fashioned style , interactive. efficiently pass datasets java javascript. use j2v8?

java - ANT build JAR with Log4j -

Image
i have wrote simple program using eclipse, output log in console log4j2. when running on eclipse, everything's fine, log output in eclipse's console, below: but when use ant build program jar, , running on command line, output logging cannot print out exact file name , line number, below: it didn't show error message during ant process. why output logging cannot print out exact file name , line number? my project's structure is: here's class code: package p1; import org.apache.logging.log4j.logmanager; import org.apache.logging.log4j.logger; import javafx.application.application; import javafx.stage.stage; public class mymain extends application { private static logger logger = logmanager.getlogger(mymain.class); public static void main(string[] s){ for(int i=1; i<=10; i++){ logger.info("this logging"); } launch(s); } @override public void start(stage primarystage) throws exception{ system.exit(0

Google Cloud Dataflow: Different behavior for DirectRunner versus DataFlowRunner when using argparse -

i building google cloud dataflow pipeline process videos. having hard time debugging pipeline because environment behavior seems different on directrunner versus dataflowrunner. my video processing tool (called deepmeerkat below) takes in arguments argparse. call pipeline: python run_clouddataflow.py \ --runner dataflowrunner \ --project $project \ --staging_location $bucket/staging \ --temp_location $bucket/temp \ --job_name $project-deepmeerkat \ --setup_file ./setup.py \ --maxnumworkers 3 \ --tensorflow \ --training where last 2 arguments, tensorflow , training both pipeline, rest needed clouddataflow. i parse args , pass argv pipeline beam.pipeline(argv=pipeline_args) and within deepmeerkat's argparse, parse known args. args,_=parser.parse_known_args() this works locally, tensorflow turned off (default on) , training turned on (default on). printing args confirms behavior. fails parse on cloud dataflow, tensorflow stays on

python - Generating a List of object properties from a pre-existing list VB.Net -

with python background, i've become rather accustomed using lines like print(" ".join({x.name x in my_list})) where {x.name x in my_list} is list/array containing name property of each of objects in my_list. i'm looking similar in vb.net, know possible using longer section of code like: dim str1 = "" each item in mylist str1 &= item.name & " " next but i'd prefer simpler solution i'll doing lot, , i've heard there's similar notation possible using linq. any appreciated. i think talking ienumerable(of t).select function. can use mapping collection of 1 type collection of type. dim combinednames string = string.join(" ", mylist.select(function(item) item.name)) so equivalent python's {x.name x in my_list} in vb.net dim names = mylist.select(function(item) item.name) dim builder = new stringbuilder() each name in names builder.append(name) builder.append(" &quo

app store - iTunes rejected app for 4.2.6 -

i facing below issue when submit app itunes guideline 4.2.6 - design - minimum functionality we noticed app appears created commercialized template or app generation service. to deliver content pre-packaged version of website, consider creating web app, looks , behaves similar native app when customer adds home screen. more information creating web app, review safari web content guide. offer app not use commercialized template, consider using apple developer tools design , create unique app deliver content. more information developing apps app store. but app developed using xcode ide. submitted appeal itunes app developed using xcode ide i not sure mistake happened end or modification need done end

linux - request_firmware_nowait failure while loading driver (fw) -

i trying load driver module has firmware. driver trying push fw image hardware through remoteproc. rproc_add calling "request_firmware_nowait" , encountered "-2" error @ fw_get_filesystem_firmware() api. it seems file not found but, before call insmod , double checked path name , , seems fine. permission looks good. if call direct firmware load call (changed kernel source code) , @ least, able find file. any clue on this? seems failing filp_open inside fw_get_filesystem_firmware function , operation working on top of workqueue . any information welcomed! linux kernel 4.4.46 early stage boot up using initrd , on ramfs (squashfs) from workqueue, call request_firmware

asp.net - Building Core2.0 project in Visual Studio Team Services fails with numerous assembly import errors -

Image
i have build definition .net core restore .net core build .net core test .net core publish publish artefact while using core1.1 worked without issue. after upgrading project core2.0 fails multiple errors error cs1703: multiple assemblies equivalent identity have been imported: 'c:\users\buildguest\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\system.threading.tasks.parallel.dll' , 'c:\users\buildguest\.nuget\packages\system.threading.tasks.parallel\4.3.0\ref\netstandard1.1\system.threading.tasks.parallel.dll' error cs0433: type 'targetframeworkattribute' exists in both 'system.runtime, version=4.2.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' , 'system.runtime, version=4.1.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' error cs0518: predefined type 'system.string' not defined or imported solution building locally. tried add task use .net core runtime 2.0.0 in beginning without succes

jquery - Dinamically renew calculator input result -

i have calculator based on select option, 2 inputs. dinamically result when change range or input data in text field. needed add div "buttons" fixed sizes. works great when choose select option , feel inputs. when choose select option click on div (60x90 or 100x150) button, inputs new values, result doesn't renewed. problem? think in $('#form').on('input change', 'select,input', function() $(document).ready(function(){ $(document).on('input', '#height', function(event) { $(this).next().val($(this).val()); }); $(document).on('input', '#heightplus', function(event) { $(this).prev().val($(this).val()); }); $(document).on('input', '#width', function(event) { $(this).next().val($(this).val()); }); $(document).on('input', '#widthplus', function(event) { $(this).prev().val($(this).val()); }); }); $(document).ready(function(){ $('#form')

javascript - How can I make a username search engine for my website? -

i'm trying make html field can put username , click on search button redirect example.com/i/username . there should no / , ? or /? @ end of url because url redirects deep link , open profile of app of username. i tried below code didn't work. <form method="get" action="https://example.com/i"> <input type="text" name="q" size="31" maxlength="255" value="" /> <input type="submit" value="search" />

javascript - One failing test causes other async tests to fail -

Image
i have basic karma/jasmine setup 1 test suite containing 2 tests. expect first test fail , second test pass. describe("the system", function() { it("should fail", function() { expect(true).tobe(false); }); it("should succeed", function(done) { settimeout(function() { expect(1).tobe(1); done(); }, 10); }); }); however, when run these tests in browser and click debug button open karma debug runner , see both tests failing, second test fails error message of first test. regular test run (i.e. not in karma debug runner) works expected. the error message second test is: uncaught expected true false. @ usercontext.<anonymous> (http://localhost:9876/base/workingspec.js:4:22) thrown when disable or remove first test, second test passes. why both tests fail in case? why second test fail error message of first test? my test setup contains following packages/versions: +

auto connect/reconnect shapes in excel with vba -

Image
i have question. have lot of shapes in excel it's flow chart. need hide rows, , flow chart not correct. can see in pic. before hiding rows: after hiding rows: is there macro write, auto connection between shapes, or reconnect after hiding rows?

How to recover a value from SQL queries in javascript -

i have function javascript , compare 2 values of 2 turnover of 2 results sql queries . problem function return 1 line knowing have more 300 lines. tihs following code: var query1 = {{repair_semestre1}}; var query2 = {{repair_semestre2}}; var data = {}; [query1, query2].foreach(function (query, semester) { query.client.foreach(function(clientid, index) { var client = data[clientid] = data[clientid] || {}; var clientart = client[query.lru[index]] = client[query.lru[index]] || [0, 0]; clientart[semester] = query.round[index]; }); }); // report on data (client in data) { (article in data[client]) { var turnovers = data[client][article]; return("client: " + client + ", art.: " + article + ", semester t/o: " + turnovers + " " + (turnovers[0] === turnovers[1] ? "equal" : turnovers[0] < turnovers[1] ? "increase&quo

html - Anchor a page when a paragraph is expanded via javascript -

i have web page dynamically creates comments. comments minimized , can expanded using "more" link. when click more link page jumps top of page. wanted make such when more button clicked full comment shown , page remains in location of comment. html <div tal:condition="not comment.pending_review"> <tr> <td>${ comment.account.email }</td> <td> <p class="more_text" style="width: 250px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis" >${ comment.comment }</p><a name="${ comment.id }" id="${ comment.id }" data-id="comment" class="more_link" href="#">more</a></td>

python - Load a PDF in a ActiveX widget -

Image
i trying load pdf qaxwidget : self.axwidget = qaxcontainer.qaxwidget() self.axwidget.setproperty("geometry", qtcore.qrect(630, 20, 501, 651)) self.axwidget.setcontrol("adobe pdf reader") self.axwidget.dynamiccall("loadfile(const qstring)", "test.pdf") however, loads empty gray background: i've been searching alternatives, external libraries, python pdf-to-png libraries , load image, etc. every result found far seems overkill task. so, since qt supports activex controls, can check working example, or specific documentation dynamiccalls python in order load pdf inside qaxwidget ? i need read-only data, image of work.

android - Recyclerview holder setting an image text instead of drawble -

i need display array texts image, displaying them text working, image not working. below explanation. i have array of texts want display them in recycler view image. string[] images = { "for_honor.png", "r.drawable.ghost_recon.png", "r.drawable.horizon_zerod.png", "r.drawable.mass_effect.png" }; setting them in way seems wrong not getting image ((myviewholder) holder).getmdataimgview().getresources().getidentifier(name,"drawable","com.example.pkg.pg.adapters"); however code working show me them text not image // ((myviewholder) holder).getmdatatextview().settext(name); this code im main activity maingridrecview = (recyclerview) findviewbyid(r.id.maingridrc); maingridrecviewlayoutmanager = new linearlayoutmanager(context); maingridrecview.setlayoutmanager(maingridrecviewlayoutmanager);

rest - I want a custom attribute to be fired automatically without writing that on the web api method -

i want custom attribute fired automatically without writing on web api method. way can achieve that? let example have action filter attribute public class myapiactionfilterattribute : filterattribute { //... } with can assign class or action depending on how want used public class myapicontroller : apicontroller { [myapiactionfilter] public ihttpactionresult myaction() { return ok(); } } this applies action only. but, if wanted applied on actions (globally) within web api, need add configuration. globalconfiguration.configuration.filters.add(new myapiactionfilterattribute ()); this done @ startup web configuring web api. note in doing above, filter applied requests.

c# - PDF not exporting to Excel -

i had desktop system converted web, , struggling developer died! main issue @ moment reports pdf , customer has been used right clicking on them , exporting excel - why not available? it exist. called ocr (optical character recognition). a little google suggest plenty of ready made tools. leaving question of redoing format.

wordpress - WP get posts with 2 condition -

i have custom post type 2 conditions : first : acf field start date secondly : acf field empty i have first, list ordered "start date" (acf field) , secondly list ordered publication date. when using get_posts, first condition works : $args_infos = array( 'numberposts' => -1, 'post_type' => 'infos', 'tax_query' => array( array( 'taxonomy' => 'emetteur', 'field' => 'term_id', 'terms' => 132, 'operator' => 'not in', //to hide expired posts ) ), 'meta_key' => 'start_date', //the reason why, posts start date showing 'meta_type' => 'date', 'orderby' => '

dynamic - Get the address of a callback function to call dynamically in C++ -

i trying build application can dynamically call win32 api function according user input. i wondering how can have behavior of function registercallback in c++, because seems useful , can address callback function. how can achieve same behavior function in c++? i implemented function can call dynamic library, stuck in such dynamic callbacks. for example can call enumwindows api function below: calllibfunction(getprocaddress(loadlibrary(l"user32.dll"), "enumwindows"), paramarray, 2, exepinfo); thanks in advance. edit: explain more. assume have following code: callback function: bool callback enumwindowsproc(__in hwnd hwnd, __in lparam lparam) { return true; } main function: enumwindows(enumwindowsproc, null); above usual way can use api function. want called this: longlong callbackaddress = <some function address>&enumwindowsproc paramarray[1].type = vt_i8; paramarray[1].llval = callbackaddress; // address of `enumwind

Dynamics 365 unexpected error -

when creating case below error. access error system not log on. because user record or business unit belong has been disabled in microsoft dynamics 365. if contact support, please provide technical details. this occurred shortly after deleting crm admin user , creating new crm admin user in office 365 users screen. the more technical message the user systemuserid=bb51ba1c-66e8-4dc1-82ca-cb64e25f3ff9 in organizationcontext=7e061672-3a31-4588-9770-9f94711c7f09 disableddetail. the error message saying user id disabled first thing open record , check user is. to that, use url below replace xx's , yourregion part of url (i've added user id). https://xxxxxxxx.yourregion.dynamics.com/main.aspx?etc=8&extraqs=&histkey=952109180&id={bb51ba1c-66e8-4dc1-82ca-cb64e25f3ff9}&newwindow=true&pagetype=entityrecord you need enable user or resolve problems there. i check don't have plugins or workflows have been setup run use

Are workspace templates as implemented in Powertools for TFS 2013 still available in TFS 2017? -

in respect following question is there way share workspace settings (folder mappings) visual studio online / team foundation server? , entry found regarding topic https://social.msdn.microsoft.com/forums/vstudio/en-us/c9b16b30-4534-4781-a2e8-fb413a2df0af/power-tools-for-tfs-2017-with-vs-2017-rc?forum=tfsgeneral wanted ask if knows how achieve needed functionality in tfs 2017? thanks. unfortunately cannot create workspace templates vs 2017 now. according release notes says of previous power tools have been integrated tfs 2017 means no separate power tools tfs 2017. but team utilities feature component not integrated, means these haven't shipped visual studio 2017. i have submitted user voice here suggest feature, can go , vote achieve in future. another similar thread reference: team members team utilities section in vs 2017

solr - Pysolr - Indexing on multiple fields -

so, reading issue on official documentation, figured can have multivalued field : solr.add([ { "id": "doc_1", "title": "a test document", "link": ["baidu.com", "google.com"] } now, index docs on both title , link field, how can that? , default field indexed on?

sqlite - Android - Two spinners in one Activity - Saving Data is not working -

my problem following. have 2 spinners in 1 activity. want both spinner items should saved in db. there slight difference between both spinners: spinner 1: populated data other db-table - when spinner in mentioned activity, works. spinner 2: has default values. not sure if added correctly activity. anyway, after added saving data not working anymore. please me doing wrong?? my activity code: public class activity_transport extends appcompatactivity { private bottomnavigationviewex bottomnavigationviewex; databasehelper mydb; button btn_save; spinner chooseproject,choosetransport; edittext entfernung,price,mwst; string selectedspinner, selectedtransport; imageview imageview2; private static int pick_image = 100; uri imageuri; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_transport); mydb = new databasehelper(this); choosepr

typescript - React Native breakpoint instantly disappears on Android emulator -

i'm attempting debug react native in chrome. in pretty-printed .js file, click line set breakpoint, , breakpoint appears disappears (like in 1/10 of second). doesn't happen on ios simulator (i can set breakpoints , debug there). i can set breakpoint on first line, is object.defineproperty(exports, "__esmodule", { value: true }); why might happening? doesn't appear can set breakpoint anywhere in of .js files. we're using typescript , babel relay-compiler . is case i've read " there can't functions in source file you're trying set breakpoint in"? don't totally control because of typescript , babel output.

html - CSS adds automatic margin on small screens in portrait mode -

this code: <html> <head> <style> body { margin: auto; width: 720px; } </style> </head> <body> <p>lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet. lorem ipsum dolor sit amet.</p> </body> </html> when running on full hd screen in portrait mode, fine: paragraph width 720px. if change width 1080px fine aswell: there no margin - paragraph goes 1 side of page other. but if i try view on 720x1280 hd screen in portrait mode, 130px margin added automatically. why happen? margin: auto messing on smaller screens? how fix it? appreciated. <style> body{ margin: 0 auto; width:720px;} &l