Search Results

Search found 407 results on 17 pages for 'hooks'.

Page 1/17 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Web hooks in Python: Any particular library?

    - by Gopal
    Hi .. somewhat of a noob here to web programming. Just getting my feet wet in python. I wanted to implement web hooks in python. Both at server end and client end. Is there any particular library for implementing web hooks? Or does django or twisted python handle this?

    Read the article

  • Are there such things as Email Hooks?

    - by viatropos
    After hearing about git commit hooks, I was thinking maybe there are such things as email hooks... Is it possible for me to build a program that says "hey, you just received an email, now run this ruby script"? Something like a GMail Web Hook. Is there anything out there like that? I mean I could build a cron thing that checked my email all the time, but maybe there's a more formal way. Looking for an online email system to do this with, not say my Mac Mail.

    Read the article

  • Documentation for Liferay Hooks

    - by Codeflayer
    Hi there, I need to listen for user log in and log out events in Liferay. From what little I've been able to find, it seems that using Liferay hooks would be the way to accomplish this. Unfortunately I haven't been able to find any information other that at the following link: http://www.liferay.com/web/raymond.auge/blog/-/blogs/portal-hook-plugins Does anyone know where I can find further documentation or how I would implement listening for user log in/log out events? Thanks in advance!

    Read the article

  • How can I add multiple pre-commit SVN Hooks

    - by Alister Bulman
    I've got several pre-commit hooks that I would like to run before each commit. Right now, they are all just shell-scripts, so I know i could just concatenate them to get them all to run. In the future though, additional scripts may be written in Perl, PHP, or some other language as well. How can I run several different scripts as part of a single pre-commit hook?

    Read the article

  • handling ImageList with windows hooks

    - by user337309
    Hi, I am programming an application that can catching the information about the screen items by Hooks Now I am trying to get the information of the ImageList when I pass them by mouse, "I want to know the name of the item" how can i do this? Thank you.

    Read the article

  • Python hooks navigation logger windows

    - by user363054
    Hi, I´m trying to do a path logger (Navigation logger) in Python, the thing that I need is that the program can get the paths that de user is accesing in real time, for example: C:\Documents and Settings\ C:\Documents and Settings\Administrator\ C:\Documents and Settings\Administrator\Desktop\ C:\Documents and Settings\Administrator\Desktop\archivos\ C:\Documents and Settings\Administrator\Desktop\Freescale ZeD 1.1.0.lnk C:\Documents and Settings\Administrator\Desktop\Freescale BeeKit.lnk C:\Documents and Settings\All Users\Desktop\PowerISO.lnk Someone knows how I can do this? I read and used the library pyhook, because I think that I need hooks, specially the WH_GETMESSAGE but pyhook doesn't use it and doesn't give the path only things like the Message, the time, the name of the window, etc. Note: I´m using Windows XP 32bits and python 2.6 Thanks in advance!

    Read the article

  • PHP hooks information and help needed

    - by sea_1987
    Background I am realtively new to hooks, and I have been asked to use a hook to populate a view with some data, currently the view gathers it data from a function that is in the model, and becuase the whole object is being passed to the view I can access the function. The function looks like this, public function numCVInSector($k) { $this->load->model('SYSector'); $sectorModel = new SYSector(); $cvs = $sectorModel->fetchRelatedCV($k); $cvs = $cvs[0]['count']; if($cvs == "0") { return false; } else { return $cvs; } } it call's a query in the model that looks like this, public function fetchRelatedCV($k) { $sql = "SELECT sector_id, COUNT(sector_id) as count FROM sy_user_sectors WHERE sector_id = $k"; //print_r($sql); $query = $this->db->query($sql); return $query->result_array(); } $k is the id of element that is in the view. The Problem I have been asked to use a hook that is in the parent of the model the hook is called post populate, now I have very little idea of what a hook is or how to use one to implement my function. Could some one give me some advice, the code where the hook is original made looks like this, public function populate($where = array()) { $results = array( "success" => false, "is_error" => false, "error_code" => "", "error_message" => "" ); if(empty($where) && empty($this->aliases['id'])){ $results['is_error'] = true; $results['error_message'] = 'No criteria.'; return $results; } // [hook] $this->prePopulate(); $where = count($where) > 0 ? $where : array('id' => $this->aliases['id']); $query = $this->db->get_where($this->tableName, $where, 1); if($query->num_rows() < 1){ $results['error_message'] = 'Empty results.'; return $results; } foreach($query->result_array() as $row){ foreach($this->aliases as $key => $val){ $this->aliases[$key] = $row[$key]; } } // [hook] $this->postPopulate(); // Presume success $results['success'] = true; return $results; } I have been asked to use the postPopulate hook. public function postPopulate() { $args = $this->getHookArgs('post_populate'); if(!is_array($args)){ // $this->fb->log($args, 'bad args'); return false; } // code here... // Convert dates to front end formats. foreach($this->frontEndDateFields as $fieldName => $dateFormat){ $dateRes = mlib_du_getFormattedMySQLDate($this->aliases[$fieldName], $dateFormat); if($dateRes != false){ $this->aliases[$fieldName] = $dateRes; } } return true; }

    Read the article

  • Experience of Python's “PEP-302 New Import Hooks”

    - by Koichi Sasada
    I'm one of the developers of Ruby (CRuby). We are working on Ruby 2.0 release (planned to release 2012/Feb). Python has "PEP302: New Import Hooks" (2003): This PEP proposes to add a new set of import hooks that offer better customization of the Python import mechanism. Contrary to the current import hook, a new-style hook can be injected into the existing scheme, allowing for a finer grained control of how modules are found and how they are loaded. We are considering introducing a feature similar to PEP302 into Ruby 2.0 (CRuby 2.0). I want to make a proposal which can persuade Matz. Currently, CRuby can load scripts from only file systems in a standard way. If you have any experience or consideration about PEP 302, please share. Example: It's a great spec. No need to change it. It is almost good, but it has this problem... If I could go back to 2003, then I would change the spec to... I'm sorry if such a question is not suitable for here. I posted here because I'm not sure that I can ask this question at python-dev (of course, the list is not for cruby development). This post is moved from http://stackoverflow.com/questions/11188229/experience-of-pythons-pep-302-new-import-hooks.

    Read the article

  • Are Remote commit hooks in subversion possible?

    - by John Hamelink
    Hi there, my current setup is as follows: We have a Linux samba share that contains all the repository folders (with the hooks folder inside, amongst the others) All the developers have the share mapped as a network drive, and import to a local directory (normally C:\Server\RepositoryName) where they work on their files. All the machines accessing the drive (unfortunately) run windows. What I'm aiming to do is to have a hook on the Linux server that detects when a commit has been made, by which project, the revision number, the name of the developer who committed, etc. I looked into the hooks files, but they seem to be ran by the client. Is there a way to monitor svn changes and collect the relevant information from the Linux server?

    Read the article

  • Easy way to set up global API hooks

    Discover an easy way to set up system-wide global API hooks using AppInit_DLLs registry key for DLL injection and Mhook library for API hooking. To illustrate this technique we will show how to easily hide calc.exe from the list of running processes.

    Read the article

  • Detecting Idle Time with Global Mouse and Keyboard Hooks in WPF

    - by jdanforth
    Years and years ago I wrote this blog post about detecting if the user was idle or active at the keyboard (and mouse) using a global hook. Well that code was for .NET 2.0 and Windows Forms and for some reason I wanted to try the same in WPF and noticed that a few things around the keyboard and mouse hooks didn’t work as expected in the WPF environment. So I had to change a few things and here’s the code for it, working in .NET 4. I took the liberty and refactored a few things while at it and here’s the code now. I’m sure I will need it in the far future as well. using System; using System.Diagnostics; using System.Runtime.InteropServices; namespace Irm.Tim.Snapper.Util { public class ClientIdleHandler : IDisposable { public bool IsActive { get; set; } int _hHookKbd; int _hHookMouse; public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam); public event HookProc MouseHookProcedure; public event HookProc KbdHookProcedure; //Use this function to install thread-specific hook. [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId); //Call this function to uninstall the hook. [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern bool UnhookWindowsHookEx(int idHook); //Use this function to pass the hook information to next hook procedure in chain. [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam); //Use this hook to get the module handle, needed for WPF environment [DllImport("kernel32.dll", CharSet = CharSet.Auto)] public static extern IntPtr GetModuleHandle(string lpModuleName); public enum HookType : int { GlobalKeyboard = 13, GlobalMouse = 14 } public int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam) { //user is active, at least with the mouse IsActive = true; Debug.Print("Mouse active"); //just return the next hook return CallNextHookEx(_hHookMouse, nCode, wParam, lParam); } public int KbdHookProc(int nCode, IntPtr wParam, IntPtr lParam) { //user is active, at least with the keyboard IsActive = true; Debug.Print("Keyboard active"); //just return the next hook return CallNextHookEx(_hHookKbd, nCode, wParam, lParam); } public void Start() { using (var currentProcess = Process.GetCurrentProcess()) using (var mainModule = currentProcess.MainModule) { if (_hHookMouse == 0) { // Create an instance of HookProc. MouseHookProcedure = new HookProc(MouseHookProc); // Create an instance of HookProc. KbdHookProcedure = new HookProc(KbdHookProc); //register a global hook _hHookMouse = SetWindowsHookEx((int)HookType.GlobalMouse, MouseHookProcedure, GetModuleHandle(mainModule.ModuleName), 0); if (_hHookMouse == 0) { Close(); throw new ApplicationException("SetWindowsHookEx() failed for the mouse"); } } if (_hHookKbd == 0) { //register a global hook _hHookKbd = SetWindowsHookEx((int)HookType.GlobalKeyboard, KbdHookProcedure, GetModuleHandle(mainModule.ModuleName), 0); if (_hHookKbd == 0) { Close(); throw new ApplicationException("SetWindowsHookEx() failed for the keyboard"); } } } } public void Close() { if (_hHookMouse != 0) { bool ret = UnhookWindowsHookEx(_hHookMouse); if (ret == false) { throw new ApplicationException("UnhookWindowsHookEx() failed for the mouse"); } _hHookMouse = 0; } if (_hHookKbd != 0) { bool ret = UnhookWindowsHookEx(_hHookKbd); if (ret == false) { throw new ApplicationException("UnhookWindowsHookEx() failed for the keyboard"); } _hHookKbd = 0; } } #region IDisposable Members public void Dispose() { if (_hHookMouse != 0 || _hHookKbd != 0) Close(); } #endregion } } The way you use it is quite simple, for example in a WPF application with a simple Window and a TextBlock: <Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <TextBlock Name="IdleTextBox"/> </Grid> </Window> And in the code behind we wire up the ClientIdleHandler and a DispatcherTimer that ticks every second: public partial class MainWindow : Window { private DispatcherTimer _dispatcherTimer; private ClientIdleHandler _clientIdleHandler; public MainWindow() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { //start client idle hook _clientIdleHandler = new ClientIdleHandler(); _clientIdleHandler.Start(); //start timer _dispatcherTimer = new DispatcherTimer(); _dispatcherTimer.Tick += TimerTick; _dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1); _dispatcherTimer.Start(); } private void TimerTick(object sender, EventArgs e) { if (_clientIdleHandler.IsActive) { IdleTextBox.Text = "Active"; //reset IsActive flag _clientIdleHandler.IsActive = false; } else IdleTextBox.Text = "Idle"; } } Remember to reset the ClientIdleHandle IsActive flag after a check.

    Read the article

  • git init template, replacing modified hooks

    - by Roy Kolak
    I am constantly updating my local git hooks. I have a repo to house my .git template. This means that I am constantly running git init --template=../git-template to update repos with my hook changes. Problem: Everytime I run git init --temp..., I need to first remove the hooks in .git/hooks that will be replaced with the updated hooks. This is annoying. I know I can script the removal of these hooks from the repo that I want to update, but is this functionality built into git already?

    Read the article

  • Subversion hooks no longer running

    - by Chris Lieb
    I don't know when this started happening, but, for some reason, none of my Subversion hooks are running anymore. I am running Subversion 1.6.9 on a Gentoo Linux machine, which has had its hooks work in the past. I am running Subversion through the svn_dav module for Apache2.2. I modified the hook scripts that I make use of to write into a file in the /tmp directory owned by apache:apache whenever they are executed, but after making a commit, there is nothing in the file that should be written to. The scripts are executable and owned by apache:apache, so I don't think that is the issue. Here is one of my test scripts (post-commit.sh) that isn't getting executed: #!/bin/sh /bin/echo post-commit >> /tmp/z_test exit 0 After running a commit, I expect both the pre-commit.sh and post-commit.sh hooks to be run, but neither of them appear to be writing into the desired file (/tmp/z_test). What's going on?

    Read the article

  • ASP.NET MVC ‘Extendable-hooks’ – ControllerActionInvoker class

    - by nmarun
    There’s a class ControllerActionInvoker in ASP.NET MVC. This can be used as one of an hook-points to allow customization of your application. Watching Brad Wilsons’ Advanced MP3 from MVC Conf inspired me to write about this class. What MSDN says: “Represents a class that is responsible for invoking the action methods of a controller.” Well if MSDN says it, I think I can instill a fair amount of confidence into what the class does. But just to get to the details, I also looked into the source code for MVC. Seems like the base class Controller is where an IActionInvoker is initialized: 1: protected virtual IActionInvoker CreateActionInvoker() { 2: return new ControllerActionInvoker(); 3: } In the ControllerActionInvoker (the O-O-B behavior), there are different ‘versions’ of InvokeActionMethod() method that actually call the action method in question and return an instance of type ActionResult. 1: protected virtual ActionResult InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary<string, object> parameters) { 2: object returnValue = actionDescriptor.Execute(controllerContext, parameters); 3: ActionResult result = CreateActionResult(controllerContext, actionDescriptor, returnValue); 4: return result; 5: } I guess that’s enough on the ‘behind-the-screens’ of this class. Let’s see how we can use this class to hook-up extensions. Say I have a requirement that the user should be able to get different renderings of the same output, like html, xml, json, csv and so on. The user will type-in the output format in the url and should the get result accordingly. For example: http://site.com/RenderAs/ – renders the default way (the razor view) http://site.com/RenderAs/xml http://site.com/RenderAs/csv … and so on where RenderAs is my controller. There are many ways of doing this and I’m using a custom ControllerActionInvoker class (even though this might not be the best way to accomplish this). For this, my one and only route in the Global.asax.cs is: 1: routes.MapRoute("RenderAsRoute", "RenderAs/{outputType}", 2: new {controller = "RenderAs", action = "Index", outputType = ""}); Here the controller name is ‘RenderAsController’ and the action that’ll get called (always) is the Index action. The outputType parameter will map to the type of output requested by the user (xml, csv…). I intend to display a list of food items for this example. 1: public class Item 2: { 3: public int Id { get; set; } 4: public string Name { get; set; } 5: public Cuisine Cuisine { get; set; } 6: } 7:  8: public class Cuisine 9: { 10: public int CuisineId { get; set; } 11: public string Name { get; set; } 12: } Coming to my ‘RenderAsController’ class. I generate an IList<Item> to represent my model. 1: private static IList<Item> GetItems() 2: { 3: Cuisine cuisine = new Cuisine { CuisineId = 1, Name = "Italian" }; 4: Item item = new Item { Id = 1, Name = "Lasagna", Cuisine = cuisine }; 5: IList<Item> items = new List<Item> { item }; 6: item = new Item {Id = 2, Name = "Pasta", Cuisine = cuisine}; 7: items.Add(item); 8: //... 9: return items; 10: } My action method looks like 1: public IList<Item> Index(string outputType) 2: { 3: return GetItems(); 4: } There are two things that stand out in this action method. The first and the most obvious one being that the return type is not of type ActionResult (or one of its derivatives). Instead I’m passing the type of the model itself (IList<Item> in this case). We’ll convert this to some type of an ActionResult in our custom controller action invoker class later. The second thing (a little subtle) is that I’m not doing anything with the outputType value that is passed on to this action method. This value will be in the RouteData dictionary and we’ll use this in our custom invoker class as well. It’s time to hook up our invoker class. First, I’ll override the Initialize() method of my RenderAsController class. 1: protected override void Initialize(RequestContext requestContext) 2: { 3: base.Initialize(requestContext); 4: string outputType = string.Empty; 5:  6: // read the outputType from the RouteData dictionary 7: if (requestContext.RouteData.Values["outputType"] != null) 8: { 9: outputType = requestContext.RouteData.Values["outputType"].ToString(); 10: } 11:  12: // my custom invoker class 13: ActionInvoker = new ContentRendererActionInvoker(outputType); 14: } Coming to the main part of the discussion – the ContentRendererActionInvoker class: 1: public class ContentRendererActionInvoker : ControllerActionInvoker 2: { 3: private readonly string _outputType; 4:  5: public ContentRendererActionInvoker(string outputType) 6: { 7: _outputType = outputType.ToLower(); 8: } 9: //... 10: } So the outputType value that was read from the RouteData, which was passed in from the url, is being set here in  a private field. Moving to the crux of this article, I now override the CreateActionResult method. 1: protected override ActionResult CreateActionResult(ControllerContext controllerContext, ActionDescriptor actionDescriptor, object actionReturnValue) 2: { 3: if (actionReturnValue == null) 4: return new EmptyResult(); 5:  6: ActionResult result = actionReturnValue as ActionResult; 7: if (result != null) 8: return result; 9:  10: // This is where the magic happens 11: // Depending on the value in the _outputType field, 12: // return an appropriate ActionResult 13: switch (_outputType) 14: { 15: case "json": 16: { 17: JavaScriptSerializer serializer = new JavaScriptSerializer(); 18: string json = serializer.Serialize(actionReturnValue); 19: return new ContentResult { Content = json, ContentType = "application/json" }; 20: } 21: case "xml": 22: { 23: XmlSerializer serializer = new XmlSerializer(actionReturnValue.GetType()); 24: using (StringWriter writer = new StringWriter()) 25: { 26: serializer.Serialize(writer, actionReturnValue); 27: return new ContentResult { Content = writer.ToString(), ContentType = "text/xml" }; 28: } 29: } 30: case "csv": 31: controllerContext.HttpContext.Response.AddHeader("Content-Disposition", "attachment; filename=items.csv"); 32: return new ContentResult 33: { 34: Content = ToCsv(actionReturnValue as IList<Item>), 35: ContentType = "application/ms-excel" 36: }; 37: case "pdf": 38: string filePath = controllerContext.HttpContext.Server.MapPath("~/items.pdf"); 39: controllerContext.HttpContext.Response.AddHeader("content-disposition", 40: "attachment; filename=items.pdf"); 41: ToPdf(actionReturnValue as IList<Item>, filePath); 42: return new FileContentResult(StreamFile(filePath), "application/pdf"); 43:  44: default: 45: controllerContext.Controller.ViewData.Model = actionReturnValue; 46: return new ViewResult 47: { 48: TempData = controllerContext.Controller.TempData, 49: ViewData = controllerContext.Controller.ViewData 50: }; 51: } 52: } A big method there! The hook I was talking about kinda above actually is here. This is where different kinds / formats of output get returned based on the output type requested in the url. When the _outputType is not set (string.Empty as set in the Global.asax.cs file), the razor view gets rendered (lines 45-50). This is the default behavior in most MVC applications where-in a view (webform/razor) gets rendered on the browser. As you see here, this gets returned as a ViewResult. But then, for an outputType of json/xml/csv, a ContentResult gets returned, while for pdf, a FileContentResult is returned. Here are how the different kinds of output look like: This is how we can leverage this feature of ASP.NET MVC to developer a better application. I’ve used the iTextSharp library to convert to a pdf format. Mike gives quite a bit of detail regarding this library here. You can download the sample code here. (You’ll get an option to download once you open the link). Verdict: Hot chocolate: $3; Reebok shoes: $50; Your first car: $3000; Being able to extend a web application: Priceless.

    Read the article

  • Spree how to use Hooks

    - by kristian nissen
    According to http://spreecommerce.com/documentation/theming.html#hooks you should be able to use spree hooks using my_theme_hooks.rb but how? Do I need to extend a class and where can I check which hooks are used in the default theme?

    Read the article

  • Hooks...exactly what they are

    - by Ygam
    I have seen hooks in Kohana PHP framework, and they work as some sort of a callback function triggered by a certain event (Kohana's events that is, some sort of method overloading). I have seen hooks in Wordpress, and I don't know what they are or how to use them (just saw them yesterday). I'm looking for events in "non-frameworked" php, I cannot find ones. Do hooks work only in an "event-based" environment? What are they anyway (in general, not just in PHP)? What are they good for if not in an "event-based" environment.

    Read the article

  • Adding hooks to TortoiseHg

    - by hekevintran
    I am using TortoiseHg and would like to apply a hook to my repo. My repo's .hg/hgrc file is as follows: [hooks] pretxncommit = python:hg_checksize.newbinsize The thing is that I don't know where TortoiseHg's PYTHONPATH variable is set. How do I change it? Or where do I put my Python file so that it is visible by TortoiseHg's Python interpreter? I cannot find any mention of hooks in TortoiseHg's documentation or through Google?

    Read the article

  • gitosis-admin git push failed, exec hooks/post-update

    - by v14nt0
    I'm following this tutorial http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way after this step git commit -a -m "Allow jdoe write access to free_monkey" git push i always failed, with this error fatal: exec hooks/post-update failed. this is from my /home/git/repositories/gitosis-admin/hooks/post-update -rwxr-xr-x 1 git git 83 Mar 10 11:49 post-update so i change gitosis.conf manually from server for adding new repositories, and repos can work fine. i've google what might cause it, i want to admin gitosis in proper way Please Help Regards, REV

    Read the article

  • Where are Riak Post-Commit Hooks run?

    - by pixelcort
    I'm trying to evaluate using Riak's Post-Commit Hooks to build a distributed, incremental MapReduce-based index, but was wondering which Riak nodes the Post-Commit Hooks actually run on. Are they run on the nodes the client used to put the commits, or on the primary nodes where the data is persisted? If it's the latter, I'm thinking I can from there efficiently do a map or reduce and put additional records from the output.

    Read the article

  • Is it possible to generate Events and Hooks in Lua for any game without built-in support?

    - by pr0tocol
    Does a game have to have built-in functions to accept and run lua scripts, or can I design Events and Hooks using Lua on any game I please, akin to the days where C code could be used to hook into the WinAPI using dlls? The reason I ask is, I am trying to create a background application that will perform events and hooks on a particular game that does not currently support lua in-game. Brief examples: Events: - An action executed by the PLAYER is detected. For instance, hitting the Q key will normally make my character use an ability, but with my Lua script running in the background, will cause a sound to play on my computer (or something). Hooks: - An action within the GAME is detected. For instance, the game spawns an enemy every minute. When an enemy spawns, the script will detect this and perform an action, for instance playing a sound locally on the computer. I would like to do both, but I know for games like Garry's Mod, the game already has built-in support for running lua scripts. Is there a way to do either events OR hooks using lua similarly to how C/C++ can connect to a game using WinAPI dlls?

    Read the article

  • Do WordPress widget (or sidebar) hooks exist?

    - by Jeff
    I'm trying to filter ALL widget output through a simple filter, but can't find any hooks and was hoping to be pointed in the right direction. Or possibly my efforts are not even possible? My simple filter is something like this: function clean_widget_output( $input ) { return str_replace( array( "\t", "\n", "\r" ), '', $input ); } add_[FILTER OR ACTION]( 'need_a_hook', 'clean_widget_output', 99 ); Any ideas? I'm pretty new to PHP, but I can get around.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >