Daily Archives

Articles indexed Tuesday April 20 2010

Page 5/121 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • LINQDataSource and private columns

    - by fyjham
    Hey, I was trying to use a ListView bound to a LinqDataSource to insert to a table where I had a few columns private to the table class (Specifically password columns - only access I want to give outside the class is methods that generate the salt and encrypt the password to store it in 1 go). I gave this a few shots, but I didn't come up with anything I really liked... was wondering if anyone has a better way to do this. The methods I've found: Use the LinqDataSource inserting event and make the appropriate calls on e.NewObject. I don't really like this because it's so far removed from the actual input and there's no simple way to hold the password in the meantime other than a class variable set during the ListView's inserting event (Which works, but seems a little dodgy). Open up these properties and just ask everyone to use the appropriate static methods for encoding the passwords they pass in. I don't really like this cause I'd prefer that class to enforce data integrity rather than relying on all calling code doing it properly... I'm currently going with option #1, but I don't really like passing values between events using class variables like that (It just seems unstructured... even though I can guarantee the events will happen in the right order). Does anyone know a better way, or alternatively am I being too pedantic and one of the methods above is actually the right way to go? Thanks

    Read the article

  • POCO Build Problem

    - by sahs
    Hello, I'm trying to try the POCO library. I downloaded the zip file, and opened the vs solution file named "Net_vs90.sln" on VS 2008. When I try to build the solution, I get this ugly error: bla bla bla.... 1Linking... 1LINK : fatal error LNK1104: cannot open file 'PocoFoundationd.lib' bla bla bla.... Linking... 2LINK : fatal error LNK1104: cannot open file 'CppUnitd.lib' I'm surprised, because I haven't done any changes to the code or configurations. What could be the reason?

    Read the article

  • SQL - How can I apply a "semi-unique" constraint?

    - by Erin Drummond
    Hi, I have a (simplified) table consisting of three columns: id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, foreignID INT NOT NULL, name VARCHAR NOT NULL Basically, I would like to add a constraint (at the database level rather than at the application level) where it only possible for one unique 'name' to exist per foreignID. For example, given the data (id, foreignid, name): 1,1,Name1 2,1,Name2 3,1,Name3 4,2,Name1 5,2,Name2 I want the constraint to fail if the user tries to insert another 'Name3' under foreignId 1, but succeed if the user tries to insert 'Name3' under foreignId 2. For this reason I cannot simply make the whole column UNIQUE. I am having difficulty coming up with a SQL expression to achieve this, can anybody help me? Thanks

    Read the article

  • Why is it so difficult to get a working IDE for Scala?

    - by Alex R
    I recently gave up trying to use Scala in Eclipse (basic stuff like completion doesn't work). So now I'm trying IntelliJ. I'm not getting very far. This was the original error. See below for update: Scala signature Predef has wrong version Expected 5.0 found: 4.1 in .... scala-library.jar I tried both versions 2.7.6 and 2.8 RC1 of scala-*.jar, the result was the same. JDK is 1.6.u20. UPDATE Today I uninstalled IntelliJ 9.0.1, and installed 9.0.2 Early Availability, with the 4/14 stable version of the Scala plug-in. Then I setup a project from scratch through the wizards: new project from scratch JDK is 1.6.u20 accept the default (project) instead of global / module accept the download of Scala 2.8.0beta1 into project's lib folder Created a new class: object hello { def main(args: Array[String]) { println("hello: " + args); } } For my efforts, I now have a brand-new error :) Here it is: Scalac internal error: class java.lang.ClassNotFoundException [java.net.URLClassLoader$1.run(URLClassLoader.java:202), java.security.AccessController.doPrivileged(Native Method), java.net.URLClassLoader.findClass(URLClassLoader.java:190), java.lang.ClassLoader.loadClass(ClassLoader.java:307), sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301), java.lang.ClassLoader.loadClass(ClassLoader.java:248), java.lang.Class.forName0(Native Method), java.lang.Class.forName(Class.java:169), org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:72)] Thanks

    Read the article

  • Transactions in codeigniter with multiple tables.

    - by Ethan
    Hey SO, I'm new to transactions in general, but especially with CodeIgniter. I'm using InnoDB and everything, but my transactions aren't rolling back when I want them to. Here's my code (slightly simplified). $dog_db = $this->load->database('dog', true); $dog_db->trans_begin(); $dog_id = $this->dogs->insert($new_dog); //Gets primary key of insert if(!$dog_id) { $dog_db->trans_rollback(); throw new Exception('We have had an error trying to add this dog. Please go back and try again.'); } $new_review['dog_id'] = $dog_id; $new_review['user_id'] = $user_id; $new_review['date_added'] = time(); if(!$this->reviews->insert($new_review)) //If the insert fails { $dog_db->trans_rollback(); throw new Exception('We have had an error trying to add this dog. Please go back and try again.'); } //ADD DESCRIPTION $new_description['description'] = $add_dog['description']; $new_description['dog_id'] = $dog_id; $new_description['user_id'] = $user_id; $new_description['date_added'] = time(); if(!$this->descriptions->insert($new_description)) { $dog_db->trans_rollback(); throw new Exception('We have had an error trying to add this dog. Please go back and try again.'); } $booze_db->trans_rollback(); //THIS IS JUST TO SEE IF IT WORKS throw new Exception('We have had an error trying to add this dog. Please go back and try again.'); $booze_db->trans_commit(); } catch(Exception $e) { echo $e->getMessage(); } I'm not getting any error messages, but it's not rolling back either. It should roll back at that final trans_rollback right before the commit. My models are all on the "dog" database, so I think that the transaction would carry into the models' functions. Maybe you just can't use models like this. Any help would be greatly appreciated! Thanks!

    Read the article

  • Oracle VM and JRockit Virtual Edition: Oracle Introduces Java Virtualization Solution for Oracle(R)

    - by adam.hawley
    Since the beginning, we've been talking to customers about how our approach to virtualization is different and more powerful than any other company because Oracle has the "full-stack" of software (and even hardware these days!) to work with to create more comprehensive, more powerful solutions. Having the virtualization layer, two enterprise class operating systems in Solaris and Enterprise Linux, and the leading enterprise software in nearly every layer of the data center stack, allows us to not just do virtualization for virtualization's sake but rather to provide complete virtualization solutions focused on making enterprise software easier to deploy, easier to manage, and easier to support through integration up and down the stack. Today, we announced the availability of a significant demonstration of that capability by announcing a WebLogic Suite option that permits the Oracle WebLogic Server 11g to run on a Java JVM (JRockit Virtual Edition) that itself runs directly on the Oracle VM Server for x86 / x64 without needing any operating system. Why would you want that? Better performance and better consolidation density, not to mention great security due to a lower "attack surface area". Oracle also announced the Oracle Virtual Assembly Builder product. Oracle Virtual Assembly Builder provides a framework for automatically capturing the configuration of existing software components and packaging them as self-contained building blocks known as appliances. So you know that complex application you've tweaked on your physical servers (or on other virtual environments for that matter)?  Virtual Assembly Builder will allow the automated collection of all the configuration data for the various application components that make up that multi-tier application and then use the information to create and package each component as a virtual machine so that the application can be deployed in your Oracle VM virtualization environment quickly and easily and just as it was configured it in your original environment. A slick, drag-and-drop GUI also serves as a powerful, intuitive interface for viewing and editing your assembly as needed.No one else can do complete virtualization solutions the way Oracle can and I think these offerings show what's possible when you have the right resources for elegantly solving the larger problems in the data center rather than just having to make-do with tools that are only operating at one layer of the stack. For more information, read the press release including the links to more information on various Oracle websites.

    Read the article

  • Can anyone simplify this Algorithm for me?

    - by Titan
    Basically I just want to check if one time period overlaps with another. Null end date means till infinity. Can anyone shorten this for me as its quite hard to read at times. Cheers public class TimePeriod { public DateTime StartDate { get; set; } public DateTime? EndDate { get; set; } public bool Overlaps(TimePeriod other) { // Means it overlaps if (other.StartDate == this.StartDate || other.EndDate == this.StartDate || other.StartDate == this.EndDate || other.EndDate == this.EndDate) return true; if(this.StartDate > other.StartDate) { // Negative if (this.EndDate.HasValue) { if (this.EndDate.Value < other.StartDate) return true; if (other.EndDate.HasValue && this.EndDate.Value < other.EndDate.Value) return true; } // Negative if (other.EndDate.HasValue) { if (other.EndDate.Value > this.StartDate) return true; if (this.EndDate.HasValue && other.EndDate.Value > this.EndDate.Value) return true; } else return true; } else if(this.StartDate < other.StartDate) { // Negative if (this.EndDate.HasValue) { if (this.EndDate.Value > other.StartDate) return true; if (other.EndDate.HasValue && this.EndDate.Value > other.EndDate.Value) return true; } else return true; // Negative if (other.EndDate.HasValue) { if (other.EndDate.Value < this.StartDate) return true; if (this.EndDate.HasValue && other.EndDate.Value < this.EndDate.Value) return true; } } return false; } }

    Read the article

  • Storing a secret key on Android

    - by Casebash
    My Android application uses a secret key to generate a token for authentication purposes. Is there a more secure way to store this than just putting this in the data store? I think for the iPhone, we store it in the keychain. I am aware of android.accounts.AccountManager, but this seems to give other applications potentially the ability to access the password (if the user selects the wrong option) and so seems less secure.

    Read the article

  • Procedural modeling of Robots?

    - by anon
    Procedural techniques is common for texture synthesis, modeling plants, and modeling terrains. However, I've seen very little work on algorithmic construction of robots, which is a bit surprising given how mechanical these systems are. Anyone have a good resource on the algorithmic construction of robots / robotic humanoids? Thanks!

    Read the article

  • Making all links inside of a div call the same function?

    - by Brandon
    I'm trying to make a notification area that will show alerts. return this.each(function() { jQuery('<div class="' + o['className'] + '">' + o.msg + ' + '<a href="#" onclick="$(this).parent().remove(); dismiss(' + o["id"] + ');">X</a>' + '</div>') .appendTo(this); }); This just takes a message pulled from the database, and shows it to the user. If the user clicks the X then it will call dismiss() which will mark it as being read in the database. The thing is, if the message itself contains a link to another page or external site, I also want to call dismiss() before the user leaves the page. Is there anyway to alter this javascript to take all a elements (the X and any links that would appear in the message) and change the onclick to call the function?

    Read the article

  • How do I handle all the exceptions in a C# class where both ctor and finalizer throw exceptions?

    - by Frank
    How can I handle all exceptions for a class similar to the following under certain circumstances? class Test : IDisposable { public Test() { throw new Exception("Exception in ctor"); } public void Dispose() { throw new Exception("Exception in Dispose()"); } ~Test() { this.Dispose(); } } I tried this but it doesn't work: static void Main() { Test t = null; try { t = new Test(); } catch (Exception ex) { Console.Error.WriteLine(ex.Message); } // t is still null } I have also tried to use "using" but it does not handle the exception thrown from ~Test(); static void Main() { try { using (Test t = new Test()) { } } catch (Exception ex) { Console.Error.WriteLine(ex.Message); } } Any ideas how can I work around?

    Read the article

  • How should I rewrite my code to make it amenable to unittesting?

    - by justin
    I've been trying to get started with unit-testing while working on a little cli program. My program basically parses the command line arguments and options, and decides which function to call. Each of the functions performs some operation on a database. So, for instance, I might have a create function: def create(self, opts, args): #I've left out the error handling. strtime = datetime.datetime.now().strftime("%D %H:%M") vals = (strtime, opts.message, opts.keywords, False) self.execute("insert into mytable values (?, ?, ?, ?)", vals) self.commit() Should my test case call this function, then execute the select sql to check that the row was entered? That sounds reasonable, but also makes the tests more difficult to maintain. Would you rewrite the function to return something and check for the return value? Thanks

    Read the article

  • Facebook Connect - logout issue

    - by Gublooo
    Hello I think I'm missing a very silly detail but the logout funtion of facebook connect is not working for me. I followed the steps posted in this answer by Typeoneerror but I cant get it to work. This is my logout javascript function function logout() { FB.init("API_KEY", "/xd_receiver.htm"); FB.Connect.logoutAndRedirect("/logout/url"); } When I click on it - nothing happens - In the browser status bar - For a second I see a message which says waiting for facebook - but I continue to stay on the same page. It does not redirect me nor does it log me out of facebook either. Just to see if the function is being called - I removed FB.init call from the function and then I get the error Error Message: 'FB.Connect' is null or not an object Any suggestions on how to debug this. Thanks a lot

    Read the article

  • PHP: SimpleXML and Arrays

    - by acemasta
    When I run this code: foreach($xml->movie as $movie) { if(isset($movie->photos)) { foreach ($movie->photos as $photo) { echo $photo."&nbsp;"; } echo "<hr/>"; } } I get nice output of the actual data, e.g. a row looks like 06397001.jpg 06397002.jpg 06397003.jpg 06397004.jpg 06397005.jpg But when I throw it in an array, it includes all the SimpleXML wrapper tags and the jpgs are not at the root of the array. code: foreach($xml->movie as $movie) { if(isset($movie->photos)) { $photos = array(); foreach ($movie->photos as $photo) { $photos[] = $photo; } } else $photos = ""; var_dump($photos); echo "<hr />"; } e.g. same row looks like array(5) { [0]= object(SimpleXMLElement)#11 (1) { [0]= string(12) "06397001.jpg" } [1]= object(SimpleXMLElement)#12 (1) { [0]= string(12) "06397002.jpg" } [2]= object(SimpleXMLElement)#13 (1) { [0]= string(12) "06397003.jpg" } [3]= object(SimpleXMLElement)#14 (1) { [0]= string(12) "06397004.jpg" } [4]= object(SimpleXMLElement)#15 (1) { [0]= string(12) "06397005.jpg" } } Why is this happening/how can I remove this so I just get an array of the photos at root level like when I echo it? Thanks, sorry for the single line code formatting; was messing up when I tried to paste directly with line breaks.

    Read the article

  • new items on GRUB screen in ubuntu/linux

    - by artsince
    I regularly update my ubuntu (10.04), and new minor versions keep accumulating on the GRUB screen. Right now I have 5 different versions listed on the GRUB, even though I always select the latest version to work with. Am I supposed to do anything to get rid of the old version references? Do these old versions affect disk space/performance?

    Read the article

  • problem installing VS 2010 after uninstalling the RC

    - by rap-uvic
    Hi I uninstalled my VS 2010 RC to install VS 2010. However, it fails to install with the following error in the log files: d:\vs_setup.msi could not be opened. I've tried running the windows clean install and deleting any VS2010 files; also renamed the Microsoft Visual Studio 10.0 folder in the registry, but I keep getting the same error. I can see the vs_setup.msi on the dvd, it just won't allow me to run it directly. I have to run setup.exe. Any ideas?

    Read the article

  • SAS: rearrange field order in data step

    - by Dan
    In SAS 9, how can I in a simple data step, rearrange the order the field. Data set2; /*Something probably goes here*/ set set1; run; So if set1 has the following fields: Name Title Salary A Chief 40000 B Chief 45000 Then I can change the field order of set2 to: Title Salary Name Chief 40000 A Chief 45000 B Thanks, Dan

    Read the article

  • How to create a high quality icon for my Windows application?

    - by Patrick Klug
    If you are running Windows with a higher DPI setting you will notice that most application icons on the desktop look terrible. Even high profile application icons such as Google Chrome look terrible while for example Firefox, Skype and MS Office icons look sharp: (example) I suspect that most icons look blurry because a lower resolution icon is scaled up rather than using a higher resolution icon. I want to give my application a high quality icon and can't seem to convince Windows to use the higher resolution icon. I have created a multi-resolution icon with the free icon editor IcoFX. The icon is provided in 16x16, 24x24, 32x32,48x48, 128x128 and 256x256 (!) (all in 32 bit including alpha channel) yet Windows seems to use the 128x128 version of the icon on the desktop and scale it up which looks terrible. (I am using Windows 7 - 64 bit - the icon is placed by means of setting up a shortcut in the msi (created via Visual Studio 2008 Setup Project) and pointing it to the .ico file that contains the multi-resolution icon) I have tried removing the 128x128 icon but to no avail. Interestingly in Windows Explorer the icon looks great even when using the Extra Large Icon setting. How can I create a high quality desktop icon that looks great on higher DPI settings on Windows?

    Read the article

  • Cannot run a JUnit test case containing threads from Eclipse

    - by Parag
    I am running JUnit test case from Eclipse 3.4.1 . This test case creates a class which starts a thread to do some stuff. When the test method ends it seems that Eclipse is forcibly shutting down the thread. If I run the same test from the command line, then the thread runs properly. Somehow I do not remember running into such problems with Eclipse before. Is this something that was always present in Eclipse or did they add it in 3.4.x ? Here is an example: When I run this test from Eclipse, I get a few printts of the cnt (till about 1800) and then the test case is terminated utomatically. However, if I run the main method, which starts JUnit's TestRunner, then the thread counts indefinetely. import junit.framework.TestCase; import junit.textui.TestRunner; /** * This class shows that Eclipses JUnit test case runner will forcibly * terminate all running threads * * @author pshah * */ public class ThreadTest extends TestCase { static Runnable run = new Runnable() { public void run() { int cnt = 0; while(true) System.out.println(cnt++); } }; public void testThread() { Thread t = new Thread(run); t.start(); } public static void main(String args[]) { TestRunner runner = new TestRunner(); runner.run(ThreadTest.class); } }

    Read the article

  • How does struts 1.X ActionForm handle pure html checkbox list?

    - by BlueDolphin
    I am dealing with an old application which uses struts 1.2. And for some reason, we are using pure html form to submit to struts action. For example: for the content output of testAction.do, I try to submit to itself. item 1 item 2 Then I associate an form bean TestForm with testAction. I am not sure how to specify the properties in the form so that it take the value from myitem1 after user click "submit" I tried to add getMyitem1(), setMyitem1(String[] items), getSelectedMyitem1(), setSelectedMyitem1(String[] items) Those set methods are only called when page are loaded. I guess my understanding of ActionForm in struts 1.x must be wrong. Please advise, thanks.

    Read the article

  • Struggling to create correct relationships in MS Access

    - by Yandawl
    http://img714.imageshack.us/img714/7820/croppercapture1.png Basically: an award(course) has many units, which can be either optional or core(mandatory), depending on the award. So for example: the unit 'Advanced Software Engineering' maybe a core unit for the award 'Software Engineering BSc' but only an optional unit for the course 'Web Technology BSc'. I've used flags for that purpose. A student is enrolled on an award so I need to get a complete list of core and optional units (bearing in mind that a student chooses 1 out of many possible optional units). Also, these units have events, e.g, a lecture, workshop or seminar, etc. and those events have sessions or instances of events where students enrolled on that particular unit are required to attend, and those attendances are stored in a separate table to form a register. So I need a hierarchy of expanding the tables something like this I guess: Awards - Students - Units - Sessions - Attendances Any help with this would be appreciated... It's blowing my mind and I'm really close to going insane! My tutor didn't spot I'd got it wrong when I showed my original data model to him and it's due in next week! Thank you :D

    Read the article

  • reflection paths between points in2d

    - by Chris H
    Just wondering if there was a nice (already implemented/documented) algorithm to do the following Given any shape (without crossing edges) and two points inside that shape, compute all the paths between the two points such that all reflections are perfect reflections. The path lengths should be limited to a certain length otherwise there are infinite solutions. I'm not interested in just shooting out rays to try to guess how close I can get, I'm interested in algorithms that can do it perfectly. Search based, not guess/improvement based.

    Read the article

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