Daily Archives

Articles indexed Saturday April 10 2010

Page 17/89 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Should I be using callbacks or should I override attributes?

    - by ryeguy
    What is the more "rails-like"? If I want to modify a model's property when it's set, should I do this: def url=(url) #remove session id self[:url] = url.split('?s=')[0] end or this? before_save do |record| #remove session id record.url = record.url.split('?s=')[0] end Is there any benefit for doing it one way or the other? If so, why? If not, which one is generally more common?

    Read the article

  • error with Security Exception

    - by Alexander
    I am getting the following error on my page: Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. The problem is with the following code SmtpClient mailClient = new SmtpClient("smtp.gmail.com", 587); What's weird is that when testing it at my localhost, everything works fine, but when I put it on my 1and1 web host it generates the error above. I contacted their support and here's their answer. We do check the error logs and the operation require a FullTrust environment which currently fall under restriction on .NET Framewor k What should I do?

    Read the article

  • protobuf-net: Issues deserializing DataMember fields in lieu of read-only property

    - by Paul Smith
    I'm having issues deserializing certain properties of ORM-generated entities using protobuf-net. I suspect something in the way the ORM manages serialization attributes on read-only properties (uses public backing fields with DataMember attributes & [de]serializes) those instead of the corresponding read-only property, which has an IgnoreDataMember attribute). Guid properties might have issues of their own, but the field vs. property thing is my working theory now. Here's a simplified example of the code. Say I have a class, Account with an AccountID read-only guid, and an AccountName read-write string. I serialize & immediately deserialize a clone. In this scenario I get one of two results (depending on the entity, haven't isolated the specific commonality yet). The deserialized clone either: ...has a different AccountID from the original, or ...throws an Incorrect wire-type deserializing Guid exception while deserializing. Here's example usage... Account acct = new Account() { AccountName = "Bob's Checking" }; Debug.WriteLine(acct.AccountID.ToString()); using (MemoryStream ms = new MemoryStream()) { ProtoBuf.Serializer.Serialize<Account>(ms, acct); Debug.WriteLine(Encoding.UTF8.GetString(ms.GetBuffer())); ms.Position = 0; Account clone = ProtoBuf.Serializer.Deserialize<Account>(ms); Debug.WriteLine(clone.AccountID.ToString()); } And here's an example ORM'd class (simplified; hopefully haven't removed the cause of the issue in the process). Uses a shell game to deserialize read-only properties by exposing the backing field ("can't write" essentially becomes "shouldn't write," but we can scan code for instances of assigning to these fields, so the hack works for our purposes): [DataContract()] [Serializable()] public partial class Account { public Account() { _accountID = Guid.NewGuid(); } [XmlAttribute("AccountID")] [DataMember(Name = "AccountID", Order = 0)] public Guid _accountID; /// <summary> /// A read-only property; XML, JSON and DataContract serializers all seem /// to correctly recognize the public backing field when deserializing: /// </summary> [IgnoreDataMember] [XmlIgnore] public Guid AccountID { get { return this._accountID; } } [IgnoreDataMember] protected string _accountName; [DataMember(Name = "AccountName", Order = 1)] [XmlAttribute] public string AccountName { get { return this._accountName; } set { this._accountName = value; } } } XML, JSON and DataContract serializers all seem to serialize / deserialize matching object graphs here, so this attribute arrangement apparently causes those serializers to correctly assign to the public backing field when deserializing. I've tried protobuf-net with lists vs. single instances, different prefix styles, etc., but always either get the 'incorrect wire type ... Guid' exception, or the Guid property (field) not deserializing correctly. So the specific questions are, is there a quick workaround for this, and/or is there an explanation for both of outcomes 1 & 2 above, and/or can protobuf-net somehow be corralled into behaving like WCF in cases like this (i.e. follow the same DataMember/IgnoreDataMember semantics)? We hope not to have to create a protobuf dependency directly in the entity layer; if that's the case, we'll probably create proxy DTO entities with all public properties having protobuf attributes. (This is a subjective issue I have with all declarative serialization models; it's a ubiquitous pattern, but IMO, "normal" should be to have objects and serialization contracts decoupled.) Thanks!

    Read the article

  • In iPhone OS, what UTI represents a plain ol' text file?

    - by Justin Searls
    I'm attempting to make use of the UIDocumentInteractionController mechanism in iPhone OS 3.2, but I'm struggling to figure out exactly how to construct a UTI that it likes. I've gotten as far as attempting to set "public.plain-text", but it's hard to test whether this is the correct UTI for a plain text document, since I can't tell whether the issue is that my iPad doesn't have any apps that support plain text import. (I figured Pages would, but I suppose perhaps not, since it will attempt and fail to load any files with the extension .pages, regardless of UTI). Any seasoned OS X developers that can help on this?

    Read the article

  • ruby, rails, railscasts example gone bad

    - by Sam
    If you saw the railscasts on nested forms this is the helper method to create links dynamically. However, after I upgraded to ruby 1.9.2 and rails 3 this doesn't work and I have now idea why. def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, h("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")")) end here is the javascript function add_fields(link, association, content) { var new_id = new Date().getTime(); var regexp = new RegExp("new_" + association, "g") $(link).up().insert({ before: content.replace(regexp, new_id) }); }

    Read the article

  • what is the difference between declarative and imperative programming

    - by Brad
    I have been searching the web looking for a definition for declarative and imperative programming that would shed some light for me. However the language used at some of the resources that I have found is daunting - for instance at wikipedia. Does any one have a real world example that they could show me that might bring some perspective to this subject...perhaps in c# thanks

    Read the article

  • PHP can't connect to Mongodb

    - by mdm414
    Hi, I followed the windows installation instructions in mongodb's website but I still can't connect to MongoDB through PHP because of this error: Class 'Mongo' not found Why isn't the file containing the Mongo Class not being loaded? I've also found this error: PHP Warning: PHP Startup: mongo: Unable to initialize module Module compiled with module API=20090626, debug=0, thread-safety=1 PHP compiled with module API=20060613, debug=0, thread-safety=1 These options need to match in Unknown on line 0 I'm using php 5.2.5 and the mongo-php-driver is Windows PHP 5.2 VC6 thread safe Thanks

    Read the article

  • Serve static media on "nginx"

    - by MMRUSer
    My django application hosted on Apache, and now I want to serve its static media through nginx, I don't have any prior experience in nginx...plus currently the static media is serve through Apache.. expecting some helping hand. Apache 2.2 mod_wsgi nignx-0.7.65 Django 1.1.1 Thanks..

    Read the article

  • GUI FTP and File Management for Linux VPS

    - by Cyrcle
    I'm interested in how I could remotely control FTP and file management on my Linux VPS with a GUI. I frequently transfer sites to my VPS for testing, and I'd much rather do it directly on the high bandwidth connection instead of my 10down, 2up Comcrap cable.

    Read the article

  • Password manager solution: Symbian based phone and a Linux machine (Windows is not important, but wo

    - by Kent
    Hi, I currently use KeePassX to manage my passwords on my Linux (Xubuntu) machine. It's nice to have all the passwords encrypted, but sometimes I'd like to be able to tell a password when I'm on the run. Therefore I'm looking for a solution which I can synchronize with my phone. I have a Nokia N82 which is a Symbian OS v9.2 based phone for the S60 3rd Edition platform with Feature Pack 1. I like an open source solution if it's possible. In case it isn't I wouldn't mind paying for a good solution. If Windows may be added to the synchronization mix it's nice, but it's absolutely not a primary requirement (I don't even have any computer running Windows).

    Read the article

  • Connecting to internet via phone on Linux

    - by Bart van Heukelom
    I have a Sony Ericsson C702 phone with a flat fee internet subscription (GPRS/UMTS). I'd like to connect my Linux (Kubuntu 9.04) laptop to internet via this phone, using bluetooth (I also have a cable connection but that's propietary, doubt it'll work). How can I do this, preferably via GUI / NetworkManager / the BT applet that comes with KDE? In Windows I use SE's PC suite software which works great, but is not available for Linux.

    Read the article

  • valuechangelistener in ice:selectBooleanCheckbox

    - by chetan
    There is a jspx page in my application where I use datatable within datatable first column I put is selectbooleancheckbox and I use value changelistener for selectbooleabcheckbox. Now problem is for two column first one is actually active when I click on second. This is a code

    Read the article

  • Unable to compile output of lex

    - by dbarker
    When I attempt to compile the output of this trivial lex program: # lex.l integer printf("found keyword INT"); using: $ gcc lex.yy.c I get: Undefined symbols: "_yywrap", referenced from: _yylex in ccMsRtp7.o _input in ccMsRtp7.o "_main", referenced from: start in crt1.10.6.o ld: symbol(s) not found collect2: ld returned 1 exit status lex --version tells me I'm actually using 'flex 2.5.35' although ls -fla `which lex` isn't a symlink. Any ideas why the output won't compile?

    Read the article

  • Extract data from an Array

    - by fireBand
    Hello, I have an array DetailsArray in VB.NET which contains the result of a LINQ query. I have shown below the values of the array. i need to get the "ProjectID" from the array and assign it to 'ProjID' variable DetailsArray (0){Name = "TestProject1", ProjectID = 10} Dim ProjID as Integer = DetailsArray(??) How would I do that? Thanks in advance.

    Read the article

  • NHibernate Linq Timeout

    - by DarrenMcD
    How do I increase the timeout in NHibernate Linq To Sql? Not the Connection Timeout but the ado command timeout. using (ISession session = NHibernateHelper.OpenSession(NHibernateHelper.Databases.CarrierCDR)) using (session.BeginTransaction(IsolationLevel.ReadUncommitted)) { lCdrs = (from verizon in session.Linq<Domain.Verizon>() where verizon.Research == true && verizon.ReferenceTable == null orderby verizon.CallBillingDate descending select verizon).ToList(); }

    Read the article

  • Browser error in IE 6?

    - by Surya sasidhar
    hi, i developed a project in that when when i click on any button it giving some message like.. sys.webforms.pagerequestmanagerservererrorexception:An unknown error occurred while processing the request on the status code returned from the server was:12019 it is especially in IE 7. it is working fine in firefox and IE 6. I have a doubt that when a system contain IE 6 and IE 7 this problem will get i think what do you say?. can u help me and this is my site

    Read the article

  • dynamic memory allocation problem

    - by wantobegeek
    i am working on a program that requires me to make use of 4 matrices sized [1000][1000]. i have created them using malloc().But when I try running the program ..it just crashes and the memory usage shoots upto 2.5 GB.Pls suggest any solution as soon as possible.I wud be grateful..

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >