Posts

Showing posts from March, 2012

node.js - Generic JavaScript Models using Composition -

i working on node.js application couple of javascript model this: function role(data) { this.data = data; ... } role.prototype.save = function(...) {...} role.findbyid = function(...) {...} role.findall = function(...) {...} all of them using same (similar) logic of functions, need different implementation saving , on. idea refactor them using kind of composition. current solution combination of using inheritance prototype functions , adapter static functions. looks this. var _adapter = new databaseadapter(schema, table, role); function role(data) { model.call(this, _adapter, role._attributes) this.data = data; ... } role._attributes = { name: '' } role.prototype.save = function(...) {...} role.findbyid = function(...) { _adapter.findbyid(...); } role.findall = function(...) { _adapter.findall(...) } but, not happy current solution, because developers need know lot of implementation details create new model. so, hope show me better approach so...

php - sending values from controller to views -

how can achieve this, sending data view controller form in view, need pick data on table in database , sending controller view, here controller: public function new_orders(){ //data views form in views $category_id=$this->uri->segment(3); $data['registration_number'] = $category_id; //data model view $this->data["product_id"]=$this->select->get_product_id(); $this->load->view("product_add", $data); } my model: function get_product_id(){ $this->db->select_max('product_id'); $this->db->from('products'); $query = $this->db->get(); return $query->result_array(); } i want form in view display registration_number @ same time product_id. in view registration_number displayed not product_id, seems undefined variable. me please solve it update code below, use $this->data instead of $data $this->load->view("product_add", $this->data...

Add one more element to multi dimensional array in java -

a method returning 2-dimensional array in java. want add 1 more element it. not sure of syntax of how copy new 2-d array& add 1 more element. have idea? string arr[][]=gettwodarray(); now want add 1 more row it. this string newarr[][] = new string[arr.length+1][]; arr[length+1][0]= {"car"}; any idea? you can't resize arrays: size fixed @ creation time. you can create new array , copy contents in; can conveniently using arrays.copyof (*): string newarr[][] = arrays.copyof(arr, arr.length + 1); // note newarr[arr.length] null. newarr[arr.length] = new string[] { "car" }; however, pointed out @kevinesche in comment on question, might find arraylist (or maybe other kind of list ) more convenient use: although backed array, , needs resize array occasionally, hides details you. (*) gotcha here arrays.copyof performs shallow copy of arr , changes elements of arr[i] reflected in elements of newarr[i] (for 0 <= < arr.length ...

Easiest way to deploy docker application -

my application uses multiple technologies redis, couchdb, nodejs, ... of them take docker hub (e.g. redis) , others (e.g. nodejs app) hosted in docker repo on own server. easiest way deploy full application remote system? great if use 1 docker-compose.yml , run docker-compsoe -d , think won't work, because use images own docker repo. first have pull these images via docker pull on remote system or possible tell .yml-file pull repo? or there other solution? don't worry private registry. docker-compose can pull images private repository automatically. you need authenticate before on private resgistry before pulling. type $docker login <private_repository> before $docker-compose up note! there need give right names own images. need tag image your_registry_host docker tag [options] image[:tag] [registryhost/][username/]name[:tag] and after can push image own registry. docker-compose need specify full image name hostname image: my_registry/image_nam...

php - Can't use two ore more filters with Elasticsearch -

i'm using elasticsearch in project. elasticsearch query that: array( [index] => galaxy [type] => galaxy [size] => 1000 [from] => 0 [body] => array( [query] => array( [filtered] => array( [query] => array( [query_string] => array( [default_operator] => , [query] => vestel* ) ) [filter] => array( [bool] => array( [must] => array( [term] => array( [fk_product_category] => 1 [fk_product_group] => 1 ) ) ) ) ) ) ) ) when remove 1 of filters terms example fk_product_group works when use both filters fatal error co...

c++ - std::cout with multi changing variables -

assuming code int main(){ int i=0, j=0; cout << << " " << f1(&i,&j) << " " << j << endl; cout << << " " << j << endl; } int f1(int *i, int *j){ *i = 20; *j = 30; return 10; } the result is 20 10 0 20 30 i puzzled why j 0 while correctly shows 20 edit: have read on sequence point still unsure of how explain this. should assume j evaluated first before f1 evaluated hence j 0 , 20? here thing: cout << << " " << f1(&i,&j) << " " << j << endl; if consider right left evaluation, j 0 , printed. then, f1 called , j value changed 30 . order of evaluation unpredictable

I couldn't get the current userid using get_currentuserinfo() in Wordpress -

i new in wordpress, created wordpress api using wp rest api . created custom route in api in callback didn't current user id , user details using function get_currentuserinfo() in wordpress 4.5 function get_currentuserinfo() has been deprecated replace get_currentuserinfo() with wp_get_current_user(); deprecated info found here : https://developer.wordpress.org/reference/functions/get_currentuserinfo/ have try this. current user information .

ios - Xcode image slicing - stretch the outsides of the image but preserve an area in the centre -

Image
i want use image slicing in xcode produce resizable image central area held static. seems impossible in xcode allows 1 stretched area , 1 shrunk area in each direction. correct? does know of nice workaround this? need use image button can't arrangement of uiimageviews on top of each other unless pass touches through , gets bit messy. many thanks. as stretchableimagewithleftcapwidth deprecated ios 5.0, can use resizableimagewithcapinsets . check apple documentation , states, you use method add cap insets image or change existing cap insets of image. in both cases, new image , original image remains untouched. example, can use method create background image button borders , corners: when button resized, corners of image remain unchanged, borders , center of image expand cover new size. another method available, resizableimage(withcapinsets:resizingmode:) if want set resizingmode you can like, uiimage *image = [uiimage imagenamed:@"yourimagena...

android - Recyclerview inside linearlayout scrolling smoothly -

i working on screen has 1 tool bar information of product , list of similar products. <relativelayout> <toolbar /> <scrollbar> <linearlayout> <productinfo /> <textview > <!--similar products --> <recyclerview /> </linearlayout> </scrollbar> everything working fine except scroll. scroll not smooth when recyclerview comes on screen. think idea should have recycler view without own scrollbar. because seems i'm ending 2 scrollbars making scrolling painful. there way through can disable scrollbar of recyclerview , stretch to occupy required height , parent scrollbar scroll screen smoothly? i'm using staggeredgridlayoutmanager can use both productinfo view , similar products card in single recyclerview, productinfo need complete width of screen similar product need 2 column. please code: > <android.support.v7.widget.toolbar android:id="@+id/toolbar" ...

winapi - Can I improve upon window redraw and if so how can I? -

Image
some years ago (2008) wrote online child support calculator using php/javascript/ajax/css advanced child support calculator - may explain replicating . some time after (2009 think) started writing equivalent windows , revisiting this. fundamentals of version working. however, have issue window noticeably flickering/changing when controls dynamically added , window redrawn/rebuilt. note! calculator specific australia. in short i'm looking way, if possible, refresh/re-display/redraw window after components have been added. basically, windows controls need dynamically added/removed depending upon scenario (number of adults , children involved). adding or removing child or adult or performing calculation, results in complete rebuild of window. is, existing controls destroyed , valid controls added (this perhaps minimised via complex logic). the issue controls removed briefly reappear (in ordered fashion) causing display flicker (for want of better description). ...

html - How to stop unordered list from moving to the next line -

i have css progress tracker @ top of shopping cart. it's div unordered list inside. see live view here: http://wordpress-15765-54444-143522.cloudwaysapps.com/shopping-cart/ the space between each step of progress tracker shrinks down screen size. once screen hits 768px tracker breaks onto next line, though there still room between each step shrink down further. i want whole tracker (all items) break down onto next line eventually, how can stop happening soon? need each step shrink further before happens. see live screencast here explaining problem: http://screencast.com/t/nngdgupeyevc i've tried changing media queries, min/max widths, , different display values, nothing works. had bit of @ css behind progress bar , think may have spotted issue. shrunk screen down around 767px under 768px mentioned. progress tracker fine when it's still being viewed @ 768px once goes below when drops down. the reason because 1 of media queries sets containing div of ...

Custom Post Type Woocommerce -

i have read dozens of posts spanning several years. can not find step-by-step explanation how-best create custom post types, custom taxonomies, custom post fields, , hook utilize woocommerce single-product template display? there price no actual checkout or buy because using catalog plugin. any guidance appreciated.

python - Psycopg2 execute tuple index out of range -

i new python , first programming language. first shot @ using sql psycopg2. "dumb" advice appreciated! i not sure problem is. research tells me im feeding few or many arguments cursor.execute(insert... have tried number of different counts , can't seem working correctly. point of view cursor.execute(create... creates table 6 columns , passing 6 args it. from lxml import html # used parse xml import requests #used service api request itemtypeid1 = 34 itemtypeid2 = 35 regionid = 10000002 webpage = requests.get('http://api.eve-central.com/api/marketstat?typeid=%i&typeid=%i&regionlimit=%i' % ( itemtypeid1, itemtypeid2, regionid)) if webpage.status_code == 200: data = html.fromstring(webpage.content) item in data.iter('type'): buy_dict = {node.tag: node.text node in item.xpath("buy/*")} sell_dict = {node.tag: node.text node in item.xpath("sell/*")} #variables output itemid = (i...

multithreading - Allow only one Thread to access a particular file in Java -

i have folder large number of files in it. there 1 cron job takes 10 file names @ time e.g. file1, file2....., file10 , creates 10 new threads read files. content of files extracted , dumped in process(irrelevant) , file deleted now problem if 1 of threads takes more minute process file, cron job triggers again , picks same file again not deleted yet , processes content again. is there way restrict thread reading file/creating file object if there thread reading content it. i can have synchronized hash map store details of 10 files 10 threads processing , check map before assign file thread finding difficult believe there no better way in java. obviously need "sync point" between different threads; that, there plenty of options. when threads running in same jvm, use class like class currentlyprocessedfilestracker { synchronized void markfileforprocessing(file f) { } synchronized void markfileasdone(file f) { or alike (where first 1 throw exception...

android - Using more than one JSON file on Firebase -

i planning use real time data on 1 android activity , set of data on activity. plan implement using 2 different json files seems not possible on firebase. there way can achieve single json file? you have 2 children inside firebase json, each containing data of 2 json files. { "json1":{ //stuff }, "json2":{ //stuff2 } }

java - Downloading JMeter Official Distribution as part of maven dependency (Not using maven plugi-in) -

integrating jmeter part of maven project extending above question, possible below steps through maven dependency itself, ideally don't want rely on local installation of jmeter running test , don't want use jmeter maven plug-in since cannot specify jmeter version want use run jmeter script. the answer mentioned use antrunner not sure how through maven pointer helpful my scenario to, download , unzip jmeter official distribution maven dependency copy target folder jmeterutils.setjmeterhome("copied-target-folder/bin") jmeter.run(); you can use antrunner , following ant tasks: get unzip example: <get src="url of jmeter" dest="${build.dir}/${zip}" usetimestamp="true" ignoreerrors="false"/> <unzip dest="${build.dir}" src="${build.dir}/${zip}">

hibernate - Stemming Search Using SnowballPorterFilterFactory Seems to Return Less Results -

i have 4 documents containing following 4 texts respectively. xxx xxx xxx xxx xxx did xxx xxx doing xxx now perform search text " do " using snowballporterfilterfactory filter, , expect search above 4 documents out. following documents searched out. xxx xxx xxx doing xxx but when try search text " refactor ", documents containing texts " refactor ", " refactors ", " refactored " or " refactoring " searched out. why search text " do " cannot return documents containing " does " , " did "? word " do " special , shouldn't using snowballporterfilterfactory filter? thanks. i'm not surprised: forms of declared stop words in stop words list provided snowballfilter in lucene didn't care case. so it's more or less consistent intents. you can either: * use stopfilterfactory provided english_stop.txt (read comment @ top of file format use); not...

How to properly pass form content with special characters to SQL Server nvarchar field from PHP/Linux app? -

i have web application on ubuntu/php7/nginx stack data reporting purposes passes data sql server 2008 database. i'm using php7.0-sybase pdo package connect mssql. use prepared statement call stored procedure insert data. fields on sql server side nvarchar fields of various lengths. issue: form content web application special characters (newlines, accented letters, etc) shows garbled (chinese-esque) characters once inserted database. suspect encoding issue, haven't been able pinpoint issue i'm not knowledgeable in area. if test doing insert directly on sql server using t-sql, text special characters shows correctly. if dump encoding of text before send web app, tells me ascii, should compatible utf-8, correct? i've tried explicitly converting utf-8 before sending. is there need set in configuration of db driver? or maybe driver doesn't know how handle data? as note, we've experimented sending type of data varchar field, , text appears correctly, issu...

microsoft dynamics - How to view corresponding SQL Server tables From NAV -

i have extract data microsoft dynamics nav , save csv files. , trying creating ssis package. is there way can find corresponding sql table nav table? i remember 1 of developers using tool called 'zoom' view tables. have access zoom not sure how find underlying sql table. tables on sql server named same in nav plus 2 things: not allowed characters replaced underscore. "g/l entry" become "g_l entry" if table exist each company company name dollar sign separator added before table name. "cronus$g_l entry".

haskell - Emacs shell/term - unlock cursor from madly scrolling output -

i temporarily decouple cursor terminal output in emacs. in eclipse console there's button this, can page , see previous output without latest line of output grabbing cursor back. does emacs allow this? there variable or command? update: i'm using plugins run ghci (haskell) repl in terminal window. guess assumed have built repl on top of terminal or eshell in out-of-box emacs. term-line-mode command @jack pointed out reason not available in ghci repl. guess became haskell-specific question... you want term-line-mode . default should c-c c-j , can toggle on , off.

ios - Trying to print a description of an Error (AKA ErrorType) enum -

i using enum inherits error (or errortype in swift 2) , trying use in such way can catch error , use print(error.description) print description of error. this error enum looks like: enum updateerror: error { case noresults case updateinprogress case nosubredditsenabled case setwallpapererror var description: string { switch self { case .noresults: return "no results found current size & aspect ratio constraints." case .updateinprogress: return "a wallpaper update in progress." case .nosubredditsenabled: return "no subreddits enabled." case .setwallpapererror: return "there error setting wallpaper." } } // 1 of many nested enums enum jsondownloaderror: error { case timedout case offline case unknown var description: string { switch self { case .time...

javascript - Valid SSL certificate for Firefox? -

i need here. i'm not ssl. connect through xhr http-site http-site works fine via cors. but need via https->https. enabled "freessl" option hoster provider. think somehow certified symantec oder geotrust have doubt it. opening rest-resource directly via firefox, fine , certificate trusted, since request. an ajax-get-request rest-resource works fine. but ajax-post-request fails. could please check whether certificate of following site should fine using in ajax-requests in firefox?? https://tempapi.kanubox.de/kanubox/v1/activities that me lot. thank you! certificate validation not depend if request or post , apart certificate valid. but if these requests possible cross origin xhr depend on details of request , if there cors headers set server. details of request unknown , cors headers not set target url guess unrelated http vs. https instead cors issue. looking @ browser console (i.e. developer tools in browser) find out more problem is. ...

Xamarin Forms - Run a hidden WebView without attaching it to the view -

currently code creates instance of hidden class , initializes webview should download javascript server. problem if webview not part of main screen user looking at, doesn't load url. my simple app: public partial class app : application { // set hidden webview companysdk.fooclass foo = new companysdk.fooclass(); public app() { initializecomponent(); var page = new contentpage(); page = new demoapppage(); mainpage = page; } protected override void onstart() { // test method call foo.test(); } } hidden webview class: public class fooclass { webview browser = new webview(); public fooclass() { browser.source = "https://companyserver.com/xyz"; // make browser invisible browser.setvalue(isvisibleproperty, false); system.diagnostics.debug.writeline("webview started platform: " + device.os.tostring().tolower()); } pub...

vb.net - Does Emgu.CV.Capture.QueryFrame leak memory? -

config: windows 10, visual studio 2015, project windows forms, vb, emgucv's opencv wrappers. my project has reference emgu.cv.world my code pretty simple (vb): imports emgu.cv class form1 public gstop boolean async function dostuff() task dim cap new capture while gstop = false cap.queryframe() loop end function end class when run dostuff in debugger, memory consumed 2gb, then: exception thrown: 'emgu.cv.util.cvexception' in emgu.cv.world.dll graph of memory leak am right in thinking demonstrates memory leak? initial code did bit more captured video above code pared down try isolate leak. above code retrieve frame webcam , discard it, indefinitely. puzzles me because basic functionality emgu don't understand why hasn't been fixed , wonder if i've got wrong somewhere. haven't coded since vb6: used know onions less now.

ios - backBarbuttonitem does nothing? -

i have set navigation programmatically in view controller set backbutton , change title per documentation. clicking on button in child controller nothing. what did miss? > in viewcontroller let backitem = uibarbuttonitem() backitem.title = "" navigationitem.backbarbuttonitem = backitem self.navigationcontroller?.pushviewcontroller(secondviewcontroller, animated: true) you have add target , action button, let backitem = uibarbuttonitem() backitem.title = "" backitem.target = self backitem.action = #selector(back) navigationitem.backbarbuttonitem = backitem self.navigationcontroller?.pushviewcontroller(secondviewcontroller, animated: true) and implement back() function. func back() { // if view controller presented navigation controller self.navigationcontroller?.popviewcontrolleranimated(true) // if view controller presented modally self.presentingviewcontroller?.dismiss(animated: true, completion: nil) } ...

amazon web services - ElK stack AWS S3 log grok pattern -

can me creating grook pattern kind of log: 79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be mybucket [06/feb/2014:00:00:38 +0000] 192.0.2.3 79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be 3e57427f3example rest.get.versioning - "get /mybucket?versioning http/1.1" 200 - 113 - 7 - "-" "s3console/0.4" - 79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be mybucket [06/feb/2014:00:00:38 +0000] 192.0.2.3 79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be 891ce47d2example rest.get.logging_status - "get /mybucket?logging http/1.1" 200 - 242 - 11 - "-" "s3console/0.4" - 79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be mybucket [06/feb/2014:00:00:38 +0000] 192.0.2.3 79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be a1206f460example rest.get.bucketpolicy - "get /mybucket?policy http/1.1" 404 nosuchbucketpolicy 297 - 38 - "-...

regex - MySQL - How to concatenate columns that contain at least one alphabetic character -

i have mysql table 4 varchar columns, in cases these columns can contain number. have concatenate single string columns contain @ least 1 character , ignore columns containing numbers. example aa + 88 + po + a4          will result      aapoa4 a3a + ww + 11 + ewd     will result      a3awwewd so may @ problem concatenation of columns if not match ^\d+$ regular expression or empty string otherwise. may find more documentation on regexp , concat , case in mysql docs, below there code, may lead want achieve: select concat( case when regexp '^[[:digit:]]+$' '' else end, case when b regexp '^[[:digit:]]+$' '' else b end, case when c regexp '^[[:digit:]]+$' '' else c end, case when d regexp '^[[:digit:]]+$' '' else d end) result your_table; of course may use not regexp instead, me it's clearer way.

javascript - angular change view url parameters -

i'm trying navigate different view in angularjs app using url parameters. i've tried this <a href="" ng-click="gotodevice(treecurrentnode.uuid)">{{treecurrentnode.displayname}}</a> js: $location.path('/devices').search({resourceview: 'devicedetailsview'}) .search({explorerview: 'table'}).search({type: 'device'}).search({uuid: uuid}); and using $stateprovider <a ui-sref="devices({resourceview: 'devicegroupview', explorerview: 'table', type: 'device', uuid: treecurrentnode.uuid})">{{treecurrentnode.displayname}}</a> my state provider code looks this: .state('devices', { url: "/devices", params: { resourceview: null, explorerview: null, type: null, uuid: null }, templateurl: "app/main/devices/module/views/devices.html", controller: "devicesextendedctrl...

xml - SuiteTalk Set Customer as Tax Exempt in NetSuite -

i trying update customer in netsuite soap requests. able search customer correctly , returned, when try send taxable or taxexempt field such below: <taxexempt xmlns="urn:relationships_2014_1.lists.webservices.netsuite.com">true</taxexempt> <taxable xmlns="urn:relationships_2014_1.lists.webservices.netsuite.com">false</taxable> netsuite returns following error: <?xml version="1.0" encoding="utf-16"?> <writeresponse xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <status issuccess="false" xmlns="urn:core_2014_1.platform.webservices.netsuite.com"> <statusdetail> <code>insufficient_permission</code> <message>you not have permissions set value element taxexempt due 1 of following reasons: 1) field read-only; 2) associated feature disabled; 3) field available eith...

angularjs - Highcharts plotting line instead of area -

Image
i trying highcharts demo available in documentation highcharts-ng . i want plot area charts when run it, area doesn't appear line. following code sample. html: <highchart id="chart1" config="chartconfig"></highchart> angular controller $scope.chartconfig = { chart: { type: 'area', spacingbottom: 30 }, title: { text: 'fruit consumption *' }, subtitle: { text: '* jane\'s banana consumption unknown', floating: true, align: 'right', verticalalign: 'bottom', y: 15 }, legend: { layout: 'vertical', align: 'left', verticalalign: 'top', x: 150, y: 100, floating: true, borderwidth: 1, backgroundcolor: (highcharts.theme && highcharts.theme.legendbackgroundcolor) || '#ffffff' }, xaxis: { catego...

vb.net - How can I use the same code without having to retype it every time in different subs? -

so have textbox want allow numbers in, have code , works fine. want use in few textboxes, how can use same code without having retype in each textbox's keydown , keypress subs? the code i'm using in keydown subs is if e.keycode = keys.back backspace = true else backspace = false end if and in keypress subs i'm using if backspace = false dim allowedchars string = "0123456789" if allowedchars.indexof(e.keychar) = -1 e.handled = true end if end if i'm using code few textboxes , wondering how can clean bit. can i? thank , time! you make own version of textbox control inherits base textbox , extends custom code. for example: public class clevertextbox inherits textbox private backspace boolean = false private sub clevertextbox_keydown(sender object, e keyeventargs) handles me.keydown if e.keycode = keys.back backspace = true else ...

xpath - How to represent multiple values for a single node in XML? -

<?xml version="1.0" encoding="utf-8"?> <code_details> <summer_redeem_code>54</summer_redeem_code> <winter_redeem_code>38</winter_redeem_code> </code_details> in above code, think of summer_redeem_code , winter_redeem_code tags want store multiple values. imagine summer_redeem_code passed values such 54,56,57 first 1 i.e. 54 can displayed. also, winter_redeem_code passed values such 38,48,58 first 1 i.e. 38 can displayed. question: trying figure out best way represent multiple values single element/attribute/tag in xml can display more first 1 can now? currently these tags 1:1 relationship , want make them 1-many (if makes sense?). basically, looking method(tags) can accommodate values. constraints: 1) tags summer_redeem_code , winter_redeem_code cannot deleted break parser cannot modified. possible solution: require leaving them , introducing new 1-many item new tag - maybe "redeem...

php - Wordpress tax_query "and" operator not functioning as expected -

i have custom post type of image custom taxonomy called image_tag (it's hierarchical categories). here examples of tags might used: structure (id: 25) - house (id: 56) - skyscraper nature - animal - plant (id: 41) so, want drill down through images selecting multiple tags in conjunction "and" operator. example, finding photos plant s , house s. $query_args = array( 'post_type' => 'image', 'tax_query' => array( array( 'taxonomy' => 'image_tag', 'terms' => array(41, 56), // ids of "plant" , "house" 'operator' => 'and', ), ), ); that works fine, problem begins when try include parent terms, example: $query_args = array( 'post_type' => 'image', 'tax_query' => array( array( 'taxonomy' => 'image_tag', 'terms' => array(25, 41), // ids of "struct...

delphi - Error when using parameter in ADOQuery -

i have simple code check if record exists in table, returns runtime error : arguments of wrong type, out of acceptable range, or in conflict 1 another. my code : function tdatamodulemain.barcodeexists(barcode: string): boolean; begin if adoquerysql.active adoquerysql.close; adoquerysql.sql.clear; adoquerysql.sql.text := 'select count(1) card barcode = (:testbarcode)'; adoquerysql.parameters.parambyname('testbarcode').value := barcode; adoquerysql.open; // here runtime error appears result := adoquerysql.fields[0].asinteger = 1; adoquerysql.close; adoquerysql.parameters.clear; end; the field barcode in table card of type nvarchar(100) in debug see parameter created, , gets populated correct value. running query in sql server management studio works. i found how pass string parameters tadoquery? , checked code code in answer don't see problems here. adoquery error using parameters did not me. it no doubt simp...

twitter bootstrap - React app wrapped in Wordpress template leads to css problems -

i have created web app reactjs want make part of wordpress page. web app ist styled using react bootstrap. the idea was: use wordpress template renders div app loads into: wordpress template: <div id="app"> </div> styling app restricted div "app": #app { //bootstrap css + additional css used app } this way style of app doesn't interfere css of wordpress template , header / footer of page perfect. the problem: the css of wordpress theme conflict bootstrap css used in div "app". because of web app looks mess. is there (easy) way ignore css of wordpress template within app div?

algorithm - Viola Jones threshold value Haar features error value -

i have read viola paper 2004. in 3.1 explain threshold calculation. super confused. reads for each feature, examples sorted based on feature value question1) sorted list list of haar feature values calculated integral image of examples. if have feature , 10 images(positive , negative). 10 results associated each input image. the adaboost optimal threshold feature can computed in single pass on sorted list. each element in sorted list, 4 sums maintained , evaluated: total sum of positive example weights t +, total sum of negative example weights t −, sum of positive weights below current example s+ , sum of negative weights below current example s− question 2) purpose of sorting. guess 1 highest 1 describes image best. algorithmically how affect (s- s+ t+ t-). question3) sorted list calculate (s- s+ t+ t-). mean each entry holds own (s- s+ t- t+) or there 1 (s- s+ t- t+) whole list. the error threshold splits range between current , previous exa...

javascript - Getting 400 (Bad Request) making a "POST" using ajax to a rails web site -

i've benn trying make "post" using ajax, keep getting "400 (bad request)". don't know if it's rails website or ajax request. rails it's simple scaffold: # post /events # post /events.json def create @event = event.new(event_params) respond_to |format| if @event.save format.html { redirect_to @event, notice: 'event created.' } format.json { render :show, status: :created, location: @event } else format.html { render :new } format.json { render json: @event.errors, status: 409 } end end end def event_params params.require(:event).permit(:name, :consult, :description, :category, :likes) end and ajax i'm trying make work: $("button").click(function () { $.ajax({ url: 'http://localhost:3000/events', type: 'post', cache: true, processdata: false, contenttype: "application/json; charset=utf-8", ...

ios - Applying SKShader to multiple layers -

in game working on, use multiple layers manage background scenery so: background background obstacles foreground obstacles i using displacement shader create ripple effect, i'm not sure how apply entire background section. each layer individual sknode add different sksprites. i want ripple effect affect layers, can't apply shader sknode. you cannot apply 1 shader effect multiple layers, need capture state of other layers making siblings in parent node , capturing output of node, this: sktexture *capturetexture = [skview texturefromnode:node]; then assign texture 1 node , attach shader node. may not able full fps updates capture approach, may way working.

How to specify proxy credentials for lagom / activator / sbt? -

i trying out lagom lightbend, using my-first-system template gettingstarted page. i on windows 10, , behind corporate proxy. activator fails download dependencies due missing credentials proxy. have set http_proxy environment variable. the following error reported activator: [info] updating {file:/e:/projects/lagomhelloworld/my-first-system/project/}my-first-system-build... [info] resolving com.lightbend.lagom#lagom-sbt-plugin;1.0.0 ... [error] server access error: connection timed out: connect url=https://repo.typesafe.com/typesafe/ivy-releases/com.lightbend.lagom/lagom-sbt-plugin/scala_2.10/sbt_0.13/1.0.0/ivys/ivy.xml [error] server access error: connection timed out: connect url=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.lightbend.lagom/lagom-sbt-plugin/scala_2.10/sbt_0.13/1.0.0/ivys/ivy.xml [error] server access error: connection timed out: connect url=https://repo1.maven.org/maven2/com/lightbend/lagom/lagom-sbt-plugin_2.10_0.13/1.0.0/lagom-sbt-plugin-1...

c# - DataGridView form shows up empty after background worker finish -

Image
need ask i'm struggling long now. have gone on many tutorials can't figure out yet... in first stage of proyect developed console program makes requests web server, processes data , updates ms access db. problem arise after doing processing, need show result inside winform clients see it, , more process should going on , on again while app opened. so i've done far creating winform runs console program background worker , results should shown , updated program keeps running. simplicity, i'm replacing heavy processing loop fills in list of hashtables, returned winform displayed: namespace thenamespace { class aldeloupdater { [stathread] static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new guiform()); } public list<hashtable> oldmain() { list<hashtable> products = new l...

elasticsearch - Elasticserch 2.3.5 encrypting string values -

i built cluster elasticsearch 2.3.5, , have loaded data using elasticsearch-spark(elasticsearch-hadoop 2.3.4) connector. looks except strings encrypted below... "changeaudioodstreams": "ltgumw==", "enm": "qw50awrvdgu=", "pid": 33, "uid": 33, "upid": 33, "pnm": "vhjhdmlzifnjb3r0", "upnm": "vhjhdmlzifnjb3r0", "rd": "mjaxns0wny0zma==", "weekid": 201601 is there property disable this? setting below property in spark code fixed issue sqlcontext.setconf("spark.sql.parquet.binaryasstring", "true");

xcode - Proper way to codesign swift framework included with distribution app -

i have enterprise app using swift frameworks via podfile. i'm signing app bundle id com.whatever.myapp using enterprise distribution cert , provisioning profile. that's fine. but i'm getting errors when tries build swift frameworks since bundle id different - example org.cocoapods.alamofire. how should code signing swift frameworks? should still done enterprise distribution cert , provisioning profile? they automatically codesign app's target. recheck bundle identifier in app's target , rebuild it.

Rails 4 + HTML: Combine form responses to generate 1 string entry -

i have question on form 15 checkboxes. take items "checked" , combine labels string entered database. rather not make separate db entry every checkbox , selecting individuals on field not important, need record response. is there easy way combine these , make value entered db? the following displays right, i'm not sure how submit correct information. html <div class="form-inline"> <div class="form-group col-sm-12" style="margin-bottom: 10px"> <div class="field"> <div class="input check_boxes optional remote_issues"> <label style="display:block; padding-bottom: 1em" class="check_boxes optional">which of following pevent reaching desired weight?</label> <% boxes = ["lack of knowledge", "physical limitations", "lack of social support", "hunger", "cravin...

Redux: user action vs logic action -

let's have list , button. element of list can selected (only 1 @ time). if element selected, button changes a , if not, changes b . my question is, should have button fire action_button_clicked , reducer can figure out if it's supposed a or b based on it's current state ( iselementselected ) or should button decide action fire, action_a or action_b ? obs.: button have it's text button(a) or button(b) based on whether element selected or not.

c - Segmentation fault when trying to declare an array of strings -

in program, trying copy each argv[i] keyword[i], program fails segmentation fault. doing wrong? #include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> int main(int argc, string argv[]) { //prototype string keyword = ""; //int j; (int = 0, n = strlen(argv[1]); < n; i++) { keyword[i] = toupper(argv[1][i]); printf("%i-- printing letters\n", keyword[i]); } } as others have observed, initialize variable keyword either empty string or pointer empty string literal, depending on definition of type string . either way, valid evaluate keyword[i] i equal zero; other value -- read or write -- out of bounds. furthermore, in latter (pointer string literal) case, must not attempt modify array keyword points to. note in particular c not automatically expand strings if try access out of bounds element. instead, attempt produces "undefined behavior", , commo...

sql - MS Access 2010 throwing "Query Too Complex" error with larger record set -

i've having repeated sporadic issues access 2010 throwing "query complex" errors on queries aren't hugely complex, involve decent number of records (say more 5000). involves working linked sharepoint list. here's example (the table i'm inserting on sharepoint server, other tables local in access file on drive): insert [nr info] (title, [nr id], [project], [sub-project], [pd number], [wbs number], [network], [ia po activity], [fa po activity], [asp], [status], [ms10], [po status], [2g/3g hw cpo], [4g hw cpo], [4g sw cpo], [additional hw cpo], [antenna hw cpo], [2g/3g/4g hwac cpo], [swap prep cpo], [vod i&c cpo], [antenna refresh cpo], [additional services cpo], [decom cpo], [variances build services cpo], [unknown variances cpo], [other cpo a], [other cpo b], [other cpo c], [other cpo d], [other cpo ...

angularjs - How can I use a different database for protractor e2e tests? -

i use database e2e tests , not use development database. need test login, in moment test using development database , not need, need create user in database , test login redirects dashboard , displays user information using node, angular, protractor , mongo. thanks login.test.js describe('login redirects dashboard , displays user email', function(){ it('should redirect dashboard , display user email', function() { var email = 'john@doe.com'; browser.get('http://localhost:3000/#/login'); element(by.id('username')).sendkeys(email); element(by.id('password')).sendkeys('none123'); element(by.id('submit-form')).click(); expect(browser.getcurrenturl()).tobe('http://localhost:3000/#/dashboard'); expect(element(by.css('.username')).gettext()).toequal('hi, ' + email); }); }); conf.js exports.config = { seleniumaddress: 'http://localhost:4...