Posts

Showing posts from January, 2012

how to jump to next matching result which show in "Location list" more efficiently,when using cscope in VIM? -

how jump next matching result show in "location list" more efficiently,when using cscope in vim? hi, all: have tried these commands jump next result,but not work: | ø | shift | ctrl ------+--------+---------+--------- <f11> | :cprev | :cpfile | :colder <f12> | :cnext | :cnfile | :cnewer so, still still way: <c-w> j : go location list(quickfix list?) j : locate next line [enter] : go browse details when using source insight, need press <f9> same things. i want hotkey this. i have following in vimrc: nnoremap <f5> :cp<cr> nnoremap <f6> :cn<cr>

flex lexer - How do you declare this macro in lex? -

i'm new lex , i'm confused on how declare following macro, keyword. want keyword consist of either "if", "then", "else", or "while." i typed in lex: keyword "if" | "then" | "else" | "while" but compiler giving me "unrecognized rule error". when instead do keyword "if" it compiles ok. is limitation of lex? know in jflex can did above , it'll work fine. or doing incorrectly? thanks i can't test right now, off top of head: try putting values in parentheses (before first %%) keyword ("if"|"then"|"else"|"while") and use in rules (between %% , %%): {keyword} {//action} this how make class in lex, in rest of code can use {keyword} , recognized regex you've assigned in definition section (before first %%). also, can use class part of other rege...

python - Single Ultrasonic Sensor for Raspberry pi 2B+ not functioning from Pi Terminal -

i have been working 4-pin hc-sro4 ultrasonic sensors, 4 @ time. have been developing code make 4 of these sensors work simultaneously , after reorganizing wires installation on project , using basic code run one, cannot make sensor function. code follows: import rpi.gpio gpio import time trig1 = 15 echo1 = 13 start1 = 0 stop1 = 0 gpio.setmode(gpio.board) gpio.setwarnings(false) gpio.setup(trig1, gpio.out) gpio.output(trig1, 0) gpio.setup(echo1, gpio.in) while true: time.sleep(0.1) gpio.output(trig1, 1) time.sleep(0.00001) gpio.output(trig1, 0) while gpio.input(echo1) == 0: start1 = time.time() print("here") while gpio.input(echo1) == 1: stop1 = time.time() print("also here") print("sensor 1:") print (stop1-start1) * 17000 gpio.cleanup() after changing wires, sensors, , other components within circuit (including gpio pins) have ...

C++ When will be allocated memory in new object? -

i want write class, can hold 9 variables (physcial values). 5 of should there every time, want control other 4 flag (optional). my question is: if have 4 variables in private sector of class not use... allocated memory these? if yes: how can avoid it? i want allocate memory optional variables dynamic. for 4 variables, need declare member variables pointers initialized nulls in constructors. allocate , deallocate upon need, don't forget surelly deallocate upon class descrution. however, if intention memory gain, need evaluate sizeof of variables against sizeof of pointers them whether benefitial. has sense complex large data types, or not expose header files. in 32-bit platforms, 4 variables require 4*4=16 bytes pointers, when not used. plus memory consuming content pointers point when used.

xlsxwriter - Is there anyway print a worksheet respecting the tabular data in it in python? -

let's created workbook in python this: import xlsxwriter workbook = xlsxwriter.workbook(path) worksheet = workbook.add_worksheet() then populated , saved worksheet. in future need print worksheet , ask user save workbook. there anyway print console worksheet respecting tabular data in it?

How to get Client IP from UDP Transport in Mule ESB? -

i'm trying client ip , socket of udp package , save in flowvar variable using mel code #[message.inboundproperties.mule_remote_client_address] however variable null, have been able make work on tcp transport, know how remote client address in udp? this xml file: <mule xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:udp="http://www.mulesoft.org/schema/mule/udp" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/udp http://www.mulesoft.org/schema/mule...

cURL SSL CA Config with Windows Server 2008R2 and PHP 5.2 -

i trying curl ssl work under php 5.2 (required of older code have running) without disabling ssl verification. have downloaded latest (jan 20) cacert.pem file , placed in our php dir (e:\php) , run little test script: <?php function nxs_curltest($url, $msg, $testtext){ $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_useragent, "mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/47.0.2526.73 safari/537.36"); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_timeout, 10); curl_setopt($ch, curlopt_connecttimeout, 10); curl_setopt($ch, curlopt_verbose, true); curl_setopt($ch, curlopt_cainfo, "e:\php\cacert.pem"); $verbose = fopen('php://temp', 'w+'); curl_setopt($ch, curlopt_stderr, $verbose); $response = curl_exec($ch); $errmsg = curl_error($ch); $cinfo = curl_getinfo($ch); curl_close($ch); ...

postgresql - get psycopg2 errors in python3 -

i've psycopg2 version 2.6.1 want fetch errors, dont work excpected: try: pgconn = psycopg2.connect(database="foobar", host="dbtest.example.de", user="postgresss") except psycopg2.operationalerror: print(psycopg2.operationalerror.pgerror) .....: <member 'pgerror' of 'psycopg2.error' objects> or: try: pgconn = psycopg2.connect(database="foobar", host="dbtest.example.de", user="postgresss") except psycopg2.operationalerror: print(psycopg2.operationalerror.diag) .....: <attribute 'diag' of 'psycopg2.error' objects> how can see correct message "no pg_hba.conf entry host xyz" you need reference exception instance: try: pgconn = psycopg2.connect(database="foobar", host="dbtest.example.de", user="postgresss") except psycopg2.operationalerror e: print(e)

Send a XML request using jQuery -

i want communicate ups api via jquery , ajax. xml seems formed, works fine in similar asp script. figured skip asp script , communicate directly ups via jquery. however, when send request, response comes as: method: options status: load cancelled i assume missed kind of option in ajax request tells send xml ups server. $(document).ready(function() { $.ajax({ type: "post", url: "https://wwwcie.ups.com/ups.app/xml/xav", data: "<?xml version=1.0?>" + " <accessrequest xml:lang='en-us'>" + " <accesslicensenumber>licensenumber</accesslicensenumber>" + " <userid>user</userid>" + " <password>pass</password>" + ...

excel - Compare two columns for new values -

i trying come formula allow me compare 2 columns of names (a & b) , tell me how many new names there in column b, not present in column a. is, names not present in column a, present in column b, , return numerical value. any ideas?? quick simple way drag box/highlight around data want check (eg columns , b) , press f5 open goto box. click special @ bottom , check 'row differences' radio button. click ok , highlight differences.

TFS 2012->TFS2015 upgrade: Test case migration issue - Bug work item type not in RequirementCategory -

we facing pretty difficult issue , need assistance desperately.hoping can give direction? detail: have migrated tfs 2012 update 4 tfs 2015 update 1. centralizing our work migrating single team project (for purpose of post i’ll refer centralproject ). earlier, teams working in own team projects , testers capturing test plans, test suites , test cases in team projects. however migrating teams “centralproject” now, need migrate test plans, test suites , test cases centralproject. to migrate testing artifacts using “mtmcopytool” nice utility during migration facing following error: “the following work item type not valid: bug. must specify valid work item type belongs category reference name microsoft.requirementcategory.” to find root cause of issue exported category.xml file (from process template) both projects (the old team specific project new centralproject). note: a. have run “configure features” wizard on centralproject , not on team specific project. b. our tea...

html - Adjust Search Form on Navbar Bootstrap 3 -

trying code working hamburger glyphicon, , nav-brand on left hand side on right hand side (left - right) have search form -> message glyph -> user glyph i have in correct order now, reason cannot search form other side unless use pull-right , puts on opposite side of glyphs <!-- navigational bar --> <nav id="navbar" class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <button href="#menu-toggle" class="slidebar-toggle" id="menu-toggle"> <span class="glyphicon glyphicon-menu-hamburger blue"></span> </button> <span><a class="navbar-brand" href="/">title</a></span> </div> <!-- menu & search items right side of navbar --> <div class="navbar-collapse collapse pull-right"> <div cl...

php - getimagesize returns bool(false) -

i have created wordpress plugin can choose file media uploader: <input type="text" id="clb_setting_logo" name="clb_plugin_options[clb_setting_logo]" value="<?php echo esc_url( $options['clb_setting_logo'] ); ?>" /> <input id="upload_logo_button" type="button" class="button" value="<?php _e( 'choose image', 'clb' ); ?>" /> <span class="description"><?php _e('choose image button.', 'clb' ); ?></span> when choose image media uploader path taken field #clb_setting_logo can seen above. within function try access dimensions this: if (!empty($options['clb_setting_logo'])) { $imagesize = getimagesize($options['clb_setting_logo']); it runs on 2 servers, on server getimagesize returns bool(false), why? first thought happens because normal file path taken - this: " http://exmap...

elasticsearch - Logstash input twitter authorized error -

any 1 have experience below error ? please me logstash startup completed exception=>twitter::error::unauthorized, :backtrace=>["c:/logstash-1.5.1 ... i'm using below twitter config input{ twitter{ consumer_key => "" consumer_secret => "" oauth_token => "" oauth_token_secret => "" keywords => [""] full_tweet => true } } output { stdout { codec => dots } elasticsearch { host => "localhost:9200" } }

reactjs - React.js + Immutable.js: best practices for shouldComponentUpdate with filtered lists -

what best practices filtering immutable.list passing down child components regards shouldcomponentupdate ? illustrative example: i'm building calendar. has <week> component, holding 7 <day> components. <week> receives list of calendar events, renders <day> s , passes filtered subset of events each of them props. all <day> components have purerendermixin attached them, intent of preventing useless re-renders. but, given immutable.list.filter returns new object each time, when single event added, every <day> component receive 'new' event list prop , re-render, when 1 of them have same content. my current idea writing custom shouldcomponentupdate compares hashcode s of every list component decides re-render based on that. there better, more established way it? code example requested. assume <week> wired flux store , gets events it. day = react.createclass({ proptypes: { events: react.proptypes.instanceof(immut...

visual studio - What is actually contained in a *.suo file? -

i've read msdn article solution user options files the solution user options file used store user preference settings, , created automatically when visual studio saves solution. but sort of settings or information considered "user preference setting"? have weird issue 1 of solution files i've received company , fix seems periodically deleting *.suo whenever problem occurs. can't figure out sort of information stored there though. know it's nothing important , i'd still know , cannot seem find answer. basically suo file(i.e., solution user options) contains information related to user level customization breakpoints, bookmarks, outlining, debugger watches etc. also note if delete suo file visual studio create new one.

MS Access / forcing a date range 2 months back, bound to this week -

i have query need, date criteria, week ending 2 months prior. so example if ran query on monday (as of right now, last monday 2/1/2016), @ 11/29/2015 through 12/5/2015 inclusive (sunday through saturday). and next week if ran it, focus on 12/6/2015 through 12/12/2015 (sunday through saturday). however need return exact same date range no matter weekday of week run it. example date range 11/29/2015 through 12/5/2015 selected if ran on 2/1/2016 through 2/5/2016 (mon-fri). i'm not sure best way go this. i've considered somehow trying find next saturday , clocking few weeks, there doesn't seem week option in dateadd(). to first weekday of week sunday saturday: firstweekdate = dateadd("d", 1 - weekday(date()), date()) to go back, 8 weeks: eightweeksback = dateadd("ww", -8, firstweekdate) then can add/subtrack days intervals, example. eightweeksbacklast = dateadd("d", 6, dateadd("ww", -8, firstweekdate)) ...

javascript - Rails jquery can not load in any event -

i have tried solution in stackoverflow still have trouble jquery load on rails.it works on localhost not on heroku. so, here application.js file //= require jquery //= require bootstrap //= require jquery_ujs //= require_tree . here application.css file *= require_tree . */ here gem file; source 'https://rubygems.org' gem 'rails', '4.2.0' gem 'json', '~> 1.8.2' gem 'bcrypt', '3.1.7' gem 'bootstrap-sass', '3.2.0.0' gem 'sass-rails', '5.0.1' gem 'uglifier', '2.5.3' gem 'coffee-rails', '4.1.0' gem 'jquery-rails', '4.0.3' #//= require turbolinks assets gem 'turbolinks', '2.3.0' gem 'jbuilder', '2.2.3' gem 'sdoc', '0.4.0', group: :doc gem "mailboxer" g...

c# - Oracle.DataAccess DataRow.Field<decimal> InvalidCastException -

in code using system.data.oracleclient ora database connection. replace library (because obsolete) oracle.dataaccess . unfortunately found datarow.field() throws invalidcastexception . same behavior (decimal)x.rows[0]["colume_name"] . not have issue system.data.oracleclient . here code example using (var oracleconnection = new oracleconnection(connectionstring)) { using (var command = new oraclecommand("select * tr", oracleconnection)) { var result = new datatable(); var adapter = new oracledataadapter(command); adapter.fill(result); console.writeline(result.rows[0].field<decimal>("tr_seq_num")); //console.writeline((decimal)result.rows[0]["tr_seq_num"]); } } tr_seq_num has number(8,0) datatype , full exception is: system.invalidcastexception: specified cast not valid. @ system.data.datarowextensions.unboxt`1.valuefield(object value) code example working system.data.orac...

Python .py to .exe py2exe ERROR -

i made python program. when used py2exe convert exe , converted . when run program error shown: importerror: dll load failed: device not ready. this program : http://pastebin.com/kzpt71w5

php - TCPDF MultiCell with first line indent -

Image
i'd print text in multicell, lines first 1 indented. i want achieve this: this have far: $this->tcpdf->multicell(width, 0, $mytext, "", "l"); thanks suggestions! there no inbuilt method that, tcpdf offers usual methods of justifying text left, right,center, justify, , default , other methods vertical alignment. take @ multicell tcpdf you can try writing custom extention needs.

python - Twisted Deferred not displaying unhandled Exception without errback -

i'm reading through mckellar , fettig's twisted network programming essentials, 2nd ed. i running twisted 15.5.0 on python 2.7.10 on windows 7. in section deferred there's example supposed raise unhandled error in deferred - getting complete silence console when run minimal example below: minimal example from twisted.internet.defer import deferred def raiseerr(err): raise exception(err) d = deferred() d.addcallback(raiseerr) d.callback("oh no") $ python test.py (no output) minimal example actual book text the actual example book along these lines: from twisted.internet.defer import deferred def callback1(result): print "callback 1 said:", result return result def callback2(result): print "callback 2 said:", result def callback3(result): raise exception("callback 3") def errback1(failure): print "errback 1 had an error on", failure return failure d = deferred() d.addcal...

Android : TabLayout not responding to clicks -

i have created layout has drawerlayout , inside there toolbar, tablayout , viewpager. in tablayout, tabs not responding on clicking on them, changing on swiping. here code: <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context=".activities.homeactivity"> <linearlayout android:id="@+id/main_layout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_height="match_parent" android:layout_width="match_parent" ...

asp.net - Stop App Pools from Application's Physical Path - ServerManager C# -

using servermanager class possible app pool name physical path application? have been testing following code: using (var manager = new servermanager()) //using (var manager = servermanager.openremote("xxx")) //uncomment line enable remote debugging, comment out line 1821, update server name value { //get site using website id var site = manager.sites.singleordefault(m => m.id == websiteid); if (site != null) { //foreach (application app in site.applications) //{ bld.appendline("1. stopping app pool for: " + site.name); //get application pool name var application = site.applications.singleordefault(m => m.virtualdirectories["/"].physicalpath == @"d:/inetpub/testsite1"); //returns null //get application binded sitename var application1 = site.applications.singleordefault(m => m.path == "/testsite1"); //return info require ...

openerp - An exception while creating new user signup. Record does not exist or has been deleted. None -

i have installed auth_signup module ensure signup functionality, when trying signup new user either public user or template user, getting exception " record not exist or has been deleted. none " by investing on found in auth_signup/res_users.py , exception following line of code are: try: cr.savepoint(): return self.copy(cr, uid, template_user_id, values, context=context) i don't why cr.savepoint returning none

java - Runtime error PowerMock + Mockito: ProxyFrameworkImpl could not be located in classpath -

i trying use powermock android instrumenttestcase since test runs on android device libraries needs added apk. i encounter big issues powermock+mockito , dex files. have runtime error powermock+mockito in dependencies: org.powermock.api.extension.proxyframework.proxyframeworkimpl not located in classpath. and compilation error if include either cglib/cglib-nodep (has suggested in answers ): com.android.dex.dexexception: multiple dex files define lnet/sf/cglib/beans/beancopier$beancopierkey here part of gradle.build: androidtestcompile 'com.android.support.test:runner:0.3' androidtestcompile 'org.powermock:powermock-api-mockito:1.6.4' androidtestcompile 'org.powermock:powermock-module-junit4:1.6.4' androidtestcompile 'cglib:cglib-nodep:3.2.0' androidtestcompile 'cglib:cglib:3.2.0' what missing ? thanks in advance! i tried use powermock android instrumentation tests , got stuck same issue. here i've found on power...

reporting services - SSRS Scorecard in visual studios 2012 -

Image
hello community. i'm building scorecard looks attached. i can data appear simple text how these values out attached. results lead me putting labels on outside. sure. how still put them in line below each other. my question is: 1) attached format possible? if not 2) can line label outside , put additional fields 1 below give kind of desired effect. right pie chart has 5 metrics measuring (resulting in 5 pieces of pie). on time there going metric parameter showing many (7 max) pieces of pie. any appreciated. & environment.newline() fixed issue me able render each metric various attribute , or calculations. design #1 not possible solution given ssrs's limitations.

ruby - Running logstash script from bin folder and setting java.io.tmpdir -

i running logstash on centos 6.7 , have issue /tmp being mounted no-exec. have seen can use -djava.tmp.io.tmpdir= have been running logstash script in bin folder. can still specifiy jvm arg? have not been able figure out. i might confused, set tmp directory logstash other /tmp, since has noexec , fail. logstash. if run java -djava.io.tmpdir=/path/to/tmpdir affect programs running java? in logstash.lib.sh able set java_opts=$java_opts -djava.io.tmpdir=

How do I turn a c# attribute into a text content? -

i have solution several c# class libraries plugins in larger system. system registers plugins in windows' registry. describe registry keys in way can extracted compiled dlls , put text (.reg) file, preferably part of build process. is there predefined attribute type of metadata? , there command line tool or msbuild task can extract them? imagine attribute [system.attributeusage(system.attributetargets.class, allowmultiple = true) // multiuse attribute.] public class registrykey : system.attribute { public string name {get; private set;} public string type {get; private set;} public string data {get; private set;} public registrykey(string name, string type, string data) { name = name; type = type; data = data; } } consume reflection this var attrs = system.attribute.getcustomattributes(typeof(mahclass)); foreach (var attr in attrs) { if (attr registrykey) { var name = attr.name...

database connection (open/close) performance -

i've doubts database connections: should open , close database every time execute query? (it's every time) if i'm downloading json files @ same time, on it's onload function, while i'm running insert querys (some times @ same time), lets 1st insert function done, if close database , 2nd function still inserting data, closing 1st database connection affect 2nd one? (note these 2 separated functions, running @ same time, depending on onload function , size of json file data) if i'm using database connections, what's best approach in order avoid memory leaks , consume less memory? check here . says, in mobile app, don't use connection pooling. should close connection every time after you're done dealing it. might execute multiple queries @ once. in case, of course keep connection open until executed. no. use alloy models. alloy handles best database practices you.

.htaccess - why this doesnt work? rewriting URL -

i want rewrite url: /pit/employee/student-profile/2 this works: rewriterule ^employee/([0-9]+) employee/student-profile.php?id=$1 this doesn't work: rewriterule ^employee/student-profile/([0-9]+) employee/student-profile.php?id=$1 i want this: /pit/employee/student-profile/2

c# - ColdFusion .net integration service - unable to locate endpoint .net dll -

i have .net class library dll has service reference. endpoint specified in app.config file endpoint address="blah .. blah" behaviorconfiguration="clientcertificatebehavior" binding="wshttpbinding" bindingconfiguration="wshttpbinding_iauthnservice" contract="authnservice.iauthnservice" name="wshttpbinding_iauthnservice" so when dll built .dll.config file generated. the .dll used/invoked within coldfusion 10 this <cfobject type=".net" name="myinstance" class="davitauserauthentication.main" assembly="path/assembly name" > <cfset myxmldata =myinstance.testservicemethod("#param1#","#param2#")> i getting following error. "could not find default endpoint element references contract 'authnservice.iauthnservice' in servicemodel client configuration section. this might because no configuration file found appli...

c# - How to get TEntity by name -

i need tentitys mi dbcontext extract information each table. have little tables little information. have code don´t work. var dbsetpropertieslocal = local.getdbsetproperties(); foreach (var item in dbsetpropertieslocal) { type type = item.propertytype; // need type of actual tentity var enumerable = getlocal<type>(item.name, local); } this method returns data specified dbset name , te specified dbcontext public list<tentity> getlocal<tentity>(string name, dbcontext ctx) { var enumerable = (ienumerable<tentity>)(typeof([classnameofmycontext]).getproperty(name).getvalue(ctx, null)); return enumerable.tolist(); } this method properties dbcontext. use dbsets in dbcontext public static list<propertyinfo> getdbsetproperties(this dbcontext context) { var dbsetproperties = new list<propertyinfo>(); var properties = context.gettype().getproperties(); foreach (var property in proper...

c# - Nuget Telnet v0.6.0 Does not support Framework DNXCore, Ver5.0 -

Image
i created new mvc 6 app. used nuget install telnet. built project. error telnet not support dnxcore. have seen other posts people target other .net versions. can show me how or make telnet work? new mvc6 so, see fine in dnx 4.5.1. issue telnet developer needs fix? here project.jason created, vs 2015 sp1 mvc updates. { "usersecretsid": "aspnet5-webservermanager-8ce24b02-fbae-4228-9f7d-6b4bcec6833a", "version": "1.0.0-*", "compilationoptions": { "emitentrypoint": true }, "dependencies": { "entityframework.commands": "7.0.0-rc1-final", "entityframework.microsoftsqlserver": "7.0.0-rc1-final", "microsoft.applicationinsights.aspnet": "1.0.0-rc1", "microsoft.aspnet.authentication.cookies": "1.0.0-rc1-final", "microsoft.aspnet.diagnostics.entity": "7.0.0-rc1-final", "micro...

javascript - Getting error message on while AJAX-get on localhost with node.js -

i'm trying use ajax piece of string local server made using node.js , connection being done, status 200, working still can't piece of string. may provide me explanation of why happening? p.s.: i'm still newbie node.js node.js server code: // load http module create http server. var http = require('http'); // configure our http server respond hello world requests. var server = http.createserver(function (request, response) { response.writehead(200, {"content-type": "text/javascript"}); response.end("var = 'hello world';"); }); // listen on port 8000, ip defaults 127.0.0.1 server.listen(8000); // put friendly message on terminal console.log("server running @ http://127.0.0.1:8000/"); ajax call code: <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script> $.ajax({ async: 'false', typ...

The best way to apply a git patch via Ansible -

i need deploy bunch of ubuntu servers in same way, thought of using ansible instead of doing manually each time need new one. one of things need git clone upstream repo, , apply custom patch it. hoping save patch in ansible directory under files/, there doesn't seem "git apply" function in git ansible module. what's best practise of doing this? some options: run own git repo branch including patch. work, have maintain own git repo somewhere , make sure servers have access/permissions it. nice if configurations kept in ansible directory instead of relying on git repo have maintain. use shell or command module. easiest working, won't able re-run playbook. other suggestions? use ansible script module . write shell script attempts patch git repository local patch. handle various possibilities : being invoked during cookbook re-run. the latest upstream source containing identical change local patch. the local patch...

Statically link a GTK + WebKit 1.0 application -

i created or adapted simple webkit-1.0 demo (consisting of window webview inside displaying local html file): // from: https://wiki.gnome.org/projects/webkitgtk/programmingguide/tutorial #include <gtk/gtk.h> #include <webkit/webkit.h> static void destroywindowcb(gtkwidget* widget, gtkwidget* window) { gtk_main_quit(); } static gboolean closewebviewcb(webkitwebview* webview, gtkwidget* window) { gtk_widget_destroy(window); return true; } int main(int argc, char* argv[]) { gtk_init(&argc, &argv); gtkwidget *main_window = gtk_window_new(gtk_window_toplevel); gtk_window_set_default_size(gtk_window(main_window), 800, 600); webkitwebview *webview = webkit_web_view(webkit_web_view_new()); gtk_container_add(gtk_container(main_window), gtk_widget(webview)); g_signal_connect(main_window, "destroy", g_callback(destroywindowcb), null); g_signal_connect(webview, "close", g_callback(closewebviewcb), main_window); webki...

python - funtion roll takes the element at position n on the stack and makes it the top element -

so i'm trying create function called roll takes element @ position n on stack , makes top element. example, consider stack s 1 2 3 4, left end bottom of stack , right end top (so number 4 @ top of stack). roll(s, 2) yield 1 2 4 3 , roll(s, 3) yield 1 3 4 2. here have far def roll(s: stack, n: int): ''' >>> roll([1,2,3,4], 2) 1243 >>> roll([1,2,3,4], 3) 1 3 4 2 ''' s2 = stack() if s.is_empty(): return null else: s2 = s[::-1] i have hardest time when comes reversing lists , picking elements it. the instructions given problem says can't access element n positions top. have push top n - 1 elements on new stack. elements onto s after removing element n. from stack import * def roll (s, n): '''perform roll operation on s.''' t = stack() in range (n - 1): t.push(s.pop()) rollval = s.pop() while t.isempty() == false: ...

javascript - ForEach function with event listener -

i trying repeat less in code. in of codes have many elements, feel i'm doing much. it's time learned how reduce code , follow dry techniques. the code below how attaching eventlisteners elements. var at1, at2 ,at3 ,at4 ,at5 ,at6 , at7, at8, at1 = ui.byid("at1"); at1.addeventlistener("click", ui.at1func, false); at2 = ui.byid("at2"); at2.addeventlistener("click", ui.at2func, false); at3 = ui.byid("at3"); at3.addeventlistener("click", ui.at3func, false); at4 = ui.byid("at4"); at4.addeventlistener("click", ui.at4func, false); at5 = ui.byid("at5"); at5.addeventlistener("click", ui.at5func, false); at6 = ui.byid("at6"); at6.addeventlistener("click", ui.at6func, false); at7 = ui.byid("at7"); at7.addeventlistener("click", ui.at7func, false); at8 = ui.byid("at8"); at8.addeventlistener("click", ui.at8func, fals...

android - Not able to connect Phone gap mobile to phone gap desktop -

i new in apps development. wanted learn apps development & got know phone gap app development tool. i followed url: https://github.com/phonegap/phonegap-app-developer/issues/307 till 7 step i'm fine after stuck. i not able connect mobile desktop app. it's saying unable download archive server. i have mobile & pc connected in same wifi. else have do? please help thanks

Android permission doesn't work even if I have declared it -

i'm trying write code send sms android app, when try send sms sends me error: 09-17 18:37:29.974 12847-12847/**.**.****e/androidruntime﹕ fatal exception: main process: **.**.****, pid: 12847 java.lang.securityexception: sending sms message: uid 10092 not have android.permission.send_sms. @ android.os.parcel.readexception(parcel.java:1599) @ android.os.parcel.readexception(parcel.java:1552) @ com.android.internal.telephony.isms$stub$proxy.sendtextforsubscriber(isms.java:768) @ android.telephony.smsmanager.sendtextmessageinternal(smsmanager.java:310) @ android.telephony.smsmanager.sendtextmessage(smsmanager.java:293) @ **.**.****.mainactivity$3.onclick(mainactivity.java:70) @ android.view.view.performclick(view.java:5198) @ android.view.view$performclick.run(view.java:21147) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android...

python - Adding numbers to variables within an if statement -

i working on program choose random winner depending on number given. have completed program, having trouble finding solution 1 particular thing. here code: player1luck = 0 player1luck = player1luck / 2 player1luck = player1luck + 15 if player1luck > 50: player1luck = player1luck + 30 probabilities.extend([player1] * int(player1luck)) print(player1luck) print(player1 + " number is:", str(player1num) + "! have percentage win of: ", str(player1luck) + "%!") else: probabilities.extend([player1] * int(player1luck)) print(player1 + " number is:", str(player1num) + "! have percentage win of: ", str(player1luck) + "%!") so, first part (before if statement) fine, numbers adding etc perfectly. it's when inside of if statement numbers adding wrongly. example said add 30 player1luck variable if above 50, instead number drastically low used before decided ...

c# - How to register generic service -

this question has answer here: vnext dependency injection generic interface 1 answer i planning move system generic service layer. public interface iabcservice<tentity> tentity : class public class abcservice<tentity> : iabcservice<tentity> tentity : class i tried not work. services.addtransient<typeof(iabcservice<myentity>), abcservice(); .... .... .... i'm using of entities , along trying add properties. how can register generic service in asp.net core? i wanted try exact same thing before , i've got work this: services.addtransient(typeof(iabcservice<>), typeof(abcservice<>)); services.addtransient(typeof(iabcservice<person>), typeof(abcservice<person>)); do mind different structure, registering parameters in method. to elaborate, can see in example above, new dnx framework packa...

Transfer and trigger javascript code by ajax call with jsf -

i have jsf-code tag re-rendered ajax call. contains <h:outputscript>alert("gotcha")</h:outputscript> but executed on first load, not on ajax induced partial render. this minimal example, i'm trying trigger server-generated javascript right after ajax-call has returned, like <h:outputscript>#{scriptbean.getscript()}</h:outputscript> i've seen calling .trigger("click") in javascript code returned ajax call , asynchronize ajax calls , javascript code , how run call javascript code jquery element loads page ajax? , running javascript code called ajax , neither questions nor answers address question, least not without additional hint or explanation. and because want keep things small , simple, , because avoid above jsf:core (mostly), i'd prefer solutions avoid using yafl (== yet fancy library). edit: comment @balusc post more context: <composite:implementation> <h:form id="${cc.attrs.imgid}" ...

pentaho - Error Cannot call method "substring" of null in Script Values - PDI -

i'm using pdi spoon , wrote script in script values values, check , transform: var cte; cte = gera_cte (ctrc.getstring(), numero_cte.getstring()); function gera_cte (arg1, arg2) { if (arg2 == 0) { return arg1.substring(3,9); } else { return arg2.substring(4,10); } } but when script read last record, happen: 2016/02/05 17:28:40 - gera num cte.0 - error (version 5.0.1-stable, build 1 2013-11-15_16-08-58 buildguy) : erro inesperado 2016/02/05 17:28:40 - gera num cte.0 - error (version 5.0.1-stable, build 1 2013-11-15_16-08-58 buildguy) : org.pentaho.di.core.exception.kettlevalueexception: 2016/02/05 17:28:40 - gera num cte.0 - javascript error: 2016/02/05 17:28:40 - gera num cte.0 - typeerror: cannot call method "substring" of null (script#12) 2016/02/05 17:28:40 - gera num cte.0 - 2016/02/05 17:28:40 - gera num cte.0 - @ org.pentaho.di.trans.steps.scriptvalues_mod.scriptvaluesmod.addvalues(scriptvaluesmod.java:457)...

asp.net - Login failed for user 'HCDIDMZ\tcpisanweb' -

Image
i giving up. have setup database user tcpisanweb , gave access db owner of database. in web.config <add name="tcpisanconnectionstring" connectionstring="data source=phoenix\dmzsql;initial catalog=tcpisan;uid=hcdidmz\tcpisanweb;pwd=1tcpisan@web" providername="system.data.sqlclient" /> my sql setting database below: also, security login screenshot here and still error "login failed user 'hcdidmz\tcpisanweb'." also, in sql configuration manager, have setup tcp/ip enabled , assigned tcp port 1433 under ip addresses tab. i not sure else do, connect successfully. if in sql server error log have more details reason failure. i notice using sql authentication. out of box disabled , needs enabled - e.g. using security tab in server properties dialogue.

Python shell is open but not .py file? -

i using python 3.4.2 idle on windows. when open idle shell , open .py file, works, but when try open .py file double cliking, doesn't open, or proceed anything. looks if nothing has happened. i open .py file , press f5 see going on rather individually open file (i still beginner python, know can use pycharm, @ point, enough) when double click on .py file, run using python interpreter. can right-click on file instead , choose open in idle.

javascript - AJAX call returning 404 error due to incorrect content type -

Image
ajax call returns: http status 404 - /mycustomproject/en/web-inf/views/desktop/register/region.jsp incidentally, same url using make ajax call. $( "#address\\.country_del" ).change(function() { alert( "handler .change() called." ); $.ajax({ url: '/register/region', data: { country: $("#address\\.country_del").val() }, type: "post", }).done(function (data){}); }); controller: @requestmapping(method = requestmethod.post, value = "/region") public list<regiondata> getregion(@requestparam(value = "country") final string country) { final string isocode = country; final list<regiondata> regions = i18nfacade.getregionsforcountryiso(isocode); return regions; } my request , response seen on browser: i think problem content type of response ?! the issue here view resolver can see respons...