Posts

Showing posts from January, 2015

amazon web services - Limit maximum time of query execution for a particular group in redshift? -

i have group of users in redshift. limit maximum time of query execution particular value. something similar statement_timeout , no 1 need write set statement_timeout 1000; before each session, , no 1 can overwrite value. you can via wlm queues. specific group of users can assigned queue , given wlm timeout . fwiw, i've not found wlm (workload management) worth added complexity , potentially idle resource.

width - Dropdown list UL box creates a margin on the left -

i began building website, make short: i'm making deadly simple dropdown menu isnt working out. make short, gave every element background color. know why boxes behave that, have own sizes. grey 1 wider should be. float:right doesnt seem work on both elements same. 1 further away other, should positioned right border. red border should disappear also: #dropdown{ display:block; float:right; background:#666; width:120px; } #logo-type{ height:90px; background-image:url("https://picload.org/image/rgrwoopr/logo_font.jpg"); width:90px; background-color:green; float:right; } #dropdown ul{ margin-top:91px; background-color:red; width:120px; } #dropdown ul li{ font-size:12px; width:120px; height:40px; background-color:black; list-style:none; text-align:center; } #dropdown ul li a{ color:white; text-decoration:none; } #dropdown ul li a:hover{ text-decoration:none; } #dropdown ul li:hover{

assembly - Dividing a negative number MASM -

i've written program that's sums bunch of numbers user , returns average, program gets stuck when try divide negative numbers. under impression dividing negative number allowed, i'm not sure problem here. include irvine32.inc ; constants min = -100 max = -1 1 = 1 .data num dword ? nums dword ? nums_message byte "total numbers: ",0 sum dword ? sum_message byte "sum: ",0 average dword ? average_message byte "average: ",0 current_loop dword ? spaces byte " ",0 invalid_msg byte "out of range, number must between [-100...-1]",0 temp dword ? .code main proc ; enter numbers displayed mov ecx, 0 enter_num: mov edx, offset prompt_2 call writestring call readint mov num, eax ; check if non-negative mov eax,

ios - What is the accuracy of the areasOfInterest property for a CLPlacemark object? -

i noticed when reverse geocoding location (latitude/longitude clplacemark), placemark(s) returned have areasofinterest string array property. is list ordered closest/most accurate areas of interest? other details should known property if use it?

c# - How to use this WebService in MVC ASP.NET -

i want use webservice ( *.asmx ) in mvc asp.net. created class: public class servicerouter : iroutehandler { private readonly string _virtualpath; private readonly webservicehandlerfactory _handlerfactory = new webservicehandlerfactory(); public servicerouter(string virtualpath) { if (virtualpath == null) throw new argumentnullexception("virtualpath"); if (!virtualpath.startswith("~/")) throw new argumentexception("virtual path must start ~/", "virtualpath"); _virtualpath = virtualpath; } public ihttphandler gethttphandler(requestcontext requestcontext) { return _handlerfactory.gethandler(httpcontext.current, requestcontext.httpcontext.request.httpmethod, _virtualpath, requestcontext.httpcontext.server.mappath(_virtualpath)); } } then, in routerconfig.cs , added: routes.add("routename", new route("service", new rout

ios - 'Use of unresolved identifier' -

in code: func didbegincontact(contact: skphysicscontact) { var firstbody:skphysicsbody var secondbody:skphysicsbody if (contact.bodya.categorybitmask < contact.bodyb.categorybitmask){ firstbody = contact.bodya secondbody = contact.bodyb }else{ firstbody = contact.bodyb secondbody = contact.bodya } if ((firstbody.categorybitmask & phototorpedocategory) != 0 && (secondbody.categorybitmask & aliencategory) != 0){ torpedodidcollidewithalien(firstbody.node as! skspritenode, alien: secondbody.node as! skspritenode) } } func torpedodidcollidewithalien(torpedo:skspritenode, alien:skspritenode){ print("hit") torpedo.removefromparent() alien.removefromparent() aliensdestroyed++ if (aliensdestroyed > 30){ var transition:sktransition = sktransition.fliphorizontalwithduration(0.5) var gameoverscene:skscene = gameoverscene(size: self.size, won: true) self

why doesn't this ruby code work -

here's practice question - write method take in number of minutes, , returns string formats number hours:minutes . def time_conversion(minutes) hours = minutes / 60 mins = minutes % 60 time = hours + ":" + mins return time end the following tests see if works. if return true means code works correctly. puts('time_conversion(15) == "0:15": ' + (time_conversion(15) == '0:15').to_s) puts('time_conversion(150) == "2:30": ' + (time_conversion(150) == '2:30').to_s) puts('time_conversion(360) == "6:00": ' + (time_conversion(360) == '6:00').to_s) sometimes true first 2 tests third test line shows false though code print out required. other times following error: string can't coerced fixnum (repl):4:in +' (repl):4:in time_conversion' (repl):1:in `initialize' please assist. the error refers line time = hours + ":" + mins hours & m

angularjs - How to pass empty params to express in a get? -

have route call angular, typically: server/a/b/c server side want query db req.params. trim , omit if a: '' or b : '' express not paths server//c. there way handle this? transform route /null/null/c that's ugly :s.

Node.js redirect CSS 302 Moved Temporarily -

Image
when use redirect : .use(function (req, res, next) { var url = req.originalurl; if (url != "/login" && !req.session.email) { res.redirect("/login"); } next(); }) it looks css files can not load correctly, want load status 200 instead of 302 1 : your middleware redirecting css requests. need make not that. you want put after static files middleware, won't run @ static files.

html - Jquery drag + drop issue -

i have following jsfiddle code (link below) . having problems fixing the items can dragged within white box area. scenario: user 1 box base , other user boxes should within user 1 white content div. if instance drag user 4 user 2 user 4 should within white content box of user 2 , on. @ moment drag grey part of user 2 box. any ideas on how setup divs? i know html setup can't think of how fix https://jsfiddle.net/euf1s9gc/3/ 'use strict' $(document).ready(function(){ var resp =[{"id":"1","name":"user","title":"1","parentid":"9","base":"1"}, {"id":"2","name":"user","title":"2","parentid":"1","base":"0"}, {"id":"3","name":" user","title":"3","parentid":"1","base":"0&quo

ios - How to test equality on two CBPeripherals in CoreBluetooth? -

so keeping pool of peripherals during scan devices. when discover peripheral, want first check whether peripheral in pool. if in pool want update handle have of peripheral. if not in pool want add pool. the problem corebluetooth no longer allows accessing uuid's peripherals. both of methods used access device uuid's deprecated in ios 7.1. so correct way test equality of peripherals in corebluetooth? yes, deprecated cbperipheral class. new "identifier" property added cbpeer superclass, cbcentral , cbperipheral inherit. so should use: peripheral.identifier.uuidstring you can check changes in ap here: https://developer.apple.com/library/ios/releasenotes/general/ios80apidiffs/frameworks/corebluetooth.html

python - EOF exception while using pexpect for ssh password prompt -

so wrote following after reading pexpect docs: import pexpect pexpect import popen_spawn child = popen_spawn.popenspawn("ssh -t -t root@server1") child.expect('password:') child.sendline('pwd') # send password now here's error i'm getting: traceback (most recent call last): file "c:\ssh_exp.py", line 4, in <module> child.expect('password:') file "c:\python27\lib\site-packages\pexpect\spawnbase.py", line 315, in expect timeout, searchwindowsize, async) file "c:\python27\lib\site-packages\pexpect\spawnbase.py", line 339, in expect_list return exp.expect_loop(timeout) file "c:\python27\lib\site-packages\pexpect\expect.py", line 102, in expect_loop return self.eof(e) file "c:\python27\lib\site-packages\pexpect\expect.py", line 49, in eof raise eof(msg) pexpect.exceptions.eof: end of file (eof). <pexpect.popen_spawn.popenspawn object @ 0x0000000

playframework - How do I get IntelliJ's Typescript assistance to resolve Angular2 installed from a WebJAR? -

i'm using sbt-typescript plugin let me use typescript assets in play. i've modeled project layout on the example one , import {injectable} "angular2/core" gives me red underline ts2307: cannot find module 'angular2/core' . in fact, angular 2 in target/web/node-modules/main/webjars/angular2 . play compiles .ts file without problem. what need configure in intellij looking in same place sbt angular2 ?

javascript - Add items from json encoded array to auto complete input box -

i have php file returning json encoded array , want show items in json array show in auto complete search box. code have in search3.php is: <?php include 'db_connect.php'; $link = mysqli_connect($host, $username, $password, $db); if(!link){ echo "db connection error"; } $output = '' ; $output2 = '' ; if (isset($_post['searchval'])){ $return_arr = array(); $searchq = $_post['searchval']; //$searchq = preg_replace("#[^0-9a-z]#i","",$searchq); $query = mysqli_query($link, "select * `organisations_info` `organisation_name` '%$searchq%'")or die("could not search!"); $count = mysqli_num_rows($query); if($count == 0){ $output = '<div>no results!</div>'; }else{ while($row = mysqli_fetch_array($query)){ $orgname = $row['organisation_name']; $orgid = $row['organisation_id']; $return_arr[] = $row['subscription_type&#

javascript - React renderToStaticMarkup and "Invariant Violation: Invalid tag" error -

i keep getting "invariant violation: invalid tag" errors when try convert jsx file js , generate html saving static html file. here test.js file: var fs = require("fs"); var babel = require("babel-core"); var react = require("react"); var reactdomserver = require("react-dom/server"); fs.readfile('./template.js', function(err, data) { var template = babel.transform(data, { "presets": ["es2015", "react"], "plugins": ["transform-es2015-modules-umd"] }); template = react.createelement(template.code); console.log(reactdomserver.rendertostaticmarkup(template)); }); here template.js file: const react = require('react'); module.exports = react.createclass({ render: function() { return <div>hello {this.props.name}</div>; } }); here console dump: bills-mbp:white-label bshack$ node test.js /users/bshack/sites/white-l

Android Studio Gradle build keeps on running for more than half an hour -

this week reinstalled os(ubuntu 14.04 amd64),in new os(same ubuntu) copied installed backup of android 2.0 , sdk, gradle build running more half hour click file goto settings ->build execution , deployment ->build tools -> gradle , there find 1 check box offline work , check check box . may building faster .

bluetooth - Where is the CTS Pin on Adafruit Bluefruit LE -

Image
we have got adafruit bluefruit le looks now interfacing lilypad atmega 328 same shown below link:: lilypad interfacing bluefruit for configuration of bluefruit using this link. here mentioned connect cts pin on bluefruit ground if not using it! but not able find cts pin on bluefruit. please suggest if have idea. on flora board cts pin connected ground on hardware level. cts not used on board default.

sql - Remove duplicate date in postgres -

my need unique value after concatenating 2 string values. below query. strings concatenated duplicated values coming. doing wrong? select ievent.event_type_id evt_type_id, ievent.event_value evt_value, ievent.event_date evt_dt, ievent.company, ievent.entity_key, row_number() on (order ievent.event_date desc) row_num ( select we.executive_id, we.event_type_id, sum(we.event_value) event_value, array_to_string(array_agg(distinct (coalesce(mc.aka_co_name,mc.company_name))),',') company, we.event_date, null entity_key wealth_event we, master_company mc mc.company_id = we.company_id , mc.is_active = 'y' , (we.event_value > 1 , we.event_value < 5000000000 , we.event_value not null , we.event_type_id in (1, 3, 4, 5)) , we.event_date <= trunc(current_date) , we.event_date > trunc(current_date) - 180 group we.event_date, we.executive_id,

r - How to display widgets inline in shiny -

Image
i have below code display widgets inline(in same row) in shiny div(style="display:inline-block; width: 150px;height: 75px;",selectinput("ddllgra", "function:",c('mean','median','sd','count','min','max'), selected='mean')), div(style="display:inline-block; width: 150px;height: 75px;",textinput(inputid="xlimitsmax", label="x-max", value = 0.5)) it coming out in ui, not in same line order. 1 in coming in upper side , other coming on lower side 1 same line. is there way correct misalignment? add vertical-align:top style rm(list = ls()) library(shiny) ui <- fluidpage( sidebarpanel( div(style="display: inline-block;vertical-align:top; width: 150px;",selectinput("ddllgra", "function:",c('mean','median','sd','count','min','max'), selected='mean')),

c++ - OPENCV desktop capture Part II -

continuing in previous post here opencv destop capture , hwnd2mat function, method capture desktop source in opencv create bitmap screen image hwnd2mat function. done. function create bitmap screen image.but gives weird effect trailing inside video, want normal video source more this one . i've try find cause it, don't know anymore. #include "opencv2/imgproc.hpp" #include "opencv2/highgui.hpp" #include <windows.h> #include <iostream> using namespace std; using namespace cv; mat hwnd2mat(hwnd hwnd) { hdc hwindowdc, hwindowcompatibledc; int height, width, srcheight, srcwidth; hbitmap hbwindow; mat src; bitmapinfoheader bi; hwindowdc = getdc(hwnd); hwindowcompatibledc = createcompatibledc(hwindowdc); setstretchbltmode(hwindowcompatibledc, coloroncolor); rect windowsize; // height , width of screen getclientrect(hwnd, &windowsize); srcheight = windowsize.bottom; srcwidth = window

python 2.7 - While Loop being interrupted when if statement is false -

i have piece of code meant ask blank word should , moves on next 1 if correctly guess. part working fine, if enter wrong answer should ask question again not doing that. instead python shell sits there blank, no error, nothing. can't see problem: while victory == false: if askq == answerx[counter]: newstring = newstring.replace(blank_list[counter],answerx[counter]) counter += 1 print newstring if counter < len(blank_list): askq = raw_input('what word ' + blank_list[counter] + '? ') if newstring == answers: print 'congratulations!' victory = true i think figured out! there may better way, worked: while victory == false: if askq == answerx[counter]: newstring = newstring.replace(blank_list[counter],answerx[counter]) counter += 1 print newstring if counter < len(blank_list): askq = raw_input('what word ' + blank_list

moodle - Customize the list of courses in the dashboard page -

Image
i'd modify list of courses ( course overview ), modify display of courses. i'd that: is there way save thumbnail each course in database, , display in dashboard of course list, each course it's own picture, according subject i have updated file moodledir\blocks\course_overview\renderer.php added static html image next each course in course settings form there option add images in "course summary files" you can upload image there , retrieve in renderer using function course_image($courseid) shown in example: https://gist.github.com/bmbrands/c1eb21dfa7f491b1205ea0ca806b5493

c# - SerialPort.Write() take a relatively long time to execute -

the function myserialport.write("hello") takes full millisecond execute. have added stopwatch code helps me understand execution time. there way program execute faster? can issue related serial port driver? using usb serial converter cable. baud rate = 115200 parity = none data bits = 8 stop bits = 1 if replace myserialport.write("hello") line empty loop runs 10000 times, executes instantly. therefore if me achieve similar speed execution of myserialport.write("hello") of immense help. in advance. private void button2_click(object sender, eventargs e) { stopwatch stopwatch = new stopwatch(); stopwatch.start(); myserialport.write("hello"); stopwatch.stop(); timespan ts = stopwatch.elapsed; textbox2.text = string.format("{0:00}:{1:00}:{2:00}.{3:00}", ts.hours, ts.minutes, ts.seconds, ts.milliseconds); }

Android: Set Margin for Edit Text in AlertDialog Box -

i trying create alert dialog box lollipop , going fine stuck in 1 section case of edittext i want edittext underline , margin left , right 20dp.for underline tried setbackground() , , working fine. but there problem setbackground() not work api level below 16. for setmargin tried final edittext input = new edittext(mainactivity.this); linearlayout.layoutparams lp = new linearlayout.layoutparams( linearlayout.layoutparams.wrap_content, linearlayout.layoutparams.wrap_content); lp.setmargins(30,0,30,0); input.setlayoutparams(lp); input.setgravity(view.text_alignment_gravity); input.setbackground(getresources().getdrawable(r.drawable.edit_text_line)); builder.setview(input); but edit text using full parent width. full code alertdialog.builder builder = new alertdialog.builder(this); builder.settitle("message"); builder.setmessage("do want to\n"+""+"exit app"); fi

objective c - iOS - Convert NSArray to float array -

i have array called self.gradientarray of colors. when print out looks this: gradientsarray: ( "uidevicergbcolorspace 0.333333 0.811765 0.768627 1", "uidevicergbcolorspace 0.333333 0.811765 0.768627 1" ) i want convert array cgfloat array. example this: cgfloat colors [] = { 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0 }; i tried , didn't work. i'm new objective-c , syntax please me. cgfloat colors [] = self.gradientarray; i want use cgfloat array in making gradients this: cggradientref gradient = cggradientcreatewithcolorcomponents(basespace, colors, null, 2); the gradientsarray appear array of uicolor , in case like: nsarray *gradientsarray = @[[uicolor redcolor], [uicolor bluecolor]]; cgfloat colors[gradientsarray.count * 4]; nsinteger index = 0; (uicolor *color in gradientsarray) { cgfloat red, green, blue, alpha; [color getred:&red green:&green blue:&blue a

MySQL: get only first row of each Distinct record -

is there way first(if there more one. see item # 1) title each item , empty string title column in case title doesn't exists (see item # 2, there no title) here table schemas. items --------------- id | created_by --------------- 1 xyz 2 abc elements ----------------- id | name ----------------- 1 title 2 description 3 type elements_text ------------------------------------------ id | item_id | elements_id | text ------------------------------------------ 1 1 1 test title 2 1 1 second title 3 1 2 description 4 2 2 test desc 5 2 3 first type 6 2 3 second type 7 2 2 desc expected output ----------------------------------------- item_id | element_name | element_text --------------------------------------

html - Table inside table ng-repeat not displayed correctly? -

i have 2 lines x 3 columnus table in which, in second row, adding table in every cell. in these tables, using angular ng-repeat display data. problem data not diplayed correctly. here code , screenshot of result. <tr> <td style="font-weight: bold"> europe </td> <td style="font-weight: bold"> europe </td> <td style="font-weight: bold"> europe </td> <td>...</td> </tr> <tr> <td style="font-weight: bold"> <table id="table3" class="table table-striped"> <tr> <th>customerid</th> <th>customeruserid</th> <th>environment</th> <th>time elapsed</th> <th>migrated </th> <tr ng-repeat="runeu in runmig24ineurope

ruby on rails - Return a number from collection_select -

i using input field collection, drawn array in model. works well, return different value actual column in table. i'm using simple_form . model task_options = %w(detection cloning sequencing primer_list primer_check) view <%= f.input :primer_task, :collection => primer3batch::task_options, :label => 'task' %> i might want return this: {1 => 'detection', 2 => 'cloning'... etc or this: {'ab' => 'detection, 'c' => 'cloning' .... that is: page display detection, cloning etc database column store 1,2 or ab, c i've guessed can done hash can't quite work out syntax. a = [] %w(detection cloning sequencing primer_list primer_check).each.with_index(1) |it,ind| << [ind,it] end hash[a] # => {1=>"detection", # 2=>"cloning", # 3=>"sequencing", # 4=>"primer_list", # 5=>"primer_check"} us

Meteor app using NGINX as load balancer -

i have meteor app deployed in digitalocean (ubuntu 14.04). able setup nginx , deployed app using mup. however, problem is, app used our company , 95% of total population of users have same ip. tested ip_hash directive directs 1 of our servers. i tried different options, can't seem figure out wrong on our configurations. these setup, load balancing doesn't make sense because users direct 1 server. what think best nginx configuration this? please see code below: map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream unifyhub { ip_hash; server 111.222.333.44:3000; # server 1 server 555.666.777.88:3000; # server 2 } server { listen 80; #listen [::]:80 ipv6only=on; server_name www.unifyhub.com; access_log /var/log/nginx/unify.access.log; error_log /var/log/nginx/unify.error.log; location / { proxy_pass http://unifyhub; #proxy_set_hea

What is the best practise for php sleep function in javascript? -

for example in php put in loop sleep function 5 min pause execution loop new fetch result database or other instances how can done in javascript way set timeout , call same function inside it, thank you. as pointed out in comments above, javascript single-threaded , not possible unless wrap code want execute after delay in it's own function. you make kind of progress storage system whereby keep track of stage want different pieces of code execute based on pause cycle, example: var stage = 0; setinterval(function() { executestage(++stage); // iterate stage }, 300000); // 5 mins var executestage = function(stagetoexecute) { // put code want execute @ every stage here console.log('this code execute no matter stage set'); // execute code specific stage switch (stagetoexecute) { case 1: // put stage 1 code here console.log('stage 1 executes here'); break; case 2: // put stage 2 code here console.log(&#

javascript - Injector Error with pikaday-angular.js -

i using pikaday directive project. returns error. error: $injector:modulerr module error failed instantiate module [iba.controlls.ui] due to: error: [$injector:modulerr] http://errors.angularjs.org/1.5.0/ $injector/modulerr?p0=p...) @ error (native) @ http://localhost:1203/scripts/angular.min.js:6:416 @ http://localhost:1203/scripts/angular.min.js:40:60 @ n ( http://localhost:1203/scripts/angular.min.js:7:355 ) @ g ( http://localhost:1203/scripts/angular.min.js:39:135 ) @ http://localhost:1203/scripts/angular.min.js:39:304 @ n ( http://localhost:1203/scripts/angular.min.js:7:355 ) @ g ( http://localhost:1203/scripts/angular.min.js:39:135 ) @ fb ( http://localhost:1203/scripts/angular.min.js:43:164 ) @ ac.c ( http://localhost:1203/scripts/angular.min.js:20:449 how fix it.? my code is angular.module('[iba.controlls.ui]', ['ui.bootstrap', '[iba.dataservice.data]', '[iba.services.ui]','ngsanitize',

javascript - nested ng-repeat with dynamic input -

i trying display json response in table using ng-repeat. problem not objects recieved same. of them have date, short message , long message. there ones additional value list, differing in length. list should diplayed underneath long message within own table or list. use alert.slice().reverse() because want newest entries on top. new objects inserted using .push({values}). <tbody class="altbody" ng-repeat="alerts in alerts.slice().reverse()" ng-class="classname"> <tr class="altr aldate" > <td ng-show="{{alerts.date}}" ><b>{{alerts.date}}:</b></td> </tr> <tr class="altr alshort " ng-click="toggledetail($index)"> <td >{{alerts.s}}</td> </tr> <tr class="altr " ng-show="activeposi

angularjs ng-show not working when ng-click -

<div role="tabpanel" class="tab-pane active" id="personnes"> <div infinite-scroll='redditusers.nextpage()' infinite-scroll-disabled='redditusers.busy' infinite-scroll-distance='3' > <div class="search-item row" ng-init="request=false" ng-repeat="user in redditusers.users" > <div class=" pull-left"> <img ng-src="{{notif.subscriber.avatar == 'no_avatar' && '/images/default.svg' || 'http://localhost:85/api.immortality.life/application/uploads/avatars/'+user.id_user+'/'+user.avatar }}" class="edit-img"> <span>{{user.first_name+' '+user.last_name}}</span> </div> <div class="pull-right" > <button ng-if="user.friend == null && request==false" ng-hi

How to setup login method to avoid duplicate code every test [selenium][java] -

i want use login method inted of repeat same code every test. check similar topic here , couldn't find solution or dont this. test autogenerated selenium ide have more question method there. mark things confuse me. test , method made: import java.util.regex.pattern; import java.util.concurrent.timeunit; import org.testng.annotations.*; import static org.testng.assert.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.firefoxdriver; import org.openqa.selenium.support.ui.select; public class sortowanie{ private webdriver driver; private string baseurl; private boolean acceptnextalert = true; private stringbuffer verificationerrors = new stringbuffer(); string[] params; @beforeclass(alwaysrun = true) public void setup() throws exception { driver = new firefoxdriver(); baseurl = "https://en-testwebapi.poczta-polska.pl/"; driver.manage().timeouts().implicitlywait(30, timeunit.seconds); } @test public void testsortowanie() throws exception

Adding a table around the pop-up information in Leaflet -

Image
i want create table around pop-up information in leaflet. using bootstrap mark-up. tried following code didn't work: oneachfeature: function (feature, layer) { layer.on({ click: function showresultsindiv() { var d= document.getelementbyid('tab4'); d.innerhtml = "<table>" "<tbody>" "<tr>" "<th scope="row"><h3>" + feature.properties.name + "</h3></th>" "</tr>" "<tr>" "<th scope="row">" "</th>" "</tr>"

javascript - MongoDB Match and Slice multiple child arrays -

i have schema var dataschema = new schema({ hid: { type: string }, sensors: [{ nid: { type: string }, sid: { type: string }, data: { param1: { type: string }, param2: { type: string }, data: { type: string } }, date: { type: date, default: date.now } }], actuators: [{ nid: { type: string }, aid: { type: string }, control_id: { type: string }, data: { param1: { type: string }, param2: { type: string }, data: { type: string } }, date: { type: date, default: date.now } }], status: [{ nid: {type: string}, status_code: {type: string}, date: { type: date, default: date.now } }], updated: { type: date, default: date.now }, created: { type: date } }); the query i'm trying build should search schema "hid", pick "sensors", "actuators" , "status" arrays objects match nid provide , limit result 10 element each array. actually, don'

javascript - How to know the url of ajax request at any website -

when use website, possible url of ajax requests, current page sends. of browser or tool. chrome developer tools or firebug trick. fiddler tool.

sap - ABAP: How to declare table inside structure -

in order achieve smartform, i'm supposed declare table within structure. tried it's not working: types: t_qase2 type table of qase. types: begin of ty_itab. pruefer type qase-pruefer. zeiterstl type qase-zeiterstl. * ......(other fields) ty_qase2 type t_qase2. include structure s_f800komp. types end of ty_itab. to declare table in structure give table type non-unique key 1 of fields: types: mytabletype type table of string non-unique default key. types: begin of ty_itab, pruefer type qase-pruefer, zeiterstl type qase-zeiterstl, mytable type mytabletype, "table here ty_qase2 type t_qase2. include structure s_f800komp. types: end of ty_itab. also notice end every line dot. in case have use ,

spring - how to fix the CrudRepository.save(java.lang.Object) is no accessor method in springboot? -

im reffering springboot tutorial , im using spring data in project, im trying add data database . using following . bt when im trying error saying invoked method public abstract java.lang.object org.springframework.data.repository.crudrepository.save(java.lang.object) no accessor method! here code , //my controller @requestmapping("/mode") public string showproducts(moderepository repository){ mode m = new mode(); m.setseats(2); repository.save(m); //this error getting return "product"; } //implementing crud mode repository @repository public interface moderepository extends crudrepository<mode, long> { } //my mode class @entity @table(name="mode") public class mode implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy=generationtype.auto) @column(unique=true, nullable=false) private int idmode; @column(nul

typescript - Error while try to bind an object to a template with ngModel? -

this should easy thing, cant figure out goes wrong. i have in class: interface message { type: string; email: string; } export class myclass { public message: message; public email: string; constructor() { } // ... } if bind email variable works ( [(ngmodel)]='email' ) if try bind message [(ngmodel)]='message.email' got error: cannot read property 'email' of undefined. why cant angular reach object variable? you need instantiate message property able bind input on 1 of properties: export class myclass { public message: message = { type: '...', email: '...'}; public email: string; constructor() { } // ... } edit in case, message interface can't use instantiate object of type. need use literal object expression instantiate object of type message . typescript check literal object has required elements. if want instantiate type, need create class. interfaces have no correspondance in compil

c# - The remote server returned an error (400) -

i got bad request using following code : httpwebrequest request = (httpwebrequest)webrequest.create(@"https://xxxxxxx"); request.headers.add("xxxxxxxxxxxxxxxxx"); request.contenttype = "application/x-www-form-urlencoded "; request.method = "post"; byte[] buf = encoding.default.getbytes("sssssssssssssss"); request.contentlength = buf.length; request.getrequeststream().write(buf, 0, buf.length); using (var response = (httpwebresponse)request.getresponse()) { } am missing in configuration assuming https://xxxxxxx valid in browser , ssl certificate valid, may need pass correct headers user-agent if haven't already.

android - java.lang.IllegalStateException: couldn't move cursor to position n -

Image
i tying import contacts , display in listview . here cursor loader contentresolver cr = getactivity().getcontentresolver(); cursor cur = cr.query(contactscontract.contacts.content_uri, null, null, null, contactscontract.commondatakinds.phone.display_name + " asc"); madapter = new contactsadapter(getactivity(), cur, true, null); setlistadapter(madapter); and adapter for (cursor.movetofirst(); !cursor.isafterlast(); cursor.movetonext()) { // need cursor here string name = cursor.getstring(cursor.getcolumnindex(contactscontract.commondatakinds.phone.display_name)); log.e("name", name + "\n" + cursor.getcount()); names.add(name); } getindexlist(); and bindview @override public void bindview(view view, context context, cursor cursor) { // gets handles individual view resources final viewholder holder = (viewholder) view.gettag(); s

capybara - Testing HTML 5 form validations when using simple_form Rails -

i'm using devise , simple_form todo list app . , have following code users/edit.html.erb <%= content_for :title,'edit profile' %> <h2>edit profile</h2> <%= simple_form_for current_user, class: 'form-horizontal' |f| %> <%= f.input :nick_name %> <%= f.submit 'update profile' %> <% end %> my user.rb looks : class user < activerecord::base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable attr_accessible :email,:nick_name, :password, :password_confirmation, :remember_me validates :nick_name, presence: true # other fields validated devise has_many :lists , dependent: :destroy end now, when click on submit button empty nick_name field ,i popup kind of alert . it's not normal browser alert ,i think html5 feature . message please fill out field popup below empty field . have disabled javascript, still shows same message . nick_name inp

facebook - Converting an FQL query into a web service -

i have query can use in fql engine @ http://developers.facebook.com/tools/explorer/ i utilize in java web service (http get?) in order retrieve same results. can devise way fetch access token out of existing database. here query: select application_id developer developer_id = 54777**** it requires access token value in column. can fetch both in db. but, figure out how write web service can use in browser (not curl) know concept work before code objects , conditions in java. can me out web service url? when try: https://graph.facebook.com/me/applications/developer/access_token=xxxx i get: { "error": { "message": "an active access token must used query information current user.", "type": "oauthexception", "code": 2500 } } you're forgetting "?" has go before url parameters. correct url be: https://graph.facebook.com/me/applications/developer/?access_token=xxxxxxx

scripting - Sparx Systems Enterprise Architect Script: Clone a Subpackage to another Package? -

i try wrote automation in jscript. if bin done creating structure of 'package b' need subpackages 'package b' in 'package a' creating diagramm of something. is possible clone subpackage of example 'package b' 'package a'with api? subpackage package includes lot subpackage more. need not "master"-subpackage complete structure of package tree of subpackage. package package b --> subpackage b.1 -->subpackage b.1.1 -->subpackage b.1.2 -->subpackage b.1.3 -->subpackage b.1.3.1 -->and on.... use package.clone() inserts copy of package same parent original package , returns newly-created package.

loops - Creating new array of dates/data with missing dates/data added in Matlab -

i have 4 columns of river flow data in format (year,month,day,data). want check through data ensure there not missing chunks , if there are, create new data array ('newdates') missing dates (column 1) added in, along nan values missing data (column 2). i checking missing data subtracting datenum of previous day, datenum of current day (if greater 1, there data missing). code below works, omitting last day of data each time. loop have generated check each row length of data minus 1, because if allow length of data, won't able check difference between 2 last dates, date vector not large enough.i know isn't overly complex thing do, can't seem figure out. appreciated. code below: %load sample file of data in format year,month,date,riverflow >data=load('dmf_21002_279631_q_complete_matlab.csv'); >yr=data(:,1); >mth=data(:,2); >day=data(:,3); >flow=data(:,4); >dates=datenum([yr,mth,day]); >icounter=1; %this counte

Upgrade Gradle version 2.8 to 2.10 in Android Studio -

i trying add classpath 'com.google.gms:google-services:2.0.0-alpha5' instead of classpath 'com.google.gms:google-services:2.0.0-alpha3' implement google plus signin. gradle project sync ends following error. warning:gradle version 2.10 required. current version 2.8. if using gradle wrapper, try editing distributionurl in /codes/myproject/gradle/wrapper/gradle-wrapper.properties gradle-2.10-all.zip please suggest me possible way solve it. download latest gradle version opening gradle-wrapper.properties. in project/gradle/wrapper directory. update distributionurl distributionurl=https://services.gradle.org/distributions/gradle-2.10-all.zip

shell - Delete lines from file using sed containing different patterns -

i have dump production db want remove data of tables messages, messages_files, etc because not useful debug/programming on local. i have been using command remove lines containing kind of data: sed -i '/create database/d' $current_main_db.sql && sed -i '/use \`okn/d' $current_main_db.sql && sed -i '/insert \`messages\`/ d' $current_main_db.sql && sed -i '/insert \`messages_email_cron\`/ d' $current_main_db.sql && sed -i '/insert \`messages_users\`/ d' $current_main_db.sql && sed -i '/insert \`messages_files\`/ d' $current_main_db.sql && sed -i '/insert \`messages_mail_list\`/ d' $current_main_db.sql && sed -i '/insert \`messages_sms_cron\`/ d' $current_main_db.sql && sed -i '/insert \`messages_tags\`/ d' $current_main_db.sql && sed -i '/insert \`messages_temp_receivers\`/ d' $current_main_db.sql && sed -i '/insert

javascript - Modal pop up not working on my website (Ubuntu VPS) -

so uploaded files ubuntu vps , seems work when press example chat rules on website nothing happens url changes from http://website http://website/?#chatrulesmodal but no pop up <div class="modal" id="chatrulesmodal"> <div class="modal-content"> <h4>chat rules</h4> <ol> <li>no begging.</li> <li>no spamming.</li> <li>no advertising.</li> <li>no code spamming.</li> <li>english only.</li> <li>always polite, mods , admins.</li> <li>no coin trading</li> </ol> </div> </div> <div class="col s4 left-align"><input type="checkbox" id="mute" /><label for="mute">mute</label></div><div class="col s4 center-align"><a href="#chatr