Posts

Showing posts from September, 2011

How to consistently replace atoms with variables in Prolog? -

i writing parser sparql (semantic web query language) using dcg. want replace sparql variable names prolog variables. how go this? i can generate new variables using length([newvar], 1) , cannot keep track of existing assignments using list of name-variable pairs. member/2 operation on list return new variable, not 1 stored in list. is there easy way naming variables in prolog, e.g., '$var(name)' ? member/2 want. here example: welcome swi-prolog (multi-threaded, 64 bits, version 7.3.25) copyright (c) 1990-2016 university of amsterdam, vu amsterdam l=[a-x,b-y,c-z], member(b-v,l). l = [a-x, b-v, c-z], y = v but might problems if interleave write/1 member/2, since variable might change identity, i.e. write symbol in following circumstances: because of garbage collection, if variable written _g<memloc> because of aliasing, in above example memloc of v might shown instead of memloc of y same problem (@<)/2. 1 way out use attribute variables,

image - To map RGB to Parula in Matlab -

Image
there functions such rgb2hsv , rgb2ind , rgb2lab , rgb2xyz in converting rgb colormap 1 - in matlab r2014b colormap parula introduced. however, cannot find solution convert rgb colormap parula i.e. current default colormap of matlab. can set colormap figure, not convert image follows. started think benefits of parula in contrast hsv in 1 part of removing black , neighbor colors in picture, example here . pseudocommand im = imread('http://i.stack.imgur.com/cfosp.png'); hsv = rgb2parula(im); % pseudocommand similar hsv: hsv = rgb2hsv(im); imshow(hsv); which gives which 1 reason quantization noise in later stages of image processing , bad morphological removal, indicated in previous thread. how can map rgb parula in matlab? user-made parulas i think need customized parula because function rgb2parula not available. proposal here variant gnuplot colormap. how can convert piece of code matlab? this not possible, because parula not contain po

javascript - Sharing data of a ng-repeat form field across controllers -

i’m making order form business card button add business card. want button create business card form , data forms shared controller of view. i have 2 templates connected respective controllers. order.html, order.js confirm.html, confirm.js code samples: order.js .factory('cards', function () { var cards = [] return cards }) .controller('testctrl', function ($scope, cards) { $scope.person0={name: '', email:'', description:''} $scope.person1={name: '', email:'', description:''} if (cards.length < 2) { cards.push($scope.person0); cards.push($scope.person1); } } order.html <md-toolbar layout='column' layout-align='center' ng-repeat="card in cards"> <md-button layout-margin layout-padding flex='100' class='md-raised md-primary'> <h1>{{ card.name }}</h1> <h1>{{ card.email }}</h1>

java - Class objects not loading -

my class object not loading reason. i've made 3 methods in second class , i'm trying use them in first class, i'm getting exception errors. here's first class: public class myfish extends panel implements runnable, keylistener { public static void main(string args[]) { efish.loadefish(efish.efish); // load efish objects efish.loadefishthread(efish.efishthread); // load efish threads efish.startefishthread(efish.efishthread); // start efish threads } } here's second class: public class efish implements runnable { static efish efish[] = new efish[20]; static thread efishthread[] = new thread[20]; static void loadefish(efish i[]) { (int j = 0; j < i.length; j++) { i[j] = new efish(); } } static void loadefishthread(thread i[]) { (int j = 0; j < i.length; j++) { i[j] = new thread(); } } static void startefishthread(thread i[]) { (int j = 0; j < i.length; j++) { i[j].start(); } } }

javascript - calling click() function on html element in jasmine-phantomjs test -

this question has answer here: phantomjs; click element 11 answers i run tests karma , phantomjs: info [karma]: karma v0.12.32 server started @ http://localhost:9876/ info [launcher]: starting browser phantomjs info [phantomjs 1.9.8 (windows 7)]: connected on socket kvovdbbgtieuquv8aaaa wit in test want click on paragraph (p) event-feedback: // given var element = appendtobody("<p id='hello-p'>hello hello world!</p>"); element.addeventlistener('click', function(event) { console.log("1"); }); // when var p = document.getelementbyid("hello-p"); console.log(p); // log: <p id="hello-p">hello hello world!</p> console.log(p.id); // log: 'hello-p' p.click(); // calling click i end having message: typeerror: 'undefined' not function (evaluating '

php - Count rows in while loop -

i trying while loop information select statement, count results. have tried @ least 10 different "solutions" , none works. 0, 1, or nothing. here's recent attempt: $query35 = "select * movies userid = $memberid"; $result35 = $db->query($query35); while ($row35 = $result35->fetchall(pdo::fetch_assoc)) { $movie = $row35['movie']; $query36 = "select count(*) similar movies userid = '$profileid' && movie = '$movie'"; $result36 = $db->query($query36); $row36->fetchobject; $similar = $row36['similar']; echo $similar; } $row36->fetchobject; seems null object, think should be $row36 = $result36->fetchobject();

Estimate the order of growth of algorithm from run time and ratio of change -

i'm beginner practising algorithms. below list represents algorithm ran , recorded times , ratio of change. i'm not sure how figure out order of growth list. factors have consider? appreciate explanatory answer. n |seconds | ratio | log(base of 2) ratio --------------------------------------- 512 0.12 4.14 2.05 1024 0.49 4.24 2.08 2048 2.08 4.24 2.08 4096 8.83 4.24 2.08 compare times smallest input various larger inputs: a 2x increase in n (512->1024) results in 4x increase in running time. a 4x increase in n (512->2048) results in 16x increase in running time. an 8x increase in n (512->4096) results in 64x increase in running time. from this, can extrapolate k x increase in n result in k 2 x increase in running time, indicating o( n 2 ) algorithm.

java - HTTP Status 404: The requested resource is not available/ Tomcat7 -

Image
i have been working on java application couple of days.the project simple spring,hibernate,jsf,mysql integration run on eclipse. aim of program add person(id, first name, last name, gender, age etc.) database on mysqlworkbench , run on server.i used spring4, hibernate4 , eclipse luna tools.and constructed project maven. database works now, can add new rows when run main class.but when comes run on server, fail. watched tutorials on youtube , see effective ways use tomcat7.on first try run java application applied following steps: 1-i create new server(tomcatv7.0 server) via right clicking servers folder on project explorer. 2-i added project configure on server via right clicking on server , choosing "add , remove" 3-again, right clicked on project run --> run on server. by way, faced output on console: apr 22, 2015 8:52:14 pm org.apache.tomcat.util.digester.setpropertiesrule begin warning: [setpropertiesrule]{server/service/engine/host/context} set

javascript - setTimeout giving unexpected identifier? -

so have code running inside of google chrome console, , every time try run it give me unexpected identifier on line: 12. went line , settimeout. don't know how fix this, tried call snipebot() didn't work either. function snipebot(itemid, max_price){ var itemurl = "http://www.roblox.com/item.aspx?id=" + itemid; $.get(itemurl, function(data){ var purchasedata = $($(data).find(".purchasebutton")[0]).data(); if (purchasedata['expectedprice'] <= max_price){ $.post('/api/item.ashx?rqtype=purchase&productid=' + purchasedata['productid'] + '&expectedcurrency=1&expectedprice=' + purchasedata['expectedprice'] + '&expectedsellerid=' + purchasedata['expectedsellerid'] + '&userassetid=' + purchasedata['userassetid'], function(){ console.log('[' + purchas

sql - create column data mysql evaluating hour column -

Image
i have column datatime type hour in mysql, , want read column , create other days each hour(0-23:59). put image explain better. intent with for rowshour day = 0 if rowhour[i] < rowhour day = day + 1 thanks all. best regards! the table, , column of date same want i believe asking 2 columns. |--id--|--name--|----dt----|--hr--| | 1 | data |2015-04-22| 00 | | 1 | data |2015-04-22| 12 | | 1 | data |2015-04-22| 20 | | 1 | data |2015-04-22| 21 | for hour (hr) use integer instead of datetime. dt use datetime, have exact minute. when query use date(), finally can use ever incrementing integer format of this: yyyymmddhh, example 2015-04-22 @ 12 2015042212

google oauth - Django Rest Framework + Ember.js + rest auth -

we're building site using ember frontend app interacts our django rest framework api backend. social authentication we're using django_rest_auth coupled django-allauth . site working, except we've run problems social authentication. our local account authentication/registration working fine. i've made many projects use django-allauth, first time using restful authentication system. ember application able go , fetch token google fine. response like: { authorizationcode: "mytoken12345", provider: "google-oauth2", redirecturi: "http://localhost:4200/dashboard" } i post access_token endpoint i've set according django_rest_auth docs. post /auth/google {access_token:} error returned google says "invalid credentials". how can invalid credentials after authenticating google , receiving token? after debugging through code, found getting response https://www.googleapis.com/oauth2/v1/userinfo during complete_

Java can't show image [CANVAS] -

i making game in java , trying draw image on screen, nothing show ( black screen no errors ) :( here code import image: public static bitmap loadbitmap(string filename) { try { bufferedimage img = imageio.read(art.class.getresource(filename)); int w = img.getwidth(); int h = img.getheight(); bitmap result = new bitmap(w, h); img.getrgb(0, 0, w, h, result.pixels, 0, w); (int = 0; < result.pixels.length; i++) { int in = result.pixels[i]; int col = (in & 0xf) >> 2; if (in == 0xffff00ff) col = -1; result.pixels[i] = col; } return result; } catch (exception e) { throw new runtimeexception(e); } } and bitmap class: public void draw(bitmap bitmap, int xoffs, int yoffs) { for(int y = 0; y < bitmap.height; y++) { int ypix = y + yoffs; if(ypix < 0 || ypix >= height) continue; for(int x = 0;

java - Is it possible to limit port number reservation range in GlassFish (or underlying jvm machine)? -

in linux server have few glassfish instances want start server product , had "address in use" error. investigating lsof found java process of glassfish occupying port number needed second product want run in same machine. is there way limit port reservation range glassfish (or underlying jvm machine)? glassfish uses few ports , need tell him use other ports. should able run it. asadmin set server.http-service.http-listener.http-listener-1.port=10080 asadmin set server.http-service.http-listener.http-listener-2.port=10443 asadmin set server.http-service.http-listener.admin-listener.port=14848 asadmin set configs.config.server-config.system-property.jms_provider_port.value=9999 look here more info: https://arnoldvillasanta.wordpress.com/2011/12/15/changing-default-glassfish-v3-port-numbers-4848-8080-and-8181/

R: Evaluate an expression in a data frame with arguments that are passed as an object -

i want write function evaluates expression in data frame, 1 using expressions may or may not contain user-defined objects. think magic word "non-standard evaluation", cannot quite figure out yet. one simple example (yet realistic purposes): say, want evaluate lm() call variables found in data frame. mydf <- data.frame(x=1:10, y=1:10) a function can written follows: f <- function(df, expr){ expr <- substitute(expr) pf <- parent.frame() eval(expr, df, pf) } such want using following command. f(mydf, lm(y~x)) # call: # lm(formula = y ~ x) # # coefficients: # (intercept) x # 1.12e-15 1.00e+00 nice. however, there cases in more convenient save model equation in object before calling lm() . unfortunately above function no longer it. fml <- y~x f(mydf, lm(fml)) # error in eval(expr, envir, enclos): object 'y' not found can explain why second call doesn't work? how function altered, such both calls lead

bitcoin - bitcoinj Connect P2SH input transaction to the output transaction -

i have created p2sh address , send coins address https://www.blocktrail.com/tbtc/address/2n8xu6rnawssxtp2xpjstut2viwqopehr3r next want send coins 2n8xu6rnawssxtp2xpjstut2viwqopehr3r address. how prepare p2sh transaction , connect output script? public static void sendfromp2sh(walletappkit kit, address destadd, coin coin) throws addressformatexception, insufficientmoneyexception, executionexception, interruptedexception { transaction tx = new transaction(testnet3params.get()); tx.addoutput(coin, destadd); //prepare destination output wallet.sendrequest req = wallet.sendrequest.fortx(tx); //todo prepare p2sh input output //https://www.blocktrail.com/tbtc/address/2n8xu6rnawssxtp2xpjstut2viwqopehr3r script script = p2shscript(kit); //2n8xu6rnawssxtp2xpjstut2viwqopehr3r transactionoutput t = null;//... how connect p2sh input transaction output ? tx.addinput(t); kit.wallet().completetx(req); kit.wallet().committx(req.tx); kit.peergroup(

c++ - what is the best way between : instantiate an object or use pointers -

we want create our own list of triangles list existed of stl mode (it's 3d geometric model, composed of triangle), several triangle can had same point, want use best solution: s1) goes through list, use coordinates of each triangle (element) of list create triangle object , put in our list (victor). here there points must created multiple times, because have said many triangles can have same point. s2) there existed list contains points, goes through list of triangle existed , each point of triangle search in list of points (so have use sort , search algorithms) use pointers (point on these points) , create objects contients 3 pointers (*p1, *p2, *p3) , put them in our list. store points in std::unordered_set store triangles list of structures containing 3 std::unordered_set::const_iterator 's. insertion of points set approximately constant time , insert returns pair contains iterator point can found. have here more details on how insert works. here

Memcached set_many and get_many failing when trying more than 100 k,v pairs in django..why? -

i'm have dictionary of data cache, use: cache.set_many(dict_to_cache, ttl) for dictionary has more 100 entries, not seem set. no error thrown, , doesn't seem getting evicted, doesn't save. work around break dictionary 100 key chunks via method: def dict_chunker(data, size=100): = iter(data) in xrange(0, len(data), size): yield {k:data[k] k in islice(it, size)} that seems work fine, wondering make not set dictionaries on 100 entries? i had same issue getting more 100 keys @ time. dict = cache.get_many(list_of_keys) does know why happen?

qt - Is there a standard way to add to the "start menu" on Linux? -

i creating linux installer (currently looking @ qt installer framework) , need add shortcuts start / applications menu. i have read , experimented .desktop files puts shortcut in general applications section... how can create vendor/product/application structure in menu? we trying move away installjammer this, far aware need use custom script in qt installer framework. any thoughts or recommendations? thanks, alan

How to Separate jQuery Functions w/o Using 2 Script Tags -

i'm not 100% knowledgeable in js or jquery, , have question how separate functions. i have function: $(window).scroll(function(){ var wscroll = $(this).scrolltop(); console.log(wscroll) var windowwidth = ($(window).width() / 8); var windowheight = ($(window).height() / 16); $('.fore-card').css({ 'transform': 'translate(' + windowwidth*0 + 'px, ' + windowheight*(-6) + 'px)', }); $('.mid-card').css({ 'transform': 'translate(' + windowwidth*(-1) + 'px, ' + windowheight + 'px)', }); $('.back-card').css({ 'transform': 'translate(' + windowwidth*(2) + 'px, ' + windowheight*(-12) + 'px)', }); }); as can see have listener scroll. have functions have nothing scroll of page. work, scroll causing jankiness objects, hence why need separate them. i thought this: $(document).ready(function(){ func1(); func2();

swift - Unable to log in using FBLoginView in iOS using facebook sdk -

Image
the function loginviewshowingloggedinuser never getting called. when press log in button, goes facebook screen asking me press ok , comes , still shows "log in.." in button. each time loginviewshowingloggedoutuser function gets called. below class: import uikit class fbloginviewcontroller: uiviewcontroller, fbloginviewdelegate { @iboutlet weak var fbloginview: fbloginview! override func viewdidload() { self.fbloginview.delegate = self self.fbloginview.readpermissions = ["public_profile", "email", "user_friends"] } func loginviewshowingloggedinuser(loginview: fbloginview!) { println("in loginviewshowingloggedinuser") } func loginviewshowingloggedoutuser(loginview: fbloginview!) { println("in loginviewshowingloggedoutuser") } func loginview(loginview: fbloginview!, handleerror error: nserror!) { println("in loginview") } func loginviewfetcheduserinfo(loginview: fbloginview!, use

javascript - Using background subtraction in a webcam-video feed in a HTML page -

Image
i'm trying make prototype photobooth-ish setup interface being shown on html page. i've managed embed video within canvas element uses integrated/external webcam on computer show user's face/body depending on distance screen. problem: need able eliminate background such person's face/body visible , rest transparent. need div tag housing overlayed on top of background such appears if person standing in front of device standing in different background setting (space,mountains,castles etc. illustrated on ui) in room. how can use image processing code within , how can achieve effect? the code i'm working far: <div id=outerdiv> <video id="video" autoplay></video> <canvas id="canvas" > <script> // put event listeners place window.addeventlistener("domcontentloaded", function() { // grab elements, crea

How to Convert a Flattened Array to Multidimensional Array in PHP -

i trying convert key values of array multi-dimensional array. key values multidimensional, text. have tried exploding the string , creating new array, feel there must simpler that. example below: array ( [template[url]] => http://www.asdasdda.com [template[upc]] => 5484548546314 [field[value]] => test example [field[answer]] => 20 ) all appricated. :) update: exact output of data before run json_decode on data. {"template[url]":"http://www.asdasdda.com","template[upc]":"5484548546314","field[value]":"test example","field[answer]":"20"} fiddled around bit, , think got it. don't think there simpler way: foreach ($array $key=>$value) { preg_match("/\[(.+)\]/",$key,$match); $newkey = preg_replace("/\[.+\]/","",$key); $newarray[$newkey][$match[1]] = $value; } where print_r() of $newarray follows: array ( [template]

javascript - Code not working in IE to hide and unhide Divs -

i'm no js asn code i'm using colleague put me , works fine in chrome isn't playing nice in ie. the code allow me have list can click show hidden div , when click link in list hide last div , unhides last clicked etc. here js function hideclass(id){ $('.objections').addclass('hide'); $('#'+id+'_container').removeclass('hide'); } and have in html onclick="hideclass(this.id)" is there anyway alter work in ie? as said, i'm not @ js html css have no idea start without seeing code it's hard know what's failing. guessed @ doing , came basic code, worked in ie me. however, ie did block scripts , had click allow. watch that. function hideclass(id) { $('.objections').addclass('hide'); $('#' + id + '_container').removeclass('hide'); } .hide { opacity: 0; } <!doctype html> <html> <head> <meta chars

ios - Apple Watchkit Activity Indicator -

actually calling web service in apple watch extension not able show activity indicator.could please let me know how show activity indicator in watch kit. uiactivityindicator doesn't exist in watchkit. you'll need roll own solution.

Python ENV file overwritten by PHP ENV -

i'm working php , laravel framework, , use .env set environment variables. call python scripts php environment, , return result php. problem is, default os.environ set in python being overridden php's environment. my code (an example): <?php //setting laravel environment , loading in $_env variable exec('python script.py'); and python: print os.environ print os.environ return of environment variables set during php environment setup. of default environment variables, such path, either not set or overridden new env. it took me while diagnose problem. however, limited knowledge of python, how solve proving problematic. there way can reinitialize python environment without affecting php environment, , vice versa? need both processes separate 1 environment-wise, or need set python environment, update old values before returning php. if knows how go you'd lifesaver. the child processes inherit environment variables parent processes on star

dataframe - R data frame subsetting concepts -

i have data frame called data. have column called colb na values , column called colc integer values , no nas. when use subset syntax false results (all nas): nrow(data[data$colb == "xxxx",]) but when run same syntax using function no results, expect , want. data[which(data$colb== "xxxx"),] also, when run following: {data[data$colc == 185,]} i correct result/output 1 matching row. why this? having na in data? , subsetting column reference (instead of using subset function) without using not recommended? na a logical constant of length 1 contains missing value indicator. and e.g. which( c( na,na,na) ) returns 0 length integer vector none of comparisons can considered true , same if tried which( c(false,false,false) ) . therefore trying subset data.frame nothing, returning nothing. if need comparisons using data na values, use is.na() , function, e.g. consider: x <- c( na , is.na(na) , na ) which( x ) #[1] 2

sql server - SQL STDEV on a calculate column -

so have 2 columns want division on want stdev on resulting column trying following sql doesnt work havent been able figure out how save internal select variable , stdev on var. barking wrong tree? ideas? select stdev( select convert(decimal(20,5),convert(decimal(20,5),(s.received)) /convert(decimal(20,5),(s.sent)))*100 ddr sometable s s.somethingname = 'thisthingsname' , s.date '2015-04-16%' ) sometable select stdev( convert(decimal(20,5),convert(decimal(20,5),(s.received)) / convert(decimal(20,5),(s.sent)))*100 ) deviation sometable s s.somethingname = 'thisthingsname' , s.date '2015-04-16%' please note if version of sql server 2008 or higher, can and cast(s.date date) = '2015-04-16' and in sql server 2012 can and cast(s.date date) = datefromparts(2015,04,16) rather (non-exact!) string comparison on date field.

c# - Selecting object with collection of objects from many-to-many relationship -

i have 3 tables: athletes , teams , , team_athletes . team_athletes joins other 2 tables in many-to-many relationship. i'm doing querying database return object athlete , collection of teams. i'm doing following 2 queries: var query = (from in db.athletes join ta in db.team_athletes on a.id equals ta.athleteid join t in db.teams on ta.teamid equals t.id t.organizationid == organizationid orderby a.lastname, a.firstname select new { athlete = a, team = t }).toarray(); var result = in query group i.athlete g select new { athlete = g.first().athlete, teams = g.select(i => i.team).toarray() }; i'd know how combine queries if possible, can't come works. thoughts? why don't use: var query

php - Magento - Products not showing on "not visible individually" -

i've got website magento enterprise edition's 1.14.1.0. if set product's visibility "not visible individually" return 404 error when try access details page directly using url. any idea/suggestion appreciate. thank you. magento has functionality make items not visible individually can, example, take 6 products , turn 1 product customer can choose options. hide individual products, leaving 1 product visible on site , reducing duplicate content issues. so individual pages never appear on site. created allow magento pull inventory on items configurable product. i 404 (and if searched it, nothing come up) because far world outside of magento admin concerned, url doesn't exist.

r - ifelse statement with factor variable output -

i have dataframe df snp effect a1 a2 8 rs12145743 -0.0203 t g 31 rs4650994 -0.0210 g 26 rs2602836 0.0192 g 34 rs4976033 0.0215 g 10 rs12525163 -0.0215 t c 1 rs10282707 -0.0250 t c 33 rs4917014 -0.0222 t g 23 rs2293889 -0.0312 t g 32 rs4871137 -0.0209 t g 43 rs970548 -0.0258 c 27 rs2923084 0.0256 g 24 rs2303975 0.0279 g 36 rs499974 -0.0263 c 35 rs4983559 -0.0197 g 13 rs16942887 0.0831 g 16 rs17695224 -0.0290 g 18 rs181362 -0.0379 t c i creating new variable new_a1 different depending on value of effect . if effect >0, new_a1 should contain value of a1 . if effect <0, new_a1 should contain value of a2 . i trying using following ifelse statement: df$new_a1 <- ifelse(df$effect>0, df$a1, df$a2) however, output not expected. new_a1 contains 1s , 2s, instead of maintaining values of factors in original variables a1 , a2 snp e

ios - No visible @interface for primitive accessor -

i'm trying implement getter method simple transient property. transient property fullname property. typical example of fullname = firstname + lastname. i'm developing ios app (just in case related works differently on os x) following 'mastering core data' wwdc 2010 keynote i've created category person nsmanagedobject subclass. in category i've added following method: - (nsstring *)fullname { [self willaccessvalueforkey:@"fullname"]; nsstring *fullname = [self primitivefullname]; [self didaccessvalueforkey:@"fullname"]; if (fullname == nil) { fullname = [nsstring stringwithformat:@"%@ %@", self.firstname, self.lastname]; [self setprimitivefullname:fullname]; } return fullname;} person class has been created automatically xcode , has fullname property , implementation @dynamic. when try compile project error category saying "no visible @interface 'person' declares selector 'primitiv

sorting - Sort an array of IPs in VB script -

i'm looking sort list of ip addresses using vb script. i've looked solutions in plenty of places if happens duplicate, welcome being marked one. i'm new using vbs syntax easy understand working solution or guideline do. seems tricky enough accomplish due vb not having committed sort function (or sub), ips being easy misinterpret. havn't tried such yet. example: 123.123.123.123, 12.12.1.12, 23.34.56.11, 45.33.22.1, 1.3.5.55, to become 1.3.5.55, 12.12.1.12, 23.34.56.11, 45.33.22.1, 123.123.123.123 by changing test data to dim atests : atests = array( _ "123.123.123.123" _ , "12.12.1.12" _ , "23.34.56.11" _ , "45.33.22.1" _ , "1.3.5.55" _ ) and taking care of 4 elements in format: alvers.add ofmt.formatarray("{0,4}.{1,4}.{2,4}.{3,4}", aparts) the technique/code here produced output: 123.123.123.123 12.12.1.12 23.34.56.11 45.33.22.1 1.3.5.55 --------------- 1. 3. 5. 55 12

c# - WPF Binding Label Content to Property -

i have read several articles , can't quite seem label update when property changed. propertychanged event firing, , property updating new text label not updating. help! xaml <grid.resources> <c:userinformation x:key="mytaskdata"/> </grid.resources> <label name="lbltasknametitle" content="{binding path=proptaskname, updatesourcetrigger=propertychanged}"/> window userinformation t = new userinformation(); t.proptaskname = "updated task name"; this.datacontext = t.proptaskname; code behind class userinformation : inotifypropertychanged { private string strtaskname = "task name: "; public string proptaskname { { return this.strtaskname; } set { this.strtaskname = value; notifypropertychanged("proptaskname"); //call method set off propertychanged event.

MySQL very slow with 20 Million Records -

doing simple query select state, count(state) cnt big_data status=0 group state takes 20 seconds. here table def: create table `newtable` (`id` bigint(22) not null auto_increment , `city` varchar(32) character set latin1 collate latin1_swedish_ci not null , `state` varchar(2) character set latin1 collate latin1_swedish_ci not null , `miles_away` int(5) not null , `member_id` int(11) not null , `gender` varchar(17) character set latin1 collate latin1_swedish_ci not null , `profile` varchar(128) character set latin1 collate latin1_swedish_ci not null , `status` varchar(1) character set latin1 collate latin1_swedish_ci not null , primary key ( `id`, `city`,

ssl - secure Websocket client in ruby -

how can make secure (tls) websocket client connection using faye-websocket in ruby? i using faye/websocket gem in script. require 'faye/websocket' require 'eventmachine' em.run { ws = faye::websocket::client.new('wss://aws.com/gateway',:ssl => { :private_key_file => 'path/to/ssl.key', :cert_chain_file => 'path/to/ssl.crt' }, :headers => { 'authorization' => 'basic bxl1c2vyom15cgfzc3dvcmq='}) ws.on :open |event| p [:open] ws.send('hello, world!') end ws.on :message |event| p [:message, event.data] end ws.on :close |event| p [:close, event.code, event.reason] ws = nil end } you can use use iodine's websocket client if it's simple connection (you can add query parameters, cookies , headers request, if need them)... fair notice, author of iodine gem. it should simple: # l

Encryption (Rijndael Cipher) With C/C++ in Android NDK -

i want convert c#(managed) decryption method android ndk, c/c++ (no java) i see there crypto. on java side want keep away jni, , see there's mcrypt , crypt++ cant find compiled lib android. here example in c# want translate, c/c++ public byte[] decryptbytes(byte[] encryptedbytes) { rijndaelmanaged rijndaelcipher = new rijndaelmanaged(); rijndaelcipher.mode = ciphermode.cbc; icryptotransform decryptor = rijndaelcipher.createdecryptor(bytes32_key, bytes16_iv); memorystream memorystream = new memorystream(encryptedbytes); cryptostream cryptostream = new cryptostream(memorystream, decryptor, cryptostreammode.read); byte[] plainbytes = new byte[encryptedbytes.length]; int decryptedcount = cryptostream.read(plainbytes, 0, plainbytes.length); memorystream.close(); cryptostream.close(); return plainbytes; }; update best i've found f

fix - NoClassDefFoundError (org/logicalcobwebs/cglib/proxy/Callback) in QuickFIX/J application -

i writing java program quickfix/j (version 1.6.0). everything works fine long logged files.. now, wanted add jdbc logging: sessionsettings sessionsettings = null; try { sessionsettings = new sessionsettings(pathtofixconfigfile); logger.info("everything okay"); } catch (configerror e) { logger.error("error: ", e); throw (e); } messagestorefactory messagestorefactory = new jdbcstorefactory( sessionsettings); logfactory[] factorioes = { new filelogfactory(sessionsettings), new jdbclogfactory(sessionsettings) }; logfactory logfactory = new compositelogfactory(factorioes); messagefactory messagefactory = new defaultmessagefactory(); try { socketinitiator = new socketinitiator(xitaroapplication, messagestorefactory, sessionsettings, logfactory, messagefactory); } catch (configerror e) { logger.error("error: ", e); throw (e); } and following error: quickfix.configerror: error during session initializatio

Executing an Alter Table statement generated by dynamic sql to a Linked Server -

i have situation need add field table on linked server. specifications of dynamic , being done in tql / stored procedures , can not change. code generating statement fine , if copy paste new ssms window , execute works.. problem need dynamically generate statement (i doing fine, think). need execute statement in sproc, part not working. here code: set @altersql = @destinationservername + '.[' + @destinationdbname +'].' + @destinationschemaname + '.sp_executesql n'' alter table ' + @destinationtablename + ' add ' + @tempcolumn + ' int' + char(39) the above creates when expose via print statement: addb15.[fsparallel].dbo.sp_executesql n' alter table node add importidentity int' after create statement use: exec @altersql and returns following error: msg 2812, level 16, state 62, procedure etldynamicimport, line 244 not find stored procedure 'fsparallel.dbo.sp_executesql n' alter table node add impo