Search Results

Search found 1544 results on 62 pages for 'weight'.

Page 7/62 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Best fit curve for trend line

    - by Dave Jarvis
    Problem Constraints Size of the data set, but not the data itself, is known. Data set grows by one data point at a time. Trend line is graphed one data point at a time (using a spline/Bezier curve). Graphs The collage below shows data sets with reasonably accurate trend lines: The graphs are: Upper-left. By hour, with ~24 data points. Upper-right. By day for one year, with ~365 data points. Lower-left. By week for one year, with ~52 data points. Lower-right. By month for one year, with ~12 data points. User Inputs The user can select: the type of time series (hourly, daily, monthly, quarterly, annual); and the start and end dates for the time series. For example, the user could select a daily report for 30 days in June. Trend Weight To calculate the window size (i.e., the number of data points to average when calculating the trend line), the following expression is used: data points / trend weight Where data points is derived from user inputs and trend weight is 6.4. Even though a trend weight of 6.4 produces good fits, it is rather arbitrary, and might not be appropriate for different user inputs. Question How should trend weight be calculated given the constraints of this problem?

    Read the article

  • Time series in R

    - by Christian Stade-Schuldt
    Hi, I am tracking my body weight in a spread sheet but I want to improve the experience by using R. I was trying to find some information about time series analysis in R but I was not succesful. The data I have here is in the following format: date - weight - body-fat-percentage - water-percentage e.g. 10/08/09 - 84.30 - 18.20 - 55.3 What I want to do plot weight and exponential moving average against time How can I achieve that?

    Read the article

  • Problem with format a single excel column with OLE automation using Delphi

    - by Snackmoore
    Dear All, I have piece of code which I use to format a range of cells in Excel. It works fine in Excel 2007 but when the range is only 1 column wide and it is Excel 2003 instead of 2007, I'll get an error saying the I am assigning invalid value for a border's line style. ** valuables such as "xlInsideHorizontal", I have declared them as CONSTANT with the proper values. Please help. procedure formatCells(FRCELLROW, FRCELLCOL, TOCELLROW, TOCELLCOL: Integer; TOPSTYLE, TOPCOLOUR, TOPWEIGHT, BOTTOMSTYLE, BOTTOMCOLOUR, BOTTOMWEIGHT, LEFTSTYLE, LEFTCOLOUR, LEFTWEIGHT, RIGHTSTYLE, RIGHTCOLOUR, RIGHTWEIGHT: Integer; INNERVSTYLE, INNERVCOLOUR, INNERVWEIGHT: Integer; INNERHSTYLE, INNERHCOLOUR, INNERHWEIGHT: Integer; HORIZONTALCELLALIGNMENT: Integer; FontBold: Boolean; NumberFormat: String ); var tmpRange: Variant; begin tmpRange := eclApp.range[eclApp.Cells[FRCELLROW, FRCELLCOL], eclApp.Cells[TOCELLROW, TOCELLCOL]]; tmpRange.Borders[xlEdgeTop].LineStyle := TOPSTYLE; if TOPSTYLE <> xlNone then begin tmpRange.Borders[xlEdgeTop].ColorIndex := TOPCOLOUR; tmpRange.Borders[xlEdgeTop].Weight := TOPWEIGHT; end; //if tmpRange.Borders[xlEdgeBottom].LineStyle := BOTTOMSTYLE; if BOTTOMSTYLE <> xlNone then begin tmpRange.Borders[xlEdgeBottom].ColorIndex := BOTTOMCOLOUR; tmpRange.Borders[xlEdgeBottom].Weight := BOTTOMWEIGHT; end; //if tmpRange.Borders[xlEdgeLeft].LineStyle := LEFTSTYLE; if LEFTSTYLE <> xlNone then begin tmpRange.Borders[xlEdgeLeft].ColorIndex := LEFTCOLOUR; tmpRange.Borders[xlEdgeLeft].Weight := LEFTWEIGHT; end; //if tmpRange.Borders[xlEdgeRight].LineStyle := RIGHTSTYLE; if RIGHTSTYLE <> xlNone then begin tmpRange.Borders[xlEdgeRight].ColorIndex := RIGHTCOLOUR; tmpRange.Borders[xlEdgeRight].Weight := RIGHTWEIGHT; end; //if tmpRange.Borders[xlInsideVertical].LineStyle := INNERVSTYLE; if INNERVSTYLE <> xlNone then begin tmpRange.Borders[xlInsideVertical].ColorIndex := INNERVCOLOUR; tmpRange.Borders[xlInsideVertical].Weight := INNERVWEIGHT; end; //if tmpRange.Borders[xlInsideHorizontal].LineStyle := INNERHSTYLE; if INNERHSTYLE <> xlNone then begin tmpRange.Borders[xlInsideHorizontal].ColorIndex := INNERHCOLOUR; tmpRange.Borders[xlInsideHorizontal].Weight := INNERHWEIGHT; end; //if tmpRange.HorizontalAlignment := HORIZONTALCELLALIGNMENT; tmpRange.Font.Bold := FontBold; tmpRange.NumberFormat := NumberFormat; end; //

    Read the article

  • How to recursively serialize an object using reflection ?

    - by Tony
    I want to navigate to the N-th level of an object, and serialize it's properties in String format. For Example: class Animal { public String name; public int weight; public Animal friend; public Set<Animal> children = new HashSet<Animal>() ; } should be serialized like this: {name:"Monkey", weight:200, friend:{name:"Monkey Friend",weight:300 ,children:{...if has children}}, children:{name:"MonkeyChild1",weight:100,children:{... recursively nested}} } And you may probably notice that it is similar to serializing an object to json. I know there're many libs can do this, can you give me some instructive ideas on how to write this?

    Read the article

  • Nginx + Haproxy + Thin + Rails - 503 Service Unavailable -

    - by Luca G. Soave
    I don't know how troubleshoot this. I get "503 Service Unavailable" http error for all "nginx upstreams" proxy passing calls to haproxy fast_thin and slow_thin ( server 127.0.0.1:3100 and server 127.0.0.1:3200 ), which loadbalance on 6 Thin servers ( 127.0.0.1:3000 .. 3005 ). Static files like /blog are currently fine. The falldown is: nginx on port 80 - haproxy on 3100 and 3200 - thin on 3000 .. 3005 and then Rails. Here it is /etc/nginx/nginx.conf : user nginx; worker_processes 2; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; sendfile on; tcp_nopush on; keepalive_timeout 65; tcp_nodelay on; include /etc/nginx/conf.d/*.conf; } then /etc/nginx/conf.d/default.conf upstream fast_thin { server 127.0.0.1:3100; } upstream slow_thin { server 127.0.0.1:3200; } server { listen 80; server_name www.gitwatcher.com; rewrite ^/(.*) http://gitwatcher.com/$1 permanent; } server { listen 80; server_name gitwatcher.com; access_log /var/www/gitwatcher/log/access.log; error_log /var/www/gitwatcher/log/error.log; root /var/www/gitwatcher/public; # index index.html; location /about { proxy_pass http://fast_thin; break; } location /trends { proxy_pass http://slow_thin; break; } location /categories { proxy_pass http://slow_thin; break; } location /signout { proxy_pass http://slow_thin; break; } location /auth/github { proxy_pass http://slow_thin; break; } location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; if (-f $request_filename/index.html) { rewrite (.*) $1/index.html break; } if (-f $request_filename.html) { rewrite (.*) $1.html break; } if (!-f $request_filename) { proxy_pass http://slow_thin; break; } } } then haproxy config file /etc/haproxy/haproxy.cfg : global log 127.0.0.1 local0 log 127.0.0.1 local1 notice #log loghost local0 info maxconn 4096 #chroot /usr/share/haproxy user haproxy group haproxy daemon #debug #quiet nbproc 1 # number of processing cores defaults log global retries 3 maxconn 2000 contimeout 5000 mode http clitimeout 60000 # maximum inactivity time on the client side srvtimeout 30000 # maximum inactivity time on the server side timeout connect 4000 # maximum time to wait for a connection attempt to a server to succeed option httplog option dontlognull option redispatch option httpclose # disable keepalive (HAProxy does not yet support the HTTP keep-alive mode) option abortonclose # enable early dropping of aborted requests from pending queue option httpchk # enable HTTP protocol to check on servers health option forwardfor # enable insert of X-Forwarded-For headers balance roundrobin # each server is used in turns, according to assigned weight stats enable # enable web-stats at /haproxy?stats stats auth haproxy:pr0xystats # force HTTP Auth to view stats stats refresh 5s # refresh rate of stats page listen rails_proxy 127.0.0.1:3100 # - equal weights on all servers # - maxconn will queue requests at HAProxy if limit is reached # - minconn dynamically scales the connection concurrency (bound my maxconn) depending on size of HAProxy queue # - check health every 20000 microseconds server web1 127.0.0.1:3000 weight 1 minconn 3 maxconn 6 check inter 20000 server web1 127.0.0.1:3001 weight 1 minconn 3 maxconn 6 check inter 20000 server web1 127.0.0.1:3002 weight 1 minconn 3 maxconn 6 check inter 20000 listen slow_proxy 127.0.0.1:3200 # cluster for slow requests, lower the queues, check less frequently server slow1 127.0.0.1:3003 weight 1 minconn 1 maxconn 3 check inter 40000 server slow2 127.0.0.1:3004 weight 1 minconn 1 maxconn 3 check inter 40000 server slow3 127.0.0.1:3005 weight 1 minconn 1 maxconn 3 check inter 40000 and the Thin config file /etc/thin/gitwatcher.yml : --- chdir: /var/www/gitwatcher environment: production address: 0.0.0.0 port: 3000 timeout: 30 log: log/thin.log pid: tmp/pids/thin.pid max_conns: 1024 max_persistent_conns: 100 require: [] wait: 30 servers: 6 daemonize: true if I look into open listen ports, I got the following : root@fullness:/var/www/gitwatcher# lsof | grep TCP | egrep "nginx|haproxy|thin" nginx 834 root 8u IPv4 921 0t0 TCP *:http (LISTEN) nginx 835 nginx 8u IPv4 921 0t0 TCP *:http (LISTEN) nginx 837 nginx 8u IPv4 921 0t0 TCP *:http (LISTEN) haproxy 1908 haproxy 4u IPv4 11699 0t0 TCP localhost:3100 (LISTEN) haproxy 1908 haproxy 6u IPv4 11701 0t0 TCP localhost:3200 (LISTEN) root@fullness:/var/www/gitwatcher# iptables -L get me the following : Chain INPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:22222 ACCEPT tcp -- anywhere anywhere tcp dpt:http ACCEPT tcp -- anywhere anywhere tcp dpt:https ACCEPT all -- anywhere anywhere DROP all -- anywhere anywhere Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere Any help ?

    Read the article

  • Jquery insertAfter() doesn't seem to work for me...

    - by Pandiya Chendur
    I have created a parent div and inserted div's after the parent div using jquery insertAfter() method.... What happens is My first record goes to the bottom and next record gets inserted above it.... Here is my function... function Iteratejsondata(HfJsonValue) { var jsonObj = eval('(' + HfJsonValue + ')'); for (var i = 0, len = jsonObj.Table.length; i < len; ++i) { var employee = jsonObj.Table[i]; $('<div class="resultsdiv"><br /><span id="EmployeeName" style="font-size:125%;font-weight:bolder;">' + employee.Emp_Name + '</span><span style="font-size:100%;font-weight:bolder;padding-left:100px;">Category&nbsp;:</span>&nbsp;<span>' + employee.Desig_Name + '</span><br /><br /><span id="SalaryBasis" style="font-size:100%;font-weight:bolder;">Salary Basis&nbsp;:</span>&nbsp;<span>' + employee.SalaryBasis + '</span><span style="font-size:100%;font-weight:bolder;padding-left:25px;">Salary&nbsp;:</span>&nbsp;<span>' + employee.FixedSalary + '</span><span style="font-size:100%;font-weight:bolder;padding-left:25px;">Address&nbsp;:</span>&nbsp;<span>' + employee.Address + '</span></div>').insertAfter('#ResultsDiv'); } } And my result is, Palani must be next to my parent div but it is at the bottom... Because insertAfter() inserts every record next to the #ResultsDiv ... Any suggestion how to insertafter the newly generated div...

    Read the article

  • problems with the email body, appearing special characters in emails

    - by tibin mathew
    Hi, I have some issues with my email -body when i send mails I'm using php in my site. My website is a spanish site , when ever i send a mail some special characters are comming in that mail. Always there is an ! mark in that mail, that too in the same place below is the code which i'm using and an email which i got. Code $domain=”http://international.com/”; $subject = "Iinternational :Solicitud de cotización "; $subject = mb_convert_encoding($subject, "UTF-8","AUTO"); $subject = mb_encode_mimeheader($subject); $mail_body ="<table width='719' border='0' align='center'>"; $mail_body .="<tr><td><a href='".$domain."' target='blank' ><img src='".$domain."images/international_s_01.jpg' border='0' width='719' style='border-color=#c8ceae' /></a></td></tr>"; $mail_body .="<tr><td style='padding-left:5px;'><font face='Verdana' size='1px;' color='#6699CC'>Estimado ".$frm_name.",</font></td></tr>"; $mail_body .="<tr><td height='30' align='center' style='padding-left:5px; font-family:Georgia, Times New Roman, Times, serif; color:#006699; font-weight:bold;font-size:20px;'><u>Solicitud de cotización de Información</u></td></tr>"; $mail_body .="<tr><td align='center'><table border='1' width='690' cellpadding='0' cellspacing='0' bordercolor='#800040'><tr><td><table border='0' width='690' cellpadding='0' cellspacing='0'>"; $mail_body .="<tr height='30'><td align='center' valign='middle' style='font-family:Verdana, Arial, Helvetica, sans-serif; color:#6699CC; font-weight:bold; font-size:15px;' width='230'>Nombre del producto</td><td align='center' valign='middle' style='font-family:Verdana, Arial, Helvetica, sans-serif; color:#6699CC; font-weight:bold; font-size:15px;' width='230'>Nombre de la subcategoría</td><td align='center' valign='middle' style='font-family:Verdana, Arial, Helvetica, sans-serif; color:#6699CC; font-weight:bold; font-size:15px;' width='230'>Nombre de la categoría</td></tr>"; $mail_body .="<tr><td align='left' style='font-family:Verdana, Arial, Helvetica, sans-serif;color:#666666;font-weight:normal;font-size:12px;padding-left:5px;' >".$product_name."</td><td style='font-family:Verdana, Arial, Helvetica, sans-serif;color:#666666;font-weight:normal;font-size:12px;padding-left:5px;' >".$sub_category_name."</td><td style='font-family:Verdana, Arial, Helvetica, sans-serif;color:#666666;font-weight:normal;font-size:12px;padding-left:5px;' >".$category_name."</td></tr>"; $mail_body .="</table></td></tr></table></td></tr>"; $mail_body .="<tr><td height='30' style='font-family:Verdana, Arial, Helvetica, sans-serif;color:#666666;font-weight:normal;font-size:12px;' >Gracias<br>Por visitar nuestro sitio y enviarnos su solicitud. Su información de contacto es segura y no será compartida con nadie.<br>Nos pondremos en contacto con usted dentro de 24 horas.</td></tr><tr><td height='20' style='font-family:Verdana, Arial, Helvetica, sans-serif;color:#6699CC;font-weight:bold;font-size:15px;padding-left:5px;' ><FONT face=tahoma color=#000000 size=2><a href='".$domain."'>www. international.com</a></font></td></tr>"; $mail_body .="<tr><td height='3'></td></tr></table>"; //$headers = "From: ".$mail_from."\n"; $mail_body = mb_convert_encoding($mail_body, "UTF-8","AUTO"); mb_language("es"); $headers .= "X-Mailer: PHP/" . phpversion()."\n"; // mailer $headers .= "From: " ."".mb_encode_mimeheader (mb_convert_encoding($mail_from,"UTF-8","AUTO")) ."" ."<".$mail_from."> \n"; $headers .= "Content-Type: text/html; charset=UTF-8";// Mime type////charset=UNICODE-1-1-UTF-8 //$headers .= "Reply-To: ". $email."\n"; // Return path for errors //$headers .= "Content-Transfer-Encoding: 16bit\n"; $success=mail($mail_to, $subject, $mail_body, $headers); $sucess_flag_user = 1;//sent the mail and set the sucess falg to 1 4 the time beigng mail func not called header("Location:./thank-you-quote.php?sucess_flag_admin=".encrypt($sucess_flag_admin )); Email which i received Estimado Thomas, Solicitud de cotización de Información Nombre del producto Nombre de la subcategoría Nombre de la categoría HPDFO - Lente Alta Definición Accesorios VersaLaser® Grac! ias Por visitar nuestro sitio y enviarnos s! u solici tud. Su información de contacto es segura y no será compartida con nadie. Nos pondremos en contacto con usted dentro de 24 horas. www.International.com This is a spanish mail here there are some ! coming inside that mail. I dont now why its comming. Please help me to fix this issue. Thanks in advance

    Read the article

  • Add divs below a parent div using jquery...

    - by Pandiya Chendur
    Here is my parent div, <div id="ResultsDiv" class="resultsdiv"> <br /> <span id="EmployeeName" style="font-size:125%;font-weight:bolder;">Pandiyan</span><span style="font-size:100%;font-weight:bolder;padding-left:100px;">Category&nbsp;:</span>&nbsp;<span>Supervisor</span><br /><br /> <span id="SalaryBasis" style="font-size:100%;font-weight:bolder;">Salary Basis&nbsp;:</span>&nbsp;<span>Monthly</span><span style="font-size:100%;font-weight:bolder;padding-left:25px;">Salary&nbsp;:</span>&nbsp;<span>25,000</span> <span style="font-size:100%;font-weight:bolder;padding-left:25px;">Address&nbsp;:</span>&nbsp;<span>Madurai</span> </div> How to add divs below this parent div using jquery, function Iteratejsondata(HfJsonValue) { var jsonObj = eval('(' + HfJsonValue + ')'); for (var i = 0, len = jsonObj.Table.length; i < len; ++i) { var employee = jsonObj.Table[i]; //Add divs here based on length } }

    Read the article

  • Why is there a constructor method if you can assign the values to variables?

    - by Joel
    I'm just learning PHP, and I'm confused about what the purpose of the __construct() method? If I can do this: class Bear { // define properties public $name = 'Bill'; public $weight = 200; // define methods public function eat($units) { echo $this->name." is eating ".$units." units of food... <br />"; $this->weight += $units; } } Then why do it with a constructor instead? : class Bear { // define properties public $name; public $weight; public function __construct(){ $this->name = 'Bill'; $this->weight = 200; } // define methods public function eat($units) { echo $this->name." is eating ".$units." units of food... <br />"; $this->weight += $units; } }

    Read the article

  • JSON Search and remove in php?

    - by moogeek
    Hello! I have a session variable $_SESSION["animals"] containing a deep json object with values: $_SESSION["animals"]='{ "0":{"kind":"mammal","name":"Pussy the Cat","weight":"12kg","age":"5"}, "1":{"kind":"mammal","name":"Roxy the Dog","weight":"25kg","age":"8"}, "2":{"kind":"fish","name":"Piranha the Fish","weight":"1kg","age":"1"}, "3":{"kind":"bird","name":"Einstein the Parrot","weight":"0.5kg","age":"4"}, }'; For example, I want to find the line with "Piranha the Fish" and then remove it (and json_encode it again as it was). How to do this? I guess i need to search in json_decode($_SESSION["animals"],true) resulting array and find the parent key to remove but i'm stucked anyways.

    Read the article

  • Django Database design -- Is this a good stragety for overriding defaults

    - by rh0dium
    Hi SO's I have a question on good database design practices and I would like to leverage you guys for pointers. The project started out simple. Hey we have a bunch of questions we want answered for every project (no problem) Which turned into... Hey we have so many questions can we group them into sections (yup we can do that) Which lead into.. Can we weight these questions and I don't really want some of these questions for my project (Yes but we are getting difficult) And then I'm thinking they will want to have each section have it's own weight.. Requirements So there's the requirements - For n number of project Allow a admin member the ability select the questions for a project Allow the admin member to re-weigh or use the default weights for the questions Allow the admin member to re-weight the sections Allow team members to answer the questions. So here is what I came up with. Please feel free to comment and provide better examples models.py from django.db import models from django.contrib.sites.models import Site from django.conf import settings class Section(models.Model): """ This describes the various sections for a checklist: """ name = models.CharField(max_length=64) description = models.TextField() class Question(models.Model): """ This simply provides a simple way to list out the questions. """ question = models.CharField(max_length=255) answer_type = models.CharField(max_length=16) description = models.TextField() section = models.ForeignKey(Section) class ProjectQuestion(models.Model): """ These are the questions relevant to the project """ question = models.ForeignKey(Question) answer = models.CharField(max_length=255) required = models.BooleanField(default=True) weight = models.FloatField(default = XXX) class Project(models.Model): """ Here is where we want to gather our questions """ questions = models.ManyToManyField(ProjectQuestion) Immediate questions: - When I start a project - any ideas on how to "pre-populate" the questions (and ultimately the weights) for the project? - Is there a generally accepted method for doing this process that I am missing? Basically the idea that you refer to the questions overide your own default weight, and store the answer? - It appears that a good chuck of the work will be done in the views and that a lot of checking will need to occur there? Is that OK? Again - feel free to give me better strategies!! Thanks

    Read the article

  • Coding issue in the 3D Buzz Hyperion tutorial.I am work

    - by Geno
    I'm following along with the tutorial. And we are currently coding the Item class. I am using the 2008 edition, while the tutorial uses 2005. The code I am having issue with is: public string Weight { get { return weight; } set { weight = value; } } earlier in the code, we had: private int Weight = 1; as you can see, they are both different variables, int, and string. I'm doing exactly as the tutorial shows, on mine, I get a conversion error, whereas in the tutorial, there are no errors, why is this? I'm doing exactly what the video shows.

    Read the article

  • How to do word wrapping.

    - by Talha Bin Shakir
    Hi, I have created a table in PHP but the cells size is not fixed it expends when the input is long. Here is the Code. echo "<div style=\"overflow-y: scroll; white-space: nowrap; height: 190px;\">\n"; echo "<table cellspacing=\"1\" cellpadding=\"1\" align=\"center\" width=\"100%\" id=\"clients\">\n"; echo "<tr bgcolor=\"2b2d5d\">\n"; echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">&nbsp;</th>\n"; echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Name</th>\n"; echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Address</th>\n"; echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Phone</th>\n"; echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Fax</th>\n"; I want to fixed the cells width please need help. Thanks

    Read the article

  • MVC how to implement two different post actions

    - by AnonyMouse
    I'm developing this really important squirrel application. There is a wizard where squirrels are added to the database. So say there are three screens to this wizard: Squirrel name details Height and weight Nut storage So at each step of the wizard I'm wanting to save the details to the database. The Height and weight view looks like: @model HeightWeightViewModel @{ ViewBag.Title = "Height and weight"; } <h2>Height and weight</h2> @using (Html.BeginForm()) { <h3>Height</h3> <div> @Html.EditorFor(model => model.Squirrel.Height) </div> <h3>Weight</h3> <div> @Html.EditorFor(model => model.Squirrel.Weight) </div> <input type="submit" value="Previous" /> <input type="submit" value="Next" /> } So I'm hoping that Previous and Next buttons will save these details. The Previous button while saving will also take the user to the Squirrel name details page. The Next will save and take the user to the nut storage page. I got the Next button working using: public ActionResult Edit(SquirrelViewModel squirrelViewModel) { _unitOfWork.SaveHeightWeight(squirrelViewModel); return RedirectToAction("Edit", "NutStorage", new { id = squirrelViewModel.Squirrel.Id }); } So the Next button saves the details and sends the user to the NutStorage page. The Previous button does the same as Next but I actually want it to send the user to the first step of the Wizard after saving. I'm not sure how to do this. Would I have another method to post to for Previous? I can't image how to implement this. Maybe I should be using ActionLinks instead of submit buttons but that would not post the details to be saved. Can anyone suggest how to get the previous button to save and send the user to the first page of the wizard while still having the Next functionality working?

    Read the article

  • I need objective-C syntax for calculating bmi

    - by Umaid
    Actually I am working on bmi calculator. Where I would like to calculate bmi for height in inches and weight in lbs and also in need of correct formula for height in cm and weight in kgs. I have tried but couldn't calculate actual value coming withing the range as below. It exceeds the range. BMI Categories: * Underweight = <18.5 * Normal weight = 18.5-24.9 * Overweight = 25-29.9 * Obesity = BMI of 30 or greater

    Read the article

  • sql query without subquery

    - by user1285737
    I need to rewrite this query and I'm not allowed to use a subquery. I need to select the name and color of the parts that are heavier than the wheel. SELECT name, color FROM parts WHERE weight > (SELECT weight FROM parts WHERE name="wheel"); This is the table: PARTS ID NAME COLOR WEIGHT 1 wheel black 100 2 tire black 50 3 gear red 20 Thanks in advance

    Read the article

  • MS-Access: SQL for updating a column in a table

    - by tecnodude
    Hi, I have the following table in an access database id VisitNo Weight 1 1 100 1 2 95 1 3 96 1 4 94 1 5 93 Now row 2 and 4 are deleted. So i have... id VisitNo Weight 1 1 100 1 3 96 1 5 93 However what i need is... id VisitNo Weight 1 1 100 1 2 96 1 3 93 What is the SQL query i need to accomplish the above? thanks

    Read the article

  • I need objective syntax for calculating bmi

    - by Umaid
    Actually I am working on bmi calculator. Where I would like to calculate bmi for height in inches and weight in lbs and also in need of correct formula for height in cm and weight in kgs. I have tried but couldn't calculate actual value coming withing the range as below. It exceeds the range. BMI Categories: * Underweight = <18.5 * Normal weight = 18.5-24.9 * Overweight = 25-29.9 * Obesity = BMI of 30 or greater

    Read the article

  • sql query is too slow, how to improve speed

    - by user1289282
    I have run into a bottleneck when trying to update one of my tables. The player table has, among other things, id, skill, school, weight. What I am trying to do is: SELECT id, skill FROM player WHERE player.school = (current school of 4500) AND player.weight = (current weight of 14) to find the highest skill of all players returned from the query UPDATE player SET starter = 'TRUE' WHERE id = (highest skill) move to next weight and repeat when all weights have been completed move to next school and start over all schools completed, done I have this code implemented and it works, but I have approximately 4500 schools totaling 172000 players and the way I have it now, it would take probably a half hour or more to complete (did not wait it out), which is way too slow. How to speed this up? Short of reducing the scale of the system, I am willing to do anything that gets the intended result. Thanks! *the weights are the standard folk style wrestling weights ie, 103, 113, 120, 126, 132, 138, 145, 152, 160, 170, 182, 195, 220, 285 pounds

    Read the article

  • SQL updating a column in a table

    - by tecnodude
    Hi, I have the following table in an access database id VisitNo Weight 1 1 100 1 2 95 1 3 96 1 4 94 1 5 93 Now row 2 and 4 are deleted. So i have... id VisitNo Weight 1 1 100 1 3 96 1 5 93 However what i need is... id VisitNo Weight 1 1 100 1 2 96 1 3 93 What is the SQL query i need to accomplish the above? thanks

    Read the article

  • evaluating a code of a graph [migrated]

    - by mazen.r.f
    This is relatively a long code,if you have the tolerance and the will to find out how to make this code work then take a look please, i will appreciate your feed back. i have spent two days trying to come up with a code to represent a graph , then calculate the shortest path using dijkastra algorithm , but i am not able to get the right result , even the code runs without errors , but the result is not correct , always i am getting 0. briefly,i have three classes , Vertex, Edge, Graph , the Vertex class represents the nodes in the graph and it has id and carried ( which carry the weight of the links connected to it while using dijkastra algorithm ) and a vector of the ids belong to other nodes the path will go through before arriving to the node itself , this vector is named previous_nodes. the Edge class represents the edges in the graph it has two vertices ( one in each side ) and a wight ( the distance between the two vertices ). the Graph class represents the graph , it has two vectors one is the vertices included in this graph , and the other is the edges included in the graph. inside the class Graph there is a method its name shortest takes the sources node id and the destination and calculates the shortest path using dijkastra algorithm, and i think that it is the most important part of the code. my theory about the code is that i will create two vectors one for the vertices in the graph i will name it vertices and another vector its name is ver_out it will include the vertices out of calculation in the graph, also i will have two vectors of type Edge , one its name edges for all the edges in the graph and the other its name is track to contain temporarily the edges linked to the temporarily source node in every round , after the calculation of every round the vector track will be cleared. in main() i created five vertices and 10 edges to simulate a graph , the result of the shortest path supposedly to be 4 , but i am always getting 0 , that means i am having something wrong in my code , so if you are interesting in helping me find my mistake and how to make the code work , please take a look. the way shortest work is as follow at the beginning all the edges will be included in the vector edges , we select the edges related to the source and put them in the vector track , then we iterate through track and add the wight of every edge to the vertex (node ) related to it ( not the source vertex ) , then after we clear track and remove the source vertex from the vector vertices and select a new source , and start over again select the edges related to the new source , put them in track , iterate over edges in tack , adding the weights to the corresponding vertices then remove this vertex from the vector vertices, and clear track , and select a new source , and so on . here is the code. #include<iostream> #include<vector> #include <stdlib.h> // for rand() using namespace std; class Vertex { private: unsigned int id; // the name of the vertex unsigned int carried; // the weight a vertex may carry when calculating shortest path vector<unsigned int> previous_nodes; public: unsigned int get_id(){return id;}; unsigned int get_carried(){return carried;}; void set_id(unsigned int value) {id = value;}; void set_carried(unsigned int value) {carried = value;}; void previous_nodes_update(unsigned int val){previous_nodes.push_back(val);}; void previous_nodes_erase(unsigned int val){previous_nodes.erase(previous_nodes.begin() + val);}; Vertex(unsigned int init_val = 0, unsigned int init_carried = 0) :id (init_val), carried(init_carried) // constructor { } ~Vertex() {}; // destructor }; class Edge { private: Vertex first_vertex; // a vertex on one side of the edge Vertex second_vertex; // a vertex on the other side of the edge unsigned int weight; // the value of the edge ( or its weight ) public: unsigned int get_weight() {return weight;}; void set_weight(unsigned int value) {weight = value;}; Vertex get_ver_1(){return first_vertex;}; Vertex get_ver_2(){return second_vertex;}; void set_first_vertex(Vertex v1) {first_vertex = v1;}; void set_second_vertex(Vertex v2) {second_vertex = v2;}; Edge(const Vertex& vertex_1 = 0, const Vertex& vertex_2 = 0, unsigned int init_weight = 0) : first_vertex(vertex_1), second_vertex(vertex_2), weight(init_weight) { } ~Edge() {} ; // destructor }; class Graph { private: std::vector<Vertex> vertices; std::vector<Edge> edges; public: Graph(vector<Vertex> ver_vector, vector<Edge> edg_vector) : vertices(ver_vector), edges(edg_vector) { } ~Graph() {}; vector<Vertex> get_vertices(){return vertices;}; vector<Edge> get_edges(){return edges;}; void set_vertices(vector<Vertex> vector_value) {vertices = vector_value;}; void set_edges(vector<Edge> vector_ed_value) {edges = vector_ed_value;}; unsigned int shortest(unsigned int src, unsigned int dis) { vector<Vertex> ver_out; vector<Edge> track; for(unsigned int i = 0; i < edges.size(); ++i) { if((edges[i].get_ver_1().get_id() == vertices[src].get_id()) || (edges[i].get_ver_2().get_id() == vertices[src].get_id())) { track.push_back (edges[i]); edges.erase(edges.begin()+i); } }; for(unsigned int i = 0; i < track.size(); ++i) { if(track[i].get_ver_1().get_id() != vertices[src].get_id()) { track[i].get_ver_1().set_carried((track[i].get_weight()) + track[i].get_ver_2().get_carried()); track[i].get_ver_1().previous_nodes_update(vertices[src].get_id()); } else { track[i].get_ver_2().set_carried((track[i].get_weight()) + track[i].get_ver_1().get_carried()); track[i].get_ver_2().previous_nodes_update(vertices[src].get_id()); } } for(unsigned int i = 0; i < vertices.size(); ++i) if(vertices[i].get_id() == src) vertices.erase(vertices.begin() + i); // removing the sources vertex from the vertices vector ver_out.push_back (vertices[src]); track.clear(); if(vertices[0].get_id() != dis) {src = vertices[0].get_id();} else {src = vertices[1].get_id();} for(unsigned int i = 0; i < vertices.size(); ++i) if((vertices[i].get_carried() < vertices[src].get_carried()) && (vertices[i].get_id() != dis)) src = vertices[i].get_id(); //while(!edges.empty()) for(unsigned int round = 0; round < vertices.size(); ++round) { for(unsigned int k = 0; k < edges.size(); ++k) { if((edges[k].get_ver_1().get_id() == vertices[src].get_id()) || (edges[k].get_ver_2().get_id() == vertices[src].get_id())) { track.push_back (edges[k]); edges.erase(edges.begin()+k); } }; for(unsigned int n = 0; n < track.size(); ++n) if((track[n].get_ver_1().get_id() != vertices[src].get_id()) && (track[n].get_ver_1().get_carried() > (track[n].get_ver_2().get_carried() + track[n].get_weight()))) { track[n].get_ver_1().set_carried((track[n].get_weight()) + track[n].get_ver_2().get_carried()); track[n].get_ver_1().previous_nodes_update(vertices[src].get_id()); } else if(track[n].get_ver_2().get_carried() > (track[n].get_ver_1().get_carried() + track[n].get_weight())) { track[n].get_ver_2().set_carried((track[n].get_weight()) + track[n].get_ver_1().get_carried()); track[n].get_ver_2().previous_nodes_update(vertices[src].get_id()); } for(unsigned int t = 0; t < vertices.size(); ++t) if(vertices[t].get_id() == src) vertices.erase(vertices.begin() + t); track.clear(); if(vertices[0].get_id() != dis) {src = vertices[0].get_id();} else {src = vertices[1].get_id();} for(unsigned int tt = 0; tt < edges.size(); ++tt) { if(vertices[tt].get_carried() < vertices[src].get_carried()) { src = vertices[tt].get_id(); } } } return vertices[dis].get_carried(); } }; int main() { cout<< "Hello, This is a graph"<< endl; vector<Vertex> vers(5); vers[0].set_id(0); vers[1].set_id(1); vers[2].set_id(2); vers[3].set_id(3); vers[4].set_id(4); vector<Edge> eds(10); eds[0].set_first_vertex(vers[0]); eds[0].set_second_vertex(vers[1]); eds[0].set_weight(5); eds[1].set_first_vertex(vers[0]); eds[1].set_second_vertex(vers[2]); eds[1].set_weight(9); eds[2].set_first_vertex(vers[0]); eds[2].set_second_vertex(vers[3]); eds[2].set_weight(4); eds[3].set_first_vertex(vers[0]); eds[3].set_second_vertex(vers[4]); eds[3].set_weight(6); eds[4].set_first_vertex(vers[1]); eds[4].set_second_vertex(vers[2]); eds[4].set_weight(2); eds[5].set_first_vertex(vers[1]); eds[5].set_second_vertex(vers[3]); eds[5].set_weight(5); eds[6].set_first_vertex(vers[1]); eds[6].set_second_vertex(vers[4]); eds[6].set_weight(7); eds[7].set_first_vertex(vers[2]); eds[7].set_second_vertex(vers[3]); eds[7].set_weight(1); eds[8].set_first_vertex(vers[2]); eds[8].set_second_vertex(vers[4]); eds[8].set_weight(8); eds[9].set_first_vertex(vers[3]); eds[9].set_second_vertex(vers[4]); eds[9].set_weight(3); unsigned int path; Graph graf(vers, eds); path = graf.shortest(2, 4); cout<< path << endl; return 0; }

    Read the article

  • Evaluating code for a graph [migrated]

    - by mazen.r.f
    This is relatively long code. Please take a look at this code if you are still willing to do so. I will appreciate your feedback. I have spent two days trying to come up with code to represent a graph, calculating the shortest path using Dijkstra's algorithm. But I am not able to get the right result, even though the code runs without errors. The result is not correct and I am always getting 0. I have three classes: Vertex, Edge, and Graph. The Vertex class represents the nodes in the graph and it has id and carried (which carry the weight of the links connected to it while using Dijkstra's algorithm) and a vector of the ids belong to other nodes the path will go through before arriving to the node itself. This vector is named previous_nodes. The Edge class represents the edges in the graph and has two vertices (one in each side) and a width (the distance between the two vertices). The Graph class represents the graph. It has two vectors, where one is the vertices included in this graph, and the other is the edges included in the graph. Inside the class Graph, there is a method named shortest() that takes the sources node id and the destination and calculates the shortest path using Dijkstra's algorithm. I think that it is the most important part of the code. My theory about the code is that I will create two vectors, one for the vertices in the graph named vertices, and another vector named ver_out (it will include the vertices out of calculation in the graph). I will also have two vectors of type Edge, where one is named edges (for all the edges in the graph), and the other is named track (to temporarily contain the edges linked to the temporary source node in every round). After the calculation of every round, the vector track will be cleared. In main(), I've created five vertices and 10 edges to simulate a graph. The result of the shortest path supposedly is 4, but I am always getting 0. That means I have something wrong in my code. If you are interesting in helping me find my mistake and making the code work, please take a look. The way shortest work is as follow: at the beginning, all the edges will be included in the vector edges. We select the edges related to the source and put them in the vector track, then we iterate through track and add the width of every edge to the vertex (node) related to it (not the source vertex). After that, we clear track and remove the source vertex from the vector vertices and select a new source. Then we start over again and select the edges related to the new source, put them in track, iterate over edges in track, adding the weights to the corresponding vertices, then remove this vertex from the vector vertices. Then clear track, and select a new source, and so on. #include<iostream> #include<vector> #include <stdlib.h> // for rand() using namespace std; class Vertex { private: unsigned int id; // the name of the vertex unsigned int carried; // the weight a vertex may carry when calculating shortest path vector<unsigned int> previous_nodes; public: unsigned int get_id(){return id;}; unsigned int get_carried(){return carried;}; void set_id(unsigned int value) {id = value;}; void set_carried(unsigned int value) {carried = value;}; void previous_nodes_update(unsigned int val){previous_nodes.push_back(val);}; void previous_nodes_erase(unsigned int val){previous_nodes.erase(previous_nodes.begin() + val);}; Vertex(unsigned int init_val = 0, unsigned int init_carried = 0) :id (init_val), carried(init_carried) // constructor { } ~Vertex() {}; // destructor }; class Edge { private: Vertex first_vertex; // a vertex on one side of the edge Vertex second_vertex; // a vertex on the other side of the edge unsigned int weight; // the value of the edge ( or its weight ) public: unsigned int get_weight() {return weight;}; void set_weight(unsigned int value) {weight = value;}; Vertex get_ver_1(){return first_vertex;}; Vertex get_ver_2(){return second_vertex;}; void set_first_vertex(Vertex v1) {first_vertex = v1;}; void set_second_vertex(Vertex v2) {second_vertex = v2;}; Edge(const Vertex& vertex_1 = 0, const Vertex& vertex_2 = 0, unsigned int init_weight = 0) : first_vertex(vertex_1), second_vertex(vertex_2), weight(init_weight) { } ~Edge() {} ; // destructor }; class Graph { private: std::vector<Vertex> vertices; std::vector<Edge> edges; public: Graph(vector<Vertex> ver_vector, vector<Edge> edg_vector) : vertices(ver_vector), edges(edg_vector) { } ~Graph() {}; vector<Vertex> get_vertices(){return vertices;}; vector<Edge> get_edges(){return edges;}; void set_vertices(vector<Vertex> vector_value) {vertices = vector_value;}; void set_edges(vector<Edge> vector_ed_value) {edges = vector_ed_value;}; unsigned int shortest(unsigned int src, unsigned int dis) { vector<Vertex> ver_out; vector<Edge> track; for(unsigned int i = 0; i < edges.size(); ++i) { if((edges[i].get_ver_1().get_id() == vertices[src].get_id()) || (edges[i].get_ver_2().get_id() == vertices[src].get_id())) { track.push_back (edges[i]); edges.erase(edges.begin()+i); } }; for(unsigned int i = 0; i < track.size(); ++i) { if(track[i].get_ver_1().get_id() != vertices[src].get_id()) { track[i].get_ver_1().set_carried((track[i].get_weight()) + track[i].get_ver_2().get_carried()); track[i].get_ver_1().previous_nodes_update(vertices[src].get_id()); } else { track[i].get_ver_2().set_carried((track[i].get_weight()) + track[i].get_ver_1().get_carried()); track[i].get_ver_2().previous_nodes_update(vertices[src].get_id()); } } for(unsigned int i = 0; i < vertices.size(); ++i) if(vertices[i].get_id() == src) vertices.erase(vertices.begin() + i); // removing the sources vertex from the vertices vector ver_out.push_back (vertices[src]); track.clear(); if(vertices[0].get_id() != dis) {src = vertices[0].get_id();} else {src = vertices[1].get_id();} for(unsigned int i = 0; i < vertices.size(); ++i) if((vertices[i].get_carried() < vertices[src].get_carried()) && (vertices[i].get_id() != dis)) src = vertices[i].get_id(); //while(!edges.empty()) for(unsigned int round = 0; round < vertices.size(); ++round) { for(unsigned int k = 0; k < edges.size(); ++k) { if((edges[k].get_ver_1().get_id() == vertices[src].get_id()) || (edges[k].get_ver_2().get_id() == vertices[src].get_id())) { track.push_back (edges[k]); edges.erase(edges.begin()+k); } }; for(unsigned int n = 0; n < track.size(); ++n) if((track[n].get_ver_1().get_id() != vertices[src].get_id()) && (track[n].get_ver_1().get_carried() > (track[n].get_ver_2().get_carried() + track[n].get_weight()))) { track[n].get_ver_1().set_carried((track[n].get_weight()) + track[n].get_ver_2().get_carried()); track[n].get_ver_1().previous_nodes_update(vertices[src].get_id()); } else if(track[n].get_ver_2().get_carried() > (track[n].get_ver_1().get_carried() + track[n].get_weight())) { track[n].get_ver_2().set_carried((track[n].get_weight()) + track[n].get_ver_1().get_carried()); track[n].get_ver_2().previous_nodes_update(vertices[src].get_id()); } for(unsigned int t = 0; t < vertices.size(); ++t) if(vertices[t].get_id() == src) vertices.erase(vertices.begin() + t); track.clear(); if(vertices[0].get_id() != dis) {src = vertices[0].get_id();} else {src = vertices[1].get_id();} for(unsigned int tt = 0; tt < edges.size(); ++tt) { if(vertices[tt].get_carried() < vertices[src].get_carried()) { src = vertices[tt].get_id(); } } } return vertices[dis].get_carried(); } }; int main() { cout<< "Hello, This is a graph"<< endl; vector<Vertex> vers(5); vers[0].set_id(0); vers[1].set_id(1); vers[2].set_id(2); vers[3].set_id(3); vers[4].set_id(4); vector<Edge> eds(10); eds[0].set_first_vertex(vers[0]); eds[0].set_second_vertex(vers[1]); eds[0].set_weight(5); eds[1].set_first_vertex(vers[0]); eds[1].set_second_vertex(vers[2]); eds[1].set_weight(9); eds[2].set_first_vertex(vers[0]); eds[2].set_second_vertex(vers[3]); eds[2].set_weight(4); eds[3].set_first_vertex(vers[0]); eds[3].set_second_vertex(vers[4]); eds[3].set_weight(6); eds[4].set_first_vertex(vers[1]); eds[4].set_second_vertex(vers[2]); eds[4].set_weight(2); eds[5].set_first_vertex(vers[1]); eds[5].set_second_vertex(vers[3]); eds[5].set_weight(5); eds[6].set_first_vertex(vers[1]); eds[6].set_second_vertex(vers[4]); eds[6].set_weight(7); eds[7].set_first_vertex(vers[2]); eds[7].set_second_vertex(vers[3]); eds[7].set_weight(1); eds[8].set_first_vertex(vers[2]); eds[8].set_second_vertex(vers[4]); eds[8].set_weight(8); eds[9].set_first_vertex(vers[3]); eds[9].set_second_vertex(vers[4]); eds[9].set_weight(3); unsigned int path; Graph graf(vers, eds); path = graf.shortest(2, 4); cout<< path << endl; return 0; }

    Read the article

  • Checking out the Helios IIS Owin Web Server Host

    - by Rick Strahl
    During last week's MVP summit Microsoft showed a new light weight, Owin host called Helios, that can run directly on the IIS core without using the ASP.NET Runtime. It's light weight and fast, and offers a glimpse into where Microsoft is heading for building a more nimble and componentized runtime that is bound to be more flexible and agile. In this post I describe how to set up Helios to play around with and some of the implications it brings.

    Read the article

  • How do I access the preferences from my main dialog window? Also how do I add a new preference?

    - by Captain_Glen
    class PreferencesCalorieBurnerDialog(PreferencesDialog): __gtype_name__ = "PreferencesCalorieBurnerDialog" def finish_initializing(self, builder): # pylint: disable=E1002 """Set up the preferences dialog""" super(PreferencesCalorieBurnerDialog, self).finish_initializing(builder) # Bind each preference widget to gsettings settings = Gio.Settings("net.launchpad.calorie-burner") widget = self.builder.get_object('example_entry') settings.bind("example", widget, "text", Gio.SettingsBindFlags.DEFAULT) #Custom preference widget = self.builder.get_object('weight') settings.bind("weight", widget, "float", Gio.SettingsBindFlags.DEFAULT) Main Dialog self.PreferencesDialog.get_weight()???

    Read the article

  • HAProxy reqrep remove URI on backend request

    - by Jim
    real quick question regarding HAProxy reqrep. I am trying to rewrite/replace the request that gets sent to the backend. I have the following example domain and URIs http://domain/web1 http://domain/web2 I want web1 to go to backend webfarm1, and web2 to go to webfarm2. Currently this does happen. However I want to strip off the web1 or web2 URI when the request is sent to the backend. Here is my haproxy.cfg frontend webVIP_80 mode http bind :80 #acl routing to backend acl web1_path path_beg /web1 acl web2_path path_beg /web2 #which backend use_backend webfarm1 if web1_path use_backend webfarm2 if web2_path default_backend webfarm1 backend webfarm1 mode http reqrep ^([^\ ]*)\ /web1/(.*) \1\ /\2 balance roundrobin option httpchk HEAD /index HTTP/1.1\r\nHost:\ example.com server webtest1 10.0.0.10:80 weight 5 check slowstart 5000ms server webtest2 10.0.0.20:80 weight 5 check slowstart 5000ms backend webfarm2 mode http reqrep ^([^\ ]*)\ /web2/(.*) \1\ /\2 balance roundrobin option httpchk HEAD /index HTTP/1.1\r\nHost:\ example.com server webtest1-farm2 10.0.0.110:80 weight 5 check slowstart 5000ms server webtest2-farm2 10.0.0.120:80 weight 5 check slowstart 5000ms If I go to http://domain/web1 or http://domain/web2 I see it in the error logs that the request on a server in each backend that the requst is for the resource /web1 or /web2 respectively. Therefore I believe there to be something wrong with my regular expression, even though I copied and pasted it from the Documentation. http://code.google.com/p/haproxy-docs/wiki/reqrep Summary: I'm trying to route traffic based on URI, however I want to strip the URI on the backend side. Go to http://domain/web1 -- backend request of / to webfarm1 Thank you! -Jim

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >