I have create new TopComonent for a client and then added new icon click action to the main toolbar and in view folder from main menu drop down list. But my problem is that what every position I set the action to it always puts it at start of toolbar but I need it at the end.
#ActionID(
category = "Build",
id = "some.action")
#ActionRegistration(
iconBase = "path.to.icom.image",
displayName = "someName")
#ActionReferences({
#ActionReference(path = "Menu/View", position = 400),
#ActionReference(path = "Toolbars/Refresh", position = 700)
})
#Messages("CTL_SomeAction=Refresh")
So can I edit the main layer.xml in netBeans??
What you would need to do is to create an xml file (eg. layer.xml) in your module. Then you would copy and paste what you need from the generated-layer.xml file that can be found in under the file tab in the left window according to the following path: [Your Module Name]/build/classes/META-INF/generated-layer.xml.
Generally according to your problem now, you might need the following info for your layer.xml file (if you give it that name):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN"
"http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
<folder name="Toolbars">
<folder name="Refresh">
<attr intvalue="1000" name="position"/>
</folder>
</folder>
</filesystem>
After doing this then validate your layer.xml file by right-clicking it and selecting "Validate XML" option. After doing this, then in the projects view, go to "important files" and open the Module Manifest file. At the end of the file add the following:
OpenIDE-Module-Layer: org/yourorg/modulename/layer.xml
After saving the manifest file and running your module, it should be ok.
Related
I'm using makeappx along with a manifest.appx to generate an application package for the Windows store.
My uap:VisualElements goes like this:
<uap:VisualElements DisplayName="tevolution"
Description="tevolution is a Remote Video Screen for Motion Freedom."
Square44x44Logo="44.png"
Square150x150Logo="150.png"
BackgroundColor="#323232">
<uap:DefaultTile Square71x71Logo="71.png"
Square310x310Logo="310.png"
Wide310x150Logo="wide.png"/>
</uap:VisualElements>
With the following visual resources:
Now, for some reason I'm getting a weird icon with additionnal margins on the start menu and the task bar:
After publishing to the Windows store, I was expecting margin-less icons and got weird margins with the provided BackgroundColor in both the start menu and the task bar.
I'm not exactly sure where those margins come from and how to fix them. If someone found a way I'd appreciate it.
Okay, so I had to copy the following in an assets folder at the root of the project.
icon.png (512x512)
icon.scale-100.png (50x50)
icon.scale-125.png (63x63)
icon.scale-150.png (75x75)
icon.scale-200.png (100x100)
icon.scale-400.png (200x200)
Square44x44Logo.scale-100.png (44x44)
Square44x44Logo.scale-125.png (55x55)
Square44x44Logo.scale-150.png (66x66)
Square44x44Logo.scale-200.png (88x88)
Square44x44Logo.scale-400.png (176x176)
Square44x44Logo.targetsize-16.png (16x16)
Square44x44Logo.targetsize-24.png (24x24)
Square44x44Logo.targetsize-32.png (32x32)
Square44x44Logo.targetsize-48.png (48x48)
Square44x44Logo.targetsize-256.png (256x256)
Square44x44Logo.altform-unplated_targetsize-16.png (16x16)
Square44x44Logo.altform-unplated_targetsize-24.png (24x24)
Square44x44Logo.altform-unplated_targetsize-32.png (32x32)
Square44x44Logo.altform-unplated_targetsize-48.png (48x48)
Square44x44Logo.altform-unplated_targetsize-256.png (256x256)
Square44x44Logo.altform-lightunplated_targetsize-16.png (16x16)
Square44x44Logo.altform-lightunplated_targetsize-24.png (24x24)
Square44x44Logo.altform-lightunplated_targetsize-32.png (32x32)
Square44x44Logo.altform-lightunplated_targetsize-48.png (48x48)
Square44x44Logo.altform-lightunplated_targetsize-256.png (256x256)
Square150x150Logo.scale-100.png (150x150)
Square150x150Logo.scale-125.png (188x188)
Square150x150Logo.scale-150.png (225x255)
Square150x150Logo.scale-200.png (300x300)
Square150x150Logo.scale-400.png (600x600)
SmallTile.scale-100.png (71x71)
SmallTile.scale-125.png (89x89)
SmallTile.scale-150.png (107x107)
SmallTile.scale-200.png (142x142)
SmallTile.scale-400.png (284x284)
LargeTile.scale-100.png (310x310)
LargeTile.scale-125.png (388x388)
LargeTile.scale-150.png (465x465)
LargeTile.scale-200.png (620x620)
LargeTile.scale-400.png (1240x1240)
WideTile.scale-100.png (310x150)
WideTile.scale-125.png (388x188)
WideTile.scale-150.png (465x225)
WideTile.scale-200.png (620x300)
WideTile.scale-400.png (1240x600)
Then, added the following to AppxManifest.xml:
<uap:VisualElements DisplayName="tevolution"
Description="tevolution is a Remote Video Screen for Motion Freedom."
Square44x44Logo="assets/Square44x44Logo.png"
Square150x150Logo="assets/Square150x150Logo.png"
BackgroundColor="transparent">
<uap:DefaultTile Square71x71Logo="assets/SmallTile.png"
Square310x310Logo="assets/LargeTile.png"
Wide310x150Logo="assets/WideTile.png"/>
</uap:VisualElements>
Then, I ran the following at the root folder of my project:
makepri createconfig /cf priconfig.xml /dq "en-US"
makepri new /pr . /cf priconfig.xml
I have no idea why anyone wouldn't figure that out.
I'm creating my first nodejs/sails.js project, I want to use 3 different layout for 3 different occasions:
frontend_layout.ejs
admin_layout.ejs
mobile_layout.ejs
In frontend_layout.ejs, I want to load bootstrap.css, jquery.js and
bootstrap.js.
In admin_layout.ejs, I want to load bootstrap.css, angular.js and
ui-bootstrap-tpls.js(angular-ui js library).
In mobile_layout.ejs, I want to load ionic.css and ionic.bundle.js
I have created 3 folders in sailsProject/views/ which are admin_pages, mobile_pages and frontend_pages, the 3 layout.ejs files reside in each of these folders respectively, but no matter which layout I load, it always include all the css/js files in assets/js and assets/styles. I know I need to do something to pipeline.js, but how exactly? I'm not efficient at grunt, so I would really appreciate if anyone could point me which config files need to be modified and how... Thanks!
I wanted something very similar in my project, except I also wanted to take advantage of Sail's cool built-in ability to auto minimize/uglify javascript files for "sails lift --prod" in various layouts with different sets of javascript files. This answer only deals with the JS files, but you can make similar changes to support the same concept with your CSS files.
In my project I had 2 different layouts -- layout.ejs and layoutadmin.ejs. I created a new /assets/jsadmin folder which holds my admin javascript files. I left the sails existing /assets/js folder as-is to hold the javascript files for the public web pages.
My goal was for the /assets/js folder contents to be inserted between these tags (sails does this by default and these tags are used in the layout.ejs file):
<!--SCRIPTS-->
<!--SCRIPTS END-->
While the /assets/jsadmin folder contents was to be inserted between these tags (I made up these "custom" tag names and they are used in the layoutadmin.ejs file. I will add add support for this new tag in the rest of this answer):
<!--SCRIPTS_ADMIN-->
<!--SCRIPTS_ADMIN END-->
I created a full code sample demo of this here.
For development...
(sails lift), I modified so sails would populate my custom tags with the assets/jsadmin js files upon lifting.
I modified tasks/pipeline.js by adding a new variable called jsAdminFilesToInject which is very similar to the existing jsFilesToInject except it collects the js files from the jsAdmin folder.
var jsAdminFilesToInject = [
// Load sails.io before everything else
//'jsAdmin/dependencies/sails.io.js',
// Dependencies like jQuery, or Angular are brought in here
'jsAdmin/dependencies/**/*.js',
// All of the rest of your client-side js files
// will be injected here in no particular order.
'jsAdmin/**/*.js'
];
Note: I also had to export this new variable at the bottom of the pipeline.js file.
module.exports.jsAdminFilesToInject = jsAdminFilesToInject.map(function(path) {
return '.tmp/public/' + path;
});
I modified tasks/config/sails-linker.js by adding a new devJsAdmin task where it looks for tags and calls the new .jsAdminFilesToInject added in the pipeline.js file above.
devJsAdmin: {
options: {
startTag: '<!--SCRIPTS_ADMIN-->',
endTag: '<!--SCRIPTS_ADMIN END-->',
fileTmpl: '<script src="%s"></script>',
appRoot: '.tmp/public'
},
files: {
'.tmp/public/**/*.html': require('../pipeline').jsAdminFilesToInject,
'views/**/*.html': require('../pipeline').jsAdminFilesToInject,
'views/**/*.ejs': require('../pipeline').jsAdminFilesToInject
}
},
I Added a new task step to the tasks/register/linkAssets.js file which calls the devJsAdmin added above.
'sails-linker:devJsAdmin',
To test, run sails in demo mode:
sails lift
Browse to http://localhost:1337/home - you will see it is using the layout.ejs template and viewing the source will show the following at the bottom (files pulled from js folder):
<!--SCRIPTS-->
<script src="/js/dependencies/sails.io.js"></script>
<script src="/js/jquery-1.10.2.js"></script>
<!--SCRIPTS END-->
Browse to http://localhost:1337/admin - you will see it is using the layoutadmin.ejs template and viewing the source will show the following at the bottom of the source (files pulled from jsAdmin folder):
<!--SCRIPTS_ADMIN-->
<script src="/jsAdmin/dependencies/jquery-1.10.2.js"></script>
<script src="/jsAdmin/knockout-3.3.0.debug.js"></script>
<!--SCRIPTS_ADMIN END-->
For production...
(sails lift --prod), I wanted to do the same as development except I first wanted to concat and uglify the production javascript that goes in my new SCRIPTS_ADMIN tags.
I added a new jsAdmin section in the grunt tasks/config/concat.js file which pulls in the files from the previously added jsAdminFilesToInject in the pipeline.js to produce a concat/productionAdmin.js output file.
jsAdmin: {
src: require('../pipeline').jsAdminFilesToInject,
dest: '.tmp/public/concat/productionAdmin.js'
},
I added a new distAdmin section in the grunt tasks/config/uglify.js file which makes the concat/productionAdmin.js "ugly" by producing a new min/productionAdmin.min.js file.
distAdmin: {
src: ['.tmp/public/concat/productionAdmin.js'],
dest: '.tmp/public/min/productionAdmin.min.js'
}
I added a new prodJSAdmin section in the tasks/config/sails-linker.js file which adds the min/productionAdmin.min.js file between the SCRIPTS_ADMIN tags.
prodJsAdmin: {
options: {
startTag: '<!--SCRIPTS_ADMIN-->',
endTag: '<!--SCRIPTS_ADMIN END-->',
fileTmpl: '<script src="%s"></script>',
appRoot: '.tmp/public'
},
files: {
'.tmp/public/**/*.html': ['.tmp/public/min/productionAdmin.min.js'],
'views/**/*.html': ['.tmp/public/min/productionAdmin.min.js'],
'views/**/*.ejs': ['.tmp/public/min/productionAdmin.min.js']
}
},
Finally, I called this new prodJSAdmin from the prod grunt task by adding a line in the prod.js file.
'sails-linker:prodJsAdmin',
Run sails in production mode:
sails lift --prod
Browse to http://localhost:1337/home - you will see it is using the layout template and viewing the source will show the following at the bottom (using production.min.js):
<!--SCRIPTS-->
<script src="/min/production.min.js"></script>
<!--SCRIPTS END-->
Browse to http://localhost:1337/admin - you will see it is using the layoutadmin.ejs template and viewing the source will show the following at the bottom of the source (using productionAdmin.min.js):
<!--SCRIPTS_ADMIN-->
<script src="/min/productionAdmin.min.js"></script>
<!--SCRIPTS_ADMIN END-->
By default, Sails automatically insert all your css files (assets/styles) into tags between STYLES and STYLES END and js files (assets/js) into tags between SCRIPTS and SCRIPTS END.
<!--STYLES-->
<!--STYLES END-->
.
.
.
<!--SCRIPTS-->
<!--SCRIPTS END-->
This is set in pipeline.js file. By default it has set to get all css files from assets/styles. You can find it in cssFilesToInject section.
'styles/**/*.css'
You can change it as you wish. you can comment or delete it simply. (keep in mind if you want to put some css files common to every layout you can put them in here.)
Same for the js files. By default it has set to get all js files from assets/js. You can find it in jsFilesToInject section. Remove or add js files according to your requirement. You can find more information about grunt globbing patterns in here which helps to understand filtering pattern.
So easiest thing you can do now is put your layout specific files out side those tags(STYLES and SCRIPTS)
For example look following code sample,
<!--STYLES-->
<!--STYLES END-->
<!--STYLES SPECIFIC TO THIS LAYOUT-->
<link rel="stylesheet" href="/styles/some_layout_specific.css">
My web-server serves up the logs as plain text.
Is it possible to use Greasemonkey to do some formatting of the logs or is it only possible to use it on HTML content?
Could I force the text into HTML on load then process it after?
Yes, Greasemonkey works on text files.
Note that when a browser such as Firefox or Chrome displays a plain text file, the browser wraps it in a dynamic <pre> element, like so:
<html><head>...</head>
<body>
<pre>
<!-- Actual content of text file is here. -->
</pre>
</body></html>
For best results, take that into account when scripting.
For example, for this public text file (U of I, Open Source License), install this script using Greasemonkey, Tampermonkey, Scriptish, etc.:
// ==UserScript==
// #name _Manip text file
// #include http://llvm.org/releases/2.8/LICENSE.TXT
// #require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// ==/UserScript==
var pageTextNd = $("body > pre");
var newPageTxt = pageTextNd.text ().replace (/\bLLVM\b/gi, "Ernst Blofeld");
//-- Rewrite the page
pageTextNd.text (newPageTxt);
And see the results.
I've tried to set 1column template for home page using my local.xml file:
<cms_index_index>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</cms_index_index>
But this is doesn't work. How can I do this?
Homepage is a CMS page. Unfortunately, you can't assign root template for CMS pages using layout, because they have own attribute "root_template" (cms_page table).
You can change this attribute in the backend (CMS - Pages).
Or you can change it in code:
$homePage = Mage::getModel('cms/page')->load('home', 'identifier');
$homePage->setRootTemplate('one_column');
$homePage->save();
I recommend you to write sql data upgrade, which will update root template value for homepage:
$installer = $this;
/* #var $installer Mage_Core_Model_Resource_Setup */
$installer->startSetup();
$installer->run("
UPDATE `{$this->getTable('cms_page')}` SET `root_template` = 'one_column' WHERE `identifier` = 'home';
");
$installer->endSetup();
I'm sure the other suggestions work well, but that all looks way too complicated to me. What I've done which seems to work great, is to simply put the following into the Layout Update XML for the CMS page in question (in this case, your home page)
<reference name="root">
<action method="setTemplate">
<template>page/1column.phtml</template>
</action>
</reference>
The problem lays in Mage_Cms_Helper_Page::_renderPage. Layout updates are applied -before- root template (configured from the backend) is applied:
Mage::dispatchEvent('cms_page_render', array('page' => $page, 'controller_action' => $action));
$action->loadLayoutUpdates();
$layoutUpdate = ($page->getCustomLayoutUpdateXml() && $inRange) ? $page->getCustomLayoutUpdateXml() : $page->getLayoutUpdateXml();
$action->getLayout()->getUpdate()->addUpdate($layoutUpdate);
$action->generateLayoutXml()->generateLayoutBlocks();
...
if ($page->getRootTemplate()) {
$action->getLayout()->helper('page/layout')
->applyTemplate($page->getRootTemplate());
}
Also notice how the only event in this method is inconveniently placed above all of this... Should you want to fix this cleanly (without queries), you should observe the following event:
controller_action_postdispatch_cms_index_index
Then do the following (untested, but should work):
$this->getEvent()->getControllerAction()->getLayout()->helper('page/layout')->applyTemplate('one_column');
Then render the layout again. This is all just a guideline how to solve this through observers.
Ok, you know how in programs like Microsoft Excel, or Adobe Acrobat Reader you can click on a file in explorer and it will open with the associated program. That's what I want my application to do. Now, I know how to set up the file associations in Windows so that it knows the default program for each extension. My question is how do I get my application to open the file when I double click the file.
I've searched the web using google, I've searched the msdn site, and I've searched several forums including this one but I haven't found anything that explains how to accomplish this. I'm guessing it has something to do with the parameters of the main method but that's just a guess.
If someone can point me in the right direction I can take it from there. Thanks in advance for your help.
Shane
Setting up the associations in windows will send the filename to your application on the command line.
You need to read the event args in your applications main function in order to read the file path and be able to open it in your application.
See this and this to see how to access the command line arguments in your main method.
static void Main(string[] args)
{
System.Console.WriteLine("Number of command line parameters = {0}", args.Length);
foreach (string s in args)
{
System.Console.WriteLine(s);
}
}
When you open the file, with associations set as you described, your application will be started with the first argument containing the filepath to your file.
You can try this out in a simple way by printing out the args from your main method, after you open your application by clicking on the associated file. The 0th element should be the path to your file.
Now, if you successfully reached this point, the all you need to do now is read the contents of the given file. I'm sure you'll find more than plenty of resources here on how to do that.
I guess this is what you are looking for:
FileInfo fi = new FileInfo(sfd.FileName); //the file you clicked or saved just point
//to the right file location to determine
//full filename with location info
// opening file
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = #fi.FullName;
startInfo.WindowStyle = ProcessWindowStyle.Normal;
Process process = new Process();
process.StartInfo = startInfo;
process.Start();
You will need to create registry-keys for your file-extension. This page describes well, which keys you'll need to set (see «3. How do I create file associations?»).