Search Results

Search found 10025 results on 401 pages for 'state restoration'.

Page 117/401 | < Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >

  • newline character on text area

    - by Prady
    I have a custom field called Current_Address__c which is of datatype textarea. I need to populate this field in the format below. ie a newline char after street and another newline after zip. street City state Zip Country The values of city state zip country etc are been taken from contact object. I dont want to use this as a formula field. So i need to populate it in my controller and display it on my VF page. I am trying to add a newline char by using the code below this.customobj.Current_Address__c = currentStreet + '\\n ' + currentCity + ' ' + currentState + ' ' + currentZIP + '\\n ' + currentCountry ; i had also used \n instead of \n. It still show the field in one line instead of 3 lines

    Read the article

  • Java replacement for C macros

    - by thkala
    Recently I refactored the code of a 3rd party hash function from C++ to C. The process was relatively painless, with only a few changes of note. Now I want to write the same function in Java and I came upon a slight issue. In the C/C++ code there is a C preprocessor macro that takes a few integer variables names as arguments and performs a bunch of bitwise operations with their contents and a few constants. That macro is used in several different places, therefore its presence avoids a fair bit of code duplication. In Java, however, there is no equivalent for the C preprocessor. There is also no way to affect any basic type passed as an argument to a method - even autoboxing produces immutable objects. Coupled with the fact that Java methods return a single value, I can't seem to find a simple way to rewrite the macro. Avenues that I considered: Expand the macro by hand everywhere: It would work, but the code duplication could make things interesting in the long run. Write a method that returns an array: This would also work, but it would repeatedly result into code like this: long tmp[] = bitops(k, l, m, x, y, z); k = tmp[0]; l = tmp[1]; m = tmp[2]; x = tmp[3]; y = tmp[4]; z = tmp[5]; Write a method that takes an array as an argument: This would mean that all variable names would be reduced to array element references - it would be rather hard to keep track of which index corresponds to which variable. Create a separate class e.g. State with public fields of the appropriate type and use that as an argument to a method: This is my current solution. It allows the method to alter the variables, while still keeping their names. It has the disadvantage, however, that the State class will get more and more complex, as more macros and variables are added, in order to avoid copying values back and forth among different State objects. How would you rewrite such a C macro in Java? Is there a more appropriate way to deal with this, using the facilities provided by the standard Java 6 Development Kit (i.e. without 3rd party libraries or a separate preprocessor)?

    Read the article

  • Is it possible to tie a subscription to a iTunes account with in-app purhcase?

    - by erotsppa
    We're trying to implement a subscription service with in-app purchase in our app. The problem is our service does not require a user account for the past year of service. Users simply use this service with advertisements shown. We want to give them a subscription where they can buy for say, 3 months to have the advertisement removed. How can this be done? We'll have to make it a consumable because it is a subscription. But we wouldn't know when the subscription end. We can't save the state locally because the user might reinstall the app We can't save the state on the server and tie it to their device because sometimes the user changes device We don't have a user account to tie the subscription to and we don't want to introduce a user account system which spoils the experience. Is there some way of associating the purchase with their iTunes account? So that it is carried with them when they reinstall or changes device?

    Read the article

  • Flex Problem Enabling and Disabling Button in List

    - by pfunc
    I have a list with a dataprovider, it lists out buttons encapsulated in an item renderer. All I want it to do is have a skin that it changes to when it is clicked. I can get this to happen, but then it just goes back to its up state. I want it to stick on the down state, which I have to do by disabling the button. So I tried this: buttonList.selectedItem.enabled = false; for(var i:Number = 0; i< buttonList.numChildren; i++) { var loopBtn = buttonList.getChildAt(i); if(loopBtn != buttonList.selectedItem) { loopBtn.enabled = true; } } But this doesn't seem to work. What am I doing wrong here?

    Read the article

  • how to update date using phpmysql

    - by DAFFODIL
    This is how,i insert data into db,but now,i want a particular column to update,how do i do? $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("form", $con); $sql="INSERT INTO Customer (Name, Address, City, Pincode, State, Country, Phone, Mobile, Fax, Email, Website, Notes) VALUES ('$_POST[name]','$_POST[address]','$_POST[city]','$_POST[pincode]','$_POST[state]','$_POST[country]','$_POST[phone]','$_POST[mobile]','$_POST[fax]','$_POST[email]','$_POST[url]','$_POST[notes]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); ?

    Read the article

  • jquery-ui icons

    - by cf_PhillipSenn
    I understand that if I use this: <script src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("jquery", "1"); google.load("jqueryui", "1"); </script> <span class="ui-icon ui-icon-arrowthick-1-n"></span> Then an arrow appears. I don't understand how to wrap the arrow with this: ui-state-default ui-corner-all because themeroller is using list items, and I'm using table head cells. I don't want to use: <th class="ui-state-default ui-corner-all"> because that highlights the entire cell.

    Read the article

  • How can I build a list of world geo locations and their relative geographical hierarchies?

    - by Nathan Ridley
    I want to build a database of geographical locations and would like to be able to identify locations that fall inside other locations. For example, The Empire State Building is going to have one geo-coordinate, but my database would be able to tell me that it falls inside Manhattan, which falls inside New York City, which is in the state of New York and so forth. I've been looking at OpenStreetMap which seems to have a pretty decent database but as best I can tell, I would need to create a set of polygon structures representing each region and then detect if a coordinate falls inside a given region's polygon. Is there a better way to do this, or is there a data source where all of this has already been calculated?

    Read the article

  • 'Static/Constant' business ojects

    - by UpTheCreek
    I don't quite know how to ask this question, so I'll phase it as an example: Imagine in an application you have a Country object. There are two properties of this object: Name, and a 'Bordering Countries' collection. More properties might be added later, but it will be the kind of information that would change very rarely (e.g. changes of country names/borders) Lets say this application needs to know about all of the countries in the world. Where would you store these object's state? How would you new them up? It seems silly to store all this state in the DB, since it won't change very often. One option might be to have an abstract 'country' base object, and have a class for each country inheriting from this with the details of each country. But this doesn't seem quite right to me. What is the proper way of dealing with these kinds of objects?

    Read the article

  • C# - LINQ Statements with OR clauses

    - by user70192
    Hello, I am trying to use LINQ to return a list of tasks that are in one of three states. These states are: 10 - Completed 11 - Incomplete 12 - Skipped The state is available through a property called "TaskStateID". I can do this in LINQ with just one state as shown here: var filteredTasks = from task in tasks select task; // Do stuff with filtered tasks string selectedComboBoxValue = GetFilterComboBoxValue(); if (selected ComboBoxValue == 3) { filteredTasks = filteredTasks.Where(p => p.TaskStateID == 10); // How do I use an 'OR' here to say p.TaskStateID == 10 OR p.TaskStateID == 11 OR p.TaskStateID == 12 } As shown in the comment above, how do I use an 'OR' in a LINQ statement to say p.TaskStateID == 10 OR p.TaskStateID == 11 OR p.TaskStateID == 12? Thank you

    Read the article

  • Ruby on Rails: one-to-one mapping. Just semantics or really a different structure.

    - by Sam
    So I'm creating a plugin for Ruby on Rails to make implemented addresses including country, state, city, and zip_code for countries that can follow that paradigm a lot easier but that's beside the point expect for how the address model is associated. So starting with my address model. class Address < ActiveRecord::Base has_one :country has_one :state has_one :city has_one :zip_code end What's the difference between saying belongs_to and has_one Seems to be the same thing because both only require one model to declare ownership and foreign_key And it also seems that both are logical to say. an address belongs to an account and an account has one address Is this only semantics or is there are real difference

    Read the article

  • Robust way to save/load objects with dependencies?

    - by mrteacup
    I'm writing an Android game in Java and I need a robust way to save and load application state quickly. The question seems to apply to most OO languages. To understand what I need to save: I'm using a Strategy pattern to control my game entities. The idea is I have a very general Entity class which e.g. stores the location of a bullet/player/enemy and I then attach a Behaviour class that tells the entity how to act: class Entiy { float x; float y; Behavior b; } abstract class Behavior { void update(Entity e); {} // Move about at a constant speed class MoveBehavior extends Behavior { float speed; void update ... } // Chase after another entity class ChaseBehavior extends Behavior { Entity target; void update ... } // Perform two behaviours in sequence class CombineBehavior extends Behavior { Behaviour a, b; void update ... } Essentially, Entity objects are easy to save but Behaviour objects can have a semi-complex graph of dependencies between other Entity objects and other Behaviour objects. I also have cases where a Behaviour object is shared between entities. I'm willing to change my design to make saving/loading state easier, but the above design works really well for structuring the game. Anyway, the options I've considered are: Use Java serialization. This is meant to be really slow in Android (I'll profile it sometime). I'm worried about robustness when changes are made between versions however. Use something like JSON or XML. I'm not sure how I would cope with storing the dependencies between objects however. Would I have to give each object a unique ID and then use these IDs on loading to link the right objects together? I thought I could e.g. change the ChaseBehaviour to store a ID to an entity, instead of a reference, that would be used to look up the Entity before performing the behaviour. I'd rather avoid having to write lots of loading/saving code myself as I find it really easy to make mistakes (e.g. forgetting to save something, reading things out in the wrong order). Can anyone give me any tips on good formats to save to or class designs that make saving state easier?

    Read the article

  • SQL Server 2008 - Get Geography From Record

    - by user336786
    Hello, I am new to using the geography types in SQL Server 2008. I have a table in my database called "Location". "Location" has the following columns and types: Location -------- City nvarchar(256) State nvarchar(256) PostalCode nvarchar(25) Latitude decimal(9, 6) Longitude decimal(9, 6) Each Location is related to a Store record in my database. I am trying to find the stores within a 10 mile radius or postal code or city/state that a user enters. To accomplish this, I know that I need to rely on geographies. At this time I have: DECLARE @startingPoint geography; SET @startingPoint=geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); That gives me the starting point from a hard-coded textual value. However, I do not know how to convert a lat/long from my Location table into a geography instance. How do I convert a lat/long in my database to a geography instance so I can continue to work on my query? Thank you!

    Read the article

  • Database triggers / referential integrity and in-memory caching

    - by Ran Biron
    Do you see database triggers / referential integrity rules being used in a way that changes actual data in the database (changing row w in table x causes a change in row y in table z)? If yes, How does this tie-in with the increasing popularity of in-memory caching (memcache and friends)? After all, these actions occur inside the database but the caching system must be aware of them in order to reflect to correct state (or at least invalidate the possibly changed state). I find it hard to believe that callbacks are implemented for such cases. Does anyone have real-world experience with such a setup / real-world experience with considering such a setup and abandoning it (which way did you go? if caching, how do you enforce integrity?)

    Read the article

  • Listing and deleting Git commits that are under no branch (dangling?)

    - by Samer Abukhait
    I've got a git repository with plenty of commits that are under no particular branch, I can git show them but when I try to list branches that contain them, it reports back nothing: I thought this is the dangling commits/tree issue (as a result of -D branch), so I pruned the repo, but I still see the case after that: $ git fetch origin $ git fsck --unreachable $ git fsck No output, nothing dangling (right?) $ git show 793db7f272ba4bbdd1e32f14410a52a412667042 commit 793db7f272ba4bbdd1e32f14410a52a412667042 Author: .. But $ git branch --contains 793db7f272ba4bbdd1e32f14410a52a412667042 Gives no output What exactly is the state of that commit? How can I list all commits with similar state, How can I delete commits like those?

    Read the article

  • Is there any way to determine what type of memory the segments returned by VirtualQuery() are?

    - by bdbaddog
    Greetings, I'm able to walk a processes memory map using logic like this: MEMORY_BASIC_INFORMATION mbi; void *lpAddress=(void*)0; while (VirtualQuery(lpAddress,&mbi,sizeof(mbi))) { fprintf(fptr,"Mem base:%-10x start:%-10x Size:%-10x Type:%-10x State:%-10x\n", mbi.AllocationBase, mbi.BaseAddress, mbi.RegionSize, mbi.Type,mbi.State); lpAddress=(void *)((unsigned int)mbi.BaseAddress + (unsigned int)mbi.RegionSize); } I'd like to know if a given segment is used for static allocation, stack, and/or heap and/or other? Is there any way to determine that?

    Read the article

  • How to create a non-persistent Elixir/SQLAlchemy object?

    - by siebert
    Hi, because of legacy data which is not available in the database but some external files, I want to create a SQLAlchemy object which contains data read from the external files, but isn't written to the database if I execute session.flush() My code looks like this: try: return session.query(Phone).populate_existing().filter(Phone.mac == ident).one() except: return self.createMockPhoneFromLicenseFile(ident) def createMockPhoneFromLicenseFile(self, ident): # Some code to read necessary data from file deleted.... phone = Phone() phone.mac = foo phone.data = bar phone.state = "Read from legacy file" phone.purchaseOrderPosition = self.getLegacyOrder(ident) # SQLAlchemy magic doesn't seem to work here, probably because we don't insert the created # phone object into the database. So we set the id fields manually. phone.order_id = phone.purchaseOrderPosition.order_id phone.order_position_id = phone.purchaseOrderPosition.order_position_id return phone Everything works fine except that on a session.flush() executed later in the application SQLAlchemy tries to write the created Phone object to the database (which fortunatly doesn't succeed, because phone.state is longer than the data type allows), which breaks the function which issues the flush. Is there any way to prevent SQLAlchemy from trying to write such an object? Ciao, Steffen

    Read the article

  • Sql server management studio reporting "The semaphore timeout period has expired."

    - by nis-simonsen
    On our development sql server, executing any query containing more than approximately 700 characters stalls for about 10 seconds and then reports the following error: Msg 121, Level 20, State 0, Line 0 A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.) for example, this query select * from FooTable where id = ' (.. and then 700 spaces ..) ' fails fails with the timeout error while this one select * from FooTable where id = ' (.. and then 600 spaces ..) ' fails with the expected Msg 8169, Level 16, State 2, Line 1 Conversion failed when converting from a character string to uniqueidentifier. - immediately. Indeed, throwing any query, including random garbage at our dev sql server exhibits this behaviour, while any other sql server I have available acts as expected, so I would think that the query never actually gets to parsing on the server. I'm at a loss here - any hints?

    Read the article

  • Intercept close Popup from Parent Page

    - by sangi
    Hi all, I have a question. In an html page, I have javascript code that allows me to open and close a popup window by clicking on a link displayed in the link, so the text displayed in the link changes to the state of the popup window (open-closed). With a variable true / false I manage the opening and closing of the popup window to click on a link whose text is aligned "opened popup" / "closed popup". The next step is to make this same change in state (true / false, "opened popup" / "close popup") directly by closing the popup window. The idea is to not have to refresh the page. Is this possible? Thank you and best regards

    Read the article

  • Gesture recognizer for mouse down and up in iPhone SDK

    - by user545201
    I want to catch both mouse down and mouse up using gesture recognizer. However, when the mouse down is caught, mouse up is never caught. Here's what I did: First create a custom MouseGestureRecognizer: @implementation MouseGestureRecognizer -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; self.state = UIGestureRecognizerStateRecognized; } -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; self.state = UIGestureRecognizerStateRecognized; } @end Then bind the recognizer to a view in view controller: UIGestureRecognizer *recognizer = [MouseGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)]; [self.view addGestureRecognizer:recognizer]; When I click mouse in the view, the touchesBegan is called, but touchesEnded is never called. Is it because of the UIGestureRecognizerStateRecognized? Any advice will be appreciated! Thanks!

    Read the article

  • What would be the best schema to store the 'address' for different entities?

    - by Cesar
    Suppose we're making a system where we have to store the addrees for buildings, persons, cars, etc. The address 'format' should be something like: State (From a State list) County (From a County List) Street (free text, like '5th Avenue') Number (free text, like 'Chrysler Building, Floor 10, Office No. 10') (Yes I don't live in U.S.A) What would be the best way to store that info: Should I have a Person_Address, Car_Address, ... Or the address info should be in columns on each entity, Could we have just one address table and try to link each row to a different entity? Or are there another 'better' way to handle this type of scenario? How would yo do it?

    Read the article

  • How do I drop a foerign key in mssql?

    - by mmattax
    I have created a foreign key (in mssql / tsql) by: alter table company add CountryID varchar(3); alter table company add constraint Company_CountryID_FK foreign key(CountryID) references Country; I then run this query: alter table company drop column CountryID; and I get this error: Msg 5074, Level 16, State 4, Line 2 The object 'Company_CountryID_FK' is dependent on column 'CountryID'. Msg 4922, Level 16, State 9, Line 2 ALTER TABLE DROP COLUMN CountryID failed because one or more objects access this column. I have tried this, yet it does not seem to work: alter table company drop foreign key Company_CountryID_FK; alter table company drop column CountryID; What do I need to do to drop the CountryID column? Thanks.

    Read the article

  • Best practices for multiple asserts on same result in C#

    - by asdseee
    What do you think is cleanest way of doing multiple asserts on a result? In the past I've put them all the same test but this is starting to feel a little dirty, I've just been playing with another idea using setup. [TestFixture] public class GridControllerTests { protected readonly string RequestedViewId = "A1"; protected GridViewModel Result { get; set;} [TestFixtureSetUp] public void Get_UsingStaticSettings_Assign() { var dataRepository = new XmlRepository("test.xml"); var settingsRepository = new StaticViewSettingsRepository(); var controller = new GridController(dataRepository, settingsRepository); this.Result = controller.Get(RequestedViewId); } [Test] public void Get_UsingStaticSettings_NotNull() { Assert.That(this.Result,Is.Not.Null); } [Test] public void Get_UsingStaticSettings_HasData() { Assert.That(this.Result.Data,Is.Not.Null); Assert.That(this.Result.Data.Count,Is.GreaterThan(0)); } [Test] public void Get_UsingStaticSettings_IdMatches() { Assert.That(this.Result.State.ViewId,Is.EqualTo(RequestedViewId)); } [Test] public void Get_UsingStaticSettings_FirstTimePageIsOne() { Assert.That(this.Result.State.CurrentPage, Is.EqualTo(1)); } }

    Read the article

  • Gridview adding row dynamically on RowDataBound with the same RowState (Alternate or Normal)

    - by rob waminal
    I am adding rows dynamically on code behind depending on the Row currently bounded on RowDataBound event. I want that added row to be the same state (Alternate or Normal) of the currently bounded row is this possible? I'm doing something like this but it doesn't follow what I want. I'm expecting the added row dynamically would be the same as the current row. But it is not. protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.DataRow) { GVData data = e.Row.DataItem as GVData; // not original object just for brevity if(data.AddHiddenRow) { // the row state here should be the same as the current GridViewRow tr = new GridViewRow(e.Row.RowIndex +1, e.Row.RowIndex + 1, DataControlRowType.DataRow, e.Row.RowState); TableCell newTableCell = new TableCell(); newTableCell.Style.Add("display", "none"); tr.Cells.Add(newTableCell); ((Table)e.Row.Parent).Rows.Add(tr); } } }

    Read the article

< Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >