Posts

Showing posts from June, 2012

case insensitive aggregation and "include" in elasticsearch -

i'd aggregations in elasticsearch return values capitalization specified, i'd able search terms in lower case. using aggrations filter can build aggregation looks like: {aggs: {tags: {terms: {field: "tags.name", include: "*some tag*"}}} i'd above query return match if match "some tag". how go that?

mysql - Counts from two joined tables are showing the same even though they should not be -

i have pretty straight forward query selects couple business name , counts results other 2 joined tables. reason same number of offers rules, though number correct rule. for example have 2 offers , 6 rules. returned results show both 6. what missing? select business_profile.busid, business_profile.busname, count(business_offers.ofr_id) cntoffers, count(business_rules.rule_id) cntrules business_profile left join business_offers on (business_offers.ofr_busid = business_profile.busid) left join business_rules on (business_rules.rule_busid = business_profile.busid) business_profile.busid > 1 group business_profile.busid order cntrules desc, cntoffers desc limit 20 use distinct don't count same id multiple times. select business_profile.busid, business_profile.busname, count(distinct business_offers.ofr_id) cntoffers, count(distinct business_rules.rule_id) cntrules

html - How to remove blue highlight color in dropdown foundation 5? -

i'm creating dropdown menu toggle right of sidebar. want remove blue color around dropdown menu. i'm using foundation 5 create dropdown menu. here screenshot of dropdown i've made below css , html code used .f-dropdown1 { display: none; left: -9999px; list-style: none; margin-left: 0; position: absolute; background: #ffffff; border: solid 1px #cccccc; font-size: 0.875rem; height: auto; max-height: none; width: 100%; z-index: 89; margin-top: 2px; max-width: 200px; } .f-dropdown1.open { display: block; } .f-dropdown1>*:first-child { margin-top: 0; } .f-dropdown1>*:last-child { margin-bottom: 0; } .f-dropdown1:before { border: inset 6px; content: ""; display: block; height: 0; width: 0; border-color: transparent transparent #ffffff transparent; border-bottom-style: solid; position: absolute; top: -12px; left: 10px; z-index: 89; } .f-dropdown1:after { border: inset 7px; conte

css - How do I make a responsive div with scroll content in HTML? -

i have following code: /* css */ .phone { height: 100%; width: 40%; overflow: hidden; padding: 0; border-radius: 3%; border: 2px solid red; } .phone .screen { height: 50%; overflow-y: auto; background-color: #c3cee0; } .phone .nav { background-color: black; overflow: hidden; color: white; } <!-- html --> <div class="phone"> <div class="screen"> <p>lorem ipsum...</p> ... <p>lorem ipsum...</p> </div> <div class="nav"> <p>back</p> <p>home</p> <p>menu</p> </div> </div> i want phone responsive in order enable scroll in div.screen need set height of div.phone . problem red border going beyond phone's content. i'd border finish div.nav ends i'm getting unwanted space. see live demostration . tl;dr live demostration . need set height (for div.

kerberos - Running Spark job to query Hive HBase tables in a Kerberized cluster -

i trying run spark 1.6 job (written in java) on kerberized cluster. through job trying read data hive table uses hbase storage. sparkconf conf = new sparkconf(); javasparkcontext context = new javasparkcontext(conf); hivecontext hivecontext = new hivecontext(context.sc()); hivecontext.setconf("hive.exec.dynamic.partition.mode", "nonstrict"); hivecontext.setconf("spark.sql.hive.convertmetastoreorc", "false"); hivecontext.setconf("spark.sql.casesensitive","false"); dataframe df = hivecontext.sql(task.getquery()); df.show(100); i using below spark-sumbit command run job on yarn: spark-submit --master yarn --deploy-mode cluster --class <main class name> --num-executors 2 --executor-cores 1 --executor-memory 1g --driver-memory 1g --jars application.json,/usr/hdp/current/hbase-client/lib/guava-12.0.1.jar,/usr/hdp/current/hbase-client/lib/hbase-client.jar,/usr/hdp/current/hbase-client/lib/hbase-common.jar,/usr/hdp/c

html - How to get the value of dynamically created dropdown using javascript? And get all values -

here drop down list created dynamically. we able first value rest of value displayed same first value. and need concatenate values. when change number of conditions it's getting added existing one. can me on these? note: need solution in javascript. var counter = 1; var str=""; var con=""; function addinput(divname) { var count=document.getelementbyid("conditionid").value; for(i=1;i<=count;i++) { var newdiv = document.createelement('div'); newdiv.innerhtml = "condition " + (counter + 0) + " <br><input list='alert' onchange='getcondition();' id='value'>"; document.getelementbyid(divname).appendchild(newdiv); counter++; } } function getcondition() { str = document.getelementbyid(

Qt C++ SSL/TLS server with Python client -

qt version: 5.8.0 python version: 2.7.13 openssl version: openssl 1.0.1c operating system: windows 10 i'm trying create ssl/tls server using qt c++ , client written in python. i'm using sslechoserver example project shipped qt. example python client, i'm using 1 got python documentation : https://docs.python.org/2/library/ssl.html . copied cert above-mentioned server example , placed next python script , specified in test scripts tried. i have tried various python client examples have found on internet (like here: https://carlo-hamalainen.net/blog/2013/1/24/python-ssl-socket-echo-test-with-self-signed-certificate ), none able connect qt echo server (it never printed out client connected: when use sslechoclient example shipped qt). client in link above work python server same link, know still works something. qt c++ server code sslechoserver.cpp /**************************************************************************** ** ** copyright (c) 2016 k

javascript - Code One (POST Sentence) Array in Zapier from multiple Google Spreadheet Lines -

when developing apps in zapier integrating web applications, may need coding specific process: have read 1-to-n lines within google drive spreadsheet (after search step) , write array send through same post sentence. array should (see full array below): "itens": [{"cfop": "string", "codigo": "string", ...}, {"cfop": "string", "codigo": "string", ...}, ...] can me building that? thanks. ------------------------- full array: "itens": [ { "cfop": "string", "codigo": "string", "descricao": "string", "sku": "string", "ncm": "string", "cest": "string", "quantidade": 0, "unidademedida": "string", "valorunitario": 0, "impostos": { "percentualaproximadotributos": { "simplif

css - Html scrollable div with persistent border that tightly envelops visible scrolled content size -

Image
let's imagine have list container (a div in code below) need able resize viewport visible on. need border around list's content (border has "brown" color in example). here problem. if list content fits in viewport without scrolling border must envelop list content tightly (so can't set border div "column left" because don't need border around whole large area can potentially contain list items). if viewport small , list content scroll border must persist (i miss @ container's top , bottom in vertial list example). that's pretty common behaviour gui. .bkgnd { position: absolute; background-color: grey; top: 0; bottom: 0; right: 0; left: 0; } .column{ overflow: auto; position: absolute; } .left{ width: 460px; top: 100px; bottom: 70px; left: 17px; } .listitem{ background-color: yellow; margin: 5px 0 0 0; } .listitem:first-child{ margi

javascript - alert()/datalayer.push are different -

i'm not experienced easy question 1 of you. i'm using google tag manager track time span element opened or closed on word press site(or trying @ least). relevant code , problem. <script type="text/javascript"> datalayer.push({ eventaction: text }); var text = jquery('span').click(function(){ var t = jquery(this).text(); alert(json.stringify(t)); }); </script> this triggered click contains ac_title_class. the html class im targeting follows <span class="ac_title_class"> purpose </span> the problem code send [object object] google analytics instead of sending alert message says "/t/t/t/t/t/t/ purpose /t/t/t/t/t"(that inst says close). have tried countless different approaches , cant seem figure out. appreciate in advance. note: "ac_title_class" part of plugin. you can push data layer data p

how to convert base 2 floating point number to base 10? -

enter image description here how can convert $(1.11)_2$ * 2 $(3.5)_10$? 1.11 in base 2 1+1/2+1/4=1.75 , , 1.75*2=3.5 .

java - How to call on the conditions defining a 'while' loop to define an 'if' statement inside said 'while' loop -

i finished writing java program game "tic tac toe" (i've been java-coding little on month , second biggest project far). works fine , everything; problem more 'cleaning up' code. main action in code big 'while' loop, start of involves ugly statement: while (contains(player1selections, winningarray1) && contains(player1selections, winningarray2) && contains(player1selections, winningarray3) && contains(player1selections, winningarray4) && contains(player1selections, winningarray5) && contains(player1selections, winningarray6) && contains(player1selections, winningarray7) && contains(player1selections, winningarray8) && contains(player2selections, winningarray1) && contains(player2selections,winningarray2) && contains(player2selections,winningarray3) && contains(player2selections, winningarray4) && contains(player2selections, winningarray5) &&

sql - IF-Exists not working in Oracle for a query -

whats's wrong query giving me error: declare con integer; begin select count(*)as result con user_tables table_name ='txn_temp_table'; if( con = 1 ) begin drop table txn_temp_table1; end; end if; end; i'm trying drop table if exists query throwing errors. you can use execute immediate execute ddl: declare con integer; begin select count(*) con user_tables table_name ='txn_temp_table'; if con = 1 execute immediate 'drop table txn_temp_table'; end if; end;

Survival Analysis in TensorFlow -

i have been using standard packages survival analysis in r. know how classification problems in tensorflow such logistic regression, having difficulty mapping survival analysis problems. in way, instead of 1 output vector have 2 (time_to_event::continuous, censored::boolean). has been done in theano, here , having difficulty translating tensorflow.

node.js - Get json file globally in angular 4.After refreshing the value is undefined -

i working in angular4 application , want load apiurl config file. i've created json file named 'config.json", configurationservice.ts url key. it's working fine while entered login page if navigate page after refreshing value becomes undefined. configurationservice.ts file code @injectable() export class configurationservice { config: object; loadconfig(): observable<any> { return this.http.get('./config.json') .map(res => res.json()) .map((data) => this.config = data ) .catch(this.handleerror); } getconfig(key: any): string { if (this.config == undefined) { this.loadconfig(); } return this.config[key]; } employeename(name: string, gender: string): observable<employee[]> { let apiurl = this.getconfig('apiurl'); } } json file { "apiurl": "http://localhost:10062/

c - Strict-Aliasing warnings and tcpdump example code -

simplifying concept, strict-aliasing rule states object should accessed pointer of compatible type or pointer char . way, compiler can make assumptions code , make optimizations. even though interpretation can bring doubts , discussion, rule isn't state secret. questions are: why respected organizations, maintained experienced programmers, submit codes don't respect strict aliasing rule? example can give tcpdump : on website's tutorial on libpcap there's example code apparently breaks strict aliasing rules several times. i've seem many other codes too, specially when handling network packets.. did got lucky compiler didn't broke code got unnoticed? rely on user compiling -fno-strict-aliasing flag? possibility considering respectful programmers - think linus torvalds himself example, i've seem on mailing list linux snippet break strict aliasing enabled - don't think optimization gained strict aliasing compensates kind of bad assumptions compi

python - How to generate sequence using LSTM? -

i want generate sequence when particular input activated. want generate odd or sequence according corresponding input neuron activation. trying create model using lstm because can remember short term order. i tried way import numpy np keras.models import sequential keras.layers import dense,lstm x=np.array([[1,0], [0,1]]) y=np.array([[1,3,5,7,9], [2,4,6,8,10]]) model = sequential() model.add(dense(10, input_shape=(2)) model.add(lstm(5, return_sequences=true)) model.add(lstm(5, return_sequences=false)) model.add(dense(5)) model.compile(loss='mse', optimizer='adam') model.fit(x,y) but when tried fit model giving me error nameerror: name 'model' not defined to use rnns in keras need introduce additional dimension data: timesteps. in case want have 5 timesteps. because want have one-to-many relationship between input , output data need replicate input data 5 times. last lstm layer must set return sequences, sinc

android - Send message to a specific user trough com.facebook.orca -

i've tried follow, seems not works: intent sendintent = new intent(); sendintent.setaction( intent.action_send ); sendintent.putextra( intent.extra_text, "test" ); sendintent.settype( "text/plain" ); sendintent.putextra( intent.action_sendto, "{facebook_user_id}" ); sendintent.setpackage( "com.facebook.orca" ); startactivity( sendintent ); how send message specific facebook user trough facebook's messenger ?

api - Tracking email with SendGrid alike MailGun -

i'm studying email services, sensdgrid , mailgun. in mailgun docs found usefull function: https://documentation.mailgun.com/user_manual.html#events you can ask mailgun api events triggered, sending filters. simple , powerful. here example: using system; using system.io; using restsharp; using restsharp.authenticators; public class eventsdatetimerecipientchunk { public static void main (string[] args) { console.writeline (eventsdatetimerecipient ().content.tostring ()); } public static irestresponse eventsdatetimerecipient () { restclient client = new restclient (); client.baseurl = new uri ("https://api.mailgun.net/v3"); client.authenticator = new httpbasicauthenticator ("api", "your_api_key"); restrequest request = new restrequest (); request.addparameter ("domain", "your_domain_name", parametertype.u

user ajax to get data without "onClick function" in javaScript -

i've been searching example of getting data using ajax without onclick function of example found within onclick funtion. here html data using onclick funtion <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>new document</title> <script type = 'text/javascript' src='js/jquery-2.2.0.js'></script> <script type ='text/javascript' src='js/testscript.js'></script> <?php include_once("database_conn_getoffers.php"); ?> </head> <body> content goes here <aside id="offer" onclick ="loaddoc('getdata.php',myfunction)"> &nbsp; click here </aside> </body> here script function loaddoc(url, cfunction) { var xhttp; xhttp=new xmlhttprequest(); xhttp.onreadystatechange = function() { if (this.readystate == 4 && this.status == 200

mysql - how to get selected index row of table using php? -

guy's need help. dont know how selected index row of table inserting data. example. have table this. i've thead (no, tanggal, no.polisi, netto) want make insert function (no , tanggal) only. how php? dont know how grab selected index of table i hope can give me example ` <form name="table_1" id="table_1" class="table_1"> <table id="table_1" class="table_1" cellspacing='0' class="js-serial" border="2"> <thead> <tr> <th width="50"><center>no.</center></th> <th width="100"><center>tanggal</center></th> <th width="80"><center>no.polisi</center></th> <th width="60"><center>netto</center></th> </tr> </thead> <tbody> </tbody> </table> </f

ruby on rails - Add a different marker on gmaps4rails -

i have hash of markers display products avaible in area user search location geocoder searchbox , map center on adress give user display 1 marker on adress, want know how display hash + 1 marker position give geocoder my controller if params[:bien_type].present? && params[:location].present? && params[:nbroom].present? @biens = bien.near(params[:location]).where(bien_type: params[:bien_type]) && bien.near(params[:location]).where(nbroom: params[:nbroom]) @hash = gmaps4rails.build_markers(@biens) |bien, marker| marker.lat bien.latitude marker.lng bien.longitude marker.infowindow "<h2>#{bien.name}</h2><a target='blank' href='http://"+"#{bien.url}'>visiter</a><h3>#{bien.adress}</h3><h3>#{bien.bien_type}</h3><h3>#{bien.nbroom} pièces</h3><h3>vendu il y #{((date.today - bien.sell_date.to_date)

Unable to write as sequence file with spark RDD API -

i using following code write rdd sequence file @test def testsparkwordcount(): unit = { val words = array("hello", "hello", "world", "hello", "welcome", "world") val conf = new sparkconf().setmaster("local").setappname("testsparkwordcount") val sc = new sparkcontext(conf) val dir = "file:///" + system.currenttimemillis() sc.parallelize(words).map(x => (x, 1)).saveashadoopfile( dir, classof[text], classof[intwritable], classof[org.apache.hadoop.mapred.sequencefileoutputformat[text, intwritable]] ) sc.stop() } when run it, complains caused by: java.io.ioexception: wrong key class: java.lang.string not class org.apache.hadoop.io.text @ org.apache.hadoop.io.sequencefile$writer.append(sequencefile.java:1373) @ org.apache.hadoop.mapred.sequencefileoutputformat$1.write(sequencefileoutputformat.java:76) @ org.apache.spark

java - How to verify presence of a text in a row. (Assert vs Verify) -

my application creates new row in table whenever new case added in application. row has few columns , content of column can similar of other columns. need find if " text " present in row. below code: @test (priority = 2) public void savestatus() { webelement element = driver.findelement(by.partiallinktext("case listing")); //to find 'case listing' button on dashboard actions action = new actions (driver); action.movetoelement(element); //move mouse , hover 'case listing' button action.click().build().perform(); //click on 'case listing' button list<webelement> newcase = driver.findelements(by.xpath("//*[@id='caselist']/tbody/tr[1]"));//find new case saved in caselist string casestatus = ((webelement) newcase).gettext(); if (casestatus.contains("draft")){ assert.asserttrue(istextpresent("draft")); } system.out.println("test case 3 --> case statu

html - Weird JavaScript behaviour with variable/alert -

i'm trying variable html form. can read of values except one, on absolutely nothing different. i tried console.log starttijd , shows nothing in console. when alert starttijd show me right value. code i'm running: function validategroepslesform() { var message = ""; var date = document.forms["groepslesform"]["date"].value; if (!date) { message += "vul een geldige datum in<br>"; } var endtime = document.forms["groepslesform"]["endtime"].value; if (endtime == "") { message += "vul een geldige eindtijd in<br>"; } var starttijd = document.forms["groepslesform"]["starttime"].value; if (starttijd = "") { message += "vul een geldige starttijd in<br>"; } console.log(starttijd); var participants = document.forms["groepslesform"]["participants"].value; if (

javascript - Highlight a text from a URL -

i new angularjs . have file in html format.consider resume in html format. here want highlight words file ,here when word present in link messing html file. so, because of not able show html file ? so, how can highlight word links ? there reg-ex can me ? . have gone through lot of questions . highlighting filtered result in angularjs i have seen same thing doing , my code - $scope.highlighthtml = function (content, text, classname, notbywordboundry) { var regexpescapetext, str; if (!(content && content.replace)) { return ''; } if (!text) { return $sce.trustashtml(content); } if (!classname) { classname = 'mark'; } regexpescapetext = text.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); if (!notbywordboundry) { str = new regexp('(\\b)' + regexpescapetext + '(\\b)', 'gi'); } else { str = new regexp(regexpescapetext, 'gi'); }

vb.net - Parameterized SQL update query doesn't work -

i stuck hours , don't know do. code doesn't work in updating student records using parameterized sql query in vb.net. dim result integer cmd = new oledbcommand("update students set student_name=@name, address=@address, contact_no=@contact id_number=@id_number;", conn) conn.open() cmd.connection = conn cmd.parameters.addwithvalue("@id_number", txt_idnumber.text) cmd.parameters.addwithvalue("@name", txt_name.text.tostring) cmd.parameters.addwithvalue("@address", txt_address.tostring) cmd.parameters.addwithvalue("@contact", txt_contactno.text.tostring) result = cmd.executenonquery() if result = 1 msgbox("changes updated successfully.", vbinformation, "message") else msgbox("update unsuccessful.", vbcritical, "message") end if conn.close() oledb doesn't recognize parameters name. in oledb parameters should

elasticsearch - is it safe that multi elastic search client create the same index at the same time? -

is safe multi elastic search client create same index @ same time? an example using date index name, when new day came, many clients try write not exist index, , lead create new index. i didn't found related information official documents. the problem writing non existing index creates index(probably without mapping wish for). don't need worry creating index same name because won't happen.

math - How to solve this linear equation? I have the OpenSolver logic, but can't transpose it in code (Javascript) -

i have linear equation problem: objective: maximize r17 variables: - floats: q7, q8, q9, q10, q11, q12, q13, q14, q15, q16, q17 - floats: r7, r8, r9, r10, r11, r12, r13, r14, r16, r16, r17 relations: - q7 +q8 +q9 +q10 + q11 + q12 + q13 + q14 + q15 + q16 = q17 - r7 +r8 +r9 +r10 + r11 + r12 + r13 + r14 + r15 + r16 = r17 - r7 = q7 / 0.50 - r8 = q8 / 0.75 - r9 = q9 / 0.88 - r10 = q10 / 1.00 - r11 = q11 / 1.13 - r12 = q12 / 1.18 - r13 = q13 / 1.76 - r14 = q14 / 2.11 - r15 = q15 / 2.33 - r16 = q16 / 2.50 constraints: - 1000 <= q7 <= 17500 - 2000 <= q8 <= 6300 - 5000 <= q9 <= 19292 - 1200 <= q10 <= 29820 - 100 <= q11 <=2887.50 - 700 <= q12 <= 20825 - 300 <= q13 <= 9481.50 - 150 <= q14 <= 5764.50, - 1200 <= q15 <= 48594, - 300 <= q16 <= 12600 - 60500 <= q17 <= 60500 i have placed constraints in excel using opensolver, need automate this. i've been looking here , played little bit glpk , couldn't find proper w

javascript - I don't understand how components are mounted -

i use pattern container/representational components. have cardcontainer component fetch data server , pass card component container component: class cardcontainer extends component { state = { 'card': null } componentdidmount() { fetch(`${baseurl}/api/cards/${this.props.params._id}/`) .then(res => res.json()) .then(card => this.setstate({'card': card})) } render() { return <carddetail card={this.state.card} /> } representational component: class carddetail extends component { render() { return ( <div> {this.props.card._id} </div> ) } } in case have error: uncaught typeerror: cannot read property '_id' of null so render method of child called before componentdidmount of parrent. in case when pass stateless function component child works fine: const functionchild = props =>

wpf - How to remove the split line between GridColumns in GridControl? -

Image
i want know how remove vertical line between grid columns in gridcontrol , should do? try set showverticallines property of tableview false : <dxg:gridcontrol ...> <dxg:gridcontrol.view> <dxg:tableview showverticallines="false" /> </dxg:gridcontrol.view> </dxg:gridcontrol>

vba - Looping through all files in a folder (encountering run time error '-2147221080 (800401a8)') -

i running code aims pull in data workbooks within specific folder. have written code loop separate code pulling in of data. sub fixedincomeloop() dim file variant dim wb1 workbook dim wb2 workbook dim folderpath string dim ws worksheet dim ws2 worksheet set wb1 = activeworkbook set ws = activesheet folderpath = "c:\users\wei hong\documents\trade tickets\" file = dir(folderpath) while (file <> "") set wb2 = workbooks.open(file) set ws2 = wb2.worksheets("trade ticket") call fixedincome(wb1, ws, ws2) wb2.close savechanges:=false set wb2 = nothing wend end sub private sub fixedincome(wb1 workbook, ws worksheet, ws2 worksheet) dim ws3 worksheet set ws3 = wb1.worksheets("constants") <-- facing error ws.activate ... end sub i facing runtime error above. not sure

android - Gradle project refresh failed compile error -

getting gradle sync error error:project :app declares dependency configuration 'compile' configuration 'default' not declared in descriptor project :volley. what mean? guess need add build.gradle file? try adding following dependencies app's build.gradle : compile 'com.android.volley:volley:1.0.0'

java - How to give superuser permission to android 2.3.5 device programmatically? -

i'm installing apk files programmatically.it working. have 2 rooted android devices , version of devices 2.3.5 , 4.4.2. problem that; when install apk file on 2.3.5 device, cannot see app icon. restart device icon showing. however, 4.4.2 device not have problem. result; want install apk file 2.3.5 device way of installation 4.4.2. here codes: private boolean installappforand235(string sourcefile, string filename, boolean issystemapp) { boolean result = false; try { string destinationpath = ((issystemapp) ? path_system_app : path_user_app) + filename; result = setexecpermision(destinationpath, true); result = androidutils.runshellcommand(string.format("mv %s %s", sourcefile, destinationpath), false); return result; } catch (exception e) { e.printstacktrace(); } return result; } private boolean installappforand442(string sourcefile, string filename, boolean issystemapp) { boolean result = false;

url rewriting - Regex to match single folder in url for web.config URL rewrite -

we use rather rubbish regex (evidently) match usernames after url rewrite them profile page. <rule name="profiles" stopprocessing="true"> <match url="(?:\w|[-_.])+" ignorecase="false" /> <conditions logicalgrouping="matchall" trackallcaptures="false"> <add input="{document_root}/{r:0}" matchtype="isfile" negate="true" /> <add input="{document_root}/{r:0}.php" matchtype="isfile" negate="true" /> <add input="{document_root}/{r:0}" matchtype="isdirectory" negate="true" /> </conditions> <action type="rewrite" url="/profile.php?username={r:0}" appendquerystring="true" /> </rule> i've realised matches way more requir

c# - Moq Mock lambda expression -

i trying mock repository on lambda expression executed. method want execute looks this: public selectlistitem getprotocolbyid(int protocolid) { var protocol = unitofwork.protocolrepository.findall(s => s.protocol_id == protocolid).firstordefault(); return new selectlistitem() { text = protocol.user_defined_id, value = protocolid.tostring() }; } i created mockrepository in class protected mockrepository mockrepository = new mockrepository(mockbehavior.default); i have unitofwork , protocols repositories , mock them this: var protocolrepositorymock = mockrepository.create<irepository<protocol>>(); var unitofworkrbmmock = mockrepository.create<iunitofworkrbm>(); the findall method irepository looks : ienumerable<tentity> findall(expression<func<tentity, bool>> where, params expression<func<tentity, object>>[] includes); and definition of irepository in iunitofworkrbm one: irepository&l