Posts

C# patterns subclasses -

i have class person , 2 child classes staff , student , interface iperson . have class database , class gateway . class database has private string id = "username"; and method public void getid() {return id;} both staff , student have getid() methods. gateway has check if method getid() requested staff ( return id ) or student ( return "go away!" ). can please me that. thinking using gateway interface of database class, because trying learn c#, don't know how that. or maybe there's better way of doing this... please thanks here's code: public class staff : person { public staff() {} public staff(string id): base(id) {} public override string getname() { throw new notimplementedexception(); } public override void update(object o) { console.writeline(id + " notified {1}", id, o.tostring()); } public override void updatemessage(object p) { console.writeline(i...

extjs - Move Ajax respose data to store in Sencha touch -

how add or save data getting ajax request store or model sencha touch 2 have controller, store , model. ext.ajax.request(); called controller , when successful want move data store in json format ext.define('myapp.controller.homecontroller', { extend: 'ext.app.controller', config: { control: { "#homepage_id": { show: 'onhomepage_idshow' } } }, onhomepage_idshow: function (component, eopts) { var token = localstorage.getitem('token'); //************************************** console.log('test home', token); var customheaders = { 'content-type': 'application/json; charset=utf-8', 'apiauth': token }; this.callajax(customheaders); }, callajax: function (headers) { var customheaders = headers; ext.ajax.request({ url: 'http://local...

java - passing empty field as parameter in jasper ireport -

the query select * db_accessadmin.customersummary (accountnumber = $p{accountno} or $p{accountno}='') , (ppusermobile = $p{mobileno} or $p{mobileno}='') , ( ppuserstaticid = $p{customerid} or $p{customerid} = '') , (cast(requestdate date) between (cast($p{fromdate} date)) , (cast($p{todate} date))) the aim generate report in jasper depending on values of parameters. when parameters 'fromdate' , 'todate' empty , query should pull out entire rows in db. how can modify query accepts null values 'fromdate' , 'todate'. xml file <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="customersummary2" language="groovy" pagewidth="595" pageheight="8...

delphi - A form that does not handle mouse and keyboard event -

this question has answer here: click through transparent form 1 answer i want make form in delphi not handle mouse , keyboard events , pass them window below itself. how can this? you can make use of procedure blockinput of user32.dll you can try (with caution!): procedure bloqued(block:boolean); var milib: thandle; blockinput : function(block: bool): bool; stdcall; begin milib := getmodulehandle('user32.dll'); if milib <> 0 begin @blockinput := getprocaddress(milib, 'blockinput'); if @blockinput <> nil begin blockinput(block); end; end; end; procedure tform1.button1click(sender: tobject) ; begin bloqued(true); sleep(1000); bloqued(false); end; version without dinamic loading: function blockinput (block: bool): bool; stdcall; external 'user32.dll'; procedure tform1.button1click(...

amazon ec2 - Running Chrome on an AWS micro instance -

let me start saying server administration experience limited, please forgive me if i'm making assumptions might seem odd. i've written extension google chrome , i'd test stability when left running continuously days, unfortunately have no access pc or laptop can leave on 24/7. idea set ec2 micro instance ubuntu, install ubuntu-desktop , vnc server, , connect via vnc instance, access graphical desktop interface, install google chrome, add extension , let run there. does sound feasible, or silly idea? potential limitations run into? aws gives complete control of os you're suggesting makes sense. the main disadvantages of running gui on network come down bandwidth , latency issues, might want consider getting ec2 instance close region possible. keep in mind aws security groups, need configured allow vnc connection. micro instances aren't made production use, may find it's not true test of typical system. should factor test may more appropriat...

linux - Why does glob lstat matching entries? -

looking behavior in this question , surprised see perl lstat() s every path matching glob pattern: $ mkdir dir $ touch dir/{foo,bar,baz}.txt $ strace -e trace=lstat perl -e 'say $^v; <dir/b*>' v5.10.1 lstat("dir/baz.txt", {st_mode=s_ifreg|0664, st_size=0, ...}) = 0 lstat("dir/bar.txt", {st_mode=s_ifreg|0664, st_size=0, ...}) = 0 i see same behavior on linux system glob(pattern) , <pattern> , , later versions of perl. my expectation globbing opendir/readdir under hood, , not need inspect actual pathnames searching. what purpose of lstat ? affect glob()s return? this strange behavior has been noticed before on perlmonks . turns out glob calls lstat support glob_mark flag, has effect that: each pathname directory matches pattern has slash appended. to find out whether directory entry refers subdir, need stat it. apparently done when flag not given.

jquery - Assigning collection object of Tuple<String,String,String> to javascript variable in .NET MVC -

i have model collection of tuple <string,string,string> public class patientdetails { public collection <tuple<string,string,string>> fieldvalidationrules { get; set; } } view stronglytyped i.e patientdetails accessed in cshtml @model now want assign fieldvalidationrules object javascript variable can refer client validations per rules specified in collection. have following line of code: $(document).ready(function(){ _jsfieldvalidationrules = "@model.fieldvalidationrules"; }); but have problem here _jsfieldvalidationrules doesn't assigned values in "@model.fieldvalidationrules instead gets assigned to: system.collections.objectmodel.collection 1[system.tuple3[system.string,system.string,system.string]] what do make work. what do make work. use json serializer: $(document).ready(function() { _jsfieldvalidationrules = @html.raw(json.encode(model.fieldvalidationrules)); });