Posts

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...