code-generation

Why Haven't GWT- and Script#-style Frameworks Become Dominant?

半世苍凉 提交于 2019-12-04 03:57:36
With GWT, we can write code in Java and have it translated to JavaScript code. With Script#, we can write code in C# and have it translated to JavaScript code. It sounds GWT and Script# will save web developers from suffering javascript pains. Then, why these tools haven't been dominant? Why still people dedicated to write javascript code? Multiple reasons, and which one is most important differs from developer to deverloper. Here are two: Because JavaScript is a more nice/flexible/powerful/(insert adjective of choice here) language than Java/C# People don't trust the output generated by GWT

Automatic Code Generation for Strings.xml from Eclipse

心不动则不痛 提交于 2019-12-04 03:40:13
I find it a waste of time that every time I need to enter a string that I have to go edit the strings.xml file manually. What I'd like to be able to do ideally is have Eclipse pop up a dialog box that lets me specify the name of the resource and the value for it. Then Eclipse would generate the code in strings.xml and paste the correct reference to the string at the cursor position. Does such a facility exist? Select a String, click Refactor --> Android --> Extract Android String . 来源: https://stackoverflow.com/questions/3631661/automatic-code-generation-for-strings-xml-from-eclipse

How do I generate the source code to create an object I'm debugging?

你离开我真会死。 提交于 2019-12-04 03:36:07
Typical scenario for me: The legacy code I work on has a bug that only a client in production is having I attach a debugger and figure out how to reproduce the issue on their system given their input. But, I don't know why the error is happening yet. Now I want to write an automated test on my local system to try and reproduce then fix the bug That last step is really hard. The input can be very complex and have a lot of data to it. Creating the input by hand (eg: P p = new P(); p.setX("x"); p.setY("x"); imagine doing this 1000 times to create the object) is very tedious and error prone. In

How to run annotation processor in eclipse on save

吃可爱长大的小学妹 提交于 2019-12-04 03:27:48
Currently I generate files with an annotation processor in eclipse for a project by Right click on project > Run As > Maven Clean Right click on project > Run As > Maven install This is quite time consuming. How do I set up eclipse to make it run the annotation processor on save? I have the "Build Automatically" feature set but it seems to ignore the annotation processors. BTW I am using m2e apt plugin with "Automatically configure JDT APT activated". I have annotation processing working in Eclipse for some of my projects; for me, it IS working on save, and I don't have to mvn install (and it

Share Constants Between PHP and JavaScript [duplicate]

谁都会走 提交于 2019-12-04 01:09:47
This question already has answers here : Closed 7 years ago . Possible Duplicate: Pass a PHP string to a Javascript variable (and escape newlines) I have several constants in a PHP application I'm developing. I've defined a Constants class and the defined the constants as const VAR_NAME = value; in this class. I would like to share these constants between my JavaScript and PHP code. Is there a DRY (Don't Repeat Yourself) mechanism to share them? class Constants { const RESOURCE_TYPE_REGSITER = 2; const RESOURCE_TYPE_INFO = 1; } Adam Peck I would use json_encode . You will have to convert the

Library to parse and check Haskell code?

微笑、不失礼 提交于 2019-12-04 00:08:39
Is there any library in hackage that can parse haskell code and check if it is valid code or not? I'm willing to play a bit with an evolutionary model and I want to check if produced strings of code will compile without having to write them to the disk and run the compiler. Ideally it would be nice to be able to run the code in the strings too, but only checking the validity of the code is ok. If you know about parser libraries (in haskell) that check for other languages (lisp, C,...)it would be nice too. For parsing Haskell code, you can use either haskell-src or haskell-src-exts The latter

XSD to Delphi Classes without XML binding

本秂侑毒 提交于 2019-12-04 00:01:56
Perhaps this has been asked before, but I haven't found it with regards to Delphi - I have used a XSD.exe in Visual Studio that does exactly this: converts XSD into 'plain vanilla' classes representing the entities specified in the XSD - not bound to XML document - classes for creating the structures in the XSD, not accessing data that conforms to the structure outlined in the XSD. I am looking for a utility or product that will do this (that doesn't cost big bucks...) : Example, I have a schema like this: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001

How can i get enum to contain a dash (-)?

时光总嘲笑我的痴心妄想 提交于 2019-12-03 22:32:18
I'm generating business objects from this schema using Enterprise Architect. The schema has the following enumeration specification: <xs:simpleType name="PackageMedium"> <xs:restriction base="xs:string"> <xs:enumeration value="NTP"/> <xs:enumeration value="DAT"/> <xs:enumeration value="Exabyte"/> <xs:enumeration value="CD-ROM"/> <xs:enumeration value="DLT"/> <xs:enumeration value="D1"/> <xs:enumeration value="DVD"/> <xs:enumeration value="BD"/> <xs:enumeration value="LTO"/> <xs:enumeration value="LTO2"/> <xs:enumeration value="LTO4"/> </xs:restriction> </xs:simpleType> Enterprise architect

how to generate a Custom Class via t4?

≯℡__Kan透↙ 提交于 2019-12-03 21:56:54
I am trying to generate the below code via T4. using System; using MyDAL; namspace Test { // Select... public partial class MyCustomer { public int id { get ;set;} public string name { get ;set;} public string surname { get ;set;} public MyCustomer() { } public List<Customer> GetById(int id) { // do something... } } // Delete,Update,Save public partial class MyCustomer { public bool Save(new MyCustomer) { // do something... } public bool delete(int id) { // do something... } public bool Update(int id) { // do something... } } } The T4 template I have so far: <#@ template language="C#"#> <#@

Eclipse auto-generation of serialVersionUID with each change

别来无恙 提交于 2019-12-03 20:41:13
问题 Eclipse nicely generates the serialVersionUID for me. But this seems to be passive code generation as the id won't be automatically updated as I change the file unless I do the generation again. Is there some way to have the serialVersionUID being generated every time I change the contents? The "Save Actions" don't seem to include such an option - has somebody found some way to do this? It would be nice that it could be combined with the IDE save actions or something similar so that I could