Posts

Showing posts from June, 2012

javascript - Google Script - How to move messages with specific domain name to trash -

i trying make script can delete messages don't want in gmail. wrote codes in google script. not working. here work. "if email address not temple university,i move trash". want achieve. function blockemail() { var thread = gmailapp.getinboxthreads(0,1)[0]; var message = thread.getmessages()[0]; var senders = message.getfrom(); var regexp = new regexp("(\w|^)[\w.+\-]{0,25}@(temple)\.edu(\w|$)"); if (senders != regexp) { thread.movetotrash(); message.movetotrash(); } } i searched answer here couldn't find 1 want. here answer found. google apps script - gmail, delete forever e-mails in trash specific label can tell me missed code worked ? or mistakes ? self learner , first time asking question here.

Write a simple c code in loadrunner -

i received string "zxm6dgm6u0fntdoylja6
chjvd+jwvc2ftbha6umvzcg9uc2u+" server response wish convert "zxm6dgm6u0fntdoylja6&%0d%0achjvd%2bjwvc2ftbha6umvzcg9uc2u%2b" format. find difficult hence seeking help. br, ak i able solve using inbuilt function in loadrunner itself. here code used: lr_save_string("zxm6dgm6u0fntdoylja6
chjvd+jwvc2ftbha6umvzcg9uc2u+", "html_text"); web_convert_param("html_text", "sourceencoding=html", "targetencoding=url", last ); lr_output_message("converted result: %s", lr_eval_string("{html_text}"));

c# - Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding -

this question has answer here: timeout expired. timeout period elapsed prior completion of operation or server not responding. statement has been terminated 11 answers when run code following exception: an unhandled exception of type 'system.data.sqlclient.sqlexception' occurred in system.data.dll additional information: execution timeout expired. timeout period elapsed prior completion of operation or server not responding. my code following: private void fillindatagrid(string sqlstring) { string cn = configurationmanager.connectionstrings["scratchpad"].connectionstring; //hier wordt de databasestring opgehaald sqlconnection myconnection = new sqlconnection(cn); sqldataadapter dataadapter = new sqldataadapter(sqlstring, myconnection); dataset ds = new dataset(); myconnection.open();

correlation - Time difference of sequences (with solution) -

Image
it given barker sequence: and receiving sequence: calculate time difference of sequences in number of symbols. solution: can me example? how got 0, 12/11 , -12/11?

css - Proper image orientation in AngularJS 1.5 project -

landscape images taken iphone appear upside down on desktop chrome, proper orientation on iphone safari. example car on homepage https://www.dapidi.com/#/ i doubt problem browsers or devices. after searching answer came across directive seems work times, not image of car. believe should "solved problem" already, cannot seem find answer. have solution how solve surely common dilemma? directive angular.module('myapp') .directive('imgorientation', function(){ return { restrict: 'a', link: function(scope, element/*, attrs*/) { function settransform(transform) { element.css('-ms-transform', transform); element.css('-webkit-transform', transform); element.css('-moz-transform', transform); element.css('transform', transform); } var parent = element.parent(

c++ - How to require an object defined by the derived class from within the constructor of a base class -

i want have generic class enforces rules derived class in template method pattern avoid two-phase initialization because don't want objects in partial invalid state if possible. base class requires "thing" generic class of used polymorphically. seperate factory isn't appropriate because don't yet know derived classes be. this came using function pointers derived class passes down during construction base class can have thing , way derived object can never exist without valid thing. wonder if there better way in c++ because seems pretty hackish? edit: corrected bit better syntax without function pointers. think simplest way this. class thing {}; class base { public: base(thing* thing): musthavething(thing) {}; virtual ~base() { delete musthavething; }; private: thing* musthavething; }; class derived: base { public: derived(): base(creatething()) {}; private: static thing* creatething() { return new thing; } };

.net - Umbraco 7.5.6 scheduled publish not working on production -

i have umbraco 7.5.6 site, publish at/unpublish @ work fine on local. however when deployed production, it's if these events aren't fired. i've made sure date formats , timezones same on machine , on server. made sure database date format matches those. any ideas should looking? i've seen on few servers, when website can't resolve itself. task makes call unpublish/publish @ accesses site call controller action. if can't access itself, events never fire. happens in more secure environments. you'll able see looking in log files in "/app_data/logs/" folder. there lot of messages scheduled publishing task failing if problem.

javascript - Treat self as a node module for npm -

i have javascript project released node module. reasons, have source code using relative paths import other files in project: // <this_module_path>/action/foo.js import execution './execution'; import types '../types'; and using module name root path import other files in project: // <this_module_path>/action/dosomething.js // using module name import // equals import './helpers.js' in case (in same folder) import executionhelpers 'this-module/action/helpers.js'; // equals import '../types/helpers' in case import typehelpers 'this-module/types/helpers.js'; how can have such file import other project files using module name rather relative paths? nodejs uses commonjs import javascript moduels. there no clear timeline adding es6 import / export syntax nodejs. need transpile code using babel commonjs module system before can run on nodejs. how using commonjs create separate package this-module mod

javascript - How to work with IndexedDB asynchronously? -

loading data , store them in indexeddb database. periodically have database crashes , lost access it. give me, please, solution how use indexeddb asynchronously! sample code i'm use now: var datatotal = 0; var threads = 6; //openindexeddbconnection(); function start(total){ datatotal = total; (var = 0; < threads; i++) { loaddata(i); } } function loaddata(datanum){ var datanext = datanum + threads; if(datanext > datatotal){ //checkend(); return; } $.ajax({ url: baseurl, data: {offset: datanum}, success: function (data) { successdata(datanext, data); }, type: 'get' }); } function successdata(datanext, data){ var dataarray = data.split(';'); savedata(dataarray); loaddata(datanext); } function savedata(dataarray){ putitem(); function putitem(i) { var count = || 0; if(dataarray.length <= i){ return; } var transaction = indexeddb.transaction([datatablename], &qu

node.js - Node environment variable not being read as string in app -

i'm using library requires secret string. i've set node variable so: export jwt_secret=e177920e88165bd0090b1c6b544cf7 however, when try use in app, so: const jwt = require('jsonwebtoken'); function usertoken(user) { return jwt.sign({ user: user.id, }, process.env.jwt_secret); } it hits error says secret must string or buffer. thought node variables strings, not sure issue is. thanks. hmm, works fine me. maybe try adding console.log(process.env.jwt_secret) check env var being loaded correctly. as side note, consider using kind of environment variable management library such dotenv . allows store of environment variables in .env file like: jwt_secret="abc" other_env_var="def" it makes easier keep track of env vars :)

c - Write n bytes and read n bytes: sending number of bytes to read using uint16_t -

i've been using these read , write functions (provided @alk). problem don't know how correctly send uint16_t data_size; . here actual code send general example buffer: uint16_t data_size; int retry_on_interrupt = 0; char buffer[] = "hello world!"; data_size = (uint16_t) sizeof(buffer); /* sending data_size */ writen(socket, data_size, 2, retry_on_interrupt); /* sending buffer */ writen(socket, buffer, sizeof(buffer); and here actual code receive general example buffer: /* receiving data_size */ readn(socket, &data_size, 2); /* receiving buffer */ readn(socket, buffer, data_size); but not working, think because writen requires const char * , instead i'm using uint16_t ... how should these calls be? thanks. replace writen(socket, data_size, 2, retry_on_interrupt); by if (-1 == writen(socket, &data_size, sizeof data_size, 1)) { perror("writen() failed writing size"); exit(exit_failure); } and repla

html - Unable to change nav-bar dropdown styles -

i attempting change nav-bar dropdown background color black. trying make dropdown options width of screen. for reason unable change dropdown background other transparent. tried code below did nothing @ all. /*-- change navbar dropdown color --*/ .navbar-default .navbar-nav .open .dropdown-menu>li>a,.navbar-default .navbar-nav .open .dropdown-menu { background-color: #3344ff; color:#ffffff; } here code: .navbar-inverse { background: #f8f9fa; border: none; color: black; height: 7em; } .navbar-inverse a{ color: #7b53c1!important; } .navbar-toggle { border: none; background: transparent !important; } .navbar-toggle:hover { background: transparent !important; } .navbar-toggle .icon-bar { width: 25px; height: 3px; transition: 0.2s; background: black !important; margin-top: 25px; } .navbar-toggle .top-bar { transform: rota

postgresql - Why required "=" before ANY function with array as param, in postgres procedure? -

i answering postgres question yesterday, , came across postgres thread ( here ) describe following error: error: operator not exist: text = text[] hint: no operator matches given name , argument type(s). might need add explicit type casts. the error seems appear whenever array string type fed any without using = any . seems strange since based on language, logic, , sql conventions, have (e.g. in ): variable function(set) instead of. variable = function(set) , unless ofcourse operator summation/count operation returning 1 result :) it make more senseto have variable any(set/array) instead of variable=any(set/array) . similar example in function. can explain going on here? in (...) equivalent = (array[...]) crucially, any not function . it's syntax defined sql standard, , no more function group by or over clause in window function. the reason = required before any any can apply other operators too. means "test operator left against ev

shell - NeoVim terminal emulator configuration for windows 10 -

i trying configure neovim windows. 1 of key things of configuration getting access terminal-emulator (its comfortable switch , use terminal vim). cant managed works. use neovim binaries/neovim-qt. have no problem run command using :!. tried play shell , shellquote vars, doesn`t help. tried use bash(msys2) instead of cmd, still no result.(:! still works) probably, problem in shell vars... or permissions. thankfull help!

html - icon center align vertically and horizontally -

Image
i trying vertically , horizontally center align small icon putting on top of image. relevant html part: <li> <a href="#"> <span class="test fa fa-play"></span> <img src="thumbnail1-l.jpg" alt=""> </a> </li> <li> <a href="#"> <span class="test fa fa-play"></span> <img src="thumbnail2-l.jpg" alt=""> </a> </li> <li> <a href="#"> <span class="test fa fa-play"></span> <img src="thumbnail3-l.jpg" alt=""> </a> </li> <li> <a href="#"> <span class="test fa fa-play"></span> <img src="thumbnail4-l.jpg" alt=""> </a> </li> css part .photo-list.cols-2 li { width: 50%

python - Imported module cannot let me use the function it contains -

i'm using 2010 head first book python, chapter 2. i've created module called nester , contains function print_lol , made program should import nester, create little list, , call function print_lol contained in nester. doesn't work, tho. import nester cast = ["palin", "cleese", "idle", "jones", "gilliam", "and chapman."] nester.print_lol(cast) this program, , output: > traceback (most recent call last): file "<pyshell#2>", line 1, in <module> nester.print_lol(cast) attributeerror: module 'nester' has no attribute 'print_lol' what's wrong that? why happens? code in book, same path, environment paths ok. what's wrong? here 'nester' code, , works properly. def print_lol(the_list): each_item in the_list: if isinstance(each_item, list): print_lol(each_item) else: print(each_item) also, nester it's in c

ionic2 - Ionic 2: Slider auto height -

is there anyway automatically adjust height of ionic 2 slider based on content within slides? have sliding card style want expand upon clicking, however, height of slider restricting it. try code ngafterviewinit(){ this.slider.autoheight = true; }

amazon web services - How Can I Authenticate my user credentials with AWSCongnito to Retrieve userIdentityId, Using aws-java-sdk? -

i create desktop rest api tool using javafx, user registerd(when user first time registerd websites, aws authenticate , register users awscongnito using:- aws sdk javascript ) user awscongnito enter credentials.. wants authenticate user awscongnito check user registerd or not awscongnito , if registerd user return useridentityid......... for try these java codes...... amazoncognitoidentity identityclient = new amazoncognitoidentityclient(new anonymousawscredentials()); identityclient.setregion(region.getregion(regions.eu_west_1)); getidrequest idrequest = new getidrequest(); idrequest.setaccountid("xxxxxxxxx"); idrequest.setidentitypoolid("xxxxxxxxxxxxxxxxxx"); getidresult idresp = identityclient.getid(idrequest); // congnitoidentityid different every request string congnitoidentityid = idresp.getidentityid(); getcredentialsforidentityresult result= ide

IBM Websphere Portal Menu Component Special Parameters -

i found out blog can pass 'special' parameters, such wcm_pagesize.[component_name] or wcm_page.[component_name], menu component when calling either directly or through wcm api. above parameters can override list presentation pagination option set in menu component. there other special parameters hidden somewhere, , how can find out them?

ios - Diaplay an activity while updating Braintree nuance to server -

Image
i following following tutorial https://developers.braintreepayments.com/guides/drop-in/ios/v4 in finding issues when post payment nuance server. drop in ui remains after enter card details. , options still enabled while payment nuance in progress user can select option here code btdropinrequest *request = [[btdropinrequest alloc] init]; btdropincontroller *dropin = [[btdropincontroller alloc] initwithauthorization:client_tok request:request handler:^(btdropincontroller * _nonnull controller, btdropinresult * _nullable result, nserror * _nullable error) { if (error != nil) { nslog(@"error"); } else if (result.cancelled) { nslog(@"cancelled"); [self dismissviewcontrolleranimated:yes completion:null]; } else { [self performselector:@selector(dismiss_bt) withobject:nil afterdelay:0.0]; [self postnoncetoserver:result.paymentmetho

python - use tkinter for nltk draw inside of jupyter notebook -

Image
i'm trying draw graph ( inline ) of nltk inside of jupyter-notebook . got error: tclerror: no display name , no $display environment variable i have tried set $display different values: $env display=0.0 # or $env display=inline # or $env display= but got error (or similar): tclerror: couldn't connect display "0.0" here code https://github.com/hyzhak/nltk-experiments/blob/master/main.ipynb last cell. environment: official anaconda3 docker -- continuumio/anaconda3:4.4.0 https://github.com/continuumio/docker-images . nltk==3.2.3 inside. python 3.6.1 |anaconda 4.4.0 (64-bit)| (default, may 11 2017, 13:09:58) type "copyright", "credits" or "license" more information. ipython 5.3.0 -- enhanced interactive python. how solve error , inline nltk graph inside of jupyter notebook ? update 1 http://www.nltk.org/_modules/nltk/draw/tree.html#draw_trees according sources of nltk tree draw uses tkinter . update 2 i

Knowing when Google Analytics has loaded when loaded via Google Tag Manager -

we're using gtm load universal analytics , want send custom events js ga. need this: ga('send', { hittype: 'event', eventcategory: 'legitimation', eventaction: 'is returning customer', noninteraction: true }); but don't know when ga has loaded since gtm makes async. how can know when ga() ready? sending ga events not through tag manager if load ga through gtm little bit tricky. can´t use normal events use if have ga hardcoded on page. here thread - answering question: https://productforums.google.com/forum/#!topic/tag-manager/c2j4nt8dbxw i suggest send datalayers instead of events, catch datalayers gtm , send events through gtm. makes lot easier.

cuda - Check failed: error == cudaSuccess (77 vs. 0) an illegal memory access was encountered -

i'm debugging lengthy code involves cuda operations. i' getting above mentioned error during call cudamemcpy(...,...,cudamemcpyhosttodevice) i'm not sure speficially related that. here code snippet: int num_elements = 8294400; // --> tried "1" here didn't work either! float *checkarray = new float[num_elements]; float *checkarray_gpu; cuda_check(cudamalloc(&checkarray_gpu, num_elements * sizeof(float))); cuda_check(cudamemcpy(checkarray_gpu, checkarray, num_elements * sizeof(float), cudamemcpyhosttodevice)); cuda_check(cudamemcpy(checkarray, checkarray_gpu, num_elements * sizeof(float), cudamemcpydevicetohost)); where cuda_check macro printing cuda error (this part of existing code , works fine other cudamemcpy oder cudamalloc calls not part of problem). strangely code snippet executed separately in toy *.cu example works fine. so assumption due previous cuda operations in program, there have been errors have no

javascript - Chrome bug with animating ellipsis text that changes colour. the text moves to the right -

this example of problem having. clicking on middle anchor causes move right. var anchors = document.getelementsbytagname('a'); var onselect = function () { var i, a; (i = 0; < anchors.length; += 1) { = anchors[i]; if (a === this) continue; a.classlist.remove('selected'); } this.classlist.toggle('selected'); }; (function () { (var = 0; < anchors.length; += 1) { anchors[i].addeventlistener('click', onselect); } }()); .table { display: table; background-color: indigo; width: 600px; } .row { display: table-row; background-color: seagreen; } .cell { display: table-cell; text-align: center; vertical-align: middle; } { padding: 10px; background-color: lightblue; display: inline-block; transition: 0.5s ease; width: 140px; height: 30px; line-height: 30px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-deco

phpunit - How to mock up a method whose name is "method"? -

class foo { public function method() { } public function bar() { } } if have class foo , can change bar 's behaviour using below syntax. $stub = $this->createmock(foo::class); $stub->expects($this->any()) ->method('bar') ->willreturn('baz'); limitation: methods named "method" example shown above works when original class not declare method named "method". if original class declare method named "method" $stub->expects($this->any())->method('dosomething')->willreturn('foo'); has used. https://phpunit.de/manual/current/en/test-doubles.html#test-doubles.stubs but question is, how can change foo::method() 's behaviour in phpunit? possible? this works fine: tested php 7.0.9/phpunit 4.8.27 public function testmethod() { $stub = $this->getmock(foo::class); $stub->expects($this->once()) ->method('method')

jquery - Prevent from executing previous JavaScript with turbolinks and highcharts //LazyHighCharts -

i'm using turbolinks 5 , rails 5 version , newest highcharts. t lazyhighcharts provides functionality turbolinks5 , wraps chart building javascript (function() { document.addeventlistener("turbolinks:load", function() { //code window.chart_my = new highcharts.chart(options); }); })() but when i'm navigating away page graph loaded turbolink, got error on newly loaded page. uncaught error: highcharts error #13: www.highcharts.com/errors/13 looks previous javascript loaded "turbolinks:load" reevaluating , causing highchart throw error, because in new dom there's no element highchart graph renderedto. i tried unbind "turbolinks:load" event document, doesn't work. reevaluates anyway. thought solution fork lazyhighcharts, rewrite layout_helper, javascript outputed after dom element, slow page page flow be loaded-dom (graph) evaluate js (sync) --> loaded-dom (graph) evaluate js (sync) ---> lo

jsf - How to compare a char property in EL -

i have command button below. <h:commandbutton value="accept orders" action="#{acceptordersbean.acceptorder}" styleclass="button" rendered="#{product.orderstatus=='n' }"></h:commandbutton> even when product.orderstatus value equal 'n' command button not displayed in page. here product.orderstatus character property. this is, unfortunately, expected behavior. in el, in quotes 'n' treated string , char property value treated number. char in el represented unicode codepoint, 78 n . there 2 workarounds : use string#charat() , passing 0 , char out of string in el. note works if environment supports el 2.2. otherwise need install jboss el . <h:commandbutton ... rendered="#{product.orderstatus eq 'n'.charat(0)}"> use char's numeric representation in unicode, 78 n . can figure out right unicode codepoint system.out.println((int) 'n') . <h:c

android - Mobile APP - API Authentication concept -

i have conceptual question , wanted know if kind enough help. i use simple example explain point of view. i have developed simple restful api node.js + express + mongodb backend. api saves hightscores android game app. use token-based authentication, tokens generated secret , trusted username/password (hardcoded or not). but still have doubt thinking safety... reverse engineering piece of cake since developer can find backend endpoint of api , use username , password (or hardcoded one) obtain token. then token ca used insert fake highscores via api. my questions are: is there way avoid security hole? is using restfull api correct way connect mobile app backend in server? if not, correct way develop app-server comunication save data in backend db?. i think can ofuscate code includes hardcoded username , password dont solve situation. pd: users question broad. made 3 concrete questions , topic avoid visibility of app information connect api. know there answers,

java - _ (underscore) is a reserved keyword -

i've replaced s in following lambda expression _ : s -> integer.parseint(s) eclipse compiler says: '_' should not used identifier, since reserved keyword source level 1.8 on. i haven't found explanation in jls §3.9 lexical structure / keywords. the place jls §15.27.1. lambda parameters it compile-time error if lambda parameter has name _ (that is, single underscore character). the use of variable name _ in context discouraged. future versions of java programming language may reserve name keyword and/or give special semantics. so eclipse message misleading, same message used both cases, when error generated lambda parameter or when warning generated other _ identifier.

c# - Winforms - Disable that when user drags form by the border to move it, it resizes the form -

i have winforms project form in maximized ( this.windowstate = system.windows.forms.formwindowstate.maximized ). when user drags form border move form around, resizes size have set (which not maximum screen size since not know values set minimumsize property maximized on every screen). i not want behaviour. want form stay maximized. have set formborderstyle fixeddialog , user can not resize form dragging borders. have tried re-set maximized window state in kinds of events, not seem work. does know how fix this? this might trick you this.minimumsize = this.maximumsize; this.sizegripstyle = sizegripstyle.hide; and can try write onresize event of form this.windowstate = system.windows.forms.formwindowstate.maximized change formborderstyle 1 of fixed values: fixedsingle, fixed3d, fixeddialog or fixedtoolbar // define border style of form dialog box. this.formborderstyle = formborderstyle.fixeddialog; // set maximizebox false remove maximize box. this.maximize

java - An app to add , delete , and view data -

i have created app has in first activity (home) 1 button, goes next activity. in next activity have put add, delete , list buttons, it's not working. please me out while deleting data should have check box select data in activity. i using android studio 2.1.3 <listview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@android:id/list" android:layout_centerhorizontal="true" android:layout_alignparenttop="true" android:layout_above="@+id/btnadd" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="list all" android:id="@+id/btngetall" android:layout_marginbottom="94dp" android:layout_alignparentbottom="true" android:layout_alignparentstart="true" /> <button android:layout_width="wrap_co

CLIPS: allowed-symbol -

i defined class restricted options slot: (defclass target (is-a user) (slot uuid (type string)) (slot function (type symbol) (allowed-symbols a1 a2 b c d e f g)) ) (make-instance target of target (uuid "a123") (function zzz) ) i expected clips complain "zzz" (not allowed), didn't. why? best regards. nicola constraint checking done statically (during parsing) , dynamically (during execution). default, static constraint checking enabled. slot assignments instances done dynamically when messages passing invoked because it's possible illegal value replaced legal value during execution of message handler. in following case, definstances not generate error when defined because invalid value replaced @ run time, defrule generate error because object patterns directly grab value of slot without using message passing. clips> (clear) clips> (defclass target (is-a user) (slot uuid (t

objective c - Ios 10 iPhone 7 Keyboard disappears when receiving notification -

i have uitexfield in chat view controller. when i'm editing answer in textfield, works fine execpt when receive push notification application. this push notification handled controller , uiwindow displayed on top of view controller. keyboard disappears .. on iphone 7 , ios 10. it works great on iphone 6 , ios 9.3 instance. i guess it's related ios 10 , uiwindow / uitextfield, don't know fix issue. do have idea ? thanks, you can listen when application becomes active, either implementing func applicationdidbecomeactive(_: uiapplication) in appdelegate, or through notification center notificationcenter.default.addobserver(self, selector: #selector(appbecameactive), name: notification.name.uiapplicationdidbecomeactive, object: nil) when user closes notification window, receive event, , can make textfield active again textfield.becomefirstresponder() to bring keyboard.

c# - RegularExpressionValidator behaves differently than UnitTest RegEx -

i created regex our needs - wrote unittest , after passed wanted upgrade frontend new regex - requiredfieldvalidator somehow doesn't match exact same string unittest does. here's unittest passes fluently: [testmethod] public void basictest() { using (shimscontext.create()) { var basicunicoderegex = new regex(@"^(?:(?:\p{isbasiclatin}|\p{islatin-1supplement}|\p{islatinextended-a}|\p{islatinextended-b}|\p{isipaextensions}|[\u0302\u030c]|\p{islatinextendedadditional}){2,}[*]?)$"); var ismatchstring = "floriân-d̂îétrich wäßterh@gen 1823*"; var isnotmatchstring = "べξぺき"; assert.istrue(basicunicoderegex.ismatch(ismatchstring)); assert.isfalse(basicunicoderegex.ismatch(isnotmatchstring)); } } and that's asp controls don't exact same string nor basic a-z one: <asp:textbox runat="server" id="edtnachname"></asp:te

html - How center text in absolute div inside td? -

in project, there html table each td contains div. have set div fit td, set position of td relative , div absolute. please consider following table , style: table { width: 500px; height: 600px; } table td { position: relative; } table td div { position: absolute; backgroundcolor: red; top: 0; right: 0; bottom: 0; left: 0; } <table id="thetable"> <tr> <th>a</th> <th>b</th> <th>c</th> </tr> <tr> <td> <div>a1</div> </td> <td> <div>b2</div> </td> <td> <div>c2</div> </td> </tr> <tr> <td> <div>a2</div> </td> <td> <div>b2</div> </td> <td> <div>c2</div> </td> </tr> </table>

objective c - ffmpeg in cocoa app does not do perfect streaming -

i using ffmpeg 3.1.4 if stream via command line on mac 10.10.5 done properly. however when compile source code , add library files in cocoa app , try stream errors. format context created using : avformat_alloc_output_context2(_avoutputformatcontext, _avoutputformat, "flv", "rtmp://path/swati.flv" file opened : avio_open(&_avoutputformatcontext->pb, cstreamname, avio_flag_write); however error received @ : avformat_write_header(_avoutputformatcontext, null); it gives -22 error any suggestion should do.

python - blank window after clicking run module in VIDLE -

i started learning vpython physics project. trying out simple code visual library , ran great first half our after close vpython , restarted test application doesn't "run" anymore. shows blank window , whenever try interact it shows "not responding". i'm running windows 10 pro 64bit 64-bit python-2.7.9 , vpython-win-64-py2.7-6.11 vpython.org. i've tried rebooting computer , reinstalling both python , vpython nothing helps. transfered projects macbook pro , runs perfectly. there solution this? thank you. have tried unistalling , re-installing python? know it's not professional answer, but...

java - Date in Spring MVC -

i trying use type=date in jsp page parse date controller. getting syntactically incorrect data (400 error). tried best find solution failed proper one. please me solve this. suggestions appreciated. my domain class: public class doctor{ @datetimeformat(pattern = "mm-dd-yyyy") private date dateofbirth=null; // setter , getter } jsp code: <f:input path="dateofbirth" type="date"/> i tried using @initbinder in contoller well, not succeed. i try run code , exception happens. cause comes date format on jsp page not same format on java bean. let's change format @datetimeformat(pattern = "mm-dd-yyyy") private date dateofbirth=null; to @datetimeformat(pattern="yyyy-mm-dd") private date dateofbirth=null; then problem resolved

Ruby - Rails 4 - Pundit - Policy and authorization error for a route #index_fr? -

sorry, didn't see place ask question pundit... thank help. i working on ruby on rails api , create url (.../api/v1/attractions/fr) list information 1 of models. i've got error message pundit : pundit::authorizationnotperformederror @ /api/v1/attractions/fr api::v1::attractionscontroller and error verify_authorized in lib/pundit.rb file def verify_authorized raise authorizationnotperformederror, self.class unless pundit_policy_authorized? end this configuration : # app/config/routes.rb namespace :api, defaults: { format: :json } namespace :v1 resources :lines, only: [ :index, :show ] collection '/fr', to: 'attractions#index_fr' end end end end # app/controllers/api/v1/attractions_controller.rb class api::v1::attractionscontroller < api::v1::basecontroller skip_before_action :authenticate_user! def index @attractions = policy_scope(attraction) @attractions = attraction.all en

python - Scrapy not able to extract links -

i have written crawler extract links , text webpage. structure of content div - ul - li - a here code from scrapy import spider scrapy.selector import selector stack.items import stackitem class stackspider(spider): name = "stack" allowed_domains = ["stackoverflow.com"] start_urls = [ "http://page.com", ] def parse(self, response): documents = selector(response).xpath('//*[@id="node-329"]/div[1]/ul/li') document in documents: item = stackitem() item['title'] = document.xpath('./a/text()').extract() item['link'] = document.xpath('/a/@href').extract() yield item basically, tag /a/@href not working. if comment , try extract text, works. please me.

oracle - Script is failing to pass XMLTYPE argument to PLSQL procedure -

i have script supposed open xml file , read contents , process it. plsql procedure test_load.bob_load has been created successfully. test_load.bob_load looks this: procedure bob_load(p_uuid in varchar2, xml_in in xmltype, msg_status out varchar2, xml_out out xmltype); end bob_load; / the script below calls procedure in final line , seems cause of error. assuming not recognising variable x xmltype. declare xml_file utl_file.file_type; chars_read integer; xml_clob clob; xamount integer :=32767; char_buffer varchar2(32767); x xmltype; begin xml_file := utl_file.fopen('/export/hm/testpit/bob', 'test.xml', 'r', xamount); dbms_lob.createtemporary(xml_clob, true); loop begin utl_file.get_line(xml_file, char_buffer); chars_read :=length(char_buffer); dbms_lob.writeappend(xml_clob, chars_read, char_buffer); dbms_lob.writeappend(xml_clob, 1, chr(10)); exception when no_data_found exit; en

swift3 - how to force the user to use native keyboard? (swift) -

i'm making app can make notes. when keyboard shown, textview shrunk keyboard size. however, when user use other keyboard native keyboard, code doesn't work good. is there way set native keyboard when user touch textview ? in advance :-)

r - geom_bar tied exactly to x and y axis (without aggregating) -

Image
i have data frame cols "x", "y" , ordinary rows ("x" , "y" can treated collections of numbers) . want plot bar-chart x tied "x" , y tied "y". tried use geom_bar(stat='identity') produce unexpected me result - figured out sums y-values of corresponding bar x-value. when tried stat_identity(geom='bar') result nice, 1 problem occured: can't figure out how set fixed alpha stat_identity (seems automatically binds number of samples corresponding bar x-value). here examples: ggplot() + geom_bar(data = xs, aes(x, y), stat = "identity", alpha = 0.5) ggplot() + stat_identity(data = xs, aes(x, y), geom = "bar", alpha = 0.5) so, once again, goal : to plot bar-chart x tied "x" , y tied "y" . hence second example solves it, there issue alpha parameter. update: file test data can found here . or github gist there . the problem want bar_plot dat

php - On modal close, swiper slider image index is not changed -

slider retaining value of slide index, not setting 0 other images in slider. once opened modal , close modal, slider index remain same other modal open. you can try put method myswiper.update(), or myswiper.update(true) hard update, when close modal

python 2.7 - Could someone explain this neural network machine learning code? -

import numpy np def nonlin(x, deriv=false): if (deriv == true): return (x * (1 - x)) return 1 / (1 + np.exp(-x)) x = np.array([[1,1,1], [3,3,3], [2,2,2] [2,2,2]]) y = np.array([[1], [1], [0], [1]]) np.random.seed(1) syn0 = 2 * np.random.random((3, 4)) - 1 syn1 = 2 * np.random.random((4, 1)) - 1 j in xrange(100000): l0 = x l1 = nonlin(np.dot(l0, syn0)) l2 = nonlin(np.dot(l1, syn1)) l2_error = y - l2 if (j % 10000) == 0: print "error: " + str(np.mean(np.abs(l2_error))) l2_delta = l2_error * nonlin(l2, deriv=true) l1_error = l2_delta.dot(syn1.t) l1_delta = l1_error * nonlin(l1, deriv=true) syn1 += l1.t.dot(l2_delta) syn0 += l0.t.dot(l1_delta) print "output after training" print l2 could explain printing out , why important. code seems make no sense me. for loop supposed optimize neurons in network given d

in app purchase - Is Windows Store app PurchaseResults.TransactionId the same as receipt's ProductReceipt->Id? -

do happen know, when do: var purchase_result = await curapp.requestproductpurchaseasync(product_id); string transaction_id= purchase_result.transactionid.tostring(); is transaction_id same productreceipt->id in purchase_result.receiptxml: ... <productreceipt id="c5318bba-4c8b-47f7-a6d5-f373f31c8b91" productid="mytestid1" purchasedate="2016-10-25t18:17:55z" expirationdate="9999-12-31t23:59:59z" producttype="durable" appid="myappid1"/> ... (i can't check in environment, i'd know before code written.) tested on debug environment, looks it's true.

python 3.x - PyGObject: How to format the text of a row in a treeview -

Image
having treeview rows, how can change properties of few rows? the treeview: more specificaly, wish change row color depending on "type" value.

How to set the size of MS chart in millimetre instead of pixel in C# -

i trying set size of chart object in millimetre in c# using following code: var chart = new chart(); chart.renderingdpix = 300; chart.renderingdpiy = 300; chart.creategraphics().pageunit = graphicsunit.millimeter; chart.size = new size(290, 200); // meant 290 millimetre not pixel ... chart.saveimage(@"d:\temp\tttt.png", chartimageformat.png); i expect size of saved image around 290 * (300/254) = 3425 pixel, whereas size of image 290 pixel 200 pixel? i tried set page unit in postpaint event using private void chartpostpaint(object sender, chartpainteventargs e) { var g = e.chartgraphics.graphics; g.pageunit = graphicsunit.millimeter; } but not work either! please me how set size of chart in millimetre or inches instead of pixel? from documentation of chart() seems default measurement unit px . but, use px input method give value on mm . write: private double tomm(int _px) { return this._px*(300/254); } so, have like: chart.size = ne

orientdb - Create Edges by ETL in same Class -

Image
1) class items itemid , name ready in database. 2) csv-file: 2 columns, itemid1,itemid2001 itemid1,itemid2345 itemid1,itemid2381 ... itemid2,itemid8393 itemid2,itemid8743 .. etc. question: how define etl json-file create edges between itemid1 , itemid's in col#2, , between itemid2 , col#2-peers. i tried reproduce problem. i had items and code connected them { "source": { "file": { "path": "mypath/item.csv" } }, "extractor": {"row": {}}, "transformers": [{ "csv": { "separator": "," } }, { "command" : { "command" : "create edge (select item iditem= '${input.iditem1}') (select item iditem= '${input.iditem2}')", "output" : "edge" } } ], "loader": { "orientdb": { "db

Laravel Eloquent relationship error -

i'm using laravel 5 blog. when use relation "hasmany", got following error "fatalerrorexception in 45abc28f0139bedaa1467307304d448ffaaed95e.php line 5: syntax error, unexpected '->' (t_object_operator) " here postcontroller <?php namespace app\http\controllers; use illuminate\http\request; use illuminate\view; use app\http\requests; use app\post; class postcontroller extends controller { public function index(){ $listeposts = post::all(); return view('post.index', compact('listeposts')); } public function show($detail){ $post = post::where('detail', $detail)->firstorfail(); $author = $post->user; $comment = $post->comments; return view('post.show', compact('post', 'author', 'comment')); } } ?> here post model <?php namespace app; use illuminate\database\eloquent\model; class post extends model { protected $guarded =

sharepoint - How to set Administrators and permissions in Business Data Connectivity Service using powershell -

while creating managed metadata service using powershell, new-spmetadataserviceapplication have property -administratoraccount , -fullaccessaccount set administrator , permissions. but in new-spbusinessdatacatalogserviceapplication have not found properties that. how can add users in administrators , permissions? thanks i got solution. here answer. $principal = new-spclaimsprincipal "domain\sp_farm" -identitytype windowssamaccountname $spapp = get-spserviceapplication -name "search service application" $security = get-spserviceapplicationsecurity $spapp -admin grant-spobjectsecurity $security $principal "full control" set-spserviceapplicationsecurity $spapp $security -admin the above given code worked if want add user in administrators. if want add user in permissions remove -admin.

java - Calendar functionality -

input date 2016-01-01 , why output shows 2016/02/01 ? string df = "2016-01-01"; string enddate=""; simpledateformat date_format_query = new simpledateformat("yyyymmdd't'hhmmss'z'"); calendar cal=calendar.getinstance(); string[] datestr=df.split("-"); int year=integer.parseint(datestr[0]); int month=integer.parseint(datestr[1]); int day=integer.parseint(datestr[2]); cal.set(year,month,day,23, 59,59); system.out.println(cal.gettime()); enddate=date_format_query.format(cal.gettime()); system.out.println(enddate); output: mon feb 01 23:59:59 est 2016 20160201t235959z answer question input date 2016-01-01, why output shows 2016/02/01? because calendar::month 0-based. month - value used set month calendar field. month value 0-based. e.g., 0 january. you should use int month=integer.parseint(datestr[1] - 1); correct solution never parse manually string containing date , better date simpl

Input type must be string type but got ArrayType(StringType,true) error in Spark using Scala -

i new spark , using scala create basic classifier. reading textfile dataset , splitting training , test data sets. i'm trying tokenize training data fails caused by: java.lang.illegalargumentexception: requirement failed: input type must string type got arraytype(stringtype,true). @ scala.predef$.require(predef.scala:224) @ org.apache.spark.ml.feature.regextokenizer.validateinputtype(tokenizer.scala:149) @ org.apache.spark.ml.unarytransformer.transformschema(transformer.scala:110) @ org.apache.spark.ml.pipeline$$anonfun$transformschema$4.apply(pipeline.scala:180) @ org.apache.spark.ml.pipeline$$anonfun$transformschema$4.apply(pipeline.scala:180) @ scala.collection.indexedseqoptimized$class.foldl(indexedseqoptimized.scala:57) @ scala.collection.indexedseqoptimized$class.foldleft(indexedseqoptimized.scala:66) @ scala.collection.mutable.arrayops$ofref.foldleft(arrayops.scala:186) @ org.apache.spark.ml.pipeline.transformschema(pipeline.scala:180) @ org.apache.spark.ml.pipelinesta

c++ - Ambiguous constructor between list<string> and string -

in following code, compiler gives me error when try pass list constructor: #include <string> #include <iostream> #include <list> class myclass { std::list<std::string> strings; public: void disp() { (auto &str : strings) std::cout << str << std::endl; } myclass(std::string const &str) : strings({str}) {} myclass(std::list<std::string> const &strlist) : strings(strlist) {} }; int main () { // compiles well: myclass c1("azerty"); c1.disp(); // compilation error, "call constructor of 'myclass' ambiguous": myclass c2({"azerty", "qwerty"}); c2.disp(); return 0; } i tried add explicit constructors' declarations, doesn't change anything. the problem string has constructor: template< class inputit > basic_string( inputit first, inputit last, const alloc