|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
Whilst I try to refrain from printing emails, some are required and normally I use print pre-view to check what page(s) I need and select accordingly. If too complex as quick ctl A and copy paste to Word (or your favourite editor) and edit to the smallest number of pages possible.
However, just been caught out with a blood test appointment printed without checking and yes, three lines on the second page (of two sided print) that are not needed. Do Web designers have a secret contract with printer supplies for paper and ink? By the way, the email had masses of White Space!
Bah Humbug, waste of a sheet of paper. 
|
|
|
|
|
I'm SMH on this.
Normally I really never look at the HTTP response payload and just assume it works. But this is a total hack on PHP 4.7 to tweak it to do modern things. I'm confused here, and really just looking for an explanation of why, so here goes.
I wrote this in PHP 4.7; being limited with what I can do, I hand crafted some JSON, and used a hack to encode it.
header('Content-Type: application/json; charset=utf-8');
$json = '{
"projectNumber":' . $sess_proj_no . ',
"projectStage":"' . $sess_proj_stage . '",
"newVersion":' . $new_version_no . ',
"undefinedValue":{
"projectNumber":"' . $projectNumber . '",
"variableContingencyCost":"' . $variableContingencyValue . '",
"variableContingencyValue":"' . $variableContingencyRate . '",
"actualPlusContingencyCost":"' . $actualPlusContingencyCost . '"
}
}';
$jsonTest = '{ "test": "result" }';
$jsonEncode = json_encode($jsonTest);
echo $json;
ob_end_flush();
With encoding, adding slashes to the double quotes,
SyntaxError: JSON.parse: expected property name or '}' at line 2 column 13 of the JSON data
"{
\"projectNumber\":2549,
\"projectStage\":\"engineering\",
\"newVersion\":0,
\"undefinedValue\":{
\"projectNumber\":\"\",
\"variableContingencyCost\":\"\",
\"variableContingencyValue\":\"\",
\"actualPlusContingencyCost\":\"\"
}
}"
Without encoding, no slashes to the double quotes, I get a clean HTTP response payload without errors.
{
"projectNumber": 2549,
"projectStage": "engineering",
"newVersion": 0,
"undefinedValue": {
"projectNumber": "",
"variableContingencyCost": "",
"variableContingencyValue": "",
"actualPlusContingencyCost": ""
}
}
I always thought JSON had to be encoded during transport, and then decoded to consume it.
Unless json_encode is meant to convert JSON created with a class, into a string without slashes. or it has something to do with echo and just spitting out text.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
According to my reading of the PHP manual, json_encode() didn't exist before PHP 5.2.0.
So I have no idea what you're using in 4.7....
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
|
It looks like you are creating a string in JSON format, then passing it to json_encode() where it is trying to turn it into more JSON. Unless you are actually trying to embed your JSON in the JSON that json_encode() produces, that doesn't make much sense.
This is how json_encode() is supposed to work:
$data = array(
"projectNumber" => $sess_proj_no,
"projectStage" => $sess_proj_stage,
"newVersion" => $new_version_no,
"undefinedValue" => array(
"projectNumber" => $projectNumber,
"variableContingencyCost" => $variableContingencyValue,
"variableContingencyValue" => $variableContingencyRate,
"actualPlusContingencyCost" => $actualPlusContingencyCost,
),
);
$json = json_encode($data);
|
|
|
|
|
Oh!
Wow thanks, I had no idea. That makes sense.
Will give it a try!
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I'm using Firefox 68.0.2 (64 bit) and a habit that I have been forming involves "bookmarking" webpages on a daily basis by pulling the site URL directly from the displayed address in the control at the top of the page as it appears in the browser onto the Bookmarks Toolbar (which is loaded with titled folders, as you would imagine, accounting for the passage of time/greater utility/etc). If a user does what I do in this way, he can right-click on any "saved" url and get a PROPERTIES dialog box to pop up and allow access to four things "Name", "Location", "Tags", and "Keyword".
So, a shortcut with properties. Considering a shortcut ... unless I saved a whole webpage to disk and then opened that local page in the browser and THEN pulled the URL to my Bookmarks Toolbar and then set about adding KEYWORDS to that local reference through the PROPERTIES/Keywords control, I would expect that by adding keywords to a link like this, to a REMOTE webpage on some server somewhere on the internet, that such a "save" would involve tracking those added keywords locally (I know it's through a SQLite database in the Mozilla folder) and I can assume that this is indeed what the local SQLite database keeps track of, among other things.
Well the behavior I observe is odd then; why does saving a webpage (as .html document for instance) to a location on a drive on my computer, placing a link to it in the bookmarks toolbar folder of choice, altering the links Properties/Keyword by adding a descriptive component, then saving that add, CHANGE THE PROPERTY OF THAT LOCAL WEBPAGE ... NOT just the link of the bookmark toolbar? It does. Somehow.
Try this yourself by saving a webpage to disk, opening that saved webpage in firefox browser, sliding a link from the address control to the browser toolbar, then opening that link. Once the page is verified "here" right-click the link again, choose Properties, see the Keywords control box, and type in some new/other term. AND now, this is the important part, copy this link, paste it somewhere else in the toolbar (behind a folder perhaps), open it so the local webpage is displayed, click once again on the link, get the properties/keyword control ... see that duplicate keyword you just typed in for the original, DELETE that keyword, and type in another keyword then save.
See my confusion:
Load the original link again, look at properties/keyword and see that the original now has the changed keyword (the original keyword has been erased and replaced with the copy's keyword).
This shouldn't be happening. Despite the fact that the link on the toolbar is connected to a local webpage and not some remote page address found in the browser's lookup under SQLite/Mozilla database, the keyword should still be associated with the LINK ALONE, NOT THE LOCAL FILE.
Yes?
Is not a webpage keyword (remote) stored in the SQLite database? Is not the sole keyword lookup for a given Bookmarked URL on my firefox toolbar being facilitated by a browser's delve into that SQLite data to return the keyword in that property's keyword {space} (for lack of a proper name for an association that a database uses to link such things under cover of it's functionality)?
How could I possibly be dis-explaining this to myself?
|
|
|
|
|
Is it possible to write libraries that contain controls/markup for use by multiple MVC5 apps?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
We're not using Core
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I know - that's why I suggested RazorGenerator.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well, I installed it and finally figured out how to get it working (the docs aren't exactly forthcoming - or complete).
In any case, it looks like this is my only choice if I want to try doing what I need, so I 5'd you., Thanks for the info.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I am dismayed to find no tangible examples of its usage - nothing but casual mentions of what people did to make it work.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Hi there:
I have to debug two branches of the same codebase side-by-side (a development branch vs a release branch), as we're seeing unexplained differences in behaviour between them. I've opened two copies of VS 2019 (latest patch v18.6.3 at 16th Dec 2020), and when launching them, one will succeed, and the other will throw up an error message:
One or more errors occurred.
Failed to launch the debug adapter. Additional information be be available in the output window.
Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:4318).
What I've tried:
- Making sure that each web project is set to start on a unique port number, I've selected 53199 for one branch and 53200 for another.
- Delete the applicationhost.config inside .vs, restart VS and let it recreate.
What I've noticed:
- The two Visual Studios try to launch as tabs in the SAME Chrome instance. I loaded a random different project from another codebase and that project launched its own new Chrome instance.
- Inside each applicationhost.config, in the <sites> section, BOTH projects have:
<site name="foo.Web" id="2">
- Their site "id" is the same, but each config file does have the correct virtualdirectorypath for its project location.
- this is new behaviour (maybe a new bug?) and I've been able to run this configuration plenty of times in the past.
- the output window contains only this:
Verbose logs are written to:
C:\Users\Bar\AppData\Local\Temp\visualstudio-js-debugger.txt
The program '' has exited with code -1 (0xffffffff).
The program '[21072] iisexpress.exe' has exited with code 0 (0x0).
- as each site starts up, the visual studio debugger log shows a --remote-debugging-port which is unique for each site, so no conflict there...
Since we're using TFS version control, "two branches" in this context means two completely different folders on disk, each with a full copy of the project source inside. I cannot see why these projects interfere with each other. Each one launches into debug successfully on its own and then the other won't launch.
Can I "fool" VS / IIS Express by manually changing the site "id" or "name" in applicationhost.config?
Any help gratefully appreciated!
-- edit: there are workarounds, e.g. using two different browsers, but still would like to clarify whether it's me or VS or IIS express causing this, and whether it can be fixed!
|
|
|
|
|
You could always just set them up as their own sites in IIS and attach the debugger of each instance of VS to the relevant site. I'm pretty sure what you're trying should work anyway so don't know if there is something odd going on with your project structure or what the sites are doing. I'd try the IIS route though as I know that definitely works.
|
|
|
|
|
|
I'm trying to diagnose an issue with a mod I wrote.
So I start with $rs2 = -1, then I increment $rs2, but when I print $res2 in the table cell, $rs2 goes ...
0
1
0
1
1
1
1
1
I thought since $rs2 is the origin number to feed into mod, that the number should increment.
0
1
2
3
4
5
6
7
It's works on the other function with the same mechanics here. Just not this one.
I haven't worked PHP since 2005, so I'm a bit rusty.
// Flip the BG Color of each row
$rs2++;
$stripe2 = ($rs2 % 2 == 0) ? "rowStripe" : "";
echo "
<tr>
<td class='report-table-body-20 $stripe2'>
<p class='report-table-body-p'> $rs2 $equip_cat_name</p>
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I was in a double while loop.
And incremented in the 2nd internal while, my bad!
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
|
Oh, that's a good idea
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
|
|
|