Search Results

Search found 390 results on 16 pages for 'samuel kim'.

Page 11/16 | < Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • capturing user IP address information for audit

    - by Samuel
    We have a requirement to log IP address information of all users who use a certain web application based on JEE 5. What would be an appropriate sql data type for storing IPv4 or IPv6 addressses in the following supported databases (h2, mysql, oracle). There is also a need to filter activity from certain IP addresses. Should I just treat the representation as a string field (say varchar(32) to hold ipv4, ipv6 addresses)

    Read the article

  • Randomize numbers within a subset

    - by Samuel
    I have a array of integer numbers (say 1,2,3,4,5 or 1,2,3, ... 10 or 1,2,3, ... 50) from which I would like to get a random set of numbers ordered differently every time. Is there a utility method to do this? e.g. for 1,2,3,4,5 post randomization it might be either [1,5,4,2,3 or 2,1,3,5,4 or 3,1,2,4,5 or ...] I would like to know if there is a java utility method / class which already provides this capability?

    Read the article

  • How to disable sql creation for JPA entity classes

    - by Samuel
    We have some JPA entity classes which are currently under development and wouldn't want them as part of the testing cycle. We tried commenting out the relevant entity classes in META-INF\persistence.xml but the hbm2ddl reverse engineering tool still seems to generate SQL for those entities. How do I tell my code to ignore these classes? Are there any annotations for these or should I have to comment out the @Entity annotation along with my changes in persistence.xml file.

    Read the article

  • Python 4 steps setup with progressBars

    - by Samuel Taylor
    I'm having a problem with the code below. When I run it the progress bar will pulse for around 10 secs as meant to and then move on to downloading and will show the progress but when finished it will not move on to the next step it just locks up. import sys import time import pygtk import gtk import gobject import threading import urllib import urlparse class WorkerThread(threading.Thread): def __init__ (self, function, parent, arg = None): threading.Thread.__init__(self) self.function = function self.parent = parent self.arg = arg self.parent.still_working = True def run(self): # when does "run" get executed? self.parent.still_working = True if self.arg == None: self.function() else: self.function(self.arg) self.parent.still_working = False def stop(self): self = None class MainWindow: def __init__(self): gtk.gdk.threads_init() self.wTree = gtk.Builder() self.wTree.add_from_file("gui.glade") self.mainWindows() def mainWindows(self): self.mainWindow = self.wTree.get_object("frmMain") dic = { "on_btnNext_clicked" : self.mainWindowNext, } self.wTree.connect_signals(dic) self.mainWindow.show() self.installerStep = 0 # 0 = none, 1 = preinstall, 2 = download, 3 = install info, 4 = install #gtk.main() self.mainWindowNext() def pulse(self): self.wTree.get_object("progress").pulse() if self.still_working == False: self.mainWindowNext() return self.still_working def preinstallStep(self): self.wTree.get_object("progress").set_fraction(0) self.wTree.get_object("btnNext").set_sensitive(0) self.wTree.get_object("notebook1").set_current_page(0) self.installerStep = 1 WT = WorkerThread(self.heavyWork, self) #Would do a heavy function here like setup some thing WT.start() gobject.timeout_add(75, self.pulse) def downloadStep(self): self.wTree.get_object("progress").set_fraction(0) self.wTree.get_object("btnNext").set_sensitive(0) self.wTree.get_object("notebook1").set_current_page(0) self.installerStep = 2 urllib.urlretrieve('http://mozilla.mirrors.evolva.ro//firefox/releases/3.6.3/win32/en-US/Firefox%20Setup%203.6.3.exe', '/tmp/firefox.exe', self.updateHook) self.mainWindowNext() def updateHook(self, blocks, blockSize, totalSize): percentage = float ( blocks * blockSize ) / totalSize if percentage > 1: percentage = 1 self.wTree.get_object("progress").set_fraction(percentage) while gtk.events_pending(): gtk.main_iteration() def installInfoStep(self): self.wTree.get_object("btnNext").set_sensitive(1) self.wTree.get_object("notebook1").set_current_page(1) self.installerStep = 3 def installStep(self): self.wTree.get_object("progress").set_fraction(0) self.wTree.get_object("btnNext").set_sensitive(0) self.wTree.get_object("notebook1").set_current_page(0) self.installerStep = 4 WT = WorkerThread(self.heavyWork, self) #Would do a heavy function here like setup some thing WT.start() gobject.timeout_add(75, self.pulse) def mainWindowNext(self, widget = None): if self.installerStep == 0: self.preinstallStep() elif self.installerStep == 1: self.downloadStep() elif self.installerStep == 2: self.installInfoStep() elif self.installerStep == 3: self.installStep() elif self.installerStep == 4: sys.exit(0) def heavyWork(self): time.sleep(10) if __name__ == '__main__': MainWindow() gtk.main() I have a feeling that its something to do with: while gtk.events_pending(): gtk.main_iteration() Is there a better way of doing this?

    Read the article

  • Address calling class

    - by Samuel
    I have an abstract class Moveable with the method abstract void move() which is extended by the class Bullet and the abstract class Character, and Character is extended by the class Survivor and the class Zombie. In Survivor and Bullet the move() method doesnt require any parameters while in the class Zombie the move() method depends on the actual position of the survivor. The survivor and multiple zombies are created in the class Gui. I wanted to access the survivor in Zombie - what's the best way of doing this? In Gui i wrote a method getSurvivor() but i don't see how to access this method in Zombie? I am aware that as a workaround i could just pass a [Survivor survivor] as parameter in move() and ignore it in Bullet and Survivor, but that feels so ... bad practice.

    Read the article

  • Problem with function calls [javascript]

    - by Samuel
    <script language="javascript"> function toggle(id) { alert('call'); if (document.getElementById(id).style.display == "none") { alert('now visible'); document.getElementById(id).style.display = ""; } else { alert('now invisible'); document.getElementById(id).style.display = "none"; } } </script> </head> <body onload="toggle('image1');alert('test_body');toggle('image2')"> <script language="javascript"> alert('test_pre_function'); toggle('image1'); alert('test_after_function'); toggle('image2'); </script> Looks like a lot of code but it's pretty simple so i think most of you won't have troubles with it. toggle() should toggle the display status of divs containing images. When the user enters the site the divs should hide, when everything is loaded the divs should show up. (onload) Strangely enough, the funtion in the body (not in the body tag) only work half, i get and alert 'test_pre_function' and i get an alert 'call' (out of the function), but that's it. The code in the body tag runs just fine. I find this weird because it's supposed to do exactly the same twice and one time it runs, another time not, so i guess i must have made some stupid mistake. Thanks for any help!

    Read the article

  • Javascript not working in firefox

    - by Samuel Meddows
    Hi guys, I have a PHP form validation function that I developed in chrome and now will not work in firefox or Opera. The function checks to see if a section of the form is blank and shows and error message. If there is no error then then the form submits through document.events.submit(); CODE: function submit_events() { //Check to see if a number is entered if the corosponding textbox is checked if (document.events.dj_card.checked == true && dj_amount.value==""){ //Error Control Method //alert ('You didn\'t enetr an Amount for DJ\'s Card!'); var txt=document.getElementById("error") txt.innerHTML="<p><font color=\"#FF0000\"> You didn\'t enetr an Amount for DJ\'s Card!</font></p>"; window.document.getElementById("dj_card_label").style.color = '#FF0000'; //Reset window.document.getElementById("company_amount_label").style.color = '#000000'; window.document.getElementById("own_amount_label").style.color = '#000000'; }else{ document.events.submit(); } The document.events.submit();does work across all my browsers however the check statements do not. If the box is not ticked the form submits. If the box is ticked it does not matter whether there is data in the dj_amount.value or not. The form will not submit and no error messages are displayed. Thanks guys.

    Read the article

  • CMD Prompt > FTP Size Command

    - by Samuel Baldus
    I'm developing a PHP App on IIS 7.5, which uses PHP FTP commands. These all work, apart from ftp_size(). I've tested: cmd.exe > ftp host > username > password > SIZE filename = Invalid Command However, if I access the FTP site through an Internet Browser, the filesize is displayed. Do I need to install FTP Extensions, and if so, which ones and where do I get them? Here is the PHP Code: <?php // FTP Credentials $ftpServer = "www.domain.com"; $ftpUser = "username"; $ftpPass = "password"; // Unlimited Time set_time_limit(0); // Connect to FTP Server $conn = @ftp_connect($ftpServer) or die("Couldn't connect to FTP server"); // Login to FTP Site $login = @ftp_login($conn, $ftpUser, $ftpPass) or die("Login credentials were rejected"); // Set FTP Passive Mode = True ftp_pasv ($conn, true); // Build the file list $ftp_nlist = ftp_nlist($conn, "."); // Alphabetical sorting sort($ftp_nlist); // Display Output foreach ($ftp_nlist as $raw_file) { // Get the last modified time $mod = ftp_mdtm($conn, $raw_file); // Get the file size $size = ftp_size($conn, $raw_file); // Size is not '-1' => file if (!(ftp_size($conn, $raw_file) == -1)) { //output as file echo "Filename: $raw_file<br />"; echo "FileSize: ".number_format($size, '')."Kb</br>"; echo "Last Modified: ".date("d/m/Y H:i", $mod)."</br>"; } } ?>

    Read the article

  • How Do I Import a 3D Object into Adobe Flex?

    - by Kim
    Hi everyone, I wanted to know if anyone here knows how to import a 3D Object (i.e. Maya 3D Model) into Adobe Flex Application? I needed to create a simple Flex application which will allow me to rotate the 3D Object by dragging but I cannot seem to start doing it because I'm having a hard time trying to figure out how I can import my 3D model into Flex. This is exactly what I wanted to do: 3D Object in Flex I hope someone can help me. Thanks a lot :)

    Read the article

  • count down timers in jquery

    - by Samuel
    How do I find out the most commonly or popularly used count down timer in jquery. I have been looking into this (http://plugins.jquery.com/project/countdown2) but not sure if this is well supported. Is there a some kind of a ranking system for the jquery plugins

    Read the article

  • How do you unit test the real world?

    - by Kim Sun-wu
    I'm primarily a C++ coder, and thus far, have managed without really writing tests for all of my code. I've decided this is a Bad Idea(tm), after adding new features that subtly broke old features, or, depending on how you wish to look at it, introduced some new "features" of their own. But, unit testing seems to be an extremely brittle mechanism. You can test for something in "perfect" conditions, but you don't get to see how your code performs when stuff breaks. A for instance is a crawler, let's say it crawls a few specific sites, for data X. Do you simply save sample pages, test against those, and hope that the sites never change? This would work fine as regression tests, but, what sort of tests would you write to constantly check those sites live and let you know when the application isn't doing it's job because the site changed something, that now causes your application to crash? Wouldn't you want your test suite to monitor the intent of the code? The above example is a bit contrived, and something I haven't run into (in case you haven't guessed). Let me pick something I have, though. How do you test an application will do its job in the face of a degraded network stack? That is, say you have a moderate amount of packet loss, for one reason or the other, and you have a function DoSomethingOverTheNetwork() which is supposed to degrade gracefully when the stack isn't performing as it's supposed to; but does it? The developer tests it personally by purposely setting up a gateway that drops packets to simulate a bad network when he first writes it. A few months later, someone checks in some code that modifies something subtly, so the degradation isn't detected in time, or, the application doesn't even recognize the degradation, this is never caught, because you can't run real world tests like this using unit tests, can you? Further, how about file corruption? Let's say you're storing a list of servers in a file, and the checksum looks okay, but the data isn't really. You want the code to handle that, you write some code that you think does that. How do you test that it does exactly that for the life of the application? Can you? Hence, brittleness. Unit tests seem to test the code only in perfect conditions(and this is promoted, with mock objects and such), not what they'll face in the wild. Don't get me wrong, I think unit tests are great, but a test suite composed only of them seems to be a smart way to introduce subtle bugs in your code while feeling overconfident about it's reliability. How do I address the above situations? If unit tests aren't the answer, what is? Thanks!

    Read the article

  • Possible loss of precision / [type] cannot be dereferenced

    - by Samuel
    I have been looking around a lot but i simply can't find a nice solution to this... Point mouse = MouseInfo.getPointerInfo().getLocation(); int dx = (BULLET_SPEED*Math.abs(x - mouse.getX()))/ (Math.abs(y - mouse.getY()) + Math.abs(x - mouse.getX()))* (x - mouse.getX())/Math.abs(x - mouse.getX()); In this constellation i get: Possible loss of precision, when i change e.g (x - mouse.getX()) to (x - mouse.getX()).doubleValue() it says double cannot be dereferenced, when i add intValue() somewhere it says int cannot be dereferenced. What's my mistake? [x, y are integers | BULLET_SPEED is a static final int] Thanks!

    Read the article

  • user interface pattern for associating single or many objects to an entity

    - by Samuel
    Need suggestions on implementing associating single or many objects to an entity. All soccer team players are registered individually (e.g. they are part of 'players' table) A soccer team has many players. The click sequence is like this:- a] Soccer team owner provides a name and brief description of the soccer team. b] Now it wants to add players to this team. c] You have the following button 'Add players to team' which lets you navigate to the 'View Players' page and lets you multi select users from there. Assuming this is a paginated list of players, how do you handle the following:- Do you provide a check box against each player and let the manager do a multi selection. If you need to add more players, it doesn't make sense to show the players who have been already added to the team. Do you mark those entries as not selectable or you would adding showing these entries. If you need to filter, do you provide search filters at the top of this page. Am looking for ideas on how to implement this or sites which have already done something similar.

    Read the article

  • Store form values for later submission

    - by kim griggs
    I have a Rails app that lets users create tutorials and quizzes. There are many users taking the quizzes and many quizzes in a tutorial. My client wants the quiz results to persist when a student navigates away from the quiz. So the use case would be: User starts to take quiz User answers some of the questions User navigates away from quiz to check a fact in the tutorial User goes back to quiz and their answers are still there User finishes quiz and submits Now this would be pretty easy to do if I enforced a "Save" submit so that the answers could be stored in a session or whatever, but the client (and I agree) thinks people will not remember to save before navigating away. Looking for advice on how to approach this. I'm thinking an observer and cookies.

    Read the article

  • COUNT issue across multiple tables

    - by Kim
    I am trying to count across 2 tables and I dont see whats wrong with my query yet I get a wrong result. User 2 does not exist in table_two, so the zero is correct. SELECT t1.creator_user_id, COUNT(t1.creator_user_id), COUNT(t2.user_id) FROM table_one AS t1 LEFT JOIN table_two AS t2 ON t2.user_id = t1.creator_user_id GROUP BY t1.creator_user_id, t2.user_id Actual result 1 192 192 2 9 0 Expected result 1 16 12 2 9 0 The result indicate a missing group by condition, but I already got both fields used. Where am I wrong ? Also, can I sum up all users that doesnt exist in table_two for t1 ? Like user 3 exists 21 times in t1, then the results would be: 1 16 12 (users with > 0 in t2 will need their own row) 2 30 0 (user 2=9 + user 3=21 => 30) Its okay for the user Id to be wrong for sum of t1 for all users with 0 in t2. If not possible, then I'll just do two queries.

    Read the article

  • Border of single th spreads to neighboring th when colspan set on td row below

    - by Samuel Hapak
    Having following html code: <table> <tr><th>First</th><th class='second'>Second</th><th class='third'>Third</th><th>Fourth</th></tr> <tr><td>Mike</td><td colspan=2 >John</td><td>Paul</td></tr> </table>? And following css: table { border-collapse: collapse; } td, th { border: 1px black solid; } td { border-top: none; } th { border-bottom: none; } th.second { border-bottom: 3px green solid; } th.third { } ? I would expect as result one table with 3px solid green line below the second th cell. Instead of that in Chrome, I have solid green border below both the second and the third th cell. In the firefox, results are just as expected. Is this browser bug, or my code is illegal? You can see example at http://jsfiddle.net/tt6aP/3/ PS: Try to set th.third { border-bottom: 2px solid red; } And then try to raise it to 3px. This is even more strange. Screenshots Expected: Chrome: Firefox:

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >