I'm working on an app that has a leader pass their position to a client and I need to update the route destination dynamically. I am currently recreating the entire route but the recalculation causes the route to "blink" which I don't love. I'm open to any workaround.
Right now this is not possible - you can dynamically change the via points on the route but not the route's destination (not without recreating the entire route).
We are exploring adding this possibility, by the end of this month we should have something in place (meaning that it should be ready for the 3.0.2 update).
Related
I'm putting together a demo app in which I frequently add content and new React components. I have just added the component react-timeago for showing when the latest changes were made to the site. Now I want to give that component the right timestamp.
At worst, I suppose I could show the last time that the server was started. I am using webpack-dev-server locally. I haven't yet gone live with this site, but it will probably (like webpack-dev-server) be an express-based solution when I do. So one option is perhaps to do a grep on an express-generated logfile for server start entries. Solving that would solve the question to an extent. It's worth noting though that adding content would not require a restart, so this solution is perhaps not ideal. Presumably, I could use some kind of middleware (logger or otherwise) in express for this.
Another possible approach might be some kind of directory watch mechanism that records the last time a change was made. Should I somehow hook this into a redux state, for example? There are so many components available that it's difficult to know which ones to put together (with my limited experience in this area) to achieve this.
My site is a lightweight single pager and I'm loath to add any kind of datastore behind it at this stage as it seems like overkill to me.
I can also mention that I'm using webpack 2. Aside from that it's a really basic React app with a couple of components.
To summarize, I am after some way of looking for added content (eg. mp3 files) or changed code files, and getting that timestamp into my react-timeago component.
As #Joe Clay suggested, I used Webpack.DefinePlugin to fill a constant with the current time at restart. This worked fine, I added the following lines into my webpack.config.js:
var dateString = new Date().toDateString();
...
new webpack.DefinePlugin({
LAST_UPDATED: JSON.stringify(dateString)
})
And was able to access the the constant in my React component:
<div style={{marginTop:120}}>A sinewave440hz demo site.<br/>
This site was updated
<TimeAgo date={LAST_UPDATED} formatter={formatter}/>.
</div>
Recording changes in the assets could also be done at startup if the previous state of the assets was recorded somewhere.
I am using mozila MakeAPI for popcorn maker. It saves the data to elasticsearch. I added and saved a new column in elastic search. Now for retrieval, I was not able to get that column value. So I update a node module Makeapi_client.
My question is, Is this approach good? because It might be case if the user updates the npm. In this case what will happen to the code I wrote in it.
"Patching" a library in this way is not recommended. Next time you update MakeAPI your changes will be overridden. You have a few options:
Submit a Pull Request - Clone the original repository, make your changes, and then create a pull request. A pull request is a request you make to the original library authors to merge your changes into their canonical library. In essence, you'll be fixing the library for everyone!
Make the patch in a different file - Nothing is stopping you from doing something like this:
var Client = require('makeapi').Makeapi_client;
Client.prototype.someNewMethod = function() {};
Or something similar. In essence, creating a patch in a different file that you can check into version control, which won't get overridden by changes.
Please note that updates to the library may still break your changes.
I have created/recorded a script in Vugen, however the the URL of the site has been changed recently. Is there any way just by replacing the url with a parameter works?
I have tried by replacing url with parameters, the new URL is
http://xsx.xxx.xsx.xxx/test99
Yhe parameters I have tried are below:
NewUrl: http://xsx.xxx.xsx.xxx/
Newhos: test99
I have replaced all in the script and when I run it I get the following error:
Error -27651: Attempted read from an unconnected socket (empty response, no HTTP headers received). URL="http://xsx.xxx.xsx.xxx/scripts/uiServer.dll"
What is the solution for this? Should i record again with the new URL ?
Thanks.
Hope I've understood what you're asking for, so here goes. If it's only the URL that has changed and not the content of the site which you might require later on in your script that this is fairly simple to do.
As you have created the new parameters ensure that they are getting the data from the same DAT file. I.e. newurl.dat which contains the following:
newurl,newhost
http://xsx.xxx.xsx.xxx/,test99
and assign the parameters to the correct column and have the newhost set to sameline as newurl. This way it’s easier to maintain I believe.
Now that the parameters have been created and properly assigned in your script you’ll need to change the url your trying to change from:
http://xsx.xxx.xsx.xxx/oldtest to {newurl}{newhost}
this needs to be done for all instances where the change has occurred.
Hope this helps with your problem you’re having.
Are you certain that the build level has not also changed at the same time as the host? If so then your new instance may be out of synch with the request model of the scripts built using an earlier build. Developers have a habit of including items below the scenes that do affect the site visually but change the structure of the requests. The error you are receiving is common when you attempt to continue a conversation on a dead connection resulting from a missed dynamic session component which may have been added in the last build.
When in doubt quickly record the second site and take a look at the differences in the requests, even to the point of using WinDiff (included in LoadRunner) for this purpose.
In Express.js, is there a standard way to re-order the middleware registered on an express#Router object? I have a situation where it is possible to dynamically register static asset directories that should be served by the app via express.static(). However, the Router#use() method (which I'm using to register the new asset directories) always puts middleware at the end of Router#stack. I want this to be at the beginning. Is there any way to achieve this?
I have a working implementation that basically traverses the current Router's stack in reverse, picks the first middleware called staticMiddleware, and moves it from that location to the front of the array. This works, but is obviously dependent on the internals of Route. I'm hoping there's another, more standard way to achieve the same behavior.
You probably want to just have a custom route at the beginning of the order that can examine the path, compare it to a list of directories you want to serve (that can change over time) and then serve the static content if its path matches.
This would just be a smarter version of express.static() that works off a dynamic path list rather than only a pre-defined path. There isn't much to express.static() so you can just copy it into your function and make it smarter.
It is apparently possible to crack into the stack of middleware and modify the order. I don't know if this is a supported capability or just something unsupported that people have figured out (that could break in the future). Here's one article that discusses this: https://www.exratione.com/2013/03/nodejs-abusing-express-3-to-enable-late-addition-of-middleware/
I have a custom list which has customized edit and new forms which were required by the user.
I then tried to add a new item to a folder (folders have the text of the year e.g. 2010) and when I click save on the customized new form it saves correctly but always to the root of the list.
I am wondering if there is a fix or a work around for this as it is highly annoying.
Alternatively can anyone recommend a way to implement a field which will auto calculate + 1 year from creation date, which might be a possible alternative however it will have to take into account the following.
Where the current year runs october to september.
Thanks for any help this has been driving me mad trying to find a solution.
Can't help much without knowing what you based the custom form on, but for a new form the folder to save to usually shows up in the query string.
The form is a basic custom form list which I have then just modified parts to remove fields that are not required or need to be read only.
The original form worked perfectly and allowed items to be added to the list subfolders.
The new one has no additional code and is using the standard sharepoint DataFormWebPart to create the custom list form and so I have no back end code to insert the item etc, although I may have to resort to this...will I?
You need to be careful when modifying standard forms. I recommend you go back to a copy of the standard form and verify that that saves correctly. Remove the "unneeded" fields until it stops working.
Sometimes with this sort of customisation you need to use css rather than server side changes to modify the form so that the functionality remains in place after the component is hidden.
It is definitely not an issue with the removal of fields as I created a new copy of the original and then changed it to a custom field saved it and tried to add an item.
It went straight into the root.
I tried the original form and it saves to the sub folder correctly.
Okay only work around I have for this at moment (I am currently in discussion with MS) is this.
http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx
I used the method getTagFromIdentifierAndTitle(tagName, identifier, title)
This returned the element I was after and then I basically went to the row dom node and deleted it.
I am hoping to have a nicer method but at least it is a work around for now.