Posts

Showing posts from January, 2014

c# - Entity Framework ObjectContext lifetime in an n-tier project -

i'm building large solution client code reuseability keyword since different types of projects (i.e. websites, wcf services, wpf etc) should use exact same businesslogic. right now, solution looks this: businesslogic layer (all of logic defines business rules added here) interfaces model (viewmodels, dtos etc) repository (currently using entity framework 6. database transactions go) webservices (wcf services) mvc website the point presentation layer (i.e. mvc website) use businesslogic layer uses repository make database transaction needed. while works way want to, find myself battleing objectcontext entity framework, because, when querying data in repository, entities doesn't transferred businesslogic (which logical because of efs lazy-loading) i'm aware can make use of .include(x => x.myothertable) , since database large, approach gets bloated , queries can rather large if included table has lot of records. i've made dbcontextmanager class loo...

Iframe src will not load a .php form -

i wanted include contact form website got easy use form here: http://www.html-form-guide.com/contact-form/simple-php-contact-form.html (the middle one) i followed instructions , uploaded 'contact' folder (containing contactform.php) root of website. i chose page on site wanted contact form appear , inserted following: <iframe src="http://[my site].com/contact/contactform.php" frameborder='0' width='100%' height="600' allowtransparency='true'></iframe> now when go page on site expect see form error '404 file or directory not found'. everything else on page ok form not appear, what's wrong?? i followed instructions , uploaded ' contact' folder root of website. urls case-sensitive. instead of http://[my site].com/contact/contactform.php you should use http://[my site].com/contact/contactform.php

python - Creating a callable with numexpr -

i'm doing symbolic math sympy, generating python lambda function using eval , sympy's lambdastr utility. here's simplified example of mean: import sympy import numpy np sympy.utilities.lambdify import lambdastr # simple example expression (my use-case more complex) expr = sympy.s('b*sqrt(a) - a**2') a, b = sorted(expr.free_symbols, key=lambda s: s.name) func = eval(lambdastr((a,b), expr), dict(sqrt=np.sqrt)) # call func on numpy arrays foo, bar = np.random.random((2, 4)) print func(foo, bar) this works, don't use of eval , , sympy doesn't generate computationally-efficient code. instead, i'd use numexpr , seems perfect use-case: import numexpr print numexpr.evaluate(str(expr), local_dict=dict(a=foo, b=bar)) the problem i'd generate callable (like func lambda), instead of calling numexpr.evaluate every time. possible? you can make use of lambdify module, allows transform sympy expressions lambda functions efficient calcula...

Can't set footnote in Word doc using Excel VBA -

i have numerous word documents have several content controls in them. using excel file update word docs. when make update, need insert footnote describing change. can update contents of content control fine, having problems inserting footnote. here's code: set cc = orange.contentcontrols(intcounter) stroriginaldate = cc.range.text if wrddoc.protectiontype <> wdnoprotection wrddoc.unprotect strsheetpassword end if if wrddoc.formsdesign = false wrddoc.toggleformsdesign end if cc.range.text = strcod ' ' insert footnote ' orange = wrddoc.range(cc.range.end, cc.range.end) orange.select selection.moveright units:=wdcharacter, count:=1 selection.typetext text:=" " selection .footnoteoptions .location = wdbottomofpage .numberingrule = wdrestartcontinuous .startingnumber = 1 .numberstyle = wdnotenumberstylearabic .layoutcolumns = 0 end .footnotes.add range:=cc.range, text:="case opening date...

java - How to set the gradient of a shape when the JFrame is constantly being repainted? -

i'm trying oval change gradient's colours every time reaches size of 50 or 100: class mydrawpanel extends jpanel { public void paintcomponent(graphics g) { graphics2d g2d = (graphics2d) g; g2d.setcolor(color.white); g2d.fillrect(0, 0, 300, 300); if(dmt == 100 || dmt == 50) { int red = (int) (math.random() * 256); int blue = (int) (math.random() * 256); int green = (int) (math.random() * 256); color startcolour = new color(red, green, blue); red = (int) (math.random() * 256); blue = (int) (math.random() * 256); green = (int) (math.random() * 256); color endcolour = new color(red, green, blue); gradientpaint gradient = new gradientpaint(300, 100, startcolour, 150, 150, endcolour); g2d.setpaint(gradient); } g2d.filloval((size-dmt)/2, (size-dmt)/2 - dmt/2, dmt, dmt); } } (dmt diameter, size s...

java - Cannot secure connection using TLS -

i'm trying establish secure socket connection between java client applet (built jdk 1.7.0_75-b13) , vc++ server application. as test vehicle, used vc++ client/server sample found in msdn forums, modified use schannel , able establish socket using cipher suite tls_rsa_with_aes_128_cbc_sha. works of tls 1.0/1.1/1.2. when try opening socket java applet same server application, connection rejected server reporting following: tls 1.0 acceptsecuritycontext failed: 0x80090327 tls 1.1 acceptsecuritycontext failed: 0x80090331 tls 1.2 acceptsecuritycontext failed: 0x80090331 this java code used create socket: debugprint("setting secure connection"); sslsocketfactory sslsocketfactory = (sslsocketfactory) sslsocketfactory.getdefault(); sslsocket sslsocket = (sslsocket) sslsocketfactory.createsocket("127.0.0.1", socketnumber); debugprint("starting handshake"); sslsocket.settcpnodelay(true); sslsocket.setsolinger(false, 0); sslsocket.s...

Connecting eBay API with oAuth 2.0 -

Image
i waited around 2 months ebay enable oauth 2.0 developer account, when user clicks "i agree" complete oauth process, redirected success url specified in runame , no code query parameter present. in fact, there no query parameters @ all. has integrated oauth 2? sound i'm missing something? this guide ebay might answer question. all get, when try, "authorisation cancelled" page:

sockets - Using Winsockets to connect to an URL -

i have simple win32 app use post usenet. use send email. a snippet of code usenet posting this: ... wsaasyncselect(conn_sock,mywin,nret,fd_connect|fd_read|fd_write|fd_close|fd_accept); lpservent = getservbyname("nntp", "tcp"); saserv.sin_family = af_inet; saserv.sin_addr = *((lpin_addr)*lphostent->h_addr_list); nret = connect((socket)conn_sock,(lpsockaddr)&saserv,sizeof(sockaddr_in)); ... etc. it works well. when change "nntp" "smtp" can send email. if "http" code not work well. can connect , get/post if address "localhost", "127,0,01" or "192.168.0.5" not if use "195.nn.nn.nn" or "www.somesite.com" etc. what missing? trying avoid using httpopenrequest() etc. functions , use send() recv() etc. instead. connect() requires ip address in numeric format. getservbyname() intended retrieve ip address , port of service provider registered in services databa...

ibm mobilefirst - Get Client IP address on Worklight Adapter -

we developing hybrid application using wl6.2. in our adapter have code: var request = wl.server.getclientrequest(); var ipaddress = request.getheader('x-archieved-client-ip'); if(ipaddress == null || ipaddress == undefined || ipaddress == "") { ipaddress = request.getheader('x-archieved-client-ip'); } if(ipaddress == null || ipaddress == undefined || ipaddress == "") { ipaddress = request.getremoteaddr(); } if(ipaddress == null || ipaddress == undefined || ipaddress == "") { //this never happen, precaution. ipaddress = "192.168.1.1"; } commonparams.originatingip = (ipaddress)?ipaddress:request.getremoteaddr(); i'm not able client ip address on adapter, , our web services see 1 ip address data power ip.and in logs see our data power ip address "orginatingip". means "getremoteaddr()" being executed. <originatingip>datapowerip</originatingip> if kept part of code: v...

Remove prefix from posted data in asp.net mvc -

i have view looks below. each field has prefix attached in name property, model in backend has property without prefix. @using (html.beginform("save", "home", formmethod.post)) { @html.validationsummary(true) <fieldset> <input type="hidden" name="prefix" value="prefix"/> <input type="text" id="prefix.name" name="prefix.name"/> <input type="submit" value="submit" /> </fieldset> } my action method looks below : public actionresult save([modelbinder(typeof(custommodelbinder))]employee employee) { throw new notimplementedexception(); } my model looks : public class employee { public string name { get; set; } } can me how achieve through custom model binder, want strip prefix each of posted form items name. posted form data : prefix:prefix prefix.name:hello world!!...

php - angular way of getting data -

i have site driven ajax. when user goes category page want show products there. what's best way fetch products category? have 2 options: save products js variable threw php @ first load of website, when user goes category filter array products has category , send them view dont save produts variable in beggining, fetch them threw api when user touch category i think first option better because products loaded in begginging , if user touch 50 categories, not have send 50 requests products. i'm not sure(maybe potencial problem if have big amount of products) thanks. you load of product data after angular app has loaded. at rate, vastly depends on how product data have , current load time. it's small amount of products combined make 100kb json object, doesn't matter. but if have more trivial amount of data, and/or average user accessing small percentage of product data, makes more sense load on demand. can keep data in memory if user switches , ...

out of memory - WPF Appliation OutOfMemory Error -

i have issue wpf application. application lot of data crunching. @ specific task memory spikes quite bit. on development machine (windows 8.1 64bit) spikes 1980mb according task manager. on machine (also windows 8.1 64 bit) runs outofmemory exception. noticed stops working once reaches ~ 1000mb in task manager. not sure if coincident stops once reaching 1000mb. i tried largeaddresssaware. runs on 1 machine not other. can think of setting make 1 machine stop @ 1000mb while other machine not ? other ideas going on ? i try optimize code not use memory wondering why app stops @ 1k ram @ 1 machine. i use following configuration in app.config <runtime> <gcallowverylargeobjects enabled="true" /> </runtime> thanks in advance.

how can i pass struct to function as parameter in go lang -

how can pass struct function parameter in go lang there code; package main import ( "fmt" ) type myclass struct { name string } func test(class interface{}) { fmt.println(class.name) } func main() { test(myclass{name: "jhon"}) } when run it, getting error this # command-line-arguments /tmp/sandbox290239038/main.go:12: class.name undefined (type interface {} has no field or method name) there play.google.com fiddle address you're looking for; func test(class myclass) { fmt.println(class.name) } as stands method recognizes class object implements empty interface (meaning in scope it's fields , methods unknown) why error. your other option this; func test(class interface{}) { if c, ok := class.(myclass); ok { // type assert on fmt.println(c.name) } } but there no reason in example. makes sense if you're going type switch or have multiple code paths different things based on a...

javascript - Style a d3 element with jQuery and CSS -

i have somehow technical question. know if there possibility style d3 element jquery. for instance "collatz graph" example d3 site http://www.jasondavies.com/collatz-graph/ producing circle - nodes small labels. in case numbers 1, 2, 3 , on. number nothing more piece of code e.g. <text dy=".31em" text-anchor="start" transform="rotate(90)translate(8)">32</text> how style element jquery? e.g. adding red border clicking it? obviously need class or id in <text ... > , proceed follows: $(".nome_class").click(function() { $(this).css( "border", "3px solid red" ); }); in code, both d3 working (i can see graph) , jquery working (i can instance style or else regular html elements). when try style d3 element no result. i grateful hint or advice. to cut long answer short: don't it! try searching [svg][jquery] namespace on variety of problems might run when trying use...

php array doesnt write to file as expected -

basically im reading file, pushing array, , rewriting file arrays no data lost this text file after write array. pirmadienis,antradienis,etc stored on different arrays. when write "pirmadienis" array starts in second line , pushed other 1 side. pirmadienis "array fwrite here" antradienis treciadienis ketvirtadienis penktadienis this php use. $pirm array "pirmadienis". use 4 more foreach loops each array writen file. ideas why creating new line? $file = fopen($failas,"w+"); foreach($pirm $key => $value) { fwrite($file,$value); }

project - Cannot create a new Spring web app in spring tool suite -

i trying use spring mvc template, wizard windows says 'requires downloading' next button disabled. dont know do. just type in project name in field (on top of dialog). next button enabled.

JSON decoding in PERL - Maintaining the original data type -

i writing simple perl script read json file , insert mongodb. facing issues json decoding. non-string values in original json getting converted object type after decode_json . input json(only part of since it's original huge) - { "_id": 2006010100000801089, "show_image" : false, "event" : "publish", "publish_date" :1136091600, "data_version" : 1 } json gets inserted mongodb - { "_id": numberlong("2006010100000801089"), "show_image" : bindata(0,"ma=="), "event" : "publish", "publish_date" :numberlong(1136091600), "data_version" : numberlong(1) } i providing custom _id documents, want converted numberlong type. working expected can see json above. notice how other non-string values show_image , publish_date , data_version got converted it's object representation. there way can retain origina...

regex - regexp for finding substring(vehicle number plate) in matlab from long string? -

i have long string "sdnak hsd fds fnsdf apsdf09sdf bn fddsdalf 7886sd f" string have extract "ap09bn7886" vehicle's licence plate number in india. know possibly easiest use regular expression, can tell me reg. exp find this. as understand the format , indian license plates are: two uppercase latin letters representing indian state - [a-z]{2} two digits representing sequential number within state, \d{2} then 4 digits prefixed letters when run out of digits; [a-z]*\d{4} (number 1 , number 2 combined rto state , district) you trying gather components of long string, , have not stated enough detail of other parts of string eliminate ambiguity (for example: letters lower case or non latin characters? 1 license plate per string? 2 letters prefixing 4 digits? etc) since not known, can represent 'sea' of characters between match groups .*? the variable letters prior 4 digit number particularly ambiguous, since there unrelated uppercase ...

ruby on rails - Can't grant permission on class scoped to belongs_to association -

i have courseclass model has many attendancesheet s , has_many teacher s. want teacher(s) of course_class instance able manage course_class's attendance sheets. i'd expect following set up: if user.has_role? :teacher can [:manage], attendancesheet, course_class: { teachers: {id: user.id } } end users have global roles, can have per-instance roles on courseclass. above, in theory, should check have global role, , teachers association finds teachers instance role on courseclass. in controller @attendance_sheets set by: @attendance_sheets = @course_class.attendance_sheets.all when run ability checks following results: [1] pry(#<#<class:0x007fb011970ea0>>)> can? :read, @attendance_sheets => false [2] pry(#<#<class:0x007fb011970ea0>>)> can? :read, attendancesheet => true [3] pry(#<#<class:0x007fb011970ea0>>)> can? :read, @course_class.attendance_sheets => false [4] pry(#<#<class:0x007fb011970ea0>...

emmet conflicting with snippets visual studio 2013 -

every time type emmet string , press tab visual studio replaces main element. realized preferning the snippet auto suggesting. there way around or fix it? using visual studio 2013 community edition on windows 7 64bit if makes difference i found problem, using plugin called viasafora colors braces , makes easier to see indentations had default option showing completions ans type. had go turn off.

javascript - Drawing a circle on HTML5 canvas at touch location -

basically, i'm trying use javascript when button pressed on page, begin listening next touch on canvas. on touch, function triggered gets x , y co-ordinates of touch , draws circle there. circle needs labelled well, have put in prompt label. here attempt , bit of context: <input type="button" value="add symptom" onclick="touch_init();"> when above input button pressed following triggered: function touch_init(){ var canvas = document.getelementbyid("medicanvas"); canvas.addeventlistener("touchstart", drawsymptomcircle, false); } function drawsymptomcircle(event) { var canvas = document.getelementbyid("medicanvas"); if (canvas.getcontext){ var ctx = canvas.getcontext("2d"); var x = new number(); var y = new number(); var radius = 100; var symptomname=prompt("please enter name of symptom:"); x = event.targettouche...

php - Unable to handle unchecked checkbox in loop while save -

i have multiple checkboxes in foreach loop in code <form method='post' action='save.php'> <?php foreach($problems $problem): ?> <input type='text' name="month[]"/> <input type="checkbox" name="is_increased[]" value="1" /> <?php endforeach; ?> <input type='submit' value='submit'/> </form> when save, got values of checked checkboxes only. how checkboxes value, '0' if checkbox unchecked. thank you. you have this: <form method='post' action='save.php'> <?php $i = 0; foreach($problems $problem): ?> <input type='text' name=month[<?php echo $i ?>]/> <input type='hidden' name="is_increased[<?php echo $i ?>]" value="0" /> <input type="checkbox" name="is_increased[<?php echo $i ?>]" value="1" /> <?php ++$i; endforeach...

Wrong output in Javascript calling function -

i'm trying print result of javascript function, instead whole function output x7: function function () { return "hello form function"; } i want output: hello form function html <p id="demo"></p> javascript var x7 = function (){ return "hello form function"; }; document.getelementbyid("demo").innerhtml = "x7: " + typeof x7 + "<br>"+x7+"<br>"; you have use parentheses call function: x7() : <!doctype html> <html> <body> <p id="demo"></p> <script> var x7 = function (){ return "hello form function"; }; document.getelementbyid("demo").innerhtml = "x7: " + typeof x7 + "<br>"+ x7()+"<br>"; </script> </body> </html>

actionscript 3 - Flex Mobile - Custom Spark List ItemRenderer -

i looking guidance create custom spark list itemrenderer flex mobile application developing. overview: section list each item has checkbox control, label, button control 1 - opens accordion list below item, button control 2 - opens camera ui. what struggling creating itemrenderer allows accoridion list visible , populated. update: here's existing code <fx:metadata> [event(name="checkboxiconitemrendererchanged", type="flash.events.event")] [event(name="cameraiconitemrendererchanged", type="flash.events.event")] </fx:metadata> <fx:script> <![cdata[ import spark.components.label; import spark.components.checkbox; import spark.components.hgroup; import spark.components.image; import spark.layouts.horizontalalign; import flashx.textlayout.formats.verticalalign; //camera stuff public var cameraicon:image; public var friendsicon:i...

database - Retrieving the object from a replicated row with Laravel/Eloquent -

i'm replicating database row , want return new row object. $new_foo = foo::find($id)->replicate()->save(); print_r($new_foo); this returns 1 instead of new object created. thoughts? in code, saving value returned save() method , not replicated model. you need make slight change code save replicated model $new_foo $new_foo = foo::find($id)->replicate(); $new_foo->save(); dd($new_foo); save() method returns boolean .

what is the fastest function in RDD spark -

i'm implementing groupby function , "transformations" operation. i need groupby function must computed immediately, i've found out solution calling "action" likes first() or count() operation after groupby computed. the running time of groupby equal + action operation, , need fastest function minimum total running time!! thanks! i assume doing performance testing kind of thing.so if right don't matter action returns,you need transformation(groupby) executed. i think first() fastest rdd action can think of. another approach can find time taken transformation (group by) alone in webui of spark.so can use rdd action wish!

javascript - ykeys null in morris line chart -

i have 3 ykeys parameters , 1 or other ykey value null. eventhough have 1 null ykey, should line chart other ykeys. that's not happening. i'm getting blank chart , getting 'svg' error. kindly on this, here tried far: new morris.line({ element: 'divname', data: [ { year: '2008', a: '',b:'10',c:'20'}, { year: '2009', a: '',b:'15',c:'25'}, { year: '2010', a:'',b: '5' ,c:'10'} ], xkey: 'year', ykeys: ['a','b','c'], labels: ['a','b','c'] }); -- in case need line chart b , c values. i'm getting svg error empty chart

c# - Communicate between pages in wpf -

i have 2 pages , 1 mainwindow.. load pages in 2 frames.. want execute methods each other.. how can this? this page1.cs: public partial class page1 : page { public method1() { dosomething; } } this page2.cs: public partial class page2 : page { public method2() { dosomethingelse; } } in mainwindow following happens: frame1.source = new uri("/source/pages/page1.xaml", urikind.relativeorabsolute); frame2.source = new uri("/source/pages/page2.xaml", urikind.relativeorabsolute); is there way, execute method2 page1.cs, , method1 page2.cs? regards one way through common parent, window. looking @ (modified accordingly) public partial class mainwindow : window { public page1 page1ref = null; public page1 page2ref = null; public mainwindow() { initializecomponent(); } private void window_loaded(object sender, routedeventargs e) { frame1...

objective c - Making first iOS App work -

i trying learn building apps using ios. using xcode 6.4, , the tutorial following seems accept using fun , override, when try it, brings errors. connecting protected page registration page this. #import "viewcontroller.h" @interface viewcontroller () @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. - (void)viewdidappear(animated: bool) { [self.performseguewithidentifier("loginview", sender: self)]; } } @end can please me point out error , solution? welcome so. typically isn't general debugging service might foot up... in objective-c methods can't declared inside other methods. can in swift swift code can't smooshed alongside objective-c code. case important in swift , obj-c performseguewithidentifier n...

javascript - Google Charts with client side data population -

i've been looking @ possibilities populate chart google charts live client data. have tried solutions send requests back-end keep side separate client environment , api still undergoing development. this example code standard pie chart //js code <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> // load visualization api , piechart package. google.load('visualization', '1.0', {'packages':['corechart']}); // set callback run when google visualization api loaded. google.setonloadcallback(drawchart); // callback creates , populates data table, // instantiates pie chart, passes in data , // draws it. function drawchart() { // create data table. var data = new google.visualization.datatable(); data.addcolumn('string', 'topping'); data.addcolumn('number',...

encryption - SQLCipher error: sqlite3_key is undefined -

using: sqlite3_key(db, "test123", 7); throws ||sqlite3_key undefined|| error, added sqlite3.h file , has method. realize there comment whit hint above. ** specify key encrypted database. routine should ** called right after sqlite3_open(). ** ** code implement api not available in public release ** of sqlite. wrong? your application not including cflag -dsqlite_has_codec make sqlite3_key available @ compile time, please check that. more information on sqlcipher build process, please see this page.

winforms - c# group controls by name -

im looking way group number of controls in winforms name using c#. the best way can describe functionality need compare how classes work in html/css same class recycled throughout target controls associated class. i have tried using name property control.name hasnt worked out planned. example //group controls group identifier in case string 'name'` txtforename.name = "name"; txtsurname.name = "name"; txtnotaname.name = "notaname"; foreach (control control in form.controls) { if (control.name == "name") { console.writeline("true"); } } expected output true; true; if more 1 control has same name, can target them while searching collection of controls? is possible? you use tag property on controls can store object. code be: foreach (control control in form.controls) { if(control.tag != null && control.tag.tostring() == "mytag") { //... } } alterna...

sql server - SQL script that loops jobs for parallel execution -

i working on process load data oracle sql server using attunity connector in ssis. there around 50 tables need load , have created job each of them can load them in parallel. based on server resources, can run 10 @ time. have script have been working isn't working correctly because fires 10 jobs , quits. need script loop through 50 jobs (start ps_) , run 10. declare @a int set @a=0 declare @jobname nvarchar(200) -- checks if there 10 jobs running while ((@a <10) , ( (select count(*) msdb.dbo.sysjobs inner join msdb.dbo.sysjobactivity b on a.job_id = b.job_id where start_execution_date not null and stop_execution_date null and substring (name, 1,3) = 'ps_')<= 10)) begin set @jobname = null --loops through fetch 1 non-running job @ time , fetches upto 10 jobs select top 1 @jobname = name from msdb.dbo.sysjobs x where substring (x.name, 1,3) = 'ps_' and --checks job did not run today , running. name in...

php - mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 to be resource or mysqli_result, boolean given -

i trying select data mysql table, 1 of following error messages: mysql_fetch_array() expects parameter 1 resource, boolean given or mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given this code: $username = $_post['username']; $password = $_post['password']; $result = mysql_query('select * users username $username'); while($row = mysql_fetch_array($result)) { echo $row['firstname']; } the same applies code $result = mysqli_query($mysqli, 'slect ...'); // mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given while( $row=mysqli_fetch_array($result) ) { ... and $result = $mysqli->query($mysqli, 'selct ...'); // call member function fetch_assoc() on non-object while( $row=$result->fetch_assoc($result) ) { ... and $result = $pdo->query('slect ...', pdo::fetch_assoc); // invalid argument supplied foreach() foreach( $result $row ) { ... and ...

sql - Partition elimination in Greenplum -

i have scenario this: select * package package_type in ('box','card') the table partitioned package_type field. assume there twenty possible values package_type field. there twenty partitions including box , card , default partitions. when above query run, partition elimination happens correctly , box , card partitions scanned. result quick. however, when same query written this: select * package package_type in (select package_type package_list_table) , column package_type in package_list_table contains 2 values box , card . when above query run, 20 partitions being scanned. degrades performance. it seems compiler failing identify second query correctly , result partitions getting accessed. any workarounds overcome this? thanks in advance. the postgres manual page on partitioning includes caveat constraint exclusion works when query's clause contains constants (or externally supplied parameters). example, comparison agains...

C++ Threadpool without using boost lib -

i have use threadpool in program have no idea how use it. know how create , use thread after lot of research, can't find how can implement threadpool without using boost lib (forbidden). if have ideas or searching path, appreciate it. i'm not asking full code @ least if can lead me. i've googled 20 seconds , i've found this, hope helps, since question how use threadpool c++ thread pool edit: without boost: simple thread pool in c++ however thread has "homework" written on it. luck ;)

ruby - Rails with angular - null value change to 0 -

Image
when update field null value, 0 appear. db: postgres angular put request ------webkitformboundarygqglt12slbc759gb content-disposition: form-data; name="product[gender]" null the field: :gender, 'integer using cast(gender integer)', {default: nil, null: true} result:

java - ExpandableListView Change layout of first child -

i'm trying load 2 different layouts expandable list child . keep getting null pointer, me sounds !=0 not working way intended. doing wrong? public view getchildview(final int groupposition, final int childposition, boolean islastchild, view convertview, viewgroup parent) { layoutinflater inflater = context.getlayoutinflater(); log.e("comments", "ok position: " + childposition); if (convertview == null) { if(childposition==0){ //first view convertview = inflater.inflate(r.layout.comments_create_comment, null); }else { //second view convertview = inflater.inflate(r.layout.comments_expandable_list_child, null); } } if(childposition!=0){ textview item = (textview) convertview.findviewbyid(r.id.comments_expandable_list_child_text_view); imageview delete = (imageview) convertview.findviewbyid(r.id.comments_expandable_list_child_delete); //th...

Use arbitrary number of arguments in class generics - Java -

i wondering if possible use arbitrary number of arguments in class generics? in methods, possible using '...' why i'm wondering if there similar way done in class generics class<t ...> something 1 above. no, can't that. each type-parameter must separately specified , have unique in terms of naming. for example: public class someclass<a, b, c, d> { .... } //valid public class someclass<a, a, b, b> { .... } //wrong, because names not unique

javascript - Pebble return carriages working on emulator but not on watch -

i have pebble smartwatch watchface gets text textarea in app's config page (html page), , puts value text layer on watchface. unfortunately there 2 things cause not work intended (hopefully they'll both solved 1 solution): 1) return carriages (eg. \n don't work on text layer, instead of moving new line displays '\n' character 2) unpaired ' (apostrophes) , " (quotation marks) don't update page (i.e don't work) i'm not amazing @ working communication between watchface , config else seems work fine apart 1 issue. below path took getting text text area text layer. relevant script (in config.html) [].foreach.call(document.queryselectorall("#save"), function(e1) { e1.addeventlistener("click", function() { console.log(saveoptions()); var return_to = getqueryparam('return_to', 'pebblejs://close#'); document.location = return_t...

gnuplot logscale looks the same with every base -

Image
i using gnuplot plot measured data , want focus on smaller values of x. x between 0 , ~65 interesting things happen between x = 0 , x = 1. use logscale. but looks same every base choose: f(x) = x**2 p(l) = (1-(l/100))**2 e(l) = p(l)**50 g(l) = e(l)*1000*100 set key bottom left set xtics ("0" 0.001, 0.01, 0.05, 0.1, 0.2, 0.3, 0.5, 0.7, 1, 2, 5, 10, 15, 25, 40, 50, 60) set yrange [0:f(100.5)] set xlabel "loss rate in %" set ylabel "successful requests (100% of expected results) in %" set ytics ("0" f(0), "50" f(50), "75" f(75), "80" f(80), "90" f(90), "100" f(100)) set logscale x 10 plot "collected_$intv.table" using 1:(f(\$2/10)) title "maximum 1 try" lc rgb "red" pt 1 lw 1, \ "collected_$intv.table" using 1:(f(\$2/10)) notitle w lines ls 27, \ "collected_$intv.table" using 1:(f(\$3/10)) title "maximum 2 tries"...

Invoke web-service in Java -

i'm writing application , application supposed talk web service. i'm supposed send filename web service , web service supposed return (text) contents of file. i think have in place, don't know how write code or call or might call it. i understand pretty straight forward, can't seem it. thanks in advance if using soap web service, jax-ws pretty straight forward. try hello world tut here: http://www.mkyong.com/tutorials/jax-ws-tutorials/ if rest service, more now, try this: http://www.mkyong.com/webservices/jax-rs/restful-java-client-with-apache-httpclient/

metal - efficiency of storing in MTLBuffer -

i want store image float data in unformatted memory location within shader, , mtlbuffer seems answer. firstly, possible? saw within apple docs of mtlbuffer 1 can access pointer pointing buffer. possible use pointer within shader fill allocated memory? secondly, wish idea how fast operation be; fast , efficient operating textures? i ask need re-engineer lot of code if confirmed mtlbuffer's speed of access comparable operating mtltexture. first, it's important aware of several restrictions : fragment shaders neither support writing textures nor buffers. you're option rendering textures. vertex shaders support support writes buffers not textures. so if you're using either of these shader types, don't have choice between texture writes , buffer writes, regardless of performance. if you're using compute shader , write pattern relatively simple (i.e. 1-to-1 thread id pixel correspondence), i'd expected buffer writes faster. said, there no ge...

c++ update boost version issue -

the thing is, installed new version of boost on ubuntu.. had 1.46 , have 1.56. problem facing of programs wont run since apparently require: error while loading shared libraries: libboost_program_options.so.1.46.1: cannot open shared object file: no such file or directory is there bypass around this. how solve problem ? boost versions not binary compatible. application needs boost-1.46.1 , cannot use other version. either install boost-1.46.1 or recompile , re-link applications against available boost version.

android - add blink to customized listview Item? -

Image
i have created listview contains multiple items, , added border items this: because of customized border original blink of item blocked doesn't appear, , i've tried add blink through animation there delay , work on main thread, used animation inside threads same delay thing, force me forget animation there anyway can make item blink when clicked without using animation or using in efficient way , way used blink animation inside onitemclicklistener can find in code below: onitemclicklistener handle blink: datalist.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> arg0, final view arg1, final int arg2, long arg3) { // todo auto-generated method stub tvwarningnoemp.setvisibility(view.gone); // adding blink final animation animation = new alphaanimation( ...