ryantroop 177 Practically a Master Poster

Hmmm... are you suggesting that the link I posted above worked for you in Edge? That you were able to scroll the 51 count, but the scroll bar just disappeared for you? From what I am reading in the link you posted, that seems to be for the auto hide scroll bar feature, ala MacOS/Safari style. This is not at all what I am getting at :-/

ryantroop 177 Practically a Master Poster
NOTE: Viewed and tested in 
    MS Edge 25.10586.627.0
    MS EdgeHTML 13.10586

https://jsfiddle.net/qgg86g7y/1/

As you can see in the fiddle, if 50 elements are displayed and calculated, a scroll bar will appear. 51 or more and the scrollbar will not appear, and scrolling is impossible. Is anyone else seeing this behavior? If so, is this defined or is this a bug? If a bug, where can I submit it for review?

Thanks!

Ryan

ryantroop 177 Practically a Master Poster

Are you trying to modify SVG data or just the resulting image it produces? If it's the former, then why bother with a canvas when the SVG object will serve just as well? If the latter, then there are ways to use your SVG as a data source for a canvas's blob data and it should render, and then you can modify the pixels to your hearts content.

Now, if your intention is the modify SVG data through a canvas interface, then you are building an interesting, and somewhat messy, technology, and I would encourage you to stick with pure SVG in that case. Of course, I don't know your requirements, nor what your intended use is, so that may also be a poor bit of advice.

My reasoning for the above suggestion is that SVG is a vector based system and canvas is raster based (this means it is flattened with each modification, and all pixels are merged together); where SVG there is an object in memory that is converted to a BMP via instructions for rendering (or whatever the browser wishes to use to express your data). In other terms - canvases are "lossy" where SVG's technically are not. This is also why canvases are faster, as SVG takes time to process and more memory space. In short, the conversion from SVG to Canvas is generally one way, unless you do some work to keep them in sync with each other (some how...?).

Maybe a little more info …

ryantroop 177 Practically a Master Poster

Im confused, do you want to replicate your SVG on to a canvas?

ryantroop 177 Practically a Master Poster

scope is fine, but intent is not clear in my opinion :-/

If you plan to use a variable outside of a loop, it should be declared outside even if null. That way, in the future, some fool who has to read it will understand what you meant to do, and not think "oh, well this is obviously in the wrong place...."

Just my 2c.

ryantroop 177 Practically a Master Poster

https://jsfiddle.net/j5Lrqmxd/

you should be able to modify this to meet your need.

In short, use display: inline-block and vertical-align: middle

ryantroop 177 Practically a Master Poster

I know this was marked fixed already, but if you have the option to skip JS timing all together, you might as well just use CSS and let the hardware / browser do the heavy lifting for you. The transition for opacity is pretty good, and the timing is very easily customizable... You can even attach event handlers to fire when the transition is complete to remove the element (as per your display none, or you can remove it from the DOM completely).

Just an alternative..

Ryan

ryantroop 177 Practically a Master Poster

It also depends on the target audience, and the marketing staff that determines what comprises that audience. At 62, they obviously feel you are no longer part of their target, and they no longer need to cater to you (or rather, your age group or particular vision acuity)... ageism on the internet.. sorry :(

ryantroop 177 Practically a Master Poster

You're asking server side logic 101 here...

You can make the login page the same page that processes the login, have the form post to itself. On success, redirect, on failure post a message inline to the page.

You can use AJAX and send data over the wire, and return a redirect.

So many ways you can do this.. try something, get to a point you cannot go further, and then come back.

ryantroop 177 Practically a Master Poster

The explode function does not return a value by reference.

Set the output of the explode to a variable, then pass the variable into the end() function.

ryantroop 177 Practically a Master Poster

Well... the most straight forward way is

let first arr = $aArr;
let second arr = $aArr2;

$aArr[0][1]['user_nicename'] = $aArr2[0][0]['user_nicename'];

However, this is assuming the same data every time... what I can't devise is what your data structure looks like, or how they relate - and if they are all part of the same database, why not just get it from the SQL instead of merging after the fact?

The only way you can really do this is by iterating over everything, finding specific keys (which I don't understand at all how these two arrays match up), and then merging them as the above example shows when finding a matching pair.

ryantroop 177 Practically a Master Poster

Goggle
document.createElement

and

Element.appendChild

You can dynamically build pretty much whatever you want in script.

ryantroop 177 Practically a Master Poster

based on the link you provided, and what I think you described, it looks like you have it working. What am I missing?

ryantroop 177 Practically a Master Poster
       $start=date('Y-m-d',$cdate);
       echo "<td>".dateDifference($strat ,$row['ldate'],$differenceFormat = '%d' ) ."</td>";
       You misspelled "start" as "strat"
ryantroop 177 Practically a Master Poster

You arent far off... however, you leave some interesting questions.. such as why use a decimal for a ClientNumber? Doesn't matter, though..

DECLARE 
 @Template_Account decimal(10,0) = 8,
 @Field1 nvarchar(max),
 @Field2 nvarchar(max),
 @Save1 bit,
 @Checkin1 bit,
 @Sandbox1 nvarchar(max)

 SELECT
      @Field1 = Field1,
      @Field2 = Field2,
      @Save1 = Save1,
      @Checkin1 = Checkin1,
      @Sandbox1 = Sandbox1
  from
    cltClients WITH (NOLOCK)
  WHERE 
      ClientNumber = @Template_Account

INSERT INTO cltClients (Field1, Field2, Save1, Checkin1, Sandbox1)
VALUES(@Field1,@Field2,@Save1,@Checkin1,@Sandbox1);

So what I dont understand... why are we insterting the same data into the same table? I get this is pseudo-code... but :-/ I R Confused...

ryantroop 177 Practically a Master Poster

Ok.. what in particular do you need help with?

ryantroop 177 Practically a Master Poster

Are they linked servers? SQL Server or MySQL?

If linked, you can do as suggested here:
http://stackoverflow.com/questions/1144051/selecting-data-from-two-different-servers-in-sql-server

That link also gives examples on how to set them up, but it looks like its MSSQL specific.

Short of it, make a linked server, and then use the full linked path when joining against it from the "local" server.

ryantroop 177 Practically a Master Poster

Well... for one, you can not use 3rd party code that has errors.

If that's not an option, you can look to ensure that you are implementing their code appropriately, and including appropriately as to not cause XSS errors.

If that's not an option / isnt' the problem, then start contributing to the projects that have errors and figure out where you can improve their code to reduce or remove those errors.

If that's not an option, then contact them and tell them they have a problem or see if they have a bug sheet that you can search/add to.

Lastly, no. There is nothing you can do.

rproffitt commented: gigo, bibo and maybe a 3rd F.L.A. Losing count of bad sites that don't care. +11
ryantroop 177 Practically a Master Poster

function dateDifference($date_1 , $date_2 , $differenceFormat = '%a' )
echo "<td>".dateDifference('edate','ldate',$differenceFormat = '%d' )."</td>";

Your function expects 2 dates as the first parameters. When you invoke the function, you are passing strings.

I think you meant:
echo "<td>".dateDifference($row['edate'],$row['ldate'],$differenceFormat = '%d' )."</td>";

ryantroop 177 Practically a Master Poster

have you tried var_dump ($_GET)?

Also, it seems you are only sending id_price, but your isset() looks for id_price and size_id, which means you need to add that along with id_price...

data:'id_price='+fabricID + '&size_id='+sizeID, //or something like this...

In the future, you may want to consider having your HTML/GET/POST variable names be the same as the column names, as this will prevent confusion as to what you are sending and expecting. id_price='fabricID' seems awfully odd.. why not just 'fabricID=' + fabricID?

ryantroop 177 Practically a Master Poster

Ok, what about adding the var_dumps on the variables?

ryantroop 177 Practically a Master Poster

Heh.. you want to build a personal one drive? That's kinda neat.. I might try and figure that out, too...

ryantroop 177 Practically a Master Poster

well... if you are using sessions, where is your session start? It should always be before headers are set. Other than that, you are simply replacing the one time super-global $_SESSION and inline declaring it an assoc array.

Other than that, it doesn't look like anything else is out of the ordinary :-/ This does look like a snippet from a bigger page structure, though.. :-/

Are you sure you are getting data from the database? What happens if you do a var_dump($_SESSION) and var_dump($rows) ?

ryantroop 177 Practically a Master Poster

Sounds like a job for javascript instead of php imo. However.. What seems to be your problem with this? Have you tried it yourself yet?

ryantroop 177 Practically a Master Poster

So... aside from etiquette issues, has anyone considered that google may be actively blocking the use of their site inside a frame? Has any other site been able to load into the iframe? If so, it's google that's actively blocking you.

Just a consideration :-/

ryantroop 177 Practically a Master Poster

Doing a pure client side (javascript only) captcha will not enhance security. Since all of your code would be visible to the client, even minified, someone could simply bypass it by forcing the output check to "true" or whatever you decide, and move on with their day. No matter how much you obscure it, at the end of the day the method that looks for pass or fail will be directly compromised in the console.

If you are doing this for "fun" or just to see if you can, then start researching canvas elements and see if there is some sort of OCR for javascript. This is a good starting point it seems: https://github.com/antimatter15/ocrad.js/

ryantroop 177 Practically a Master Poster

No, correct syntax is
$query = "INSERT INTO SURVEY (surveyid,q1,q2,q3) VALUES (?,?,?,?), (?,?,?,), (?,?,?,)";

ryantroop 177 Practically a Master Poster

@Atli,

Your table design doesnt handle multiple answers per question well :-/

However, your point is valid and should probably be considered :)

ryantroop 177 Practically a Master Poster

SQL server 2008+ has the same syntax, and same solutions otherwise. Batch it, or make a stored proc that takes a delimited string and makes the batch for you.

ryantroop 177 Practically a Master Poster

If you have an up to date version of mySQL you can have PHP write something like this:

insert tableName (a, b) values (c,d), (e,f), (g,h) .... (y,z);

http://dev.mysql.com/doc/refman/5.5/en/insert.html

Alternatively, you can have PHP write a batch for you, and submit a batch (but that's less efficient than using the above method). Even using a stored proc would be somewhat wasteful, as you will have the same efficiency issues, unless you have PHP make some sort of delimiter for you, pass the delimited string to sql and parse it in the stored proc, which would ultimately come down to a series of inserts (or dynamically created SQL, which would be faster in PHP :-/ )

I certainly hope you are sanitizing your data before sending to the database, as well.. all that good stuff.. good luck!
ryan

ryantroop 177 Practically a Master Poster

are you sure you have the correct URL? Are you sure they exist?

ryantroop 177 Practically a Master Poster

Im not sure why you are doing this, but "\" is an escape delimiter in PHP - so if you type \" it will treat the " as a string literal. If you are NOT intending this, then your string is invalid, as you would have 3 quotes in your string making it an unterminated constant...

Hope that helps :-/

ryantroop 177 Practically a Master Poster

Well... it is not written the way I would personally do it... it looks like too much is being attempted because "it can be done" instead of taking a direct approach to the problem. Personally, I would break it apart into smaller pieces and work with that.. Seems over complicated :-/ However, you may be correct in that I just "don't understand" it... Something like this I would likely take a profiler to, and start breaking it apart based on where the highest load is.

ryantroop 177 Practically a Master Poster

?s= is a GET request, not a POST.

ryantroop 177 Practically a Master Poster

If that's the same calculation each time in that case statement, why not do it once as its own output, and use that value's alias in your case statement. You are then only doing the calculation once, and its a scalar compare in the case statement.

As for the rest of what you are doing, and optimization, without some sort of trace analyzation it will be guesswork based on understanding how databases work... are all your indexes in order? Do you have to do the partition? Can you use local variables instead and figure out how to do the same work with joins?

Can your function be optimized in a similar fashion as the case statements? Is the function using appropriate indexes? Etc... etc.... etc...........

Edit:

So after reading a bit... I still think you're making this very complex. It might be worth while to try the most simple route first to see if that speeds things up, and only add on extended features and overhead when necessary. I'm not sure why you think CTE is the route to go for the valuation, unless the intent is to make this query run across multiple date ranges for various months.. if it is, I would still think there is a more optimal way, as the WITH () ... construct tends to be a shortcut, except where there is no other way (which, I cant really think of any, but Im sure they exist).

ryantroop 177 Practically a Master Poster

When posting questions like this, it really does help to have a "live" demo page available. That said...

A couple comments on what I do see...

you have a "fixed" footer, which removes it from the page flow no matter what - which means being structured inside the "container" element does nothing for you. In fact, it may be part of your problem depending on the browser and how it handles a fixed element inside a relative element (im pretty sure the "right" way for a browser to handle this is to ignore the relative element completely, but shrug who am I to say so?)

That said, your "container" element has a height of 100% - of what? Since your HTML and BODY tags do not have a given height, this particular bit of CSS is worthless. This means that all of the "height" comes from block elements with height that exists within the flow of the document within this container. So, if all of that adds up in size, and then you have your height 100%, you basically have double the height of the parent container - and if that causes an overflow on the page - then there's your problem.

So I went and plopped this into JS Fiddle (https://jsfiddle.net/kdvx5yes/) and you can see the result - it's not pretty. If that's not at all what your page looks like, then some other things appear to be missing, and not given to us via your code snippet …

ryantroop 177 Practically a Master Poster

Well.. if you have a duplicate, what exactly makes them different from each other so they are atomic?

If they are exact duplicates, then you will also have to MIN or MAX on your index to single one of them out, or fix your data :-/

ryantroop 177 Practically a Master Poster

Try including plateNo, Make, and Model into your group by.

Im not sure how you would have multiple matching rows, but this may be your issue :-/

ryantroop 177 Practically a Master Poster

To answer your question - yes, you would limit to only the last 10 posts with your query.

You query would look something like this:

select
  U.UserKey,
  M.MessageKey
from
  User U
    LEFT OUTER JOIN Message M ON M.UserKey = U.UserKey
 where
   M.MessageKey IN (select M2.MessageKey from Message M2 where M2.UserKey = U.UserKey order by M2.PostDate DESC LIMIT 10)
 order by
   U.UserKey (or whatever.. date?)

Of course, your mileage may vary... but this should hopefully get you started.

For speed, you may want to use an inner join instead of "IN", but then youre gonna have some struggles dealing with the LIMIT and the order.. truth be told, Im not sure how best to do it without an IN, but I've always been told that an IN can always be replaced by a JOIN of some sort.

ryantroop 177 Practically a Master Poster

For the record, my suggestion was to make a stub html page that has a single script element that has your formatted data on the page already. Not really a whole lot of work there

ryantroop 177 Practically a Master Poster

On a "modern" machine, probably not. You will have a longer delay simply downloading the data.

However, if this is the path you plan on taking, I would let PHP format it into the array so that the browser just has to JSON.parse() the value and then you don't have to worry about "processing" (so.. pretty much everything in JS is a string. If you send a raw string of whatever along to script, it will have to take that string and basically "eval" it to figure out what is inside said string. You would then turn it into an "array" which means JS then has to iterate through the string again to break everything apart. Not such a good idea...).

That said, 5MB in an array may be a bit demanding, and actually stall processing a bit (if you do a straight up for (;;) loop, and you have 100000 results, you will likely be sitting for a while to process all of that (seconds, if not minutes). It also depends on what the compare values are, if they are strings, etc... or what actions you are taking with the data as you iterate over your array.

Really, the only way to "know" is to make an HTML page that has your 5MB of data on it already formatted as you need it, and start processing it in script to check your timings. It likely will not be "usable" without some sort of spinny wheel of death to show …

ryantroop 177 Practically a Master Poster

inline-block and width: calc(100% - 230px)

or,

use floats, and put overflow: hidden on the parent div.

ryantroop 177 Practically a Master Poster

Well... you can read about the API...
https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API

You split your "canvas area" into the dimensions of your grid requirements, and you draw lines or just use math :-/

You can also look at this fine demo:
http://codepen.io/solartic/pen/qEGqNL
(not mine. This is done kindly by Kimani Walters)

And then there's this:
http://codereview.stackexchange.com/questions/114702/drawing-a-grid-on-canvas

So... really.. my answer is "just google it" and you will find a bunch of examples.

ryantroop 177 Practically a Master Poster

Likely it's just the memory used by the script. While it may not be much when compiled down, it's still memory and cycles required to turn it into machine code and have the pointers available for reference.

If memory isn't an issue (in most cases it is not) and CPU cycles are not a major thing (on most web servers they are not), then you probably have little to worry about if your file size is fairly manageable. However, if you're loading Megabytes worth of dead function pointers, many would first ask why bother? Then, the potential hit will come from how fast the machine is (and what resources are availale), and if it is capable of processing that much data that quickly (in a shared rack space and/or on a VM, it may make a few eyebrows raise).

ryantroop 177 Practically a Master Poster

To put it in other words, I believe what you are being asked is to take all the values from the first two rows and multiply them.

If you think of your 3x3 array as an array of arrays:

//demonstrative
int A[3][3] == [ [a,b,c], [d,e,f], [h,i,j] ];

You know the size of your arrays, so you can loop through them A[0][0] through A[0][2] and A[1][0] through A[1][2].

You can do this using two for loops (one for each dimension, that iterates through the sizeof each row), or using a single for loop for each dimension (since you know you only want row 0 and 1.

Alternatively, you can access them by pointer (since that's basically what they are under the hood any how).

Lots of ways to skin the cat..

ryantroop 177 Practically a Master Poster

So don't use MD5, use SHA-1 or SHA-256 or any other variant... what platform are you doing this on? In PHP, for example, you have this to work with:

http://php.net/manual/en/function.hash-algos.php

Do your research on what is best for you. I believe current industry standard is still SHA-1, but there is no reason not to go with SHA-256 or SHA-512. (Also, I believe SHA-1 is deprecated, and CERT providers and most other hash mechanisms are moving to SHA-256 or the SHA-2 family in general).

You can also reference this (originally for passwords, but gets the point across)
http://security.stackexchange.com/questions/56397/which-hashing-algorithm-is-ideal-for-use-on-the-web

You should also understand why MD5 is no longer viable as a hashing mechanism for "secure" data. It's not so much that it's easily "cracked" as much as it's easily brute forced due to the limited possible outputs from the MD5 hashing mechanism. The problem is not that you can reverse the process, it's that you can generate enough guesses to find a matching output and exploit those matches.

ryantroop 177 Practically a Master Poster

It really depends on how you plan on consuming and using the data. Why do you need encryption over a hash? Will you be applying the SSN for any given application or is it simply an identifier? If it's only an identifier, then hash it and store the hash. That way, when the user signs in with the SSN, you are doing a key lookup on the hash, and then you never have to worry about keeping the SSN anywhere near readable or deconstructable.

If you are going to use the SSN for anything other than identification, then you will likely have to have some encryption method on your server, saving the encrypted hash and key in the database, and then have a decryption method that consumes both to retrieve that data (so your database still only stores a hash and a "public" key).

ryantroop 177 Practically a Master Poster

Develop for what your customer base is likely to be using. I still support IE9, but I have to keep current with changes, and develop new features for future browsers. caniuse.com is an excellent resource. Use it. Know why you are implementing things, and how to fall back when you can't use the new.

Also, if people are disabling javascript they are likely going to be used to jacked up websites, or sites that don't quite work the way they expect. If you feel that you user base will be very very against javascript, then develop this way - otherwise, join 90% of the web and don't worry about it.

A better way to look at development with JS is this -> Is it stylistic? Do it in CSS. Is it Data? Do it in javascript. Is it functional? Try to avoid JS unless its part of the functionality in the first place (FileReader, all the new fancy HTML5 stuff, canvas, etc...). There are always going to be times when the lines get blurred, and sometimes you need the helping hand of javascript to make your CSS look right.

ryantroop 177 Practically a Master Poster

Im confused...

nav ul li a.submenu should only affect anchor tags that have the class submenu. That's a pretty specific selector...

Can you put up a fiddle with your issue so we can see more clearly what you are struggling with?

Personally, with your current structure.. my CSS would be something a little less absolute unless needed...

a.submenu by itself is more than sufficient, unless you see that class being used elsewhere. If you are concerned about other page contamination, then maybe li > a.submenu, but really your "nav" element should have its own class at that point to alleviate that concern.

You are likely getting overruled by the generalization of your selector, and arent specific enough to change what you are looking for. Try this and see if it's what youre after.

https://jsfiddle.net/6x93nzfn/

Also, your markup has an error. Your closing sub ul is missing </ul> on line 8.

ryantroop 177 Practically a Master Poster

All of them will benefit you depending on what you want to do...

For embedded systems (from my very little experience with it all), Java seems to be king, since they have a ton of code already out there to support various hardware configurations. If you write in C/C++, you will get the best performance - but that comes at likely having to write your own memory and cpu controllers (unless you find some that are preconfigured that you can use). Python has a lot of support as well, and is a big player in the maker community - it may work well for what you are looking to do.

However, if you are going with a Raspberry Pi or similar, I think they also have their own proprietary language for handling the communications of the microprocessor. Truth be told, I would love to do a lot of what you are looking into. If you ever find good resources please share!

This stack exchange article will also give you a bit more insight -- they seem to think C/C++ is the route to go:
http://arduino.stackexchange.com/questions/816/c-vs-the-arduino-language