Posts

Showing posts from June, 2014

java - JTable not updating when model updates -

ok, have read on this, i'm still confused. have jtable custom table model stores data in arraylist. displays fine. however, when want add row, add object arraylist, call firetablerowsinserted(...). however, table not refresh. public main() { initcomponents(); current_map = new map(); current_map.authors.add(new author("new author")); author_model = new authormodel(current_map.authors); jtable1.setmodel(new authormodel(current_map.authors)); <---this mistake } ... private void jbutton1actionperformed(java.awt.event.actionevent evt) { author_model.authors.add(new author("new author")); author_model.firetablerowsinserted(author_model.authors.size(), author_model.authors.size()); } the above code main jframe. not sure go here. i'm lost right now. the table initialized with: jtable1.setmodel(new authormodel(current_map.au

extjs - How to set (title of) detail view with Ext navigation view -

what's proper way of setting (title of) detail view ext navigation view? 1st approach in sencha list tutorial ( video ) controller does this.getmain().push({ xtype: 'presidentdetail', title: record.fullname(), data: record.getdata() }); and detail view regular ext.panel tpl. 2nd approach however, navigation view example ships sencha touch download (code here ) takes totally different approach. here controller does this.showcontact = ext.create('addressbook.view.contact.show'); this.showcontact.setrecord(record); this.getmain().push(this.showcontact); and detail view contains quite bit of code don't understand (yet) ext.define('addressbook.view.contact.show', { extend: 'ext.container', ... config: { title: 'information', basecls: 'x-show-contact', layout: 'vbox', items: [ { id: 'content', tpl: ... }, ... }, updaterecord: fun

XSLT adding new element to current node -

i have xml , trying add new element assign value on conditions. working fine. however, seems adding new element parent node. can me figure out issue. below full xslt . having problem last template. <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:ns0="http://somenamespace"> <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> <xsl:template match="ns0:cedent/ns0:party/ns0:id[. = '']"> <xsl:copy> <xsl:apply-templates select="@*" /> <xsl:a

scala - What do I have to add to my build.sbt in order to work with halbuilder? -

i can't find how use halbuilder in spray project. first step add correct dependencies build.sbt file , can read api documentation. anyone out there has used halbuilder in scala project? librarydependencies += "com.theoryinpractise" % "halbuilder-core" % "2.0.1" from googled example . it seems works: scala> import com.theoryinpractise.halbuilder._ import com.theoryinpractise.halbuilder._ it's correct location according pom.xml : <groupid>com.theoryinpractise</groupid> <artifactid>halbuilder-scala</artifactid> disclaimer: i've never used it.

login - Logging into SAML/Shibboleth authenticated server using python -

Image
i'm trying login university's server via python, i'm entirely unsure of how go generating appropriate http posts, creating keys , certificates, , other parts of process may unfamiliar required comply saml spec. can login browser fine, i'd able login , access other contents within server using python. for reference, here site i've tried logging in using mechanize (selecting form, populating fields, clicking submit button control via mechanize.broswer.submit(), etc.) no avail; login site gets spat each time. at point, i'm open implementing solution in whichever language suitable task. basically, want programatically login saml authenticated server. basically have understand workflow behind salm authentication process. unfortunately, there no pdf out there seems provide in finding out kind of things browser when accessing saml protected website. maybe should take this: http://www.docstoc.com/docs/33849977/workflow-to-use-shibboleth-authenticati

python - Where do classes get their default '__dict__' attributes from? -

if compare lists generated applying dir() built-in object superclass , 'dummy', bodyless class, such as class a(): pass we find class has 3 attributes ('__dict__', '__module__' , '__weakref__') not present in object class. where class inherit these additional attributes from? the __dict__ attribute created internal code in type.__new__ . class's metaclass may influence eventual content of __dict__ . if using __slots__ , have no __dict__ attribute. __module__ set when class compiled, instance inherits attribute class. can verify performing test inst.__module__ cls.__module__ (given inst instance of cls ), , modifying cls.__module__ , observing inst.__module__ reflects change. (you can stupid things setting inst.__module__ differing value cls.__module__ . not sure why isn't readonly attribute.) __weakref__ created when instance is; afaik it's controlled internal cpython object-creation system. attribute p

backbone.js - Uglifying a RequireJS/Backbone project into one single .js file? -

i worked along the following tutorial try optimize project 1 single .js file, unfortunately can't seem expected results. r.js create optimized folder me, instead of single file, uglified copies of each individual .js file in respective folders. seems last concatenation step somehow missing. i'm trying leverage existing config file instead of using paths, don't know if specific step breaking it. my build/app.build.js is: ({ appdir: '../', baseurl: 'js', mainconfigfile: '../js/config.js', dir: '../../my-app-build', modules: [{ name: 'main' }] }) my main.js file has config file dependency: require(["config"], function() { require(['underscore', [...] [...] } } and config file of project dependencies declared: require.config({ baseurl: "js", paths: {[...]}, shim: {...]}, }); does have insight why might not getting single file output i'm looking for? tried o

excel - formatting html data and writing back to same cell - performance issue -

i have excel column "a" containing non-formatted html data. format data, following below steps: 1) take non-formatted html data first cell , paste on internet explorer , paste formatted text html page excel column "e" ( html text tags formatted text in excel cell ) 2) excel column "e", read data each row final row , paste original cell preserving formatting , use below code that. sub concatenaterichtext(target range, source range) dim cell range dim long dim c long = 1 target .clear each cell in source .value = .value & vblf & cell.value next cell .value = trim(.value) end each cell in source c = 1 len(cell.value) target.characters(i, 1).font .name = cell.characters(c, 1).font.name .fontstyle = cell.characters(c, 1).font.fontstyle .size = cell.characters(c, 1).font.size .strikethro

z3 - Questions about using Z3Py online to solve problems in Transport Phenomena -

Image
certain problem in transport phenomena solved using following code: t_max, t_0, s, r, k, i, k_e, l, r, e, = reals('t_max t_0 s r k k_e l r e a') k = a*k_e*t_0 = k_e*e/l s = (i**2)/k_e eq = t_0 + s* r**2/(4*k) print eq equations = [ t_max == eq, ] print "temperature equations:" print equations problem = [ r == 2, l == 5000, t_0 == 20 + 273, t_max == 30 + 273, k_e == 1, == 2.23*10**(-8), e > 0 ] print "problem:" print problem print "solution:" solve(equations + problem) using code online obtain this output gives correct answer there 2 issues in code: a) expresion named "eq" not simplified , necessary give arbitrary value k_e . question is: how simplify expression "eq" in such way k_e eliminated "eq"? other example: determine radius of tube code: def inte(n,a,b): return (b**(n+1))/(n+1)-(a**(n+1))/(n+1) p_0, p_1, l, r, mu, q, c = reals('p_0 p_1 l r mu q c') k = (p_0 - p_1)/(2*mu*l) eq

c++ - How to inherit from std::runtime_error? -

for example: #include <stdexcept> class { }; class err : public a, public std::runtime_error("") { }; int main() { err x; return 0; } with ("") after runtime_error get: error: expected '{' before '(' token error: expected unqualified-id before string constant error: expected ')' before string constant else (without ("") ) get in constructor 'err::err()': error: no matching function call 'std::runtime_error::runtime_error()' what's going wrong? (you can test here: http://www.compileonline.com/compile_cpp_online.php ) this correct syntax: class err : public a, public std::runtime_error and not: class err : public a, public std::runtime_error("") as doing above. if want pass empty string constructor of std::runtime_error , way: class err : public a, public std::runtime_error { public: err() : std::runtime_error("") { } // ^^^^^^^^^^^^^

mongodb - set up mongo db across 2 servers -

i setting mongo database in production environment. running off of 2 servers - want set 1 server can fail on other when , if necessary. i new mongo , have sql server database. admit not sure how set such. tutorials of similar on web me? or advice regarding such setup? replication in mongodb achieve goal. here how replication works in mongodb a replica set set of 2 or more mongod cluster ( 3 preferred on 2 ) one among them primary , rest secondaries. in case of failover of primary, secondaries form election , choose new primary. ( automated failover ) there different member configuration available replica set, details in deployment details in

html - Why is my CSS style not being applied? -

i've got html: <p> <span class="fancify">parting such sweet sorrow!</span><span> - bill rattleandrollspeer</span> </p> ...and css (added bottom of site.css): .fancify { font-size: 1.5em; font-weight: 800; font-family: consolas, "segoe ui", calibri, sans-serif; font-style: italic; } so, expect quote ("parting such sweet sorrow!") italicized, , of different font name of quotee (bill rattleandrollspeer), since span tag has class "fancify" attached it. class should seen, file in appears references layout file uses site.css file. what rookie mistake making now? update i thought maybe problem had added new class in site.css following section in file: /******************** * mobile styles * ********************/ @media screen , (max-width: 850px) { ...but moved above there, , still not working, , not seen via f12 | inspect element label in question. i moved reference

html5 - Is there a way to achieve a 6-point button in HTML? -

Image
i'm trying achieve similar how apple breadcrumbs in footer: i thinking css3 (border-radius), rounded corners only. or is simple html5 feature? theres alot examples on internet css3 breadcrumbs , see many tutorials. http://css-tricks.com/triangle-breadcrumbs/ and can border here example , tutorial http://thecodeplayer.com/walkthrough/css3-breadcrumb-navigation

yUP on Python graphics.py from prof J Zelle -

as having problems trying enter information through screen window, using graphics.py prof. j zelle, reading additional tutorial on " http://anh.cs.luc.edu/python/hands-on/3.1/handsonhtml/graphics.html?highlight=yup " , here find examples starts with win = graphwin('face', 200, 150) # give title , dimensions win.yup() # make right side coordinates! i using graphics.py download http://mcsp.wartburg.edu/zelle/python/ , appears @ # version 4.2 5/26/2011, , on cant find win.yup . can pls provide information how fix this as tutorial linked explains in first paragraph, "my slight elaboration of [i.e. prof. zelle] package graphics.py in example programs." you want version http://anh.cs.luc.edu/python/hands-on/3.1/index.html instead. download zip file linked after "example programs needed test out code used in tutorial".

javascript - How to mock required directive controller in directive UT -

according angularjs doc a/the directive controller is: instantiated before pre-linking phase , shared other directives if request name (see require attribute). allows directives communicate each other , augment each other's behavior. this sounds great , useful in case ui view composed of container , widget, widget's link func can passed in container directive controller via declarative approach require:^cotnainerdirective . gives alternative way callback container behavior instead of communication relying on events. for example, widget directive requiring container controller below: angular.module('platform').directive('widget', [ function ( ) { return { restrict: 'e', transclude: true, require: '?^container', replace: true, scope: { layout: '=', model: '=' }, templateurl: 'js/modules/platform/templates/form-tmpl.html',

asp.net - Check for SQL Keywords in C# -

if allow users type in textbox , perform search against db, there potential sql injection. use regex, thats first thought. had better idea. why not see if typed has sql keywords in it. im using sql server database, in asp.net program c#, thought microsoft have offered easy solution talking about. best can find in article: is programmatic way sql keywords (reserved words) which ill end doing, problem still have type out entire list of keywords, there around hundred. sure done instead of searching , asking question. isnt there easier way? right im going to: 1 create hashset 2 add keywords hashset (cmon) 3 validate user input against hashset would love see step 2 made easier, other suggestions sql injections appreciated if passing search text stored procedure , doing where search @inputparam sql not allow injection incur in above fragment. however, if building string variable , using exec @sql or sp_execute @sql, vulnerable sql injection.

java - producer consumer pattern finish signal -

i have application applies producer-consumer design pattern. written in java. in short, producers put items in blocking queue , consumers takes them there. consumers should run until signaled producer stop. what neatest way deliver signal producers consumers? chief designer said wants keep producer , consumer separate dont see other other invoking method on consumer thread pool? the chief programmer right. keeping them separate leads highly decoupled code excellent. there several ways this. 1 of them called poison pill. here's how works - place known item on queue when consumer see item, kill or take action. this can tricky if there multiple consumers (you mentioned threadpool) or bounded queues. please in java concurrency in practice joshua bloch. explained best.

c++ - Something like new but to allocate 2 rooms -

i have member function must create 2 objects of class (in memory). must return pointer "p", want access objets p[0] , p[1]. know keyword new, allocate memory 1 object. there similar allocate contigous memory 2 objets ? can create 2 cells array (two pointers) using keyword new 2 times, preferer easier solution (p[0] , p[1]). myclass * p = new myclass[2]; and remember delete with: delete[] p;

Apply jQuery code to divs individually -

i'm using following code: $('.game-list-right-bottom > .game-list-file').each(function(i) { if( % 4 == 0 ) { $(this).nextall().andself().slice(0,4).wrapall('<div class="game-list-files"></div>'); } }); to turn this: <div class="game-list-right-bottom"> <div class="game-list-file"></div> <div class="game-list-file"></div> <div class="game-list-file"></div> <div class="game-list-file"></div> <div class="game-list-file"></div> <div class="game-list-file"></div> </div> into this: <div class="game-list-right-bottom"> <div class="game-list-files"> <div class="game-list-file"></div> <div class="game-list-file"></div> <

javascript - Opera's right click disables key events -

in opera, while holding down right click, no key events register. window.onkeydown = function() { alert("hey"); } this doesn't register if you're holding down right mouse button in opera. i've disabled context menu, right click still blocks key events. i've tried disabling mouse gestures in opera (which use right mouse button). there's no context menu nor mouse gestures, key events still don't register while right mouse button down. here's js fiddle example . when press key, "a" move right, regardless of whether right mouse button down, unless you're in opera. are there workarounds/fixes? it onmousedown work holding down right click below code works me in opera , chrome right click. <html> <body> <script> window.onkeydown = function() { alert("hey"); } window.mousedown = function() { alert("hey mouse down"); } </script> </body> </html>

ios - Delete from Plist is not working? -

i have plist , when user write notes save plist along id,each time when user opens check whether user id got notes in plist , display in uitableview .also user can remove notes when tried following process got exceptions 1.in view didload check whether user got previous notes or not 2.check plist user id 3.if match retrieve corresponding notes 4.and save mutable array .so when user add new note first use previous mutable array store new note , write again plist //not working me. 5.when user delete notes update itinto plist i assume have structure similar this [ { "userid": 1, "notes": [ { "noteid": 1, "desc": "description" },{ "noteid": 2, "desc": "description" } ] } ] plist file path in documents directory - (nsstring *)usernotesfilepath{ nsstring *

angularjs - Is there a code coverage for HTML using Karma when doing angular e2e test? -

we can use coverage see how javascript code covered our unit testing. e2e testing literally testing view components in html code against controller. question is, there same code coverage available how of html dom elements covered or touched in our e2e testing? agree, there big difference in execution path testing , ui testing. curious. thanks as know e2e testing use files served web server, unit test served directly karma, e2e testing used sure page work expect, end-to-end test use server side , client side. that's why typically never expected have 100% e2e coverage because more fragile. so people focus on unit test (testing edge-cases), , add e2e test sure behavior of page works correctly. you can use istanbul , build coverage report karma. http://gotwarlost.github.io/istanbul/ or article : http://lkrnac.net/blog/2014/04/measuring-code-coverage-by-protractor/ sum how use protractor e2e generate coverage report of e2e tests. using using tool : https://github.c

javascript - How to apply Onitem click using Java script -

below html page: <body> <div data-role="page" id="taxmanhomepage" data-theme="e"> <div data-role="header" data-position="fixed" data-tap-toggle="false" data-theme="e"> <h4 align="center">taxmann demo app</h4> </div> <div data-role="content" data-theme="e"> <a data-role="button" onclick="callservice()">webservice</a> todays headlines: <div class="content-primary"> <ul id="newlist" data-role="listview" data-inset="true" data-filter-theme="e" data-divider-theme="e"></ul> </div> </div> </div> </body> and java script code: var url="http://www.taxmann.com/taxmannwhatsnewservice/mobileservice.aspx?service=corporatelaws"; var news_i

c# - Set CauseValidation to false but not working -

i have validating event. private void employeeidtextbox_validating(object sender, canceleventargs e) { if (employeeidtextbox.text == "") { messagebox.show("please enter employeeid.", "invalid employeeid"); } } and set cancelbutton causevalidation false when hit cancelbutton messagebox still shows. you need set causesvalidation property of controls in hierarchy of cancel button false. for example: form1 contains panel1 , panel1 contains cancel button. need set causesvalidation property of form1, panel1 , cancel button false. causesvalidation property of control class. read more here the control allows fire validating event if causesvalidation true default value. if controls in hierarchy have causesvalidation true , receive focus before u click on cancel button, validating event fired. to avoid disabling everywhere controls in panel1, should use separate panel or none cancel button.

java - Resolving the JPA/Hibernate EntityNotFoundException -

i've run weird situation here. when try delete set of entities & later try add set of entities, may or may not have same elements again,i seem getting below exception. whole stack trace isn't required doesn't much. javax.persistence.entitynotfoundexception: deleted entity passed persist [com.test.myentity#<null>] to make myself more clear, let me give more detailed explanation. this entity. @entity @table(name = "my_entity") @sequencegenerator(name = "my_enty_seq", sequencename = "my_entity_seq") public class myentity { private long id; @id @generatedvalue(strategy = generationtype.auto, generator = "my_enty_seq") @column(name = "id", unique = true, nullable = false, precision = 12, scale = 0) public long getid() { return this.id; } // other methods & variables not relevant here. } and class playing entities. public class myentityserviceimpl implements myen

objective c - uitableview with paging must display only 10 cells -

in app have uitableview subview of uiscrollview many number of cells . want paging firstly uitableview must contain 10 cells . i'm new concept paging. i'm not getting idea how start referred tutorials of no use. can 1 me how start paging uitableview . this how creating uitableview , having delegate methods self.tableview=[[uitableview alloc] initwithframe:cgrectmake(25,150,730, [listofitems count]*160) style:uitableviewstyleplain]; self.tableview.delegate=self; self.tableview.datasource=self; self.tableview.scrollenabled = no; self.tableview.separatorcolor = [uicolor clearcolor]; [testscroll addsubview:self.tableview]; [self.tableview reloaddata]; 1) pass 10 elements array . 2) consider 2 buttons next & previous, on button click remove older elements array . 3) add newer 10 elements array . 4) reload table data . consider followin

java - Generate base64 string of an image to use in data URI -

how generate base64 string of image use in data uri? i have base64 image encoding issue hope can with. i'm trying use data uri in web page (ie <img src="data:image/png;base64,ivborw..."/> org.apache.commons.codec.binary.base64 v1.8 generating base64 string of png image. to generate base64 string have used: base64.encodebase64urlsafestring(imagefile) the problem browser cannot render image. compared generated string 1 works , noticed differences apache base64 version has "_" , "-" characters instead of "/" , "+". internet see there different base64 formats assume apache's implementation not compatible browsers. so wondering there library implements base64 format appropriate purposes? current fix replace characters rather use library. according javadoc of base64.encodebase64urlsafestring method, seems design. check out link provided, says in javadoc: encodes binary data using url-safe variatio

performance - Django MPTT - how expensive is objects.rebuild? -

i roll out in next days application using django mptt manage hierarchical data. mptt provides function called rebuild , rebuilds trees available given model, , called such treenodes.objects.rebuild() . can see command called on model, not on instance of model. command has called after node has been inserted tree. for django mptt 0.6 (not yet officially released ) partial_rebuild command implemented, rebuild given tree. while testing locally 10 trees no performance issue @ all, i'm concerned when there 100s of trees in db, , i'm calling rebuild command (which rebuild 100s of trees), might significant performance issue. anybody out there has experience using rebuild command? for future reference.. objects.rebuild() needed in special cases. mptt sets left , right values of nodes correctly setting parent id of node. mentioned in docs i experienced issue not correctly set left, right values because saved new node, !before! reset position values of other, ex

java - Option Menu won't display -

i want show menu action bar, menu won't display, source code : public class epolicymainactivity extends tabactivity { /** called when activity first created. */ public void oncreate(bundle savedinstancestate) { //hide title bar basicdisplaysettings.toggletaskbar(epolicymainactivity.this, false); //show status bar basicdisplaysettings.togglestatusbar(epolicymainactivity.this, true); super.oncreate(savedinstancestate); setcontentview(r.layout.menu); resources res = getresources(); // resource object drawables tabhost tabhost = gettabhost(); // activity tabhost tabhost.tabspec spec; // resusable tabspec each tab intent intent; // reusable intent each tab // create intent launch activity tab (to reused) intent = new intent().setclass(this, loginactivity.class); spec = tabhost.newtabspec("login").setindicator("", res.getdrawable(r.drawable.epolicy_menu_xml_home)) .setcontent(i

Calculate mean for uneven weighting in matlab -

i want calculate mean of field of tracers in matlab, cells make field different size. example, tracer field is: t = 1 3 5 8 2 1 4 3 2 1 9 1 20 8 3 1 and have 2 more fields, dx , dy describe size of cells make t . dx = 1 1 2 3 1 1 2 3 1 1 2 3 1 1 2 3 and dy = 3 3 3 3 3 3 3 3 2 2 2 2 1 1 1 1 so, intuitively, dx , dy tell me bottom left hand corner of tracer field t should have smallest contribution calculate of mean of t , while top right hand corner should have greatest contribution. i tried mean(mean(t)) , overweights importance of bottom left corner of t , etc. after bit of investigation figured i'd thorough , calculate mean manually, , including weightings, using this: t_mean_i = sum(t*dx)./sum(dx) and similar dy , cell width in y-direction. however, i'm not sure how implement this. edit: here more detail question. my grid 260*380 cells, size(dy) = size(dx) = 260-by-380 . tracer field calculated dividing surface flux field, sflux

compiler construction - Project without blank spaces will be compiled faster? -

as far know compiler , interpreter ignore blank spaces in projects. so, if suppose have project composed 2 thousand line, there blank spaces. in case, project compiled more project without them? no. ignoring whitespace possibly fastest operation there in compiler. if tips i/o required on additional disk read might notice tiny difference. it's not worth worrying about, , isn't worth defacing source files for. 2000 line project nothing compiler.

javascript - Inheritance from native objects -

i seem miss constructor chain inheritance in javascript, native objects. example : function errorchild(message) { error.call(this, message); } errorchild.prototype = object.create(error.prototype); var myerror = new errorchild("help!"); why myerror.message defined "" after statements ? expect error constructor define "help!" (and override default value of error.prototype.message ), if doing : var myerror = new error("help!") thanks lot ! the simple work-around: working fiddle function errorchild(name, message) { // error.call(this); not needed this.name = name; this.message = message; } errorchild.prototype = object.create(error.prototype); errorchild.prototype.constructor = errorchild; var myerror = new errorchild("test", "help!"); document.body.innerhtml += myerror.message; the above doesn't break expected behaviour. when throw myerror , correct name , message display. the pro

Instantiate object in dictionary comprehension in Django/Python -

i'm trying make function can dynamically builds django queryset. reason keeps giving nameerror ... can see what's going wrong? doesn't work: from django.db.models import sum sum_fields = ['subtotal', 'id'] subtotal = invoice.objects.filter(id__in=id_list).aggregate(**{field: sum(field) field in sum_fields}) the error given nameerror: global name 'sum' not defined . but... i'm importing before try dictionary comprehension. this work: from django.db.models import sum sum_fields = ['subtotal', 'id'] subtotal = invoice.objects.filter(id__in=id_list).aggregate(**dict([(field, sum(field)) field in sum_fields])) the last version works , should do, want know what's wrong dictionary comprehension.

Inno Setup: Installing Windows services using "sc create" -

i have 2 binaries , have create service them. tried solution using "sc create" how install windows service inno setup? but did not work me. it's getting stuck @ end of installation. doing wrong? here code: filename: {cmd}; parameters: "sc create srvname start= auto displayname= mysrv binpath= {app}\mybinary.exe" ; flags: runhidden i tried using cmd instead of {cmd} - no change. i did not try pascal code in solution referred. keeping last resort. i used code , both of services installing , uninstalling: [run] filename: {sys}\sc.exe; parameters: "create mysrv start= auto binpath= ""{app}\mysrv.exe""" ; flags: runhidden [uninstallrun] filename: {sys}\sc.exe; parameters: "stop mysrv" ; flags: runhidden filename: {sys}\sc.exe; parameters: "delete mysrv" ; flags: runhidden this solved problem, why should use pascal in case.?

node.js - Get connection status on Socket.io client -

i'm using socket.io, , i'd know status of connection server client-side. something this: socket.status // return true if connected, false otherwise i need information give visual feedback user if connection has dropped or has disconnected reason. you can check socket.connected property: var socket = io.connect(); console.log('check 1', socket.connected); socket.on('connect', function() { console.log('check 2', socket.connected); }); it's updated dynamically, if connection lost it'll set false until client picks connection again. easy check setinterval or that. another solution catch disconnect events , track status yourself.

c++ - 'sqrt' is not a member of 'std' -

i compile program in linux - has following line : std::sqrt((double)num); on windows ok,but on linux 'sqrt' not member of 'std' have include math.h what problem it? change directive #include <cmath> . c++ headers of form <cxxxxxxx> guaranteed have standard names in std namespace (and may optionaly provide them in global namespace). <xxxxxx.h> not.

c# - WPF DataGrid in ComboBox -

i'm trying add datagrid inside combobox try save screen space on complexed window. here code: <combobox grid.row="0" grid.column="0" > <combobox.itemtemplate> <datatemplate> <datagrid itemssource="{binding path=productlist, source={staticresource mainwindowviewmodel}}" autogeneratecolumns="false" width="500" height="80"> <datagrid.columns> <datagridcheckboxcolumn header="selected" isreadonly="false" /> <datagridtextcolumn header="name" binding="{binding name}" width="100" /> <datagridtextcolumn header="code" binding="{binding code}" width="100" /> </datagrid.columns> </datagrid> </datatemplate> </combobox.itemtemplate> <s

java - Prefill iphone calendar event via hyperlink -

i want prefill iphone calendar clicking hyperlink on website. what syntax url scheme pass event data calendar app? i want in way, clicking link event created 'this text' event name , 'description' description. i tried x-apple-reminder:// opens reminder app. how prefill event data? if trying access , send data parameter application via safari should try article http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html it explains url schemes under optionally handle url myapp:// myapp://some/path/here myapp://?foo=1&amp;bar=2 myapp://some/path/here?foo=1&amp;bar=2

c++ - Problems with std::chrono -

i having trouble compiling chrono, here code: time.hh #include <chrono> class time { protected: std::chrono::steady_clock::time_point _start_t; std::chrono::steady_clock::time_point _now; std::chrono::steady_clock::time_point _time; public: time(); time(const time &other); time &operator=(const time &other); ~time(); public: void start(); double getdursec(); double getdurmilsec(); private: void setnow(); }; compilation error: g++ -w -wall -wextra -i./include -std=c++0x -c -o src/time/time.o src/time/time.cpp in file included src/time/time.cpp:11:0: ./include/time/time.hh:21:3: error: ‘steady_clock’ in namespace ‘std::chrono’ not name type ./include/time/time.hh:22:3: error: ‘steady_clock’ in namespace ‘std::chrono’ not name type ./include/time/time.hh:23:3: error: ‘steady_clock’ in namespace ‘std::chrono’ not name type src/time/time.cpp: in member function ‘void time::st

html - a width and height 100% and text still at the bottom right - possible? -

i'm creating tiled nav , need fill tile, text still located @ bottom right position. however, when make width:100% , height:100% (in relation li), text jumps top left of area. know why happens, think understand whole idea, don't know how force jump bottom right while still filling tile. here's code: #menu { width: 900px; float: right; display: block; margin:0; padding:0; } #menu ul{ list-style:none; display: block; margin:0; padding:0; } #menu ul li{ display:inline-block; width: 146.5px; height: 146.5px; background-color: #1ba1e2; position: relative; } #menu ul li a{ text-decoration: none; color: #fff; display: block; padding-right:5px; padding-top:5px; width: 100%; height: 100%; and html: <div id="menu"> <ul> <li><a href="#">pies</a></li> <li><a href="#">kot</a></li> <li><a href="#"

c# - how can i read a DataTable from javascript -

i have function return datatable : public datatable sendonlinecontacts() { ... (int = 0; < friendsdt.rows.count; i++) { int friendid = convert.toint16(friendsdt.rows[i][0]); datarow[] friendisonlinerow = connectedclientdt.select("clientid=" + friendid); if (friendisonlinerow.length > 0) // friend online { // new sqlhelper(sqlhelper.connectionstrings.websiteconnectionstring).update("update clients set user_status='o' client_id=" + friendsdt.rows[i][0]); friendsinfo.rows.add(friendsdt.rows[i][0] + "," + friendsdt.rows[i][1] + "," + friendsdt.rows[i][2] + "," + "o"); } } return friendsinfo; } client side : $.ajax({ type: 'post', url: 'chatpagetest.aspx/sendonlinecontacts', data: '{}', contenttype: 'applic