Gulp with WinSCP - livereload and less - twitter-bootstrap-3

I am using gulp with livereload, less, and others on a remote server. I have successfully used gulp before many times, and have never experienced this scenario.
I am using WinSCP to save/edit files (I double click the file, and it opens in Sublime Text ... I save it, WinSCP automatically uploads it back to the server ).
However, when doing it this way gulp-less fails almost all the time. I have two core CSS files that are compiled - one is Bootstrap and one is my own - they should both be compiled with their own gulp tasks upon modification - but Bootstrap fails every time, and the other file fails about half of the time.
When I say fails, here's what I mean - with Bootstrap I always get the same error:
variable #grid-columns is undefined in file ....grid.less line no. 48
This happens even if I define #grid-columns as the first-heading in my main Bootstrap "import" file.
The other one fails in that livereload reloads the compiled CSS at some point prior to the Less file being compiled. This should be impossible, but it happens somehow.
However, when from the SSH command prompt, I type touch myfile.less or touch anybootstrapfile.less, everything works perfectly.
Obviously this is very annoying, but its livable. I think there must be some way to fix it though. Any ideas on what in the world could make this happen and what (if anything) I could do to fix it?

Chances are that, when WinSCP uploads the file after you save it in the internal editor, it sets a timestamp of uploaded file to older than it was before.
This might be particularly true, if you are using the FTP protocol, or Windows Vista or older.
For details, refer to WinSCP FAQ:
Why are the changes, I upload to webserver, not visible in the web browser?

Alright. With the help of Martin, who I now realize is the developer of WinScp, I have solved this. I had been working with the gulp.wait plugin and inserting a pause before the final reload - and it wasn't working.
Because... that wasn't where the problem was. The problem was happening at the time of upload; in that the file was getting 'touched' to soon (or there was something with the timestamp that ended up causing the functional equivelant).
So I moved the wait process to just before the less process was called like so:
gulp.src(src)
.pipe(plumber({
errorHandler:onError
})
.pipe(wait(500))
.pipe(less())
//etc
I'm gonna experiment, 500ms is probably longer than needed..but not too long to be painful. This solved the problem instantly.
Thanks Martin!

Related

How to run a script from startup on Raspbian 10 (buster)?

I have designed a GUI that I want to run as soon as I turn on my Raspberry Pi. It is currently set up to automatically log in as user on startup, but if that makes the process more difficult I can change that. My Raspi runs on Raspbian 10 (buster), which has made things difficult since I can only find tutorials for Raspbian 8 or so.
I have tried modifying autostart folder, but it is not in the same location as it was in previous Raspbian versions and doesn't seem to be working the way it used to. Tutorials have said to create a .desktop file in /home/pi/.config/autostart but I don't have a .config folder, or at least it's hidden. For me, autostart is in /etc/xdg/autostart and when I try to create a new file here using nano in the terminal, I get the message [Directory '/etc/xdg/autostart' is not writable] and it doesn't save my file.
I have also tried calling my script in /etc/rc.local but it did nothing. Some have said it doesn't work for GUIs.
Here's what I type into terminal:
$ nano /etc/xdg/autostart/gui.desktop
and a new file pops up, but at the bottom I get the warning [Directory '/etc/xdg/autostart' is not writable]
How can I get my GUI script to run on startup with Raspbian 10 (buster)?
There are a number of issues here, first when you are looking at tutorials recognize that Linux distros are built in layers, for simplicity let's say your "layer stack" looks like this: kernel, systemd, x11, xdg, lxde. The kernel boots, then starts systemd, which then starts x11 (and a lot of other stuff), x11 starts xdg (and some other stuff, I think), lxde is started by either x11 or xdg I'm not sure which.
You want to add something to this process, you can do it at the kernel level (bad idea), at they systemd level (probably not right unless its a daemon), at the x11 level (still probably bad as you still don't have a user session yet), or at the xdg or lxde level.
xdg is probably the right place as it has all you need ( a gui, a user session) while being common (xdg will still work if you switch window managers, probably)
With that out of the way, why isn't your solution of modifying xdg working? It's because '/etc/xdg/autostart' is a system configuration directory. Any changes made to it will apply to all users. You may want this, but the system is trying to protect other users on your system and only allows root to make changes to everyone. If you want to do that use "sudo" (documented elsewhere on stack exchange and the internet). If you want to do it just for you use ~/.config/autostart, (https://wiki.archlinux.org/index.php/XDG_Autostart) you might need to create that directory with "mkdir ~/.config/" and then "emacs ~/.config/autostart"
Would it be better to have the python program run in a terminal window from startup? That way you would see what it is doing in case of errors.
If so, perhaps check this out https://stackoverflow.com/a/61730679/7575617
By the way, in the file manager, hit CTRL+H to toggle viewing hidden files and folders.

Odoo 12 - XML files not triggering server reload with --dev=all

New Odoo user here.
It's been a few days since I started messing around with Odoo(v12). I managed to build a module, including creating models, views and menus. It's working like a charm, though there is one issue that is really bothering me.
I've read that running odoo-bin with the --dev=all arg -- which requires watchdog, by the way -- is supposed to trigger a server restart whenever .py or .xml files are changed inside one of the addons folders.
The server does restart when I modify PYTHON files, but so far, even after trying it out for hours, I can't seem to make the same thing work for XML files.
For reference, I'm building the openacademy module from the official documentation, and I'd like for the server to read the views from the XML files instead of the database and reload on change, so I can customize the forms and views and see the result without having to upgrade my module every single time.
--dev=all, unfortunately, doesn't seem to work.
Can anyone help?
Edit: here's the full command I'm using to start up Odoo:
py odoo-bin -c odoo.conf --dev=all
P.S: I'm running Odoo 12 source on Windows 10 64bit
--dev=all actually works in conjunction with watchdog, so if you have watchdog package installed in your running odoo python environment, any change in your addons .py file with cause watchdog to notify running server and the server will reload automatically. You can actually see those messages if you have loglevel set to info. In case view update, changes in xml file doesn't actually reload the server but causing a refresh in the browser automatically updates the view. But, if there is any error in the view definitions, i faced this situation that odoo is not updating the changes. So make sure that there is no error in the xml views and update should be done automatically after page refresh.
Late to the party but as I spent a lot of time trying to figure this out on both Mac and Ubuntu it's worth noting that the --dev xml does not update to reflect every change in a .xml file. I was modifying menus and seeing nothing and thinking it was broken but from some investigation I discovered that the changes only pick up modifications to ir.ui.view models and (I think from looking at the source code) ir.rule models.

Keep getting : Debug error BC31019 : Unable to write to output file 'path/form.exe System Error &H80070005& VB.NET

I'm using Visual Studio Professional 2013 and I'm doing some very basic windows forms application.
A month ago, I could do everything I wanted without any problem. But I started some new projects today and for absolutely no reasons, I keep getting this error message when I come to debug or compile:
Debug error BC31019 : Unable to write to output file 'path/form.exe System Error &H80070005&
It can happen simply by changing the size of a textbox or modifying the text content in a label... It's very random... And I can even do an undo (ctrl+z) and then I can debug again, but if I try again to do the thing I did that brought the error message, the same message pops again as I try to run.
After reading a little about the subject, I realized that it was because the .exe file became in read-only mode and when I try to remove it, windows wont let me.
The only thing I can do if I really want to continue, is to restart my computer every times it happens. Then I can continue just like normal as my .exe file is no longer in read-only...
I tried tor run a sfc/scannow in my command prompt to see if i had any problems with my frameworks but everything was fine.
Since, it is when i restart my pc that the bug disapears, isn't anything i can do or run somewhere to do the same thing. I need to find why the exe file goes to read-only for nothing and how to get it back to normal without having to restart my pc every time...
Please help me!
thank you
I came across the same issue and it was related to having a command line argument that VS could not find, then when i clicked stop debugging I ended up in this situation as it seemed VS kept a process running.
I could see this process in task manager but could not end it (it started with the same name as my app)
I found closing VS would release this process.
Restarting VS it would then work ok again.
there may be other ways to reproduce the issue but restarting VS seems to release the file and allow you to continue.
I set the exe properties to Read/write. No effect, but when I set app properties/settings to "Always on top" = False the issue went away and is still away.

Simpless not compiling automatically

My simpLESS stylesheets have stopped compiling automatically. If I open the actual simpLESS program and click the refresh icon it builds them without a problem.
But it's stopped listening to when I save them. Anyone know how to make simpLESS listen again?
Well I got in touch with the SimpLESS technical support guys at wearekiss.com, they said "I noticed that from time to time, too. When I remove the indexed LESS files from SimpLESS and restart the App, it seems to be working again."
I tried that, it failed, so I uninstalled and reinstalled SimpLESS, then reindexed files, now it's working again.
Simpless will not warn you if you're missing a variable declaration... it just won't compile, which is really confusing since in will warn you for other errors. It appears as if Simpless just stopped working.
What you should do is paste your code here: http://winless.org/online-less-compiler to find what variables you aren't declaring, then fix it in the original LESS file, then SimpLESS will continue working fine.

Application Loader: "Cannot proceed with delivery: an existing transporter instance is currently uploading this package"

I have been unable to overcome this error in Application Loader. I've quit, restarted, tried different computers - it's like the server is hung up on an op that I never initiated and it won't time out. Has anyone seen it before and beaten it?
Basically, you need to clear out the transport tokens. This can happen if you were to close out of Xcode while in the middle of submitting an app to iTunes Connect.
The token files now appear in the
Library/Caches/com.apple.amp.itmstransporter/UploadTokens/ subfolder of the given user's home directory. Which, honestly, is a better place for them anyway.
Delete any .token files in this directory.
--
If you are unable to find the .token files, this is because they are hidden in Finder. To hide/show hidden files in Finder, use the following Terminal command (TRUE = UNHIDE, FALSE = HIDE):
defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder
You need to clear out the transport tokens.
Open Terminal on your Mac, and paste:
rm /Users/<username>/Library/Caches/com.apple.amp.itmstransporter/UploadTokens/*.token
That should clear the stuck token. After this, try uploading the build again.
It might be because Xcode crashed as you were uploading your app. Either, all you need to do is delete the token files:
Open Terminal on your Mac, and paste:
rm ~/.itmstransporter/UploadTokens/*.token
That should clear it. If it still doesn't work (at this point you should try re-uploading your app), run that command on Terminal again, or manually go to...
/Users/<username>/.itmstransporter/UploadTokens/
...and delete all the .token files.
Hope that helps!
token was in here
/Users/(user_name)/Library/Caches/com.apple.amp.itmstransporter/UploadTokens/
Appreciated #WrightsCS 's answer It helps me to overcome Application Loader issue.
I would like to highlight one more thing here.
I proceed as per #WrightsCS answer and it resolved Application loader error:
Can not proceed with delivery: an existing transporter instance is currently uploading this package
But I found one more issue after removing all tokens from
/Users//.itmstransporter/UploadTokens/
I went to iTunesConnect and clicked on "My Apps", what I saw a message that "Can not connect... please contact Apple".
Here I don't know why it suddenly stops working!
I submitted the same build which was there on iTunesConnect for submission but it has shown as processing.
After submission of that build, iTunesConnect works fine! Also, I am able to see last uploaded build in a list for submission.
In my case (I am using OSX Catalina), I was not able to find the folder:
Library/Caches/com.apple.amp.itmstransporter/UploadTokens/
Under my user home directory (even when showing hidden files and folders)
but it seems my problem was a bit different and I just closed xCode completely (every xCode window opened) and reopened it again then I archived my project and uploaded it without any issues
maybe this could help someone else fix this issue
You need to clear out the upload tokens that are "stuck". To do this, open the tokens file found in /users//.itmstransporter/UploadTokens/. You should see one line of text at the top that refers to your current upload token. Simply delete this line and save the file. You should now be able to submit your app again.
Cheers