Posts

Showing posts from July, 2015

unit testing - What is the difference between Classic and Constraint Model Assertions in Nunit? -

i learning nunit-2.6.3 reading documentation. having few doubts it. what difference between classical model , constraint model assertion? which model of assertions best one, , why? the main difference syntactic. it's difference between (classic): assert.areequal("expected", somestring); and (constraint) assert.that(somestring, is.equalto("expected")); classic mode has been around longer , people believe it's more explicit , easier follow. other people believe constraint based approach closer way might constraint if explaining else. if you're getting started, constraint based assertions better ones learn, since they're direction nunit appears trying head in. they're closer fluentassertions . constraint based assertions has more explicit support extension through use of iresolveconstraint interface. you should gain awareness of classic assertions since there's chance different places encounter code may use ei

c# - What could be reason of AutoMapper failed? -

i suppose reason of automapper failed different fields of domain model , view model. here domain model: public partial class users { public int id { get; set; } public string login { get; set; } public string password { get; set; } public int roleid { get; set; } public virtual userroles userroles { get; set; } } so here view model: public class usersviewmodel { public int id { get; set; } [required] [minlength(3, errormessage = "Минимальная длина логина - 3 символа")] [maxlength(50, errormessage = "Максимальная длина логина - 50 символов")] [display(name = "Логин")] public string login { get; set; } [required] [minlength(8, errormessage = "Минимальная длина пароля - 8 символов")] [maxlength(50, errormessage = "Максимальная длина пароля - 50 символов")] [display(name = "Пароль")]

jquery - onclick function is not repeating inside javascript for loop -

this question has answer here: javascript closure inside loops – simple practical example 31 answers i want repeat jquery function dynamically n-numner of times. alert working number of count function not created many times. code below var count = 5; var = 1; (var = 1; <= count; i++) { var min = ".min" + i; alert(min); // testing purpose, working document.writeln(min); // testing purpose, working alert(i); // testing purpose, working // following function not repeated, $(document).ready(function () { $("min" + i).click(function () { alert(i); }); }); } my body section code follows <div class="min1"> test - 1 </div> <div class="min2&

Getting time frequency of number in array in Python? -

let's have time series represented in numpy array, every 3 seconds, data point. looks (but many more data points): z = np.array([1, 2, 1, 2.2, 3, 4.4, 1, 1.2, 2, 3, 2.1, 1.2, 5, 0.5]) i want find threshold where, on average, every y seconds data point surpass threshold ( x ). maybe question easier understand in sense: let's i've gathered data on how many ants leaving mound every 3 seconds. using data, want create threshold ( x ) in future if number of ants leaving @ 1 time exceeds x , beeper go off. key part - want beeper go off every 4 seconds. i'd use python figure out x should given y amount of time based on array of data i've collected. is there way in python? i think easiest first think in terms of statistics. think saying want calculate 100*(1-m/nth) percentile, number such value below 1-m/nth of time, m sampling period , n desired interval. in example, 100*(1-3/4th) percentile, or 25th percentile. is, want value exceeded 75%

activerecord - SQL self referencing query -

i have schema 4 tables users, groups, memberships & membershipcontrols memberships m:m between users & groups. membership controls specify groups user must member of member of group. for example member of "green" group user must member of either "blue" or "yellow" groups. when user member of "green" group membership contingent upon them being member of either "blue" or "yellow" groups. if user ceases member of "blue" group existing memberships remain if cease member of "yellow" group "membership of "green" should deleted. i trying work out sql delete records memberships in violation of membership controls. http://sqlfiddle.com/#!9/302d2 based fiddle above following memberships valid: (1, 1, 1) (2, 1, 2) (3, 1, 3) (4, 1, 4) if middle 2 memberships above of green & blue removed valid memberships be: (1, 1, 1) i.e. if memberships table contained: (1, 1, 1) (1, 1

permissions - C# Folder ACL's not applying -

i have started learning c# project @ work write updated user creation tool replace our old vbscript tool. far have completed active directory side of having issues folder acl's when creating profile folder. i have made function remove folder acl's , start scratch function add acl's folder not seem work. here function: public void createfolderacl(string folderpath, string account, filesystemrights rights, accesscontroltype controltype) { try { directorysecurity fs = directory.getaccesscontrol(folderpath); authorizationrulecollection rules = fs.getaccessrules(true, true, typeof(system.security.principal.ntaccount)); fs.addaccessrule(new filesystemaccessrule(@"domain\" + account, rights, controltype)); directory.setaccesscontrol(folderpath, fs); } catch(exception e) { console.writeline(e); } } when pipe in createfolderacl(userdata["prof

Sending information through bluetooth using Javascript -

i'm planning on making html5 chrome app users able connect each other using bluetooth , able send messages. how can this. phonegap can hybrid apps: https://github.com/bcsphere/bluetooth otherwise appears ability use bluetooth html5 removed spec. more information, see other question: html5 bluetooth , audio

objective c - Fast Enumeration over NSMutableArray problems -

i having issues trying wrap head around why can not mutate collection during enumeration... apparently, if doing sort of fast enumeration, system should throw exception if try mutate. below have 3 examples mutating during enumeration. 1 simple c-style loop, , other 2 use form of fast-enumeration. getting enumeration exceptions thrown case 2. shouldn't getting exceptions thrown case 1? why case 1 valid? also, people throughout stack overflow case 3 bad practice, why? simple , seems work. inconsistency in how 2 different fast-enumeration loops behaving , general disgust c-style loop screwing understanding here. instead of vague generic rules of thumb, if can break down science help. fundamental level want know why exceptions not consistent here , why case 3 works me when apparently "shouldn't" or "bad practice." //case 1: nsmutablearray *array = [nsmutablearray arraywithobjects:@"phuj", @"whub", @"adgh", nil]; [array enumera

Parsing a Python JSON -

i trying parse below json, , extract name , interval elements. reply "[ { "interface" : [ { "name" : "ethernet39", "number" : 39, "rate" : [ { "interval" : 45, "rx-bad-vlan-rate" : 0, "rx-broadcast-packet-rate" : 0, "rx-byte-rate" : 0, "rx-drop-rate" : 0, "rx-error-rate" : 0, "rx-multicast-packet-rate" : 0, "rx-unicast-packet-rate" : 0, "timestamp" : "2015-06-18t21:59:23.703z", "tx-broadcast-packet-rate" : 0, "tx-byte-rate" : 0, "tx-drop-rate" : 0, "tx-error-rate" : 0, "tx-multicast-packet-rate" : 0, "tx-unicast-packet-rate" : 0 }, { "interval" : 45, "rx-bad-vlan-rate" : 0, "rx-broadcast-packet-rate" : 0, &quo

In Elixir how do you initialize a struct with a map variable -

i know possible create struct via %user{ email: 'blah@blah.com' } . if had variable params = %{email: 'blah@blah.com'} there way create struct using variable eg, %user{ params } . this gives error, wondering if can explode or other way? you should use struct/2 function. docs: defmodule user defstruct name: "john" end struct(user) #=> %user{name: "john"} opts = [name: "meg"] user = struct(user, opts) #=> %user{name: "meg"} struct(user, unknown: "value") #=> %user{name: "meg"}

Javascript setting object with variable -

this question has answer here: how add property javascript object using variable name? 7 answers i'm trying set object using variable. here's have: var sortby = 'post_date'; var sort = { sortby : 'asc' }; but when console.log(sort) object {sortby: "asc"} how can set key of object value of variable? prior es6 (the newest javascript standard), following: var sortby = 'post_date'; var sort = {}; sort[sortby] = 'asc'; however, if made sure can use es6 features you're doing, possible: var sortby = 'post_date'; var sort = { [sortby]: 'asc }; see pages more information on es6 features: https://github.com/lukehoban/es6features

node.js - Nodejs Order of properties guarantee -

note: using nodejs may or may not have subtle differences vanilla ecmascript's standards. i have heard when using for-each loop iterate on properties of object, should not count on properties being in same order. (even though in practice have never seen case objects iterated on in different order). in production, have believe typo object created overwritten property. var obj = { a: 'a property', b: 'another property', c: 'yet property', a: 'woah have a?' } in nodejs, guaranteed second property containing string 'woah have a?' always shadow first property containing string 'a property' ? (even though in practice have never seen case objects iterated on in different order) following should give different order in v8 atleast. var obj = { "first":"first", "2":"2", "34":"34", "1":"1", "second":"secon

.net - Cast IEnumerable(Of String) to my sub-classed List(Of String) -

i have class inherits list: public class textlines : inherits list(of string) end class now, how can cast return value of type ienumerable(of string) custom class? real example of i'm trying do: dim lines textlines lines = ctype(file.readalllines(me.filepathb, me.encodingb).tolist, textlines) it throws invalid cast exception. why don't this? dim lines new textlines() lines.addrange(file.readalllines(me.filepathb, me.encodingb)); or expose constructor takes ienumerable<t> ?

python - Using MySQL database twice in the same function returns a 1 instead of actual string -

i struggling understand why getting 1 returned after second time use database in function. need access 2 different tables information need. class getsubdivs: def __init__(self): self.con = mdb.connect('localhost', 'root', 'root', 'shannon') self.cur = self.con.cursor() def openconnection(self): self.con = mdb.connect('localhost', 'root', 'root', 'shannon') self.cur = self.con.cursor() def closeconnection(self): self.con.commit() self.cur.close() def getallsubdivsfortable(self): self.cur.execute('select * subdivs') info = self.cur.fetchall() print info dict = {} #dictionary object creates rr collection of rr resources x in info: littledict = {} #makes little dictionary object fill other dictionary object id = x[0] name = x[3] que = ('select railroa

How to handle the File hand-off from windows in a python program -

i want set python program process pdfs opened on system, , hand processed pdf off standard reader. so register program windows default handler .pdf files , windows presumably run program on pdf file. how within script access file. file name 1 sys.argvs ? i didn't google work me here. so, yes, windows passes file name script 1 of sys.argvs. (so far can tell printing value) file name without path, used open file, tells me windows starts program working directory set directory of file it's called on. one word of caution, gotcha of sorts, registering .py default handler, did not work -- clicking on file, resulted in windows complaining file not valid windows executable. didn't research turned .py .exe (py2exe) , registered that default file handler did work. update, did not test out told specifying python interpreter script default file handler solve "not valid" issue. "c:\python2.7\python.exe yourscript.py %*" %* make file name ma

html - Anchor tags not working -

i have few anchor tags in html reason aren't working. far can tell there nothing wrong code @ loss. maybe need fresh pair of eyes on see if there obvious missing? website not loaded onto server yet here code having issues with. <div id="navigation"> <div class="wrapper"> <div class="right"> <div class="phone-number"> <p>24hr turn around time 1-877-229-9665</p> </div> <div class="social-media"> <a href="https://www.facebook.com/archfitters" target="blank"><img src="images/facebook.png"></a> <a href="https://twitter.com/archfitters" target="blank"><img src="images/twitter.png"></a> <a href="http://www.yelp.com/biz/arch-fitters-portl

angularjs - Add text parameters in angular ui-sref -

i trying add parameters ui-sref. if try works <a ui-sref="services.test({ id: 2 , other_id: 3 })">test</a> but if try don't work <a ui-sref="services.test({ id: firstexmple , other_id: secondone })">test</a> if try set id literal value "firstexample" , other_id "secondone" need write them write strings in plain javascript code, so: <a ui-sref="services.test({ id: 'firstexmple' , other_id: 'secondone' })">test</a> (mind can't use double quotes (like id: "firstexmple" ) because you're using them wrap whole ui-sref attribute's value.

sql - Oracle Express 11g command -

i'm trying run sql command oracle express 11g, , it's giving me error message: no rows selected select employee_id, employee_name, department_name employees join departments using (department_id) employee_id < 103 , employee_id > 203; the question asks: employee identification number, employee name, , department name employees identification number less 103 or greater 203. your code uses and logical operator instead of or operation. since number (the id, in case) cannot both less 103 , greater 203, no rows. just replace and or , should fine: select employee_id, employee_name, department_name employees join departments using (department_id) employee_id < 103 or employee_id > 203; -- here -----------------^

flash - Actionscript 3 - Accessing a variable on the main timeline -

i'm trying make file easy non-flash user use/reuse display content. key here file template novice user copy/paste minimal code create different "flash card" type swf files. the file creating has multiple buttons on main timeline when clicked, attaches movie clip display dynamic text area content specific button clicked. content text area loaded separate text file. for sake of example, i'm going refer 1 button... so, on main timeline, in frame 1, have variable definition: var myfilename1:string = "mysamplefile2.txt"; when button on main timeline, in frame 1 pressed, movie clip loaded contains text area. content text area located in file: mysamplefile2.txt . if hard-code file name, works dream: mytextloader.load(new urlrequest("mysamplefile2.txt")); but don't want hard code file name. want refer variable in main timeline. in 2, have been mytextloader.load(new urlrequest(_root.myfilename1)); in as3 thought either: m

sql - How to create a "live" feed for two seperate Postgres Instances? -

so feel pretty confident inside of postgres have interesting problem in opinion. i have local postgres instance , remote postgres instance. remote instance read production server. need able pull records , generate views/tables/reports/whatever. how can accomplish that? currently using dblink running every 15 minutes pretty resetting local instance dropping objects , using pgagent jobs rebuild objects ready next cycle. labor intensive make changes , worse troubleshoot. my eventual solution make views through dblink. clunky speed increase substantial , worth more restrictive coding requirements connection.

Entity Framework Nested Table Relation SelectMany -

my problem following query return 0 records.but there records in database. my aim subjectquestion select table subjectid equal questionmodel. how can do. thank you. [my models] subjectquestion public class subjectquestion { public int id { get; set; } public int subjectid { get; set; } public int questionid { get; set; } public virtual list<question.question> question { get; set; } } question public class question { public int id { get; set; } public int questionno { get; set; } public string title { get; set; } public string description { get; set; } public bool isdeleted { get; set; } public questionmodel tomodel() { return new questionmodel(id,questionno,title,description,choiceid); } } questionmodel public class questionmodel { public questionmodel(int id, int questionno, string title, string description,int choiceid) { id = id; questionno = questionno; title =

java - Does JMS require hsqldb files in jboss 5.x? -

i trying remove hsqldb files jboss server part of server security. after removing can't deploy project while deploying throws queue not bound exception. due jms queue. jms queue depends on hsqldb? if there workaround. jms in jbossas 5.x (and older) uses datasource store messages. default, points @ standard hsqldb 1 configured. if remove hsqldb datasource need either: replace database remove standard jms queue & topic configurations i think find uses datasource persisting ejb timers.

Rails cocoon f.fields_for not working -

i'm working project requires nested forms add multiple valves single order (order called rfq in case). i error: actionview::template::error (uninitialized constant rfq::valf): 48: </div> 49: 50: <div id="valves"> 51: <%= f.fields_for :valves |valve| %> 52: <%= render 'valve_fields', f: valve %> 53: <% end %> 54: <%= link_to_add_association 'add valve', f, :valves %> here's relevant part of form partial, <%= form_for @rfq |f| %> ... <div class="field"> <%= f.label :application %><br> <%= f.text_field :application %> </div> <div id="valves"> <%= f.fields_for :valves |valve| %> <%= render 'valve_fields', f: valve %> <% end %> <%= link_to_add_association 'add valve', f, :valves %> </div> <div class="actio

Google Bigquery: Not adding data. No errors -

i had bigquery table adding data regularly on past few months. yesterday created new table in same dataset handle other data. however, when tried adding data, nothing happened. i adding data using function "bigquery.tabledata.insertall" in script made , response "{kind=bigquery#tabledatainsertallresponse}", suppossed mean there no errors. when queried select * [<mydataset>.<mytableid>] table in ui, said there 0 results. soon after, noticed original table wasn't getting new data. tried deleting new table made hasn't fixed it. the scripts still working , know json in correct format. tried adding 1 row 1 field @ time , didn't work. {kind=bigquery#tabledatainsertallrequest, rows=[{json={tranid=3427412}, insertid=row3427413}]} anyone encountered problem? also first time posting here if didn't follow rules or provide enough information please let me know. thanks

ios - APNS_SANDBOX tokens deactivate instantly on Amazon SNS -

we use amazon sns send our push notifications different platforms. i've hit unique snag , looking solve it. on our apns_sandbox application, token inserted phone signed mobile developer , ios team provisioning profile instantly deactivate when message sent end point. without error, aws console says message delivered, if refresh list of end points, end point deactivated. our apns (production) push works fine, when app signed release proper provisioning profile. sandbox won't deliver push notifications phone. full disclosure, have posted on sns product forums support, it's been days , have not had reply.

php - PDO query to display on id information -

i have following table: tbl_users ============== id username password email i have following code id's of users , want display id field. can't work. $db = $db_con; $stmt = $db->prepare("select * tbl_users"); $result = $stmt->execute(); while ($row = $result->fetchall(pdo::fetch_assoc)){ echo $row['id']; } i keep getting following error: notice: undefined index: id in fetchall returns all of rows. shouldn't call inside loop. you can solve in different ways. here one: // entire dataset $rows = $result->fetchall(pdo::fetch_assoc)); // loop through array foreach ($rows $row) { echo $row['id']; } another way (the 1 intended write), fetch rows 1 one using fetch instead of fetchall : while ($row = $result->fetch(pdo::fetch_assoc)) { echo $row['id']; } by way, if you're going need id , it's best practise select id yourtable instead of selecting using * . make query (an

javascript - Accessing parent helper in Meteor -

i find myself dividing work templates still use same helpers. so, have template structure: <template name="maintemplate"> <div>{{> firsttemplate}}</div> <div>{{> secondtemplate}}</div> <div>{{> thirdtemplate}}</div> <div>{{> fourthtemplate}}</div> </template> now each of these templates wants use same helper, let's call datahelper : template.maintemplate.helpers({ datahelper: function() { //do stuff return result } }) sadly, helper can't accessed in template first through fourth typing {{datahelper}} how events work. my solution has been create global helper instead, seems tad overkill, since have few pages don't care these helpers @ all. solution create 4 separate helpers but, hey, dry. am missing simple here? there isn't obvious way in current version of meteor. 1 solution child template "inherit" helpers parent. can pretty using

java - checking whether an object is present in a List of Objects on the basis of some member variable -

suppose have defined list private blockingqueue<mydelayed> delayedids = new delayqueue<>(); class mydelayed like: private class mydelayed implements delayed { private string myid; private long creationtime; mydelayed (string myid) { this.myid= myid; this.creationtime = system.currenttimemillis(); } string getmyid() { return this.myid; } @override public long getdelay(timeunit unit) { //todo } @override public int compareto(delayed o) { //todo } } now suppose want add object of class mydelayed in delayedids list. can using add function. but if want add obbject in list if list not contain object of class mydelayed has same myid attribute trying insert. obviously delayedids .contains(new mydelayed(myid)) not work. is there easy way check thing ? missing ? you write , compare every element in list see if contains id. if @ point find matching 1 return true,

excel - I need to convert a log file into an XSL sheet -

i need convert log file xsl sheet- format of log file looks like- 73445971 [webcontainer : 3] error error.com.xyz.cat.csd.datarqst.model.datarequestcollection - {event id=9248285763 | time=2015-05-25-00.22.11.822000 | event type=error | request id=_3acunq3qj_g4omm7z3dmcs | lifecycle=qa | application id=xyz | application version=2015-05-21-015732 | host name=lzbita18 | server instance=18_cl1_web20_qa_m1 | client descriptor=sxyz | user id=@1224 | request descriptor=https://abcb04.xyz.com/csd/alert.do | session id=_3acunq3qj_g4omm7z3dmcs | session create timestamp=2015-05-25-00.19.03.326000 | global session id=231cf811:_3acunq3qj_g4omm7z3dmcs | remote address=10.230.9.164 | message=missing provision data request: | method=getdatarequest() | severity=error} 77379848 [webcontainer : 3] error error.com.xyz.cat.csd.connectivity.connectivityexception - {event id=1823361457 | time=2015-05-25-01.27.45.697000 | event type=error | request id=mkhel__utfhau8qoshrqhhp | lifecycle=qa | appli

perl - Why does my value change when I am not resetting it? -

i have following example exhibiting problem i'm struggling resolve. in toy example, have array @actors 2 levels. have array of hashes @people using 'look up' properties of people in @actors . the output of program should be: blue, blue cat, cat red, red dog, dog blue, blue cat, cat red, red dog, dog but instead i'm getting: blue, cat cat, cat red, dog dog, dog blue, cat cat, cat red, dog dog, dog that is, seems in setting $favanim[$i][$j] seem overwriting value of $favcols[$i][$j] . suspect reason fact @actors 2-dimensional array means assignments via = references rather values, though don't know why or how stop it. please help! the toy program here: (i apologise if can simplified whilst still exhibiting problem - has taken me of afternoon strip down this) #!/usr/bin/perl -w @people = (); $people[0]{'alternative full names regexp'} = 'matthew smith|matt smith'; $people[1]{'alternative full n

c - modify array element through pointer to a pointer -

i'm trying build program modifies element of array through pointer pointer. loaded debugger , see value of pointer changes, reason doesn't affect element in array. pointer syntax wrong? reassigning pointer somewhere else? #include <stdio.h> #include <stdlib.h> #define size 6 /* * */ void change (char **x); int main() { char arra[] = "back"; char *c = arra; change(&c); int i; printf("%c", arra[0]); } void change (char **x) { *x = "h"; } *x = "h"; should be **x = 'h'; you trying modify first character , character has within single quotes. there no need of pointer pointer here. can pass array decays pointer when passed in function parameterks shown @haccks

jsf - Retrieve the id of an Entity object as soon as the entity was instantiated? -

is there way in jpa retrieve id of entity object entity instantiated? e.g person person = new person(); currently using in entity class following strategy: @generatedvalue(strategy = generationtype.identity) if not there "dummy id" strategy having dummyid e.g -10 etc before actual primary key set table in database? please note primary key in mysql db set autoincrement. the reason need able add new entities in lists , sort them using there id in jsf datatables before persisting them in db. there no way retrieve id before persisting - because has no id until persist entity. has nothing strategy. has concurrence. but can add own temporary key use case: @entity public class person { private static final atomiclong counter = new atomiclong(); @id @generatedvalue(strategy = generationtype.identity) private long id; private final transient long tempid = counter.decrementandget(); public long getidforcomparison() { return id

Android - Re-use TextView showing current date time in multiple activities -

i have activities displaying current date , time. want make 1 text view (layout) txttime showing time , updated each second handler in main activity. others views of other activities can re-use text view txttime including. (i want 1 handler updating date/time value , app activities can display value) in fact, don't know how create/access text view txttime. usual find text view (activity).findviewbyid(r.id...). since not belongs activity got stuck there. my pb: how use textview application circle object doesn't belongs activity? how change text value(date or time)? do have suggestion/solution me? thanks, @ reponse of remy: want : static final textview apptimetext = new textview(appcontext);, , in handler apptimetext.settext("text"); when create latout in activity simple add it. – remy tell me if understand currectly, dont want make textview inside activity, because want use in life circle of application? if im understand currect want application

datetime - subtracting time for date time in SQL Developer -

i using sql developer (3.1.06) pull information dwhp. want subtract time (hh:mm:ss)--> timecol_3 date time (dd/mm/yy hh:mm:ss)-->datetime_col4, (10/01/15 01:00:00)-(03:00:00) should display (09/01/15 22:00:00). now date time wasnt combined intially , neither in above format. (they in mm/dd/yyyy , hhmma or hhmmp format), used following syntax bring (dd/mm/yy hh:mm:ss) format--> to_char(to_date(datecol_1 || ' ' || timecol2, 'dd/mm/yy hh24:mi:ss'), 'dd/mm/yy hh24:mi:ss') datetime_col4 could please help?? it looks data in string format (based on manipulations performed in bolded text): to_char(to_date(datecol_1 || ' ' || timecol2, 'dd/mm/yy hh24:mi:ss'), 'dd/mm/yy hh24:mi:ss') datetime_col4 in oracle it's best work dates in native date type rather converting them , character data types, datetime_col4 better represented so: to_date(datecol_1 || ' ' || timecol2, 'dd/mm/yy hh24:mi:ss') d

css - How to make horizontal list of bootstrap 3 panels responsive? -

i'm using bootstrap 3 , struggling make horizontal list of panels responsive. html below. renders fine in browsers on mobile resolution text not responsive. ideas missing? <body> <div class="container"> <div class="row"> <div class="col-xs-2"> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title">sprinkler system <br />test & inspection</h3> </div> <div class="panel-body"> lorem ipsum dolor sit amet, qui ne iudicabit honestatis. cu utroque adversarium usu, ius ut autem consulatu. </div> </div> </div> <div class="col-xs-2"> <div class="panel panel-primary"> <div class="p

c# - Making an appliction so it is the only application that can connect to my WebAPI -

how possible create application interact webapi . app send info website( webapi ) , , update database info, problem how secure it, app can interact website? the application designed deployed many computers. , users can use application anonymously. example the lightshot app you can't limit access web site (or ip port) 1 app. validate requests on server , possibly allow access authenticated users - should enough cases (except payed games). you can make harder replay/re-create communication protocol: require client certificate https connect frequently change code client , protocol itself only allow authenticated users rate-limit requests same user make harder revere engineer protocol...

android - smoothScrollToPositionFromTop not smooth when going to a lower index -

i need listview scroll @ specific position @ time, putting row @ position @ top of listview. for purpose use smoothscrolltopositionfromtop(int position, int offset, int duration) now let's wand go index 6 10, scrolls smoothly. after let's want go backward, 5 instance, scrolling not smooth @ all, looks rapid translation. any idea missing or workaround? i think using smoothscrolltopositionfromtop() while going back causing problem. prefer use of smoothscrolltoposition() .

asp.net mvc - Allow user to update view content once, for every page the view is on? -

new mvc , umbraco, chugging along. one issue have have view @ present displays images & text (sprinkled css). view found on number of pages, , having ability update in 1 place, changes pages view included great. but i'd able allow user update simple text / images on view. i'd go , create properties on document type, user can edit in content section. there anyway can without having create same properties on each page view on? means user has update view on every page present, means loses benefit of being view! perhaps don't understand umbraco yet. i'm asking if can allow user update view once in umbraco, , changes filter through pages view on. without creating properties each page. i can supply code, more of logic question, don't have problem code such. hit me if need more information. thanks in advance. the content logo, copyrights appear on pages, can add properties document type of home page, in master page, can home page , fetch prop

java - Validation of text fields and contact no text field -

i have jframe consisting of text fields (10) , textarea. want validate text fields , see if not empty , check if 10 digit contact no entered in 1 of text field. after checking text fields, want enable submit button used submit dat database. i used following code adding text area condition not working,gives error:- exception in thread "awt-eventqueue-0" java.lang.nullpointerexception here code used not working:- public class dataentered1 implements documentlistener { private jbutton button; list<jtextfield> txtfields=new arraylist<jtextfield>(); jtextarea ta; public dataentered1(jbutton dbadd) { this.button=dbadd; } public void addtextfield(jtextfield txtfield) { txtfields.add(txtfield); txtfield.getdocument().adddocumentlistener(this); } public void addtextarea(jtextarea ta) { this.ta=ta; ta.getdocument().adddocumentlistener(this); } public boolean isdataentered

openldap - How to provide multiple search base in ping federate? -

i have multiple dit in ldap. (dc=example,dc=com , dc=test,dc=com) . under create credential validator instance, not able give more 1 search base. tried give search base: dc=example,dc=com dc=test,dc=com dc=example,dc=com : dc=test,dc=com dc=example,dc=com ; dc=test,dc=com dc=example,dc=com | dc=test,dc=com should try other combinations? note : connecting multiple datastores can accomplished. you can't support multiple ldap suffix single pingfederate data source or password credential validator. create single data source , create single pcv each suffix wish search. if using html form adapter, can use multiple pcv when attempting authenticate user's identity.

java - How can I test my Struts 1.2 web application without server? -

i have struts 1.2 web application. has service & dao classes well. how can test each , every layer without web/application server. heard, spring provides same facility spring mvc application. how can test application end end? please suggest? struts 1 officially deprecated , no longer maintained. in addition, hard imagine developping web application without local server on developpement machine. eclipse or netbeans both offer possibility use local tomcat or [whatever prefered servlet container]. anyway, if corporate policies require it, try search old tools used struts 1, hoping can still find enough resources them. can remember : strutstestcase junit : strutstestcase junit extension of standard junit testcase class provides facilities testing code based on struts framework. strutstestcase provides both mock object approach , cactus approach run struts actionservlet, allowing test struts code or without running servlet engine. apache cactus - in attic since 20

ios - Is it somehow possible to define a property in Interface-Builder and read this property in code? -

i have 3 uitextfield's want limit in length. first , second text field 24 characters , third text field 32 characters. i found this solution limiting characters in uitextfield works fine: #define maxlength 10 - (bool)textfield:(uitextfield *) textfield shouldchangecharactersinrange:(nsrange)range replacementstring:(nsstring *)string { nsuinteger oldlength = [textfield.text length]; nsuinteger replacementlength = [string length]; nsuinteger rangelength = range.length; nsuinteger newlength = oldlength - rangelength + replacementlength; bool returnkey = [string rangeofstring: @"\n"].location != nsnotfound; return newlength <= maxlength || returnkey; } but solution suggests, every text-field limited same length (i.e. 10 characters defined @ top of code snippet). wondering if there chance define kind of property each of text-fields separately in interface-builder of xcode allows me read out in code -- replace "maxlength" &qu

xpages: convert from org.openntf.xsp.bootstrap.library to extension library? -

is there easy way modify application has been built using bootstrap4xpages uses same code has become part of extension library? allow application updates guess bootstrap4xpages plugin won't updated anymore. thanks :) if application uses select2 control, you'll still need both in xsp.properties. that's because there licensing issues prevented select2 control being included in extension library plugin. otherwise, per says, can remove org.openntf.xsp.bootstrap.library reference xsp.properties.

smartcard - How do I interpret the response from GET PROCESSING OPTIONS? -

i'm communicating visa electron debit card via acr reader , following response get processing options command: 80 0a 1c 00 08 01 03 00 10 01 01 00 90 00 how should interpret response, when there's no afl (application file locator) nor aip (application interchange profile) in it? here's full communication log: select psev2: 00 a4 04 00 0e 32 50 41 59 2e 53 59 53 2e 44 44 46 30 31 00 select psev2 returned: 6a82 - wrong parameter(s) p1 p2; file not found select psev1: 00 a4 04 00 0e 31 50 41 59 2e 53 59 53 2e 44 44 46 30 31 00 select psev1 returned: 6a82 - wrong parameter(s) p1 p2; file not found select adf: 00 a4 04 00 07 a0 00 00 01 52 30 10 00 select adf returned: 6a82 - wrong parameter(s) p1 p2; file not found select adf: 00 a4 04 00 07 a0 00 00 00 03 10 10 00 select adf returned: 6a82 - wrong parameter(s) p1 p2; file not found select adf: 00 a4 04 00 07 a0 00 00 00 03 20 10 00 select adf returned: 6f 2c 84 07 a0 00 00 00 03 20 10 a5 21 50 0d 56 49 53 41 20

jquery - How to create a preloader for audio,video,css,images in HTML 5? -

how implement preloader functionality in html 5 audio, video, css , images files. please let know how resolve? use this, utillizes preloader functions see need https://github.com/pazguille/aload and css i'd recommend https://github.com/filamentgroup/loadcss

javascript - Groupby without using underscore js -

i have collection group id. each id contains array of objects. want loop through , create target collection group "id" column shown on example. not use underscore js. have use javascript reduce method achieve this. var targetcollection = [{ 123456: [ { "id": "1", "name": "xxx", "age": "22" }, { "id": "1", "name": "yyy", "age": "15" }, { "id": "5", "name": "zzz", "age": "59" } ], 789456: [ { "id": "1", "name": "xxx", "age": "22" }, { "id": "1", "name": "yyy", "age": "15" }, { "id": "5", "name": "zzz", "age": "59" } ] }] var targetoutput

java - Asynchronous Task error in doInBackground method -

i have try code public class splashscreen extends activity { string urls = "xxxxxxxxxxxxxxx"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.requestwindowfeature(window.feature_no_title); setcontentview(r.layout.splash_screen); if (android.os.build.version.sdk_int > 9) { strictmode.threadpolicy policy = new strictmode.threadpolicy.builder() .permitall().build(); strictmode.setthreadpolicy(policy); } try { new mytask().executeonexecutor(asynctask.thread_pool_executor); } catch (exception e) { // todo: handle exception } } class mytask extends asynctask<void, void, void>{ @override protected void doinbackground(void... params) { rssfeed_saxparser saxparser = new rssfeed_saxparser(urls); log.i("clearbef", "----------------cache-clear-----------"); log.v("gettitlelist",

html - Input transition -

i try animate search button. when click on it, should expand , slide side. animation no problem in css, in front of search bar div, not follow expanding search bar. <form> <div class="test"></div> <input type="search" placeholder="search"> </form> form{ float:right; } input[type=search] { background: #e75757 url(http://nerdlove.de/blog/img/search_icon.svg) no-repeat 15px center; background-size: 25px; border: none; padding: 10px 10px 10px 10px; width: 35px; -webkit-transition: .5s; -moz-transition: .5s; transition: .5s; text-indent:-999px; } input[type=search]:focus { width: 150px; background-position: -30px; text-indent: 0px; } .test{ float:left; } .test:before{ content: no-close-quote; border-top: 40px solid rgba(0, 0, 0, 0); border-left: 0px solid rgba(0, 0, 0, 0); border-right: 18px solid #e75757; float: right; right: 55px; position: absolute; } exa