Posts

Showing posts from June, 2015

database - create a six character password in mysql 5.7 -

i need create user 6 character password in new mysql on mac. know lowest setting in 5.7 allows 8 characters. there anyway go around that? i type in create user 'newsier'@'localhost' identified 'special' it out puts error error 1819 (hy000): password not satisfy current policy requirements you using password validation plugin . default allows 8 characters , longer passwords. because can't check value of hash, @riggsfolly correct pre-hashing password work. however, if want change options , you'll need set value of validate_password_length system variable. can in configuration file or: set global validate_password_length=6;

Loading Spinner Style for Cordova Android -

i developing android application in cordova using inappbrowser plugin . there default load spinner , progress dialog. want change spinner style. in link find source of plugin , changed code spinner. there can change spinner icon style programmatically? my open source library blacktie.js has showloading function need!

haskell-stack getting TlsExceptionHostPort error -

been running stack/ghc inside debian 8.2 via vagrant while. morning: $ stack setup run outside project, using implicit global project config using resolver: lts-4.2 implicit global project's config file: /home/vagrant/.stack/global-project/stack.yaml downloading lts-4.2 build plan ...tlsexceptionhostport (handshakefailed (error_protocol ("certificate has expired",true,certificateexpired))) "raw.githubusercontent.com" 443 $ stack --version version 1.0.2, git revision fa09a980d8bb3df88b2a9193cd9bf84cc6c419b3 (3084 commits) x86_64 the same error remains if delete ~/.stack . did mess up? you might want try running stack -v setup able see files being downloaded. identify file(s) cannot downloaded due tlsexceptionhostport - there won't many of them - , run: curl -0 https://raw.githubusercontent.com/path_to_your_file > your_file once blocking file(s) have been downloaded, re-run stack setup . this might not clean approach, worked me.

kubernetes - How can I debug why my single-job pod ends with status = "Error"? -

i'm setting kubernetes cluster , testing small container. yaml file pod: apiversion: v1 kind: pod metadata: name: example spec: restartpolicy: never containers: - name: node image: 'node:5' command: ['node'] args: ['-e', 'console.log(1234)'] i deploy kubectl create -f example.yml , sure enough runs expected: $ kubectl logs example 1234 however, pod's status "error": $ kubectl po example name ready status restarts age example 0/1 error 0 16m how can investigate why status "error"? kubectl describe pod example give more info on what's going on also kubectl events can more details although not dedicated given pod.

c++ - Can't complete `auto` variable of C++11 in Code::Blocks -

this problem easy encounter, hard describe. use code::blocks 13.12, test code snippet follows: auto xxx = std::string("test"); xxx. when trailing . entered, there should context menu of auto completion popup, doesn't. but if give right type of xxx that: std::string xxx = std::string("test"); xxx. the complete menu pops normal. completion feature not support c++11 yet? or can't complete auto type? go settings -> compiler , find c++ compiler compiler flag -std=c++11, choose flag , save.

How to call a "C" function that is implemented in a ROM (or at an address) from ADA? -

i have question way call "c" function in rom, looking way without involving link-time changes. for example, know "c" function: int my_func(int a); is located @ address 0xffff_aaaa; so try: type rom_my_func access function (a : interfaces.c.int) return interfaces.c.int; pragma convention (c, rom_my_func); ada_my_func : rom_my_func := 16#ffff_aaaa#; the error can't around assignment of ada_my_func, unsure if there typecast, , attempt @ using system.address_to_access_conversions did not prove successful either. any pointer(s) examples and/or appreciated. if you’re using modern gnat , ada2012 can say function my_func (a : interfaces.c.int) return interfaces.c.int import, convention => c, address => system'to_address (16#ffff_aaaa#); note system’to_address gnat-specific; use system.storage_elements.to_address . i ran program using under gdb , got (gdb) run starting program: /users/simon/tmp/so/asker program re

integration - how to integrate HP QC 9.2 with HP QTP 11.0 on different machine -

i trying integrate qc 9.2 qtp 11.0. the qc 9.2 installed on local machine , qtp 11.0 @ other remote machine. want qc able communicate qtp 11 run test scripts. please me , please note quite new both qc , qtp. thanks in advance. you can perform same in testlab of qc in test instance before click run see options run on host or local in remote host specify remote machine name must in same network. @ same time in remote machine have install remote agent , in qtp options of test run check on allow other hp products.

Allow only one file of directory in robots.txt? -

i want allow 1 file of directory /minsc , disallow rest of directory. now in robots.txt this: user-agent: * crawl-delay: 10 # directories disallow: /minsc/ the file want allow /minsc/menu-leaf.png i'm afraid damage, dont'know if must use: a) user-agent: * crawl-delay: 10 # directories disallow: /minsc/ allow: /minsc/menu-leaf.png or b) user-agent: * crawl-delay: 10 # directories disallow: /minsc/* //added "*" ------------------------------- allow: /minsc/menu-leaf.png ? thanks , sorry english. according the robots.txt website : to exclude files except one this bit awkward, there no "allow" field. easy way put files disallowed separate directory, "stuff", , leave 1 file in level above directory: user-agent: * disallow: /~joe/stuff/ alternatively can explicitly disallow disallowed pages: user-agent: * disallow: /~joe/junk.html disallow

ruby on rails - Rails4 Jbuilder templates not being found -

i trying setup simple json response using jbuilder. controller follows: class api::v1::jobscontroller < api::v1::basecontroller def show @job = job.find(params[:id]) end end i have jbuilder template here: views\api\v1\jobs\show.json.jbuilder for reason when loading page in browser or postman controller hit, jbuilder template not found. a: rendered text template (0.5ms) completed 404 not found in 298ms if modify show action on jobs controller , add render json: @job desired output, of course isn't using jbuilder template. can't figure out why isn't seeing jbuilder template! added addition details if go .json url started "/api/v1/jobs/69407.json" 127.0.0.1 @ 2016-01-21 19:16:44 -0500 processing api::v1::jobscontroller#show json parameters: {"id"=>"69407"} job load (18.3ms) select "jobs".* "jobs" "jobs"."id" = $1 limit 1 [["id", 69407]] rendered t

sql - Wrong results in query with ORDER BY and ROWNUM -

i have problem query generated orm framework limit , order results in oracle database 11.2.0.1.0 64bit production. generated select looks this: select * (select this_.* plate this_ this_.id in (select distinct this_.id y0_ plate this_ ) order this_.name asc) rownum <= 10; trying understand problem created following sandbox: create table plate ( id integer primary key, name varchar2(30), description varchar2(255) ); insert plate values ( 1, 'aaa-1234', 'test1' ); insert plate values ( 2, 'bbb-1234', 'test2' ); insert plate values ( 3, 'ccc-1234', 'test3' ); insert plate values ( 4, 'ddd-1234', 'test4' ); commit; executing select in example returns: id name description 1 ddd-1234 (null) 2 ddd-1234 (null) 3 ddd-1234 (null) 4 ddd-1234 (null) in understanding should return: id name description 1 aaa-1234

Errors in Mozart / Oz with tree traversal examples from book " Concepts, Techniques, and Models of Computer Programming " -

thanks in advance, , apologies errors or confusing post. i getting errors tree traversal examples in section 3.4.6 of " concepts, techniques, , models of computer programming ". using oz / mozart2-2.0.0-alpha.0 (+build.4091-slitaz-1.01.ova). i entering below procedures , functions in book (two versions of book, different code) , getting errors when try execute. i've tried fixing them myself, cannot anywhere far. i'll give code, execution statements, errors, , test tree declaration (which seems valid can execute {lookup}, {insert} , {delete} on without issue) below. i'll include more notes think necessary, below.. so, question is wrong these bits of code or how using them or trees? included function , 3 procedures giving same issue complete (and maybe troubleshooting), think solution same all. tree declaration last, below. the code --> %all of below errors occur upon execution, not on definition of proc or function % version: vanroyharidi2

Ruby on Rails - ActiveSupport: Array Extensions -

in extensions array class (rails/activesupport/lib/active_support/core_ext/array/access.rb) following function defined: # returns beginning of array +position+. def to(position) if position >= 0 take position + 1 else self[0..position] end end why defined this? why can't do: def to(position) self[0..position] end according commit message of change in rails code , looks trying "avoid creating range objects". when arr[0..3] , 0..3 part becomes range object, gets used calculate subarray. i'm guessing trying save memory avoiding this.

java - Sessions in Spring MVC -

i know how sessions gets used in spring mvc retain value until user logged in. somewhere found model.addattribute("session_name",username); creating session & access ${username} in jsp page. real way web can define & access username variable in pages? how can check if session variable name username exists? in jsp used use if(null == session.getattribute("username")){ // user not logged in. }else{ // user logged in. } how can check in spring mvc ? session created spring container when need put in arguments of controllers method , injected. user login example @requestmapping(value=("login"),method=requestmethod.post) public string login(@requestparam("name")string name,@requestparam("pass")string pass,@requestparam("gname")string gname,httpsession session ) { user u1=new user(); u1.setname(name); u1.setgname(gname); u1.setpass(pass); user u2=dao.findbyi

apache spark - Why specifying schema to be DateType / TimestampType will make querying extremely slow? -

i'm using spark-csv 1.1.0 , spark 1.5. make schema follows: private def makeschema(tablecolumns: list[sparksqlfieldconfig]): structtype = { new structtype( tablecolumns.map(p => p.columndatatype match { case fielddatatype.integer => structfield(p.columnname, integertype, nullable = true) case fielddatatype.decimal => structfield(p.columnname, floattype, nullable = true) case fielddatatype.string => structfield(p.columnname, stringtype, nullable = true) case fielddatatype.datetime => structfield(p.columnname, timestamptype, nullable = true) case fielddatatype.date => structfield(p.columnname, datetype, nullable = true) case fielddatatype.boolean => structfield(p.columnname, booleantype, nullable = false) case _ => structfield(p.columnname, stringtype, nullable = true) }).toarray ) } but when there datetype columns, query dataframes slow. (the queries simple groupby(), sum(

php - How to update boolean values to 0 if checkboxes are not checked when form is submitted -

i have game users information inserted database every time finished survey after game, display these information in table format in website, below there submit button, when clicked check checked , unchecked boxes , update values of boolean in database, able check checked checkboxes not checked when submitted not updated in database. here code check uncheck , checkboxes when submitted <?php include_once("dcconnect.php"); if(!empty( $_post['mycheckbox'] )){ $strallusernamecombined = implode("','", $_post['mycheckbox']); $sql = "update dcusers set dcchecked = 1 dcid in ('{$strallusernamecombined}')"; mysqli_query($link, $sql) or exit("result_message=error"); } else { $strallusernamecombined = implode("','", $_post['mycheckbox']); $sql = "update dcusers set dcchecked = 0 dcid in ('{$strallusernamecombined}')"; mysqli_q

android - Is it possible to implement a FlowLayout with RelativeLayout properties? -

i create custom relativelayout has 2 views in 1 row: 1 on left side of screen (android:layout_alignparentstart="true") , 1 on right (android:layout_alignparentend="true"). view on right grow toward left view until takes space between 2 views. move new line under view on left. i have implemented modified version of romain guy's flowlayout extends relativelayout. however, class seems ignore relativelayout's align properties , sticks views right next each other. there way implement such layout anchor views left , right? flowlayout class: public class flowlayout extends relativelayout { private int mhorizontalspacing; private int mverticalspacing; public flowlayout(context context) { super(context); } public flowlayout(context context, attributeset attrs) { super(context, attrs); typedarray attributes = context.obtainstyledattributes(attrs, r.styleable.flowlayout); mhorizontalspacing = attributes.getdimensionpixelsize(r.styleable

api - Sphinx doc to Swagger doc migration -

i have working api solution uses sphinx doc locally uses restructured text (rst) input. i'm looking @ possibility switch swagger either converting rst yaml or using swagger solution takes rst files input. there existing tools purpose? has gone through such conversion? haven't used try this. converts sphinx swagger

php - Is it possible to extend a library class extend MY_Controller class -

is possible extend library class extend my_controller class in application - core folder. yes can. can totally replace them, needed. see manual: https://ellislab.com/codeigniter/user-guide/general/core_classes.html (for legacy codeigniter)

spring mvc - Stream Multiple PDFs to render in Browser -

i'm in need of way stream multiple pdfs rendered in browser one. challenges multiple. the files large , don't have static copy on server. retrieve back-end , stream. retrieval not stream byte array. cannot change behavior of back-end. i have option of retrieving pdf in 1 go, takes time pdfs run in thousands. other option retrieve in segments, gives multiple individual pdfs. the number of pages or length cannot determined api not reliable. my question - there way combine , stream byte arrays of multiple pdf 1 stream , render in browser? i've tried stream byte array of 1 pdf after another. however, browser renders first pdf , after close stream. i'm ok use javascript solution pdf.js, provider i'm able show , let users print/save whole document. it spring mvc application jsf front-end on websphere application server. have liberty of adding open source libraries dependencies if required.

php - Yii2 sendFile() - Trying to get property of non-object -

hey guys trying set download button user can download file, uploaded using kartik's file input widget(single upload). the codes resides inside crud generated view/controllers/models. this view button code, <?= html::a('download uploaded file', ['download', 'id' => $model->form_id], [ 'class' => 'btn btn-danger', 'data' => [ 'confirm' => 'are sure want download item?', 'method' => 'post', ], ]) ?> controller function(download), public function actiondownload($id) { $model = $this->findmodel($id); $path = yii::getalias('@web') . '/uploads'; $file = '/borang/'.$model->form_id.'.'.$model->file->extension; if (file_exists($file)) { yii::$app->response->sendfile($file); } } controller function(upload inside create action) public function actioncreate() {

linux - How do I use a UNIX bash script variable assigned a value from the date command in a conditional statement -

this question has answer here: how set variable output command in bash? 12 answers i'm new unix coding please kind. trying use date command obtain current month's abbreviated name , store variable. i'm using variable check against in if statement see if equal "jan" should be. echo variable first test value , prints jan. unfortunately, if statement refuses catch variable being equal "jan" though seems though is. have tried using cut command select first 3 characters rule out trailing white spaces or other format issues. ideas why date function not working expected? here script: #! /bin/bash month= date +"%b" if[[ $month == "jan"]] echo current month, january has 31 days else echo error retrieving month! fi i running terminal on ubuntu virtual machine bash script. bash can finicky if syntax (e.g. s

javascript - Grunt - Unable to compile less to css using grunt-contrib-less -

i've feeling doing extremely silly here not sure what. i using grunt-contrib-less compile less css doesn't seem work @ all. shows no error or , not sure why. please find jsbin here - http://jsbin.com/hagavokige/edit?html,js if prefer gist - https://gist.github.com/ktkaushik/b3fc7aa4445e88c46bdf i use here. i've been stuck @ 1 long. i using - using grunt v0.4.5 using node v5.1.1 using npm v3.312 update 1 there no output @ all. event added --debug flag in cli no luck. haha :) rename "less" task different name myless, running main less tasks, creating infinite loop https://github.com/gruntjs/grunt-contrib-less/issues/279

ruby on rails - Matching substrings in fulltext search not working -

in rails application, i'm using solr search. substring matching working fine on local server matching full words on deployment server. searchable block searchable text :firstname, :lastname, :login, :mail boolean :member integer :status end schema.xml is. <fieldtype name="text" class="solr.textfield" omitnorms="false"> <analyzer> <tokenizer class="solr.standardtokenizerfactory"/> <filter class="solr.standardfilterfactory"/> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.porterstemfilterfactory"/> <filter class="solr.edgengramfilterfactory" mingramsize="2" maxgramsize="10" side="front" /> </analyzer> </fieldtype> what doing wrong? (adding answer here inform of possible undesired behavior) fyi, when make changes "text" fieldtype in schema

How to perform row wise math operations in SQL Server? -

how perform row wise math operations in sql server? eg: want find average of marks particular student shown in table below student mark1 mark2 mark3 avg ----------------------------------------------- ram 78 81 56 71.67 jos 92 67 54 71.00 saj 98 91 89 92.67 select student, mark1, mark2, mark3, 1.0 * (mark1 + mark2 + mark3)/3 avg yourtable add 1.0 * convert sum result float before division

swift - NSTask Output to Text View Sometimes Goes to Console -

directing output of nstask object text view works of commands i've tried, not git clone. in instance, output goes xcode console, even though have no print statements in code . code written below, goes console. if use commented out lines instead, output goes text view. var clonetask: nstask! @iboutlet var tv: nstextview! override func viewdidload() { super.viewdidload() clonetask = nstask() clonetask.launchpath = "/usr/bin/git" clonetask.arguments = ["clone", "https://github.com/edelmar/dht22_reader"] //clonetask.launchpath = "/usr/bin/env" //clonetask.arguments = ["pwd"] clonetask.pipeoutputto(tv) clonetask.launch() } pipeoutputto: function in extension on nstask, extension nstask { func pipeoutputto(logger: anyobject) -> anyobject { let pipe = nspipe() self.standardoutput = pipe let stdouthandle = pipe.filehand

sql - Filter top by group -

we have following situation query in oracle. we have orders , transactions, order being mapped multiple transactions. order orderid|customer|..... transaction orderid|transactionid|transactiondate|..... we need display latest transaction each order. how go in oracle 11g? this 1 method select t1.* transactions t1 inner join ( select orderid,max(transactiondate) transactiondate transactions group orderid ) t2 on o.orderid=t.orderid , t1.transactiondate =t2.transactiondate

apache spark - kafka to sparkstreaming to HDFS -

i using creatdirectstream in order integrate sparkstreaming , kafka. here code used: val ssc = new streamingcontext(new sparkconf, seconds(10)) val kafkaparams = map("metadata.broker.list" -> "sandbox:6667") val topics = set("topic1") val messages = kafkautils.createdirectstream[string, string, stringdecoder, stringdecoder]( ssc, kafkaparams, topics) now want store messages hdfs. right this? messages.saveastextfiles("/tmp/spark/messages") saveastextfiles("/tmp/spark/messages") - persist data in local file system , in case provided folder structure ("/tmp/spark/messages") part of local hdfs show in hdfs directory because saveastextfiles leverages same mapereduce api's write output. the above work in scenarios spark executors , hdfs on same physical machines in case hdfs directory or url different , not on same machines, executors running, not work. in case need ensure data pers

Find results get removed in intellij? -

Image
ok search eval() in php project find leaks. i 60 hits. @ first result , want see if maybe security leak. see eval() gets called eval($myspecialvar) search $myspecialvar see not security problem. want check next entry of eval() search result... not there more. have search again eval() very beginning, , figure out 60 results....?!? is there no more clever way it? edit the open in new tab grayed out me you have check "open in new tab" setting. location depends on search you're using - if text find, setting under result options section: if you're searching usages, in edit > find > find usages settings: note option enabled if have search results displayed. in case: first search eval(), before searching $myspecialvar you're clicking on "open in new tab". yet option after searching eval() pin search results, new search opened in new tab:

vsts - TFS setup for one small team and multiple parallel projects -

we have 5 member dev team , building multiple internal projects in parallel. upon researching, find best create 1 team project, our situation, correct? if so, please recommend how setup proper iterations projects , timelines? http://arstechnica.com/civis/viewtopic.php?f=20&t=1293955 sounds similar situation can't seem more 1 "current" iteration in tfs agile process board? per team project can have 1 iteration tree (and therefore 1 current iteration). should decide based on how plan team resources. want have single backlog whole team or different backlogs each project. each has pros , cons, depending whether want use visual studio team service planning team resources or planning projects. using single team project / backlog with approach easy plan whole team resources next sprint. can assign people different tasks in different projects , have overview on team working. assign work items different projects can use area path. planning , tracking pr

java - Efficient Way to find most similar value -

i have value such color, , list of string : {colour,color,main color, main colour, theme, brand, subject ..... etc} i similar string , except searched string itself. in example expect colour. (not color) i sorting list using following rules , ranked rules : filter same value check upper lower cases delete whitespaces. trim using levenshtein distance string order : main color = color main check acronym : hp - hewlett packard it takes lot of time go on list of 1000 relevant candidates. have lots of candidates check. any other efficient way? original code: public static list findsimilarity(string word, list candidates) { list recommendations = new arraylist(); if (!word.equals("")) { (string candidate : candidates) { if (!word.equals(candidate)) { //1. same token , lower/upper cases , ignore white spaces if (stringutils.deletewhitespace(word).equalsignorecase(stringutils.deletewhitespace(candidate))) {

spring - Unable to deploy to server running Tomcat -

i trying deploy spring application server running apache tomcat. however, error: severe: containerbase.addchild: start: … org.apache.catalina.lifecycleexception: failed start component [standardengine[catalina].standardhost[localhost].standardcontext[/ruralivrs]] @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:154) @ org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:901) … @ org.apache.catalina.core.containerbase.addchild(containerbase.java:877) @ org.apache.catalina.core.standardhost.addchild(standardhost.java:633) @ org.apache.catalina.startup.hostconfig.deploywar(hostconfig.java:976) @ org.apache.catalina.startup.hostconfig$deploywar.run(hostconfig.java:1653) @ java.util.concurrent.executors$runnableadapter.call(executors.java:511) @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runwor

python - BIT 0 represented as '\x00' -

Image
in database table have column defined as: using query: query = text( "select * %s " % "atable" "%s=%s , " % ("done", 0) ) result = engine.execute(query) row = result.fetchone() when call print row['done'] '\x00' . for generation of tables sqlacodegen generated done columns this: column('done', bit(1), nullable=false), am missing configuration in sqlalchemy? don't want convert hex int everywhere goint use bit column. edit problem not sqlalchemy seems pymysql blame. try have chapter of python documentation . however, in case, might enough ord convert hex: >>> = b'\x00' >>> '\x00' >>> str(a) '\x00' >>> ord(a) 0 >>> ord('\x5f') 95

php - Receiving empty data on ajax request in spite of available data -

i trying sub-category list of category ajax request through admin-ajax.php . categories under custom post type. each category has sub categories. ajax request returns no data in console . jquery.ajax({ type: 'post', url: classipress_params.ajax_url + "?action=dropdown-child-categories", datatype: "json", data: { cat_id : category_id }, //show loading when dropdown changed beforesend: function() { ... }, //stop showing loading when process complete complete: function() { ..... }, error: function(xmlhttprequest, textstatus, errorthrown){ .... }, // if data retrieved, store in html success: function( data ) { // child categories found build , display them if ( data.success === true ) { console.log(data); .... } } }); am doing wrong? category_id okay, tested that. result in console: { success: true,

java - Threads in spring: synchronized or @Scope("proptery") performance -

i have 2 spring beans. jmshandler receives message . processed , handed on mailhandler sends mail. i've seen messages arrive @ jmshandler in exact same time. when entering sendmail method 1 of both isn't processed (no mail sent). expect that's threading issue. i've got 2 possiblities handle issue: a) set sendmail method synchronized. means next execution stopped until first processed. public class jmshandler { @autowired private mailhandler mailer; public void handlemessage(message msg) { mailer.sendmail(msg.getpayload().tostring()); } } @component public class mailhandlerimpl implements mailhandler { @override public synchronized void sendmail(string message) { // fancy stuff... // mail message. } } b) define mailhandler scope "prototype" , using lookup applicationcontext. public class jmshandler { @autowired private applicationcontext ctx; public void handlemessage(messag

java - Xlsx issue, cell.getCellStyle().getDataFormat() changing value after adding or removing date -

Image
i using block of code cell.getcellstyle().getdataformat() . changes it's values after adding or removing content xlsx. should done in case? first cell 21/01/2016 returns cell.getcellstyle().getdataformat() retuns 14 when add rows cell.getcellstyle().getdataformat() returns 165 if (dateutil.iscelldateformatted(cell)) { double val = cell.getnumericcellvalue(); date date = dateutil.getjavadate(val); string datefmt = null; system.out.println(cell.getcellstyle().getdataformat()); xssfcellstyle style = (xssfcellstyle) cell.getcellstyle(); system.out.println("in int: "+style.getdataformat()); if (cell.getcellstyle().getdataformat() == 14) { system.out.println("14"); datefmt = "dd/mm/yyyy"; } else if(cell.getcellstyle().getdataformat() == 165) { system.out.println("165"); datefmt = "m/d/yy"; } else if(cell.getcellstyle().getdatafo

html - no request for favicon -

Image
i writing simple node.js file server using node's http module (i not using express). i noticed initial request firing , subsequent request being made css , javascript; however, not getting request favicon. when @ at page inspector, don't have errors , favicon not showing in resources. html // inside head of index.html <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon"> <link rel="icon" href="img/favicon.ico" type="image/x-icon"> node.js http.createserver(function(req, res){ // log each req method console.log(`${req.method} request ${req.url}`); }).listen(3000) there default icon mustache, not custom icon. missing here? just in case it's relevant question. using node v4.2.4 edit i think has how reading , serving file. if ( req.url.match(/.ico$/) ){ var icopath = path.join(__dirname, 'public', req.url); var filestream = fs.createreadstrea

java - How to limit number of downloaded (parsed) entries (items) in ROME Fetcher -

i using rome & rome fetcher getting feeds ( atom/rss ) in javaee web application. in cases limit number of downloaded/parsed entries/items. want avoid scenario: , ten make sublist() . any ideas or solved somehow ? thanks. rome rome fetcher i don't see feasible way download few of them - @ end of day send request server , decide send you. to me sounds bit premature optimization. dependent on you're building, might better caching data if you're worried performance. anyhow, can't see anyway can rome, done if built own xml parser.

java - Android handler handleMessage() method call -

when instantiate handler object (for example lets using anonymous inner class) in main ui thread. handler h = new handler () { @override public void handlemessage (message msg) { /* code handle message */ } }; we can pass handler object reference other thread can post status updates ui thread using reference ( h.sendmessage() ). doubt: have not provided our custom anonymous class reference h handler anywhere activity class or ui thread. in order call overridden method ui thread must have object reference our class. how overridden handlemessage() called instead of default one? your handlemessage() being called looper . can see here looper calls dispatchmessage on message target handler . , target being assigned this reference when post message inside handler. flow follows: you post message on handler, internally creates message object reference handler. that message put message queue managed main ui thred (in particular case) when ti

javascript - How to debug this error: Uncaught (in promise) Error: Objects are not valid as a React child -

the full error in console: uncaught (in promise) error: objects not valid react child (found: object keys {id, name, description, css, ephemeral, readonly, toppost}) if meant render collection of children, use array instead or wrap object using createfragment(object) react add-ons. check render method of exports .(…) i don't know error means , doesn't point me line in code, don't know do. i using api.jsx fetch data imgur (specifically call in topic-store.jsx ) , trying render data in topic-list.jsx main.jsx var react = require('react'); var header = require('./header'); var topiclist = require('./topic-list'); module.exports = react.createclass({ render: function () { return <div> <header /> {this.content()} </div> }, content: function () { if (this.props.children) { return this.props.children } else { return <topiclist/

javascript - How to extract text from an script result -

i using script visitor's country name: <script src="http://www.seocentro.com/cgi-bin/promotion/geo/geocn.pl" type="text/javascript"></script> this geocn.pl url returns: document.write('<a href="http://www.seocentro.com/tools/online/ip-country.html" style="text-decoration: none;">somecountryname</a>'); what should use next obtain window.alert name of country? window.alert(country); use below code: <script> $(document).ready(function(){ alert($("a:first").text()); }); </script>

java - Can I map a relationship inJPA with a unique target that is not the id? -

i'd able use dot notation 1 entity another. let's have table users : id username acronym ----------------------- 1 john nasa and table institutions : id instname acronym --------------------------- 9 natl. air... nasa for historical reasons, users table not contain reference institution id, acronym unique. is there possibility dot way entity john name of nasa in john.getinstitution().instname() ? i'd avoid having run query through entity manager. have tried it? as far can see then, depending on jpa provider, following mappings may or not supported. @entity public class institution{ @onetomany(mappedby = "institution") private set<user> users; } @entity public class user { @manytoone @joincolumn(name = "acronym", referencedcolumname = "acronym") private institution institution; } failing this, other possibility create database view based on following , map user en

c++ - Deleting specific content of XML file -

in xml file have node subchilder have 2 attributes, have delete 1 whole subchild while considering 1 attribute. have given example below xml file: <umg> <abc name="abc" value="1"></abc> <abc name="abc1" value="2"></abc> <abc name="abc2" value="3"></abc> <abc name="abc3" value="4"></abc> <abc name="abc4" value="5"></abc> </umg> i have delete whole subchild "name" attribute, because value can changed. my code until now: void::mainwindow::xml() { qstring path = ui->lineedit_7->text(); qdebug()<<path; if(!file.exists() ) { qdebug() << "check file"; } qdomdocument dom; dom.setcontent(&file); qdomnodelist nodes = dom.elementsbytagname("abc"); qdomnodelist loc_childnodes = nodes.at(