Posts

Showing posts from March, 2013

regex - Parsing IBM server error message in Java -

i have error message need parse. dsnl027i agentname server distributed agent luwid=xx00000.x000.xx0000000x00=00000 thread-info=xxxx00:255.255.255.255:xxxx00:application_name:*:*:*:* received abend=00x reason=00000000 there thousands of these messages need parse. follow similar pattern 1 below. dsnl027i agent-type distributed agent luwid luw-id=token thread-info thread-information received abend=abend-code reason=reason-code additionally, these patterns available on ibm documentation site. http://www-01.ibm.com/support/knowledgecenter/ssepek_10.0.0/com.ibm.db2z10.doc.msgs/src/msgs/db2z_msgs.dita i need capture of fields in message , create xml object, example given error message below. <agent-type>agentname</agent-type> <luwid>xx00000.x000.xx0000000x00</luwid> <token>00000</token> <thread-information>xxxx00:255.255.255.255:xxxx00:application_na

javascript - Extending Touch EventListener to Additional DOM Element -

i used codrops article/experiment create interactive environment local group use @ conferences. problem default interaction not intuitive. template used flickity.js , seems classie.js create sliding interface having trouble with. the page can found here: www.eyeconic.tv/ky-ffa/ issue: way activate view-full clicking on html element: <h2 class=".stack-title"> // after stack active should able activate full view clicking on first .stack-item used create thumbnail below it. entire div should clickable. users touching everywhere on screen , not clicking title desired action. hope makes sense. in other words should able click stack-title , image below title of each stack pull stack full view mode on screen. click x or anywhere else on screen close full view. the following located in main.js , reference found create events referring to. // function initevents() { stacks.foreach(function(stack) { var titleel = stack.queryselector('.s

javascript - Creating a jQuery vertical scroll loop -

i'm trying write jquery script continually scroll these <p> tags within <div> parent. got idea this site . function shuffle(){ $('#wrapper > p').each(function(){ h = ($(this).offset().top + 130); if( h > 500 ){ console.log(h); $(this).css ('top', 0 ); return; } if( h == 270 ){ $(this).addclass('current' ); } if( h == 360 ){ $(this).removeclass('current' ); } $(this).animate({ top: h, easing: 'easein' }, 500, ''); if( h > 1350 ){ $(this).css ('top', 0 ); } }); window.settimeout(shuffle, 2500); } var = 0; $('#wrapper > p').each(function(){ starter = $(this).css('top', ((i * 90) ) + 'px' ); starterwhite =

android - Cordova missing ANDROID_HOME variable to emulate -

how can emulator working? cordova missed android_home environment variable, set terminal output below shows in netbeans works debug using browser of device, not emulation of app apk yves@dell-xps:~/netbeansprojects/motion$ sudo cordova emulate [sudo] password yves: running command: /home/yves/netbeansprojects/motion/platforms/android/cordova/run --emulator error: error: android sdk not found. make sure installed. if not @ default location, set android_home environment variable. error: /home/yves/netbeansprojects/motion/platforms/android/cordova/run: command failed exit code 2 @ childprocess.whendone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23) @ childprocess.eventemitter.emit (events.js:98:17) @ maybeclose (child_process.js:743:16) @ process.childprocess._handle.onexit (child_process.js:810:5) yves@dell-xps:~/netbeansprojects/motion$ echo $android_home /home/yves/android/sdk

sungridengine - Using qconf to change reporting_params -

how use qconf change values of reporting_params ? qconf -mconf looks want opens editor avoid doing. qconf -sconf > file modify file prefer. qconf -mconf file in general upper case -m... or -a... switches work file while lower case (-m... -a... ) variants drop in editor. you set editor environment variable point script modifies file in way want , updates modification time before calling qconf -mconf.

JAVA Variable declaration not allowed here -

i error "variable declaration not allowed here" , don't know why, i'm new in java , can't find answer :/ says, can't make "int" in "if" there way create it? import java.io.printwriter; import java.io.file; import java.io.filenotfoundexception; import java.util.scanner;import java.util.scanner; public class test{ public static void main(string[] args) throws filenotfoundexception{ file plik = new file("test.txt"); printwriter saver = new printwriter("test.txt"); int score = 0; system.out.println("q: what's bigger"); system.out.println("a: dog b: ant"); scanner odp = new scanner(system.in); string odpo = odp.nextline(); if(odpo.equals("a")) int score = 1; else system.out.println("wrong answer"); } } string must changed string . by writing int score you're trying declare new variable exists,

javascript - multilevel push menu in meteor -

i newbie in meteor , new member in stackoverflow.. want ask multi level push menu in meteor.. got trouble add external js file meteor app.. i know question has been asked before, , follow integrating multi-level push menu meteor app but still not working on me..by way, im using meteor 1.1.0.2 (correct me if im wrong, there no smart.json anymore in version).. dont know how replace code in smart.json file , cannot add meteor add multi-level-push-menu in cmd .. i cannot ask in same thread before because of dont have 50 reputations.. thanks

javascript - onblur event not fired every time -

the onblur event not firing. it's not predictable. included small program can run replicate problem. need click inside iframe , see if in consol there's asti . if it's there, alright world. sometimes, however, onblur doesn't fire , nothing printed. failure frequency 5%. why onblur event not fire? <html> <head> <title> index </title> </head> <body > <h1> tabarnac </h1> <p>chikanuti</p> <iframe src=""></iframe> </body> <script type="text/javascript"> var body = document.getelementsbytagname("body")[0]; document.activeelement.blur(); window.focus(); body.onblur=function(){ console.log("asti"); }; </script> </html> the onblur event fires when leave element (the element loses focus). so, when click iframe , body loses focus , event fires. if click out of i

android - how to get my app to respond to a SMS from a specific number -

i trying build app response sms of specific number, more demonstration want code this: if(number == +232344322) { } else { nothing } so simplest way in android ??? you need create broadcastreceiver invoked when sms received.in onreceive of broadcastreceiver write code retrive number of sms sender , compare number , perform task based on that. public class receivesms extends broadcastreceiver { @override public void onreceive(context context, intent intent) { final bundle bundle = intent.getextras(); if (bundle != null) { final object[] pdusobj = (object[]) bundle.get("pdus"); (int = 0; < pdusobj.length; i++) { smsmessage currentmessage = smsmessage.createfrompdu((byte[]) pdusobj[i]); string phonenumber = currentmessage.getdisplayoriginatingaddress(); string message = currentmessage.getdisplaymessagebody(); log.v("ranjapp", pho

android - Continuous gesture recognizion with DTW -

i try use dynamic time warping (dtw) detect gestures performed smartphone using accelerometer sensor. implemented simple dtw-algorithm. so basicly comparing arrays of accelerometer-data (x,y,z) dtw. 1 array contains predefiend gesture, other should contain measured values. problem is, accelerometer-sensor measures continously new values , don't know when start comparison predefined value-sequence. i need know when gesture starts , when ends, might different different gestures. in case supported gestures start , end @ same point, far know can't calculate traveled distance acceleration reliably. so sum things up: how determine right time compare arrays using dtw? thanks in advance! the answer is, compare predefined gesture every subsequence. can in faster real time (see [a]). you need z-normalize every subsequence, , z-normalize predefined gesture. so, analogy, if stream was..... now winter of our discontent, made glorious summer.. and predefined wo

real numbers become complex in python -

the code : a = b/a b = c/a c = d/a q = (a**2-3*b)/9 r = (2*a**3-9*a*b+27*c)/54 m = r**2-q**3 p = (3*b-a**2)/3 q = (2*a**3-9*a*b+27*c)/27 delta = (q/2)**2+(p/3)**3 if m <= 0 : math import sqrt,acos,cos,pi z = acos(r/sqrt(q**3)) x1 = -(2*sqrt(q)*cos(z/3))-a/3 x2 = -(2*sqrt(q)*cos((z+2*pi)/3))-a/3 x3 = -(2*sqrt(q)*cos((z-2*pi)/3))-a/3 elif delta > 0 : math import sqrt import cmath u = ((-q/2)+sqrt(delta))**(1/3) v = ((q/2)+sqrt(delta))**(1/3) x1 = u-v-a/3 x2 = -(1/2)*(u-v)-a/3+(u+v)*(sqrt(3)/2)*cmath.sqrt(-1) x3 = -(1/2)*(u-v)-a/3-(u+v)*(sqrt(3)/2)*cmath.sqrt(-1) it gives me wrong answers when enter : a = 1 b = 1 c = -1 d = -1 m == 0 but skips m , goes delta and results : x1 = 1.0 x2 = (-1+4.8e-09j) x3 = (-1-4.8e-09j) i don't know wrong ? suppose go m , x1 , x2 , x3 become real calculating in m negative number raised fractional power either gives complex number (in python 3.x) (even odd po

windows - Copy-Item shortcut fails to copy -

i have list of files need put on every new computer company gets , have automated powershell, can't last part work. command not working i'm wanting put shortcut in start_menu. have found out in order myself put file in location requests administrator permission copy. account admin click continue , file transfer. want automated. copy-item g:\work\bginfo\updatebginfo.lnk c:\programdata\microsoft\windows\start_menu -force also when test file location comes false if have manually put shortcut @ location. test-path c:\programdata\microsoft\windows\start_menu\updatebginfo.lnk so after looking more of developer code microsoft found answer. according found add "" when code in powershell needs have space. original code: copy-item g:\work\bginfo\updatebginfo.lnk c:\programdata\microsoft\windows\start_menu -force correct code: copy-item "g:\work\bginfo\updatebginfo.lnk c:\programdata\microsoft\windows\start menu" -force

c# - Data Points Not Visible When Using CustomLabel -

Image
i'm trying produce chart shows data points each hour of last 24 hours using .net chart control ( system.windows.forms.datavisualization.charting ). want x-axis have 2 rows, top row showing hour in format "8pm" ( "htt" ) , bottom row showing date in form of "07/16" ( "mm\\/dd" ). problem code below custom label not show unless uncomment 2 lines have been commented out. but, when do, data points disappear. what's going on? how can show data points , custom label? as side question, don't understand why have add 2 dayofyear on axisx.maximum . seems should have add 1. chart1.series.clear(); var series = chart1.series.add("trend"); series.xvaluemember = "date"; series.xvaluetype = chartvaluetype.datetime; series.yvaluemembers = "count"; series.yvaluetype = chartvaluetype.int32; series.charttype = seriescharttype.line; series.markerstyle = markerstyle.circle; series.markersize = 16; series.borderwidth

javascript - calculate time difference in node.js -

i want calculate difference between current time , date recuperate program. unfortunalety, second date on iso format ie. in : date2 = "2015-07-16t16:33:39.113z" i want calculate difference between date2 , current time , display difference " 0h 53min 10s" example. how can in node.js please? try using moment . get current time via now() function call , manipulate dates framework (use diff()). var moment = require('moment'); date2 = "2015-07-16t16:33:39.113z" var = moment(date2, "yyyy-mm-dd't'hh:mm:ss:sssz"); var = moment(); var diff = moment.duration(then.diff(now)); if (diff < 0) { diff = math.abs(diff); } var d = moment.utc(diff).format("hh:mm:ss:sss"); console.log("difference: " + d); for reference, see get time difference between 2 datetimes

javascript - How to dynamically update directive once user is logged in? -

i have app navbar directive , basic sign up/log in functionality. want change of words on nav bar (from 'signup/login' 'sign out') once user logged in, can't figure out best (or one) way this. i've tried setting value of variable/binding want change factory gets updated when user logs in, doesn't work, , directive doesn't update new value. my code attached below, specific solutions appreciated not necessary, if can point me in right direction how helpful. solutions i've tried: factories setting binding variables equal factory variables updated setting binding variables equal output of getter statements variables cookies (would prefer avoid unless convinces me it's way of solving this) setting binding variables equal values in cookies unfortunately none of these cause directive variable dynamically update well. feel solution simple can't think of should doing. potential solutions: using routing, e.g. changing view 1

c# - Serialization restrictions in .net -

i trying serialize object instance of pretty complex class - class consists of other complex classes. getting error reflecting. trying decorate every member xmlelement tag it's of work, doing experimental ui work , backend not important @ point. long works. there way of making serialization working without going , modifying tons of existing code? thanks

angularjs - Restangular with JSONP -

i'm trying use jsonp restangular. i'm using songkick api , when making request i'm receiving no response data different domain locally receive data no problem. i've created following factory configuring restangular , controller. i'm little unsure how use setdefaultrequestparams. maybe configuration incorrect? angular .module('modulename') .factory('restfactory', factory); function factory (restangular) { var factory = { songkick: songkick }; return factory; function songkick () { return restangular.withconfig(function(restangularconfigurer) { restangularconfigurer.setjsonp = true; restangularconfigurer.setdefaultrequestparams('jsonp', { callback: 'json_callback' }); restangularconfigurer.setdefaultrequestparams('get', { reason: 'attendance', apikey: 'xxxxxxxxxx'

ruby on rails - Nested forms with join table attributes -

i have new match form: edit: = form_for(@match) |f| = f.label :match_date = f.date_select :match_date, :order => [:day, :month, :year] = f.label :player_ids, 'select players' = f.collection_select :player_ids, @players, :id, :lastname, {}, { multiple: true } = f.fields_for :match_edits |ff| = ff.label :result = ff.number_field :result, in: 0..10 %div = f.button :submit when choose 2 players want set each 1 match result this: id: 1, match_id: 1, player_id: 1, result: 4 id: 2, match_id: 1, player_id: 2, result: 10 i'm new in rails , don't know how fix that matchcontroller class matchescontroller < applicationcontroller respond_to :html def index @matches = match.all end def show @match = match.find(params[:id]) @results = @match.match_edits end def new @match = match.new @players = player.all 2.times {@match.match_edits.build} end def create @match = match.new(match_p

How to display manually entered string values in text boxes using JavaScript & HTML on the same webpage? -

i trying write following source code displaying manually entered(from keyboard) text in text boxes using submit button: html + javascript source: <html> <head> <title>insert values</title> </head> <body> <form id="form1"> title: <input type="text" id="title1" size="25"><br /><br /> description: <input type="text" id="desc1" size="55"><br /><br /> <input type="button" value="submit" onclick="doit();"> </form> <script type="text/javascript"> function doit(){ var title = document.getelementbyid("title1").value; var desc = document.getelementbyid("desc1").value; document.write("<h3>title : </h3>" + title + <br />); document.write("<h

java - AWS S3 multi-tenancy billing -

i have multi tenancy (java web app) store/transfer files using aws s3. our customers paying for: - storage - data transfer the calc of storage simple , it's ok now, problem calculate data transfer of our customers, envolve partial download problems, etc. i wan't know experience approach. there's way explore costs in effective way? for example: send tenant-id , user-id on getobjectrequest. if there's way data ok. anyone have better idea deal that?

java - Share Spring Boot YAML configuration between two applications -

i have 2 applications in same maven project , have given each of them own configuration file setting spring.config.name property each before invoking springapplication.run(). this in first application, set spring.config.name server1 looks server1 instead of application.yml . in second have set spring.config.name server2 . however them share same logging configuration. unfortunately, logging configuration cannot imported via @propertysource since logging configured before property-sources read - see logging section of spring boot manual. is there way can this? spring boot uses default logback. can put logback.xml file in src/main/resources configure log. , both applications automatically use file configure logging engine. you can learn how configure logback here: http://logback.qos.ch/manual/configuration.html a simple example. set log level info , log console: <configuration> <appender name="stdout" class="ch.qos.logback.core.c

c++ - Boost 1.44 asio linker problems with visual studio -

i'm trying build project needs boost 1.44.0 in visual studio 2005 (i know it's old have use these versions). have build bjam mention here following line in vs 2005 command prompt: bjam --toolset=msvc-8.0 --build-type=complete link=static threading=multi architecture=x86 address-model=64 --with-system stage i set library paths to: ...\boost_1_44_0\stage\lib and include: ...\boost_1_44_0 but when try build whole solution, linking process throws following errors: error 1 error lnk2019: unresolved external symbol __imp__getaddrinfo@16 referenced in function "class boost::system::error_code __cdecl boost::asio::detail::socket_ops::getaddrinfo(char const *,char const *,struct addrinfo const &,struct addrinfo * *,class boost::system::error_code &)" (?getaddrinfo@socket_ops@detail@asio@boost@@ya?averror_code@system@4@pbd0abuaddrinfo@@papau7@aav564@@z) tasiosocket.obj and error 2 error lnk2019: unresolved external symbol __imp__freeaddr

perl - Forward Slash issue with DBI -

i'm new using dbi sql queries in perl script. issue i'm having pertains data in fields have forward slash. i'm wanting use variables input clause, doing dbi intends forward slash do: stop query. tried numerous different work arounds binds, quotes, etc. none worked, possible? data in consistent. line $sql variable trouble is. #!/usr/bin/perl # modules use dbi; use dbd::oracle; use strict; use warnings; # connection info $platform = "oracle"; $database = "mydb"; $user = "user"; $pw = "pass"; # data source $ds = "dbi:oracle:$database"; $dbh = dbi->connect($ds, $user, $pw); # $dbh = dbi->connect(); $xcod = $dbh->quote('cba'); $a = $dbh->quote('abc'); $b = $dbh->quote('123'); # tried $pid = $dbh->quote('$a/$b'); $sql = "select p_id mytable p_id=$a/$b , xcod=$xcod"; $sth = $dbh->prepare($sql); $sth->execute(); $outfile = 'superunique.txt

c++ - OpenGL shader linking -

after following set of opengl tutorials great didn't let me understand basics, i'm trying basic opengl coding c++. program supposed read vertex , fragment shader , draw triangle. i error when linking shaders (i suspect error can tracked down compiling of shader though). know shaders read program, changes them doesn't affect error. running: glgetprogramiv(shaderprogram, gl_link_status, &success); i receive error: "link called without attached shader object". programs builds, , triangle shows, not affected shaders. update i no longer above error after fixing mistake. complain after glcompileshader(): "error: 0:3 'location' : syntax error parse error" so imagine has shader files (will add them below). shader files taken tutorial, assumed work. shader files: vertex shader: #version 330 layout (location = 0) in vec3 position; void

swift - Scope of a Type Name in Protocols -

i find myself hitting name space conflicts in type declarations. like: protocol identifier : hashable {} // identifiable if has identifier protocol identifiable : hashable { typealias identifier : identifier // error: doesn't 'see' 'protocol identifier' var identifier : identifier { } } the simple solution define protocol identifiertype : hashable {} doesn't read right me. or in identifiable use typealias identifiertype : identifier types satisfying identifiable specialize on identifertype , doesn't read right me. another case: protocol food {} class foodservice <food : food> {} // error so naming convention should using? formulating relationship between 2 types incorrectly? there way express typealias identifier : global.identifier ? edit: responding comment -- if instead avoid typealias , tried: protocol identifiable : hashable { var identifier : identifier { } } then compiler error of "protocol identifier c

swift - I can`t use Collecion Cell whith Array Foto -

i have class api code import foundation import uikit class gallerymodel { var logoimage : uiimage! var galleryimages: [uiimage]! var title = "" init ( title: string, logoimage: uiimage, galleryimages: [uiimage] ) { self.title = title self.logoimage = logoimage self.galleryimages = galleryimages } static func creategalleryimages () -> [gallerymodel] { return [ gallerymodel(title: "saturday night @ stodola pub" , logoimage: uiimage(named: "g1.0")!, galleryimages: [uiimage(named: "g1.1")!, uiimage(named: "g2.1")!, uiimage(named: "g3.1")!, uiimage(named: "g4.1")!,

excel - Differentiating between hyperlinks in the code of hyperlink handler -

how reference specific hyperlinks named delete , not others have different names in following code: private sub workbook_sheetfollowhyperlink(byval sh object, byval target hyperlink) range(activecell.address).name = "delete" msgbox ("activated - workbook_sheetfollowhyperlink - before if-else") if range(activecell.addresslocal).text = "delete" clearthatcell 'calling clearthatcell sub else msgbox ("it's regular link - not delete ") end if end sub 'this sub clearing selected cell sub clearthatcell() activecell.clear msgbox ("the cell cleared!") end sub sub workbook_sheetdeactivate(byval sh object) lastsheet = sh.name end sub the above code handler of hyperlinks, want code used if "delete" hyperlink clicked in parent workbook. tries help! i'm guessing not matter worksheet's event initiates workbook_sheetfollowhyperlink event macro. private sub workbook_sheetfollowhype

c# - Single responsibility principle in MVC -

i have mvc project following pattern view <-> controller <-> service <-> repository/entities <-> database for example, if have 2 tables (customer , order) in database, have 2 classes in repository layer (this class map 1:1 database table because i'm using ef code first) : public class customer { [key] public int customerid { get; set; } public int name { get; set; } //rest of columns here } public class order { [key] public int orderid { get; set; } //rest of columns here } then have services : public class customerservice : icustomerservice { void addnewcustomer(customer obj); void getcustomerorders(customer obj); //rest of methods here } public class orderservice : iorderservice { void getorderbyid(int id); void getcustomerorders(customer obj); //rest of methods here } you notice have getcustomerorders . my question : without breaking single responsibility principle rul

qt - A QLineEdit/QComboBox search that ignores diacritics -

i have application people can enter names of places in form. being europe, have deal names includes diacritics orléans, köln, liège, châteauroux. when people enter names want them able type characters without diacritics still come list of names include them can select accented name. program has long non-exhaustive list of names (people can enter name like). i have function finds names based on non-diacritic match. 'orle' return 'orléans', 'kol' finds 'köln', etc. i tried 2 things: 1: qlineedit qcompleter fills list in completer matches using qstringlistmodel. unfortunately not work since list contain accented version of name, not match value entered user, qlineedit not show name in popup (if @ all). i played qabstractitemmodel until realized qcompleter string match on data returned model, again 'orle' != 'orlé'. 2: editable qcombobox list gets filled dynamically depending on text has been entered far. following code connec

javascript - In Node.js, how do I "include" functions from my other files? -

let's have file called app.js. pretty simple: var express = require('express'); var app = express.createserver(); app.set('views', __dirname + '/views'); app.set('view engine', 'ejs'); app.get('/', function(req, res){ res.render('index', {locals: { title: 'nowjs + express example' }}); }); app.listen(8080); what if have functions inside "tools.js". how import them use in apps.js? or...am supposed turn "tools" module, , require it? << seems hard, rather basic import of tools.js file. you can require js file, need declare want expose. // tools.js // ======== module.exports = { foo: function () { // whatever }, bar: function () { // whatever } }; var zemba = function () { } and in app file: // app.js // ====== var tools = require('./tools'); console.log(typeof tools.foo); // => 'function' console.log(typeof tools.bar); // =>

java - Restore .classpath of a project -

i have deleted .classpath .project .settings of project in project directory. have refreshed maven project in eclipse. lots of errors due files missing. rebuilt project. .project .settings created successfully. not .classpath file. same error exists. have deleted project eclipse workspace , tried same. still file missing. please me solve issue right click option doesn't show me configure build path option

Rbind two vectors in R -

i have data.frame several columns i'd join 1 column in new data.frame. df1 <- data.frame(col1 = 1:3, col2 = 4:6, col3 = 7:9) how create new data.frame single column that's 1:9? since data.frame s lists of columns, unlist(df1) give 1 large vector of values. can construct new data.frame it: data.frame(col = unlist(df1))

Reopening page on Codeigniter -

i trying reopen same page on codeigniter. see code below: <?php class leads extends ci_controller { public $tempname; public $tempfrom; public $tempto; public function index() { $this->load->model('lead'); $leads = $this->lead->getallleads(); $pagenum = count($leads); $this->load->view('main', array('leads' => $leads, 'pagenum' => $pagenum)); } public function getleads(){ $this->load->model('lead'); $name = $this->input->post('name'); $from = $this->input->post('from'); $to = $this->input->post('to'); $leads = $this->lead->getleads($name, $from, $to); $pagenum = count($leads); $this->load->view('main', array('leads' => $leads, 'pagenum' => $pagenum)); } } ?> as can see, first open 'main' 'index()'. in main, call 'getleads()', page not getting updated.

java - Start an Apache server using a C# program -

i start apache tomcat server on localhost. possible write java or c# application start whenever user requires? use process class in c# execute local process.

html - JavaScript Code wont execute when clicking link -

the code below supposed allow me click text link , starts javascript function. however, no reaction when click links. used tutorial me http://www.thesitewizard.com/archive/textsubmit.shtml <html><body> <head> <script language="javascript" type="text/javascript"> function getdsh(selectedfield) { document.results.dshtoprint.value = selectedfield; document.results.getelementbyid(selectedfield).disabled = false; document.results.submit(); } </script> </head> <font size = '6' color = 'red'>loop 1 --------------------------------------------------------------------------------</font><p><a href = "javascript:getdsh('1-1');"> ##! test fail: /switchcard/testtraffic -l none -s 9208 -d 60 -r 100gbase-4 --allow-mix-speeds --ppm=2000000 </a></p> <font size = &#

linux - How to replace column 3 with column 1 when it has a specific word? -

i have 3 column data file of format below: convicts np convict console jj <unknown> apples np apple so, here have word console in place word "unknown" is. ps: huge file contains word "unknown" multiple number of times. so, wherever word "unknown" occurs in third column, want replaced it's corresponding 1st column word. i tried using command awk ' { $3="unknown"; $3=$1; print } ' <filename> but replaces entire 3rd column words of 1st column. please how can rectify this. in advance! if want replace <unknown> corresponding lines first column value: awk '$3=="<unknown>"{$3=$1;} {print};' filename

java - Custom addToDisplay method returns exception in another class -

a newcomer here. having trouble method prints text jtextarea . the addtodisplay method works fine in native gamewindow class. here is: public class gamewindow extends jframe implements keylistener { jtextarea displayarea; public gamewindow() { ... this.addtodisplay(""); //works fine } public void addtodisplay(string newstring) { displayarea.append("\n" + newstring); displayarea.selectall(); } } when method called in class of same package, throws java.lang.nullpointerexception public class duelist { private gamewindow window; public duelist(string n) { ... } public void dueling(duelist opponent) { ... window.addtodisplay(""); //exception occurs here } } please show me how rid of exception. if need more information, let me know in comments. you have initialize gamewindow in duelist class before using gamewindow window=new gamewindow(

Send JSONArray from android to php -

i transferred jsonarray android app php file , when echo on php file echo's "array" can't seem access contents of array. here part of php file: $data = json_decode(file_get_contents('php://input'), true); $orderjson = urldecode($_post['order']); $orderjson = json_decode($orderjson,true); // create connection $conn = mysqli_connect($servername, $username, $password2, $dbname); // check connection if (!$conn) { die("connection failed: " . mysqli_connect_error()); } echo $orderjson; i cant seem access contents, return null, used following encode jsonarray on android. string jsonpost = urlencoder.encode("order","utf-8")+"="+urlencoder.encode(jsonarray.tostring(),"utf-8"); i have double check if array has data before posting through , display loaded contents, on php file echo's contents when comment out json_decode() method $orderjson array , cannot use echo show content

Search if two strings both in separate columns exist in one row in excel? -

how can use find function see if 2 strings exist in excel? ex: row/column b c d 1 fly cat dog fish 2 cat pig horse dog 3 zebra pig cat elephant i want search rows both contains cat , dog. how can achieve this? how use and , countif function together: =and(countif(a1:d1,"cat"),countif(a1:d1,"dog")) if row contains both cat , dog ,it returns true .

php - Form Validation Won't Work if Load Two Models - CodeIgniter -

Image
i have 1 controller , try load 2 models ( usermodel , contentmodel ) , need load form validation library. use usermodel user such login , register, , need contentmodel web content. @ first able login , register , had no problem form validation library, when add line $this->load->model('contentmodel'); load contentmodel , error: if remove line $this->load->model('contentmodel'); goes normal again. controller (controll.php): defined('basepath') or exit('no direct script access allowed'); class controll extends ci_controller { /** * index page controller. * * maps following url * http://example.com/index.php/welcome * - or - * http://example.com/index.php/welcome/index * - or - * since controller set default controller in * config/routes.php, it's displayed @ http://example.com/ * * other public methods not prefixed underscore * map /index.php/welcome/<method_name> * @see http://codeigniter.c

Android - Show events by hour in calendarView? -

Image
i've been looking make calendar show events following picture below in android. can done calendarview? best way go this? i hope isn't duplicate, looked through stackoverflow similar answer there no starting point calendarviews. thank looking. have around library ?

python - Errors with matplotlib, what am I missing? -

i've been experimenting spy (spectral python), using pycharm on mac. i've been running error after error, stands, error i'm stumped on: program output: /system/library/frameworks/python.framework/versions/2.7/bin/python2.7 "/users/pkillam/pycharmprojects/untitled/spy experiments" /library/python/2.7/site-packages/spectral/spectral.py:198: userwarning: unable import or configure pylab plotter. spectrum plots unavailable. 'will unavailable.', userwarning) . . #normal output . traceback (most recent call last): file "/users/pkillam/pycharmprojects/untitled/spy experiments", line 28, in <module> view = imshow(img, (29, 19, 9)) file "/library/python/2.7/site-packages/spectral/graphics/spypylab.py", line 1238, in imshow import matplotlib.pyplot plt file "/library/python/2.7/site-packages/matplotlib/pyplot.py", line 34, in <module> matplotlib.figure import figure, figaspect

c++ - Get template parameter from file -

i have 2 classes: a non-type templated class foo a non-templated class bar contains member of foo, template parameter should read file. from (i think) know, doesn't work because template parameters of non-templated class set @ compile-time, need static consts. don't see how can achieve that, since evaluation (i.e. reading file, extracting value) has happen before can provide parameter value. nonetheless, there way achieve similar? i want avoid templating second class since user has (in theory) no knowledge of file, should looked when program executed. file not change during run-time. the situation this: // templated class template <int a> class foo { public: foo() : a_(a) {}; void print () { std::cout << "the value of : " << a_ << std::endl; } private: int a_; }; // non-templated class // won't work, showing idea: class charlie { public: charlie() { = loadfromfile("myfile

python seaborn lmplot regplot for y-log scale fit -

i wondering why seaborn lmplot , regplot has option logx. have frequent use linearly fit log(y) ~ x , y-axis should in log scale show correlation (as convention). is can done in seaborn? an option of logy=true nice... thanks. you can set y-axis scale log with: import seaborn sns; sns.set(color_codes=true) tips = sns.load_dataset("tips") ax = sns.regplot(x="total_bill", y="tip", data=tips) ax.set_yscale('log') # set_yscale function, not string

android - Why isn't the action bar text color changing? -

i on android lollipop , using following style theme mynavigationdrawertheme in styles v14 <style name="mynavigationdrawertheme" parent="materialnavigationdrawertheme.light"> <item name="actionmenutextcolor">@color/white</item> </style> in material drawer theme.xml (mostly irrelevant issue) <style name="materialnavigationdrawertheme.light" parent="theme.appcompat.light.noactionbar" > <item name="drawertype">@integer/drawertype_accounts</item> <item name="drawercolor">#fafafa</item> </style> i understand theme theme.appcompat.light.noactionbar has black text action bar why isn't changing when include line <item name="actionmenutextcolor">@color/white</item> i have been trying fix 2 days tried many things (eg here ) nothing works any idea you try in styles.xml: <style name

ruby - When rendering json in rails, how can I exclude an entry from an included association? -

i have following line... render json: { user: @user.as_json(except: :password_digest, include: :currency), token: token} however, except element included currency association. how can this? render json: { user: @user.as_json( except: :password_digest, include: { currency: { except: :your_element } } ), token: :token }

php - Codeigniter URI routing and security -

in codeigniter or restful structure, page can route through uri for example, if @ item list of id: 1 , need create path that: domain.com/item/view/1 and in controller function view() { $id = $this->uri->segment(3); //database data , return view... } this should standard way implement restful structure. however, when in member system, , item id dependent user, how can protect link? so other user can not brute force try different id , read other member item. one approach compare user_id , item_id in each function. if system large means need compare in each function , lot of coding , checking . are there smarter way reduce overhead / coding ? thanks in domain.com/item/view/1 , stands base_url/controller/method so if create controller ( item ), function ( view ). class item extends ci_controller { public function __construct() { parent::__construct(); } public function view($id) { //so in $id assign 3r