Daily Archives

Articles indexed Monday October 8 2012

Page 15/17 | < Previous Page | 11 12 13 14 15 16 17  | Next Page >

  • Achieving decoupling in Model classes

    - by Guven
    I am trying to test-drive (or at least write unit tests) my Model classes but I noticed that my classes end up being too coupled. Since I can't break this coupling, writing unit tests is becoming harder and harder. To be more specific: Model Classes: These are the classes that hold the data in my application. They resemble pretty much the POJO (plain old Java objects), but they also have some methods. The application is not too big so I have around 15 model classes. Coupling: Just to give an example, think of a simple case of Order Header - Order Item. The header knows the item and the item knows the header (needs some information from the header for performing certain operations). Then, let's say there is the relationship between Order Item - Item Report. The item report needs the item as well. At this point, imagine writing tests for Item Report; you need have a Order Header to carry out the tests. This is a simple case with 3 classes; things get more complicated with more classes. I can come up with decoupled classes when I design algorithms, persistence layers, UI interactions, etc... but with model classes, I can't think of a way to separate them. They currently sit as one big chunk of classes that depend on each other. Here are some workarounds that I can think of: Data Generators: I have a package that generates sample data for my model classes. For example, the OrderHeaderGenerator class creates OrderHeaders with some basic data in it. I use the OrderHeaderGenerator from my ItemReport unit-tests so that I get an instance to OrderHeader class. The problem is these generators get complicated pretty fast and then I also need to test these generators; defeating the purpose a little bit. Interfaces instead of dependencies: I can come up with interfaces to get rid of the hard dependencies. For example, the OrderItem class would depend on the IOrderHeader interface. So, in my unit tests, I can easily mock the behaviour of an OrderHeader with a FakeOrderHeader class that implements the IOrderHeader interface. The problem with this approach is the complexity that the Model classes would end up having. Would you have other ideas on how to break this coupling in the model classes? Or, how to make it easier to unit-test the model classes?

    Read the article

  • PHP Drupal alternatives

    - by Quinma
    Based off answers to this question: Will I pick bad coding habits from PHP books? and many others it is a general consensus that PHP is not the most well suited language for web development anymore (if you are not completely knowledgeable about the language). I use Drupal and write custom modules in PHP, does this viewpoint of PHP being an ill fitted web coding language also apply to Drupal based PHP sites? I generally build community sites and intra-company sites, are there better means of building these than with PHP and drupal frameworks?

    Read the article

  • Should you promise to deliver a feature that you aren't sure if its implementable?

    - by user476
    In an article from HN, I came across the following advice: Always tell your customer/user "yes", even if you're not sure. 90% of the time, you'll find a way to do it. 10% of the time, you'll go back and apologize. Small price to pay for major personal growth But I've always thought that one should do a feasibility analysis before making any kind of promises to a customer/user, so that they aren't misled at any point. At what circumstances, then, should the above advice applicable?

    Read the article

  • Why are so many questions closed? [migrated]

    - by Justin984
    I just joined this stackexchange, and I'm sure this question will get closed like so many others as being subjective or "not constructive". I did a quick count on the first few pages, and it looks like at least 10% of questions are closed. One page I saw had 22 out of 50 questions closed. What does closing so many questions solve? Apparently it does not reduce the number of "bad questions". Instead it just prevents people who would otherwise be interested in answering from doing so. Why can't the people who dislike all these questions just.. not answer?

    Read the article

  • still about perl vs python but (to me) slightly different from what has been asked [closed]

    - by B Chen
    Being a newbie to coding, I read from this site that Perl is still as viable as it has been, while Python, quoted from someone else's post, is good but just "snake oil" (not sure what this refers to exactly though). So from the responses in that post, I got the gist that Perl is good and worthy to learn. My question is - pardon me for phrasing it in this "non-programmer's" way - Which one should I learn FIRST? (I am actually currently learning R) Here below is the background info - (a) I will be using it mostly for data mining and statistics analysis (b) Will there be this "first" and "later" issue with learning either Perl or Python? That is, after I become competent with one language, would there be a need to learn the second one (for a similar task??) (c) If there should be circumstances where I must learn the second one, would learning Perl FIRST be better than learning Python? I hope to learn as much from exchanging info here, so please help provide with more than just "it depends" type of info. Great many thanks to all who choose to respond to my query.

    Read the article

  • Using "Google Guava" in coding interviews

    - by kbgn27
    I attended a in-person interview recently and performed well. But surprisingly I got rejected. When I asked the HR for reason, he contacted the technical interviewer and told me that I was syntactically wrong while coding. I used Google Guava for coding. So my code looked like this: List<String> items = Lists.newArrayList() instead of List<String> items =new ArrayList<String>(); I know that the code will compile and work as expected.Is it ok to use third party libraries like Google Guava in interviews?

    Read the article

  • Architecture for Social Graph data that has a Time Frame Associated?

    - by Jay Stevens
    I am adding some "social" type features to an existing application. There are a limited # of node & edge types. Overall the data itself is relatively small (50,000 - 70,000 for each type of node) there will be a number of edges (relationships) between them (almost all directional). This, I know, is relatively easy to represent with an SDF store (such as BrightstarDB) or something like Microsoft's Trinity (or really many of the noSQL options). The thing that, I think, makes this a unique use case is that each relationship will have a timeframe associated with it (start and end dates). Right now, I'm thinking of just storing this in a relational structure and dealing with the headaches of "traversing the graph", but I'm looking for suggestions on a better approach (both in terms of data structure and server): Column ================ From_Node_ID Relationship To_Node_ID StartDate EndDate Any suggestions or thoughts are welcomed.

    Read the article

  • Web Crawler for Learnign Topics on Wikipedia

    - by Chris Okyen
    When I want to learn a vast topic on wikipedia, I don't know where to start. For instance say I want to learn about Binary Stars, I then have to know other things linked on that pages and linked pages on all the linked pages and so on for the specified number of levels. I want to write a web crawler like HTTracker or something similiar, that will display a heiarchy of the links on a certain page and the links on those linked pages.I wish to use as much prewritten code as possible. Here is an example: Pretending we are bending the rules by grabing links from only the first sentence of each pages The example archives and "processes" two levels deep The page is Ternary operation The First Level In mathematics a ternary operation is an N-ary operation The Second Level Under Mathmatics: Mathematics (from Greek µ???µa máthema, “knowledge, study, learning”) is the abstract study of topics encompassing quantity, structure, space, change and others; it has no generally accepted definition. Under N-ary In logic,mathematics, and computer science, the arity i/'ær?ti/ of a function or operation is the number of arguments or operands that the function takes Under Operation In its simplest meaning in mathematics and logic, an operation is an action or procedure which produces a new value from one or more input values ------------------------------------------------------------------------- I need some way to determine what oder to approach all these wiki pages to learn the concept ( in this case ternary operations )... Following along with this exmpakle, one way to show the path to read would a printout flowout like so: This shows that the first sentence of the Mathematics page doesn't link to the first sentence of pages linked on ternary page two levels deep. (Please tell me how I should explain this ) --- In otherwords, the child node of the top pages first sentence, ternary_operation, does not have any child nodes that reference the children of the top pages other children nodes- N-ary and operation. Thus it is safe to read this first. Since N-ary has a link to operations we shoudl read the operation page second and finally read the N-ary page last. Again, I wish to use as much prewritten code as possible, and was wondering what language to use and what would be the simpliest way to go about doing this if there isn't already somethign out there? Thank You!

    Read the article

  • Is it bad practice to use the same name for arguments and members?

    - by stijn
    Sometimes I write constructor code like class X { public: X( const int numberOfThingsToDo ) : numberOfThingsToDo( numberOfThingsToDo ) { } private: int numberOfThingsToDo; }; or in C# class X { public X( int numberOfThingsToDo ) { this.numberOfThingsToDo = numberOfThingsToDo; } private int numberOfThingsToDo; } I think the main reason is that when I come up with a suitable member name, I see no reason to use a different one for the argument initializing it, and since I'm also no fan of using underscores the easiest is just to pick the same name. After all it's suitable. Is this considered bad practice however? Any drawbacks (apart from shooting yourself in the foot when forgetting the this in C#)?

    Read the article

  • What can Haskell's type system do that Java's can't and vice versa?

    - by Matt Fenwick
    I was talking to a friend about the differences between the type systems of Haskell and Java. He asked me what Haskell's could do that Java's couldn't, and I realized that I didn't know. After thinking for a while, I came up with a very short list of minor differences. Not being heavy into type theory, I'm left wondering whether they're formally equivalent. To try and keep this from becoming a subjective question, I'm asking: what are the major, non-syntactical differences between their type systems? I realize some things are easier/harder in one than in the other, and I'm not interested in talking about those. And to make it more specific, let's ignore Haskell type extensions since there's so many out there that do all kinds of crazy/cool stuff.

    Read the article

  • Resources for Test Driven Development in Web Applications?

    - by HorusKol
    I would like to try and implement some TDD in our web applications to reduce regressions and improve release quality, but I'm not convinced at how well automated testing can perform with something as fluffy as web applications. I've read about and tried TDD and unit testing, but the examples are 'solid' and rather simple functionalities like currency converters, and so on. Are there any resources that can help with unit testing content management and publication systems? How about unit testing a shopping cart/store (physical and online products)? AJAX? Googling for "Web Test Driven Development" just gets me old articles from several years ago either covering the same examples of calculator-like function or discussions about why TDD is better than anything (without any examples).

    Read the article

  • Why does Ubuntu 12.10 Beta2 insist on commiting changes to the partition table?

    - by Uten
    Why does Ubuntu 12.10 Beta2 insist on commiting changes to the partition table even as no real changes has been done? This is a show stopper for me as I'm installing without a CD/DVD ROM. This is how I go about it. I downloaded the iso image and extracted vmlinuz and initrd.lz to the same folder I keep the iso image. Configured grub (0.9x) to boot /ubuntu/vmlinuz with the iso image like this: title ubuntu live-cd kernel /ubuntu/vmlinuz boot=casper iso-scan/filename=/ubuntu/ubuntu-12.10-beta2-desktop-i386.iso ro quiet splash initrd /ubuntu/initrd.lz boot This works well and I get a running livecd session. The iso image is mounted on /isomedia (or something similar). The spare HD space where I want to install Ubuntu is in the logical area (at the wery end of the disk). I have tried both to use the space as empty and preformated with ext4. After selecting the partition and selecting "use as ext4" and selecting a mountpoint (/) I get the message: "The installer needs to commit changes to partition tables, but cannot do so because partitions on the following mount points could not be unmounted" "/isomedia" (or something similar). Is this a "feature" of the installer? To insist that everything is unmounted even if no changes is nescesary (as fare as I understand). It's probably a safety feature but is it needed? I have cahnged layouts with parted and gparted (at the end of the disk) for years without any failures. I understand that booting the iso image like this is not the common way. But it is just such a beautifull way of doing it when you hav a running system and want to play with another. Any one had any success installing Ubuntu (12.10 beta2 ) like this? Best regards Uten

    Read the article

  • No me arranca ubuntu 12.04

    - by MAgnum
    Buenos Dias, Tengo un Notebook Intel(R) Atom(TM) CPU N270 1.60GHz Version de la BIOS Intel V1585, tenia un sistema operativo de windows xp e intente instalar ubunto 12.04 por medio de live USB debido a que no tengo la adaptación de CD segui todos los pasos y le di instalar completamente formateando el sistema anterior, terminando la instalacion me salio un problema que no encontraba el sistema de arranque o algo asi el hecho es que me salia algo de SDA donde aparecia el modelo del HDD y como es Hitachi HTS543212L9A300 le di en esa y le di finalizar, pero al reiniciar cuando debe iniciar el sistema operativo se queda en negro y no carga nada =S he intentado volver a arrancar la usb pero no me deja hacer nada se me traba =S. soy principiante en este sistema operativo y quiera saber que solución me pueden decir para sacarme de este embrollo. tampoco me sale nada despues de usar ctrl+alt+F1 =S... Muchas gracias al alma caritativa que me quiera asesorar =D...

    Read the article

  • In Rhythmbox, is there a way to sort by artist and search by title?

    - by duxk.gh
    In Rhythmbox I sort my music by artist. When I quickly want to look for a song I'd like to type in the title of the song. Not in the standard search box up top, but by starting to type when I've clicked anywhere in the list of songs. A small search box appears in the right bottom corner just like it does in Nautilus. The thing is, when I sort by artist that search looks up the artist as well. When I sort by title, it searches by title. I'd like to sort by artist, but search by title. Is there a way to do that?

    Read the article

  • OpenJDK default options to always use the server VM

    - by montrealmike
    I got a warning message: jvm uses the client vm, make sure to run java with the server vm for best performance by adding -server to the command line In fact, when i run java -version i get: OpenJDK Runtime Environment (IcedTea7 2.3.2) (7u7-2.3.2a-0ubuntu0.12.04.1) OpenJDK Client VM (build 23.2-b09, mixed mode, sharing) How does one go about and change OpenJDK's defaults to always start under the server VM?

    Read the article

  • Cannot connect to wifi after downloading 12.04, repeated prompts for password

    - by Daytown3487
    I have had this OS for a little bit but this is my first upgrade and my first issue I am trying to deal with without my buddy who got my on Ubuntu in the first place (who is on the other side of the country.) I am running an IBM Lenovo T400 Thinkpad that had 11.10 on it and worked flawless. I upgraded to 12.04 a few weeks back and I have not been able to connect to the wifi in my home or anywhere for that matter. I have been trying to mess with it through reading the forums and am not quite sure what my problem is. I am running off of Fios Internet and the wifi keep disconnecting and prompts me to retype the password for reconnecting. If you guys could give me a step by step process of how I should go about fixing this I would GREATLY appreciate it!

    Read the article

  • Install failing new hard drives

    - by John
    I'm trying to install Ubuntu server 12.04 on my new hard drives but it seems to fail. Once past the option menu where is asked the partition to install the OS on, goes into a hold and no progress is shown afterwards. The hard disk I'm trying to install it on is: Western Digital WD20EARX The installation process hangs around 'installing core packages/installing the base system' . The CD comes through the test with being valid/ok. any help would be appreciated. Thanks in advance.

    Read the article

  • Can't install Ubuntu one

    - by Yehonatan Tsirolnik
    While trying to install Ubuntu one it throwes me this error - W:Failed to fetch http://ppa.launchpad.net/rabbitvcs/ppa/ubuntu/dists/DISTIBUTION/main/binary-amd64/PAckages 404 Not Found, W:Failed to fetch http://ppa.launchpad.net/rabbitvcs/ppa/ubuntu/dists/DISTRIBUTION/main/binary-i386/Packages 404 Not Found, E:Some index files failed to download. They have been ignored, or old ones used instead. and I can't install it Thanks.

    Read the article

  • Port an existing Quickly app from precise to quantal

    - by Ian B.
    I've developed an app using Quickly on a 12.04 system. In preparation for the 12.10 release, I'd like to have launchpad build a version for Quantal so that it can be used and tested by people from my ppa. I'm not willing to upgrade my system yet (I depend on it for work), how can I do this from 12.04 and my current quickly project? I have a virtualbox with 12.10 installed for testing, but I don't want to copy over the quickly project if I don't have to. Ideally, an answer should work with the quickly submitubuntu command so that it is packaged for installation in the /opt/extras.ubuntu.com directory.

    Read the article

  • What is an "integration script" and why would I want one?

    - by ændrük
    When I navigate to Launchpad in Firefox, a pop-up appears: I think, despite its failure to form a coherent question, it's trying to ask me if I want to install an "integration script" called "unity-webapps-launchpad". Sadly, it does not provide me with enough information to make an informed decision, nor does it refer me to a source where I can learn more about it. The top result in my web searches on the topic is my own bug report. While this cyclical phenomenon provides a brief source of amusement, it is ultimately unhelpful. So, once again, I've come to Ask Ubuntu for a nudge in the right direction. What is this thing?

    Read the article

  • Install OpenOffice for headless use

    - by Subhransu
    The question very simple and short. I am following this article to install OpenOffice headless: sudo apt-get install openoffice.org-headless openoffice.org-writer openoffice.org-draw And I get the following error : Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package openoffice.org-headless E: Couldn't find any package by regex 'openoffice.org-headless' UPDATE: apt-cache search openoffice.org output: http://pastebin.ubuntu.com/1262902/

    Read the article

  • Why isn't persistence working on Lubuntu 12.04 Live-USB?

    - by Frodik
    I have used Universal-USB-Installer ever since to install different Linux versions to USB flash drive. But now with Lubuntu 12.04 even though I do the same process by selecting persistence file, it gets created but is never used in Lubuntu. Every time I boot into Lubuntu on flash, it is fresh new Lubuntu without my changes I did last time I have booted it. Anyone can help me or give me some hints ? Thanks in advance.

    Read the article

  • Uninstall broken package

    - by user60665
    Times ago I have installed Linux mint stuff on my Ubuntu 11.10 (now 12.04). I accidentally removed some files manually ( they were under /usr/share.). Now it is impossible to remove the related deb packages, and synaptic report various errors. How can remove them bypassing errors? It is possible view the installed files in synaptic and remove them manually, but is tedious...also remain the problem to remove the files entry from the apt database. Any suggestion?

    Read the article

  • Help on PHP CURL script [closed]

    - by Sumeet Jain
    This script uses a cookie.txt in the same folder chmoded to 777... The problem i am facing is i hav many accounts to login... Say if i hav 5 accounts...i created cookie1.txt,cookie2.txt an so on.. then the script worked..with the post data But i want this to be always logged in and post data.. Can anyone tell me how to do this????? Code which works for login and post data is http://pastebin.com/zn3gfdF2 Code which i require should be something like this ( i tried with using the same cookie.txt but i guess it expires :( ) http://pastebin.com/45bRENLN Please help me with dealing with cookies... Or suggest how to modify the code without using cookie files...

    Read the article

  • jQuery scrolling images for e-commerce site, what to do about users who disable JS

    - by Livingston Storm
    As the title suggests, I am developing an e-commerce site and I intend of having two jQuery plug ins on the default page, one for scrolling images and the other for the navigation menu. Should I be concerned about making the site work if the users disables JS? Cause if they have it disabled my site would be almost impossible to use with the scrolling images blocking the main content. Plus the CMS I am using, Big Commerce, uses a bit of JS for the products pages, which would also look ridiculous with JS disabled. Anyone have experience with this?

    Read the article

< Previous Page | 11 12 13 14 15 16 17  | Next Page >