Search Results

Search found 7127 results on 286 pages for 'calculated columns'.

Page 158/286 | < Previous Page | 154 155 156 157 158 159 160 161 162 163 164 165  | Next Page >

  • Python breaks for a certain amount

    - by Brian Cox
    All, I am not very good at explaining so i will let my comments do it! #this script is to calculate some of the times table up to 24X24 and also miss some out #Range of numbers to be calculated numbers=range(1,25) for i in numbers: for w in numbers: print(str(i)+"X"+str(w)+"="+str(i*w)) #here i want to break randomly (skip some out) e.g. i could be doing the 12X1,12X2 and then 12X5 i have no limit of skips. Update Sorry if this is not clear i want it to break from the inner loop for a random amount of times

    Read the article

  • calling function in radiobutton group

    - by vijisai
    thank you very much. with your help, i am now able to call the function for each radio button. however, i get a error message Reference to non-existent field 'ics_si' ics_si is my function, which has the following code, i do not know where i am making a mistake i have created the edit box for user to input the values for bore and stroke. and vdisp is calculated and the result is displayed in the third edit box. function ics_si_Callback(hObject, eventdata, handles) b = str2double(get(handles.bore,'String')); s = str2double(get(handles.stroke,'String')); vdisp = (pi * b * b * s*10^(-3))/4; set(handles.vdisp,'String',vdisp); this code must be called when i press the first or second radio button. i.e. when the radio button is pressed, it should call the function ics_si, calculate it and display the result. how to get this.

    Read the article

  • CRC32 calculations for png chunk doesn't match the real one

    - by user2507197
    I'm attempting to mimic the function used for creating CRC's in PNG files, I'm using the autodin II polynomial and the source code from: http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/libkern/crc32.c My tests have all been for the IHDR chunk, so my parameters have been: crc - 0xffffffff and 0 (both have been suggested) buff - the address of the IHDR Chunk's type. length - the IHDR Chunk's length + 4 (the length of the chunk's data + the length of the type) I printed the calculated CRC in binary, which I compared to the actual CRC of the chunk. I can see no similarities (little-big endian, reversed bits, XOR'd, etc). This is the data for the IHDR chunk (hexadecimal format): length(big endian): d0 00 00 00 (13) type: 49 48 44 52 data: 00 00 01 77 00 00 01 68 08 06 00 00 00 existing CRC: b0 bb 40 ac If anyone can tell me why my calculations are off, or give me a CRC32 function that will work I would greatly appreciate it. Thank-you!

    Read the article

  • Hi i am creating a php calendar i have a Problem in that

    - by udaya
    Hi i am creating a calendar i which i filled the year and date like this <<<<< Year <<<<< month by clicking on the arrow marks the year and month can be increased and decreased now i have to fill the dates for the year and month selected I calculated the first day of month and last date of the month The dates must be start filling from the first day Say if the first day is thursday the date 1 must be on thursday and the next days must follow that till the last date These are my functions in my controller " function phpcal() { $month=04; $day=01; $year=2010; echo date("D", mktime(0,0,0,$month,$day,$year)); //here i am calculating the first day of the month echo '<br>lastdate'.date("t", strtotime($year . "-" . $month . "-01"));'' here i am calculating the lasdt date of the month //echo '<br>'.$date_end = $this->lastOfMonth(); $this->load->view('phpcal'); } function firstOfMonth($m1,$y1) { return date("m/d/Y", strtotime($m1.'/01/'.$y1.' 00:00:00')); } function lastOfMonth() { return date("m/d/Y", strtotime('-1 second',strtotime('+1 month',strtotime(date('m').'/01/'.date('Y').' 00:00:00')))); } function phpcalview() { $year = $this->input->post('yearvv'); $data['year'] = $this->adminmodel->selectyear(); $data['date'] = $this->adminmodel->selectmonth(); //print_r($data['date'] ); $this->load->view('phpcal',$data); } This is my view page <table cellpadding="2" cellspacing="0" border="1" bgcolor="#CCFFCC" align="center" class="table_Style_Border"> <? if(isset($date)) { foreach($date as $row) {?> <tr> <td><?= $row['dbDate1'];?></td> <td><?= $row['dbDate2'];?></td> <td><?= $row['dbDate3'];?></td> <td><?= $row['dbDate4'];?></td> <td><?= $row['dbDate5'];?></td> <td><?= $row['dbDate6'];?></td> <td><?= $row['dbDate7'];?></td> </tr> <tr bgcolor="#FFFFFF"> <td><?= $row['dbDate8'];?></td> <td><?= $row['dbDate9'];?></td> <td><?= $row['dbDate10'];?></td> <td><?= $row['dbDate11'];?></td> <td><?= $row['dbDate12'];?></td> <td><?= $row['dbDate13'];?></td> <td><?= $row['dbDate14'];?></td> </tr> <tr> <td><?= $row['dbDate15'];?></td> <td><?= $row['dbDate16'];?></td> <td><?= $row['dbDate17'];?></td> <td><?= $row['dbDate18'];?></td> <td><?= $row['dbDate19'];?></td> <td><?= $row['dbDate20'];?></td> <td><?= $row['dbDate21'];?></td> </tr> <tr bgcolor="#FFFFFF"> <td><?= $row['dbDate22'];?></td> <td><?= $row['dbDate23'];?></td> <td><?= $row['dbDate24'];?></td> <td><?= $row['dbDate25'];?></td> <td><?= $row['dbDate26'];?></td> <td><?= $row['dbDate27'];?></td> <td><?= $row['dbDate28'];?></td> </tr> <tr> <td><?= $row['dbDate29'];?></td> <td><?= $row['dbDate30'];?></td> <td><?= $row['dbDate31'];?></td> <td><?= $row['dbDate1'];?></td> <td><?= $row['dbDate1'];?></td> <td><?= $row['dbDate1'];?></td> <td><?= $row['dbDate1'];?></td> </tr> </tr> <? }} ?> </table> How can i insert the dates starting from the day i have calculated in the function phpcal

    Read the article

  • make a lazy var in scala

    - by ayvango
    Scala does not permit to create laze vars, only lazy vals. It make sense. But I've bumped on use case, where I'd like to have similar capability. I need a lazy variable holder. It may be assigned a value that should be calculated by time-consuming algorithm. But it may be later reassigned to another value and I'd like not to call first value calculation at all. Example assuming there is some magic var definition lazy var value : Int = _ val calc1 : () => Int = ... // some calculation val calc2 : () => Int = ... // other calculation value = calc1 value = calc2 val result : Int = value + 1 This piece of code should only call calc2(), not calc1 I have an idea how I can write this container with implicit conversions and and special container class. I'm curios if is there any embedded scala feature that doesn't require me write unnecessary code

    Read the article

  • What do you name the "other" kind of view-model in an MVVM project?

    - by DanM
    With MVVM, I think of a view-model as a class that provides all the data and commands that a view needs to bind to. But what happens when I have a database entity object, say a Customer, and I want to build a class that shapes or flattens the Customer class for use in a data grid. For example, maybe this special Customer object would have a property TotalOrders, which is actually calculated using a join with a collection of Order entities. My question is, what do I call this special Customer class? In other situations, I'd be tempted to call it a CustomerViewModel, but I feel like "overloading" the notion of a view-model like this would be confusing in an MVVM project. What would you suggest?

    Read the article

  • how can i substitute a NULL value for a 0 in an SQL Query result

    - by Name.IsNullOrEmpty
    SELECT EmployeeMaster.EmpNo, Sum(LeaveApplications.LeaveDaysTaken) AS LeaveDays FROM EmployeeMaster FULL OUTER JOIN LeaveApplications ON EmployeeMaster.id = LeaveApplications.EmployeeRecordID INNER JOIN LeaveMaster ON EmployeeMaster.id = LeaveMaster.EmpRecordID GRoup BY EmployeeMaster.EmpNo order by LeaveDays Desc with the above query, if an employee has no leave application record in table LeaveApplications, then their Sum(LeaveApplications.LeaveDaysTaken) AS LeaveDays column returns NULL. What i would like to do is place a value of 0 (Zero) instead of NULL. I want to do this because i have a calculated column in the same query whose formular depends on the LeaveDays returned and when LeaveDays is NULL, the formular some how fails. Is there away i can put 0 for NULL such that that i can get my desired result.

    Read the article

  • How to calculate number of leap years between two years in C#

    - by Vlad Bezden
    Hi All, Is there a better way to calculate number of leap years between two years. Assuming I have start date and end date. I have my code, but I think there should be more elegant way. calling code: var numberOfLeapYears = NumberOfLeapYears(startDate.Year + 1, endDate.Year - 1); function itself: private static int NumberOfLeapYears(int startYear, int endYear) { var counter = 0; for (var year = startYear; year <= endYear; year++) counter += DateTime.IsLeapYear(year) ? 1 : 0; return counter; } So if I have startDate = "10/16/2006" and endDate = "4/18/2004" I should only have 1 leap year (2000) in result. Another words startDate's Year and endDate's year should not be calculated, only years in between. Thanks in advance for your help.

    Read the article

  • Structuremap and creating objects with initial state

    - by Simon
    I have an object which needs a dependency injected into it public class FootballLadder { public FootballLadder(IMatchRepository matchRepository, int round) { // set initial state this.matchRepo = matchRepository; this.round = round; } public IEnumerable<LadderEntry> GetLadderEntries() { // calculate the ladder based on matches retrieved from the match repository // return the calculated ladder } private IMatchRepository matchRepo; private int round; } For arguments sake, lets assume that I can't pass the round parameter into the GetLadderEntries call itself. Using StructureMap, how can I inject the dependency on the IMatchRepository and set the initial state? Or is this one of those cases where struggling against the framework is a sign the code should be refactored?

    Read the article

  • Design RESTful service with multiple ids

    - by Dustin Digmann
    I am designing a RESTful service. It is to list a set of data. The main problem is that the set does not have a reasonable, single identifier. Nor can the specific set be easily calculated within the knowledge of the system. As a result, it does not seem possible to have a GET /items/{identifier} service. I do have the id of each element being requested. My main issue is that it does not seem RESTful to list the ids in the URI (eg GET items/{id1},{id2},...,{idn} ). Right? I could see DELETE having a similar use case - remove multiple items in one request cycle. How would such a use case be satisfied while staying within the REST realm? Is that possible?

    Read the article

  • EntityFramework how to Override properties

    - by plotnick
    I've just started using EF in VS2010. That thing is just amazin'. I frankly can't understand something. For example I have EntityType with property, they generated from database structure. Now, I have to simply override that property in my code. I don't need to save value of the property back into DB, but everytime when it gets read from DB it should be substituted with run-time calculated value. Of course I can create derived class based on my EntityType but I've tried and found kinda difficulties, I'm not sure this is kinda right way to do. Anyway even when I try to change the whole EntityType to Abstract, damn Visual Studio doesn't want to validate that and says something like: "Error 2078: The EntityType 'AssetsModel.Asset' is Abstract and can be mapped only using IsTypeOf." "Error 2063: At least one property must be mapped in the set mapping for 'Assets'" What the hell is this suppose to mean I dunno.. Any ideas gentlemen?

    Read the article

  • Ruby on Rails - observe_field help

    - by miligraf
    Trying to put in field "pagar" the calculated value of "precio" * 15% but I don't know why it is not working :S <% form_for @libro, :html => { :multipart => true } do |f| %> <%= f.label "Precio (si es venta):" %> <%= f.text_field :precio %> <%= observe_field :libro_precio, :frequency => 0.25, :update => :libro_pagar, :with => 'value*0.15' %> <%= f.label "A pagar (si es venta):" %> <%= f.text_field :pagar %> <% end %>

    Read the article

  • [MATH]Project an axis to a plane

    - by Robert
    how do i project the X axis to a plane if the plane is defined by three points? see pic here: http://129.25.16.135:2080/v6.5/books/usb/graphics/iconventions-local-surfaces.png The default local 1-direction is the projection of the global x-axis onto the surface. If the global x-axis is within 0.1° of being normal to the surface, the local 1-direction is the projection of the global z-axis onto the surface. let's suppose that these points are: t1 = [-0.362879991531372, 0.357021987438202, -0.373737007379532] t2 = [-0.383525013923645, 0.371621012687683, -0.383549988269806] t3 = [-0.383534014225006, 0.34629300236702, -0.38544899225235] is the vector [0.78280971952246, -0.0307519963686645, 0.411184845614438] correct answer in this case? i've calculated the angle between the surf and x (1,0,0) is ~28°. and can you give the entire procedure for the calculation, because i'm just puzzled.

    Read the article

  • AWK: how to reuse a result NR-times without removing END?

    - by HH
    How can I get all differences, not just one? I want to use the calculated result for each item in the third column. The dilemma is that if I remove END I can print $3 but cannot have ave. If I leave END I have ave but not all differences. awk '{sum+=$3} END {ave=sum/NR} END {print $3-ave}' coriolis_data -0.00964 // I want to see the rest differences, how? coriolis_data .105 0.005 0.9766 0.0001 0.595 0.005 .095 0.005 0.9963 0.0001 0.595 0.005 .115 0.005 0.9687 0.0001 0.595 0.005 .105 0.005 0.9693 0.0001 0.595 0.005 .095 0.005 0.9798 0.0001 0.595 0.005 .105 0.005 0.9798 0.0001 0.595 0.005 .095 0.005 0.9711 0.0001 0.595 0.005 .110 0.005 0.9640 0.0001 0.595 0.005 .105 0.005 0.9704 0.0001 0.595 0.005 .090 0.005 0.9644 0.0001 0.595 0.005

    Read the article

  • Pass Success variable to code

    - by João Dias
    How can I pass a variable that has been calculated in the success callback of an ajax function, to the document.ready ? I have this code function loadActions() { var countDiv; $.ajax({ type: "POST", cache: false, url:"modules/actions/actions.php", success : function (data) { $("#actions-container").html(data); $('.action-details').hide(); countDiv = $('.action-tab-odd').length + $('.action-tab-even').length ; } }); return countDiv; } $(document).ready(function(){ var count = loadActions(); }); But count is allways undefined. How can I get this to work? Thank you

    Read the article

  • Cleanest way to store lists of filter coefficients in a C header

    - by Nick T
    I have many (~100 or so) filter coefficients calculated with the aid of some Matlab and Excel that I want to dump into a C header file for general use, but I'm not sure what the best way to do this would be. I was starting out as so: #define BUTTER 1 #define BESSEL 2 #define CHEBY 3 #if FILT_TYPE == BUTTER #if FILT_ROLLOFF == 0.010 #define B0 256 #define B1 512 #define B2 256 #define A1 467 #define A2 -214 #elif FILT_ROLLOFF == 0.015 #define B0 256 #define B1 512 // and so on... However, if I do that and shove them all into a header, I need to set the conditionals (FILT_TYPE, FILT_ROLLOFF) in my source before including it, which seems kinda nasty. What's more, if I have 2+ different filters that want different roll-offs/filter types it won't work. I could #undef my 5 coefficients (A1-2, B0-2) in that coefficients file, but it still seems wrong to have to insert an #include buried in code.

    Read the article

  • Calculation of derived field in sql

    - by Matt
    Taking Sql this quarter and not having any luck with the following question: The height of players in feet (inches/12). Include their name. Hint: Calculation or derived field. Be sure to give the calculated field a column header. We're learning the basic Select statment and didn't find any reference on how to make custom data at w3schools. I'm using Microsoft SQL server Management Express Here's my statment so far: select nameLast, nameFirst, height from Master where height (I assume its something like 'Player_Height' = height/12) order by nameLast, nameFirst, height Thanks for the help

    Read the article

  • How to scroll whole visible page down to an anchor with a smooth effect (Scriptaculous or jQuery)?

    - by ChrisBenyamin
    Hey community, I want to create an navigation with anchors. By clicking on a navigation link, the whole visible page should scroll down to the clicked anchor. The most important is the following structure of the page. --------------- (Begin visible browser area) NAV1 nav2 nav3 content --------------- (Begin/end visible browser area) nav1 NAV2 nav3 content --------------- (Begin/end visible browser area) nav1 nav2 NAV3 content --------------- (end visible browser area) Finally all content is in a single document and the height of the current page (selected by the nav-item) has to be calculated (with a JS Library). I prefer PrototypeJS/Scriptaculous and jQuery. The scroll effect should be a smooth slide/ effect. Chris

    Read the article

  • How to handle huge table ?

    - by misha-moroshko
    I would like to display to user a table which contains ~500,000 rows. The table should be calculated based on a file (i.e. the table is known at the beginning, and does not change). I guess that building the HTML text of this table is not a good idea in terms of memory performance. So how can I build such table ? I would like user to be able to scroll the table using a vertical scroll bar. Is it possible to build on the fly only the visible part of the table ? I'm afraid to see delays because of this. Is it a better idea to use server side programming rather than Javascript ? Any advise would be appreciated.

    Read the article

  • Query - Trying to SUM one field based on content of another field

    - by ShaneL
    Table: DayOfWeek Enrollments Monday 35 Monday 12 Saturday 25 Tuesday 15 Monday 9 Tuesday 15 Basically I'm trying to sum the total enrolments for each day. so the Output will look like: DayOfWeek Enrollments Monday 56 Saturday 25 Tuesday 30 I've spent around 4 hours trying to work this out trying many many different ways but no luck. The problem I'm having is i can count how many enrollments for each day but can't have it aligned with the correct day when i run the query e.g. I want The total to be on the same line as the day it was calculated from. (I hope that is clear enough)

    Read the article

  • SQL database self interaction entity

    - by Ricardo Costa
    I've been working on a database, wich is referent to an Aeroport management. I'm having a problem that it's freaking me out.. What i'm trying to do is, assuming that a client wants to know the distance between 2 locations, in miles or kms. As an example, if the user wants to know the distance between London and Amsterdam, should that distance be calculated by a formule or should it be already stored on the database? (1,N) ____________ ____________|__ | | | | | City/Airport |<---------| |______________| How can i show to user the distance between his 2 choices? RicardoCosta

    Read the article

  • Confusion over manual/automatic sizing of Flash Sprite Objects

    - by John
    If I have a custom class subclassing Sprite and it draws some simple objects, how does this work with respect to the Sprite.width & Sprite.height properties? It seems I can draw (for example) a rectangle of any size, bigger than the Sprite size. Similarly if I set the width/height properties, what happens to the content already drawn? As a use-case, I might have a stick-man which is drawn as a set of lines, I want to set the man's height and the rendering is scaled to this. Are there any issues with width/height being auto-calculated or am I misunderstanding what these properties actually mean?

    Read the article

  • Is it good practice to export variables in Perl?

    - by gvkv
    I'm finding it very convenient to pass configuration and other data that is read or calculated once but then used many times throughout a program by using Perl's use mechanism. I'm doing this by exporting a hash into the caller's namespace. For example: package Myconfiguration; my %config; sub import { my $callpkg = caller(0); my $expsym = $_[1]; configure() unless %config; *{"$callpkg\::$expsym"} = \%config; } and then in other modules: use MyConfiguration (loc_config_sym); if ( $loc_config_sym{paramater} ) { # ... do stuff ... } However, I'm not sure about this as a best practice. Is it better to add a method that returns a hash ref with the data? Something else?

    Read the article

  • jQuery UI dialog positioning

    - by Wickethewok
    I am trying to use the jQuery dialog UI library in order to position a dialog next to some text when it is hovered over. The jQuery dialog takes a position parameter which is measured from the top left corner of the current viewport (in other words, [0, 0] will always put it in the upper left hand corner of your browser window, regardless of where you are currently scrolled to). However, the only way I know to retrieve the location is of the element relative to the ENTIRE page. The following is what I have currently. position.top is calculated to be something like 1200 or so, which puts the dialog well below the rest of the content on the page. $(".mytext").mouseover(function() { position = $(this).position(); $("#dialog").dialog('option', 'position', [position.top, position.left]); } How can I find the correct position? Thanks!

    Read the article

  • How do I find the speed of an in-progress file upload in cURL?

    - by cinek1lol
    I'd like to know how to check out the speed of a file being uploaded in real time using the cURL library in C++. This is what I have written: void progress_func(void* ptr, double TotalToDownload, double NowDownloaded, double TotalToUpload,double NowUploaded) { cout<<NowUploaded<<endl; } //... int main() { //... curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_func); } But the manual says that it shows average speed, but even this doesn't seem to work with me, because too mach fast is end. How to good write or A well-calculated?

    Read the article

< Previous Page | 154 155 156 157 158 159 160 161 162 163 164 165  | Next Page >