Search Results

Search found 10804 results on 433 pages for 'attribute keys'.

Page 180/433 | < Previous Page | 176 177 178 179 180 181 182 183 184 185 186 187  | Next Page >

  • Disable ARC with Xcode 5

    - by user2187565
    First, sorry for my bad english, I'm french and had 15years old but StackOverFlow is for me the best forum for developers. So, in the previous versions of Xcode, we can disable ARC (Automatic Reference Counting) in the project settings when we create the project. Not now with Xcode 5 and ARC to pose me a problem: with an property list file, for the reading step, Xcode send me an error: "implicit conversion of 'int' to 'id' is disallowed with ARC". I had not the problem with the same code with Xcode 4. In my property list file, The keys are numbers and also in my viewController.m . NIKOS M.: No problem, but I don't see how I can add compiler flag with the 5th version of Xcode. The code (with french string...): NSString *error; NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *plistPath = [rootPath stringByAppendingPathComponent:@"Save.plist"]; NSArray *keys = [NSArray arrayWithObjects:@"valeurCompteur1", @"valeurCompteur2", @"valeurCompteur3", @"valeurCompteur4", @"valeurCompteur5", @"nomCompteur1", @"nomCompteur2", @"nomCompteur3", @"nomCompteur4", @"nomCompteur5", nil]; NSArray *objs = [NSArray arrayWithObjects: compteur1, compteur2, compteur3, compteur4, compteur5, nameC1, nameC2, nameC3, nameC4, nameC5, nil]; REVIEW: When I disallow ARC for the target, an warning persist. How I can resolve that please ? Thank you very much.

    Read the article

  • Greasemonkey failing to GM_setValue()

    - by HonoredMule
    I have a Greasemonkey script that uses a Javascript object to maintain some stored objects. It covers quite a large volume of information, but substantially less than it successfully stored and retrieved prior to encountering my problem. One value refuses to save, and I can not for the life of me determine why. The following problem code: Works for other larger objects being maintained. Is presently handling a smaller total amount of data than previously worked. Is not colliding with any function or other object definitions. Can (optionally) successfully save the problem storage key as "{}" during code startup. this.save = function(table) { var tables = this.tables; if(table) tables = [table]; for(i in tables) { logger.log(this[tables[i]]); logger.log(JSON.stringify(this[tables[i]])); GM_setValue(tables[i] + "_" + this.user, JSON.stringify(this[tables[i]])); logger.log(tables[i] + "_" + this.user + " updated"); logger.log(GM_getValue(tables[i] + "_" + this.user)); } } The problem is consistently reproducible and the logging statments produce the following output in Firebug: Object { 54,10 = Object } // Expansion shows complete contents as expected, but there is one oddity--Firebug highlights the array keys in purple instead of the usual black for anonymous objects. {"54,10":{"x":54,"y":10,"name":"Lucky Pheasant"}} // The correctly parsed string. bookmarks_HonoredMule saved undefined I have tried altering the format of the object keys, to no effect. Further narrowing down the issue is that this particular value is successfully saved as an empty object ("{}") during code initialization, but skipping that also does not help. Reloading the page confirms that saving of the nonempty object truly failed. Any idea what could cause this behavior? I've thoroughly explored the possibility of hitting size constraints, but it doesn't appear that can be the problem--as previously mentioned, I've already reduced storage usage. Other larger objects save still, and the total number of objects, which was not high already, has further been reduced by an amount greater than the quantity of data I'm attempting to store here.

    Read the article

  • Create cross platform Java SWT Application

    - by mchr
    I have written a Java GUI using SWT. I package the application using an ANT script (fragment below). <jar destfile="./build/jars/swtgui.jar" filesetmanifest="mergewithoutmain"> <manifest> <attribute name="Main-Class" value="org.swtgui.MainGui" /> <attribute name="Class-Path" value="." /> </manifest> <fileset dir="./build/classes" includes="**/*.class" /> <zipfileset excludes="META-INF/*.SF" src="lib/org.eclipse.swt.win32.win32.x86_3.5.2.v3557f.jar" /> </jar> This produces a single jar which on Windows I can just double click to run my GUI. The downside is that I have had to explicitly package the windows SWT package into my jar. I would like to be able to run my application on other platforms (primarily Linux and OS X). The simplest way to do it would be to create platform specific jars which packaged the appropriate SWT files into separate JARs. Is there a better way to do this? Is it possible to create a single JAR which would run on multiple platforms?

    Read the article

  • Load PEM encoded private RSA key in Crypto++

    - by 01100110
    Often times, user will have PEM encoded RSA private keys. Crypto++ requires that these keys be in DER format to load. I've been asking people to manually convert their PEM files to DER beforehand using openssl like this: openssl pkcs8 -in in_file.pem -out out_file.der -topk8 -nocrypt -outform der That works fine, but some people don't understand how to do that nor do they want to. So I would like to convert PEM files to DER files automatically within the program. Is it as simple as striping the "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----" from the PEM or is some other transformation required as well? I've been told that between those markers that it's just b64 encoded DER. Here's some code that demonstrates the issue: // load the private key CryptoPP::RSA::PrivateKey PK; CryptoPP::ByteQueue bytes; try { CryptoPP::FileSource File( rsa.c_str(), true, new CryptoPP::Base64Decoder() ); File.TransferTo( bytes ); bytes.MessageEnd(); // This line Causes BERDecodeError when a PEM encoded file is used PK.Load( bytes ); } catch ( CryptoPP::BERDecodeErr ) { // Convert PEM to DER and try to load the key again } I'd like to avoid making system calls to openssl and do the transformation entirely in Crypto++ so that users can provide either format and things "just work". Thanks for any advice.

    Read the article

  • str_replace() and strpos() for arrays?

    - by Josh
    I'm working with an array of data that I've changed the names of some array keys, but I want the data to stay the same basically... Basically I want to be able to keep the data that's in the array stored in the DB, but I want to update the array key names associated with it. Previously the array would have looked like this: $var_opts['services'] = array('foo-1', 'foo-2', 'foo-3', 'foo-4'); Now the array keys are no longer prefixed with "foo", but rather with "bar" instead. So how can I update the array variable to get rid of the "foos" and replace with "bars" instead? Like so: $var_opts['services'] = array('bar-1', 'bar-2', 'bar-3', 'bar-4'); I'm already using if(isset($var_opts['services']['foo-1'])) { unset($var_opts['services']['foo-1']); } to get rid of the foos... I just need to figure out how to replace each foo with a bar. I thought I would use str_replace on the whole array, but to my dismay it only works on strings (go figure, heh) and not arrays.

    Read the article

  • incorrect height in Chrome when "-webkit-appearance: none" and value="" on <input> tag

    - by Avi Steiner
    In Chrome v17.0.963.79 on Windows 7, I seem to be having an inexplicable problem when applying the -webkit-appearance: none style to an <input> tag. The problem is as follows: I have a stylesheet, let's call it potatofoot.css, which consists of the code .tbl { display: table; } .tblRow { display: table-row; } .tblCell { display: table-cell; } input { -webkit-appearance: none; }? and I have an html file, let's call it blech.html, which contains the code <div class="tbl"> <div class="tblRow"> <label class="tblCell">Name</label> <input type="text" class="tblCell" value="I'M NOT EMPTY! OH, YEAH!"> </div><!--end tblRow--> </div><!--end tbl--> This displays fine (see this jsfiddle). But when I empty the value attribute, as in this jsfiddle, the entire table grows from a height of 26px to a height of 31px, the label moves to the bottom, and the input stays at the top. However, if I remove -webkit-appearance: none;, everything shows up the same with and without out the value attribute being filled. What's going on?

    Read the article

  • Matching on search attributes selected by customer on front end

    - by CodeNinja1974
    I have a method in a class that allows me to return results based on a certain set of Customer specified criteria. The method matches what the Customer specifies on the front end with each item in a collection that comes from the database. In cases where the customer does not specify any of the attributes, the ID of the attibute is passed into the method being equal to 0 (The database has an identity on all tables that is seeded at 1 and is incremental). In this case that attribute should be ignored, for example if the Customer does not specify the Location then customerSearchCriteria.LocationID = 0 coming into the method. The matching would then match on the other attributes and return all Locations matching the other attibutes, example below: public IEnumerable<Pet> FindPetsMatchingCustomerCriteria(CustomerPetSearchCriteria customerSearchCriteria) { if(customerSearchCriteria.LocationID == 0) { return repository.GetAllPetsLinkedCriteria() .Where(x => x.TypeID == customerSearchCriteria.TypeID && x.FeedingMethodID == customerSearchCriteria.FeedingMethodID && x.FlyAblityID == customerSearchCriteria.FlyAblityID ) .Select(y => y.Pet); } } The code for when all criteria is specified is shown below: private PetsRepository repository = new PetsRepository(); public IEnumerable<Pet> FindPetsMatchingCustomerCriteria(CustomerPetSearchCriteria customerSearchCriteria) { return repository.GetAllPetsLinkedCriteria() .Where(x => x.TypeID == customerSearchCriteria.TypeID && x.FeedingMethodID == customerSearchCriteria.FeedingMethodID && x.FlyAblityID == customerSearchCriteria.FlyAblityID && x.LocationID == customerSearchCriteria.LocationID ) .Select(y => y.Pet); } I want to avoid having a whole set of if and else statements to cater for each time the Customer does not explicitly select an attribute of the results they are looking for. What is the most succint and efficient way in which I could achieve this?

    Read the article

  • django test client trouble

    - by Anton Koval'
    I've got a problem... we're writing project using django, and i'm trying to use django.test.client with nose test-framework for tests. Our code is like this: from simplejson import loads from urlparse import urljoin from django.test.client import Client TEST_URL = "http://smakly.localhost:9090/" def test_register(): cln = Client() ref_data = {"email": "[email protected]", "name": "???????", "website": "http://hot.bear.com", "xhr": "true"} print urljoin(TEST_URL, "/accounts/register/") response = loads(cln.post(urljoin(TEST_URL, "/accounts/register/"), ref_data)) print response["message"] and in nose output I catch: Traceback (most recent call last): File "/home/psih/work/svn/smakly/eggs/nose-0.11.1-py2.6.egg/nose/case.py", line 183, in runTest self.test(*self.arg) File "/home/psih/work/svn/smakly/src/smakly.tests/smakly/tests/frontend/test_profile.py", line 25, in test_register response = loads(cln.post(urljoin(TEST_URL, "/accounts/register/"), ref_data)) File "/home/psih/work/svn/smakly/parts/django/django/test/client.py", line 313, in post response = self.request(**r) File "/home/psih/work/svn/smakly/parts/django/django/test/client.py", line 225, in request response = self.handler(environ) File "/home/psih/work/svn/smakly/parts/django/django/test/client.py", line 69, in __call__ response = self.get_response(request) File "/home/psih/work/svn/smakly/parts/django/django/core/handlers/base.py", line 78, in get_response urlconf = getattr(request, "urlconf", settings.ROOT_URLCONF) File "/home/psih/work/svn/smakly/parts/django/django/utils/functional.py", line 273, in __getattr__ return getattr(self._wrapped, name) AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF' My settings.py file does have this attribute. If I get the data from the server with standard urllib2.urllopen().read() it works in the proper way. Any ideas how I can solve this case?

    Read the article

  • Best Practice: Protecting Personally Identifiable Data in a ASP.NET / SQL Server 2008 Environment

    - by William
    Thanks to a SQL injection vulnerability found last week, some of my recommendations are being investigated at work. We recently re-did an application which stores personally identifiable information whose disclosure could lead to identity theft. While we read some of the data on a regular basis, the restricted data we only need a couple of times a year and then only two employees need it. I've read up on SQL Server 2008's encryption function, but I'm not convinced that's the route I want to go. My problem ultimately boils down to the fact that we're either using symmetric keys or assymetric keys encrypted by a symmetric key. Thus it seems like a SQL injection attack could lead to a data leak. I realize permissions should prevent that, permissions should also prevent the leaking in the first place. It seems to me the better method would be to asymmetrically encrypt the data in the web application. Then store the private key offline and have a fat client that they can run the few times a year they need to access the restricted data so the data could be decrypted on the client. This way, if the server get compromised, we don't leak old data although depending on what they do we may leak future data. I think the big disadvantage is this would require re-writing the web application and creating a new fat application (to pull the restricted data). Due to the recent problem, I can probably get the time allocated, so now would be the proper time to make the recommendation. Do you have a better suggestion? Which method would you recommend? More importantly why?

    Read the article

  • In XSLT, how can you sort using an indirect key?

    - by edholder
    I am having trouble getting xsl:sort to understand the scope of the attributes I am referencing. Here is an XML sample document to illustrate: <Root> <DrinkSelections> <Drink id=1000 name="Coffee"/> <Drink id=1001 name="Water"/> <Drink id=1002 name="Tea"/> <Drink id=1003 name="Almost But Not Quite Entirely Unlike Tea"/> </DrinkSelections> <CustomerOrder> <Drinks> <Drink oid="1001"/> <Drink oid="1002"/> <Drink oid="1003"/> </Drinks> </CustomerOrder </Root> I want to produce a list of drinks (sorted by name) contained in the CustomerOrder. Here is the XSLT code I am fiddling with: <xsl:for-each select="/Root/CustomerOrder/Drinks/Drink"> <xsl:sort select="/Root/DrinkSelections/Drink[@id = @oid]/@name"/> <xsl:variable name=var_oid select="@oid"/> <xsl:value-of select="/Root/DrinkSelections/Drink[@id = $var_oid]/@name"/> </xsl:for-each> Apparently, the xsl:sort command is trying to apply the "oid" attribute to the Drink elements in DrinkSelections, rather than local Drink element. I can get around this using a variable, as in the xsl:value-of statement. But since xsl:sort must be the first statement after the xsl:for-each statement, I can't insert the xsl:variable statement before xsl:sort. Is there a way to explicitly state that the attribute value should be taken from the "local" element?

    Read the article

  • What's the difference between the [OptionalField] and [NonSerialized]

    - by IbrarMumtaz
    I came across this question on transcender: What should you apply to a field if its value is not required during deserialization? Me = [NonSerialized], ANSWER = [OptionalField] My gut reaction was NonSerialised, I have no idea why but in the space of 5 seconds thats what I thought but to my surprise, Transcender says I am wrong. OK fair enough .... but why? looking more closely at the question I have a good idea what to look out for as far as the [Nonseralized] attribute is concerned but still I would really like this clearing up. As far as I can tell the former has relationship with versioning conflicts between newer and older versions of the same assembly. The later is more concerned with not serializing a field FULLSTOP. Is there anything else that might pick these two apart? MSDN does not really say much about this as they both are used on the BinaryFormatters and SoapFormatter with the XMLFormatter using the XMLIgnoreAttribute. My second question is can you mix and match either one of the two attributes ... I am yet to use them as I have not had an excuse to mess about with them. So my curiosity can only go so far. Just throwing this one out there, but does my answer have something to do with the way [OnDeserialized] and the IdeserilizationCallback interface is implemented???? Am guessing here .... Thanks In Advance UPDATE: I know that optional field attribute does not serialize the value held by a data member but NonSerialized will not even serialise the data member or its value. That sounds about a right???? That's all I got on these two attributes.

    Read the article

  • Eror while showing returned value on parent window from chield (Dialog box) window using JSF Trinida

    - by Navnath
    Hi There, I am using Myfaces and Trinidad tld's for page design. In that, I am trying to implement Dialog box which will going to open on button click with tacking some value from parent window and return result to Parent window. Now the problem is I can send value to Dialog box and also get return from dialog box successfully, but there is problem to show return value on Parent window because parent window is not reflecting that value and ask for refresh page. When I refresh page, it again open the pop up, i.e. it resending the previous request. Here is my return code. private UIXInput input; public UIXInput getInput() { return input; } public void setInput(UIXInput input) { this.input = input; } public void returned(ReturnEvent event) { if (event.getReturnValue() != null) { getInput().setValue(event.getReturnValue()); RequestContext afContext = RequestContext.getCurrentInstance(); afContext.addPartialTarget(getInput()); } } Next is I have bind input variable with field which need to reflect return value. Here is .jspx code. I have download Trinidad dialog code and try to run on local system, but it not showing any dialog box. But once I remove partialSubmit="true" attribute from comment button which shows dialog box, Then I can see dialog box. Is this attribute making an above error? I hope I have explain my problem clearly. Please...Please let me know any any kind of solution, suggestion. I have spend almost a week to resolve this issue, but.......didn't succeed. Thank You in advance, Navnath Kumbhar.

    Read the article

  • Javascript: click and dblclick deliver different parentNodes on same html. Why?

    - by user1658206
    currently I work on an very small wysiwyg editor based on jquery. I dont care about IE oder Chrome, just Firefox. My problem is to find if the selection is in a link for to get the value of the href attribute if is set. With click the node of the link is found, with double click always the body. It is in designMode. My event-handler for click and dblclick. The vars current_selection, current_node, iframe and container are global. selection_handler:function() { current_selection = iframe.getSelection(); current_node = current_selection.anchorNode; if(current_node.nodeName == "#text") { current_node = current_node.parentNode; } $('#log').text(current_node.nodeName); }, The log shows mit for example 'body', when I click in unformated text. When I add a link with execCommand('createLink',...) the log shows 'A'. That works. When I mark the linked word with 2 click from start to end, the log shows 'A'. But with double click I always get 'body'. So I can't get the href attribute. The handler is defined in the init: init:function(options) { ... iframe = $('#wysiwyg-'+container.attr('id'))[0].contentWindow; iframe.addEventListener('dblclick',methods.selection_handler,false); iframe.addEventListener('click',methods.selection_handler,false); ... } Has somebody an idea what is wrong?

    Read the article

  • How to send KeyEvents through an input method service to a Dialog, or a Spinner menu?

    - by shutdown11
    I'm trying to implement an input method service that receives intents sent by a remote client, and in response to those sends an appropriate KeyEvent. I'm using in the input method service this method private void keyDownUp(int keyEventCode) { getCurrentInputConnection().sendKeyEvent( new KeyEvent(KeyEvent.ACTION_DOWN, keyEventCode)); getCurrentInputConnection().sendKeyEvent( new KeyEvent(KeyEvent.ACTION_UP, keyEventCode)); } to send KeyEvents as in the Simple Sofykeyboard Sample, and it works in the home, in Activities... but it doesn't works when a Dialog or the menu of a Spinner is in foreground. The events is sent to the parent activity behind the Dialog. Is there any way to send keys and control the device like using the hardware keys from an input method? Better explanation on what I'm trying to do: I am kind of writng an Input Method that allows to control the device from remote. I write in a client (a java application on my desktop pc) a command (for example "UP"), a server on the device with sendBroadcast() sends the intent with the information, and a receiver in the input method gets it and call keyDownUp with the keycode of the DPAD_UP key. It generally works, but when I go to an app that shows a dialog, the keyDownUp method don't sends the key event to the dialog, for example for select the yes or not buttons, but it keeps to control the activty behind the Dialog.

    Read the article

  • Need help with an xpath query!

    - by gerrod
    Can anyone help with the following XPath question? Given the node-set: <table> <rows> <row> <value column="Product">Coal</value> <value column="Quantity">10000</value> </row> <row> <value column="Product">Iron</value> <value column="Quantity">5000</value> </row> <row> <value column="Product">Ore</value> <value column="Quantity">4000</value> </row> </rows> </table> I want to query to find the node sub-set with a given product name. Note that the product name is being supplied by an attribute of the current node being processed (i.e. "@name"). So when the @name attribute has the value of "Coal" I would expect this to be returned: <row> <value column="Product">Coal</value> <value column="Quantity">10000</value> </row> This is what I've come up with; I know it's wrong, because I don't get anything back. $table/rows/row[value[@column='Product'][text()=@name]] </code>

    Read the article

  • Can a PHP object respond to an undefined method?

    - by Nathan Long
    Rails relies on some of the neat aspects of Ruby. One of those is the ability to respond to an undefined method. Consider a relationship between Dog and Owner. Owner has_many :dogs and Dog belongs_to :owner. If you go into script/console, get a dog object with fido = Dog.find(1), and look at that object, you won't see a method or attribute called Owner. What you will see is an owner_id. And if you ask for fido.owner, the object will do something like this (at least, this is how it appears to me): I'm being asked for my .owner attribute. I don't have one of those! Before I throw a NoMethodError, do I have a rule about how to deal with this? Yes, I do: I should check and see if I have an owner_id. I do! OK, then I'll do a join and return that owner object. PHP's documentation is - ahem - a bit lacking sometimes, so I wonder if anyone here knows the answer to this: Can I define similar behavior for objects in PHP? If not, do you know of a workaround for flexible model joins like these?

    Read the article

  • form target iframe not working in IE7- in facebook fan tab

    - by greatcaesarsghost
    This issue is similar to the one discussed in this thread, only mine is in a Facebook fan page tab (FBML/FBJS). The fix described in the referenced question works fine outside of Facebook, but for whatever reason I can't get it to work in the posted FBJS. Here's a stripped down version of what I'm trying to do: <script type="text/javascript"> function doit() { document.getElementById('msg').setInnerXHTML('<iframe id="testframe" name="testframe" frameborder="0" />'); } </script> <div id="msg"></div> <form action="http://somesite.com/whatever.php" method="post" id="testform" name="testform" target="testframe"> <input type="text" id="txt1" name="txt1" /> <input type="submit" id="btn" name="btn" value="test" onclick="doit();" /> </form> -- This behaves as you'd expect in all browsers, except IE <= 7, where it opens a new window. IE's dev tool shows the iframe as having a 'submitName' attribute, but no 'name' attribute. Even by manually setting the name (document.getElementbyId('testframe').setName('testframe') fails to work the way it would outside of Facebook. Has anyone run into this same issue, and if so, is there any way around it? Thank you.

    Read the article

  • Dom Traversal to Automate Keyboard Focus - Spatial Navigation

    - by Steve
    I'm going to start with a little background that will hopefully help my question make more sense. I am developing an application for a television. The concept is simple and basically works by overlaying a browser over the video plane of the TV. Now being a TV, there is no mouse or additional pointing device. All interaction is done through a remote control. Therefore, the user needs to be able to visually tell which element they are currently focused upon. To indicate that an element is focused, I currently append a colored transparent image over the element to indicate focus. Now, when a user hits the arrow keys, I need to respond by focusing on the correct elements according to the key pressed. So, if the down arrow is pressed I need to focus on the next focusable element in the DOM tree (which may be a child or sibling), and if they hit the up arrow, I need to respond to the previous element. This would essentially simulate spatial navigation within a browser. I am currently setting an attribute (focusable=true) on any DOM elements that should be able to receive focus. What I would like to do is determine the previous or next focusable element (i.e. attribute focusable=true) and apply focus to the element. I was hoping to traverse the DOM tree to determine the next and previously focusable elements, but I am not sure how to perform this in JQuery, or in general. I was leaning towards trying to use the JQuery tree travesal methods like next(), prev(), etc. What approach would you take to solve this type of issue? Thanks

    Read the article

  • Multiple submits in an HTML form

    - by StackOverflowNewbie
    I have an HTML form that needs multiple submit buttons, like this: <input type="submit" name="foo" value="1"/> <input type="submit" name="foo" value="2"/> <input type="submit" name="foo" value="3"/> The problem is that I want it to display on the button something other than what is in the value attribute (in the example above: 1, 2, 3). For example, I want to show "Bar" for the button with value="1". Is this possible? I've considered using the <button> tag, like this: <button name="foo" value="1">Bar</button> The problem with using <button> (from w3schools): If you use the element in an HTML form, different browsers may submit different values. Internet Explorer, prior version 9, will submit the text between the and tags, while other browsers will submit the content of the value attribute. Use the element to create buttons in an HTML form. Thoughts?

    Read the article

  • How to update attributes without valitation

    - by Brian Roisentul
    I've got a model with its validations, and I found out that I can't update an attribute without validating the object before. I already tried to add on => :create syntax at the end of each validation line, but I got the same results. My announcement model have the following validations: validates_presence_of :title validates_presence_of :description validates_presence_of :announcement_type_id validate :validates_publication_date validate :validates_start_date validate :validates_start_end_dates validate :validates_category validate :validates_province validates_length_of :title, :in => 6..255, :on => :save validates_length_of :subtitle, :in => 0..255, :on => :save validates_length_of :subtitle, :in => 0..255, :on => :save validates_length_of :place, :in => 0..50, :on => :save validates_numericality_of :vacants, :greater_than_or_equal_to => 0, :only_integer => true validates_numericality_of :price, :greater_than_or_equal_to => 0, :only_integer => true My rake task does the following: task :announcements_expiration => :environment do announcements = Announcement.expired announcements.each do |a| #Gets the user that owns the announcement user = User.find(a.user_id) puts a.title + '...' a.state = 'deactivated' if a.update_attributes(:state => a.state) puts 'state changed to deactivated' else a.errors.each do |e| puts e end end end This throws all the validation exceptions for that model, in the output. Does anybody how to update an attribute without validating the model?

    Read the article

  • Service behavior not being applied correctly

    - by Rubans
    I have a custom behavior for a service where I want to specify a receive timeout value, I have created a behavior and on the build service header. I use the declarative attribute to apply the behavior or as I thought. But the behavior seems to make no difference, i.e. the set timeout value is not being applied as expected. However when I have noticed the behavior is only being applied when the host is opened rather than when created. The same behavior when applied explicitly through does work. Any ideas? Behavior: [AttributeUsage(AttributeTargets.Class)] public class BuildServiceBindingBehavior : Attribute, IServiceBehavior { public BuildServiceBindingBehavior( string p_receiveTime ) { ReceiveTimeout = TimeSpan.Parse( p_receiveTime ); } #region IServiceBehavior Members public void AddBindingParameters( ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection<ServiceEndpoint> endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters ) { } public void ApplyDispatchBehavior( ServiceDescription serviceDescription, ServiceHostBase serviceHostBase ) { // add this behavior to each endpoint foreach ( var endPoint in serviceDescription.Endpoints ) { endPoint.Binding.ReceiveTimeout = ReceiveTimeout; } } public void Validate( ServiceDescription serviceDescription, ServiceHostBase serviceHostBase ) { } #endregion internal TimeSpan ReceiveTimeout { get; set; } } Service code: [ServiceBehavior(Name = "DotNetBuildsService", InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single )] // Set receieve time out [BuildServiceBindingBehavior( "0:0:1" )] public class BuildService : IBuildTasksService { //implementation code }

    Read the article

  • XML parsing problem

    - by Albinoswordfish
    I'm having this strange XML parsing problem. I have this XML string I'm trying to parse <?xml version="1.0"?> <response status="success"> <lot>32342</lot> </response> I'm using XPath with Java in order to do this. I'm using the Xpath expression "/response/@status" to find the text "success". However whenever I evaluate this expression I get an empty string. However I am able to successfully parse this string using "/response/@type" <?xml version="1.0"?> <response type="success"> <lot>32342</lot> </response> So why would simply changing the name of the attribute change the return string to nothing? is = new InputSource(testWOcreateStrGood); xPathexpressionSuccess = xPath.compile("/response/@status"); responseStr = xPathexpressionSuccess.evaluate(is); reponseStr is the string I posted earlier with the "status" attribute

    Read the article

  • help me refactor iteration over a generic collection

    - by Biswanath
    Hi, I am working with a generic data structure, say MyGeneric<Type>. There is a case where I have to iterate over all the values it holds The code I am trying to do. for ( all the keys in myGeneric ) { // do lot of stuff here } Now the generic can hold base type as double and string and it can hold some user-defined type also. There is a particular situation where I have to some specific work depending upon the type of the generic. so the final code block looks something like this for( all the keys in myGeneric ) { if key is type foo then //do foo foo else if key is of type bar //do bar bar } Now, as complexity sensitive as I am I do not like to have an if condition in the for loop. So the next solution I did was if myGeneric is of type foo call fooIterator(myGeneric) if myGenric is of type bar call barItetrator(myGeneric) function FooIterator() { // ..... // foo work //...... } function BarItetrator() { // ..... // bar work //...... } Then again when somebody sees my code then I am quite sure that they will shout where is the "refactoring". What is the ideal thing to do in this situation ? Thanks.

    Read the article

  • Navigating sorted XML data (XSLT)

    - by Andrew Parisi
    I have an XML file with company data in it, for 30 companies across 8 industries, on a portfolio page. The user has the option to sort this data by Industry, and this XML file will be added to constantly. This sorting is done in my XSL file using <xsl:choose>. Example: <xsl:when test="(invest[@investid='con'])"> <xsl:for-each select="$invest-port/portfolio/company[@industry='Communications']"> <xsl:sort select="name" /> <div class="invest-port-thumb"> <a> <xsl:attribute name="href"> <xsl:value-of select="link" /> </xsl:attribute> </a> </div> </xsl:for-each> </xsl:when> When navigating to an individual company's page, there are "previous" and "next" buttons at the bottom of the window. My issue is that I need these to dynamically link to the previous and next elements from within the XML data that has been sorted. Is this possible? Or is there an easier way to do this? (such as place each company in industry-divided XML files instead of one) Any insight would be greatly appreciated!

    Read the article

  • How to configure a NSPopupButton for displaying multiple values in a TableView?

    - by jekmac
    Hi there! I'm using two entities A and B with to-many-to-many relationship. Lets say I got an entity A with attribute aAttrib and a to-many relationship aRelat to another entity B with attribute bAttrib and a to-many relationship bRelat with entity A. Now I am building an interface with two tables one for entity A and another for entity B. The table for entity B has two columns one for bAttrib and one for the relationship aRelat. The aRelat-column should be a NSPopupButtonCell to display multiple aAttrib values. I'd like to set all the bindings in InterfaceBuilder in Table Column Bindings: -- I have two NSArrayController each for one entity: Object Controller Mode:Entity Array Controller Bindings: Parameters Managed Object Context bind to File's Owner -- One Table Cloumn with a PopUpButtonCell: TableCloumnBindings Content bind to Entity A with ControllerKey arrangedObjects; Content Values bind to Entity A with ModelKeyPath aAttrib Selected Object bind to Entity B with ModelKeyPath bRelat I know that this configuration doesn't allow multiple value setting. But I don't know how to do the right one. Getting the following message: HIToolbox: ignoring exception 'Unacceptable type of value for to-many relationship: property = "bRelat"; desired type = NSSet; given type = NSCFString; value = testValue.' that raised inside Carbon event dispatch... Does anyone have any idea?

    Read the article

< Previous Page | 176 177 178 179 180 181 182 183 184 185 186 187  | Next Page >