Posts

Showing posts from January, 2015

Why is my Java program not working correctly? -

Image
this code working class. when run it hangs @ welcome message , go no further, wont let me type anything. i've asked instructor multiple times , giving advice corrections given still dont fix issue have. doing wrong? /* * file: foreverygame.java * author: darren pirtle * date: november 8, 2016 * purpose: provide amount of money customer can win per * nba game if betting x amount of money x amount of games */ // import statements import java.util.scanner; public class foreverygame { public static void main(string[] args) { //declare variables int numbergames = 0; int moneyamount = 0; //display welcome message system.out.println(" "); system.out.println("how money can win?!"); system.out.println(" "); //scanner class scanner scannerin = new scanner(system.in); //prompt user number of games during night while (numbergames > 15 || numbergames <= 0);

ajaxcontroltoolkit - How to set the range of ajax bar chart y-axis -

how can define range of values in y-axis in ajax tools bar chart.i need range of values in {0.01,0.020,0.03 upto 0.1} kindly tell me bar chart properties. in advance. sample of question here

javascript - Promises not catching error correctly NodeJS -

if remember correctly promises supposed catch error when 1 thrown @ times promise.catch() can used handle error. don't recall exceptions when throw error inside settimeout() somehow doesn't work. can explain why doesn't work? or bug in nodejs? test code // works! function async() { return new promise(function (resolve, reject) { throw new error('test'); }); } async().catch(function() { console.log('ok: 1'); }); // doesn't work.. function async_fail() { return new promise(function (resolve, reject) { settimeout(function() { throw new error('test'); }, 1); }); } async_fail().catch(function() { console.log('ok: 2'); }); you never catch error thrown in settimeout, because executes async actual execution of promise function. promise finished (without call resolve or reject) when function inside set tim

Android button onClick unknown event issue -

when pressing button in devices it's showing `e/sensors: proximitysensor: unknown event (type=1, code=330, value=1), , here given code. xml <button android:id="@+id/button_done" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:background="@drawable/button_clcik_efferct_blue_white_no_round" android:text="done" android:textcolor="@drawable/button_clcik_efferct_text_white_blue" android:textstyle="bold"/> java @bindview(r.id.button_done) button buttondone; @onclick(r.id.button_done) public void onclick(view view) { switch (view.getid()) { case r.id.button_done: try { preferencemanager.getinstance().setlocationname(localityname); } catch (exception e) { e.prin

ruby on rails - Unable to override a method in spree model -

i upgrading rails , spree rails 4.2 , spree 3.1 i had overriden purchase! method in payment model this how method in spree module spree class payment < spree::base module processing def purchase! started_processing! gateway_action(source, :purchase, :complete) end end end end this how overridden in rails 3.2 (and working till now) spree::payment::processing.class_eval def purchase! started_processing! if source.class == spree::purchaseorder gateway_action(source, :authorize, :pend) else gateway_action(source, :purchase, :complete) end end end but getting following error rails 4.2 , spree 3.1 /home/deepak/workspace/project/app/models/spree/payment/processing_decorator.rb:2:in `<module:spree>': superclass mismatch class payment (typeerror) /home/deepak/workspace/project/app/models/spree/payment/processing_decorator.rb:1:in `<top (required)>' /home/deepak/.rvm/gems/ruby-

Can I modify Hive partition location using java api? -

i developping system job consume data kafka , put hive.since table have partition "day" , , location of partition on hdfs /root/tablelocation/day=20161110/adfadfaaf.avro . but, location cannot meet requirement.i want change location /root/tablelocation/20161110/adfadfaaf.avro . the api using apache hive metastore.demo code when create table this: table table = new table(database, tablename); table.settabletype(tabletype.external_table); table.getparameters().put("external", "true"); string tablepath = fileutils.hivedirectoryname(url, topicsdir, tablename); table.setdatalocation(new path(tablepath)); table.setserializationlib(avroserde); try { table.setinputformatclass(avroinputformat); table.setoutputformatclass(avrooutputformat); } catch (hiveexception e) { throw new hivemetastoreexception("cannot find input/output format:", e); } list<fieldschema> columns = hiveschemaconverter.convertschema(schema); table.setfields(col

c# - How to Convert a generic type list of data to another generic type list of data -

i trying write generic base service class after receiving fist generic list of data actual type of db model entity need conversion new generic view model type of data. i have tried list.convertall() getting build error convertall() method. i tried list.cast<tvm>().tolist() solve build error getting run time error. here code snips of classes , interfaces. or suggestion appreciated. entity class public abstract class entity { [key] [index("ix_id", 1, isunique = true)] public string id { get; set; } [datatype(datatype.datetime)] public datetime created { get; set; } public string createdby { get; set; } [datatype(datatype.datetime)] public datetime modified { get; set; } public string modifiedby { get; set; } [defaultvalue(true)] public bool active { get; set; } } baseviewmodel class public abstract class baseviewmodel<t> t: entity { protected baseviewmodel() { } protected base

mysql - convert string with time to date only -

i have column holds date values varchar in format of date_n date_s 2016-11-10::12:36:05 2016-nov-10::12:36:05 2016-11-10 2016-nov-10 now need date both of columns able column date_n along timestamp , nothing date_s query tried as select * table cast(date_n date)=curdate(); which returns both element result when change date_n date_s returns empty , need output date no time stamp so there way sort out hi try logic where trim(upper(substring_index(date_s,':',1))) = trim(concat(year(now()),' -',upper(substring((monthname(str_to_date(month(now()),'%m'))),1,3)),'-',day(now())))

javascript - how to append a new hyperlink with a new id each time in a loop? -

it's second day on project :\ i'm trying create : creating new <a> element new href , id attributes in for loop can each output of api link. this js code var one; var two; var hoba; $(document).ready(function() { $("#inp").keyup(function() { hoba = $(this).val(); }); $("#but").on("click", function() { var app = "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=revisions&list=search&titles=main+page&rvprop=content&origin=*&srsearch=" + hoba; $.getjson(app, function(data) { (i = 0; < data.query.search.length; i++) { console.log(app); 1 = $("<a></a>").text(data.query.search[i].title); //var _href = $("a").attr("href"); $("a").attr("href", 'https://www.wikipedia.org/wiki/' + data.query.search[i].title); $("a").attr("id",

algorithm - Mysterious number 6174 [Kaprekar Theorem] in Java -

in 1949 mathematician d. r. kaprekar, devised process known kaprekar's operation. first choose 4 digit number digits not same (that not 1111, 2222,...). rearrange digits largest , smallest numbers these digits can make. finally, subtract smallest number largest new number, , carry on repeating operation each new number. let's try out, starting number 2005, digits of last year. maximum number can make these digits 5200, , minimum 0025 or 25 (if 1 or more of digits zero, embed these in left hand side of minimum number) 5200 - 0025 = 5175 7551 - 1557 = 5994 9954 - 4599 = 5355 5553 - 3555 = 1998 9981 - 1899 = 8082 8820 - 0288 = 8532 8532 - 2358 = 6174 now objective verify theorem & find number of iteration take reach 6174. can give better algorithm? here code. public int verifykaprekartheorem(int m) { if (m <= 1000 || m > 9999) { return -1; } string orginal = string.valueof(m); int count = 0; while (true) {

How to load css on UIWebview in tvOS app built using swift(SpriteKit)? -

i creating tvos app using spritekit , unable load css on uiwebview . let html including css - let myhtml = "<html>"+"<head>"+"<style type=\"text/css\">"+"@font-face{font-family: myfirstfontb;src: url('\(fontpath)')}"+"</style>"+"<link rel='stylesheet' type='text/css' href='styleipad.css' /></head>"+"<body>"+"<div class='page'>\(value)</div>"+"</body>"+"</html>" here styleipad.css located in project. now can load html string uiwebview - webview?.loadhtmlstring(myhtml, baseurl: bundle.main.bundleurl) please give bundle url, else css not load.

java - Jenkins vs SonarQube : Run with specific JDK -

i have project built , compiled jdk 1.7 , sonarqube 6.0 runs jdk 1.8. on jenkins dashboard, set goal: :org.codehaus.mojo:sonar-maven-plugin:latest:sonar , on wrapper.conf on sonarqube folder, changed wrapper.java.command=c:\program files\java\jdk1.8.0_91\bin\java , jenkins jdk set 1.7....but sonar doesn't work jdk 1.8. please give me advise. i had similar problem. the solution set jdk8 used in job-configuration in jenkins , set jdk7 used compilation of sources, test-sources , surefire plugin. something this: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.5.1</version> <configuration> <source>1.5</source> <target>1.5</target> <testsource>1.7</testsource> <testtarget>1.7</testtarget>

ios - Swift conditional compilation access control -

i building ios framework , need same framework used in public apps , in internal apps , difference in internal apps need access classes , function want hide public apps , don't want copy paste code framework internal apps ... is possible use conditional compilation (or other solution without duplicating code ) : #if someflag public #else internal #endif class someclass{ // public when someflag otherwise internal } of course code above not working pseudo code need ( doesn't have macros) . thanks.

How to dynamically create Web APIs (REST apis) in selfhosted owin server? -

i'm looking way dynamically generate web apis , add them @ runtime (after selfhosted server has been initialized). basically idea to: 1. create selfhost owin server serving static/already defined controllers (web apis) -> part ok at later time, want dynamically generate new controller , add somehow server client can send request it. -> there way that? know can dynamically build controller , add server before initialized serves existing web apis (using customassemblyresolver). now existing controller may need updated. re-generate existing controller , update server use new definition (maybe parameter change, name of apis changed, etc.) way that? can recycle controller without stopping controllers? if somehow can supported, mean service not available time (until update done). ideally work web service hosted in iis. if web service definition change between 2 requests. 1st request go old definition , 2nd request transparently directed new definition. there no interrup

java - Set default encoding for Undertow embedded -

i'm using undertow embedded http server in app. default encoding iso-8859-1 url encoding , query parameters. want use utf-8 . did not find in documentation. idea? i setup defaultencoding on deploynentinfo . helped me. deploymentinfo servletbuilder = servlets .deployment() .setclassloader(main.class.getclassloader()) .setdeploymentname("myapp").setcontextpath("/myapp") .setdefaultencoding("utf-8"); deploymentmanager manager = servlets.defaultcontainer().adddeployment(servletbuilder); manager.deploy(); undertow server = undertow.builder() .addhttplistener(9090, "localhost") .sethandler(manager.start()) .build(); server.start(); for current version of undertow default encoding utf-8. non-deploy mode, can use options change default encoding: undertow.builder() .sethandler(...) .setserveroption(undertowoptions.url_charset, "utf8") .addhttplistene

scope - Local variables in Python nested functions -

okay, bear me on this, know it's going horribly convoluted, please me understand what's happening. from functools import partial class cage(object): def __init__(self, animal): self.animal = animal def gotimes(do_the_petting): do_the_petting() def get_petters(): animal in ['cow', 'dog', 'cat']: cage = cage(animal) def pet_function(): print "mary pets " + cage.animal + "." yield (animal, partial(gotimes, pet_function)) funs = list(get_petters()) name, f in funs: print name + ":", f() gives: cow: mary pets cat. dog: mary pets cat. cat: mary pets cat. so basically, why not getting 3 different animals? isn't cage 'packaged' local scope of nested function? if not, how call nested function local variables? i know running these kind of problems means 1 'doing wrong', i'd understand happens. the nested function loo

Count Unique with multiple conditions in Excel -

first post, help. i'm trying write formula gives count of unique matches within range based on 4 criteria i've searched , found similar answers steered me towards formula involved sumproduct , frequency, haven't been able write correct formula. i have table of records of managers assigned employee recorded on year , quarter. employee can have more 1 manager within quarter, , same manager can asssigned more once within quarter. manager recorded in status column exit, new or change. i have flag column in wish @ eahc row , calculate value based on these criteria row a. if status = exit, flag = 0 b. if status = change or new, , 1 manager employee name in same q , y, flag = 0 c. if status = change or new, , more 1 manager employee name in same q , y, flag = count of unique manager names employee same q , y. [note - it's not count of manager names, rather unique names.] my if calculation can handle a. , b., it's c. failing on. i've attache

reactjs - ReactNative: undefined is not an object (this.state.listAccounts) -

class widgets extends component { constructor(props){ super(props); this.state = { accesstoken: "", listaccounts:[], } } componentwillmount(){ this.setstate({listaccounts: this.loadaccountsdata()}) } loadaccountsdata(){ //return data server } render() { return ( <content> {this.state.listaccounts.map( (account) => <account accountdata={account} />)} </content> ) } } above blue print of code. unabele access state in render? error: undefined not object (evaluating 'this.state.listaccounts.map') you setting state on async request. need wait till response comes set state. class widgets extends component { constructor(props){ super(props); this.state = { accesstoken: "", listaccounts:[], } } componentwill

ssis - Developer sandboxes for Oracle database -

we developing large data migration oracle db (12c) system ssis. developers using production copy database problem that, due complexity of data transformation, have things in stages preprocessing data intermediate helper tables used further downstream. problem developers using same database , screw each other running things simultaneously. oracle db offer in terms of developer sandboxing? build mechanism handle (e.g. have dev id in helper tables, query views map dev), i'd rather use built-in functionality. use oracle multitenant this? we ended producing master subset database of select schemas/tables through elaborate pl/sql, made several copies of master schema each dev has his/her own sandbox (as alex suggested). have used oracle data masking , subsetting it's expensive. option creating subset database wouldn have been use jailer . should note didn't have need mask sensitive data. note. think common problem if new tools , solutions arise, please post them

angular2 routing - Using a base guard for all routes in Angular 2 application -

is there way set "base" canactivate when configuring routes in angular2? routes covered same base check, , each route can have more granular check. i have appmodule routing this: @ngmodule({ imports: [ routermodule.forroot([ { path: '', component: homecomponent, canactivate: [authenticationguardservice], data: { roles: [roles.user] } } ]) ], exports: [ routermodule ] }) export class approutingmodule { } and feature module featuremodule : @ngmodule({ imports: [ routermodule.forchild([ { path: "feature", component: featurecomponent, // i'd avoid having this: canactivate: [authenticationguardservice], data: { roles: [roles.user] } } ]) ], exports: [ routermodule ] }) export c

sqlite3 - Django 1.9 - created new app run migrate, tables are not created -

ive added new app , created models. have run makemigrations , migrate , went successfully. when open sqlite table, none of tables created. sample models: from __future__ import unicode_literals django.db import models django.conf import settings import string import random import time import os # create models here. service.models import servicecontacts class subnets(models.model): subnet = models.genericipaddressfield(protocol='ipv4',verbose_name="subnet",blank=true,null=true) subnet_mask = models.charfield(max_length=4,verbose_name="subnet mask",choices=settings.subnet_mask_choices,blank=true) subnet_type = models.charfield(max_length=10 ,verbose_name='subnet type',choices=settings.subnet_type_choices,blank=true) class meta: verbose_name = "site subnet data" verbose_name_plural = "site subnet data" class sitecontacts(models.model): name = models.charfield(max_length=200) title

node.js - Linux Server vs Local NodeJS versions -

hi there fellow stackoverflow-ers, just quick question hopefully. why latest nodejs version windows/mac etc v6.9.1 on google compute engine vm instance latest version v0.10.48 (after running sudo apt-get install nodejs) why different? default version comes vm , running above command installs local install file? cheers ahh, nevermind - should learn more linux servers. starting here: https://itsfoss.com/apt-get-linux-guide/

linux - Bash command assigned to variable stays empty -

i have few commands following each other after xargs . funnily enough command works fine if echo out stdout . when try assign variable, variable stays empty. see below: $~ ./somescript | grep -f fc.samples | xargs -i {} sh -c "echo {} | tr '/' '\t' | cut -f9;" sample1 sample2 sample3 sample4 sample5 sample6 sample7 sample8 $~ trying assign variable , echo results in empty lines: $~ ./somescript | grep -f fc.samples | xargs -i {} sh -c "sample=$(echo {} | tr '/' '\t' | cut -f9); echo $sample; " $~ i have tried multiple variations of , cannot figure out getting wrong. can spot problem? thanks! you need escape $ chars sh -c command, otherwise $( ) , $sample part handled current shell rather sh -c . ... | xargs -i {} sh -c "sample=\$(echo {} | tr '/' '\t' | cut -f9); echo \$sample; " or can consider using single quotes outer quoting. ... | xargs -i {} sh -c 'sample=$(

C# Task - Linked cancellation token not working -

please if me. i'm trying use tpl linked cancellation tokens. issue after cancellation of main cancellationtokensource, value of linked token's property iscancellationrequested still "false". i'm starting 2 tasks, sure - should same thing. first pass cancellationtoken, , second pass cancellationtokensource. behaviour same: in while loops - condition linkedtoken.iscancellationrequested stays "false" after cancellation. here code using: public class manager { private task tokentask; private task sourcetask; private cancellationtokensource maincancelationtokensource; private cancellationtoken maintoken; public manager() { this.maincancelationtokensource = new cancellationtokensource(); this.maintoken = maincancelationtokensource.token; this.maintoken.register(maincanceled); } public void start() { workers w = new workers(); tokentask = task.run(() => w.doworktoken(mai

php - Need Mysql Query for Search Bus from stop and To Stop -

i create table buses , route , stop tables buses table id , bus_name 1 aaa 2 bbb stop table id, stop_name, latitude, longitude 1 xyz 12.5555 77.222 2 sss 13.5555 77.2888 3 eee 88.444 77.222 4 c 34.8859309 -97.47070 5 jjj 32.9902355 -97.99804 route table id, bus_id, stop_id, arrival_time, departure_time, start_end_stop 1 1 1 0000 8.00am start 2 1 2 8.10am 8.10am 3 1 3 8.15am 8.16am 4 1 4 8.20am 8.20am 5 1 5 8.25am 0000 end 6 2 1 0000 8.10am start 7 2 3 8.15am 8.18am 8 2 5 8.27am 0000 end now search stop xyz jjj i want result is bus_name from_stop_name departure_time to_stop_name arrival

php - Laravel - How to return json error message on error? -

i added x-editable current laravel project. works have problem returning error message . when controller able save request, 'success!' json message. that's fine. when have error, not 'error!' message. can see fire error message when $article->save() not successful. what doing wrong? controller: $article->$input['name'] = $input['value']; if( $article->save() ){ // works return response()->json(array('status'=>'success', 'msg'=>'success!.'), 200); } else{ // not work return response()->json(array('status'=>'error', 'msg'=>'error!'), 500); } javascript in view: $(".xeditable").editable({ success: function(response) { console.log(response.msg); }, error: function(response) { // console says, response.msg undefinded console.log(response.msg); } }); kind regards. i'm

php - Laravel routing: how to prepend optional parameter in uri? -

realising api rest service i'm facing problem of how/where in url signature pass api version. by reading around decided pass version like http://mydomainservice.tld/api/version/entity ... about treat version optional , parse request referring latest api version, intention: http://mydomainservice.tld/version/entity ... the question not how manage/arrange versioning in api rest more if there's chance realise routing rule prepend optional parameter in uri: this working: route::group(['prefix' => 'api/'], function(){ route::get('{v}/subscribers', 'apirequestcontroller@show'); route::get('subscribers', 'apirequestcontroller@show); }); for both calls like: http://mydomain.tld/api/subscribers http://mydomain.tld/api/1/subscribers but i'd solve in single rule: route::get('{v?}/subscribers', 'apirequestcontroller@show'); but second rule won't work if try reach out request like: http

jquery - Auto Select From Dropdown If Only Two Options -

i got 2 select dropdowns have 2 options each the "please select" , "true option". in case want auto select "true option". value of "true option" won't same "please select" value empty need select 1 not empty value. if ($('.product-options .inputbox').size() == 2) { $('.product-options .inputbox').not(.val('')).attr('selected', true); } <div class="product-options"> <div id="option-98" class="options_class"> <div> <strong>size:</strong> <select id="options98" class="inputbox" name="options[98]" onchange="updateprice();"> <option value="" selected="selected">--- please select ---</option> <option value="99">small</option> </select> </div> </div> <di

android - addView to layout with java -

i trying understand how add views programatically (with java) in android applications. created simple layout (below) practice struggle solve following error: java.lang.illegalstateexception: not find method addingview() in parent or ancestor context android:onclick attribute defined on view class android.support.v7.widget.appcompatbutton id 'button' screenshot app: my xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_m

objective c - multiple line UILabel is truncating -

i want display status on uilabel. want wraparound @ word breaks if it's long, , want font size shrink if not enough room in uilabel. uilabel created in storyboard, , lines = 2, , autoshrink minimum font scale 0.5 but can't make happen. text keeps truncating. i got working: in storyboard: 1. stretched uilabel vertically bigger 2. lines=0 3. line break = word wrap 4. autoshurink = fixed font size

constants - OpenCL - The difference between Buffer and global memory -

in opencl, buffers conduit through data communicated host application. cl_mem clcreatebuffer (cl_context context, cl_mem_flags flags, size_t size, void *host_ptr, cl_int *errcode_ret); now if have buffer a_buffer flaged read_only , , kernel is: __kernel void two_buffer_double(__global float* a) { int = get_global_id(0); float b = a[i] * 2; } my question that: a_buffer global memory or constant memory? should use __constant qualifier a . connection between cl_mem_flags( read_only , read_write ) , memory qualifier( global , constant )? __constant qualifier used constant memory , cards in texture cache , independent bandwidth __global limited in size. __global __read_only * float means, opencl implementation try put in cache(or use other data path) if hardware sees fit __global limited vram size or fraction instead of 64kb(for example) __constant. these qualifiers device-side optimization. at host-side optimization, should

angularjs - How to popup json data in Angular? -

"devices": [ { "sub_family": "6s plus", "presales_description": "iphone 6 plus features stunning 5.5-inch retina hd display, amazing cameras , many advanced features, in breakthrough design. 5.5-inch retina hd display. a8 chip 64-bit desktop-class architecture. 8mp isight camera focus pixels , optical image stabilisation. touch id. fast 4g lte , wi-fi.1 long battery life.2 , ios 9 , icloud.", "camera": true, "device_type": "smartphone", "presales_vendor": "apple", "sim_form-factor": "nano", "memory": 64, "device_class": "hc14", "tv capable": true, "family": "iphone", "specification_reference": "d20", "variants": [ { "colour": "space grey", "defaul

javascript - How can I display a variable content in HTML? -

it's 9th day of learning how code! #excitement let's have title <h1 id="title">test </h1> and have variable <script type="text/javascript"> var content=$("#title).html(); </script> how var content displayed in let's new paragraph? trying this: <p id="test"> <p> <script type="text/javascript"> $("#test").html(content); </script> thanks! ps: i've seen things using "element.innerhtml", didn't seem fit problem, or didn't it. question asker didn't provide example. simple way can this, see below code $(document).ready(function(){ $("#test").text($(".title").html()); }); <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> <h1 class="title">test </h1> <p id="test"> <p>

sabre - Amtrak Manage Ticket Error Code 189: 491DENIED -

i trying manage ticketing of amtrak booking using railmanageticketrq v1.13 keep seeing same error code returned. i've been able issue tickets using same credit card without problems attempt make results in error. code : 189 value : 491denied any decoding error gratefully received.

mysql - Query takes too long to run -

i running below query retrive unique latest result based on date field within same table. query takes time when table growing. suggestion improve welcome. select t2.* ( select ( select id ctc_pre_assets ti ti.ctcassettag = t1.ctcassettag order ti.createddate desc limit 1 ) lid ( select distinct ctcassettag ctc_pre_assets ) t1 ) ro, ctc_pre_assets t2 t2.id = ro.lid order id our able may contain same row multiple times, each row different time stamp. object based on single column example assettag want retrieve single row each assettag latest timestamp. it's simpler, , faster, find newest date each ctcassettag , join find whole row matches. this assume no ctcassettag

javascript - angular 2: attaching string with property binding -

i'm trying attach string propery binding for example object is { "name": "the walking dead", "imageurl": "/title/tt1520211/?pf_rd_m=a2fgeluunoqjnl&pf_rd_p=2240084122&pf_rd_r=1q5zrdhsa2zk5s6q31wn&pf_rd_s=center-1&pf_rd_t=15506&pf_rd_i=tvmeter&ref_=chttvm_tt_1", "rating": "8.6" }, as dont have base url in imageurl field want attach in angular template url template: <tbody *ngfor="let prod of products"> <tr > <td><img [src]="'www.example.com/'+{{prod.imgurl}}" alt=""></td> <td>{{prod.name}}</td> <td>{{prod.rating}}</td> </tr> </tbody> i'm trying add example.com imageurl in template field , i'm unable add base url im expecting url baseurl+path www.example.com/title/tt1520211/?pf_rd_m=a2fgeluunoqjnl&pf_rd_p=2240084122&pf_rd_r=1q5zrdhsa2zk5s6q31wn&pf_

Multipart Image Alamofire 4 swift 3 -

i've big problem when try update image db. i must upload image, , string value. func imagepickercontroller(_ picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : any]) { if let selectedimage = info[uiimagepickercontrolleroriginalimage] as? uiimage { imagecropped = selectedimage self.sendimagewithmultipart() imagepicker.dismiss(animated: true, completion: { _ in }) } } func sendimagewithmultipart() { alamofire.upload(multipartformdata: { multipartformdata in multipartformdata.append("\(hgygjihf746fg743g)".data(using: string.encoding.utf8, allowlossyconversion: false)!, withname :"auth_token") multipartformdata.append("\(0)".data(using: string.encoding.utf8, allowlossyconversion: false)!, withname :"os") multipartformdata.append("\(10.0.3)".data(using: string.encoding.utf8, allowlos

html - jquery remove nodes and keep children -

i ashamed post question have not managed use of unwrap or replacewith methods in jquery need. my problem simple : need remove nodes (jquery selectors) of html code without losing children of these nodes. here jsfiddle demonstrate result of unsightly code used reach goal https://jsfiddle.net/uddaeh1u/15/ (yes it's works...) // var content : html source code of wysiwyg var result = ''; $(content).contents().each(function(){ var addcontent = ''; // textnode if(this.nodetype == 3) { // text node result+= $(this).text(); } else if(this.nodetype == 1 && $(this).hasclass('atwho-inserted')) { // if object node target class // keep it's contents (means ".atwho-inserted" not kept) result+= $(this).html(); } else { // in other case keep entirely result+= this.outerhtml; } }); could find me better code (with unwrap method) ? thank lot :) i think

What are the differences between asp.net, asp.net mvc and asp.net core -

i know difference between asp.net (webforms) , asp.net mvc seems new technology called asp.net core coming out. know if new concept or if mean kernel of asp.net, common asp.net , asp.net mvc ? thanks asp.net has been rewritten scratch modular, cloud ready, , more performing. there .net core, asp.net core , frameworks entityframework core. it same technology, same concept, same classes, core different few differences can migrated easily. asp.net core can run on windows, linux , mac

android - Bluetooth is not reading every characteristic -

i've got problem bluetooth in app. i've got lots of characteristics , can read 2. when try read more i'm not getting callback. read should create queue don't know how it. help, please ? here's characteristics : private void registerparameterscharacteristics(list<bluetoothgattcharacteristic> characteristics) { (bluetoothgattcharacteristic characteristic : characteristics) { uuid characteristicuuid = characteristic.getuuid(); if (characteristics.eon_params_eddystone_uid_char.equals(characteristicuuid)) { euidcharacteristic = characteristic; log.e(tag, "registerparameterscharacteristics: euid" ); } else if (characteristics.eon_params_eddystone_eid_char.equals(characteristicuuid)) { eeidcharacteristic = characteristic;} else if (characteristics.eon_params_eddystone_url_char.equals(characteristicuuid)) { eurlcharacte

Android : How to detect the image orientation (portrait or landscape) picked from gallery while setting on an imageview? -

Image
i setting image on imageview picked gallery(camera album). if picked image has landscape orientation, displays if image in in portrait mode(i.e image clicked in portrait mode) displaying image 90 degree rotation. trying find out orientation before setting on imageview, images giving same orientation , same width-height. here code : uri selectedimage = intent.getdata(); if (selectedimage != null) { bitmap bitmap = mediastore.images.media.getbitmap(this.getcontentresolver(), selectedimage); int str = new exifinterface(selectedimage.getpath()).getattributeint("orientation", 1000); toast.maketext(this, "value:" + str, toast.length_long).show(); toast.maketext(this, "width:" + bitmap.getwidth() + "height:" + bitmap.getheight(), toast.length_long).show(); use exifinterface rotate image. use method correct value rotate captured image camera. public int getcameraphotoorientation(context context, uri imageuri, stri

google api - how to turn off oauth consent screen after allow permission? -

i have 2 questions in thread. i use google api authentication. after run code make credential, browser opens oauth consent screen in new tab (google chrome). how can show popup dialog, not open new tab anymore? after click accept button, api return text tell me token received in tab. how can turn off immediatelly? thank you! depends on language using. consent form web page assuming can create own popup window web browser feed consent uri. you cant authentication code returned authentication server web page going have open someplace.

collections - PriorityQueue source code initFromPriorityQueue why doing the type comparison -

i reading source code of priorityqueue, in private method initfrompriorityqueue, compared type of c priorityqueue.class, don't understand, how can not same since priorityqueue concrete class without subclass? private void initfrompriorityqueue(priorityqueue<? extends e> c) { if (c.getclass() == priorityqueue.class) { this.queue = c.toarray(); this.size = c.size(); } else { initfromcollection(c); } }

java - How to parse body of Content-type: application/vnd.contentful.management.v1+json -

i trying parse request body where content-type: application/vnd.contentful.management.v1+json when give content-type: application/json it works fine contentful cms passes above content-type have parse somehow. seems using contentful java sdk right ? that header filled sdk, there reason need parse header ?

regex - Rewrite URL on .htaccess -

i have urls www.example.com/de/something , need redirect www.example.com starts /de/ . at moment have done this redirect 301 /de http://example.com and redirect links removing /de part , result www.example.com/something . how fix this? thanks redirect directive matchs rest of uri , appends target, can use redirectmatch redirect specific uri redirectmatch 301 ^/de/? http://example.com

LINQ - Buidling a search query -

i building search query customer search function: have these fields passing function , wonder best way build linq expression. of fields maybe empty string , search should using "contains" instead of searching exact field string public list<customer> searchcustomer( string membershipid, string prefername, string firstname, string lastname, string nric, string phonenumber, string email, datetime dob, string gender, string address, boolean vip, bool isdeleted) you can manage multiple filter parameters in following way: var result = customercollection. .where(c => membershipid != null ? c.membershipid.contains(membershipid) : true) .where(c => prefername != null ? c.prefername.contains(membershipid) : true) ... .tolist(); i hope idea

Cron Jobs Run At Same Time -

in cron job file have 2 cronjobs defined: #yo1 mailto="example@domain.com" *1****wget -o - -q "http://example.com/cron/test1.php">/dev/null 2>&1 #yo1 mailto="example@domain.com" *15****wget -o - -q "http://example.com/cron/test2.php">/dev/null 2>&1 the php files simple sending mails different subjects. the issue both cronjobs running on same time every minute, can see want them run on different times. first - every minute, second - every 15 minutes. can me this. can't figure out whats wrong. your syntax incorrect. please use following code #every minute * * * * * wget -o - -q "http://example.com/cron/test1.php">/dev/null 2>&1 #every 15 minutes */15 * * * * wget -o - -q "http://example.com/cron/test2.php">/dev/null 2>&1 you can use online crontab generators http://www.crontab-generator.org/

vba - Copying multiple ranges from excel to word and controlling linespacing -

i manage copy range excel newly opened word document , control line spacing (thanks copy range excel word - set paragraph spacing zero ). however, not manage control linespacing when copy multiple ranges multiple bookmarks in opened , existing word file (document.docx). code can found below @ end of post. this code works excel file multiple sheets. 1 sheet configuration sheet. contains name of excel sheet containing table (in range "name") , links bookmark name in word (in range bookmarkexcel")". i suppose problem piece of code: set wdtable = mydoc.tables(mydoc.tables.count) wdtable.range.paragraphformat.spaceafter = 0 i tried sorts of variations (e.g. replacing mydoc.tables.count rep, 1, ...) didn't manage control linespacing. did wrong? edit: i found cause : document contains tables (before , after ones copy , paste) causes code line spacing not work. thus, how can adapt code such works documents contain tables? sub exceltablestoword() dim t