Posts

Showing posts from January, 2010

c# - EntityFramework Include (Eager Load) virtual Property of virtual property -

imagine have 3 dbsets below: category { ... public virtual icollection<item> items {get; set;} ... } item { ... public virtual icollection<specification> specifications{get; set;} ... } specification { ... } for eager loading use this: category cat = db.categories.include(c=> c.items).firstordefault(c=> c.id == 1); but problem cat.items[0].specifications null , how can make eager load sub collections of collection too? p.s.: tried removing virtual keyword testing (i'm don't want remove it) didn't work either. you can use notation db.categories.include("items.specifications") note has string

groovy - Active Choices Reactive Reference Parameter in jenkins pipeline -

i'm using active choices reactive reference parameter plugin in dsl job here code parameters { activechoiceparam('choice1') { description('select choice') choicetype('radio') groovyscript { script("return['aaa','bbb']") fallbackscript('return ["error"]') } } activechoicereactiveparam('choice2') { description('select choice') choicetype('radio') groovyscript { script("if(choice1.equals("aaa")){return ['a', 'b']} else {return ['aaaaaa','fffffff']}") fallbackscript('return ["error"]') }

sql server - unable to update when 0(zero) value is stored for empty fields in c# -

i have non mandatory phone textbox field , datatype int. if leave phone field blank , submit form, phone column stored 0(zero) in database. facing issue update: while updating when phone '0' respective row not updated. need set default value of phone null? if please explain. here update query cmd.commandtext = "update client_final set companyname = @companyname, url = @url, industry = @industry, contactperson1 = @contactperson1, contactperson2 = @contactperson2, designation = @designation, fax = @fax, phone = @phone, mobile = @mobile, emailid1 = @emailid1, emailid2 = @emailid2, baddress = @baddress, bcity = @bcity, bstate = @bstate, bzipcode = @bzipcode, bcountry = @bcountry, regaddress = @regaddress, regcity = @regcity, regstate = @regstate, regzipcode = @regzipcode, regcountry = @regcountry client_id = @client_id"; cmd.parameters.addwithvalue("@client_id", txtclientid.text); cmd.parameters.addwithvalue("

database - Entity Framework and Linq equivalent in Android -

i new android. literally learn android few days ago. wondering, there entity framework , linq equivalent android? also, need store/cache record local database. best database use? thinking of using sqlite. appropriate android? thanks! sqlite appropriate store local data example: if retrieving json, u can sqlite database store data offline mode, , of course u can use cache well, recommend u sqlite. hope helped.

objective c - OBJC_PRINT_VTABLE_IMAGES and OBJC_PRINT_VTABLE_SETUP does not show any output -

i've tried use objc_print_vtable_images , objc_print_vtable_setup environmental variables on objective-c executable in order learn vtable mechanism in objective-c objects. unfortunately mentioned environment variables have no effect on console output, despite fact runtime acknowledged variables set: » objc_print_options=1 objc_print_vtable_images=yes /applications/textedit.app/contents/macos/textedit objc[41098]: objc_print_options set objc[41098]: objc_print_vtable_images set i've tried use both variables on executables provided system (textedit) , own. no effect. whole vtable mechanism in objective-c objects obscure. it's hard find information mechanism on apple pages. there info other sources, no official documentation: http://www.sealiesoftware.com/blog/archive/2011/06/17/objc_explain_objc_msgsend_vtable.html http://cocoasamurai.blogspot.com/2010/01/understanding-objective-c-runtime.html why these variables not working? vtables in current version of objecti

youtube - Cobalt for Amazon Prime -

we planning use cobalt port on our embedded platform run applications amazon prime along youtube. possible use applications other youtube? if so, expected run-time footprint of cobalt? also, there licensing cost associated cobalt? cobalt can run application has been engineered run within cobalt subset of html/css/webapi. unlikely amazon prime video run out of box on cobalt, made run effort. cobalt open source, , has no licensing fee. for youtube, cobalt takes 130mb of cpu memory. gpu usage depends lot on image cache settings , ui resolution. the binary 5mb stripped , compressed, 19mb uncompressed. our icu data 2mb compressed, 6mb uncompressed. have couple different font options take varying amounts of space. can cover in 10mb of uncompressed fonts. these numbers subject significant change.

c# - VS does not allow me to invoke my extension method -

for reason, vs allows me use long writing of extension method invocation. compiler rejects shorter form: public static class operationextender { public static void mymethod(operation ope, int value) { ... } } i can invoke way: operationextender.mymethod(anoperation, 0); but if type: anoperation.operationextender(0); vs generates usual comilation error: 'operationextender.mymethod(operation, int)' not contain definition 'mymethod' , no extension method 'mymethod' accepting first argument of type 'operation' found (are missing using directive or assembly reference?) if first writing accepted, suppose cannot usung/ns/assembly issue.... because it's not extension method. forgot this keyword on first parameter (the type being "extended"): public static void mymethod(this operation ope, int value) { //... }

java - gson.toJson() throws StackOverflowError in Servlet -

i have list of objects clients list<client> clientslist=new arraylist<client>(); clientslist=clientdao.getallclients(); entity client has others list attributes: @manytoone(optional=false) private user createdby; @manytomany(mappedby = "clients") private set<clienttype> types=new hashset(); @manytoone(optional=false) private leadsource id_leadsource; @manytoone(optional=false) private agencie id_agencie; @onetomany(cascade=cascadetype.all,mappedby="owner") private set<propertie> properties=new hashset(); @onetomany(cascade=cascadetype.all,mappedby="buyer") private set<sale> sales=new hashset(); @onetomany(cascade=cascadetype.all,mappedby = "client") private set<rent> rents=new hashset(); @onetomany(cascade=cascadetype.all,mappedby = "clientdoc") private set<document> docuements=new hashset(); and when try convert list of clients json format out.write(new gson().tojson(clien

I cannot download spring-data-gemfire in Maven. What are corrects repository/group/artifact ? -

i cannot download spring-data-gemfire in maven. corrects repository/group/artifact ? pom <dependency> <groupid>org.springframework.data</groupid> <artifactid>spring-data-gemfire</artifactid> <version>1.9.1.release</version> <dependency> <repository> <id>spring.io</id> <name>spring.io</name> <url>http://repo.spring.io/plugins-release/</url> </repository> <repository> <id>mvnrepository</id> <name>mvnrepository</name> <url>https://mvnrepository.com/artifact/</url> </repository> <repository> <id>apache.nexus</id> <name>asf nexus staging</name> <url>https://repository.apache.org/content/groups/staging/</url> </repository> <repository>

hbase - How do I make spark write to multiple sources foreachrdd -

i have made spark streaming program reads kafka source. after transformations, need send data 2 kafka producers , hbase. i receive data via spark streaming: customer1 21631512435 2 1449540003.803 1449540363.571 25566530 27670 1557041 19491 65664 1 197.26.8.142 197.31.74.208 customer2 21631526589 4 1449540003.821 1339540363.565 25536520 27369 1545811 19487 65659 5 197.25.2.135 197.31.74.206 i want make transformations , send 2 kafka producers , save copy hbase. i found examples here talking sending data kafka producers , saving hbase, problem don't have sbt or maven , i'm using spark shell (spark 1.3). i've found many problems importing jars. i'm reading kafka , saving hdfs. can me complete task?

How to pass checkboxes in different activities to one single activity in android? -

i making android app in there different cities in different activities. example, there 1 activity dalhousie , activity shimla. , in each activity there 1 heart shaped checkbox, in instagram. if check check boxes, city appear in activity profileactivity.java has list of favorite cities have checked. don't know how intent different activities 1 single activity. here code dalhousieactivity.java package com.example.srushtee.dummy; import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.support.v4.view.viewpager; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.text.method.scrollingmovementmethod; import android.util.log; import android.view.view; import android.widget.button; import android.widget.checkbox; import android.widget.compoundbutton; import android.widget.textview; import me.relex.circleindicator.circleindicator; public class dalhousieactivity extends appcompatact

Angular 2 Component communication by service not working -

i trying communicate between 2 components service it's not working me, , don't understand why. please guide me through this. want change page title bar when change page. service import {injectable} '@angular/core'; import {subject} 'rxjs/subject'; @injectable() export class updatepagetitleservice { // observable string sources private newtitlesource = new subject<any>(); // observable string streams newtitle$ = this.newtitlesource.asobservable(); changetitle(title: any) { this.newtitlesource.next(title); console.log(this.newtitlesource); } } page component import {component, oninit} '@angular/core'; import {updatepagetitleservice} '../../../../share/updatepagetitle.service'; @component({ selector: 'customer-details', template: require('./customerdetails.html'), styleurls: ['./customerdetails.scss'], providers: [updatepagetitleservice] }) export class customerdetails imp

java - com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'xyz' . hbm2ddl.auto=update not working -

i creating 1 application using spring, hibernate , mysql. setting hibernate.hbm2ddl.auto=update , suppose force mysql create database/tables if not exist. still reasons hibernate not creating database , throwing exception. please have used sorts of dialect please see below in vain. hibernate.properties file #jdbc properties jdbc.driverclassname=com.mysql.jdbc.driver jdbc.url=jdbc:mysql://localhost:3306/emusicstoredb jdbc.username=root jdbc.password=mysql@123 #hibernate properties hibernate.dialect=org.hibernate.dialect.mysql5dialect hibernate.show_sql=true hibernate.hbm2ddl.auto=update hibernate.format_sql=true applicationcontext.xml file <context:property-placeholder location="/web-inf/hibernate.properties" /> <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource"> <property name="driverclassname" value="${jdbc.driverclassname}" /> &

machine learning - Printing from Custom Layers in Keras -

i working on implementing alexnet in keras. recently, came across 1 implementation on repo quite clean implementation of alexnet architecture. feel there bug in available code on line . if somehow know way print dimensions of variables able understand , resolve bug. tried print function , writing file none of them seem working. know can printed such custom layers in keras library? try `model.summary()' function. prints full information layers dimensions.

javascript - Why is the textarea in a d3 group changing position when new line is added? -

Image
edit: if i'm setting ".style("overflow", "hidden")" doesn't happen. strange. so problem, have added textarea foreignobject , foreignobject part of d3 group , when add new line textarea changes position. how can fix that? here can see i'm talking (hit 2 or 3 times enter) https://jsfiddle.net/jcbujyyg/2/ original code: var svg = d3.select("body").append("svg") .attr("preserveaspectratio", "xminymin meet") .attr("viewbox", "0 0 960 600") .attr("width", "100%") .attr("height", "100%") .attr("style", "outline: thin solid black;") .style("background-color", "#f4f3f1"); var group = svg.append('g') .datum({x: 0, y: 0}); group.append("rect") .data([{x: 200, y: 200, width: 400, height: 200}]) .attr("id", "base") .attr("x", function (d) {ret

rxjs - How to return from within an observer? -

i trying return filter function return doesn't seem work callbacks. here this.store.let(getispersonalized$) observable emitting boolean values , this.store.let(getplayersearchresults$) observable emiting objects of video class. how run synchronously, can avoid asynchronus callback altogether given can't modify observables received store. ispersonalized$ = this.store.let(getispersonalized$); videos$ = this.store.let(getplayersearchresults$) .map((vids) => this.myfilter(vids)); myfilter(vids) { this.ispersonalized$.subscribe((x){ if(x){ return this.fileterx(vids);//return here } else { return this.filtery(vids);//or return here } }); } fileterx(vids) { return vids.filter((vid) => vids.views>100;); } filetery(vids) { return vids.filter((vid) => vids.views<20;); } i got working way, don't need myfilter(vids) @ if can branching out on ispersonalized$ &

python - Can't create_all Flask-SQLAlchemy - specified key was too long -

when try run db.create_all() create mysql tables, following error: sqlalchemy.exc.internalerror: (pymysql.err.internalerror) (1071, 'specified key long; max key length 767 bytes') [sql: '\ncreate table post (\n\tid integer not null auto_increment, \n\tblog_id integer, \n\tuser_id integer, \n\ttitle varchar(80), \n\tbody text, \n\timage varchar(255), \n\tslug varchar(256), \n\tpublish_date datetime, \n\tlive bool, \n\ttag_id integer, \n\tprimary key (id), \n\tforeign key(blog_id) references blog (id), \n\tforeign key(user_id) references user (id), \n\tunique (slug), \n\tcheck (live in (0, 1)), \n\tforeign key(tag_id) references tag (id)\n)\n\n'] how can resolve error? i'm unsure source of issue. can create_all() db in dev environment, not on host. i've assumed it's column size restriction on server's mysql service. encoding table contents inefficiently? did structure models incorrectly? i've tried change settings.py : db_uri = "mysq

How to show current CPU load with Android Device Monitor? -

Image
i want watch current cpu load of android-app activity monitor on macos or in task manager of windows. apparently android offers android device monitor that. unfortunately device monitor displays not specific section cpu load shown below in picture official documentation : but can't find neither "monitor" tab in device monitor window nor "view"-menu activate it, mentioned in documentation. this how looks on development machine (macbook macos sierra): how can enable cpu- , memory graphs? android-studio: 2.2.3 android-sdk: 7.1 , 6.0 summary / tl;dr: this question not how open android device monitor. question aboput how active cpu-load-view within android device monitor. apparently android offers android device monitor (a picture official documentation): that documentation , screenshot refers android monitor, not same android device monitor. (sorry — didn't name them) this how looks on development machine (macbook maco

asp.net - Custom .net assembly in classic ASP- error 0177 : 80004003 -

i have been working on days , made progress still not working way need to. first off project taking existing huge site (100,000+ lines of code spread out on @ least 200+ files) written in classic asp (vbscript) , converting .net framework. the existing code uses vbscript classes, part, , plan make mimic of dozen or classes defined .net assembly both new .net version , existing classic asp pages can use - through com+. i have made first class definition, replicated in .net , works in test.ashx page on development server (when go page in browser, expected output). receive error calling test.asp page server object error 'asp 0177 : 80004003' on line calls set obj = server.createobject("mylibrary.myclass") . i have registered custom dll via regasm regasm "c:\inetpub\siteroot\bin\mylibrary.dll" /tlb /codebase , seemed work fine (the library appears in server's component services expected methods defined , seems fine. my gut telling me either 3

c# - From asp.net submit long running sql query -

i have asp.net web application needs submit long running sql stored procedure parameters. run 30 minutes. how can submit run on sql server job web app can continue on else? possible check if job finished asp.net? i handle putting query job. page/website check see if job complete. start job how start sql server job stored procedure? check status of job how can determine status of job?

android - Listview inside Cardview using RecyclerView -

i want add dynamically loading listview inside cardviews arranged in grid layout loads dynamically according data present. how can done? all listviews different according data fetched links: 1) http://www.json-generator.com/api/json/get/btarfsabkg?indent=2 (used) or 2) http://www.json-generator.com/api/json/get/cnwvbvagoo?indent=2 supporting code same below: mainactivity.java import android.content.context; import android.os.asynctask; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.gridlayoutmanager; import android.support.v7.widget.recyclerview; import android.util.log; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.net.httpurlconnection; import java.net.url; import java.util.arraylist; public class mainactivity extends appcompatactiv

c# - Network Activity Spinner Spins Forever -

i'm building xamarin forms app , have problem network activity spinner in status bar (ios) continuing spin forever. below code i'm using display loading screen. private async task executeconfigurecampaigncommand() { if (isbusy) { return; } isbusy = true; //configurecampaigncommand.changecanexecute(); bool showalert = false; string campaign = null; try { campaign = crosssecurestorage.current.getvalue(settingnames.campaign); if (!string.isnullorempty(campaign)) { statusmessage = "blah"; onpropertychanged("statusmessage"); await task.delay(1000); statusmessage = "blah"; onpropertychanged("statusmessage"); await task.delay(700); statusmessage = "blah"; onpropertychanged(&

android - How to let Picasso check the cached file on disk at provided path? -

we know picasso first checks memory cache, disk cache , in end downloads file if can't find it. my aim "tell" picasso, when needs file disk, find , if not exist there, download , save @ path. the reason want ensure can make use of downloaded file again anywhere else in app if need. way, if file has been downloaded part of app, picasso not download again , use straight away. otherwise, picasso download , else not have download again , use it. is possible tell picasso , download (if needed) file @ path developer provide? any suggestions how achieve it?

xamarin.forms - Xamarin forms Azure push notification Delayed -

hey developed xamarin forms mobile app (ios , android) uses azure mobile services node.js end , implemented azure push notifications android. should send me notification when record inserted database. notification phone there huge delay (about 1 min) appreciated thank in advance push notifications not real-time , not guaranteed delivery. delays common - i've seen delays of 5 minutes push. 1 minute doesn't seem out of place.

How to call controller in state of AngularJS from another folder contain controller? -

Image
i'm facing problem. how call controller state, while controller placed on folder named , controllers (as shown in following picture)? there way add controller in state like: url:"/whatever", templateurl:'whatever/init', controller :function(depencies){ perform function } but want reduce code in state, , want put controller folder, , can integrate them separate locations. this picture clear understanding: as long include controllers/articles.js in page change state config use registered controller name: url:"/whatever", templateurl:'whatever/init', controller :'articles'

javascript - ng-model value is always String type, even entered value is a number -

<div> <input type="text" ng-model="test"/> </div> "test" value string type, if entered number valid case. still want exact data type. can suggest me way find data type, if enter value number data type should "number", , if enter value "abc" data type should "string" , etc. in short use same html texture , data type of entered value you're going have post bit of code give example, otherwise it's going difficult give answer. suspect it's because of bad html, i.e., <input type="text" /> the above return 'string'. <input type="number" /> the above return 'number'. code set correctly? edit: if put without caring 'type' (bad html) check type in controller when you're massaging data. i.e., (using lodash example) these 2 examples: if (_.isstring(value)) { } if (_.isnumber(value)) { } or native javascript use '

c# - WebApi2 OData return custom error object -

i've searched intensive can't work. i've haven web ap2 odata api , need return custom error class. here have: public class error { public string code { get; set; } public string message { get; set; } } in global.asax.cs protected void application_start() { globalconfiguration.configure(webapiconfig.register); globalconfiguration.configuration.messagehandlers.add(new messageinterceptor()); } public class messageinterceptor : delegatinghandler { protected override task<httpresponsemessage> sendasync(httprequestmessage request, cancellationtoken cancellationtoken) { return base.sendasync(request, cancellationtoken).continuewith( task => { var body = task.result.content.readasstringasync().result; var resultobj = jsonconvert.deserializeobject(body.replace("value", "results"));

arangodb - Object Array data type -

this aql returns object use. const keys = db._query(aql` huis in test filter huis._key in ${req.queryparams.keys} return { 'key': huis._key, 'adres': huis.adres, 'postcode': huis.postcode, 'plaats': huis.plaats } `); this returns object: [ { "key": "374875", "adres": "klaverstraat 7", "postcode": "2197gv", "plaats": "leiden" } ] then take key so: keys[0].key this works in javascript when make fiddle not in foxx. const test = [ { "key": "374875", "adres": "klaverstraat 7", "postcode": "2197gv", "plaats": "leiden" } ] console.log(test[0].key) 374875 why return 'undefined' in foxx correct data in fiddle? this foxx code: router.get('/', function (req, res) { c

c# - How to allow only decimals in TextBox in WPF? -

i have 2 textbox in wpf, , want 1 of them allow integer inputs , other 1 decimal inputs precision of two. looks this: <label>price:</label> <textbox name="price" previewtextinput="decimalvalidationtextbox" text="{binding path=price}" /> <label>mileage:</label> <textbox name="mileage" previewtextinput="integervalidationtextbox" text="{binding path=mileage}" /> and 2 handler this: private void decimalvalidationtextbox(object sender, textcompositioneventargs e) { regex regex = new regex("^[0-9]+([.][0-9]{1,2})?$"); e.handled = regex.ismatch(e.text); } private void integervalidationtextbox(object sender, textcompositioneventargs e) { regex regex = new regex("[^0-9]+"); e.handled = regex.ismatch(e.text); } the point 1 used integers, namely integervalidationtextbox works fine, , can type integer values. problem first 1 used

javascript - How to pass php switch case data through html form using ajax? -

action="cart.php?action=add&code=<?php echo $product_array[$key]["code"]; ?>" this form action i'm trying send data php code based on action switch cases present here "code" 1 of them. i'm not able figure out how send switch case data. you can way, if want on submit. $( "#form" ).submit(function( event ) { $.ajax({ method: "get", url: "cart.php", data: { action: "add", code: "<?php echo $product_array[$key]['code']; ?>" } }) .done(function( msg ) { alert( "product added: " + msg ); }); event.preventdefault(); });

android - How to download CPU/ABI sytsem images -

i know there several questions regarding subject online none of solutions provided in questions have worked me. trying create avd in order emulate ionic project can't create avd because there no cpu/abi system images available target , target chose 1 available ( android 7.1.1 -api level 25 ). how fix , way os i'm running ubuntu. links have visited are: android 4.3 virtual device cpu/abi - no system images installed (eclipse) creating new avd- cpu/abi field show 'no system images installed' https://teamtreehouse.com/community/create-new-avd-cpuabi-no-system-images-installed-for-this-target https://teamtreehouse.com/community/no-cpuabi-system-image-available-for-this-target

java - Getting 403 errror while accessing apache restful services from mobile -

i getting 403 error post request when restful services deployed on tomcat server accessed mobile device, desktop getting proper response, below error in access logs "post /myservice/check http/1.1" 403 20 "-" "mozilla/5.0 (iphone; cpu iphone os 9_1 mac os x) applewebkit/601.1.46 (khtml, gecko) version/9.0 mobile/13b143 safari/601.1" please let me know reason this regards pallavi

c++ - Recursive instantiation of a template with a typename? -

for templated function takes integer, wrote following general-purpose dispatcher: #define dispatch_template(funct_name, max) \ template<int i> decltype(&funct_name<0>) dispatch_template_##funct_name (int index) { \ return (index == i) ? funct_name <i> : dispatch_template_##funct_name <i - 1>(index); \ } \ template<> decltype(&funct_name<0>) dispatch_template_##funct_name <-1>(int) { \ return nullptr; \ } \ decltype(&funct_name<0>) dispatch_##funct_name (int i) { \ return dispatch_template_##funct_name <max>(i); \ } \ this works , can this: template<int

reactjs - React-Router issues when serving React App with Spring Boot -

i'm needing serve react app spring boot. working root url - localhost:8080/ , of course none of sub-routes recognized spring controller. i'm not sure how react routing , spring request mapping line without hard-coding in every possible route map index.html - , of routes have variable sub-routes. here homecontroller serves index.html @controller public class homecontroller { @requestmapping(value = "/") public string index() { return "index.html"; } } here routing render in react app const root = ({ store }) => ( <provider store={store}> <router history={browserhistory}> <route path="/" component={app}> <indexredirect to="users"/> <route path="/org" component={orgsearch}> {<route path="/org/:orgid" component={org}/>} </route> <route path="/users" component={usersearch}&

ios - Programmatically adding UIImage into collection view cell -

this custom class collection view cell: import uikit class navbarcell: uicollectionviewcell { var avatarimageview: uiimageview = { var avatarview = uiimageview() avatarview.contentmode = .scaleaspectfit return avatarview }() override init(frame: cgrect) { super.init(frame: frame) avatarimageview = uiimageview() contentview.addsubview(avatarimageview) } required init?(coder adecoder: nscoder) { fatalerror("init(coder:) has not been implemented") } } then in viewdidload of controller have let layout:uicollectionviewflowlayout = uicollectionviewflowlayout.init() navbarcollectionview.setcollectionviewlayout(layout, animated: true) navbarcollectionview.backgroundcolor = uicolor.clear navbarcollectionview.register(navbarcell.self, forcellwithreuseidentifier: "cell") navbarcollectionview.delegate = self navbarcollectionview.datasource = self layout.