Search Results

Search found 247 results on 10 pages for 'yusuf andre'.

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

  • Python overriding class (not instance) special methods

    - by André
    How do I override a class special method? I want to be able to call the __str__() method of the class without creating an instance. Example: class Foo: def __str__(self): return 'Bar' class StaticFoo: @staticmethod def __str__(): return 'StaticBar' class ClassFoo: @classmethod def __str__(cls): return 'ClassBar' if __name__ == '__main__': print(Foo) print(Foo()) print(StaticFoo) print(StaticFoo()) print(ClassFoo) print(ClassFoo()) produces: <class '__main__.Foo'> Bar <class '__main__.StaticFoo'> StaticBar <class '__main__.ClassFoo'> ClassBar should be: Bar Bar StaticBar StaticBar ClassBar ClassBar Even if I use the @staticmethod or @classmethod the __str__ is still using the built in python definition for __str__. It's only working when it's Foo().__str__() instead of Foo.__str__().

    Read the article

  • What frustrates you the most at your current workplace?

    - by Andre Bossard
    Do you know these moments when you: stopped laughing at Dilbert, because you realize its true spent evenings completing a project that never went into production when requirements are blurry but the schedule is not There are so many factors that can frustrate developer and hinder him from being productive. What factors do you experience at your current workplace? See Also What Makes you lose motivation?

    Read the article

  • Opacity in CSS, some doubts

    - by André
    Hi, I have some doubts with opacity in CSS. I have a Header and a Footer that uses opacity, but I would like to turn off opacity the opacity in the text. Is that possible? To a better understanding I will post the code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title> stu nicholls | CSS PLaY | cross browser fixed header/footer layout basic method </title> <style type="text/css" media="screen"> #printhead {display:none;} html { height:100%; max-height:100%; padding:0; margin:0; border:0; background:#fff; font-size:80%; font-family: "trebuchet ms", tahoma, verdana, arial, sans-serif; /* hide overflow:hidden from IE5/Mac */ /* \*/ overflow: hidden; /* */ } body {height:100%; max-height:100%; overflow:hidden; padding:0; margin:0; border:0;} #content {display:block; height:100%; max-height:100%; overflow:hidden; padding-left:0px; position:relative; z-index:3; word-wrap:break-word;} #head {position:absolute; margin:0; top:0; right:18px; display:block; width:100%; height:1; background-color:transparent; font-size:1em; z-index:5; color:#000; border-bottom:1px solid #000;} #foot {position:absolute; margin:0; bottom:-1px; right:18px; display:block; width:100%; height:30px; background-color:transparent; color:#000; text-align:right; font-size:2em; z-index:4; border-top:1px solid #000;} .pad1 {display:block; width:18px; height:18px; float:left;} /* Com este "height", alinho a border do header */ .pad2 {display:block; height:100px;} .pad3 {display:block; height:0px;} /* Com este "height" controlo onde começa o content e o scroll do browser */ #content p {padding:5px;} .bold {font-size:1.2em; font-weight:bold;} .red {color:#c00; margin-left:5px; font-family:"trebuchet ms", "trebuchet", "verdana", sans-serif;} h2 {margin-left:5px;} h3 {margin-left:5px;} /* Esta classe controla as caracteristicas do background do footer e do header. */ .bkg { background-color: blue; filter:alpha(opacity=35); /* IE's opacity*/ opacity: 0.35; height: 10; } iframe { border-style: none; width: 100%; height: 100%; } </style> </head> <body> <div id="head"> <div class="bkg"> <div class="pad1"></div>Header </div> </div> <div id="content"> <div class="pad3"></div> <iframe src="http://www.yahoo.com" id="iFrame"></iframe> <div class="pad2"></div> </div> </div> <div id="foot"><div class="bkg">Footer</div></div> </body> </html> I want to maintain the opacity in the blue color in the footer and header but I would like to put the text stronger. Is that possible? Best Regards,

    Read the article

  • Column-oriented DBMS and JOIN operations

    - by André
    From some of the research I've done on NoSQL, column-oriented databases (like HBase or Cassandra) seem to solve the problem of costly JOIN operations, but I don't get how this approach solves this problem. Can anyone explain it to me and/or link me to interesting documentation regarding this area? Thanks

    Read the article

  • IIS 6.0 - ASP Error 0126 Include file not found

    - by André
    Hello, I have a Win Sever 2003 running IIS 6.0 which has only my main website on it and now I am trying to setup a test website which currently is an exact duplicate of the main site. When accessing my main site everything works fine, and has done for a long time. If I access the test site (through 'test.' subdomain) I get this error: Active Server Pages error 'ASP 0126' Include file not found /html/shop/asp/admin/inc/incWeeklySpecialswide3.asp, line 71 The include file '/html/asp/quickfindwithSuburbs31.asp' was not found. The file actually exists, and the paths are correct. I have enabled Parent Paths, replaced the include file path to the full path (http://foo.com/html/asp -etc.), removing the ' / ' at the start of the path and changing the code from ' include ' to ' virtual '. Thanks in advance.

    Read the article

  • Using subselect to accomplish LEFT JOIN

    - by Andre
    Is is possible to accomplish the equivalent of a LEFT JOIN with subselect where multiple columns are required. Here's what I mean. SELECT m.*, (SELECT * FROM model WHERE id = m.id LIMIT 1) AS models FROM make m As it stands now doing this gives me a 'Operand should contain 1 column(s)' error. Yes I know this is possible with LEFT JOIN, but I was told it was possible with subselect to I'm curious as to how it's done.

    Read the article

  • css calculation of the width

    - by marc-andre menard
    I got into a math problem my content box is 700pc wide my hentry (inside content) is 100% wide with padding of 10px wich make the hentry to be wider that the content resulting and overflow... Any solution Here is the page : http://www.equipe94.com I have firebug and removing the width 100% work, but it send by wordpress so how to overwrite a width:100% with nothing ?

    Read the article

  • php : echo"", print(), printf()

    - by marc-andre menard
    Is there a better way to output data to html page with PHP ? if i like to make a div with some var in php i will write something like that print ('<div>'.$var.'</div>); or echo "'<div>'.$var.'</div>'"; what is the PROPER way to do that ? or a better way, fill a $tempvar and print it once? like that: $tempvar = '<div>'.$var.'</div>' print ($tempvar); in fact, in real life, the var will be fill with much more !

    Read the article

  • WPF, Setting property with single value on multiple subcontrols

    - by Andre van Heerwaarde
    I have a parent contentcontrol which displays data via a datatemplate. The datatemplate contains a stackpanel with several usercontols of the same type. I like to set the property only once on the parent control, it must set the value of the property on all the subcontrols. But if there is a way to do it on the stackpanel it's also OK. The template can be changed at runtime and the values need also to be propagated to the new template. My current solution is to implement the property on both parent and subcontrol and use code to propagate the value from the parent to all the subcontrols. My question is: is there a better or other ways of doing this?

    Read the article

  • How extensive is an Object in CakePHP model linkage?

    - by Andre
    I was hoping someone with an understanding on CakePHP could shed some light on a question I've been having. Here's my scenario, I have a User this User has a Company which in turn has many Department and many Address. If I were to get a User could I expect to have access to the Company and all models associated with that Company? So would $user['Company']['Department'][0] or $user['Company']['Address'][0] be possible? Which brings me back to the original question, how extensive is the linkage between models?

    Read the article

  • Load list of image from folder

    - by marc-andre menard
    I have a folder of images, from 10 to 200, a webpage, a jquery fade and a php script that read folder full of images Is there any way to make the php script scan a folder, get a list of image (in an array ?) and pass it to jquery script ? (first question) Now, i can make a xml file from the result php list of files found or make a html <li> from the list in the html. is there ANY other way to do that ? (question #2)

    Read the article

  • How to check if a given Regex is valid?

    - by Philipp Andre
    Hi folks, I have a little program allowing users to type-in some regular expressions. afterwards i like to check if this input is a valid regex or not. I'm wondering if there is a build-in method in Java, but could not find such jet. Can you give me some advice? Best regards Phil

    Read the article

  • why does an event handler never gets called if its added within a loop on an ienumerable

    - by André Carvalho
    For instance: IEnumerable<MyType> list = someCollection.Select(i => new MyType(i)); foreach (var item in list) item.PropertyChanged += item_PropertyChanged; <-- this never gets called Bu if list is assigned like list = someCollection.Select(i => new MyType(i)).ToArray(); the event handler does get called.. Why? (i imagine it has something to do with the fact that a linq query is lazy, but the fact of looping through the result isn't enough??)

    Read the article

  • Bad performance function in PHP. With large files memory blows up! How can I refactor?

    - by André
    Hi I have a function that strips out lines from files. I'm handling with large files(more than 100Mb). I have the PHP Memory with 256MB but the function that handles with the strip out of lines blows up with a 100MB CSV File. What the function must do is this: Originally I have the CSV like: Copyright (c) 2007 MaxMind LLC. All Rights Reserved. locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode 1,"O1","","","",0.0000,0.0000,, 2,"AP","","","",35.0000,105.0000,, 3,"EU","","","",47.0000,8.0000,, 4,"AD","","","",42.5000,1.5000,, 5,"AE","","","",24.0000,54.0000,, 6,"AF","","","",33.0000,65.0000,, 7,"AG","","","",17.0500,-61.8000,, 8,"AI","","","",18.2500,-63.1667,, 9,"AL","","","",41.0000,20.0000,, When I pass the CSV file to this function I got: locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode 1,"O1","","","",0.0000,0.0000,, 2,"AP","","","",35.0000,105.0000,, 3,"EU","","","",47.0000,8.0000,, 4,"AD","","","",42.5000,1.5000,, 5,"AE","","","",24.0000,54.0000,, 6,"AF","","","",33.0000,65.0000,, 7,"AG","","","",17.0500,-61.8000,, 8,"AI","","","",18.2500,-63.1667,, 9,"AL","","","",41.0000,20.0000,, It only strips out the first line, nothing more. The problem is the performance of this function with large files, it blows up the memory. The function is: public function deleteLine($line_no, $csvFileName) { // this function strips a specific line from a file // if a line is stripped, functions returns True else false // // e.g. // deleteLine(-1, xyz.csv); // strip last line // deleteLine(1, xyz.csv); // strip first line // Assigna o nome do ficheiro $filename = $csvFileName; $strip_return=FALSE; $data=file($filename); $pipe=fopen($filename,'w'); $size=count($data); if($line_no==-1) $skip=$size-1; else $skip=$line_no-1; for($line=0;$line<$size;$line++) if($line!=$skip) fputs($pipe,$data[$line]); else $strip_return=TRUE; return $strip_return; } It is possible to refactor this function to not blow up with the 256MB PHP Memory? Give me some clues. Best Regards,

    Read the article

  • Problems with LWUIT in J2ME on Nokia E72

    - by Andre Mariano
    Well, I'm developing a app in my cellphone that is going to connect to my PC, the problem is that everytime that I return a URLRequest to the cellphone, it shows the previous Form on the screen and not de actual one, for example this is what goes in my actionListener: public void actionPerformed(ActionEvent ae) { if (ae.getCommand() == guiaUtil.cSelecionar()) { LoginRemote loginRemote = new LoginRemote(); try { //This is the request, returns true or false, does not affect the form loginRemote.login(tLogin.getText(), tPassword.getText()); } catch (Exception e) { GuiaUtil.error(e); return; } guiaUtil.mainApp().startMenu(); } } Then in the "guiaUtil.mainApp().startMenu()" I have this public void startMenu() { if (itemsMenu == null) { itemsMenu = new List(); itemsMenu.setWidth(320); itemsMenu.addItem("Sincronize Spots"); itemsMenu.addItem("Find Spots"); itemsMenu.addItem("Work"); itemsMenu.setFocus(true); this.addComponent(itemsMenu); this.addCommandListener(this); this.addCommand(guiaUtil.cSelect()); Form form = new Form(); form.addComponent(itemsMenu); } form.show(); } Anyway, after the request returns, it shows my Login form again, instead of showing the Menu List

    Read the article

  • Show UIView for app presentation only once in iOS

    - by André Muniz
    I need to show an UIScrollView with some pages for present the app to user when launched for the first time. My slides are working correctly, lefting the logic to present it. Is a good practice to set the UIScrollViewController as root controller and set a NSUserDefault variable to control the presentation and redirect to main controller or set the main ViewController as root normally and call the presentation view if needed is a better approach? If there is a better way to do this can someone help? Thanks.

    Read the article

  • REST API - why use PUT DELETE POST GET?

    - by Andre
    So -i was looking through some articles on creating REST API's. And some of them suggest using all types of HTTP requests: like PUT DELETE POST GET. So - we would create for example index.php and write API this way: $method = $_SERVER['REQUEST_METHOD']; $request = split("/", substr(@$_SERVER['PATH_INFO'], 1)); switch ($method) { case 'PUT': ....some put action.... break; case 'POST': ....some post action.... break; case 'GET': ....some get action.... break; case 'DELETE': ....some delete action.... break; } Ok - granted - I don't know much baout web services (yet). But - wouldn't it be easier to just accept JSON object through normal $_POST and then respond in JSON as well. We can easily serialize/deserialize via php's json_encode and json_decode and do whatever we want with that data without having to deal with different HTTP request methods... Am I missing something? UPDATE 1: Ok - after digging through various API's and learning a lot about XML-RPC, JSON-RPC, SOAP, REST I came to a conclusion that this type of API is sound. Actually stack exchange is pretty much using this approach on their sites and I do think that these people know what they are doing Stack Exchange API.

    Read the article

  • How to invoke a method with a generic return type using reflection

    - by Andre Luus
    Hi there! I'm trying to invoke a method with reflection that has a generic return type, like this: public class SomeClass<T> { public List<T> GetStuff(); } I get an instance of SomeClass with a call to a Repository's GetClass<T> generic method. MethodInfo lGetSomeClassMethodInfo = typeof(IRepository) .GetMethod("GetClass") .MakeGenericMethod(typeof(SomeClass<>); object lSomeClassInstance = lGetSomeClassMethodInfo.Invoke( lRepositoryInstance, null); After that, I this is where I try to invoke the GetStuff method: typeof(SomeClass<>).GetMethod("GetStuff").Invoke(lSomeClassInstance, null) I get an exception about the fact that the method has generic arguments. However, I can't use MakeGenericMethod to resolve the return type. Also, if instead of typeof(SomeClass<>) I use lSomeClassInstance.GetType() (which should have resolved types) GetMethod("GetStuff") returns null! UPDATE I have found the solution and will post the answer shortly.

    Read the article

  • Code Igniter - URL Rewrite

    - by André Alçada Padez
    Hey, i'm trying to get a project to work, but i am having trouble with the rewrite module. I'm running Wamp over Windows XP. I changed httpd.conf to change the root of localhost to: DocumentRoot "C:/wamp/www/project/docroot/" I have htaccess RewriteEngine On RewriteBase / my Apache has the rewrite module Activated. my base_url() in config.php is 'http://localhost/' in routes.php i have: $route['default_controller'] = "home"; $route['our-recipes'] = "recipes"; and more pairs when i point the browser to http://localhost/ i get the homepage of my site, but when i click on any internal link like to 'our-recipes' it loads but i get the same homepage, with the new url on the location bar. if i try to access 'http://localhost/recipes' i get the same result. this is my folder structure: Can anyone please solve this for me??

    Read the article

  • Projects with browsable source using dependency injection w/ guice?

    - by André
    I often read about dependency injection and I did research on google and I understand in theory what it can do and how it works, but I'd like to see an actual code base using it (Java/guice would be preferred). Can anyone point me to an open source project, where I can see, how it's really used? I think browsing the code and seeing the whole setup shows me more than the ususal snippets in the introduction articles you find around the web. Thanks in advance!

    Read the article

  • Dependency injection in constructors

    - by andre
    Hello everyone. I'm starting a new project and setting up the base to work on. A few questions have risen and I'll probably be asking quite a few in here, hopefully I'll find some answers. First step is to handle dependencies for objects. I've decided to go with the dependency injection design pattern, to which I'm somewhat new, to handle all of this for the application. When actually coding it I came across a problem. If a class has multiple dependencies and you want to pass on multiple dependencies via the constructor (so that they cannot be changed after you instantiate the object). How do you do it without passing an array of dependencies, using call_user_func_array(), eval() or Reflection? This is what i'm looking for: <?php class DI { public function getClass($classname) { if(!$this->pool[$classname]) { # Load dependencies $deps = $this->loadDependencies($classname); # Here is where the magic should happen $instance = new $classname($dep1, $dep2, $dep3); # Add to pool $this->pool[$classname] = $instance; return $instance; } else { return $this->pool[$classname]; } } } Again, I would like to avoid the most costly methods to call the class. Any other suggestions?

    Read the article

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