How can i attach to a process using gdbvim? - c++

I use Vim as primary IDE for programming, with some plugins i have a good environment but for a single point: debugging.
I have recompiled Vim to use vimgdb, and it works, but the problem is that i need to attach to a process started by a root user so i have to use sudo to do it....
How can i do this with vimgdb?
Thanks in advance.

Well, the most obvious way - but probably not really what you're looking for - would be to run vim as root to begin with. Then you wouldn't have to worry about it switching to the root user for debugging. It would already be there.

Since I haven't used the vimgdb yet, I don't have the answer for your question. But, I guess you might be able to find a solution by referring to the implementation of SudoEdit plugin which handles the issue of reading/writing a file using the sudo command.
http://www.vim.org/scripts/script.php?script_id=2709
Hope that helps.

Related

How to automate django deployment?

OK, I am desperate enough to finally post a github question.
SUMMARY:
Django deploy -> digital ocean droplet -> nginx and gunicord + git pull
It works, but manually writing all the commands is way to tedious + error prone. I have been trying to find a suitable tool ever since, and kinda need some advice.
SOO FAR:
I have tried Fabric, BUUUT complexity and simplicity baffles me. Some tutorial are way to trivial, some are way too complex and 95 % of them seems to be outdated(this seems relevant in this case , because syntax has changed drastically)
In addition, the most basic example in docs don't work no matter how many times I have tried to correct it(ssh connection vie password).
P.S. I am completely new to devops, so a lot of things is confusing for me
Beside that, I have tried to dive into some other tools like bash scripting and ansible and dropped them shortly after, mainly due to them not being as alluring as Fabric seems to be.
My question is!
Should I continue tring to solve Fabric, or is there some other commonly used way to make deployment a simple and enjoyable matter while preserving the functionality?
::btw I am windows 10 user put prefer to use git bash, could this be the problem for Fabric(it seemed not being able to recognize ls command and I used DIR instead)
I typically recommend using ansible over fabric unless you are working with *nix. If you have to work with AIX, Solaris, HPUX, fabric can offer you more flexibility since you don't need python on the server. It will take about two-days to get up to speed on ansible, but if you're already using django, jinja2 (the templating language used by anible) should be a snap.

Start my program at login in MacOSX

I am developing a program in C++ in MacOSX, and I want to add an option to start my program at login. I investigated some possible solutions in MacOSX, but I did not understand well which is the best/the official suggested one nowadays. Some of them are easy, some more complicated, and it seems that the easier ones are not the suggested ones for the future.
Here a resume of what I found:
using OsaScript: it seems the simplest one, but I really would like a C/C++ API, and not using the osascript command
From the official documentation, I can see the 'Service Management framework', but I want the user be able to see my app started at login in the preference, and I would not like to create another helper bundle...
Again from the official documentation, I can see Launch Services Reference, but I am not sure it is what I need. I did not find any example in C/C++, and if I search for the 'Login' keyword, I just see two deprecated functions therein...
Technical Note TN2228 it seems a complete guide and with also some example therein, but it speaks about creating a 'authorization plug-in'. Do I really need that to start my app at login?
Creating Launch Daemons and Agents it seems the preferred way to launch a Daemon, but my app is not really a daemon...
So, what do you suggest me to do?
Do you know some other way to make my programm running at login?
Which one do you think is the easiest but not deprecated solution?
Do you have some example in C/C++? All the example I found are in other languages...
Thanks everybody
PS:
At the end I chose the OsaScript solution (one line of code...)
From this example you can see that you can set the property "name" when you add your item so that you can delete it later.
I am still looking for a easy C++ solution...

I want to use JSQMessagesViewController without pod install! can I do it?

I open another project in my mac and this won't work because I got Error for JSQMessagesViewController and I think I should Install that so I want to install JSQMessagesViewController to my project ! I have problem with pod install can I use Another way? or there is no way Just That way?!
If I have to use this method please tell me how to use this in the terminal
at the End when my project does not build its just because of JSQMessagesViewController pod file or not? thanks a lot
I am a little confused on your situation for what some of your questions are asking for but as to the on
can I use Another way? or there is no way Just That way?!
You can clone the project and add it directly to your project. So not using pods. The drawback with this is updating. You will have to manually download the latest version and add it to your project every time you want new features that are released with this framework.
Let me know if you need more clarification or if I can help with your other questions I would just need more details. 🖖🏽

how to run lamp in env

TL;DR
How do I encapsulate my Apache/PHP/MySQL/Wordpress installation in an environment or sandbox?
In my absence the designers-that-be have decreed that we use Wordpress for our newest project, as opposed to the Django-type applications I am familiar with. Another developer has already started making a custom theme, but now he's gone and I'm supposed to take over his work but I have no experience whatsoever with LAMP or Wordpress.
I thought it would be a good start to encapsulate the project into a proper standalone repository that I can copy and share between machines and people, put on github, etc, and most importantly: it needs to run in a virtual-env instance (or equivalent), so it doesn't mess up anybody's other projects, we can run multiple versions, etc.
Can anybody help me with that? At the moment it looks like the required files are spread out over my whole computer, I keep having to touch stuff in my root-directory, I need sudo simply to start and stop the *##+ing server, it's complete lunacy.
Thank you!
Take a look at virtPHP, phpenv and php-build for creating isolated environments. As for typing sudo every time you need to start or stop the server, this is the right way of doing things.

I've added a module in redmine, how can I enable it for many projects at once?

I've got all these great new plugins enabled, and I can enable them on any given project.
However, I don't see a way to add/remove them from many projects at once.
Perhaps I need a module management plugin? ;-)
In my case Redmine 3.1.0 and MySQL is used as DB server. I think, you'll get the main idea in case of other confuguration.
DELETE FROM `enabled_modules` WHERE `name` = 'module_name_here';
INSERT INTO `enabled_modules`
(`project_id`, `name`)
SELECT
`id`, 'module_name_here'
FROM
`projects`
You can activate module for one project to discover its name from enabled_modules. Or you can find it in plugin sources, it should look like 'project_module :module_name_here'
Please, don't do this if you do not completely understand, what is this answer about!
PS: Yes, I know - it is a dirty solution, but it's fast and easy enough for operation which is neccesary once a year or less.
It's been a while and I reckon the OP has since solved his problem. In case someone else has the same problem:
We also had to activate a few modules in all projects and wrote a small script to do it for us:
https://github.com/EugenMayer/enable_chiliproject_modules
Edit:
This was created and tested for the Redmine fork "Chiliproject" but should work without changes in Redmine.
how can I enable it many projects at once?
You can't - at least not by using the UI.