Search Results

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

Page 151/433 | < Previous Page | 147 148 149 150 151 152 153 154 155 156 157 158  | Next Page >

  • Restkit Serializing a Boolean from NSNumber

    - by angelokh
    One of managed objects has one attribute 'isMember' represented by NSNumber type. When serialize to Json post body by RestKit, it always give 0/1 instead of YES/NO or true/false. When mapping from json result to objects, RestKit is able to successfully turn YES/NO to NSNumber. What is the way to force serialize the boolean attribute to YES/NO or true/false? Serialize: 0 -> 0, 1 -> 1 Deserialize : YES/true -> 1, NO/false -> 0

    Read the article

  • runtime loading of ValidateAntiForgeryToken Salt value

    - by p.campbell
    Consider an ASP.NET MVC application using the Salt parameter in the [ValidateAntiForgeryToken] directive. The scenario is such that the app will be used by many customers. It's not terribly desirable to have the Salt known at compile time. The current strategy is to locate the Salt value in the web.config. [ValidateAntiForgeryToken(Salt = Config.AppSalt)] //Config.AppSalt is a static property that reads the web.config. This leads to a compile-time exception suggesting that the Salt must be a const at compile time. An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type How can I modify the application to allow for a runtime loading of the Salt so that the app doesn't have to be re-salted and recompiled for each customer? Consider that the Salt won't change frequently, if at all, thereby removing the possibility of invalidating form

    Read the article

  • WCF hosted in a Web application and compatibility mode

    - by DotnetDude
    I have a WCF service hosted in a web application (IIS). I need to expose 1 end point over wsHttp and the other over netTcp. I am on a IIS7 environment that makes it possible for me to host non HTTP based services. Anyways, when I browse the .svc file using a browser, I get the error: The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application By googling, I realized that WCF runs in two modes - Mixed and ASP.NET compatible. When I apply the attribute [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] However, it appears that once I apply this attribute to the Service Contract implementation, I cannot use a non HTTP binding. How do I set it up so that: I can support non HTTP endpoints I can host the service on a Web app I don't create multiple services one with aspnet compatibility turned on and the other turned off

    Read the article

  • Help Required on track active directory changes

    - by Faiasl Iqbal
    I am going to write a small software to track active directory changes. I need an expert opinion from you. I want to display information about What ( with before and after values), When, Where and Who of any change in AD. I am going to implement this by one of the following way 1. Change Notification Control 2. DirSync Control Both of these method give us the attribute that are changed and we can compare new values with some dump in SQL Server to get old values. My problem is how can I find “Who” has made this change. I have tried but there is no attribute “LastModifiedBy” in active directory. Please give your opinion how can I track who has made this change. --Faisal Iqbal

    Read the article

  • What causes this retainAll exception?

    - by Joren
    java.lang.UnsupportedOperationException: This operation is not supported on Query Results at org.datanucleus.store.query.AbstractQueryResult.contains(AbstractQueryResult.java:250) at java.util.AbstractCollection.retainAll(AbstractCollection.java:369) at namespace.MyServlet.doGet(MyServlet.java:101) I'm attempting to take one list I retrieved from a datastore query, and keep only the results which are also in a list I retrieved from a list of keys. Both my lists are populated as expected, but I can't seem to user retainAll on either one of them. // List<Data> listOne = new ArrayList(query.execute(theQuery)); // DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); // List<Data> listTwo = new ArrayList(ds.get(keys).values()); // listOne.retainAll(listTwo);

    Read the article

  • EF4 CTP5 Code First approach ignores Table attributes

    - by Justin
    I'm using EF4 CTP5 code first approach but am having trouble getting it to work. I have a class called "Company" and a database table called "CompanyTable". I want to map the Company class to the CompanyTable table, so have code like this: [Table(Name = "CompanyTable")] public class Company { [Key] [Column(Name = "CompanyIdNumber", DbType = "int")] public int CompanyNumber { get; set; } [Column(Name = "CompanyName", DbType = "varchar")] public string CompanyName { get; set; } } I then call it like so: var db = new Users(); var companies = (from c in db.Companies select c).ToList(); However it errors out: Invalid object name 'dbo.Companies'. It's obviously not respecting the Table attribute on the class, even though it says here that Table attribute is supported. Also it's pluralizing the name it's searching for (Companies instead of Company.) How do I map the class to the table name?

    Read the article

  • undefined reference to function, despite giving reference in c

    - by Jamie Edwards
    I'm following a tutorial, but when it comes to compiling and linking the code I get the following error: /tmp/cc8gRrVZ.o: In function `main': main.c:(.text+0xa): undefined reference to `monitor_clear' main.c:(.text+0x16): undefined reference to `monitor_write' collect2: ld returned 1 exit status make: *** [obj/main.o] Error 1 What that is telling me is that I haven't defined both 'monitor_clear' and 'monitor_write'. But I have, in both the header and source files. They are as follows: monitor.c: // monitor.c -- Defines functions for writing to the monitor. // heavily based on Bran's kernel development tutorials, // but rewritten for JamesM's kernel tutorials. #include "monitor.h" // The VGA framebuffer starts at 0xB8000. u16int *video_memory = (u16int *)0xB8000; // Stores the cursor position. u8int cursor_x = 0; u8int cursor_y = 0; // Updates the hardware cursor. static void move_cursor() { // The screen is 80 characters wide... u16int cursorLocation = cursor_y * 80 + cursor_x; outb(0x3D4, 14); // Tell the VGA board we are setting the high cursor byte. outb(0x3D5, cursorLocation >> 8); // Send the high cursor byte. outb(0x3D4, 15); // Tell the VGA board we are setting the low cursor byte. outb(0x3D5, cursorLocation); // Send the low cursor byte. } // Scrolls the text on the screen up by one line. static void scroll() { // Get a space character with the default colour attributes. u8int attributeByte = (0 /*black*/ << 4) | (15 /*white*/ & 0x0F); u16int blank = 0x20 /* space */ | (attributeByte << 8); // Row 25 is the end, this means we need to scroll up if(cursor_y >= 25) { // Move the current text chunk that makes up the screen // back in the buffer by a line int i; for (i = 0*80; i < 24*80; i++) { video_memory[i] = video_memory[i+80]; } // The last line should now be blank. Do this by writing // 80 spaces to it. for (i = 24*80; i < 25*80; i++) { video_memory[i] = blank; } // The cursor should now be on the last line. cursor_y = 24; } } // Writes a single character out to the screen. void monitor_put(char c) { // The background colour is black (0), the foreground is white (15). u8int backColour = 0; u8int foreColour = 15; // The attribute byte is made up of two nibbles - the lower being the // foreground colour, and the upper the background colour. u8int attributeByte = (backColour << 4) | (foreColour & 0x0F); // The attribute byte is the top 8 bits of the word we have to send to the // VGA board. u16int attribute = attributeByte << 8; u16int *location; // Handle a backspace, by moving the cursor back one space if (c == 0x08 && cursor_x) { cursor_x--; } // Handle a tab by increasing the cursor's X, but only to a point // where it is divisible by 8. else if (c == 0x09) { cursor_x = (cursor_x+8) & ~(8-1); } // Handle carriage return else if (c == '\r') { cursor_x = 0; } // Handle newline by moving cursor back to left and increasing the row else if (c == '\n') { cursor_x = 0; cursor_y++; } // Handle any other printable character. else if(c >= ' ') { location = video_memory + (cursor_y*80 + cursor_x); *location = c | attribute; cursor_x++; } // Check if we need to insert a new line because we have reached the end // of the screen. if (cursor_x >= 80) { cursor_x = 0; cursor_y ++; } // Scroll the screen if needed. scroll(); // Move the hardware cursor. move_cursor(); } // Clears the screen, by copying lots of spaces to the framebuffer. void monitor_clear() { // Make an attribute byte for the default colours u8int attributeByte = (0 /*black*/ << 4) | (15 /*white*/ & 0x0F); u16int blank = 0x20 /* space */ | (attributeByte << 8); int i; for (i = 0; i < 80*25; i++) { video_memory[i] = blank; } // Move the hardware cursor back to the start. cursor_x = 0; cursor_y = 0; move_cursor(); } // Outputs a null-terminated ASCII string to the monitor. void monitor_write(char *c) { int i = 0; while (c[i]) { monitor_put(c[i++]); } } void monitor_write_hex(u32int n) { s32int tmp; monitor_write("0x"); char noZeroes = 1; int i; for (i = 28; i > 0; i -= 4) { tmp = (n >> i) & 0xF; if (tmp == 0 && noZeroes != 0) { continue; } if (tmp >= 0xA) { noZeroes = 0; monitor_put (tmp-0xA+'a' ); } else { noZeroes = 0; monitor_put( tmp+'0' ); } } tmp = n & 0xF; if (tmp >= 0xA) { monitor_put (tmp-0xA+'a'); } else { monitor_put (tmp+'0'); } } void monitor_write_dec(u32int n) { if (n == 0) { monitor_put('0'); return; } s32int acc = n; char c[32]; int i = 0; while (acc > 0) { c[i] = '0' + acc%10; acc /= 10; i++; } c[i] = 0; char c2[32]; c2[i--] = 0; int j = 0; while(i >= 0) { c2[i--] = c[j++]; } monitor_write(c2); } monitor.h: // monitor.h -- Defines the interface for monitor.h // From JamesM's kernel development tutorials. #ifndef MONITOR_H #define MONITOR_H #include "common.h" // Write a single character out to the screen. void monitor_put(char c); // Clear the screen to all black. void monitor_clear(); // Output a null-terminated ASCII string to the monitor. void monitor_write(char *c); #endif // MONITOR_H common.c: // common.c -- Defines some global functions. // From JamesM's kernel development tutorials. #include "common.h" // Write a byte out to the specified port. void outb ( u16int port, u8int value ) { asm volatile ( "outb %1, %0" : : "dN" ( port ), "a" ( value ) ); } u8int inb ( u16int port ) { u8int ret; asm volatile ( "inb %1, %0" : "=a" ( ret ) : "dN" ( port ) ); return ret; } u16int inw ( u16int port ) { u16int ret; asm volatile ( "inw %1, %0" : "=a" ( ret ) : "dN" ( port ) ); return ret; } // Copy len bytes from src to dest. void memcpy(u8int *dest, const u8int *src, u32int len) { const u8int *sp = ( const u8int * ) src; u8int *dp = ( u8int * ) dest; for ( ; len != 0; len-- ) *dp++ =*sp++; } // Write len copies of val into dest. void memset(u8int *dest, u8int val, u32int len) { u8int *temp = ( u8int * ) dest; for ( ; len != 0; len-- ) *temp++ = val; } // Compare two strings. Should return -1 if // str1 < str2, 0 if they are equal or 1 otherwise. int strcmp(char *str1, char *str2) { int i = 0; int failed = 0; while ( str1[i] != '\0' && str2[i] != '\0' ) { if ( str1[i] != str2[i] ) { failed = 1; break; } i++; } // Why did the loop exit? if ( ( str1[i] == '\0' && str2[i] != '\0' || (str1[i] != '\0' && str2[i] =='\0' ) ) failed =1; return failed; } // Copy the NULL-terminated string src into dest, and // return dest. char *strcpy(char *dest, const char *src) { do { *dest++ = *src++; } while ( *src != 0 ); } // Concatenate the NULL-terminated string src onto // the end of dest, and return dest. char *strcat(char *dest, const char *src) { while ( *dest != 0 ) { *dest = *dest++; } do { *dest++ = *src++; } while ( *src != 0 ); return dest; } common.h: // common.h -- Defines typedefs and some global functions. // From JamesM's kernel development tutorials. #ifndef COMMON_H #define COMMON_H // Some nice typedefs, to standardise sizes across platforms. // These typedefs are written for 32-bit x86. typedef unsigned int u32int; typedef int s32int; typedef unsigned short u16int; typedef short s16int; typedef unsigned char u8int; typedef char s8int; void outb ( u16int port, u8int value ); u8int inb ( u16int port ); u16int inw ( u16int port ); #endif //COMMON_H main.c: // main.c -- Defines the C-code kernel entry point, calls initialisation routines. // Made for JamesM's tutorials <www.jamesmolloy.co.uk> #include "monitor.h" int main(struct multiboot *mboot_ptr) { monitor_clear(); monitor_write ( "hello, world!" ); return 0; } here is my makefile: C_SOURCES= main.c monitor.c common.c S_SOURCES= boot.s C_OBJECTS=$(patsubst %.c, obj/%.o, $(C_SOURCES)) S_OBJECTS=$(patsubst %.s, obj/%.o, $(S_SOURCES)) CFLAGS=-nostdlib -nostdinc -fno-builtin -fno-stack-protector -m32 -Iheaders LDFLAGS=-Tlink.ld -melf_i386 --oformat=elf32-i386 ASFLAGS=-felf all: kern/kernel .PHONY: clean clean: -rm -f kern/kernel kern/kernel: $(S_OBJECTS) $(C_OBJECTS) ld $(LDFLAGS) -o $@ $^ $(C_OBJECTS): obj/%.o : %.c gcc $(CFLAGS) $< -o $@ vpath %.c source $(S_OBJECTS): obj/%.o : %.s nasm $(ASFLAGS) $< -o $@ vpath %.s asem Hopefully this will help you understand what is going wrong and how to fix it :L Thanks in advance. Jamie.

    Read the article

  • How can I sort a Perl array of array of hashes?

    - by srk
    @aoaoh; $aoaoh[0][0]{21} = 31; $aoaoh[0][0]{22} = 31; $aoaoh[0][0]{23} = 17; for $k (0 .. $#aoaoh) { for $i(0.. $#aoaoh) { for $val (keys %{$aoaoh[$i][$k]}) { print "$val=$aoaoh[$i][$k]{$val}\n"; } } } The output is: 22=31 21=31 23=17 but i expect it to be 21=31 22=31 23=17 Please tell me where is this wrong. Also how do I sort the values so that i get the output as 23=17 22=31 21=31 (if 2 keys have same value then key with higher value come first)

    Read the article

  • Define variable in variable/parameter and use in javascript?

    - by Ross
    I want to defined a variable/parameter in CSS and access it by javascript. What is the best way of doing this? One option I thought of would be to place a cutsom attribute on the body element, then access that attribute via jQuery. A little more info: I'm defining colour sets in CSS. I've created a function with RaphaelJS to draw a gradient background on the page. I want this function to use a highlight colour (which is not used elsewhere on the DOM) which will be defined in the CSS along with the other colour elements. Thanks

    Read the article

  • Sum value of XML attributes using PowerShell 2.0

    - by Yooakim
    I have a directory with XML files. I quickly want to go through them and sum upp the value stored in one attribute. I have figured out how to fidn the nodes I am interested in. For example: (Select-Xml -Path .\*.xml -XPath "//*[@Attribue = 'valueImlookingfor']").Count This command gives me the count of elements in all of the XML files in the current directory which has the value "valueImlookingfor" in the "Attribue". I want to sum up all the values of the "Attribute", not count them. What would be the best way to do this in PowerShell? I am new to PowerShell so this may be trivial but un-known to me... All tips are much appreciated :-)

    Read the article

  • Lucene.Net memory consumption and slow search when too many clauses used

    - by Umer
    I have a DB having text file attributes and text file primary key IDs and indexed around 1 million text files along with their IDs (primary keys in DB). Now, I am searching at two levels. First is straight forward DB search, where i get primary keys as result (roughly 2 or 3 million IDs) Then i make a Boolean query for instance as following +Text:"test*" +(pkID:1 pkID:4 pkID:100 pkID:115 pkID:1041 .... ) and search it in my Index file. The problem is that such query (having 2 million clauses) takes toooooo much time to give result and consumes reallly too much memory.... Is there any optimization solution for this problem ?

    Read the article

  • Redirect away from HTTPS with ASP.NET MVC App

    - by Amadiere
    I'm using ASP.NET MVC 2 and have a login page that is secured via HTTPS. To ensure that the user always accesses those pages via SSL, I've added the attribute [RequiresHttps] to the controller. This does the job perfectly. When they have successfully logged in, I'd like to redirect them back to HTTP version. However, there isn't a [RequiresHttp] attribute and I'm struggling to get my head around how I might achieve this. The added (potential) complication is that the website when in production is hosted at the route of the domain, but for development and testing purposes it is within a sub directory / virtual directory / application. Am I over-thinking this and is there an easy solution staring me in the face? Or is it a little more complex?

    Read the article

  • Android Market Publishing Issues

    - by Steve
    I have an app which I have just updated to froyo to take advantage of the move to SD card feature. I am now trying to upload the update to the market but I keep getting the following error: "The file is invalid: W/ResourceType( 7193): Bad string block: last string is not 0- terminated ERROR getting 'android:label' attribute: attribute is not a string value". I changed the value in the manifest from "android:label="@string/app_name" " to "android:label="test" " and uploaded it, then it started complaining about the icon, saying that it wasn't a string. Anyone have any ideas? The application part of my manifest is shown below and I'm properly confused. The app compiles into an APK, it even installs and runs fine on my N1 (installing from SD card) it just won't upload to the market. Any help would be greatly appreciated, I have absolutely no idea what's wrong, seems like I've tried everything I can think of including re-installing eclipse. Cheers Steve

    Read the article

  • Difference between C++ Keyboard keycode and JAVA KeyEvent keycode

    - by Auxiliary
    I noticed a difference between the keycodes that vkCode in C++ gives and the ones that Java's KeyEvent gives us. (Ofcourse the normal characters have the same code (0 = 48 just like the ASCII) but they differ in the other keys). Is there a way to 'translate' them from one to the other (What's the logic behind each one?) or am I supposed to use loads of switches and IFs for that. If it helps, my app is half in C++ and half in JAVA because of the Native Hooks that c++ gives us and it gets the keycodes of the keys that the user presses and then the java is going to use them. Thanks in advance.

    Read the article

  • CSS [custom?] attributes

    - by Michael
    radio[pane] { list-style-image: url("jar:resource:///chrome/classic.jar! /skin/classic/browser/preferences/Options.png"); } radio[pane="prefpane-appearance"] { -moz-image-region: rect(0px, 32px, 32px, 0px); } radio[pane="prefpane-appearance"]:hover, radio[pane="prefpane-appearance"][selected="true"] { -moz-image-region: rect(32px, 32px, 64px, 0px); } Can anyone explain a syntax of this css, particularly what is pane.. I couldn't find such attribute for radio element in context of XUL. So I guess it's some custom attribute? If it is, then how it is evolving through the lines, first declaration, then several assignments? It has also selected, which means can have multiple custom attributes? How can those attributes be used later?

    Read the article

  • [Java] Implement a RSA algorithm

    - by Robin Monjo
    Hello everyone. I want to implement a RSA algorithm to encrypt an image (byte[]). To generate my two keys I used this piece of code : KeyPairGenerator keygen = KeyPairGenerator.getInstance("RSA"); keygen.initialize(512); keyPair = keygen.generateKeyPair(); Once public and private key are generated, I would like to show them to the user so he can distribute the public key and use the private key to decode. How can I get back those key ? Using keygen.getPrivateKey() and keygen.getPublicKey() give me all the information of the RSA algorithm, not only the keys I need. Thanks

    Read the article

  • Error Serializing a CLR object for use in a WCF service

    - by user208662
    Hello, I have written a custom exception object. The reason for this is I want to track additional information when an error occurs. My CLR object is defined as follows: public class MyException : Exception { public override string StackTrace { get { return base.StackTrace; } } private readonly string stackTrace; public override string Message { get { return base.Message; } } private readonly string message; public string Element { get { return element; } } private readonly string element; public string ErrorType { get { return errorType; } } private readonly string errorType; public string Misc { get { return misc; } } private readonly string misc; #endregion Properties #region Constructors public MyException() {} public MyException(string message) : base(message) { } public MyException(string message, Exception inner) : base(message, inner) { } public MyException(string message, string stackTrace) : base() { this.message = message; this.stackTrace = stackTrace; } public MyException(string message, string stackTrace, string element, string errorType, string misc) : base() { this.message = message; this.stackTrace = stackTrace; this.element = element; this.errorType = errorType; this.misc = misc; } protected MyException(SerializationInfo info, StreamingContext context) : base(info, context) { element = info.GetString("element"); errorType = info.GetString("errorType"); misc = info.GetString("misc"); } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("element", element); info.AddValue("errorType", errorType); info.AddValue("misc", misc); } } I have created a copy of this custom xception in a WP7 application. The only difference is, I do not have the GetObjectData method defined or the constructor with SerializationInfo defined. If I run the application as is, I receive an error that says: Type 'My.MyException' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. If I add the DataContract / DataMember attributes to the class and its appropriate members on the server-side, I receive an error that says: Type cannot be ISerializable and have DataContractAttribute attribute. How do I serialize MyException so that I can pass an instance of it to my WCF service. Please note, I want to use my service from an Android app. Because of this, I don't want to do anything too Microsoft centric. That was my fear with DataContract / DataMember stuff. Thank you so much for your help!

    Read the article

  • How do I name an array key with a key inside the array

    - by Confused
    I have some data, yes, data. This data came from a MySQL query and it will always contain 4 items, always. I want to cache that data in an array table for use later within a web page but I want to keep the keys from the query and separate out each grouping within a multidimensional array. However to save time iterating through the array each time I want to find a given group of data, I want to call the keys of the first array the same as the ID key which is always the first key within each four items. At the minute I'm using this code: function mysql_fetch_full_result_array($result) { $table_result=array(); $r=0; while($row = mysql_fetch_assoc($result)){ $arr_row=array(); $c=0; while ($c < mysql_num_fields($result)) { $col = mysql_fetch_field($result, $c); $arr_row[$col -> name] = $row[$col -> name]; $c++; } $table_result[$r] = $arr_row; $r++; } return $table_result; } I'm currently testing this using 3 unique users, so I'm getting three rows back from the query and the data from this function ends up in the format: [0]=> . . [id] => 1 . . [name] => random name . . [tel] => random tel . . [post] => post code data [1]=> . . [id] => 34 . . [name] => random name . . [tel] => random tel . . [post] => post code data [2]=> . . [id] => 56 . . [name] => random name . . [tel] => random tel . . [post] => post code data So how do I alter the code to instead of the keys [0], [1], [2] give me the output: [1]=> . . [id] => 1 . . [name] => random name . . [tel] => random tel . . [post] => post code data [34]=> . . [id] => 34 . . [name] => random name . . [tel] => random tel . . [post] => post code data [56]=> . . [id] => 56 . . [name] => random name . . [tel] => random tel . . [post] => post code data I don't mind if the main array keys are strings of numbers rather than numbers but I'm a bit stuck, I tried changing the $table_result[$r] = $arr_row; part to read $table_result[$result['id']] = $arr_row; but that just outputs an array of one person. I know I need another loop but I'm struggling to work out how to write it.

    Read the article

  • Is there any benefit to encrypting twice using pgp?

    - by ojblass
    I am asking from a "more secure" perspective. I can imagine a scenario with two required private keys needed for decryption scenarios that may make this an attractive model. This is to settle an argument. My vote is that it is not adding any additional security other than having to compromise two different private keys. I think that if it was any more secure than encrypting it one million times would be the best way to secure informaiton and I don't buy it. So I guess my question becomes is a two locking mechanism equivalent to another one locking mechanism with a single key? Update: Forgive me if the answer is obvious but my bread goes dead as I read books on the topic.

    Read the article

  • Design for tagging system in GAE-J

    - by tempy
    I need a simple tagging system in GAE-J. As I see it, the entity that is being tagged should have a collection of keys referring to the tags with which it's associated. A tag entity should simply contain the tag string itself, and a collection of keys pointing to the entities associated with the tag. When an entity's list of tags is altered, the system will create a new tag if the tag is unknown, and then append the entity's key to that tag's key collection. If the tag already exists, then the entity's key is simply appended to the tag's key collection. This seems relatively straight-forward and uncontroversial to me, but I would like some feedback on this design, just to be sure.

    Read the article

  • Rails - How do i update a records value in a join model ?

    - by ChrisWesAllen
    I have a join model in a HABTM relationship with a through association (details below). I 'm trying to find a record....find the value of that records attribute...change the value and update the record but am having a hard time doing it. The model setup is this User.rb has_many :choices has_many :interests, :through => :choices Interest.rb has_many :choices has_many :users, :through => :choices Choice.rb belongs_to :user belongs_to :interest and Choice has the user_id, interest_id, score as fields. And I find the ?object? like so @choice = Choice.where(:user_id => @user.id, :interest_id => interest.id) So the model Choice has an attribute called :score. How do I find the value of the score column....and +1/-1 it and then resave? I tried @choice.score = @choice.score + 1 @choice.update_attributes(params[:choice]) flash[:notice] = "Successfully updated choices value." but I get "undefined method score"......What did i miss?

    Read the article

  • How do I combine MVCContrib's "Rescue" with Elmah?

    - by Chris
    I got the Rescue attribute working. It properly serves up the DefaultError view when there is an unhandled exception. However, these exceptions will not get logged or emailed. This SO question is answered by Atif Aziz and it looks pretty solid, but it applies to the built-in HandleErrorAttribute, which Rescue replaces, right? How do I get that to work with Rescue? I want to make sure that if an unhandled exception arises, that the user gets served up the view specified with the Rescue attribute, but the exception is still properly logged, and viewable with elmah.axd.

    Read the article

  • SQL: join within same table with different 'where' clause

    - by Pmarcoen
    Ok, so the problem I'm facing is this, I have a table with 3 columns : ID, Key and Value. ID | Key | Value ================ 1 | 1 | ab 1 | 2 | cd 1 | 3 | ef 2 | 1 | gh 2 | 2 | ij 2 | 3 | kl Now I want to select the value of Keys 1 & 3 for all IDs, the return should be like this ID | 1 | 2 ================ 1 | ab | ef 2 | gh | kl So per ID 1 row containing the Values for Keys 1 & 3. I tried using 'join' but since I need to use multiple where clauses I can't figure out how to get this to work ..

    Read the article

  • How to modify my Response.Document XSD for getting author name form Sharepoint

    - by Rohan Patil
    Hi, This is my XSD currently <?xml version="1.0" encoding="Windows-1252"?> <xsd:schema xmlns:tns="urn:Microsoft.Search.Response.Document" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:Microsoft.Search.Response.Document" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:import namespace="urn:Microsoft.Search.Response.Document.Document" schemaLocation="Microsoft.Search.Response.Document.Document.xsd" /> <xsd:annotation> <xsd:documentation> </xsd:documentation> <xsd:documentation> Defines a Query Respnose from a Windows SharePoint Services 3.0 Query Service. </xsd:documentation> </xsd:annotation> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- Root Element: Document --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - --> <xsd:element name="Document"> <xsd:complexType> <xsd:sequence> <xsd:element name="Title" type="xsd:string" minOccurs="0" /> <xsd:element name="Action"> <xsd:complexType> <xsd:sequence> <xsd:element name="LinkUrl"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="size" type="xsd:unsignedByte" use="optional" /> <xsd:attribute name="fileExt" type="xsd:string" use="required" /> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Description" type="xsd:string" minOccurs="0" /> <xsd:element name="Date" type="xsd:dateTime" minOccurs="0" /> <xsd:element xmlns:q1="urn:Microsoft.Search.Response.Document.Document" ref="q1:Properties" minOccurs="0" /> </xsd:sequence> <xsd:attribute name="relevance" type="xsd:unsignedByte" use="optional" /> </xsd:complexType> </xsd:element> </xsd:schema> I want to able to get the author name.. Please help..

    Read the article

< Previous Page | 147 148 149 150 151 152 153 154 155 156 157 158  | Next Page >