Search Results

Search found 254039 results on 10162 pages for 'overflow auto'.

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

  • ruby on rails implement search with auto complete

    - by user429400
    I've implemented a search box that searches the "Illnesses" table and the "symptoms" table in my DB. Now I want to add auto-complete to the search box. I've created a new controller called "auto_complete_controller" which returns the auto complete data. I'm just not sure how to combine the search functionality and the auto complete functionality: I want the "index" action in my search controller to return the search results, and the "index" action in my auto_complete controller to return the auto_complete data. Please guide me how to fix my html syntax and what to write in the js.coffee file. I'm using rails 3.x with the jquery UI for auto-complete, I prefer a server side solution, and this is my current code: main_page/index.html.erb: <p> <b>Syptoms / Illnesses</b> <%= form_tag search_path, :method => 'get' do %> <p> <%= text_field_tag :search, params[:search] %> <br/> <%= submit_tag "Search", :name => nil %> </p> <% end %> </p> auto_complete_controller.rb: class AutoCompleteController < ApplicationController def index @results = Illness.order(:name).where("name like ?", "%#{params[:term]}%") + Symptom.order(:name).where("name like ?", "%#{params[:term]}%") render json: @results.map(&:name) end end search_controller.rb: class SearchController < ApplicationController def index @results = Illness.search(params[:search]) + Symptom.search(params[:search]) respond_to do |format| format.html # index.html.erb format.json { render json: @results } end end end Thanks, Li

    Read the article

  • Multiplying char and int together in C part 2

    - by teehoo
    If I do the following: int c0 = CHAR_MAX; //8 bit int c1 = CHAR_MAX; //8-bit int i = c0*c1; //store in 32-bit variable printf("%d\n", i); //prints 16129 We can see that there is no problem with to 8-bit numbers being multiplied together, and producing a 32-bit output. However, if I do int i0 = INT_MAX; //32-bit int i1 = INT_MAX; //32 bit variable long long int ll = i0*i1; //store in 64-bit variable printf("%lld\n", ll); //prints 1..overflow!! In this case, two 32-bit variables were multiplied together, overflowed, and then were assigned to the 64-bit variable. So why did this overflow happen when multiplying the ints, but not the chars? Is it dependent on the default word-size of my machine? (32-bits)

    Read the article

  • Absolute positioned div not hidden.

    - by Cristy
    I have this <div id="container"> <div id="div1"></div> <div> Now, let's assume that: the "container" has a width of 300px the "container" has overflow: hidden; the "div1" has a width of 1000px; the "div1" is absolute positioned, top:0px,left:0px; The problem: The "div1" is not hidden, it overflows the "container" but it's still showing :(. If I simply remove the "position:absolute" it will work. How can I hide the overflow of "div1" ?

    Read the article

  • Bypass OpenID. Please give us a simple login form.

    - by Florin
    Can I kindly ask that we're allowed to login without the OpenID nonsense? This system is so popular that stack-overflow is the only place that I use it. If it is the policy of stack-overflow to prevent people to login, they've succeeded. I am a passive reader. For some reasons, I really don't like the idea of having one Id for all sites. To me, this system is dead in the water. Unless used within organizations I will never use it. Of course, until the government decides to reign us all in. Will you give them a hand? Until then, can we simply have a login form as in 1995? Thank you for your consideration.

    Read the article

  • Need help getting DIV inside DIV to stretch to width of contents in Firefox

    - by bj.
    I am using a layout similar to the one from Dynamic Drive here: http://www.dynamicdrive.com/style/layouts/item/css-right-frame-layout/ The main content area (white) has overflow set to auto. I have given the innerTube inside this main content area a border. However if the contents within this innerTube are greater than the width of the main content area, a horizontal scroll bar will appear as expected, but in Firefox these contents will 'overlap' the border and go off screen (can be retrieved by scrolling horizontally). In other words, the right hand border remains in place, and the content just goes over the op of it, and disappears behind the right hand column. In IE it behaves exactly as I want - the content pushes the border off screen to be visible only once you scroll over there. I guess the easiest thing is to paste the source code here. If you copy it into a blank file you'll see what I mean. I've just used one really long word to replicate what happens if a wide image is there instead. Thanks in advance to anyone who can help me out. <!--Force IE6 into quirks mode with this comment tag--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> body{ margin: 0; padding: 0; border: 0; overflow: hidden; height: 100%; max-height: 100%; } #framecontent{ position: absolute; top: 0; bottom: 0; right: 0; width: 200px; /*Width of frame div*/ height: 100%; overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/ background: #cccccc; color: white; } #maincontent{ position: fixed; top: 0; left: 0; right: 200px; /*Set right value to WidthOfFrameDiv*/ bottom: 0; overflow: auto; background: #fff; } .innertube{ margin: 15px; /*Margins for inner DIV inside each DIV (to provide padding)*/ } .innertubeWithBorder { margin: 15px; border: solid 1px #666666; } * html body{ /*IE6 hack*/ padding: 0 200px 0 0; /*Set value to (0 WidthOfFrameDiv 0 0)*/ } * html #maincontent{ /*IE6 hack*/ height: 100%; width: 100%; } </style> </head> <body> <div id="framecontent"> <div class="innertube"> <h1>CSS Right Frame Layout</h1> <h3>Sample text here</h3> </div> </div> <div id="maincontent"> <div class="innertubeWithBorder"> <h1>Dynamic Drive CSS Library</h1> <p>AReallyLongWordWhichIsSimilarToHavingAnImageWithWidthGreaterThanTheWidthOfThisDivToShowOverFlowProblemWithBorderSoIfYouResizeThisWindowNarrowerYouWillSeeWhatIMeanWorksFineInIEButNotFirefox</p> <p>So I want that border over there ------> to dissappear behind the right hand column like it does in IE, and be visible once you use the scrollbar below and scroll to the right</p> <p style="text-align: center">Credits: <a href="http://www.dynamicdrive.com/style/">Dynamic Drive CSS Library</a></p> </div> </div> </body> </html>

    Read the article

  • Is a safe accumulator really this complicated?

    - by Martin
    I'm trying to write an accumulator that is well behaved given unconstrained inputs. This seems to not be trivial and requires some pretty strict planning. Is it really this hard? int naive_accumulator(unsigned int max, unsigned int *accumulator, unsigned int amount) { if(*accumulator + amount >= max) return 1; // could overflow *accumulator += max; // could overflow return 0; } int safe_accumulator(unsigned int max, unsigned int *accumulator, unsigned int amount) { // if amount >= max, then certainly *accumulator + amount >= max if(amount >= max) { return 1; } // based on the comparison above, max - amount is defined // but *accumulator + amount might not be if(*accumulator >= max - amount) { return 1; } // based on the comparison above, *accumulator + amount is defined // and *accumulator + amount < max *accumulator += amount; return 0; }

    Read the article

  • Issue with css float -- Hindering IE6 from putting div in next line

    - by Bernhard V
    Hi, I've got an issue with floating divs in IE6. There's one navigation div on the left and one content div for the rest of the page. They've got the following css values: #navigation { float: left; width: 185px; padding-left: 5px; overflow: auto; height: 100%; } #content { overflow: auto; height: 100%; } In Firefox, IE8, Chrome and Opera, I get scrollbars for the content div when I resize the page to a size where both divs can't fit in as a whole. The navigation div stays in its place. And that is the desired behaviour. But in IE6, there are no scrollbars for the content div. Instead, when the page is getting too small, IE6 simply puts the content div under the navigation div. Do you know any way to hinder IE6 from this behaviour?

    Read the article

  • zsh auto-complete event designator

    - by simont
    (See my previous question for additional context). I'm migrating to zsh from bash, and using oh-my-zsh. When my zsh history looks something like the following: git status git add -A git commit I want to be able to re-run git add -A. To do that, I could use !?git add, which should: !?str[?] Refer to the most recent command containing str. The trailing ‘?’ is necessary if this reference is to be followed by a modifier or followed by any text that is not to be considered part of str. The link for zsh event designators is here. Unfortunately, I can't do this - as I'm typing !?git add, as I hit the ' ', it auto-completes the command to the most recent command matching git (ie, it auto-completes with git commit). I can't use the event designator properly because of this auto-completion as I hit the space. I assume this is an oh-my-zsh feature. I have no idea where to look, though - greping for 'complet' in the oh-my-zsh source doesn't get me anywhere. My question: how do I turn off this feature? Or, if that's not something that's known, where should I be looking - if I was going to implement this auto-complete when whitespace is entered, where would be a logical place to do so in the oh-my-zsh framework?

    Read the article

  • auto-mounting shared folders in VirtualBox

    - by brannerchinese
    I am writing to ask what the effect of the auto-mounting process is in VirtualBox, and where the folders can be accessed within a guest Linux system if auto-mount is used. I have VirtualBox 4.0.4 installed on Mac OS 10.6.7, with Guest Additions apparently running correctly. The guest OS is Ubuntu 10.04, and I observe no apparent problems with it. I find that if the shared folders have "auto-mount" unchecked in the VirtualBox settings, they can then be mounted using the prescribed syntax sudo mount -t vboxsf folder_name path_to_mount_point and all works as it is supposed to. But if the auto-mount option is checked, then I find that I can no longer mount the shared folders manually. I get the error mounting failed with the error: Invalid argument and the folders also do not appear to mount anywhere else accessible to me. Using the syntax sudo mount -t vboxsf without specifying a path installs them in /media, with their names prefixed with sf_, but they are not easily accessible there and I have not been able to change their owner using chown, either. Thanks for your patient explanation.

    Read the article

  • Grand Theft Mario [Video]

    - by Asian Angel
    What do you get when you mix Mario and Grand Theft Auto? The “real” answer to where Mario got his racing kart! Here is the original GTA V official trailer that Grand Theft Mario is based on. Grand Theft Mario [via Dorkly Bits] HTG Explains: How Hackers Take Over Web Sites with SQL Injection / DDoS Use Your Android Phone to Comparison Shop: 4 Scanner Apps Reviewed How to Run Android Apps on Your Desktop the Easy Way

    Read the article

  • CSS overflow character not pushing down <div>

    - by Uncle Toby
    I have a <div> called bigbox which contain a <div>called wrapper . The wrapper contain 2 <div> called textbox and checkbox. If the characters inside textbox overflow , it doesn't push the other wrapper below . How can I make the below wrapper go down ? here is the jsfiddle : http://jsfiddle.net/WA63P/ <html> <head> <title>Page</title> <script type="text/javascript" src="jquery-1.9.1.min.js"></script> <style type="text/css"> .bigbox { background-color: #F5E49C; color: #000; padding: 0 5px; width:280px; height:500px; position: absolute; text-align: center;content: "";display: block;clear: both; } .box { background-color: #272822; color: #9C5A3C; height:100px; width:260px; margin-bottom: 10px; position: relative; top:10px; } .textbox { background-color: #FFFFFF; color: #272822; height:100px; width:160px;float:left;text-align: left } .checkbox { background-color: #FFFFFF; height:50px; width:50px; float:right; d } </style> <div class="bigbox"> <div class="box"> <div class="textbox">background background background background background background background background background background background background background background background background background background background background background background </div> <div class="checkbox"> </div> </div> <div class="box"> <div class="textbox"> </div> <div class="checkbox"> </div> </div> </body> </html>

    Read the article

  • C++ Stack Overflow

    - by PhilMAN
    Here is some code: void main() { GameEngine ge("phil", "anotherguy"); string response; do { ge.playGame(); cout << endl << "Do you want to (r)eplay the same battle, (s)tart a new battle, or (q)uit? "; cin >> response; } while(response == "r" || response == "R" || response == "s" || response == "S" ); } GameEngine::GameEngine(string name1, string name2) { p1Name = name1; p2Name = name2; } void GameEngine::playGame() { cout << "PLAY GAME" << endl; Army p1, p2; Battlefield testField; RuleSet rs; int xSize = 13; // Number of rows int ySize = 13; // Number of columns loadData(p1, p2, testField, rs, xSize, ySize); ... } void GameEngine::loadData(Army& p1, Army& p2, Battlefield& testField, RuleSet& rs, int& xSize, int& ySize) { string terrain = BattlefieldUtils::pickTerrain(); string armySplit[14];//id index 1 string ruleSplit[19];//in index 7 string armyP1, armyP2, ruleSet; Skill p1Skills[8]; Skill p2Skills[8]; CreatureStack p1Stacks[20]; CreatureStack p2Stacks[20]; ... } CreatureStack(){quantity = 0; isLive = false; id = -1;}; Army(){}; Battlefield(){}; RuleSet(){}; I have posted every line of code that executes until the program crashes. This code ran fine for a long time, I added some stuff that does not even execute until way after the code I have posted here, and bam stack overflow that occurs at GameEngine::loadData() line: CreatureStack p2Stacks[20]; will not go away. What am I doing wrong here? Is that all the stack can handle? I increased the stack size in Visual Studio and got the error to go away, but that slowed things down considerably, so I would rather just get to the source of the issue and fix that.

    Read the article

  • flex DataGrid row auto fit content

    - by orangestar
    Hi, all! I try to create a DataGrid in flex which can fit its content. The itemEdit is a TextArea that can auto change its height while inputing. I set variableRowHeight="true" and wordWrap="true". Although The TextArea will auto resize but the height of row is not changed. Could anyone tell me how to change row height of DataGrid while inputing? One way I found is auto commit its text to DataGrid so the DataGrid will know the data changes but which function can commit its data? Thank you!

    Read the article

  • Webbrowser control: auto fill textfields

    - by Khou
    I would like my custom browser to auto fill in a form when it is completely loaded Ok so inside private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { } Ive inserted the following statements webBrowser1.Document.GetElementById("FirstName").SetAttribute("value", "John"); webBrowser1.Document.GetElementById("LastName").SetAttribute("value", "Smith"); // etc..etc.. I noticed that "webBrowser1_DocumentCompleted" only is loaded one time?? How do i make my browser auto fill in a form when the document has finish loading, and auto fill the values to the define values if they have been changed by the end user.

    Read the article

  • iphone setting UITextView delegate breaks auto completion

    - by Tristan
    Hi there! I have a UITextField that I would like to enable auto completion on by: [self.textView setAutocorrectionType:UITextAutocorrectionTypeYes]; This works normally, except when I give the UITextView a delegate. When a delegate is set, auto complete just stops working. The delegate has only the following method: - (void)textViewDidChange:(UITextView *)textView { self.textView.text = [self.textView.text stringByReplacingOccurrencesOfString:@"\n" withString:@""]; int left = LENGTH_MAX -[self.textView.text length]; self.characterCountLabel.text = [NSString stringWithFormat:@"%i",abs(left)]; } Does anyone know how to have both auto complete enabled and a delegate set? Thanks!Tristan

    Read the article

  • Emacs: ac-slime for auto complete

    - by Boris
    I am trying to add auto complete for *.lisp files. My slime setting is: (add-to-list 'load-path "~/.emacs.d/plugins/slime/") (setq slime-lisp-implementations '((sbcl ("/opt/sbcl/bin/sbcl" "--core" "/opt/sbcl/lib/sbcl/sbcl.core") :coding-system utf-8-unix :env ("SBCL_HOME=/opt/sbcl/lib/sbcl")) (ccl ("/opt/ccl/lx86cl64") :coding-system utf-8-unix))) (require 'slime-autoloads) (slime-setup '(slime-fancy)) And ac-slime setting is: (require 'ac-slime) (add-hook 'slime-mode-hook 'set-up-slime-ac) (add-hook 'slime-repl-mode-hook 'set-up-slime-ac) (eval-after-load "auto-complete" '(add-to-list 'ac-modes 'slime-repl-mode)) Each time I type a word in *.lisp file, auto complete popups some candidates but after a second minibuffer outputs error in process filter: Reply to canceled synchronous eval request tag=slime-result-6-19579 sexp=(swank:simple-completions "de" (quote "COMMON-LISP-USER")) and the popup stuck for a while. After that I can continue my selection. My question is how to remove this error and stuck? Any help is appreciated.

    Read the article

  • Smart auto-completition for staged git file names, used with difftool

    - by piobyz
    I'd like to have a smart auto-completition of currently staged file names when using git diff. Example: modified: DIR1/LongCamelCaseFileName.h modified: DIR1/AnotherLongCamelCaseFileName.m modified: DIR1/AndThereAreALotOfThemInDir1.m modified: DIR2/file4.m and here, using bash tab-auto-complete functionality I'd like to use it with git diff where by smart I mean that after typing git diff I'd need to type only a short part of the staged file name that I want to diff, and without a dirname, so for example git diff And<TAB> would result in git diff AndThereAreALotOfThemInDir1.m Actually, without a dir-ommiting-part it would be still useful (auto-completing using only staged files pool).

    Read the article

  • Auto RowDefinitions Grid with ContentControls

    - by pipelinecache
    Hi all, I have a Page with two ContentControls loaded by a RegionManager. A List of items, and a DetailView of these items. The problem is that the grid doesn't apply the auto height what I liked to. So I want to make all the available screen size to grid.row=0. I've added my code below: <Grid> <Grid.RowDefinitions> <RowDefinition MinHeight="300" Height="Auto" /> <RowDefinition Height="200"/> </Grid.RowDefinitions> <ContentControl Grid.Row="0" x:Name="ListRegion" ListMededelingRegion}" IsTabStop="False" Focusable="False" Height="Auto" /> <ContentControl VerticalAlignment="Bottom" Grid.Row="1" x:Name="DetailRegion" cal:RegionManager.RegionName="{x:Static com:RegionNames.DetailRegion}" IsTabStop="False" Focusable="False" /> </Grid>

    Read the article

  • width:auto for <input> fields

    - by richb
    Newbie CSS question. I thought 'width:auto' for a display:block element meant 'fill available space'. However for an <input> element this doesn't seem to be the case. For example: <body> <form style='background-color:red'> <input type='text' style='background-color:green;display:block;width:auto'> </form> </body> Two questions then: Is there a definition of exactly what width:auto does mean? The CSS spec seems vague to me, but maybe I missed the relevant section. Is there a way to achieve my expected behaviour for a input field - ie. fill available space like other block level elements do? Thanks!

    Read the article

  • Auto-hydrate your objects with ADO.NET

    - by Jake Rutherford
    Recently while writing the monotonous code for pulling data out of a DataReader to hydrate some objects in an application I suddenly wondered "is this really necessary?" You've probably asked yourself the same question, and many of you have: - Used a code generator - Used a ORM such as Entity Framework - Wrote the code anyway because you like busy work     In most of the cases I've dealt with when making a call to a stored procedure the column names match up with the properties of the object I am hydrating. Sure that isn't always the case, but most of the time it's 1 to 1 mapping.  Given that fact I whipped up the following method of hydrating my objects without having write all of the code. First I'll show the code, and then explain what it is doing.      /// <summary>     /// Abstract base class for all Shared objects.     /// </summary>     /// <typeparam name="T"></typeparam>     [Serializable, DataContract(Name = "{0}SharedBase")]     public abstract class SharedBase<T> where T : SharedBase<T>     {         private static List<PropertyInfo> cachedProperties;         /// <summary>         /// Hydrates derived class with values from record.         /// </summary>         /// <param name="dataRecord"></param>         /// <param name="instance"></param>         public static void Hydrate(IDataRecord dataRecord, T instance)         {             var instanceType = instance.GetType();                         //Caching properties to avoid repeated calls to GetProperties.             //Noticable performance gains when processing same types repeatedly.             if (cachedProperties == null)             {                 cachedProperties = instanceType.GetProperties().ToList();             }                         foreach (var property in cachedProperties)             {                 if (!dataRecord.ColumnExists(property.Name)) continue;                 var ordinal = dataRecord.GetOrdinal(property.Name);                 var isNullable = property.PropertyType.IsGenericType &&                                  property.PropertyType.GetGenericTypeDefinition() == typeof (Nullable<>);                 var isNull = dataRecord.IsDBNull(ordinal);                 var propertyType = property.PropertyType;                 if (isNullable)                 {                     if (!string.IsNullOrEmpty(propertyType.FullName))                     {                         var nullableType = Type.GetType(propertyType.FullName);                         propertyType = nullableType != null ? nullableType.GetGenericArguments()[0] : propertyType;                     }                 }                 switch (Type.GetTypeCode(propertyType))                 {                     case TypeCode.Int32:                         property.SetValue(instance,                                           (isNullable && isNull) ? (int?) null : dataRecord.GetInt32(ordinal), null);                         break;                     case TypeCode.Double:                         property.SetValue(instance,                                           (isNullable && isNull) ? (double?) null : dataRecord.GetDouble(ordinal),                                           null);                         break;                     case TypeCode.Boolean:                         property.SetValue(instance,                                           (isNullable && isNull) ? (bool?) null : dataRecord.GetBoolean(ordinal),                                           null);                         break;                     case TypeCode.String:                         property.SetValue(instance, (isNullable && isNull) ? null : isNull ? null : dataRecord.GetString(ordinal),                                           null);                         break;                     case TypeCode.Int16:                         property.SetValue(instance,                                           (isNullable && isNull) ? (int?) null : dataRecord.GetInt16(ordinal), null);                         break;                     case TypeCode.DateTime:                         property.SetValue(instance,                                           (isNullable && isNull)                                               ? (DateTime?) null                                               : dataRecord.GetDateTime(ordinal), null);                         break;                 }             }         }     }   Here is a class which utilizes the above: [Serializable] [DataContract] public class foo : SharedBase<foo> {     [DataMember]     public int? ID { get; set; }     [DataMember]     public string Name { get; set; }     [DataMember]     public string Description { get; set; }     [DataMember]     public string Subject { get; set; }     [DataMember]     public string Body { get; set; }            public foo(IDataRecord record)     {         Hydrate(record, this);                }     public foo() {} }   Explanation: - Class foo inherits from SharedBase specifying itself as the type. (NOTE SharedBase is abstract here in the event we want to provide additional methods which could be overridden by the instance class) public class foo : SharedBase<foo> - One of the foo class constructors accepts a data record which then calls the Hydrate method on SharedBase passing in the record and itself. public foo(IDataRecord record) {      Hydrate(record, this); } - Hydrate method on SharedBase will use reflection on the object passed in to determine its properties. At the same time, it will effectively cache these properties to avoid repeated expensive reflection calls public static void Hydrate(IDataRecord dataRecord, T instance) {      var instanceType = instance.GetType();      //Caching properties to avoid repeated calls to GetProperties.      //Noticable performance gains when processing same types repeatedly.      if (cachedProperties == null)      {           cachedProperties = instanceType.GetProperties().ToList();      } . . . - Hydrate method on SharedBase will iterate each property on the object and determine if a column with matching name exists in data record foreach (var property in cachedProperties) {      if (!dataRecord.ColumnExists(property.Name)) continue;      var ordinal = dataRecord.GetOrdinal(property.Name); . . . NOTE: ColumnExists is an extension method I put on IDataRecord which I’ll include at the end of this post. - Hydrate method will determine if the property is nullable and whether the value in the corresponding column of the data record has a null value var isNullable = property.PropertyType.IsGenericType && property.PropertyType.GetGenericTypeDefinition() == typeof (Nullable<>); var isNull = dataRecord.IsDBNull(ordinal); var propertyType = property.PropertyType; . . .  - If Hydrate method determines the property is nullable it will determine the underlying type and set propertyType accordingly - Hydrate method will set the value of the property based upon the propertyType   That’s it!!!   The magic here is in a few places. First, you may have noticed the following: public abstract class SharedBase<T> where T : SharedBase<T> This says that SharedBase can be created with any type and that for each type it will have it’s own instance. This is important because of the static members within SharedBase. We want this behavior because we are caching the properties for each type. If we did not handle things in this way only 1 type could be cached at a time, or, we’d need to create a collection that allows us to cache the properties for each type = not very elegant.   Second, in the constructor for foo you may have noticed this (literally): public foo(IDataRecord record) {      Hydrate(record, this); } I wanted the code for auto-hydrating to be as simple as possible. At first I wasn’t quite sure how I could call Hydrate on SharedBase within an instance of the class and pass in the instance itself. Fortunately simply passing in “this” does the trick. I wasn’t sure it would work until I tried it out, and fortunately it did.   So, to actually use this feature when utilizing ADO.NET you’d do something like the following:        public List<foo> GetFoo(int? fooId)         {             List<foo> fooList;             const string uspName = "usp_GetFoo";             using (var conn = new SqlConnection(_dbConnection))             using (var cmd = new SqlCommand(uspName, conn))             {                 cmd.CommandType = CommandType.StoredProcedure;                 cmd.Parameters.Add(new SqlParameter("@FooID", SqlDbType.Int)                                        {Direction = ParameterDirection.Input, Value = fooId});                 conn.Open();                 using (var dr = cmd.ExecuteReader())                 {                     fooList= (from row in dr.Cast<DbDataRecord>()                                             select                                                 new foo(row)                                            ).ToList();                 }             }             return fooList;         }   Nice! Instead of having line after line manually assigning values from data record to an object you simply create a new instance and pass in the data record. Note that there are certainly instances where columns returned from stored procedure do not always match up with property names. In this scenario you can still use the above method and simply do your manual assignments afterward.

    Read the article

  • Overflow - what am I doing wrong?

    - by ClarkeyBoy
    Hi, I have been working on trying to get a page to display a title at the top of the content pane, and then a scrollable list of products below that so that the title of the product range is displayed at all times. I am sure this is a very simple thing to do - but cannot figure it out. Currently the actual page (not the test page for which the code is given below) works ok in the sense that I set the heading div to 5% of the height of .content-container and then set the scrollable div to 95% with top: 5%, both with position: absolute applied. - however I would like to place some links in the heading div to different pages (1, 2, 3 etc), which I would like to centre vertically if they are shorter than the heading and expand the heading div to match the height of the heading or the links, whichever is smallest. Furthermore I would like the div below the heading to shrink so that it doesn't go below the bottom of the content div as the heading div gets taller. The point of this is because it is for a client who may, or may not, be happy with the heading sizes and so on - therefore the heading div height could easily change. Specifying heights so precisely means that changing the h1 height could mean 5 changes to the CSS file - something I want to avoid. The content pane currently has its height fixed to 80% of the page, with the header and footer being 10% each on top of that, so there is no scrollbar at the side of the page and the header / footer are always showing. This is something I would like to keep. In the code below, .content-container is the main content pane - this is contained in another div which is centred using the margin at 50% of the page width. .test-div is the div which contains the heading. .test-div-2 is an attempt to place a div below .test-div, in the hope that I can force .test-div-3 to extend to 100% of its' height but no further, and to display a scrollbar if the content exceeds the height. So far I have the following, but it doesn't do exactly what I would like it to: <div class="content-container"> <div class="test-div"> <h1 style="text-align: center;">Dogs</h1> </div> <div class="test-div-2"> <div class="test-div-3"> //Content here </div> </div> </div> .content-container { position: absolute; width: 100%; height: 100%; left: 0; right: 0; bottom: 0; overflow: auto; } .test-div { position: relative; padding: 0; margin: 0; } .test-div-2 { position: relative; background-color: #CCCCCC; } .test-div-3 { max-height: 100%; background-color: #999999; } Any help with this would be greatly appreciated. I would like to achieve this without the use of JavaScript / jQuery if possible - pure HTML / CSS solutions only please! Regards, Richard

    Read the article

  • Block element text overflow problem in IE7

    - by Adomas
    I'm making a "sort elements" web game using jQuery, HTML & CSS. While everything works fine in FF, IE8, Opera, Chrome, I'm having problem with IE7 wrapping words inside block elements. Here's how it looks in IE7 (wrong): Link (cannot post images as a new user) In IE8 the box with wrapped text would just expand to fit it whole in one line without any overflows. Sorry, can't give another link as a new user Don't mind the element order as it's random. Elements are dynamically generated by jQuery. HTML code: <div class="ui-sortable" id="area"> <span class="object">: </span> <span class="object">1998- </span> <span class="object">ISSN 1392-4087</span> <span class="object">, </span> <span class="object">. </span> <span class="object">nepriklausomas savaitraštis buhalteriams, finansininkams, auditoriams</span> <span class="object">. </span> <span class="object">. </span> <span class="object">. </span> <span class="object">Vilnius</span> <span class="object">1998- </span> <span class="object"><em>Apskaitos, audito ir mokesciu aktualijos</em></span> </div> CSS code (irrelevant info like fonts & colors removed): #area { min-height: 160px; width: 760px; } .object { display: block; float: left; text-align: center; width: auto; } Any comments on why does IE7 does that? How do I make these spans expand to fit the whole text in one line in IE7 and not wrap the text or make overflows?

    Read the article

  • Does this sound like a stack overflow?

    - by Jordan S
    I think I might be having a stack overflow problem or something similar in my embedded firmware code. I am a new programmer and have never dealt with a SO so I'm not sure if that is what's happening or not. The firmware controls a device with a wheel that has magnets evenly spaced around it and the board has a hall effect sensor that senses when magnet is over it. My firmware operates the stepper and also count steps while monitoring the magnet sensor in order to detect if the wheel has stalled. I am using a timer interrupt on my chip (8 bit, 8057 acrh.) to set output ports to control the motor and for the stall detection. The stall detection code looks like this... // Enter ISR // Change the ports to the appropriate value for the next step // ... StallDetector++; // Increment the stall detector if(PosSensor != LastPosMagState) { StallDetector = 0; LastPosMagState = PosSensor; } else { if (PosSensor == ON) { if (StallDetector > (MagnetSize + 10)) { HandleStallEvent(); } } else if (PosSensor == OFF) { if (StallDetector > (GapSize + 10)) { HandleStallEvent(); } } } this code is called every time the ISR is triggered. PosSensor is the magnet sensor. MagnetSize is the number of stepper steps that it takes to get through the magnet field. GapSize is the number of steps between two magnets. So I want to detect if the wheel gets stuck either with the sensor over a magnet or not over a magnet. This works great for a long time but then after a while the first stall event will occur because 'StallDetector (MagnetSize + 10)' but when I look at the value of StallDetector it is always around 220! This doesn't make sense because MagnetSize is always around 35. So the stall event should have been triggered at like 46 but somehow it got all the way up to 220? And I don't set the value of stall detector anywhere else in my code. Do you have any advice on how I can track down the root of this problem? The ISR looks like this void Timer3_ISR(void) interrupt 14 { OperateStepper(); // This is the function shown above TMR3CN &= ~0x80; // Clear Timer3 interrupt flag } HandleStallEvent just sets a few variable back to their default values so that it can attempt another move... #pragma save #pragma nooverlay void HandleStallEvent() { ///* PulseMotor = 0; //Stop the wheel from moving SetMotorPower(0); //Set motor power low MotorSpeed = LOW_SPEED; SetSpeedHz(); ERROR_STATE = 2; DEVICE_IS_HOMED = FALSE; DEVICE_IS_HOMING = FALSE; DEVICE_IS_MOVING = FALSE; HOMING_STATE = 0; MOVING_STATE = 0; CURRENT_POSITION = 0; StallDetector = 0; return; //*/ } #pragma restore

    Read the article

  • Proper application shutdown before windows xp auto shutdown

    - by vashman
    I frequently leave the computer on playing a movie or downloading a file while I go to bed. I do use the 'shutdown computer when finished' feature of KMPlayer or getright or uTorrent or whatever program I am using. This method effectively shuts down the computer, but the problem is that there are some applications that seem to exit forcefully when doing this kind of shutdown, this being clearly reflected in winamp not saving the current playlist and config, messenger not saving the chat logs, etc. My goal here would be to have automatically close properly all applications when the auto/scheduled program triggers it. I am looking for some Windows shutdown mode/setting that does application closing like the user would do. I am not expecting to auto-click on save dialogs prompts, if this is needed I will do it before leaving the computer on for auto shutdown.

    Read the article

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