I'm using git-flow-avh and upon completing a release I'm always passing the -p flag to make sure the tag gets pushed to the remote. Is there a way to make this the default behaviour.
Related
I have a process that adds tabs to Vivaldi (or any browser): one to an external url and one to a local html file. I am able to identify the process IDs associated with each tab.
I want to be able to close the tabs. I have tried kill <id>. That clears the page of the local file, but the tab is still there and can be reloaded if I refresh the page. kill has no effect on the tab associated with the external url.
Is there a way to do this?
Killing processes is the wrong approach here anyway because apart from causing unexpected termination and not orderly closing, nothing guarantees each tab to live its own process. You may have both of them living in the same process, or sharing a process with other, unrelated tabs. Bottom line, it's not going to work or at least it'll work only sometimes and cause collateral damage. (Others asked for such a way before.)
My suggestion would be a browser extension that uses native messaging. You could then ask it via the native messaging function to close certain tabs for you, using the officially supported tabs API that the browser exposes to extensions.
(These links are to the Chrome extension docs, but Vivaldi is Chromium-based as well and supports the same APIs.)
Alternative idea that works without an extension:
Tabs opened through the command line behave as if they were opened by a script of the same origin, insofar that the website in them is able to call window.close(). So depending on your use case, maybe you can arrange for the website in the tab to close the tab by itself.
If one of them is "external" in such a way that you can't control its contents, then you could instead have one tab open the other one through JavaScript, because then the first tab can close the second tab using close as well.
If you need a way to communicate to the website running in your tab(s) that you want it to close itself, you could also do something like starting a local server at a random unused port and passing the port into the website via a URL parameter1, and stopping the server when you want to close the tab. Then, inside your website you would regularly poll the local server URL using AJAX and close the tab when it fails2. (Remember to return CORS headers for this to work.)
This is just one of several possible ways, and yes it is a bit "hacky" - so I'm open to suggestions on how to improve on this idea.
Another alternative (which may or may not fit to your use case): Instead of opening a tab, you could open a separate popup window for each website using --app in the command line before the URL. Then you could find the corresponding window by checking what is the newest window with a matching title, and you could close it programmatically (check out xdotool and xwininfo).
1: Why not a fixed port number? Because you can't control whether something else is already listening on that port on the user's machine.
2: Why not the other way round, starting the server in order to close the tab? Because then you would have to wait to ensure that the website noticed that you started the server, and if you would stop the server too early then the tab would never close, so it's extra effort and an extra possible failure point, for example if there is high CPU usage at the moment or Vivaldi put the tab into sleep mode in the background. Additionally, with my method, killing your "manager" process would then also cause the tab to close instead of leaving it sticking around. And, finally, you don't want another process to interfere with your communication by opening a server on the same port that you chose before you do so, so it'll be best to open the server right away and not only once you want the tab to close.
I'm not totally clear on what flow check does vs just flow. Running flow seems to start a server up, and checks all the code. Subsequent executions of flow are faster due to the running server. flow check also seems to do a full code check but without the server.
Is there more to it than that?
Yep, you seem to get it!
flow server does a full check of your code from scratch. Once it is done, it watches for changes, and incrementally checks your code as it changes.
flow start basically runs flow server in the background.
flow check is basically the same thing as flow server, except as soon as it's done with the initial full check, it prints the errors and exits.
flow status talks to the running flow server and asks for the current errors. If no server is running, it calls flow start to start a new server.
flow (with no explicit command) is an alias for flow status
Another distinction is flow check will ignore the currently running server.
I learned this after finding that running flow and flow check randomly yielded two different results. Truth is, I had run flow, added flow-typed stuff, and then run flow check.
Meteor is supposed to pre-load a small part of Mongo client-side so that it can simulate changes to the DB. Thus making any changes to the page happen instantly while the real DB update happens in the background.
However, on my site I'm seeing a 1-2 second delay on simple actions that make changes to the DB, such as deleting a post.
Is there some extra coding that needs to be done to ensure the client-side simulation works?
As Michel Floyd Pointed out, if your meteor method is defined as server only code, there is no way to simulate the method call on the client.
Try moving Meteor method declarations into shared code, and see if that changes latency time.
also, without seeing some code and project structure the problem could be else where...
If you are using server-side method only, make sure your Mongodb has oplog tailing enabled, so that the change is picked up immediately and sent to the client. If you are using like a hosted db, like the free mlab, it's possible you have no oplog, the meteor falls back to querying the db periodically to check for changes.
But in any case, if the method is server side only, you will always have delays. Like mentioned in this thread, move the method definition outside the server folder (like /lib) só that the method becomes available on th client.
I have a Meteor game of heads or tails that keeps the stats of a user in their profile. The stats eg. wins and loses are changed using Meteor methods like incrementWins and incrementLoses.
Is there a way to prevent the users from calling these methods on the console?
I didn't find any precise answer to the question so I'll add one.
Is there a way to prevent the users from calling these methods on the console?
The short answer is no.
As long as you have the Meteor variable available on the client, it's not possible to restrict a user to use if from browser console. Meteor allows the client side to use Meteor.call function in any conditions, therefore even if you restrict its usage somehow, it will affect your whole application, not just browser console.
You can, however, make your methods more secure. As you know, you can make your code run either on client side, server side, or both. If you put your methods on the server side, the client side will never know what exactly happens as the methods are executed, nor would it be able to influence it or intercept control anyhow.
On the other hand, if you put your methods in the lib/ or both/ folder (or simply root folder of your app), the methods will run both on client and on server. Insecure part of the code (like bulk removing collection items or manipulating Meteor.users collection) won't be executed on the client side. But you may want to put something that would change UI state or show any messages, ironically, on the browser console. Think twice before applying this practice.
I personally think you exaggerate the meaning of ability to run something on the browser console. First, only a small group of users actually do that (but if they do, expect smallest holes in your app to be exploited). Second, Meteor is well secured in this part, it doesn't allow a user to run insecure code (unless insecure package is added, which is by default as you create a new app). And third, most of the time, as your methods get executed, the data will be updated reactively, this is what Meteor takes care of out of the box, so you don't need to worry about refreshing UI after app state change, etc.
Every newly created Meteor project has the insecure package added by default. This is the package that allows us to edit the database from the client. It's useful when prototyping, To remove this package, go to your app directory and run:
meteor remove insecure
I have an application that should run continuously even after the user presses the back button.
It has to send some data using POST method to my database in a remote server for every half an hour. This should happen even after the user has pressed the back button and the app should only stop when the mobile is switched off.
While I have set up the HTTP Adapter to send POST data and also an HTML file to call the adapter procedures on launch, I dont know how to make it background or which code to run to keep sending the POST data every half an hour.
It sounds like you are running on Android.
The expected behavior in Android is that pressing the Back button QUITS the application.
Moving to the background is performed by pressing the Home button.
So, I don't think you should do this when pressing the Back button... or maybe you should at least present the user the choice of either quitting or moving to the background (you can override the Back button by using WL.App.overrideBackButton).
That said, I am not familiar with a programmatic method to move to the background instead of quitting (maybe there is an existing Cordova plug-in or another way that does this).
The other way to accomplish this is by using an Android Background Service, however, Worklight does not have support in its Native API to do this.
As for what happens when the Worklight application is in the background, I have never tried it myself, so I cannot be certain at all, but try using WL.Client.setHeartBeatInterval to keep alive the connection to the Worklight Server and write some logic that sends the adapter requests. See if that would work for you...
I have found this:
How to create plugin in phonegap to run the application in background?
Maybe you'll be able to massage it into your Worklight project (in case the heartbeat approach above does not work).
More information on running in the background:
Android:
http://developer.android.com/training/basics/activity-lifecycle/index.html
http://developer.android.com/reference/android/app/Activity.html
iOS:
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html
Override the Back button by using WL.App.overrideBackButton.,
remove the exit function in that method and leave it blank (if you want the background process not to exit when clicked)