Posts

Showing posts from April, 2015

objective c - Guidelines to design rectangular buttons for iOS -

Image
what guidelines design rectangular buttons ios? sizes supported ios designing rectangular button? eg, icons suppose of 44x44 pixels, not able find same buttons. can give me related link or reference? from apple ui design guidelines , recommended follow button size easy tap user. create controls measure @ least 44 points x 44 points can accurately tapped finger. however there no description maximum button size should appropriate content. and ios human interface guidelines , says that: embrace borderless buttons. default, bar buttons borderless. in content areas, borderless button uses context, color, , call-to-action title indicate interactivity. , when makes sense, content-area button can display thin border or tinted background makes distinctive. also @ system button guidelines a system button: has no border or background appearance default can contain icon or text title supports custom decoration, such border or background image (to add custo...

Return boolean in java? -

i need on question. "inside chknum class,the method ineven()return if value passed " even.it return false odd.therefore iseven()has return type of boolean." also line below cannot changed. if(e.ineven(10))system.out.println("10 even"); if(e.ineven(9))system.out.println("9 even"); if(e.ineven(8))system.out.println("8 even");" i beginner in java. try finish question following program.anyway, doesn't work.=( doing wrong? public class chknum{ boolean ineven=true; public boolean ineven(int o) { if ((o%2)==0) { ineven= true; } else { ineven = false; } return ineven; } } class main{ public static void main(string args[]) { chknum e=new chknum(); if(e.ineven(10))system.out.println("10 even"); if(e.ineven(9))system.out.println("9 even"); if(e.ineven(8))system.out.pr...

linux - How to remove line feed character in csv file using sed -

i have csv data file data in following structure: abc^"a detail explaination"^cde^"another detail explaination"^date however due user input, details entered line breaks, , broke program. i'll need remove line breaks in between double quote " i tried use sed command doesn't change it, command tried is: sed -e :1 -e 's@\(".*\)\n\(.*"\)@\1\\2@;t1' file.csv > file_changed.csv the criteria i'm trying replace line breaks \n encapsulated in between 2 double quotes, format of csv. anyone has idea what's wrong sed command? or there other better way achieve this? edit additional notes, can't remove line breaks i'll need keep @ end of line since csv file import purpose. need remove encapsulated within double quotes sed ':cycle^j/^\([^"]*"[^"]*"\)*[^"]*"[^"]*$/ {n;s/\n//;b cycle^j}' file.csv > file_changed.csv on each line have number of open , close...

jsf - p:dataTable (row selection) selection and pe:inputNumber not working -

i have <p:datatable > updated button , filled. data displayed correctly. problem when click/select row, no response; while being clicked, row highlighted, now-> no highlight. have done type of design many times time <p:datatable> behaving weirdly. cannot find root of problem. my xhtml snippet table : <p:datatable id="tblsales" rowindexvar="rowsn" paginator="true" value="#{invsalemb.dummylist}" var="saleobj" selectionmode="single" selection="#{invsalemb.dummysaleobj}" rowkey="#{saleobj.item.itemtypeid}"> <p:column headertext="#"> <h:outputlabel value="#{rowsn+1}" /> </p:column> <p:column headertext="name"> <h:outputlabel value="#{saleobj.item.itemtypename}" /> </p:column> <p:column headertext="count"...

exception handling - Simple Python program checking for intersection points -

the aim of program find points comes under intersection of @ least 2 circles.(space 1000x1000 matrix) n=input() mat=[[0 in range(1005)] in range(1005)] circles=[] in range(n): circles.append(map(int,raw_input().split())) ans=0 circle in circles: minx=circle[0]-circle[2] maxx=circle[0]+circle[2] miny=circle[1]-circle[2] maxy=circle[1]+circle[2] in range(minx,maxx+1): j in range(miny,maxy+1): if mat[i][j]<=1: if ((i-circle[0])**2+(j-circle[1])**2)<=(circle[2]**2): mat[i][j]+=1 if mat[i][j]>1: ans+=1 print ans n denoted number of circle circles contain circle center , radius in format [x,y,r] example let circles = [[3,2,4],[2,5,2]] contains 2 circles centered @ (3,2) , (2,5) radius 4 , 2 respectively. is logic correct?...will trigger exceptions??

Display Repeatation Item in ListView after three Item on Scrolling in android? -

Image
i want fill listview but repeat imglike,imgcomments,txtlikeunlike , txtcomments items. because using array imglike,imgcomments,txtlikeunlike , txtcomments (fetch)selected position. mistake in code please guide me. my code, /** adapter class */ public class adapter1 extends baseadapter { imageview imgimage = null,imgunlike[] = null, imglike[] = null,imgcomments[] = null, imgshare[] = null; textview txtid = null,txtlikeunlike[] = null, txtcomments[] = null; public arraylist<hashmap<string, string>> arr = null; context context = null; layoutinflater layoutinflater = null; hashmap<string, string> getdata = new hashmap<string, string>(); public adapter1(context context, arraylist<hashmap<string, string>> arr) { this.context = context; this.arr = arr; layoutinflater = layoutinflater.from(context); ...

android actionbar - How to set App title at center in Navigation drawer Action Bar? -

i want customize navigation drawer app compact action bar, want remove app icon , want make title center in action bar. i have applied solutions , nothing working conditions. please give me clue applying. in simple activity can create custom action bar , how create customize navigation drawer action bar please share idea's ..... to archive having centered title in abs (if want have in default actionbar, remove "support" in method names), this: in activity, in oncreate() method: getsupportactionbar().setdisplayoptions(actionbar.display_show_custom); getsupportactionbar().setcustomview(r.layout.abs_layout); abs_layout: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <textview and...

Exclude cflags in Android.mk -

i wish exclude global compile flags android.mk compilation e.g. -werror=format-security. there recommended way without hacking central android make files? you should @ least able override settings adding more cflags within own android.mk, adding e.g. -wno-error=format-security .

java - Creating a custom result set in MySQL -

i'm building app calculates monthly bill amount clients. i getting data mysql in 3 different queries populate 1 table. i wanted know if there way join these queries, , create result set default table of choice. for example, use these quires separately, , data goes same table. // me prices per hour client. select * roommanager.companyfinance projectname = 'xxx'; output like: shifttype | price ----------|------ ol | 555 off | 548 bkg | 666 snd | 422 //this me amount of products per product client month. select shifttype, count(*) roommanager.dailyrooms project = 'xxx' , company = 'yyy' , daydate \"%yyyy-dd%" group shifttype;"; output like: shifttype | count ----------|------ ol | 2 off | 1 bkg | 0 snd | 3 //this me amount of cancellations select wascancelled, count(*) roommanager.dailyrooms wascancelled = 2 , project = 'xxx' grou...

Extract data from Python locally html files -

i extract data several html files in folder (saved locally) , save information text file. html toolboxes in python seems deal online webpages , not locally saved files. example, if find "cas registry number" files , write text file how should do? example of html row containg informtion: <div class=detailtitle><span class=title>cas registry number</span> 555-34-0</div> i suggest use pyquery, elegant handling html elements' tutorial here code : from pyquery import pyquery html = open("index.html", 'r').read() # local html query = pyquery(html) query("li").eq(1).text() ......

c# - What's the difference between these three Task Continuations? -

i have these 2 scenarios, don't understand why things happening do: static void main(string[] args) { console.writeline("***starting t1"); //run 2 tasks sequentially task t = firsttask().continuewith(_ => secondtask(), taskcontinuationoptions.onlyonrantocompletion); //register succeded , faulted continuations t.continuewith(_ => completion(), taskcontinuationoptions.onlyonrantocompletion); t.continuewith(_ => faulted(), taskcontinuationoptions.onlyonfaulted); console.readline(); console.writeline("***starting t2"); task t2 = firsttask().continuewith(_ => faulttask(), taskcontinuationoptions.onlyonrantocompletion); t2.continuewith(_ => completion(), taskcontinuationoptions.onlyonrantocompletion); t2.continuewith(_ => faulted(), taskcontinuationoptions.onlyonfaulted); console.readline(); console.writeline("***starting t3...

Add all elements from object to FormData object - JavaScript -

i want append elements in object dynamically formdata object. how possible? i don't want append manually. var myfd = new formdata(); myfd.append('user', dataobj.user); myfd.append('image', dataobj.image); ... try using for loop: var myobject = { 'prop1': 'value1', 'prop2': 'value2' }; var myfd = new formdata(); for(var propertyname in myobject) { if(myfd.hasownproperty(propertyname) == false) { myfd.append(propertyname, myobject[propertyname]); } }

Android Studio build Cocoonjs by Gradle not ANT -

my project dependency on module & b and module dependent on module b after setup dependencies, multiple dex exception encountered. fyi my project doing native + cordova webview and try accelerate ludei webview+ low end model https://github.com/ludei/webview-plus my project dependent on cordova module & ludei webview+ module cordova module dependent on ludei webview+ module after these setting can build grade no warning, not pass dexdebug when want build application. got error com.android.dex.dexexception: multiple dex files define lcom/ludei/chromium/buildconfig; i know officially recommended build on ant, have did trick change webview+ package name can build "debug" application not in "release". how can set in android studio build gradle without having multiple dex exception? ---------update ------------- @scott barta yes, here whole cordova project under [project]/platforms/android. the whole project...

tfs2013 - Can multiple checkout be enabled just in one branch in tfs 2013? -

we using tfs2013 , have need have main branch on server workspace disabled multiple checkouts, , have branch again on server workspace enabled multiple checkouts. possible in other way using local workspace on second branch? thanks! no. settings checkout @ team project level. however, there's no reason have exclusive checkouts enabled in first place -- terrible detriment productivity. if 2 developers change same file, they'll have merge files. it's not big deal.

android - Sliding tab with calendar in fragment -

i having 2 sliding tabs working. want calendar in 1 of tab giving me error. error 12-16 09:58:54.437: e/androidruntime(2495): fatal exception: main 12-16 09:58:54.437: e/androidruntime(2495): process: com.project.homepagedemo, pid: 2495 12-16 09:58:54.437: e/androidruntime(2495): java.lang.nullpointerexception 12-16 09:58:54.437: e/androidruntime(2495): @ com.bharatwellness.mainactivities.diarytabonecalorieconsumed.oncreateview(diarytabonecalorieconsumed.java:66) 12-16 09:58:54.437: e/androidruntime(2495): @ android.support.v4.app.fragment.performcreateview(fragment.java:1504) 12-16 09:58:54.437: e/androidruntime(2495): @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:942) 12-16 09:58:54.437: e/androidruntime(2495): @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1121) 12-16 09:58:54.437: e/androidruntime(2495): @ android.support.v4.app.backstackrecord.run(backstackrecord.java:682) 12-16 09:58:54.437...

java - What if the computation inside a listener is slow than the listener's update? -

i new android programmer. , implementing algorithm within sensor listener, each time sensor data has been received, computations base on newly received sensor data, code this: class somelistener implements somesensorlistener { public void onreceive(item state) { // computation here, , make change ui } } and wondering question: if computation slower sensor data update frequency, when newest sensor data arrives, last round of computation has not been finished? result in problem? thank in advance answer! there's 2 case scenarios: if callback asynchronous spawn new thread every time method called. means many of these methods can co-exist @ same time. if callback synchronous spawn in same thread (this case). in android means looper ( http://developer.android.com/reference/android/os/looper.html ) handle message previous message has finished. if computation of method slower rate @ new messages added queue of looper, may throw kind of exception. are...

How to integrate PayPal sdk with Gradle Android -

i want know steps of how integrate paypal sdk gradle android. read in document, imported .jar file. copied .so files jnilibs folder. still classes mention in manifest ion red color. ex com.paypal.android.sdk.payments.paypalservice you can use dependency integrate paypal trough gradle: compile 'com.paypal.sdk:paypal-android-sdk:2.15.1'

svn - TeamCity VS plugin - error Failed to collect pending changes in Subversion -

i've updated ankhsvn, tortoisesvn , sliksvn latest version , now, after open solution in visual studio , try remote run changes have following error: "failed collect pending changes in subversion. error: opened solution contains no subversion versioned resources" my current versions are: teamcity addin 8.1, ankhsvn 2.5.12478, tortoisesvn 1.8.8.25755 , sliksvn 1.8.10, x64 versions. using turtoisesvn in windows explorer works, want able use teamcity plugin inside vs. plugin configured use sliksvn, correct path specified. give advise on this? thanks! in order solve this, workaround, had go teamcity menu option in vs, options, source control, subversion , "search changes in" had change "automatically detect directories" "manually specified directories" , add local directories, ones code is.

java - Spring security service configuration -

i´m trying build java ee app prototype using different frameworks. works fine except security layer. choose use spring secutiry configured spring configuration. code this: spring secutiry config @configuration @enablewebmvcsecurity public class securityconfig extends websecurityconfigureradapter { @autowired private myuserdetailsservice userdetailsservice; @override protected userdetailsservice userdetailsservice () { return this.userdetailsservice; } @override public void configure(websecurity web) throws exception { web .ignoring() .antmatchers("/resources/**"); } @override protected void configure(httpsecurity http) throws exception { http .formlogin() .loginpage("/login") .loginprocessingurl("/login/authenticate") .failureurl("/login?err...

objective c - How to pop to root view controller on custom tab bar button clicked iOS -

i showing custom tab bar using tab bar controller. and creating separate navigationcontroller view controllers. first *firstviewcontroller = [[first alloc]init]; uinavigationcontroller *firstnavcontroller = [[uinavigationcontroller alloc]initwithrootviewcontroller:firstviewcontroller]; second *secondviewcontroller = [[second alloc]init]; uinavigationcontroller *secondnavcontroller = [[uinavigationcontroller alloc]initwithrootviewcontroller:secondviewcontroller]; third *thirdviewcontroller = [[third alloc]init]; uinavigationcontroller *thirdnavcontroller = [[uinavigationcontroller alloc]initwithrootviewcontroller:thirdviewcontroller]; tabbar.viewcontrollers = [[nsarray alloc] initwithobjects:firstnavcontroller, secondnavcontroller, thirdnavcontroller, nil]; tabbar.delegate=self; tabbar.selectedindex=0; but when trying pop root on tab click, 3rd navigation controller accessible. so working 3rd tab, first , second not working. if you're loading view controller ...

C# - HttpWebResponse redirect to external URL -

i'm trying achieve following: i'm building mvc website me automatically logon site. websitea call websiteb using httpwebrequest. websitea send details of user through headers (request.headers.add) websiteb handle user authentication , internally redirect page granting access user. i've managed achieve part of i'm stuck in displaying redirection return. knows if can achieved? here code gets called in websitea app: [httppost] [outputcache(nostore = true, duration = 0, varybyparam = "*")] public actionresult login(mymodel model) { httpwebrequest request = (httpwebrequest)webrequest.create("http://websiteb/login.aspx"); request.allowautoredirect = true; request.method = "post"; request.headers.add("myusertologon", model.user); //i'm sending user through headers string postdata = "this test"; byte[]...

sonar runner - How to handover a custom rule for SonarQube to identify JavaScript constructors? -

i working on client side mvc framework angular js. part of project have written services handle restful client requests , responses using angular api. right doing code quality task using sonar tool. per angular js api service having 1 function can call constructor same name of service. example angular.module('modulename').factory('servicename',[function(){ function servicename() { }]); now issue sonarqube. sonaqube reading function name normal function name (servicename) basing on normal function hungarian notation rules if change function name normal function name functionality not working per angular js api standards. need handover 1 custom rule sonar omitting of checking these constructor name normal function name. can please suggest me ways write custom rule handling such kind of scenarios. in advance?

c - Bad File descriptor error due to socket reconnection -

actually trying identify problem, can close(sockfd) socket more once generate exception in file reading within same process. here stuff creating problem : have 2 threads : one thread responsible create connection server. retry make connection server in sleep of 10 secs if not connected. second thread reads 2 files , process both. , waits connection established other thread first time. what have done, first thread connected server , goes down after that, main thread processes first file correctly fails read second file each time. if connection made other thread server persistent, both files processed successfully. i want know reason behind this. call close(sockfd) affecting file descriptor of second file??

java - Strange behaviour of synchronized -

class testsync { public static void main(string[] args) throws interruptedexception { counter counter1 = new counter(); counter counter2 = new counter(); counter counter3 = new counter(); counter counter4 = new counter(); counter1.start(); counter2.start(); counter3.start(); counter4.start(); counter1.join(); counter2.join(); counter3.join(); counter4.join(); (int = 1; <= 100; i++) { if (values[i] > 1) { system.out.println(string.format("%d visited %d times", i, values[i])); } else if (values[i] == 0) { system.out.println(string.format("%d wasn't visited", i)); } } } public static integer count = 0; public static int[] values = new int[105]; static { (int = 0; < 105; i++) { values[i] = 0; } } public static void incrementcount() { count++; } public static int getcount() { return count; } public static class counter e...

java - Multi Threading in Google App Engine Datastore -

how can make operations of getting , setting property datastore, thread safe? currently, have code puts tasks in queue , each task perform task , updates property called of numberoftasks of type int. fetches current value of property , increments it. however tasks executed in queue, final value not coming correct because of threading issue. sometimes, 2 tasks tries update proeprty @ same time , hence sometime increment isnt done. could please in getting done correctly? datastore property getter method: private string doget(string rowid) throws entitynotfoundexception { key egskey = keyfactory.createkey(datastore_kind, rowid); entity egsentity = datastore.get(egskey); // schema changed string text type. transparently handle here. object propertyvalue = egsentity.getproperty(property_key); if (propertyvalue instanceof string) { return (string) propertyvalue; } text text = (text) propertyvalue; return text.getvalue(); } datastor...

html - How to call a table using its Id in a javascript with if-else statements -

am trying show table using value "graph". if graph value 0 should display table1(id of table), if value of graph 10 , should display table2(id of table). trying show java script if else case. don't know how call table within java script in if else statements <script> $(document).ready( function () { myfunc(); }); function myfunc(){ console.log("input value", document.getelementbyid("graph").value) if (document.getelementbyid('graph').value==00){ } }</script> how write here call table in if else statement try doing jquery if possible . hope helps ! $(document).ready(function(){ if($('#graph').val()=='00'){ $('#table1').show(); $('#table2').hide(); }else if($('#graph').val()=='10'){ $('#table2').show(); $('#table1').hide(); ...

java - IntelliJ IDEA is unable to kill my Dropwizard Server -

i have project developed using dropwizard , gradle. when want start server, can run inside intellij idea gradle run runconfiguration. doing starts server , can interact expected, debugging intellij no problem. but using "stop" or "rerun" buttons don't seem kill started server. instead, if rerun server following exception: 13:45:48: executing external task 'run'... :compilejava up-to-date :processresources up-to-date :classes up-to-date connected target vm, address: '127.0.0.1:61376', transport: 'socket' :run info [2014-12-16 12:46:01,393] io.dropwizard.server.serverfactory: starting my-project disconnected target vm, address: '127.0.0.1:61376', transport: 'socket' warn [2014-12-16 12:46:01,552] org.eclipse.jetty.util.component.abstractlifecycle: failed org.eclipse.jetty.server.server@7a6359b0: java.lang.runtimeexception: java.net.bindexception: address in use so seems other program keeps address want use. wh...

sql - Sorting a varchar column in customized way -

i trying sort varchar column contains data this: a.1) null a.1.xc) 1131820 b.1) null b.1.xc) 1131822 c.1) null c.1.xc) 131824 c.2) (ce) null c.2) (nrml) null c.2.xc) 131826 c.2.xc) 132152 c.3) null c.3.a) 131828 c.3.a.xc) 131830 c.3.xc) 131828 c.4) null c.4.a) 131838 c.4.a.xc) 131840 c.4.xc) 131838 d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1) null d.1.xc) 16131842 d.1.xc) 15131842 d.1.xc) 14131842 d.1.xc) 13131842 d.1.xc) 12131842 d.1.xc) 11131842 d.1.xc) 10131842 d.1.xc) 9131842 d.1.xc) 8131842 d.1.xc) 7131842 d.1.xc) 6131842 d.1.xc) 5131842 d.1.xc) 4131842 d.1.xc) 1131842 d.1.xc) 3131842 d.1.xc) 2131842 d.2) null d.2.xc) 132124 d.3) null d.3.xc) 132126 d.4) null d.4.xc) 1132156 d.5) (nrml) null d.5.xc) 132158 e.1) null e.1.xc) 132138 e.10) null e.10.xc) 131932 e.10.xf) 131932 e.10...

jQuery attribute disable not working -

i'm try disable (and remove) attributes in jquery, seems not working when value changed , set "disabled" fields. script runs when value of drop-down box changed. here code below: $(".tipo_frete").change(function(){ if($(this).val() == "fob" ){ $(".id_transp").attr("disabled"); $(".id_transp").val(""); $(".nome_transp").attr("disabled"); $(".nome_transp").val(""); $(".valor_frete").attr("disabled"); $(".valor_frete").val(""); }else{ $(".id_transp").removeattr("disabled"); $(".valor_frete").removeattr("disabled"); $(".nome_transp").removeattr("disabled"); } }); did wrong here? in jquery when want attribute value...

sql - Why can't I reinstall Module Magento? -

i have module in magento, , script setup module. want re-run script , module. deleted setup of module in core_resource, , access magento. module not reinstalled. database of module isn't deleted, althought have drop table if exist in scripts. , in core_resource, setup of module not exists, deleted. think setup not run. module still work old sql , no setup field in core_resource. thank in advance. you need clear magento configuration cache trigger re-run of setup resource migration script. cache clearing lets magento see version of module has changed. also, might consider using n98-magerun command line tool -- has number of commands manually running setup resource migration scripts.

Is there any good use for a default Java class (i.e. non-public, non-abstract, non-final, subclass of Object) -

i've been programming in c , c++ few years , taking java classes first time. i've come across chapter on java classes , curious default declaration java class: class myclass { //vars , methods } this compiles i'm told, have practical usage, such in particular design patterns or applications? if matters, java 6. old, know, project @ work built on java6 , that's motivating me learn this. the default access in java package private. means class visible other classes in same package. it useful, example, if write library , want prevent users of library directly using internal classes not part of api. allows change internal classes in later versions without having worry backward compatibility.

android - drop wakelock in WakefulBroadcastReceiver that does not start a Service -

i registered wakefulbroadcastreceiver gets called @ time , based on content of broadcast decides start service process intent or not. my question is: there wakelock registered if startwakefulservice not called? if so, how release wakelock again? is there wakelock registered if startwakefulservice not called? no, there not, can tell looking @ the wakefulbroadcastreceiver source code .

android - InflateException when inflating a fragment for a drawer caused by NullPointerException thrown by setContentView() in MainActivity -

since android studio came out decided import project in eclipse. app crashes in api 16 works fine 21. minimum api 14 , maximum 21, can't try running @ in between because don't have device @ level , emulator won't run it. wasn't using gradle on eclipse in android studio. i'd love helping hand cause it's bit i'm stuck on problem. you may find code shitty , redundant, i'm sorry in advance please focus on main problem. and thank you! stacktrace 28073-28073/sc.erza.prancer e/androidruntime﹕ fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{sc.erza.prancer/sc.erza.prancer.mainactivity}: android.view.inflateexception: binary xml file line #33: error inflating class fragment @ android.app.activitythread.performlaunchactivity(activitythread.java:2085) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2110) @ android.app.activitythread.access$600(activityt...

sikuli - Is there any way in Selenium 2 where the script should know that web-page is Loading and hence it should wait? -

i have situation using sikuli detect image. in case image displayed web-page still shows loading.so when sikuli tries click on image not selects image script gets pass though have not selected image.any suggestion. how can handle situation? i assuming can use selenium webdriver. if case selenium should wait untill page loads. being said, can use following code see if page loads. int count = 0 ; string state = ""; { state = ((javascriptexecutor)driver).executescript("return document.readystate"); thread.sleep(3000); } while ((!state.equals("complete"))&&count<15);

f# - Translating Linq to a FSharp expression -

Image
the documentdb has walk-though , sample project in c# working through in fsharp. 1 of 1st tasks locate existing datbase. c# code this var database = client.createdatabasequery().where(db => db.id == "familyregistry").toarray().firstordefault(); i attempting same line in fsharp not getting .where though referencing same libraries. instead getting this: am thinking problem wrong? in advance. linq isn't specific c#. in c# need add reference system.linq.dll , using system.linq; statement. c# project templates include these statements. in f# need same, ensure project has reference system.linq , add open system.linq statement there @ least 2 more idiomatic ways: you can use seq module's functions pipeline operator achieve same result method chaining, eg: let random = new system.random() seq.initinfinite (fun _ -> random.next()) |> seq.filter (fun x -> x % 2 = 0) |> seq.take 5 |> seq.iter (fun elem -> printf "%d...

html - change of encoding shows Weird symbols -

the unknown symbols after writing html css appear in code how , come from <table width="96%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td width="39%" style="border:1px solid red"></td> <td width="60%" valign="center" style="font-size:40px; font-weight:bold; border:1px dashed black; letter-spacing:-0.5px; line-height:100%;"><h4>personal message</h4></td> </tr> </tbody> not ask questions why use tables in html or inner styling above see if write in encoding utf-8 after switching encoding ansi characters appear in code <table width="96%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td width="39%" style="border:1px solid red"></td> ...

rabbitmq - How to throttle ServiceStack Messaging EventHandler -

i know sounds anti-pattern, have requirement dictates flow of messages service (cisco phones) configurable i.e. throttling. there times when our phone system can not handle load of messages being routed servicestack via rabbitmq broker (work queue), it's during these peak times need curb flow of messages. i've read this qa, don't know if that's applicable or not. should nak messages based on throttling algorithm in client handler? thank you, stephen by default there 1 worker thread (per message type) that's used process request, can add thread.sleep() in service delay processing of request next request gets processed after previous 1 has finished.

matlab - Compare last charaters of strings -

i need compare last characters of strings in matlab. natively following: string = 'foobar'; len_string = length(string); if len_str_2 >= 3 str_suffix = str_2(len_str_2 - 2:len_str_2); strcmp('bar', str_suffix) end is there simpler way this? strncmp can compare first n characters. this sounds typical job regular expression: any(regexp('foobar','bar$')) %% return true any(regexp('foobars','bar$')) %% return false the dollar sign enforces pattern @ end of string.

c# - LINQ Dynamic QUERY to produce 'where AssignedUser is null' -

i trying build dynamic expression query rows has null in column where assigneduser null , below code, not doing expected. can 1 spread light on issue please? private expression<func<vwassignmentactivities, bool>> getisnullexpressionequals<t>(string propname, t value) { var item = expression.parameter(typeof(vwassignmentactivities), "item"); var prop = expression.convert(expression.property(item, propname), value.gettype()); expression body = expression.equal(prop, expression.constant(null, prop.type)); return expression.lambda<func<vwassignmentactivities, bool>>(body, item); } any appreciated the error getting because have value in nullable. type returns int32 though variable nullable. trying convert null int. assuming care finding null values, this public type getnullable(type type) { if (type == typeof(nullable<>)) return type.gettype(); if(type == typeof(int)) type = ty...