Posts

Is it possible to use BCP In with named pipe in SQL Server 2008 R2? -

i have input json file want load sql server table. following below steps: 1) convert json file flat structure using jq utility. ( http://stedolan.github.io/jq/ ) 2) store output of jq flat file 3) load flat file sql table using bcp bcp database.schema.table in "\\shareddirectory\inputfilename.txt" -t -s "server" -w -t ~ -r \n is possible skip step 2) , load output of jq directly sql server table using bcp? trying run below command: jqcommand | bcp database.schema.table in -t -s "server" -w -t ~ -r \n judging can see in msdn , seems bcp accepts files inputs. for windows, there special file called con used capture stdin (similar /dev/stdin ). try using that. jqcommand | bcp database.schema.table in con -t -s "server" -w -t ~ -r \n

Changing color JavaScript doesn't work -

my problem is: have 3 elements on list, , have keep changing text color when mouse hover. so building 3 different functions, because colors different. what did is: <script type="text/javascript"> var links = document.getelementsbyclassname("menuitems"); function firsthover() { links[0].style.color = "rgb(204, 0, 0)"; /*this avoiding setinterval delay*/ setinterval(function(){ if(links[0].style.color == "rgb(204, 0, 0)") { links[0].style.color = "rgb(235, 153, 153)"; } if(links[0].style.color == "rgb(235, 153, 153)") { links[0].style.color = "rgb(204, 0, 0)"; } },1150); } </script> the problem is: changes color once. i tried use hexadecimal color too, doesn't work. please patient, still novice. the problem small logical flaw. color change, changes right away. if first if statement evaluates true , color set rgb(235,...

ruby on rails - Call before_update if an attribute is filled -

what way call before_update trigger if particular attribute filled? here part of code: before_update { self.gravatar = gravatar.downcase } validates :gravatar, :on => :update, length: { maximum: 128 }, format: { with: valid_gravatar_regex }, allow_blank: true indeed want call downcase function on attribute if 1 filled in edit form. i have following error: undefined method `downcase' nil:nilclass which logical. like ? before_update { self.gravatar = gravatar.downcase if gravatar.present? }

transactions - How to integrate Square Payment in my website? -

i want integrate square api in website payments of products. please provide solution can integrate it. i beginner in square api , searched lot of things not found way integrate it. please give me answers if knows. try looking @ https://github.com/square/connect-api-examples examples on using square apis in few languages. hope helps!

highcharts - Show tooltip in column chart when hovering crosshair line -

using highstock ("stockchart"), tooltips each bar in column chart show if hovering "crosshair line" above actual bar. see example: $('#container').highcharts('stockchart', { chart: { alignticks: false }, rangeselector: { selected: 1 }, title: { text: 'aapl stock volume' }, series: [{ type: 'column', name: 'aapl stock volume', data: data, datagrouping: { units: [[ 'week', // unit name [1] // allowed multiples ], [ 'month', [1, 2, 3, 4, 6] ]] } }] }); stockchart jsfiddle example how achieve same result using highcharts column chart? example of similar highcharts example column chart can found here: $('#conta...

ruby - Customize Rails' Default Resourceful Route Path -

tl;dr i'd change default behaviour of rails resourceful routing, move create path resources it's post /resources/new rather /resources . the setup let's presume resourceful route specified so: # routes.rb resources :events the actual routes generated are: $ rake routes prefix verb uri pattern controller#action events /events(.:format) events#index post /events(.:format) events#create new_event /events/new(.:format) events#new edit_event /events/:id/edit(.:format) events#edit event /events/:id(.:format) events#show patch /events/:id(.:format) events#update put /events/:id(.:format) events#update delete /events/:id(.:format) events#destroy n.b. create action triggered post /events path. now, if want change path, can "manually", on per-resource basis: # routes.rb # i've placed routes in order,...

How to read a config file without keys in python -

so have created config file & need read data it. the config file looks like:- [sport] cricket soccer tennis where sport section name & rest keys. i able read file without values using allow_no_value=true option. my problem need print 1st record in sport section & store in variable. my code till now:- import configparser config = configparser.configparser(allow_no_value=true) config.read('sport.ini') val1 = config.get('sport') print val1 it shows me error as:- val1 = config.get('sport') typeerror: get() takes @ least 3 arguments (2 given) kindly let me know how 1st record config file & store in variable. you have pass key also >>>print(config.get('sport', 'cricket')) none or view key value pairs >>>config.items('s') [('cricket', none), ('soccer', none), ('tennis', none)]