Posts

Showing posts from April, 2014

c# - EF 6: Include not building navigation properties -

i cant seem figure out why navigation property not getting built include statement. here method: public async task<ihttpactionresult> getcompanies(string id) { dbcontext.database.log = s => system.diagnostics.debug.writeline(s); var company = await dbcontext.companies.where(x => x.id.tostring() == id).include(x => x.startelaccounts).firstordefaultasync(); if (company != null) { return ok(this.themodelfactory.create(company)); } return notfound(); } when test sql debug log fields , values both objects. here models: public class companygroup { [key] public guid id { get; set; } [required] [maxlength(100)] public string name { get; set; } [required] [datatype(datatype.date)] public datetime firstbillingdate { get; set; } [required] public int termlength { get; set; } public virtual icollection<applicationuser> members { get; set; } ...

svn - Trying To Download Subversion Code with Python's urllib2 module = Fail -

i trying download code subversion repository without using svn subversion program. using python's urllib2 module instead. below script. problem script returns web page of sorts , not actual source-code. can see links source-code not actual source-code. does have suggestions on how can download actual source-code subversion urllib2? #! /usr/bin/env python import urllib2 def sub(): theurl = 'https://intranet-server/svn/fancysoftware/trunk/' username = 'username' password = 'password' passman = urllib2.httppasswordmgrwithdefaultrealm() passman.add_password(none, theurl, username, password) authhandler = urllib2.httpbasicauthhandler(passman) opener = urllib2.build_opener(authhandler) print "opener :", opener urllib2.install_opener(opener) pagehandle = urllib2.urlopen(theurl) print "pagehandle :", pagehandle return pagehandle if __name__ == "__main__": ret = sub...

java - What should be included in equals and hashcode for JPA Entity -

in terms of creating jpa entity should , should not go equals , hashcode. example have address entity follows. i've read id should not included, not sure why. nested objects state in case? did not include locations because state non owning end, location owns relationship. of following class should , should not in equals , hashcode? @entity @table(name = "t_address") @xmlrootelement @equalsandhashcode(exclude = {"id", "locations"}) @tostring(exclude = {"location"}) public class address implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.sequence, generator = "addressseq") @sequencegenerator(name = "addressseq", sequencename = "t_address_seq", allocationsize = 1) @column(name = "id") private long id; @size(max = 255) @column(name = "street_line_1") private string streetline1; ...

github - In Git, how can I reorder (changes from) pushed commits? -

i have repository single ( master ) branch: a > b > e > f > g > c > d it turns out need changes in c , d (two commits toward end of history far) occur earlier, i’d have: a > b > c > d > e > f > g everything’s been pushed. understand i’m not supposed rebase pushed commits, can do? here's quick , dirty solution doesn't change history: use git revert remove each commit branch. use git cherry-pick reapply commits in order want. push these changes. lets change order of commits without changing history.

java - Need to launch a new JPanel on click event in a JTable cell. -

i want create jtable having last column advanced options icon. on clicking last column in jtable, want new jpanel pop allowing user enter input required 4 string input fields. jpanel when dismissed, should return original jtable. i not sure save data 4 fields new jpanel. 4 string input fields per jtable row, displayed in jpanel. can jtabel cell hold object saving data? usecase: have jtable 10 columns. getting cluttered want move 5 columns new panel launched on clicking advanced options icon in original jtable last column. sample code on how associate data jpanel row in jtable highly appreciated. in order show pop-up when cell clicked, need cell editor class. main purpose of class provide custom editors cells, can use trigger action when cell clicked: public class infocelleditor extends abstractcelleditor implements tablecelleditor { @override public java.awt.component gettablecelleditorcomponent(jtable table, object value, boolean isselected, int row, in...

ios - Evernote API: How to upload a note with pure ENML instead of plain text -

i'm trying set content of note raw enml when upload note , @ note in sandbox web app looks treating enml plain text. how upload note raw enml can use of features in enml? here swift code: let note: ennote = ennote() note.title = title let testemlstring: string = "<?xml version=\'1.0\' encoding=\'utf-8'?>" + "<!doctype en-note system\"http://xml.evernote.com/pub/enml2.dtd\">" + "<en-note>" + "<div><br /></div>" + "<div>" + "<span style=\"font-size: 18px;\">" + "<b>hello world</b>" + "</span>" + "</div>" + "<div><br /></div>" + "</en-note>" note.content = ennotecontent(string: testemlstring) ensession.sharedsession().uploadnote(note, notebook: nil, completion: { noteref, e...

java - Error when building fragment with Tycho: "xyz.fragment cannot be installed in this environment because its filter is not applicable" -

while running mvn install on fragment project in eclipse got error: ${fragment name} cannot installed in environment because filter not applicable. using eclipse-platformfilter: (osgi.os=macosx) in manifest breaks build. here's output surrounding key error (ids/directory names redacted): [info] resolving dependencies of mavenproject: ${fragmentid}:4.3.0-snapshot @ ${fragmentdir}/pom.xml [info] {osgi.os=linux, org.eclipse.update.install.features=true, osgi.arch=x86_64, osgi.ws=gtk} [error] cannot resolve project dependencies: [error] problems resolving provisioning plan.: [error] ${fragment name} cannot installed in environment because filter not applicable. [error] [error] see http://wiki.eclipse.org/tycho/dependency_resolution_troubleshooting help. the link ( http://wiki.eclipse.org/tycho/dependency_resolution_troubleshooting ) doesn't help. i found few similar errors on internet ( component x cannot installed in environment because filter not app...

graphing - gnuplot not recognizing past the first line of data -

i have data in form: 1.23420394 3.2342423 4.2390424 1.2423424 3.3243242 1.2342522 3.4092843 8.92348209 2.3940284 4.21313 2.340242 3.342424 3.9875894 1.3423434 and goes on long list. took data excel , exported txt file. i trying plot gnuplot with: plot [col=2:7] "filename.txt" using 1:col it first wasn't working @ until went in manually , deleted invisibles , replaced them spaces. now, recognizes first line. gnuplot uses first column x , rest of columns corresponding y values. i'm not sure why happens.

How to get the union of two sets in javascript -

this question has answer here: getting union of 2 arrays in javascript 20 answers say have 2 sets (arrays): a = [1,2,3]; b = [2,3,5]; and want 1,2,3,5 out only. what terse way this? or, failing that, way this? var = [1,2,3]; var b = [2,3,5]; //concat both arrays [1,2,3,2,3,5] var result = a.concat(b).filter(function(value, index, self) { //array unique return self.indexof(value) === index; }); console.log(result); //[1, 2, 3, 5];

vim - Change all numbers in a block of text all at once -

i have file (pac file) contains ip addresses corporation , want obscure out every ip address within it. 1 idea had add 1 every digit in file , mod resulting number 256, still remains valid ip. for e.g 129 become 2310 % 256 = 6 is there quick way apply such change using vim? sounds ambitious, thought i'd still ask. here example of 1 block file. if ( isinnet(ip, "111.222.123.234", "255.255.255.224") || isinnet(ip, "166.19.10.14", "255.255.255.192") || ) {return "direct";} here's single search/replace command all: :s/\d\+/\=substitute(tr(submatch(0), '0123456789', '1234567890'), '0', '10', 'g') % 256/g (add own range, e.g. selecting block in visual mode , doing :'<,'>s (or :%s whole file)). we start matching numbers (i.e. sequences of digits: \d\+ ). for each of rotate digits: 0 becomes 1 , 1 becomes 2 , ..., 9 becomes 0 (done using...

c# - Problems with an overloaded function inside a Generic Function -

i writing function serialize data pass through socket. wanted write small function serialize 1 item. private byte[] serializeone<t>(t data) { byte[] oneitem = new byte[constants.one_item_buffer]; oneitem = bitconverter.getbytes(data); if (bitconverter.islittleendian) oneitem.reverse(); return oneitem; } the problem bitconverter alwaysassumes data type bool , throws error: argument 1 cannot convert t bool. missing syntax force bitconverter use t type or not possible in c#?

c# - Need help implementing multiple Or conditions in Nest query -

i attempting implement following sql pseudo-code in nest elasticsearch. i haven't found similar stackoverflow questions matching question or in nest documentation. appreciate direction can provide. select * curator..published accountid = 10 , ( (publishstatusid = 3 , scheduleddt > '2015-09-01') or (publishstatusid = 4 , publisheddt > '2015-09-01') ) i've created following elasticsearch query unable translate nest syntax. get curator/published/_search { "query": { "filtered": { "filter": { "bool": { "must": [ { "term": { "accountid": 1781 } } ], "should": [ { "bool": { "must": [ { "term": { ...

Adding GZIP compression to Bolt CMS -

id gzip compress output bolt cms. i have had in yaml files , there doesnt seem setting. is there way ? this not done @ application layer, rather in web server configuration virtual site. in apache similar should work: <ifmodule mod_gzip.c> mod_gzip_on yes mod_gzip_dechunk yes mod_gzip_item_include file .(html?|css|php|txt)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^content-encoding:.*gzip.* </ifmodule>

postgresql - get the url to connect to marathon app via jdbc -

i have marathon app running runs postgres. [viz. db-instance] i have application running on marathon needs connect first app using database url in jdbc properties file. [viz app-instance] both of them dockarized. when marathon spins out "db-instance" starts on different slave node in cluster. so how specify jdbc url in "app-instance" able connect "db-instance" you use mesos dns this. way able specify not host:port in app-instance connect db-instance via name. each application launched via marathon name db-instance.marathon.mesos , way won't need bother ip address able specify db connection string db-instance.marathon.mesos:port . hope helps.

javascript - Adding a video to a playlist using the Youtube Player IFrame API -

i'm working on kind of youtube remote web application using youtube player iframe api , got stuck when tried use built-in playlist system queue application. using api, able load specific list of videos playlist e.g.: player.loadplaylist({playlist: ['_9ibbmw2o_o']})` but there no function such as: player.addvideotoplaylist('_9ibbmw2o_o') what i'm trying adding video without stopping or reloading current playlist. is there workaround or missing something? by getting little creative, can use loadplaylist() without causing interruption. api provides events , 1 of reveal useful our purpose: onstatechange . onstatechange this event fires whenever player's state changes. data property of event object api passes event listener function specify integer corresponds new player state. possible values are: -1 (unstarted) 0 (ended) 1 (playing) 2 (paused) 3 (buffering) 5 (video cued) some observation shows...

angularjs - What is the main reason to use headers for authentication tokens? -

just getting speed authentication in angular . read lot usage of headers pass in token here: $http auth headers in angularjs question passing in token every request backend main reasons use headers? cleaner solution or performance? using headers isn't angular thing, many apis use these example server can determine if client should allowed access examining headers , not request body. allows better separation of concerns between authentication , authorization functions, , payload processing on server. upstream servers (of there may many layers) can add , remove headers , route , authorize request more efficiently if data in request body. headers keep authentication data out of url request parameters looks cleaner stops authentication data appearing in browser history etc. one downside if making requests through network proxy there's chance proxy may strip headers if they're non-standard names.

node.js - Sails js :: Testing variables passed to views -

controller module.exports = { index: function (req, res) { res.view({message: 'hello'}); } } how test if variable message been set correctly? var request = require('supertest'); describe('homecontroller', function() { describe('index', function() { it('should return success', function (done) { request(sails.hooks.http.app) .get('/') .expect(200).end(function (err, res) { if (err) throw err; res.body.should.have.property('message'); done(); }); }); }); }); res.body returns {} you testing response body has property of message , that's not how view locals work: passed view variables view engine can replace. if variable isn't present in view, replacement won't happen. furthermore, using get method in supertest won't return res.body default; you'll need check res.text instead. so: make sure home/index....

winforms - Button help c# Visual Studio -

i have button on widows form isn't working. form called form2 private void button1_click(object sender, eventargs e) { form1.setplayernames(p1.text, p2.text); this.close(); } the code seems check 2 textboxes, , assigns them value in next form, form1 supposed linked. reason link doesn't work. first, before open the form2 , set global variable is public string textbox1value = ""; public string textbox2value = ""; then open the form2 form2.showdialog(); when calling button function, this... private void button1_click(object sender, eventargs e) { textbox1value = p1.text; textbox2value = p2.text; this.close(); } after close form2, below form2.showdialog(); put this, form1.setplayernames(form2.textbox1value, form2.textbox2value ); try. and realize 1 thing is, form1 appeared light blue color, trying call class function inside form1? without declare variable?

dictionary - Convert the dataype of VALUES in Maps Go language -

i have map in go : var userinputmap = make(map[string]string) and values in of type : [abcd:30 efgh:50 pors:60] not 30,50,60 strings on here. i wish have same map numeric values should have float64 type instead of string type. desired output : var output = make(map[string]float64) i tried error : cannot use <placeholder_name> (type string) type float64 in assignment you cannot simple typecasting; 2 maps have different representations in memory. to solve this, have iterate on every entry of first map, convert string representation of float float64 , store new value in other map: import "strconv" var output = make(map[string]float64) key, value := range userinputmap { if converted, err := strconv.parsefloat(value, 64); err == nil { output[key] = converted } }

indexing - python - find position of next item in list, given criteria -

i'm new python, dumbed-down explanations appreciated. have data have read in csv file have manipulated in form: [(t1,n1,v1),(t2,n2,v2),(t3,n3,v3),...] what i'm trying is, given non-zero value in v, find position of next occurrence of n has 0 value v, , determine difference in t values. here code far: d=[] i,x in enumerate(list): if x[2]!=0: j,y in enumerate(list): if x[1]==y[1] , j>i , y[2]==0: d.append(y[0]-x[0]) else: d.append(0) print d i did in excel using match , offset functions, i'm bit lost transitioning index , enumerate here. my first problem nested loop doesn't stop when finds first match, , keeps appending t value differences every matching n value. i'd find first match. my second query if there's better way this, nested loop isn't starting @ beginning of list, , instead starts @ index i. i'm dealing quite large data sets. edit: managed make work, though it's quite inelega...

python - Bracket Injection when Concatenating String -

i have python 3 program runs extremely 1 part. calculating area , perimeter of rectangle (drawn graphics.py ) , concatenating results 1 string. below current code val = "the perimeter is" , str(2*(height + width)), " , area ", str(height*width) when output page using graphics.py , result shows following. {the perimeter is} 215 { , area } 616 how can output not have brackets in middle of text? without str() , brackets exist, not ideal result. ideal result below. the perimeter 215 , area 616 if use + instead of , , error can't convert 'int' object str implicitly , hasn't worked me either. any great! when use , in variable definition, creating tuple not string. hence when - val = "the perimeter is" , str(2*(height + width)), " , area ", str(height*width) val tuple , reason brackets. suggest using str.format create string. example - val = "the perimeter {} , area {}".format(2*(...

android gradle - How to add a build step after packageApplication -

how add build step after packageapplication , make sure xxx-debug-unalined.apk has been generated? i use packageapplication.dolast, works ok on windows, fail on linux, because xxx-debug-unaligned.apk not exist. any appreciated! see also: how support osgi in android gradle plugin environment? i fixed issue. it failed on linux,because updatezipfileentry use temp file in /tmp file system, rename file, renameto method ran failed,return false. because can not rename file in /tmp filesystem. change output dir, works ok.

laravel - Binding on `statement` not supported in Eloquent 5.1? -

i'm new laravel , trying string query in eloquent. trying use db::statement , kept getting errors placeholders in query string. seems either don't have syntax right, or bindings unimplemented or unsupported? the reason want use statement because i'm doing insert... select , haven't been able find documentation in eloquent. here's code: $ php artisan tinker psy shell v0.5.2 (php 5.6.13-0+deb8u1 — cli) justin hileman >>> echo \db::statement('create database :db', [':db'=>'test']); illuminate\database\queryexception message 'sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near '?' @ line 1 (sql: create database :db)' >>> \db::statement('create database ?', ['test']); illuminate\database\queryexception message 'sqlstate[42000]: syntax error or access violation: 1064 have error in sql ...

How to skip a transaction in replicate(Target system) in Goldengate oracle -

requirement: source table contains 5 columns. replicating 3 columns on target out of 5. seq_id additional column on target. when update operation performed on columns not in target table,seq_id increased. seq_id should increase when update performed on columns present on target. enabling unconditional supplemental table level logging on selected columns(id,age,col1) replicated: source: table name: test1(id,age,col1,col2,col3) target: table name: test1(id,age,col1,seq_id) we created sequence increse seq_id when insert or update happens. scenario : if insert or update happens on source table on these columns (id,age,col1) seq_id incresed, , if update happens on others columns(col2,col3) seq_id getting incremented. our requirement when update happens on others columns(col2,col3) ,seq_id should not incrementd. want skip transaction of updates happening on columns(col2,col3) . source: primary extract test_e1 extract test_e1 userid dbtuat_gg,password dbt_1234 exttrai...

c# - Unity 5x - UI Button - Awkward behavior -

so works. button round image inserted sprite background. have text on button. awkward stuff button works if pricesly aim on text of button moved on bottom right of button. any idea why graphic not acting button, text of button?

python - A Small Addition to a Dict Comprehension -

i have been experimenting python recently, , have discovered power of dict comprehensions. read them bit in python's reference library. here example found on them: >>> {x: x**2 x in (2, 4, 6)} {2:4, 4:16, 6:36} for mini project, have code: def dictit(inputstring): counter = 0 output = {counter: n n in inputstring} return output however, want counter increment 1 every loop, tried rely on sort-of-educated guesses following: def dictit(inputstring): counter = -1 output = {counter++: n n in inputstring} return output and def dictit(inputstring): counter = 0 output = {counter: n n in inputstring: counter++} return output etc, none of guesses worked. this desired i/o: >>> print dictit("hello") {0:"h", 1:"e", 2:"l", 3:"l", 4:"o"} how able achieve aiming for? {i:n i,n in enumerate("hello")}

selectonemenu - Using JSF 2.x ,how to update other UI components from a change in current component -

this question has answer here: how load , display dependent h:selectonemenu on change of h:selectonemenu 1 answer i have selectonemenu , below have selectmanylistbox . based on user has selected in selectonemenu , want refresh selectmanylistbox . example selectonemenu has list of students , selectmanylistbox has list of courses. example in scenario, if select student1 automatically selectmanylistbox should show course1, course9 selected. if change selectonemenu student2 accordingly selectmanylistbox should show courses selected ones. general strategy of doing this?. you fire change in selectonemenu , fill selectmanylistbox's value. <f:ajax event="change"/> or if using primefaces, use <p:ajax event="change"/> see link

asp.net mvc 4 - Server Error in '/' Application. Access is Denied -

Image
i've got error when try run program in localhost in pc when deployed in server, works fine. here error in localhost in pc. i wondering why have problem in fact in our last project, works in localhost i'm not 1 set everything. copy , paste implementation active directory in web config. here web config codes: <?xml version="1.0" encoding="utf-8"?> <!-- more information on how configure asp.net application, please visit http://go.microsoft.com/fwlink/?linkid=169433 --> <configuration> <configsections> <!-- more information on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=5.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <connectionstring...

How to 'show' an application through another application (visual c++) -

Image
i don't know if title makes sense guys , i'm not english i'll explain problem through images (i don't have enough rep sorry that) so in solution have 2 projects: what i'm trying 'show' second 1 through first, this: i sound total noob... possible? if is, how can achieve this? both written in c++ thank help. this complicated question answer in reasonable amount of space. can provide first, assurance has been done possible, , second, broad outline of how proceed. there 2 approaches possible depending on desired level of integration: windows screensavers standalone exe files. despite can render windows 'preview' dialog. accomplished screensaver.exe being launched preview dialog - passes hwnd on command line. so - need 3 things convince managed app (cocoshelper) give hwnd form, , launch cocos app command line containing number. in cocos project go appdelegate applicationdidfinishlaunching implementation, , retrieve hwnd ...

r - remove a character from the entire data frame -

i have dataframe various columns, of data within columns contain double quotes, want remove these, eg: id name value1 value2 "1 x a,"b,"c x" "2 y d,"r" z" i want this: id name value1 value2 1 x a,b,c x 2 y d,r z i use lapply loop on columns , replace " using gsub . df1[] <- lapply(df1, gsub, pattern='"', replacement='') df1 # id name value1 value2 #1 1 x a,b,c x #2 2 y d,r z and if need class can changed type.convert df1[] <- lapply(df1, type.convert) data df1 <- structure(list(id = c("\"1", "\"2"), name = c("x", "y"), value1 = c("a,\"b,\"c", "d,\"r\""), value2 = c("x\"", "z\"")), .names = c("id", "name", "value1", "value2"), ...

android - "Moments" cannot be resolved to a type in opencv -

i have tried text extractor project using opencv tesseract library. while importing project added tesseract library. showing error in following of code. moments moments = imgproc.moments(largest.get(0)); point center = new point(0,0); center.x = moments.get_m10() / moments.get_m00(); center.y = moments.get_m01() / moments.get_m00(); list<point> points = largest.get(0).tolist(); points = sortcorners(points, center); error is moments cannot resolved type

python 3.5 installation on window 7 - 64 bit [compatability issue] -

current version python 2.7.10 32 bit installed on system.yes, 32 bit version working correctly. >python -v python 2.7.10 my processor , operating system details follow: processor : intel(r) core(tm) i7-4790k cpu@4.00ghz system type : 64 bit operating system i'm trying download correct version system link. [ https://www.python.org/downloads/windows/] i go link --> latest python 3 release - python 3.5.0 after have 2 option 1) windows x86-64 web-based installer -for amd64/em64t/x64, not itanium processors 2) windows x86 web-based installer both of these version of python giving me incompatibility issues. please suggest how diagnose or point out correct version system. i found 64-bit installer on filehorse. sure change path c:/python35 or installs on users folder. use i7-4771 processor , run version fine.

java - Avoid 26 if/elseif/else statements when checking for a letter in user input -

i wondering if there simple way check value of letter user input. example, scanner scanner = new scanner(system.in); string message = scanner.nextline(); string letter; int length = message.length(); (int i=0; < length; i++) { letter = message.substring(i, i+1); if (letter.equalsignorecase("a")) { system.out.println("letter a"); // of course real program won't print out "letter a" // show actions different } else if(letter.equalsignorecase("b") { system.out.println("letter b"); } // etc... of possible values of "letter" } is there way write above statement without having make 26+ if/else statements? (i know there's switch-case you'd still have write 26+ of them). appreciated! well, according comments printing different text depending on letter. in case, tim's idea of using map pretty good. show basic example: in class, create hashmap . i...

javascript - How to hide choose file button from Uploadcare widget -

once image uploaded using uploadcare widget, how hide choose button , show remove button if image uploaded? <div id="profile_edit_img"> <%= image_tag resource.picture.present? ? resource.picture.url : "/assets/profile_blank-4844b32a08e9c5effe4be4f143d9c41f.png", id: "user_profile_pic", class: "center-block img-circle img-responsive"%> </div> you want add clearable option widget show "remove" button. the "choose" button should hidden if file uploaded, isn't so?

javascript - How can I embed a video file when it's URL keeps expiring? -

i'm trying embed video file, file's url keeps expiring. there anyway refresh link or somehow keep video file embedded on website? trying embed video using javascript, iframe allowed well. some hosting providers protect such embedding videos (so no 1 can avoid ads while downloading). have use different hosting provider acquire static link video. the best choice host on own ftp although increase load on servers.

javascript - Dashboard architecture - Angular JS + React JS + Node JS -

i starting on dashboard angular , react used on client side while node js used server side. i going through architecture , found this: view: <html ng-app="my-dashboard"> <body> <div class="some structuring thing"> <ng-include src="my-header.html"></ng-include> </div> <div class="some other thing"> <ng-include src="my-sidebar.html"></ng-include> </div> etc... </body> </html> controllers: <div ng-controller="my-header-text"> <p ng-bind="title"> etc... </div> <div ng-controller="my-header-login"> <p ng-click="login()">login</p> etc... </div> from these pieces of code, is possible pave way app similar this ? thanks.

grails - Issue with mongodb user authentication -

i trying connect server-1 mongo server running in other sever server-2 grails app running in server-1. have given external configuration this. grails { mongo { host = "<server-2>-host" port = 27017 username = "myapp" password = "myapp" databasename = "myapp" options { autoconnectretry = true connecttimeout = 3000 } } } and in server-2 i've created myapp db , same user , credentials use myapp db.createuser( { "user" : "myapp", "pwd": "myapp", "roles" : [] }, { w: "majority" , wtimeout: 5000 } ) and able see users list below > db.getusers() [ { "_id" : "myapp.myapp", "user" : "myapp", "db" : "myapp", "roles" : [ ] } ] ...

asp.net - HTTP Error 404.15 - Not Found while exporting in crystal report in mvc -

need on issue. i able view report(crystal report) in asp.net mvc (aspx view) without error but when export report either pdf or other format, http error 404.15 - not found the request filtering module configured deny request query string long. is appearing

bash - How to enter Multiple entries in .pgpass file? -

i supposed execute same psql command bash script on 5 remote machines using username , password. i have read have pass credentials in .pgpass file , use -w option while executing psql command. but how can execute same command on 5 machines using same .pgpass file? you can add multiple entries in .pgpass file e.g. syntax: hostname:port:database:username:password sample file: test.net:5432:testdb:testuser:testpass test1.net:5432:testdb1:testuser1:testpass1 test2.net:5432:testdb2:testuser2:testpass2 make sure permission of .pgpass file set 0600 chmod 0600 .pgpass

django - Unable to install and use python-docx? -

i've been using django build web program enables user input information within form tags file i/o ms word(docx) document. in order that, i've set virtualenv django 1.7.6 , python-docx==0.8.5 installed. problem when include "from docx import document" in views.py, httpresponse 'index.html' returns 'importerror: no module name 'lxml'' as far understand, should problem lxml package, unable fix it. i've installed lxml according lxml documentation, command 'sudo apt-get install python3-lxml' doesn't work. please helpless newbie. thanks. thanks @ jroddynamite 's help, able solve problem. you should: install requirements ( libxml2 & libxslt ) then, install lxml command pip install lxml .

How to render youtube video in YII2 DetailView widget -

i'm displaying you-tube video on front end of website. admin can provide you-tube source embedded code site end. want have preview on view page. following code tried displaying iframe tags (i know not right way) [ 'attribute'=>'source', 'value' => !empty($model->source) ? '<iframe class="embed-responsive-item" src="'.$model->source.'" frameborder="0" allowfullscreen></iframe>' : null, ], is there thing has image format: [ 'label'=>'image', 'attribute'=>'userinfo.image', 'format' => ['image',['width'=>'100','height'=>'100']], ], format html or raw you. [ 'format' => 'raw', 'attribute'=>'source', 'value' => !empty($model->source) ? '<iframe class="embed-responsive-item" src=...

use swift file into Objective-C project -

Image
can tell me how can use swift file objective-c project? i have swift file inherits uiviewcontroller instead of nsobject. trying use swift file not able figure out how. when add swift file objective-c project, asks create bridging header. in header file importing swift file - #import "slidecontroller.swift" and bridging file name objctoswift-bridging-header.h i read many answers asks import file #import "myproductmodulename-swift.h" into .m file, can't find such file in project. i changed defines module = yes shown in answer. but still not able access swift file. missing? please tell me right steps figure out. after created bridging header. go build setting =>search "objective-c bridging header" just below find ""objective-c generated interface header name" file and import file in view controller. ex.in case: "dauble-swift.h"

excel - Removing the border lines in a worksheet when code has been run -

Image
i have code looks external file , copy/pastes rows contain particular condition current workbook. example searching singapore in external workbook called active master project file , copy rows containing singapore current workbook open. a problem occurs when run same code twice, border line exist on last row of worksheet. example when run code, copy paste information containing singapore current worksheet called "new upcoming projects": however, when run code again create border line on each column such image shown below: and code have is: sub updatenewupcomingproj() dim wb1 workbook, wb2 workbook dim ws1 worksheet, ws2 worksheet dim copyfrom range dim lrow long '<~~ not integer. might give error in higher versions of excel dim strsearch string set wb1 = application.workbooks.open("u:\active master project.xlsm") set ws1 = wb1.worksheets("new upcoming projects") strsearch = "singapore...

Tomcat 8 memory leak -

i'm developing java web application using spring/spring boot/mysql , deployed tomcat 8. in tomcat web application manager click reload button , after successful redeploy - find leaks button , have following message: the following web applications stopped (reloaded, undeployed), classes previous runs still loaded in memory, causing memory leak (use profiler confirm): /domain-api /domain-api my tomcat log not contain messages possible memory leaks.. looks right have 2 instances of application(domain-api) , running.. how check , how fix ? this has not mean, application has memory leak. message in tomcat manager means, there still classes deployed web application loaded have not yet been garbage collected. if not memory leak warning removed setting permgenspace lower value. force gc unload classes after redeploy app. an other way ensure have no memory leak redeploy app few times , create heapdump , analyze profiler eclipse memory analyzer . there should inst...

python - Scanning without sequences in theano? (emulating range()) -

theano newbie here. doing experiments in order generate variable length sequences. started simplest thing coming mind: emulating range(). here simple code wrote: from theano import scan theano import function theano import tensor t x = t.iscalar('x') step = t.iscalar('step') max_length = 1024 # or othe large value def fstep(i, x, t): n = * t return n, until(n >= x) t_fwd_range, _ = scan( fn=fstep, sequences=t.arange(max_length), non_sequences=[x, step] ) getrange = function( inputs=[x, param(step, 1, 'step')], outputs=t_fwd_range ) getrange(x, step) print list(f) assert list(f[:-1]) == list(range(0, x, step)) so had use max_length length of range used input of fstep theano scan . so, main question this: there way use scan without input sequence? and, suppose answer no , next question is: correct (most efficient, ecc) way traying do? there no need provide input sequence scan. can instead specify number of ...

javascript - How to add this element in jquery -

i making program in need multiple accordion menu more 100 first work properly. know can solved selector in jquery new in jquery have no idea how add element. accordion menu copied internet in 1 menu opened other become inactive(closed). in case topmost menu working not other my coding html <div id='cssmenu'> <ul> <li class='has-sub'><a href='#'><span>products</span></a> <ul> <li><a href='#'><span>product 1</span></a></li> <li><a href='#'><span>product 2</span></a></li> <li class='last'><a href='#'><span>product 3</span></a></li> </ul> </li> <li class='has-sub'><a href='#'><span>about</span></a> <ul> <li><a href='#'><spa...

css - Button not displayed in IE11 -

we upgraded our application .net 2.0 4.5. result of had use ie11. problem facing buttons , address in master page in application not show on page display. gets displayed if turn on compatibility view not recommended. uses css class bluebutton being used other buttons , getting displayed on page. below css class, hide copy code input.bluebutton { font-size:.875em; font-family:arial; color:white; width:auto; height:22px; background: #606060 url(../../images/blankbluebutton61x22repeatx.gif) 0px 0px repeat-x scroll; border:1px none solid; border-collapse: collapse; padding: 0px 0.5em 0px 0.5em; } below html tag of 1 of pages, <asp:button id="buttonsearch" runat="server" cssclass="bluebutton" causesvalidation="false" meta:resourcekey="buttonsearch" onclick="buttonsearchclick" /> please let me know how go , working? in advan...

python - Why are you never supposed to reload modules? -

this question has answer here: how unload (reload) python module? 12 answers in "modules , packages: live , let die!" , page 28 (see the video ), it's said that: you can force-reload module, you're never supposed it. can explain why not supposed reload modules in python? reloading explained in detail here: how unload (reload) python module? tl;rd there valid use cases reload , django development server. in general, reloading modules has many caveats practical. two largest concerns are: to unload old objects, must make sure no other module or object keeps references them (which impossible). if fail here, may hard-to-trace memory leak or unexpected behavior. there no general way reload module c extensions. may reload safely; may seem reload safely, leak, , may crash interpreter or produce weird bugs.