Posts

Showing posts from March, 2015

java - Jackson error : unacceptable character '' (0x0) special characters are not allowed -

i'm trying parse yaml data using jackson mysql error saying there special character. error : com.fasterxml.jackson.databind.jsonmappingexception: special characters not allowed [source: java.io.stringreader@5528a42c; line: 13, column: 68] (through reference chain: com.app.resultcontentmodel["opinion"]) ... caused by: com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.yamlexception: special characters not allowed @ [source: java.io.stringreader@5528a42c; line: 13, column: 68] ... caused by: unacceptable character '' (0x0) special characters not allowed in "'reader'", position 1027 my dependencies file : <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.6</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.dataformat</groupid> <artifactid>jackson-dataformat-yaml...

select - Need Simple Query in Sql server -

my criteria: i have distributor (parent table), has many retailer (child table). need last joined retailer name. i.e distributor list | total no. retailer | last joined retailer name my query : select distname, count(retailername) totalretailer, max(retailername) lastposted, max(lastjoinretail) lastjoindate distributor d right outer join retailer r on d.distno = r.retailno , r.status = 0 , d.status = 0 group distname..... i not getting last joined "retailer name"?. select [distributor_name] , [total_no._retailer] , [last date] , (select name tbl_retailer [last date] = createddate) [last joined retailer name] ( select d.name 'distributor_name' ,count(r.name) 'total_no._retailer' ,max(r.createddate) 'last date' tbl_distributor d inner join tbl_retailer r on d.id = r.distributorid gr...

How can I replace a character in mongodb with another character in a collection? -

i have collection contains documents having delimiter "|". { "_id" : objectid("57bbe4342a00d122b0075fbb"), "phone_search" : "9255958588|9138115601|9034223813", "address" : "central complex market|rohtak road|sonipat|rohtak road-131001|sonepat|haryana", "national_catidlineage_search" : "/10255012/|/10406930/", "area" : "rohtak road", } is there command in mongodb can replace "|"s ","s documents in collection? this question answered here how replace string in documents in mongo // change 'collection' name yours in db.collection.find , db.collection.update: var cursor = db.collection.find(); while (cursor.hasnext()) { var x = cursor.next(); print("before: "+x['phone_search']); x['phone_search'] = x['phone_search'].replace('|', ...

android - Difficulty to set latitude & longitude in marshmallow in url & displaying item -

Image
difficulty set latitude & longitude in marshmallow in url & displaying item. setting latitude & longitude in url after hitting url want information on basis of hitting url . while did not set lat & long in url dynamically . list coming image while have set lat & long manually in url when hitting url use below code progress bar loader moving not getting list . i setting lat & long in url dynamically . please see error in code not getting in marhsmallow nothing getting while below marshmallow getting loader moving , moving . see in image public class listviewactivity extends activity implements locationlistener { // log tag private static final string tag = listviewactivity.class.getsimplename(); // change here url of server api // private static final string url = "https://comida-95724.herokuapp.com/api/v1/restaurants?per_page=5&km=1&location=true&lat=19.0558306414&long=72.8339840099"; private pro...

perl - Use of uninitialized value in concatenation (.) or string at App/DuckPAN/Web.pm line 484 -

i trying develop instant answer goodie duckduckgo. using codio , after testing code, when try run webserver @ port 5000, error: ddg::zeroclickinfo { parents www::duckduckgo::zeroclickinfo public methods (4) : does, has_structured_answer, new, structured_answer private methods (0) ...

python bs4 find return none -

i learning python web scraping,i practice on http://search.proquest.com/ , site need purchase think universities have it. from urllib.request import urlopen urllib.request import urlretrieve bs4 import beautifulsoup import urllib.error import http.cookiejar import requests import pymysql conn = pymysql.connect(host ='localhost',user = 'root',passwd = 'gaojia',db = 'mysql') cur = conn.cursor() # cur.execute("create database wsj") cur.execute("use wsj") # cur.execute("create table wsj.list (id int not null auto_increment, url varchar(255) not null, title varchar(1000) , abstract varchar(20000),created timestamp not null default current_timestamp, primary key (id))") issues = set() # store url of desired issues articles = set() # store url of articles of given issue def store(title,abstract,url): cur.execute("insert pages (title,abstract,url) values (%s,%s,%s)",(title,abstract,url)) cur.connection.co...

python - Event when entry's xview changes -

i creating simple program using tkinter . want function called every time xview property of entry changes. there doesn't seem event this, @ least not 1 can find. the <configure> event fires on resize, handled, doesn't fire when actual value i'm tracking changes in different way, such user dragging mouse see end of entry. here code: import tkinter tk import tkfiledialog root = tk.tk() class repositoryfolderframe(tk.frame): def __init__(self, root): tk.frame.__init__(self, root) self.build_gui() self.set_entry_text("searching...") #root.after(0, self.find_repo) self.prev_entry_index = len(self.entry.get()) root.bind("<configure>", self.on_entry_resize) #self.entry.bind(???, self.on_entry_change) #self.entry.bind("<configure>", self.on_entry_change) def on_entry_resize(self, event): cur_entry_index = self.entry.xview()[1] if ...

Why Netty use boss and work eventloop rather than one eventloop -

i've question netty. seems use boss eventloop keep accepting connection, , worker eventloop keep doing data i/o. the source code showed 1 eventloop repeat calling select/poll/epoll. there more 1 eventloop burning cpu. why can't netty use 1 eventloop handle both server listen socket , accepted socket? there architecture called seda. benefit of boss eventloop : thread used accept connection not blocked io threads used read data socket , work in handler. use executionhandler eventloop. netty changing , improving thread modeling. , changed lot in netty 4.

css - Background image in fullscreen -

i use code show image full screen in desktop <style> body{ background: url("under-constraction1.jpg")no-repeat fixed 0 0 / cover ; } </style> but in mobile in firefox browser piece of image shown how can fix it? use body{ background: url("under-constraction1.jpg") no-repeat center center fixed -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }

/usr/bin/sudo: Permission denied in cygwin when installing "libpng-dev" -

i getting error follows in cygwin $ make g++ -o3 -w -wall -g -c -o imageiopng.o imageiopng.cpp imageiopng.cpp:19:17: fatal error: png.h: no such file or directory compilation terminated. make: *** [<builtin>: imageiopng.o] error 1 after followin answer. png.h file not found - linux , i had error in following, $ sudo apt-get install libpng-dev -bash: /usr/bin/sudo: permission denied i have read in linux, don't need write sudo , instead of can use yum . so, have tried yum install. but, says traceback (most recent call last): file "/usr/bin/yum", line 22, in <module> import yummain file "/usr/share/yum/yummain.py", line 22, in <module> import clientstuff file "/usr/share/yum/clientstuff.py", line 18, in <module> import rpm importerror: no module named rpm almost, in every steps, getting errors. problem? yum useful package, seems installed not correctly.i have installed yum-2.0.7. to i...

c# - Disable closing of a certain WinForm -

i'd know if there's possible solution (i hope there is) problem. have 2 forms, login form , main form. i'd know if there's way disable closing of main form , allow closing when sign out (which redirects user login form) , allow closing when login form active. sorry bad english. i tried using event below, yes stops me closing main form when signed-out did same login form didn't want happen. there way this? private void form1_closing(object sender, canceleventargs e) { e.cancel = true; } i suppose using loginform dialog (showdialog), use dialogresult.ok when user logs successful .... private voif logoutbutton_click(object sender, eventargs e) { _logged = false; } ..... private void loginbutton_click(object sender, eventargs e) { loginform _loginform = new loginform(); if(_loginform.showdialog() == dialogresult.ok) { _logged = true; } } ...... private void form1_closing(object sender, canceleventargs e) { if(...

javascript - GraphQL Args error: argument type must be Input Type but got: function GraphQLObjectType(config) { -

on server start ( node index.js ) getting following error graphql nodejs server: error: query.payment(data:) argument type must input type got: function graphqlobjecttype(config) { _classcallcheck(this, graphqlobjecttype); this error happened when changed original args string args: { data: { type: graphql.graphqlstring } }, to object type: args: { data: { type: graphql.graphqlobjecttype } }, i need object type need send several fields params. graphql server: var query = new graphql.graphqlobjecttype({ name: 'query', fields: { payment: { type: graphql.graphqlstring, args: { data: { type: graphql.graphqlobjecttype } }, resolve: function (_, args) { // there more data here, // want return string return 'success!'; } } } }); how can al...

handle errors and exceptions logging in node.js -

i'm newbie development , earlier year started playing around node.js , liked much. i've been gradually increasing logging mechanism in node.js. starting console.log , using ram disk log file in ram disk. this method of logging ram disk close desire. don't want permanent file, want persistence if node.js crashes don't loose prior logs. using forever restart node automatically, means not have active terminal can watch logs , errors in real time. instead have method reads logs ram disk , serves me. here code saving logs in file in ram disk , in memory buffer: function generatelog(level, logmsg) { var loglevel; if(level == leveloff) return; // no need go further, logging has been disabled. else if(level == leveldebug) loglevel = "debug: "; else if(level == levelinfo) loglevel = "info: "; else if(level == levelwarning) loglevel = "warning: "; else if(level == levelerror) ...

Automate website search using powershell and output results to text file -

i'm trying automate task of checking sites spf records , wondering if have got around this. need able go site , type in domain name eg. stuff.co.nz , click on get spf record , output result text file. below i've attempted do. appreciated. $ie = new-object -com internetexplorer.application $ie.visible=$true $ie.navigate("http://www.kitterman.com/spf/validate.html") $ie.document.getelementsbyname("domain").value="stuff.co.nz" $ie.document.getelementsbyvalue("get spf record (if any)").click() i think it's not necessary launch ie accomplish this. the below script should make http post request spf records , saves output text file. $postparams = @{domain='stuff.co.nz';serial='fred12'} invoke-webrequest -uri http://www.kitterman.com/getspf2.py -method post -body $postparams -outfile output.txt if still use ie, need save whole page. refer this post .

saml - Spring Security multiple authentication provider not getting to the second one -

i have app uses spring security, using custom authentication provider fine. need add saml idp mix now. got sample saml application , running , use security context base. have manager defined this: <security:authentication-manager alias="authenticationmanager"> <security:authentication-provider ref="myauthenticationprovider" /> <security:authentication-provider ref="samlauthenticationprovider"/> </security:authentication-manager> now when submit login form username/passeord in saml idp, can see logs calls myauthenticationprovider, throws badcredentialsexception, nothing. don't see other exception, , not peep out of samlauthenticationprovider. i have read documentation few times, , seems indicate can done, don't see example. have example of using saml , basicauthentication? i don't think need add authentication provider new idp. need add new ?? in cachingmetadatamanager bean. in securit...

php - How to send a value in Database to Google analytics? -

i manage web application made symfony2(php). measure value in database (for example, register user per day) on management screen made myself. but want compare value data on google analytics. want know how send value in database google analytics. you check data import section on property level, in admin menu. can find various range of data, can imported analytics, , applied reports. it's not clear post, if of these solution you. detailed description of feature available here . personally, i'd reversed, , collect ga data management screen via ga api, if had management screen already.

python - QT Webengine for Ubuntu -

i have several different qt packages installed development environment on ubuntu 15.04 (3.19.0-51-generic), , can't seem imports correct. error running in pycharm is: pyqt5.qtwebenginewidgets import qwebenginepage importerror: no module named 'pyqt5.qtwebenginewidgets' the following packages have installed already, believe relevant follows: python3-pyqt5 python3-pyqt5-dbg python-pyqt5 python-pyqt5-dbg pyqt5-dev-tools pyqt5-dev python-pyqt5.qtwebkit python3-pyqt5.qtwebkit python-pyqt5.qtwebkit-dbg python3-pyqt5.qtwebkit-dbg what missing here? note project explicitly requires following in readme: qt 5.5+ pyqt5.6+ furthermore, understand webengine , webkit 2 different things (i giving stab). can't find webengine pyqt5 anywhere in official vivid repository. tried installing libqt5webengine5-dev , libqt5webengine5 https://launchpad.net/~ethereum/+archive/ubuntu/ethereum-qt packages same result, perhaps need add python path. can lend hand (im .net develo...

Rails Mysql ActiveRecord::ConnectionNotEstablished -

i created new rails application, when started server tried connect gave server error activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection' activerecord (4.0.0) lib/active_record/connection_handling.rb:79:in `retrieve_connection' activerecord (4.0.0) lib/active_record/connection_handling.rb:53:in `connection' activerecord (4.0.0) lib/active_record/query_cache.rb:51:in `restore_query_cache_settings' activerecord (4.0.0) lib/active_record/query_cache.rb:43:in `rescue in call' activerecord (4.0.0) lib/active_record/query_cache.rb:32:in `call' activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call' activerecord (4.0.0) lib/active_record/migration.rb:369:in `call' actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__713349442__call__callbacks...

sql server - Group XML Column Data -

using sql server 2012. have table containing group identifier , small snippets of xml. here sample: create table temp ( groupid [int] not null, rawxml [xml] null ) insert temp values (1, '<item><criteria type="state" values="ca"/><criteria type="state" values="tx"/><criteria type="state" values="fl"/></item>') insert temp values (1, '<item><criteria type="manager" values="tim"/></item>') insert temp values (2, '<item><criteria type="name" values="walters"/></item>') insert temp values (2, '<item><criteria type="manager" values="tim"/></item>') what want group snippets of xml groupid form larger xml document end result structured this: <parent> <group groupid="1"> <item> <criteria t...

c# - Reliable way of determining whether an user account requires a password? -

i wrote code snippet listing local users , whether account uses password (credits leniel macaferi ) var users = (from managementobject user in new managementobjectsearcher(@"select * win32_useraccount").get() (uint)user["accounttype"] == uf_normal_account && (bool)user["localaccount"] && !(bool)user["disabled"] && (bool)user["localaccount"] && !(bool)user["lockout"] orderby (string)user["name"] ascending select new { username = (string)user["name"], passwordrequired = (bool)user["passwordrequired"] }).toarray(); foreach (var user in users) console.writeline("{0} (requires password: {1})", user.username, user.passwordrequired ? "yes" : "no"); using code there 1 specific user, win32_useraccount.passwordrequired field set false though user using password. changing password via system co...

iOS - Showing background app status -

Image
i'm making app runs in background mode getting user's location. then works perfectly, datas received in background mode, wanted show google maps status when app in background. screenshot : ( it's in french sorry, think you'll know mean ). so, how thing ? feature's name ? thank you

JS error Vb.net embedded browser -

i have program embedded browser. when try load site, (motdgd.com) throws error the value of property 'atob' null or undefined not function object line 101 char 5 i have searched extensively, cannot find answer. public class form1 dim count integer dim adlink string private sub webbrowser1_documentcompleted(sender object, e webbrowserdocumentcompletedeventargs) handles webbrowser1.documentcompleted end sub private sub button1_click(sender object, e eventargs) handles button1.click count = 1 userlink = textbox1.text label1.text = userlink webbrowser1.url = new uri(userlink) end sub private sub label2_click(sender object, e eventargs) handles label2.click end sub end class solved initializecomponent(); registrykey key = registry.currentuser.opensubkey(@"software\microsoft\internet explorer\main\featurecontrol\feature_browser_emulation", true); key.s...

haskell - No instance for Show arising from a use in "main" level -

i have code reads files , parses using uu.parsing lib returns abstract sintax tree , shows on screen. i received error message "no instance show" in functions originated in tokensparsertobytestring , applyparser using parseio (of uu.parsing lib) , inherited signatures until main. fixed signatures problem in main function. added instance show in signature have next compilation error: no instance (show (io j2s)) arising use of ‘main’ in expression: main when checking type of io action ‘main’ the complete error message is: $ cabal build building java2scala-1.0... preprocessing library java2scala-1.0... in-place registering java2scala-1.0... preprocessing executable 'java2scala' java2scala-1.0... preprocessing executable 'test' java2scala-1.0... [5 of 5] compiling main ( test/main.hs, dist/build/test/test-tmp/main.o ) test/main.hs:27:1: no instance (show (io j2s)) arising use of ‘main’ in expression: main when checking typ...

php - Email Validation is not working in jQuery -

guys want validate email address in php file "validate.php". not working. not getting response "validate.php" file. jquery code: function validate_email(email){ $.post('validate.php', {email:email}, function(data){ $('msg').text(data); }); } $('#input').focusin(function(){ if($('#input').val() === ''){ $('#msg').text("enter valid email address"); } else{ validate_email($('#input').val()); } }).blur(function(){ $('#msg').text(""); }).keyup(function(){ validate_email($('#input').val()); }); "validate.php" code: <?php if(isset($_post['email'])){ $email = $_post['email']; if(!empty($email)){ if(filter_var($email, filter_validate_email) === false) echo 'email address not valid, enter valid email address.'; els...

verilog - How does clock gating in RTL design work? -

Image
i'm trying understand how clock gating works in rtl design. i've example wave here: description: 1st signal gated_clock 2nd signal clock_enable 3rd signal ungated_clock so there 3 cycles in wave (let's cycle 0,1,2). in cycle 0, clock_enable low , gated_clock turned off. in cycle 1 clock_enable goes high , in next cycle (cycle 2) gated_clock turns on. now, during simulation see cases incoming data received @ cycle 1 being registered module gated clock (using gated_clock). it's kinda odd me , don't quite understand how it's possible. the logic this: always_ff @(posedge gated_clock, negedge reset) begin if (~reset) begin some_val <= 1'b0; end else begin if (in_valid==1'b1 && in_ready==1'b1) begin some_val <= in_val; end else begin some_val <= 1'b0; end end end so i'm seeing if in_valid , in_ready high in cycle 1 some_val register incoming in_val data ,...

python - Differentiating between compressed .gz files and archived tar.gz files properly? -

what proper way deal differentiating between plain compressed file in gzip or bzip2 format (eg. .gz) , tarball compressed gzip or bzip2 (eg. .tar.gz) identification using suffix extensions not reliable option it's possible files may end renamed. now on command line able this: bzip2 -dc test.tar.bz2 |head|file - so attempted similar in python following function: def get_magic(self, store_file, buffer=false, look_deeper=false): # see we're indexing if look_deeper == true: m = magic.magic(mime=true, uncompress=true) else: m = magic.magic(mime=true) if buffer == false: try: file_type = m.from_file(store_file) except exception, e: raise e else: try: file_type = m.from_buffer(store_file) except exception, e: raise e return file_type then when trying read compressed tarball i'll pass in buffer elsewhere via: file_buffer = open(file_nam...

Show all possible values of a dimension by another dimension with crossfilter.js and dc.js -

let's consider dataset : var dataset = [{day :"monday", elapsed_time:120, person:"x"}, {day :"monday", elapsed_time:140, person:"y"}, {day :"tueday", elapsed_time:160, person:"x"}, {day :"tueday", elapsed_time:168, person:"y"}, {day :"wednesday", elapsed_time:140, person:"x"}, {day :"wednesday", elapsed_time:160, person:"y"}, {day :"thurday", elapsed_time:50, person:"x"}, {day :"thurday", elapsed_time:60, person:"y"}, {day :"friday", elapsed_time:80, person:"x"}, {day :"friday", elapsed_time:170, person:"y"}]; with crossfilter , dc.js want create barchart, show elapsed_times days, ie : in x-axis, monday friday , in each day show 2 values witho...

python - PyQt: QListView in connection with QTexEdit -

i have qlistview , qtextedit on form , them working together, follows: if checkbox checked, index of respective item in qlistview should displayed in tbe qtextedit; if checkbox unchecked, value should deleted qtextedit. indexes should displayed cumulatively, delimited 1 character (say, comma), eg., 0,1,3. conversely, if value typed in the qtextedit, respective checkbox should automatically checked (or none, in case value entered not correspond index in qlistview). i attempted catch indices of selected checboxes attaching handler clicked event of qlistview, below: <del>@qtcore.pyqtslot(qtcore.qmodelindex) def onclick(self, index): editbox.settext(str(index.row()))</del> but got error message: "nameerror: global name 'self' not defined". any hints? in advance assistance can provide! here complete test code: edit: changed code below deal event handlers. import sys pyqt4 import qt, qtcore, qtgui class mainwindow(qtgui.qwidget):...

angularjs - Why is FormController expecting a name in my form to inject itself? -

i noticed if form has name attribute this: <form name="myform"></form> then can hold of formcontroller this: var form = $('form')[0]; var formcontroller = $(form).scope().myform; what deal pattern? why does't angular put " formcontroller " in form's scope - common when implementing custom directives? i curious understand if pattern should expect in other cases , if should follow while implementing own directives. thanks the documentation mention in comments state when using name attribute, formcontroller published onto current scope. means access controller need $scope.myformsname . <!doctype html> <html ng-app="myapp"> <head> <script data-require="angular.js@1.5.9" data-semver="1.5.9" src="https://code.angularjs.org/1.5.8/angular.js"></script> <link rel="stylesheet" href="style.css" /> <script src=...

amazon web services - AWS Lambda function execution time when using AWS Elastic Transcoder -

i transcode videos lambda function. example node.js: transcoder.createjob(params, function(err, data) { if (err) { ... } else { ... } }); does function hang until video encoded? or job started lambda function execution stops right away? thanks!

web scraping - Using python to scrape contents of jsp webpage -

using python , requests library, have list of zip codes, , these compile list of nearby cvs store addresses each. can extract address field without problem, cannot dynamically generate next page since there no "&zip=77098" (or equivalent) in url. each time visit page seemingly random "requestid" value. http://www.cvs.com/store-locator/store-locator-landing.jsp?_requestid=1003175 if copy link , paste in browser routes me default cvs location. there way send zip code in url or otherwise dynamically set location search for? this (not working) code 1 zip code. returns "default" locations, not locations specific zip in in header: data = {"search":"77098"} urlx = 'http://www.cvs.com/store-locator/store-locator-landing.jsp' cookies = requests.get(urlx).cookies rx = requests.post(urlx, cookies=cookies,data=data, headers={'user-agent':'mozilla/5.0 (windows nt 6.1) applewebkit/537.36 (khtml, gecko) chrom...

python cant use a function to change the value of a variable -

i'm rather new python , wondering why function , therefore if statement returns "100" instead of "83" in code below. i'm not sure if i'm missing obvious seems if should work. this code i'm refering to: playerhp = 100 def attack1(x): x = (x - 17) return x while playerhp > 0: enemyattack = input("please type word 'attack': ") if enemyattack.upper() == "attack": attack1(playerhp) print(playerhp) else: break as mentioned in comment above, issue comes down scoping. try googling more info, i'll try give beginner level explanation here. when declare variable, exists in specific scope, , can accessed variables in same or lower scope. example, var1 = 5 if var1 < 6: print(var1) var2 = 7 print(var2) #error on line var1 exists in highest scope in example, accessible lower ones, print(var1) line works fine. however, var2 in higher scope statement at...

scala - Skolemization of existentially typed expressions -

in scala, following expression raises type error: val pair: (a => string, a) forsome { type } = ( { a: int => a.tostring }, 19 ) pair._1(pair._2) as mentioned in si-9899 , answer , correct according spec: i think working designed per sls 6.1: "the following skolemization rule applied universally every expression: if type of expression existential type t, type of expression assumed instead skolemization of t." however, not understand this. @ point rule applied? apply in first line (i.e., type of pair different 1 given type annotation), or in second line (but applying rule second line whole not lead type error)? let's assume sls 6.1 applies first line. supposed skolemize existential types. can make in first line non-existential type putting existential inside type parameter: case class wrap[t](x:t) val wrap = wrap(( { a: int => a.tostring }, 19 ) : (a => string, a) forsome { type }) wrap.x._1(wrap.x._2) it works! (no type error.) m...