Daily Archives

Articles indexed Thursday December 20 2012

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

  • How to execute a Ruby file in Java, capable of calling functions from the Java program and receiving primitive-type results?

    - by Omega
    I do not fully understand what am I asking (lol!), well, in the sense of if it is even possible, that is. If it isn't, sorry. Suppose I have a Java program. It has a Main and a JavaCalculator class. JavaCalculator has some basic functions like public int sum(int a,int b) { return a + b } Now suppose I have a ruby file. Called MyProgram.rb. MyProgram.rb may contain anything you could expect from a ruby program. Let us assume it contains the following: class RubyMain def initialize print "The sum of 5 with 3 is #{sum(5,3)}" end def sum(a,b) # <---------- Something will happen here end end rubyMain = RubyMain.new Good. Now then, you might already suspect what I want to do: I want to run my Java program I want it to execute the Ruby file MyProgram.rb When the Ruby program executes, it will create an instance of JavaCalculator, execute the sum function it has, get the value, and then print it. The ruby file has been executed successfully. The Java program closes. Note: The "create an instance of JavaCalculator" is not entirely necessary. I would be satisfied with just running a sum function from, say, the Main class. My question: is such possible? Can I run a Java program which internally executes a Ruby file which is capable of commanding the Java program to do certain things and get results? In the above example, the Ruby file asks the Java program to do a sum for it and give the result. This may sound ridiculous. I am new in this kind of thing (if it is possible, that is). WHY AM I ASKING THIS? I have a Java program, which is some kind of game engine. However, my target audience is a bunch of Ruby coders. I don't want to have them learn Java at all. So I figured that perhaps the Java program could simply offer the functionality (capacity to create windows, display sprites, play sounds...) and then, my audience can simply code with Ruby the logic, which basically justs asks my Java engine to do things like displaying sprites or playing sounds. That's when I though about asking this.

    Read the article

  • Photo sharing social platform [closed]

    - by user1696497
    I am working on a photo sharing social platform like Flickr, Photobucket. To start off with I have half a million photos as of now. I want to convert all of these into a single format, compression ratio and use it as an original image. I will be storing original image, re-sized image according to layout and a thumbnail. I have started off with ruby, didn't find supporting libraries. I am considering python as it has a good image processing library and instagram is using it. I want some advise about how the image has to be processed while uploading, efficient way of storage whether database or a file system, image compressions, and precautions to be taken. I would be having profile pictures, do I need store them separately or along with the images? If I want to store the images on a file system, which file system should I use and also should I store the url or should I use any intermediate key value store like redis?

    Read the article

  • Term for a single C++ endpoint/object file

    - by Qix
    I have heard several terms for a C++ "Codepoint" (which is what I've heard used the most often), or a .cpp file that is compiled into an object file. For instance, .cpp files can include other .cpp files (or any other file, really, so long as it compiles), but during compilation, there is really only one 'main' code file that is used/generated. I know there is a widely accepted term, I just can't recall what it is. What is the accepted term for the final .c/.cpp file used to generate an object file?

    Read the article

  • Don't Use Static? [closed]

    - by Joshiatto
    Possible Duplicate: Is static universally “evil” for unit testing and if so why does resharper recommend it? Heavy use of static methods in a Java EE web application? I submitted an application I wrote to some other architects for code review. One of them almost immediately wrote me back and said "Don't use "static". You can't write automated tests with static classes and methods. "Static" is to be avoided." I checked and fully 1/4 of my classes are marked "static". I use static when I am not going to create an instance of a class because the class is a single global class used throughout the code. He went on to mention something involving mocking, IOC/DI techniques that can't be used with static code. He says it is unfortunate when 3rd party libraries are static because of their un-testability. Is this other architect correct?

    Read the article

  • Static objects and concurrency in a web application

    - by Ionut
    I'm developing small Java Web Applications on Tomcat server and I'm using MySQL as my database. Up until now I was using a connection singleton for accessing the database but I found out that this will ensure just on connection per Application and there will be problems if multiple users want to access the database in the same time. (They all have to make us of that single Connection object). I created a Connection Pool and I hope that this is the correct way of doing things. Furthermore it seems that I developed the bad habit of creating a lot of static object and static methods (mainly because I was under the wrong impression that every static object will be duplicated for every client which accesses my application). Because of this all the Service Classes ( classes used to handle database data) are static and distributed through a ServiceFactory: public class ServiceFactory { private static final String JDBC = "JDBC"; private static String impl; private static AccountService accountService; private static BoardService boardService; public static AccountService getAccountService(){ initConfig(); if (accountService == null){ if (impl.equalsIgnoreCase(JDBC)){ accountService = new JDBCAccountService(); } } return accountService; } public static BoardService getBoardService(){ initConfig(); if (boardService == null){ if (impl.equalsIgnoreCase(JDBC)){ boardService = new JDBCBoardService(); } } return boardService; } private static void initConfig(){ if (StringUtil.isEmpty(impl)){ impl = ConfigUtil.getProperty("service.implementation"); // If the config failed initialize with standard if (StringUtil.isEmpty(impl)){ impl = JDBC; } } } This was the factory class which, as you can see, allows just one Service to exist at any time. Now, is this a bad practice? What happens if let's say 1k users access AccountService simultaneously? I know that all this questions and bad practices come from a bad understanding of the static attribute in a web application and the way the server handles this attributes. Any help on this topic would be more than welcomed. Thank you for your time!

    Read the article

  • How to deal with static utility classes when designing for testability

    - by Benedikt
    We are trying to design our system to be testable and in most parts developed using TDD. Currently we are trying to solve the following problem: In various places it is necessary for us to use static helper methods like ImageIO and URLEncoder (both standard Java API) and various other libraries that consist mostly of static methods (like the Apache Commons libraries). But it is extremely difficult to test those methods that use such static helper classes. I have several ideas for solving this problem: Use a mock framework that can mock static classes (like PowerMock). This may be the simplest solution but somehow feels like giving up. Create instantiable wrapper classes around all those static utilities so they can be injected into the classes that use them. This sounds like a relatively clean solution but I fear we'll end up creating an awful lot of those wrapper classes. Extract every call to these static helper classes into a function that can be overridden and test a subclass of the class I actually want to test. But I keep thinking that this just has to be a problem that many people have to face when doing TDD - so there must already be solutions for this problem. What is the best strategy to keep classes that use these static helpers testable?

    Read the article

  • Freelancing - Share the source code?

    - by Tec
    I have developed a couple of form based windows application in vb.net for a client and they all work well and he paid me through a freelance site. I have handed over the executable and the setup to the client and all was well. Now the client wants the source code for the application. Is there a general practice on sharing the source code with the client? Please note - the client never mentioned he needs the source code and he is now asking for it after a week after the app was completed and he made the payment. I don't mind sharing the source code, but I am not sure if I should. This probably means the client would not hire me again and the bigger question is the source code really his property? This question may have been asked a few times, but I cannot still draw a conclusion on what is right. update To answer some of the questions: The source code was not mentioned at all. There was no exclusive contract signed except for the usual agreement of the freelance site. I am not sure if software development comes under work for hire and is it valid for users outside of the US? The reason for not sharing the source code was this was a very small project and I got paid for a mere few hours. So if I have an option then definitely I would want to keep the source code to myself as that gives a possibility of the client coming back. The application works flawlessly and the code is solid. Also, the task that the client wanted to achieve was very challenging and I would not like other programmers (competitors) to know how I achieved it. So unless I get the confirmation that the source code is purely the property of the client, I would not be willing to share it.

    Read the article

  • About shared (static) Members and its behavior

    - by Allende
    I just realized that I can access shared members from instances of classes (probably this is not correct, but compile and run), and also learn/discover that, I can modify shared members, then create a new instance and access the new value of the shared member. My question is, what happens to the shared members, when it comes back to the "default" value (class declaration), how dangerous is it do this ? is it totally bad ? is it valid in some cases ?. If you want to test my point here is the code (console project vb.net) that I used to test shared members, as you can see/compile/run, the shared member "x" of the class "Hello" has default value string "Default", but at runtime it changes it, and after creating a new object of that class, this object has the new value of the shared member. Module Module1 Public Class hello Public Shared x As String = "Default" Public Sub New() End Sub End Class Sub Main() Console.WriteLine("hello.x=" & hello.x) Dim obj As New hello() Console.WriteLine("obj.x=" & obj.x) obj.x = "Default shared memeber, modified in object" Console.WriteLine("obj.x=" & obj.x) hello.x = "Defaul shared member, modified in class" Console.WriteLine("hello.x=" & hello.x) Dim obj2 As New hello() Console.WriteLine("obj2.x=" & obj2.x) Console.ReadLine() End Sub End Module UPDATE: First at all, thanks to everyone, each answer give feedback, I suppose, by respect I should choose one as "the answer", I don't want to be offensive to anyone, so please don't take it so bad if I didn't choose you answer.

    Read the article

  • Help With Hard links And Symlinks Moving Directory And Files

    - by Julio
    This is what I would like to do. I have a symlink "/var" linking to "/tmpfs/var.1" /var - /tmpfs/var.1 I start a script called "cache_tmpfs" from /etc/rc.local on startup this script will copy /var.backup/* contents to /tmpfs/var.1/ cp -dpRxf /var.backup/* /tmpfs/var.1/ now the problem is that kernel is opening messages log file in /var/log/messages, is it possible to remove the current /var symlink and recreate a new one (that will symlink to /var.backup insteed of /tmpfs/var.1) without issues as files once opened by system become hard links?? rm /var && ln -s /var.backup /var Thanks...

    Read the article

  • Error while running bash script that moves files

    - by K.K Patel
    I am new to bash scripting and want to create bash script that moves some days old files between source and destination as per days defined in script. When I run this script I get error line 16: syntax error near unexpected token `do' #!/bin/bash echo "Enter Your Source Directory" read soure echo "Enter Your Destination Directory" read destination echo "Enter Days" read days do find $soure -mtime +$days mv $soure $destination {} \; echo "Files $days old moved from $soure to $destination" done please help me to create this script.

    Read the article

  • Problem with WindowsXp on VirtualBox in 12.10

    - by umpirsky
    When I try to start it I get: Failed to open a session for the virtual machine WindowsXp. The virtual machine 'WindowsXp' has terminated unexpectedly during startup with exit code 1. Result Code: NS_ERROR_FAILURE (0x80004005) Component: Machine Interface: IMachine {5eaa9319-62fc-4b0a-843c-0cb1940f8a91} and in another dialog: Kernel driver not installed (rc=-1908) The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing '/etc/init.d/vboxdrv setup' as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary. When I try to run: $ sudo /etc/init.d/vboxdrv setup [sudo] password for umpirsky: sudo: /etc/init.d/vboxdrv: command not found Any idea?

    Read the article

  • foreign-architecture

    - by speedy-MACHO
    Always when I install something, I get the following error multiple times: Unknown configuration key 'foreign-architecture' found in your 'dpkg' configuration files. This warning will become a hard error at a later date, so please remove the offending configuration options and replace them with 'dpkg --add-architecture' invocations at the command line. When I try dpkg --add-architecture I get: Unknown configuration key `foreign-architecture' found in your `dpkg' configuration files. This warning will become a hard error at a later date, so please remove the offending configuration options and replace them with `dpkg --add-architecture' invocations at the command line. dpkg: error: --add-architecture takes one argument Type dpkg --help for help about installing and deinstalling packages [*]; Use `dselect' or `aptitude' for user-friendly package management; Type dpkg -Dhelp for a list of dpkg debug flag values; Type dpkg --force-help for a list of forcing options; Type dpkg-deb --help for help about manipulating *.deb files; Options marked [*] produce a lot of output - pipe it through `less' or `more' ! I've no problems yet, but since it says This warning will become a hard error at a later date I better do something about this. When I search 'foreign-architecture', I find an empty file, containing not a single byte. I somehow can't delete that file. Please help, it's a kind of creapy...

    Read the article

  • Custom keybindings without gnome-settings-daemon

    - by Carlito
    I am using Ubuntu 12.04 (Fallback) and I am trying to slim it down, mostly for fun/learning experience. I killed gnome-settings-daemon because I set up my theming from elsewhere. But now some of my keybindings are lost. I think the windowmanager ones are still working, like Alt-Tab and switch workspace. But my mediakeys to change volume and my custom keybindings are not working anymore. Is there a different way to save custom keybindings? Do I really need to run settings-manager to setup my keybindings?

    Read the article

  • USB Device first mounted as root, then by user

    - by Petr Marek
    When I connect my Kindle, it shows up as an usb0 media, which I can read but not write (owner = root). However, if I do sudo umount /media/usb0, usb0 gets unmounted and a Kindle media gets mounted properly (is writable etc.). What can cause such strange behavior? It's not only with Kindle, but with Flash drives etc. as well. My /etc/fstab: # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc nodev,noexec,nosuid 0 0 # / was on /dev/sda2 during installation UUID=595815c2-d882-4ec8-a2cd-cce70471167c / ext4 errors=remount-ro 0 1 # /boot was on /dev/sda6 during installation #UUID=1340a336-66ca-4743-a6e4-41a307af2dda /boot ext4 defaults 0 3 # swap was on /dev/sda5 during installation UUID=afa49f1d-d505-4166-82a2-2f44548a48c6 none swap sw 0 0 UUID=deb86039-528a-45f3-b5f9-ce528740c94e /data_hdd ext4 defaults 0 2 My groups: petr@sova:~$ groups petr petr : petr adm cdrom sudo dip plugdev fuse lpadmin sambashare bumblebee

    Read the article

  • Disabling Password and Key Login

    - by Matthew Miller
    I want to disable the login prompt to access the Passwords and Keys. Right clicking the prompt does not bring up a change password dialogue. Under Applications System Tools Preferences there is "Passwords and Keys" but right clicking that does not allow me to change the password either. There is no Password and Keys selection under Accessories. I used to be able to change the password to a blank character, which allowed it to automatically login, but there doesn't seem to be an option for that now. Using Gnome 3 in 12.10 Thank you

    Read the article

  • Controlling Brightness in Sony Vaio SVE151A11W |Not Working|

    - by Rabimba Karanjai
    Disclaimer First: I have gone thorugh these following threads here and followed all of their advice but none of them worked Brightness Control Problem on Sony VAIO with NVIDIA GT-320M unable to change brightness settings in sony vaio e series laptop Brightness doesn't change on Sony laptop Now the Problem I have installed Ubuntu 12.10 (64bit) in this Sony Vaio laptop. After vanilla isntallation the brightness keys are workinga nd I can see the brightness indictaor going up and down buit its isn't having any effect on the real brightness of the device. I have installer additional drivers too but that didn't solve the problem. I can't seem to be able to change the brightness. Anyone knows how I can fix this?

    Read the article

  • Downloads killing internet on my home network

    - by Travis
    I am currently having a problem with my wireless. Whenever I try to download anything it kills the internet for every other application(tabs within the same browser, browsers on other computers on the same network) except the process doing the download. This occurs with everything from downloading updates to iso's. I am not using a torrent. It happens when downloading upgrades, browser downloads, or anything else. This problem does not occur when I use Windows 7 on the same computer and it stops killing the internet for other computers if I turn the download/Ubuntu off. I am using an ASUS G74SX laptop running Ubuntu 12.10 with Gnome 3.6. My wireless card is an Intel Corporation Centrino Wireless-N + WiMAX 6150 (rev 67) Thanks!

    Read the article

  • Cedarview drivers boot to a blank screen

    - by map7
    I'm following the tutorial following tutorial to get my Intel D2700DC motherboard's graphics working: http://daily.siebler.eu/2012/06/ubuntu-12-04-driver-for-intel-cedarview-atom-n2000-und-d2000-serie/ When I boot I'm getting a blank screen. I followed the tutorial and read all the comments. I've also tried: Install gdm and use this instead of lightdm (ubuntu default) sudo apt-get install gdm Remove previous pae kernel: http://www.liberiangeek.net/2011/11/remove-old-kernels-in-ubuntu-11-10-oneiric-ocelot/ Reboot before adding cedarview packages. Have tried with and without the "video=LVDS-1:d" to GRUB_CMDLINE_LINUX_DEFAULT variable in /etc/default/grub I still get a blank screen. I am plugged into a HD screen through the HDMI and have tried the DVI connector also. I can see the grub menu, then a little of the loading and then 'No signal'. I can still ssh into the box though so it is logging in. lspci -v -s 00:02.0 00:02.0 VGA compatible controller: Intel Corporation Atom Processor D2xxx/N2xxx Integrated Graphics Controller (rev 09) (prog-if 00 [VGA controller]) Subsystem: Intel Corporation Device 2011 Flags: bus master, fast devsel, latency 0, IRQ 45 Memory at 80100000 (32-bit, non-prefetchable) [size=1M] I/O ports at 20d0 [size=8] Expansion ROM at <unassigned> [disabled] Capabilities: <access denied> Kernel driver in use: pvrsrvkm Kernel modules: cedarview_gfx uname -a Linux test-desktop 3.2.0-35-generic #55-Ubuntu SMP Wed Dec 5 17:45:18 UTC 2012 i686 i686 i386 GNU/Linux

    Read the article

  • Installing MATLAB Ubuntu 12.10, persistent "permission denied" problem

    - by Javier
    I'm trying to install MATLAB on Ubuntu 12.10, I had it in my last laptop with 12.04 and I didn't have much trouble to install it. I'm getting this problem: j@jgb:~/Programs/Instaladores/matlab$ ./install Preparing installation files ... Installing ... ./install: 1: eval: /tmp/mathworks_1436/sys/java/jre/glnxa64/jre/bin/java: Permission denied Finished And it doesn't change if I change the permissions to the java file or to the install file as other posts say. In my /etc/fstab file I had this line added (But nothing changes if I comment it): tmpfs /tmp tmpfs nodev,nosuid,noexec,mode=1777 0 0 Thanks

    Read the article

  • Problem in my terminal related clamav

    - by Hejar Hejar
    Recently I decided to use Avast Antivirus. I uninstalled clamav and installed Avast. Now whenever I use my terminal I get the following errors.: 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/1,250 kB of archives. After this operation, 5,120 B of additional disk space will be used. Do you want to continue [Y/n]? y (Reading database ... dpkg: warning: files list file for package `clamav-daemon' missing, assuming package has no files currently installed. dpkg: warning: files list file for package `python-pyclamav' missing, assuming package has no files currently installed. dpkg: warning: files list file for package `clamav-base' missing, assuming package has no files currently installed. dpkg: warning: files list file for package `clamav-freshclam' missing, assuming package has no files currently installed. dpkg: warning: files list file for package `libclamav6' missing, assuming package has no files currently installed. dpkg: warning: files list file for package `python-clamav' missing, assuming package has no files currently installed. (Reading database ... 554940 files and directories currently installed.) Please help. Thank you

    Read the article

  • That pestky Intel Centrino wireless N + WiMAX 6150 wireless card

    - by newb26
    I'm new to linix and just got Ubuntu up and running on my ASUS laptop last night. Aside from the wireless everything seems to be working. The card is able to recognize networks but cannot make a full connection. After I enter my password it will try to connect before asking for the password again after a few minutes. I know the issue isn't the password because I checked that I had the right one. I've done some poking around trying to find a way to get it work. Linix recognizes the card as well. I found a link to some drivers in a question someone had about a WiMAX 6250 card and am curious if anyone knows if they would also work for the 6150 I have in my machine: https://github.com/ago/wimax-tools If not what can I do?

    Read the article

  • How should I update my name server after I installed a new dedicated server?

    - by Jim Thio
    Say I got a dedi. The IP is 123.123.123.123 Now I got domain name domainname.com that will be the "main" domain name for that server. Should I? Set the name server of the domainname.com to ns1.domainname.com and ns2.domainname.com Add child nameserver ns1.domainname.com and ns2.domainname.com to point to that exact IP. or Should I? Point the name server to my registrar name server. Set an A address of the name server to point to my IP. Which one is right? Obviously I want ns1.domainname.com and ns2.domainname.com to point to my IP so I can then point hundreds of domains to that IP. But how exactly I should do that? Specifically I simply use cpanel. Centosh with cpanel.

    Read the article

  • SEO Suggestion For My Blog [closed]

    - by Rana
    I have a programming tutorial blog, which have decent traffic. However, I am interested to do some basic seo for my blog to get it optimized. I want to do it myself by learning. I was wondering if experts here can suggest me how should I proceed please? Also, if you please review my blog and suggest the most common seo concern that come to your mind first, those will be helpful as well. My blog site url is as follow: http://codesamplez.com/ Looking forward to your feedback soon. Thanks.

    Read the article

  • How many different servers are needed to keep a website running with no downtime? [closed]

    - by Mason Wheeler
    Machines go down. It's a fact of life. They may need to be rebooted for some reason, or they may have a hardware failure, or a power outage. So if I wanted to deploy a website with a server backed by a SQL database, putting the whole thing on one server wouldn't be good enough. It obviously needs at least two servers, so that if one goes down, the other can pick up the slack until the first comes back up. Of course, if I have the server software on two machines, either one of which could go down, I can't place the database on either of those two machines, because it could go down. So the database needs its own server. But that server can go down, so I need a backup database server and some sort of replication system to keep it in sync so the main can fail-over to it. So far, that's a bare minimum of 4 machines to keep one website running with a reasonable chance of no downtime. (Assuming no catastrophic events take place that take down both front-end servers at once or both DB servers at once, and no hacks, DDOS attacks, etc. Am I missing any other factors, or should I consider 4 servers to be the minimum for running a website with a goal of continuing operation without downtime even when a server goes down?

    Read the article

  • How do i make an AJAX block crawlable?

    - by Vikas Gulati
    I have a block with a few tabs. When the user clicks the tab the content of that block get loaded. Now I would like to make it crawlable by the search engines and at the same time I want to maintain the good user-experience. I figured out a couple of alternative but each one has its own shortcomings. The approached that i could come up with. Use hashbangs and then use this. But hashbangs are not good and things of past now. Secondly it will make my content crawlable by only googlebot as yahoo and bing dont support this. Use GET PARAMETERIZED fallback incase when javascript doesn't work. This will work for all bots and also would be nice as it would work without javascript. But then this will create duplicates of my page as this block is only a very small section of my page and i have like around 5-6 tabs. So it means that many duplicates! Doing this without AJAX is not an option as it would only increase the page load time as all these blocks have heavy media content in them!

    Read the article

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