external

Java - Android - Split Activity/Class into multiple files for better organization (solution)

[亡魂溺海] 提交于 2019-11-27 16:22:37
问题 I'm not PRO in JAVA , but I found myself of getting crazy with Android activities getting too large. After a few pages of code length I found myself of permanently scrolling back and forth! Not only OnClickhandlers can grow huge, just a lot of code tends to sum up in a bigger activity. Fragments were no solution for me. In general Java does not allow to split up a class into several files so a hack is needed. I browsed through a lot of stackoverflow threads regarding that, not one had a

grails / external configuration / grails.config.locations - absolute path file “Does not exist”?

我只是一个虾纸丫 提交于 2019-11-27 13:32:14
问题 I'm trying to use Grails' built-in mechanism for loading external configuration files (*.groovy and *.properties) outside the deployed WAR file. The documentation implies this is just a case of setting grails.config.locations with the appropriate classpath: or file: paths. I've configured Config.groovy with: String externalConfigLocation = System.getProperty("SYSTEM_PROPERTY_KEY") if (!grails.config.locations || !(grails.config.locations instanceof List)) { grails.config.locations = [] } if

How to know if browser tab is already open using Javascript?

只谈情不闲聊 提交于 2019-11-27 11:58:00
问题 How to know or check if the two browser tab is already open and if those tab are open, the user will receive an alert box or msg box saying that 'the url is already open', something like that, in pure/native JavaScript? This browser tab is contain an external website which is I don't have any privileges to manipulate or change it. Thanks Example URLs yahoo.com and google.com I want to alert the user if there's already open tab for yahoo.com and google.com And I want to use tabCreate to open

Use Jinja2 template engine in external javascript file

╄→гoц情女王★ 提交于 2019-11-27 11:50:07
问题 I working on a web project using Python and Flask. I was just wondering if I can access parameters sent by python in my external javascript files? It's working well with html files or with js embedded in html files but not when javascript is extern. See below. The python code @app.route('/index') def index(): return render_template('index.html', firstArg = 2, secondArg = 3) The index.html code ... <body> <p>The first arg is {{firstArg}}.</p> <script src="index.js"></script> </body> ... And

RAILS link_to external site, url is attribute of user table, like: @users.website

只谈情不闲聊 提交于 2019-11-27 11:31:44
问题 I'm working on a website that allows users to create an account. One of the attributes when creating a user is a users personal website. When I try to use the users website like this: <%= link_to @user.site, @user.url %> The url that gets generated is: http://0.0.0.0:3000/www.userswebsite.com I think this is because of the @user part of the link_to... but how can I get this to link to www.userwebsite.com ? 回答1: Looks like you need to stick the protocol on your link. E.g. you have www

Piping buffer to external command in Vim

心不动则不痛 提交于 2019-11-27 10:35:46
I am kind of a Vim novice. I would like to send contents of the current buffer to stdin of external command (lets say mail). My final purpose is to set a shortcut to quickly send email from current Vim buffer. I am guessing this should be a trivial stuff, but I couldn't find a way to send Vim buffer to an external command. Thanks in advance. You can use :w !cmd to write the current buffer to the stdin of an external command. From :help :w_c : :[range]w[rite] [++opt] !{cmd} Execute {cmd} with [range] lines as standard input (note the space in front of the '!' ). {cmd} is executed like with ":!

Loading external script with jinja2 template directive

此生再无相见时 提交于 2019-11-27 10:22:20
问题 I'm very new to jinja2 and the use of templates in general so I was wondering if there's an easy way to load an external javascript. I was thinking of using: {% block javascript %} <script src="myscript.js"></script> {% endblock %} But I can't help to ask: Is there a way of loading this script directly from within a template directive? 回答1: You have two choices here -- the first is the way you did it -- simply add the appropriate markup into a template (or a block if you want to be able to

How do you edit a dependency/external library in android studio? [duplicate]

柔情痞子 提交于 2019-11-27 10:01:54
问题 This question already has an answer here: How do I add a library project to Android Studio? 30 answers There is a lot of information about adding libraries and dependencies, but I haven't been able to find any useful information on being able to actually edit a library. I have added https://github.com/jdamcd/android-crop as a dependency in my project, but I would like to edit some of its features, mostly layout related stuff. However, when I go into browse the files Android Studio says "files

C++ Unresolved external symbol with Class templates [duplicate]

混江龙づ霸主 提交于 2019-11-27 08:54:01
问题 This question already has an answer here: Why can templates only be implemented in the header file? 16 answers What is an undefined reference/unresolved external symbol error and how do I fix it? 32 answers Here's a simple example of using class templates in C++. This code works. #include <iostream> using namespace std; template <class T> class Test { public: Test(); void print(); private: int i; }; template <class T> Test<T>::Test() { i=1; cout<<"New instance"<<endl; } template <class T>

How do you cancel an external git diff?

十年热恋 提交于 2019-11-27 07:52:41
I've got vim setup as my external diff tool: [diff] external = git_diff_wrapper #!/bin/sh vimdiff "$2" "$5" Say I have 300 files that have been modified; via bash, I type "git diff". It launches 300 vimdiffs sequentially, how do I abort it? If stopping the process is not enough, killing the shell itself (in which you launched the git diff ) might be more effective. See also Git Diff with Vimdiff Not being ready to go full speed into using vimdiff (I’m just new to it), I put the following in ‘ gitvimdiff ’. The result is that I can use vimdiff to look at git-diff by running ‘ gitvimdiff ‘, but