Posts

Showing posts from June, 2015

java - doGet XML in Servlet -

i have method in java class downloads xml file , returns org.w3c.dom.document object. i xml java servlet class can't figure out how to. i tried : protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { document document = allmethods.getxml(); response.setcontenttype("text/xml;charset=utf-8"); response.setheader("cache-control", "no-cache"); response.getwriter().write(document); } but doesn't work because printwriter not applicable document object. how can archive ? i succeeded following tip @jim garrison. document document = allmethods.getxml(); transformerfactory tf = transformerfactory.newinstance(); transformer transformer = tf.newtransformer(); transformer.setoutputproperty(outputkeys.omit_xml_declaration, "yes"); stringwriter writer = new stringwriter(); transformer.t...

multithreading - Set priority of PPL thread groups -

i have scenario functions need complete possible , given computation resources @ expense of other tasks (i.e. high-priority). specifically, graphics rendering, , tasks spawned rendering should run possible not consume full cpu capacity. simultaneously, want fill empty cycles of cpu other work not time-critical , make sure not steal cycles rendering tasks. the basic idea simple, cannot figure out how want through ppl. have found how set default scheduler different priorities, don't want globally change priority. rather, want have 2 distinct scheduling policies can add tasks @ time. the ideal situation if create 2 task_group instances different priorities , add tasks relevant group needed, don't see how that. linked relevant documentation found, want, uses agents in way leaves me unsure how simple action of adding task. rather not add complexity of agents , message passing if can use basic facilities in ppl. https://msdn.microsoft.com/en-us/library/dd984038.aspx it im...

html - XPATH - Extract content between two positions with different indent (python) -

i'm trying data html file via url. here's example: <html> ... <div class="start"> <!-- here.. --> <p></p> <p><a href=''></a> <span></span <br> <!-- ..to here --> <div class="end"> ... </div> ... ... </div> ... </html> i'm trying the data directly under div class="start" , don't know how, since div contains whole page. know, div class="end" comes right after data want. keep in mind don't want text in between, different elements, in case <p> & <span> & <a> . note element types may vary showing in html above. google gave me different types of (without luck): '//*[preceding-sibling::div[@class="start"] , following-sibling::div[@class="end"]]' you got ...

ios - Render dynamic text onto CVPixelBufferRef while recording video -

Image
i'm recording video , audio using avcapturevideodataoutput , avcaptureaudiodataoutput , in captureoutput:didoutputsamplebuffer:fromconnection: delegate method, want draw text onto each individual sample buffer i'm receiving video connection. text changes every frame (it's stopwatch label) , want recorded on top of video data that's captured. here's i've been able come far: //1. cvpixelbufferref pixelbuffer = cmsamplebuffergetimagebuffer(samplebuffer); //2. uiimage *textimage = [self createtextimage]; ciimage *maskimage = [ciimage imagewithcgimage:textimage.cgimage]; //3. cvpixelbufferlockbaseaddress(pixelbuffer, 0); cgcolorspaceref colorspace = cgcolorspacecreatedevicergb(); nsdictionary *options = [nsdictionary dictionarywithobject:(__bridge id)colorspace forkey:kciimagecolorspace]; ciimage *inputimage = [ciimage imagewithcvpixelbuffer:pixelbuffer options:options]; //4. cifilter *filter = [cifilter filterwithname:@"ciblendwithmask"];...

javascript - How to recheck the input for condition -

i have code. $scope.addingdirector = function(id, directorname){ if(directorname){ var find = _.filter($scope.directorarr, function(dir){ //if required use .trim() directorname.trim().tolowercase() strip whitespace return dir.tolowercase() == directorname.tolowercase(); }); if(find.length == 0){ var titledirector = { cpportfolioitemid: id, name:directorname, job: 'director' }; contentassessmentfactory.adddirectorname(titledirector); $window.alert('success!') }else{ $window.alert('director name exist.'); } }else{ $window.alert('you cannot leave field blank.'); } }; it checks input box if there existing director name. if not add database. problem is, when click submit button repeatedly add database repeatedly too. not recheck again input box every submit. can ...

Visual Studio 2015 RC C# Intellisense - some settings missing -

i'm looking specific checkbox listed on microsoft article, here , where, under c# -> intellisense tab, can check if want space bar auto complete, not want do. can visual studio novice find setting? thanks.

phantomjs --web-security=no -

in documentation phantomjs, there option turn off web security , allow xhr (cross domain requests). does present security risk user if filling forms credentials such usernames , passwords , downloading screenshots casper/phantom? maybe. allowing cross domain xhr opens few attacks. e.g. see https://stackoverflow.com/a/7615287/841830 . see is cors secure way cross-domain ajax requests? but tends not come normal use cases phantom: whether testing own web site, or screen-scraping, tend go pre-decided urls , links, , not sending secret information, , not going tricked new , suspicious link. unlikely logged bank, or facebook, while testing site or scraping google search results. (but, if scraping google pages force sign google first, bit more careful - perhaps set dedicated gmail account scraping.) so, in summary, attacks bit more obscure , unlikely, compared normal desktop browsing session, still there, use --web-security=no when script otherwise not work.

sql - How do I list all the column names in Netezza? -

is there query can write search column names particular database in netezza? within same database can use following query: select * _v_odbc_columns1 column_name '%columnname%' or less netezza specific query select * information_schema.columns column_name '%columnname%'

Rails 4.1 -> 4.2 has caused an after_create callback that sends an e-mail to stop working -

in note model ( note.rb ) have snippet below being triggered active record callback: def creation_email case self.notable_type when 'application' notemailer.run('application', self) when 'appointment' notemailer.run('appointment', self) end self.inbounded = 1 self.save end in notemailer have switch statement send different e-mail templates based on polymorphic notable_type . here snippet: def run(type, note) @note = note case type when 'application' app = application.find(@note.notable_id) app.users.each |user| if user.id != @note.user.id && user.email mail(to: user.email, from: @note.user.name + " <application." + app.id.to_s + "." + user.id.to_s + "@mail.mysecretdomain.com>", subject: "my secret subject", template_name: "application.html.erb").deliver_now ...

jquery - Datatables cell contents split into 2 columns on export -

is possible split contents of cell 2 columns upon export? example of cells contents: 2015-05-29 open shift open shift requested output: 2015-05-29 | open shift is possible datatables? i'm working on same issue. you can modify value before exporting using fncellrender : https://www.datatables.net/extensions/tabletools/button_options i tried add ; between values excel doesn't split cell when open .csv file. here code tried split date in 3 cells (the date in column 4): {'sextends':'xls', "oselectoropts": { filter: 'applied', order: 'current' }, "sbuttontext": "csv export", "fncellrender": function ( svalue, icolumn, ntr, idataindex ) { if ( icolumn === 4 ) { var datesplit = svalue.split("."); y = "20"+date...

swing - Java create a brush stroke action -

when draw freehand line paint application whatever brush ends stacking multiple points of brush form brush stroke. for example basic pen stroke stack 1 pixel drag mouse. in more advanced applications have brush fancy shape, say: star example, , stroking canvas "star brush" cause paint application draw multiple stars drag mouse on canvas. please correct me if i'm wrong. i have implemented "brush" ( i.e. basic circle ) , whenever user drags mouse on canvas while holding left-mouse-button application draws circle each new mouse position. my problem "undo feature" if may call way. when undo action, application deletes last shape ( circle ) drawn, while want delete whole free-hand drawing ( collection of shapes / circles ) user first press of left-mouse-button release. how "pack" collection shape objects 1 ? problem repainting of circles, want repainting of maybe 30000 circles fast, bufferedimage. i use bufferedimage background of ...

Java CSV Updater not saving updated TableModel -

this code using csv editor? reads csv file , shows in custom table , allows editing can't saving , updating work. import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.table.*; public class t1data { public static void main(string[] args) { try { string path = system.getproperty("user.dir"); string csvname = "effects"; string datafile = path+"/files/logic/"+csvname+".csv"; filereader fin = new filereader(datafile); defaulttablemodel m = createtablemodel(fin, null); jframe f = new jframe(); f.setdefaultcloseoperation(jframe.exit_on_close); jtable table = new jtable(m); jscrollpane stable = new jscrollpane (table); stable.setverticalscrollbarpolicy(jscrollpane.vertical_scrollbar_always); stable.sethorizontalscrollbarpolicy(jscrollpane.horizontal_scrollbar_always); ...

winforms - Completely resize DataGridView in VB.NET -

i having issues resizing datagridview in vb.net application. datagridview not bound data source, data entered manually. it docked in tablelayoutpanel, set fill , , expect automatically resize fit assigned cell, seems have minimum size, @ can not shrink further. problem because tablet pc deploying has smaller resolution, windows must scale properly. tablelayoutpanels keeping in correct position, crucial grids scale end user can see bottom scroll bar , records in table. this problem pretty same 1 mentioned here . if go alternatingrowsdefaultcellstyle in properties window of datagridviewer there padding feature defaults 0,0,0,0 represents each direction. perhaps if reduce padding autosize instead of being limited on upper end moving down.

linux - Cygwin 32 faster than Cygwin 64? High grep memory usage -

i grepping large files. when run command on cygwin32, completed in 46 seconds. however, when run same command on cygwin64, memory use climbs , memory exhausted after 30-40 minutes. shouldn't cygwin64 faster cygwin32? here's couple things tried: avoid caching fresh file names reinstalling cygwin64 new mirror site (to avoid incomplete package) i upgrade cygwin64 work updated split command options. however, need grep work too. please let me know if have idea of what's going on.

tfs2012 - TFS 2012 Orphan users -

over past 18 months, we've had 85 tfs users leave company. 8 persist show both [team foundation]\team foundation valid users & [collection]\project collection valid users although have no other project group memberships. in our enterprise, tfs users identified ad/network id , "disabled" upon departure company policy rather being deleted. typically, left no group memberships outside of global group membership "domain users." we use team foundation server 2012 update 3 in production. have begun testing in our test environment , plan move production update 4 within next 6 months. we have continually expanded our criteria ensuring no "entanglements" exist disabled users prevent " orphaned user " situation. review , take action upon departure of tfs user ensure: 1. user not associated tfs collection project group 2. user has no workspaces associated identity in tfs 3. user has no shelvesets associated identity in tfs 4 . user ...

html - PHP Errors - Total of four -

this php code <html> <head> <title>joerassic park</title> </head> <body> <?php $to = "joerassicpark.ddns@gmail.com"; $subject = "contact for"; $name = $_post["name"]; $email = $_post["email"]; $message = $_post["message"]; $headers = "from: $email"; $sent = mail('joerassicpark.ddns@gmail.com',$subject,$message,$headers); if($sent){ print('<a href="contact.html">thank you. click here return site.</a>'); } else { print "there issue contact form"; } ?> </body> </html> and can see errors @ joerassicpark.ddns.net/contact.php can tell me doing wrong? the errors are: notice: undefined index: name in c:\wamp\www\contact.php on line 9 notice: undefined index: email in c:\wamp\www\contact.php on line 10 notice: undefined index: message in c:\wamp\www\contact.php on line 11 warning: mail(): failed connect mailserver...

c# - Perform Calculations Within List Using Linq and Lambda Expressions -

i have following object: public class foo { public int32 id public int32 sampleid public int32 companyid public decimal data } public class bar { public int32 companyid public decimal data } i have list of these objects. want perform calculation group ids "companyid" first. each company id, add 3 different sampleids data , returning new object each company. //i want data sampleid = 2, 4 , 6 added //from foo object , put data of new bar object. list.groupby(l => l.companyid).select( x => new bar { companyid = x.key, ????? } ); i stuck how perform calculation after grouping. appreciated. you pretty close me. this should work: var list = new list<foo> { new foo { companyid = 1, data = 15, id = 1, sampleid = 2 }, new foo { companyid = 1, data = 10, id = 2, sampleid = 4 }, new foo { companyid = 1, data = 25, id = 2, sampl...

javascript - How to bind oninput event in angularjs to check for maxlength? -

i trying validate maxlength input field oninput event. have javascript code working validation need how can implement in angular. i know, can done controller input fields has controller checks non numeric value (avoid letter). please advice whats best approach. javascript checks maxlength oninput event function maxlengthcheck(object) { if (object.value.length > object.maxlength) object.value = object.value.slice(0, object.maxlength) } html <input type="number" min="1" max="9" maxlength="10" oninput="maxlengthcheck(this)" class="form-control value" ng-model="apr.vpr.value" ng-controller="formvalidationcontroller" >

mongodb - Get newly inserted document BSONObjectID -

i need return newly inserted object. read can generate own id that's not case. def create(repo: string) = action.async(parse.json) { implicit req => val id = bsonobjectid.generate collection(repo).insert($("_id " -> id)).map { last => if(last.ok) ok(json.tojson($("_id"->id)++$("success"->true))) else badrequest($("success"->false)) } } and i'm generating records this: { "_id": { "$oid": "556dfb2021c76e3b1c566915" }, "_id ": { "$oid": "556dfb1f5f00006100d4a0bc" } } you should not generate mongodb _id manually unless know sure unique or have deal duplicated key exception in code. if insert new document without _id , mongodb generate 1 during insert process. if want _id back, can request mongodb document newly created _id . normally drivers handle part automatically y...

Using Google Finance Package in Python -

i new python. have installed google finance python package via pip. but try run import googlefinance i error message :- no module named googlefinance . can please me? not sure what's going wrong works fine me: richy@cisco → pip install googlefinance collecting googlefinance downloading googlefinance-0.7.tar.gz installing collected packages: googlefinance running setup.py install googlefinance installed googlefinance-0.7 richy@cisco → python python 2.7.9 (default, jan 7 2015, 11:49:12) [gcc 4.2.1 compatible apple llvm 6.0 (clang-600.0.56)] on darwin type "help", "copyright", "credits" or "license" more information. >>> import googlefinance >>> could issue related mixing python2 , python3? if want use module (assuming supported) in python3 have use pip3 install it. richy@cisco → python3 python 3.4.3 (default, feb 25 2015, 21:28:45) [gcc 4.2.1 compatible apple llvm 6.0 (clang-600.0.56)] on d...

How to access Raspberry Pi Camera via Windows Universal App? -

i have rpi 2 windows 10 iot preview installed on it, , i'm trying create windows universal app displays live feed raspberry pi camera (specifically pi noir camera). possible? it's not possible yet. there no windows drivers available camera. change @ point, current option use different os.

GitHub author: real name instead of user name -

when doing things via web interface of github such merging pull requests or working on gh-pages, author of commit is: real name <email@address> but be user name <email@address> is there way change this? when working on local repo , push here, expected. edit here simple steps reproduce issue: create new repo , mark checkbox generate readme.md file clone repo in local repo run "gitk" - notice real name used, not user name here test repo (i delete again later): https://github.com/puce77/test edit 2 or recommended use real name? reason? think user name unique real name might not. real names change more (eg. marriage) user names. your username associates commits identity. set on local repository use following command: git config user.name "your name" to set globally every repository on computer: git config --global user.name "your name" all according documentation

How to control the metrics sent by statsd to graphite? -

i using hosted graphite , statsd. want reduce costs, reducing metrics been sent. example: each timer, don't want send 14 metrics (upper, std...), 3 of them (mean_90, sum, , maybe one). how can configure in statsd configuration file? looking @ statsd docs , its source , don't think can configure not send metrics. i suggest either: edit source code calculate , send metrics want. easy deleting lines calculated. configure graphite drop metrics coming statsd not matching 3 patterns want.

postgresql - Should index include a 'constant' column? -

i doing partitioning in postgres db. root table kpis_weekly(date, personid, metric, value) , partition table kpis_weekly_yyyymmdd inherits kpis_weekly table. set primary key of child table (personid, metric), date same in same partition table. is right practice? or should create primary key on (date, personid, metric), although date 'constant' inside same partition table. the queries run on table like: select * kpis_weekly date = '2011-02-20' , personid = 50 select * kpis_weekly date = '2011-02-20' , metric = 'centrality' , personid in ( 50, 82, 10, 14, 22, 36) if pair personid - metric unique yes, it's better have primary key based on these 2 columns. in case primary key of master table cannot propagated child tables, including date key useless.

Spring Transactions and hibernate.current_session_context_class -

i have spring 3.2 application uses hibernate 4 , spring transactions. methods working great , access correctly database save or retrieve entities. then, introduced multithreading, , since each thread accessing db getting following error hibernate: org.hibernate.hibernateexception: illegal attempt associate collection 2 open sessions i read web i've add <prop key="hibernate.current_session_context_class">thread</prop> hibernate configuration, every time try access db get: org.hibernate.hibernateexception: saveorupdate not valid without active transaction however service methods annotated @transactional , , working fine before add of <prop key="hibernate.current_session_context_class">thread</prop> . why there no transaction although methods annotated @transactional? how can solve problem? here hibernate configuration (including session context property): <?xml version="1.0" encoding="utf-8"?> ...

python - Pygame read axis value from BU0836X HID device -

i have bu0836x joystick interface board want use read analog joystick values. http://www.leobodnar.com/shop/index.php?main_page=product_info&products_id=180 on computer there python script running capturing joystick values using pygame's joystick module. however, it's possible information board, such name, number of axes, number of buttons, etc. supplied calibration tool works fine. the problem experiencing can't read axis data, works standard gamepad of course. there workaround board , running in pygame enviroment? here super simple script used testing: import pygame pygame.joystick.init() while true: joystick_count = pygame.joystick.get_count() in range(joystick_count): joystick = pygame.joystick.joystick(i) joystick.init() name = joystick.get_name() axes = joystick.get_numaxes() hats = joystick.get_numhats() button = joystick.get_numbuttons() joy = joystick.get_axis(0) print (na...

machine learning - DBSCAN using spatial and temporal data -

i looking @ data points have lat, lng, , date/time of event. 1 of algorithms came across when looking @ clustering algorithms dbscan. while works ok @ clustering lat , lng, concern fall apart when incorporating temporal information, since it's not of same scale or same type of distance. what options incorporating temporal data dbscan algorithm? look generalized dbscan same authors. sander, jörg; ester, martin; kriegel, hans-peter; xu, xiaowei (1998).  density-based clustering in spatial databases: algorithm gdbscan , applications . data mining , knowledge discovery (berlin: springer-verlag) 2(2): 169–194. doi:10.1023/a:1009745219419. for (generalized) dbscan, need 2 functions: findneighbors - "related" objects database corepoint - decide whether set enough start cluster then can repeatedly find neighbors grow clusters. function 1 want hook into, example using 2 thresholds: 1 geographic , 1 temporal (i.e. within 100 miles, , within 1 hour). ...

java - if else block is not printing out statement for rock paper scissors game -

hey i'm trying figure out i'm doing wrong here. have been making rock paper scissors game in java through netbeans ide. know ive seen alot of questions regarding in if else statements trying print out statements if condition met. if player 1 throws rock , player 2 throws anything, including tie, else not printing out statement when ran. code below, know guys specific question , smaller sections of code feel need post full code see went wrong. if makes sense! help. public static void main(string[] args) { scanner in = new scanner(system.in); string personplay; //player -- "r", "p", or "s" string seconduser; //player b scanner scan = new scanner(system.in); system.out.println("player 1please enter name"); string name1; name1 = scan.next(); system.out.println("hello " + name1); system.out.println("hello player 2"); system.out.println("player 2 please enter name");...

javascript - Google Analytics - wider date range shows less visits than a shorter date range. Possible dimensions and metrics mismatch? -

Image
this question kind of two-parter. appreciate if answers both parts. part 1 - wider date range shows less visits narrower range i having trouble query of mine. these dimensions , metrics , filters using: metrics: ga:visits,ga:visitbouncerate,ga:goalcompletionsall,ga:goalconversionrateall dimensions: ga:landingpagepath,ga:medium filters: ga:landingpagepath==/online-access/benefits-online-account-video.html;ga:visits>1;ga:medium==organic,ga:hassocialsourcereferral==yes,ga:medium==cpc,ga:medium==cpc if start-date 2015-01-01 , end-date 2015-05-30, query returns 0 fields, if change start date 2015-02-01 , end date 2015-02-28, 17 visits, , other metric fields have values more correct. after investigating little bit, thought maybe had dimensions-metric mismatch, @ point have no idea. part 2 - matching dimensions , metrics i little confused how can combine metrics , dimensions. example, the dimensions , query explorer seems suggest ga:sessions can combined ga:sessiondu...

php - str_split without word-wrap -

i'm looking fastest solution , split string parts, without word-wrap . $strtext = "the quick brown fox jumps on lazy dog"; $arrsplit = str_split($strtext, 12); // result: array("the quick br","own fox jump","s on l","azy dog"); // better: array("the quick","brown fox","jumps on the","lazy dog"); you can use wordwrap() , fed explode() , using newline character \n delimiter. explode() split string on newlines produced wordwrap() . $strtext = "the quick brown fox jumps on lazy dog"; // wrap lines limited 12 characters , break // them array $lines = explode("\n", wordwrap($strtext, 12, "\n")); var_dump($lines); array(4) { [0]=> string(9) "the quick" [1]=> string(9) "brown fox" [2]=> string(10) "jumps over" [3]=> string(12) "the lazy dog" }

linux - scp command with username and password on CLI -

i know if there way scp username , password cli single liner - password not prompted. i not want use sshpass (that did not work on scientific linux anyway - no such package) - has tried it? thanks! you can use key pair ssh. scp -i [path 2 private key] [source] [destination]

Resizing a 2d array in java -

i have been doing questions in programming book , came across question: what output of following code? int[][] array = new int[5][6]; int[] x = {1, 2}; array[0] = x; system.out.println("array[0][1] " + array[0][1]); the book says answer is: array[0][1] 2 i learned far resizing array isn't possible. understand of problem that int[][] array = new int[5][6] is creating 5 arrays of 6 elements display 0's default if displayed on console 000000 000000 000000 000000 000000 and understand array[0] = x; is resizing first array has 6 elements of 0 array 2 elements: 1 , 2. what not understanding? array[0] = x; is making it's changing index 0 element , index 1 element of first array? , keeping index 2,3,4,5 elements 0's in array[0]? i found question resize array while keeping current elements in java? don't think helps me answer question. this line array[0] = x; is not resizing array array[0] ; it's replacing...

java - how to set lookup-method programatically in spring -

i creating spring bean @ runtime , want hookup lookup-method property in it, please me out how can achieved. edit 1: below helper class public class commonhelper implements methodreplacer{ @override public object reimplement(object arg0, method arg1, object[] arg2) throws throwable { //replaced logic return null; } and configured bean in spring.xml now, below creating bean @ runtime , also, have injected 1 property able retrieve, so, how can set "replaced-method" particular bean? reference link http://java.dzone.com/articles/method-injection-spring genericbeandefinition beandefinition = new genericbeandefinition(); beandefinition.setbeanclass(testclass.class); beandefinition.setlazyinit(false); beandefinition.setabstract(false); beandefinition.setautowirecandidate(true); beandefinition.setpropertyvalues(new mutablepropertyvalues().add("str", "getyest")); registry.registerbeandefinition("dyn...

c# - Making a generic-body method -

i'm writing web api. quite tired of checking if model valid , embracing method try , catch clauses. reason wrote method try that. works asynchronously. here code below works: [route("account/[controller]")] public class logincontroller : controller { private static async task<status> try(modelstatedictionary modelstate, func<task<status>> func) { try { return modelstate.isvalid ? await func() : status.invalidformat; } catch { return status.invalidformat; } } [httppost] public async task<status> login(accountloginmodel model) => await try(modelstate, async () => { // yaaay! i'm safe! model valid! // , if bad happens, exception caught!! // let's something... return await task.fromresult(status.ok); }); } my question is: possible make shorter, simpler, clearer? still don't ugly lar...

java - ASN.1 Decode Error -

i using objective system inc( http://www.obj-sys.com/products/asn1c/index.php ) asn.1 compiler , specification file(cdr_spec.asn) generated java source code. cdrs enecoded based on format ber(basic encoding rule) command generate java source: ./asn1c cdr_spec.asn -java -ber -reader -print -getset -pkgname com.testpkg the source generated: asn1c compiler, version 6.4.5 copyright (c) 1997-2011 objective systems, inc. rights reserved. registered to: xxxxxx parsing asn.1 definitions.. generating java source files module xxx-xxx.. when decode first cdr file, parses 3 lines only, cdr file supposed contain more 100 lines, partially decoded. when try decoding cdr file, failed when decoding cdr file , gave me such error : com.objsys.asn1j.runtime.asn1missingrequiredexception: asn.1 decode error @ offset 832: sequence or set missing required element. 10:11:30.394 [main] error com.testpkg.test - asn.1 decode error @ offset 832: sequence or set missing required element. my ...

javascript - Google Chrome extension that sends a image url into a specific text field -

i trying make google chrome extension allows user click on in image in popup window , have images url sent specific websites text field; see nothing wrong code refuses work. here manifest.json { "manifest_version": 2, "name" : "gifs", "description": "gifs", "version": "1", "permissions": [ "activetab", "http://www.cssflow.com/snippets/login-form/demo", "http://*/*", "https://*/*" ], "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" } } here popup.html <script src="jquery.js"></script> <script src="popup.js"></script> <img src="http://www.vidble.com/cayujffa0f.gif" border="0"> <br><br> <img src="http://www.vidble.com/u8l5ghvn5f.gif" border="0"> here popup....

javascript - trying to change nav tabs active class within a modal on click of separate buttons bootstrap -

i have nav tabs within modal shown. using meteor framework. here modal link sign button (there button called login links same modal): <button class="btn btn-primary full-width center-text" data-toggle="modal" id="signupmodalbutton" data-target="#signupmodal">sign up</button> if model called sign button, want signup tab within modal active if model called login button, want login tab within modal active <div class="modal automodal" id="signupmodal" tabindex="-1" data-keyboard="false" role="dialog" aria-labelledby="signupmodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <!-- nav tabs --> <ul class="nav nav-tabs" role="tablist" id="signup...

bash - awk unmatched with blank file -

recently i've encountered strange behavioral problem awk say have 2 files 1 blank file & populated data so let me apply simple unmatched code awk -v var=0 'nr==fnr{a[$var]++;next} !($var in a)' file1 file2 say file1 & file 2 b v it return blank data supposed return content in file 2. can explain me how overcome issue? there isn't data in file1 , overall record number never changes, fnr == nr throughout file2 . i'm not sure there's easy way fix that, either. you can't use begin block record current file name , spot when file name changes. posix specification awk says: filename pathname of current input file. inside begin action value undefined. inside end action value shall name of last input file processed. i think best bet comparing filename argv[1] : awk -v var=0 'filename==argv[1] {a[$var]++;next} !($var in a)' file1 file2

php - Include Path issue with config and header -

i have problem include path in php. code: https://github.com/kukubaczek/kukushop/blob/master/www/panel/index.php if open panel/index.php page see error's: warning: require_once(/parts/header.php): failed open stream: no such file or directory in /path/kukushop/www/panel/index.php on line 3 fatal error: require_once(): failed opening required '/parts/header.php' (include_path='/..') in /path/kukushop/www/panel/index.php on line 3 how can fix this? here problem include path. you using absolute references when want relative file locations. try using instead: require_once("../parts/header.php")

javascript - HTML5 Video onStart Fullscreen -

is possible set video full screen on page load? so far, answer work , logical me setting width , height on element via css. var $pop = popcorn("#video"); $pop.play(); console.dir( $pop ) html{font-family:arial;} #video{width:100%;height:100%;} <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://popcornjs.org/code/dist/popcorn-complete.min.js"></script> <video height="180" width="300" id="video" controls> <source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.mp4"></source> <source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.ogv"></source> <source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.webm"></source> </video> i use popcorn.js playing video on startup. i aware of setting css clas...

html - Make the logo and links on the same line in header -

i'm making website , in header need logo , horizontal set of links. logo must on left , links must on right. problem i'm running if add many links list, wrap next line, need closely attached right side of page. both banner , list of links in header. css follows. header{ width:100%; height:10%; background-color:#ac222a; color:white; } links{ position: relative; height: 10; width: 10%; float: right; top: 35%; display: inline; } banner{ position: absolute; padding: 1% left: 1%; height; 10; width: 15% float: left; } and html follows: <html> <head> <link rel="stylesheet" href="index.css"> </head> <div id="header"> <div id = "banner"> <img src="pictures/logo_logo.png"> </div> <div id = "links"> <a href="">home</a> &nbsp;|...

css - Nav bar does not take up full width of page when zoomed in -

my problem can seen here if zoom 110% or more on browser. (it happens chrome, i'm not sure other browsers). basically, on right side can see grey sliver of few pixels after 'contact' button when zoom in. i'm assuming because have buttons set there amount of blue area around each word, , gets messed when zoom. wondering if there way keep button-size formatting default fill space when zoomed in. hope makes sense. html: <body> <div id="wrapper"> <div id="container"> <nav> <div id="navigation"> <ul> <li><a href="index.html">home</a></li><li><a href="about.html">about</a></li><li><a href="milk.html">milk</a></li><li><a href="farm.html">the farm</a></li><li><a href="contact.html">contact</a></li> </...

Tasks that need to be performed on a certain date in Azure -

i developing application using azure cloud service , web api. allow users create consultation session ability change price of session, allow users 30 days leave session before new price affects price members signed session. first thought use queue storage , set visibility timeout 30 day time limit, seems grow queue fast on time, if message should not run 30 days; not mention ordering issues. looking @ task scheduler session pricing changes not recurring concept more random. queue idea approach or there better , more efficient way accomplish this? the stuff trying should done relational database. can use timestamps record when prices session changed. wouldn't use queue @ this. queue more passing messages in distributed system. problem tracking prices changed on sessions , when. data should modeled in database.

php - Am I handling query errors correctly in Medoo Framework? -

i'm using medoo framework handle database queries. pdo wrapper, didn't find in documentation how handle errors or check result, return empty array, false 0 etc. as couldn't understand how handle errors i'm doing using empty() because can handle false , 0 , empty array think it's okay here): on select (medoo returns array) // same as: // select username accounts id=$id , suspended=0 $select = $database->select("accounts",["username"], [ "and" => [ "id" => $id, "suspended" => 0 ] ]); // have check if query failed if row not found if (empty($select) === false && count($select) > 0) { // didn't fail // username this: $key = array_keys($select)[0]; $username = $select[$key]['username']; } else { // failed } on insert (medoo says returns insert id here) $insert = $database->insert("accounts", [ ...

c# - asp.net Web Api and multiple database -

Image
i'm trying create api asp net uses multiple db. basically, example, have action employees (ex. api/employee) , i'd have "api/first_city/employee" takes data db associate first_city , "api/second_city/employee" takes data second db. best architecture? can't find can me. suggestion? possible asp net web api? thanks you need create sevral entityframework models site open project>>add new item >>data>>ado.net entity data model. so, each model represent different database, can start coding using these models.

rust - How can I sort a LinkedList with just the standard library? -

vec provides sort method (through deref implementation), linkedlist not. there generic algorithm somewhere in rust standard library allows sorting of linkedlist s? i don't think there built-in way it. however, can move list contents vec , sort , turn linked list: let mut vec: vec<_> = list.into_iter().collect(); vec.sort(); let list: linkedlist<_> = vec.into_iter().collect(); this idea not remotely bad may seem - see here . while relatively fast algorithms sorting linked list do exist, won't give of cache performance flat array sorting may do.

php - How to assign a Foreign Key Value in Laravel efficiently -

so started playing laravel last night, i'm coming experience using django framework python. so there's quite few similarities , i'm quite impressed far. however, i'm having difficulty understanding how assign foreign key value table. for example, have 2 models. user order order have foreign key value user. order - has foreign key user, titled user_id what expect able do, coming django, can authenticated user , assign directly foreign key value using this... $order->user = auth::user(); or $order->user_id = auth::user(); however, doesn't work... work if manually user_id so... $order->user_id = auth::user()->id; it seems me there should exist ability laravel recognize want id of user object due foreign key definition without me having specify it... in django. does laravel support this, , if how implemented? i'm using laravel 5.0 i'm guessing have hasmany <-> belongsto relationship between us...

ember.js - Injecting controllers as a service in EmberJS? -

i have controller, isn't reachable route special tasks. controller used many routes these tasks. at moment use controllerfor() it. but since used service other controllers want add every route di. i tried following in em.application.initializer app.register('workspacertc:workspace', app.workspacecontroller); app.inject('route', 'workspace', 'workspacertc:workspace'); which didn't work. how correctly inject controllers in ember.js?

java - Android NavigationDrawerFragment layout appears in the fragments -

i programming application in android studio , decided use navigationdraweractivity main screen activity. automatically, android srudio creates 2 .java classes (main.java navigationdraweractivity.java) , 3 layouts. my problemis: when want put button in main screen (where navigation drawer can opened, of course), other fragments accessed navigation drawer have button of main activity. mean, layout of main activity doesný dissappear fragments! what can do? thank much!

java - login Facebook registerCallback not called -

here oncreate method: @override protected void oncreate(bundle bundle) { super.oncreate(bundle); setcontentview(r.layout.activity_social_login); init(); hideactivesocialnetworks(); facebooksdk.sdkinitialize(getapplicationcontext()); callbackmanager callbackmanager = callbackmanager.factory.create(); loginmanager.getinstance().registercallback(callbackmanager, new facebookcallback<loginresult>() { @override public void onsuccess(loginresult loginresult) { // not called log.d("fb_login_sdk", "callback success"); } @override public void oncancel() { // not called log.d("fb_login_sdk", "callback cancel"); } @override public void onerror(facebookexception e) { // not called log.d("fb_login_sdk", "callback onerror"); } }); final activity act...

PHP client socket connection with C# Socket Server -

i trying connect c# server website using php. i keep connection alive through pages. c# server: port 100 using system; using system.collections.generic; using system.net; using system.net.sockets; using system.text; namespace multi_server { class program { private static socket _serversocket; private static readonly list<socket> _clientsockets = new list<socket>(); private const int _buffer_size = 2048; private const int _port = 100; private static readonly byte[] _buffer = new byte[_buffer_size]; static void main() { console.title = "server"; setupserver(); console.readline(); // when press enter close closeallsockets(); } private static void setupserver() { console.writeline("setting server..."); _serversocket = new socket(addressfamily.internetwork, sockettype.stream, protocoltype....

c# - Creating a printable form with varying page count and automatic page breaks -

i want create printable "invoice" form varying number of pages. each page should have repeating header , footer, , in between invoices' positions. it great if wpf create automatic page break between positions. somehow possible? in project, i've created more "static" printable form consists of canvas, in size of a4 page, nested layout frames , controls on it. canvas can printed, , working great, concept. but how dynamically varying content varying number of records, , page breaks? can realized in wpf? you want flow documents. these allow create document style content , can displayed in few different wpf controls. flowdocumentreader control has "page" viewing mode might looking for. here links started: flow document overview flowdocumentreader class

python - Youtube V3 API new subscription videos script -

so new programming , need use youtube v3 new subscription videos of user. after research found out it's not possible directly - there no 1 api call gives it. found third party solution online having trouble implementing it. here solution : https://github.com/ali1234/ytsubs . have put in youtube_server_api_key , developer notes # youtube_server_api_key="<your_secret_key>" ./ytsubs.py <username> <output rss file> baseurl = 'https://www.googleapis.com/youtube/v3' my_key = os.environ.get('youtube_server_api_key') # check missing inputs if not my_key: print "youtube_server_api_key variable missing." sys.exit(-1) i tried adding key in different formats keep getting variable missing error. think it's because not familiar python , it's environment variable. format should put in? tried: my_key = os.environ.get('secret_key' + ' ./views.py username output.rss') my_key = os.environ.get('...

python - enter the correct number of variables based on function handle -

i have list of variables, , function object , assign correct number of variable depending on function. def sum2(x,y): return x + y def sum3(x,y,z): return x + y + z varlist = [1,2,3] so if f = sum2 , call first 2 elements of varlist, , if f = sum3 , call 3 elements of function. use inspect module follows: import inspect n2 = len(inspect.getargspec(sum2)[0]) n3 = len(inspect.getargspec(sum3)[0]) sum2(*varlist[0:n2]) sum3(*varlist[0:n3]) getargspec returns 4-tuple of (args, varargs, keywords, defaults) . above code works if args explicit, i.e. not * or ** args. if have of those, change code accordingly.

javascript - Length of subclassed array -

in following snippets subclassed array behaves differently original arrays. why? function arr() {} arr.prototype = new array(); var iarr = new arr(); iarr[0] = 9; iarr[5] = 10; console.log(iarr.length); console.log(iarr[0]); console.log(iarr[5]); iarr.push(87); console.log(iarr.length); console.log(iarr[0]); console.log(iarr[5]); results in 0 9 10 1 87 10 while var iarr = new array(); iarr[0] = 9; iarr[5] = 10; console.log(iarr.length); console.log(iarr[0]); console.log(iarr[5]); iarr.push(87); console.log(iarr.length); console.log(iarr[0]); console.log(iarr[5]); gives 6 9 10 7 9 10 what have expected first snippet well. i cannot understand why length property in first snippet not change through accessing elements index. length behaviors work objects have been created array constructor via new array . is, length auto-behaviors work genuine array instances . here, array instance have arr.prototype , iarr 's prototype parent. iarr not created...