Search Results

Search found 212 results on 9 pages for 'luca rossi'.

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

  • Do you like Twisted?

    - by Luca
    I use Python Twisted for web development, and I don't like it? I know async programming is a great idea, I know there are may async web servers now, I know it's the only way to solve some problems you'd have with threads but I don't like. The problem is that, you're forced to program in a twisted way. So, the architecture you have in mind, very often have to be modified to fit the way twisted works. The architecture have to follow the technology, I don't think this is good. When we use callback in javascript, we don't have too many difficulties: things are usually simpler, we use a callback in response to an Ajax call. But in a server web app things are, very often, a bit more complex. Writing chain of callbacks don't seem to me a wonderful way of programming. The code is not simple, and so it is difficult to understand and to maintain. Writing twisted code we very often lost the linear intuitive idea of the algorithm we wanted to implement, especially when things grow in complexity. What's your point of view?

    Read the article

  • Routing a location that matches one controller to another

    - by Luca Romagnoli
    Hi I have a controller named "places" with some actions like "view", "new", "create" When a user goes to mysite.com/places I want to execute the action "show" of another controller called "cores" So I've put this in the routes.rb file: map.connect '/:id/show', :controller => "cores", :action => "show" But it doesn't work. I receive this error: Processing PlacesController#show (for 127.0.0.1 at 2010-04-16 00:52:07) [GET] ActionController::UnknownAction (No action responded to show. Actions: admin_denied, admin_required, auto_complete_for_location, auto_complete_for_name, change_location, create, create_facebook_session, create_facebook_session_with_secret, edit, exist, facebook_params, facebook_session, facebook_session_expired, facebook_session_parameters, get_form, is_admin?, new, one_or_true, redirect_to, render_publisher_error, render_publisher_interface, render_publisher_response, set_facebook_session, top_redirect_to, update, wants_interface?, and zero_or_false): How can i do to map that action in another controller? thanks

    Read the article

  • streaming XML serialization in .net

    - by Luca Martinetti
    Hello, I'm trying to serialize a very large IEnumerable<MyObject> using an XmlSerializer without keeping all the objects in memory. The IEnumerable<MyObject> is actually lazy.. I'm looking for a streaming solution that will: Take an object from the IEnumerable<MyObject> Serialize it to the underlying stream using the standard serialization (I don't want to handcraft the XML here!) Discard the in memory data and move to the next I'm trying with this code: using (var writer = new StreamWriter(filePath)) { var xmlSerializer = new XmlSerializer(typeof(MyObject)); foreach (var myObject in myObjectsIEnumerable) { xmlSerializer.Serialize(writer, myObject); } } but I'm getting multiple XML headers and I cannot specify a root tag <MyObjects> so my XML is invalid. Any idea? Thanks

    Read the article

  • executing named_scoped only when there are present params

    - by Luca Romagnoli
    Hi have a model like this: class EventDate < ActiveRecord::Base belongs_to :event named_scope :named, lambda { | name | { :joins => { :event => :core}, :conditions => ["name like ?", "%#{ name }%"] }} named_scope :date_range, lambda { | start, length | { :conditions => ["day >= ? AND day <= ?", start, date + (length || 30) ] }} it works correctly if i launch name = "ba" start = Date.today EventDate.named(name).date_range(start , start + 2) But if the name or the start is nil i don't want execute the named_scope like name = nil EventDate.named(name).date_range(start , start + 2) Is possible to set a condition inner the named_scope ? thanks

    Read the article

  • UITableView: block cell dragging during reordering

    - by Luca
    Hi I've a problem with UITableView. When I'm in editing mode i want to reorder the cell but e when I drag a cell at the bottom of the screen it's allowed to go down as much as the TableView height and down the last tableViewCell. I've only 4 cell and i want that when Im dragging a cell it's not allowed to go down after the fourth cell. Can Anyone help me?!?

    Read the article

  • The rightCalloutAccessory button is not shown

    - by Luca
    I try to manage annotations, and to display an info button on the right of the view when a PIN get selected, my relevant code is this: - (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation { MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"greenPin"]; if ([annotation isKindOfClass:[ManageAnnotations class]]) { static NSString* identifier = @"ManageAnnotations"; MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; if (newAnnotation==nil) { newAnnotation=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; }else { newAnnotation.annotation=annotation; } newAnnotation.pinColor = MKPinAnnotationColorGreen; newAnnotation.animatesDrop = YES; newAnnotation.canShowCallout = YES; newAnnotation.rightCalloutAccessoryView=[UIButton buttonWithType:UIButtonTypeInfoLight]; return newAnnotation; }else { newAnnotation.pinColor = MKPinAnnotationColorGreen; newAnnotation.animatesDrop = YES; newAnnotation.canShowCallout = YES; return newAnnotation; } ManageAnnotations.m : @implementation ManageAnnotations @synthesize pinColor; @synthesize storeName=_storeName; @synthesize storeAdress=_storeAdress; @synthesize coordinate=_coordinate; -(id)initWithTitle:(NSString*)storeName adress:(NSString*)storeAdress coordinate:(CLLocationCoordinate2D)coordinate{ if((self=[super init])){ _storeName=[storeName copy]; _storeAdress=[storeAdress copy]; _coordinate=coordinate; } return self; } -(NSString*)title{ return _storeName; } -(NSString*)subtitle{ return _storeAdress; } ManageAnnotations.h @interface ManageAnnotations : NSObject<MKAnnotation>{ NSString *_storeName; NSString *_storeAdress; CLLocationCoordinate2D _coordinate; } // @property(nonatomic,assign)MKPinAnnotationColor pinColor; @property(nonatomic, readonly, copy)NSString *storeName; @property(nonatomic, readonly, copy)NSString *storeAdress; @property(nonatomic,readonly)CLLocationCoordinate2D coordinate; // -(id)initWithTitle:(NSString*)storeName adress:(NSString*)storeAdress coordinate:(CLLocationCoordinate2D)coordinate; // The PINS are shown correctly on the Map, but without the info button on the right of the view. Am i missing something?

    Read the article

  • User Control as container at design time

    - by Luca
    I'm designing a simple expander control. I've derived from UserControl, drawn inner controls, built, run; all ok. Since an inner Control is a Panel, I'd like to use it as container at design time. Indeed I've used the attributes: [Designer(typeof(ExpanderControlDesigner))] [Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))] Great I say. But it isn't... The result is that I can use it as container at design time but: The added controls go back the inner controls already embedded in the user control Even if I push to top a control added at design time, at runtime it is back again on controls embedded to the user control I cannot restrict the container area at design time into a Panel area What am I missing? Here is the code for completeness... why this snippet of code is not working? [Designer(typeof(ExpanderControlDesigner))] [Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))] public partial class ExpanderControl : UserControl { public ExpanderControl() { InitializeComponent(); .... [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] internal class ExpanderControlDesigner : ControlDesigner { private ExpanderControl MyControl; public override void Initialize(IComponent component) { base.Initialize(component); MyControl = (ExpanderControl)component; // Hook up events ISelectionService s = (ISelectionService)GetService(typeof(ISelectionService)); IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService)); s.SelectionChanged += new EventHandler(OnSelectionChanged); c.ComponentRemoving += new ComponentEventHandler(OnComponentRemoving); } private void OnSelectionChanged(object sender, System.EventArgs e) { } private void OnComponentRemoving(object sender, ComponentEventArgs e) { } protected override void Dispose(bool disposing) { ISelectionService s = (ISelectionService)GetService(typeof(ISelectionService)); IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService)); // Unhook events s.SelectionChanged -= new EventHandler(OnSelectionChanged); c.ComponentRemoving -= new ComponentEventHandler(OnComponentRemoving); base.Dispose(disposing); } public override System.ComponentModel.Design.DesignerVerbCollection Verbs { get { DesignerVerbCollection v = new DesignerVerbCollection(); v.Add(new DesignerVerb("&asd", new EventHandler(null))); return v; } } } I've found many resources (Interaction, designed, limited area), but nothing was usefull for being operative... Actually there is a trick, since System.Windows.Forms classes can be designed (as usual) and have a correct behavior at runtime (TabControl, for example).

    Read the article

  • Better way to do SELECT with GROUP BY

    - by Luca Romagnoli
    Hi i've wrote a query that works: SELECT `comments`.* FROM `comments` RIGHT JOIN (SELECT MAX( id ) AS id, core_id, topic_id FROM comments GROUP BY core_id, topic_id order by id desc) comm ON comm.id = comments.id LIMIT 10 I want know if it is possible (and how) to rewrite it to get better performance. Thanks

    Read the article

  • split html text in 2 paragraphs

    - by Luca Romagnoli
    hi i have a html text like this: aaa dafjsld dslajfk òsal asfòljd <a href="ciao.com">aa aa</a> adsfsadfsadfs i want to split it in 2 paragraphs. but i don't want to generate this situation: <p>aaa dafjsld dslajfk òsal asfòljd <a href="ciao.com">aa</p><p> aa</a> adsfsadfsadfs</p> how can i check if the split involves any tags and avoid it? thanks

    Read the article

  • Custom Windows GUI library

    - by Luca Matteis
    I always wondered how software such as iTunes, Winamp etc is able to create its own UI. How is this accomplished under the Windows platform? Is there any code on the web explaining how one would create their own custom GUI?

    Read the article

  • IntPtr arithmetics

    - by Luca
    I tried to allocate an array of structs in this way: struct T { int a; int b; } data = Marshal.AllocHGlobal(count*Marshal.SizeOf(typeof(T)); ... I'd like to access to allocated data "binding" a struct to each element in array allocated with AllocHGlobal... something like this T v; v = (T)Marshal.PtrToStructure(data+1, typeof(T)); but i don't find any convenient way... why IntPtr lack of arithmetics? How can I workaround this is a "safe" way? Someone could confirm that PtrToStructure function copy data into the struct variable? In other words, modifing the struct reflect modifications in the structure array data, or not? Definitely, I want to operate on data pointed by an IntPtr using struct, without copying data each time, avoiding unsafe code. Thank all!

    Read the article

  • routing map a action controller

    - by Luca Romagnoli
    Hi i have a controller named "places" with some action like "view", "new", "create" When a user try to launch mysite.com/places i want that is execute the action show of a another controller called "cores" so in the routes.rb file i've put this: map.connect '/:id/show', :controller => "cores", :action => "show" But it doesn't work. I receive this error: Processing PlacesController#show (for 127.0.0.1 at 2010-04-16 00:52:07) [GET] ActionController::UnknownAction (No action responded to show. Actions: admin_denied, admin_required, auto_complete_for_location, auto_complete_for_name, change_location, create, create_facebook_session, create_facebook_session_with_secret, edit, exist, facebook_params, facebook_session, facebook_session_expired, facebook_session_parameters, get_form, is_admin?, new, one_or_true, redirect_to, render_publisher_error, render_publisher_interface, render_publisher_response, set_facebook_session, top_redirect_to, update, wants_interface?, and zero_or_false): How can i do to map that action in another controller? thanks

    Read the article

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