Search Results

Search found 9771 results on 391 pages for 'equivalence classes'.

Page 114/391 | < Previous Page | 110 111 112 113 114 115 116 117 118 119 120 121  | Next Page >

  • CSS selectors : should I minimise my use of the class attribute in the HTML or optimise the speed

    - by Laurent Bourgault-Roy
    As I was working on a small website, I decided to use the PageSpeed extension to check if their was some improvement I could do to make the site load faster. However I was quite surprise when it told me that my use of CSS selector was "inefficient". I was always told that you should keep the usage of the class attribute in the HTML to a minimum, but if I understand correctly what PageSpeed tell me, it's much more efficient for the browser to match directly against a class name. It make sense to me, but it also mean that I need to put more CSS classes in my HTML. It also make my .css file a little harder to read. I usually tend to mark my CSS like this : #mainContent p.productDescription em.priceTag { ... } Which make it easy to read : I know this will affect the main content and that it affect something in a paragraph tag (so I wont start to put all sort of layout code in it) that describe a product and its something that need emphasis. However it seem I should rewrite it as .priceTag { ... } Which remove all context information about the style. And if I want to use differently formatted price tag (for example, one in a list on the sidebar and one in a paragraph), I need to use something like that .paragraphPriceTag { ... } .listPriceTag { ... } Which really annoy me since I seem to duplicate the semantic of the HTML in my classes. And that mean I can't put common style in an unqualified .priceTag { ... } and thus I need to replicate the style in both CSS rule, making it harder to make change. (Altough for that I could use multiple class selector, but IE6 dont support them) I believe making code harder to read for the sake of speed has never been really considered a very good practice . Except where it is critical, of course. This is why people use PHP/Ruby/C# etc. instead of C/assembly to code their site. It's easier to write and debug. So I was wondering if I should stick with few CSS classes and complex selector or if I should go the optimisation route and remove my fancy CSS selectors for the sake of speed? Does PageSpeed make over the top recommandation? On most modern computer, will it even make a difference?

    Read the article

  • PHP Type Hinting: array supported, object NOT?

    - by Marius Burz
    Am I missing something or there really is no support for generic object type hinting in PHP 5.x? I find it really strange that hinting arrays is supported while hinting objects is not, at least not out of the box. I'd like to have something like this: function foo(object $o) Just as we have: function foo(array $o) Example of possible use: methods of an objects collection class. Workaround: using an interface "Object" implemented by all classes or extending all classes from a generic class "Object" and writing something like this: function foo(Object $o) Well, that just ain't cute. Edit: somebody suggested in a deleted post using stdClass. It doesn't work: Catchable fatal error: Argument 1 passed to c::add() must be an instance of stdClass, instance of b given

    Read the article

  • tutorials/books to create a plugin/module/library?

    - by fayer
    i wonder if there are tutorials/books explaining how you create a library/plugin/module for other to implement? libraries/frameworks like solr, doctrine, codeigniter etc. cause it seems that they follow the same pattern. having one "bootstrap" file to load configurations, other classes and so on. i aim to understand the basics, so i can create a such library. cause at the moment i want to code an address book that other can use. just include a bootstrap file and they are ready to use my classes (like Doctrine). recommendations of sources to learn these things of stuff? you experienced guys, how did you learn it? thanks.

    Read the article

  • does a ruby on rails rack class get access to the entire rails environment?

    - by Andrew Arrow
    that is when the def call(env) method is invoked by hitting any url, can I inside that method make some ActiveRecord queries, use classes defined in lib, etc. etc. Or is it more like an irb console without the rails env loaded? Another way to put it with a rake task example: task :foo => :environment do # with env end task :foo2 do # without env end I would think rack classes would NOT get the environment so they are super fast and don't take all the overhead of a normal rails request. But that doesn't seem to be the case. I CAN make ActiveRecord queries inside my rack class. So what is the advantage of rack then?

    Read the article

  • Clojure closures and GC

    - by Ralph
    It is my understanding that the default ClassLoader used in Java (and thus, Clojure) holds on to pointers to any anonymous classes created, and thus, onto lambdas and closures. These are never garbage collected, and so represent a "memory leak". There is some investigation going on for Java 7 or 8 to adding an anonymous ClassLoader that will not retain references to these functions. In the mean time how are people dealing with writing long-running applications in languages like Clojure and Scala, that encourage the use of these constructs? Is there any possibility that Clojure could provide its own anonymous ClassLoader, extending the system one, but not holding onto created classes?

    Read the article

  • Is it possible to run a compiled program with Xcode on Mac OS X in FreeBSD? (Objective-C/Cocoa)

    - by Eonil
    Hi. I have a plan to build a web-site which running CGI made with Cocoa. My final goal is develop on Mac OS X, and run on FreeBSD. Is this possible? As I know, there is a free implementation of some NextStep classes, the GNUStep. The web-site is almost built with only strings. I read GNUStep documents, classes are enough. DB connection will be made with C interfaces. Most biggest problem which I'm concerning is linking and binary compatibility. I'm currently configuring FreeBSD on VirtualBox, but I wanna know any possibility informations about this from experts. This is not a production server. Just a trial. Please feel free to saying anything.

    Read the article

  • Adding css class to jspDrag on scroll

    - by Jeff
    Today I implemented the horizontal jScrollPane script and the element I intended to scrolls like a charm. Via CSS I'm using an image for the jspDrag element. Now for my question; I see that there are a few css classes added to the jspDrag like jspHover and jspActive. Is it also possible to add css classes when I scroll to the left or right? I would like to do this, so I can change the image according to the scroll. (Hoping my question is clear, a reaction would be highly appreciated. Kind regards)

    Read the article

  • .NET XML Serialization, possibly to use a different method name than PropertySpecified for ignoring

    - by Lasse V. Karlsen
    I have a bunch of classes that I intend to serialize in order to transport over a webservice call. These classes already have properties that return whether a given "real" property has a value or not, that is ingrained in a lot of code of our product. Is it possible, for instance through attributes, for me to specify that each "real" property should be included if a specified other property returns true, but not one that is called RealPropertyNameSpecified? ie. for instance if I have this class: [XmlType("test")] public class TestClass { [XmlIgnore] public bool NameHasGotAValue { get; set; } [XmlElement("name")] public string Name { get; set; } } Is it possible for me to use the NameHasGotAValue as the "*Specified" method for the Name property, or is my only option to either rename NameHasGotAValue, add a NameSpecified method, or implement IXmlSerializable?

    Read the article

  • VS2005 Compilation Problem with Settings

    - by vijay.j
    I am trying to integrate PJNSMTPCONNECTION CLASSES in my project; they say that those classes do not use MFC. My project is with the setting like MT, and using standard library linking. When I try to compile, I am getting CSTRING not defined and fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h> If I include afx.h and remove windows.h, I am getting iDLLMain already defined errors. How do I resolve these problems, please?

    Read the article

  • Me As Child Type In General Function

    - by Steven
    I have a MustInherit Parent class with two Child classes which Inherit from the Parent. How can I use (or Cast) Me in a Parent function as the the child type of that instance? EDIT: My actual goal is to be able to serialize (BinaryFormatter.Serialize(Stream, Object)) either of my child classes. However, "repeating the code" in each child "seems" wrong. EDIT2: This is my Serialize function. Where should I implement this function? Copying and pasting to each child doesn't seem right, but casting the parent to a child doesn't seem right either. Public Function Serialize() As Byte() Dim bFmt As New BinaryFormatter() Dim mStr As New MemoryStream() bFmt.Serialize(mStr, Me) Return mStr.ToArray() End Function

    Read the article

  • Convert ISO/Windows charsets to UTF-8 in Javascript

    - by Amir
    I'm developing a firefox plugin and i fetch web pages to do some analysis for the user. The problem is when i try to get (XMLHttpRequest) pages that are not utf-8 encoded the string i see is messed up. For example hebrew pages with windows-1125 or Chinese pages with gb2312. I already tried the following: var uDecoder=Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].getService(Components.interfaces.nsIScriptableUnicodeConverter); uDecoder.charset="windows-1255"; alert( xhr.responseText ); var decoder=Components.classes["@mozilla.org/intl/utf8converterservice;1"].getService(Components.interfaces.nsIUTF8ConverterService); alert(decoder.convertStringToUTF8(xhr.responseText,"WINDOWS-1255",true)); I also tried escape/unescape/encodeURIComponent any ideas???

    Read the article

  • Android: setting up a google map class. bit of advice required.

    - by Capsud
    Hey there, Ok so this is what i've got. Button anandabutton = (Button) findViewById(R.id.anandaAddressButton); anandabutton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent myIntent = new Intent(view.getContext(),MapClass.class); startActivityForResult(myIntent,0); } }); This method opens up my MapClass class which at the moment I just have set to show the location of one place. But I have a load of buttons and rather than making a lot of different mapClass classes for each button, I am wondering can I just use the one class and depending on what button 'id' is pressed, it will check an 'if statement' and then put in the correct coordinates into the method to display the map. It would be a lot neater than coding up like 20-30 classes. I'm not sure if i've explained that right so if not let me know. Thanks for any help.

    Read the article

  • Using LocationManager from another class than Main

    - by iphonePom
    Hi, i'm new here, i'm new in iphone development, i'm new in Objective-c and i'm new in engligh speaking, so don't hate me :P I'm creating an application that will use the location manager to display the distance between the own position and the positions of a list of shops, like AroundME. Now, i give the locationManager property to my main class and in the .m of that class, precisely in the viewDidLoad method, i make: [locationManager startUpdatingLocation]. It all works fine, but the problem is: i need to know my position in other classes than the main, but i don't think that is a good idea making [locationManager startUpdatingLocation] every time i need it, is not time overhead? The view of my main class is always below the others, so can i retrieve the updated location in my other classes? In what way? Creating another instance of my main class is not useful, i think, but the locationManager, once started, doesn't stop until my main class is released, isn't true? So i think that it is accessible in some way. Thanks for your attention and sorry for my awful english : )

    Read the article

  • What's the most straightforward way to typeset MLA-style college essays in LaTeX?

    - by bcat
    I've been using LaTeX for a little while now to typeset my algorithms homework, and I really like the quality of the output as well as the ease-of-use. I'd like to starting using LaTeX in other classes as well, but non–computer-science subjects have more stringent formatting requirements than I've come across in CS. Most classes that require essays want them to be formatted in MLA style, but I'm not sure what to best way to do that using LaTeX is. I've tried Googling "latex mla" and other similar things, but I've found many different MLA templates, and my LaTeX skills aren't good enough to determine which is the best. Is anyone else using LaTeX for "normal" essays, and, if so, how are you doing it?

    Read the article

  • ZF-Autoloader not working in UnitTests on Ubuntu

    - by Sam
    i got a problem regarding Unit-testing a Zend-Framework application under Ubuntu 12.04. The project-structure is a default zend application whereas the models are defined as the following ./application ./models ./DbTable ./ProjectStatus.php (Application_Model_DbTable_ProjectStatus) ./Mappers ./ProjectStatus.php (Application_Model_Mapper_ProjectStatus) ./ProjectStatus.php (Application_Model_ProjectStatus) The Problem here is with the Zend-specific autoloading. The naming convention here appears that the folder Mappers loads all classes with _Mapper but not _Mappers. This is some internal Zend behavior which is fine so far. On my windows machine the phpunit runs without any Problems, trying to initiate all those classes. On my Ubuntu machine however with jenkins running on it, phpunit fails to find the appropriate classes giving me the following error Fatal error: Class 'Application_Model_Mapper_ProjectStatus' not found in /var/lib/jenkins/jobs/PAM/workspace/tests/application/models/Mapper/ProjectStatusTest.php on line 39 The error appears to really be that the Zend-Autoloader doesn't load from the ubuntu machine, but i can't figure out how or why this works. The question remains of why this is. I think i've double checked every point of contact with the zend autoloading stuff, but i just can't figure this out. I'll paste the - from my point of view relevant snippets - and hope someone of you has any insight to this. Jenkins Snippet for PHPUnit <target name="phpunit" description="Run unit tests with PHPUnit"> <exec executable="phpunit" failonerror="true"> <arg line="--configuration '${basedir}/tests/phpunit.xml' --coverage-clover '${basedir}/build/logs/clover.xml' --coverage-html '${basedir}/build/coverage/.' --log-junit '${basedir}/build/logs/junit.xml'" /> </exec> </target> ./tests/phpunit.xml <phpunit bootstrap="./bootstrap.php"> ... this shouldn't be of relevance ... </phpunit> ./tests/bootstrap.php <?php // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing')); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( realpath(APPLICATION_PATH . '/../library'), get_include_path(), ))); require_once 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance(); Any help will be appreciated.

    Read the article

  • Mocking my custom dependencies with Spring

    - by Brabster
    Is is possible to declare mocks using some mocking framework for my own classes declaratively with Spring? I know there are some standard mocks available in Spring, but I'd like to be able to mock out my own classes declaratively too. Just to check I'm not going about this the wrong way: the idea is to have a pair of JUnit test and Spring config for each integration test I want to do, mocking everything except the specific integration aspect I'm testing (say I had a dependency on two different data services, test one at a time) and minimising the amount of repeated Java code specifying the mocks.

    Read the article

  • How to get global access to enum types in C#?

    - by lala
    This is probably a stupid question, but I can't seem to do it. I want to set up some enums in one class like this: public enum Direction { north, east, south, west }; Then have that enum type accessible to all classes so that some other class could for instance have: Direction dir = north; and be able to pass the enum type between classes: public void changeDirection(Direction direction) { dir = direction; } I thought that setting the enum to public would make this automatically possible, but it doesn't seem to be visible outside of the class I declared the enum in.

    Read the article

  • Makefile to compile both C and Java programs at the same time

    - by user342745
    I have three programs that need to be compiled at the same time, 2 written in C and 1 in java. I had all three working with the Makefile when they were in C, but then switched one of them to java... is there a way to compile all 3 at once with the same makefile? Here is my current Makefile: CC=gcc JC=javac JFLAGS= -g CFLAGS= -Wall -g -std=c99 LDFLAGS= -lm .SUFFIXES: .java .class .java.class: $(JC) $(JFLAGS) $*.java CLASSES = kasiski.java kentry.java ALL= ic ftable kasiski all: $(ALL) ic: ic.o kasiski: $(CLASSES:.java=.class) ftable: ftable.o ic.o: ic.c ic.h ftable.o: ftable.c ftable.h .PHONY: clean clean: rm -rf core* *.class *.o *.gch $(ALL)

    Read the article

  • Iphone memory leak with malloc

    - by Icky
    Hello. I have memory leak, found by instruments and it is supposed to be in this line of code: indices = malloc( sizeof(indices[0]) * totalQuads * 6); This is actually a code snippet from a tutorial, something which i think is leak-free so to say. Now I reckon, the error is somewhere else, but I do not know, where. These are the last trackbacks: 5 ColorRun -[EAGLView initWithCoder:] /Users/thomaskopinski/programming/colorrun_3.26/Classes/EAGLView.m:98 4 ColorRun -[EAGLView initGame] /Users/thomaskopinski/programming/colorrun_3.26/Classes/EAGLView.m:201 3 ColorRun -[SpriteSheet initWithImageNamed:spriteWidth:spriteHeight:spacing:imageScale:] /Users/thomaskopinski/programming/colorrun_3.26/SpriteSheet.m:68 2 ColorRun -[Image initWithImage:scale:] /Users/thomaskopinski/programming/colorrun_3.26/Image.m:122 1 ColorRun -[Image initImpl] /Users/thomaskopinski/programming/colorrun_3.26/Image.m:158 0 libSystem.B.dylib malloc Does anyone know how to approach this?

    Read the article

  • Does Qt support virtual pure slots ?

    - by ereOn
    Hi, My GUI project in Qt has a lot of "configuration pages" classes which all inherit directly from QWidget. Recently, I realized that all these classes share 2 commons slots (loadSettings() and saveSettings()). Regarding this, I have two questions: Does it make sense to write a intermediate base abstract class (lets name it BaseConfigurationPage) with these two slots as virtual pure methods ? (Every possible configuration page will always have these two methods, so I would say "yes") Before I do the heavy change in my code (if I have to) : does Qt support virtual pure slots ? Is there anything I should be aware of ? Here is a code example describing everything: class BaseConfigurationPage : public QWidget { // Some constructor and other methods, irrelevant here. public slots: virtual void loadSettings() = 0; virtual void saveSettings() = 0; }; class GeneralConfigurationPage : public BaseConfigurationPage { // Some constructor and other methods, irrelevant here. public slots: void loadSettings(); void saveSettings(); };

    Read the article

  • Why my WCF Service returns xml serialized objects?

    - by user294554
    Hi, I'm new here and I hope anyonte can help me. I have WCF Service and Windows Forms working with this client written in VB.NET. The Service class started to return xml serialized objects, but all my classes on Service side are DataContract-s and the service class is DataContractFormat. I googled everywhere about serializations and I couldn't find reason why it started to do that. I checked my classes and service, app.config file, but I couldn't find anything. I checked Reference.vb class, and it's System.Xml.Serialization.XmlElementAttribute everywhere. The question may seem dummy, but I really don't know what to do. I just want to know what can cause the service to act like that. Thank you.

    Read the article

< Previous Page | 110 111 112 113 114 115 116 117 118 119 120 121  | Next Page >