Posts

Showing posts from April, 2013

What are iOS iPad launchpad image resolutions? -

this so post gives image resolutions , device types xcode launchpad image.xcassettes iphones. corresponding information ipads? google friend. apple has list device sizes here https://developer.apple.com/ios/human-interface-guidelines/graphics/launch-screen/ full table: uilaunchimages = { { --iphone 4 portait ["uilaunchimageminimumosversion"] = "7.0", ["uilaunchimagename"] = "default", ["uilaunchimageorientation"] = "portrait", ["uilaunchimagesize"] = "{320, 480}" }, { --iphone 4 landscapeleft ["uilaunchimageminimumosversion"] = "7.0", ["uilaunchimagename"] = "default", ["uilaunchimageorientation"] = "landscapeleft", ["uilaunchimagesize"] = "

android - How to refresh RecyclerView from button on DialogFragment -

i have application recyclerview , dialogfragment , in dialog add data database , display in recyclerview . tried refresh recyclerview when clicked in add. this fragment public class addaction extends dialogfragment implements view.onclicklistener { edittext addtitle, adddesc; button add, clear,close; context context; private databasehelpher db; string title,des; public addaction() { } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.addaction, container, false); addtitle = (edittext) rootview.findviewbyid(r.id.todotitle); adddesc = (edittext) rootview.findviewbyid(r.id.tododescription); add = (button) rootview.findviewbyid(r.id.addbutton); add.setonclicklistener(this); close = (button) rootview.findviewbyid(r.id.close); close.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { dis

swift - Custom variable setter with a default value -

i cannot create custom setter default value simple class. want implement custom tz setter timezone inspecting. what's wrong? public class city: nsobject { public var lat = 0.0, lon = 0.0, name = "" private static let def_tz = "gmt+00:00" private static let timezones = nstimezone.knowntimezonenames() public var tz: string = def_tz { set { //// <<<<< there error var = city.timezones.indexof(newvalue ?? city.def_tz) ?? 0 self.tz = timezones[i].name } { return self.tz } } // mark:- init required public init(name: string, lat: double, lon: double, tz: string) { super.init() setup(name, lat: lat, lon: lon, tz: tz) } private func setup(name: string, lat: double, lon: double, tz: string) { self.lat = lat self.lon = lon self.tz = tz == "" ? city.def_tz : tz self.name = name } } t

c++ - QT signal slot is not working -

i facing strange problem while trying execute following program main.cpp #include "sample.h" #include <qlist> #include <unistd.h> int main(int argc, char **argv) { a; a.calla(); while(1) sleep(1); return 0; } sample.cpp #include "sample.h" #include <qlist> #include <qmetamethod> #include <unistd.h> thread::thread(a *a) { } void thread::run() { int = 5; while (i){ qdebug()<< i; sleep(2); i--; } emit processingdone(">>> thread"); qdebug()<<"emited signal thread"; } void a::calla() { qdebug()<<"from calla"; //movetothread(thread); thread->start(); //thread->run(); //emit signala(">>> calla"); } void a::slota(qstring arg) { qdebug()<<"from sloata "<< arg; } sample.h class a; class thread : public qthread { q_object public: thread(a *a); ~threa

blockchain - Can we set a list of discovery nodes? -

when starting new node have indicate address of root node can connect , discover network. there way set list of nodes new node not depend on single peer? environment variable: - core_peer_discovery_rootnode=vp0:7051 q:is there way set list of nodes new node not depend on single peer? answer: new nodes doesn't depend on single peer , rootnode can peer. from fabric protocol spec , upon start up, peer runs discovery protocol if core_peer_discovery_rootnode specified. core_peer_discovery_rootnode ip address of peer on network (any peer) serves starting point discovering peers on network.

javascript - Datatable is not getting refreshed in angularjs -

i have bunch of data server call decided use datatable using angularjs. while implementing getting 10 records @ every pagination call. problem while clicking on next paging brings data , refelects datatable while clicking on previous paging brings data not refelected datatable. here chunk of angularjs code:- appice.controller('appuserscontroller', function ($scope,appiceservice, dtoptionsbuilder, dtcolumnbuilder, $q) { function init(){ $scope.getappusers(); } //$scope.dtinstance = {}; $scope.type = ''; $scope.getappusers = function(type){ $scope.type = type; $scope.dtoptions = dtoptionsbuilder.newoptions() .withfnserverdata(serverdata) .withoption('processing', true) .withoption('serverside', true) .withoption('searchdelay', 350) .withpaginationtype('full_numbers') .withdisplaylength(10); $scope.dtcolumn

angularjs - Sending a Post request in Angular 1.x via factory -

the post request url should updated in following format. https://www.example.com/api/one-push?type=json&query=push&title=____&url=____&tag=___ <form ng-submit="submiturl()"> <input type="text" class="form-control block" ng-model="url.title" placeholder="title"> <input type="text" class="form-control block" ng-model="url.urlstring" placeholder="url"> <input type="text" class="form-control block" ng-model="url.tag" placeholder="tag"> <button>add</button> </form> var app = angular.module('app', []) .controller('searchcontroller', ['$scope', '$http','searchservice', function($scope, $http,searchservice) { $scope.submiturl = function() { $scope.url = {}; searchservice.updateurl($scope.url).success(function(data) { $scope.url = data;

android - Navigate to main fragment from viewpager -

i have created navigation drawer in mainactvity , main fragment. want navigate viewpager mainfragment clicking on gridview. here code of gridview: android.support.v4.app.fragment fv; case 4: fv=new events(); android.support.v4.app.fragmenttransactio fts=getfragmentmanager().begintransaction(); fts.replace(r.id.fragment_container,fv,"visible_fragment"); fts.addtobackstack(null); fts.commit(); break; my events.java viewpager fragment android.support.v4.app.fragment. and viewpager cannot navigate mainfragment, when click main fragment whole content display inside viewpager. have implemented onbackpressed in mainactivity follow: @override public void onbackpressed() { if(getfragmentmanager().getbackstackentrycount() != 0) { getfragmentmanager()

java - Dynamic dispatch, overloading and generics -

using class: public class fallible<t> { private final exception exception; private final t value; public fallible(final t value) { this.value = value; this.exception = null; } public fallible(final exception exception) { this.value = null; this.exception = exception; } } can safely assume value never contain exception object? no, can't make such assumption. example: object obj = new exception(); fallible f = new fallible(obj); would invoke generic constructor. the way check check type of value explicitly using instanceof : public fallible(final t value) { if (value instanceof exception) { this.exception = (exception) value; this.value = null; } else { this.value = value; this.exception = null; } }

sql server - getting Incorrect syntax near ',' error -

i mistake here can't see what? idea? declare @out nvarchar(50); exec dbo.cbt_registration_createuseraccount (select newid()), (select convert(varchar(255), newid())), (select convert(varchar(255), newid())), (select convert(varchar(255), newid())), (select convert(uniqueidentifier,'270b5adc-873f-4b69-8e70-1954228aa16e')), (select convert(varchar(255), newid())), (select convert(uniqueidentifier,'37781810-3a49-4ce0-922d-54543b0bacde')), (select convert(varchar(255), newid())), 'gbp',(select convert(uniqueidentifier,'4ee4f84d-24ad-4e0d-a3b8-d9a5d1949d46')), @out out select @out msg 102, level 15, state 1, line 3 incorrect syntax near ','. msg 102, level 15, state 1, line 3 incorrect syntax near ','. msg 102, level 15, state 1, line 3 incorrect syntax near ','. msg 102, level 15, state 1, line 3 incorrect syntax near ','. msg 102, level 15, state 1, line 4 incorrect syntax near ','. msg 102,

Database relation one to one based on type -

i have following tables: user : id, typeid .. type: id, name .. based on type user has between 1 3 values. example user 1 typ b, , type b has 3 values. type have 2 values. create different value-tables valuesa: id, min-value, max-value, userid valuesb: id, value1, value2, value3, userid ... and use userid foreign key, , decide table should use based on type. or create 1 value-table value-fields , leave empty fields in rows, , add valueid users table? or better way this? the better way normalize value rows. value ----- user id type id sequence value the primary key table (user id, type id, sequence). sequence column makes primary key unique. type a, sequence 1 , 2. type b, sequence 1, 2, , 3. this design allows flexibility have 0 values, 5 values, or 150 values given user , type.

highcharts - setting one array for X axis (in time, each day) and for series only set Y points -

how can set 1 time x axis points array in utc datetime. (even better if there startpoint:datefrom , endpoint:dateend for each day) then in series put y points each charttype ? is possible ? because series object have data : let data = [{ "name": "< 100 mb", "type": "column", "data": [ [date.utc(2013, 7, 1), 2], [date.utc(2013, 7, 2), 3], [date.utc(2013, 7, 3), 3], [date.utc(2013, 7, 4), 2], [date.utc(2013, 7, 5), 1] ] }, { "name": "< 10 mb", "type": "column", "data": [ [date.utc(2013, 7, 1), 3], [date.utc(2013, 7, 2), 3], [date.utc(2013, 7, 3), 2], [date.utc(2013, 7, 4), 4], [date.utc(2013, 7, 5), 10] ]

java - How to remove duplicate lines from a text file -

am new java! want remove duplicate lines file ,but i need keep lines more number of capital letters which function can use achieve this if text file contains following words input car car bus bus bike expected output car bus bike try this. static class str { final string origin; final int uppers; str(string origin) { this.origin = origin; this.uppers = (int)origin.chars() .filter(character::isuppercase) .count(); } } public static list<string> uniq(string file) throws ioexception { path path = paths.get(file); list<string> lines = files.readalllines(path); map<string, str> map = new linkedhashmap<>(); (string e : lines) { str n = new str(e); map.compute(e.tolowercase(), (k, v) -> v == null || n.uppers > v.uppers ? n : v); } return map.values().stream() .map(s -> s.origin) .collect(collector

python - Closing a connection with a `with` statement -

i want have class represents imap connection , use with statement follows: class imapconnection: def __enter__(self): connection = imaplib.imap4_ssl(imap_host) try: connection.login(mail_username, mail_pass) except imaplib.imap4.error: log.error('failed log in') return connection def __exit__(self, type, value, traceback): self.close() imapconnection() c: rv, data = c.list() print(rv, data) naturally fails since imapconnections has no attribute close . how can store connection , pass __exit__ function when with statement finished? you need store connection in object attributes. this: class imapconnection: def __enter__(self): self.connection = imaplib.imap4_ssl(imap_host) try: self.connection.login(mail_username, mail_pass) except imaplib.imap4.error: log.error('failed log in') return self.connection

javascript - date in Jqgrid shows 1 day off. -

in application using jqgrid.in jqgrid having start date , close date .when executing application on same matching jqgrid start date , close date shows correct dates.but after hosting project on server , see application @ client side shows previous date in jqgrid. actually not understand why should happen. if having suggestion on please give suggestion on that. when there miss match in server , client machine time zone issue occur .when setting same time zone in server , client machine date displaying in grid correct.

c# - Find element in a list that is contained in another class sub-list -

can me more performance , more readable code piece of code? var prd = new list<prodotti>(); foreach (var prodotto in db.prodotti) foreach (var prdid in prdidx) if (prdid._idprodotto == prodotto.idprodotto) foreach (var prodottoseriali in prodotto.allserialnumbers) if (prdid.serialnumber == prodottoseriali) if (prdid.serialnumber == prodottoseriali) if (prd.count(c => c.idprodotto == prdid._idprodotto) == 1) prd.single(c => c.idprodotto == prdid._idprodotto).serialnumbers.add(prdid.serialnumber); else { var tmpprd = new prodotti() { idprodotto = prodotto.idprodotto,

java - Spring Security intercept URL not working with custom UserDetails object -

i'm new spring security please please patient. open suggestions make question more specific if guide me. my problem have intercept-url configuration in spring security redirecting access denied page when user has requisite role. spring security config: <?xml version="1.0" encoding="utf-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.1.xsd"> <!-- enable use-expressions --> <http auto-config="true" use-expressions="true"> <intercept-url pattern="/admin/**&qu

python - Inserting one item on a matrix -

how insert single element array on numpy. know how insert entire column or row using insert , axis parameter. how insert/expand one. for example, have array: 1 1 1 1 1 1 1 1 1 how insert 0 (on same row), on (1, 1) location, say: 1 1 1 1 0 1 1 1 1 1 is doable? if so, how do opposite (on same column), say: 1 1 1 1 0 1 1 1 1 1 numpy has looks ragged arrays, arrays of objects, , not want. note difference in following: in [27]: np.array([[1, 2], [3]]) out[27]: array([[1, 2], [3]], dtype=object) in [28]: np.array([[1, 2], [3, 4]]) out[28]: array([[1, 2], [3, 4]]) if want insert v row/column i/j , can padding other rows. easy do: in [29]: = np.array([[1, 1, 1], [1, 1, 1], [1, 1, 1]]) in [30]: i, j, v = 1, 1, 3 in [31]: np.array([np.append(a[i_], [0]) if i_ != else np.insert(a[i_], j, v) i_ in range(a.shape[1])]) out[31]: array([[1, 1, 1, 0], [1, 3, 1, 1], [1, 1, 1, 0]]) to pad along columns, not rows, first transpose a , perform

ruby - Interpolate string from database -

for example: t = test.new t.test_string = "\#{foo} , \#{bar}" t.save and want interpolate string in 1 of method. i tried several options: erb.new foo = 'hello' bar = 'world' erb.new(t.test_string).result it not work, test_string print "\#{foo} , \#{bar}" . it work if print without escape symbol '\'. erb.new("#{foo} , #{bar}").result => "hello , world" but how can make programatic? eval foo = 'hello' bar = 'world' eval '"' + t.test_string + '"' it works not safe. do have other options? or how make erb.new work? maybe don't quite understand needs. looking for? require 'erb' erb_template = erb.new('foo equals <%= bar %> , 2 + 2 = <%= 2 + 2 %>') bar = 'baz' erb_template.result(binding) # => foo equals baz , 2 + 2 = 4 binding method captures current scope erb rendering template in scope

Postman - can I save some of the cookie information returned in a variable? -

my first step same - log in. when log in need 4 pieces of information headers. need use 4 cookies/values/whatever subsequent actions (post, put, get, etc...) is there way save 4 pieces of information headers variables can use them in next query? since session seems time out after 3 minutes copy , pasting driving me mad. i found response body: var jsondata = json.parse(responsebody); postman.setenvironmentvariable("token", jsondata.token); how can information returned in header? if still issue you, may have @ this: https://www.getpostman.com/docs/postman/scripts/postman_sandbox in paragraph "request/response related properties" have information on how extract data headers (request or response) , in paragraph above, how data cookies ... hope helps alexandre

Rails: Is there an else statement in if try(:current_order)? -

is possible have else statement in if try()? the else block ignored: <% if try(:current_order) %> <% if current_order.state != 'complete' && current_order.line_items.count > 0 %> <%= current_order.line_items.count %> <% end %> <% else %> <%= "&nbsp;".html_safe %> <% end %> i want achieve print out of &nbsp; if try(:current_order) fails. update: <li class="icon icon-cart"> <%= link_to spree.cart_path %> <div class="cart"> <%= image_tag("shopping_bag.png", class: 'shopping-bag') %> <span class="cart-items-count"> <% if current_order %> <% if current_order.state != 'complete' && current_order.line_items.count > 0 %> <%= current_order.line_it

c# - SMTP server requires a secure connection or the client was not authenticated. The server response was :5.5.1 authentication required -

private void button1_click(object sender, eventargs e) { sendmaxinvoice(); try { mailmessage mail = new mailmessage(); smtpclient smtpserver = new smtpclient("smtp.gmail.com"); mail.from = new mailaddress("fromexample@gmail.com"); mail.to.add("toexample@gmail.com"); mail.subject = "test mail - 1"; mail.body = "mail attachment"; system.net.mail.attachment attachment; attachment = new system.net.mail.attachment(@"c:\users\user\desktop\dee.txt"); mail.attachments.add(attachment); smtpserver.port = 587; smtpserver.credentials = new system.net.networkcredential("fromexample@gmail.com", "*******"); smtpserver.enablessl = true; smtpserver.send(mail); messagebox.show("mail send"); } catch (exception ex) { console.writeline(ex.tostring()); } }

javascript - Call ViewBag, ViewData, TempData in external js file -

in mvc application, want viewbag, viewdata, tempdata values in external .js file. dont want write scripting in view.cshtml, added external js file it. unable call viewbag, viewdata, tempdata values in js file. can tell me how call these values without writing js code in view.cshtml because razor code runs on server side, values aren't available javascript runs on client side. way know of getting around declare variables in .js file , initialize them in .cshtml file. perhaps not ideal you, hope helps. my.cshtml: ... <script type="text/javascript"> myvar = @(viewbag.myvar); // etc. </script> ... my.js var myvar = null; function myfunc() { // check initialization if (myvar == null) alert("myvar not initialized!"); ... // use myvar ... }

osx - Lektor command-line installation fails on OS X 10.11.6 -

i've installed lektor desktop app os x on 2 computers, , when select "install shell command", prompts admin credentials (my default user account not admin in either case) , after i've entered admin details responds with: error failed install shell commands a search 'lektor' in console revealed no log entries. both machines have xcode 8.0 installed (don't know if makes difference). (fyi, not part of question, subsequent attempts install command line app via bash script succeeded on 1 , failed on other computer.) didn't work me either. looked @ shell script command line installation , saw wrapper around python script. solution: i copy/pasted python code shell script file , ran on command line. installation worked fine then. steps i've taken: environment: macos 10.12.1 python 2.7.12_2 installed via homebrew, fish shell (just bash replacement) used "curl ..." link getlektor.com download script - need modi

ios - How to create image set for both landscape and portrait orientation? -

i'm new in ios programming. want create image set background image of login view in application (iphone, ipad). prepared images portrait orientation, , landscape orientation. don't know how setup image set. you should use assets images. can use size classed different images portrait , landscape. for, example if want set images iphones in portrait should select compact width , regular height size class , can set portrait images there. so, can set images per size class if have different images different orientation. if have common image no need set different size class can set universal.

regex - BASH Check if variable match (or not) regexpr -

i need find out how check if variable matches defined regexp. let's have var1="abcd,1234" , vars have match regexpr bellow. see, var not match has comma, how check? have created if statement below, did not work: if [[ ${var1} == ^[a-za-z0-9`~!@#$%^&*()_+-={}|[]:";'?] ]] thanks. #!/bin/bash regex="^[^,]*[^ ,][^,]*$" var="$1" if [[ "$var" =~ $regex ]] echo "matches"; else echo "doesn't match!"; fi that check string not have comma..

amazon web services - java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.ClientConfiguration -

using bundle - aws-java-sdk-osgi-1.11.26.jar in osgi server below error thrown when executed amazons3 s3 = new amazons3client( credentials ); java.lang.noclassdeffounderror: not initialize class com.amazonaws.clientconfiguration @ com.amazonaws.clientconfigurationfactory.getdefaultconfig(clientconfigurationfactory.java:46) @ com.amazonaws.clientconfigurationfactory.getconfig(clientconfigurationfactory.java:36) @ com.amazonaws.services.s3.amazons3client.<init>(amazons3client.java:440) any solution fix this? thanks suggestions the clientconfiguration of aws-java-sdk-osgi-1.11.26.jar dependent of jackson-databind.jar jackson-databind.jar dependent on jackson-core.jar not able initialize clientconfiguration. added import-package importing jackson-core-osgi.jar in manifest of jackson-databind-osgi.jar then issue resolved note: dependent jars converted osgi jars , deployed

javascript - SweetAlert2 detect radio button select -

i using sweetalert2 javascript library show popups. sweetalert2 fork of sweetalert not maintained anymore. sweetalert2 allows me add radio buttons this // inputoptions can object or promise var inputoptions = new promise(function(resolve) { resolve({ '#ff0000': 'red', '#00ff00': 'green', '#0000ff': 'blue' }); }); swal({ title: 'select color', input: 'radio', inputoptions: inputoptions, inputvalidator: function(result) { return new promise(function(resolve, reject) { if (result) { resolve(); } else { reject('you need select something!'); } }); } }).then(function(result) { swal({ type: 'success', html: 'you selected: ' + result }); }) sweetalert2 give 'swal2-radio' name radio inputs, this <input id="swal2-radio-1" type="radio" name="swal2-radio" value="3&qu

r - plot cpt.var: Use values from dataframe for axis -

when try plot result changepoint analysis using cpt.var changepoint package, resulting values on x-axis integers starting 0 instead of values dataframe (which integers combining year , week). when plot data data frame x-axis correct, when plotting result of cpt.var x-values gone i have searched online answers cannot find solution. hope can me out. the syntax more complex example below comes down same issue: plotting the dataframe using plot(df, type="l") returns correct values on x-axis, plotting result of changepoint analysis using plot(vvalue) not. library(changepoint) df <- read.table(header=true,text = "year_week n 200801 12 200802 5 200803 0 200804 6 200805 0 200806 0 200807 4 200808 5 200809 3 200810 25 200811 36 200812 5 200813 2 ") vvalue <- cpt.var(df$n, method = "pelt", penalty = "bic") plot(vvalue) plot(vvalue, xaxt = "n") axis(1, at=1:13, labels=df[,1])

typescript - Saving an array of objects in localStorage -

i'm trying add item localstorage array make array of objects , iterate somewhere in angular 2 app. how i'm trying save localstorage item: if (!this.search_history) { localstorage.setitem('search_history', json.stringify(this.calc)); } else { localstorage.setitem('search_history', this.search_history + ',' + json.stringify(this.calc)); } and in component i'm trying iterate: private searchhistory = json.parse(localstorage.getitem('search_history')) || []; i go confused how supposed work, think have problem way trying insert new array item. not sure if can use push in case. what's proper syntax insert new array record?

How to download image from from url in java? -

i have been trying download image url via java. tried solve many ways didn't succeed. i'm writing ways hoping find went wrong: with first , second ways following error while i'm trying open image: ... file appears damaged, corrupted, or large ...and size smaller should be. i guess it's related encoding. first way: url url = new url("http://www.avajava.com/images/avajavalogo.jpg"); inputstream in = url.openstream(); files.copy(in, paths.get("somefile.jpg"), standardcopyoption.replace_existing); in.close(); second way: file f= new file("c:\\image.jpg"); url myurl = new url("http://www.avajava.com/images/avajavalogo.jpg"); fileutils.copyurltofile(myurl, f); with way 3 exception in thread "main" java.lang.illegalargumentexception: image == null! third way: url url = new url("http://www.avajava.com/images/avajavalogo.jpg"); bufferedimage img = imageio.read(url); file file = new file(

python - Cross-Lingual Word Sense Disambiguation -

i beginner in computer programming , completing essay on parallel corpora in word sense disambiguation. basically, intend show substituting sense word translation simplifies process of identifying meaning of ambiguous words. have word-aligned parallel corpus (europarl english-spanish) giza++, don't know output files. intention build classifier calculate probability of translation word given contextual features of tokens surround ambiguous word in source text. so, question is: how extract instances of ambiguous word parallel corpus aligned translation? i have tried various scripts on python, these run on assumption 1) english , spanish texts in separate corpora , 2) english , spanish sentences share same indexes, not work. e.g. def ambigu_word2(document, document2): words = ['letter'] sentences in document: tokens = word_tokenize(sentences) item in tokens: x = w_lemma.lemmatize(item) w in words: if w

c# - EF6 creates new entity instead of setting just a reference -

Image
i'd save list of flags each event. in order done i'm using following method in controller: public actionresult createevent(models.event newevent) { if(!string.isnullorempty(request.form["flag"])) { string[] idarr = request.form["flag"].split(','); foreach(string idstring in idarr) { int id = idstring.toint32(); newevent.flags.add(_applicantrepository.getflagbyid(id)); } } _applicantrepository.saveevent(newevent); } in applicantrepository use following methods: public void saveevent(event ev) { using (var dbctx = new visitorregistrationcontext()) { dbctx.events.addorupdate(ev); dbctx.savechanges(); } } public models.flag getflagbyid(int id) { using (var dbctx = new visitorregistrationcontext()) { models.flag flag = dbctx.flags.find(id); return flag; } } unfortunately, each time save e

.net - EF Reverse POCO with Oracle -

has managed ef, reverse poco, , oracle in sandbox @ same time? seems judicious application of nuget (ef , oracle) make takes. not so. any ides? the ef reverse poco template supports sql server

php - What can delay "Time to First byte" by almost 2s? -

Image
i have enabled php profiler, magento, still profiler. standard magento compiler records processing including db queries create page, receiving request. i testing php built-in server hosted locally. the results show pretty decent server response times, on chrome developer tools time first byte higher. why this? take note...the screenshots below of timings same request...clearly profiler (www.mysite.com/index.php): developer tools (www.mysite.com/index.php): edit i had written bit bigger answer realized using built-in php server. honestly, should give real webserver go. might chasing problem not exist (although 1 can argue there going on because it's not normal situation - might encountering php bug) ;)

commenting - Make a ascii box around the code block in Vim -

is possible create ascii comment box around code block? ascii box should smart enough extend box around maximum of code width. should clear trailing spaces. notice, should not have column line @ beginning of code. in code shown below, ; comment character. the code block may contain comment lines. work flow may pick code block in visual mode apply changes. here example. before ; convert radians theta45 = (theta + 45.)/!radeg theta90 = (theta + 90.)/!radeg theta = theta / !radeg ey = ey * normal ; engineering shear strain gxy = shear * exy after ; -----------------------------------------; ; convert radians ; theta45 = (theta + 45.)/!radeg ; theta90 = (theta + 90.)/!radeg ; theta = theta / !radeg ; ey = ey * normal ; ; ; engineering shear strain ;

c# - Binding Command in DataTemplate -

i made uwp app mvvm pattern(i think :) ) app have data template listbox. listbox in view.xaml: <listbox x:name="lbmysongs" itemssource="{binding path=mysongs}" itemtemplate="{staticresource lbsongstemplate}" grid.row="1"> <listbox.itemcontainerstyle> <style targettype="listboxitem"> <setter property="horizontalcontentalignment" value="stretch"/> </style> </listbox.itemcontainerstyle> </listbox/> datetemplate resource: <datatemplate x:key="lbsongstemplate"> <grid> <grid.columndefinitions> <columndefinition width="auto"/> <columndefinition width="auto"/> <columndefinition width="*"/> <columndefinition width="auto"/>

ios - Difficulty configuring NSFetchedResultsController in Swift 3 -

i'm refactoring existing project swift 2 swift 3. has been straightforward until got refactoring core data. i'm able create managed objects , persist them in managedobjectcontext , i'm having difficulty getting nsfetchedresultscontroller work. took @ this post , it's not getting me across finish line. after importing records json, verify there objects in managedobjectcontext following code: func recordcount() -> int { let context = (uiapplication.shared.delegate as! appdelegate).persistentcontainer.viewcontext let fetchrequest: nsfetchrequest<nsfetchrequestresult> = nsfetchrequest(entityname: "myentity") let count = try! context.count(for: fetchrequest) return count } when create fetchedresultscontroller , i'm running trouble. code doesn't crash, doesn't return nsmanagedobjects despite there being objects match search. here's how i'm creating nsfetchedresultscontroller in uiviewcontroller . class m

php - PHPMailer - Could not authenticate -

i've been running phpmailer year on php server. fine until 3 days ago when started getting following error: smtp error: not authenticate. allow less secure apps on here code: function sendemail($to,$cc,$bcc,$subject,$body) { require 'phpmailerautoload.php'; $mail = new phpmailer(true); $mail->smtpdebug = 1; try { $addresses = explode(',', $to); foreach ($addresses $address) { $mail->addaddress($address); } if($cc!=''){ $mail->addcustomheader("cc: " . $cc); } if($bcc!=''){ $mail->addcustomheader("bcc: " . $bcc); } $mail->issmtp(); $mail->smtpauth = true; // turn on smtp authentication $mail->smtpsecure = "tls"; // sets prefix servier $mail->host = "smtp.gmail.com"; // sets gmail smtp server $mail->port = 587; $mail->username = "myemail@gmail.com"; // smtp username $mail->password = "myemailpass"; // smtp pass

python - Interactive matplotlib widget not updating with scipy ode solver -

i have been using interactive matplotlib widgets visualise solution of differential equations. have got working odeint function in scipy, have not managed update ode class. rather use latter has greater control on solver used. the following code used solve differential exponential decay. y0 amplitude of decay. code stops working when solver.integrate(t1) called inside update function. i'm not sure why is. from scipy.integrate import ode # solve system dy/dt = f(t, y) def f(t, y): return -y / 10 # array save results def solout(t, y): sol.append([t, *y]) solver = ode(f).set_integrator('dopri5') solver.set_solout(solout) # initial conditions y0 = [1] # initial amplitude t0 = 0 # start time t1 = 20 # end time fig = plt.figure(figsize=(10, 6)) fig.subplots_adjust(left=0.25, bottom=0.4) ax = plt.subplot(111) # solve des solver.set_initial_value(y0, t0) sol = [] solver.integrate(t1) sol = np.array(sol) t = sol[:, 0] y = sol[:, 1] l, = plt.plot(t, y,

ios10 - Appcelerator Live View Console.Log not working -

odd 1 this. ever since upgrading ios10 , latest appcelerator sdk (5.5.0), can't simple console.log("hi!") show in console when i'm testing on iphone 6s plus connected mac via usb, using liveview. i've tried changing ti.api.info("hi!") - believe old way - no avail. if change alert("hi!") , works fine. however, it's not useful console.log used when developing things must tested on connected device (the camera, in case). i've googled this, plus done extensive searching on stackoverflow. it may new no-one has noticed yet. can help? it's known issue. apple changed way log data. appcelerator sdk has adapted changes. i'm pretty sure they'll fix asap. you'll have await update. greetings edit: here corresponding jira ticket ( https://jira.appcelerator.org/browse/timob-23786 )

static analysis - Jessie plugin integration with Frama-c Aluminium -

how integrate jessie external plugin(why 2.36) frama-c aluminium? you can't. why 2.36 compatible frama-c magnesium. however, master branch of why's git repository seems compatible frama-c aluminium (disclaimer: i've checked plugin compiles fine, didn't attempt proof it). the git repository located @ https://scm.gforge.inria.fr/anonscm/git/why/why.git/ can installed through following steps: git clone https://scm.gforge.inria.fr/anonscm/git/why/why.git/ cd why autoconf ./configure [--prefix=my_local_install] make [sudo] make install optionnally, if you're using opam, can installed pinned version of why: opam pin add why --kind git --edit https://scm.gforge.inria.fr/anonscm/git/why/why.git/ [ able edit opam instruction file: change version number 9999 , add ["autoconf"] @ top of list of build steps ]

crystal reports - Count the results of an equation -

when try following equation in crystal reports 10, told field {@total less one} cannot summarized: if {@total minus one} = 1 count({@total minus one}) else 0 i need count number of times {@total minus one} equal 1 , 2 , 3 , , on. shows how many jobs in month have had 1 change, how many have had 2 changes, etc. my equation {@total minus one} {#count of changes} -1 and rt {#count of changes} count of field occurrences, resetting on group of job number. how can create formula? the short answer is, can't summarize summary. total minus one count, can't count of count. try rewriting logic use shared variables instead.

javascript - Module not found: Error: Can't resolve 'filepath', but the file certainly exists -

i have .js file requires .svg file: // ... '.icon': { filter: `url(${require('./svg_filters/filters.svg')})` }, // ... i've checked , double-checked file 'svg_filters/filters.svg' exists , in right location relative .js file. i've made sure webpack.config.js configured pack .svg files: // ... module: { loaders: [ // ... { test: /\.svg$/, loader: 'file' } ] } // ... but when try run webpack, error (edited scrub actual project's filenames): error in ./my/script.js module not found: error: can't resolve './svg_filters/filters.svg' in '/home/kevin/programming/project/src/my' @ ./src/my/script.js xx:27-63 why getting error? there else need set before webpack can bundle .svg files?

How to change eZPlatform Backoffice SiteAccess? -

i'm new ezplatform , have been thrown in project involving migration ez legacy ez platform. 1 problem i've bumped siteaccess , images. example: users have custom images defined in var directory, let's var/news . unfortunately backoffice uses default siteaccess , don't find way modify without trigger redirect /ez#login /login page . i noticed can't change backoffice siteaccess in demo platform too. so wondering either if there's way achieve purpose or there's documentation address such subject? just clear, have 1 var directory per site access, issue right? /ez use default one, have problem. i think there no simple way manage use case right now, think possible 2.x (ask in slack) one complex solution put in 1 var directory , replace in db different paths... :( (or wait 2.x)

fortran - Passing a generic procedure to a function as actual argument -

i attempting pass generic procedure actual argument function: module mymod implicit none interface func module procedure :: func1 module procedure :: func2 endinterface func contains real function func1(x) real,intent(in) :: x func1 = 2*x endfunction func1 real function func2(x,y) real,intent(in) :: x real,intent(in) :: y func2 = 2*x + 3*y endfunction func2 real function func3(func,x,y) interface real function func(x,y) real,intent(in) :: x real,intent(in) :: y endfunction func endinterface real,intent(in) :: x real,intent(in) :: y func3 = func(x,y) endfunction func3 endmodule mymod program myprogram use mymod implicit none write(*,*)func3(func,2.,3.) endprogram myprogram gfortran 6.2.0 notes cannot this: test.f90:43:16: write(*,*)func3(func,2.,3.) 1 error: generic procedure ‘func’ not allowed actual argument @ (1) similarly, ifort 17: test.f90(39): error #8164: generic interface name shall not used actu

xcode - ionic Cordova Failed recording audio on IOS using Media plugin -

i'm working on ionic app , need record audio files , used cordova-plugin-media , worked fine android when tried on ios error : {"message":"failed start recording using avaudiorecorder","code":1} here code : var extension = '.wav'; var name = 'filename'; var audio = null; var filepath; $scope.startrecording = function() { name = utils.generatefilename(); if(device.platform == "ios") { //var path = "documents://"; //var path = cordova.file.documentsdirectory; //var path = cordova.file.cachedirectory; var path = cordova.file.datadirectory; path = path.replace("file:///", "cdvfile://"); } else if(device.platform == "android") { var path = cordova.file.externalapplicationstoragedirectory; } var filename = name + extension; filepath = path + filename; audio = new media(filepath, function(e){console.log(e, "success media"

javascript - Changing DOM element type depending on AngularJS variable -

what trying achieve depending on scope variable dom element change type.. so have scope var like: $scope.post = { title: 'post title goes here!', slug: 'post-title-goes-here', category: 'news', featured_image: '//src.jpg' }; and dom element like: <a href="#/post/{{post.slug}}"> <div style="background-image: url({{post.featured_image}});"> <small ng-if="post.category">{{post.category}}</small> <h3>{{post.title}}</h3> </div> </a> but if var $scope.post.slug empty dom element like: <div> <div style="background-image: url({{post.featured_image}});"> <small ng-if="post.category">{{post.category}}</small> <h3>{{post.title}}</h3> </div> </div> obviously can ng-if , duplicate each bit of code i'm trying avoi

wpf - BarButtonItems and BarSubItems on Bound RibbonControl -

i developing wpf application using devexpress controls, such ribbon control. want able place buttons on ribbon dynamically. able support both regular buttons , drop-down buttons. i thinking similar below. wpf view: <usercontrol.resources> <datatemplate x:key="ribboncommandtemplate"> <contentcontrol> <dxb:barbuttonitem ribbonstyle="all" content="{binding caption}" command="{binding (dxr:ribboncontrol.ribbon).datacontext.menuexecutecommand, relativesource={relativesource self}}" commandparameter="{binding}" /> </contentcontrol> </datatemplate> </usercontrol.resources> <grid> <dockpanel> <dxr:ribboncontrol dockpanel.dock="top" ribbonstyle="office2010"> <dxr:ribbondefaultpagecategory>

Plotting correlation scatter matrix plot in Julia -

Image
i plot data in particular dataframe obtained rdataests , julia> prestige = dataset("car", "prestige") the dataframe consists of various columns, interested in plotting 3 of them viz. prestige , income , education . have matrix of scatter plots, 1 obtained using r shown below, try statplots ? using statplots, rdatasets; pyplot() prestige = dataset("car", "prestige"); corrplot(array(prestige[[:prestige, :income, :education]]), bins=10)

SQL Server Conversion failed varchar to int -

i have table (no.1) has 10 columns. 1 of them clm01 integer , not allowed null values. there second table (no.2) has many columns. 1 of them string type clm02 . example of column data 1,2,3 . i'd make query like: select * table1 t1, table2 t2 t1.clm01 not in (t2.clm2) for example in table1 have 5 records values in clm01 1,2,3,4,5 , in table2 i've got 1 record value in clm02 = 1,2,3 so query return record value 4 , 5 in clm01 . instead get: conversion failed when converting varchar value '1,2,3' data type int any ideas? i decided give couple of options duplicate question see pretty often. there 2 main ways of going problem. 1) use , compare strings have build strings little oddly it: select * @table1 t1 not exists (select * @table2 t2 ',' + t2.clm02 + ',' '%,' + cast(t1.clm01 varchar(15)) + ',%') what see ,1,2,3, %,clm01value,% must add delimiter strings