Posts

Showing posts from February, 2015

ios - Generated header file not found in xcode -

Image
we working on swift project use little bit of objc. have 2 targets , 1 framework big part of code (also mixed code) inside it. 2 targets including framework. (screenshot) now keep getting error. 'nexx4-ios-swift.h' file not found nexx4-ios generated header file been created. when inside derived data find file. cannot navigate (cmd-click) file. seems that there thing wrong linking of it? any help? first remove header file path build setting in project in each target. , again recreate header file.

click the button and increase number through component - angular -

hej, i'm having having problem button should increase number +=1 , display in view number. app.component.ts import { component } '@angular/core'; import { counterservice } '../common/services/counter.service'; @component({ selector: 'app-root', templateurl: './app.component.html', styleurls: ['./app.component.sass'] }) export class appcomponent { constructor(private counterservice: counterservice) {} count() { return this.counterservice } set count(count){ this.counterservice.count += 1; } } counter.service export class counterservice { count = 0; } app.component.html <div class="container"> <div> <p> {{ counterservice.count }}</p> <button (click)="count()" class="btn btn-default form-control increasebtn">increase</button> </div> </div> i can display 0 when i'm stacked incrementation. thx in advance! t

java - Lambda: Callable variable initiated with a Runnable instance -

just found strange , interesting lambda behavior. let's have following class: private class task implements runnable { @override public void run() { // process } } the following statement compiling , running: callable task = task::new; could explain why possible ? edit : based on answers below, check following statements: 1. executorservice executor = executors.newsinglethreadexecutor(); executor.submit(task::new); 2. executorservice executor = executors.newsinglethreadexecutor(); executor.submit(new task()); on first glance, seems same, totally different thing. what happens here above situation. the reason executorservice has 2 methods: submit(runnable); submit(callable); so, using code 1. executor process following on it's internal thread: new task() the version 2. call submit(runnable) method , code task.run executed. conclusion: careful lambdas :) the callable not initialized runnable instance, in

Error while creating a new project using angular-cli -

i installed angular-cli when trying create new project, throwing error: npm warn optional skipping optional dependency: node-sass@4.5.3 (node_modules\node-sass): npm warn optional skipping optional dependency: sha1-0jydexlkejnrux/8yjh9zsu+fwg= integrity checksum failed when using sha1: wanted sha1-0jydexlkejnrux/8yjh9zsu+fwg= got sha1-au9qswhf0hcutezv8pftf+ahicg=. (81395 bytes) npm err! code eintegrity npm err! sha1-5pzh90zxhojsvqdqpjbbq/l9mvo= integrity checksum failed when using sha1: wanted sha1-5pzh90zxhojsvqdqpjbbq/l9mvo= got sha1-vmzmdoabdu7ugy26v1yhr9hyutk=. (48762 bytes) npm err! complete log of run can found in: npm err! c:\users\raman\appdata\roaming\npm-cache\_logs\2017-07-25t09_26_53_359z-debug.log package install failed, see above. package install failed, see above. how resolve error! thanks in advance! try npm set registry https://registry.npmjs.org/ rm -rf node_modules/ npm cache clean --force npm cache verify npm install or discard npm ,

sql - how I can resend all failed emails (msdb.dbo.sp_send_dbmail) -

i sending emails using msdb.dbo.sp_send_dbmail. emails not send. have got list of emails have failed. select top 10 * msdb.dbo.sysmail_event_log log_id event_type log_date process_id mailitem_id account_id last_mod_date last_mod_user 9022 error 50:15.9 5608 20428 null 50:15.9 sa 9023 error 51:23.3 5608 20428 null 51:23.3 sa now, want resend failed emails again available in sysmail_event_log table. how can resend failed emails? use following query sending failed item. or use cursor each row msdb.dbo.sysmail_faileditems same query declare @to varchar(max) declare @copy varchar(max) declare @title nvarchar(255) declare @msg nvarchar(max) select @to = recipients, @copy = copy_recipients, @title = [subject], @msg = body msdb.dbo.sysmail_faileditems mailitem_id = 56299 exec msdb.dbo.sp_send_dbmail @recipients = @to, @copy_recipients = @copy, @body = @msg, @subject = @title, @body_format = 'html'; referenc

javascript - Dynamically added button only fires "partially" .on('click') -

i have strange behaviour button add via function table. buttons in table this: <a href="#" class="btn btn-success pointer btn-sm clickable rounded-0" data-ref="detailsraw" data-hash="details-rohmaterial-{{ raw.id }}" data-trigger="{{ raw.id }}"><i class="fa fa-search"></i> details</a> if click them work expected. if add 1 button dynamically works (for example can see loadrawsettings being fired) , until comment, think class active added removed can see dom updates in chrome dev. cols functions this: cols.showmessage = function () { $('body').addclass('show-message'); messageisopen = true; }; while messageisopen , cols global vars. i'm not sure whether whole 'click' function necessary here anyway: $(document).on('click', '.clickable', function (e) { window.location.hash = $(this).attr('data-hash'); /* prepare */

c - Can not read utmpx file in go -

package main import ( "os" "fmt" ) func main() { fd, err := os.open("/var/run/utmpx") fmt.println(fd, err) var data []byte len, err := fd.read(data) fmt.println(len, err) } &{0xc42000a240} nil 0 nil there no error, no data. this path /var/run/utmpx read system header file. how path another question system: macos el capiton, go version go1.8 darwin/amd64 **my final goal read file go struct.**this file contains system users infomation. can ? keep trying... you can use ioutil.readfile function this: package main import ( "fmt" "io/ioutil" ) func main() { fd, err := ioutil.readfile("/var/run/utmpx") fmt.println(string(fd), err) } the problem in original code read data 0 bytes long. since reader interface reads reads len(data) , reads nothing. more on that: https://golang.org/pkg/io/#reader

Is it possible to get system.localtime in particular format in zabbix? -

i have item prints local time of system , want design trigger works when local time on system < 6am this item. zabbix_get -s 192.168.201.101 -k system.localtime[local] and output 2017-07-25,04:39:14.682,-05:00 i using zabbix 3.0. how format item show time hhmmss (043914). want have in format can use in trigger expression - if localtime > 060000 , <some_other_condition> raise alert currently see zabbix raises alerts based on server time, cannot use inbuilt item.key.time(0) function server time different host time. unfortunately, not possible currently. can use parameter utc , return unix timestamp. without knowing timezone, cannot calculate local time that. advanced value parsing, coming in zabbix 3.4, might allow calculate that, still messy. it seems useful idea - please consider creating new feature request (make sure search existing requests).

python - django-modeltranslation removes text from models -

this translation.py file: from modeltranslation.translator import translator, translationoptions polls.models import question, choice class questiontranlationoptions(translationoptions): fields = ('question_text',) class choicetranslationoptions(translationoptions): fields = ('choice_text',) translator.register(question, questiontranlationoptions) translator.register(choice, choicetranslationoptions); models.py : from django.db import models django.utils import timezone import datetime django.utils.translation import ugettext_lazy _ class question(models.model): question_text = models.charfield(max_length=200) pub_date = models.datetimefield(_('date published')) def __str__(self): return self.question_text def was_published_recently(self): = timezone.now() return - datetime.timedelta(days=1) <= self.pub_date <= was_published_recently.admin_order_field = 'pub_date' was_published

awk Compare 2 files, print match and print just 2 columns of the second file -

i novice , sure silly question searched , didn't find answer. want select 2 columns of file 2. know how select 1 column =$1 , columns =$0. if want show 2,3, ... column file2 in file3, possible? awk -v rs='\r\n' 'begin {fs=ofs=";"} fnr==nr {a[$2] = $1; next} {gsub(/_/,"-",$2);$2=toupper($2);print a[$2]?a[$2]:"na",$0,a[$2]?a[$2]:"na"}' $file2 $file1 > file3 or awk -v rs='\r\n' 'begin {fs=ofs=";"} fnr==nr {a[$2] = $0; next} {gsub(/_/,"-",$2);$2=toupper($2);print a[$2]?a[$2]:"na",$0,a[$2]?a[$2]:"na"}' $file2 $file1 > file3 i want $1 , $2 file2, code doesn´t work. obtain 1 column data $1 , $2 awk -v rs='\r\n' 'begin {fs=ofs=";"} fnr==nr {a[$2] = $1$2; next} {gsub(/_/,"-",$2);$2=toupper($2);print a[$2]?a[$2]:"na",$0,a[$2]?a[$2]:"na"}' $file2 $file1 > file3 any solution?? awk -v rs='\r\

c# - odata v4 using 2 parameter -

i want pass 2 parameter controller , run sql-function try , googled lot resources no luck, anyone give me hints? basically follow web api , odata- pass multiple parameters when using builder.function compiler keep tell me no extension method found. package.config <?xml version="1.0" encoding="utf-8"?> <packages> <package id="entityframework" version="6.1.3" targetframework="net452" /> <package id="entityframework.functions" version="1.4.0" targetframework="net452" /> <package id="microsoft.aspnet.odata" version="6.0.0" targetframework="net452" /> <package id="microsoft.aspnet.webapi" version="5.2.3" targetframework="net452" /> <package id="microsoft.aspnet.webapi.client" version="5.2.3" targetframework="net452" /> <package id="microsoft.aspnet

haskell - Let Cabal-Install show the install plan -

if install package using cabal install pkg cabal install packages pkg depends on. if there conflict installed packages cabal shows packages have installed freshly, ones updated , installed ones broken. there way list unconditionally instead of running install procedure? cabal install <pkg> --dry-run print packages installed without performing of installation. not show information though if package installed or similar.

amazon web services - Python, aws s3 - data with images bulk importing -

i new here @ stackoverflow. i have question regarding process of bulk importing of data. scenario: have xyz system have feature bulk import data, having trouble on how can bulk import of images aws s3 via sftp. take note these images related data have been imported via bulk import. hoping hear knowledgeable on regard. thanks. cheers! s3 not have native sftp support. you can upload s3 using awscli (the s3 sync option may useful), write own uploader using s3 apis, or find 3rd-party solution. if absolutely must have sftp, see stack overflow post: ftp/sftp access amazon s3 bucket .

Batch Requests for Insights on Facebook Marketing API (JAVA) -

this should easy looking @ fb documentation marketing api page empty: https://developers.facebook.com/docs/marketing-api/asyncrequests/v2.10 does has simple example on how make easy batch request adsinsights ads, adsets or campaigns? googling around find examples in js or python, can't seem find right class name in java this. ok, got working. code in scala should same in java. implicit val batch = new batchrequest(facebookapi.context) apinodelist.asscala.map(getinsights) def getinsights(node: ad)(implicit data: insightdata, batch: batchrequest) = { node.getinsights .setbreakdowns(data.breakdowns) .setdatepreset(data.datepreset.tostring) .setfields(data.fields) .setactionattributionwindows(data.attributionwindow) .settimeincrement(data.timeincrement) .addtobatch(batch) } val result = batch.execute()

machine learning - XGBoost error fluctuates and the model doesn't seem to converge -

recently, have been working on predicting using xgboost. first test-drove xgboost on portion (4,000,000, .npy) of dataset , works well. yet after switched complete 1 (7,000,000, .svm), showed weird pattern of error follows: [0] train-error:12.822 val-error:12.4942 [1] train-error:1.02848 val-error:1.02711 [2] train-error:12.8268 val-error:12.4991 [3] train-error:1.01773 val-error:1.01609 [4] train-error:12.8218 val-error:12.4925 [5] train-error:1.0205 val-error:1.01982 [6] train-error:12.803 val-error:12.4753 [7] train-error:1.0421 val-error:1.04024 [8] train-error:12.7632 val-error:12.4369 [9] train-error:1.08154 val-error:1.07835 [10] train-error:12.7387 val-error:12.4139 [11] train-error:1.11096 val-error:1.10667 [12] train-error:12.7433 val-error:12.4177 [13] train-error:1.10388 val-error:1.09992 [14] train-error:12.7509 val-error:12.4244 [15] train-error:1.09414 val-error:1.09195 [16] train-error:12.757 val-error:12.4301 [17] train-error:1.08932

.net - Convert algorithm to validate NIPC / NIF into a C# Regex (Regular Expression) -

i've got next simple algorithm validate nipc / nif identification portugal: private bool isnipccorrect(string nifstring) { int controldigit = 0; (int = 0; < nifstring.length - 1; i++) { controldigit += (int)char.getnumericvalue(nifstring[i]) * (10 - - 1); }; controldigit = controldigit % 11; if (controldigit <= 1) { controldigit = 0; } else { controldigit = 11 - controldigit; } if (controldigit == (int)char.getnumericvalue(nifstring[8])) { return true; } else { return false; } } i'd know if generate little regex validate identification in few lines. initial validation: lenght: 9 digits control digit: nifstring[8] how validate: sum = nifstring[7] * 2 + nifstring[6] * 3 + nifstring[5] * 4 + nifstring[4] * 5 + nifstring[3] * 6 + nifstring[2] * 7 + nifst

objective c - RestKit resolve objects given an id or partial representation in JSON -

i have json array, like: [{ "name": "john smith", "occupationid": 3 }, { "name": "steven davis", "occupationid": 2 } ] the occupation response looks like: [{ "id": 2, "name": "teacher" }, { "id": 3, "name": "teaching assistant" } ] is there way allow restkit request correct data occupations, given id? know can done if data persisted using coredata, via addconnectionforrelationship:connectedby: method, rather data transient, given server local , there no need persist data. i'm aware rkobjectmapping not support identifiactionattributes property, meaning cannot (to knowledge) designate way allow class declare unique, identifying property. any appreciated. using mix of objective-c , swift, , such, not mind answers in either language.

Regex101 vs Oracle Regex -

Image
my regex: ^\+?(-?)0*([[:digit:]]+,[[:digit:]]+?)0*$ it removing leading + , leading , tailing 0s in decimal number. i have tested in regex101 for input: +000099,8420000 , substitution \1\2 returns 99,842 i want same result in oracle database 11g: select regexp_replace('+000099,8420000','^\+?(-?)0*([[:digit:]]+,[[:digit:]]+?)0*$','\1\2') dual; but returns 99,8420000 (tailing 0s still present...) what i'm missing? edit it works greedy quantifier * @ end of regex, not lazy *? set lazy one. the problem well-known worked henry spencer's regex library implementations: lazy quantifiers should not mixed greedy quantifiers in 1 , same branch since leads undefined behavior. tre regex engine used in r shows same behavior. while may mix lazy , greedy quantifiers extent, must make sure consistent result. the solution use lazy quantifiers inside capturing group: select regexp_replace('+000099,8420000', '^\+?(-?)0

javascript - ajax success call back function was not called when the dataType is JSONP.in Cross domain Access -

type = 'calci'; var ajurl = "example.com&callback=mycallback"; var datas = "cateid=" + cateid + "&type=" + type + "&pno=" + pno + "&whos=" + whos; $.ajax({ type: "get", url: ajurl, data: datas, contenttype: "application/json; charset=utf-8;", datatype: "jsonp", jsonp: 'callback', username: "abcdxyz", password: "lkjljlmkjhlkj", success: function(data) { alert('success...'); console.log(data); }, jsonpcallback: 'mycallback', error: function(xhr, ajaxoptions alert(xhr.status); alert(thrownerror); } }); i have defined call function function mycallback(jsondata){ console.log(jsondata+"check"); $('#calcilist').html(jsondata); } if print error shows either call function not defined or queryasjdkbaskjds1298372981379284-2132 not called. from url try change &callback=mycal

jsf 2 - How to listen on a stateless POST request and set JSF managed bean properties -

i have java-ee application works jsf (managedbean, managedproperty, ect ...) , spring framework. need able retrieve data via javascript form sent external website. have opened rights authorize cors (cross origin or cross domain). i know best way grab external form jsf processed managedbean. to make question more explicit made diagram ============== edit application works jsf, i'm looking way retrieve data (from javascript form on external site) in managedbean under jsf. tried retrieve data creating java-ee standard servlet , using dopost ... methods of httpservlet. solution not work (this subject of previous question on s.o). several people told me in web application not mix java-ee standard , jsf, either servlet or jsf. made diagram (above) explaining trying do. to recap: retrieve data external website (via javascript form) in managedbean of application. ============== i've tried standard java-ee servlet it's not right way. indeed, standard servlet can r

Firefox Browser 54.0.1. crashed with geckodriver Failed to decode response from marionette -

i have problem selenium test open firefox browser test failed error org.openqa.selenium.webdriverexception: failed decode response marionette build info: version: '3.4.0', revision: 'unknown', time: 'unknown' system info: host: 'ip-10-24-2-92', ip: '10.24.2.92', os.name: 'linux', os.arch: 'amd64', os.version: '3.13.0-85-generic', java.version: '1.8.0_131' driver info: org.openqa.selenium.firefox.firefoxdriver capabilities [{moz:profile=/opt/buildagent/temp/buildtmp/rust_mozprofile.nnpkigsllgki, rotatable=false, timeouts={implicit=0.0, pageload=300000.0, script=30000.0}, pageloadstrategy=normal, platform=any, specificationlevel=0.0, moz:accessibilitychecks=false, acceptinsecurecerts=true, browserversion=54.0.1, platformversion=3.13.0-85-generic, moz:processid=23262.0, browsername=firefox, javascriptenabled=true, platformname=linux}] session id: 04c80e38-df7d-431b-b76a-06cbc850db46

xml - Python minidom check element exists -

i have xml file structure: <?domparser ?> <logbook:logbook xmlns:logbook="http://www/logbook/1.0" version="1.2"> <visits> <visit> <general> <technology>eb</technology> </general> </visit> <visit> <general> <grade>23242</grade> <technology>eb</technology> </general> </visit> </visits> </logbook:logbook> i want check if each column exists in visit tag, , if not exist want return none, wrote code: import xml.dom.minidom minidom mydict={} columnslst=['grade','technology'] doc=minidom.parse('file.xml') visitcount=len(doc.getelementsbytagname('visit')) in range(visitcount): c in columnslst: if(doc.getelementsbytagname(c)[i].firstchild): mydict[c]=doc.getelementsbytagname(c)[i].firstchild.data print(mydict) this not work, since not return none elements not exist. , index

python - DoesNotExist: CustomerProfile matching query does not exist -

class customerprofileformcleaner(object): """ objet centralises validation , normalizing of customer profile fields should run inside form's clean function """ ... def clean_bank_account(self): ssn = self.form.cleaned_data.get('ssn') customer = customerprofile.objects.get(ssn=ssn) bank_account = self.form.cleaned_data.get('bank_account') bank = self.form.cleaned_data.get('bank') bank_transit = self.form.cleaned_data.get('bank_transit') qs = financialprofile.objects.exclude(customer_id=customer.id).filter( bank=bank, bank_transit=bank_transit, bank_account=bank_account) if qs.count() > 0: # concatenation of bank transit, bank account , bank # number must unique. hence, following message # displayed if in use. raise validationerror( _(&#

hive - Can't do a CTAS when I use dbname in CTAS -

a piculiarity noticed. when try create table dbname.table_name select i error creating temporary folder on: hdfs://nameservice1/apps/hive/warehouse. error encountered near token 'tok_tmp_file' but if first do use dbname; and then create table table_name select it works. why that? to create table in database user need have write permission on current database , database in table being created. i.e. while running create table dbname.table_name select statement , need have write permission on current database well. this known issue reported in jira hive-11427 .

Can't create the correct filter for my elasticsearch query -

i've problem set correct filter. query looks this: { "query" : { "bool" : { "must" : [ { "query_string" : { "query" : "example~", "analyzer" : "standard", "default_operator" : "or", "fuzziness" : "auto" } }, { "term" : { "client" : { "value" : "myclient", "boost" : 1 } } }, { "range" : { "datecreate" : { "gte" : "2016-01-01t00:

REST: Is it considered restful if API sends back two type of response? -

we have stock website , buyers connect sellers. creating api let buyers push contact details , seller details. transaction , logged in our database. have created following api: the request post, url looks like: /api/leads the request body looks like: { "buyermobile": "9999999999", "stockid": "123" } the response looks like: { "sellermobile" : "8888888888", "selleraddress": "123 avenue park" } we have new requirement, i.e. need send pdf url (instead of "sellermobile" & "selleraddress"). pdf url contain seller details in case comes 1 of our client. we have modified same api, request body looks like: { "buyermobile": "9999999999", "stockid": "123", "ispdf": true } the response looks like: { "sellerdetailspdf" : "https://example.com/sellerdetails-1.pdf", } is restful this? or

VBA function with array inputs -

i trying create more user friendly version of function sumproduct don't understand why function returning #value!. please advise: below code both array inputs of same length: function sp(x variant, y variant) double psum = 0 = lbound(x) ubound(x) qsum = x(i) * y(i) psum = psum + qsum next sp = psum end function you need state qsum , psum are. make sure arrays being called in of same type variant.: function sp(x variant, y variant) double dim psum, qsum double psum = 0 = lbound(x) ubound(x) qsum = x(i) * y(i) psum = psum + qsum next sp = psum end function test sub sub test() dim ex, wy variant ex = array(1, 2, 3, 4, 5) wy = array(2, 3, 4, 5, 6) call sp(ex, wy) end sub this worked me without value error

html - issue in making bootstrap responsive -

hi making website responsive getting issues 1) small text "dk" , "/md" goes off screen when in mobile mode 2) .box-head not same psd have if compare attached image , code result there less space in head. here code: <div class="container"> <div class="row-fluid"> <div class="col-md-4"> <div class="box"> <div class="box-head"> <h3>basic</h3> <div class="line"><hr></div> <p>18 tv channels</p> <p><a href="">see list</a></p> </div> <!-- box head closed --> <div class="box-info"> <div class="content-wrapper"> <img src="card.png" alt="" class="img-responsive"> <div class="text-wrapper"> <div class="row"> <div class="col-md-8"> <h1>99</h1> &

java - Eclipse WorkerPool does not start new Workers for Jobs -

in rcp eclipse application have number of sessions each run controller run job. each controller makes request/response-communication should synchrounous per controller run in job (for display of progress , parallelism of long running requests in different sessions). in 99% of cases works correctly. there no new worker objects produced in workerpool , spare ones in pool gone. have multiple heap-dumps our customers proof. the calling code follows: job job = new job("name") { // request/response work, try/catch errors -> alsways return status.ok } job.schedule(5l); job.join(jobdeadlocktimeout,monitor); // wait each request/response job before next can scheduled in sync per session usually in heap-dump can see workers controller-jobs , spare (sleeping) worker-objects used request/response jobs. in case application hangs can see controller threads in workerpool , no sleeping or unused workers. have been removed no new workers produced. heap-dumps state ecli

c# - Inserting spaces between chars of two strings modify their order -

this question has answer here: unexpected behavior when sorting strings letters , dashes 2 answers i have 2 strings of same length. assuming (probably wrongly) inserting space between each character of each string not change order. var e1 = "12*4"; var e2 = "12-4"; console.writeline(string.compare(e1,e2)); // -1 (e1 < e2) var f1 = "1 2 * 4"; var f2 = "1 2 - 4"; console.writeline(string.compare(f1,f2)); // +1 (f1 > f2) if insert other characters (_ x instance), order preserved. what's going on ? thanks in advance. if use ordinal comparison, right result. the reason ordinal comparison works evaluating numeric value of each of chars in string object, inserting spaces make no difference. if use other types of comparisons, there other things involved. documentation: an operation uses w

c# - Show result of nested cursors as a single table in SQL Server -

in stored procedure shown below, have 5 cursors scroll data in several tables select information need while go through 1 of tables, using parameters of selection various columns of initial query shown in first cursor. at end execute query result of cursors. final query shows result split in tables divided code of record identified id. although records belong same entity procedure shows divided tables , need impression shown single table able pass result asp.net gridview c#. procedure created in sql server 2012. await comments , thank you. alter proc [dbo].[sp_presing] @ident int set nocount on declare mi_cursor cursor select p.idlinea, p.identidad, n.capitulo cap, n.nombre, p.anio, p.idingreso, c.tipo, c.conceptoobj, c.cuenta, c.subcuenta, c.auxiliar, c.descripcion descaux, p.idotorgante, isnull(e.nombre, '') otorg, isnull(e.capitulo, '') capotor, p.idfuente, f.fuente, p.idespecifica, t.fuenteespecifica claespecifica, t.descr

Programmatically clicking a link in android browser using Javascript -

i'm trying click on dynamically created click-to-call link in android browser, nothing happen. create element: var link = document.createelement('a'); link.href = "tel:+1-303-499-7111"; then event , fire click: var evt = new mouseevent("click"); link.dispatchevent(evt); or even link.click(); it works fine on chrome's mobile mode , ios device, doesn't work in android browser. if create element in html <a href="tel:+1-303-499-7111">+1 (303) 499-7111</a> , click manually, working

sql server - How can I save INT in NVARCHAR column database -

i have stored procedure saves int parameter nvarchar column. if do declare @valore int set @valore = 90 insert table (valore) values(@valore) so if select valore database can see this 90.0000 insert table (valore) values(cast(@valore varchar(10))

am new to python, please share logic for below concept -

eg: ece_student_list = [['section-1', [["sai",'science'], ["rama",'maths']]], ['section-2', [["seetha",'science'], ["ravana",'maths']]]] i have print student name , subject passing key section name. for eg : if key 'section-1' first student should print "sai",'science' second student ,then should print "rama",'maths' please share logic in python. won't share code directly. have learn , experiment on own. although can tell can expect output. you can create dictionary in python , add section-1, section-2 keys , list of students value each key. your dictionary structure this: { 'section-1' : [ {'sai':'science'}, {'rama':'math'} ], 'section-2':[ {'sai':'science'}, {'rama':'math'} ] }

ios - How to detect which button user clicked on SKStoreReviewController? -

it easier keep track of data , optimize reviews based on how performed on skstorereviewcontroller prompts. but how detect button user clicked? not now? 1* 4* 5*? submitted review? you can't. if read docs skstorereviewcontroller , requestreview , you'll see doesn't expose results, ui, or whether prompt shown.

ionic3 - How to control ion-backdrop in Ionic 3? -

i have search in api docs , components list , have not found info regarding how use ion-backdrop component. if append component of own gets showed opacity set @ 0.1 , not sure if have put kind of manual timeout change or if there better way control using component itself. does knows can find docs or how show in correct way?

ios - Using 3rd party framework (Alamofire) in my sub-project (CocoaTouch framework) -

Image
i using xcode 8 + swift 3. i created fresh ios project named " myapp ". then, create cocoa touch framework project, named "mysubproject". (the idea have myapp project accessing mysubproject code.) i added mysubproject myapp project, linked mysubproject framework. in xcode project navigator looks this: myapp > mysubproject.xcodeproj everything works fine. code in myapp can access code in mysubproject . now, need add alamofire mysubproject . followed instruction in alamofire offical website manually add alamofire mysubproject , project structure looks this: myapp > mysubproject.xcodeproj > alamofire.xcodeproj so, mysubproject has dependency on alamofire framework. looke under mysubproject target--> general : after that, can access alamofire in mysubproject code, no compile error. myapp built successfully. however, when run app in emulator, got run-time error: dyld: library not loaded: @rpath/libswiftswif

php - Updating users login time -

i have login script , want insert last login members table , update every time member logins in having issues. lastlogin not being inserted everytime user logins in. here code if(isset($_post['submit'])){ $username = $_post['username']; $password = $_post['password']; if($user->login($username,$password)){ $_session['username'] = $username; try{ $stmt = $db->prepare("update admin set login_date = now() adminid = $adminid "); $stmt->execute(); $stmt=null; } catch (pdoexeception $e){ $error[] = $e->getmessage(); } header('location: index.php'); exit; } else { $error[] = '<div class="alert alert-danger fade in text-center"> <a href="#" class="close" data-dismiss="alert">&times;</

database - AWS Elasticache Redis failover -

i using redis on elasticache node application , today node went down means our app stopped working. took 20 minutes new node provisioned. from reading documentation seems can set cluster automatically promotes slave primary in case of failure. big gotcha seems have set client write primary node , read slave nodes. this means in case of failure, have reconfigure app point newly created 'read' nodes. takes few minutes slave promoted primary. is there no way set if primary fails, slave automatically take on read/write operations? i'm not storing data in redis , low read/write operations, required run app (live video sessions!). if can't have seamless failover in redis, there can use provides functionality? i'm hoping don't have move traditional dbms works need able handle failure well. thanks multi az's should automatically switch on minimal downtime. once have created 1 of these instances, endpoint cluster. amazon point dns entry prope

python - count an occurrence of a string in a bigger string -

i looking understand can make code work. learning concept unlock lot in programming understanding. trying count number of times string 'bob' occurs in larger string. here method: s='azcbobobegghakl' in range(len(s)): if (gt[0]+gt[1]+gt[2]) == 'bob': count += 1 gt.replace(gt[0],'') else: gt.replace(gt[0],'') print count how refer string instead of having work integers because of using for in range(len(s)) ? try this: def number_of_occurrences(needle, haystack, overlap=false): hlen, nlen = len(haystack), len(needle) if nlen > hlen: return 0 # no occurrences n, = 0, 0 while < hlen: consecutive_matching_chars = 0 j, ch in enumerate(needle): if (i + j < hlen) , (haystack[i + j] == ch): consecutive_matching_chars += 1 else: break if consecutive_matching_chars == nlen: n += 1

reactjs - setState doesn't apply changes to component state -

i use react v16.0.0-alpha.6 , react-native v0.44.2 . i've encountered weird situation. state changed code below. expected result. it's ok. // current this.state.searchinputvalue 'q' // coming searchinputvalue 'a' _handlesearchinputvaluechanged = (searchinputvalue) => { this.state.searchinputvalue = searchinputvalue // here searchinputvalue of state 'a' } state changed code below. expected result too. it's ok. // current this.state.searchinputvalue 'q' // coming searchinputvalue 'a' _handlesearchinputvaluechanged = (searchinputvalue) => { settimeout(()=>this.setstate({ searchinputvalue })) // after running settimeout , async setstate methods // searchinputvalue of state 'a' } however normal usage of setstate doesn't work // current this.state.searchinputvalue 'q' // coming searchinputvalue 'a' _handlesearchinputvaluechanged = (searchinputvalue) => {

c# - Reset and Dispose observable subscriber, Reactive Extensions -

suppose have : public class uploaddicomset { public uploaddicomset() { var cachcleantimer = observable.interval(timespan.fromminutes(2)); cachcleantimer.subscribe(checkuploadsetlist); //start subscriber } void checkuploadsetlist(long interval) { //stop , dispose subscriber } public void adddicomfile(sharedlib.dicomfile dicomfile) { //renew subscriber, call checkuploadsetlist 2 minutes later } } 1- in checkuploadsetlist want dispose or finish observable 2- in adddicomfile want reset as comment in methods. update: i can timer as: public class uploaddicomset : importbaseset { timer _timer; public uploaddicomset() { _timer = new timer(checkuploadsetlist, null, 120000, timeout.infinite); } void checkuploadsetlist(object state) { logging logging = new logging(logfile); try { _timer.dispose(); //stop subscription

android - What's with the "read Tango-specific data to external storage" permission? -

Image
(that's not typo way, permission asks "reading to storage".) i'm making google tango app in unity export, upload, download , import adf (area description) files , tango. somewhere along process of downloading , importing adf files, following permission dialog: (app name anonymized privacy.) i haven't been able find specific permission is, nor it's doing. questions following: why come repeatedly every file download/import? both in 1 session , after app restarts, permission dialog comes every file download , import. thought if grant app permission, have permission on? is there specific identifier permission add androidmanifest.xml ? make appear once? have <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.read_external_storage" /> in there. what allow/deny? i've tried put in print statements along download , save flow see stops me, s

gfortran - Is there any way to call Fortran subroutine from character variable (which holds name of subroutine) instead of name of actual subroutine -

i have fortran subroutine sample . call inside program. looking way call character variable, not call sample() following program calculate character(97) :: ii='sample' call ii() ! call sample subroutine end program subroutine sample print 'something' end subroutine sample

jquery - Using .val().length != 0 to show textbox -

i working survey, note section after every question. notes should come after pressing end or f10 first time. after skipping ahead question 2, , going question 1, note section question 1 should again hidden if there no notes. however, if there writing in notes section @ all, want them remain visible after returning question 1 question 2. i trying accomplish using .val().length != 0 display notes if there 1 character written. i'm not sure if issue here .val().length or preventdefault command, want prevent default action in case not display notes. <style> #[% questionname() %]_div {display:none} </style> <script> $(document).keydown(checknote); function checknote(f){ f = f || window.event; if (f.keycode == '121' || f.keycode == '35'){ f.preventdefault(f); $("#[% questionname() %]_div").css('display', 'block'); } } function displaynote(d){ d = d || window.event; if ($("#[% questionname()

html - Keep background-color while overlapping a picture -

how can overlap <p style="background-color:red; width:168px; padding:10px; margin-top:-168px;" class="kasten"> this p tag on picture , keep background-color:red? because background gets transparent when overlaps picture... thanks answers! cheers, till instead of margin-top, try using: position: relative; top: -168px; see: https://codepen.io/anon/pen/prvwvo

apache - Symfony 2.8 can't write in /var/lib/php/sessions/ -

good day! i'm bit confused here in symfony functionality terms. have website wich supossed write sessions in /var/lib/php/sessions/ . i'm confused right there, because in /var/www/html/myproject/ recursively property of www-data:www-data (yes, i'm using apache). owner of /var/lib/php/sessions/ root , when apache tries write there, 500 server error regarding writing permissions in directory. i have divided opinions here. people advice me modify config.yml manage sessions inside project directory, while other people bad practice. but, how targeting /var/lib/php/sessions/ without file permission error? here's via apache url: oops! error occurred server returned "500 internal server error". broken. please let know doing when error occurred. fix possible. sorry inconvenience caused. here's via php development webserver: warning: sessionhandler::read(): open(/var/lib/php/sessions/sess_u3eg1842nlpkbm0rvddrq37dc2, o_rdwr) failed: permission d

reference - De-referencing a JavaScript property from inside an array -

this question has answer here: javascript closure not working 1 answer i'm trying de-reference property on javascript object, not getting expected result. i have array of knockout view-models (i don't think problem knockout-specific), each of has observable, selected . add subscription observable function, crossselecttargetlangs called when value of selected changed. furthermore, add subscription inside for... loop. var tl = 0, tlmax = alllangvms.length, vmlang, selectedcode; // each 'vmlang' view-model in 'alllangvms' array... (; tl < tlmax; tl++) { // local variable context view-model vmlang = alllangvms[tl]; // add subscription observable vmlang.selected.subscribe(function() { // de-reference vmlang.code property selectedcode = (function(code) { return code;

android - react-native-nfc can't detect Mifare DESfire -

i'm working https://github.com/novadart/react-native-nfc detect nfc tag. unfortunately, can't detect, it's able detect when using nfc tools (downloaded @ playstore) here's information nfc tools: tagtype iso 14443-4 nxp mifare desfire / nxp mifare desfire ev1 isodep, nfca serial number xxxxxx atqa 0x0344 sak 0x20 i have follow tutorial & curious why can't detect. guide please. thanks.

python - How to filter fields in embedded objects with Alignak backend client -

i trying limit fields embedded object in alignak, documentation alignak backend not go detail on how combine 2 functionalities. using alignak_backend_client ( http://alignak-backend-client.readthedocs.io/en/latest/index.html ). right have: params = { "projection": { "name": 1, "ls_last_check": 1, "host":1 }, "embedded": { "host": 1 } } backend = alignak_backend_client.client.backend(alignak_backend_url) backend.login(alignak_admin_userid, alignak_admin_password) backend.get_all("service", params=params) this returns entire host object embedded returned dict, want few fields. looked mogodb serves db alignak , in theory uses dot notation limit returned fields, using: params = { "projection": { "name": 1, "ls_last_check": 1, "host.name":1

reactjs - react-select: Do we need CSS as well just to display a normal select list? -

i have following code displays normal select list. working fine logically , able log when change happens. problem is, small box being displayed instead of text box adequate show options.and placeholder being displayed normal text. when click on placeholder, values being displayed. import select 'react-select; class selectlist extends component { onchange() { console.log("value changed"); } render() { var select = require('react-select'); var options = [ { value: 'one', label: 'india' }, { value: 'two', label: 'singapore' }, { value: 'three', label: 'iceland' } ]; return( <select name="select list" value="one" options={options} onchange={this.onchange.this(bind}} /> ); } do need css things here.

Calculating median - javascript -

Image
i've been trying calculate median still i've got mathematical issues guess couldn't correct median value , couldn't figure out why. here's code; class statscollector { constructor() { this.inputnumber = 0; this.average = 0; this.timeout = 19000; this.frequencies = new map(); (let of array(this.timeout).keys()) { this.frequencies.set(i, 0); } } pushvalue(responsetimems) { let req = responsetimems; if (req > this.timeout) { req = this.timeout; } this.average = (this.average * this.inputnumber + req) / (this.inputnumber + 1); console.log(responsetimems / 1000) let groupindex = math.floor(responsetimems / 1000); this.frequencies.set(groupindex, this.frequencies.get(groupindex) + 1); this.inputnumber += 1; } getmedian() { let medianelement = 0; if (this.inputnumber <= 0) {

python - Print decision tree and feature_importance when using BaggingClassifier -

obtaining decision tree , important features can easy when using decisiontreeclassifier in scikit learn. not able obtain none of them if , bagging function, e.g., baggingclassifier. since need fit model using baggingclassifier, can not return results (print trees (graphs), feature_importances_, ...) related decisiontreeclassifier. hier script: seed = 7 n_iterations = 199 dtc = decisiontreeclassifier(random_state=seed, max_depth=none, min_impurity_split= 0.2, min_samples_leaf=6, max_features=none, #if none, max_features=n_features. max_leaf_nodes=20, criterion='gini', splitter='best',