Search Results

Search found 315 results on 13 pages for 'adrian matteo'.

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

  • What is So Unique About Node.js?

    - by Adrian Shum
    Recently there has been a lot of praise for Node.js. I am not a developer that has had much exposure to network application. From my bare understanding of Nodes.js, its strength is: we have only one thread handling multiple connections, providing an event-based architecture. However, for example in Java, I can create only one thread using NIO/AIO (which is non-blocking APIs from my bare understanding), and handle multiple connections using that thread, and I provide an event-based architecture to implement the data handling logic (shouldn't be that difficult by providing some callback etc) ? Given JVM being a even more mature VM than V8 (I expect it to run faster too), and event-based handling architecture seems to be something not difficult to create, I am not sure why Node.js is attracting so much attention. Did I miss some important points?

    Read the article

  • How much time takes to a new language like D to become popular? [closed]

    - by Adrián Pérez
    I was reading about new languages for me to learn and I find very good comments about D, like it's the new C or what C++ should have been. Knowing that many people say wonders about the language, I'm wondering how much time usually takes to a language to become popular. This is, having libraries ported or written natively for this language and being used in serious software development. I have read about the history of Java, and Python to figure it out, but may be they are too high level complexity to say their development could take the same time as will take for D.

    Read the article

  • Why Nodes.js being that "unique"?

    - by Adrian Shum
    Recently years there are lots of praise to Nodes.js. I am not a developer that have much exposure on network application. From my bare understanding of Nodes.js, its strength is: We are having only on thread handling multiple connections, providing a event-based architecture. However, for example in Java, what if I am having only one thread, using NIO/AIO (which is non-blocking APIs from my bare understanding), and handle multiple connections using that thread, and I provide an event-based architecture to implement the data handling logic (shouldn't be that difficult by providing some callback etc) ? Given JVM being a even more mature VM than V8 (I expect it run faster too), and event-based handling architecture seems not something difficult to create. I am not sure why Nodes.js is attracting so much attention. Did I miss some important points?

    Read the article

  • can't install libcairo2-dev under ubuntu 12.04

    - by Adrian Serafin
    I'm trying to install libcairo2-dev package on ubuntu 12.04. The error message is as follows: requires: libcairo2 (= 1.10.2-6.1ubuntu2) but 1.10.2-6.1ubuntu3 is about to be installed requires: libcairo-gobject2 (= 1.10.2-6.1ubuntu2) but 1.10.2-6.1ubuntu3 is about to be installed requires: libglib2.0-dev but it won't be installed Don't really know what to do next, tried googling but with no luck :(

    Read the article

  • Toshiba A105 s4244 microphone doesn't work

    - by Adrian Gabura
    I have installed ubuntu on my toshiba laptop and whenever I connect a microphone it doesn't detect any sounds at all. Everything worked well under xp. When I try sound recorder to record sounds it registers no sounds. The only thing that actually gets recorded is a sound when I remove or connect the microphone in its socket(a kind of a "click"). No its NOT muted I checked a million times. Thanks a lot!

    Read the article

  • update-grub is setting a wrong linux root partition

    - by adrian m
    Initially, Ubuntu was installed on another partition (sda5 or sda4). At some point I did manually move the root partition to sda2. Now, the problem is that whenever a new kernel is installed, the automatic regeneration of the menu.lst is using the OLD Linux partition. So I have to manually change in menu.lst the lines : root (hd0,5) into root (hd0,1) How can I configure update-grub to automatically generate menu.lst with the current Linux root partition? I assume that the (hd0,5) was written somewhere at installation, but I couldn't find it.

    Read the article

  • {smartassembly} Software for Code Obfuscation

    {smartassembly} is a tool for ensuring that the source code your commercial .NET application isn't visible to anyone with .NET Reflector. Matteo Slaviero, who writes for us about encryption in .NET, asked if he could write a review of {smartassembly} for Simple-Talk. Because we like the product too, and Red Gate Software had recently taken it over, we were happy to agree. span.fullpost {display:none;}

    Read the article

  • {smartassembly} software for code obfuscation

    {smartassembly} is a tool for ensuring that the source code your commercial .NET application isn't visible to anyone with .NET Reflector. Matteo, who writes for us about encryption in .NET, asked if he could write a review of {smartassembly} for Simple-Talk. Because we like the product too, and Red Gate Software had recently taken over the product, we were happy to agree.

    Read the article

  • Symmetric Encryption

    Cryptography is an increasing requirement for applications, so it is great that it is part of the .NET framework. Matteo builds on his first article that explained Asymmetric Cryptography and Digital Signatures, and tackles Symmetric Encryption and how to implement it in the .NET Framework.

    Read the article

  • AJAX basics with jQuery in ASP.NET

    ASP.NET now has support for the jQuery JavaScript library. Although ASP.NET integrated AJAX technology by introducing the is the UpdatePanel server control, jQuery offers an alternative, and more versatile, way of doing it and a great deal more besides. Matteo shows how easy it is to get started with using jQuery.

    Read the article

  • TLS/SSL and .NET Framework 4.0

    The Secure Socket Layer is now essential for the secure exchange of digital data, and is most generally used within the HTTPS protocol. .NET now provides the Windows Communication Foundation (WCF) to implement secure communications directly. Matteo explains the TLS/SSL protocol, and takes a hands-on approach to investigate the SslStream class to show how to implement a secure communication channel

    Read the article

  • links for 2010-06-03

    - by Bob Rhubart
    @rluttikhuizen: Fault handling in Oracle SOA Suite 11g "When it comes to technical faults," says  Oracle ACE Ronald van Luttikhuizen, "you probably do not want to design error handling in the process itself." (tags: soa oracleace oracle otn) Adrian Campbell: Enterprise Architecture and Zombies EA blogger Adrian Campbell invokes Harry Potter, the Lord of the Rings, Black Adder, and "Pride and Prejudice and Zombies" in this interpretation of Gartner's 10 EA pitfalls. (tags: entarch zombies gartner) Nathalie Roman: Oracle Forms -- alive and kicking Oracle ACE Director Nathalie Roman offers details on a recent Oracle Forms Modernization seminar.  (tags: oracle otn oracleace fusionmiddleware soa) Trond-Arne Undheim: Is Openness at the heart of the EU Digital Agenda? Trond-Arne Undheim shares some insight into the upcoming OpenForum Europe Summit 2010, to be held in Brussels. (tags: oracle otn entarch architect) Chris Raby: Oracle Financial Analytics Presentations and Photos Chris Raby shares details on Rittman Mead's series of seminars that combine the company's in-depth technical knowledge with a greater focus on the business perspective.  (tags: entarch bi architect oracle otn) June Oracle Technology Network NEW Member Benefits - books books and more books!!! Details on how OTN members can get discounts on books from APress, CRC, Pearson, and Packt Publishing.  (tags: oracle otn community books discounts) Manoj Neelapu: Oracle Service Bus + SOA in same server Manoj Neelapu's  tutorial covers on how to do create a domain in which SOA and Oracle Service Bus run in a single JVM . (tags: oracle otn soa architect)

    Read the article

  • links for 2010-06-16

    - by Bob Rhubart
    Automating Enterprise Reporting with SOA and Oracle Business Intelligence Publisher In the latest article in the Enterprise Solution Cookbook series, authors John Chung and Harish Gaur take you step-by-step through the development of an automated reporting platform using Oracle's SOA Suite, WebCenter, and Business Intelligence Publisher. (tags: soa enterprise2.0 architect entarch bpm oracle otn) @ORACLENERD: Job: Infrastructure Technical Architect Oracle ACE Chet "ORACLENERD" Justice shares the 411 on a great new gig for the right architect.  (tags: jobs employment infrastructure architect oracleace) Andrew Ness: Building a training environment for RAC, ASM and Dataguard on OEL 5.4 "In all the environments I've worked in where Oracle DBAs are involved, " says Ness, "they would have chewed my arm off to have this level of control over where their data lives." (tags: oracle grid database dba) Chris Quenelle: Virtualization terms UNIXy Goodness blogger Chris Quenelle dives into Wikipedia to compile this short but valuable glossary of virtualization terms.  (tags: solaris hypervisor virtualization) William Vambenepe: CMDB in the Cloud: not your father's CMDB "Most [customers] will be dealing with a mix of old-style and Cloud applications and they’ll be looking for a unified management approach. This helps CMDB incumbents. If you doubt the power to continuity, take a minute to realize that the entire value proposition of hypervisor-style virtualization is centered around it." -- William Vambenepe (tags: oracle otn cloud virtualization) Merv Adrian: Oracle Exadata: a Data Management Tipping Point "In this second version of its newest platform, Oracle not only provides the latest technology in each part of the data-management architecture, but also integrates them under the full control of one vendor, with a unified approach to leveraging the full stack." -- Merv Adrian (tags: oracle exadata database)

    Read the article

  • Windows Azure BidNow Sample &ndash; definitely worth a look

    - by Eric Nelson
    [Quicklink: download new Windows Azure sample from http://bit.ly/bidnowsample] On Mondays (17th May) in the  6 Weeks of Windows Azure training (Now full) Live Meeting call, Adrian showed BidNow as a sample application built for Windows Azure. I was aware of BidNow but had not found the time to take a look at it nor seems it running before. Adrian convinced me it was worth some a further look. In brief I like it :-) It is more than Hello World, but still easy enough to follow. Bid Now is an online auction site designed to demonstrate how you can build highly scalable consumer applications using Windows Azure. It is built using Visual Studio 2008, Windows Azure and uses Windows Azure Storage. Auctions are processed using Windows Azure Queues and Worker Roles. Authentication is provided via Live Id. Bid Now works with the Express versions of Visual Studio and above. There are extensive setup instructions for local and cloud deployment You can download from http://bit.ly/bidnowsample (http://code.msdn.microsoft.com/BidNowSample) and also check out David original blog post. Related Links UK based? Sign up to UK fans of Windows Azure on ning Check out the Microsoft UK Windows Azure Platform page for further links

    Read the article

  • Getting an Access 2007 table (.accdb extension) in ArcMap programmatically

    - by Adrian
    I have recently found a script from ArcScripts on how to get an Access table in ArcGIS programmatically and it works well. But this is for Access 2003 (.mdb extension) and earlier. The code is posted below, and I want to know how to modify it for using Access 2007 (.accdb extension) and later databases. Attribute VB_Name = "Access_connect" Sub Open_Access_Connect() 'V. Guissard Jan. 2007 On Error GoTo EH Dim data_source As String Dim pTable As ITable Dim TableName As String Dim pFeatWorkspace As IFeatureWorkspace Dim pMap As IMap Dim mxDoc As IMxDocument Dim pPropset As IPropertySet Dim pStTab As IStandaloneTable Dim pStTabColl As IStandaloneTableCollection Dim pWorkspace As IWorkspace Dim pWorkspaceFact As IWorkspaceFactory Set pPropset = New PropertySet ' Get MDB file name data_source = GetFolder("mdb") ' Connect to the MDB database pPropset.SetProperty "CONNECTSTRING", "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data source=" & data_source & ";User ID=Admin;Password=" Set pWorkspaceFact = New OLEDBWorkspaceFactory Set pWorkspace = pWorkspaceFact.Open(pPropset, 0) Set pFeatWorkspace = pWorkspace ' Get table name TableName = SelectDataSet(pFeatWorkspace, "Table") ' Open the table Set pTable = pFeatWorkspace.OpenTable(TableName) 'Create Table collection and add the table to ArcMap Set mxDoc = ThisDocument Set pMap = mxDoc.FocusMap Set pStTab = New StandaloneTable Set pStTab.Table = pTable Set pStTabColl = pMap pStTabColl.AddStandaloneTable pStTab ' Update ArcMap Source TOC mxDoc.UpdateContents Exit Sub EH: MsgBox "Access connect: " & Err.Number & " " & Err.Description End Sub Public Function GetFolder(Optional aFilter As String) As String ' Open a GUI to let the user select a Folder path name (by default) or : ' Set aFilter = "shp" to get a shapefile name ' Set aFilter = "mdb" to get an MS Access file name ' Return the Folder Path or phath & file name As String ' V. Guissard Jan. 2007 Dim pGxDialog As IGxDialog Dim pFilterCol As IGxObjectFilterCollection Dim pCurrentFilter As IGxObjectFilter Dim pEnumGx As IEnumGxObject Select Case aFilter Case "shp" Set pCurrentFilter = New GxFilterShapefiles aTitle = "Select Shapefile" Case "mdb" Set pCurrentFilter = New GxFilterContainers aTitle = "Select MS Access database" Case Else Set pCurrentFilter = New GxFilterBasicTypes aTitle = "Select Folder" End Select Set pGxDialog = New GxDialog Set pFilterCol = pGxDialog With pFilterCol .AddFilter pCurrentFilter, True End With With pGxDialog .Title = aTitle .ButtonCaption = "Select" End With If Not pGxDialog.DoModalOpen(0, pEnumGx) Then Smp = MsgBox("No selection : Exit", vbCritical) End 'Exit Function 'Exit if user press Cancel End If GetFolder = pEnumGx.Next.FullName End Function Public Function SelectDataSet(pWorkspace As IWorkspace, Optional theDataType As String) As String ' Open a GUI to let the user select a DataSet into a Workspace ' (Table or Request into an MS Access Database or a Geodatabase File) ' Set pWorkspace to the DataSet IWorkspace ' Set theDataType = "Table" to select a Table name of the DataSet ' Return the selected Table or Request Table name As String ' V. Guissard Jan. 2007 Dim aDataset As Boolean Dim boolOK As Boolean Dim DataSetList As New Collection Dim datasetType As Integer Dim n As Integer Dim pDataSetName As IDatasetName Dim pListDlg As IListDialog Dim pEnumDatasetName As IEnumDatasetName ' Set the Dataset Type Select Case theDataType Case "Table" datasetType = 10 Case Else Answ = MsgBox("Need a Dataset Type : Exit", vbCritical, "SelectDataset") End End Select ' Get the Dataset Names included in the workspace Set pEnumDatasetName = pWorkspace.DatasetNames(datasetType) ' Create the Dataset Names List Dialog aDataset = False Set pListDlg = New ListDialog pEnumDatasetName.Reset Set pDataSetName = pEnumDatasetName.Next Do While Not pDataSetName Is Nothing pListDlg.AddString pDataSetName.name DataSetList.Add (pDataSetName.name) Set pDataSetName = pEnumDatasetName.Next aDataset = True Loop ' Open a GUI for the user to select a dataset If aDataset Then boolOK = pListDlg.DoModal("Select a " & theDataType, 0, Application.hwnd) n = pListDlg.choice If (n <> -1) Then SelectDataSet = DataSetList(n + 1) Else Sup = MsgBox("No DataSet selected : EXIT", vbCritical, "SelectDataset") End End If End If End Function Here is the link to the ArcScript: http://arcscripts.esri.com/Data/AS14882.bas PS I know this code is written in VBA and I don't know if a modified version is in VB.NET or whatever else language. Thanks, Adrian

    Read the article

  • How do I create a partial function with generics in scala?

    - by Matteo Caprari
    Hello. I'm trying to write a performance measurements library for Scala. My idea is to transparently 'mark' sections so that the execution time can be collected. Unfortunately I wasn't able to bend the compiler to my will. An admittedly contrived example of what I have in mind: // generate a timing function val myTimer = mkTimer('myTimer) // see how the timing function returns the right type depending on the // type of the function it is passed to it val act = actor { loop { receive { case 'Int => val calc = myTimer { (1 to 100000).sum } val result = calc + 10 // calc must be Int self reply (result) case 'String => val calc = myTimer { (1 to 100000).mkString } val result = calc + " String" // calc must be String self reply (result) } Now, this is the farthest I got: trait Timing { def time[T <: Any](name: Symbol)(op: => T) :T = { val start = System.nanoTime val result = op val elapsed = System.nanoTime - start println(name + ": " + elapsed) result } def mkTimer[T <: Any](name: Symbol) : (() => T) => () => T = { type c = () => T time(name)(_ : c) } } Using the time function directly works and the compiler correctly uses the return type of the anonymous function to type the 'time' function: val bigString = time('timerBigString) { (1 to 100000).mkString("-") } println (bigString) Great as it seems, this pattern has a number of shortcomings: forces the user to reuse the same symbol at each invocation makes it more difficult to do more advanced stuff like predefined project-level timers does not allow the library to initialize once a data structure for 'timerBigString So here it comes mkTimer, that would allow me to partially apply the time function and reuse it. I use mkTimer like this: val myTimer = mkTimer('aTimer) val myString= myTimer { (1 to 100000).mkString("-") } println (myString) But I get a compiler error: error: type mismatch; found : String required: () => Nothing (1 to 100000).mkString("-") I get the same error if I inline the currying: val timerBigString = time('timerBigString) _ val bigString = timerBigString { (1 to 100000).mkString("-") } println (bigString) This works if I do val timerBigString = time('timerBigString) (_: String), but this is not what I want. I'd like to defer typing of the partially applied function until application. I conclude that the compiler is deciding the return type of the partial function when I first create it, chosing "Nothing" because it can't make a better informed choice. So I guess what I'm looking for is a sort of late-binding of the partially applied function. Is there any way to do this? Or maybe is there a completely different path I could follow? Well, thanks for reading this far -teo

    Read the article

  • Javascript static method intheritance

    - by Matteo Pagliazzi
    I want to create a javascript class/object that allow me to have various method: Model class Model.all() » static method Model.find() » static method Model delete() » instance method Model save() » instance method Model.create() » static that returns a new Model instance For static method I can define them using: Model.staticMethod(){ method } while for instance method is better to use: function Model(){ this.instanceMethod = function(){} } and then create a new instance or using prototype? var m = function Model(){ } m.prototype.method() = function(){ } Now let's say that I want to create a new class based on Model, how to inherit not only its prototypes but also its static methods?

    Read the article

  • Android - Correspondence between ImageView coordinates and Bitmap Pixels

    - by Matteo
    In my application I want the user to be able to select some content of an Image contained inside an ImageView. To select the content I subclassed the ImageView class making it implement the OnTouchListener so to draw over it a rectangle with borders decided by the user. Here is an example of the result of the drawing (to have an idea you can think of it as when you click with the mouse on your desktop and drag the mouse): Now I need to determine which pixels of the Bitmap image correspond to the selected part. It's kind of easy to determine which are the points of the ImageView belonging to the rectangle, but I don't know how to get the correspondent pixels, since the ImageView has a different aspect ratio than the original image. I followed the approach described especially here, but also here, but am not fully satisfied because in my opinion the correspondence made is 1 on 1 between pixels and points on the ImageView and does not give me all the correspondent pixels on the original image to the selected area. Calling hoveredRect the rectangle on the ImageView the points inside of it are: class Point { float x, y; @Override public String toString() { return x + ", " + y; } } Vector<Point> pointsInRect = new Vector<Point>(); for( int x = hoveredRect.left; x <= hoveredRect.right; x++ ){ for( int y = hoveredRect.top; y <= hoveredRect.bottom; y++ ){ Point pointInRect = new Point(); pointInRect.x = x; pointInRect.y = y; pointsInRect.add(pointInRect); } } How can I obtain a Vector<Pixels> pixelsInImage containing the correspondent pixels?

    Read the article

  • Insert HTML on Radio Label on Formtastic

    - by Adrian Matteo
    I have a form that has a radio button on it (Formtastic), and It works just fine with the :collection I'm passing. The problem is I want some part of the text to be affected by some CSS, but the :collection attribute does not let me put in HTML. Here's my code: = subscription.input :plan_type_id, :as => :radio, :label => false, :wrapper_html => {:class => "plan_type"}, :collection => { @plans[:premium_yearly][:description]+number_to_currency(@plans[:premium_yearly][:amount], :precision => 2) => @plans[:premium_yearly][:value], @plans[:premium_monthly][:description]+number_to_currency(@plans[:premium_monthly][:amount], :precision => 2) => @plans[:premium_monthly][:value] } Has you may may see, I build the label I want to show with my @plans variable and the :collection attribute. Is there any way I can modify the way it renders the label, I want to put some css to some part of the label. I want something like this: = subscription.input :plan_type_id, :as => :radio, :label => false, :wrapper_html => {:class => "plan_type"}, :collection => { @plans[:premium_yearly][:description]+'<b>'+number_to_currency(@plans[:premium_yearly][:amount], :precision => 2)+'<\\b>' => @plans[:premium_yearly][:value], @plans[:premium_monthly][:description]+'<b>'+number_to_currency(@plans[:premium_monthly][:amount], :precision => 2)+'<\\b>' => @plans[:premium_monthly][:value] } Thanks in advanced.

    Read the article

  • How can I map a spring controller to a url with .jsp extension?

    - by Matteo Caprari
    Hi. We are in the process of migrating a jsp-only application to Spring-MVC. For various reasons we can't change the extension of the current pages. (calls to login.jsp need to handled by a spring controller that will use a jsp file as view). We are doing this iteratively, so some pages need to stay jsp files (calls to welcome.jsp won't be handled by a controller). To do that I mapped both the DispatcherDervlet and the HandlerMapping to *.jsp, and configured the JstlView in the standard way. Unfortunately, if I browse to //login.jsp I get an error saying <No mapping found for HTTP request with URI [/<context>/WEB-INF/jsp/login.jsp] in DispatcherServlet with name 'spring'> It all works if I change .jsp to any other extension in DispatcherServlet and HandlerMapping. web.xml: <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.jsp</url-pattern> </servlet-mapping> spring-servlet.xml: <!-- View resolver --> <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/> </bean> <!-- URL Mapping --> <bean id="publicUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="urlMap"> <map> <entry key="/login.jsp" value-ref="loginController"/> </map> </property> </bean> Thanks a lot.

    Read the article

  • How to intercept deallocate callbacks of Core Foundation objects in Objective-C.

    - by Matteo
    I'm writing an Eiffel wrapper for AppKit and Foundation and I need to hijack all -dealloc methods. Thanks to the dynamic nature of Objective-C it is pretty easy to do that. But the problem is it only works with some of the Foundation or AppKit objects. There are certain objects (e.g. NSString, NSArray, NSDate, ...) that are actually CF objects so the dealloc method doesn't get called. Instead the deallocate callbacks of the allocator that allocated the CF object is called. Is there a way to intercept that?

    Read the article

  • How to manage feeds with subclassed object in Django 1.2?

    - by Matteo
    Hi, I'm trying to generate a feed rss from a model like this one, selecting all the Entry objects: from django.db import models from django.contrib.sites.models import Site from django.contrib.auth.models import User from imagekit.models import ImageModel import datetime class Entry(ImageModel): date_pub = models.DateTimeField(default=datetime.datetime.now) author = models.ForeignKey(User) via = models.URLField(blank=True) comments_allowed = models.BooleanField(default=True) icon = models.ImageField(upload_to='icon/',blank=True) class IKOptions: spec_module = 'journal.icon_specs' cache_dir = 'icon/resized' image_field = 'icon' class Post(Entry): title = models.CharField(max_length=200) description = models.TextField() slug = models.SlugField(unique=True) def __unicode__(self): return self.title class Photo(Entry): alt = models.CharField(max_length=200) description = models.TextField(blank=True) original = models.ImageField(upload_to='photo/') class IKOptions: spec_module = 'journal.photo_specs' cache_dir = 'photo/resized' image_field = 'original' def __unicode__(self): return self.alt class Quote(Entry): blockquote = models.TextField() cite = models.TextField(blank=True) def __unicode__(self): return self.blockquote When I use the render_to_response in my views I simply call: def get_journal_entries(request): entries = Entry.objects.all().order_by('-date_pub') return render_to_response('journal/entries.html', {'entries':entries}) And then I use a conditional template to render the right snippets of html: {% extends "base.html" %} {% block main %} <hr> {% for entry in entries %} {% if entry.post %}[...]{% endif %}[...] But I cannot do the same with the Feed Framework in django 1.2... Any suggestion, please?

    Read the article

  • How do I send automated e-mails from Drupal using Messaging and Notifications?

    - by Adrian
    I am working on a Notifications plugin, and after starting to write my notes down about how to do this, decided to just post them here. Please feel free to come make modifications and changes. Eventually I hope to post this on the Drupal handbook as well. Thanks. --Adrian Sending automated e-mails from Drupal using Messaging and Notifications To implement a notifications plugin, you must implement the following functions: Use hook_messaging, hook_token_list and hook_token_values to create the messages that will be sent. Use hook_notifications to create the subscription types Add code to fire events (eg in hook_nodeapi) Add all UI elements to allow users to subscribe/unsubscribe Understanding Messaging The Messaging module is used to compose messages that can be delivered using various formats, such as simple mail, HTML mail, Twitter updates, etc. These formats are called "send methods." The backend details do not concern us here; what is important are the following concepts: TOKENS: tokens are provided by the "tokens" module. They allow you to write keywords in square brackets, [like-this], that can be replaced by any arbitrary value. Note: the token groups you create must match the keys you add to the $events-objects[$key] array. MESSAGE KEYS: A key is a part of a message, such as the greetings line. Keys can be different for each send method. For example, a plaintext mail's greeting might be "Hi, [user]," while an HTML greeing might be "Hi, [user]," and Twitter's might just be "[user-firstname]: ". Keys can have any arbitrary name. Keys are very simple and only have a machine-readable name and a user-readable description, the latter of which is only seen by admins. MESSAGE GROUPS: A group is a bunch of keys that often, but not always, might be used together to make up a complete message. For example, a generic group might include keys for a greeting, body, closing and footer. Groups can also be "subclassed" by selecting a "fallback" group that will supply any keys that are missing. Groups are also associated with modules; I'm not sure what these are used for. Understanding Notifications The Notifications module revolves around the following concepts: SUBSCRIPTIONS: Notifications plugins may define one or more types of subscriptions. For example, notifications_content defines subscriptions for: Threads (users are notified whenever a node or its comments change) Content types (users are notified whenever a node of a certain type is created or is changed) Users (users are notified whenever another user is changed) Subscriptions refer to both the user who's subscribed, how often they wish to be notified, the send method (for Messaging) and what's being subscribed to. This last part is defined in two steps. Firstly, a plugin defines several "subscription fields" (through a hook_notifications op of the same name), and secondly, "subscription types" (also an op) defines which fields apply to each type of subscription. For example, notifications_content defines the fields "nid," "author" and "type," and the subscriptions "thread" (nid), "nodetype" (type), "author" (author) and "typeauthor" (type and author), the latter referring to something like "any STORY by JOE." Fields are used to link events to subscriptions; an event must match all fields of a subscription (for all normal subscriptions) to be delivered to the recipient. The $subscriptions object is defined in subsequent sections. Notifications prefers that you don't create these objects yourself, preferring you to call the notifications_get_link() function to create a link that users may click on, but you can also use notifications_save_subscription and notifications_delete_subscription to do it yourself. EVENTS: An event is something that users may be notified about. Plugins create the $event object then call notifications_event($event). This either sends out notifications immediately, queues them to send out later, or both. Events include the type of thing that's changed (eg 'node', 'user'), the ID of the thing that's changed (eg $node-nid, $user-uid) and what's happened to it (eg 'create'). These are, respectively, $event-type, $event-oid (object ID) and $event-action. Warning: notifications_content_nodeapi also adds a $event-node field, referring to the node itself and not just $event-oid = $node-nid. This is not used anywhere in the core notifications module; however, when the $event is passed back to the 'query' op (see below), we assume the node is still present. Events do not refer to the user they will be referred to; instead, Notifications makes the connection between subscriptions and events, using the subscriptions' fields. MATCHING EVENTS TO SUBSCRIPTIONS: An event matches a subscription if it has the same type as the event (eg "node") and if the event matches all the correct fields. This second step is determined by the "query" hook op, which is called with the $event object as a parameter. The query op is responsible for giving Notifications a value for all the fields defined by the plugin. For example, notifications_content defines the 'nid', 'type' and 'author' fields, so its query op looks like this (ignore the case where $event_or_user = 'user' for now): $event_or_user = $arg0; $event_type = $arg1; $event_or_object = $arg2; if ($event_or_user == 'event' && $event_type == 'node' && ($node = $event_or_object->node) || $event_or_user == 'user' && $event_type == 'node' && ($node = $event_or_object)) { $query[]['fields'] = array( 'nid' => $node->nid, 'type' => $node->type, 'author' => $node->uid, ); return $query; After extracting the $node from the $event, we set $query[]['fields'] to a dictionary defining, for this event, all the fields defined by the module. As you can tell from the presence of the $query object, there's way more you can do with this op, but they are not covered here. DIGESTING AND DEDUPING: Understanding the relationship between Messaging and Notifications Usually, the name of a message group doesn't matter, but when being used with Notifications, the names must follow very strict patterns. Firstly, they must start with the name "notifications," and then are followed by either "event" or "digest," depending on whether the message group is being used to represent either a single event or a group of events. For 'events,' the third part of the name is the "type," which we get from Notification's $event-type (eg: notifications_content uses 'node'). The last part of the name is the operation being performed, which comes from Notification's $event-action. For example: notifications-event-node-comment might refer to the message group used when someone comments on a node notifications-event-user-update to a user who's updated their profile Hyphens cannot appear anywhere other than to separate the parts of these words. For 'digest' messages, the third and fourth part of the name come from hook_notification's "event types" callback, specifically this line: $types[] = array( 'type' => 'node', 'action' => 'insert', ... 'digest' => array('node', 'type'), ); $types[] = array( 'type' => 'node', 'action' => 'update', ... 'digest' => array('node', 'nid'), ); In this case, the first event type (node insertion) will be digested with the notifications-digest-node-type message template providing the header and footer, likely saying something like "the following [type] was created." The second event type (node update) will be digested with the notifications-digest-node-nid message template. Data Structure and Callback Reference $event The $event object has the following members: $event-type: The type of event. Must match the type in hook_notification::"event types". {notifications_event} $event-action: The action the event describes. Most events are sorted by [$event-type][$event-action]. {notifications_event}. $event-object[$object_type]: All objects relevant to the event. For example, $event-object['node'] might be the node that the event describes. $object_type can come from the 'event types' hook (see below). The main purpose appears to be to be passed to token_replace_multiple as the second parameter. $event-object[$event-type] is assumed to exist in the short digest processing functions, but this doesn't appear to be used anywhere. Not saved in the database; loaded by hook_notifications::"event load" $event-oid: apparently unused. The id of the primary object relevant to this event (eg the node's nid). $event-module: apparently unused $event-params[$key]: Mainly a place for plugins to save random data. The main module will serialize the contents of this array but does not use it in any way. However, notifications_ui appears to do something weird with it, possibly by using subscriptions' fields as keys into this array. I'm not sure why though. hook_notifications op 'subscription types': returns an array of subscription types provided by the plugin, in the form $key = array(...) with the following members: event_type: this subscription can only match events whose $event-type has this value. Stored in the database as notifications.event_type for every individual subscription. Apparently, this can be overiden in code but I wouldn't try it (see notifications_save_subscription). fields: an unkeyed array of fields that must be matched by an event (in addition to the event_type) for it to match this subscription. Each element of this array must be a key of the array returned by op 'subscription fields' which in turn must be used by op 'query' to actually perform the matching. title: user-readable title for their subscriptions page (eg the 'type' column in user/%uid/notifications/subscriptions) description: a user-readable description. page callback: used to add a supplementary page at user/%uid/notifications/blah. This and the following are used by notifications_ui as a part of hook_menu_alter. Appears to be partially deprecated. user page: user/%uid/notifications/blah. op 'event types': returns an array of event types, with each event type being an array with the following members: type: this will match $event-type action: this will match $event-action digest: an array with two ordered (non-keyed) elements, "type" and "field." 'type' is used as an index into $event-objects. 'field' is also used to group events like so: $event-objects[$type]-$field. For example, 'field' might be 'nid' - if the object is a node, the digest lines will be grouped by node ID. Finally, both are used to find the correct Messaging template; see discussion above. description: used on the admin "Notifications-Events" page name: unused, use Messaging instead line: deprecated, use Messaging instead Other Stuff This is an example of the main query that inserts an event into the queue: INSERT INTO {notifications_queue} (uid, destination, sid, module, eid, send_interval, send_method, cron, created, conditions) SELECT DISTINCT s.uid, s.destination, s.sid, s.module, %d, // event ID s.send_interval, s.send_method, s.cron, %d, // time of the event s.conditions FROM {notifications} s INNER JOIN {notifications_fields} f ON s.sid = f.sid WHERE (s.status = 1) AND (s.event_type = '%s') // subscription type AND (s.send_interval >= 0) AND (s.uid <> %d) AND ( (f.field = '%s' AND f.intval IN (%d)) // everything from 'query' op OR (f.field = '%s' AND f.intval = %d) OR (f.field = '%s' AND f.value = '%s') OR (f.field = '%s' AND f.intval = %d)) GROUP BY s.uid, s.destination, s.sid, s.module, s.send_interval, s.send_method, s.cron, s.conditions HAVING s.conditions = count(f.sid)

    Read the article

  • generateUrl problem

    - by Daniel Hertz
    I am trying to generate a url but I keep getting a strange warning even though it works. I am making an api xml page and I use the following call in the controller: public function executeList(sfWebRequest $request) { $this->users = array(); foreach($this->getRoute()->getObjects() as $user) { $this->users[$this->generateUrl('user_show', $user, true)] = $user->asArray($request->getHost()); } } The user_show route is as follows: # api urls user_show: url: /user/:nickname param: { module: user, action: show } And the xml outputs as follows: <br /> <b>Warning</b>: array_diff_key() [<a href='function.array-diff-key'>function.array-diff-key</a>]: Argument #1 is not an array in <b>/opt/local/lib/php/symfony/routing/sfRoute.class.php</b> on line <b>253</b><br /> <br /> <b>Warning</b>: array_diff_key() [<a href='function.array-diff-key'>function.array-diff-key</a>]: Argument #1 is not an array in <b>/opt/local/lib/php/symfony/routing/sfRoute.class.php</b> on line <b>253</b><br /> <br /> <b>Warning</b>: array_diff_key() [<a href='function.array-diff-key'>function.array-diff-key</a>]: Argument #1 is not an array in <b>/opt/local/lib/php/symfony/routing/sfRoute.class.php</b> on line <b>253</b><br /> <?xml version="1.0" encoding="utf-8"?> <users> <user url="http://krowdd.dev/frontend_dev.php/user/danny"> <name>Danny tz</name> <nickname>danny</nickname> <email>[email protected]</email> <image></image> </user> <user url="http://krowdd.dev/frontend_dev.php/user/adrian"> <name>Adrian Sooian</name> <nickname>adrian</nickname> </user> </users> So it outputs the correct xml but I do not know why it throws thows warning when calling the generateurl method. Thanks!

    Read the article

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