|
|
I'm using WebView2 to display data in my app. If I send a string literal it works fine. But if I send a value in a variable I get nothing.
This works:
wb.ExecuteScriptAsync("document.body.innerHTML=" & ChrW(39) & "HELLO" & ChrW(39))
This doesn't ("lStr" is my string variable):
wb.ExecuteScriptAsync("document.body.innerHTML=" & ChrW(39) & lStr & ChrW(39))
I assume I'm doing something wrong here. Any advice is appreciated.
Sometimes the true reward for completing a task is not the money, but instead the satisfaction of a job well done. But it's usually the money.
|
|
|
|
|
That's going to depend on the content of your variable, which we can't see.
For example, if the variable contains a single quote or any newline characters, your script will end up with an "unterminated string literal" error.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Could possibly contain quotes but no newline chars. I was trying to give my old spell checker a facelift. I wanted to use the WebView2 for the error text ("Not In Dictionary"). It's one line from the text editor with the error highlighted. So I'd need to send it the error start/end positions plus tell it to scroll to that position. All easily done if I could figure out how to send it a value in a variable.
Sometimes the true reward for completing a task is not the money, but instead the satisfaction of a job well done. But it's usually the money.
|
|
|
|
|
As I said, you'll need to ensure the value is properly encoded.
Assuming you're running .NET Framework 4.7.2 or later, .NET Core, or .NET 5+, then you can use the System.Text.Json package[^] to encode the string:
wb.ExecuteScriptAsync("document.body.innerHTML=" & System.Text.Json.JsonSerializer.Serialize(lStr)) For older frameworks, use the Json.NET[^] package.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you!
Sometimes the true reward for completing a task is not the money, but instead the satisfaction of a job well done. But it's usually the money.
|
|
|
|
|
Hi,
New here. Anyway I'm working on a project and I'm placing some text over some images. All is good with that.
However I only want to rotate the text 35 degrees but I can't figure how to do that in Javascript.
Here is how I'm displaying the text -
const ctxt = canvas.getContext('2d');
ctxt.fillStyle = 'red';
ctxt.font = '40px Brush Script MT';
ctxt.fillText('TEST',200,178);
Thanks.
|
|
|
|
|
The canvas uses a transformation matrix and it has a few functions for manipulating it.
Here is a 35-degree rotation:
const ctxt = canvas.getContext('2d');
ctxt.fillStyle = 'red';
ctxt.font = '40px Brush Script MT';
const tm = ctxt.measureText('TEST');
ctxt.translate(200 + tm.width / 2, 178);
ctxt.rotate(35 * 3.14159 / 180);
ctxt.translate(-(200 + tm.width / 2), -178);
ctxt.fillText('TEST',200,178);
ctxt.resetTransform();
|
|
|
|
|
Awesome! Just what I needed. Thanks!
|
|
|
|
|
I want to load image dynamically from database in popup form
how to receive or integred databending in JS script with laravel8 ?
<script type="text/javascript">
function getValues(){
document.getElementById('txt1').value=imageName;
var path = '{{asset(storage/images/imageName)}}' ;
document.getElementById('img').src=path ;
}
</script>
>> In HTML <<
<input type="text" name="txt1" id="txt1" />
<img src="default.jpg" name="img" id="img" >
>> ERROR <<
<pre>Use of undefined constant storage - assumed 'storage' (this will throw an Error in a future version of PHP) (View: C:\xampp\htdocs\Ecommerce-Front\resources\views\popup.blade.php)
|
|
|
|
|
hi am geting this error
Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: <h2 />. Did you accidentally export a JSX literal instead of a component?
at App
console.<computed> @ index.js:1
printWarning @ react-jsx-dev-runtime.development.js:97
error @ react-jsx-dev-runtime.development.js:71
jsxWithValidation @ react-jsx-dev-runtime.development.js:1242
App @ App.js:7
renderWithHooks @ react-dom.development.js:16175
mountIndeterminateComponent @ react-dom.development.js:20913
beginWork @ react-dom.development.js:22416
beginWork$1 @ react-dom.development.js:27381
performUnitOfWork @ react-dom.development.js:26513
workLoopSync @ react-dom.development.js:26422
renderRootSync @ react-dom.development.js:26390
performConcurrentWorkOnRoot @ react-dom.development.js:25694
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
schedulePerformWorkUntilDeadline @ scheduler.development.js:564
requestHostCallback @ scheduler.development.js:588
unstable_scheduleCallback @ scheduler.development.js:441
scheduleCallback$1 @ react-dom.development.js:27491
ensureRootIsScheduled @ react-dom.development.js:25639
scheduleUpdateOnFiber @ react-dom.development.js:25428
updateContainer @ react-dom.development.js:28804
push../node_modules/react-dom/cjs/react-dom.development.js.ReactDOMHydrationRoot.render.ReactDOMRoot.render @ react-dom.development.js:29216
(anonymous) @ index.js:7
./src/index.js @ index.js:8
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ index.js:8
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
react-dom.development.js:28389 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `App`.
at createFiberFromTypeAndProps (react-dom.development.js:28389:1)
at createFiberFromElement (react-dom.development.js:28415:1)
at createChild (react-dom.development.js:14979:1)
at reconcileChildrenArray (react-dom.development.js:15274:1)
at reconcileChildFibers (react-dom.development.js:15691:1)
at reconcileChildren (react-dom.development.js:19964:1)
at updateHostComponent$1 (react-dom.development.js:20733:1)
at beginWork (react-dom.development.js:22447:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:4161:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4210:1)
at invokeGuardedCallback (react-dom.development.js:4274:1)
at beginWork$1 (react-dom.development.js:27405:1)
at performUnitOfWork (react-dom.development.js:26513:1)
at workLoopSync (react-dom.development.js:26422:1)
at renderRootSync (react-dom.development.js:26390:1)
at performConcurrentWorkOnRoot (react-dom.development.js:25694:1)
at workLoop (scheduler.development.js:266:1)
at flushWork (scheduler.development.js:239:1)
at performWorkUntilDeadline (scheduler.development.js:533:1)
at run (setImmediate.js:40:1)
at runIfPresent (setImmediate.js:69:1)
at onGlobalMessage (setImmediate.js:109:1)
createFiberFromTypeAndProps @ react-dom.development.js:28389
createFiberFromElement @ react-dom.development.js:28415
createChild @ react-dom.development.js:14979
reconcileChildrenArray @ react-dom.development.js:15274
reconcileChildFibers @ react-dom.development.js:15691
reconcileChildren @ react-dom.development.js:19964
updateHostComponent$1 @ react-dom.development.js:20733
beginWork @ react-dom.development.js:22447
callCallback @ react-dom.development.js:4161
invokeGuardedCallbackDev @ react-dom.development.js:4210
invokeGuardedCallback @ react-dom.development.js:4274
beginWork$1 @ react-dom.development.js:27405
performUnitOfWork @ react-dom.development.js:26513
workLoopSync @ react-dom.development.js:26422
renderRootSync @ react-dom.development.js:26390
performConcurrentWorkOnRoot @ react-dom.development.js:25694
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
schedulePerformWorkUntilDeadline @ scheduler.development.js:564
requestHostCallback @ scheduler.development.js:588
unstable_scheduleCallback @ scheduler.development.js:441
scheduleCallback$1 @ react-dom.development.js:27491
ensureRootIsScheduled @ react-dom.development.js:25639
scheduleUpdateOnFiber @ react-dom.development.js:25428
updateContainer @ react-dom.development.js:28804
push../node_modules/react-dom/cjs/react-dom.development.js.ReactDOMHydrationRoot.render.ReactDOMRoot.render @ react-dom.development.js:29216
(anonymous) @ index.js:7
./src/index.js @ index.js:8
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ index.js:8
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
index.js:1 Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: <h2 />. Did you accidentally export a JSX literal instead of a component?
at App
console.<computed> @ index.js:1
printWarning @ react-jsx-dev-runtime.development.js:97
error @ react-jsx-dev-runtime.development.js:71
jsxWithValidation @ react-jsx-dev-runtime.development.js:1242
App @ App.js:7
renderWithHooks @ react-dom.development.js:16175
mountIndeterminateComponent @ react-dom.development.js:20913
beginWork @ react-dom.development.js:22416
beginWork$1 @ react-dom.development.js:27381
performUnitOfWork @ react-dom.development.js:26513
workLoopSync @ react-dom.development.js:26422
renderRootSync @ react-dom.development.js:26390
recoverFromConcurrentError @ react-dom.development.js:25806
performConcurrentWorkOnRoot @ react-dom.development.js:25706
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
schedulePerformWorkUntilDeadline @ scheduler.development.js:564
requestHostCallback @ scheduler.development.js:588
unstable_scheduleCallback @ scheduler.development.js:441
scheduleCallback$1 @ react-dom.development.js:27491
ensureRootIsScheduled @ react-dom.development.js:25639
scheduleUpdateOnFiber @ react-dom.development.js:25428
updateContainer @ react-dom.development.js:28804
push../node_modules/react-dom/cjs/react-dom.development.js.ReactDOMHydrationRoot.render.ReactDOMRoot.render @ react-dom.development.js:29216
(anonymous) @ index.js:7
./src/index.js @ index.js:8
__webpack_require__ @ bootstrap:851
fn @ bootstrap:150
1 @ index.js:8
__webpack_require__ @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
react-dom.development.js:28389 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `App`.
at createFiberFromTypeAndProps (react-dom.development.js:28389:1)
at createFiberFromElement (react-dom.development.js:28415:1)
at createChild (react-dom.development.js:14979:1)
at reconcileChildrenArray (react-dom.development.js:15274:1)
at reconcileChildFibers (react-dom.development.js:15691:1)
at reconcileChildren (react-dom.development.js:19964:1)
at updateHostComponent$1 (react-dom.development.js:20733:1)
at beginWork (react-dom.development.js:22447:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:4161:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4210:1)
at invokeGuardedCallback (react-dom.development.js:4274:1)
at beginWork$1 (react-dom.development.js:27405:1)
at performUnitOfWork (react-dom.development.js:26513:1)
at workLoopSync (react-dom.development.js:26422:1)
at renderRootSync (react-dom.development.js:26390:1)
at recoverFromConcurrentError (react-dom.development.js:25806:1)
at performConcurrentWorkOnRoot (react-dom.development.js:25706:1)
at workLoop (scheduler.development.js:266:1)
at flushWork (scheduler.development.js:239:1)
at performWorkUntilDeadline (scheduler.development.js:533:1)
at run (
this my index.js
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);
|
|
|
|
|
IF ANYONE Can help me get through this I will pay!!!!!!!!!!!!
Server Error in '/' Application.
contact With Id = 00000000-0000-0000-0000-000000000000 Does Not Exist
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: contact With Id = 00000000-0000-0000-0000-000000000000 Does Not Exist
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FaultException`1: contact With Id = 00000000-0000-0000-0000-000000000000 Does Not Exist]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +14833454
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +386
Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request) +0
Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request) +797
Microsoft.Xrm.Client.Services.InnerOrganizationService.UsingService(Func`2 action) +127
Microsoft.Xrm.Client.Services.CachedOrganizationService.InnerExecute(OrganizationRequest request) +139
Microsoft.Xrm.Client.Services.OrganizationServiceCache.InnerExecute(TRequest query, Func`2 execute, Func`2 selector) +21
Microsoft.Xrm.Client.Caching.<>c__DisplayClass6`1.<get>b__5(String key) +27
Microsoft.Xrm.Client.Threading.<>c__DisplayClass5`1.<get>b__3() +49
Microsoft.Xrm.Client.Threading.MutexExtensions.Lock(String key, Int32 millisecondsTimeout, Action`1 action) +110
Microsoft.Xrm.Client.Threading.LockProvider.Get(String key, Int32 millisecondsTimeout, Func`2 loadFromCache, Func`2 loadFromService) +237
Microsoft.Xrm.Client.Services.OrganizationServiceCache.LookupAndInsert(TRequest query, Func`2 execute, Func`2 selector, String selectorCacheKey) +375
Microsoft.Xrm.Client.Services.OrganizationServiceCache.InnerExecute(TRequest request, Func`2 execute, Func`2 selector, String selectorCacheKey) +191
Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute(OrganizationRequest request, Func`2 selector, String selectorCacheKey) +227
Microsoft.Xrm.Client.Services.CachedOrganizationService.Execute(OrganizationRequest request) +162
Microsoft.Xrm.Client.Services.CachedOrganizationService.Retrieve(String entityName, Guid id, ColumnSet columnSet) +154
PSEGPortal.ApplicationService.GetContactInfo(Guid contactId, CrmOrganizationServiceContext service) +101
PSEGPortal.ApplicationService.GetPartnerInfo(Guid accountId, Guid olaId) +521
PSEGPortal.CustomerInformation.loadApplication(String lp, String ola) +726
System.Web.UI.Control.OnLoad(EventArgs e) +106
System.Web.UI.Control.LoadRecursive() +68
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Control.LoadRecursive() +162
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3785
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3930.0
|
|
|
|
|
An unformatted dump of your exception message, with no details of the code, posted in the wrong forum?
Sure, let us get right on helping you to fix that.
Quote: contact With Id = 00000000-0000-0000-0000-000000000000 Does Not Exist
That looks like something you should start your investigation with.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
What are the differences between Heap and Stack Memory in Java?
modified 1-Jun-22 13:03pm.
|
|
|
|
|
Yes, but you need to provide the details. You also need to post it in the Java forum; this one is for Javscript which is not the same thing. But do not expect anyone here to do all the work for you, even if you do offer ridiculous amounts of money.
|
|
|
|
|
I have a SharePoint List (list_dls) which has all the Email addresses. The list has a single column with Field name "Title". I need to validate that the Item in the "LookupField" is contained in the 'list_dls'. The list has over 5000 emails, hence I will need to do a CAML query. The script does not seem to find the item. Any ideas to get it to work would be really appreciated.
Here is the code.
<pre><input type='button' value='get Lists' onclick="PopulateLookupField();"/>
<p id="demo"></p>
<script language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
var LookupField = 'lnam@xyz.com';
function PopulateLookupField()
{
var clientContext = new SP.ClientContext.get_current();
var LookupList = clientContext.get_web().get_lists().getByTitle('list_dls');
var camlQuery_list = new SP.CamlQuery();
camlQuery_list.ViewXml = @"<View Scope='RecursiveAll'><ViewFields><FieldRef Name='ID'/><FieldRef Name='Title'/></ViewFields><RowLimit Paged='TRUE'>5000</RowLimit></View>";
LookupList<ListItem> allListItems = new LookupList<ListItem>();
do
{
var listItemCollection = LookupList.GetItems(camlQuery_list);
clientContext.Load(listItemCollection);
clientContext.ExecuteQuery();
allListItems.AddRange(listItemCollection);
var ItemFound = listItemCollection.Where(item => item.FieldValues["Title"].ToString().Contains(LookupField);
if(ItemFound !== null){break;}
camlQuery_list.ListItemCollectionPosition = listItemCollection.ListItemCollectionPosition;
} while (camlQuery_list.ListItemCollectionPosition != null);
clientContext.load(ItemFound);
alert("ItemFound = " + ItemFound);
}
</script>
|
|
|
|
|
Hello everyone,
I have a problem that I'm having trouble solving, I have the following errors on my screen:
1. Error in src\App.js line 2:7: parsing error: identifier 'react' has already been declared.(2:7)
Webpack 5.72.0 compiled with 2 errors 2.in 8076 I show you an example of the code
1.Import React from "react"
2.Import react, {component} from "react";
Const App = () => {
Return(
< BrowserRouter>
<route path="/" element="{Home/">}/>
<route path = '/About'element = {About/>}
)
}
Thanks for your help
|
|
|
|
|
I think it's because you are already importing react on line 1. You don't need the "import react" on line 2.
|
|
|
|
|
I am developing in Angular 12 with the exceljs package. I am trying to add an image to a Workbook and the TS below produces and throws the client side exception:
Error: Uncaught (in promise): TypeError: u.readFile is not a function
TypeError: u.readFile is not a function
at exceljs.min.js:3:449768
Here is the code I am calling:
let imageSrc = '\assets\images\graph.jpeg'
var imageId1 = workbook.addImage(
{
filename: imageSrc,
extension: 'jpeg',
});
workbook.xlsx.writeBuffer().then((data) => {
let blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
fs.saveAs(blob, 'Random Number Generator.xlsx');
});
modified 25-Apr-22 15:36pm.
|
|
|
|
|
Based on this GitHub issue[^], it looks like addImage can't use the path of an image on the server to generate a file on the client.
The suggested workaround is to load the image as a buffer. The code in the issue uses axios, but you could use the fetch API instead[^]:
const imageSrc = '/assets/images/graph.jpeg';
const response = await fetch(imageSrc);
const buffer = await response.arrayBuffer();
const imageId1 = workbook.addImage({
buffer: imageBuffer.data,
extension: 'jpg'
});
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am learning Javascript right now and am looking to start as soon as possible, but I don't know where to begin.
In my mind I would like the user experience to be as simple as possible; focused on the centre of the screen, on a single drop down menu, of which when a choice is selected that menu visually slides out of the way (so the user doesn't feel disoriented), as a new one slides in, and so forth, until the selections are exhausted.
What should I look into to achieve this please ?
|
|
|
|
|
|
Thanks, but I'm already working through that (about half way through). What a mess JavaScript has become, how on Earth a let can be a var God only knows, especially coming from a type-safe language like Swift ?!
I found the following code, which was pretty similar to what I wanted : https://codepen.io/balapa/pen/zvObzO[^]
I am just figuring out how the code works now, to see how to load up new menu options..
|
|
|
|
|
After the file is played, you need to load a new file and start playback.
According to my plan, I did this:
the file "au.js"
function replay()
{
var aud = document.getElementById("audio_label");
aud.src = "cap.wav?cb=" + new Date().getTime();
aud.load();
aud.play();
}
function hproc(e)
{
replay();
}
var x = document.getElementById("audio_label");
x.addEventListener('ended',hproc,false);
the "index.html"
<pre><script src="au.js"></script>
<body>
<audio id="audio_label" autoplay controls src="cap.wav"
type="audio/wav"></audio>
...plays only once...
|
|
|
|
|