Search Results

Search found 4919 results on 197 pages for 'integer'.

Page 10/197 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • casting a node to integer

    - by user1708762
    The code gives an error saying that "no operator matches these two operands" in the if comparison statement. I interpret,it should mean that "a node can't be converted/casted into an integer". But, the print statement prints an integer value for w[2] when used with %d format. Why is that happening? Isn't printf casting it? NODE *w=(NODE *)malloc(4*sizeof(NODE)); if(w[2]==0) printf("%d\n",w[2]); The structure of the node is- struct node{ int key; struct node *father; struct node *child[S]; int *ss; int current; };

    Read the article

  • Font serialization in vb.net

    - by jovany
    Hello all, as the title says , I need to serialize my font. I have tried the following approach unfortunately to no avail. This is what I have and what happens; I have a drawing application and certain variables and properties need to be serialized. (So , Xml.Serialization has been used.) Now this has already been done in a huge portion and I've created some other attributes which needed to be serialized and it works. There is one base class and classes such as drawablestar, drawableeclipse ,etc. all inherit from this class. As does my drawabletextboxclass. The base class is Serializable as can be seen in the sample below. It looks like this... Imports System.Xml.Serialization <Serializable()> _ Public MustInherit Class Drawable ' Drawing characteristics. 'Font characteristics <XmlIgnore()> Public FontFamily As String <XmlIgnore()> Public FontSize As Integer <XmlIgnore()> Public FontType As Integer <XmlIgnore()> Public ForeColor As Color <XmlIgnore()> Public FillColor As Color <XmlAttributeAttribute()> Public LineWidth As Integer = 0 <XmlAttributeAttribute()> Public X1 As Integer <XmlAttributeAttribute()> Public Y1 As Integer <XmlAttributeAttribute()> Public X2 As Integer <XmlAttributeAttribute()> Public Y2 As Integer ' attributes for size textbox <XmlAttributeAttribute()> Public widthLabel As Integer <XmlAttributeAttribute()> Public heightLabel As Integer '<XmlTextAttribute()> Public FontFamily As String '<XmlAttributeAttribute()> Public FontSize As Integer 'this should actually not be here.. <XmlAttributeAttribute()> Public s_InsertLabel As String ' Indicates whether we should draw as selected. <XmlIgnore()> Public IsSelected As Boolean = False ' Constructors. Public Sub New() ForeColor = Color.Black FillColor = Color.White 'FontFamily = "Impact" 'FontSize = 12 End Sub Friend WriteOnly Property _Label() As String Set(ByVal Value As String) s_InsertLabel = Value End Set End Property Public Sub New(ByVal fore_color As Color, ByVal fill_color As Color, Optional ByVal line_width As Integer = 0) LineWidth = line_width ForeColor = fore_color FillColor = fill_color ' FontFamily = Font_Family ' FontSize = Font_Size End Sub ' Property procedures to serialize and ' deserialize ForeColor and FillColor. <XmlAttributeAttribute("ForeColor")> _ Public Property ForeColorArgb() As Integer Get Return ForeColor.ToArgb() End Get Set(ByVal Value As Integer) ForeColor = Color.FromArgb(Value) End Set End Property <XmlAttributeAttribute("BackColor")> _ Public Property FillColorArgb() As Integer Get Return FillColor.ToArgb() End Get Set(ByVal Value As Integer) FillColor = Color.FromArgb(Value) End Set End Property 'Property procedures to serialize and 'deserialize Font <XmlAttributeAttribute("InsertLabel")> _ Public Property InsertLabel_() As String Get Return s_InsertLabel End Get Set(ByVal value As String) s_InsertLabel = value End Set End Property <XmlAttributeAttribute("FontSize")> _ Public Property FontSizeGet() As Integer Get Return FontSize End Get Set(ByVal value As Integer) FontSize = value End Set End Property <XmlAttributeAttribute("FontFamily")> _ Public Property FontFamilyGet() As String Get Return FontFamily End Get Set(ByVal value As String) FontFamily = value End Set End Property <XmlAttributeAttribute("FontType")> _ Public Property FontType_() As Integer Get Return FontType End Get Set(ByVal value As Integer) FontType = value End Set End Property #Region "Methods to override" Public MustOverride Sub Draw(ByVal gr As Graphics) ' Return the object's bounding rectangle. Public MustOverride Function GetBounds() As Rectangle ...... ........ ..... End Class [/code] My textbox class which looks like this , is the one that needs to save it's font. Imports System.Math Imports System.Xml.Serialization Imports System.Windows.Forms <Serializable()> _ Public Class DrawableTextBox Inherits Drawable Private i_StringLength As Integer Private i_StringWidth As Integer Private drawFont As Font = New Font(FontFamily, 12, FontStyle.Regular) Private brsTextColor As Brush = Brushes.Black Private s_insertLabelTextbox As String = "label" ' Constructors. Public Sub New() End Sub Public Sub New(ByVal objCanvas As PictureBox, ByVal fore_color As Color, ByVal fill_color As Color, Optional ByVal line_width As Integer = 0, Optional ByVal new_x1 As Integer = 0, Optional ByVal new_y1 As Integer = 0, Optional ByVal new_x2 As Integer = 1, Optional ByVal new_y2 As Integer = 1) MyBase.New(fore_color, fill_color, line_width) Dim objGraphics As Graphics = objCanvas.CreateGraphics() X1 = new_x1 Y1 = new_y1 'Only rectangles ,circles and stars can resize for now b_Movement b_Movement = True Dim frm As New frmTextbox frm.MyFont = drawFont frm.ShowDialog() If frm.DialogResult = DialogResult.OK Then FontFamily = frm.MyFont.FontFamily.Name FontSize = frm.MyFont.Size FontType = frm.MyFont.Style 'drawFont = frm.MyFont drawFont = New Font(FontFamily, FontSize) drawFont = FontAttributes() brsTextColor = New SolidBrush(frm.txtLabel.ForeColor) s_InsertLabel = frm.txtLabel.Text i_StringLength = s_InsertLabel.Length 'gefixtf Dim objSizeF As SizeF = objGraphics.MeasureString(s_InsertLabel, drawFont, New PointF(X2 - X1, Y2 - Y1), New StringFormat(StringFormatFlags.NoClip)) Dim objPoint As Point = objCanvas.PointToClient(New Point(X1 + objSizeF.Width, Y1 + objSizeF.Height)) widthLabel = objSizeF.Width heightLabel = objSizeF.Height X2 = X1 + widthLabel Y2 = Y1 + heightLabel Else Throw New ApplicationException() End If End Sub ' Draw the object on this Graphics surface. Public Overrides Sub Draw(ByVal gr As System.Drawing.Graphics) ' Make a Rectangle representing this rectangle. Dim rectString As Rectangle rectString = New Rectangle(X1, Y1, widthLabel, heightLabel) rectString = GetBounds() ' See if we're selected. If IsSelected Then gr.DrawString(s_InsertLabel, drawFont, brsTextColor, X1, Y1) 'gr.DrawRectangle(Pens.Black, rect) ' Pens.Transparent gr.DrawRectangle(Pens.Black, rectString) ' Draw grab handles. DrawGrabHandle(gr, X1, Y1) DrawGrabHandle(gr, X1, Y2) DrawGrabHandle(gr, X2, Y2) DrawGrabHandle(gr, X2, Y1) Else gr.DrawString(s_InsertLabel, drawFont, brsTextColor, X1, Y1) 'gr.DrawRectangle(Pens.Black, rect) ' Pens.Transparent gr.DrawRectangle(Pens.Black, rectString) End If End Sub 'get fontattributes Public Function FontAttributes() As Font Return New Font(FontFamily, 12, FontStyle.Regular) End Function ' Return the object's bounding rectangle. Public Overrides Function GetBounds() As System.Drawing.Rectangle Return New Rectangle( _ Min(X1, X1), _ Min(Y1, Y1), _ Abs(widthLabel), _ Abs(heightLabel)) End Function ' Return True if this point is on the object. Public Overrides Function IsAt(ByVal x As Integer, ByVal y As Integer) As Boolean Return (x >= Min(X1, X2)) AndAlso _ (x <= Max(X1, X2)) AndAlso _ (y >= Min(Y1, Y2)) AndAlso _ (y <= Max(Y1, Y2)) End Function ' Move the second point. Public Overrides Sub NewPoint(ByVal x As Integer, ByVal y As Integer) X2 = x Y2 = y End Sub ' Return True if the object is empty (e.g. a zero-length line). Public Overrides Function IsEmpty() As Boolean Return (X1 = X2) AndAlso (Y1 = Y2) End Function End Class The coordinates ( X1 ,X2,Y1, Y2 ) are needed to draw a circle , rectangle etc. ( in the other classes ).This all works. If I load my saved file it shows me the correct location and correct size of drawn objects. If I open my xml file I can see all values are correctly saved ( including my FontFamily ). Also the color which can be adjusted is saved and then properly displayed when I load a previously saved drawing. Of course because the coordinates work, if I insert a textField ,the location where it is being displayed is correct. However here comes the problem , my fontSize and fontfamily don't work. As you can see I created them in the base class, However this does not work. Is my approach completely off? What can I do ? Before saving img14.imageshack.us/i/beforeos.jpg/ After loading the Font jumps back to Sans serif and size 12. I could really use some help here.. Edit: I've been using the sample from this website http://www.vb-helper.com/howto_net_drawing_framework.html

    Read the article

  • Why can't the JVM just make autoboxing "just work"?

    - by Pyrolistical
    Autoboxing is rather scary. While I fully understand the difference between == and .equals I can't but help have the follow bug the hell out of me: final List<Integer> foo = Arrays.asList(1, 1000); final List<Integer> bar = Arrays.asList(1, 1000); System.out.println(foo.get(0) == bar.get(0)); System.out.println(foo.get(1) == bar.get(1)); That prints true false Why did they do it this way? It something to do with cached Integers, but if that is the case why don't they just cache all Integers used by the program? Or why doesn't the JVM always auto unbox to primitive? Printing false false or true true would have been way better.

    Read the article

  • Hash 32bit int to 16bit int?

    - by dkamins
    What are some simple ways to hash a 32-bit integer (e.g. IP address, e.g. Unix time_t, etc.) down to a 16-bit integer? E.g. hash_32b_to_16b(0x12345678) might return 0xABCD. Let's start with this as a horrible but functional example solution: function hash_32b_to_16b(val32b) { return val32b % 0xffff; } Question is specifically about JavaScript, but feel free to add any language-neutral solutions, preferably without using library functions. Simple = good. Wacky+obfuscated = amusing.

    Read the article

  • Integers in TextNodes w/ Python minidom

    - by PylonsN00b
    I am working on an API using SOAP and WSDL. The WSDL expects integers to come through. I am fairly new to ALL of this, and constructing XML in Python. I have chosen to use minidom to create my SOAP message. So using minidom, to get a value into a node I found I have to do this: weight_node = xml_file.createElement("web:Weight") weight_contents = xml_file.createTextNode(weight) weight_node.appendChild(weight_contents) So say weight needs to go in as an integer and IS an integer. The function is 'createTextNode' does this mean its going to be text, or what I put in there has to be text? Again I am fairly new to all of this. So if what I have explained seems way off base, please speak up.

    Read the article

  • Division to the nearest 1 decimal place without floating point math?

    - by John Sheares
    I am having some speed issues with my C# program and identified that this percentage calculation is causing a slow down. The calculation is simply n/d * 100. Both the numerator and denominator can be any integer number. The numerator can never be greater than the denominator and is never negative. Therefore, the result is always from 0-100. Right now, this is done by simply using floating point math and is somewhat slow, since it's being calculated tens of millions of times. I really don't need anything more accurate than to the nearest 0.1 percent. And, I just use this calculated value to see if it's bigger than a fixed constant value. I am thinking that everything should be kept as an integer, so the range with 0.1 accuracy would be 0-1000. Is there some way to calculate this percentage without floating point math?

    Read the article

  • storing multiple values as binary in one field

    - by Enghoej
    Hi I have a project where I need to store a large number of values. The data is a dataset holding 1024 2Byte Unsigned integer values. Now I store one value at one row together with a timestamp and a unik ID. This data is continously stored based on a time trigger. What I would like to do, is store all 1024 values in one field. So would it be possible to do some routine that stores all the 1024 2byte integer values in one field as binary. Maybe a blobfield. Thanks. Br. Enghoej

    Read the article

  • Sorting a list of variable length integers delimited by decimal points...

    - by brewerdc
    Hey guys, I'm in need of some help. I have a list of delimited integer values that I need to sort. An example: Typical (alpha?) sort: 1.1.32.22 11.2.4 2.1.3.4 2.11.23.1.2 2.3.7 3.12.3.5 Correct (numerical) sort: 1.1.32.22 2.1.3.4 2.3.7 2.11.23.1.2 3.12.3.5 11.2.4 I'm having trouble figuring out how to setup the algorithm to do such a sort with n number of decimal delimiters and m number of integer fields. Any ideas? This has to have been done before. Let me know if you need more information. Thanks a bunch! -Daniel

    Read the article

  • Is there a standard format string in ASP.NET to convert 1/2/3/... to 1st/2nd/3rd...?

    - by Dr. Monkey
    I have an integer in an Access database, which is being displayed in ASP.NET. The integer represents the position achieved by a competitor in a sporting event (1st, 2nd, 3rd, etc.), and I'd like to display it with a standard suffix like 'st', 'nd', 'rd' as appropriate, rather than just a naked number. An important limitation is that this is for an assignment which specifies that no VB or C# code be written (in fact it instructs code behind files to be deleted entirely). Ideally I'd like to use a standard format string if available, otherwise perhaps a custom string (I haven't worked with format strings much, and this isn't high enough priority to dedicate significant time to*, but I am very curious about whether there's a standard string for this). (* The assignment is due tonight, and I've learned the hard way that I can't afford to spend time on things that don't get the marks, even if they irk me significantly.)

    Read the article

  • Set asisde space for ADT when reading integers from file

    - by That Guy
    I'm using C to make maze solver. The program should be able read a maze from a text file containing a grid of 1 and 0 representing walls and paths. This file could be of any size as the user selects which maze to use. The program should then show the maze being solved. As the maze is being solved it should show where has been walked and how many steps have been taken. I have made an ADT called Cell containing a bool for wall or path and an integer for steps taken. I now need to populate a 2D array of Cells which means I need to set aside enough space to store a Cell for every integer in the maze file. What would be the best way to do this?

    Read the article

  • Find largest value of integer in repeating string

    - by dotancohen
    I have a script log file that looks a bit like this: 2012-9-16 Did something Did 345 things Script time: 244 seconds 2012-9-17 Did yet something Did another thing 23 times Script time: 352 seconds 2012-9-18 Did something special for 34 seconds 51 times Did nothing at all Script time: 122 seconds I would like to find the largest value of N in the lines Script time: N seconds. However, I need to keep the context, so simply removing all lines that don't contain Script time in them is not a viable solution. Currently, I am grepping for lines with Script time, then sorting those to find the highest value, then going back to the original file and searching for that value. However, if there is a more straightforward way then I would love to know. This is on Vim 7.3 on a recent CentOS. I would prefer to remain in VIM if possible. Thanks.

    Read the article

  • Integer Surrogate Key?

    - by CitadelCSAlum
    I need something real simple, that for some reason I am unable to accomplish to this point. I have also been unable to Google the answer surprisingly. I need to number the entries in different tables uniquely. I am aware of AUTO INCREMENT in MySQL and that it will be involved. My situation would be as follows If I had a table like Table EXAMPLE ID - INTEGER FIRST_NAME - VARCHAR(45) LAST_NAME - VARCHAR(45) PHONE - VARCHAR(45) CITY - VARCHAR(45) STATE - VARCHAR(45) ZIP - VARCHAR(45) This would be the setup for the table where ID is an integer that is auto-incremented every time an entry is inserted into the table. The thing I need is that I do not want to have to account for this field when inserting data into the database. From my understanding this would be a surrogate key, that I can tell the database to automatically increment and I do not have to include it in the INSERT STATEMENT so instead of INSERT INTO EXAMPLE VALUES (2,'JOHN','SMITH',333-333-3333,'NORTH POLE'.... I can leave out the first ID column and just write something like INSERT INTO EXAMPLE VALUES ('JOHN','SMITH'.....etc) Notice I Wouldnt have to define the ID column... I know this is a very common task to do, but for some reason I cant get to the bottom of it. I am using MySQL, just to clarify. Thanks alot

    Read the article

  • SQL GUID Vs Integer

    - by Dal
    Hi I have recently started a new job and noticed that all the SQL tables use the GUID data type for the primary key. In my previous job we used integers (Auto-Increment) for the primary key and it was a lot more easier to work with in my opinion. For example, say you had two related tables; Product and ProductType - I could easily cross check the 'ProductTypeID' column of both tables for a particular row to quickly map the data in my head because its easy to store the number (2,4,45 etc) as opposed to (E75B92A3-3299-4407-A913-C5CA196B3CAB). The extra frustration comes from me wanting to understand how the tables are related, sadly there is no Database diagram :( A lot of people say that GUID's are better because you can define the unique identifer in your C# code for example using NewID() without requiring SQL SERVER to do it - this also allows you to know provisionally what the ID will be.... but I've seen that it is possible to still retrieve the 'next auto-incremented integer' too. A DBA contractor reported that our queries could be up to 30% faster if we used the Integer type instead of GUIDS... Why does the GUID data type exist, what advantages does it really provide?... Even if its a choice by some professional there must be some good reasons as to why its implemented?

    Read the article

  • how to show integer values in JComboBox?

    - by Edan
    Hello, I would like to know how to set a JComboBox that contain integers values that I could save. Here is the definitions of values: public class Item { private String itemDesc; private int itemType; public static int ENTREE=0; public static int MAIN_MEAL=1; public static int DESSERT=2; public static int DRINK=3; private float price; int[] itemTypeArray = { ENTREE, MAIN_MEAL, DESSERT, DRINK }; Object[][] data = {{itemDesc, new Integer(itemType), new Float(price)}}; . . . } Now, I want the add a JComboBox that the user will choose 1 of the items (ENTREE, MAIN_MEAL...) and then I could set the number as an Integer. I know that JComboBox need to be something like that: JComboBox combo = new JComboBox(itemTypeArray.values()); JOptionPane.showMessageDialog( null, combo,"Please Enter Item Type", `JOptionPane.QUESTION_MESSAGE);` What am I doing wrong?

    Read the article

  • Why can't pass Marshaled interface as integer(or pointer)

    - by cemick
    I passed ref of interface from Visio Add-ins to MyCOMServer (http://stackoverflow.com/questions/2455183/interface-marshalling-in-delphi).I have to pass interface as pointer in internals method of MyCOMServer. I try to pass interface to internal method as pointer of interface, but after back cast when i try call method of interface I get exception. Simple example(Fisrt block execute without error, but At Second block I get Exception after addressed to property of IVApplication interface): procedure TMyCOMServer.test(const Interface_:IDispatch); stdcall; var IMy:_IMyInterface; V: Variant; Str: String; I: integer; Vis: IVApplication; begin ...... Self.QuaryInterface(_IMyInterface,IMy); str := IA.ApplicationName; V := Integer(IMy); i := V; Pointer(IMy) := Pointer(i); str := IMy.SomeProperty; // normal completion str := (Interface_ as IVApplication).Path; V := Interface_; I := V; Pointer(Vis) := Pointer(i); str := Vis.Path; // 'access violation at 0x76358e29: read of address 0xfeeefeee' end; Why I can't do like this?

    Read the article

  • GAE datastore querying integer fields

    - by ParanoidAndroid
    I notice strange behavior when querying the GAE datastore. Under certain circumstances Filter does not work for integer fields. The following java code reproduces the problem: log.info("start experiment"); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); int val = 777; // create and store the first entity. Entity testEntity1 = new Entity(KeyFactory.createKey("Test", "entity1")); Object value = new Integer(val); testEntity1.setProperty("field", value); datastore.put(testEntity1); // create the second entity by using BeanUtils. Test test2 = new Test(); // just a regular bean with an int field test2.setField(val); Entity testEntity2 = new Entity(KeyFactory.createKey("Test", "entity2")); Map<String, Object> description = BeanUtilsBean.getInstance().describe(test2); for(Entry<String,Object> entry:description.entrySet()){ testEntity2.setProperty(entry.getKey(), entry.getValue()); } datastore.put(testEntity2); // now try to retrieve the entities from the database... Filter equalFilter = new FilterPredicate("field", FilterOperator.EQUAL, val); Query q = new Query("Test").setFilter(equalFilter); Iterator<Entity> iter = datastore.prepare(q).asIterator(); while (iter.hasNext()) { log.info("found entity: " + iter.next().getKey()); } log.info("experiment finished"); the log looks like this: INFO: start experiment INFO: found entity: Test("entity1") INFO: experiment finished For some reason it only finds the first entity even though both entities are actually stored in the datastore and both 'field' values are 777 (I see it in the Datastore Viewer)! Why does it matter how the entity is created? I would like to use BeanUtils, because it is convenient. The same problem occurs on the local devserver and when deployed to GAE.

    Read the article

  • Integer array or struct array - which is better?

    - by MusiGenesis
    In my app, I'm storing Bitmap data in a two-dimensional integer array (int[,]). To access the R, G and B values I use something like this: // read: int i = _data[x, y]; byte B = (byte)(i >> 0); byte G = (byte)(i >> 8); byte R = (byte)(i >> 16); // write: _data[x, y] = BitConverter.ToInt32(new byte[] { B, G, R, 0 }, 0); I'm using integer arrays instead of an actual System.Drawing.Bitmap because my app runs on Windows Mobile devices where the memory available for creating bitmaps is severely limited. I'm wondering, though, if it would make more sense to declare a structure like this: public struct RGB { public byte R; public byte G; public byte B; } ... and then use an array of RGB instead of an array of int. This way I could easily read and write the separate R, G and B values without having to do bit-shifting and BitConverter-ing. I vaguely remember something from days of yore about byte variables being block-aligned on 32-bit systems, so that a byte actually takes up 4 bytes of memory instead of just 1 (but maybe this was just a Visual Basic thing). Would using an array of structs (like the RGB example` above) be faster than using an array of ints, and would it use 3/4 the memory or 3 times the memory of ints?

    Read the article

  • Assigning a value to an integer in a C linked list

    - by Drunk On Java
    Hello all. I have a question regarding linked lists. I have the following structs and function for example. struct node { int value; struct node *next; }; struct entrynode { struct node *first; struct node *last; int length; }; void addnode(struct entrynode *entry) { struct node *nextnode = (struct node *)malloc(sizeof(struct node)); int temp; if(entry->first == NULL) { printf("Please enter an integer.\n"); scanf("%d", &temp); nextnode->value = temp; nextnode->next = NULL; entry->first = nextnode; entry->last = nextnode; entry->length++; } else { entry->last->next = nextnode; printf("Please enter an integer.\n"); scanf("%d", nextnode->value); nextnode->next = NULL; entry->last = nextnode; entry->length++; } } In the first part of the if statement, I store input into a temp variable and then assign that to a field in the struct. The else branch, I tried to assign it directly which did not work. How would I go about assigning it directly? Thanks for your time.

    Read the article

  • Need help with java map and javabean

    - by techoverflow
    Hi folks, I have a nested map: Map<Integer, Map<Integer, Double>> areaPrices = new HashMap<Integer, Map<Integer, Double>>(); and this map is populated using the code: while(oResult.next()) { Integer areaCode = new Integer(oResult.getString("AREA_CODE")); Map<Integer, Double> zonePrices = areaPrices.get(areaCode); if(zonePrices==null) { zonePrices = new HashMap<Integer, Double>(); areaPrices.put(areaCode, zonePrices); } Integer zoneCode = new Integer(oResult.getString("ZONE_CODE")); Double value = new Double(oResult.getString("ZONE_VALUE")); zonePrices.put(zoneCode, value); myBean.setZoneValues(areaPrices); } I want to use the value of this Map in another method of the same class. For that I have a bean. How do I populate it on the bean, so that I can get the ZONE_VALUE in this other method In my bean I added one new field as: private Map<Integer, Map<Integer, Double>> zoneValues; with getter and setter as: public Map<Integer, Map<Integer, Double>> getZoneValues() { return zoneValues; } public void setZoneValues(Map<Integer, Map<Integer, Double>> areaPrices) { this.zoneValues = areaPrices; } What I am looking for to do in the other method is something like this: Double value = myBean.get(areaCode).get(zoneCode); How do I make it happen :(

    Read the article

  • How to validate integer and float input in asp.net textbox

    - by Rajesh Rolen- DotNet Developer
    I am using below code to validate interger and float in asp.net but if i not enter decimal than it give me error <asp:TextBox ID="txtAjaxFloat" runat="server" /> <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" TargetControlID="txtAjaxFloat" FilterType="Custom, numbers" ValidChars="." runat="server" /> i have this regex also but its giving validation error if i enters only one value after decimal.. http://stackoverflow.com/questions/617826/whats-a-c-regular-expression-thatll-validate-currency-float-or-integer

    Read the article

  • XSLT big integer (int64) handling msxml

    - by Farid Z
    When trying to do math on an big integer (int64) large number in xslt template I get the wrong result since there is no native 64-bit integer support in xslt (xslt number is 64-bit double). I am using msxml 6.0 on Windows XP SP3. Are there any work around for this on Windows? <tables> <table> <table_schem>REPADMIN</table_schem> <table_name>TEST_DESCEND_IDENTITY_BIGINT</table_name> <column> <col_name>COL1</col_name> <identity> <col_min_val>9223372036854775805</col_min_val> <col_max_val>9223372036854775805</col_max_val> <autoincrementvalue>9223372036854775807</autoincrementvalue> <autoincrementstart>9223372036854775807</autoincrementstart> <autoincrementinc>-1</autoincrementinc> </identity> </column> </table> </tables> This test returns true due to overflow (I am assuming) but actually is false if I could tell the xslt processor somehow to use int64 rather than the default 64-bit double for the data since big integer is the actual data type for the numbers in the xml input. <xsl:when test="autoincrementvalue = (col_min_val + autoincrementinc)"> <xsl:value-of select="''"/> </xsl:when> here is the complete template <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <!--Reseed Derby identity column--> <xsl:output omit-xml-declaration='yes' method='text' /> <xsl:param name="stmtsep">;</xsl:param> <xsl:param name="schemprefix"></xsl:param> <xsl:template match="tables"> <xsl:variable name="identitycount" select="count(table/column/identity)"></xsl:variable> <xsl:for-each select="table/column/identity"> <xsl:variable name="table_schem" select="../../table_schem"></xsl:variable> <xsl:variable name="table_name" select="../../table_name"></xsl:variable> <xsl:variable name="tablespec"> <xsl:if test="$schemprefix"> <xsl:value-of select="$table_schem"/>.</xsl:if><xsl:value-of select="$table_name"/></xsl:variable> <xsl:variable name="col_name" select="../col_name"></xsl:variable> <xsl:variable name="newstart"> <xsl:choose> <xsl:when test="autoincrementinc > 0"> <xsl:choose> <xsl:when test="col_max_val = '' and autoincrementvalue = autoincrementstart"> <xsl:value-of select="''"/> </xsl:when> <xsl:when test="col_max_val = ''"> <xsl:value-of select="autoincrementstart"/> </xsl:when> <xsl:when test="autoincrementvalue = (col_max_val + autoincrementinc)"> <xsl:value-of select="''"/> </xsl:when> <xsl:when test="(col_max_val + autoincrementinc) &lt; autoincrementstart"> <xsl:value-of select="autoincrementstart"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="col_max_val + autoincrementinc"/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test="autoincrementinc &lt; 0"> <xsl:choose> <xsl:when test="col_min_val = '' and autoincrementvalue = autoincrementstart"> <xsl:value-of select="''"/> </xsl:when> <xsl:when test="col_min_val = ''"> <xsl:value-of select="autoincrementstart"/> </xsl:when> <xsl:when test="autoincrementvalue = (col_min_val + autoincrementinc)"> <xsl:value-of select="''"/> </xsl:when> <xsl:when test="(col_min_val + autoincrementinc) > autoincrementstart"> <xsl:value-of select="autoincrementstart"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="col_min_val + autoincrementinc"/> </xsl:otherwise> </xsl:choose> </xsl:when> </xsl:choose> </xsl:variable> <xsl:if test="not(position()=1)"><xsl:text> </xsl:text></xsl:if> <xsl:choose> <!--restart with ddl changes both the next identity value AUTOINCREMENTVALUE and the identity start number AUTOINCREMENTSTART eventhough in this casewe only want to change only the next identity number--> <xsl:when test="$newstart != '' and $newstart != autoincrementvalue">alter table <xsl:value-of select="$tablespec"/> alter column <xsl:value-of select="$col_name"/> restart with <xsl:value-of select="$newstart"/><xsl:if test="$identitycount>1">;</xsl:if></xsl:when> <xsl:otherwise>-- reseed <xsl:value-of select="$tablespec"/> is not necessary</xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> </xsl:stylesheet>

    Read the article

  • BitSet to and from integer/long

    - by ataylor
    If I have an integer that I'd like to perform bit manipulation on, how can I load it into a java.util.BitSet? How can I convert it back to an int or long? I'm not so concerned about the size of the BitSet -- it will always be 32 or 64 bits long. I'd just like to use the set(), clear(), nextSetBit(), and nextClearBit() methods rather than bitwise operators, but I can't find an easy way to initialize a bit set with a numeric type.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >