Move to the definition for PHP constants in Aptana - hyperlink

I used to work with Zend Studio where it was possible to go to the definition for constants using hyper-linking "ctrl+click" (as for functions, vars, etc.)
I switched to Aptana studio 3.0 and customized my way well except on this point.
Does anyone knows if it's possible to manage PHP constants in Aptana the same way as with Zend Studio?
This is not fundamental but could be very useful to retrieve a constant (I precise that typing the name of a constant works well with code assist. It's just to get back to the definition by clicking that's seems impossible)
Thanks a lot! :)

I just tried that:
File a.php:
<?php
class TestClass {
const TEST_CONST1 = 0;
const TEST_CONST2 = -1;
const TEST_CONST3 = 5;
const TEST_CONST4 = -5;
}
File b.php:
<?php
TestClass::TEST_CONST1;
Clicking Ctrl and hovering over the TEST_CONST1 shows a link. Clicking that link opens a.php on line 3.
Use the latest Studio.
Make sure that your project was created using the Aptana PHP project creation wizard. The Nature of the project that is created this way effects the functionality of the Content Assist and the linking.
In case your project was imported, you can still set the Aptana PHP Nature by right-clicking the project --> Select properties --> Select Project Natures --> Select the PHP item.
Hope that helps

Select project and set the Aptana PHP Nature by right-clicking the project --> Select properties --> Select Project Natures --> Select the PHP item.

Related

Sublime text 2: certain files should open in a different panel

I'm using Sublime Text 2 for Rails development. I love the editor so far, especially its customizability. Currently I'm getting used to a 2-panel workflow where I have various Rspec files open in the right panel, and the corresponding views, controllers etc. open in the left panel. But when I open new files, they frequently open in the wrong panel (the one I'm currently working in), and I have to drag them over to the left or right manually.
Here's my question: when I open a file, is it possible to make the file open in the right panel if the file name has "_spec" in it, and in the left panel otherwise?
I know that's a pretty specific adjustment. I'd appreciate any tips.
Yes it is possible via a plugin. If you have some time, I'd spend a little bit of it investigating the sublime text api. I've thrown something together that should work. It's only minimally tested, and not very robust. Though I think it should work for your use case. If it doesn't you can use making it just right part of exploring the ST api.
import sublime_plugin
import os
class OpenLocationListener(sublime_plugin.EventListener):
def on_load(self, view):
file_name = view.file_name()
window = view.window()
num_groups = window.num_groups()
if file_name is not None and num_groups >=2:
if "_spec" in os.path.basename(view.file_name()):
if window.active_group() == 0:
window.set_view_index(view, 1, 0)
window.focus_view(view)
else:
if window.active_group() == 1:
window.set_view_index(view, 0, 0)
window.focus_view(view)
Save the above in your Packages/User folder as <some name>.py The name doesn't matter, as long as you save it as a python file.
As a side not, unless you are using an ST2 only plugin, consider upgrading to ST3. Many plugins that are under active development may only be ST3 compatible. I wrote the above in ST3, so that's where I tested, though I don't believe there is anything ST3 specific about it.

Issues with multiple build template (xaml files) in project

I'm having trouble with my TFS Build project. I'm following the example from here as far as setting up the project in VS.
I have a project just for the custom activities and a separate project for just the templates. The issue I have is that the Templates project can only contain one xaml file. If I copy and and paste it in the same project it wont build. I get the following error:
Error 102 The item "obj\Debug\TfsBuild_Process_BeforeInitializeComponentHelper.txt" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.
But if I remove it, it'll build just fine. Everything works, meaning it'll build if I queue a build.
I have also tried the solution suggested on here, but it doesn't seem to resolve my issue.
Solution:
Renaming the form name in the solution explorer.
Change the class name in the .cs and Designer.cs file.
Change the constructor and destructor name (which is same as class name)
Change the name space name (if needed).
Here is the link to download the project.
I can't seem to figure out why. Any help is greatly appreciated!
I don't know if you still have this problem but I also had the problem today. I found a resolution that (if you still facing the problem) can help you or others.
When you copy a Build Process template it automaticly gets the x:Class property set to TfsBuild.Process. When you have multiple process templates with the same value then you will get this error when building the project.
<Activity mc:Ignorable="sads sap sap2010" x:Class="TfsBuild.Process" this:Process.BuildNumberFormat="$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)" this:Process.AgentSettings="[New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly}]" this:Process.Verbosity="[Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]" this:Process.OutputFullHistory="True" this:Process.OutputBranchOrigin="True" this:Process.OnlyOutputChangedFiles="True" this:Process.StartChangeset="0"......
I solved the problem by replacing TfsBuild.Process with another name for every template (ex. TfsBuild.ProcessLabDefault). Please note you should also change all the instances of this:Process because the two are linked together (ex. this:ProcessLabDefault).
<Activity mc:Ignorable="sads sap sap2010" x:Class="TfsBuild.MyProcess" this:MyProcess.BuildNumberFormat="$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)" this:MyProcess.AgentSettings="[New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly}]" this:MyProcess.Verbosity="[Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]" this:MyProcess.OutputFullHistory="True" this:MyProcess.OutputBranchOrigin="True" this:MyProcess.OnlyOutputChangedFiles="True" this:MyProcess.StartChangeset="0"......
I didn't find a way to change this by using the interface, View Code & Find and replace works. Hope it helps.
I used the following approach and it worked very well. All that needs replaced is TfsBuild in two locations on the first line of the raw xaml.
http://social.msdn.microsoft.com/Forums/vstudio/en-US/d3fb6b89-b711-4a02-a10a-a88a0cb4f714/unable-to-add-more-than-one-templatexaml-into-activity-library-workflow-project?forum=tfsprocess
From the link:
1 Right-click your Copy of DefaultTemplate.xaml in Source Control and select View With… to open it in Notepad (you can also right-click the template in VS and select 'View Code').
2 Then in the first line change:
**x:Class="TfsBuild.Process"** to **x:Class="YourProcessTemplateName.Process"**
**xmlns:this="clr-namespace:TfsBuild"** to **xmlns:this="clr-namespace:YourProcessTemplateName"**
I ran in to this problem and wanted to add the solution I found to it. If you check the properties of the XAML files, when you link them to your project they're assigned a BuildAction of XamlAppDef. Changing this to 'Content' will resolve the error.
To find the properties screen you need to edit just highlight the XAML file in Solution Explorer and either hit F4 or Right-Click on the file and choose 'Properties' from the context menu.
Hope this helps.

How to inform Free Pascal Compiler to set Locale ID for the compiled application

In Delphi there is an option VersionInfo->Language->Locale ID when viewing project properties.
I was wandering how to set such property for a program being compiled under Free Pascal.
Any solution is welcome: command line argument or preprocessor directive such as {$key value}; equivalent to Delphi.
If you can build your projects using *.lpi files then I would try to add the following into your project's Project.lpi file. In the following snippet is shown how to set the project's locale ID (for Windows platform) to 0405 (Czech).
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
...
<VersionInfo>
<UseVersionInfo Value="True"/>
<Language Value="0405"/>
<StringTable ProductVersion=""/>
</VersionInfo>
...
</ProjectOptions>
...
</CONFIG>
Or if you are using Lazarus IDE then you might use to Delphi very similar settings tab which you can open from Project / Project Options ... and as in Delphi go to Version Info where is the Language selection combo box available if you include the version info into the project.
Not 100% sure this will work, feel free to vote me down if this doesn't work.
Lazarus will inherit the locale settings it starts with.
You can set the locale info prior to starting Lazarus in Linux/OS X using the command line:
export LC_CTYPE="pt_BR"
export LANG="pt_BR"
export LANGUAGE="pt_BR"
./lazarus
Your compiled application should inherit these settings.
The answer is inspired by this workaround to an error has since been fixed.
I recommend you have a look at the fpc forum as well and ask the question there.
Don't forget it include details like the platform (Linux/Windows/OS X) and the exact version of FPC and Lazarus you are using as well as the actual Locale that you want.
Better answer
From: http://forum.lazarus.freepascal.org/index.php/topic,5924.0.html
Finally, I managed to find a simple and effective way to make my application localizeable. It uses just one unit and no code.
1. Add unit "defaulttranslator" to your uses list.
2. Enable "i18n" in "Project Options" and set "PO output directory" to "locale" or "languages". You can put translation files right into application folder, but that would just make a mess. Don't forget to create an appropriate folder.
3. Add components to the form. If you already have all components on your form, you'll have to move it a little bit, so it's modified.
4. Save your project.
5. Now there should be .po files in your "locale" or "languages" folder. For different languages files should be copied and renamed like so "project1.XX.po", where XX is language code (e.g. "en", "de", etc.).
6. Translate .po files with translation software, and generate .mo files. I suggest to use POEdit.
7. Run your application, and the translation to be used will be chosen by your regional locale settings. If you need to test other language - just start your application with following command line parameters - "-l XX" or "-lang XX", where XX is a language code.
This method is not very versatile, but it translates resource strings and LCL component properties.

ContentLoadException problem

I'm very new to XNA. Actually I have XNA 4.0 book by kurt jaegers, so i installed VS 2010 and XNA 4.0 and wrote my first program. But that program didn't run successfully,it kept displaying the ContentLoadException file not found. So i did a bit of research on web and found that there is some issue with XNA 4.0. So I uninstalled the VS 2010 & XNA 4.0 and installed VS 2008(express edition) & XNA 3.0 . Then I compiled my first program on it and i ran successfully.
But,now I'm facing the same problem again with my new projects. I've tried both Syntax :
xx = this.Content.Load<Texture2D>("TitleScreen");
xx = Content.Load<Texture2D>(#"TitleScreen");
And there is no spelling mismatch problem. Please Mods guide me. And please tell me why I'm getting this problem again and again.
System Specs :
XP sp3,i3,2gb RAM.
Content that you want to load into via the ContentManager needs to be in the content project. Pretend for a moment it looks like this
Mygame.Content > SomeFolder > textureName
You would use content.Load<Texture2D>("SomeFolder/textureName") to get to it. If it was at the root of the Content project content.Load<Texture2D>("textureName") will work. If (and since) it isn't there are 2 things to check
Right click on the texture and go to properties. Look at the AssetName properties. This is what you use to load it up via the Content Manger. Try using whatever this name is.
The root directory the Content Manager looks in is "Content". Look at Content.RootDirectory and see what it is. If it isn't "Content" change it to that. That could also work.
In order to properly load content, you'll need to use the generic method
ContentManager.Load<T>
For example, if you're trying to load a Texture2D element, Use the following syntax:
Texture2D texture = Content.Load<Texture2D>("textureName");
Read more about loading content in this link.
There is a known issue with ContentManagers instanced by anything other than the default Game object constructor, which cause the problem you are experiencing.
If you are indeed using a ContentManager object other than the one supplied on the Game object, the solution is:
When you instantiate the ContentManager, you should set it's RootDirectory property to
#"Content"
Hope it helps

Changing file references during the Publishing of the website

I have a master file which has references to the JS and the CSS file used for my website. These references are pointing to the non-crunched version of the files. Now, when I hit the Publish button through Visual Studio for my project I want to change the references in my master file to point to the crunched version of the JS and CSS.
Eg: During development if it was pointing to http://www.example.com/main.js, during publish it should change the reference to http://www.example.com/main_min.js. Is there a way to do this?
Also, before changing the reference I need to run my current js file(main.js) through the tool which outputs the crunched js file(main_min.js).
Any help on this is appreciated!
Thanks.
You could go to the project's properties and in the Build Events tab enter the following into the "Post-build event command line":
$(SolutionDir)..\YourJsCruncher.exe $(ProjectDir)\content\js\debug\ $(ProjectDir)\content\js\release\
and then have a custom HTML helper:
public static MvcHtmlString IncludeJs(this UrlHelper helper, string javascriptFile)
{
#if DEBUG
var subfolder = "debug";
#else
var subfolder = "release";
#endif
var path = helper.Content("~/Content/js/{1}/{2}.js", subfolder, javascriptFile);
return MvcHtmlString.Create(string.Format("<script type=\"text/javascript\" src=\"{0}\"></script>", path));
}
and then in your view:
<%= Url.IncludeJs("foo.js") %>
This question has most of the answers you need:
Concatenate and minify JavaScript on the fly OR at build time - ASP.NET MVC
Customizing the publich process for one click publish is a little trickier. The best I could answer is linking to this blog: http://vishaljoshi.blogspot.com/ When I was working with one-click-publish customization this is the place I found the most answers. If I remember correctly this wasn't trivial and its better to integrate this into your build process like the answers in the first question I link explain.

Resources