Search Results

Search found 18 results on 1 pages for 'elias haileselassie'.

Page 1/1 | 1 

  • Liskov principle: violation by type-hinting

    - by Elias Van Ootegem
    According to the Liskov principle, a construction like the one below is invalid, as it strengthens a pre-condition. I know the example is pointless/nonsense, but when I last asked a question like this, and used a more elaborate code sample, it seemed to distract people too much from the actual question. //Data models abstract class Argument { protected $value = null; public function getValue() { return $this->value; } abstract public function setValue($val); } class Numeric extends Argument { public function setValue($val) { $this->value = $val + 0;//coerce to number return $this; } } //used here: abstract class Output { public function printValue(Argument $arg) { echo $this->format($arg); return $this; } abstract public function format(Argument $arg); } class OutputNumeric extends Output { public function format(Numeric $arg)//<-- VIOLATION! { $format = is_float($arg->getValue()) ? '%.3f' : '%d'; return sprintf($format, $arg->getValue()); } } My question is this: Why would this kind of "violation" be considered harmful? So much so that some languages, like the one I used in this example (PHP), don't even allow this? I'm not allowed to strengthen the type-hint of an abstract method but, by overriding the printValue method, I am allowed to write: class OutputNumeric extends Output { final public function printValue(Numeric $arg) { echo $this->format($arg); } public function format(Argument $arg) { $format = is_float($arg->getValue()) ? '%.3f' : '%d'; return sprintf($format, $arg->getValue()); } } But this would imply repeating myself for each and every child of Output, and makes my objects harder to reuse. I understand why the Liskov principle exists, don't get me wrong, but I find it somewhat difficult to fathom why the signature of an abstract method in an abstract class has to be adhered to so much stricter than a non-abstract method. Could someone explain to me why I'm not allowed to hind at a child class, in a child class? The way I see it, the child class OutputNumeric is a specific use-case of Output, and thus might need a specific instance of Argument, namely Numeric. Is it really so wrong of me to write code like this?

    Read the article

  • MCP 1.7.10 Java class navigation

    - by Elias Benevedes
    So, I'm new to the Minecraft modding community and trying to understand where to start. I've attempted to do it before, but dropped it to the complexity of starting and the lack of a site like this to help (Mind that I'm also semi-new to Java, but have worked extensively in Javascript and Python. I understand how Java is different from the two). I have downloaded MCP 9.08 (Decompiles 1.7.10), and decompiled Minecraft. I'm looking to mod client, so I didn't supply it with a server jar. Everything seemed to work fine in decompile (Only error was it couldn't find the server jar). I can find my files in /mcp908/src/minecraft/net/minecraft. However, if I open up one of the classes in, say, block, I see a bunch of variables starting with p_ and ending with _. Is there any way to make these variables more decipherable, to understand what's going on so I can learn by example? Thank you.

    Read the article

  • How to secure JBoss application server using SELinux

    - by Jakub Elias
    I want to secure RedHat 5.4 application server by SELinux (targeted policy) and have several questions 1, where can i get SELinux sources (/etc/selinux//src/policy/)There seems to be no such package on install cd .. 2, how to restrict user rights (for example user jboss could not modify /etc/my.cnf) 3, how to configure JBoss application server to work under SELinux Although i read many documents from NSA the whole topic is still not clear for me.What i want is to basically protect filesystem in case one account is broken.I cannot find any materials about securing jboss server using either chroot jail, ACLs or SELinux ....

    Read the article

  • CSS and JS files not being updated, supposedly because of Nginx Caching

    - by Alberto Elias
    I have my web app working with AppCache and I would like that when I modify my html/css/js files, and then update my Cache Manifest, that when the user accesses my web app, they will have an updated version of those files. If I change an HTML file, it works perfectly, but when I change CSS and JS files, the old version is still being used. I've been checking everything out and I think it's related to my nginx configuration. I have a cache.conf file that contains the following: gzip on; gzip_types text/css application/x-javascript text/x-component text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon; location ~ \.(css|js|htc)$ { expires 31536000s; add_header Pragma "public"; add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate"; } location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ { expires 3600s; add_header Pragma "public"; add_header Cache-Control "max-age=3600, public, must-revalidate, proxy-revalidate"; } And in default.conf I have my locations. I would like to have this caching working on all locations except one, how could I configure this? I've tried the following and it isn't working: location /dir1/dir2/ { root /var/www/dir1; add_header Pragma "no-cache"; add_header Cache-Control "private"; expires off; } Thanks

    Read the article

  • Add TOC to PDF from XML/JSON/file?

    - by Elias
    I currently have a PDF file without any ToC (for example, in Mac's Preview.app, I can't see the ToC in the sidebar). But I have the TOC in XML format, where there is a title and a pagenumber where that section starts. Is there any way I can add that TOC to my PDF file in a batch way? Since I have the TOC in XML, I can basically parse it in any possible way, so if there were a command line to add an TOC item to a PDF, I could also do that. Any ideas?

    Read the article

  • Flash AS3 load file xml

    - by Elias
    Hello, I'm just trying to load an xml file witch can be anywere in the hdd, this is what I have done to browse it, but later when I'm trying to load the file it would only look in the same path of the swf file here is the code package { import flash.display.Sprite; import flash.events.; import flash.net.; public class cargadorXML extends Sprite { public var cuadro:Sprite = new Sprite(); public var file:FileReference; public var req:URLRequest; public var xml:XML; public var xmlLoader:URLLoader = new URLLoader(); public function cargadorXML() { cuadro.graphics.beginFill(0xFF0000); cuadro.graphics.drawRoundRect(0,0,100,100,10); cuadro.graphics.endFill(); cuadro.addEventListener(MouseEvent.CLICK,browser); addChild(cuadro); } public function browser(e:Event) { file = new FileReference(); file.addEventListener(Event.SELECT,bien); file.browse(); } public function bien(e:Event) { xmlLoader.addEventListener(Event.COMPLETE, loadXML); req=new URLRequest(file.name); xmlLoader.load(req); } public function loadXML(e:Event) { xml=new XML(e.target.data); //xml.name=file.name; trace(xml); } } } when I open a xml file that isnt it the same directory as the swf, it gives me an unfound file error. is there anything I can do? cause for example for mp3 there is an especial class for loading the file, see http://www.flexiblefactory.co.uk/flexible/?p=46 thanks

    Read the article

  • how to create a dynamic sql statement w/ python and mysqldb

    - by Elias Bachaalany
    I have the following code: def sql_exec(self, sql_stmt, args = tuple()): """ Executes an SQL statement and returns a cursor. An SQL exception might be raised on error @return: SQL cursor object """ cursor = self.conn.cursor() if self.__debug_sql: try: print "sql_exec: " % (sql_stmt % args) except: print "sql_exec: " % sql_stmt cursor.execute(sql_stmt, args) return cursor def test(self, limit = 0): result = sql_exec(""" SELECT * FROM table """ + ("LIMIT %s" if limit else ""), (limit, )) while True: row = result.fetchone() if not row: break print row result.close() How can I nicely write test() so it works with or without 'limit' without having to write two queries?

    Read the article

  • Using LinqSql, stored procedure returns datatype image problem

    - by Elias
    Hello! I´ve got a problem when using LINQ to execute a stored procedure and return its values. One of the column that the stored procedure returns is of datatype image and contains a pdf in binary form.(this because the database is deployed on sql server 2000, otherwised i would choose a blob) When including the stored procedure in my linq class its generates that my pdf columns is datatype int in the designer class. I´ve work around the problem and manually changed the datatype in representation of the stored procedure in the designer class. But when adding/removing items in the linq class the designer file re-generates and my changes are lost. Are there any better solution for my problem??

    Read the article

  • Calculate date from numeric value

    - by elias
    The number 71867806 represents the present day, with the smallest unit of days. How can I calculate the currente date from it? (or) convert it into an Unix timestamp? Solution shouldn't use language depending features. Thanks!

    Read the article

  • Automatic web browsing for windows phone

    - by Elias
    There's a website (telephonic company) where I get a statistic information about the amount of data transferred by my phone during the current month. To access that information, I need: * Access the website and login with username and passwod (html form) * Then choose an option in a combo box (html select) * And finally click on a link that shows the information (html a) I want to develop an app that does all this process automatically, and shows only the statistic data. There's a way to do this in C#?

    Read the article

  • CoInternetIsFeatureEnabled in Delphi2010

    - by Elias
    Hello, I am trying to deactivate the annoying sound when clicking a link in WebBrowser control, WITHOUT changing the user registry. I've found documentation that this can be done through CoInternetIsFeatureEnabled, also explained here. But i have no idea how to implement it on Delphi 2010, since i am getting "Undeclared Identifier" error after including URLMon unit into the project and not much documentation out there. Any ideas?

    Read the article

  • All possible paths in a cyclic undirected graph

    - by Elias
    I'm trying to develop an algorithm that identifies all possible paths between two nodes in a graph, as in this example. in fact, i just need to know which nodes appear in all existing paths. in the web only got references about DFS, A* or dijkstra, but i think they doesn't work in this case. Does anyone know how to solve it?

    Read the article

  • 2D Tile-based terrian generation

    - by a240
    As a summer project I decided it would be fun to make a flash game. Right now I'm going for something like the look of http://www.terraria.org/. It's been a lot of fun, but today I've hit a snag. I need a way to generate my worlds. I've read up Perlin Noise ( http://freespace.virgin.net/hugo.elias/models/m_perlin.htm ) as a possibility, but I my attempts have given me sporadic looking results. What are some techniques used to generate these 2D tile-based worlds? Ideally I would like to be able to generate mountains, plains, and caves.

    Read the article

  • Transform coordinates from 3d to 2d without matrix or built in methods

    - by Thomas
    Not to long ago i started to create a small 3D engine in javascript to combine this with an html5 canvas. One of the issues I run into is how can you transform 3d to 2d coords. Since I cannot use matrices or built in transformation methods I need another way. I've tried implementing the next explanation + pseudo code: http://freespace.virgin.net/hugo.elias/routines/3d_to_2d.htm Unfortunately no luck there. I've replace all the input variables with data from my own camera and object classes. I have the following data: An object with a rotation, position vector and an array of 4 3d coords (its just a plane) a camera with a position and rotation vector the viewport - a square 600 x 600 surface. The example uses a zoom factor which I've set as 1 Most hits on google use either matrix calculations or don't implement camera rotation. Basic transformation should be like this: screen.x = x / z * zoom screen.y = y / z * zoom Can anyone point me in the right direction or explain to me howto achieve this? edit: Thanks for all your posts, I haven't been able to apply all this to my project yet but I hope to do this soon.

    Read the article

  • What is wrong with my game loop/mechanic?

    - by elias94xx
    I'm currently working on a 2d sidescrolling game prototype in HTML5 canvas. My implementations so far include a sprite, vector, loop and ticker class/object. Which can be viewed here: http://elias-schuett.de/apps/_experiments/2d_ssg/js/ So my game essentially works well on todays lowspec PC's and laptops. But it does not on an older win xp machine I own and on my Android 2.3 device. I tend to get ~10 FPS with these devices which results in a too high delta value, which than automaticly gets fixed to 1.0 which results in a slow loop. Now I know for a fact that there is a way to implement a super smooth 60 or 30 FPS loop on both devices. Best example would be: http://playbiolab.com/ I don't need all the chunk and debugging technology impact.js offers. I could even write a super simple game where you just control a damn square and it still wouldn't run on a equally fast 30 or 60 fps. Here is the Loop class/object I'm using. It requires a requestAnimationFrame unify function. Both devices I've tested my game on support requestAnimationFrame, so there is no interval fallback. var Loop = function(callback) { this.fps = null; this.delta = 1; this.lastTime = +new Date; this.callback = callback; this.request = null; }; Loop.prototype.start = function() { var _this = this; this.request = requestAnimationFrame(function(now) { _this.start(); _this.delta = (now - _this.lastTime); _this.fps = 1000/_this.delta; _this.delta = _this.delta / (1000/60) > 2 ? 1 : _this.delta / (1000/60); _this.lastTime = now; _this.callback(); }); }; Loop.prototype.stop = function() { cancelAnimationFrame(this.request); };

    Read the article

  • What is a good Javascript RDFa parser implementation?

    - by tremoloqui
    I am looking to implement a client side RDFa based formatting for a web application. This would be similar to Mark Birbeck's ubiquity-rdfa project. Mark's project looks fantastic but it has at least two drawbacks: It is slow. Adding RDFa formatting to a simple page causes a noticeable delay in page loading. It is complex. The ubiquity-rdfa project makes use of the w3c fresnel specification which is complex way to add simple annotations to client markup. I am looking for a lighter weight way of adding annotations through client code and I don't mind doing some work to get it. What I would like is a fast and reliable Javascript RDFa parser. Some implementations that I have found include: W3C RDFa bookmarklet parser Elias Torres RDFa extractor I am interested to know if you would recommend one of these, or another, RDFa Javascript implementation. Thanks!

    Read the article

  • Expression Studio 4 - without SketchFlow&hellip;

    - by mbcrump
    is kinda like an explosion with no “Ka-Boom”… I was excited to hear the news yesterday at Microsoft Teched that Expression Studio 4 had officially launched. MSDN subscribers could log in and download the full release. So, I logged into my MSDN account and started downloading Expression Studio 4 Premium thinking that I was only minutes away from trying out SketchFlow 4. To my dismay, I launched Blend 4 and noticed it did not say SketchFlow on the splash screen. So, I went to New Project and the template was not available. After some digging around on the net, I learned my premium MSDN subscription did not include SketchFlow and I would need to purchase the Ultimate Edition. Below is a excerpt directly from Microsoft: Q: What products are included in the Microsoft Expression Studio 4 Ultimate? A: Expression Studio 4 Ultimate is comprised of 4 products, Expression Web 4, Microsoft Expression Blend® 4 + SketchFlow, Expression Encoder 4 Pro and Expression Design 4. Expression Blend 4 includes SketchFlow in Expression Studio 4 Ultimate product only. Q: What products are included in the Microsoft Expression Studio 4 Premium? A: Expression Studio 4 Premium is comprised of 4 products, Expression Web 4, Microsoft Expression Blend 4, Expression Encoder 4 and Expression Design 4. Expression Studio 4 Premium is not available for retail purchase. Q: What products are included in the Microsoft Expression Studio 4 Web Professional? A: Expression Studio 4 Web Professional is comprised of 3 products, Expression Web 4, Expression Encoder 4 and Expression Design 4. As you can see, we got screwed on this deal and plenty of people are complaining: Kiran Says: 6.07.2010 at 5:07 PM No SketchFlow for Expression Studio 4 Premium? What a bumper for Microsoft Partners!! Martin Says: 6.07.2010 at 6:18 PM Why does Expression Professional Subscription not include upgrades and new releases of Expression Studio. Good question hey. I bought my subscription 5 days ago thinking I would get what i purchased but no Expression upgrades or new releases for me, what a waste of money. I think I am not the only long term user of this software that feels disgruntled. Sorry john just had to tell someone. shaggygi Says: 6.07.2010 at 7:31 PM SketchFlow NOT included in Studio 4? WTF! I repeat.... WT...Freaking.... F! This is totally unacceptable. My development team purchased VS 2010 Premium w/ MSDN with the impression by Adam Kinney, Scott Guthrie, etc. that this would be included in the Premium package or some sort of free upgrade. I understand this is a Marketing thing, but come on! I believe, at very least, this should have been explained in detail before this release. John Papa... as a rep to give feedback to the team... Please please and please.... tell powers-at-be to fix this problem. Sorry for the rant. Besides this issue, I believe it is a very good product:) Thanks Vaclav Elias Says: 6.08.2010 at 4:30 AM Well, I am also not happy that SketchFlow is only for the chosen ones :-) It is very nice product. Actually, kind of foundation for web development so they could really support any MSDN subscribers.. :-( I am hoping that Microsoft will make this right for all of us with MSDN premier subscriptions. In the meantime,  you can check out the 5 day training series available here.

    Read the article

1