Posts

Showing posts from June, 2011

rpc - SOA Publishing Messages vs Calling Procedures -

the project working on moving n-tier soa architecture have been reading on soa practices. i'm struggling understand dynamic between avoiding rpc style services in favor of event driven services, , requirement of user interfaces retrieve data , speedily. so instance, ideally soa architecture composed of repeatable business process wherein publish message onto esb handle finding services handle message. rather executing procedure called "setup new user" set out tasks related new user setup, publish message esb contained new user's details , had appropriate document type "new user" , esb find services handled event whatever domain specific new user provisioning required. however, need data. maybe have page shows list of user associated data. can't fire off message esb because need data , need now. also, aren't triggering business processes; you're retrieving data invoked business processes (the processes caused user associated data instance)...

r - Applying the minimum date to the rest of a set of observations -

i have dataframe: zz <- "id created status snap zx1 2012-09-07 2013-01-01 zx1 2012-09-07 b 2013-01-02 zx1 2012-10-11 b 2013-01-03 zx1 2012-12-03 b 2013-01-04 zy2 2014-01-04 2013-01-01 zy2 2014-01-04 2013-01-04 zz3 2014-08-06 2013-01-01 zz3 2014-05-06 b 2013-01-03 zz3 2014-07-15 c 2013-01-04" df <- read.table(text=zz, header=t) where need pick , apply minimum created date each id . output: id created status snap zx1 2012-09-07 2013-01-01 zx1 2012-09-07 b 2013-01-02 zx1 2012-09-07 b 2013-01-03 zx1 2012-09-07 b 2013-01-04 zy2 2014-01-04 2013-01-01 zy2 2014-01-04 2013-01-04 zz3 2014-05-06 2013-01-01 zz3 2014-05-06 b 2013-01-03 zz3 2014-05-06 c 2013-01-04 example: zx1 "created" should 2012-09-07 observations. try library(dplyr) df %>% group_by(id) %>% mutate(created=min(as.date(created))) # id created status snap #1 zx1 2012-09-07 2013-01-01 #2 zx1...

javascript - listbox does not pass string to google script -

when select user listbox, onchange() event triggers function. should pass string function. code finds user's password , returns comparison. following code works fine if hard code user value, not when select listbox. function addclients(clients){ $('#customer').empty(); $('#customer').append('<option> ---- choose user ----</option>'); (var in clients) { $('#customer').append('<option>'+clients[i]+'</option>'); $('#customer').trigger("chosen:updated"); } } getval function: function getval(sel){ var usrpass = google.script.run.getuserpass(sel.value); alert(usrpass); } the function in code.gs follows function getuserpass(userval){ var usrpass = ""; var doc = spreadsheetapp.openbyid("spreadsheet id"); var sheet = doc.getactivesheet(); var data = sheet.getrange(3, 3, sheet.getlastrow(),5).getvalues();; for(n=0;n<data.length;++n...

PWM controll on digital pin 3 Arduino Due (C) -

i'm trying control fan on arduino due board arduinos own motor shield , have encountered problem. want send pwm signal fan, , here comes problem, pin 3 channel less.. what can find there no channel digital pin 3? the code works, have tested other pins , requested value when measure on multimeter. in due's datasheet there not single thing it. on motor shields webpage did find pin 3 1 use , on arduino uno works great. there way use digital pin 11, it's same here, no channel. does 1 have solution or answer way it's way?

exception - How can I print out entire String line to output file (java)? -

in assignment have work outputting list of names either valid output file or error file. need right scan text file input errors (for example, supposed int has letter in it, therefore throws exception). my program works fine in detecting these errors , print out valid information, problem outputting invalid information. example, when program detects invalid double input, prints part of line instead of entire line. i'm @ loss right , i'm wondering if can me? here program... import java.io.*; import java.util.*; public class taxdeductiondriver { public static void main(string[] args) { //array used store information , output net income employee[] info = new employee[71]; scanner input = null; printwriter output = null; int = 0; try { input = new scanner(new fileinputstream("payroll.txt")); output = new printwriter(new fileoutputstream("error.txt")); while(input.hasnextline()) { ...

python - Aggregate all codetags in a single file -

how aggregate code tags in single file. from main.py # todo: write function # bug: 'func asdf()' not work some.py # todo: define ports # bug: smth wrong to codetags.md # todo: write function # todo: define ports # bug: smth wrong # bug: code not wor at pep 350 - codetags found rotten link http://tracos.org/codetag progect. maybe there other projects

Python - How do I save/load specific cookies? -

i have following python code supposed log website using .roblosecurity cookie. includes except ioerror: function if .roblosecurity cookie doesn't log in, use username/password log in , save cookies gets that. import urllib2 import urllib import cookielib try: cookielib.lwpcookiejar().load("cookies.txt") #trying load cookie file except ioerror: #in case cookies.txt fails log in. don't know if ioerror correct error specification expired cookie print "loading stored cookies failed, manually logging in..." cj = cookielib.lwpcookiejar() opener = urllib2.build_opener(urllib2.httpcookieprocessor(cj)) opener.addheaders = [('user-agent', 'mozilla/5.0')] urllib2.install_opener(opener) authentication_url = 'https://www.roblox.com/newlogin' payload = { 'username' : 'usernamehere', 'password' : 'passwordhere', '' : 'log in', } ...

c++ - 8-digit BCD check -

i've 8-digit bcd number , need check out see if valid bcd number. how can programmatically (c/c++) make this? ex: 0x12345678 valid, 0x00f00abc isn't. thanks in advance! you need check each 4-bit quantity make sure it's less 10. efficiency want work on many bits can @ single time. here break digits apart leave 0 between each one, add 6 each , check overflow. uint32_t highs = (value & 0xf0f0f0f0) >> 4; uint32_t lows = value & 0x0f0f0f0f; bool invalid = (((highs + 0x06060606) | (lows + 0x06060606)) & 0xf0f0f0f0) != 0; edit: can better. doesn't take 4 bits detect overflow, 1. if divide digits 2, frees bit , can check digits @ once. uint32_t halfdigits = (value >> 1) & 0x77777777; bool invalid = ((halfdigits + 0x33333333) & 0x88888888) != 0;

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

i'm experimenting node , socks5-https-client . reason, tor hidden service ( .onion ) sites return connection error. for example, connecting duckduckgo ( 3g2upl4pq6kufc4m.onion ) works , returns html. however, connecting pirate bay ( uj3wazyk5u4hnvtk.onion ) or torch ( xmh57jrzrnw6insl.onion ) returns... error: socks connection failed. connection not allowed ruleset. what error mean? how can avoid it? here's code reproduce it: var shttps = require('socks5-https-client'); shttps.get({ hostname: '3g2upl4pq6kufc4m.onion', path: '', sockshost: '127.0.0.1', socksport: 9150, rejectunauthorized: false }, function(res) { res.setencoding('utf8'); res.on('readable', function() { console.log(res.read()); // log response console. }); }); the error seems caused 0x02 value in field 2 of server response. in summary the servers you're failing access don't support ...

Programmatically mirror screen from android device to TV -

my samsung device running kitkat(19) has "screen mirroring" option finds , syncs nearby compatible displays. implement feature programatically. i have experimented both mediaroute , displaymanager classes. both succeed in detecting nearby displays, after manually turn on screen mirroring. them detect displays automatically. there i'm missing initiate scan or kick wifidisplaycontroller gear? here implementation of mediarouter: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); handler = new handler(); output = (textview) findviewbyid(r.id.output); mmediarouter = mediarouter.getinstance(this); mselector = new mediarouteselector.builder() .addcontrolcategory(mediacontrolintent.category_live_video) .addcontrolcategory(mediacontrolintent.category_remote_playback) .build(); } @override public void onresume() { super.onresume(); m...

php - Yii2: Custom Validation on Dates based on two models -

i having 2 models namely patient admission having 2 columns such admission_date , discharge_date , model daily_ward_entry having date field date both models related ipd_patient_id now want create 1 or 2 validators, can restrict date entry in daily_ward_entry between admission_date , discharge_date i had @ compare validator , can't make out, how replace value compared attribute model relation. i have tried following variations, throwing error: variation one [$this->discharge_date, 'compare', 'comparevalue' => $this->admission_date, 'operator' => '>='], error - unknown property – yii\base\unknownpropertyexception variation two ['discharge_date', 'compare', 'comparevalue' => 'admission_date', 'operator' => '>='], error - discharge date must greater or equal "admission_date". error generated irrespective of date lower or greater variation ...

dart - Cancel stdin subscription in combination with LineSplitter -

i use linesplitter command line interface every line command: import "dart:io"; import 'dart:convert'; void main() { var sub; sub = stdin.transform(utf8.decoder).transform(new linesplitter()).listen((l) { if (l == "e") { sub.cancel(); } print('$l'); }); } typing e , line break should exit application subscribtion canceled. doesn't happen, instead have put line break stdin. problem seems linesplitter , maybe it's waiting next complete line, there way "undo"/"unchain" transformer application exits? calling exit not option me exits without correct cleanup. i think this question related, isn't solved. this issue io library in dart sdk on windows , bug should fixed (see https://github.com/dart-lang/sdk/issues/22940 )

geting values from arrays in php -

i have following code: stdclass object ( [orders] => array ( [0] => stdclass object ( [shipping_address] => stdclass object ( [first_name] => john [last_name] => doe [company] => [address_1] => 3927 walnut grove [address_2] => [city] => rosemead [state] => ca [postcode] => 90001 [country] => ) ) [1] => stdclass object ( [shipping_address] => stdclass object ( [first_name] => chris [last_name] => koh [company] => [address_1] => 745 bow [address_2] => [city] => diamond [state] => ca [postcode] => 90015[country] => ) ) ) ) how extract first_name both elements? john , chris the "array" mishmash of arrays , objects, objects accessed differently. array values accessed by $an_array = array('apple','banana'); $an_array[0]; //will return apple while object values area accessed by $an_object->key; take @ return object stdclass object ( //<-- object [orders] => ...

javascript - I want to get an attribute from the textarea that uses the onkeypress event -

i have following code: <div> <form name="comentario" id="<?php echo $id?>" action="funcion_enviar_comentario.php" method="post"> <input hidden="hidden" type="text" id="inputid" name="inputid" value="<?php echo $id?>"> <textarea class=estilotextarea1 id="comentario<?php echo $id?>" onkeypress="process1(event,this)" name="<?php echo $id?>" placeholder="introduce tu comentario aquí..."></textarea> <script> function process1(e) { //var ide= document.getelementbyid("comentario <?php echo $id?>").name; //var submit= document.getelementbyid("enviado<?php echo $id?>"). var code = (e.keycode ? e.keycode : e.which); if (code == 13) { $('form#comentario<...

python - Outputting dictionary results for all indexes -

i'm bit new python, please bare me. i'm trying output keys, indexes, e.g: print results["result"][0]["name"] prints out first key no problems, , [1], [2], etc. want able print indexes, value "name". i'm sure uses loop, , tried several methods, have failed. how can print results indexes, not 1? assuming results['result'] is a list , use for loop iterate on items in list: for item in results['result']: print(item['name'])

task on java.util concurrent. Multithreading problems with polling from BlockingQueue -

i've received task java.util.concurrent package of java. i've made totally, there bug or mistake. when queue empty , operator waits 5 seconds method poll should retrieve null , pass operator , operator goes home. doesn't happen. retrieves null doesn't pass operator. sorry english.) public class client extends thread { public countdownlatch latch=new countdownlatch(1); private boolean waiting; private final random random=new random(); public boolean iswaiting() { return waiting; } public void setwaiting(boolean iswaiting) { this.waiting = iswaiting; } private static final logger logger; static { logger = logger.getlogger(client.class); new domconfigurator().doconfigure("log4j.xml", logmanager.getloggerrepository()); logger.setlevel(level.info); } private int limittime=new random().nextint(5000); public void run(){ clientqueue.enqueueclient(this); while(waiting){ if (random.nextboolean()){ ...

android - Are indexes using COLLATE LOCALIZED automatically rebuilt on locale change? -

when android locale changed, sqlite indices using collate localized have reindex ed explicitly or happen automatically? sqlite has no mechanism detect changes in definition of collation sequence. have execute reindex manually.

I'm having issues with my Terminal -

i'm having issues trying open atom in terminal. know can open manually i'm trying figure out issue. this i'm getting when try open atom in terminal. cannot locate atom.app, located in /applications. set atom_path environment variable directory containing atom.app. anyone have idea issue is??? lets fixed you. the error you're getting indicating atom isn't located should be, applications folder. open applications , confirm isn't there. if isn't, locate atom on computer , drag applications folder. if have atom , terminal both open, restart them. try opening atom terminal.

servlets - java.lang.ClassNotFoundException: org.jivesoftware.smack.SmackException$NotConnectedException Smack -

smack not working servlet. however, works fine when copy-paste code , run desktop application. error occurs @ chatserver.java:42 here's code: servlet (chatserver.java): import java.io.ioexception; import java.io.printwriter; import java.util.arraylist; import java.util.collection; import java.util.hashmap; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import org.jivesoftware.smack.rosterentry; /** * servlet implementation class chatserver */ @webservlet("/chatserver") public class chatserver extends httpservlet { private static final long serialversionuid = 1l; /** * default constructor. */ public chatserver() { // todo auto-generated constructor stub } /** * @see httpservlet#doget(httpservletrequest request, httpservletresponse response) */ ...

Android Fragment created twice orientation change -

my fragment being created twice, though activity adding fragment once content. happens when rotate screen. also, everytime fragment's oncreateview called, has lost of it's variable state. public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); if (savedinstancestate == null) { // checking recreation getsupportfragmentmanager().begintransaction() .add(r.id.container, new apppanelfragment()) .commit(); } } } oncreate in activity checks null savedinstancestate , if null add fragment can't see why fragment should created twice? putting breakpoint in if condition tells me ever get's called once activity shouldn't adding fragment multiple times. oncreateview of fragment still gets called each time orientation changes. publi...

javascript - Google Calendar API - Request URL 404 Not Found -

i trying events calendar using google api: <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="googlecalendar.js"></script> <script src="https://apis.google.com/js/client.js?onload=handleclientload"></script> </head> <body> <div id="calendarcontainer"> <div> <button type="button" id="authorize-button"><?= _("google calendar events"); ?></button> </div> <div id="content"> <h2><?= _("events"); ?></h2><br> <ul id="events"></ul> </div> </div> </body> </html> googlecalendar.js: $(documen...

sql - Single Column as N Rows -

this question has answer here: efficiently convert rows columns in sql server 3 answers i have large table 3 columns follows: invoice product color 1 pant red 1 pant black 1 shirt green 2 pant white 2 pant black 2 pant blue i'd group on invoice & product , have unique color values appear on related grouped record follows: invoice product colour1 colour2 colour3 1 pant red black 1 shirt green 2 pant white black blue is possible in sql server? it possible in sql server -- if know there 3 color columns. if there variable number, still possible, requires dynamic sql. i approach using conditional aggregation: select invoice, product, max(case when seqnum = 1 colour end) colour1, m...

Ruby, adding methods to a Module, Class or Object -

i noticed odd while adding methods kernel make them available globally. it's interesting, , i'm looking documentation or explanation. let's @ code: file: ./demo.rb # example 1 module kernel def foo puts "i'm defined inside module!" end end # example 2 module bar def bar puts "i'm included! (bar)" end end kernel.send :include, bar # example 3 module baz def baz puts "i'm included! (baz)" end end module kernel include baz end then, in bash , irb $ irb -r ./demo.rb > foo # i'm defined inside module! > bar # nameerror: undefined local variable or method `bar' main:object > baz # nameerror: undefined local variable or method `baz' main:object > > self.class.ancestors # => [object, kernel, basicobject] > > include kernel > > self.class.ancestors # => [object, kernel, baz, bar, basicobject] > > foo # i'm defined inside module! > bar...

css - background image wont show in most recent version of ie -

body { background-position: right; color: #ff7f27; background-color: transparent; background-image url('../cityage_background3.png'); background-size: 1386px 861px; background-repeat: no-repeat; background-attachment: fixed; } the link n example. know real link works because show in cchrome , firefox. why isnt background image showing in internet explorer. your error here: background-image url('../cityage_background3.png'); it should be: background-image: url('../cityage_background3.png'); you missing : edit* ie not errors.

Identity 2.0 Web Api, iOS and Android Clients Facebook app approval always rejected -

here our setup: 1) web api project asp.net identity 2.0 external login support facebook. 2)a native ios app , native android app we using appid , secret in web api , identity facebook authorization options. , using web views login process facebook. however, also, after user authenticated, allowing them share different pieces of application facebook. currently, website shows scope of publish_actions, user_videos , user_photos. facebook telling custom web views not okay, , have use native sdk's on of them. what's purpose of identity providing ability utilize getting external accounts , access tokens if can't use them on mobile app? of our code sharing process happens on actual controllers in web api project. display popup allows user enter text gets posted, facebook describes. how can submit facebook app explain them website actual application utilizes facebook actions requesting? is possible? if not, why technology available allow external logins via api...

javascript - How this site shows a neat HTML box before you leave -

on site: http://shirtjs.com/product-category/collections/zeptojs/ when move cursor out of html page (about go close tab) show "wait before leave!" modal centered div. tldr: this doesn't occur if 'leave' html page through sides or bottom of browser window. is common js library, custom made, ... there's 2,000,000 libraries loaded on site! haven't been able trace js code bottom of this. any idea how it? found it: ouibounce lib. https://github.com/carlsednaoui/ouibounce thanks efforts :)

javascript - How to do .click() on added class in JQuery? -

i trying create simple edit function on button. when user clicks the edit button (containing following classes btn btn-primary btn-edit change-btn ), text change "save", readonly attributes removed on input elements, , have class btn-success save-btn @ same time removing edit-btn btn-primary class. when user clicks button again, update , save data. although removes , changes classes, save-btn function wont work simple "hello" alert. here code: $(document).ready( function() { $('.save-btn').click(function () { alert('hello'); }); $('.edit-btn').click(function () { $('.change-btn').removeclass('btn-primary edit-btn').addclass('btn-success save-btn').text('save'); $('#firstname, #lastname').removeattr('readonly'); }); }); is there wrong of execution of javascript/jquery here? it doesn't work because when adding save-btn click h...

ruby on rails 4 - Handle dependent destroy via active jobs -

i have couple models many children. dependent destroy has gotten heavy. know of way tie dependent destroy active jobs? or, option remove dependent destroy , role own jobs via callbacks on parent model? you can create worker destroy models async , enqueue it's deletion. like: class complexmodeldeletion < activejob::base def perform(model) model.destroy! end end and model like: class model < activerecord::base def destroy_later complexmodeldeletion.enqueue(self) end end then, whenever need kill instance of model, call model#destroy_later enqueue it. mark object deleted before enqueuing prevent being retrieve db before killed. not sure if work as is , give idea of do.

core ajax into polymer element dont do the response function -

dont response handler function, dont know why outside paper elemet, using document.getelemetbyid(), respnser, when put paper element, dont anything. here code: <link rel="import" href="bower_components/polymer/polymer.html"> <link rel="import" href="bower_components/core-ajax/core-ajax.html"> <polymer-element name="post-service" attributes="posts"> <template> <style> :host { display: none; } </style> <core-ajax auto url="http://yami-no-seire.hol.es/blog/api/get_recent_posts/" on-core-response="{{postsloaded}}" handleas="json"> </core-ajax> </template> <script> polymer({ created: function () { this.posts = []; }, /*ajax success callback method*/ postsloaded: function() { console.log("ok"); var respuesta = t...

c# - Can I verify if a class is correctly created? -

i know may stupid question, new in programming world there's lot of stuff don't understand or don't know how do. i'm starting learn little bit c#, , i'm trying create class, far think i'm good, there's no way 'check' if did well... when create solution in xamarin studio on osx, press cmd+enter , solution compile , you'll see result of code wrote, don't know if there's kind of procedure or kind of tip check if class created ok. so code compiles, work seems asking. it sounds looking unit testing. go read on , test-driven development. for small summary, decide in advance of output of object should be, , write tests check output correct under reasonable inputs. code class against test. finally, test it. , then, every time change code, (to add feature or fix bug), run same unit tests, possibly new additions, , verify still pass. the quality of tests limiting factor in quality of code, learn how write tests when code unexpe...

c# - ASP.Net Model to Javascript - Passing Data from server to client -

hey guys quick question best approach on converting model javascript. i tried using @{ var arr = new string[3]; arr[0] = "1"; arr[1] = "2"; arr[2] = "3"; var jason = jsonconvert.serializeobject(model); } <script type="text/javascript"> var string = '@jason'; var variable2 = jquery.parsejson(string); alert(variable2.id); </script> as can guess did not work, through sample of jquery should work not sure if compatible jsonconvert of .net its first time on programming in client side quite simple question tried looking answer net. see uber complicated answers , @ least 3 , higher old guessing there should easier way now?

objective c - Set Autolayout Constraints Relative to Device Size -

i fell trap of relying on autolayout. have viewcontroller ton of uiviews , realized they're distorted on smaller devices (iphone 4s , 5). is possible set constraints in autolayout relative device size. for example, have 1 uiview several other uiviews aligned edges. change height in autolayout of 1 uiview equal half device height. yes. there way constrain screen size. they called size classes . in interface builder on bar @ bottom of screen says wany hany , pulldowns. select combination of height , width of device , orientation want constrain to, , when create constraints in mode, they'll specific size/orientation. can add , modify size-specific constraints in inspector, constraint editor pane, in interface builder. if need tweak corner case things aren't able accomplish conveniently enough size clases, can make iboutlet constraint , refer in code, , modify when view appears , changes, similar following example. easier , safer trying generate cons...

javascript - Python causing server error when trying to save new JSON file -

i'm new python, let me know if there's glaring mistakes. i've created simple webpage uses ajax, reads server's xml response, , displays on page. i'm using python script send xml response, it's building json file, , it's working perfectly. but problem occurs when add code python script modifies json prior sending xml response. here code causes problem: with open("../../../var/www/data.json", "r+") jsonfile: data = json.load(jsonfile) data[0]["a"] = "2" jsonfile.seek(0) # rewind jsonfile.write(json.dumps(data)) jsonfile.truncate() when code put python file, error in browser console when ajax sends post request: failed load resource: server responded status of 500 (internal server error) but funny thing is, though prevents server responding properly, correctly update json file. why writing json file cause server not respond post request? here javascript function sends post requ...

javascript - Using callback to get image pixel data -

i relatively new javascript. concept of callbacks confusing me bit coming oop background i trying create hidden canvas image object , pixel data. i have imageobject on want store properties image, pixels , on.. inside start() , first references maincanvas , mainctx. load image , once image drawn, store pixel data in imageobject.pixels however inside start(), code runs asynchronously , log statement display imageobject.pixels return null how use callbacks solve this? below code imageobject = {}; var mainctx; var maincanvas; //get image pixel properties function start() { maincanvas = document.getelementbyid("canvas"); mainctx = maincanvas.getcontext('2d'); imageobject.image = loadimage(); console.log(" image pixels " +imageobject.pixels); // -> displays null because code runs asynchronously, how use callback here avoid this? } function loadimage() { var image = new image(); image.src = 'image.jpg'; ima...

jquery - javascript API call results in old data -

i have weather web api,which need show weather report of current city in website.whenever code calls in api, results in old data.data never changes , when run web api url on browser results want. please me reason cached data. webapi http://api.openweathermap.org/data/2.5/weather?lat=26.894049&lon=80.942686&mode=json my code $.getjson('http://api.openweathermap.org/data/2.5/weather?lat=' + lat + '&lon=' + lon + 'mode=json&rand=' + math.random(), function (data) { var wind = {}; var temp = {}; wind = data.wind; temp = data.weather; var clouds = '%' + data.clouds.all; var description = data.weather[0].description; var temp = data.main.temp - 273.15; var humidity = data.main.humidity + '%'; var icon = data.weather[0].icon; weatherimg = "<img height=\"45\" width=\"45\" style=\"border: medium none; width: 45px; height: 45px;position:relative;top:-10px;...

c# - The model backing the <Mydb> context has changed since the database was created -

Image
hello every one i new in .net mvc3 have made connection string in web.config file, connection created. below connection code <add name="storedb" connectionstring="data source=amit-pc;initial catalog=store;user id=sa;password=****;integrated security=false" providername="system.data.sqlclient" /> after created dbconfig.cs class file database table connection below code public class store : dbcontext { public store() { } public dbset<registermodel> myapp { get; set; } public dbset<application> applicationformmodels { get; set; } } there 2 model have created. first registermodel , seconds application model. when run code error occured the model backing context has changed since database created. when use 1 dbset<registermodel> table created , curd operation done error occured when create more 1 dbset . below screenshots looking forward inputs...

sql server - C# Entity Framework: Mapping select results to list of objects -

let's have list of student objects , want find tuition. tuition in database , key student id. want map tuition student objects after. have class student{ int id; string name; double gpa; double tuition; } example database tuple |id | tuition | schoolname| student name| list<double> gettuitionsbyid(list<student> students) { var ids = students.select(x => x.id).tolist(); var query = dbstudent in _context.studentsdb ids.contains(dbstudent.id) select dbstudent.tuition; var tuitions = query.tolist(); return tuitions; } i hoping loop through tuitions , map students list, select query doesn't return prices in same order. how can map tuitions db student objects? when have no ordering in database query results coming database not guaranteed in specific order. return results in order passed in need return id database data can mapped initial list , ...

ios - UITableView navigation on row selection -

well have designed iphone setting in tableview.there 40 setting.so there 40 cells in 8 sections.so there different view controller row.what want navigate corresponding view controller of row without using if-else,switch condition using indexpath.row or indexpath.section.means don't want manipulate rows , sections.thanks in advance. you can below. i assuming using segue push different controllers now suppose have 1 array containing 40 dictionary said. each dictionary contains name. so structure below yourmutablearray [0] dictionary "name" : "value" in same dictionary can add 1 more key , value key "seguename" , value identifier of segue. so structure below yourmutablearray [0] dictionary "name" : "value" "seguename" : "pushtosecondview" now can write in tableview's didselectrowatindexpath nsdictionary *selectedrowdata = [yourmutablearray objectatindex:indexpath.row]...

Hadoop: Getting error when i load file from source (i.e my PC) to HDFS -

im trying copy file source hdfs query: hadoop fs -copyfromlocal (local path) (source path) e.g hadoop fs -copyfromlocal c:\users\desktop (source path) as e.g hadoop fs -copyfromlocal c:\users\desktop uri but geting error -copyfromlocal: can not create path null string usage: hadoop fs [generic options] -copyfromlocal [-f] [-p] (localsrc) ... (dst) try hadoop dfs -copyfromlocal file_to_be_copied hdfs://namenode:/path_to_location fs command being depreciated. note: not have mention actual hdfs path. hadoop dfs -copyfromlocal file_to_be_copied /path_to_location_within_hdfs

What is difference between initialized variable and a literal in java? -

i learning java, while studying literals in java found literals can of datatype (int,boolean,char,etc.) , declared int decval = 26; //am declaring literal correctly? as far know, literal fixed value , above declaration similar initialization of variable of 'int' type. confirm, tried following code. public class literalchecking { public static void main(string[] args) { int i=2; for(i=2;i<5;i++) { system.out.println("i= "+i); } } } where, got output as: i=2 i=3 i=4 now confused between literal , initialization, both same? can 1 explain me difference? am declaring literal correctly? no, you're not declaring literal. you're declaring , initializing variable called decval . 26 integer literal. i confused between literal , initialization a literal value in program code. examples of literals include "hello" -- string literal true -- boolean literal 26...

matlab - How to eliminate series of values with so much variation -

i got dataset (azimuth vs time) measure compass of object trough time. can see when object moving (the compass vary much), , when it's static, without moving (compass not vary). question how program in matlab in order eliminate data show object moving , filter data shows object static. for example: azimuth (angle) | 30 30 30 15 10 16 19 24 24 24 17 14 12 15 16 time (s) | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 the output be: azimuth (angle) | 30 30 30 24 24 24 time (s) | 1 2 3 8 9 10 s=diff(azumuth)==0 %diff skip values @ t=1 , t=8. modify include them well: s=[s(1),s(2:end)|s(1:end-1),s(end)] azumuth(s) time(s)

How do I trap an error when OneDrive image renders file.OpenAsync error -

in project try give users option select images personal libraries. nothing special such. this goes when user selects desired image local imagelibrary. when images selected onedrive, error occurs, , i'm not able trap error. source of error seems in file.openasync method. it seems there may relation size of selected image, cannot tell, i'm not able catch error. here's codesnippet (it's taken xaml image sdk samples in fact) dim picker new fileopenpicker {.viewmode = pickerviewmode.thumbnail, .suggestedstartlocation = pickerlocationid.pictureslibrary} 'picker.suggestedstartlocation = pickerlocationid.pictureslibrary picker.filetypefilter.add(".png") picker.filetypefilter.add(".jpeg") picker.filetypefilter.add(".jpg") picker.filetypefilter.add(".bmp") dim wbitmap new writablebitmap(200,200) dim file storagefile = await picker.picksinglefileasync() ...

vb.net - System.IO.IOException: The process cannot access the file -

hi programmers colleagues! hope know how solve issue. time time not error in subject when writing log file. got 3 windows services in solution. using same file logs. unfortunetly time time error. code logger showed below. used synlock , thought enough not. can me should change avoid issue please?: public notinheritable class logger private shared readonly _locker new object() public shared sub logit(byval engine string, byval msg string, byval logmessage string, byval path string, byval isdebug boolean) if file.exists(path) if isdebug debug.print(datetime.now & "> " & "| " & engine & " | " & msg & " | " & logmessage) ' debug.print(message) else synclock _locker using w textwriter = file.appendtext(path) 'w.writeline(message) ...

text - Is it possible to view UTF-8 Characters in DOS programs -

i using hiew32 find arabic sentences inside exe file before launching hiew32.exe tried lucida console font , : chcp 65001 but result same; there method view utf-8 chars in dos mode ? consider using hiew32 > file.txt, , open file in notepad. or, consider using powershell.exe , start command there. powershell_ise.exe have better arabic support

dockerfile - Add a volume to Docker, but exclude a sub-folder -

supposed have docker container , folder on host /hostfolder . if want add folder docker container volume, can either using add in dockerfile or mounting volume. so far, good. now /hostfolder contains sub-folder, /hostfolder/subfolder . i want mount /hostfolder docker container (whether read-write or read-only not matter, works both me), not want have included /hostfolder/subfolder . want exclude this, , want docker container able make changes sub-folder, without consequence of having changed on host well. is possible? if so, how? if want have subdirectories ignored docker-compose persistent, can following in docker-compose.yml : volumes: node_modules: services: server: volumes: - .:/app - node_modules:/app/node_modules this mount current directory shared volume, mount persistent docker volume in place of local node_modules directory. similar answer @kernix, allow node_modules persist between docker-compose up runs, desired behavior....

integer - What happens after 2038-1-19? -

starting epoch time 1 january 1970 00:00:00 and counting limit 32-bit signed integer can reach, day when reach limit of counting time (in computer, of course) 2038-1-19, given in answer matt howells. a 32-bit signed integer using 1970-1-1 epoch can represent dates 2038-1-19, on date wrap around 1901-12-13 if wraps around date, solution count time forward instead of wrapping date? given in wikipedia there no universal solution year 2038 problem. i don't feel comfortable this! there must thought solution problem. understand cause not using 64-bit integer in first place (which give 292 billion years relax!): not many machines (could any?) handle 64-bit integers time. , switching 64-bit integer now has own problems. solution this?

c# - Query a Datagridview.Rows or Dataset using Linq -

i have problem. since i'm not experienced linq couldn't figure out how query datagridview (or directly dataset preferably) , show results on datagridview. this fill full datagridview , dataset: string icerikquery = "select * [rrselfservis].[dbo].[talimaticerikler] order [kod] asc, [percent] desc"; //messagebox.show(icerikquery); sqldataadapter icerikadapter = new sqldataadapter(icerikquery, connection); dataset icerikset = new dataset(); icerikadapter.fill(icerikset, "test_table_icerik"); datagridview2.datasource = icerikset; datagridview2.datamember = "test_table_icerik"; and here query part: datagridview4.datasource = datagridviewrow in datagridview2.rows rowview.row.field<string>("kod").value.tostring() == somesearchstringvariable orderby rowview.row.field<decimal>("percent") descending select row; but i'm ...