I installed KCachegrind on Ubuntu 14.10
When i click open button, i see Open dialog with default filter of file "Callgrind Profile Data" and not see my file. I must select "All files" in filter and then i see my file.
What extension must have a file that I saw him once when opening this dialog?
I looked up the relevant source code here:
void QCGTopLevel::loadTrace()
{
QString file;
file = QFileDialog::getOpenFileName(this,
tr("Open Callgrind Data"),
_lastFile,
tr("Callgrind Files (callgrind.*)"));
loadTrace(file);
}
It seems you need to prefix the filename with callgrind. to see the file by default. Or you can just select "All Files" from the dropdown.
callgrind. did not work for me, so I checked the code as well:
KUrl url = KFileDialog::getOpenUrl(KUrl(),
i18n("cachegrind.out* callgrind.out*|Callgrind Profile Data\n*|All Files"),
It seems callgrind.out works.
Related
I have an html file with this path: /home/kevedvoc/index.html
In my C program am scanning the user's input, and if they say "open doc", I want to open this html file on chrome or firefox or whatever browser. I just need it to appear.
How can I do that. Is it doable?
Thank you for your help.
It has been a while, but if I remember right, you can use int system(const char *command) found in stdlib.h.
system("firefox <url>"); // "firefox.exe" on Windows.
system("chrome <url>"); // "chrome.exe" on Windows.
system makes a call to execl found in unistd.h, so you could also call that directly.
If there is a way in PhpStorm 2019.2.3 opening “Find in path” dialog to select search in the directory of the active file ?
MODIFIED :
When I start new session in my PHPStorm and
having active file in one of subdirectories : https://imgur.com/a/tQbhlI9
I open “Find in path” dialog and see : https://imgur.com/a/UZp5KmE
“In project” tab is active and in found files I see files found from all the project.
I open “Directory” tab and see error : https://imgur.com/a/e4rtCdH
Are there some options To Search In the current directory?
Is something wrong in config of my PhpStorm 2019.2.3 ?
Thanks!
To search in the directory of the current file, you need to take 3 steps:
Open the Project Navigation bar
Click the select opened file button on the project toolbar or press ALT+F1 followed by 1 (At least that's what the combination is on the Sublime Text Keymap)
Press Ctrl+Shift+S or go to Edit -> Find -> Find in Path (or select the parent folder of your file in the project toolbar and right click to select find in path)
Alternatively you can right click the file tab and copy the path to enter it in the directory option of find in files.
Why when I save a file in Sublime Text 3 is the default save location the Sublime install directory and why is the default file type nothing?
I want to set the default save location to the Desktop and the default file type to .txt, how can I do this?
Here are my settings:
{
"font_size": 9,
"hot_exit": false,
"ignored_packages": ["Vintage"],
"remember_open_files": false
}
Without no line of code:
Preferences -> Settings -> paste this "default_dir": "your/favorite/path"
And you are done.
More here: https://sublime-text-unofficial-documentation.readthedocs.io/en/latest/reference/settings.html#file-and-directory-settings
Doesn't (currently) address the default extension issue, but you can also try AdvancedNewFile. Rather than creating an unnamed buffer, this plugin creates a named file. The default location is configurable, though there is no default extension.
Disclaimer: I'm the maintainer of the AdvancedNewFile plugin.
Edit
I've updated AdvancedNewFile to support default file extensions.
You can install the Default File Type plugin manually. It's a very simple plugin, and while the Package Control page says that it's for Sublime Text 2 only, I just installed it under OSX and it works fine. To install, navigate to %APPDATA%\Sublime Text 3\Packages and run
git clone https://github.com/spadgos/sublime-DefaultFileType.git DefaultFileType
Then, copy Packages\DefaultFileType\default_file_type.sublime-settings to Packages\User and change its contents to the following:
{
"default_new_file_syntax": "Packages/Text/Plain text.tmLanguage",
"use_current_file_syntax": false
}
Save the file, and now whenever you hit CtrlN to create a new file, it will be set to plain text. The plugin only works with the key combo, not via the File -> New File menu option.
As far as the save location goes, I have a theory, but I haven't been able to find documentation to back it up. At least on Win7 (for me), it seems like the default save location is the directory which contains the file that was open when you hit CtrlN or File -> New File to create the new file. For example, I had my Packages\User\Preferences.sublime-settings file open when I created a new file, and hitting CtrlS opened the Save dialog in Packages\User. I saved the file to the Desktop, hit CtrlN for a new file, entered something, then hit CtrlS and the Save dialog opened in the Desktop.
So, while there isn't a preferences setting for default save location, at least on Windows you can tweak it by always keeping a Desktop file open, then creating new files while that Desktop file is focused.
This should be a built-in option, honestly, but it seems fairly simple to automate yourself. Hit Tools -> New Plugin
Then paste this over the file that's created, hit save and call it "DefaultLanguage.py" or something:
import sublime, sublime_plugin
class EverythingIsPowerShell(sublime_plugin.EventListener):
def on_new(self, view):
view.set_syntax_file('Packages/PowerShell/Support/PowershellSyntax.tmLanguage')
Of course, you can change the language from PowerShell to ... whatever you prefer. You just need the relative path to the tmLanguage. You can get that by opening a file in your favorite language and then open the console (View->Show Console) and type:
view.settings().get('syntax')
Can anyone tell me how the Chrome developer tools workspace mappings work.
I believe it is only available in Canary at the moment.
I thought it is supposed to allow me to make changes to the CSS rules in the elements view and have them automatically saved to the local files as demonstrated by Paul Irish at Google IO 2013. I can't get this functionality to work.
https://developers.google.com/events/io/sessions/325206725
It works only in canary at the moment.
EDIT: Now in Chrome (since ver 30+)
1) you need to open devtools settings panel. It has 'Workspace' section.
2) in this section you need to click on 'Add folder' item. It will show folder selection dialog.
3) After selecting a folder you will see an info bar about access rights for the folder.
4) As a result you will see two top level elements in the Source panel file selector pane. In my case it were localhost:9080 site and devtools local file system folder. At this moment you need to create a mapping between site files and your local files. You can do that via context menu on a file.
It doesn't matter what file to map, local or site file.
5) at that moment devtools will ask you about restart.
After restart devtools will show you the singe folder entry in the files pane and will apply all the changes you do to the local file each time when you press Ctrl + S or Cmd + S on mac.
Just a correction on what loislo has said.
"It works only in canary at the moment."
You can trigger all these experimental features in stable chrome releases by typing
Chrome://flags in the address bar.
Can anyone tell me how the Chrome developer tools workspace mappings work?
In current version of Chrome (I have version 80) the manual mapping option is gone. In the DevTools under Settings > Workspace it only says "Mappings are inferred automatically". From what I found the automatic mapping considers the following characteristics:
(1) Resource name and file name must be equal.
(2) Resource content and file content must be equal.
(3) The header field "Last-Modified" of the resource must be equal to the last modification date of the file on the file system.
Note that for (2) also the encoding must be the same. For example mixing "UTF-8" and "UTF-8 with BOM" will not work.
(3) Was not true in my case because I served the resource using a custom HttpServlet (Java), in which this header field was not set. Now I set this header field in my HttpServlet and the workspace mapping in Chrome is working. Simplified example:
#Override
protected void doProcess(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException
{
try
{
// (1) file_name must be equal to the queried resource name of the website.
String path = "path/to/the/file_name.js";
File file = new File(path);
httpResponse.setContentType("application/javascript");
// (3) the Last-Modified header field of the resource must match the file's last modified date
httpResponse.setDateHeader("Last-Modified", file.lastModified());
// (2) the content of the resource must match the content of the file
// Note: CopyStream is a utility class not part of standard Java. But you get the idea ;)
CopyStream.copyAll(new FileInputStream(path), httpResponse.getOutputStream());
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
For me I just needed to update Chrome (there was a light red "update" button that I'd been ignoring for some time).
I was looking around and the questions and answers did not seem to match what I am looking for. Anytime I open a new file it defaults to a plan text file. I mostly work with HTML files so I was wondering if there is a setting that would be changed so that when I open a new file it will default to HTML? Hope this is possible.
Rob
Create a new plugin Tools > Developer > New Plugin...
Paste this in:
import sublime, sublime_plugin
class EverythingIsPowerShell(sublime_plugin.EventListener):
def on_new(self, view):
view.set_syntax_file('Packages/PowerShell/Support/PowershellSyntax.tmLanguage')
Save and call it NewTabSyntax.py. New tabs will now default to Powershell.
You can change the syntax to whatever you prefer. To find out the "path" of a particular syntax, simply open a file of that syntax, open the console (View > Show Console) and type:
view.settings().get('syntax')
pls install Package sublime-DefaultFileType https://github.com/spadgos/sublime-DefaultFileType
which will automatically sets the syntax for new files.
It is possible with the ApplySyntax Plugin. Once it is installed (e.g. via PackageControl), you can set the ApplySyntax User Settings like that:
"new_file_syntax": "HTML",
Now if you open a new file, your default syntax will be HTML. Of course you can set every Syntax you have installed.