Search Results

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

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

  • EF4 Code First Control Unicode and Decimal Precision, Scale with Attributes

    - by Dane Morgridge
    There are several attributes available when using code first with the Entity Framework 4 CTP5 Code First option.  When working with strings you can use [MaxLength(length)] to control the length and [Required] will work on all properties.  But there are a few things missing. By default all string will be created using unicode so you will get nvarchar instead of varchar.  You can change this using the fluent API or you can create an attribute to make the change.  If you have a lot of properties, the attribute will be much easier and require less code. You will need to add two classes to your project to create the attribute itself: 1: public class UnicodeAttribute : Attribute 2: { 3: bool _isUnicode; 4:  5: public UnicodeAttribute(bool isUnicode) 6: { 7: _isUnicode = isUnicode; 8: } 9:  10: public bool IsUnicode { get { return _isUnicode; } } 11: } 12:  13: public class UnicodeAttributeConvention : AttributeConfigurationConvention<PropertyInfo, StringPropertyConfiguration, UnicodeAttribute> 14: { 15: public override void Apply(PropertyInfo memberInfo, StringPropertyConfiguration configuration, UnicodeAttribute attribute) 16: { 17: configuration.IsUnicode = attribute.IsUnicode; 18: } 19: } The UnicodeAttribue class gives you a [Unicode] attribute that you can use on your properties and the UnicodeAttributeConvention will tell EF how to handle the attribute. You will need to add a line to the OnModelCreating method inside your context for EF to recognize the attribute: 1: protected override void OnModelCreating(System.Data.Entity.ModelConfiguration.ModelBuilder modelBuilder) 2: { 3: modelBuilder.Conventions.Add(new UnicodeAttributeConvention()); 4: base.OnModelCreating(modelBuilder); 5: } Once you have this done, you can use the attribute in your classes to make sure that you get database types of varchar instead of nvarchar: 1: [Unicode(false)] 2: public string Name { get; set; }   Another option that is missing is the ability to set the precision and scale on a decimal.  By default decimals get created as (18,0).  If you need decimals to be something like (9,2) then you can once again use the fluent API or create a custom attribute.  As with the unicode attribute, you will need to add two classes to your project: 1: public class DecimalPrecisionAttribute : Attribute 2: { 3: int _precision; 4: private int _scale; 5:  6: public DecimalPrecisionAttribute(int precision, int scale) 7: { 8: _precision = precision; 9: _scale = scale; 10: } 11:  12: public int Precision { get { return _precision; } } 13: public int Scale { get { return _scale; } } 14: } 15:  16: public class DecimalPrecisionAttributeConvention : AttributeConfigurationConvention<PropertyInfo, DecimalPropertyConfiguration, DecimalPrecisionAttribute> 17: { 18: public override void Apply(PropertyInfo memberInfo, DecimalPropertyConfiguration configuration, DecimalPrecisionAttribute attribute) 19: { 20: configuration.Precision = Convert.ToByte(attribute.Precision); 21: configuration.Scale = Convert.ToByte(attribute.Scale); 22:  23: } 24: } Add your line to the OnModelCreating: 1: protected override void OnModelCreating(System.Data.Entity.ModelConfiguration.ModelBuilder modelBuilder) 2: { 3: modelBuilder.Conventions.Add(new UnicodeAttributeConvention()); 4: modelBuilder.Conventions.Add(new DecimalPrecisionAttributeConvention()); 5: base.OnModelCreating(modelBuilder); 6: } Now you can use the following on your properties: 1: [DecimalPrecision(9,2)] 2: public decimal Cost { get; set; } Both these options use the same concepts so if there are other attributes that you want to use, you can create them quite simply.  The key to it all is the PropertyConfiguration classes.   If there is a class for the datatype, then you should be able to write an attribute to set almost everything you need.  You could also create a single attribute to encapsulate all of the possible string combinations instead of having multiple attributes on each property. All in all, I am loving code first and having attributes to control database generation instead of using the fluent API is huge and saves me a great deal of time.

    Read the article

  • SQL Server 2008 R2: StreamInsight changes at RTM: Access to grouping keys via explicit typing

    - by Greg Low
    One of the problems that existed in the CTP3 edition of StreamInsight was an error that occurred if you tried to access the grouping key from within your projection expression. That was a real issue as you always need access to the key. It's a bit like using a GROUP BY in TSQL and then not including the columns you're grouping by in the SELECT clause. You'd see the results but not be able to know which results are which. Look at the following code: var laneSpeeds = from e in vehicleSpeeds group e...(read more)

    Read the article

  • Detecting long held keys on keyboard

    - by Robinson Joaquin
    I just want to ask if can I check for "KEY"(keyboard) that is HOLD/PRESSED for a long time, because I am to create a clone of breakout with air hockey for 2 different human players. Here's the list of my concern: Do I need other/ 3rd party library for KEY HOLDS? Is multi-threading needed? I don't know anything about this multi-threading stuff and I don't think about using one(I'm just a NEWBIE). One more thing, what if the two players pressed their respective key at the same time, how can I program to avoid error or worse one player's key is prioritized first before the the key of the other. example: Player 1 = W for UP & S for DOWN Player 2 = O for UP & L for DOWN (example: W & L is pressed at the same time) PS: I use GLUT for the visuals of the game.

    Read the article

  • Cannot assign keys to Wacom scroll wheel anymore

    - by UncleZeiv
    Hi all, my Wacom Graphire 4 used to work perfectly well until, I think, Ubuntu 10.4. At that point something changed in the configuration and I couldn't assign a key to the scroll wheel anymore (note: the pad's scroll wheel, not the mouse's), i.e this command: xsetwacom set "Wacom Graphire4 6x8 pad" AbsWDn "key +" returns silently without error but nothing happens. Same goes for AbsWUp, RelWDn, RelWUp. Apparently though the problem is even deeper as pressing the wheel in a xev window doesn't seem to have any effect. Moreover I am thoroughly confused on how the various pieces (kernel driver, xorg driver, evdev, HAL, xinput?) are supposed to work together and if the wacom module that ships with Ubuntu is the one from linuxwacom or not. Any ideas? I don't want to become an X.org hacker just to understand what's going on... it used to work! NOTE: I have already read question 3940, but that's not the same problem.

    Read the article

  • Powershell Active Directory Account Attribute to a variable

    - by Bill Garrett
    Sorry for the newbie question. I am using Powershell 3 to get a list of all user accounts. I am trying to generate an output for accounts, either "Enabled" or "Disabled". I am able to get the account status code from active directory using: $rc = $Rech.PropertiesToLoad.Add("userAccountControl"); That will display the correct account status code. When I try to use an if statement on the value, I dont get any result. How do I put this value into a variable to use some logic with it? In the end, my requirements are to have the output to an CSV file that I can send to HR and have them examin it and instead of a code I would like to have it say "Enabled" or "Disabled". Thank you.

    Read the article

  • Fixing Two keys events on single key press by xmodmap

    - by William.Ebe
    I'm using Dell Latitude D620. Whenever, I'm pressing the space key, the down arrow key also triggered perform it's action. Here is the log: KeyPress event, serial 30, synthetic NO, window 0x3200001, root 0x10c, subw 0x0, time 2248017, (70,-9), root:(76,39), state 0x0, keycode 116 (keysym 0xff54, Down), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyPress event, serial 31, synthetic NO, window 0x3200001, root 0x10c, subw 0x0, time 2248018, (70,-9), root:(76,39), state 0x0, keycode 65 (keysym 0x20, space), same_screen YES, XLookupString gives 1 bytes: (20) " " XmbLookupString gives 1 bytes: (20) " " XFilterEvent returns: False KeyRelease event, serial 33, synthetic NO, window 0x3200001, root 0x10c, subw 0x0, time 2248083, (70,-9), root:(76,39), state 0x0, keycode 65 (keysym 0x20, space), same_screen YES, XLookupString gives 1 bytes: (20) " " XFilterEvent returns: False KeyRelease event, serial 33, synthetic NO, window 0x3200001, root 0x10c, subw 0x0, time 2248085, (70,-9), root:(76,39), state 0x0, keycode 116 (keysym 0xff54, Down), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False ClientMessage event, serial 33, synthetic YES, window 0x3200001, message_type 0x157 (WM_PROTOCOLS), format 32, message 0x155 (WM_DELETE_WINDOW) The above log is for a single press+release of spacebar key. I would like to know how to fix that. Thanks. PS: I'm using the same laptop to post question. If somebody helps to align it into code format, it would be helpful as I can't do that with this keyboard properly.

    Read the article

  • Two Simple Keys to SEO Success - Take Care of the Basics and Forget About Algorithm-Chasing

    Search engine optimization (SEO) is critical to the success of any website because it helps to improve a website's visibility in the natural search results - the end result of which should be that the optimized website experiences a sustainable boost in search referral traffic. And yet in spite of the obvious importance of SEO, the reality is that the vast majority of websites have never been exposed to even a bare-minimum level of SEO effort, meaning that they are potentially forfeiting top rankings - and the traffic that top rankings virtually guarantee - to their competitors Why do so few people bother with SEO when it is so essential to a website's success?

    Read the article

  • there is no attribute "border"

    - by ptahiliani
    Sometimes we got this error message when we try to validate our asp.net website on w3c. To solve this error you need to write the PreRender event. Here is the complete event: Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender         imgBtnGo.Style.Remove(HtmlTextWriterStyle.BorderWidth)         imgBtnGo.Attributes.Remove("border") End Sub

    Read the article

  • Extracting meta tags attribute using wget [migrated]

    - by Amit
    I have a file having some URLs per line. I need to extract the "keywords" present in the tags i.e. if there is meta tag for "keywords" then i want to get "content" value for it. Example: if the web-page has this meta-tag then for that URL i want "wikipedia,encyclopedia" to be extracted. One approach is to download the web-page using "wget" and then parse it using some standard HTML parser. I was wondering is there any better way to do this without downloading the entire web-page.

    Read the article

  • TransformXml Task locks config file identified in Source attribute

    - by alexhildyard
    As background: the TransformXml MSBuild task is typically invoked in a custom build step to mark up a web.config file with per-environment configuration; its flexible directives offer highly granular control over the insertion, removal, substitution and transformation of existing configuration hierarchies. For those using the TransformXML task (typically in a Web Deployment Project) I raised an issue against Visual Studio 2010, in which the file handle on the input file was not released, meaning that following transformation the source file remained locked. As a result, the best way to transform a file was first to rename it, transform it, and then copy it back, leaving the "locked" file to be freed up later.I just heard today that this has now been resolved in Visual Studio 2012 RTM. That's good news, because Web Config Transformations offer a lot. An intelligent, automated build process will swap in the relevant transform(s), making it much easier to synthesise the Developer and Build server builds. This makes for a simpler and more exemplary build process, and with the tighter coupling comes a correspondingly quicker response to Developmental change.Oh, and don't forget -- it isn't just web.configs you can transform. You can transform app.configs, or indeed any XML file that honours the task's schema and hierarchical rules.

    Read the article

  • Three Keys to Good Keyword Selection

    Even though most novice webmasters recognize the importance of keyword research and selection in the SEO process, very few people actually attack the process in the right way. Finding the right keywords is about much more than finding often-searched terms related to your niche.

    Read the article

  • Working with Primary Keys and Generators - Quickstart with NHibernate (Part 4)

    - by BobPalmer
    In this NHibernate tutorial, I'll be digging into the ID tag and Generator classes.  I had originally planned on finishing up a series on relationships (parent/child, etc.) but felt this would be an interesting topic for folks, and I also wanted to start integrating some of the current NHibernate reference. Since this article also includes some reference sections (and since I have not had a chance to check for every possible parameter value), I used the current reference as a baseline, and would welcome any feedback or technical updates that I can incorporate. You can find the entire article up on Google Docs at this link: http://docs.google.com/Doc?id=dg3z7qxv_24f3ch2rf7 As always, feedback, suggestions, and technical corrections are greatly appreciated! Enjoy! - Bob

    Read the article

  • Spaces in type attribute for Behavior Extension Configuration Issues

    - by Shawn Cicoria
    If you’ve deployed your WCF Behavior Extension, and you get a Configuration Error, it might just be you’re lacking a space between your “Type” name and the “Assembly” name. You'll get the following error message: Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions So, if you’ve entered as below without <system.serviceModel> <extensions> <behaviorExtensions> <add name="appFabricE2E" type="Fabrikam.Services.AppFabricE2EBehaviorElement,Fabrikam.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/> </behaviorExtensions> </extensions> The following will work – notice the additional space between the Type name and the Assembly name: <system.serviceModel> <extensions> <behaviorExtensions> <add name="appFabricE2E" type="Fabrikam.Services.AppFabricE2EBehaviorElement,Fabrikam.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/> </behaviorExtensions> </extensions>

    Read the article

  • How to use multiple search keys?

    - by user32565
    I have a database wherein the files are named abcd100.00b, abcd101.00b, etc. I need a code where when the user enters abcd separate then 100 to 110, all the files with the name abcd and in the range 100 to 110 should get displayed now the following code can display only the first four characters. How do I implement this? <?php //capture search term and remove spaces at its both ends if the is any $searchTerm = trim($_GET['keyname']) ; //check whether the name parsed is empty if($searchTerm == "rinex_file") { echo "Enter name you are searching for."; exit(); } if($searchTerm == "rinex_file") { echo "Enter name you are searching for."; exit(); } //database connection info $host = "localhost"; //server $db = "rinex"; //database name $user = "m"; //dabases user name $pwd = "c"; //password //connecting to server and creating link to database $link = mysqli_connect($host, $user, $pwd, $db); //MYSQL search statement $query = "SELECT * FROM rinexo WHERE rinex_file LIKE '%$searchTerm%'"; $results = mysqli_query($link, $query) ; /* check whethere there were matching records in the table by counting the number of results returned */ if(mysqli_num_rows($results) >= 1){ echo '<table border="1"> <tr> <th>rinex version</th> <th>program</th> <th>date</th> <th>maker name</th> <th>maker number</th> <th>observer</th> <th>agency</th> <th>position_X_Y_Z</th> </tr>'; while($row = mysqli_fetch_array($results)){ echo '<tr> <td>'.$row['rinex_version'].'</td> <td>'.$row['pgm'].'</td> <td>'.$row['date'].'</td> <td>'.$row['marker_name'].'</td> <td>'.$row['marker_no'].'</td> <td>'.$row['observer'].'</td> <td>'.$row['agency'].'</td> <td>'.$row['position_X_Y_Z'].'</td> </tr>'; } echo '</table>'; }else{ echo "There was no matching record for the name " . $searchTerm; }

    Read the article

  • Compiz shortcut with two arrow keys

    - by l0b0
    The "Put" functionality of CompizConfig Settings Manager is great. I'd like to be able to move windows to the desktop corners by using Super+Down/Up+Left/Right for this; is that possible? Whenever I try to set something like that it is just reset to "Disabled". A workaround is of course to use the numeric pad, but I'd like to be able to do this on my EEE laptop as well without enabling and disabling NumLock all the time.

    Read the article

  • A critical look at sysfs attribute values

    <b>LWN.net:</b> " It isn't hard to find complaints that the code in the Linux kernel isn't being reviewed enough, or that we need more reviewers. The creation of tags like "Reviewed-by" for patches was in part an attempt to address this by giving more credit to reviewers and there by encouraging more people to get involved in that role."

    Read the article

  • Google Analytics recording event based on <a> title attribute

    - by rlsaj
    I am declaring: var title = (typeof(el.attr('title')) != 'undefined' ) ? el.attr('title') :""; and then have the following: else if (title.match(/^"Matching Content"\:/i)) { elEv.category = "Matching Content Click"; elEv.action = "click-Matching-Content"; elEv.label = href.replace(/^https?\:\/\//i, ''); elEv.non_i = true; elEv.loc = href; } However, using Google Analytics debugger this is not being recorded. Any suggestions? The complete function is: if (typeof jQuery != 'undefined') { jQuery(document).ready(function gLinkTracking($) { var filetypes = /\.(avi|csv|dat|dmg|doc.*|exe|flv|gif|jpg|mov|mp3|mp4|msi|pdf|png|ppt.*|rar|swf|txt|wav|wma|wmv|xls.*|zip)$/i; var baseHref = ''; if (jQuery('base').attr('href') != undefined) baseHref = jQuery('base').attr('href'); jQuery('a').on('click', function (event) { var el = jQuery(this); var track = true; var href = (typeof(el.attr('href')) != 'undefined' ) ? el.attr('href') :""; var title = (typeof(el.attr('title')) != 'undefined' ) ? el.attr('title') :""; var isThisDomain = href.match(document.domain.split('.').reverse()[1] + '.' + document.domain.split('.').reverse()[0]); if (!href.match(/^javascript:/i)) { var elEv = []; elEv.value=0, elEv.non_i=false; if (href.match(/^mailto\:/i)) { elEv.category = "Email link"; elEv.action = "click-email"; elEv.label = href.replace(/^mailto\:/i, ''); elEv.loc = href; } else if (title.match(/^"Matching Content"\:/i)) { elEv.category = "Matching Content Click"; elEv.action = "click-Matching-Content"; elEv.label = href.replace(/^https?\:\/\//i, ''); elEv.non_i = true; elEv.loc = href; } else if (href.match(filetypes)) { var extension = (/[.]/.exec(href)) ? /[^.]+$/.exec(href) : undefined; elEv.category = "File Downloaded"; elEv.action = "click-" + extension[0]; elEv.label = href.replace(/ /g,"-"); elEv.loc = baseHref + href; } else if (href.match(/^https?\:/i) && !isThisDomain) { elEv.category = "External link"; elEv.action = "click-external"; elEv.label = href.replace(/^https?\:\/\//i, ''); elEv.non_i = true; elEv.loc = href; } else if (href.match(/^tel\:/i)) { elEv.category = "Telephone link"; elEv.action = "click-telephone"; elEv.label = href.replace(/^tel\:/i, ''); elEv.loc = href; } else track = false; if (track) { _gaq.push(['_trackEvent', elEv.category.toLowerCase(), elEv.action.toLowerCase(), elEv.label.toLowerCase(), elEv.value, elEv.non_i]); if ( el.attr('target') == undefined || el.attr('target').toLowerCase() != '_blank') { setTimeout(function() { location.href = elEv.loc; }, 400); return false; } } } }); }); }

    Read the article

  • Z-index preventing on hover attribute on another element [migrated]

    - by user18294
    I have two different elements (div class="") within a larger container. Let's call them div class="overlay_container" and div class="title." The div class="overlay_container" has a subclass, .image, which creates an overlay over the entire larger container on hover. The div class="title" has a z-index of 10,000 and lies over .image and therefore over the overlay. Unfortunately, when you hover over "title," the subclass overlay image underneath disappears. I know the problem is obviously that the "title" div is right over the other divs and therefore the on hover will disappear due to the z-index. But how do I fix this? How do I make it so that when you hover over the "title," the .image overlay still appears? If your answer involves jQuery, could you please tell me where to put the script (before the /head tag)? Thanks!

    Read the article

  • Application that provides unique keys to multiple threads

    - by poly
    Thanks all for your help before. So, this is what I came up with so far, the requirements are, application has two or more threads and each thread requires a unique session/transaction ID. is the below considered thread safe? thread 1 will register itself with get_id by sending it's pid thread 2 will do the same then thread 1 & 2 will call the function to get a unique ID function get_id(bool choice/*register thread or get id*/, pid_t pid) { static int pid[15][1]={0};//not sure if this work, anyway considor any it's been set to 0 by any other way than this static int total_threads = 0; static int i = 0; int x=0,y=0; if (choice) // thread registeration part { for(x=0;x<15;x++) { if (pid[x][0]==0); { pid[x][0] = (int) pid; pid[x][1] = (x & pidx[x][1]) << 24;//initiate counter for this PID by shifting x to the 25th bit, it could be any other bit, it's just to set a range. //so the range will be between 0x0000000 and 0x0ffffff, the second one will be 0x1000000 and 0x1ffffff, break; } total_threads++; } } //search if pid exist or not, if yes return transaction id for(x=0;x<15;x++) { if (pid[x][0]==pid); { pid[x][1]++;//put some test here to reset the number to 0 if it reaches 0x0ffffff return pid[x][1]; break; } } }

    Read the article

  • 5 Keys of Resource Box Optimization

    The whole point of writing and submitting articles to article directories [like this one] is so the reader, after reading your great informative article, will want to learn more by clicking on your links. This is the reason all of us use article marketing, so we can get them to click on our links at the end of the article. But how exactly can you get them to do that?

    Read the article

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