auto-generate

Auto-generate LESS styles for sprite icons

ぃ、小莉子 提交于 2019-12-21 23:55:34
问题 I have icon sprites image with each icon in a 20 by 20 pixel area. Each icon has several variants (black, colour, white small etc.). And have a significant amount of them. Instead of writing styles for each individual icon I'd rather just provide their names in my LESS file and let the processor generate styles for them. This is what I came up with but it doesn't seem to work. @icons: upvote,downvote,comment,new,notify,search,popup,eye,cross; @array: ~`(function(i){ return (i + "").replace(/[

Python: How to solve the issue : 'badly formed hexadecimal UUID string' in Django

旧街凉风 提交于 2019-12-20 03:38:10
问题 I have created 'post' model in which I included 'post_id' as the primary key field. When I am trying to create a post, it is raising an error: 'badly formed hexadecimal UUID string'. I would appreciate helping me in solve this. Here's my code. Models.py: class Post(models.Model): post_id = models.UUIDField(primary_key=True, default='uuid.uuid4', editable=False) user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1) from1 = models.CharField(max_length=20) To = models.CharField(max

What is the best way to add attributes to auto-generated entities (using VS2010 and EF4)

删除回忆录丶 提交于 2019-12-20 01:59:13
问题 ASP.NET MVC2 has strong support for using attributes on entities (validation, and extending Html helper class and more). If I generated my Model from the Database using VS2010 EF4 Entity Data Model (edmx and it's cs class), And I want to add attributes on some of the entities. what would be the best practice ? how should I cope with updating the model (adding more fields / tables to the database and merging them into the edmx) - will it keep my attributes or generate a new cs file erasing

XML class generator for serialization

浪子不回头ぞ 提交于 2019-12-18 09:09:16
问题 Is there an easy way to construct class from a XML. The constructed class will be used to serialize and deserialize XML. I have an XML with lots of properties and elements defined. Do I need to manually create my class based on that XML? Or Is there a utility tool available to generate class from XML Thanks, Esen 回答1: Further on Willem's post: This will generate the XSD ( not dataset ) xsd.exe myCustom.xml This generates the C# class: xsd.exe myCustom.xsd /c 回答2: There's a round about way:

GNU make: Generating automatic dependencies with generated header files

三世轮回 提交于 2019-12-17 15:53:07
问题 So I followed the Advanced Auto-Dependency Generation paper -- Makefile : SRCS := main.c foo.c main: main.o foo.o %.o: %.c $(CC) -MMD -MG -MT '$@ $*.d' -c $< -o $@ cp $*.d $*.tmp sed -e 's;#.*;;' -e 's;^[^:]*: *;;' -e 's; *\\$$;;' \ -e '/^$$/d' -e 's;$$; :;' < $*.tmp >> $*.d rm $*.tmp clean:: -rm *.o *.d main -include $(SRCS:.c=.d) main.c : #include "foo.h" int main(int argc, char** argv) { foo() ; return 0 ; } foo.h : #ifndef __FOO_H__ #define __FOO_H__ void foo() ; #endif -- and it works

Getting auto-generated key from row insertion in spring 3 / PostgreSQL 8.4.9

折月煮酒 提交于 2019-12-17 15:39:10
问题 I would like to retrieve the auto-generated id from a row insertion, but I get a NullPointerException Here is the code : long result = 0; final String SQL = "INSERT INTO compte (prenom, nom, datenaissance, numtelephone) " + " VALUES(?,?,?,?)"; KeyHolder keyHolder = new GeneratedKeyHolder(); int row= this.jdbcTemplate.update(new PreparedStatementCreator(){ public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { PreparedStatement ps =connection

Inheriting from a UserControl abstract subclass

寵の児 提交于 2019-12-14 00:33:57
问题 I have a set of UserControls that need to have a few similar properties. Thus I have defined an abstract subclass of UserControl that defines these properties and updated the .xaml.cs and .g.cs files to inherit from this base class. All compiles well and runs well. Great! But.... .g.cs files are generated and will be regenerated, so how do I tell Blend or Visual Studio to keep inheriting from my base class rather than UserControl? 回答1: You need to change the XAML a bit to prefix the

An in code class auto generator from a string of text or some other mechanism

允我心安 提交于 2019-12-13 23:11:13
问题 I would like to be able to automatically generate a class in code if possible. I know that I can have a text or script file that can be opened and the contents of that file be loaded into either a vector of strings or a string stream, and from there write back to a file or set of files to generate a class. I'm not interested in the details of the parsing aspect and this is not what I'm actually after. Let's say I have a text file that looks something like this: My current pseudo file above is

Generate random alphanumeric string into password field

笑着哭i 提交于 2019-12-13 09:35:17
问题 I want to generate a random alphanumeric string into password field when click a button. <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox> code behind the button var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var stringChars = new char[8]; var random = new Random(); for (int i = 0; i < stringChars.Length; i++) { stringChars[i] = chars[random.Next(chars.Length)]; } var finalString = new String(stringChars); txtPassword.Text =

Netbeans generated code settings

前提是你 提交于 2019-12-13 02:46:32
问题 I was wondering where can I change the way Netbeans generates code. For example, I want the opening bracket to be on a new line. I've been looking in the [Tools] -> [Options] menu but I didn't find anything. 回答1: Solution 1 should solve your problem. For any auto-generated code formatting that Solution 1 won't solve, use Solution 2 . Beware the "Code Templates" tab though, it has been relatively buggy for me in the past. Important Note: Attempting to modify the "Code Templates" for the