Posts

Showing posts from September, 2012

What is the "prototype" linkage for Objects created via the Object Literal Notation in JavaScript? -

my first post on stack overflow , complete newbie here , still getting used rules / annotations followed on forum , please excuse aspiring "developer" ;-) while reading through crockford's " good parts ", came across line said: every object linked prototype object can inherit properties. objects created object literals linked object.prototype, object comes standard javascript. so test out wrote following jscript code: var student = {} console.log(student.isprototypeof(object.prototype)) note: i executing via browser console , hence function - console.log(...) . i guessing way student variable declared here using " object literal notation ". isn't correct ? so second line - console.log(student.isprototypeof(object.prototype)) returned false instead of true . shouldn't display true instead of false ? well doesn't contradict lines book mentioned above ? so here snippet in action - var student = {}; a

ios - How to read the height and weight data that we enter in the health app to our custom app -

how read height , weight data values enter in health app our custom app? 1. request healthkit authorization: - (void)checkhealthstoreauthorization { if ([hkhealthstore ishealthdataavailable]) { nsset *readdatatypes = [self datatypestoread]; if (!self.healthstore) { self.healthstore = [[hkhealthstore alloc] init]; } static nsinteger = 0; (hkobjecttype * quantitytype in readdatatypes) { if ([self.healthstore authorizationstatusfortype:quantitytype] == hkauthorizationstatusnotdetermined) { [self.healthstore requestauthorizationtosharetypes:nil readtypes:readdatatypes completion:^(bool success, nserror *error) { i++; if (!success) { if (error) { nslog(@"requestauthorizationtosharetypes error: %@", error); } return; } else {

python - Are there any standards (even IDE-specific) to refer a certain object from inside a comment string? -

in java, in eclipse @ least, there way refer class, inside code documentation. cool, if 1 refactored class (changed name or moved in other package), comment refactored. i'm using pycharm, , i'd know if can same thing there. for example: def myfunction(): """does interesting class mypackage.myclass. see yourpackage.yourclass """ pass i'd ide recognize myclass , yourclass specified classes "are". i know how type annotations so: def myfunc(myarg): """ :type myarg: classinthismodule :rtype: int """ return 3 but not sufficient. want give examples in documentation, , link other areas in code might interesting (classes, functions, modules, etc), , want ide recognize these things, , refactor them intelligently in case that's needed. is possible? or need write plugin if wanted this.

floating point - Why do I see a double variable initialized to some value like 21.4 as 21.399999618530273? -

double r = 11.631; double theta = 21.4; in debugger, these shown 11.631000000000000 , 21.399999618530273 . how can avoid this? these accuracy problems due internal representation of floating point numbers , there's not can avoid it. by way, printing these values @ run-time still leads correct results, @ least using modern c++ compilers. operations, isn't of issue.

email - Responsive e-mail: turn table cells (td) to (cleared) blocks -

i have basic example should display these 3 table cells blocks (underneath each other) on mobile devices. yet doesn't seem work out on ipad, iphone, nor on samsung phone. does work on regular browsers , websites simulate mobile display (for web pages probably), when viewing on actual mail clients of mobile devices, display: block property seems ignored. is there that's missing? or if display -attribute isn't supported @ all, alternative? <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <meta charset="utf-8"> <title>mobilize me</title> <style type="text/css"> @media screen , (max-width: 1400px) { table,tr,td{ width: 100% !important; display: block !important; clear: both !important; } } </sty

express - Node.js middleware authentication with variable -

before route , render website want check if user authenticated , of type. "middleware" looks this: function isauthenticated(req,res,next,required_type){ if(parse.user.current()){ parse.user.current().fetch().then(function(fetcheduser){ var type = fetcheduser.get("type"); if(type == required_type){ return next(); }else{ res.redirect("/login"); } }, function(error){ res.redirect("/login"); }); }else{ res.redirect("/login"); } } this part seems fair , easy enough. here how try use middleware before route: app.get('/dashboard_client',isauthenticated, dashboard_client_view_controller.displayview); my questions is, how set required_type variable, since node.js somehow know how , find req,res , next variables. thank answering such stupidly , guess obvious solve question. you try approach: //middleware: function isauthen

r - Subset data.frame based on a column that matches a separate vector -

this question has answer here: filtering data.frame 5 answers once again stumped here. i have data.frame of 4 columns: col1 col2 col3 col4 1 1.lsm 0.43 0.34 2 1.lsm 0.47 0.30 3 1.lsm 0.27 0.85 1 2.lsm 0.35 0.55 2 2.lsm 0.71 0.46 3 2.lsm 0.53 0.37 4 2.lsm 0.63 0.34 col1 cell number cells have been tracked on time. i have vector containing integers pertaining cells want keep: keep=c(3, 4) now, want use vector "keep" decide rows of data.frame kept , output new data.frame columns keep relevant rows. i.e. ideal output here be: col1 col2 col3 col4 3 1.lsm 0.27 0.85 3 2.lsm 0.53 0.37 4 2.lsm 0.63 0.34 you can try df[df$col1 %in% keep, ] #

java - Collections in POJOs -

i generating pojos database using different tools , noticed generate collections fields, getters , setters, 1 many relationships , others didn't. let's have order , product table. each order can have 1 or many products. collection<product> list = new arraylist<>(); list.add(product1); list.add(product2); method 1: order order = new order(); order.setdate(...); orderdao.add(order); orderdao.addproductbatch(list) method 2: order order = new order(); order.setdate(...); order.setproductcollection(list); orderdao.add(order); and in add method, include addproductbatch call. which method prefered? 1 many relationships adding multiple objects in single transaction never occurs - in case wouldn't need of these collections - correct? it depends on implementation of dao... in method 2, build order , products in business model, pass complete , consistent order (order + list of products) saved dao. transaction implementation internal dao. in

ios - poptorootviewcontroller and dismiss to mainViewController -

i new ios . question is, have view-controllers navigationcontroller,mainvc, vc1, vc2, vc3, cameravc. in cameravc have done button having action doneclicked. these view-controller pushed in navigationcontroller. vc1 presented, not pushed in nav-controller. doneclicked function implemented poptorootviewcontroller. when click on done button let me vc1 not mainvc. there way can pop view controller vc1 , after automatically dismiss vc1 mainvc. make mainvc root view controller , in ibaction of done button use code pop mainvc. [self.navigationcontroller poptorootviewcontrolleranimated:yes]; hope helps.

watch os 2 - WatchKit: setTitle delay? -

when push new controller in watchkit , use settitle in new controllers' awakewithcontext: method takes second or set title, stays blank until then. when set title in storyboard appears instantly. am missing or expected behavior? that's correct. if set title in storyboard, watch reads value directly resources saved on device. if set in code, watch need run request extension (which runs on iphone) , it'll receive value , display it. if title of controller static, should directly add storyboard.

ios - Convert all values of Container into NSString -

i have problem communicate server. webserver expects parameters in json object string. every number , every boolean in every container needs string. for example have nsdictionary full of key values (values kinds of types - numbers, arrays etc.). example: { "anexamplenumber":7e062fa, "anexampleboolean":0, "anexamplearrayofnumber":[17,4,8] } has become: { "anexamplenumber":"7e062fa", "anexampleboolean":"0", "anexamplearrayofnumber":["17","4","8"] } i tried standard nsjsonserializer doesn't give me option need. tried transform in dictionary manually string seems overhead. have hint me? maybe serializer or function convert objects in container strings? (i assume mean nsjsonserializer , not nsserializer .) i doubt you'll find pre-rolled solution this. it's not general problem. note, incorrect json, json serializers shouldn't it. the best

javascript - SuccessCallback firing immediately in Xrm.Page.data.save -

i writing javascript code change form of entity in dynamics crm based on value of field on each form. to change form, user has change value of field. during onchange event, js comes in, triggers saving, has wait result , change form. (if save , change @ same time, there still window shown asking user confirm leaving unsaved changes) now there should way that: xrm.page.data.save(saveoptions).then(successcallback, errorcallback) as described on msdn : saves record asynchronously option set callback functions executed after save operation completed. i using such: var campaigntype = xrm.page.getattribute('typecode').getvalue(); if (xxx.forms.hasownproperty(campaigntype)) { xrm.page.data.save().then(function () { xxx.redirecttoform(xxx.forms[campaigntype]); }, null); but form change still triggered during save. what doing wrong? i faced similar problem while trying update process bar. xrm.page.data.save().then (function () {

iOS Trying to call web service and I'm getting a NSURLErrorDomain error -

i'm trying connect web service if hit through safari json, when hit through code nsurlerrordomain error following description. "the certificate server invalid. might connecting server pretending "url" could..." here code: nsurl *url = [nsurl urlwithstring:@"webservice_url"]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url]; [request sethttpmethod:@"get"]; nserror *error = nil; nshttpurlresponse *responsecode = nil; nsdata *oresponsedata = [nsurlconnection sendsynchronousrequest:request returningresponse:&responsecode error:&error]; can explain how around this? also, https web service. the website doesn't have https certificate. try looking this: https://stackoverflow.com/a/15011030/4716039

ember.js - Subscribe to DOM events within Ember app -

i've got ember cli based blog. resize <img> inside posts upon clicking them using function inside application-controller. i rely on on('init') , ember.run.later , feels dirty. how can improve subscription code below? import ember 'ember'; export default ember.arraycontroller.extend({ imagescaling: function() { ember.run.later((function() { //subscribe actual event ember.$(".post-content img").on("click", function(){ // resize here }) }), 3000) }.on('init') }); if you're inserting of images inside ember templates, can use action helper: <img {{action 'scaleimages' on='click'}} src='' /> i realize that's not case though. way i've dealt dom interactions in past override application view set , tear down event handler there. can avoid ember.run.later call modifying jquery event listener. here's how it: // app/views/applicat

plsql - Anonymous PL/SQL block checked exception -

i'm trying catch exception within anonymous pl/sql block declare ... begin herstell_row in ( ... ) loop ... declare table_does_not_exists exception; pragma exception_init( table_does_not_exists, -942 ); begin insert smart_monitoring_machine_nav_b ( machine, navigation_level_id ) select old_binding.machine, pv_id smart_machine_nav_binding old_binding old_binding.navigation_level_id = herstell_row.hename1; exception when table_does_not_exists null; end; end loop; end; i know table smart_machine_nav_binding doesn't exist in case, need nested anonymous block ignore code. error: error report - ora-06550: line 41, column 14: pl/sql: ora-00942: table or view not exist ora-06550: line 33, column 10: pl/sql: sql statement ignored you can't compile code non-existent table, can try e

Fluent NHibernate subclass reference -

so have following entities: timelinerecord: id: pk from: datetime to: datetime servicerecord extends timelinerecord: id: pk timelinerecord_id: fk somespecificproperties... demand: id: pk from: datetime to: datetime ... servicedemandconnection: id: pk service: servicerecord demand: demand timelinerecord, demand , servicedemandconnection mapped using classmap id(x => x.id). servicerecord mapped using subclassmap (table-per-class). references in servicedemandconnection mapped using references(x => x.service).cascade.none() , same .demand. the problem inserting servicedemandconnection set servicerecord , demand. error: detail=key (servicerecord_id)=(8) not present in table "servicerecord". error states true. 8 id of timelinerecord, not servicerecord. however, id of servicerecord (timelinerecord_id, not mapped/not accessible in code) should used instead. current mapping hides servicerecord.id. how should tell

Using an Enum as a flag in a class, Python -

i use enum represent internal state of class: #!/usr/bin/python3 enum import enum class testclass: class color(enum): red = 1 blue = 2 green = 3 def __init__(self): self.value = 0 def setvalue(self, color): self.value = color this thought possible implementation. 2 annoying things see are: to set value have : q = testclass() q.setvalue(q.color.red) and find q.color.red someway umpleasant, i'd rather have like: color.red or red . maybe way have use string comparison, trying avoid using enum. i method q.color.mro seems internal method of enum class. for? alternative #1: can have enum class string lookup you: def setvalue(self, color): self.value = self.color[color] usage: q = testclass() q.setvalue('red') reference: https://docs.python.org/3/library/enum.html#programmatic-access-to-enumeration-members-and-their-attributes alternative #2: if there no conflicts,

postgresql - `pg:pull` is not a heroku command, but `db:pull` is -

i've been trying pull database heroku. reason when try heroku pg:pull heroku_postgresql_rainbow_url newlocaldb --app myapp it returns ! pg:pull not heroku command. ! perhaps meant db:pull , pg:kill or pg:psql . ! see heroku help list of available commands. on other hand, command heroku db:pull heroku_postgresql_rainbow_url newlocaldb --app myapp is recognized, despite db:pull replaced pg:pull according e.g. this . when try heroku help , shows entry db:pull not pg:pull . so, nice use command pg:pull . doesn't work me now. (i believe did recently.) problem?

aes - WM-Bus extended layer decoding -

i trying decrypt wm-bus telegram kamstrup multical21 in c1 mode extended link layer. payload ell info following: 23 44 2d 2c 45 45 71 63 1b 16 8d 20 6a 31 fb 7c 20 39 a3 79 60 4b 90 bd fc 8d d8 cb 18 ce 77 dc 41 ce 8c analysing ci = 8d found there ell following data: ci (1 byte) cc(1 byte) acc(1 byte) sn(4 bytes) crc(2 bytes) 8d 20 6a 31 fb 7c 20 39 a3 the documentation says buffer should decrypted shall contain crc ell, i.e: 39 a3 79 60 4b 90 bd fc 8d d8 cb 18 ce 77 dc 41 ce 8c i have got aes key manufacturer: b9 7a 6d 4e c2 74 a4 6d 87 0e 31 27 d9 a0 af 63 initialization vector ell shall be: m-field a-field cc-field sn-field fn bc 2d 2c 45 45 71 63 1b 16 20 31 fb 7c 20 00 00 00 after decrypting, following result: 08 3a 5f ce b2 8d 51 97 94 a2 5b fb 61 ab 2e c0 e4 20 c8 2a 43 ff 3a 75 6f 93 d0 ac 8c 79 b7 a1 since there no 2f 2f in beginning, wrong! can me , t

CalendarView in Android not showing correct month -

Image
i have implemented calendarview in android app. have strange issue on selection of date. month showing april 2015 in top toast showing 1/3/2015? if scroll may 2015 toast shows 1/4/2015. month previous month. i doing this: calendar =(calendarview) findviewbyid(r.id.calendarforstart); calendar.setshowweeknumber(false); calendar.setfirstdayofweek(2); calendar.setondatechangelistener(new ondatechangelistener() { @override public void onselecteddaychange(calendarview view, int year, int month, int day) { toast.maketext(getapplicationcontext(), day + "/" + month + "/" + year, toast.length_long).show(); } }); please check snapshot: did notice in top shows april 2015 below toast shows 1/3/2015.. why happening? can me fix this? thanks! month start 0. jan-dec 0-11 you need change month+1 toast.maketext(getapplicationcontext(), day + "/" + (month+1) + "/" + year, t

c++ - Why is digits10 for reference to integer type 0? -

the following code: #include <iostream> #include <limits> #include <cstdint> int main() { std::cout << std::numeric_limits<std::uint64_t>::digits10 << "\n" << std::numeric_limits<std::uint64_t&>::digits10 << "\n"; } outputs 19 0 i expect std::uint64_t& have same value std::uint64_t : there reason discrepancy? 18.3.2.1/2: specializations shall provided each arithmetic type, both floating point , integer, including bool. member is_specialized shall true such specializations of numeric_limits. so know specializations exist for these non-reference types. 18.3.2.3/1: the default numeric_limits template shall have members, 0 or false values. i suspect done way because can static_assert on is_specialized force compile error, there possibly template application 0 ok default value 1 or more of limits. if want able test references run through

javascript - edit tooltip on a kartograph map -

i'm using kartograph on map adapt style/tooltip depending on data, follow showcase : http://kartograph.org/showcase/choropleth/ map.addlayer('layer_0', { styles: { 'stroke-width': 0.7, fill: function(d) { return color(stars[d["nuts-id"]]? stars[d["nuts-id"]].total_stars: 0); }, stroke: function(d) { return color(stars[d["nuts-id"]]? stars[d["nuts-id"]].total_stars: 0).darker(); }, }, tooltips: function(d) { return [d["nuts-id"], stars[d["nuts-id"]]? stars[d["nuts-id"]].total_stars: 0]; } }); the map good, want edit it. for style did : map.getlayer('layer_0').style('fill', function(d) { ... }); map.getlayer('layer_0'

ruby - What is correct path in .js file in Rails? -

i have js script plays video on home page , can't correct path video folder in script. works in html static project. assets/javascript/common.js var videobackground = new $.backgroundvideo($('#background-video'), { "path": "/video/" }); assets/javascript/video/ - videos in folder i tried sending root_path variable in application file, doesn't work either. application.html.haml :javascript var root_url = '#{rails.root}'; application.html.haml var videobackground = new $.backgroundvideo($('#background-video'), { "path": root_url + "/app/assets/javascripts/video/" }); i not sure, if want assets, try putting video in app/assets/videos , in config/application.rb config.assets.paths << "#{rails.root}/app/assets/videos" config.assets.enabled = true else put in public/videos then, video_tag "video.mp4" should automatically loaf there

c++ - Why class instance as pointer uses heap and not stack? -

i read in c++ book can have kinds of class instances in c++. normal class instances class instances pointer for example : class person { public: person(); person(std::string name, int age){ } }; //this created in stack : person john("john",68); //this created in heap b : person *marcel("marcel",31); so, why when creating object using pointer (a) uses heap , why in b, uses stack ? first, let's correct syntax: int main() { person john("john",68); //statement 1 person *marcel = new person("marcel",31); //statement 2 .... } the first statement, indeed, creates instance of class person, on stack. the second statement declares pointer of type person on stack, , assigns instance of class person on heap, because dynamically allocated. so, pointer (i.e. variable holds address of class instance) resides on stack, actual instance allocated on heap. i hope clears things up, if not, reco

c++ - ICU, Unicode and libraries -

my goal implement unicode in utf-16 format in embedded system. want able use multiple languages display on lcd. texts in multiple languages going written in separate text files. program eclipse gcc compiler. i've done research unicode , seems icu holds libraries unicode working on embedded systems. icu version i've downloaded written windows visual studio 10. i'm new program bear me.. i've installed microsoft visual c++ 2010 compile icu , changed library path mentioned in readme file. when trying run cintltst im getting following error: #### note: icu init without build-specific setdatadirectory() failed. u_file_access_error #### error! c:\documents\icu\source\test\cintltst\.\x86\debug\cintltst.exe: u_init() failed status = "u_file_access_error". *** check icu_data environment variable , *** check data files present. *** exiting. use '-w' option if data files *** purposely removed, continue test anyway. now couple of questions: 1) don'

iphone - Swift can't show back button after hiding it -

i have uitableviewcontroller static cell has custom button. hide button in viewdidload code: var cancelbtn = uibarbuttonitem(title: "cancel", style: uibarbuttonitemstyle.plain, target: self, action: "closesettings") self.navigationitem.hidesbackbutton = true self.navigationitem.leftbarbuttonitem = cancelbtn if don't have self.navigationitem.hidesbackbutton = true line in place, button arrow still appears. line in code, button hidden , cancel button appears how want. problem coming when open view controller cell, button not present. instantiate view controller when cell clicked, , use navigation controller push view controller. have attempted put self.navigationitem.hidesbackbutton = false in code right before pushviewcontroller(). when see button appear, when new view controller pushed on navigation controller, button disappears. i have attempted putting hidesbackbutton = false line in target view controller's viewdidload , viewdidappear, not a

excel - find a cell with specific text, multiple occurences, and past active cell in all cells containing specific text -

i working on report, originating in infoview (sap business objects) this report provides valuable information on weekly basis, enhance awareness of current shop performance. like tile of post might show want find cell specific text. has multiple occurrences, , want past selected cell in of instances. i can reach same result ctrl-f, "search all" ( "specific text") , paste (the selected cell) ( http://www.extendoffice.com/documents/excel/816-excel-select-cells-with-specific-text.html ) automate this. i want use: cells.find(what:="[ö]", after:=activecell, lookin:=xlformulas, lookat:= _ xlpart, searchorder:=xlbyrows, searchdirection:=xlnext, matchcase:=false _ , searchformat:=false).activate and cells.findnext(after:=activecell).activate but can't incorporate 2 in 1 macro gives me result describes above. the selected cell contains formula, containing index(match) , reference cell on same row "specific text&quo

html - How can I make a Input with a span with :before pseudo class? -

it's firts question in stackoverflow ... have input type button, , want add pseudo:class before animation ( http://codepen.io/anon/pen/emodkg ). know it's impossible because input can't contain something. try add span input, span give class "btn" codepen ... the problem span on input, have animation it's not clickable. <span class="btn"><input type="button"></span> try one, think :) .btn { position: relative; display: block; margin: 30px auto; padding: 20px; overflow: hidden; border-width: 0; outline: none; border-radius: 2px; box-shadow: 0 1px 4px rgba(0, 0, 0, .6); background-color: #2ecc71; color: #ecf0f1; transition: background-color .8s; text-align: center; } .btn:hover, .btn:focus { background-color: #27ae60; } .btn:before { content: ""; position: absolute; top: 50%; left: 50%; display: block; width: 0; padding-top: 0

Can Servicestack.Interfaces dll be used without license? -

i assuming downloaded servicestack.client nuget package not need license. i'm looking build whitelabel apps connect central servicestack based api, hence want reference servicestack.client , servicestack.interfaces in various projects & solutions. yes can since servicestack.interfaces definition library , not limited of built-in free quotas .

Java Code: "Iterations & I/O" Pulling a file into Eclipse and using it -

with project learning how pull , outside file , use in our eclipse program. in outside file (wordpad) there needs 50 numbers (1-50, new number each line:1 return, 2 return, 3 return, etc.). these numbers have ask user pull in file (with input.txt input, output.txt output). ask user 5 names , average numbers each student. example user enters joe, jack, jill, james, , jake should output: joe: 5.5 (average of 1-10) jack: 15.5 (average of 11-20) jill: 25.5 (average of 21-30) james: 35.5 (average of 31-40) jake: 45.5 (average of 41-50) what guys think? advise or help? import java.io.file; import java.io.filenotfoundexception; import java.io.printwriter; import java.util.scanner; public class lineio { public static void main(string[] args)throws filenotfoundexception{ scanner console = new scanner(system.in); system.out.print("enter input file name: "); string inputfilename = console.next(); system.out.print("output file: ")

wordpress - Display related post based on tag -

i'm working on music site uses lot of tags , categories per post. example, on artist's page related posts display artist's releases based on tags. have tried adding tag using wordpress' post_type $args = array( - 'post_type' => 'releases' but hasn't worked. for example, here complete code - <div class="relatedposts"> <h3>releases artist</h3> <?php $orig_post = $post; global $post; $tags = wp_get_post_tags($post->id); if ($tags) { $tag_ids = array(); foreach($tags $individual_tag) $tag_ids[] = $individual_tag->term_id; $args=array( 'post_type' => 'releases', 'tag__in' => $tag_ids, 'post__not_in' => array($post->id), 'posts_per_page'=>4, // number

php - Get position of text in mPDF to determine vertical height of HTML element -

i generating pdfs mpdf class , wondering if , how possible determine position of last line of text in document generated mpdf? i need html box cover in height remaining space between last line of text , bottom margin of document. setting html element height: 100% pushes element new page , covering whole height of new page. the content of page generated dynamically based on number of factors, can never sure @ vertical position last line at. if knew vertical position of last line, subtract value total page height , set css element have height. is possible or there other solutions? you can use purpose "$mpdf->y" (current position in user unit cell positioning): $mpdf=new mpdf('', 'a4'); $mpdf->writehtml('line1<pagebreak>line2<br>line3'); // $unusedspaceh = $mpdf->h - $mpdf->y - $mpdf->bmargin; $unusedspacew = $mpdf->w - $mpdf->lmargin - $mpdf->rmargin; // $mpdf->rect($mpdf->x, $mpdf->y,

c# - Get fields from any class (based on type) -

i have class class1 public class class1 { public string abc { get; set; } public string def { get; set; } public string ghi { get; set; } public string jlk { get; set; } } how can list of, in case 'abc', 'def', ... want name of public fields. i tried following: dictionary<string, string> props = new dictionary<string, string>(); foreach (var prop in classtype.gettype().getproperties().where(x => x.canwrite == true).tolist()) { //console.writeline("{0}={1}", prop.name, prop.getvalue(classitem, null)); //objectitem.setvalue("abc", "test"); props.add(prop.name, ""); } and: var bindingflags = bindingflags.instance | bindingflags.nonpublic | bindingflags.public; var fieldvalues = classtype.gettype() .getfields(bindingflags) .select(field => field.getvalue(classtype)) .tolist(); but neither

c# - Sockets: Only one usage of each socket address is normally permitted -

Image
i want reuse socket after used once, subj exception. found multiple questions same issue no working solution. tried using code, tried manual closing - without success a little sample using system; using system.net; using system.net.sockets; using system.text; namespace sockettest { class program { static void main() { (int = 1; <= 2; i++) { var encoding = new utf8encoding(false); var host = dns.gethostentry("localhost"); var endpoint = new ipendpoint(host.addresslist[0], 11322); console.writeline("iteration #{0}\tenpdoint = {1}", i, endpoint); try { var client = new tcpclient(endpoint); const string message = "hello world!"; byte[] data = encoding.getbytes(message); client.connect(endpoint); var stream

javascript - Ajax calls, sending images and other data -

i wondering there length limit it? im sending images , data server, returns cannot "find" required data. can , cant find it. , getting frustrating because cant find problem. im sending images dataurl. server gets nothing. there empty formdata checking inspection tool data writen correctly. any other things check? posting code: var id = this.id.substr(11); if (!user) { if (document.getelementbyid('username').value.length < 1) { listing.alert('{{trans('adsadd.entername')}}', true); $('#username').parent().addclass('has-error'); $('#username').addclass('has-error'); return; } if (document.getelementbyid('userphone').value < 1) { listing.alert('{{trans('adsadd.enterphone')}}', true); $('#userphone').parent().addclass('has-error');

ibm mq - Minimum version of IBM websphere MQ supporting XA transactions -

i want use xa complaint ibm websphere mq. minimum version of websphere mq supporting feature of distributed transaction?. additionally using ibm mq classes jms it's not clear if asking xa mq client or queue manager can act xa resource manager. in either case, mq version older v7 no longer supported ibm @ minimum should using mq v7.0.1, preferably 1 more recent because version has end of support september year. all versions of mq can act xa transaction coordinator or use services of external xa transaction coordinator. details of implementations of xa compatible mq, please see detailed system requirements page version of mq , drill down. as of 24 april 2012, versions of ibm mq client licensed xa transactionality , include functionality built in. however, necessary download , use client software posted ibm after date qualify because process includes agreeing new license terms. also, transactional client installation pre-dates new release show on license audit

variables - OLEDB Source dosn`t receive Sql Statment from Skrip Task -

i have problem script task. have package foreach loop container contains skriptask creating sql statment variable. variable defined , contains default value when after execution skripttask i`m trying create dataflow (oledb source) has sqlstatment variable, oledb getting default value variable , not new 1 script. is options miss? thanks lot! update: case "feed" msgbox("feed") if cstr(dts.variables("executionflag").value) = "1" dts.variables("feed").value = "select [symbolname] ,[bid],[ask],[ticktime],[server],[serverid],[lastupdate] feed cast( " & columndatefilter & " date) between '" & fromdate & "' , '" & todate & "'" msgbox(dts.variables("executionflag").value.tostring) elseif cstr(dts.variables("executionflag").value) = "0"

mysql - SQL foreign key restraint referencing information_schema -

is possible "constrain" columns in 1 table "reference" columns views in information_schema in way (it needn't proper foreign key constraint, hence scare quotes)?-- need minimally-intrusive way of adding arbitrary metadata existing column data (e.g. add "comments" e.g. value shop.cheeses.name shop.cheeses.id = n ), , thought of defining table such: create table shop.metadata ( `table_schema` varchar(64) not null, `table_name` varchar(64) not null, `column_name` varchar(64) not null, `record_id` int(11) unsigned not null, `comments` text not null, /* show purpose of table */ primary key (`table_schema`, `table_name`, `column_name`, `record_id`), foreign key (`table_schema`, `table_name`, `column_name`) references information_schema.tables(`table_schema`, `table_name`, `column_name`) ); however, statement returns error 1215 (hy000): cannot add foreign key constraint , presumably because table_schema , table_name , co

c# - Why Collection assignment act differently inside method and consecutive lines? -

from below results, know why 'test 2' have value 30 , expect same result in 'test 3' (100) ? here fiddler link https://dotnetfiddle.net/rco1md better understanding. ilist<test> initialcollection = new list<test>(); initialcollection.add(new test(){ value = 30}); console.writeline("test 1 : before update method : " + initialcollection.last().value ); updatevaluecollection(initialcollection); console.writeline("test 2: after update method : " + initialcollection.last().value ); ilist<test> check = new list<test>(); check.add(new test(){ value = 100}); initialcollection = check; console.writeline("test 3: same update method code added consecutive line : " + initialcollection.last().value ); and method is public void updatevaluecollection(ilist<test> lsttest) { ilist<test> check = new list<test>(); check.add(new test(){ value = 100}); lsttest = check; } the results are

java - Unable to show images in JSP from database using servlet -

Image
i trying fetch , display , images saved blob on jsp mysql database using servlet. wrote code referring many websites , still , not working. not getting type of errors. showing this i have created table using create table contacts(id int not null auto_increment, name varchar(40), second varchar(40), photo blob, primary key(id)); this servlet displayservlet.java @webservlet("/displayservlet") public class displayservlet extends httpservlet { private static final long serialversionuid = 1l; connection conn = null; preparedstatement stmt = null; resultset rs = null; public void init() throws servletexception { } public displayservlet() { super(); } protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { dopost(request, response); } /** * @see httpservlet#dopost(httpservletrequest request, httpservletresponse response) */ protected void dopost(httpservletrequest reque

ember cli - ReferenceError: Can't find variable: define at http://localhost:7357/assets/test-loader.js, line 3 -

i'm upgrading ember cli addon 0.1.9 0.2.0, , hitting error when running ember test --server : referenceerror: can't find variable: define @ http://localhost:7357/assets/test-loader.js , line 3 ember serve works, , can visit /tests in browser, else seems have broken testem/phantom setup. i've upgraded phantom, , went through ember init diffs several times, must still missing something. the problem had used es6 syntax in 1 of files in /addon . es6 isn't supported there (yet), throwing error. removing es6 (in case, ticks) solved problem. update simply npm install --save ember-cli-babel in addon babel support files in /addon directory.

android - Repeatedly update a list in the ListFragment -

i'm using estimote sdk android. i'm trying change provided code on official site. want show list of detected beacons in listfragment (with information each beacon). in main activity start necessary (service, listeners..), , in particular have oncreate(...) method: public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); beaconmanager.setranginglistener(new beaconmanager.ranginglistener() { @override public void onbeaconsdiscovered(region region, list<beacon> beacons) { // update list of beacons in listfragment in way } }); } if understood correctly, method called continuosly every fixed time. this code of listfragment: public class discoveredbeacons extends listfragment { private list<beacon> beacons = new arraylist<beacon>(); private beacon beacon; private view mcontentview = null; @override public void onactivity

javascript - Using an NPM package with dependencies in Meteor -

i'm trying use npm package in meteor project have problems getting work. the module i’m trying use steam package. i’ve added meteorhacks:npm package meteor , changed packages.json file to: { "steam": "0.6.8", "adm-zip": "0.4.7", "buffer-crc32": "0.2.5", "bytebuffer": "3.5.4", "bufferview": "1.0.1", "long": "2.2.3", "protobufjs": "4.0.0-b2", "ascli": "1.0.0", "optjs": "3.2.1-boom", "colour": "0.7.1" } (to clarify above, it’s steam package dependencies , dependencies of dependencies) now i’ve tried use package in meteor app code located in -/server/steambot/steambot.js var steam = meteor.npmrequire('steam'); var bot = new steam.steamclient(); bot.logon({ // (fake credentials) accountname: 'a', p

asp.net - How can I open an ASP page from HTML page? -

i working on asp project, first time uploading server (a server provided @ campus) i have mix of html , asp pages. want html page default page, while have links on html pages pointing asp pages. from local machine worked fine (of course local. used localhost:xxxx address link, know wont work when upload server). i'm using visual studio 2012. can point me right direction? it might possible server uploading plain file server , , not asp server . if case, link particular asp file display contents , not html page generated on local machine asp server .

android - Variable not declared until set in preferences -

i'm working on app works database , offers option create backup on external storage. app gets backup directory preferences, since it's not set when run app first time, use default path instead, getting path external storage , creating directory there. for this, use global string value keeps backup path. here's problem - when run app first time, declare default path in oncreate() method. when try write path log, works. have onclick() method, listen click on button, calls dialog export/import options. when try write backup path log here, string empty. variable shouldn't issue, because here's interesting thing - when go preferences , set backup path there (which saved string variable same way before), can variable onclick method , works fine. just record, tried setting different path , i've been choosing same path in preferences used manually in oncreate method. any ideas issue? can write whole condition backup path used in oncreate onclick method

java - Groovy method to build <String, List<List>> tokens from String array -

i have string array: def invoices = [ledes98bi v2, line|invoice_date|invoice_number|invoice_total, 1|20150301|inv-error_test1|22, 2|20150301|inv-error_test1|24, 3|20150301|inv-error_test2|26, 4|20150301|inv-error_test2|28,] i tried convert hasmap<string, list<list>> key invoice numbers( inv-error_test1 , inv-error_test2 ) , values each invoice line: [ inv-error_test2:[[3,20150301, inv-error_test2,26], [4,20150301, inv-error_test2,28]], inv-error_test1:[[1,20150301, inv-error_test1,22], [2,20150301, inv-error_test1,24]] ] and method converts string array <string, list<list>> tokens: def extractinvoicelineitems(def invoices) { map invlineitems = new hashmap<string, arraylist<arraylist>>(); def lineitems = [] for(int = 2; i<invoices.length; i++){ def tokens = invoices[i].split('\\|') list if(tokens.size != 1) { lineitems.add(tokens) } } (int i=0; i< lineitems.siz