Adding Code Snippet in PentaHo kettle User defined java Class - kettle

I had written some custom code using java . I want to add the code to the User defined java class in Kettle in the code snippets section. Is there a way to add the custom code snippets in the Classes and code fragment in UDJC so that it can be reusable.
Thanks.

For the moment there is no ability to add code snippets using ui at runtime. You can submit issue with pentaho jira if you want this functionality. Or just as workaround you can edit codeSnippits.xml (situated under lib/kettle-ui-*.jar/org/pentaho/di/ui/trans/steps/userdefinedjavaclass/) and re-zip this file back to the jar.

I would not recommend going down this path.
The reason is very simple, UDJC in PDI is Janino, a rather minified (but super fast) Java compiler, and I quote the Pentaho wiki for User Defined Java Class:
Not 100% Java... The first thing to know is that Janino and as a
consequence this step doesn't need the complete Java class... the
most apparent limitation is the absence of generics
What happened if we'd been able to add code snippets on the fly? Probably not good things.
However, and this is very useful, consider wrapping your code in a JAR package as suggested in the comments, include it in the lib-ext folder of your PDI environment and import it to User Defined Java Classes at will. IMHO, this is the right way.
I hope this helps a bit.

Related

Does AspectJ support modifying the JDK bytecode?

I want to intercept ClassLoader's loadClass method. In order to show the process of loading class by ClassLoader. But I don't know the working principle of aspectj. It can modify the source code of the JDK?
You could just use a debugger and step through the process in order to understand it.
AspectJ can weave aspects into existing class files during compilation (CTW, compile-time weaving) or during class-loading (LTW, load-time weaving).
LTW does not work for JDK classes because those classes are always loaded before the weaving agent. So you have a bootstrapping problem there.
What you can do, however, is to apply CTW to the class files in e.g. rt.jar from your JRE/JDK distribution, zip the woven class files into another JAR and replace the original one with it. Then if you start the JVM with aspectjrt.jar on the boot classpath, you see the aspects in action. I have done that before and it works. But really, this is not what AspectJ was designed for. But you asked, so I told you. It is a very advanced topic though, and I doubt that it is the road you should take as a complete AspectJ greenhorn - no offense meant.
Update: Because I have been asked this question so often, I created a little demo project showing how to weave aspects into the JRE/JDK. I still do not think it makes sense to use it under normal circumstances, but what the heck: Why do people climb the Mount Everest? Because it exists. ;-)

Sharing only the templates without giving access to source code

I'd like to share the templates of the website I've done with a graphist. My problem is that I dont want him to access the Python code at all.
It's easy to share a folder and give access to it through sftp.
I was wondering if it were possible given a right tag, to access my Python code. I know for example that with Php/Smarty or with Php/Twig, you can execute Php code, which means you can read whatever you want, including all the source files (I've done it to test). So sharing Php templates files and thinking "my source code is safe" is a mistake.
I'm a beginner with Django, and I'm wondering if there's a way to access the source files through Django template system / or not?
Django's template system is specifically written with this use case in mind; the original developers, at the Lawrence Journal-World newspaper in Kansas, wanted to be able to give the templates to designers to produce, while working on the Python code themselves.
There is no way to access arbitrary Python code from a Django template.

How to use Google Blink/Webkit to render HTML code

Sorry if the title somewhat ambiguous.
I'm buliding an app that recieve an URL then return the final HTML code (and save it for caching), after Ajax and other js feature executed (something like Phantomjs).
My language can call C++ code, so I think it would be nice if I can buid and use Blink/Webkit libary directly.
The issue is both Blink/Webkit document is too big.
UPDATE 1: Which API (Blink has many APIlayer) or a particular class I need to look at?
Do you know any example or tutorial I should look at?
Or any alternative simpler libary?
Thanks
Finally Chromium project have headless API in development with very good example which can be build using ninja, more information in their project at https://chromium.googlesource.com/chromium/src/+/master/headless/
A video from BlinkOn https://www.youtube.com/watch?v=GivjumRiZ8c&t=838s

Module overriding in Joomla 1.6

I am new to Joomla, started learning it just a day ago and didn't manage to find an answer to my question in the docs (which suck real bad compared to Drupal).
So what I want to do is override the whole module in a template. The documentation only suggests I can override the markup of a module by placing corresponding files in the html folder, but I have to make some corrections to the actual logic. Is copying the module, changing and then installing it as a separate entity the only way to go? I mean it makes sense that "template" folder is for "views" but with the kind of application I have to develop it is gonna be annoying...
Yeah, you can only override views.
If you want to override logic, you have 2 options:
Change the actual logic in-place, which leads to problems on updating etc
Duplicate the module and change the logic, as you suggested
One other way to consider is to replicate or fix the logic in the template. While this is not a very slick way of doing it, it is faster, especially than duplicating a whole component.
Note that you can also add your own libraries to the Joomla libraries folder to centralize your own code.
Further, if you manage your code with (for example) svn, you should not have any problems on upgrades with creating new views that may include their own logic.

CodeIgniter template problem

Hello all CodeIgniter guys :), I'm new to CodeIgniter andIi have now put my project on github. Here is my github page: https://github.com/SimonJ/Hip-hop-project
So I would hear about someone bothered to look through my files and make comments about what I can do better so I can learn something new :)
I have tried to use ocular template system but I get this error:
An Error Was Encounter Unable to load the Requested Class: ocular
Do you know what I'm doing wrong?
This question borders on the edge of belonging on Code Review instead of Stack Overflow, but I'll help you with your templating issue.
Are you running PHP 5 on your server? It looks like Ocular is using "public" and "private" words for functions and variables.
You are running an older version of Codeigniter by the looks of it because I don't see a folder called "core" in your application folder. There's a community version of CI called Reactor here or you can get the standard CI 2.0 from EllisLab here. I would upgrade to one of those, personally I would use Reactor.
Ocular is great but Phil Sturgeon has a lighter template library simply called template you might be interested in looking at as well, here. Like I said in the first paragraph of this answer, go to Code Review if you would like to have your code critiqued and reviewed.
PS. Welcome to Codeigniter, it's an awesome PHP framework.