Posts

authorization - Achieving property value assignment control using a generic approach for POCO or plain C# entity classes -

i working on .net application & trying achieve following in c#. let's assume have entity employee class below few public auto implemented properties. assume have created attribute - beforepropertyset & have annotated of entity properties - in class below. class employee { [beforepropertyset("some delegate", "some other prop value")] public string address { get; set; } public string name { get; set; } public int age { get; set; } } what want can explained of code snippet - var e = new employee(); e.address = "confidential data"; //this assignment restricted user x //whereas allowed user y e.name = "general data"; whenever assign value property, if property annotated special attribute beforepropertyset callback common function standard thing across application. example, if currentuser not expected view value being assigned new value assignment can cancelled. this approach enables me remove attribut...

Regex expression to return match if word is found at a particular distance from another word -

i need build regular expression return true or false specified word in same sentence either word "county" or "counties" , comes either before or after either of words , no more either 10 words or 100 characters apart "county" or "counties". for example : county test test1 test2 word test3 test4 or test test1 test2 test3 word test4 test5 counties test6 test7 should return true , while counties test1 test2 test3 test4 test5 test6 test7 test8 test9 test test8 test3 test4 word test5 test7 should return false here got: \bword\w+(?:\w+\w+){0,10}?counties\b i added county works far if words county and/or counties after word: \bword\w+(?:\w+\w+){0,10}?(counties|county)\b can please point me in right direction? does solve problem? tried on regex101 word\s\w*(?:(?!word)\w+\w*){0,10}?(?:counties|county)|(?:counties|county)\s\w*(?:\w+\w*){0,10}?word

c# - How to make WCF service available in a local network? -

i'm new in wcf. wrote simple service: namespace wcfservice1 { [servicecontract] public interface iservice1 { [operationcontract] int add(int a, int b); } } namespace wcfservice1 { public class service1 : iservice1 { public int add(int a, int b) { return (a + b); } } } how can let local network access service? there several ways host (i think that's mean publish in context) wcf service: hosting in internet information services (iis) hosting in windows activation services (was) hosting in console or desktop application (self hosting) hosting in windows service where option 1 , 4 interesting if service more test project ;-) take @ tutorial more information: http://www.codeproject.com/articles/550796/a-beginners-tutorial-on-how-to-host-a-wcf-service

actionscript 3 - How to transform seconds in minutes ? in Flex -

my problems have value...75 seconds , want display in grid 1:15 minutes... how can ? i'm trying this... xmlcttsemacao = new xmllistcollection(event.result..ctt); var i:int = 0; each(var node:xml in xmlcttsemacao) { xmlcttsemacao[i].@dur_ctt = (xmlcttsemacao[i].@dur_ctt / 60) %60; i++; } xmlcttsemacao.refresh(); gp2.refresh(); but result example is: 1:25 another example...56 seconds displaying 0.933333 first, split bit, calculate seconds , minutes before putting them together: for each(var node:xml in xmlcttsemacao) { var durctt:int = xmlcttsemacao[i].@dur_ctt; var seconds:int = durctt % 60; var minutes:int = durctt / 60; var timedisplay:string = minutes + ":" + seconds; xmlcttsemacao[i].@dur_ctt = timedisplay; i++; }

arrays - PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" -

i running php script, , keep getting errors like: notice: undefined variable: my_variable_name in c:\wamp\www\mypath\index.php on line 10 notice: undefined index: my_index c:\wamp\www\mypath\index.php on line 11 line 10 , 11 looks this: echo "my variable value is: " . $my_variable_name; echo "my index value is: " . $my_array["my_index"]; what these errors mean? why appear of sudden? used use script years , i've never had problem. what need fix them? this general reference question people link duplicate, instead of having explain issue on , on again. feel necessary because real-world answers on issue specific. related meta discussion: what can done repetitive questions? do “reference questions” make sense? notice: undefined variable from vast wisdom of php manual : relying on default value of uninitialized variable problematic in case of including 1 file uses same variable name. majo...

travis ci - Choose a specific Ubuntu version -

if i'm using default travis file looks build machine ubuntu precise. hit http://ppa.launchpad.net precise release.gpg is there tweak use trusty or utopic machine? this implemented, add .travis.yml : dist: trusty to use ubuntu trusty.

LightSwitch HTML Client: How to set the value of a computed property based on another computed property -

before asking question, make simple example make question clear. in lightswitch html client, have table 1 column: "amount" i made computed property, "amountplustax" , set value follow, myapp.browsetransactions.amountplustax_postrender = function (element, contentitem) { contentitem.databind("data.amount", function () { $(element).text(parsefloat(contentitem.data.amount) * 1.05); }); }; as see, amountplustax = amount * 1.05 the problem have want make computed property value depends on value of "amountplustax" computed property. like, amountplustaxplusinterest = amountplustax * 1.03 how possible? this doesn't work: myapp.browsetransactions.amountplustaxplusinterest_postrender = function (element, contentitem) { $(element).text(parsefloat(contentitem.screen.amountplustax) * 1.03); }; although doesn't directly answer question, alternatively capture inserting/inserted/updating/upda...