Search Results

Search found 6094 results on 244 pages for 'double gras'.

Page 79/244 | < Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >

  • Computing unique index for every poker starting hand

    - by Aly
    As there are 52 cards in a deck we know there are 52 choose 2 = 1326 distinct matchups, however in preflop poker this can be bucketed into 169 different hands such as AK offsuit and AK suited as whether it is A hearts K hearts or A spade K spades it makes no difference preflop. My question is, is there a nice mathematical property in which I can uniquely index each of these 169 hands (from 0 to 168 preferably). I am trying to create a look up table as a double[][] = new double [169][169] but have no way of changing a hand representation such as AKs (an Ace and a King of the same suit) to a unique index in this array.

    Read the article

  • Word mergefield wildcard not correctly matching

    - by aZn137
    Hello, Below is my mergefield code: { IF { MERGEFIELD Subs_State } = "GA" "blah blah" "{ IF { MERGEFIELD CEOrgStates } = "GA" "blah blah" ""} "} I'm pulling records from a MS Access db. My goal is to check whether a record has Subs_State field matching "GA", or the CEOrgStates has the word "GA" (some records have stuff like "|FL|CA|GA|CT|KY|" (no quotes)). When I merged the docs, Word doesnt seem to be able to match with the wildcards: If I use and compare "*GA" (fields ending with GA), it works; however, the double wildcards "*GA*" dont seem to work at all. Here are the things I’ve tried: Have data in lowercase, then compare with lowercase Have data in lowercase, convert to and then compare with uppercase Do the opposite of the above 2 with uppercase data Use “*GA*” and “*ga*” (no pipe) Use different delimiters Nothing seems to work with the double wildcard matching. What am I doing wrong? Thanks!

    Read the article

  • window.beforeunload called twice in Firefox - how to get around this?

    - by Zarkonnen
    I'm creating a popup window that has a beforeunload handler installed. When the "Close" file menu item is used to close the popup, the beforeunload handler is called twice, resulting in two "Are you sure you want to close this window?" messages appearing. This is a bug with Firefox, and I've reported it here, but I still would like a way to prevent this from happening. Can you think of a sane way of detecting double beforeunload to prevent the double message problem? The problem is that Firefox doesn't tell me which button in the dialog the user elected to click - OK or cancel.

    Read the article

  • Log to rolling CSV file with Enterprise Library

    - by Tinminator
    Need logging to: Rolling file, to avoid 1 big log file. CSV format for easier look up. I can see EntLib (5.0) have Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener to log to rolling log file. To make the log entries look like a CSV row, I can change the Logging.Formatters.TextFormatter.Template to put double quote around the values. Also change the Listener's Footer and Header to nothing, so they won't be output. Under normal circumstance, this would give me a well formed CSV file. However if a token value in the Template contain double quote, this would not be escaped, hence the log file become an invalid CSV file. Is there any way to resolve this? Is there any alternative solutions to this problem?

    Read the article

  • Fixtures and inheritance in Symfony

    - by Tere
    Hi! I have a database schema in Symfony like this: Persona: actAs: { Timestampable: ~ } columns: primer_nombre: { type: string(255), notnull: true } segundo_nombre: { type: string(255) } apellido: { type: string(255), notnull: true } rut: { type: string(255) } email: { type: string(255) } email2: { type: string(255) } direccion: { type: string(400) } ciudad: { type: string(255) } region: { type: string(255) } pais: { type: string(255) } telefono: { type: string(255) } telefono2: { type: string(255) } fecha_nacimiento: { type: date } Alumno: inheritance: type: concrete extends: Persona columns: comentario: { type: string(255) } estado_pago: { type: string(255) } Alumno_Beca: columns: persona_id: { type: integer, primary: true } beca_id: { type: integer, primary: true } relations: Alumno: { onDelete: CASCADE, local: persona_id, foreign: id } Beca: { onDelete: CASCADE, local: beca_id, foreign: id } Beca: columns: nombre: { type: string(255) } monto: { type: double } porcentaje: { type: double } descripcion: { type: string(5000) } As you see, "alumno" has a concrete inheritance from "persona". Now I'm trying to create fixtures for this two tables, and I can't make Doctrine to load them. It gives me this error: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (eat/alumno__beca, CONSTRAINT alumno__beca_persona_id_alumno_id FOREIGN KEY (persona_id) REFERENCES alumno (id) ON DELETE CASCADE) Does someone know how to write a fixture for a table inherited from another? Thanks!

    Read the article

  • Using a type parameter and a pointer to the same type parameter in a function template

    - by Darel
    Hello, I've written a template function to determine the median of any vector or array of any type that can be sorted with sort. The function and a small test program are below: #include <algorithm> #include <vector> #include <iostream> using namespace::std; template <class T, class X> void median(T vec, size_t size, X& ret) { sort(vec, vec + size); size_t mid = size/2; ret = size % 2 == 0 ? (vec[mid] + vec[mid-1]) / 2 : vec[mid]; } int main() { vector<double> v; v.push_back(2); v.push_back(8); v.push_back(7); v.push_back(4); v.push_back(9); double a[5] = {2, 8, 7, 4, 9}; double r; median(v.begin(), v.size(), r); cout << r << endl; median(a, 5, r); cout << r << endl; return 0; } As you can see, the median function takes a pointer as an argument, T vec. Also in the argument list is a reference variable X ret, which is modified by the function to store the computed median value. However I don't find this a very elegant solution. T vec will always be a pointer to the same type as X ret. My initial attempts to write median had a header like this: template<class T> T median(T *vec, size_t size) { sort(vec, vec + size); size_t mid = size/2; return size % 2 == 0 ? (vec[mid] + vec[mid-1]) / 2 : vec[mid]; } I also tried: template<class T, class X> X median(T vec, size_t size) { sort(vec, vec + size); size_t mid = size/2; return size % 2 == 0 ? (vec[mid] + vec[mid-1]) / 2 : vec[mid]; } I couldn't get either of these to work. My question is, can anyone show me a working implementation of either of my alternatives? Thanks for looking!

    Read the article

  • Array of Arrays in C#

    - by Betamoo
    I need to know how to initialize array of arrays in C#.. I know that there exist multidimensional array, but I think I do not need that in my case! I tried this code.. but could not know how to initialize with initializer list.. double[][] a=new double[2][];// ={{1,2},{3,4}}; Thank you PS: If you wonder why I use it: I need data structure that when I call obj[0] it returns an array.. I know it is strange.. Thanks

    Read the article

  • Volatile or synchronized for primitive type?

    - by DKSRathore
    In java, assignment is atomic if the size of the variable is less that or equal to 32 bits but is not if more than 32 bits. What(volatile/synchronized) would be more efficient to use in case of double or long assignment. like, volatile double x = y; synchronized is not applicable with primitive argument. How do i use synchronized in this case. Of course I don't want to lock my class. so this should not be used.

    Read the article

  • How to do pointer work with accessor methods in Objective-C

    - by Jasconius
    Basic problem statement: I have a very good reason for doing some pointer fanciness in an app where I need to pass a decimal by reference. So I have a class which stores many a decimal, so let's say is has a property as such: @property (nonatomic) double myDecimalValue; I want to pass it by reference to some other class. [someOtherObject sendMyDecimalByReference:&myDecimalValue]; But, a problem emerges! The way that actually has to be written (because it's a property) is [someOtherObject sendMyDecimalByReference:&decimalOrigin.myDecimalValue]; This fails to compile in objective-c I get around it by writing the following - (double *) myDecimalValueRef; [someOtherObject sendMyDecimalByReference:[decimalOrigin myDecimalValue]]; Except I have dozens of these decimals and I don't want to write that stupid wrapper function for every value. Is there a shorthand way to do this in Objective-C using just the Getter functions? Let's just assume I have a great reason for not using NSNumber. Thanks!

    Read the article

  • Automatic Schema Validation using NHibernate/ActiveRecord

    - by Krembo
    Hi, let's assume I have a table of Products with columns: Id, Name, Price and using NHibernate (or ActiveRecord) I map the table to the POCO: public class Product { public virtual long Id { get; set; } public virtual string Name { get; set; } public virtual double Price { get; set; } } Now if someday a new column named ShipmentPrice (let's assume it's double too) will be added to the Products table, is there any way I can automatically know that. For saying automatically I mean adding code to do that or getting an exception? (I assume I don't have control on the columns of the table or a way to know of any changes to the table's schema in advance)

    Read the article

  • Access 2007 VBA : Building a listbox with selection choices from another list box

    - by Justin
    So there are 8 categories that may be associated to each order, but not necessarily all of them. So i was going to build a list box that allowed the user to double click each of the category they wish to associate when they have an "Order Detail" form opened up (unbound form that has hidden text boxes with all needed ID numbers). I want to have another empty text box right beside it that will allow me to append the selections (up to 8) so the user can see that they have been added. So one list box with the default choices, and when a choice is double clicked, it adds that choice to the second list box to see the tally so to speak. What is the VB for getting something like this done? Thanks Justin

    Read the article

  • Vertical Scroll not working, are the guides but the screen does not scroll.

    - by Leandro
    package com.lcardenas.infoberry; import net.rim.device.api.system.DeviceInfo; import net.rim.device.api.system.GPRSInfo; import net.rim.device.api.system.Memory; import net.rim.device.api.ui.MenuItem; import net.rim.device.api.ui.component.Dialog; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.component.Menu; import net.rim.device.api.ui.component.SeparatorField; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.container.VerticalFieldManager; import net.rim.device.api.ui.decor.Background; import net.rim.device.api.ui.decor.BackgroundFactory; public class vtnprincipal extends MainScreen { //llamamos a la clase principal private InfoBerry padre; //variables para el menu private MenuItem mnubateria; private MenuItem mnuestado; private MenuItem mnuacerca; public vtnprincipal(InfoBerry padre) { super(); this.padre = padre; } public void incventana(){ VerticalFieldManager _ventana = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL | VerticalFieldManager.VERTICAL_SCROLLBAR); double tmemoria =((DeviceInfo.getTotalFlashSize()/1024)/1024.00); double fmemoria = ((Memory.getFlashFree()/1024)/1024.00); Background cyan = BackgroundFactory.createSolidBackground(0x00E0FFFF); Background gris = BackgroundFactory.createSolidBackground(0x00DCDCDC ); //Borramos todos de la pantalla this.deleteAll(); //llamamos al menu incMenu(); //DIBUJAMOS LA VENTANA try{ LabelField title = new LabelField("Info Berry", LabelField.FIELD_HCENTER | LabelField.USE_ALL_HEIGHT ); setTitle(title); _ventana.add(new LabelField("Información del Dispositivo", LabelField.FIELD_HCENTER |LabelField.RIGHT | LabelField.USE_ALL_HEIGHT | LabelField.NON_FOCUSABLE )); _ventana.add(new SeparatorField()); _ventana.add(new SeparatorField()); txthorizontal modelo = new txthorizontal("Modelo:", DeviceInfo.getDeviceName()); modelo.setBackground(gris); _ventana.add(modelo); txthorizontal pin = new txthorizontal("PIN:" , Integer.toHexString(DeviceInfo.getDeviceId()).toUpperCase()); pin.setBackground(cyan); _ventana.add(pin); txthorizontal imeid = new txthorizontal("IMEID:" , GPRSInfo.imeiToString(GPRSInfo.getIMEI())); imeid.setBackground(gris); _ventana.add(imeid); txthorizontal version= new txthorizontal("SO Versión:" , DeviceInfo.getSoftwareVersion()); version.setBackground(cyan); _ventana.add(version); txthorizontal plataforma= new txthorizontal("SO Plataforma:" , DeviceInfo.getPlatformVersion()); plataforma.setBackground(gris); _ventana.add(plataforma); txthorizontal numero= new txthorizontal("Numero Telefonico: " , "Hay que firmar"); numero.setBackground(cyan); _ventana.add(numero); _ventana.add(new SeparatorField()); _ventana.add(new SeparatorField()); _ventana.add(new LabelField("Memoria", LabelField.FIELD_HCENTER | LabelField.USE_ALL_HEIGHT | LabelField.NON_FOCUSABLE)); _ventana.add(new SeparatorField()); txthorizontal totalm= new txthorizontal("Memoria app Total:" , mmemoria(tmemoria) + " Mb"); totalm.setBackground(gris); _ventana.add(totalm); txthorizontal disponiblem= new txthorizontal("Memoria app Disponible:" , mmemoria(fmemoria) + " Mb"); disponiblem.setBackground(cyan); _ventana.add(disponiblem); ///txthorizontal estadoram = new txthorizontal("Memoria RAM:" , mmemoria(prueba) + " Mb"); //estadoram.setBackground(gris); //add(estadoram); _ventana.add(new SeparatorField()); _ventana.add(new SeparatorField()); this.add(_ventana); }catch(Exception e){ Dialog.alert("Excepción en clase vtnprincipal: " + e.toString()); } } //DIBUJAMOS EL MENU private void incMenu() { MenuItem.separator(30); mnubateria = new MenuItem("Bateria",40, 10) { public void run() { bateria(); } }; mnuestado = new MenuItem("Estado de Red", 50, 10) { public void run() { estado(); } }; mnuacerca = new MenuItem("Acerca de..", 60, 10) { public void run() { acerca(); } }; MenuItem.separator(70); }; // public void makeMenu(Menu menu, int instance) { if (!menu.isDisplayed()) { menu.deleteAll(); menu.add(MenuItem.separator(30)); menu.add(mnubateria); menu.add(mnuestado); menu.add(mnuacerca); menu.add(MenuItem.separator(60)); } } public void bateria(){ padre.vtnbateria.incventana(); padre.pushScreen(padre.vtnbateria); } public void estado(){ padre.vtnestado.incventana(); padre.pushScreen(padre.vtnestado); } public void acerca(){ padre.vtnacerca.incventana(); padre.pushScreen(padre.vtnacerca); } public boolean onClose(){ Dialog.alert("Hasta Luego"); System.exit(0); return true; } public double mmemoria(double x) { if ( x > 0 ) return Math.floor(x * 100) / 100; else return Math.ceil(x * 100) / 100; } }

    Read the article

  • Function pointer arrays in Fortran

    - by Eduardo Dobay
    I can create function pointers in Fortran 90, with code like real, external :: f and then use f as an argument to another function/subroutine. But what if I want an array of function pointers? In C I would just do double (*f[])(int); to create an array of functions returning double and taking an integer argument. I tried the most obvious, real, external, dimension(3) :: f but gfortran doesn't let me mix EXTERNAL and DIMENSION. Is there any way to do what I want? (The context for this is a program for solving a system of differential equations, so I could input the equations without having a million parameters in my subroutines.)

    Read the article

  • C# - Angle between two 2d vectors, diff between two methods?

    - by Sean Ochoa
    Hey all. I've got this code snippet, and I'm wondering why the results of the first method differ from the results of the second method, given the same input? public double AngleBetween_1(vector a, vector b) { var dotProd = a.Dot(b); var lenProd = Len*b.Len; var divOperation = dotProd/lenProd; return Math.Acos(divOperation) * (180.0 / Math.PI); } public double AngleBetween_2(vector a, vector b) { var dotProd = a.Dot(b); var lenProd = Len*b.Len; var divOperation = dotProd/lenProd; return (1/Math.Cos(divOperation)) * (180.0 / Math.PI); }

    Read the article

  • Help Understanding Function

    - by Fred F.
    What does the following function perform? public static double CleanAngle(double angle) { while (angle < 0) angle += 2 * System.Math.PI; while (angle > 2 * System.Math.PI) angle -= 2 * System.Math.PI; return angle; } This is how it is used with ATan2. I believe the actually values passed to ATan2 are always positive. static void Main(string[] args) { int q = 1; //'x- and y-coordinates will always be positive values //'therefore, do i need to "clean"? foreach (Point oPoint in new Point[] { new Point(8,20), new Point(-8,20), new Point(8,-20), new Point(-8,-20)}) { Debug.WriteLine(Math.Atan2(oPoint.Y, oPoint.X), "unclean " + q.ToString()); Debug.WriteLine(CleanAngle(Math.Atan2(oPoint.Y, oPoint.X)), "cleaned " + q.ToString()); q++; } //'output //'unclean 1: 1.19028994968253 //'cleaned 1: 1.19028994968253 //'unclean 2: 1.95130270390726 //'cleaned 2: 1.95130270390726 //'unclean 3: -1.19028994968253 //'cleaned 3: 5.09289535749705 //'unclean 4: -1.95130270390726 //'cleaned 4: 4.33188260327232 }

    Read the article

  • Sorting List which has object that contains two string members that contains numbers

    - by Lemo
    I want to know the best solution for this my case here is that i am taking values from Excel sheet and pushing them to database field, sometimes that field might contain some strings (thats why I cant make my object members int / double) In my class below size is the variable responsible for showing size of files in bytes public class dataNameValue { public string Name { get; set; } public string Count { get; set; } public string Size { get; set; } } I wanted to sort the list by file Size something like List mylist = new List(); mylist = mylist.OrderByDescending(i = i.Size).ToList(); The problem is that if i sorted it without converting it to "int/double" first -- its not giving right results

    Read the article

  • Polygon area calculation using Latitude and Longitude generated from Cartesian space and a world fil

    - by Heath
    Given a series of GPS coordinate pairs, I need to calculate the area of a polygon (n-gon). This is relatively small (not larger than 50,000 sqft). The geocodes are created by applying an affine transform with data from a world file. I have tried to use a two step approach by doing converting the geocodes to cartesian coordinates: double xPos = (lon-lonAnchor)*( Math.toRadians( 6378137 ) )*Math.cos( latAnchor ); double yPos = (lat-latAnchor)*( Math.toRadians( 6378137 ) ); then I use a cross product calculation to determine the area. The issue is that the results are a bit off in accuracy (around 1%). Is there anything I can look into to improve this? Thanks.

    Read the article

  • Mobile Safari Geolocation API Issues

    - by sph
    Hi, since Mobile Safari's Geolocation API should be an implementation of the W3C Geolocation API I found some bugs. I was wondering if anybody noticed the same. As specified in the W3C Geolocation API the PositionCallback returns a Position object, which contains a Coordinates object. In this object all attributes are of type double. Using navigator.geolocation.getCurrentPosition and checking the Position object in the successCallback the accuracy attribute is always an object, but should be a double. The heading attribute is always -1 when testing in the iPhone simulator, but should be null or between 0 and 360. 2. Setting the options parameter for navigator.geolocation.watchPosition or navigator.geolocation.getCurrentPosition as specified in the W3C Geolocation API has no effect. No matter what is set as the timeout value, the win callback is called every 10 seconds. For example setting the timeout=1000 should immediately call either the successCallback or errorCallback. Thanks

    Read the article

  • Problem with building tree bottom up

    - by Esmond
    Hi, I have problems building a binary tree from the bottom up. THe input of the tree would be internal nodes of the trees with the children of this node being the leaves of the eventual tree. So initially if the tree is empty the root would be the first internal node. Afterwards, The next internal node to be added would be the new root(NR), with the old root(OR) being one of the child of NR. And so on. The problem i have is that whenever i add a NR, the children of the OR seems to be lost when i do a inOrder traversal. This is proven to be the case when i do a getSize() call which returns the same number of nodes before and after addNode(Tree,Node) Any help with resolving this problem is appreciated edited with the inclusion of node class code. both tree and node classes have the addChild methods because i'm not very sure where to put them for it to be appropriated. any comments on this would be appreciated too. The code is as follows: import java.util.*; public class Tree { Node root; int size; public Tree() { root = null; } public Tree(Node root) { this.root = root; } public static void setChild(Node parent, Node child, double weight) throws ItemNotFoundException { if (parent.child1 != null && parent.child2 != null) { throw new ItemNotFoundException("This Node already has 2 children"); } else if (parent.child1 != null) { parent.child2 = child; child.parent = parent; parent.c2Weight = weight; } else { parent.child1 = child; child.parent = parent; parent.c1Weight = weight; } } public static void setChild1(Node parent, Node child) { parent.child1 = child; child.parent = parent; } public static void setChild2(Node parent, Node child) { parent.child2 = child; child.parent = parent; } public static Tree addNode(Tree tree, Node node) throws ItemNotFoundException { Tree tree1; if (tree.root == null) { tree.root = node; } else if (tree.root.getSeq().equals(node.getChild1().getSeq()) || tree.root.getSeq().equals(node.getChild2().getSeq())) { Node oldRoot = tree.root; oldRoot.setParent(node); tree.root = node; } else { //form a disjoint tree and merge the 2 trees tree1 = new Tree(node); tree = mergeTree(tree, tree1); } System.out.print("addNode2 = "); if(tree.root != null ) { Tree.inOrder(tree.root); } System.out.println(); return tree; } public static Tree mergeTree(Tree tree, Tree tree1) { String root = "root"; Node node = new Node(root); tree.root.setParent(node); tree1.root.setParent(node); tree.root = node; return tree; } public static int getSize(Node root) { if (root != null) { return 1 + getSize(root.child1) + getSize(root.child2); } else { return 0; } } public static boolean isEmpty(Tree Tree) { return Tree.root == null; } public static void inOrder(Node root) { if (root != null) { inOrder(root.child1); System.out.print(root.sequence + " "); inOrder(root.child2); } } } public class Node { Node child1; Node child2; Node parent; double c1Weight; double c2Weight; String sequence; boolean isInternal; public Node(String seq) { sequence = seq; child1 = null; c1Weight = 0; child2 = null; c2Weight = 0; parent = null; isInternal = false; } public boolean hasChild() { if (this.child1 == null && this.child2 == null) { this.isInternal = false; return isInternal; } else { this.isInternal = true; return isInternal; } } public String getSeq() throws ItemNotFoundException { if (this.sequence == null) { throw new ItemNotFoundException("No such node"); } else { return this.sequence; } } public void setChild(Node child, double weight) throws ItemNotFoundException { if (this.child1 != null && this.child2 != null) { throw new ItemNotFoundException("This Node already has 2 children"); } else if (this.child1 != null) { this.child2 = child; this.c2Weight = weight; } else { this.child1 = child; this.c1Weight = weight; } } public static void setChild1(Node parent, Node child) { parent.child1 = child; child.parent = parent; } public static void setChild2(Node parent, Node child) { parent.child2 = child; child.parent = parent; } public void setParent(Node parent){ this.parent = parent; } public Node getParent() throws ItemNotFoundException { if (this.parent == null) { throw new ItemNotFoundException("This Node has no parent"); } else { return this.parent; } } public Node getChild1() throws ItemNotFoundException { if (this.child1 == null) { throw new ItemNotFoundException("There is no child1"); } else { return this.child1; } } public Node getChild2() throws ItemNotFoundException { if (this.child2 == null) { throw new ItemNotFoundException("There is no child2"); } else { return this.child2; } } }

    Read the article

  • jQuery / jqgrid / Editing form events

    - by MiBol
    I'm working with the jqGrid and I want to know if exists an event to read a double click in the Editing Form? Has example: I have a grid with ColumnA and ColumnB. I want read the event when the user perform a double click under ColumnB (In the Editing Form). Thanks! I found the solution of my problem ^^ Here is the code, to this example I use the alert "TEST!!!"... [Thanks to Oleg to wake up my mind :P] In the colModel { name: 'Total_uploads', index: 'Total_uploads', width: '100', editable: true, edittype: 'text', editoptions: { size: 10, maxlength: '20', dataInit: function (el) { $(el).click(function () { alert("TEST!!!"); }); } }, editrules: { required: true }, formoptions: { label: 'Total uploads: ', elmsuffix: '&nbsp;&nbsp; <span style="color : #0C66BE; font-family: Calibri">(*)</span>' } }

    Read the article

  • How to best integrate generated code

    - by Arne
    I am evaluating the use of code generation for my flight simulation project. More specifically there is a requirement to allow "the average engineer" (no offense I am one myself) to define the differential equations that describe the dynamic system in a more natural syntax than C++ provides. The idea is to devise a abstract descriptor language that can be easily understood and edited to generate C++ code from. This descriptor is supplied by the modeling engineer and used by the ones implementing and maintaining the simulation evironment to generate code. I've got something like this in mind: model Aircraft has state x1, x2; state x3; input double : u; input bool : flag1, flag2; algebraic double : x1x2; model Engine : tw1, tw2; model Gear : gear; model ISA : isa; trim routine HorizontalFight; trim routine OnGround, General; constant double : c1, c2; constant int : ci1; begin differential equations x1' = x1 + 2.*x2; x2' = x2 + x1x2; begin algebraic equations x1x2 = x1*x2 + x1'; end model It is important to retain the flexibility of the C language thus the descriptor language is meant to only define certain parts of the definition and implementation of the model class. This way one enigneer provides the model in from of the descriptor language as examplified above and the maintenance enigneer will add all the code to read parameters from files, start/stop/pause the execution of the simulation and how a concrete object gets instatiated. My first though is to either generate two files from the descriptor file: one .h file containing declarations and one .cpp file containing the implementation of certain functions. These then need to be #included at appropriate places [File Aircarft.h] class Aircraft { public: void Aircraft(..); // hand-written constructor void ReadParameters(string &file_name); // hand-written private: /* more hand wirtten boiler-plate code */ /* generate declarations follow */ #include "Aircraft.generated.decl" }; [File Aircraft.cpp] Aircarft::Aircraft(..) { /* hand-written constructer implementation */ } /* more hand-written implementation code */ /* generated implementation code follows */ #include "Aircraft.generated.impl" Any thoughts or suggestions?

    Read the article

  • Memory in Eclipse

    - by user247866
    I'm getting the java.lang.OutOfMemoryError exception in Eclipse. I know that Eclipse by default uses heap size of 256M. I'm trying to increase it but nothing happens. For example: eclipse -vmargs -Xmx16g -XX:PermSize=2g -XX:MaxPermSize=2g I also tried different settings, using only the -Xmx option, using different cases of g, G, m, M, different memory sizes, but nothing helps. Does not matter which params I specify, the heap exception is thrown at the same time, so I assume there's something I'm doing wrong that Eclipse ignores the -Xmx parameter. I'm using a 32GB RAM machine and trying to execute something very simple such as: double[][] a = new double[15000][15000]; It only works when I reduce the array size to something around 10000 on 10000. I'm working on Linux and using the top command I can see how much memory the Java process is consuming; it's less than 2%. Thanks!

    Read the article

  • bin_at in dlmalloc

    - by chunhui
    In glibc malloc.c or dlmalloc It said "repositioning tricks"As in blew, and use this trick in bin_at. bins is a array,the space is allocated when av(struct malloc_state) is allocated.doesn't it? the sizeof(bin[i]) is less then sizeof(struct malloc_chunk*)? Who can describe this trick for me? I can't understand the bin_at macro.why they get the bins address use this method?how it works? Very thanks,and sorry for my poor English. /* To simplify use in double-linked lists, each bin header acts as a malloc_chunk. This avoids special-casing for headers. But to conserve space and improve locality, we allocate only the fd/bk pointers of bins, and then use repositioning tricks to treat these as the fields of a malloc_chunk*. */ typedef struct malloc_chunk* mbinptr; /* addressing -- note that bin_at(0) does not exist */ #define bin_at(m, i) \ (mbinptr) (((char *) &((m)->bins[((i) - 1) * 2])) \ - offsetof (struct malloc_chunk, fd)) The malloc_chunk struct like this: struct malloc_chunk { INTERNAL_SIZE_T prev_size; /* Size of previous chunk (if free). */ INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */ struct malloc_chunk* fd; /* double links -- used only if free. */ struct malloc_chunk* bk; /* Only used for large blocks: pointer to next larger size. */ struct malloc_chunk* fd_nextsize; /* double links -- used only if free. */ struct malloc_chunk* bk_nextsize; }; And the bin type like this: typedef struct malloc_chunk* mbinptr; struct malloc_state { /* Serialize access. */ mutex_t mutex; /* Flags (formerly in max_fast). */ int flags; #if THREAD_STATS /* Statistics for locking. Only used if THREAD_STATS is defined. */ long stat_lock_direct, stat_lock_loop, stat_lock_wait; #endif /* Fastbins */ mfastbinptr fastbinsY[NFASTBINS]; /* Base of the topmost chunk -- not otherwise kept in a bin */ mchunkptr top; /* The remainder from the most recent split of a small request */ mchunkptr last_remainder; /* Normal bins packed as described above */ mchunkptr bins[NBINS * 2 - 2]; /* Bitmap of bins */ unsigned int binmap[BINMAPSIZE]; /* Linked list */ struct malloc_state *next; #ifdef PER_THREAD /* Linked list for free arenas. */ struct malloc_state *next_free; #endif /* Memory allocated from the system in this arena. */ INTERNAL_SIZE_T system_mem; INTERNAL_SIZE_T max_system_mem; };

    Read the article

  • What is the equivalent of <composite-element> in Castle ActiveRecord?

    - by Daniel T.
    I have a TrackLog that has a collection of TrackPoints: public class TrackLog { public string Name { get; set; } public ISet<TrackPoint> TrackPoints { get; set; } } public class TrackPoint { public DateTime Timestamp { get; set; } public double Latitude { get; set; } public double Longitude { get; set; } } I'd like to map the track points as a collection of components, as this makes the most sense. According to the book NHibernate in Action, on page 187: Collections of components are mapped similarily to other collections of value type instances. The only difference is the use of <composite-element> in place of the familiar <element> tag. How would I do this using Castle ActiveRecord attributes?

    Read the article

< Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >