|
There is a few wrong stuff, but main error is that code is written on an bastardly stupid VB!
|
|
|
|
|
A screenshot from my laptop early today..
<a href="https://picasaweb.google.com/lh/photo/De0HCAngTHWVhc6HEy3NJNMTjNZETYmyPJy0liipFm0?feat=directlink">https://picasaweb.google.com/lh/photo/De0HCAngTHWVhc6HEy3NJNMTjNZETYmyPJy0liipFm0?feat=directlink</a>[<a href="https://picasaweb.google.com/lh/photo/De0HCAngTHWVhc6HEy3NJNMTjNZETYmyPJy0liipFm0?feat=directlink" target="_blank" title="New Window">^</a>]
-- modified 27-Jul-12 5:14am.
|
|
|
|
|
|
Edited it in latest Chrome. Doesn't show up too good with that either.
|
|
|
|
|
Just copy the link direct from the address bar, and paste it into the page.
One of four things will happen:
1) It will automatically become linkified (mine did, and about 90% or more do)
2) It will be pasted, and an option will appear at thr right hand side - select "as is" and then highlight the link before pressing the [^] widget.
3) It will be pasted and no option will appear but there is a good chance it will be surrounded by pare tags, selected to VB. Swear. remove the pre tags, and treat as above.
4) It will be pasted, not option will appear and your browser will freeze up. Swear lots. Wait. Wait some more. Swear some more. Wait. Eventually it comes back to life and you can continue with 2 or 3 above.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
What Windows did to me (as shown in the link) was much better. I would rather take down the link. 
|
|
|
|
|
Sorry Griff, replied on the wrong part of the thread..
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I've done it myself from time to time...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Where's the weird?
Updating the app that's responsible for the updates might sound a bit strange at first, but it makes perfect sense; it's merely an app, and from time to time, it needs an update.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Dude MVVM has a different meaning!
public LoginControl()
{
InitializeComponent();
passwordTextBox.Focus();
LoginViewModel loginViewModel = new LoginViewModel(new Model.UserCredential { Username = Environment.UserName, Domain = Environment.UserDomainName });
((LoginCommand)loginViewModel.LoginCommand).LoginResultValueChanged += new LoginCommand.LoginResultChangedHandler(LoginCommand_LoginResultValueChanged);
loginViewModel.LoginRemembered += new LoginViewModel.LoginRememberedHandler(loginViewModel_LoginRemembered);
this.DataContext = loginViewModel;
}
public bool LoginAsDifferentUser
{
get { return _isLoginAsDifferentUser; }
set
{
_isLoginAsDifferentUser = value;
if (this.DataContext != null && _isLoginAsDifferentUser)
{
(this.DataContext as LoginViewModel).ClearLoginCredential();
}
}
}
|
|
|
|
|
|
Blech!
Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions.
Dave Barry
Read more at BrainyQuote[ ^]
|
|
|
|
|
Darn!! I almost thought you'd say: DLL Hell
|
|
|
|
|
ExcellentOrg wrote: DLL Hell
Well, that works as well!
Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions.
Dave Barry
Read more at BrainyQuote[ ^]
|
|
|
|
|
[begin rant]
So, I've been doing some integrations between our company Oracle E-Business Suite ERP and a website from a company that has been recently acquired by us.
Our ERP exposes a webservice that our main website and the newly acquired company's website need to call, and sync clients, orders, products, etc (the two websites are e-commerce).
So, I had to make a module for the new company website, and have that module call the ERP webservice with the needed data. The new company website is PHP. Now, I also had to output some data in some tables that would show up as a webpage full of logs, when I found a PHP bug (I guess it's a bug, cause if it's not, then it's elephanting plain weird). So let's say we have:
[outputting some unrelated table stuff]
[...].
$result .= '<td>'.date('d-m-Y g:i A', strtotime($header->getCreatedTimestamp())).'</td>';
$result .= '<td>'.(intval($header->getPlacedTimestamp() != 0)) ? 'Yes' : 'No' .'</td>';
$result .= '<td>'.(intval($header->getPlacedTimestamp() != 0)) ? $header->getPlacedTimestamp() : '-' .'</td>';
$result .= '<td>'.$header->getSupplierName().'</td>';
[outputting other unrelated table stuff]
[...].
So, imagine my surprise when the result of the two ternaries gets placed BEFORE THE GODDAMNED TABLE!!! I mean, the output is:
[Ternaries result]
[table with my other data, no result from the two ternaries whatsoever, and the td's are simply missing]
And the fix was simply to place the ternary result into two variables, and output those (I guess those two get somehow evaluated and executed before the other code, or I just don't know):
[outputting some unrelated table stuff]
[...].$is_placed = (intval($header->getPlacedTimestamp() != 0)) ? 'Yes' : 'No';
$placed_ts = (intval($header->getPlacedTimestamp() != 0)) ? $header->getPlacedTimestamp() : '-';
$result .= '<td>'.date('d-m-Y g:i A', strtotime($header->getCreatedTimestamp())).'</td>';
$result .= '<td>'. $is_placed .'</td>';
$result .= '<td>'. $placed_ts .'</td>';
$result .= '<td>'.$header->getSupplierName().'</td>';
[outputting other unrelated table stuff]
[...].
Oh, and I also had to output the HTML table from PHP code (as a requirement, I had to follow their...'guidelines', which enforce this )
[end rant]
Edit: Sorry, I just had to get this thing off my chest. I think I'll go shoot myself now. I miss my Android project (looking back, maybe it was simpler to just delay its completion forever, instead of ending it on time...Oh, blissful ignorance )
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
This is caused by a piece of PHP weirdness combined with a browser getting confused about mismatched tags.
The PHP weirdness is that the ternary is a weak binding. So
$var = $bool ? 1 : 0 . ' bowls of petunias';
... will set $var to either (numeric) 1 or (string) "0 bowls of petunias". This isn't wrong, per se, but it is surprising if you come from a language where the ternary is a strong binding. In PHP you must do
$var = ($bool ? 1 : 0) . ' bowls of petunias';
As a result of that, you're outputting markup with mismatched <td>/</td> tags, if the ternaries pick the first option. If that inside a nested table, most browsers will just give up on trying to work out what's going on and draw the contents of the mismatched cells before the inner table.
|
|
|
|
|
Yeah, this is what was happening in my case.
Thanks for the explanation and alternate fix!
On a side note, I think I'll start compiling a list of 'Look out for...', and glue it to a wall in the office. Maybe in this way, other poor souls will not fall into the same pit of agony as me and my team did these last few weeks (most of us come from Java, and some also have a bit of .NET experience)
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
I, on the contrary, really enjoy .php, but - being an amazingly nice guy (who NEVER eats bacon), I'll give you a watch-out-for:
If you are outputting results from an array (such as might be returned from dbase calls), you'll have any number of rowsets which might, for example, become the conents of a table. Let's say each rowset in array $Data contains such the fields 'recID', 'name', 'age', and you wish to iterate through a loop to generate a table.
You might try to use something like:
foreach ($Data as $d)
ECHO "<tr><td>$d['recid']</td><td>$d['name']</td><td>$d['age']</td></tr>";
You'll typically get an error mentioning problems with whitespaces.
As it turns out, .php doesn't like the array item's referenced inside the "'s
The solutions are either:
foreach ($Data as $d)
ECHO "<tr><td>".$d['recid']."</td><td>".$d['name']."</td><td>".$d['age']."</td></tr>";
or
foreach ($Data as $d) {
$r = $d['recid'];
$n = $d['name'];
$a = $d['age'];
ECHO "<tr><td>$r</td><td>$n</td><td>$a</td></tr>";
}
You may employ the later approach if you've other symbols you'd like in your "-ed output
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Well, that's another one that I'll probably remember. I always use your second tip, (the one with the array keys concatenation), it's the closest to what I'm used to doing. 10x for the tip, good to know . I also really miss the StringBuilder.
Doing large numbers of string concatenations, dunno, just feels wrong)
EDIT: I think I'll be partying today (First discussion I've opened to be featured in The Daily News Newsletter )
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Another thing you may wish to look into if you've not already: "HEREDOC".
If you consider that .php is very heavily used as a language for server-side web development, then you may realize that sometimes there's quite a bit of formatted HTML that may need to be generated. This can be done very easily using the "<<<" operator (HEREDOC). It allows you to actually create the entire webpage (if you wished to) as a single string in a natural webpage format. Or type in paragraph after paragraph of text to create a string, embedding $variables as you go along.
Syntax:
$lotsOfStuff = <<<someName
Here you type in whatever you wish
And it all becomes part of a single
String. For example, create a table in
a natural flow:
<table>
<tr> <th>HUSBAND</th> <th>WIVES</th> </tr>
<tr> <td>Scaramouche</td> <td>Kimberley</td> </tr>
<tr> <td>$here</td> <td>$hellion[1],$hellion[2]</td> </tr>
</table>
... etc
someName;
Examples that come to mind:
- JavaScript that are modified at load
- Design page-pieces in HTML, cut & paste them into your HEREDOC block, and then modify as required. The entire page (
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
As I recall (been a while since I worked in PHP), you can make those array references work in string if you add curly brackets:
foreach ($Data as $d)
ECHO "<tr><td>${d['recid']}</td><td>${d['name']}</td><td>${d['age']}</td></tr>";
|
|
|
|
|
I think the curly braces go before the $ .
|
|
|
|
|
Or you can use "... $s[recid] ... etc" (note no single quotes in the array indexer).
|
|
|
|
|
BobJanova wrote: Or you can use "... $s[recid] ... etc" (note no single quotes in the array indexer).
I like that, strange nuance though it may seem, and will try out shortly.
Assuming it works, Thanks!
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
That's bad bad bad and more BAD advice. Always use quotes around array indexes in PHP if not what you are essentially telling php is that there is a defined constant with the name of recid, PHP looks for it and doesn't find it, and replaces it with the string 'recid' and generating a E_NOTICE error for you. For more info see here:
http://de.php.net/manual/en/language.types.array.php#language.types.array.foo-bar[^]
Member 8857022 showed the correct way of doing this using {} to wrap the variable.
|
|
|
|
|