dynamic

ImageMagick best fit text within rectangle?

会有一股神秘感。 提交于 2019-12-21 18:30:15
问题 I have an image like this, with a rectangle at specific coordinates: (for illustratory purposes I put the coordinates of the rectangle and its size and center in there) Now I want to render some text with ImageMagick, so that it fits exactly within the rectangle . If it's a very short (narrow) string, the rectangle's height will be the limiting factor: On the other hand with a long (wide) string, the rectangle's width will determine the size: In either case, independent of how short or long

What is the most efficient way to dynamically create class instances?

你离开我真会死。 提交于 2019-12-21 17:54:13
问题 I don't know how many class instances I will have from the get-go, so I need to create them dynamically, but I would also like to keep the code tidy and readable. I was thinking of doing something like this: names = ['Jon','Bob','Mary'] class Person(): def __init__(self, name): self.name = name people = {} for name in names: people[name] = Person(name) It works, but I can't seem to find any examples of people doing this online (though I didn't look much). Is there any reason I should avoid

SQL Server pivots? some way to set column names to values within a row

爱⌒轻易说出口 提交于 2019-12-21 17:52:38
问题 I am building a system of multiple trackers that are going to use a lot of the same columns so there is a table for the trackers, the tracker columns, then a cross reference for which columns go with which tracker, when a user inserts a tracker row the different column values are stored in multiple rows that share the same record id and store both the value and the name of the particular column. I need to find a way to dynamically change the column name of the value to be the column name that

Using LINQ to SQL with Dynamic tables

半腔热情 提交于 2019-12-21 17:42:46
问题 I am trying to migrate an old project to using LINQ but I have run into a pretty major problem. The problem is we have dynamic tables for search indexing (CM-system with dynamic attributes). The search index has columns for each searchable attribute { attribute_x, attribute_y, ... }. Now the problem is I cannot statically define which columns are available (or even which table to use as we divide search indexes), so I need a way to do this on the fly. I have tried using Dynamic Expressions,

How to create a dynamic page title using PHP

若如初见. 提交于 2019-12-21 17:38:06
问题 Hi I was wondering if anyone can help with this PHP problem. Is it possible to use the text in a H2 tag and use that to populate the page title dynamically. I'd also like to be able to use this same technique to add the H2 text into the meta description - Can anyone help? 回答1: That sounds like something that jQuery would excel at: <script type='text/javascript' src='jquery-1.4-min.js'></script> <script type="text/javascript"> $(document).ready(function() { document.title = $('h2:first').text(

Cant get the values from dynamically added check box

那年仲夏 提交于 2019-12-21 17:29:03
问题 While click the button i have added a checkbox, finally need to get the all checked checkbox value by means of clicking submit button, This is my code mIncrementButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.setMargins(20, 0, 0, 0); CheckBox checkbox = new CheckBox(MainActivity.this);

Dynamic MySQL partitioning based on UnixTime

微笑、不失礼 提交于 2019-12-21 17:00:11
问题 My DB design includes multiple MYISAM tables with measurements collected online, Each row record contains auto-incremented id, some data and an integer representing unixtime. I am designing an aging mechanism, and i am interested to use MySQL partitioning to partition each such table based on unixtime dynamically. Say that i am interested that each partition will represent single month of data, last partition should represent 2 months, if records arrive for the next not represented month, the

Is there an alternative way to free dynamically allocated memory in C - not using the free() function?

走远了吗. 提交于 2019-12-21 16:54:50
问题 I am studying for a test, and I was wondering if any of these are equivalent to free(ptr): malloc(NULL); calloc(ptr); realloc(NULL, ptr); calloc(ptr, 0); realloc(ptr, 0); From what I understand, none of these will work because the free() function actually tells C that the memory after ptr is available again for it to use. Sorry that this is kind of a noob question, but help would be appreciated. 回答1: Actually, the last of those is equivalent to a call to free() . Read the specification of

Dynamically populate a field based on dropdown selection (Javascript / HTML)

断了今生、忘了曾经 提交于 2019-12-21 16:49:45
问题 I am looking for some help in coding my companies website. We are trying to create a custom "part number generator" based on selections made from a dropdown box. Our goal is that when a user picks an option in the dropdown box that it dynamically fills in a box underneath, eventually creating a part number. The attached screenshot is a good visual representation of the design and where we want the output boxes. We are looking to do it in JavaScript and HTML. The code we are using currently to

Eclipse: Have multiple Dynamic web projects contribute to a single war file?

强颜欢笑 提交于 2019-12-21 12:55:39
问题 I am in a situation where I basically want to be able to have a web project in Eclipse where the WebContents folder is merged from multiple projects instead of only a single dynamic web project. If I have "a.jsp" in project A, and "b.jsp" in project B, I would like to end up with a single web application in the web container where "a.jsp" and "b.jsp" sit next to each other in the same folder. It would be perfect if all files, not just the jsp-files, could be merged like this. This is to be