Posts

Showing posts from July, 2014

python - How to set non-model field property to all the objects in ManyToMany Relation? -

i have django model, manytomany relation, , through recursive function trying set custom property on main model , models in manytomany fields, manytomany related model property not getting reflected templates. here code snippet: def update_product_price_details(product): product.sale_price = product.original_price if product.product_type == "packaged_product": product_discount = productservices.get_product_discount(product) # todo : handle multiple items # calculate product sale price base on subproducts , disocunt product.original_price = 0 sub_product in product.packagedproduct.sub_products.all(): sub_product = productservices.update_product_price_details(sub_product) product.original_price = product.original_price + sub_product.sale_price if product_discount , product_discount.is_valid(): product.sale_price = product.original_price - (prod

c# - ASP - the timeout period elapsed prior to obtaining a connection from the pool -

i'm having trouble following error: "timeout expired. timeout period elapsed prior obtaining connection pool. may have occurred because pooled connections in use , max pool size reached." it seems error in following code block: da = new sqldataadapter(command); command.commandtimeout = 100; da.fill(dt); conn.close(); return dt; it's hard such small amount of code in question error can occur when you're not disposing of db connection objects properly. "using" statement may out of problem. there issue same error message , code examples here: timeout expired. timeout period elapsed prior obtaining connection pool. may help.

c++ - dynamic_cast macro rescue NULL -

i want use dynamic_cast intrinsic in generated c++ code. macro definition looks like: #define jcast(t, v) (dynamic_cast<t*>(v)) unfortunately, because code generated, situation can occur: foo(jcast(uwiseobject, null)); a compiler said that: error: `nullptr_t` not pointer. how can rescue null in situation? want like: if (v) return dynamic_cast<t*>(v); else return null; well, that's macro's you. write real c++ instead: template<typename t, typename u> t* jcast(u* u) { return dynamic_cast<t*>(u); } template<typename t> t* jcast(nullptr_t) { return nullptr; }

xslt - How to customize feedback page Dspace XMLUI? -

how customize or change contact page of dspace 5.5 xmlui? files or configuration should change? to add additional content page have 2 options: one option customize contact.addbody . example: public void addbody(body body) throws ... { [...] contact.addpara("for urgent matters call 555-666-777."); } use ide autocompletion see kind of elements can add. there equivalents basic html elements. see dri schema reference understand better. the other option add content through xsl file: first, create dspace-xmlui-mirage2/src/main/webapp/xsl/aspect/artifactbrowser/contact.xsl (assuming mirage 2 theme) following content: <xsl:stylesheet xmlns:i18n="http://apache.org/cocoon/i18n/2.1" xmlns:dri="http://di.tamu.edu/dri/1.0/" xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="i18n dri xsl"> <

sql - Syntax error in Postgres query -

i written select query in postgresql db giving me syntax error. select order.c_doctype_id , doc.docsubtypeso c_order order inner join c_doctype doc on(order.c_doctype_id = doc.c_doctype_id) order.c_order_id =1000674 in above query giving me syntax error near order. use double quotes "" reserved words : select "order".c_doctype_id , doc.docsubtypeso c_order "order" inner join c_doctype doc on("order".c_doctype_id = doc.c_doctype_id) "order".c_order_id =1000674 or don't use reserved words: select o.c_doctype_id , doc.docsubtypeso c_order o inner join c_doctype doc on(o.c_doctype_id = doc.c_doctype_id) o.c_order_id =1000674

ms word - How to Merge Macro Code and to avoid flicker screen -

i've made 3 macro , want work one. try merge taking long respond , make screen flicker. indicate code please see code thanks. of code record since im not in coding. here's code: sub macrotest27() ' ' merge macro make 1 click ' ' 'deleting trash text make clear 'i use find jobspecialtycode highlight , delete. selection.find.clearformatting selection.find.replacement.clearformatting selection.find .text = "jobspecialtycode" .replacement.text = "" .forward = true .wrap = wdfindcontinue .format = false .matchcase = false .matchwholeword = false .matchbyte = false .correcthangulendings = false .hanjaphonetichangul = false .matchallwordforms = false .matchsoundslike = false .matchwildcards = false .matchfuzzy = false end while selection.find.execute selection.selectcell selecti

javascript - need baseurl in config.js file -

in config.js file (pasted below), need base url php base url script have used doesn't work. suggestions on can use replace php base url below ? bobbieeditor.editorconfig = function( config ) { config.fileopener = '<?php echo $this->baseurl;?>files/browse.php?opener=bobbieeditor&type=files'; }; can put value of $this->baseurl; in metas example: <!doctype html> <html> <head> <meta name="data-base-url" content="<?php echo $this->baseurl;?>" /> and js: var base_url = document.queryselectorall('head > meta[name="data-base-url"]'); var base_content = base_url[0].getattribute('content');

c - Dynamically allocating an int array -

int funkcija(int broj) { int *niz; int i; *niz = (int*)malloc(broj*sizeof(int)); srand(time(null)); (i = 0; < broj; i++) { niz[i] = rand() % 50; printf("%d\n", niz[i]); } return *niz; } i need make function takes number, dynamically allocates string/sequence of numbers, initializes random numbers , returns it. assistance? there few problems code, example, malloc() returns pointer, want assign pointer variable is pointer. in other words, should assign return value of malloc() niz , not *niz . next, funkcija() should return pointer array of int s random values reside. return type should int * . in continuation above logic, function should return pointer niz . if dereference niz (with *niz ), returning first element of array (which not need).

Type annotation in a pattern match in Rust? -

i'm digging rust, gracefully handling errors, i'm having little trouble type inference. extern crate mysql; use mysql my; fn main() { my_test(); } fn my_test() -> result<(), my::error> { let pool = try!(my::pool::new("")); let res = try!(pool.prep_exec("select 1 count", ())); rows in res { let row: my::row = try!(rows); match row.take("count") { none => (), some(i) => println!("{:?}", i), }; } ok(()) } which leads to src/bin/main.rs:86:12: 86:13 error: unable infer enough type information _ ; type annotations or generic parameter binding required [e0282] unfortunately docs in crate use unwrap lot, not me. in haskell, println!("{:?}", :: i32) , can't figure out how in rust. i've tried various ways cast row.take , i've haven't had luck. i'd love see variety of ways in have structured code, if there more id

performance - Benchmark for memory usage by android app -

i building fitnessapp focus on running. want know there benchmark android apps in terms of memory usage, cpu tune, ram usage , network track can compare performance of app benchmark , optimize respect that. if want optimize app, can use android studio monitor https://developer.android.com/studio/profile/android-monitor.html memory usage , performance differs device device. not take other apps reference. can misleading. optimize app performance , memory usage possible can.

javascript - grunt-sass and grunt-contrib-watch seems to not work together as expected -

i use grunt-sass , grunt-watch compile , minify code grunt.config('watch', { scripts: { files: ['<%= project.src.js.directory %>/*.js'], tasks: ['concat:scripts', 'uglify:compile'] }, styles: { files: [ '<%= project.src.css.directory %>/**/*.scss' ], tasks: ['sass:compile', 'cssmin:minify'] } }); problem: when modify 1 scss file, sass:compile kicks in, grunt-contrib-watch detects changes on javascript files , never run cssmin:minify . however, running task (without watch) works well. i thought grunt-contrib-watch cause (using spawn false instructed in https://github.com/gruntjs/grunt-contrib-watch/pull/509 kind of fix issue). does have encountered same issue? switching grunt-contrib-sass (using ruby-sass) fixes problem. my gruntfile.js: 'use strict'; module.exports = function(grunt) { /* * time grunt tasks execution time.

android - RecyclerView is not showing all of the items in the adapter -

i implemented infinite scrolling in recyclerview checking item's position in onbindviewholder() , whether or not more items being requested rest service. if item's position less 5 end of list , request not being made more items, request more items executed. @override public void onbindviewholder(itemholder holder, int position) { holder.bindholder(position); //debugging purposes //logs current position, size of item list, , whether //or not more items being retrieved rest service log.d("adapter", "position = " + position + "\nmitems.size() = " + mitems.size() + "\nget_user_feed_is_inactive = " + httprequests.get_user_feed_is_inactive + "\n\n"); //query more items if user less 5 items end , //there not active query if (position > mpolls.size() - 5 && httprequests.get_user_feed_is_inactive){ httprequests.ge

Creating a tripled nested JSON in Python -

i trying create json via first making python dict produces following structured format: {"sentences": [{"sentence": "at end of november 2005 , hong kong , america had 132 licensed banks , 41 restricted licensed banks , 35 deposit-taking institutions , , 86 representative offices .","parsedsentence": "xyz in text e.g. @ end of november 2005 , location_slot , location_slot had number_slot licensed banks , number_slot restricted licensed banks , number_slot deposit-taking institutions , , number_slot representative offices .","location-value-pairs": [{"america": 132}, {"america": 41}, {"america": 35}, {"hong kong": 132}, {"hong kong": 41}, {"hong kong": 35}]}]} however can't seem create code of 2 nested keys, , third key of keys, each of keys having array. my current code structure following (note, couldn't keys "sentence", "pa

javascript - Applying custom Jquery UI resize handles on image -

i have following code enable custom resize handles on image. tried code on div element working fine. on img element not working. and give following error. uncaught typeerror: cannot read property 'ownerdocument' of undefined jquery ui resize what understood custom handles should children of element resized. there way add custom handles on image , resize ? $( document ).ready(function() { $('#img-wrapper img').resizable({ handles: { 'nw': '#nwgrip', 'ne': '#negrip', 'sw': '#swgrip', 'se': '#segrip', 'n': '#ngrip', 'e': '#egrip', 's': '#sgrip', 'w': '#wgrip' } }); }); #img-wrapper{ position:relative; width:350px; height:150px; } #nwgrip, #negrip, #swgrip, #segrip, #ngrip, #egrip, #sgrip, #wgrip { width: 10px; height:

apache - mod_rewrite to redirect raw percent sign in URL instead of Bad Request 400 -

i have bunch of urls following: http://domain.com/is-20%-into-401k-enough/ i aware that, standards, malformed uris therefore going url directly result in bad request server. here few questions: i thought browsers automatically encode server sees %25 instead of %? why doesn't work in case? can use mod_rewrite redirect malformed uri correct 1 ( /is-20%25-into-401k-enough/ )? here i'm @ think bad request getting priority because rewritecond seems looking %25 in url: rewritecond %{request_uri} \% rewriterule . $0 [b] thanks in advance.

python - Is it possible to combine a dictionary of lists together into one list? -

say have dictionary so: my_list = { "foo": ["a", "b", "c"], "bar": ["d", "e", "f"] } how combine lists in dictionary 1 large list in 1 line of code (meaning there not temporary variable)? came following solution, not elegant: def combine_list_dictionary(): temp = [] (key, value_list) in my_list: temp += value_list return temp combine_list_dictionary() # ["a", "b", "c", "d", "e", "f"] i don't mind keys lost in process. don't use sum join lists. there long discussion on python ideas mailing list around why bad idea (will link later). itertools.chain solution, or if rather go functional then >>> my_list = { ... "foo": ["a", "b", "c"], ... "bar": ["d", "e", "f"] ... } >>> import oper

javascript - Uncaught type error: cannot read property persist of undefined with react-bootstrap carousel -

i'm implementing react-bootsrap carousel react-redux , i'm getting error in title. i'm using controlled carousel , error message appears when carousel changes slide automatically. when user clicks prev. next buttons , changes manually seems ok. i don't should add persist props or options props or similar? here's code: container: import react, { component } 'react' import { connect } 'react-redux' import { link } 'react-router' import store 'store/configurestore' import slides 'components/slideshow' import { getinitalslides, handleselect } 'actions/slidesactions' class home extends component { constructor(props) { super(props) this.state = { index: null, direction: null } this.handleselect = this.handleselect.bind(this) static fetchdata({ store }) { return store.dispatch(getinitalslides()) } componentdidmount() { this.props.getinitalslides(

.htaccess - mod_rewrite removes the ?page= fine, get &id= not working -

i got .htaccess working correctly going from: webshop/index.php?page=home webshop/home if put id in url still needs webshop/product&id=1 . want create webshop/product/1 . searched lot of options on internet not working. code below .htaccess file. options +followsymlinks -multiviews rewriteengine on # removes index.php url rewritecond %{the_request} /index\.php [nc] rewriterule ^(.*?)index\.php$ /$1 [l,r=302,nc,ne] # rewrites /home /index.php?page=home rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^webshop/([^/]*)$ /webshop/?page=$1 [qsa] hope guys can me out. you can use: options +followsymlinks -multiviews rewriteengine on # removes index.php url rewritecond %{the_request} /index\.php [nc] rewriterule ^(.*?)index\.php$ /$1 [l,r=302,nc,ne] # skip files , directories rewrite rules below rewritecond %{request_filename} -d [or] rewritecond %{request_filename} -f rewriterule ^ - [l] # rewrites /webshop/product/1 /web

javascript - Unable to read excel file using MultipartFormdataInput in Rest Call -

i using multipartformdatainput read excel file in rest call. server code mentioned below. @post @path("/uploadedfile") @consumes("multipart/form-data") @produces({ "text/html" }) public /*jsonarray*/ string uploadedfile(multipartformdatainput input) throws exception { map<string, list<inputpart>> uploadform = input.getformdatamap(); list<inputpart> inputparts = uploadform.get("file"); system.out.println("in rest call file got" ); inputpart inputpart = inputparts.get(0); inputstream inputstream = inputpart.getbody(inputstream.class, null); xssfworkbook workbook = new xssfworkbook(inputstream); ..... } now throw exception while reading inputstream? can tell me what's wrong in or there other way can totally new in area exception is: unable find messagebodyreader media type: application/vnd.openxmlformats-officedocument.spreadshe

c# - Add Adorner to Image in WPF RichTextBox when loaded -

i have richtextbox control in application developing using along toolbar create rich text editor. 1 feature have implemented ability user insert image, worth noting @ point output richtextbox rtf. when user inserts image using following code add image document , add resizeadorner (example here richtextbox resizing adorner ) image allows user resize. when user saves , loads document size of image persisted correctly. private void btninsertimage_onclick(object sender, routedeventargs e) { openfiledialog ofd = new openfiledialog(); ofd.multiselect = false; ofd.checkfileexists = true; ofd.checkpathexists = true; ofd.filter = "image files (*.png;*.jpg;*.jpeg;*.gif;*.bmp)|*.png;*.jpg;*.jpeg;*.gif;*.bmp"; ofd.initialdirectory = environment.getfolderpath(environment.specialfolder.mypictures); ofd.title = "insert image"; if (ofd.showdialog() == true) { bitmapimage bitmap = new bitmapimage(new uri(ofd.filename, urikind.rel

python - Return a pandas DataFrame when using pandas.DataFrame.mean -

the function pandas.dataframe.mean returns pandas.series . return dataframe same column names original dataframe. how 1 this? import numpy np, pandas pd df = pd.dataframe(np.random.rand(10,5), columns = ['a', 'b', 'c', 'd', 'e']) this returns pandas.series object df.mean() so this df.mean(level = 0) and this df.mean(axis = 0) the current way using following commands, easiest way it?! means = df.mean(axis = 0) pd.dataframe(means).t i hoping more straight-forward solution! you using to_frame , transpose: in [188]: df.mean().to_frame().t out[188]: b c d e 0 0.393221 0.441338 0.445528 0.67516 0.699105

plsql - Create a table in Oracle SQL If table does not exist using select and join -

the question common, facing 1 single issue in there not able find answer. have is, create table if table not exist. while creating table, need create select query(which result of join of 2 tables). "oracle sql developer" / "pl/sql". the query using is: declare count_matching_tbl binary_integer := 0; begin select count(*) count_matching_tbl dba_tables lower(table_name) = 'testtable'; if(count_matching_tbl = 0) execute immediate ( ' create table testtable (select a. , b. tab1 join tab2 b on a.id = b.rid 1=2)'); end if; end; if tab1 , tab2 table has same name column ambiguity occure while creating table , inserting record instead of * replace table column add in testtable like create table testtable (select a.cola1, b.colb1 tab1 join tab2 b on a.id = b.rid 1=2

android - Errors coming up out of nowhere in Eclipse -

first of want say: yes, know, eclipse bad, android studio 100 times better. i'm working on school project , have couple of days left after working on 5 months. means i'm not gonna switch android studio now. i worked builded app 4 months straight now. never experienced problems, errors but, fixable. it's close finished, , find strange errors. changed none of code, can't run anymore. there 100 lines of errors involving appcompat_v7, , have no idea mean or how can fix them. here example of error lines: [2016-07-06 14:10:22 - rodekruis] g:\ict_alg\01 applicaties\android app\software\appcompat_v7\res\values-v21\themes_base.xml:142: error: error: no resource found matches given name: attr 'android:windowelevation'. [2016-07-06 14:10:22 - rodekruis] [2016-07-06 14:10:22 - rodekruis] g:\ict_alg\01 applicaties\android app\software\appcompat_v7\res\values-v21\themes_base.xml:146: error: error: no resource found matches given name: attr 'android:windowelevatio

Bluetooth Pairing rejects during attempt to programmatically connect BT in android -

i trying connect bluetooth device (bt headphone) programmatically android app. issue facing in first couple of attempts fails connect device , says "pairing rejected". after connects successfully. here's code: package rockwellcollins.bluetooth_pairing_siu; import android.bluetooth.bluetootha2dp; import android.bluetooth.bluetoothadapter; import android.bluetooth.bluetoothdevice; import android.bluetooth.bluetoothprofile; import android.bluetooth.bluetoothsocket; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.content.intentfilter; import android.os.bundle; import android.support.design.widget.floatingactionbutton; import android.support.design.widget.snackbar; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.util.log; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.toast; import j

javascript - Trigger event when user clicks the browsers back button -

is possible jquery trigger function when user clicks browsers button. have lightbox/widget when open fills window when open. there close button etc if closed if user hit button mistake. i have far function doesnt seem run @ all $(window).on("navigate", function (event, data) { event.preventdefault(); console.log('back pressed'); var direction = data.state.direction; if (direction === 'back') { if(widgets.full_active){ $('.close', widgets.active_widget).click(); event.preventdefault(); console.log('close this'); } } if (direction === 'forward') { // else } }); by not running line @ start of function event.preventdefault(); should mean page never changes usually, using native javascript api browser, described here: manipul

html - Flexbox with sized images broken in Safari -

Image
i have following layout working in chrome , firefox, it's broken in safari. .grid { max-width: 1280px; margin: 0 auto; background-color: red; } .block { display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -webkit-flex-wrap: nowrap; -ms-flex-wrap: nowrap; flex-wrap: nowrap; -webkit-justify-content: flex-start; -ms-flex-pack: start; justify-content: flex-start; -webkit-align-content: flex-start; -ms-flex-line-pack: start; align-content: flex-start; -webkit-align-items: flex-start; -ms-flex-align: start; align-items: flex-start; } .block .meta { background-color: blue; margin: 0 60px 0 0; -webkit-order: 0; -ms-flex-order: 0; order: 0; -webkit-flex: 1 1 auto; -ms-flex: 1 1 auto; flex: 1 1 auto; -webkit-align-self: auto; -ms-flex-item-align: auto; align-self: auto; } .block .thumbnail { -webk

junit - Need to resolve com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa' -

i using junit test application. in application used datasource connection database. database connection properties getting context.xml while testing junit, had written code initialize initialcontext , set database properties in datasource, while getting connection getting login failed error. don't know why happening, please let me know how resolve these issues. # initialization had written # // create initial context system.setproperty(context.initial_context_factory, "org.apache.naming.java.javaurlcontextfactory"); system.setproperty(context.url_pkg_prefixes, "org.apache.naming"); initialcontext ic = new initialcontext(); ic.createsubcontext("java:"); ic.createsubcontext("java:comp"); ic.createsubcontext("java:comp/env"); ic.createsubcontext("java:comp/env/jdbc"); // construct datasource

vba - Return a variable by a function and store it a new variable -

i want create 2 functions: 1 should "produce" number , other should perform function parameter number. i got following code sub get_number() dim x integer x = 3 return x end sub but cant return numeric value because throws compile error. thoughts on how can function return x value , store in new variable (fe y() you need use function, not sub, , assign return value name of function: function get_number() dim x integer x = 3 get_number = x end function then use: y = get_number in other code.

qt - QLabel text alignment with rich text and <tt> -

Image
i have qlabel that's displaying rich text (i. e. subset of html supported qt) , uses <tt> tag (for monospaced font). seems mess vertical alignment of whole label text (not monospaced part). as example, here 9 qlabels in grid layout. text of center label "text<tt>label</tt>" , while text of other labels "textlabel" . text of center label aligned 3 pixels lower others. needless say, messes layout , causes annoying layout changes when text changed value doesn't contain monospaced font. how can text align other labels? qt 5.5.1 on ubuntu 16.04 gnome 3.18.2. tl;dr : using <span style="font-family: monospace">...</span> instead of <tt>...</tt> fixed issue me. looking @ following screenshot, impression issue related courier new font: the blue label (top) has font set courier new. has additional space above text. the red label (center) uses <tt> in question. qt chooses courier

c# call a method whenever another method ends? -

although question might sound stupid @ first glance, please hear me out. c#'s get{} , set{} methods increadibly usefull in situations when not know how porgramming goals evolve while build code. enjoyed freedom many time , wonder if there similar methods in bit different light. as working in gamedev, common practice extend/update/improve existing code day-in day-out. therefore, 1 of patterns taught myself follow never use "return" statement more once in of methods. the reason why able write @ bottom of method , sure line have written called 100% of time once method ends. here example: public void update() { updatemovement(); if (isincapacitated) return; if (isinventoryopened) { updateinventory(); return; } if (input.hasaction(actions.fire)) { fire(); return; } else if (input.hasaction(actions.move)) {

android - Heatmap Overlay with weighted sum of latlng? -

how apply heatmap overlay in android specific colors specific values. weighted sum appears same individual heatmap spot? how apply heatmap overlay in android specific colors specific values in android heatmap docs , can set own colors heatmap using setgradient(); here's sample of customizing heatmaps : // create gradient. int[] colors = { color.rgb(102, 225, 0), // green color.rgb(255, 0, 0) // red }; float[] startpoints = { 0.2f, 1f }; gradient gradient = new gradient(colors, startpoints); // create tile provider. mprovider = new heatmaptileprovider.builder() .data(mlist) .gradient(gradient) .build(); // add tile overlay map. moverlay = mmap.addtileoverlay(new tileoverlayoptions().tileprovider(mprovider));

sql - Finding rows that do not have a corresponding entry in join table -

i have table joined table b through join-table j. how can access rows table not have corresponding "join" entry in j based on given attribute table b? example: table a: ------- id table j: ------- a_id b_id table b: ------- id name say given b.name = "suzie", how can determine rows not have entry in j b_id b.name = "suzie"? feel should simple query, , considered using group by because seems each entry in a, want determine if b_id you're working (where b.name = "suzie" in case) exists in j each "group" of a_id's. somehow, can't wrap head around this; appreciate push in right direction. you can where not exists : select a.* tablea not exists ( select 1 tablej j join tableb b on b.id = j.b_id j.a_id = a.id , b.name = 'suzie' )

esper - Cumulocity date formats -

i wondering why date format different between fields. rule declared this: @name("measurement_occupation") context parkingspotoccupation insert createmeasurement select e.source source, "parkingspotoccupation" type, min(e.time) time, { "startdate", min(e.time), "enddate", max(e.time), "duration", datedifferenceinsec(max(e.time), min(e.time)) } fragments smartparkingevent e output last when terminated; and result following using api measurements: { "time": "2016-05-30t06:00:00.000+02:00", "id": "33200", "self": "https://management.post-iot.lu/measurement/measurements/33200", "source": { "id": "26932", "self": "https://management.post-iot.lu/inventory/managedobjects/26932" }, "type": "parkingspotoccupation", "startdate": { "time":

sql - Nullable FK vs two tables -

i have requirement store scan (barcode/fingerprint etc) events table, , if it's scan linked person in database, link scan person. so, need store invalid scans well. i have few options. a userscan table, details scan, , nullable userid foreign key user table, populated when have valid scan. or a userscan table details scan, , not null fk user table, , write valid scans table, plus 'failed scan' table, details scan only. maybe there's other options? this table rather large, , lot of queries using table work out in location @ times, example. nullable userid less optimal option? or recommended? i thinking of maybe 'scan event' table, has scans, , if scan successful, userscanevent table, scan event id , user id. looks many-to-many link table. i'm looking best design efficiency. best way go, , maybe there's better idea? option 1: think select efficiency point of view, option 1 might give best result, using filtered index on userid

How can I find out what distribution of Python I'm using? -

i'm not looking version distribution, i.e. whether it's anaconda, python(x,y), etc. open terminal (or command line on windows) , type python --version . instance, on windows machine returns: python 3.4.4 :: anaconda 4.0.0 (64-bit) unless i'm in python 2.7 virtual env, in case returns: python 2.7.11 :: anaconda 4.0.0 (64-bit) which python tells binary located, not give of idea version (although if it's in anaconda folder, know it's anaconda, , sort of thing).

ios - Edit 2 labels from 1 text field -

good day! here issue - need change 2 different labels 1 text field. tried simple if-else logic, didn't work in case. func labeltextchanger() { if fromusername.text == nil { fromusername.text = textfileld.text } else { replytousername.text = textfileld.text } } ma case if understand question correctly, need change text of 2 uilabels whenever editing uitextfield? if so, should use "editing began" or "editing changed" ibaction linked storyboard file. then, have uilabel's value change whatever uitextfield's text is. @ibaction textfileideditingchanged { fromusername.text = textfileid.text replytousername.text = textfileid.text }

java - Is there an implementation of javax.bluetooth.* that works on El Capitan? -

it appears bluecove little old , doesn't work since yosemite , couldn't find alternative that. you can use newest version(2.1.2) of bluecove. not officially announced official bluecove team has native osx 64 bit support , solution win 8. found version @ bluecove issue page . please under comment #21. if want can download here .

flowtype - Nuclide Flow not showing errors in Atom -

Image
i have small project test out facebook flow . have purposefully placed type errors flow picks up, , detected when running flow check command line. i display them directly on atom, when viewing file(s), shows 0 errors (about 20 in project when running command line). here i've done: installed flow (with brew) installed nuclide atom packages (settings shown in image below) initialized empty .flowconfig file in project initialize each file flow-check /* @flow */ run flow check project directory i have following os versions: osx 10.11 atom 1.8.0 nuclide 0.141.0 flow 0.14.0 here settings nuclide flow : here when running flow on command line: here when viewing file on atom: i have made work doing following: update flow 0.26.0 brew upgrade flow (or sudo brew upgrade flow if need to) disable linter packages on atom restart atom (shutting app first) restart flow server (atom top bar --> nuclide --> flow --> restart flow server)

java - Selenium Web Driver - How to check whether all the products in a page loads -

i trying solve issue need check whether products in web page loads completely. products load when user scroll page downwards. each time on scroll 8 products loaded. how check in page last product loads , user not able scroll downwards? use known solution scrolling down : webdriver driver = new firefoxdriver(); javascriptexecutor jse = (javascriptexecutor)driver; jse.executescript("window.scrollby(0,250)", ""); then check 8 products after last scrolling iteration doesn't differ current iteration. pseudo-code: products = getproducts(); jse.executescript("window.scrollby(0,250)", ""); // reasonable wait here if(getproducts() == products){ //that it. nothing scroll

ios - Is 'init' forbidden as *part* of a variable name? -

i spent 3 hours debugging error , in end narrowed down (i think) variable name. i using initmonths (initial months) caused unpredicatable errors when changed imonths worked! i can understand preventing use of init on it's own surprised if prevented part of variable name. bug or feature? it's not bug if it's related name being overlap. there's part of arc used know when retain counts should updated, , may running that. similar rules apply use new @ start of names (for same reason). it's easy , wise steer clear of using init @ start of names unless it's init function. i can imagine issue related arc getting involved shouldn't , takes while called shouldn't, weird. i expect issue else , name change had other effect. worst case means have memory issue , changing name has changed memory footprint of code you've moved bug somewhere else (or along lines).

amazon web services - Elastic Beanstalk: allow user to deploy -

i can't figure out how let other people in company deploy (test) server aws elastic beanstalk. this page suggests global permission control on elb: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/awshowto.iam.managed-policies.html the rhys godfrey blog post titled using iam secure elastic beanstalk applications on aws has guidance. we have elastic beanstalk application, , group of users. group of users should able monitor , deploy elastic beanstalk environment, restarting or terminating application instance. should not able change application or environments configuration, or delete environment. user should not able affect other applications or aws services, acceptable them see details on other areas. assume user using aws console. i have reposted iam policies here reference. the nice thing approach considers application environment referencing ec2 tag on instances eg environment=testing , require in use case. { "version&quo

Rails db migrations mariadb and transactions -

by default rails , rake use transactions when performing database migrations, if database supports them. mysql not , using mysql2 adapter, transactions not used. i'm using mariadb drop in replacement mysql, , support transactions. there way tell rake/rails use transactions? need find or write own adapter mariadb?

makefile - GNU Make: "dir not expected at this moment" -

i have makefile including following lines: buildrepo: @$(call make-repo) define make-repo dir in $(c_srcs_dir); \ \ mkdir -p $(objdir)/$$dir; \ done endef on line commands for dir in $(c_srcs_dir); \ following error message: "dir not expected @ moment" make: *** [buildrepo] error 255 i using gnu make . can tell me going wrong? actually for ... in ... ; ... done statement unix command not gnu make command, therefore guess using windows machine (or other one). have find equivalent system. but gnu make has foreach function works : $(foreach dir,$(c_srcs_dir),mkdir -p $(objdir)/$(dir);) also note in specific case (not related gnu make windows) can create dirs without for/foreach loop, : mkdir -p $(addprefix $(objdir)/,$(c_srcs_dir))

python - Viewing dicom image with Bokeh -

i'm trying set graph background dicom image. followed this example , image data given dicom.pixel_array isn't rgba. i'm not sure how convert it, either. i'm not sure bokeh expecting. i've tried finding specifics in documentation, not such luck. from bokeh.plotting import figure, show, output_file import dicom import numpy np path = "/pathtodicomimage.dcm" data = dicom.read_file(path) img = data.pixel_array p = figure(x_range=(0,10), y_range=(0,10)) # must give vector of images p.image_rgba(image=[img], x=0, y=0, dw=10, dh=10) output_file("image_rgba.html", title="image_rgba.py example") show(p) this code doesnt give me errors, doesn't display anything. maybe pixel array doesn't have alpha data, alpha defaults 0 ? i'm not sure. also, can't quite figure out how test it. solved as pointed out, needed map pixel data rgba space. instance, means duplicating data each channel, , setting alpha way. def dic