Search Results

Search found 116 results on 5 pages for 'stefano palazzo'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Designing for an algorithm that reports progress

    - by Stefano Borini
    I have an iterative algorithm and I want to print the progress. However, I may also want it not to print any information, or to print it in a different way, or do other logic. In an object oriented language, I would perform the following solutions: Solution 1: virtual method have the algorithm class MyAlgoClass which implements the algo. The class also implements a virtual reportIteration(iterInfo) method which is empty and can be reimplemented. Subclass the MyAlgoClass and override reportIteration so that it does what it needs to do. This solution allows you to carry additional information (for example, the file unit) in the reimplemented class. I don't like this method because it clumps together two functionalities that may be unrelated, but in GUI apps it may be ok. Solution 2: observer pattern the algorithm class has a register(Observer) method, keeps a list of the registered observers and takes care of calling notify() on each of them. Observer::notify() needs a way to get the information from the Subject, so it either has two parameters, one with the Subject and the other with the data the Subject may pass, or just the Subject and the Observer is now in charge of querying it to fetch the relevant information. Solution 3: callbacks I tend to see the callback method as a lightweight observer. Instead of passing an object, you pass a callback, which may be a plain function, but also an instance method in those languages that allow it (for example, in python you can because passing an instance method will remain bound to the instance). C++ however does not allow it, because if you pass a pointer to an instance method, this will not be defined. Please correct me on this regard, my C++ is quite old. The problem with callbacks is that generally you have to pass them together with the data you want the callback to be invoked with. Callbacks don't store state, so you have to pass both the callback and the state to the Subject in order to find it at callback execution, together with any additional data the Subject may provide about the event is reporting. Question My question is relative to the fact that I need to implement the opening problem in a language that is not object oriented, namely Fortran 95, and I am fighting with my usual reasoning which is based on python assumptions and style. I think that in Fortran the concept is similar to C, with the additional trouble that in C you can store a function pointer, while in Fortran 95 you can only pass it around. Do you have any comments, suggestions, tips, and quirks on this regard (in C, C++, Fortran and python, but also in any other language, so to have a comparison of language features that can be exploited on this regard) on how to design for an algorithm that must report progress to some external entity, using state from both the algorithm and the external entity ?

    Read the article

  • Design of input files reading when it comes to defaults/transformations

    - by Stefano Borini
    Suppose you have an application that reads an input file, on a language that does not support the concept of None. The input is read, parsed, and the contents are stored on a structure for later use. Now, in general you want to keep into account transformation of the data from the input, such as adding default values when not specified, or adding full path information to relative path specified in the input. There are two different strategies to achieve this. The first strategy is to perform these transformations at input file reading time. In practice, you put all the intelligence into the input parser, and your application has no logic to deal with unexpected circumstances, such as an unspecified value. You lose the information of what was specified and what wasn't, but you gain in black-boxing the details. Your "running code" needs that information in any case and in a proper form, and is not concerned if it's the default or a user-specified information. The second strategy is to have the file reader a real one-to-one mapper from the file to a memory-stored object, with no intelligent behavior. unspecified values are not filled (which may however be a problem in languages not supporting None) and data is stored verbatim from the file. The intelligence for recovery must now go into the "running code", which must check what was specified in the file, eventually fall back to a default, or modify the input properly before using it. I would like to know your opinion on these two approaches, and in particular which one you found the most frequently implemented.

    Read the article

  • Result class dependency

    - by Stefano Borini
    I have an object containing the results of a computation. This computation is performed in a function which accepts an input object and returns the result object. The result object has a print method. This print method must print out the results, but in order to perform this operation I need the original input object. I cannot pass the input object at printing because it would violate the signature of the print function. One solution I am using right now is to have the result object hold a pointer to the original input object, but I don't like this dependency between the two, because the input object is mutable. How would you design for such case ?

    Read the article

  • designing classes with similar goal but widely different decisional core

    - by Stefano Borini
    I am puzzled on how to model this situation. Suppose you have an algorithm operating in a loop. At every loop, a procedure P must take place, whose role is to modify an input data I into an output data O, such that O = P(I). In reality, there are different flavors of P, say P1, P2, P3 and so on. The choice of which P to run is user dependent, but all P have the same finality, produce O from I. This called well for a base class PBase with a method PBase::apply, with specific reimplementations of P1::apply(I), P2::apply(I), and P3::apply(I). The actual P class gets instantiated in a factory method, and the loop stays simple. Now, I have a case of P4 which follows the same principle, but this time needs additional data from the loop (such as the current iteration, and the average value of O during the previous iterations). How would you redesign for this case?

    Read the article

  • .htaccess rewrite , parked domain on another site to read the proper domain name

    - by Stefano
    I have a parked domain ¨mysite.co.uk¨ on another domain name webspace in a folder and need to rewrite the mysite.co.uk domain name in the browser URL as it currently shows the Other domain name while browsing and i need it to read mysite.co.uk. When parking the domain the isp automatically added this which works although displays anotherdomain name. RewriteCond %{HTTP_HOST} ^mysite.co.uk$ [OR] RewriteCond %{HTTP_HOST} ^www.mysite.co.uk$ RewriteRule ^/?$ "http\://www.otherdomain.eu/myfolder" [R=301,L]

    Read the article

  • Organizing MVC entities communication

    - by Stefano Borini
    I have the following situation. Imagine you have a MainWindow object who is layouting two different widgets, ListWidget and DisplayWidget. ListWidget is populated with data from the disk. DisplayWidget shows the details of the selection the user performs in the ListWidget. I am planning to do the following: in MainWindow I have the following objects: ListWidget ListView ListModel ListController ListView is initialized passing the ListWidget. ListViewController is initialized passing the View and the Model. Same happens for the DisplayWidget: DisplayWidget DisplayView DisplayModel DisplayController I initialize the DisplayView with the widget, and initialize the Model with the ListController. I do this because the DisplayModel wraps the ListController to get the information about the current selection, and the data to be displayed in the DisplayView. I am very rusty with MVC, being out of UI programming since a while. Is this the expected interaction layout for having different MVC triplets communicate ? In other words, MVC focus on the interaction of three objects. How do you put this interaction as a whole into a larger context of communication with other similar entities, MVC or not ?

    Read the article

  • constructor should not call methods

    - by Stefano Borini
    I described to a colleague why a constructor calling a method is an antipattern. example (in my rusty C++) class C { public : C(int foo); void setFoo(int foo); private: int foo; } C::C(int foo) { setFoo(foo); } void C::setFoo(int foo) { this->foo = foo } I would like to motivate better this fact through your additional contribute. If you have examples, book references, blog pages, or names of principles, they would be very welcome. Edit: I'm talking in general, but we are coding in python.

    Read the article

  • Constructor should generally not call methods

    - by Stefano Borini
    I described to a colleague why a constructor calling a method can be an antipattern. example (in my rusty C++) class C { public : C(int foo); void setFoo(int foo); private: int foo; } C::C(int foo) { setFoo(foo); } void C::setFoo(int foo) { this->foo = foo } I would like to motivate better this fact through your additional contribute. If you have examples, book references, blog pages, or names of principles, they would be very welcome. Edit: I'm talking in general, but we are coding in python.

    Read the article

  • What do you use to organize your team knowledge?

    - by Stefano Verna
    Last year, me and three good old friends of mine founded a small web/mobile development team. Things are going pretty well. We're learning a lot, and new people are joining the group. Keeping knowledge always updated and in-sync is vital for us. Long emails threads are simply not the way to go for us: too dispersing and confusing, and hard to retrieve after a while. How your team manages and organizes common knowledge? How do you collect and share useful resources (articles, links, libraries, etc) inside your team? Update: Thanks for the feedback. More than using a wiki to share team common procedures or informations, I'd like to share external links, articles, code libraries, and be able to comment them easily within my team. I was particularly interested in knowing if you're aware of any way/webservice to share a reading list with a team. I mean, something like Readitlater/Instapaper, but for teams, maybe with some stats available, like "# of coworkers who read it".

    Read the article

  • Is there anything different in cifs for 13.04? I can't mount with old config

    - by Stefano
    I've recently upgraded my station to 13.04 and all mounts I had on /etc/fstab stopped working. I can't even mount them at terminal (mount -t cifs ...), through smbclient or nautilus. I always get 'NT_STATUS_LOGON_FAILURE'; Provided nothing has changed at the server, I assume some configuration has changed in the packages of 13.04. Maybe password encryption, maybe port? I have just spent 10 hours looking for a solution and, since I have a serious time retrain, I am considering rolling back to 12.10. Could someone give a clue where to find it? Thanks all.

    Read the article

  • WSDLException : An error occurred trying to resolve schema referenced at ...

    - by Stefano
    Hello i'm trying to generate a proxy class from a local wsdl file with eclipse Galileo and axis 2 1.4 on windows xp . My problem is that i get an error due to an imported schema inside the wsdl . The line tha troubles me is : <xsd:import namespace="http://www.w3.org/2005/05/xmlmime" schemaLocation="http://www.w3.org/2005/05/xmlmime"/> i've tried to run the wsdl2java following command: wsdl2java.bat -uri SOAService.wsdl -o D:\temp p test -d xmlbeans -a -s -ns2p -uw and i get the following exception : Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:156) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:ty pes/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve sche ma referenced at 'http://www.w3.org/2005/05/xmlmime', relative to 'file:/D:/Prog rammi/axis2-1.4/bin/SOAService.wsdl'.: java.net.ConnectException: Connection tim ed out: connect at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( CodeGenerationEngine.java:288) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:111) ... 2 more Caused by: java.net.ConnectException: Connection timed out: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.Socket.connect(Socket.java:520) at java.net.Socket.connect(Socket.java:470) at sun.net.NetworkClient.doConnect(NetworkClient.java:157) at sun.net.www.http.HttpClient.openServer(HttpClient.java:388) at sun.net.www.http.HttpClient.openServer(HttpClient.java:523) at sun.net.www.http.HttpClient.(HttpClient.java:231) at sun.net.www.http.HttpClient.New(HttpClient.java:304) at sun.net.www.http.HttpClient.New(HttpClient.java:321) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC onnection.java:813) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne ction.java:765) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection .java:690) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:934) at java.net.URL.openStream(URL.java:1007) at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source) i suspect it's due to the system proxy which doesn't let retrieve the xsd to the wsdl2java tool. In fact i can download the file from the browser without problems. There's an option to specify a proxy to wsdl2java or someone has resolved this issue ? For the moment i've downloaded the xsd, added it to the project and changed the wsdl to include the relative file (instead of the remote one) , but i'd prefer to avoid this , because the file is a third party service wsdl. thank you in advance for any hint Stefano

    Read the article

  • Ubuntu 12.04 despite the left panel POLI tray present, myunity says that unity turns in 2d

    - by Stef
    How do I enable unity 3d? I state that I have used the correct login to ubuntu to ubuntu and not 2d below the glxinfo stefano@WorkLinux:~$ glxinfo | grep render nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 30 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 30 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 55 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 56 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 59 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 58 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 30 direct rendering: Yes OpenGL renderer string: Gallium 0.4 on NV34

    Read the article

  • Reconfigure RAID on Dell PowerEdge T710

    - by Stefano Borini
    I have a Dell PowerEdge T710 under my feet at this very moment, with RedHat Enterprise Server 5.3. I have 6 1TB disks and two 500GB. parted reports two devices, one 500 GB and the other 4 TB. So I assume the RAID has been setup as mirror for two disks, and I assume as RAID 5 the remaining ones. I say "I assume" because it does not make sense. Having 6 disks in RAID 5, I should obtain a total space of 5 TB, not 4TB. It's not even RAID 10: I would end up with a 3 TB unit. How can I check and eventually modify the RAID array definition? In the Fujitsu Siemens I played with some time ago, at boot I had the chance to enter the controller BIOS, but here I don't see a clear way to perform this operation.

    Read the article

  • blur a moving area in a movie on osx

    - by Stefano Borini
    Note, there's already a question on this regard, but it's totally useless. I need to blur, or put a small opaque mask to a moving object on a movie I took, I am using mac osx. Clearly, I don't want to shell out a lot of money for something so simple, so getting adobe premiere or similar software is a no go. I could however consider paying a small software (max 30 dollars) for this specific task.

    Read the article

  • apache+mod_wsgi configuration for django project(s) on a quad core

    - by Stefano
    I've been experiment quite some time with a "typical" django setting upon nginx+apache2+mod_wsgi+memcached(+postgresql) (reading the doc and some questions on SO and SF, see comments) Since I'm still unsatisfied with the behavior (definitely because of some bad misconfiguration on my part) I would like to know what a good configuration would look like with these hypotesis: Quad-Core Xeon 2.8GHz 8 gigs memory several django projects (anything special related to this?) These are excerpts form my current confs: apache2 SetEnv VHOST null #WSGIPythonOptimize 2 <VirtualHost *:8082> ServerName subdomain.domain.com ServerAlias www.domain.com SetEnv VHOST subdomain.domain AddDefaultCharset UTF-8 ServerSignature Off LogFormat "%{X-Real-IP}i %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" custom ErrorLog /home/project1/var/logs/apache_error.log CustomLog /home/project1/var/logs/apache_access.log custom AllowEncodedSlashes On WSGIDaemonProcess subdomain.domain user=www-data group=www-data threads=25 WSGIScriptAlias / /home/project1/project/wsgi.py WSGIProcessGroup %{ENV:VHOST} </VirtualHost> wsgi.py import os import sys # setting all the right paths.... _realpath = os.path.realpath(os.path.dirname(__file__)) _public_html = os.path.normpath(os.path.join(_realpath, '../')) sys.path.append(_realpath) sys.path.append(os.path.normpath(os.path.join(_realpath, 'apps'))) sys.path.append(os.path.normpath(_public_html)) sys.path.append(os.path.normpath(os.path.join(_public_html, 'libs'))) sys.path.append(os.path.normpath(os.path.join(_public_html, 'django'))) os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import django.core.handlers.wsgi _application = django.core.handlers.wsgi.WSGIHandler() def application(environ, start_response): """ Launches django passing over some environment (domain name) settings """ application_group = environ['mod_wsgi.application_group'] """ wsgi application group is required. It's also used to generate the HOST.DOMAIN.TLD:PORT parameters to pass over """ assert application_group fields = application_group.replace('|', '').split(':') server_name = fields[0] os.environ['WSGI_APPLICATION_GROUP'] = application_group os.environ['WSGI_SERVER_NAME'] = server_name if len(fields) > 1 : os.environ['WSGI_PORT'] = fields[1] splitted = server_name.rsplit('.', 2) assert splitted >= 2 splited.reverse() if len(splitted) > 0 : os.environ['WSGI_TLD'] = splitted[0] if len(splitted) > 1 : os.environ['WSGI_DOMAIN'] = splitted[1] if len(splitted) > 2 : os.environ['WSGI_HOST'] = splitted[2] return _application(environ, start_response)` folder structure in case it matters (slightly shortened actually) /home/www-data/projectN/var/logs /project (contains manage.py, wsgi.py, settings.py) /project/apps (all the project ups are here) /django /libs Please forgive me in advance if I overlooked something obvious. My main question is about the apache2 wsgi settings. Are those fine? Is 25 threads an /ok/ number with a quad core for one only django project? Is it still ok with several django projects on different virtual hosts? Should I specify 'process'? Any other directive which I should add? Is there anything really bad in the wsgi.py file? I've been reading about potential issues with the standard wsgi.py file, should I switch to that? Or.. should this conf just be running fine, and I should look for issues somewhere else? So, what do I mean by "unsatisfied": well, I often get quite high CPU WAIT; but what is worse, is that relatively often apache2 gets stuck. It just does not answer anymore, and has to be restarted. I have setup a monit to take care of that, but it ain't a real solution. I have been wondering if it's an issue with the database access (postgresql) under heavy load, but even if it was, why would the apache2 processes get stuck? Beside these two issues, performance is overall great. I even tried New Relic and got very good average results.

    Read the article

  • I found two usb sticks on the ground. Now what?

    - by Stefano Borini
    As from subject. I want to see what's inside. I am seriously interested in finding the owner if possible and returning them, but I am worried it could be an attempt at social engineering. I own a macbook intel with OSX 10.6. It is a very important install. What would you do in my situation if you want to see the content without risks ? Any proposal welcome. Edit: I decided not to plug them in, and I brought them to the hotel reception. They will forward it to the police.

    Read the article

  • Blur a moving area in a movie on Mac OS X

    - by Stefano Borini
    Note, there's already a question on this regard, but it's totally useless. I need to blur, or put a small opaque mask to a moving object on a movie I took, I am using Mac OS X. Clearly, I don't want to shell out a lot of money for something so simple, so getting Adobe Premiere or similar software is a no go. I could however consider paying a small software (max 30 dollars) for this specific task.

    Read the article

  • Ubuntu Server mdadm drbd ocfs2 kvm hangs under heavy file reading

    - by Stefano Annese
    I have deployed four ubuntu 10.04 server. They are coupled two by two in a cluster scenario. on both sides we have software raid1 disks, drbd8 and OCFS2 and on top of it some kvm machines run with qcow2 disks. I followed this: Link corosync is just used for DRBD and OCFS, the kvm machines are run "manually" When it works is fine: good performances, good I/O, but at a given time one of the two cluster started hanging. Then we tried with just one server turned on and it hangs the same. It seems to happen when an heavy READ in one of the virtual machines occurs, that is during rsyn backup. When the fact occurs the virtual machines are not reachable any more and the real server responds with good delay to the ping but no screen and no ssh is available. All we can do is force shutdown (hold the button) and restart and when it turns on again the raid on which relay drbd is resyncing. All the time it hangs we see such fact. After a couple of week of pain on one side this morning also the other cluster hung, but it has different moteherboard, ram, kvm instances. What is similar is reading for rsync scenario and Western Digital RAID Edistion disks on both side. Can anybody give me some input to solve such issue?

    Read the article

  • How can I run msiexec from cygwin to unpack a msi?

    - by Stefano Borini
    I need to unpack (not execute, unpack) a msi in a cygwin makefile. If I invoke from the windows command prompt the following msiexec /a package.msi /qn TARGETDIR=C:\foo The package is correctly deployed in C:\foo. However, if I try to perform the exact same operation from the cygwin prompt msiexec /a package.msi /qn TARGETDIR=C:\\foobaz All I get is the msiexec window stating the usage. I can solve this problem in two ways, either running successfully msiexec as above, or by starting a windows command from the makefile, and have it invoke that operation. Any ideas?

    Read the article

  • How to properly remove disk from PERC 6/i RAID controller ?

    - by Stefano Borini
    I have a Dell T710, coming with PERC 6/i RAID controller. The current raid has 2x500 GB hard drives (with the OS), and 6x1000 GB hard drives (in RAID-6, currently empty). I would like to take one 1000 GB disk physically out to keep as an immediate spare in case of a crash, and configure the remaining 5x1000 GB in a single VD RAID-6. This is all nice and clean and works, until I realized that the display on the machine reports the lack of the 8th disk as an error. It's marked as error, but appears to be a warning, since the machine is fully functional. My question is: what is the best way to keep one disk as a spare out of the array? should I disassemble the disk from the cradle and insert the empty cradle in the array ? Or should I just silence the error in the display in some way (how?). I know that what I am doing sounds pretty strange, but here is academia and having a spare disk available could take weeks. Better to have one ready in my drawer for any emergency.

    Read the article

  • How to put a rgb image on gnuplot 3d plot?

    - by Stefano Borini
    I want to plot an rgb image with gnuplot, and it must be hovering inside a 3d plot box, so that it can act as a "floor" for my data. How can I do it ? THe gnuplot examples use a heatmap to map the rgb values, but this is not what I want. Apart from receiving an error GNUPLOT (plot_image): Color boxes cannot handle RGB components. It is not what I want in any case. I need the full rgb data in the box, not mapped through a heatmap.

    Read the article

  • Is my website running on an iPhone?

    - by Stefano Borini
    Provocative question, but in any case, this is what it would appear... unless there's some other reason, of course. In my cystat wordpress log, I obtained the following entry IP Browser OS Date Method Type URL 127.0.0.1 Safari 419.3 iPhone July 30, 2009 7:39 pm GET BLOG /blog/ The IP address is the IP of the visiting client. It's clear that this is not possible. Why do I get 127.0.0.1 as IP? cystat bug? some weird network trick I am not aware of? or is my website really running on an iPhone, and the guy at the applestore is reading my blog ?

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >