Search Results

Search found 11632 results on 466 pages for 'field'.

Page 5/466 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to limit choice field options based on another choice field in django admin

    - by umnik700
    I have the following models: class Category(models.Model): name = models.CharField(max_length=40) class Item(models.Model): name = models.CharField(max_length=40) category = models.ForeignKey(Category) class Demo(models.Model): name = models.CharField(max_length=40) category = models.ForeignKey(Category) item = models.ForeignKey(Item) In the admin interface when creating a new Demo, after user picks category from the dropdown, I would like to limit the number of choices in the "items" drop-down. If user selects another category then the item choices should update accordingly. I would like to limit item choices right on the client, before it even hits the form validation on the server. This is for usability, because the list of items could be 1000+ being able to narrow it down by category would help to make it more manageable. Is there a "django-way" of doing it or is custom JavaScript the only option here?

    Read the article

  • Adding a calculated field to a Query at run time.

    - by JamesB
    I'm getting data using a query in Delphi, and would like to add a calculated field to the query before it runs. The calculated field is using values in code as well as the query so I can't just calculate it in SQL. I know I can attach an OnCalcFields Event to actually make the calculation, but the problem is after adding the calculated field there are no other fields in the query... I did some digging and found that all of the field defs are created but the actual fields are only created if DefaultFields then CreateFields Default Fields is specified procedure TDataSet.DoInternalOpen; begin FDefaultFields := FieldCount = 0; ... end; Which would indicate that if you add fields you only get the fields you added. I would like all the fields in the query AS WELL AS the ones I Add. Is this possible or do I have to add all the fields I'm using as well?

    Read the article

  • How to create and remove an html hidden field using jquery?

    - by ChickenBoy
    I am new to javascript and jquery so please bear with me. First of all here is my code so that you can test it to see whats wrong: http://jsfiddle.net/Lzw4e/1/ I want to create a new hidden field every time the user selects from the left <select> element and remove / destroy the hidden field when the user clicks the right <select> element. I used the jquery command $("<input type='hidden' value=selectedAddFootballPlayerId>"); but when I checked of firebug I can't see any hidden field being created. For removal of the hidden field I really don't know. Please help me. Thanks in advance.

    Read the article

  • How to access the backing field of a base class using fluent nhibernate?

    - by Akk
    How do i set the Access Strategy in the mapping class to point to the base _photos field? public class Content { private IList<Photo> _photos; public Content() { _photos = new List<Photo>(); } public virtual IEnumerable<Photo> Photos { get { return _photos; } } public virtual void AddPhoto() {...} } public class Article : Content { public string Body {get; set;} } I am currently using the following to try and locate the backing field but an exception is thrown as it cannot be found. public class ArticleMap : ClassMap<Article> { HasManyToMany(x => x.Photos) .Access.CamelCaseField(Prefix.Underscore) //_photos //... } i tried moving the backing field _photos directly into the class and the access works. So how can i access the backing field of the base class?

    Read the article

  • Calculate value from two field in third field

    - by terence6
    I'm trying to create a query, that will calculate sum of products on invoice. I have 3 tables : Product (with product's price) Invoice (with invoice id) Products on invoice (with invoice id, product id and number of particular products) So in my query I take invoice_id (from invoice), price (from product),number of products sold and invoice_id (from products on invoice) and calculate their product in fourth column. I know I sohuld use 'Totals' but how to achieve that ? Model:

    Read the article

  • Query - Trying to SUM one field based on content of another field

    - by ShaneL
    Table: DayOfWeek Enrollments Monday 35 Monday 12 Saturday 25 Tuesday 15 Monday 9 Tuesday 15 Basically I'm trying to sum the total enrolments for each day. so the Output will look like: DayOfWeek Enrollments Monday 56 Saturday 25 Tuesday 30 I've spent around 4 hours trying to work this out trying many many different ways but no luck. The problem I'm having is i can count how many enrollments for each day but can't have it aligned with the correct day when i run the query e.g. I want The total to be on the same line as the day it was calculated from. (I hope that is clear enough)

    Read the article

  • Connecting Id field with name field

    - by sts
    Hi, Am having a table with quetion_id , nominees and vote_count. In which the values for question_id and nominees are prepopulated from other tables with vote_count as zero. If the users select some nominees the vote count should be incresed by one. The problem is How to connect the question_id and nominees like for this question_id this nominee is selected . can some one give example for this situation..

    Read the article

  • Solr return whether member is in multivalued field

    - by ??iu
    Is there any way to return in the fields list whether a value exists as one of the values of a multivalued field? E.g., if your schema is <schema> ... <field name="user_name" type="text" indexed="true" stored="true" required="true" /> <field name="follower" type="integer" indexed="true" stored="true" multiValued="true" /> ... </schema> A sample document might look like: <doc> <field name="user_name">tester blah</field> <field name="follower">1</field> <field name="follower">62</field> <field name="follower">63</field> <field name="follower">64</field> </doc> I would like to be able to query for, say, "tester" and follower:62 and have it match "tester blah" and have some indication of whether 62 is a follower or not in the results.

    Read the article

  • Creating Descriptive Flex Field (DFF) Bean in OAF

    - by Manoj Madhusoodanan
    In this blog I will explain how to add a custom DFF in a custom OAF page.I am using XXCUST_DFF_DEMO table to store the DFF values.Also I am using custom DFF named XXCUST_PERSON_DFF.  Following steps needs to be performed to create this solution. 1) Register the custom table in Oracle Application2) Register the DFF3) Define the segments of DFF4) Create BC4J components for OAF and OA Page which holds the DFF I will explain the steps in detail below. Register the custom table in Oracle Application I am using custom DFF here so I have to register the custom table which I am going to capture the values.Please click here to see the table script. I am using the AD_DD package to register the custom table.Please click here to see the table registration script. Please verify the table has registered successfully. Navigation: Application Developer > Application > Database > Table Table has registered successfully. Register the DFF Next step is to register the DFF. Navigate to Application Developer > Flex Field > Descriptive > Register. Give details as below. Click on Reference Fields and set the Reference Field as ATTRIBUTE_CATEGORY. Click on the Columns button to verify that the columns ATTRIBUTE_CATEGORY,ATTRIBUTE1 .... ATTRIBUTE30 are enabled. DFF has registered successfully. Define the segments of DFF Here I am going to define the segments of the DFF.Navigate to Application Developer > Flex Field > Descriptive > Segments.Query for "XXCUST - Person DFF". Uncheck "Freeze Flexfield Definition". In my DFF the reference field I want to display a value set which has values "Permanent" and "Contractor". So define a value set  XXCUST_EMPLOYMENT_TYPE. Navigation: Application Developer > Flex Field > Descriptive > Validation > Sets After that assign the values to above created value sets. Navigation: Application Developer > Flex Field > Descriptive > Validation > Values Assign XXCUST_EMPLOYMENT_TYPE to Context Field Valueset. Setup the Context Field Values based on below table. Context Code Segments Global Data Elements Phone Number Email Fax Contractor Manager Extension Number CSP Name Permanent Extension Number Access Card Number Phone Number,Email and Fax displays always.When user choose Context Value as "Contractor" Manager Extension Number and CSP Name will show.In case of "Permanent" Extension Number and Access Card Number will show.  Assign value set also as follows. For Global Data Elements following are the segments. For "Contractor" following are the segments. For "Permanent" following are the segments. Check the "Freeze Flexfield Definition" check box and save.Standard concurrent program "Flexfield View Generator" will generate XXCUST_DFF_DEMO_DFV view which we mentioned in the DFF registration step.  Now the DFF has created successfully and ready to use. Create BC4J components for OAF and OA Page which holds the DFF Create the BC4J components ( EO,VO and AM) appropriately.Create the page based on the created VO.For DFF create an item of type "flex" with following property.  Note: You cannot create a flex item directly under a messageComponentLayout region, but you can create a messageLayout region under the messageComponentLayout region and add the flex item under the messageLayout region. In the Segment List property give the segment names which you want to display.The syntax of this is Global Data Elements|SEGMENT 1|...|SEGMENT N||[Context Code1]|SEGMENT 1|...|SEGMENT N||[Context Code2]|SEGMENT 1|...|SEGMENT N||... Eg: Global Data Elements|Phone Number|Email|Fax||Contractor|Manager Extension Number|CSP Name||Permanent|Extension Number|Access Card Number When you change the Context Value corresponding segments will display automatically by PPR in the page. You can attach partial action to the DFF bean programmatically so that you can identify the action related to DFF. pageContext.getParameter(EVENT_PARAM) will return "FLEX_CONTEXT_CHANGEDPersonDFF" when you change the DFF Context. Page is ready and you can test. When you choose "Contract" following output you can see. When you choose "Permanent" following output you can see.  Give proper values and press Apply.You can see values populated in the table.

    Read the article

  • Content Query Web Part and the Yes/No Field

    - by Bil Simser
    The Content Query Web Part (CQWP) is a pretty powerful beast. It allows you to do multiple site queries and aggregate the results. This is great for rolling up content and doing some summary type reporting. Here’s a trick to remember about Yes/No fields and using the CQWP. If you’re building a news style site and want to aggregate say all the announcements that people tag a certain way, up onto the home page this might be a solution. First we need to allow a way for users of all our sites to mark an announcement for inclusion on our Intranet Home Page. We’ll do this by just modifying the Announcement Content type and adding a Yes/No field to it. There are alternate ways of doing this like building a new Announcement type or stapling a feature to all sites to add our column but this is pretty low impact and only affects our current site collection so let’s go with it for now, okay? You can berate me in the comments about the proper way I should have done this part. Go to the Site Settings for the Site Collection and click on Site Content Types under the Galleries. This takes you to the gallery for this site and all subsites. Scroll down until you see the List Content Types and click on Announcements. Now we’re modifying the Announcement content type which affects all those announcement lists that are created by default if you’re building sites using the Team Site template (or creating a new Announcements list on any site for that matter). Click on Add from new site column under the Column list. This will allow us to create a new Yes/No field that users will see in Announcement items. This field will allow the user to flag the announcement for inclusion on the home page. Feel free to modify the fields as you see fit for your environment, this is just an example. Now that we’ve added the column to our Announcements Content type we can go into any site that has an announcement list, modify that announcement and flag it to be included on our home page. See the new Featured column? That was the result of modifying our Announcements Content Type on this site collection. Now we can move onto the dirty part, displaying it in a CQWP on the home page. And here is where the fun begins (and the head scratching should end). On our home page we want to drop a Content Query Web Part and aggregate any Announcement that’s been flagged as Featured by the users (we could also add the filter to handle Expires so we don’t show old content so go ahead and do that if you want). First add a CQWP to the page then modify the settings for the web part. In the first section, Query, we want the List Type to be set to Announcements and the Content type to be Announcement so set your options like this: Click Apply and you’ll see the results display all Announcements from any site in the site collection. I have five team sites created each with a unique announcement added to them. Now comes the filtering. We don’t want to include every announcement, only ones users flag using that Featured column we added. At first blush you might scroll down to the Additional Filters part of the Query options and set the Featured column to be equal to Yes: This seems correct doesn’t it? After all, the column is a Yes/No column and looking at an announcement in the site, it displays the field as Yes or No: However after applying the filter you get this result: (I have the announcements from Team Site 1 and Team Site 4 flagged as Featured) Huh? It’s BACKWARDS! Let’s confirm that. Go back in and change the Additional Filters section from Yes to No and hit Apply and you get this: Wait a minute? Shouldn’t I see Team Site 1 and 4 if the logic is backwards? Why am I seeing the same thing as before. What gives… For whatever reason, unknown to me, a Yes/No field (even though it displays as such) really uses 1 and 0 behind the scenes. Yeah, someone was stuck on using integer values for booleans when they wrote SharePoint (probably after a long night of white boarding ways to mess with developers heads) and came up with this. The solution is pretty simple but not very discoverable. Set the filter to include your flagged items like so: And it will filter the items marked as Featured correctly giving you this result: This kind of solution could also be extended and enhanced. Here are a few suggestions and ideas: Modify the ItemStyle.xsl file to add a new style for this aggregation which would include the first few paragraphs of the body (or perhaps add another field to the Content type called Excerpt or Summary and display that instead) Add an Image column to the Announcement Content type to include a Picture field and display it in the summary Add a Category choice field (Employee News, Current Events, Headlines, etc.) and add multiple CQWPs to the home page filtering each one on a different category I know some may find this topic old and dusty but I didn’t see a lot out there specifically on filtering the Yes/No fields and the whole 1/0 trick was a little wonky, so I figured a few pictures would help walk through overcoming yet another SharePoint weirdness. With a little work and some creative juices you can easily us the power of aggregation and the CQWP to build a news site from content on your team sites.

    Read the article

  • SharePoint: Numeric/Integer Site Column (Field) Types

    - by CharlesLee
    What field type should you use when creating number based site columns as part of a SharePoint feature? Windows SharePoint Services 3.0 provides you with an extensible and flexible method of developing and deploying Site Columns and Content Types (both of which are required for most SharePoint projects requiring list or library based data storage) via the feature framework (more on this in my next full article.) However there is an interesting behaviour when working with a column or field which is required to hold a number, which I thought I would blog about today. When creating Site Columns in the browser you get a nice rich UI in order to choose the properties of this field: However when you are recreating this as a feature defined in CAML (Collaborative Application Mark-up Language), which is a type of XML (more on this in my article) then you do not get such a rich experience.  You would need to add something like this to the element manifest defined in your feature: <Field SourceID="http://schemas.microsoft.com/sharepoint/3.0"        ID="{C272E927-3748-48db-8FC0-6C7B72A6D220}"        Group="My Site Columns"        Name="MyNumber"        DisplayName="My Number"        Type="Numeric"        Commas="FALSE"        Decimals="0"        Required="FALSE"        ReadOnly="FALSE"        Sealed="FALSE"        Hidden="FALSE" /> OK, its not as nice as the browser UI but I can deal with this. Hang on. Commas="FALSE" and yet for my number 1234 I get 1,234.  That is not what I wanted or expected.  What gives? The answer lies in the difference between a type of "Numeric" which is an implementation of the SPFieldNumber class and "Integer" which does not correspond to a given SPField class but rather represents a positive or negative integer.  The numeric type does not respect the settings of Commas or NegativeFormat (which defines how to display negative numbers.)  So we can set the Type to Integer and we are good to go.  Yes? Sadly no! You will notice at this point that if you deploy your site column into SharePoint something has gone wrong.  Your site column is not listed in the Site Column Gallery.  The deployment must have failed then?  But no, a quick look at the site columns via the API reveals that the column is there.  What new evil is this?  Unfortunately the base type for integer fields has this lovely attribute set on it: UserCreatable = FALSE So WSS 3.0 accordingly hides your field in the gallery as you cannot create fields of this type. However! You can use them in content types just like any other field (except not in the browser UI), and if you add them to the content type as part of your feature then they will show up in the UI as a field on that content type.  Most of the time you are not going to be too concerned that your site columns are not listed in the gallery as you will know that they are there and that they are still useable. So not as bad as you thought after all.  Just a little quirky.  But that is SharePoint for you.

    Read the article

  • Why distance field text rendering have clear outline?

    - by jinhwan
    http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf All the process for doing distance rendering is clear, but 'how does it work' is not clear for me. It looks like that distance field pixels which are created around original pixel may affect 2d texture sampling interpolation process. But I can't understand the interpolation process. I've read that the distance field rendering is processed under nearest-neighbour interpolation. If it is true, shouldn't the distance field redering creates non interpolated result? In my thought, they should looks liked retro style pixel art. Where do i misunderstand in this process? So far, It is no difference with alpha test for me. Both of them throw away all pixcel which are not in. How does extra distance field pixel affect rendering under nearest-neighbour interpolation?

    Read the article

  • Indexing on only part of a field in MongoDB

    - by Rob Hoare
    Is there a way to create an index on only part of a field in MongoDB, for example on the first 10 characters? I couldn't find it documented (or asked about on here). The MySQL equivalent would be CREATE INDEX part_of_name ON customer (name(10));. Reason: I have a collection with a single field that varies in length from a few characters up to over 1000 characters, average 50 characters. As there are a hundred million or so documents it's going to be hard to fit the full index in memory (testing with 8% of the data the index is already 400MB, according to stats). Indexing just the first part of the field would reduce the index size by about 75%. In most cases the search term is quite short, it's not a full-text search. A work-around would be to add a second field of 10 (lowercased) characters for each item, index that, then add logic to filter the results if the search term is over ten characters (and that extra field is probably needed anyway for case-insensitive searches, unless anybody has a better way). Seems like an ugly way to do it though. [added later] I tried adding the second field, containing the first 12 characters from the main field, lowercased. It wasn't a big success. Previously, the average object size was 50 bytes, but I forgot that includes the _id and other overheads, so my main field length (there was only one) averaged nearer to 30 bytes than 50. Then, the second field index contains the _id and other overheads. Net result (for my 8% sample) is the index on the main field is 415MB and on the 12 byte field is 330MB - only a 20% saving in space, not worthwhile. I could duplicate the entire field (to work around the case insensitive search problem) but realistically it looks like I should reconsider whether MongoDB is the right tool for the job (or just buy more memory and use twice as much disk space). [added even later] This is a typical document, with the source field, and the short lowercased field: { "_id" : ObjectId("505d0e89f56588f20f000041"), "q" : "Continental Airlines", "f" : "continental " } Indexes: db.test.ensureIndex({q:1}); db.test.ensureIndex({f:1}); The 'f" index, working on a shorter field, is 80% of the size of the "q" index. I didn't mean to imply I included the _id in the index, just that it needs to use that somewhere to show where the index will point to, so it's an overhead that probably helps explain why a shorter key makes so little difference. Access to the index will be essentially random, no part of it is more likely to be accessed than any other. Total index size for the full file will likely be 5GB, so it's not extreme for that one index. Adding some other fields for other search cases, and their associated indexes, and copies of data for lower case, does start to add up, which I why I started looking into a more concise index.

    Read the article

  • Repeating Group Messages in Quickfix C++

    - by Mark Jackson
    We cannot seem to process some group messages with QuickFix. I am trying to set up a connection with the ICE exchange using QuickFix (C++). I have created a custom data dictionary to handle ICE's non-standard messages. The first message to handle is a SecurityDefinition. The message contains about 13000 entries broken into blocks of 100. I attached the message below (the first two entries with CR/LF added for clarity). My question is in the data dictionary, I defined a group as part of the entry with all the fields they specify in the group. Yet the message is rejected before it gets to the cracker as having an invalid tag (tag = 305). Message 2 Rejected: Tag not defined for this message type:305 Does this dictionary entry look correct. Is there any documentation anywhere on how to handle group messages? Dictionary entry <message name='SecurityDefinition' msgcat='app' msgtype='d'> <field name='SecurityResponseID' required='Y' /> <field name='SecurityResponseType' required='Y' /> <field name='SecurityReqID' required='Y' /> <field name='TotNoRelatedSym' required='N' /> <field name='NoRpts' required='N' /> <field name='ListSeqNo' required='N' /> <group name='NoUnderlyings' required='N'> <field name='UnderlyingSymbol' required='N' /> <field name='UnderlyingSecurityID' required='N' /> <field name='UnderlyingSecurityIDSource' required='N' /> <field name='UnderlyingCFICode' required='N' /> <field name='UnderlyingSecurityDesc' required='N' /> <field name='UnderlyingMaturityDate' required='N' /> <field name='UnderlyingContractMultiplier' required='N' /> <field name='IncrementPrice' required='N' /> <field name='IncrementQty' required='N' /> <field name='LotSize' required='N' /> <field name='NumofCycles' required='N' /> <field name='LotSizeMultiplier' required='N' /> <field name='Clearable' required='N' /> <field name='StripId' required='N' /> <field name='StripType' required='N' /> <field name='StripName' required='N' /> <field name='HubId' required='N' /> <field name='HubName' required='N' /> <field name='HubAlias' required='N' /> <field name='UnderlyingUnitOfMeasure' required='N' /> <field name='PriceDenomination' required='N' /> <field name='PriceUnit' required='N' /> <field name='Granularity' required='N' /> <field name='NumOfDecimalPrice' required='N' /> <field name='NumOfDecimalQty' required='N' /> <field name='ProductId' required='N' /> <field name='ProductName' required='N' /> <field name='ProductDescription' required='N' /> <field name='TickValue' required='N' /> <field name='ImpliedType' required='N' /> <field name='PrimaryLegSymbol' required='N' /> <field name='SecondaryLegSymbol' required='N' /> <field name='IncrementStrike' required='N' /> <field name='MinStrike' required='N' /> <field name='MaxStrike' required='N' /> </group> </message> The actual message is 8=FIX.4.49=5004335=d49=ICE34=252=20121017-00:39:41.38556=600357=23322=3924323=4320=1393=1310382=13267=1711=100 311=1705282309=TEB SMG0013-TFL SMG0013305=8463=FXXXXX307=NG Basis Futures Spr - TETCO-ELA/TGP-500L - Feb13542=20130131436=1.09013=0.00059014=2500.09017=25009022=289024=19025=Y916=20130201917=201302289201=11969200=129202=Feb139300=60589301=Texas Eastern Transmission Corp. - East Louisiana Zone/Tennessee Gas Pipeline Co. - Zone L, 500 Leg Pool9302=TETCO-ELA/TGP-500L998=MMBtus9100=USD9101=USD / MMBtu9085=daily9083=49084=09061=4909062=NG Basis Futures Spr9063=Natural Gas Basis Futures Spread9032=1.259004=17051939005=1353778 311=1714677309=PGE SQF0014.H0014-SCB SQF0014.H0014305=8463=FXXXXX307=NG Basis Futures Spr - PG&E-Citygate/Socal-Citygate - Q1 14542=20131231436=1.09013=0.00059014=2500.09017=25009022=909024=19025=Y916=20140101917=201403319201=12339200=159202=Q1 149300=59979301=PG&E - Citygate/Socal - Citygate9302=PG&E-Citygate/Socal-Citygate998=MMBtus9100=USD9101=USD / MMBtu9085=daily9083=49084=09061=4909062=NG Basis Futures Spr9063=Natural Gas Basis Futures Spread9032=1.259004=13430529005=1344660

    Read the article

  • Set postion in customized list field in blackberry

    - by arunabha
    I want three list field items to be displayed, from bottom to top. I am able to display three list field items, but they display from top to bottom. I have tried setting the position, but it isn't working. import java.util.Vector; import net.rim.device.api.system.Bitmap; import net.rim.device.api.system.Display; import net.rim.device.api.ui.ContextMenu; import net.rim.device.api.ui.DrawStyle; import net.rim.device.api.ui.Field; import net.rim.device.api.ui.Font; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.Manager; import net.rim.device.api.ui.MenuItem; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.component.BitmapField; import net.rim.device.api.ui.component.Dialog; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.component.ListField; import net.rim.device.api.ui.component.ListFieldCallback; import net.rim.device.api.ui.component.NullField; import net.rim.device.api.ui.container.FullScreen; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.util.Arrays; import net.rim.device.api.ui.component.ListField; /** * @author Jason Emerick */ public class TaskListField extends UiApplication { //statics ------------------------------------------------------------------ public static void main(String[] args) { TaskListField theApp = new TaskListField(); theApp.enterEventDispatcher(); } public TaskListField() { pushScreen(new TaskList()); } } /*class List extends FullScreen { TaskList tl; List(){ super(); TaskList tl=new TaskList(); } }*/ class TaskList extends MainScreen implements ListFieldCallback { private Vector rows; private Bitmap p1; private Bitmap p2; private Bitmap p3; String Task; ListField listnew=new ListField(); public TaskList() { super(); listnew.setRowHeight(50); //setEmptyString("Hooray, no tasks here!", DrawStyle.HCENTER); listnew.setCallback(this); p1 = Bitmap.getBitmapResource("1.png"); p2 = Bitmap.getBitmapResource("2.png"); p3 = Bitmap.getBitmapResource("3.png"); rows = new Vector(); for (int x = 0; x < 3; x++) { TableRowManager row = new TableRowManager(); if (x== 0) { Task="On Air Now"; } if (x== 1) { Task="Music Channel"; } if (x==2) { Task="News Channel"; } // SET THE PRIORITY BITMAP FIELD // if high priority, display p1 bitmap if (x % 2 == 0) { row.add(new BitmapField(p1)); } // if priority is 2, set p2 bitmap else if (x % 3 == 0) { row.add(new BitmapField(p2)); } // if priority is 3, set p3 bitmap else { row.add(new BitmapField(p3)); } // SET THE TASK NAME LABELFIELD // if overdue, bold/underline LabelField task = new LabelField(Task, DrawStyle.ELLIPSIS); // if due today, bold if (x % 2 == 0) { task.setFont(Font.getDefault().derive( Font.BOLD)); } else { task.setFont(Font.getDefault().derive(Font.BOLD)); } row.add(task); LabelField task1 = new LabelField("Now Playing" + String.valueOf(x), DrawStyle.ELLIPSIS); // if due today, bold /* if (x % 2 == 0) { task.setFont(Font.getDefault().derive( Font.BOLD)); } else { task.setFont(Font.getDefault().derive(Font.BOLD)); }*/ Font myFont = Font.getDefault().derive(Font.PLAIN, 12); task1.setFont(myFont); row.add(task1); // SET THE DUE DATE/TIME row.add(new LabelField("", DrawStyle.ELLIPSIS | LabelField.USE_ALL_WIDTH | DrawStyle.RIGHT) { protected void paint(Graphics graphics) { graphics.setColor(0x00878787); super.paint(graphics); } }); rows.addElement(row); } listnew.setSize(rows.size()); this.add(listnew); } // ListFieldCallback Implementation public void drawListRow(ListField listField, Graphics g, int index, int y, int width) { //TaskList list =(TaskListField) listnew; TableRowManager rowManager = (TableRowManager)rows .elementAt(index); rowManager.drawRow(g, 0, y, width, listnew.getRowHeight()); } private class TableRowManager extends Manager { public TableRowManager() { super(0); } // Causes the fields within this row manager to be layed out then // painted. public void drawRow(Graphics g, int x, int y, int width, int height) { // Arrange the cell fields within this row manager. layout(0, 1); // Place this row manager within its enclosing list. setPosition(x,y); // Apply a translating/clipping transformation to the graphics // context so that this row paints in the right area. g.pushRegion(getExtent()); // Paint this manager's controlled fields. subpaint(g); g.setColor(0x00CACACA); g.drawLine(0, 0, getPreferredWidth(), 0); // Restore the graphics context. g.popContext(); } // Arrages this manager's controlled fields from left to right within // the enclosing table's columns. protected void sublayout(int width, int height) { // set the size and position of each field. int fontHeight = Font.getDefault().getHeight(); int preferredWidth = getPreferredWidth(); // start with the Bitmap Field of the priority icon /* Field field = getField(0); layoutChild(field, 0, 0); setPositionChild(field, 150, 300);*/ // set the task name label field /* field = getField(1); layoutChild(field, preferredWidth - 16, fontHeight + 1); setPositionChild(field, 34, 3); // set the list name label field field = getField(2); layoutChild(field, 150, fontHeight + 1); setPositionChild(field, 34, fontHeight + 6);*/ // set the due time name label field /* field = getField(3); layoutChild(field, 150, fontHeight + 1); setPositionChild(field,4,340);*/ /* layoutChild(listnew, preferredWidth, fontHeight); setPositionChild(listnew, 3, 396);*/ setExtent(360, 480); } // The preferred width of a row is defined by the list renderer. public int getPreferredWidth() { return getWidth(); } // The preferred height of a row is the "row height" as defined in the // enclosing list. public int getPreferredHeight() { return listnew.getRowHeight(); } } public Object get(ListField listField, int index) { // TODO Auto-generated method stub return null; } public int getPreferredWidth(ListField listField) { // TODO Auto-generated method stub return 0; } public int indexOfList(ListField listField, String prefix, int start) { // TODO Auto-generated method stub return 0; } }

    Read the article

  • How do I assign by "reference" to a class field in c#?

    - by Jamie
    I am trying to understand how to assign by "reference" to a class field in c#. I have the follwing example to consider: public class X { public X() { string example = "X"; new Y( ref example ); new Z( ref example ); System.Diagnostics.Debug.WriteLine( example ); } } public class Y { public Y( ref string example ) { example += " (Updated By Y)"; } } public class Z { private string _Example; public Z( ref string example ) { this._Example = example; this._Example += " (Updated By Z)"; } } var x = new X(); When running the above code the output is: X (Updated By Y) And not: X (Updated By Y) (Updated By Z) As I had hoped. It seems that assigning a "ref parameter" to a field loses the reference. Is there any way to keep hold of the reference when assigning to a field? Thanks.

    Read the article

  • How should I get the value contained in a particular field of a Drupal 7 custom node?

    - by Matt V.
    What is the "proper" way to get the value stored in a particular field within a custom Drupal node? I've created a custom module, with a custom node, with a custom URL field. The following works: $result = db_query("SELECT nid FROM {node} WHERE title = :title AND type = :type", array( ':title' => $title, ':type' => 'custom', ))->fetchField(); $node = node_load($result); $url = $node->url['und']['0']['value']; ...but is there a better way, maybe using the new Field API functions?

    Read the article

  • Bring Winforms control to front

    - by Nathan
    Are there any other methods of bringing a control to the front other than control.BringToFront()? I have series of labels on a user control and when I try to bring one of them to front it is not working. I have even looped through all the controls and sent them all the back except for the one I am interested in and it doesn't change a thing. Here is the method where a label is added to the user control private void AddUserLabel() { UserLabel field = new UserLabel(); ++fieldNumber; field.Name = "field" + fieldNumber.ToString(); field.Top = field.FieldTop + fieldNumber; field.Left = field.FieldLeft + fieldNumber; field.Height = field.FieldHeight; field.Width = field.FieldWidth; field.RotationAngle = field.FieldRotation; field.Barcode = field.BarCoded; field.HumanReadable = field.HumanReadable; field.Text = field.FieldText; field.ForeColor = Color.Black; field.MouseDown += new MouseEventHandler(label_MouseDown); field.MouseUp += new MouseEventHandler(label_MouseUp); field.MouseMove += new MouseEventHandler(label_MouseMove); userContainer.Controls.Add(field); SendLabelsToBack(); //Send All labels to back userContainer.Controls[field.FieldName].BringToFront(); } Here is the method that sends all of them to the back. private void SendLabelsToBack() { foreach (UserLabel lbl in userContainer.Controls) { lbl.SendToBack(); } }

    Read the article

  • How to add a new item in a sharepoint list using web services in C sharp

    - by Frank
    Hi, I'm trying to add a new item to a sharepoint list from a winform application in c# using web services. As only result, I'm getting the useless exception "Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown." I have a web reference named WebSrvRef to http://server/site/subsite/_vti_bin/Lists.asmx And this code: XmlDocument xmlDoc; XmlElement elBatch; XmlNode ndReturn; string[] sValues; string sListGUID; string sViewGUID; if (lstResults.Items.Count < 1) { MessageBox.Show("Unable to Add To SharePoint\n" + "No test file processed. The list is blank.", "Add To SharePoint", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } WebSrvRef.Lists listService = new WebSrvRef.Lists(); sViewGUID = "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"; // Test List View GUID sListGUID = "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"; // Test List GUID listService.Credentials= System.Net.CredentialCache.DefaultCredentials; frmAddToSharePoint dlgAddSharePoint = new frmAddToSharePoint(); if (dlgAddSharePoint.ShowDialog() == DialogResult.Cancel) { dlgAddSharePoint.Dispose(); listService.Dispose(); return; } sValues = dlgAddSharePoint.Tag.ToString().Split('~'); dlgAddSharePoint.Dispose(); string strBatch = "<Method ID='1' Cmd='New'>" + "<Field Name='Client#'>" + sValues[0] + "</Field>" + "<Field Name='Company'>" + sValues[1] + "</Field>" + "<Field Name='Contact Name'>" + sValues[2] + "</Field>" + "<Field Name='Phone Number'>" + sValues[3] + "</Field>" + "<Field Name='Brand'>" + sValues[4] + "</Field>" + "<Field Name='Model'>" + sValues[5] + "</Field>" + "<Field Name='DPI'>" + sValues[6] + "</Field>" + "<Field Name='Color'>" + sValues[7] + "</Field>" + "<Field Name='Compression'>" + sValues[8] + "</Field>" + "<Field Name='Value % 1'>" + (((float)lstResults.Groups["Value 1"].Tag)*100).ToString("##0.00") + "</Field>" + "<Field Name='Value % 2'>" + (((float)lstResults.Groups["Value 2"].Tag)*100).ToString("##0.00") + "</Field>" + "<Field Name='Value % 3'>" + (((float)lstResults.Groups["Value 3"].Tag)*100).ToString("##0.00") + "</Field>" + "<Field Name='Value % 4'>" + (((float)lstResults.Groups["Value 4"].Tag)*100).ToString("##0.00") + "</Field>" + "<Field Name='Value % 5'>" + (((float)lstResults.Groups["Value 5"].Tag)*100).ToString("##0.00") + "</Field>" + "<Field Name='Comments'></Field>" + "<Field Name='Overall'>" + (fTotalScore*100).ToString("##0.00") + "</Field>" + "<Field Name='Average'>" + (fTotalAvg * 100).ToString("##0.00") + "</Field>" + "<Field Name='Transfered'>" + sValues[9] + "</Field>" + "<Field Name='Notes'>" + sValues[10] + "</Field>" + "<Field Name='Resolved'>" + sValues[11] + "</Field>" + "</Method>"; try { xmlDoc = new System.Xml.XmlDocument(); elBatch = xmlDoc.CreateElement("Batch"); elBatch.SetAttribute("OnError", "Continue"); elBatch.SetAttribute("ListVersion", "1"); elBatch.SetAttribute("ViewName", sViewGUID); strBatch = strBatch.Replace("&", "&amp;"); elBatch.InnerXml = strBatch; ndReturn = listService.UpdateListItems(sListGUID, elBatch); MessageBox.Show(ndReturn.OuterXml); listService.Dispose(); } catch(Exception Ex) { MessageBox.Show(Ex.Message + "\n\nSource\n" + Ex.Source + "\n\nTargetSite\n" + Ex.TargetSite + "\n\nStackTrace\n" + Ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); listService.Dispose(); } What am I doing wrong? What am I missing? Please help!! Frank

    Read the article

  • Is there a way to customize how the value for a custom Model Field is displayed in a template?

    - by Jordan Reiter
    I am storing dates as an integer field in the format YYYYMMDD, where month or day is optional. I have the following function for formatting the number: def flexibledateformat(value): import datetime, re try: value = str(int(value)) except: return None match = re.match(r'(\d{4})(\d\d)(\d\d)$',str(value)) if match: year_val, month_val, day_val = [int(v) for v in match.groups()] if day_val: return datetime.datetime.strftime(datetime.date(year_val,month_val,day_val),'%b %e, %Y') elif month_val: return datetime.datetime.strftime(datetime.date(year_val,month_val,1),'%B %Y') else: return str(year_val) Which results in the following outputs: >>> flexibledateformat(20100415) 'Apr 15, 2010' >>> flexibledateformat(20100400) 'April 2010' >>> flexibledateformat(20100000) '2010' So I'm wondering if there's a function I can add under the model field class that would automatically call flexibledateformat. So if there's a record r = DataRecord(name='foo',date=20100400) when processed in the form the value would be 20100400 but when output in a template using {{ r.date }} it shows up as "April 2010". Further clarification I do normally use datetime for storing date/time values. In this specific case, I need to record non-specific dates: "x happened in 2009", "y happened sometime in June 1996". The easiest way to do this while still preserving most of the functionality of a date field, including sorting and filtering, is by using an integer in the format of yyyymmdd. That is why I am using an IntegerField instead of a DateTimeField. This is what I would like to happen: I store what I call a "Flexible Date" in a FlexibleDateField as an integer with the format yyyymmdd. I render a form that includes a FlexibleDateField, and the value remains an integer so that functions necessary for validating it and rendering it in widgets work correctly. I call it in a template, as in {{ object.flexibledate }} and it is formatted according to the flexibledateformat rules: 20100416 - April 16, 2010; 20100400 - April 2010; 20100000 - 2010. This also applies when I'm not calling it directly, such as when it's used as a header in admin (http://example.org/admin/app_name/model_name/). I'm not aware if these specific things are possible.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >