Daily Archives

Articles indexed Wednesday August 20 2014

Page 7/19 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Passing functions into other functions as parameters, bad practice?

    - by BlueHat
    We've been in the process of changing how our AS3 application talks to our back end and we're in the process of implementing a REST system to replace our old one. Sadly the developer who started the work is now on long term sick leave and it's been handed over to me. I've been working with it for the past week or so now and I understand the system, but there's one thing that's been worrying me. There seems to be a lot of passing of functions into functions. For example our class that makes the call to our servers takes in a function that it will then call and pass an object to when the process is complete and errors have been handled etc. It's giving me that "bad feeling" where I feel like it's horrible practice and I can think of some reasons why but I want some confirmation before I propose a re-work to system. I was wondering if anyone had any experience with this possible problem?

    Read the article

  • Project structure: where to put business logic

    - by Mister Smith
    First of all, I'm not asking where does business logic belong. This has been asked before and most answers I've read agree in that it belongs in the model: Where to put business logic in MVC design? How much business logic should be allowed to exist in the controller layer? How accurate is "Business logic should be in a service, not in a model"? Why put the business logic in the model? What happens when I have multiple types of storage? However people disagree in the way this logic should be distributed across classes. There seem to exist three major currents of thought: Fat model with business logic inside entity classes. Anemic model and business logic in "Service" classes. It depends. I find all of them problematic. The first option is what most Fowlerites stick to. The problem with a fat model is that sometimes a business logic funtion is not only related to a class, and instead uses a bunch of other classes. If, for example, we are developing a web store, there should be a function that calcs an order's total. We could think of putting this function inside the Order class, but what actually happens is that the logic needs to use different classes, not only data contained in the Order class, but also in the User class, the Session class, and maybe the Tax class, Country class, or Giftcard, Payment, etc. Some of these classes could be composed inside the Order class, but some others not. Sorry if the example is not very good, but I hope you understand what I mean. Putting such a function inside the Order class would break the single responsibility principle, adding unnecesary dependences. The business logic would be scattered across entity classes, making it hard to find. The second option is the one I usually follow, but after many projects I'm still in doubt about how to name the class or classes holding the business logic. In my company we usually develop apps with offline capabilities. The user is able to perform entire transactions offline, so all validation and business rules should be implemented in the client, and then there's usually a background thread that syncs with the server. So we usually have the following classes/packages in every project: Data model (DTOs) Data Access Layer (Persistence) Web Services layer (Usually one class per WS, and one method per WS method). Now for the business logic, what is the standard approach? A single class holding all the logic? Multiple classes? (if so, what criteria is used to distribute the logic across them?). And how should we name them? FooManager? FooService? (I know the last one is common, but in our case it is bad naming because the WS layer usually has classes named FooWebService). The third option is probably the right one, but it is also devoid of any useful info. To sum up: I don't like the first approach, but I accept that I might have been unable to fully understand the Zen of it. So if you advocate for fat models as the only and universal solution you are welcome to post links explaining how to do it the right way. I'd like to know what is the standard design and naming conventions for the second approach in OO languages. Class names and package structure, in particular. It would also be helpful too if you could include links to Open Source projects showing how it is done. Thanks in advance.

    Read the article

  • Moving From IT to Embedded software Developing

    - by Ameer Adel
    i worked for two years at a channel station, managing various Types of tasks, varying from printers installation, software solution, down to managing and maintaining server automation, to be honest, i always been enthusiastic about programming, i studied at some affordable college and finished my IT path successfully, my graduation project was in C# ADO.NET couple of years ago. Obviously it was so much of a beginner spaghetti code than a well furnished code. I also had the chance; after leaving the IT career, to study about some ASP.NET MVC and web apps development. I have rookie level of coding skills due to the poor level of education i endured, and sufficient resources. Currently i m working as a trainee in a newly opened embedded software development company, that is being said, i am, as i sound, have a little idea about the algorithms included, as i was reading for the past couple of days, embedded system development requires more strict coding skills, including memory management, CPU optimization according to its architect, and couple of other tricks regarding the display, and power management if mobile.. etc. My question is, What type of Algorithms am i supposed to use in such cases, as i mentioned before, i am really enthusiastic about learning programming skills and algorithms related to embedded systems and programming languages, including C/C++, Java, C#, and some EC++ if still operational.

    Read the article

  • Modern website/webapp setup

    - by onepiece
    I'm new to web development. From looking at popular open-source frameworks for both front-end and back-end, I have a general idea of what the modern full-stack web setup looks like: Database <- Back-end language ~ REST API <- Front-end Notes: The back-end language (Python, Ruby, PHP, Java) generates the API, which is the only layer between the back and the front. The API will have authentication to protect private data. The front-end sends GET and POST requests to the API. A MVC framework can be used, such as Backbone, Angular, or Ember.js. Does this align with best practices for web development?

    Read the article

  • C++ Without Source Files

    - by Snowman
    Bjarne Stroustrup mentions in his book "The C++ Programming Language, 4th Edition" that not all C++ implementations use files to store and compile code: There are systems that do not store, compile, and present C++ programs to the programmer as sets of files. (Chapter 15, page 419) Later in the chapter, he reiterates that certain implementations do not use files but he does not give any examples. How would such an environment function compared to a more common file-based environment?

    Read the article

  • type of application form in Visual Studio 2013 [on hold]

    - by Lyhour Chhay
    I wanna ask all of you about the type of application form which can developed by using Visual Studio . I know only 2 , there are windows application form and web application form . So i wanna know more because my teacher told me that there 4 more application forms . I try to search on Google or Wikipedia but still can't find the best answer for me . I hope that you all of you can help me. Best Regard !! thx in advance.

    Read the article

  • How to refactor a myriad of similar classes

    - by TobiMcNamobi
    I'm faced with similar classes A1, A2, ..., A100. Believe it or not but yeah, there are roughly hundred classes that almost look the same. None of these classes are unit tested (of course ;-) ). Each of theses classes is about 50 lines of code which is not too much by itself. Still this is way too much duplicated code. I consider the following options: Writing tests for A1, ..., A100. Then refactor by creating an abstract base class AA. Pro: I'm (near to totally) safe by the tests that nothing goes wrong. Con: Much effort. Duplication of test code. Writing tests for A1, A2. Abstracting the duplicated test code and using the abstraction to create the rest of the tests. Then create AA as in 1. Pro: Less effort than in 1 but maintaining a similar degree of safety. Con: I find generalized test code weird; it often seems ... incoherent (is this the right word?). Normally I prefer specialized test code for specialized classes. But that requires a good design which is my goal of this whole refactoring. Writing AA first, testing it with mock classes. Then inheriting A1, ..., A100 successively. Pro: Fastest way to eliminate duplicates. Con: Most Ax classes look very much the same. But if not, there is the danger of changing the code by inheriting from AA. Other options ... At first I went for 3. because the Ax classes are really very similar to each other. But now I'm a bit unsure if this is the right way (from a unit testing enthusiast's perspective).

    Read the article

  • comparison of an unsigned variable to 0

    - by user2651062
    When I execute the following loop : unsigned m; for( m = 10; m >= 0; --m ){ printf("%d\n",m); } the loop doesn't stop at m==0, it keeps executing interminably, so I thought that reason was that an unsigned cannot be compared to 0. But when I did the following test unsigned m=9; if(m >= 0) printf("m is positive\n"); else printf("m is negative\n"); I got this result: m is positive which means that the unsigned variable m was successfully compared to 0. Why doesn't the comparison of m to 0 work in the for loop and works fine elsewhere?

    Read the article

  • Naming interfaces for persistent values

    - by orip
    I have 2 distinct types of persistent values that I'm having trouble naming well. They're defined with the following Java-esque structure, borrowing Guava's Optional for the example and using generic names to avoid anchoring: interface Foo<T> { T get(); void set(T value); } interface Bar<T> { Optional<T> get(); void set(T value); } With Foo, if the value hasn't been set explicitly then there's some default value available or pre-set. With Bar, if the value hasn't been set explicitly then there's a distinct "no value" state. I'm trying to optimize the names for their call sites. For example, someone using Foo may not care whether there's a default value involved, only that they're guaranteed to always have a value. How would you go about naming these interfaces?

    Read the article

  • School vs Self-Taught [duplicate]

    - by Joan Venge
    This question already has an answer here: Do I need a degree in Computer Science to get a junior Programming job? [closed] 8 answers Do you think university is a good learning environment or is it better to be autodidact? [closed] 3 answers Do you think formal education is necessary to gain strong programming skills? There are a lot of jobs that aren't programming but involves programming, such as tech artists in games, fx tds in film for example. I see similar patterns in the people I work where the best ones I have seen were self-taught, because of being artists primarily. But I also see that while the software, programming knowledge is varied and deep, hardware knowledge is very basic, including me, again due to lack of formal education. But I also work with a lot of programmers who possess both skills in general (software and hardware). Do you think it's necessary to have a formal education to have great programming skills? Would you think less of someone if he didn't have a degree in computer science, or software engineering, etc in terms of job opportunities? Would you trust him to do a software engineering job, i.e. writing a complex tool? Basically I feel the self-taught programmer doesn't know a lot of things, i.e. not knowing a particular pattern or a particular language, etc. But I find that the ability to think outside the box much more powerful. As "pure" programmers what's your take on it?

    Read the article

  • Mac host and Ubuntu guest on virtual box shared folder issue

    - by Thomas Ryan
    I have set up ubuntu server on virtual box on my mac. I created a shared folder which appears to be saved and visible in the configuration section on virtual box for the ubuntu server machine. My only issue is I don't know where this is or how to access it from inside ubuntu server. Does it get it's own directory or do I have to create some sort of a sym-link? If I do need to manually tell it to look in the mac for the file how do I reference the mac machine?

    Read the article

  • Hardware compatibility on H97 chipset/hardware support

    - by user3238850
    I am aware that there is documentation about compatibility but it is way out dated. I am also aware that there is a hardware compatibility page on Ubuntu website, but that one is focused on the whole box rather than a single piece of hardware. I have some experience with Linux OS, and some experience playing Ubuntu Server in a virtual machine, but never worked on a machine that lives in the real internet. I am building a home server with an Intel H97 chipset motherboard. I have looked at several models and none of them has Linux in the supported OS category. I have the experience of installing Ubuntu Desktop 14.04 on my 4-years-old lap top, and except for some system errors on start up, there is not too much I can complain about, so I guess I should be fine. However, this time I am going to install Ubuntu Server 14.04 on a relatively new piece of hardware(I went to http://linux-drivers.org/ but found nothing really helpful). For example the ASUS motherboard has M.2 socket and Intel LAN I218V chip, the Gigabyte motherboard has two LAN chips(Intel LAN WGI217V and ATHEROS AR8161-BL3A-R). So I really want to make sure everything will work. Usually I would just trust Ubuntu and buy all hardware I need, but basing on my past experience with the Ubuntu Desktop version on my lap top, I am not so convinced. There is an easily noticeable difference: when the system is idle, the fan runs much more frequently and longer under Ubuntu. This leads to my suspicion that generally hardware will have worse support for Ubuntu, which is no surprising at all but enough for me to put this post here. And as far as I know, some Intel CPU features come with software that usually will not run under Linux. Any help, idea or thoughts would be greatly appreciated!

    Read the article

  • Change clock resolution to 1000 Hz

    - by Ricky Robinson
    I am running Ubuntu 12.04 and I need to change the clock resolution to 1000 Hz (now it's 250 Hz, the default value). I understand that I have to set it and then recompile the kernel, as for example described here. It's not clear, though, how I can do it from the terminal, as for instance the suggested make menuconfig won't work. Any tips? My current settings are: $ cat /boot/config-3.8.0-29-generic | grep HZ CONFIG_NO_HZ=y CONFIG_RCU_FAST_NO_HZ=y # CONFIG_HZ_100 is not set CONFIG_HZ_250=y # CONFIG_HZ_300 is not set # CONFIG_HZ_1000 is not set CONFIG_HZ=250 CONFIG_MACHZ_WDT=m

    Read the article

  • apt-get command problem

    - by Ramesh Khadka
    I am using Ubuntu 12.04 32 bit in hp pavilion dv6 laptop (AMD Processor) after upgrade and reboot, the desktop doesn't start and at cui (cltr + alt + f1) I login to my user and following error shows: apt-config :/lib/i386-linux-gnu/lib.so.6:version 'GLIBC_2.17' NOT FOUND (required by /usr/lib/i386-linux-gnu/libstdc++.so.6) when I type sudo apt-get command same error shows up and apt-get command doesn't work. All I have is character user interface. please help me.

    Read the article

  • Enable permanent vertical and horizontal scroll bars

    - by Rolen Koh
    I am facing a problem and it is in Ubuntu (14.04) permanent scroll bar is not there but it appears when you move the mouse pointer to right most side or bottom most side. But it is very difficult to use and lately it takes too much to appear and sometimes it doesn't appear at all and so i have to close the application and reopen it. So i want to ask how to enable permanent scroll bars on right side and bottom most side. I am sure many people must have faced this problem before me. Thanks. P.S: By permanent i mean scroll bars should be visible all the time.

    Read the article

  • Elementary OS boots to a terminal (other OS) [on hold]

    - by Benjamin Watson
    Im new to this site, please forgive me if I missed some posting protocol of some sort. I am attempting to install Luna on my samsung s2 laptop (a8 amd radeon 7640g) and when I click on try luna, it just pulls up a terminal after the insignia (curvy E). When I install it, same issue. CTRL-ALT-f7 reveals this (hand typed, sorry if there's typos) Starting preload: *starting CUPS printing spooler/server *stopping save kernel messages preload. fsck from util-linux 2.20.1 fsck from util-linux 2.20.1 dosfsck 3.0.12, 29 oct 2011 FAT32, LFN /dev/sda1: 3 files, 245/189518 clusters /dev/sda2: clean, 133841/30294016 files, 2529529/121164544 blocks Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd *starting AppArmor profiles speech-dispacher disabled; edit /etc/default/speech-dispenser *stopping system V initialisation compatibility *starting system V runlevel compatability *starting apci daemon *starting anac(h)ronistic cron *starting save kernal messages *starting ntp server ntpd *starting regular background program processing damon *starting deferred execution scheduler *stopping anac(h)ronistic cron *starting LightDM Display Manager *starting bluetooth daemon *starting mDNS/DNS-SD daemon *starting CPU interrupts balancing daemon *stopping Send an event to indicate plymouth is up saned disabled ; edit /etc/default/saned *starting network connection manager *starting crash report submission daemon *checking battery state... That's it. I can't make heads or tails of it. Please note that while I've been running linux for about a year, I'm still fairly new to all of this, so try to be detailed in your explanations and/or descriptions of what I need to do. Any/all help would be appreciated. Thank you for your time.

    Read the article

  • Why I am getting following error when trying to start SDK manager?

    - by rishiag
    I have a 64 bit- 20 GB Ubuntu partition which has very less usable space. So I have put Eclipse in my Ubuntu and downloaded sdks to a folder in my another partition. So when I try to start sdk manager, I am getting the following error in my console: Unexpected exception 'Cannot run program "/media/Data/android-sdks/platform-tools/adb": error=13, Permission denied' while attempting to get adb version from '/media/Data/android-sdks/platform-tools/adb' I have run chmod recursively on android-sdks directory. If I change the address for sdks to Ubuntu partition, sdk manager starts successfully. Is there anything I can do other than increasing the partition size? Thanks

    Read the article

  • Ubuntu 12.04 to 14.04 LTS upgraded but crashed soon after restarting the system

    - by LEELA MANOJ N
    In Ubuntu 12.04 the update manager offered me to upgrade it to 14.04, so i kept it for upgrading for whole night and after all the downloading, fetching and removing of packages it asked for restart. So i restarted the system that's it from that time there is no log in page, nothing is coming and just a black command prompt prompting initramfs is appearing (BUSY BOX or something). How can i solve this issue ? or there is way to revert back to 12.04? please help?

    Read the article

  • "cannot open file system. File system seems damaged "

    - by suresh kadiri
    I was using windows 7 till yesterday. I tried to install ubuntu 14. 04 Lts version yesterday with in windows 7. But it was not succeeded. Then I decided to install ubuntu only. By mistake I installed ubuntu in whole disk. After that to get deleted partitions I installed testdisk. I also used deeper search option. Now I'm getting "file system damaged". It shows The hard disk (320GB /298 GiB) seems to small! (<473 GB /441 GB) Check the Harddisk size: HD Jumpers setings, BIOS detection... The following partitions can't be recovered: Partition start end size in sectrors Linux 19077 177 45 57604 81 13 618930716 Linux 19080 192 57 57607 96 25 618930716 With ubcd also I used testdisk option. Same result comes."cannot open file system. File system seems damaged ". I have all my stuff in hard disk. Please help me to get recover my files in deleted partitions.

    Read the article

  • Unable to install updates on 14.04 LTS

    - by Mike
    I have been getting update notifications for a few weeks now but whenever I attempt to install them I get this message; The upgrade needs a total of 74.6 M free space on disk '/boot'. Please free at least an additional 29.8 M of disk space on '/boot'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'. First of all I don't have permission to access /boot (don't know why as its a standalone machine and i'm the only user). Secondly, I emptied the trash; Thirdly, I launched Terminal and entered sudo apt-get clean I was a asked for a sudo password. I entered my system password. Re-entered sudo apt-get clean. The cursor stopped blinking - I assumed it was doing it's "thing". I let it go for about 10 minutes then exited Terminal. Tried to install the updates but just got the same message. Is there something i'm ignorant of? This is the output I get from the command df -h and I have no idea what it all means! @Tim, What's bash and why am I denied access to fstab and /boot? mike@mike-MS-7800:~$ /etc/fstab bash: /etc/fstab: Permission denied mike@mike-MS-7800:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/ubuntu--vg-root 913G 11G 856G 2% / none 4.0K 0 4.0K 0% /sys/fs/cgroup udev 1.7G 4.0K 1.7G 1% /dev tmpfs 335M 1.6M 333M 1% /run none 5.0M 4.0K 5.0M 1% /run/lock none 1.7G 14M 1.7G 1% /run/shm none 100M 52K 100M 1% /run/user /dev/sda2 237M 182M 43M 81% /boot /dev/sda1 487M 3.4M 483M 1% /boot/efi /dev/sr1 31M 31M 0 100% /media/mike/Optus Mobile mike@mike-MS-7800:~$ I ran this from the terminal and all is now working. dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

    Read the article

  • Install reliance Driver software in ubuntu 14.04

    - by A Umar Mukthar
    I'm Using Huawei ec 150 dongle. I need to install driver software It is quiet a big task for begineers in linux. So i took this matter over here. EDIT Output of lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 003: ID 12d1:140b Huawei Technologies Co., Ltd. EC1260 Wireless Data Modem HSD USB Card Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 003: ID 046d:c05a Logitech, Inc. M90/M100 Optical Mouse Bus 002 Device 002: ID 046d:c31d Logitech, Inc. Media Keyboard K200 Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

    Read the article

  • ifconfig can't see USB wireless

    - by Alex
    I have a wifi USB dongle which I have previously used on a Raspberry Pi (this it is what it is target at). I am trying to get it working on an Nvidia Jetson TK1, however I am having some problems. When I run ifconfig I can't see the wifi, only the ethernet and local loopback. iwconfig reports no wireless extensions on all devices. lsusb does find the device: Bus 002 Device 008: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter So I am not sure why the network tools can't see it. I have tried logging on with a GUI and opening up the network settings through Unity, but cannot see any wireless devices either. Not sure if this is useful, but output of lsmod: Module Size Used by nvhost_vi 2940 0 How can I enable wireless networking on this computer? Command line approach is preferred, but either is fine. UPDATE I don't have the kernel module rt2800usb anywhere on my system. If I do an apt-file search for rt2800usb it lists a number of packages of the pattern: linux-image-3.13.0-*. Perhaps installing one of these will do the trick, but can anyone tell me if its safe to do so?

    Read the article

  • Duplicate page content and the Google index

    - by Kit Sunde
    I have a static pages with dynamically expanding content that google is indexing. I also have deep links into virtually duplicate pages which will pre-expand the relevant section of content into the relevant section. It seems like Google is ignoring all my specialized pages and not putting them in the index. Even after going through web-masters tools, crawling and submitting them to the index manually. I also use the google API for integrating search on the site, and the deep linked pages won't show up. Is there a good solution for this?

    Read the article

  • Subdomains vs. URL Path in shareable links

    - by Adam Matan
    I am building a web application for questions and answers. Each question/answer page has all the required metadata for Facebook and Twitter, and we encourage users to share these pages. I have a dilemma regarding the shared link structure: Option 1 - subdomains Use a questions.example.com and answers.example.com, followed by an ID and optional text. The text is ignored by the request, which only takes the id into account. http://questions.example.com/<question_id>/<question_text> http://questions.example.com/12345/how-long-is-the-queue # Example http://q.example.com/12345 # Example Option 2 - URL path This is the format used by stackoverflow.com and trello.com: http://example.com/questions/<question_id>/<question_text> http://example.com/questions12345/how-long-is-the-queue # Example http://example.com/q/12345 # Example Server-wise, I can easily do both - I have a wildcard SSL certificate and Apache/NGinx configuration is pretty straightforward. Which option - subdomains or URL path - is preferred for shareble links?

    Read the article

  • Hidden text and links appearing just on click for SEO?

    - by CamSpy
    I am working on a site that has neat clean/minimalistic design/layout. Menu items are "hidden" behind an icon, to see them, users need to click on that icon to get a javascript toggled overlay with the list of menu items. Then there are blocks with photos and users need to click on a small icon/button on each of them to get a block of text shown for each of the photo. While I don't like such "design" myself, making me click lots of time just to read, I also think that for SEO purpose this model is really wrong. Is such model bad for SEO? Are there ways to keep design like this but have "safe" methods of displaying text content on click that will not hurt SEO?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >