Posts

Showing posts from January, 2013

c# - Using BrokeredMessage with ServiceBus Queue Trigger in Azure Function -

i've created azure function triggered time new message added azure servicebus queue. code works fine: #r "newtonsoft.json" #load "..\shared\person.csx" using newtonsoft.json; using newtonsoft.json.serialization; public static void run(string message, tracewriter log) { var person = jsonconvert.deserializeobject<person>(message, new jsonserializersettings() {contractresolver = new camelcasepropertynamescontractresolver()}); log.verbose($"from deserializeobject: {person.firstname} {person.lastname}"); } i've seen can bind message poco that: public static void run(person message, tracewriter log) { log.verbose($"from deserializeobject: {message.firstname} {message.lastname}"); } now bind message brokeredmessage because need have access properties of message. edit new sdk supports servicebus sdk using #r directive #r "microsoft.servicebus" using microsoft.servicebus.messagin

swing - Java order jlist by status -

i have small problem, don't know how sort jlist status retrieved database. want sort "online" , "offline", mean online computers go first , offline computers, have code now, makes icon+text jlist can tell me how can filter/sortby status? public void acx_pc(string query) { try { statement st = con.createstatement(); resultset rs = st.executequery(query); string comb; map<object, icon> icons = new hashmap<>(); arraylist<string> pc_list = new arraylist<>(); int = 0; while (rs.next()) { //getting info db string pc_name = rs.getstring("nombre_pc"); string pc_ip = rs.getstring("ip"); string status = rs.getstring("estado"); //setting text jlist comb = pc_name + " - " + pc_ip; //comparing status switch (status) { case "onl

Routes error with django models migrations -

i have file named routes.py have router.register('orders', orderviewset, 'order') if comment don't have problems migrations, in production, , boss cannot comment every time want migrate. in te serializer.py have this: class orderserializer(serializers.modelserializer): buyer_obj = serializers.serializermethodfield() #items = productserializer(many=true, read_only=true) class meta: model = order fields = ('id', 'url', 'buyer', 'items', 'store', 'buyer_obj', 'browser_ip', 'currency', 'enabled', 'financial_status', 'gateway', 'total_amount') the error next: django.db.utils.operationalerror: (1054), "unkown column 'orders_order.currency' in 'field list'") please exist form migrate that? thank you.

c# - How to use a ServiceBus Trigger with a topic/subscription in an Azure Function -

Image
i'd create azure function triggered when new message added topic/subscription. for moment i've created azure function using servicebusqueuetrigger c# template , i've set queue name to topicpath + "/subscriptions/" + subscriptionname but i've got exception: microsoft.servicebus: cannot entity 'topic-test/subscriptions/subscription-test' because not of type queuedescription . check using method(s) correct entity type. system.runtime.serialization: error in line 1 position 1762. expecting element 'queuedescription' namespace ' http://schemas.microsoft.com/netservices/2010/10/servicebus/connect '.. encountered 'none' name '', namespace ''. . i thought azure function using messagingfactory.createmessagereceiver initialize message pump not. is there support topic/subscription moment ? yes topics supported, our ui , templates behind on unfortunately - we'll releasing updates addr

Intellij Idea - how to get rid of thick caret/cursor -

Image
i pressed in intellij , caret shape changed this. how revert normal thickness? using intellij 2016.1. compare this, normal thickness should of bold vertical line: update: on android studio 2.1 beta, same machine, same font settings, cursor visibly thinner. you can .. it's not pixel perfect. mean -- me value not seem control thickness in pixels rather index (which gets applied predefined values) -- at least impression on see computer. in case: help | find action... search registry action once in registry window -- editor.caret.width entry set new value (for me default 2 ) -- make sure field went bold (move entry) ensure new value accepted. restart ide (this option requires it) update (2017/04/06): you may try thincaret plugin : makes editor caret 1 pixel thin (for retina users)

linear regression - How to replace the fitted value in multiple columns in R -

i have dataframe called new.cars . need apply linear regression formula columns in dataframe. there thousands of columns in new.cars , indicating each of them not possible in formula. there 4 columns, pcas remain same in formula other columns (columns other pcas ) in want apply formula. the formula first column (column mercedes ) is fit1 <- lm(mercedes ~ pca1 + pca2+pca3+pca4, data=new.cars) new.cars[,"mercedes"] <-fit1$fitted.values and forth other car columns.. best way replace column values fitted value (and omitting na values in column, means don't want change nas--as empty cells , need not fitted)? new.cars<- structure(list(mercedes = c(1, 1, 1, 1), vw = c(1, 2, 0, na), camry = c(2, 0, 0, na), civic = c(4, 1, 1, 1), ferari = c(2, 2, 2, 0), pca1 = c(0.021122, 0.019087, 0.022184, 0.021464 ), pca2 = c(0.023872, 0.024295, 0.022471, 0.027509), pca3 = c(0.000784, 0.001996, 0.003911, 0.006119), pca4

r - Using "rvest" scraping html table -

i try using rvest package scrape table: library(rvest) x <- read_html ("http://www.jcb.jp/rate/usd04182016.html") x %>% html_node(".csvtable") %>% html_table url elements likes: <table class="csvtable"> <tbody>...</tbody> <tbody class>...</tbody> </table> why occur error "no matches"? you're in luck (kind of). site uses dynamic xhr requests make table, said request csv file. library(rvest) library(stringr) pg <- read_html("http://www.jcb.jp/rate/usd04182016.html") # <script> tag dynamic loading in position 6 of # list of <script> tags fil <- str_match(html_text(html_nodes(pg, "script")[6]), "(/uploads/[[:digit:]]+\\.csv)")[,2] df <- read.csv(sprintf("http://www.jcb.jp%s", fil), header=false, stringsasfactors=false) df <- setnames(df[,3:6], c("buy", "mid", "sell", "symb

sharding - What are best practices for partitioning DocumentDB across accounts? -

i developing application uses documentdb store customer data. 1 of requirements segregate customer data geographic region, customers' data stored within us, , european customers' data lives in europe. the way planned achieve have 2 documentdb accounts, since account associated data centre/region. each account have database, , collection within database. i've reviewed documentdb documentation on client- , server-side partitioning (e.g. 1 , 2 ), seems me built-in partitioning support not able deal multiple regions. though implementation of ipartitionresolver conceivably return arbitrary collection self-link, partition map associated documentclient , therefore tied specific account. therefore appears need create own partitioning logic , maintain 2 separate documentclient instances - 1 account , 1 europe account. there other ways of achieving requirement? azure's best practices on data partitioning says: all databases created in context of docume

ios - Button position different for different iphone -

Image
how can buttons stay on same position different versions of iphone? have background image , on top of that, have button. is there anyway can provide fixed position button? the following supposed like, based on story board. all ios devices 4", 4.7", , 5.5" screens (which iphones since iphone 5 , ipods since 5th generation) have same screen aspect ratio, 16:9, if target devices, doable constraints in storyboard , no code. you posted iphone 6-sized screen shot. (pro tip: press ⌘s in simulator save screen shot desktop don't have try crop hand.) in shot, you've put bottom edge of button 300 pixels = 150 points above bottom edge of screen. screen of iphone 6 667 points tall. so step 1 add “spacer” view root view. set background color can see, , make hidden. (hidden views still participate in layout.) pin spacer left , bottom edges of root view. make 20 points wide. width doesn't matter. create equal-height constraint between spacer , root v

ios - Stripe - STPPaymentCardTextField - Remove border -

stripe's ios sdk's "stppaymentcardtextfield" has bordercolor property. i'm trying remove using new color or setting nil without success. is there way programmatically remove border of stppaymentcardtextfield? ok, adding user defined runtime attributes in storyboard: layer.bordercolor > color > white bordercolor > color > white

matlab - How to use interp2 here -

i have matrix, 37x13, has 4 "holes" poked it, i've been asked use interp2 refill these values a=load ('archive'); a(10,6)=0; a(10,7)=0; a(11,6)=0; a(11,7)=0; i've used interp2 before way i'm afraid not work here, because matrix has more 1 row missing years = 1950:10:1990; service = 10:10:30; wage = [150.697 199.592 187.625%10 179.323 195.072 250.287 203.212 179.092 322.767 226.505 153.706 426.730 249.633 120.281 598.243]; %it possible interpolate find wage earned in 1975 employee %with 15 years' service: w=interp2(service,years,wage,15,1975); i need guidance on how declare meshgrid command, syntax of interp2 troubles me most, interp1 not trouble learn in comparison. in advance

javascript - I can't use my static JS files in ExpressJS -

i'm new nodejs. i'm calling static javascript file within ejs file. not outputting onto console. my .ejs file: <head> <title><%= title %></title> <link rel='stylesheet' href='/stylesheets/style.css' /> <script type="text/javascript" src="/javascripts/calc.js"></script> </head> <body>...</body> my static js (calc.js) file: console.log("why not working?!");//this have no more code here i have added app.use(express.static(path.join(__dirname, 'public'))); in app.js. my static js file in public --> javascripts --> calc.js thanks. in app.use() joining __dirname , folder "public", yet in ejs file src script @ root, not under "public." might issue.

javascript - jqBootstrapValidation not working, always return valid value; -

don't know why validation not working, have try use various validator result return valid.. need second eyes spot error.. first time using snippet, snippet below correct.. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>test files</title> <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jqbootstrapvalidation/1.3.7/jqbootstrapvalidation.min.js"></script> <script> $(function(

Filtering and extracting fields from a text file in python -

i have text file in following format. 03/12 20:23:26.11: 04:23:26 l9 <mx acc magnum xdv:00111a0000000117 00d3001200870172 01ff6000f01cfe81 3d26000000000300 03/12 20:23:26.11: 04:23:26 l9 <mx acc mid 0x1500 len 26 xdv:00111a0000000117 00d3001200870172 01ff6000f01cfe81 3d26000000000300 03/12 20:23:26.11: 04:23:26 l8 <mx jk31 (mx) jsp:17.37.6.99: size = 166, data: 00345c4101003031 e463ef0113108701 5a01ff6008f01cfe 81ab170000000003 ef01131087015a01 ff6008f01cfe81ab 170000000003ef01 131087015b01ff60 00f01cfe81701b00 00000003ef011310 87015b01ff6000f0 1cfe81701b000000 0003ef0113108701 5c01ff2000f01cfe 81cb240000000003 ef01131087015c01 57cc00f01cfe81cb 240000000003ef01 131087015d01ff20 00f01cfe815b2900 00000003ef011310 87015d01ff2000f0 1cfe815b29000000 0003ef0113108701 5e01ff6000f01cfe 819d280000000003 ef01131087015e01 ff6000f01cfe819d 0003 03/15 20:23:26.11: 04:23:26 l8 <kx jk49 (kx) jsp:15.33.2.93: size = 163, data: 00647

javascript - How to get style coordinates of element in IE8 -

Image
i have been banging head @ while need smart guys. i struggling extract xy coordinates of 'background-position' value in element. test this, set (css_class = predetermined css class): var d = document.getelementbyid(css_class); alert("1: "+getstyle(d,'background-position')); alert("2: "+d.style.backgroundposition); alert("3: "+d.currentstyle.backgroundposition); alert("4: "+d.style.csstext); alert("5: "+window.getcomputedstyle(d,null).getpropertyvalue('background-position')); test1--> undefined test2--> blank test3--> undefined test4--> blank test5-->'object doesn't support property or method 'getcomputedstyle'' nothing gives me xy pixel values. have done research, through microsoft dom api references find, here (which got getstyle function (below, uses getcomputedstyle), searched mozilla developer forums, etc. function found on forum: function getstyle(el,style

html - 'Open Sans', sans-serif looks different in mac -

Image
i using 'open sans', sans-serif font family in website.but looks little bit different in mac systems. this how looks in mac. , this in other systems. those 2 different fonts. take @ letter "a" in each image. have different tails. my guess have open sans installed on 1 computer , not other computer? bottom image looks open sans guess may have installed there. (i'm not saying need installed fonts work properly, obviously, having installed explains why shows there , not other computer) how including font because looks it's not getting included properly. if don't include font properly, set font in css, computer has font installed show proper font, other computer show fallback font. edit: if don't have installed on either device none of them in fact open sans , both fallback fonts. top image looks helvetica me. try doing "inspect element" , going "computed" if you're in chrome (i'm unfamiliar similar way vi

javascript - Angular Js beginner Ajax Call -

i'm new angular js, inside controller.js controllers app, 100% working. i'm having problem how make ajax call using angular js. i'm trying fetch data service , pass index.html using ajax. when try debug code, hits on $http doesn't go through code inside it. doing wrong here? $http({ method: 'post', url: 'http://someservice.site.net/site.aspx', data:{action:'someaction', position:'founders'}, headers: {'content-type': 'application/x-www-form-urlencoded'} }).then(function successcallback(response){ var json =jquery.parsejson(response); var htmldata=""; for(i=0; i<json.length; i++) { var htmlinfo = '<li><div class=\'col\'><a href="'+ json[i].id +'"><img width=\'100%\' height=\'auto\' src="'+json[i].image + '" class=\'profile-img\' /&

java - Hive throws an error while creating table "Cannot validate serde: com.cloudera.hive.serde.JSONSerDe" -

working on apache-hive-0.13.1. while creating table hive throw error below failed: execution error, return code 1 org.apache.hadoop.hive.ql.exec.ddltask. cannot validate serde: com.cloudera.hive.serde.jsonserde table structure create external table tweets(id bigint, created_at string, scource string, favorited boolean, retweet_count int, retweeted_status struct < text:string,user:struct< screen_name:string, name:string>>, entities struct< urls:array<struct< expanded_url:string>>, user_mentions:array<struct< screen_name:string, name:string>>, hashtags:array<struct<text:string>>>, text string, user struct< screen_name:string, name:string, friends_count:int, followers_count:int, statuses_count:int, verified:boolean, utc_offset:int, time_zone:string> , in_reply_to_screen_name string) partitioned

android - getLastLocation() always null after reinstall -

i seem have problem can't figure out. creating application requires location services android. application needs poll location. code had been working months, , when uninstalled phone , reinstalled it, location returning null. here locationprovider class, grabs location using google api client: public class locationprovider implements googleapiclient.connectioncallbacks, googleapiclient.onconnectionfailedlistener, locationlistener { public abstract interface locationcallback { public void handlenewlocation(location location); } public static final string tag = locationprovider.class.getsimplename(); /* * define request code send google play services * code returned in activity.onactivityresult */ private final static int connection_failure_resolution_request = 9000; private locationcallback mlocationcallback; private context mcontext; private googleapiclient mgoogleapiclient; private locationrequest mlocationrequest; public locationprovider(context

extjs - RowEditor crashes when maxLength validation is triggered -

Image
i have grid row editing plugin, within grid have 1 number field , maxvalue attribute set 100 field. however, every time trigger maxlength validation, row editing buttons crashed , have no responses. forced refresh page cancel row editing mode. know how solve problem?

How to get the target cell row number in the sheet with Google-apps-script -

Image
i want create google-apps-script in google sheet. first need target cell row number, continue next step. i have tried getrow() and getrowindex() ,all of them return 0, tell me what's right method... var ss = spreadsheetapp.getactivespreadsheet(); var sheets = ss.getsheets(); var sheet1 = sheets[0]; var cell = sheet1.getactivecell(); var selectrow = cell.getrow(); logger.log("selectrow :" & selectrow); for example: i want return number 2. thank in advance. the problem logger.log("selectrow :" & selectrow); . use + instead of & string concatenation , variable displayed properly. use: logger.log("selectrow :" + selectrow); or this: logger.log("selectrow : %s", selectrow);

parent properties for application-{profile}.properties with Spring-Boot app -

there common properties shared among different profiles e.g. path location temp files , path remains same among different env(tst,prd). is there way have parent application-{parent}.properties profile specific properties files can inherit properties. that in avoiding writing same properties in application-{profile}.properties in addition, each application-{profile}.properties have : profilelocation=xxx abc=${profilelocation}/temppath here can move abc common location? cannot in application.properties gets loaded before application-{profile}.properties actually, not entirely true application.properties loaded before others. processed together. set common properties used profiles, should use ordinary application.properties file. 2 main thing should know described below. case 1. keys placed inside application.properties file can overridden profile specific configuration. common.path.for.all.envs=/some/path default.path=/another/path than in e.g. applicat

Batch processing in Cassandra to copy tables; -

i have 2 tables.customer_materializedview , customer_backup. want function such after every 30 min batch runs table customer_materializedview gets copied customer_backup. please notice have copy whole table , not single rows. begin batch copy events.customer_materializedview (colm_def,...) 'temp.csv'; truncate customer_materializedview; copy event.customer_backup (colm_def) 'temp.csv'; apply batch; this backup strategy not safe nor practical. suggest reading document first: https://docs.datastax.com/en/cassandra/2.0/cassandra/operations/ops_backup_restore_c.html but try answer question regardless. create scheduled job using tools based on os using. example can schedule cron job on linux. you need 2 files. 1 cql commands want execute on db , executing commands. first file named "cql" this: begin batch copy events.customer_materializedview (colm_def,...) 'temp.csv'; truncate customer_materializedview; copy event.customer_b

image resizing - ImageResizer S3Reader vs. RemoteReader -

as can connect s3 bucket simple domain images.yourdomain.com, advantage in using s3reader rather using remotereader? i know remotereader open , resample images security reasons, thats no problem. could switch between cloud providers setting nameserver destination? you can use remotereader connect public http-accessible datastore, including amazon s3. however, s3reader offers many benefits less error-prone whitelisting. validate bucket name instead of managing permutations each s3 region , address method. optional file invalidation (remotereader cannot invalidate if resource changes) optional ssl encryption optional iam authentication can hide source files, while serving resized versions.

Update python 3.5 in anaconda -

i have installed python 3.5 following commando: conda create -n py35 python=3.5 anaconda i have base anaconda python27 installed. when wish update write: conda update conda but how update pyhon35? i have tried this: activate py35 [py35] c:\users\trofl>cd c:\users\trofl\anaconda2\envs\py35 [py35] c:\users\trofl\anaconda2\envs\py35>conda install conda using anaconda cloud api site https://api.anaconda.org fetching package metadata: .... solving package specifications: ......... error: 'conda' can installed root environment it looks trying install when have conda-env , conda-build in current environment. have remove these first update conda. source activate my-env conda remove conda-build conda remove conda-env conda update anaconda

javascript - page redirection now working in angular js -

we new angular js .we developing ng-cordova apps. facing problems page redirection. have 2 homesecond , detailspage pages.in homesecond have loadfeeds method using method data form server when page load. $scope.loadfeeds = function () { alert("start"); $http({ method : "get", url : 'http://192.168.3.118:2244/api/postpets/getdata' }).then(function mysucces(response) { var dogspostlists = response.data; $scope.dogspostlists = dogspostlists; }, function myerror(response) { alert(response); //console.log('err'+response.message); }); } $scope.loadfeeds(); we have button redrieciton detailspage code $scope.toggleimage = function (index) { $location.path("/page11"); } after

Highcharts pdf export not working when we export all charts in one -

i have used highcharts , have multiple charts export pdf. want show patterns in bar charts. have applied pdf showing blank. here code http://fiddle.jshell.net/vtexot2c/

python - Calculation in Kivy with inputs from several widgets (and output to a different one) -

i'm trying build app kivy asks numbers , returns calculation, need input numbers provided on different widgets. i've been searching way that, , seems can done objectproperty() or numericproperty(), can't figure correct way. barebone example (not working, obviously), below code app 2 numbers introduced , calculates sum. main.py is kivy.app import app kivy.uix.boxlayout import boxlayout class sumroot(boxlayout): pass class firstinput(boxlayout): pass class secondinput(boxlayout): pass class outputslide(boxlayout): def sum_of_inputs(self): self.resultado.text = str(float(self.first_input.text)+float(self.second_input.text)) class sumapp(app): pass if __name__ == '__main__': sumapp().run() and sum.kv files is sumroot: <sumroot>: carousel: carousel first_slide: first_slide second_slide: second_slide third_slide: third_

java - RegEx capturing first (or only) group of 7 numbers max in a numeric/space string -

the exact rule (translate french, hope correct) : 6th rule : in case string numeric (eventually spaces) , first or series of numbers less or equal 7 character, serie our "title n°" "1122584 44588985 1211" must return "1122584" " xx 122585 12585" must not match " 122585 1258xx5" must not match " 12224457887 5896" must return "5896" " 1458 125828 " must return "1458" according me "the first or only" useless, if find 1 i'm ok, no matter if it's 1 'cause it's first. can't manage both checking if whole string numeric/space , finding group matching. i'll use regex in java 7, library : https://docs.oracle.com/javase/7/docs/api/java/util/regex/pattern.html edit : ^[0-9\s]*$ regex check numeric/space string ([0-9]{1,7}) captur group i can't figure how combine 2 expressions. ([0-9]{1,7}) capture group, , want make sure other character

How can we improve merge sorting algorithm? -

i trying modify merge sorting algorithm. per modification looks reduce best case , wort case time complexity o(nlogn) o (n). still working average time complexity. as know merge sort algorithm based on divided , conquer method. best case: input : 1 2 3 4 5 6 7 8 9 10 as per merge sort logic have split given input 2 half group. continue half process till group size length 1. after split go merge process in fact if number sorted. think can remove merging process adding simple 1 condition condition : check if left half of nth element less right half of first element. if yes in sorted no need compare 2 half. eg: l: 1 2 3 4 5 r: 6 7 8 9 10 if l[4] < r[0]: #two half in sorted order else #run merge algorithm wort case: input: 10 9 8 7 6 5 4 3 2 1 as per merge sort logic have split given input 2 half group. continue half process till group size length 1. it split 2 half alway in sort order. in merge process reorder 2 half element

c# - Mongodb difference between MongoCollection vs MongoCollectionBase -

i try upgrade mongo c# driver.with 2.2.3 driver. mongocollectionbase comes , support async methods.if change collection mongocollection mongocollectionbase time lose abilities removeall,findallas etc,also many of method implementation change. actually shoud go on use mongocollection or switch mongocollectionbase. is there suggested repository sample mongodb c# driver 2.2.3

android - How to pass Adapter handle to another activity? -

i have bluetooth adapter handle in 1 activity , how pass activity. public bluetoothadapter ba; ba = bluetoothadapter.getdefaultadapter(); how can pass handle activity. you can use same code adapter in activity bluetoothadapter ba = bluetoothadapter.getdefaultadapter();

excel - VBA - How to Retrieves the column number and use it to fill another column? -

how make code work when column number dynamic? i want code work when of time need work col b , of times col c (the title stay same)? i tried use function don't think i'm doing right. public function getcolumn(str string, rng range) integer getcolumn = application.sheets("sheet1").match("supplier", "poc[#headers]", 0) end function sub i() numrows = cells(rows.count, "e").end(xlup).row = 2 numrows supplier = cells(i, 16).value select case supplier case "edlc", "anc", "edtd", "enc", "apasa p", "ebanrope", "evanc" getcolumn.value = "zaya" end select next end sub try this: sub test() dim supplier string dim poc string numrows = cells(rows.count, "e").end(xlup).row = 2 numrows supplier = cells(i, sheet1.rows(1).find("supplier").column)

xcode - iOS ipa for Enterprise project does not open app -

Image
i trying launch ios project enterprise account. first thing first, project running fine when run xcode. when download ipa archive(i created) server it appears open app on screen less second , closes it . i have tried various provisioning profiles: development -> ios app development distribution -> in house distribution -> ad hoc and combined above possible ways of archiving project: -> ad hoc deployment -> enterprise deployment -> development deployment only when archive ipa development works on phone, registered development device provisioning profile, not other phones. am missing out? there setting in xcode should change enterprise launch? update: device logs says: dyld error message: dyld message: library not loaded: @rpath/researchkit.framework/researchkit referenced from: /var/containers/bundle/application/6dbb2c29-b1ae-4ae0-aefb-abf4081467a5/beck chestionar.app/beck chestionar reason: no suitable image found. did find:

mysql - Normalisation of product/protocol review system -

i'm working on review system, reviews products shown based on outcome of questionnaire. example: what food (italian, french or fusion) which vegetables (spinach, tomato or broccoli) how money spend on dinner ($0-$10, $11-$20 or $21-$30) if selects italian, tomato, $0-$10, user see (for example) 20 types of pizza's, reviews other users shown. want show products have been reviewed exact same outcome of questionnaire (we call protocol). table: questions ----------------------------------- | id | question | ----------------------------------- | 1 | food | ----------------------------------- | 2 | vegetables you... | ----------------------------------- table: possible_answers ----------------------------------- | id | question_id | answer | ----------------------------------- | 1 | 1 | italian | ----------------------------------- | 2 | 1 | french | ----------------------------------- table: products -

multithreading - OmniThreadLibrary memory leak (consumption) on pipeline running from another thread -

i'm running pipeline (thread's pipeline omnithreadlibrary) thread , got memory leak or rather memory consumption. when application close it's ok , there no memory leak report ( reportmemoryleaksonshutdown := true; ). here example: click button 10 times , test app ~600 mb of memory. windows 7 x64, delphi xe6, latest omni source. it's bug? or need use code? uses otlparallel, otlcommon; procedure tform75.button1click(sender: tobject); begin // run empty pipeline threads parallel.&for(1, 100).execute( procedure(value: integer) var pipe: iomnipipeline; begin pipe := parallel.pipeline .stage(procedure(const input: tomnivalue; var output: tomnivalue) begin end) .run; pipe.cancel; pipe.waitfor(100000); pipe := nil; end ); end; edit 1: tested code processexplorer , found threads count @ runtime constant, handles count grown. if i'm insert application.processmessages; @ end of "for

How can I save an image with text overlaying it to the Gallery in Android Studio? -

we trying make app lets user upload image, write text on it, , save new image text. our current implementation use imageview hold image, use textviews write on top of it. what best way save image whole? below our current code. thanks help! :) protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_generator); final edittext toptextinput = (edittext)findviewbyid(r.id.edittoptext); final edittext bottomtextinput = (edittext)findviewbyid(r.id.editbottomtext); final textview toptextview = (textview)findviewbyid(r.id.toptext); final textview bottomtextview = (textview)findviewbyid(r.id.bottomtext); imageview = (imageview)findviewbyid(r.id.imageview2); button pickimage = (button) findviewbyid(r.id.button2); pickimage.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { intent photopickerintent = new intent(inte

php - Create zero values for missing items in foreach loop -

i have application extracts information mysql between 2 dates , returns associative array. producing graph information have dates missing dates in database have no information return. cannot fix on mysql side have read access database. my database method retrieves associative array below: [0] => array ( [number_of_calls] => 151 [total_call_time] => 00:01:30 [average_call] => 00:02:00 [date(calldate)] => 2016-03-18 [direction] => outbound ) what hoping create daterange form below: //create data range array $begin = new datetime( $datefrom ); $end = new datetime( $dateto ); $end = $end->modify( '+1 day' ); $interval = new dateinterval('p1d'); $daterange = new dateperiod($begin, $interval ,$end); and use foreach loop iterate through selected dates of daterange , pull value associative array dates match , if not insert 0 values below:

c# - Keep focus on combobox after first selection -

i have form comboboxes , textboxes. if using keyboard key iterate through matching items in list, after first matching item, focus gets lost , moves next control (textbox) in form. works expected if form has no other controls switch after first selection.

Create a validate form in jquery -

how many types of functions or methods validate username , password? i have tried codes cannot understand. code different each other. this code works <script type="text/javascript"> $(document).ready(function() { $.validator.addmethod("email", function(value, element) { return this.optional(element) || /^[a-za-z0-9._-]+@[a-za-z0-9-]+\.[a-za-z.]{2,5}$/i.test(value); }, "please enter valid email address."); $.validator.addmethod("username", function(value, element) { return this.optional(element) || /^[a-za-z0-9._-]{3,16}$/i.test(value); }, "username 3-15 characters"); $.validator.addmethod("password", function(value, element) { return this.optional(element) || /^[a-za-z0-9!@#$%^&*()_]{6,16}$/i.test(value); }, "passwords 6-16 characters"); // validate signup form $("#signup").vali

git - can not push files to remote host -

i have started container (git service) using command... # create local directory volume. $ mkdir -p /var/gogs # use `docker run` first time. $ docker run --name=gogs -p 10022:22 -p 10080:3000 -v /var/gogs:/data gogs/gogs i able start git service , can check newly created repository browser... http://52.201.82.96:10080/shantanuo/testme but when follow these steps, error (permission denied): touch readme.md git init git add readme.md git commit -m "first commit" git remote add origin http://localhost:3000/shantanuo/testme.git git push -u origin master is docker issue? u should define volume datapoint, e.g. mkdir -p /var/gogs volume["/var/gogs"]

mysql - i want to update only one table field on name field value -

here there 1 table having field id, name,value. there 1 form field meta title, meta description, when insert values insert id name value 1 meta title testtitle(this value of textbox of meta title in form) 1 meta description testdes insert , delete function working correctly edit/update function not working properly. here update function : function mysql_updatemetapost($db, $columns) { $sql = ""; foreach ($columns $obj) { $sql = "update user_metapost set value = '{$obj['value']}' user_postid='" . $obj['user_postid'] . "' , name= '" . $obj['name'] . "'"; $result = mysql_query($sql, $db) or die(mysql_error()); } return $result; } columns array contain data of form. here when updating records name field value(meta title,meta description) should not change, here in code problem when update insert last value of colum

ruby on rails - Merge associated items from an activerecord relation result -

how combine example tag.has_many :images, through: :taggings bunch of tag s? something around unless theres simpler: images = ??? tag.where("name in (?)", tag_params).each |tag| images = images.merge(tag.images) end how about: images = image.joins(:tags).where(['tags.id in (?)', tag_params]) ?

Basil.js and ExtendScript in Indesign / How can I style textFrames? -

after svg elements placed/drawn in indesign, wanna change style some or elements . in example style textframes while drawn. example works. but how can change style after textframes placed? i wanna use skewing angle (applied textframe) , rotationangle (look in example -> forloop) i tried following: r.textframes.shearangle=20; , doc.textframes.add({shearangle:20}); ...but both don‘t work. #includepath "~/documents/;%userprofile%documents"; #include "basiljs/bundle/basil.js"; // script shows how load data // basil further usage. // document working needs saved @ least once. // data needs in folder next document // folder needs named "data" // take output of js console of estk function draw() { var doc = b.doc(); b.clear(doc); // clear doc b.units(b.mm); // use mm var ytextframe = 195; // scripts name// containing folder// name of script without extension // add .indd ext

java - Combining BundleDbPersistenceManager with FsBlobStore does not work as expected -

i have problem programmatically initialised bundledbpersistencemanager local blob store. can verify blob store initialised fsblobstore . problem starts bundledbpersistencemanager doesn't not respecting following values; bundledbpersistencemanager.setexternalblobs(true); bundledbpersistencemanager.setminblobsize("10"); i initialise bundle bundledbpersistencemanager#init method seems correct way do. after point restoring backup however, data ends in db , created blob folder directory empty. wondering reason of bundledbpersistencemanager not respect blog store presence @ all? using 2.8 version however, tried upgrade latest version (2.12.1) didn't help. i couldn't manage find problem low level api, however, when used repositorycopier problems gone. can more stable , haven't encountered problem above (datastore's not respected) https://jackrabbit.apache.org/api/2.0/org/apache/jackrabbit/core/repositorycopier.html

javascript - Angularjs: onerror is not working in IE -

onerror not working in ie only, rest browser showing correctly. here code: <img src="<?php echo site_url(); ?>assets/uploads/{{obj.img}}" onerror="this.src='<?php echo site_url(); ?>assets/images/default_avatar.png'"/> my understanding: here trying use onerror when images available in uploads folder script need take default image show on browser. displaying default images though images available in uploads folder. , issue ie 10 & edge. working fine in crome , firefox.

DNS setup from Cloudflare to Amazon API Gateway -

i have website mydomain.com dns configured through cloudflare. in process of setting api accessible through api.mydomain.com the servers use hosted on digital ocean, use of features of amazon api gateway interface (i later migrating servers on amazon). api server same website (again later separated, effective record same digital ocean node). api gateway interface configured , can access fine through provided endpoint someamazonendpointurl.com/stage on amazon have created cloudflare distribution origin api.mydomain.com. has basic http https behaviours along query string parameters. set cname record on cloudflare point endpoint url. when try , access api.mydomain.com though chrome error: err_too_many_redirects does have idea might have misconfigured. realise bit of odd setup, stop-gap while migrate our servers on amazon. update i noticed had cname record in cloudfront api.mydomain.com. i've removed get: error request not satisfied. bad request. generated cloudfr

android - Mathematical Expression Editor Library / Plugins -

i gone through few(hostmath.com, mathjax, wirik, etc), looking libraries (free / paid) helps users in writing mathematical expressions on web, android, ios. mathjax library useful , supports majority of platforms.

How to improve query performance by two and more array fields in MongoDB? -

i have collection of objects have multiple array fields. like: { sponsors: { lead_sponsor: { name: "mark", type: "individual" } collaborators: [ {name: "company ltd.", type: "company"}, {name: "industry company ltd.", type: "company"} ] }, terms: ["some term", "some term 2", "some term 3"], keywords: ["word1", "word2", "word3", "word4"], description: "here might big text detailed description", status: "active", } how can optimize query next one? { status: "active", $or: [ {"lead_sponsor.name": /company/i}, {"collaborators.name": /company/i}, {"terms": /phrase/i}, {"keywords": /phrase/i}, {"description": /phrase/i}, ] } compound indexes cannot have more 1 arr

flowchart - What does the zig-zag arrow in the System Flows Chart indicate? -

Image
i have following situation required depicted systems flow chart: my attempt @ drawing these diagrams figure out following 4 things: 1) input= sales transaction 2) process= verification of credit card 3) output= reciept 4) stored data= prices, product , transaction files how involve central computer? the model answer problem is: i've looked several legends describe common symbols used in system flowcharts, i've never come across circle , zig-zagged lines. know proper definitions these 2 symbols. per knowledge, can't represent input, document or storage system. they? lastly, please share resource learning , practising system flow chart diagrams or maybe heuristic 1 can use solve such problems? so zig-zag line communication link, found there (page 3), maybe depends on tool working with. that zig-zag symbol represents transmission of data 1 location via communication lines. also circle/elipse stands beginning, end, or point