Posts

Showing posts from September, 2015

javascript - Microsoft Bot Framework - how to send responses from a 3rd party API -

using microsoft bot framework, how can proxy api between incoming , outgoing bot messages? i've replaced: server.post('/api/messages', connector.listen()); with own implementation takes req.body.text , sends separate endpoint. how can send endpoints response chat? server.post('/api/messages', (req, res, next) => { request.post('endpoint', { json: {"text": req.body.text}, }, (error, response, body) => { // how send body outgoing chat message? }) }) update: to point out why ezequiel jadib's answer won't work, i've added complete code. req not defined within bot's callback function. const restify = require('restify') const builder = require('botbuilder') const request = require('request') // setup restify server const server = restify.createserver() server.use(restify.plugins.bodyparser()) server.listen(process.env.port || process.env.port || 3978, function () { cons

java - Mock final method in inner class with PowerMockito -

i'm having trouble stubbing final method, used inside of class i'm trying test. problematic line in test class here: powermockito.when(connectionmock.authuser("fake-user", "fake-password")).thenreturn("random string"); which throws nullpointerexception. test class looks this: @runwith(powermockrunner.class) @preparefortest({myclass.class, apiclientconnection.class}) public class myclasstest { @test public void apiconnect() throws exception { myclass c = new myclass(); apiclientconnection connectionmock = powermockito.mock(apiclientconnection.class); powermockito.whennew(apiclientconnection.class).withanyarguments().thenreturn(connectionmock); powermockito.when(connectionmock.authuser("fake-user", "fake-password")).thenreturn("random string"); c.apiconnect("fake-host", 80, "fake-user", "fake-password"); } } the class i'm

c++ - Output is either 6.9531e-308 or 0 (noob) -

i'm trying write program give cost of phone call based on when starts/ends , how long takes. works fine, except when tries display cost of each call , total cost @ end. every cost listed $6.9531e-308. similar issue resolved issue initializing variable in question 0 when program starts listing every cost $0. the way i'm calculating total doesn't seem working either, since when cost $6.9531e-308, total comes out $7.64841e-307 instead of $4.17186e-307. it's either multiplying 1 of costs 11 or thinks there's 11 costs need added up. here code: #include <fstream> #include <sstream> #include <iostream> #include <iomanip> #include <string> #include <cstring> using namespace std; ifstream fin("call_history.txt"); //read file //int main int main() { string temp; double total = 0.0; while (getline(fin, temp)) { istringstream s(temp); string token[3]; int = 0; while(getl

asp.net mvc - how to pass 'true'/'false' data from Controller to View using jquery for bootstrap validator in MVC -

view $('#frmcreatenewadminpanelmenu').bootstrapvalidator({ message: '.......', feedbackicons: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { txtmenuname_create: { validators: { notempty: { message: '......' }, stringlength: { min: 6, max: 100, message: '.......' }, remote: { type: 'post', url: '/adminpanelmenu/menunameremote',

graph - Recursive self-join in HANA SQLSCRIPT procedure -

according academical literature http://pi3.informatik.uni-mannheim.de/~norman/hana_sqlscript_btw2013.pdf hana support recursive calls on hierarchical tree following: create procedure browse_set_top_bt (in depth integer, in currdepth integer, in current tt_from_to, out hull tt_from_to) language sqlscript reads sql data begin relevant = select frm , customerconnections weight >= 2; temp = select c.frm , r.to :current c, :relevant r c.to = r.frm ; currdepth = currdepth + 1; if( currdepth < depth ) call browse_set_top_bt ( depth, currdepth, temp, temp2 ) hull = :temp union :temp2; else hull = :temp; end; end; any further support in eventual manner browse parent-child tree in recursive self-join way welcome. sorry, mistook academic test implementation of query processing feature part of delivered standard product functionality. sap hana not support recursive queries described in paper. what support graph-oriented queries (maybe suitable use case here) ,

c++ - Application of socket() from sys/socket.h -

i'm writing program in c++ establish communication dlp lightcrafter (texas instruments) without provided gui, , i've used these instructions establish connection: #include <stdlib.h> #include <string.h> #include <iostream> /* cout */ #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> /* socket struct */ #include <arpa/inet.h> /* ip, etc */ #include <unistd.h> /* read() write() socket */ #include <cstdint> #include "pkt.h" /* calcchecksum() */ using namespace std; /* packet format * ------------------------------------------------------------------------------------ * | header | data | checksum | * ------------------------------------------------------------------------------------ * | byte 0 | byte 1 | byte 2 | byte 3 | byte 4 | byte 5 | byte 6...byte n | byte n+1 | * ------------------------------------------------------------

google cloud dataflow - How can I improve performance of TextIO or AvroIO when reading a very large number of files? -

textio.read() , avroio.read() (as other beam io's) default don't perform in current apache beam runners when reading filepattern expands large number of files - example, 1m files. how can read such large number of files efficiently? when know in advance filepattern being read textio or avroio going expand large number of files, can use recently added feature .withhintmatchesmanyfiles() , implemented on textio , avroio . for example: pcollection<string> lines = p.apply(textio.read() .from("gs://some-bucket/many/files/*") .withhintmatchesmanyfiles()); using hint causes transforms execute in way optimized reading large number of files: number of files can read in case practically unlimited, , pipeline run faster, cheaper , more reliably without hint. however, may perform worse without hint if filepattern matches small number of files (for example, few dozen or few hundred files). under hood, hint causes transforms execute via

Testng listener to comply with Apache Ant JUnit XML Schema -

as part of testng automation test suite automatically push results jenkins testrail. have plugin installed on jenkins server: https://github.com/jenkinsci/testrail-plugin the read me states output must comply junit schema: https://github.com/windyroad/junit-schema/blob/master/junit.xsd i have reference how 1 junit report testng test cases? , added <listeners> <listener class-name="org.testng.reporters.junitxmlreporter"></listener> </listeners> to listeners; however, not seem create file in correct format causes jenkins fail message : uploading results testrail. error pushing results testrail posting index.php?/api/v2/add_results_for_cases/236 returned error! response testrail is: {"error":"field :results cannot empty (one result required)"} build step 'testrail plugin' marked build failure finished: failure i wondering if there different listener should using instead. thank help. i used xsd

javascript - Creating 2D Ring Shape In Cesium -

Image
i'm using cesium , want able create looks this: but more layers, , want transparent , not have colors mix. i figured easiest way create multiple entities rings can't figure out how this. if can appreciated! also, if can think of better way love hear it.

ruby on rails - How to login successfully in typo application? -

i able see output in heroku fixing errors in gemfile errors in gemfile also login admin...but 1 time...then password not recognized , login not successful... not save password on admin page(error:password doesn't match confirmation) , not login using admin password provided(error:login unsuccessful) i've tried create admin , password manually got errors. how login using admin credential? thanks errors , files related below //errors typo-1 (master) $ rails console loading development environment (rails 3.0.17) 1.9.3-p551 :001 > user.create(:username => 'admin', 1.9.3-p551 :002 > :password => 'abc123', 1.9.3-p551 :003 > :password_confirmation => 'abc123') activerecord::unknownattributeerror: unknown attribute: username /usr/local/rvm/gems/ruby-1.9.3-p551/gems/activerecord-3.0.17/lib/active_record/base.rb:1565:in `block in attributes=' /usr/local/rvm/gems/ruby-1.9.3-p551/gems/activer

SQL Query in Excel PowerPivot -

i have issue when try validate sql query , says 'a column name can not blank' i have been able shortened version without joining 2 table together. select [dbo].[stocktransactions].[transactionnumber], [dbo].[stocktransactions].[activitydate], [dbo].[stocktransactions].[sitecode], [dbo].[stocktransactions].[commoditycode], [dbo].[stocktransactions].[commodityvarietycode], [dbo].[stocktransactions].[bingradecode], [dbo].[stocktransactions].[samplemoistureqty], [dbo].[stocktransactions].[partition], [dbo].[stocktransactions].[sampleproteinqty], [dbo].[stocktransactions].[sampletestweight], [dbo].[stocktransactions].[sampleretentionqty], [dbo].[stocktransactions].[samplescreeningsqty], sum([dbo].[stocktransactions].[unshrunktonnes]), [dbo].[stocktransactions].[sampleskinningsqty], [dbo].[vw_oms_sampleresults].[testcode], [dbo].[vw_oms_sampleresults].[result] [dbo].[stocktransactions] left outer join [dbo].[vw_oms_sampleresults] on ([dbo].[stocktransactions

python - How to pass foreign key to serializer when creating parent at the same time? -

just preface, i'm beginner , realise conventions may not standard grateful if correct me i'm doing wrong. currently, api called using: http:127.0.0.1:8000/weather/<latitude>,<longitude> i pulling weather data api, want store in database @ same time. represent weather, have 2 models, location , currently hold coordinates , weather information. in case, parent location. my issue don't know how pass location foreign key currentlyserializer . in code below i'm not passing in @ , receive obvious "location field required" error. views.py def get(self, request, *args, **kwargs): # process latitude , longitude coordinates url coordinates = kwargs.pop('location', none).split(",") latitude = coordinates[0] longitude = coordinates[1] # retrieve weather data. forecast = get_weather(latitude, longitude) = forecast['currently'] # serialize , confirm validity of data. location_seri

class - Swift For In Loop Iterating Through an Array of Custom Classes Doesn't Work -

i working project , have come across error when iterating through in loop this: class customclass { var namenum : int { didset { self.name = "customclass \(namenum)" } } var name : string init() { namenum = 0 self.name = "customclass \(namenum)" } } var myarray : [customclass] = [customclass](repeating: customclass(), count: 5) _class in myarray.indices { myarray[_class].namenum = _class } print("\n") _class in myarray.indices { print("item \(_class): \(myarray[_class].name)") } i following output: item 0: customclass 4 item 1: customclass 4 item 2: customclass 4 item 3: customclass 4 item 4: customclass 4 this not make sense me thought following output instead: item 0: customclass 0 item 1: customclass 1 item 2: customclass 2 item 3: customclass 3 item 4: customclass 4 any why doesn't work or how go fixing appreciated, thanks!

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

i've set bento/ubuntu-16.04 vagrant box using php 5.6, , getting following error quite few times when try , run shell script: "uncaught reflection exception: class domdocument not exist". i've tried adding following top of script (not together), each no success: "sudo apt-get install php5.6-xml", "sudo apt-get install php5-xml", "sudo apt-get install php-dom" i've tried resetting server "sudo service apache2 restart". does have suggestions?

c# - LINQ Sql Expression to Return a Sum -

i'm quite new @ asp.net mvc. with said, i'm trying send view sum of sales acomplished salesman. controller method: [httppost] public jsonresult totaldevendas(int vendedor_id) { try { var resultado = (from vendas in db.tblvenda vendas.vendedor_id == vendedor_id select vendas.venda_valor).sum(); return json(resultado); } catch (exception) { return null; } } and me trying show on list, along other info.. <div class="row"> <div class="col-lg-12"> <table class="table table-hover"> <thead> <tr> <th>cod.</th> <th>nome</th> <th>total vendido</th> </tr> </thead> <tbody> @foreach (tblvendedor vendedor in model)

php - Laravel join and distinct -

in laravel, have query is: $productsmodel->join('tags', 'tags.item_id', '=', 'products.id') ->select('products.*', 'tags.item_id') ->distinct(); db tables looks this: | products | tags | ----------|---------| | id | id | | | item_id | products has 1 many relationship tags, creates issues when joining tables. example, need query products based on multiple tags, need show 1 product. okay. you're going have provide little more context. from looks of things, have 1:n relationship, tablea has many tableb. therefore, if join, may have multiple tableb records joined tablea records, fine. but then, if want select distinct tablea record, of many possible tableb records should returned, if there's more one? an easy way achieve you're asking use group by . $tablea->selectraw('table_a.*, max(table_b.item_id) item_id') ->join('table_b', 'ta

c - need to read an array of chars from a data file, I have a loop setup and it just outputs numbers not the chars I would expect -

#include <stdio.h> #include <math.h> #define inputfile "c:\\users\\failedpilgrim\\documents\\undprog\\wind.txt" /* main function */ int main(void) { /* declare variables */ char city_datatype[21]; double wind_speeds [12][5], total_rows[12] ={0}, total_cols[5]={0}, average_rows[12], average_cols[5]; int i, j, nrows, ncols; file *input = null; /*open input file*/ input= fopen(inputfile, "r"); /*verify input file*/ if (input==null) { printf ("\n\n\nerror opening input file.\n\n"); printf ("\n\nprogram terminated...\n\n\n\n"); return 1; } /*read title*/ (i=0; i<=21;i++) { fscanf(input, "%c", &city_datatype[i]); printf("%d",city_datatype[i]); ... this reading data file starts phrase "centerville-windspeed" task read array , print array. why code not work? output bunch of seemingly ra

how to read function type signatures in Haskell? -

this question has answer here: what => symbol mean in haskell? 4 answers given function adds 1 int, can see type signature: prelude> addone :: int -> int; addone x = x + 1 prelude> :t addone addone :: int -> int the signature means addone takes int , returns int. simple enough. instead if define function without specifying type: prelude> anotheraddone x = x + 1 prelude> :t anotheraddone anotheraddone :: num => -> it makes sense dealing num not int whats way read num => -> a ? , difference between => , -> here? anotheraddone :: num => -> the => here separates class constraint , type. in example, num a class constraint, consists of class num , type variable a . full signature declares type a num , function anotheraddone has type a -> a .

amazon web services - Testing classic internal ELB -

i have configured , passed health check aws elb(load balancer), trying ping or send packet tcp port 9300 there no ip address elb. have ec2 instance @ end of elb has elasticsearch running on it. the elb configured internal elb doesn't have public ip address it. wondering if there way can ssh? or ping elb? pretty new aws , read trouble shooting aws official website, couldn't find solution. the goal trying achieve test whether internal amazon ec2 load balancer working properly. got internal elb ip address ping command, however, not able ping or crul ip address. know doing wrong. way want access private network in correct? an elastic load balancer presented single service, consists of several load balancing servers spread across subnets , availability zones nominate. when connecting elastic load balancer, should always use dns name of elastic load balancer. resolve 1 of several servers providing load balancing service. load balancers designed pass reques

indexing - Creating a .p file from an InvertedIndex -

i trying construct python search engine pull queried tweets out of twitterapi. i cannot use tweepy . have constructed class twitterwrapper, class engine, , have created (pickled) corpus query term of “raptor”, no problem there. have created class invertedindex cannot seem construct index of lemmatized words , add jupyter notebooks pickle file (.p) (which must do) in order use twittir.py interface: t = twittir.engine(“raptor.p”, “index (to named).p”) results = t.query (“raptor”) result in results: print(result) so, question is, how make index (using inverted index), , save jupyter notebook .p file? of course, of python beginner. def build_index(self, corpus): index = {} if self.lemmatizer == none: self.lemmatizer = nltk.wordnetlemmatizer() if self.stop_words none: self.stop_words = [self.wordtotoken(word) word in nltk.corpus.stopwords.words('english')] doc in corpus: self.add_document(doc['text'], self.n

accessibilityservice - AccessibilityNodeInfo values -

i have been looking @ sample code , came across value put action, can explain me? have checked android site, couldn't find pointed out values. can't find reference 16 or 4. node.performaction(16); node.performaction(4); you using random integers, these refer things, using integers not help! node.performaction(accessibilitynodeinfo.action_select); and node.performaction(4); are literally identical @ run time. 1 more readable code. node.performaction(16) is nothing meaningful , should avoided @ costs! there no accessibilitynodeinfo.action_...... equivalent 16. imagine wouldn't bad, never productive.

C++, OpenCV, & Kinect: Processing speed goes down -

i use c++ (visual studio 2015) , opencv (ver 3.2.0) process data sent kinect v1. c++ program has no problem when starts debugging first time. after stops debugging , re-start debugging, however, gets slow. i suspecting program closes without releasing memory (i.e., memory leak). aware of need use delete function release memory if use new function. didn't use new function in c++ program (i neither used malloc() function, equivalent new function in c programs). for opencv, use destroyallwindows function @ end of program. kinect v1, use nuishutdown() , release() , , closehandle() functions @ end of program. is there else need release memory (e.g., releasing memory associated mat in opencv)? or else causing decrease in processing speed? i'd appreciate help. thanks. after first run disconnect kinect reconnect , try second run. if goes problem stuck thread. device access handled separate threads , usb can stuck (in case of error or sync problem betwee

c# - Determine when invalid JSON key/value pairs are sent in a .NET MVC request -

i have client mvc application accepts raw json requests. modelbinder maps incoming key/value pairs controller model properties, no problem there. the problem want throw error when send invalid key/value pair, , life of me cannot find raw incoming data. for example, if have model string property mname in json request send "middlename":"m" , modelbinder toss invalid key , leave mname property blank. not throw error , modelstate.isvalid returns true . i know throw [required] attribute on property, that's not right, either, since there might null values property, , still doesn't problem of detecting key/value pairs don't belong. this isn't question of over-posting; i'm not trying prevent incoming value binding model. i'm trying detect when incoming value didn't map in model. since values coming in application/json in request body, i'm not having luck accessing, let along counting or enumerating, raw request data. can

php - Google Calendar API unable to referesh token -

please check code snippet: $client = new google_client(); $client->setapplicationname(application_name); $client->setscopes(scopes); $client->setauthconfig(client_secret_path); $client->setaccesstype('offline'); $client->sethttpclient(new guzzlehttp\client(['verify' => false])); $client->setredirecturi(redirecturi); $client->setapprovalprompt('force'); $client->setaccesstoken($accesstoken); try { #if($client->isaccesstokenexpired()){ $accesstoken['refresh_token'] = $_session["ac"][$email]["refresh_token"]; $client->fetchaccesstokenwithrefreshtoken($accesstoken); $_session["ac"][$email]['token'] = $client->getaccesstoken(); $_session["ac"][$email]['refresh_token'] = $client->getrefreshtoken(); #} } catch (exception $e) { return $e->getmessage(); } $service = new google_service_calendar($client); $calendari

How to linearly combine a list of lists in python, where not every item is a list? -

i have list composed of strings , lists: a = ['a', 'b', 'c', 'd', 'e', ['fgh', 'rst'], 'i',['quv','wxy']] how join each element in list of string elements contain 1 of each internal list element, while maintaining position in original list? ex: targets = ['abcdefghiquv', 'abcdefghiwxy', 'abcderstiquv', 'abcderstiwxy', ] i have attempted in manner below, but, works if last element list combinations = [] combinations2 = [] s in a: if isinstance(s, basestring): combinations.append(s) else: seqint = ''.join(combinations) combinations2.append([seqint]) combinations2.append(s) combinations[:]=[] comb in list(itertools.product(*combinations2)): print ''.join(comb) using itertools.product surely way go. way (may not totally correct since have never us

angular - dxo-filter-row not showing search icon in DevExtreme in angular4? -

i using angular2/4 devextreme datagrid, it's works nice, it's not showing search icon while doing filter <dxo-filter-row [visible]="showfilterrow" [applyfilter]="applyfiltertypes[0].key"></dxo-filter-row> even tried add external icon, it's not taking more details please check https://js.devexpress.com/demos/widgetsgallery/demo/datagrid/filtering/angular/light/

typescript - Adding definitions for strongly typed events -

i'm trying figure out how efficiently add typed events project, keep running odd issues. ideally i'd able this: declare class eventemitter<t> { on<k extends keyof t>(event: k, fn: (...args: t[k]) => void, context?: any): void; once<k extends keyof t>(event: k, fn: (...args: t[k]) => void, context?: any): void; emit<k extends keyof t>(event: k, ...args: t[k]): boolean; } interface myevents { 'eventa': [string, number]; 'eventb': [string, { prop: string, prop2: number }, (arg: string) => void]; } class myemitter extends eventemitter<myevents> { // ... } const myemitter = new myemitter(); myemitter.on('eventa', (str, num) => {}); myemitter.once('eventb', (str, obj, fn) => {}); myemitter.emit('eventa', 'foo', 3); the first issue apparently tuples aren't valid types rest parameters, despite being arrays of typed elements under hood (i believe being wo

javascript - How to close Ionic2 Datetime popup without clicking Cancel button -

in ionic 2 project, need make user logout after idle timeout. while doing so, noticed cannot close datetime popup before invoking logout event , redirecting login page. need close popup before redirecting login page. below code sample working on <ion-datetime (ioncancel)="oncanceldatetime()" [(ngmodel)]="datetime"> </ion-datetime> the (ioncancel) event fired when close popup. is there way invoke firing of event programmatically? or there way close datetime popup? currently there no official documented ionic 3 way close datetime picker programmatically. however can use javascript 'dispatchevent' method trigger click on 'cancel' button of datetime picker. here how it: // reference clear button of datetime picker. var pickerclearbutton = document.getelementsbyclassname("picker-button")[0]; // create click event triggered var clickevent = new mouseevent("click", { "view": window

c# - Issue using MailKit to fetch gmail emails -

i 'm working on mvc application fetch emails gmail account using mailkit, on local computer works perfectly. however, when uploading on host "a socket operation attempted unreachable network". don't have ssl enabled on host. suggestions appreciated have crawled web , tried solutions s22.imap.dll still same error. using (var client = new imapclient()) { using (var cancel = new cancellationtokensource()) { // demo-purposes, accept ssl certificates client.servercertificatevalidationcallback = (s, c, h, e) => true; var ips = dns.gethostaddresses("imap.gmail.com"); try { client.connect("imap.gmail.com", 993, true, cancel.token); } catch { foreach (var ip in ips) { try

html - change color of nth child with css or jquery -

i using slick slider , structure this: <div class="slick-track"> <ul> <li class="slick slick-active"></li> <li class="slick slick-active"></li> <li class="slick slick-active"></li> <li class="slick"></li> <li class="slick"></li> <li class="slick"></li> <li class="slick"></li> <li class="slick"></li> <ul> </div> it shows 3 slides @ time. i.e. when next slide shown 2,3,4 li gets slick-active class what want select middle element active , change background color. i have tried doing doesn't work .slick-track .slick-active:nth-child(odd) { background: red; } .slick-track .slick-active:nth-child(even) { background: green; } or .slick-track .slick-active:nth-child(2) { background: red; } it counts li , select o

sonarqube - How to ignore the 'not covered by tests' warning? -

i using sonarqube version 6.4. not writing test cases, when check sonarqube, shows quality gate failed. error message is: not covered tests. is possible avoid or ignore same projects? change default quality gate settings. go quality gates , select default quality gate , delete code coverage metrics.

How to trigger mouse right click programmatically using javascript or jQuery -

i need trigger mouse right click using javascript or jquery. here tried below code not working me <div id="testing" style="height:500px;width:1000px;background-color:lime;"></div> <script> $(document).ready(function () { $('#testing').contextmenu(); //or $('#testing').trigger({ type: 'mousedown', which: 3 }); }); </script> can please provide information on this. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <div id="testing" style="height:500px;width:1000px;background-color:lime;"></div> <script> $(document).ready(function () { $("#testing" ).contextmenu(function() { alert( "right clicked" ); }); }); </script>

javascript - Set all menu items to be center of Bootstrap Menu Header -

recently have resized bootstrap's menu size. problem text position of menu items shows in top of menu bar. i want show menu items center of menu header. menu items aligned in center position. here code : http://jsfiddle.net/y8v0rd9g css: .navbar .navbar-nav { display: inline-block; float: none; } .navbar .navbar-collapse { text-align: center; } .navbar { position: relative; min-height: 80px; margin-bottom: 20px; border: 1px solid transparent } if use browser's dev tools, you'd see links ( ul.nav ) vertically center-aligned, list ends before nav element does. that's because you're setting min-height: 80px on nav. i'd recommend adding padding well, not way @lkg did it. instead, remove min-height rule , add top , bottom padding .navbar . way items remain center-aligned nicely. updated fiddle , updated code: .navbar { position: relative; margin-bottom: 20px; padding: 12px 0; border: 1px solid transparent }

html - Right Table Row to Go Below Left Row -

i want td on right (pagination buttons) go below left td (buttons) when there isn't enough space.( small screens). is doable ? <table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom:3px"> <tr valign="bottom"> <td class="smallfont"> "buttons on left </td> <td align="$stylevar[right]"> "page navigation buttons on right </td> </tr> </table> add column table , hide desktop.while going mobile ,hide fist column , show third column .hide-for-desktop{ display:none; } .@media screen , (max-width: 500px) { table td{ display:block; width:100%; } .hide-for-desktop{ display:block } .hide-for-mobile{ display:none !important; } } <table cellpadding="0" cellspacing=&qu

Visual Studio 2017 throws compilation error in TypeScript file using angular 2 -

Image
i trying create angular 2 app below typescript code import { component } 'angular2/core'; @component({ selector: 'my-app', template: ' < h1 > first sharepoint add in using angular2... !!! < /h1>' }) export class appcomponent { } it throwing below errors cannot find module angular2/core experimental support decorators feature subject change in future release for second error have added "experimentaldecorators": true, in tsconfig.json i have installed typescript sdk visual studio 2017 , restarted visual studio, no luck i tried npm install -g typescript@latest below package.json { "name": "imageslideshow", "version": "1.0.0", "description": "slide show image libraries", "main": "index.js", "dependencies": { "@angular/core": "^4.3.2", "angular2": "^2.0.0-beta.

ruby - How to setup controller to respond to a specific object rails -

i trying set controller responds "first" video record in database skip validations in model. video.rb validates :link, presence: true, format: yt_link_format, unless: :skip_video_validation before_create :uid_link_match, unless: :skip_video_validation before_update :uid_link_match, unless: :skip_video_validation attr_accessor :skip_video_validation end how set in controller can first video skip these validations. def update @video = video.find(params[:id]) if @video == @video[0] @video.skip_video_validation = true if @video.update_attributes(video_params) flash[:success] = 'video updated!' redirect_to root_url else render 'edit' end else ... end could please explain doing wrong , why. full code should in controller def update @user = user.find(params[:user_id]) @video = video.find(params[:id]) if @video == @user.videos[0] @video.skip_video_validation = true

scala - Custom user defined types in Phantom Cassandra -

i trying create custom udt in phantom. case class creationtrack(source_ip: string, created_by: string, created_at: uuid) abstract class registrations extends cassandratable[registrations, creationtrack] rootconnector { object creation_details extends jsoncolumn[creationtrack](this){ override def fromjson(obj: string): creationtrack = { jsonparser.parse(obj).extract[creationtrack] } override def tojson(obj: creationtrack): string = { compactrender(extraction.decompose(obj)) } } } input given: creationtrack("192.123.4.5","arun", uuids.timebased()) but getting, invalid string constant{"source_ip":"192.123.4.5","created_by":"arun","created_at":{}} i believe there issue uuid type casting on json conversion. got stucked here. help? in advance! ps: know there option called @udt available in phantom-pro resolve issue. dont want use pro version here. this solved prob

android - How to debug app when it's killed -

Image
my app has bug on activities: when restarts (when it's killed , opened again multitasker), crashes. assume has singleton, i'm not sure. i'd pinpoint problem, can't debug since debugger stops when kill application (i'm using adb shell kill <package-name> ). does know how can debug problem? (or give me hint problem might matter) i use ddms (dalvik debug monitor server (ddms) capture stack trace, etc.. after kill , restart our app. (fyi: installed along rest of android toolset) while not going allow debug app via vs/xs, can pin area of app cause. there add logging around trouble area (i.e. old-fashion printf style debugging) http://developer.android.com/tools/debugging/ddms.html to launch visual studio: from xamarin studio: