Daily Archives

Articles indexed Wednesday April 21 2010

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

  • Custom byte size?

    - by thyrgle
    So, you know how the primitive of type char has the size of 1 byte? How would I make a primitive with a custom size? So like instead of an in int with the size of 4 bytes I make one with size of lets say 16. Is there a way to do this? Is there a way around it?

    Read the article

  • cakephp: how to make NOW() work in search condition ?

    - by kaklon
    I'm trying to get all records with date greater then now. I tried this but it doeasnt work: $all_dates = $this->TourDate->find('all', array('conditions' => array('TourDate.date >=' => 'NOW()'), 'order' => array('TourDate.date ASC'))); If I replace NOW() with the current date it works. Why's that?

    Read the article

  • Year dropdown range - when do we stop?

    - by Andrew Heath
    I attended a payroll software demo yesterday wherein the year dropdowns throughout the software ran from 2000 to 2200. Now, we've all been down this road before with 2 digit shortsight, but honestly - a 200 year service life for a Java & Oracle payroll system? Our Board of Directors would be thrilled if the company was even solvent for 1/4th that long. When forced to use a dropdown year select, where do you draw the line?

    Read the article

  • On saving an new active record, in what order are the associated objects saved?

    - by Bryan
    In rails, when saving an active_record object, its associated objects will be saved as well. But has_one and has_many association have different order in saving objects. I have three simplified models: class Team < ActiveRecord::Base has_many :players has_one :coach end class Player < ActiveRecord::Base belongs_to :team validates_presence_of :team_id end class Coach < ActiveRecord::Base belongs_to :team validates_presence_of :team_id end I expected that when team.save is called, team should be saved before its associated coach and players. I use the following code to test these models: t = Team.new team.coach = Coach.new team.save! team.save! returns true. But in another test: t = Team.new team.players << Player.new team.save! team.save! gives the following error: > ActiveRecord::RecordInvalid: > Validation failed: Players is invalid I figured out that team.save! saves objects in the following order: 1) players, 2) team, and 3) coach. This is why I got the error: When a player is saved, team doesn't yet have a id, so validates_presence_of :team_id fails in player. Can someone explain to me why objects are saved in this order? This seems not logical to me.

    Read the article

  • Cannot clear the form after Submit using the Validation plugin in jQuery

    - by novellino
    Hello, I an quite new to jQuery and I have a problem while trying to create a form. I am using the Validation plugin for validate the email (one the form's field). When I click the Submit button I want to call my own function because I want to save the data in an XML file. This is my button: (as I understood the plugin uses "submit" for understand the button) <input type="submit" name="submit" class="submit" id="submit_btn" value="Send"/> and here is the script for the validation: <script type="text/javascript"> $(document).ready(function() { //this is my form $("#contactForm").validate(); /*save the valid data in the xml*/ $(".submit").click(function() { var email = $("input#email").val(); var subject = $("input#subject").val(); var message = $("textarea#message").val(); if (email == "" || !$("#contactForm").valid()) { return false; } var dataString = 'email='+ email + '&subject=' + subject + '&message=' + message; //alert("DATA: " +dataString); $.ajax({ type: "POST", url: "SaveData.jsp", data: dataString, success: function(data){} }); return false; }); }); </script> In general it works ok but I have two basic problems. When I click the button in the beginning having all the form empty, I get no message for the field required. Also when the data are valid and I am doing the submit, the form does not become clear after the submit. If I deleted this script code, these actions are working properly but I can not save the data! Does anyone know what is wrong? Thanks a lot!

    Read the article

  • Mock a Linq to Sql EntityRef using Moq?

    - by Jeremy Holt
    My datacontext contains a table named Userlog with a one to many relationship with table UserProfile. In class UserLog public UserProfile UserProfile { get {return this._UserProfile.Entity;} } In class UserProfile public EntitySet<UserLog> UserLogs { get{return this._UserLogs;} } { set {this._UserLogs.Assign(value); } How would I go about mocking (using Moq) UserLog.UserProfile without changing the autogenerated code? What I would like to do is something like: var mockUserLog = new Mock<UserLog>(); mockUserLog.Setup(c=>c.UserProfile.FirstName).Returns("Fred"); etc I can do this if I go into the designer.cs and make FirstName and UserProfile virtual, however I would like to do this in the partial class. Any ideas? Thanks Jeremy

    Read the article

  • REST API for driving distance?

    - by Mark
    Is there a service that will give me the driving distance between two addresses? Apparently Google Maps API requires you to display a map, which I don't want to do (on that particular page), and I'd like to just snag the data and save it to my DB after a user submits a form, rather than waiting for JS to do it's thing. If it's relevant, this is going into a Django app. I discovered that CloudMade offers a Python API, which is nice, except their latest dev release has a bug in it (can't use the API object), but more importantly, it's support for Canada is awful/worthless (couldn't find directions from any major city around here!).

    Read the article

  • Help with IF THEN breaking when comparing results from MYSQL query.

    - by roydukkey
    I'm have a problem with an invite system. The if statement seems to break. It shows the message "Fail" but the UPDATE statement still executes. Why do both the THEN and the ELSE excute? $dbConn = new dbConn(); // Check if POST user_username and user_hash are matching and valid; both are hidden for fields $sql = "SELECT user_username " . "FROM table_users " . "WHERE user_id=".mysql_real_escape_string($_POST["user_id"])." " . "AND user_hash='".mysql_real_escape_string($_POST["user_hash"])."' " . "AND user_enabled=0;"; $objUser = $dbConn->query($sql); // If result contains 1 or more rows if( mysql_num_rows($objUser) != NULL ){ $objUser = mysql_fetch_assoc($objUser); $ssnUser->login( $objUser["user_username"] ); $sql = "UPDATE table_users SET " . "user_enabled=1, " . "user_first_name='".mysql_real_escape_string($_POST["user_first_name"])."', " . "user_last_name='".mysql_real_escape_string($_POST["user_last_name"])."', " . "user_password='".mysql_real_escape_string( md5($_POST["user_password"]) )."' " . "WHERE user_id=".mysql_real_escape_string($_POST["user_id"]).";"; $dbConn->query($sql); echo "Success"; header( "Refresh: 5; url=/account/?action=domains" ); } else { echo "Fail"; } This dbConn Class is as follows: class dbConn{ var $username = "xxxx_admin"; var $password = "xxxxxxxx"; var $server = "localhost"; var $database = "xxxx"; var $objConn; function __construct(){ $conn = mysql_connect( $this->server, $this->username, $this->password, true ); if( !$conn ){ die("Could not connect: ".mysql_error() ); } else { $this->objConn = $conn; } unset($conn); } function __destruct(){ mysql_close( $this->objConn ); unset( $this ); } function query( $query, $db = false ){ mysql_select_db( $db != false ? $db : $this->database, $this->objConn ); $result = mysql_query( $query ); unset($query,$db); return $result; } }

    Read the article

  • Forcing tar to create an empty archive

    - by snostorm
    I'm trying to use tar to tar files before transfer, so I can keep the entire file path rather than losing it along the way. However, when I try to tar an empty folder, it tells me that it is cowardly refusing to create an empty archive. I want to keep the empty folder on the other end, but don't want to put anything else into the archive to make it non-empty. Is there any way to do this?

    Read the article

  • how to close open ftp connections?

    - by KnockKnockWhosThere
    I use FileZilla, and I thought when a session ended, it automatically closed the ftp connection, but that doesn't appear to have happened because now I'm getting a "530 Sorry, the maximum number of connections (10) for your host are already connected." error. Is there a way to find any open ftp connections and close them from my end? Or, do I have to contact the host?

    Read the article

  • Copy EXIF Metadata from TIF to JPEG in C# / VB.NET

    - by George
    Hello! I would really appreciate if you could shed light on this problem. I have 2 images, one was created from TIF file with metadata, the other is an in-memory image that will be saved as jpeg. Then I use this routine to transfer exif metadata from first image to the second one (that is from the one created from tif file to the in-memory image): For Each _p In image1.PropertyItems image2.SetPropertyItem(_p) Next And this works perfectly fine. All exif items are successfully copied. I confirmed this by using watches in debug mode. The problem comes when you save image2 as jpeg using this: Dim eps As EncoderParameters = New EncoderParameters(1) eps.Param(0) = New EncoderParameter(Encoder.Quality, 85) Dim ici As ImageCodecInfo = GetEncoderInfo("image/jpeg") image2.Save("C:\1.jpg", ici, eps) Only very few EXIF properties are saved with image2 jpeg file however, namely only camera model and camera maker. However If I save image2 as TIF, all properties from the original tif will be there. Can anyone explain why is that? Thanks.

    Read the article

  • How to add global exception handling to a add-in dll?

    - by redjackwong
    Here's my context: I am writing a WPF add-in for an application. This Application's main thread is unmanaged. I want to add a global exception handling system for this add-in to handle any unhandled exceptions. Here's what I've tried but not working: I cannot add a try-catch block to my Application.Run() code line. Because I am an add-in, that code fragment is in the application. System.Windows.Forms.Application.ThreadException is not working too. There might not be an WinForm Application exists. (WPF hosting in unmanaged code.) AppDomain.CurrentDomain.UnhandledException is not working too. Because maybe it's handled by the Application itself. It just doesn't enter my code. So, any ideas for this situation?

    Read the article

  • Detect movie being played (Windows)

    - by modosansreves
    Watching a movie is quite a different user activity. User doesn't touch neither mouse nor keyboard. Yet he 'actively' uses the computer. Thus, screensaver shouldn't run, indexing should be performed with care etc. On the other side, playing video requires either using direct write to video memory, or DirectShow, or some other API. This may be the key to the answer. What is the Dead Simple Way to determine that a video is being played?

    Read the article

  • SQL Rotating numbers

    - by vinodacharyabva
    I want to create a rotating logic in sql like consider there are 3 numbers 1,2,3 then first week 1,2 will be selected next 3,1 next 2,3 and so on..... if there are 4 numbers 1,2,3,4 then 1,2 next 3,4 next 1,2 so on... Like that i want to generate the numbers in sql server.Please help me.

    Read the article

  • apache front end using mod_proxy_ajp to tomcat on different servers

    - by user302307
    Anyone knows the steps to run Apache on server A as front end and run mod_proxy_ajp to connect to tomcat instances on server B? I want to run apache on sever A to do name based vhost that connects to many tomcat servers. I can run mod_proxy_ajp, only if apache and tomcat are on the same server. What I've tried so far: In server A, running Apache 2.2: NameVirtualHost *:80 ServerName tc0.domo.lan ErrorLog "C:\Apache\Apache2.2\logs\tc0.ajp.error.log" CustomLog "C:\Apache\Apache2.2\logs\tc0.ajp.access.log" combined DocumentRoot C:/htdocs0 AddDefaultCharset Off Order deny,allow Allow from all ProxyPass / ajp://192.168.77.233:8009/ ProxyPassReverse / ajp://192.168.77.233:8009/ Options FollowSymLinks AllowOverride None Order deny,allow Allow from all Server B: 192.168.77.233, tomcat 6 connector: I can confirm if going to http://192.168.77.233:8080/manager/html, tomcat works. When I use packet sniffer on server A, I found that server A is trying to connect to server B at port 80 when I'm connecting http://tc0.domo.lan/manager/html on server A

    Read the article

  • Eclipse - no Java (JRE) / (JDK) ... no virtual machine...

    - by Wallter
    I am trying to get Eclipse Galileo to re-run on my computer - i have run it before with no problems but now i keep getting this error: A java Runtime Environment (JRE) or Java Development kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations: C:\eclipse\jre\javaw.exe javaw.exe in your current PATH I've just done a fresh install of both the JDK and the SDK I have Windows 7 (x64) what's up with this? / how do i fix it-? UPDATE- i can't run any of the ipconfig / tracert / ping

    Read the article

  • Connect R to Quickbooks

    - by Btibert3
    Has anyone connected the R package to QuickBooks? I know there is an ODBC driver than can be bought. Just wondering if anyone has already gone down this road. Any insight will be much appreciated! ~ Brock

    Read the article

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