Skip to content

Instantly share code, notes, and snippets.

View nbhusare's full-sized avatar
🏠
Working from home

Neeraj Bhusare nbhusare

🏠
Working from home
View GitHub Profile
@nbhusare
nbhusare / HelloWorld_Flink.java
Last active July 7, 2021 08:13
Hello World Flink program
@nbhusare
nbhusare / DefinitionGenerator.java
Created May 19, 2021 07:32
Calling multiple Code Generators
class DefinitionGenerator extends JvmModelGenerator {
override protected _internalDoGenerate(EObject obj, IFileSystemAccess fsa) {
generateSchema(obj as Definition, fsa)
generateDotNetCore(obj as Definition, fsa)
}
def void generateSchema(Definition definition, IFileSystemAccess fsa) {
fsa.generateFile(
definition.name + ".sql", //
@nbhusare
nbhusare / Eclipse startup troubleshooting tip
Created April 27, 2021 17:34
Why are my uninstalled bundles being reloaded!?
https://wiki.eclipse.org/Equinox/p2/FAQ#Why_are_my_uninstalled_bundles_being_reloaded.21.3F
@nbhusare
nbhusare / Xbase-repeat-syntax
Created April 26, 2021 15:09
XBase - Adding the support for 'repeat X times Y' syntax
@Override
XPrimaryExpression returns xbase::XExpression:
super |
XRepeatExpression;
XRepeatExpression returns xbase::XExpression:
{XRepeatExpression} 'repeat' numTimes=INT 'times' expression=XExpression;
------------------------------------------------------------------------
@nbhusare
nbhusare / ExtractDocFromModel
Created April 22, 2021 06:21
Extracting the document information from your model
https://github.com/eclipse/xtext-core/blob/master/org.eclipse.xtext/src/org/eclipse/xtext/documentation/impl/MultiLineCommentDocumentationProvider.java
@nbhusare
nbhusare / PSQL_Out_Of_Memory
Created March 31, 2021 15:37
Postgresql: Out of memory while running a script
ERROR: out of shared memory
HINT: You might need to increase max_locks_per_transaction.
# Solution
1. Open /data/postgresql.conf
2. set max_locks_per_transaction = 1024
3. Save and Restart postgresql.
# Restarting Postgresql
1. Winkey + R
@nbhusare
nbhusare / Example Xtext DSL's
Created March 28, 2021 12:33
Example Xtext DSL's
eLang - https://github.com/vorburger/eLang
ptolemy - https://github.com/hallvard/ptolemy
raas4emf - https://github.com/patins1/raas4emf
sm - https://github.com/djnemeth/sm
kortargyalo-MDSD-2016 - https://github.com/ftsrg-mdsd/kortargyalo-MDSD-2016/tree/ee27d3e56095b4e253be869dd166366a2eb4d50f
emfacade - https://github.com/hallvard/emfacade
xklaim - https://github.com/LorenzoBettini/xklaim
@nbhusare
nbhusare / Git-list-all-files-in-a-commit.txt
Created December 11, 2020 08:56
List all the files in a commit
How to - list all the files in a commit?
https://stackoverflow.com/questions/424071/how-to-list-all-the-files-in-a-commit
@nbhusare
nbhusare / Import_Dec_anti_pattern
Last active October 10, 2020 07:15
Import declaration anti pattern
RPackage:
'pkg' name=QualifedName
importDec=ImportDeclaration?;
ImportDec:
'imports' '{'imports+=Import*'}';
Import:
importedNamespace=QNWildcard;
Problems with the above grammar: 1) You have to overwrite `ImportedNamespaceAwareLocalScopeProvider#internalGetImportedNamespaceResolvers()`, and in that you have to write special handling code to deal with the `ImportDec` (PS code below), 2) In real world projects, you'll see 1000's of models files created, which means equal number of `ImportDec` are created in the memory. It increases the memory requirement, and also increases the work of the garbage collector.
@nbhusare
nbhusare / FindFieldReference.java
Created October 8, 2020 10:06
Finding References of a given field in the workspace
List<QuerySpecification> queries = new ArrayList<>();
ICompilationUnit compilationUnit = (ICompilationUnit) ((IStructuredSelection) currentSelection).getFirstElement();
for (IJavaElement javaElement : compilationUnit.getChildren()) {
if (javaElement instanceof SourceType) {
IField[] fields = ((SourceType) javaElement).getFields();
for (IJavaElement field : fields) {
queries.add(createQuery(field));
}
}