hook

How to write a Git pre-commit hook that prevents committing of an Android project if the test project fails?

送分小仙女□ 提交于 2019-12-07 11:34:24
Given that I in my workspace I have an android project MyAndroidProject and my tests project MyAndroidProjectTests directories how could I write a pre-commit git hook that will run the tests in the MyAndroidProjectTests and refuse to commit any code changes if the tests fail? When I run tests on the terminal they usually have output like this: com.mydomain.tests.Models.MyProjectTests:....... Test results for InstrumentationTestRunner=....... Time: 0.05 OK (10 tests) What I'm unsure about is how to what to use to try to determine if the tests passed or failed other than parsing the output of

WindowsFromDc return null

纵饮孤独 提交于 2019-12-07 11:09:00
问题 I need some help about the win32 api and especially WindowsFromDc. I have a application which hook a another application. This two application communicate by a NamedPipe. In the second application, I have hook the DrawTextExW function and I get a HDC from this function. But when I do a WindowsFromDC with the DC returned by the DrawTextEx function, i got a null return. So, I have some question about that : -Is it possible a HDC don't have a HDWN with ? -How I can get the HWND of the window

retrieve the global hook chain in windows

吃可爱长大的小学妹 提交于 2019-12-07 08:20:30
I need to get the list of functions in global hook chain in Windows and get their corresponding application if it's possible. I don't know how to retrieve information from the global hook chain however. As far as I know there is no windows API for doing this so I think I have to find them by parsing the hook chain link list . The problem is that I don't know the data structure of this link list and it's begin address. Does anyone know how windows manages its global hook chain? One approach I've seen is shown in this blog post . It was referenced by this code (beware of slow server). Crazy

How and where to write Webform submit hook?

牧云@^-^@ 提交于 2019-12-07 07:32:41
问题 I am new to Drupal(7) and hence need some help for following situations. I have created one Webform(I have other webform too) and now instead of inserting in default webform_submitted_data table, I want for this webfrom to insert into myTable. From what I found, I need to write a hook for this. Actually I am getting confused for way to write this hook. I have below questions. Where to write this hook (in which file). How to write this hook only for one webform. Please help and let me know if

ignore certain mercurial commands in mercurial hook

谁都会走 提交于 2019-12-07 07:11:18
问题 I have a mercurial hook like so: [hooks] pretxncommit.myhook = python:path/to/file:myhook with the code looking like this: def myhook(ui, repo, **kwargs): #do some stuff but this hook runs on commands that use the commit logic to do something else, in my case hg shelve . is there a way to get the command that the user has input to avoid running the hook on that command? perhaps something like this: def myhook(ui, repo, command, **kwargs): if command is "hg shelve" return 0 #do some stuff 回答1:

gitolite post-receive hook not triggering

耗尽温柔 提交于 2019-12-07 06:55:29
In my .gitolite.rc file I have: LOCAL_CODE => "$ENV{HOME}/.gitolite/local" ..then in ENABLE section of the same file I have enabled repo-specific-hooks : ENABLE => [ # COMMANDS # These are the commands enabled by default 'help', 'desc', 'info', ..., ..., ..., 'repo-specific-hooks' ..., ..., ... ] , now, on my local machine inside gitolite-admin folder I have: gitolite-admin ... ... └──local/ └── hooks/ ├── common/ └── repo-specific/ └── message* <-- this one I want to call in a post-receive hook! , and for some repo in my gitolite-admin conf file: repo foo RW+ = @all option hook.post-receive =

Is it possible to accept user input as part of a remote git post-receive hook?

我的梦境 提交于 2019-12-07 06:13:51
问题 I've got a post-receive hook that deploys our master branch whenever we push master. I'd like to make the deployment optional; the hook asks for simple Y/N response to achieve this; bash pseudo code below: echo "Should I deploy this code now? Enter Y/N" read deploy_code case ${deploy_code} in "Y") do_a_deploy ;; "N") exit ;; *) # ask the question again if not Y or N ;; esac Because of the way the post-receive hook gets its arguments on stdin the read line doesn't pause for input from the user

Wordpress preview_post_link

馋奶兔 提交于 2019-12-07 05:23:25
问题 I am trying to alter the default "preview post" button when posting on wordpress as the site has a hacked wordpress install and the posts previews are not where they are suppose to be. I found the hook preview_post_link now I am just trying to figure out how to make a little plugin that will fix the problem. What I don't know how to do and why I am posting here is, using the add_filter to change the link add_filter( 'preview_post_link', 'the_preview_fix' ); function the_preview_fix() { return

update woocommerce order status after payment process complete and redirect to store

僤鯓⒐⒋嵵緔 提交于 2019-12-07 05:17:00
问题 I am using woo-commerce for my shopping site. I want to update the order status to complete after payment was made and then return to a success page. I used the following code: add_filter( 'woocommerce_payment_complete_order_status', 'my_change_status_function', 10, 2 ); function my_change_status_function ($order_status, $order_id) { $order = new WC_Order($order_id); return 'completed'; } But this function is called before the payment was made and redirects to the payment page. I want to

How to retrieve the third uri segment in a codeigniter hook

北城余情 提交于 2019-12-07 03:54:25
问题 I'm writing a custom post_controller hook. As we know, codeigniter uri structure is like this: example.com/class/function/id/ and my code: function hook_acl() { global $RTR; global $CI; $controller = $RTR->class; // the class part in uri $method = $RTR->method; // the function part in uri $id = ? // how to parse this? // other codes omitted for brevity } I've browsed the core Router.php file, which puzzled me a lot. thanks. 回答1: Using CodeIgniter URI core class Generally within CodeIgniter