Posts

Showing posts from August, 2013

How to implement sending images in quickblox (Swift, iOS, xcode) -

i have app already, , implemented quickblox. far, have message sending. how can add sending images? to send message attachments should use same way send regular message text, add attachment object. var imagedata: nsdata = uiimagepngrepresentation(uiimage(named: "arrow.png")!)! qbrequest.tuploadfile(imagedata, filename: "arrow.png", contenttype: "image/png", ispublic: false, successblock: {(response: qbresponse!, uploadedblob: qbcblob!) in // create , configure message var message: qbchatmessage = qbchatmessage() var uploadedfileid: uint = uploadedblob.id var attachment: qbchatattachment = qbchatattachment() attachment.type = "image" attachment.id = string(uploadedfileid) message.attachments = [attachment] // send message }, statusblock: {(request: qbrequest?, status: qbrequeststatus?) in }, errorblock: {(response: qbresponse!) in nslog("error: %@", response.error) }) the...

meteor - lukemadera:autoform-googleplace -

i've installed lukemadera:autoform-googleplace package , followed usage instructions. when run application address field doesn't auto populate type. error in console (exception in template helper: referenceerror: ejson not defined) can please tell me i'm missing. path: layout.html <head> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places"></script> </head> path: schema.js schema.address = new simpleschema({ fulladdress: { type: string }, lat: { type: number, decimal: true }, lng: { type: number, decimal: true }, geometry: { type: object, blackbox: true }, placeid: { type: string }, street: { type: string, max: 100 }, city: { type: string, max: 50 }, state: { type: string, regex: /^a[lkszraep]|c[aot]|d[e...

javascript - Add buttons dynamically which also add textboxes dynamically AngularJS -

i have jsfiddle code : http://jsfiddle.net/rnnb32rm/285/ <div ng-app="angularjs-starter" ng-controller="mainctrl"> <fieldset data-ng-repeat="choice in choicesa"> <input type="text" ng-model="choice.name" name="" placeholder="enter name"> <button class="addfields" ng-click="addnewchoice()">add fields</button> <button class="remove" ng-click="removechoice()">-</button> </fieldset> <div id="choicesdisplay"> {{ choicesa }} <br/> {{ choicesb }} </div> </div> js : var app = angular.module('angularjs-starter', []); app.controller('mainctrl', function($scope) { $scope.choicesa = [{id: 'choice1'}, {id: 'choice2'}]; $scope.choicesb = []; $scope.addnewchoice = function() { var newitemno = $scope.choice...

How to get month name from number in mysql -

is there anyway month short name number of month in mysql ? example : if give 3, need mar. try this: select monthname(str_to_date(1, '%m'));//returns january also refer this

swift - Setting tokens in Spotify iOS app disables login callback -

i trying set login ios app using spotify's sdk. have login working, without tokens. once add these 2 lines of code: sptauth.defaultinstance().tokenswapurl = nsurl(string: ktokenswapurl) sptauth.defaultinstance().tokenrefreshurl = nsurl(string: ktokenrefreshserviceurl) the login not work. code login. appdelegate.swift let kclientid = "my-client-id" let kcallbackurl = "my-callback-url" let ktokenswapurl = "my-token-swap-url" let ktokenrefreshserviceurl = "my-token-refresh-url" func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. // override point customization after application launch. sptauth.defaultinstance().clientid = kclientid sptauth.defaultinstance().redirecturl = nsurl(string: kcallbackurl) sptauth.defaultinstance().requestedscopes = [sptauthstreamingscope, sptauthuserreadp...

regex - Regular expression to debatch MT940 message -

i got message below structure, message starts tag :20: , ends @ :86:. want write regular expression extract messages. write c# utility extract each message , put in arraylist. :20:160212-2359 :21:600******444 :28c:00001/00001 . . . :86:daily settlement /entry-13 mar :62f:d160212gbp1229387,45 :64:d160212gbp1229387,45 :65:d120314gbp1229387,45 :65:d120315gbp1229387,45 :65:d120316gbp1229387,45 :65:d120317gbp1229387,45 :65:d120318gbp1229387,45 :86:forward available funds show items known not yet posted more comments in 86_2 segment line2 :20:160212-2359 :21:b***22 :25:60*****88 . . . :86:/entry-13 mar trf/ref 6*******64 /ord/ line here *********************** /bnf/ jo 88 :62f:c160212eur13868931,00 :64:c160212eur13868931,00 :65:c120314eur13868931,00 :65:c120315eur13791849,00 :65:c120316eur13791849,00 :65:c120317eur13791849,00 :65:c120318eur13791849,00 :86:forward available funds show items known not yet posted more comments in 86_2 segment. :20:160212-2359 :21:b****x :25:6***********...

linker - C++ Builder XE unresolved external error -

i have following header file containing class , variables extern bool akwizycja_w_toku; extern lpctstr pfilename; extern int numer_akwizycji; class akwizycja : public tthread { public: __fastcall akwizycja(bool createsuspended); void __fastcall akwizycja::updatelabels(); akwizycja::akwizycja() {} }; (just sample, there more doesn't matter) furthermore i've got main project #include "akwizycja.h" void __fastcall akwizycja::updatelabels() { form1->label12->caption=floattostrf(drate,fffixed,8,4); form1->label13->caption=floattostrf(actualrate,fffixed,8,3); form1->label14->caption=floattostrf(effectiverate,fffixed,8,3); form1->label15->caption=pow(2,clock_divider); } where arguments drate or fffixed of extern variables. problem starts when want use of functions void __fastcall tform1::button3click(tobject *sender) { akwizycja* new_object = new akwizycja; } i [ilink32 error] error: unresolved external...

python - TypeError: 'str' object does not support item assignment with PyMongo (MongoDB API) -

i'm trying follow mongodb - quick guide , i'm getting following error: alexus@mbp:~ $ python python 2.7.10 (default, oct 23 2015, 18:05:06) [gcc 4.2.1 compatible apple llvm 7.0.0 (clang-700.0.59.5)] on darwin type "help", "copyright", "credits" or "license" more information. >>> import json >>> pymongo import mongoclient >>> client = mongoclient('mongodb://192.168.99.100:32768/') >>> db = client['test'] >>> collection = db['c'] >>> >>> obj = 'adc83b19e793491b1c6ea0fd8b46cd9f32e592fc:{tag1:value1}' >>> print obj adc83b19e793491b1c6ea0fd8b46cd9f32e592fc:{tag1:value1} >>> json.dumps(obj, separators=(',', ':'), sort_keys=true) '"adc83b19e793491b1c6ea0fd8b46cd9f32e592fc:{tag1:value1}"' >>> db.c.insert(json.dumps(obj, separators=(',', ':'), sort_keys=true)) traceback...

javascript - Web Game has many errors: does this matter? -

recently finished (or finished) coding core concept of web game i'm still working on. however, when run code in chrome (the game meant webkit browsers only), lot of errors. but, not affect code trying achieve. code written in javascript/html/css. to more detail, code part of "battle" sequence , looped each turn. each loop produces hundreds of errors (i assume can produce 1000's each loop), each successive loop producing more errors previous one. depending on number of turns battle takes, page may spitting out thousands , thousands of errors each loop... not good. errors literally "cannot set property "classname" of undefined" (my code uses bunch of these change animations of sprites i'm using). thing though, mentioned above, these errors not seem affecting overall battle itself, ie battle can progress smoothly. so question this: enormous amount of errors pose kind of problem, example browser or web page performance? plan transfer game ...

Passing parameters to JMeter -

Image
i can pass parameters through jmeter long embed them in path so: when try add them using gui, doesn't work: have tried combinations of encode/unecode, adding "?" path, result same - server replies required parameter missing. ideas? this post request pass name value body data (click on body data tab) in json format { "taskid": "9000" } or { "taskid": 9000 } if type of 9000 string choose 1st option other wise 2nd, better try both options check 1 working other approach: try change method get same parameters passed in snapshot2 (attached you) might possible request not supports get method in situation have post passing in path field (as shown in snapshot 1) or in body data tab

I want to pass array in ajax call -

here code var itemdetail = []; itemdetail[362] = {'qty':2} $.ajax({ method: 'get', url: url, data: {update_cart_action:'update_qty',cart:itemdetail}, success: function(msg){ } }); i want pass array this array( [362]=>array( ['qty']=>2 ) ) array pass not passing correct way in console shows this update_cart_action:update_qty cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: cart[]: .......... cart[362][qty]:2 but want pass this update_cart_action:update_qty cart[362][qty]:2 how can this? possible in method pass array? edit i trying solution var itemdetail[id] = {}; than give me error uncaught syntaxerror: unexpected token [ another without using var itemdetail[id] = {}; than give me error itemdetail undefined another try var itemdetail = []; itemdetail[id] = {}; than give me type of array cart[]: cart[]: cart[]: ...

How to make a DEM in QGIS using spot heights and contors -

i have 2 shapefiles. 1 contors of area , other spot heights. both of them has altitude attribute. in arcgis there tool called topo raster can use both these features create dem. in qgis have found tools can use one. any ideas? there interpolation tool know of create dem. depending on resolution you're after, buffer spot heights, merge shape files , run interpolation tool on that. using graphical modeler prevent buffer layer being created making process little tidier (and i'm sure there's better way using python console). hope helps.

rails 4.2 link_to method: No route matches [POST] -

i'm trying construct link_to method: :delete call destroy method in users controller: <%= link_to 'disable token', user_path(user), method: :delete, data: { confirm: 'are sure?'} %> which generates html looks like: <a data-confirm="are sure?" rel="nofollow" data-method="delete" href="/users/6">disable token</a> my application.js file has: //= require jquery //= require jquery_ujs and, in fact, know javascript loaded , doing supposed to, because generates 'are sure?` alert dialog. however, when following link following: no route matches [post] "/users/9" and indeed there no such route, because routes are: users_path /users(.:format) users#index user_path delete /users/:id(.:format) users#destroy the mystery (to me) wh...

c - How do I print command line arguments vertically? -

i know how print them backwards, forwards, etc. however, having trouble printing off command line vertically. can explain? #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { int j; int = 0; (i = 1; < argc; i++) { char *tmp = argv[i]; int len = strlen(argv[i]); for(j = len-1; j > -1; --j) printf("%c",tmp[j]); printf("\n"); } return 0; } this have printing command line backwards, how make print vertically? i guess want have like a a r r r r g g g g 1 2 3 4 so idea on first line print first char of each arg, on second line next char, until end int main(int argc, char *argv[]) { int j; int = 0; int argslength[argc]; int maxlength = 0; // lengths or args (i = 0; < argc - 1; i++) { argslength[i] = strlen(argv[i+1]); if(argslength[i]>maxlength) {maxlength = argslengt...

Is there a global database of all products with EAN 13 barcodes which i can integrate with my wordpress site? -

ean 13 international system. there api or database contains items have these barcodes? food, goods can buy in regular convenience store. there global open database integrate database , use adding barcode , info related product autopopulated? look here: https://www.outpan.com it crowd sourcing project , there api, can query ean code , outputs detailed information.

javascript - Angular JS Page not loading while using session and local storage in chrome -

i new angular js , following tutorial http://embed.plnkr.co/dd8nk9pdfotcqu4yrndg/ creating simple spa page. in which, when use local , session storage concepts in page ,it working in firefox,ie except chrome. not able find problem in chrome. please need help. index.html <html ng-app="scotchapp"> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mtjoasx8j1au+a5wdvnpi2lkffwweaa8hdddjzlplegxhjvme1fgjwpgmkzs7" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-flw2n01lmqjakbkx3l/m9eahuwpsfenvv63j5ezn3uzzapt0u7eysxmjqv+0en5r" crossorigin="anonymous"> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> ...

javascript - Bootstrap Modal only shows top border -

i have webpage multiple modals. issue, opening 1 modal, user entering data, query being ran, , displays shown in grid (this modal closed). each row returned there select button open new modal populated data row. issue second modal not displaying. there thin bar looks border of modal, , background fade modal displaying. also, if click select button before running query, modal works fine. <!-- modal --> <div id="service-code-details" class="modal hide fade" role="dialog" aria-hidden="true" > <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h2 id="mymodallabel">service code details</h2> </div> <div class="modal-body"> <div class="modal-body"> <p>some content</p> <input type=...

c# - Inner join in LINQ? -

this question has answer here: what syntax inner join in linq sql? 15 answers how convert below inner join sql statement linq statement select ca.[cus_address_id] ,ca.master_customer_id ,ca.[address_1] ,[city] ,[state] ,country_code ,cad.address_type_code ,cad.address_status_code inner join [cus_address_detail] cad on ca.cus_address_id = cad.cus_address_id , cad.priority_seq = 0 ca.customer_id = '0000026' and assign public class location { public string customernumber { get; set; } public string city { get; set; } public string state { get; set; } public string country { get; set; } public string addressloccode { get; set; } public string addressstatus { get; set; } } the query wind looking (keep in mind, though, you'll have change field names match since little mangled): va...

php - Is this someone trying to get inside? -

i using kohana framework. framework has error debugger (the red errors) , have set send these errors mail, when customer sees this. today have experienced weird actions, , of parameters price, description , else is: !s!wcrtestinput000002<><>%3c%3e!e! ' , '7'='7 i using kohana query builder queries. am safe? type of hacking, normal sql injection? how prevent? yes, testing if application vulnerable sql injection. news: passed test. long use kohana query builder build queries, you're safe.

php - Return each Array Value into Variable -

i'd recover values array this: $var = array($jogo1_t1, $jogo1_t2, $jogo2_t1, $jogo2_t2, $jogo3_t1, $jogo3_t2); how export each value different variable? for example: $var1 = first array value $var2 = second array value $var3 = third array value either use list() : list($var1, $var2, $var3, $var4, $var5, $var6) = $var; or use array keys: $var1 = $var[0]; $var2 = $var[1]; $var3 = $var[2]; $var4 = $var[3]; $var5 = $var[4]; $var6 = $var[5]; or if must, use dynamic variable names (this work if $var size without having rewrite code): for ($i = 0; $i < count($var); $i++) { $variablename = 'var' . ($i + 1); $$variablename = $var[$i]; }

php - Creating a safe dev environment -

we small team developing wordpress site. till have been editing same files online, inevitably led mistakes. thought use git / github stop stepping on each others tows , manage source code efficiently. can not run site locally on xampp getting numerous php errors. recommend in case? maybe creating folder on server identical content testing? possible run git on server? i operate in team of devs , do. locally each set our own wordpress install under seperate vhost , locally modified dns. plain jane wordpress running perfectly. create dev testing site on live server on internet (often prefix real url dev-www.mysite.com) create git repository, , have auto push-deploy dev testing site (we create folder structure in git wp-content down, , have custom themes/plugins) configure git manually push changes production server (for going live) on systems install wp-migrate-db-pro plugin. locally devs pull shared dev site local (which means planning what/when/where create content)....

c# - Application_End fires after Application_Start in global.asax when restarting -

we've noticed application_end old app domain can fire long after application_start new app domain when restarting website.. we've seen delays of 45 seconds plus.. i'm guessing asp.net prioritizes compilation , starting of new app domain before unloading old app domain..? i found this: http://msdn.microsoft.com/en-us/library/ms178473(v=vs.100).aspx but can't find info delay between old , new app domains.. can shed light on this..? is configurable..? i did not found configure delay, there option disallow new worker process start before old 1 exits. in iis manger go "application pool", select application pool application part of. select "advanced settings" in context menu. set option "disable overlapped recycle" "true".

Java socket communication -

i have problem program. explain use example: i have 2 programs, , b. controls b sockets, have client , b server. the client code: package clienttimer; import java.io.*; import java.net.*; import javax.swing.joptionpane; import java.net.*; import java.io.*; public class client { private string action; private string ip; public client(string action,string ip) { this.action=action; this.ip=ip; string servername = "server"; int port = 9999; try { socket client = new socket(ip, port); outputstream outtoserver = client.getoutputstream(); dataoutputstream out = new dataoutputstream(outtoserver); out.writeutf(action); inputstream infromserver = client.getinputstream(); datainputstream in =new datainputstream(infromserver); ...

jquery - How to keep track of multiple request data from the same user in PHP sessions? -

so question little complicated, let me explain. page code running this: user enters query in search field , clicks submit. 1.1 jquery loads new body display progress data. 1.2 jquery calls process.php via ajax , supplies query argument. 1.3 jquery starts setinterval periodic update grab progress data, stored inside $_session['prog'], , displays it. when process.php finishes, jquery stops periodic update, displays final information , calls ajax clear $_session['prog'] variable. at moment progress data stored inside 1 variable, fine far different users concerned (because of different sessions), if same user make multiple requests @ same time, $_session['prog'] variable cross-overwritten. so far have thought of 2 possiblities distinguish data each request same user (same session) have jquery generate random string , send query (and hope avoid colission, although unlikely) make 2 ajax calls, first 1 requesting new_request_id, second 1 sending ...

html - Fit image in DIV on Internet Explorer 8 -

i need show image fits in div tag. code works fine in chrome when visualize on internet explorer 8 cropped image. code .grid{ background:url('./images/grid.png'); background-repeat:no-repeat; width:730px; height:647px; background-size: contain; background-size: 100% 100%; } <div id="pointer_div" onclick="point_it(event)" class="grid"> ... </div> don't know if helps gotta use <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> the attribute background-size doesn't work in ie8. you should try add <img> tag inside div , use max-width: 100%; on <img> . http://caniuse.com/background-img-opts

doctrine2 - how to get the date from a datetime register in doctrine? -

im using codeigniter doctrine, bd: id fecha_publicacion 1 2013-03-23 14:52:06 2 2013-03-23 18:02:06 3 2013-03-23 00:00:00 .. ... what want do, search publications date or between range of dates the thing that, if want select fields date 2013-03-23 query returns 3erd field (which time 00:00:00) how can want? i've tried many things had no success public function postsbydates($tipo,$fecha1,$fecha2=''){ if($fecha2 == ''){ $fecha2 = $fecha1; } $this->qb = $this->em->createquerybuilder(); $this->qb->select('p') ->from('models\post', 'p') ->where( $this->qb->expr()->eq('p.tipo', '?1'), $this->qb->expr()->between('p.fecha_publicacion', '?2', '?3') ) ->setparameter(1, $tipo) ->setparameter(2, "$fecha1%") ->setparameter(3, "$fecha2%"); $query = $th...

javascript - h:outputscript source file not loaded in firefox -

i have facelet page consists of <h:outputscript name="xyz.js" target="head"/> in template.xhtml loads javascript data. strange thing function "xyz.js" file executed in ie , chrome , cannot executed in firefox. the firefox not able find/load javascript file. kindly help,

javascript - $.getJson() response limit -

i'm using $.getjson() function return array located in separate json file , store local array var. problem i'm having i'm getting 20 of total 25 items json. $.getjson have limit number of returned items? this how i'm using code: javascript: $.getjson('data/griddata1.json',function(json){ console.log("json length is: " + json.length); var grid = json; filtergrid(grid, ele); }); json: [ {"assignment":"tom" , "cell":["tom", "2013-10-06", "client 3", "activity", "scheduled" ]} ,{"assignment":"tom" , "cell":["tom", "2007-10-06", "client 2", "alert" , "work in progress" ]} ,{"assignment":"tom" , "cell":["tom", "2013-10-06", "client 3", "activity", "in pr...

Splitting json data in python -

i'm trying manipulate list of items in python im getting error "attributeerror: 'list' object has no attribute 'split'" understand list not understand .split don't know else do. below copy paste of relevant part of code. tourl = 'http://data.bitcoinity.org/chart_data' tovalues = {'timespan':'24h','resolution':'hour','currency':'usd','exchange':'all','mining_pool':'all','compare':'no','data_type':'price_volume','chart_type':'line_bar','smoothing':'linear','chart_types':'ccacdfcdaa'} todata = urllib.urlencode(tovalues) toreq = urllib2.request(tourl, todata) tores = urllib2.urlopen(toreq) tores2 = tores.read() tos = json.loads(tores2) tola = tos["data"] item in tola: ting = item.get("values") ting.split(',')[2] <-----error print(ting) ...

mysql - Sql query returning duplicate rows -

please find query below: select a.reco_index_content_code,a.reco_index_content_name, a.reco_index_user_action_download_file, case when b.refdata_profession_passion_code '%-%' 'passion' else 'profession' end passion_or_profession tbl_reco_index_contents inner join tbl_reference_databases b on a.reco_index_content_code = b.refdata_content_code a.reco_index_user_action_installed = 1 , a.user_profile_number = 1 the query returns rows repeated. if query not self explanatory, more obliged revert further details. any appreciated result of query aay_aayab_ftd00028 pga tour /mnt/sdcard/googlecheckout/pga tour.apk profession aab_aabae_ftd00071 pd central /mnt/sdcard/googlecheckout/parkinson's central.apk passion aab_aabae_ftd00071 pd central /mnt/sdcard/googlecheckout/parkinson's central.apk passion aab_aabae_ftd00072 com.diablo.psychiatry /mnt/sdcard/goo...

ruby on rails - The action 'create' could not be found for UsersController -

i doing chapter 7 of michael hartl's rails tutorial, , getting errors when trying sign user in development. have finished chapter through 7.3 of tests should passing now, i'm still receiving the action 'create' not found userscontroller in development. here users controller class userscontroller < applicationcontroller def show @user = user.find(params[:id]) end def new @user = user.new def create @user = user.new(user_params) if @user.save flash[:success] = "welcome sample app!" redirect_to @user else render 'new' end end def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation) end end end at point in tutorial should able sign user in online form without issue. here github repository https://github.com/ajhausdorf/sample_app your def new has not been closed. this code shoul...

java - (ORMLite - android) Setting foreign key fields directly -

in android app, pull down record server , save them db - i'd able save "message" records without having first save "thread" records attached to. a message composed of: string id string body long sent_ts string sender_id string topic_id is possible set topic_id , sender_id records directly on message object rather creating dummy topic instance , user instance? know can either not mark fields foreign , give on easier lookups of related objects or save nested objects first, possible directly set foreign key references in case keys externally provided? this being done on android standard android sqlite setup. edit i settled on writing multiple models on same database table. it's not elegant solution, seemed way able either populate foreign id fields directly or join on other tables, depending on context. i'd able save "message" records without having first save "thread" records attached to. so each mes...

How to assign zero values to multiple columns in a data.frame in r within a loop -

i have loop splits dataset (fulldataset) training (olddata) , holdout (newdata)dataset. model (auto.arima (xtreg)regressors) estimated on 24 pieces indexed i. holdout dataset (newdata) used make predictions using fit model built on olddata. newdata2 exact same newdata, except want 3 of predictors in columns 18:20 take on 0 values. when run loop, no errors, newdata2's variables in column's 18 thru 20 have same original values, , predictions same using both newdata , newdata2. when specify variables name assign vector of zeros first specified variable. olddata<-fulldataset[[i]][1:525,] newdata<-fulldataset[[i]][526:547,] newdata2<-transform(fulldataset[[i]][526:547,],fulldataset[[i]][526:547,18:20]<-0 ) my question is: how transform dataframe can assign 0 values more 1 column in dataframe? also, remember code running in loop. used plyr , apply functions needs loop executes faster. 1) don't use <- inside argument function. use = instead. 2)...

haskell - Enforced pattern order -

i'm writing magic gathering (mtg) game engine in haskell. for unfamiliar mtg, it's card game cards can have 5 colors: white (w), blue (u), black (b), red (r), , green (g). {-# language viewpatterns #-} import data.set data color = w | u | b | r | g deriving (show, eq, ord) data card = card (set color) -- simplified card type colors viewcolors :: card -> [color] viewcolors (card colors) = tolist colors what pattern match on colors so: foo :: card -> string foo (viewcolors -> [w, b]) = "card white , black" foo _ = "whatever" so far, good. there 1 problem here: can type order of colors incorrectly in view pattern so: bar :: card -> string bar (viewcolors -> [b, w]) = "this never hit" bar _ = "whatever" of course, have written viewcolors in way directly resolves problem. or use guards, i'd rather not. here couple ways so viewcolors :: card -> (bool, bool, bool, bool, bool) viewcolors (card c...

wpf - How to use Interaction Trigger on button with MouseUp and MouseDown events in XAML? -

i have button needs execute 2 separate commands (one start , 1 stop it). after doing research system.windows.interactivity.dll seemed provide easy way accomplish this. doesn't work left mouse button (it work if use event mousedoubleclick or mouserightbuttondown , not mousedown , mouseup , or mouserightbuttondown )...it seems if button consumes event , interaction.trigger never sees it. provided snippet of xaml below, can around behavior? <button content="dostuff"> <i:interaction.triggers> <i:eventtrigger eventname="mousedown"> <i:invokecommandaction command="{binding startcommand}" /> </i:eventtrigger> <i:eventtrigger eventname="mouseup"> <i:invokecommandaction command="{binding stopcommand}" /> </i:eventtrigger> </i:interaction.triggers> </button> you can use previewmousedown , previewmouseup ...

python--rounding value of expression--unexpected EOF -

in last line i'm trying round output 1 decimal place when test unexpected eof error. please? count = 0 scoresum = 0 score = 0 while score != 999: score = float(input("enter test score or enter 999 finish: ")) if score > 0 , score < 100: scoresum += score count += 1 elif (score <0 or score > 100) , score != 999: print("this score invalid, enter 0-100") else: print ("your average is: ", round((scoresum / count), 2) the last line problem--you need closing parenthesis: print ("your average is: ", round((scoresum / count), 2)) # right here ^ actually, have line of code this: print("your average is: ", round(scoresum / count, 2)) there no need parenthesis.

ios - NIB Custom Class -

i have nib view in subclass submenu of class menu. view hooked via iboutlet menu class property of viewcontroller. nothing initialised in code. i expecting property contain subclass submenu subclass of menu having property instance of menu wouldn't issue. nib when inflated seems return new instance of super class. is expected behaviour ? have subclass view controller ?

maven - Execute script as part of mvn package -

my pom.xml contains <plugin> <artifactid>maven-war-plugin</artifactid> <version>2.3</version> <configuration> <warname>${project.artifactid}</warname> <outputdirectory>${wlp.install.dir}/usr/servers/liberty/apps</outputdirectory> <failonmissingwebxml>false</failonmissingwebxml> </configuration> </plugin> when run mvn package can see step running: [info] --- maven-war-plugin:2.3:war (default-war) @ frontend --- that's great. however, want run shell script before war file created. tried adding <plugin> <artifactid>maven-antrun-plugin</artifactid...

ruby - Rails response.should be_success is never true -

i following michael hartl's excellent tutorial on ruby on rails. i'm stuck trying understand way actiondispatch::response works. derives exercise 9 of chapter 9 (rails version 3.2.3). in particular we're asked make sure admin user unable user#destroy himself. have idea how that, since i'm trying follow tdd methodology, i'm first writing tests. this relevant snippet in test: describe "authorization" describe "as non-admin user" let(:admin) {factorygirl.create(:admin)} let(:non_admin) {factorygirl.create(:user)} before{valid_signin non_admin} describe "submitting delete request users#destroy action" before delete user_path(admin) #puts response.message puts response.succes? end specify{ response.should redirect_to(root_path) } specify{ response.should_not be_success } end end #e...

Going from clustered environment with named SQL instance to single VM server with the default instance but -

i want keep original named instance name. decade ago, contractor set our clustered environment (svr1 , svr2) , installed sql enterprise on failover capabilities, creating named instance - meldsql we need replace hardware , have created vm server sql server test environment. vm server (say 'newvmsvr') has default sql instance on called newvmsvr. problem is, in ensuing 10 years, whole host of hooks have been built using meldsql reference. changing task outside of possible project scope. what i'd turn off meldsql cluster (svr1 , 2) , rename newvmsvr meldsql. we've determined our ad has no record of value "meldsql". according to: http://social.msdn.microsoft.com/forums/sqlserver/en-us/c07ab906-dabf-4303-9737-d430d82c4f42/how-to-rename-instance-of-sql-server-2008-r2 renaming default instance appear pretty straight forward. what missing? i confused. meldsql virtual cluster name default sql instance? there named instance example compu...

amazon web services - AWS + SELinux, Permission denied while connecting upstream to jetty server from nginx using ssl -

i'm trying install standalone archiva server , running problem nginx ssl proxy. can hit proxy, 502 bad gateway error jetty server behind it. nginx returns this: connect() 127.0.0.1:8080 failed (13: permission denied) while connecting upstream. client: xxx.xx.xx.xxx, server: server.at.aws, request: "get /archiva http/1.1", upstream: "http://127.0.0.1:8080/archiva", host: "server.at.aws" this on aws instance. jetty server listening on port 127.0.0.1:8080. have confirmed can archiva server within instance itself. there special configuration jetty server needs make accept proxy connection? i forgot turns out important detail configuration. it's on fedora server running selinux. port 8080 out of context in nginx , being denied. type=avc msg=audit(1380053745.510:1730): avc: denied { name_connect } pid=12145 comm="nginx" dest=8080 scontext=system_u:system_r:**httpd_t**:s0 tcontext=system_u:object_r:**ht...

javascript - How to use draggable on overflow:scroll containers? -

i have item want drag container, after scroll first item stays down mouse while dragging , first container resets top. edit. updated jsfiddle html: <body> <div id=left> <div id=item>drag me!</div> </div> <div id=right></div> </body> css: #left{ position:absolute; top:0; bottom:0; left:0; right:50%; background-color:red; overflow-y:scroll; } #right{ position:absolute; top:0; bottom:0; left:50%; right:0; background-color:green; } #item{ position:static; top:150px; height:50px; width:50px; background-color:black; color:white; } javascript: $("#left #item").draggable({ revert: true, stack:"#right", start: function() { $(this).parent().css('overflow-y', 'visible'); }, stop: function() { $(this).parent().css('overflow-y', 'scroll'); } //helper:"clone" }); $("#ri...

HBase : Cant create table, Who to blame: HMaster or Zookeeper? -

im getting "mixed messages" in errors when creating table in simple hbase 2 node cluster. 1) hmaster running: 21519 manager 14748 hmaster 25110 jps 9887 quorumpeermain 15473 hregionserver 14062 servicemain 5702 bootstrap 2) when try create table: create 't1','f1' i master initializing exception. 3) however, oddly, when run in -d mode, logs seem report security, rather " master initializing " errors. my question: security error ? zookeeper error? or error on hmaster? , why that, debug mode, logs referring zookeeper security, whereas normal mode, exception stack trace points hmaster initialization failure? slf4j: class path contains multiple slf4j bindings. slf4j: found binding in [jar:file:/usr/lib/hbase/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/usr/lib/zookeeper/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: see h...