Search Results

Search found 5122 results on 205 pages for 'max'.

Page 142/205 | < Previous Page | 138 139 140 141 142 143 144 145 146 147 148 149  | Next Page >

  • Three boolean values saved in one tinyint

    - by Casper
    Hello, probably a simple question but I seem to be suffering from programmer's block. :) I have three boolean values: A, B, and C. I would like to save the state combination as an unsigned tinyint (max 255) into a database and be able to derive the states from the saved integer. Even though there are only a limited number of combinations, I would like to avoid hard-coding each state combination to a specific value (something like if A=true and B=true has the value 1). I tried to assign values to the variables so (A=1, B=2, C=3) and then adding, but I can't differentiate between A and B being true from i.e. only C being true. I am stumped but pretty sure that it is possible. Thanks

    Read the article

  • Text replace with regex in SQL Server

    - by Thiyaneshwaran S
    Currently I have a SQL server column of type nvarchar(max) which has text that starts with <span class="escape_<<digits>>"></span> The only thing that varies in the pattern is the <<digits>> in the class name. The common part is <span class="myclass_ and the closing </span> Some sample values are <span class="myclass_12"></span> <span class="myclass_234"></span> <span class="myclass_4546"></span> These span text are present only at the beginning of the column. Any such matching span in the middle should not be removed or matched. Whats the SQL Server query with regex to remove all these occurances of span?

    Read the article

  • step attribute not working with HTML5 <input type="range"> on Safari

    - by Claudiu
    Are there known issues with range inputs not working fully on Safari? I have the following input element: <input type=?"range" min=?"0" max=?"360" step=?"0.0001" value=?"0">? On Chrome, the input goes according to the step variable. On Safari, it only goes by integer values. Even setting the step to 10 still makes it go by increments of 1. I'm confused because I thought Chrome and Safari both used WebKit.

    Read the article

  • Get top 'n' records by report_id

    - by Skudd
    I have a simple view in my MSSQL database. It consists of the following fields: report_id INT ym VARCHAR -- YYYY-MM keyword VARCHAR(MAX) visits INT I can easily get the top 10 keyword hits with the following query: SELECT TOP 10 * FROM top_keywords WHERE ym BETWEEN '2010-05' AND '2010-05' ORDER BY visits DESC Now where it gets tricky is where I have to get the top 10 records for each report_id in the given date range (ym BETWEEN @start_date AND @end_date). How would I go about getting the top 10 for each report_id? I've stumbled across suggestions involving the use of ROW_NUMBER() and RANK(), but have been vastly unsuccessful in their implementation.

    Read the article

  • How do I use a custom select statement in Hibernate using the HibernateDaoSupport class

    - by Bill Leeper
    I am trying to write a custom select statement in Hibernate using the getHibernateTemplate() method. I am having problems with the resulting mapping. Example Code: List<User> users = getHibernateTemplate().find("Select user, sysdate as latestPost from User as user"); for (User user : users) { assertNotNull(users.name); } The goal of the above line is to eventually have a join where I get the max(date) of posts made by the user. The problem I am having is that the resulting users list is not a list of User objects and I get a class cast exception. Hopefully that is enough code. It is a greatly simplified version of my problem and a combination of snippets from various parts of my application.

    Read the article

  • Bean validation VS JSF validation

    - by henloke
    When facing the problem of validating a property in a JSF2 application there are two main approaches. Defining the validation on the ManagedBean using an Annotation @ManagedBean public class MyBean { @Size(max=8) private String s; // Getters setters and other stuff. } or declaring it on the jsf page: <h:inputText value="#{myBean.s}"> <f:validateLength maximum="8"/> </h:inputText> It happens that I can't decide for none of them. The first one is nice because it removes some code from the jsf pages (which is always good since those pages are not eye friendly by definition) but makes harder to see 'at a glance' what's going on with the page when checking the jsf file. Which one do you think is clearer? Nicer? Better?

    Read the article

  • SQL Stored Procedure fired from C# Code-Behind not working on UPDATE

    - by CSSHell
    I have a stored procedure called from a C# code-behind. The code fires but the update command does not get performed. The stored procedure, if run directly, works. I think I am having a brain fart. Please help. :) CODEBEHIND protected void btnAbout_Click(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(strConnection); SqlCommand myCommand = new SqlCommand("spUpdateCMSAbout", myConnection); myConnection.Open(); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add("@AboutText", SqlDbType.NVarChar, -1).Value = txtAbout.Text.ToString(); myCommand.ExecuteNonQuery(); myConnection.Close(); } STORED PROCEDURE ALTER PROCEDURE fstage.spUpdateCMSAbout ( @AboutText nvarchar(max) ) AS BEGIN SET NOCOUNT ON; UPDATE fstage.staticCMS SET About = @AboutText; END HTML <asp:Button ID="btnAbout" runat="server" Text="Save" CausesValidation="False" onclick="btnAbout_Click" UseSubmitBehavior="False" /> C# .NET 4.0

    Read the article

  • resort on a std::vector vs std::insert

    - by Abruzzo Forte e Gentile
    I have a sorted std::vector of relative small size ( from 5 to 20 elements ). I used std::vector since the data is continuous so I have speed because of cache. On a specific point I need to remove an element from this vector. I have now a doubt: which is the fastest way to remove this value between the 2 options below? setting that element to 0 and call sort to reorder: this has complexity but elements are on the same cache line. call erase that will copy ( or memcpy who knows?? ) all elements after it of 1 place ( I need to investigate the behind scense of erase ). Do you know which one is faster? I think that the same approach could be thought about inserting a new element without hitting the max capacity of the vector. Regards AFG

    Read the article

  • MySQL COUNT help

    - by space
    I'm trying to count all the ids form table3 that are related to the first two tables but I think my SQL code is wrong can some one help me fix it? Here is the code: $dbc = mysqli_query($mysqli,"SELECT table1.*, table2.*, COUNT(id) as num, table3.id FROM table1 INNER JOIN table2 ON table1.id = table2.id INNER JOIN table3 ON table2.id = table3.id WHERE table2.id = '$id'"); Here is the error message. Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4

    Read the article

  • In Perl, can I limit the length of a line as I read it in from a file (like fgets)

    - by SB
    I'm trying to write a piece of code that reads a file line by line and stores each line, up to a certain amount of input data. I want to guard against the end-user being evil and putting something like a gig of data on one line in addition to guarding against sucking in an abnormally large file. Doing $str = <FILE> will still read in a whole line, and that could be very long and blow up my memory. fgets lets me do this by letting me specify a number of bytes to read during each call and essentially letting me split one long line into my max length. Is there a similar way to do this in perl? I saw something about sv_gets but am not sure how to use it (though I only did a cursory Google search). Thanks.

    Read the article

  • Help with algorithm to determine phrase occurrence in string in PHP

    - by Will M.
    I have an array of phrases (max 2 words) like $words = array('barack obama', 'chicago', 'united states'); and then I have a string like: $sentence = "Barack Obama is from Chicago. Barack Obama's favorite food it pizza."; I want to find/create an efficient algorithm that would return the number of occurrences of the words in the array $words in the string $sentence. In this case it would be: 'barack obama' => 2 'chicago' => 0 How can I built this?

    Read the article

  • Is it a problem if i query again and again to SQL Server 2005 and 2000?

    - by learner
    Window app i am constructing is for very low end machines (Celeron with max 128 RAM). From the following two approaches which one is the best (I don't want that application becomes memory hog for low end machines):- Approach One:- Query the database Select GUID from Table1 where DateTime <= @givendate which is returning me more than 300 thousands records (but only one field i.e. GUID - 300 thousands GUIDs). Now running a loop to achieve next process of this software based on GUID. Second Approach:- Query the database Select Top 1 GUID from Table1 where DateTime <= @givendate with top 1 again and again until all 300 thousands records done. It will return me only one GUID at a time, and I can do my next step of operation. What do you suggest which approach will use the less Memory Resources?? (Speed / performance is not the issue here).

    Read the article

  • why am i getting an error SyntaxError : invalid syntax for this code

    - by eragon1189
    This is a code in python which calculates f (x) =? ((-1)*x)/(x*x+n*n) n from 1 to infinite.... correct to 0.0001, for the range 1 < x < 100 in steps of 0.1.But i am getting an syntax error,as i am new to programming in python... from scipy import * from matplotlib.pyplot import * x=arange(0.1,100,0.1) f=zeros(len(x)) s=-1 for n in range (1,10000): t=s*x/(x*x+n*n) f +=t s =-s if max(abs(t))< 1e-4 break for xx in c_[x,f]: print "%f %f" % (xx[0],xx[1])

    Read the article

  • Getting the most recent entry per group in a select statement

    - by TheObserver
    I have 3 tables to join to get table1.code, table1.series, table2.entry_date, table3.title1 and I'm trying to get the most recent non null table3.title1 grouped by table1.code and table1.series. select table1.code, table1.series, max(table2.entry_date), table3.Title1 from table3 INNER JOIN table2 ON table3.ID = table2.ID INNER JOIN table1 ON table2.source_code = table1.code where table3.Title1 is not NULL group by table1.code, table1.series, table3.Title1 seems to give me all entries with a non null title1 instead of the most recent one. How should I structure the query to just pick the newest version of Title1 per code & series?

    Read the article

  • hibernate - Postgres- target lists can have at most 1664 entries

    - by Vineyard
    We are using hibernate, postgres 8.3x Our entities are many to one mapped with eager fetching. We have multiple associations with Many to one mapping. As we added new columns to any other existing entities, We are getting below error: target lists can have at most 1664 entries I searched internet and they say this is due to More number of select statements in sql query (generated by hibernate) Can you any body please let us know if there is any configuration (in postgres) to update max number columns in configuration or any other solution to solve this issue. Thank you in advance.

    Read the article

  • Comparing two images by corr2 function

    - by user3696860
    I'm trying to compare two images by corr2 function on Matlab, it's not necess getting 1 end of function so I am using a treshold to find best images among template images. But sometimes it evaluate wrong image. How can I process them to find best match? ` temp=[]; for i=1:10 res=sprintf('%d.png',i) yol=fullfile('cember\taslak_cember\',res); a=imread(yol); b=imread('30_1.png'); a=rgb2gray(a); b=rgb2gray(b); a=im2bw(a,0.4); b=im2bw(b,0.4); c=corr2(a,b); temp=[temp c]; end max(temp) `

    Read the article

  • Jquery convert string of one type to string array.....

    - by chandru_cp
    Consider a string which is {"Table" : [{"Bird" : "Peacock"}, {"Bird" : "Crow"}]} to this ["Peacock", "Crow"] in jquery... Is this possible? EDIT: I am doing this but didnt work... $(document).ready(function() { var obj = JSON.parse('{"Table" : [{"Bird" : "Peacock"},{"Bird" : "Crow"}]}'); myarray = []; $.each(obj.table, function(i, v) { myarray.push(v.Bird); }); $("#tags").autocomplete(myarray, { width: 138, max: 4, highlight: false, multiple: true, multipleSeparator: " ", scroll: true, scrollHeight: 300 }); });

    Read the article

  • Resizing uploaded images based on a maximum width in django (PIL)

    - by AndrewE
    I'm working on a simple message board app in Django that lets people upload images to be displayed in their posts. Since the div containing the posts is only 700px, I want to resize the uploaded images to a max width of something like 680px to save space rather than using css to display an image that's too large within the space constraints. I've been searching this site, google and the PIL docs for a while and haven't found any way of resizing an image on one dimension while maintaining the original aspect ratio. Given my inexperience, it's possible that I'm just not recognizing a solution that's plain to someone who knows what to look for.

    Read the article

  • Nested <a> and <span> challenge

    - by PaddyO
    Hi all, Trying in vain to get a nested link working within a nested span. This is a working test page for the code below to explain what I'm trying to do. Any ideas on how to get this working in valid html? I guess it's either a nesting order or style syntax thing but I am at a loss. Any thoughts much appreciated. <div id="greyback"> <ul id="scrollbox"> <li class="listcat">List header</li> <li><a class="menu" href="#freeze">List item 1<span><b>This text has popped up because you have clicked the list item, which has an "a" tag and now has :focus. That "a" tag is the first of two.</b><br><br>What I am trying to do is to set the second "a" tag as a DIFFERENT "embedded" link in this box<span style="color: blue; background-color: yellow;">eg, here<a href="http://www.conservationenterprises.com" target="blank">This is the second (nested) "a" tag in this html nest. It is a link to an external site. Instead of this being an always-visible link, I want it to sit within the yellow box in the first span (click the List item 1 to display).</a></span> </a></span> </li> </a></span> </li> </ul> </div> and the CSS: #scrollbox {margin: 0 auto; margin-top: 1em; margin-bottom: 1em; width:19em; height:auto; max-height: 21em; overflow:auto; border-bottom: 0.1em solid #FFA500; border-top: 0.1em solid #FFA500;} #scrollbox a {float: left; color:#000000; text-decoration:none; width:18em; height: auto; margin-bottom: 0.5em; font-family: Arial, sans-serif; font-size: 0.9em; text-align:left;} #scrollbox a.menu {} #scrollbox a span {display:none; position:absolute; left:0em; top:0;} #scrollbox a span img {float: right; border:0; max-width:7.5em;} #scrollbox a:hover {border: 0; color: #7ebb11; font-size:0.9em;} #scrollbox a:hover span {border: 0; color: #535353;} #scrollbox a span:focus {color: blue;} #scrollbox a:active {border:none; color: #535353; text-decoration: none;} #scrollbox a:focus {border:0em solid #000; outline:0;} #scrollbox a:active span, #scrollbox li a:active span, #scrollbox a:focus span, #scrollbox li a:focus span {display: block; width: 52.5em; min-height: 20em; height: auto; left: 1.5em; top:18em; z-index:10; font-size:0.9em; text-align: left; padding: 1em; padding-bottom: 0em; background-color: #c3FFe3; color: #535353; border: solid #FFA500 0.25em;} #scrollbox li a:active span span, #scrollbox li a:focus span span{display: block; width: auto; height: auto; min-height: 2em; left: 25em; top:10em; z-index:10; font-size:0.9em; text-align: left; padding: 1em; padding-bottom: 0em; background-color: transparent; color: #535353; border: dashed red 1px;} .ul#scrollbox {padding-left: 0.1em;} #scrollbox li {float:left; list-style: none; background: url(blank.png) no-repeat left center; margin-left: 0em; font-family:Arial, sans-serif; font-size: 0.9em;} #scrollbox li.listcat {float: left; text-align:left; width: 18em; margin-left: 0em; margin-top: 0.1em; margin-bottom: 0.3em; padding-top:0.5em; color: green; font-size: 0.9em; font-weight:bold;} Cheers Patrick.

    Read the article

  • Java sockets: can I write a TCP server with one thread?

    - by hmp
    From what I read about Java NIO and non-blocking [Server]SocketChannels, it should be possible to write a TCP server that sustains several connections using only one thread - I'd make a Selector that waits for all relevant channels in the server's loop. Is that right, or am I missing some important detail? What problems can I encounter? (Background: The TCP communication would be for a small multiplayer game, so max. 10-20 simultaneous connections. Messages will be sent about every few seconds.)

    Read the article

  • IE or Firefox,which one has a more logical CSS handling ?

    - by Najm
    hello there , i know that there is some rules and standards in css handling but i mean which one is closer to a human thinking. for example : when i give a DIV tag a height property of 100px i just want it to be 100px! but in Firefox i should work on min-height or max-width and so on ! there is many like this examlpe , i think IE read css more humanestic against Firefox. i have several experiences in this case , your final nice design in IE can be a mess in Firefox thats because of the way they handle css. Firefox act as a robot but IE act as a human-half robot ! its just my idea. i will be glad to hear and learn from you proffesionals and other friends here. thank you.

    Read the article

  • Execute query stored in variable in a very specific way

    - by niao
    Greetings, I have a problem as follows: I have an SQL variable declared: DECLARE @myVariable nvarchar(max) a third party library set a value for this variable. To simplify, lets say that the value is as follows: SET @myVariable = 'Select ROWGUID from MySampleTable' Now, I want to execute the following query: SELECT ROWGUID FROM myTable WHERE ROWGUID in (exec sp_executesql @myVariable ) However, the above statement does not work because it returns an error telling me that I can't execute stored procedure in that way. I made a workaround and this is what I wrote: create table #temptable (ID uniqueidentifier null) if(@myVariable is not null AND @myVariable !='') insert into #temptable exec sp_executesql @myVariable SELECT ROWGUID FROM myTable WHERE ROWGUID in (select * from #temptable) DROP TABLE #temptable This works fine.However I don't think it is a good idea to use temporary table. How can I achieve the same result without necessity of creating temporary tables? I am using SQL SERVER 2005

    Read the article

  • test php disabled caching

    - by user1691389
    My site had a problem in that certain browsers (especially opera and gecko) were "over-caching" (caching far too much for my taste). I've just added the following PHP snippet to hopefully disable caching in all browsers: <?php header("Expires: Tue, 01 Jan 2000 00:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?> Question: How would you test this out, to make sure it actually works?

    Read the article

  • C# Array Maximum

    - by Betamoo
    I have 2 arrays named Arr1 and Arr2 in C#. They are of the exact same dimensions... I need to get the element of Arr1 corresponding to maximum of elements in Arr2 beginning with given indices ... e.g Get indices of the max of Arr2 [ 1 , 10 , 3 , i , j ] for all i,j Return Arr1 [ 1 , 10 , 3 , i , j ] Of course I need the elegant solution (not the "loop for them" one...) Please Note: I do not want to loop through the arrays, because it is 11 dimensional!!.. the code will be ugly and error prone.. and I may run out of variable names :)

    Read the article

  • Limit calls to external database with Python CGI

    - by Matt Ball
    I've got a Python CGI script that pulls data from a GPS service; I'd like this information to be updated on the webpage about once every 10s (the max allowed by the GPS service's TOS). But there could be, say, 100 users viewing the webpage at once, all calling the script. I think the users' scripts need to grab data from a buffer page that itself only upates once every ten seconds. How can I make this buffer page auto-update if there's no one directly viewing the content (and not accessing the CGI)? Are there better ways to accomplish this?

    Read the article

< Previous Page | 138 139 140 141 142 143 144 145 146 147 148 149  | Next Page >