magento admin - retrieve current selected store in a multistore backend - magento-1.4

is it possible to retrieve the current selected store view in a multi store magento backend? i'm in an admi page (Catalog -> manage Categories -> general Information) and i have to retrieve the current selected store / store id. is it possible and how?
thanks

There are a number of options for this but you should be able to use,
Mage::app()->getRequest()->getParam('store');
if you aren't looking for a specific ID, you can use
Mage::getModel('core/store')->getCollection()->load()->getAllIds();
assigning your own variables to use with them.

Related

Where should I store a default list of strings in an iOS app?

I have an app that stores lists of strings.
I currently have a CoreData entity for a list and for a user; a user has a relationship to many lists. A user can create more lists.
But I would like to include some default lists. Where should I store these default lists?
The options that come to mind are:
Prepopulate CoreData with some lists
Store default lists in UserDefaults
Store default lists in plist file
Explicitly create default lists in code where they are needed
What is the best way to store a default array of strings for an iOS app?
IMO there is no one-answer to your question an these really depends on your use case.
In general, if your user shall have any interaction with the default lists (manipulating, hide, delete) i would put them in your CoreData.
I assume since you have an entity for the user, you allow multiple different users to use the app on the same device? So if you would store them in the userDefaults you would also have to keep track off the modifications for each user. In general the userDefaults should only be used for "small" data, cf. doc
The defaults system allows an app to customize its behavior to match a
user’s preferences. For example, you can allow users to specify their
preferred units of measurement or media playback speed.

AWS DynamoDB remember item for user

I am building an application using AWS Mobile HUD and connected services, most prominently Cognito & DynamoDB. Currently I am facing a problem to setup a scheme that allows me to store user-related information on DynamoDB items (or vice versa).
Scenario
Run 1
User A pulls list of [RootItem] = {RootItem_1, RootItem_2, RootItem_3} from DynamoDB (check: works fine)
User A either dismisses RootItem_1 (mark as 'not interested' in app)
Run 2
User A logs into the application
User A pulls list of [RootItem] = {}
User A should only get RootItems which are not dismissed
List delivered to client should be {RootItem_2, RootItem_3}
Being new to non-relational data / NoSQL, I am not sure what is the best way to approach this. Possible Ideas:
Store userID on the RootItem_1 to exclude it in Scan [issue: there will potentially be thousands of users dismissing the same item]
Store uuid of RootItem_1 to userdata on cognito, cache locally before pull and exclude uuid's from pull
Create table with exclusions/dismissions [userid, rootItem_uuid], query this first to get list of user exclusions. > potential performance issue?
It would be great to get some advice what is the best approach to handle this in a NoSQL environment.
It depends of course on the number or RootItems, and how many active (not dismissed) RootItems are existing per user. But I would maintain a list of RootItems (or refereces to it) and store it in a table for each user, and maintain that list as the user dismisses the items. Or even is it possible that most items are dismissed, and then it would be a list of saved items for the users?

In Rails 3, how can I save user search history to the database with no membership/authentication system?

Currently, the site is storing "previously viewed items" via cookies.
I need to take that a step further and not only store those items in the database, but save the user's most recent search, so that they can retrieve the search later by returning to the site (the cookie can handle this), but also through say a four-letter code and later a QR code.
When you get into writing these non-authenticated users' data to the database, what is the identifier to use as the key to differentiate them? And would it be ideal to create the actual model record upon visiting the home page, or perhaps after the initial search?
You could save the IP address, other than that, there is really no way to save something specific to a user.
Use the rails request object. You can access the IP with request.remote_ip.
This is the only thing I can think of that is request specific without auth.

TFS Global List in Database

I have TFS2010 and I am wondering, where can I find the global list values within the TFS database. I am trying to find the correct table name and database that contains the values.
Thanks!
We don't support using the operational data store, instead use the API's we provide to you. To start using the API for global list see http://blogs.microsoft.co.il/blogs/shair/archive/2010/03/08/tfs-api-part-23-create-global-list-xml-way.aspx

What is the right way to handle permalinks when the page depends on the session?

Here's the situation: I've got an application where you begin at a screen showing a list of countries. You choose a country, and this becomes the ambient country that the application uses until you change it. This ambient country is stored in the Session so the application doesn't have to pass around a CountryId in every single url. But I also want to support permalinks to country specific content, so I guess there needs to be a "Get Permalink" button, which creates a permalink that does contain the CountryId, because it obviously has to work independent of the current session.
Here's the question: My understanding is that because selecting a country changes the session state, one should only do it via POST. But then if the user comes in via GET with a permalink containing, e.g. CountryId=123, what should happen? Should the page update the Session with country 123? In this case, it would be breaking the rule that you can change the session ONLY via POST. But if it doesn't change the session, then all the code that relies on the session won't work, and I'd have to have code redundant ways to generate the page.
OR, should the page have some sort of mechanism for saying "use the session value, but override with any query string value if there is one (and don't modify the session at all)?
OR, am I misunderstanding the POST rule entirely?
The real issue here is the fact that you are using a Session. You cannot provide permalinks because the data that you have stored in the session might have expired when the user follows this links later. So you must somehow persist this data into a more durable datastore when someone requests you to generate a permalink. So when a user asks for a permalink you will go ahead and persist all those search criteria that were used to perform the search into your data store and obtain an unique id that will allow you to fetch them later. Then give the user the following permalink: /controller/search/id where the id represents the unique identifier tat will allow you to fetch the criteria from your data store, perform the search and reconstruct the page as it was.

Resources