Posts

Showing posts from August, 2010

stored procedures - Dapper mapping column with a property in the model having a different name and type -

i have model model: public class member { #region public property public int id { get; set; } public string lastname { get; set; } public string firstname { get; set; } public accountstate accountstate { get; set; } public godfathertype godfathertype { get; set; } } accountstate , godfathertype both 2 eumerates: public enum accountstate { notactivated = 0, activated = 1, desactived = 2, } public enum godfathertype { undefined=0, unknown = 1, correct = 2, } in database have id, lastname, fistname, tinyint accountstateid et smallint godfathertypeid, don't change stored procedure how can map class member database?? actually attributes id, lastname, fistname when execute stored procedure code: public sealed class dbcontext : idbcontext { private bool disposed; private sqlconnection connection; public dbcontext(string connectionstring) { con

Ruby - API RestClient - JSON -

just getting started api testing , struggling, used doing front end selenium web-driver tests, however, need head around api testing. i kind of understand basics such get data url , post post data url, think correct, however, wrong. the issue having below: response = restclient.post 'http://jsonplaceholder.typicode.com/posts', {:title => 'mr', :first_name => 'bob', :second_name => 'smith'} data1 = json.parse(response) p data1 so assigning restclient.post response variable , posting hash key, value pairs url? using json parse response , printing response console. need extract each value hash , print each value console shows data mr bob smith. instead of {:title => 'mr', :first_name => 'bob', :second_name => 'smith'} print "#{ data1[ :title ]} #{data1[:first_name]} #{data1[:second_name]}"

cuda - Does CudaMallocManaged allocate memory on the device? -

i'm using unified memory simplify access data on cpu , gpu. far know, cudamallocmanaged should allocate memory on device. wrote simple code check that: #define type float #define bdimx 16 #define bdimy 16 #include <cuda.h> #include <cstdio> #include <iostream> __global__ void kernel(type *g_output, type *g_input, const int dimx, const int dimy) { __shared__ float s_data[bdimy][bdimx]; int ix = blockidx.x * blockdim.x + threadidx.x; int iy = blockidx.y * blockdim.y + threadidx.y; int in_idx = iy * dimx + ix; // index reading input int tx = threadidx.x; // thread’s x-index corresponding shared memory tile int ty = threadidx.y; // thread’s y-index corresponding shared memory tile s_data[ty][tx] = g_input[in_idx]; __syncthreads(); g_output[in_idx] = s_data[ty][tx] * 1.3; } int main(){ int size_x = 16, size_y = 16; dim3 numtb; numtb.x = (int)ceil((double)(size_x)/(double)bdimx) ; numtb.y = (int)ceil((double)(size_y)/(double)bdim

sql - Assign values from an array to specific PHP variables -

i trying use php select values sql server db , assign values specific parameters. the table selecting looks this: **columnname1 columnname2** datarow1col1, datarow1col2 datarow2col1, datarow2col2 datarow3col1, datarow3col2 datarow4col1, datarow4col2 i trying create variable equal datarow3col2 has columnname1 = datarow3col1. is possible? here have far: $sql = "select * table id = {$id}"; $stmt = sqlsrv_query( $trpconn, $sql ); if( $stmt === false) { die( print_r( sqlsrv_errors(), true) ); } $data = array(); while( $row = sqlsrv_fetch_array( $stmt, sqlsrv_fetch_assoc) ) { $data[] = $row; } sqlsrv_free_stmt( $stmt); thank you $sql = "select * table id = {$id}"; $stmt = sqlsrv_query( $trpconn, $sql ); if( $stmt === false) { die( print_r( sqlsrv_errors(), true) ); } $data = array(); while( $row = sqlsrv_fetch_array( $stmt, sqlsrv_fetch_assoc) ) { $data[$row['columnname1']] = $row['

javascript - InvalidValueError: initAutocomplete is not a function Google Places and Autocomplete API -

hope can i've hit wall, i'm quite new using google's places apis. i'm not going post code yet code works fine when 2 pieces describe run in isolation. i using google's places in addition autocomplete api working javascript examples provided google. initially had following script @ bottom of document: <script src="https://maps.googleapis.com/maps/api/js?&libraries=places&callback=initautocomplete" async defer></script> and script @ top of document: <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> this gave me the, "you have included google maps api multiple times on page. may cause unexpected errors." after looking merged both this: <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&callback=initautocomplete&sensor=false"></script> however, have done this, receive following errors:

Using xp_cmpshell with variable in SQL Server -

i want use xp_cmdshell ping servers. created procedure have little problem, need select server ip table created. i created cursor server ip table don't know how use @ip varchar variable ping command. this syntax didn't work: execute xp_cmdshell 'ping @ip' you cannot reference parameters directly within xp_cmdshell, have concatenate value when creating command. recommend reading: https://msdn.microsoft.com/en-us/library/ms175046.aspx in example, like: declare @cmd nvarchar(4000); set @cmd = 'ping ' + @ip; exec xp_cmdshell @cmd;

javascript - Multiple series data Highcharts line -

Image
the result of query use display 3 column (country, date, items). php code side $res = db_query($sql); $dat = array(); while($r = db_fetch_array($res)){ $dat[]= array($r['date'], $r['items'], $r['country']); } // armar $start_date = ''; if(count($dat)>0){ $s = split(' ',$dat[0][0]); $ss = split('-',$s[0]); } // cada objeto en $dats es una grafica $dats[] = array('type'=>'line', 'name'=>$q['title'], 'pointinterval'=>24 * 3600 * 1000, 'pointstart'=>mktime(0,0,0,$ss[1],$ss[2],$ss[0])*1000, 'data'=>$dat) ; //echo "$sql"; echo json_encode($dats,json_numeric_check); my javascript code : function loadline(_data){ $('#line_container').highcharts({ chart: {zoomtype: 'x',spacingright: 20}, title: { text: 'monthly created items'}, subtitle: {tex

c++ - Encrypt/Decrypt image file using ElGamal -

i trying encrypt , decrypt image file elgamal in c++. has use elgamal encryption. want save both encrypted file , recovered file. using crypto++ libraries encryption/decryption part. here have far. autoseededrandompool prng; elgamal::decryptor decryptor; decryptor.accesskey().generaterandomwithkeysize(prng, 2048); const elgamalkeys::privatekey& privatekey = decryptor.accesskey(); elgamal::encryptor encryptor(decryptor); const publickey& publickey = encryptor.accesskey(); string ofilename = "test.bmp"; string efilename = "test.enc"; string rfilename = "test-recovered.bmp"; filesource fs1(ofilename.c_str(), true, encryptor.createencryptionfilter(encryptor.encrypt, new filesink(efilename.c_str()))); filesource fs2(efilename.c_str(), true, decryptor.createdecryptionfilter(decryptor.decrypt, new filesink(rfilename.c_str()))); i stuck @ encryption , decryption part. appreciated! your problem you're trying encrypt arbitrarily lar

@Controller no longer using spring.data.rest.base-path variable for REST URL for @RequestMapping -

i created @restcontroller @entity objects rest url being set correctly using spring.data.rest.base-path variable set in application.peroperties /api @requestmapping("someendpoint") not using variable. example for @entity class user rest endpoint located at: `http://localhost:8081/api/users' but when try access someendpoint : 'http://localhost:8081/api/someendpoint' i response of: response status http/1.1 404 not found body "timestamp":1461267817272,"status":404,"error":"not found","message":"no message available","path":"/api/someendpoint"} instead endpoint of rest service located @ 'http://localhost:8081/someendpoint' response: http/1.1 200 ok controller class @restcontroller public class homecontroller { @requestmapping(value = "/") public string index() { return "index"; } @requestmappin

windows - Powershell Script fails with "Read and Prompt Functionality is not available" -

i running series of remove-netipaddress , new-netipaddress powershell commands. run fine in interactive mode locally on machines. when run through ansible, fail prompt user confirm actions. i have tried -force, -confirm:$false no avail. when use them, plays hang. does know how "interactive" powershell commands working? i don't have access cmdlets atm if indeed behaves in such way can't prevent prompt work around it: run command in background job , kill after time period (this not job done said sometimes prompts @ least have script unblocked). implement 1 of console automation methods described here .

java - Capture, store and retrieve photo in activity -

i have problem, can't fix. have spent day today trying work, can't , out of ideas, decided ask help. i not experienced java/android developer bare me! also, have looked around google , stackoverflow answers, none of helped me. the problem regards photo capturing android. have activity, can "create" new item later on stored in database. can pass name , location, take photo binds it. when press "add" saved database. works, except camera intent. want able take photo in activity, binds "object" i'm creating, later on can view photo when click on particular "object" on list. have permissions (write , read) in androidmanifest, still dont help. <uses-permission android:name="android.permission.read_external_storage" android:maxsdkversion="18" /> <uses-permission android:name="android.permission.write_external_storage" android:maxsdkversion="18"

Using Dates in R -

this question has answer here: how convert date string csv file date format [duplicate] 1 answer i have csv file columns dates. have imported file using code: rx <-read.csv ("test.csv", sep = "," , header = true) , want convert field start_date date format can use date ranges split data set. in csv file field in format '01/01/2015' any in doing great. thanks i agree imo. can convert using: rx$start_date = as.date(rx$start_date, format = "%d/%m/%y")

Distributing a Java application with an Embedded Apache Derby database -

so have java application uses apache derby embedded database store information regarding user. i built application in netbeans, , resides within dist folder, folder contains executable jar , apache database, , lib folder. can launch application selecting executable jar don't want distribute folder users, rather have single exe user can select instead of giving them folder has executable jar and other folders within it. have been looking tools launch4j don't need. is possible create exe contains derby database? edit also need write database store users details.

python - My QGridLayout in PyQt doesn't show all elements, or in the right places -

Image
when @ mainwindow in qt designer, see however, when compile ui file python code, take match object (a qgroupbox "champion" title, inside match history), , port on can build many of these things , add them scroll area (match history) , run this the group box ends shortly after bottom of window, doesn't go on forever, , have confirmed in code width , height of group box set correctly. i've confirmed match object indeed have 10 slots , has items in after being built, problem doesn't right @ runtime. what's going wrong? here buildmatch method: def buildmatch(self, summonerid, matchindex, matchid, matchwidth, matchheight): # method takes matchindex , matchid input, builds match object, , returns it. part of # building each match object, method calls calculatematchstatistics() , calculateaverages. might # prudent later call self.calculateaverages() once, rather every time, i'm not sure. # globals: none # check whether have matc

ruby - Regex to remove p tags within li tags and td tags -

i have html content: <p>this paragraph:</p> <ul> <li> <p>point 1</p> </li> <li> <p>point 2</p> <ul> <li> <p>point 3</p> </li> <li> <p>point 4</p> </li> </ul> </li> <li> <p>point 5</p> </li> </ul> <ul> <li> <p><strong>sub-head : </strong>this para followed heading, para followed heading, para followed heading, para followed heading</p> </li> <li> <p><strong>sub-head 2: </strong></p> <p>this para followed heading, para followed heading, para followed heading, para followed heading</p> </li> </ul> i want remove <p>&</p> tags between <li>&</li> irrespective of position between <li>&</li>. need remove p tags between td tags inside table. this controller code far: nogo={"<li>

javascript - JQuery Autocomplete search both to letters -

i implemented autocomplete fetch data ajax post database , add them autocomplete item. shown below jquery.ajax({ url: "--url--", datatype: 'jsonp', success: function(data){ jquery("#location_finder").autocomplete({ source: function( request, response ) { var lookup = jquery.ui.autocomplete.escaperegex( request.term ); var matcher = new regexp( "^" + lookup, "i" ); response( jquery.grep(data, function(item){ return matcher.test(item); })); } }); }, }); the data after post come : data = ['berti','simon','Çarli','cherpa']; while doing typing in input field letter "c" "cherpa" shown try show "Çarli" user. how can handle , give option user both letter "c" , "Ç"? in advance.

JMeter treating "${COOKIE_[cookiename]}" as a string -

i have looked @ numerous examples of setting properties cookies, , seem indicate using beanshell postprocessor, should able following, given cookie named 'foo'. props.put( "foocookie", "${cookie_foo}" ); however, when try write value console, see here... print( props.get( "foocookie" ) ); ... value string ${cookie_foo} if dollar/curly bracket notation not being parsed. i feel must missing painfully obvious here, after several hours of fighting this, bringing experts. advice appreciated. edit: adding bit more detail. layout of test plan test plan user defined variables http cookie manager http request defaults login thread (setup) [page request - login post] http header manager beanshell postprocessor [more page requests] and indeed have cookiemanager.save.cookies=true set in jmeter.bat file launching with. do have http cookie manager in test plan? if not, nee

Javascript not reading array items beginning with 0 -

i want give genetic algorithms chance can't seem find solution problem. this code: var encodings = { 0000: 0, 0001: 1, 0010: 2, 0011: 3, 0100: 4, 0101: 5, 0110: 6, 0111: 7, 1000: 8, 1001: 9, 1010: "+", 1011: "-", 1100: "*", 1101: "/" }; var chromosome = ""; (var = 0; < 36; i++) { chromosome += math.round(math.random()); } var chromarray = chromosome.match(/.{1,4}/g); document.write(chromarray + "<br>"); (var o = 0; o < 9; o++) { document.write(encodings[chromarray[o]]); } if run code, see there lot of undefineds in output. cause this? thanks! you should convert keys of object strings it should be: var encodings = { "0000": 0, "0001": 1, "0010": 2, "0011": 3, "0100": 4, "0101": 5, "0110": 6, "0111": 7, "1000"

css - how can I do an image overlay without fading text? -

i'm trying have image overlay , text on it. overlay have works fine, text fading don't want. i'd text stay same. here of code html: <div class="hero"> <div class="overlay"> <div class="header"> <h1 class="overlay-text"</h1> <p class="text-center overlay-text">some content here</p> </div> </div> </div> css: .hero { background-image: url('http://localhost:3000/3b1425242c422b429f78f272b0a4c0f7.jpg'); background-size: cover; position: relative; display: block; min-height: 101vh; color: white; } .hero:after { content: ' '; position: absolute; left: 0; right: 0; top: 0; bottom: 0; background-color: rgba(0,0,0,.2); } .overlay-text { z-index: 200; } .overlay-text:after { z-index: 200; } .overlay text tried, doesn't anything. here little examp

arrays - Python split list of items according to a weighting -

suppose have list of items, let's integers, split in near equal sized sub lists. that's easy numpy... mylist = range(30) numpy.array_split(mylist, 3) ....or custom code.... nsublists = 3 sublist =[] = 0 item in mylist: in range(nsublist): sublist[i].append(item) if > nsublists: = 0 else: = + 1 but suppose don't want items distributed equally between subsists. suppose, want them distributed according weighting e.g. wgtlist1 = 20% wgtlist2 = 30% wgtlist3 = 50% where % show fraction of items in original list want in each sub list. if list doesn't split evenly according percentages or fractions can closest integer split. what's best way apply such weightings list split in python? i no expert in python, programmatic solution can think of this: def split(original_list, weight_list): sublists = [] prev_index = 0 weight in weight_list: next_index = math.ceil( (len(my_list) * weight) ) sublists

c - Casting pointer to void when printing -

i've been trying work through c fundamentals lately try , build basic understanding of lower level languages. in 1 of documents i've encountered ( a tutorial on pointers , arrays in c ) author uses void pointer in printf statement: int var = 2; printf("var has value %d , stored @ %p\n", var, (void *) &var); and states reason: i cast pointers integers void pointers make them compatible %p conversion specification. however, omitting (void *) not result in error or warning, either compiling , running or running through valgrind . int var = 2; printf("var has value %d , stored @ %p\n", var, &var); is casting void here considered best practice or standard, or there more sinister afoot? since printf variadic function, declaration specifies type of first parameter (the format string). number , types of remaining parameters required match format string, it's you, programmer, make sure match. if don't, behavior undefi

sql - PostgreSQL: Finding the total line total for each product that was sold in the largest order? -

i'm college student taking database course, using postgresql. there 1 question seem's give me trouble. here 2 tables: table1-orders fields-id, order_date, customer_id, credit_card_number, cvv, , order_total table2-order_lines fields-id, order_id, product_id, quantity, sell_price, , line_total here question: what total line_total each product sold in largest order? (largest order_total). enter 0 if product not in largest order. make sure enter both decimal places. so far, syntax have: select product_id, sum (line_total * (1) * quantity) order_lines group product_id; i able output product_id total sum of line_total wondering how total line_total each product sold in largest order. should find id of largest order based on order_total? use sub query merge the 2 tables final answer? using sell_price field syntax have above? first need largest order. done taking first record ordered order_total desc : select * orders order order_tota

dockerfile - Docker using gosu vs USER -

docker kind of had user command run process specific user, in general lot of things had run root. i have seen lot of images use entrypoint gosu de-elevate process run. i'm still bit confused need gosu . shouldn't user enough? i know quite bit has changed in terms of security docker 1.10, i'm still not clear recommended way run process in docker container. can explain when use gosu vs. user ? thanks edit: the docker best practice guide not clear: says if process can run without priviledges, use user , if need sudo, might want use gosu . confusing because 1 can install sorts of things root in dockerfile , create user , give proper privileges, switch user , run cmd user. why need sudo or gosu then? dockerfiles creating images. see gosu more useful part of container initialization when can no longer change users between run commands in dockerfile. after image created, gosu allows drop root permissions @ end of entrypoint inside of container

c# - Scintillanet, how to save its text to a file? -

i programming code editor in c# using visual studio , use scintillanet text editor in program, want user able save text editor file. if used richtextbox, code saving file have been: richtextbox.savefile(savefile1.filename, richtextboxstreamtype.richtext); now tried scintilla editor: scintilla.savefile(savefile1.filename, richtextboxstreamtype.richtext); but got error: scintillanet.scintilla not contain definition savefile , no extension method savefile"... what's appropriate code/method saving text scintilla editor file. can tell me? thank you

r - How does ggplot2 density differ from the density function? -

Image
why following plots different? both methods appear use gaussian kernels. how ggplot2 compute density? library(fueleconomy) d <- density(vehicles$cty, n=2000) ggplot(null, aes(x=d$x, y=d$y)) + geom_line() + scale_x_log10() ggplot(vehicles, aes(x=cty)) + geom_density() + scale_x_log10() update: a solution question appears on here , specific parameters ggplot2 passing r stats density function remain unclear. an alternate solution extract density data straight ggplot2 plot, shown here in case, not density calculation different how log10 transform applied. first check densities similar without transform library(ggplot2) library(fueleconomy) d <- density(vehicles$cty, from=min(vehicles$cty), to=max(vehicles$cty)) ggplot(data.frame(x=d$x, y=d$y), aes(x=x, y=y)) + geom_line() ggplot(vehicles, aes(x=cty)) + stat_density(geom="line") so issue seems transform. in stat_density below, seems if log10 transform applied x variable before densi

c++ - Boost Linking Issues - Multiple Versions -

i writing c++ application has read binary .mat file. need use libmat , libmex (note not using mex files though). trying use boost::program_options handle parsing command line arguments since non-gui application. using cmake handle build environment. the version of boost working 1.59. however, when try link in program_options, cmake finding boost::program_options library in matlab libraries , matlab libraries require boost 1.49. when try run compiled application, crashes because of using headers 1.59 libraries matlab's copies of 1.49. have ideas how can use 2 versions of boost since matlab not work 1.59 , matlab did not include include files 1.49. if application crashes, means sadly 1.49 , 1.59 not binary compatible, way can work force application use 1.59. there might 2 options: force cmake use 1.59 libraries, setting boost_librarydir variant cmake. force cmake use 1.59 libraries, , static versions of them, additionally setting boost_use_static_libs . i don

algorithm - C : Sum of reverse numbers -

so want solve exercise in c or in sml can't come algorithm so. firstly write exercise , problems i'm having can me bit. exercise we define reverse number of natural number n natural number nr produced reading n right left beginning first non-zero digit. example if n = 4236 nr = 6324 , if n = 5400 nr = 45. so given natural number g (1≤g≤10^100000) write program in c tests if g can occur sum of natural number n , reverse nr. if there such number program must return n. if there isn't program must return 0. input number g given through txt file consisted 1 line. for example, using c, if number1.txt contains number 33 program instruction : > ./sum_of_reverse number1.txt could return example 12, because 12+21 = 33 or 30 because 30 + 3 = 33. if number1.txt contains number 42 program return 0. now in ml if number1.txt contains number 33 program instruction : sum_of_reverse "number1.txt"; it return: val = "12" : string the

html - Enter doesn't always generate a LF -

i have div i've set contenteditable = "true". when enter text div enter @ end of line generate cr not lf. times doesn't generate lf, lf generate automatically if type something. if display else on screen seems drop mode both cr , lf generated enter in editable div. know be? thanks.

algorithm - The Great Tree list recursion program -

i faced interesting problem called great tree-list problem. problem follows : in ordered binary tree , each node contains single data element , " small " , " large " pointers sub-trees .all nodes in "small" sub-tree less or equal data in parent node. nodes in "large" sub-tree greater parent node. , circular doubly linked list consist of previous , next pointers. the problem take ordered binary tree , rearrange internal pointers make circular doubly linked list out of it. " small " pointer should play role of " previous " , " large " pointer should play role of " next ". list should arranged nodes in increasing order. have write recursive function & return head pointer new list. the operation should done in o(n) time. i understand recursion go down tree, how recursively change small , large sub-trees lists, have append lists parent node. how should approach problem?.. need direction so

bluetooth lowenergy - How to turn on Peripheral mode in Android -

i creating application send ble advertisement in android. using intrinsyc eval kit android (snapdragon 805) apq8084. has android os version of 5.1.1 seems peripheral mode not on. because of not able send advertisement beacon it. is there way turn on peripheral mode in android? thank you,

MongoDB have an integer always be positive -

is possible enforce field , have mongodb have positive value integer field? ideal if increment wouldn't make number negative. you can't able restrict data input/output on mongodb, need in program/code

javascript - I want that "mousewheel event delay" -

i want that.. mousewheel event delay example...i run wheeldown..so change "bg_02". change bg_05.. want delay 1 wheeldown , change bg_01 -> bg_02 1 wheeldown , change bg_02 -> bg_03 ... wheeldown change bg_01 -> bg_04 or wheeldown count ++ sorry english little script // wheel function wheel(){ if (event.wheeldelta >= 120){ wheelup(); return; } else if (event.wheeldelta <= -120){ wheeldown(); } } var bgspot = $('.bg_spot'); var bgspot_cnt = bgspot.length; bgspot.eq(0).addclass('spot_on').css('top','0'); // down function wheeldown(i){ $('.spot_on').addclass('move_top'); $('.spot_on').next().css('top','0'); $('.spot_on').next().addclass('spot_on').prev().removeclass('spot_on'); } css .bg_spot{position:fixed;top:100%;right:0;bottom:0;left:0;z-index:10;width:100%;height:100%; -webkit-transition: 0.6s ease; -moz-tr

python How would I divide this? -

any ideas on how divide (trying average of something) import re print(sum(float(re.sub(r"[^\d.]", "", post.text)) post in posts)) this works me. import re posts = ['1test', '23test', '15test'] r = re.compile('(^\d)') print sum([float(r.match(post).group(1)) post in posts])/len(posts)

html - Determine if list of bulk URLs are dead, live, or parked -

there's list of 100s of urls need checked determined if sites live (someone has put own content, if landing), unreachable, or parked. unreachable self explanatory, distinguishing between actual user content , parked domain trickier. mean who's hosting domain through godaddy , uses default landing page versus hosted site unique content landing page. using http codes (2xx,3xx,4xx,etc) isn't reliable. know of solution? doesn't need 100% accurate in instances, accurate when says it's accurate in order minimise manual checking. the best solution can come seeing site registered , comparing code against other sites registered there matches >.9 or effect. clunky. are there ready-made solutions problem? if not, there more efficient methodology?

Rails, same piece of code won't work with 3.2 -

so have on erb: <%= fields_for camera, :index =>camera.id |field|%> <%= field.check_box :alertflag %> and on controller: @camera = camera.update(params[:camera].keys, params[:camera].values) and works on 1 server have rails 3.0.9, reason doesn't work same way on 1 server have rails 3.2. the params hash on 3.0.9: camera%5b10%5d%5balertflag%5d=0 on 3.2: camera%5balertflag%5d=0 so index missing. the index option supported in both rails versions. when comparing source code of formhelper module in 2 rails versions becomes clear fields_for method signature has changed from: def fields_for(record_or_name_or_array, *args, &block) in rails 3.0 , to def fields_for(record_name, record_object = nil, fields_options = {}, &block) in rails 3.2 . so if need pass options (e.g. index ), must pass the 3rd argument method now, following should work: <%= fields_for :camera, camera, :index => camera.id |field| %>

javascript - How to Marry Local apache web domain? -

i bought domain on internet, want on domain put application. application developed on sails.js, , made virtual host apache2 using module mod_proxy. how do on domain bought on internet, put application? my virtual host is: namevirtualhost 111.11.11.111 <virtualhost *:80> servername app.domain.com.ve serveralias www.app.domain.com.ve serveradmin 111.11.11.111:1337 rewriteengine on proxypass / http://111.11.11.111:1337/ proxypassreverse / http://111.11.11.111:1337/ customlog /home/user/app/apache2log/accessapp.log combined errorlog /home/user/app/apache2log/errorapp.log </virtualhost> and /etc/hosts: 111.11.11.111 www.app.domain.com.ve you isp provide administration panel update a record . need update dns records point server application hosted. you need host in datacenter. try aws/azure/google cloud/linode provides small server , provides external network interface on internet. publish application on host. shou

scrapy - content exists, but xpath could not find it, why? -

i using "scrapy shell" test xpath. looked like: scrapy shell https://item.taobao.com/item.htm?spm=a219e.1191392.1111.1.fglwuh&id=40978681727&scm=1029.newlist-0.1.50002766&ppath=&sku=&ug=#detail the xpath looked like: response.xpath("//a[@class='shop-name-link']") the result none, page content contains <a class="shop-name-link" href="//shop103857282.taobao.com" target="_blank" data-goldlog-id="/tbwmdd.1.044">长岛小两口创业</a> why? if have problems finding results xpaths use firepath or chrome browser dev tools investigate page source. remember scrapy spider sees page source unrendered. not rendered javascript. view source spider sees use firepath in browser javascript disabled. i cannot see link class shop-name-link in page linked in question. either you're not giving proper link or element displayed after user action, or page shown in different ways diff

c++ - Inheritance: use inherited methods from parent pointer -

i'm working production code, of cannot safely modify (without breaking things). issue use specific method, 1 of parameters of pointer class. class parameter not want to. so wrote sub-class of class , attempting call above function, still uses parent class' methods. i have mwe below: #include <iostream> class parent { public: parent() {}; void method() {std::cout<<"in parent\n";} }; class child : public parent { public: child() {}; void method() {std::cout<<"in child\n";} }; void secondmethod(parent* pptr) { pptr->method(); } int main() { child c = child(); parent* parentptr = &c; c.method(); parentptr->method(); secondmethod(parentptr); secondmethod(&c); return 0; } in above example running output of course: in child in parent in parent in parent i believe issue slicing? i'm casting pointer of parent class, considered parent. i have seen ways around

performance - Android drawing to bitmap canvas slow -

scenario have imageview fills phone screen. every based on touch events draw offscreen bitmap , display on imageview. code display is bitmap b = bitmap.createbitmap(globals.screenwidth,globals.screenheight, bitmap.config.argb_8888); canvas canvas = new canvas(b); then bunch of paint settings, drawrects, , font outputs. once bitmap/canvas updated show onscreen calling imageview iv = (imageview)findviewbyid(r.id.mainview); iv.setimagebitmap(b); this works slow. there not lot of drawrects , font updates (maybe @ 100 drawrects , 5 or 6 lines of text), can take 400 ms draw. when should seem instant user when touch screen. any other ways of getting offscreen bitmap and/or canvas display fast onscreen?

wordpress - What's the right format to create a PHP DateTime instance of '2016.04.30 PM 7:30' via DateTime::createFromFormat? -

i'm working on wordpress project should custom post metadata, convert datetime instance, , math it. when echo get_post_meta, looks follows. 2016.04.30 pm 7:30 the format i'm using datetime instance follows. y.m.d g:i but return value of datetime::createfromformat false . // 2016.04.30 pm 7:30 $start_at = datetime::createfromformat( 'y.m.d g:i', get_post_meta(get_the_id(), 'as_date', true)); if ($start_at === false) { echo 'false format: ' . get_post_meta(get_the_id(), 'as_date', true); } else { echo $start_at->gettimestamp(); } the result false format: 2016.04.30 pm 7:30 . what missing here? think must trivial can't through. testing, found problem character in format 'a'. poked around , found bug in php (that apparently not bug @ all!) going through source code , looks not parse , pm until after hour has been parsed. probably best bet quick pass through regular expression move a

ios - How to integrate/use `WKWebView` plugin in PhoneGap application -

i have phonegap ios application in using angular kendo mobile framework build ui. i want use wkwebview in application instead of uiwebview. steps need follow so? i tried integrate adding wkwebview plugin in application see blank page , in logs errors loading html pages. you have install plugin this: cordova plugin add cordova-plugin-wkwebview and after in config.xml add this: <plugin name="cordova-plugin-wkwebview" /> <feature name="cdvwkwebviewengine"> <param name="ios-package" value="cdvwkwebviewengine" /> </feature> <preference name="cordovawebviewengine" value="cdvwkwebviewengine" />

r - shiny allowling users to choose which columns to display -

i dabbling datatable feature in shiny , interested in creating wellpanel or sidepanel lists columns of datatable , allows users choose columns want see on datatable. right code below displays columns of toy dataset mtcars library(shiny) runapp(list( ui = basicpage( h2('the mtcars data'), datatableoutput('mytable') ), server = function(input, output) { output$mytable = renderdatatable({ mtcars }) } )) i interested in providing users ability turn these columns either on or off using checkbox [1] "mpg" "cyl" "disp" "hp" "drat" [6] "wt" "qsec" "vs" "am" "gear" [11] "carb" any on addressing issue appriciated. in advance. my example uses checkboxgroupinput select multiple columns library(shiny) vchoices <- 1:ncol(mtcars) names(vchoices) <- names(mtcars) runapp(list( ui = basicpage(

Can I create a master function in Python to take a single line of other functions? -

i have 2 functions contain same code. 1 returns "true" if array passed in contains positive numbers while other returns "true" if array contains numbers divisible 10. i want combine these 2 functions function this: def master_function(array, function): in array: if function: result = true else: result = false break print(result) return result the part vary "function" in if statement. when write functions missing line don't called program executes. def positive_integers(array): >= 0 def divisible_by_10(array): i%10 == 0 the test code isn't executed either. master_function([10,20,30,35],divisible_by_10) your functions aren't returning anything, , need give them access i : def positive_integers(i): return >= 0 def divisible_by_10(i): return not i%10 def master_function(array, function): in array: if function(i):

How to rewrite this url in spring mvc in java -

from= demo/user.search_candidate.form?action=clickoncandidate&userid=25 to= demo/click_candidate enable filter in web.xml <filter> <filter-name>urlrewritefilter</filter-name> <filter-class>org.tuckey.web.filters.urlrewrite.urlrewritefilter</filter-class> </filter> <filter-mapping> <filter-name>urlrewritefilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>request</dispatcher> <dispatcher>forward</dispatcher> </filter-mapping> add following rule web-inf/urlrewrite.xml <urlrewrite> <rule> <from>^/demo/api.do?method=getuser&amp;uid=(.*)$</from> <to>/demo/api/user/$1</to> </rule> </urlrewrite> you can use tuckey urlrewritefilter for : add dependency if you're using maven <dependency> <groupid>org.tuckey</groupid> <artif

android - Right POJO Model -

how can create right pojo model needs?i want deal response 1 web server.result https://api.vid.me/videos/featured big,i need title,number of likes , url of video,how can correct right woring retrofit library? use few part of json , paste http://www.jsonschema2pojo.org/ generate pojo you. like { "status": true, "page": { "offset": 0, "limit": 20, "total": 1713, "currentmarker": null, "currentmarkerday": null, "currentmarkerdate": null, "nextmarker": "2016-04-21" }, "videos": [{ "video_id": "8771660", "url": "apfz", "full_url": "https:\/\/vid.me\/apfz", "embed_url": "https:\/\/vid.me\/e\/apfz", "user_id": "6747684", "complete": "s3: