I have a Google Spreadsheets containing about 50 rows, each of which has values in the first four cells of the row. I'd like to build something where I can click a button (or a cell?) and have it return one of these rows, selected randomly. I had assumed that this would be fairly simple in Google Sheets, but lots of searching online hasn't yielded anything useful.
I'm open to building something different (simple web app?) that will still do what I'm looking for.
Does anyone know how to do this, or even know some different language that I should be using as search terms?
If you insert a new ColumnA and populate it with:
=randbetween(1,100)
you might then use a formula like:
=query(Sheet1!A1:E50,"select B,C,D,E order by A limit 1")
and even have this update itself every minute or hour by selecting Recalculation in Spreadsheet settings..., otherwise on command with Ctrl+R.
HOWEVER, the result is effectively provisional until the sheet has saved.
You can use Google Apps Script, which will allow you to add the functionality you require into your spreadsheet. It uses JavaScript and the link I have given above will lead to some easy to follow examples. If you get stuck, then the Web Applications Stack Exchange site has many Q & A's on scripting Google's web apps.
If you reach the limits of Google Apps Script at some point, you may write your own application which interacts with your Google Sheet via their API. The APIs support multiple scripting and programming languages and searching Github will yield many open source libraries helpful for using Google Sheets and other Google Apps.
An alternative is with a relatively recent feature (Randomize range) under Data.
Assuming your data starts in A1, say name your "about 50 rows" by four columns and apply a formula such as:
=ArrayFormula(A1:D1)
The select your named range and click on Randomise range.
Related
I’ve created a script that lists articles, and register when the user skips or clicks on the link. I want to show the user further links based on what they’ve already shown interest in.
Each link has associated categories, keywords and authors. So I have some texture to the data. And of course other users who’ll be clicking on links.
My thought was to use openCF, but wondering if it’ll be fast enough eg find current ratings -> send current user ratings -> fetch from MySQL.
Is there a better way to do this than MySQL without relying on a 3rd party API (like say Recombee or AWS)?
I’ve tried recombee in the past, and the results are good, but end up with duplication and unnecessary cost.
I am kind of a newbie at programming (have worked a bit with Delphi years back) but have started to build an application for Windows Phone 7.5 Mango, as I have a great idea for an app :D
In the application the user should be able to pick different locations from a list (a very large list, 5k+ items) - to make sure that all users always get the latest list, I have created a SQL on my website to generate the list as XML - which I load to the application via httpwebrequest; I am not quite sure what best practise is when dealing with a large list, which will be updated frequently etc.?
That is not the main question thou, because this seems to work pretty okay - my real question is, how to add a search function to my application, so the user can search for a location instead of scrolling throug the entire list?
My SQL is build up with ID, Country, State, Region, City (and a few more irrelevant tables for a search function).
I do not know what the best way to approach this is? Should I make a query on my website and generate the result as XML and use httpwebrequest to get the result to the phone - or should it be a search function on the device to search the entire list? And if so, how do I do that?
Thank you ;-)
First of all I have to inform you that fetching an list with over 5k+ items via a smartphone that not are using Wireless Network, will take a while. So, acrording to me there would be a huge waste of traffic to download the whole list if the user only are interested in a few items. This basically means that you are downloading a bunch of date but only are using 0,01% of it which is not the way you should build a program.
So, acording to me you should make an webservice so that the user can call the webservice and make a http request using its search parameter. And then you basically just use the parameter in an SQL Search Query, which could be an stored procedure or just bare in code, but I don't know how your server/database is build and structed so you can basically choose that whatever.
Here is an example:
SELECT * FROM TABLE_NAME WHERE (ID=#ID) OR (Country=#Country) OR (State=#State) OR (Region=#Region) OR (City=#City)
If i would have done this application I would have had two parameters. One that are representing the user input, in other words the search text and one that explains what the serach parameter is. (ID, Country, State, Region or City?).
You have to register your handle function for TextBox.TextChanged with some logic to filter queries that happens too often (for example typing name John may cause 4 requests: J, Jo, Joh, John). It can be done by using System.Threading.Timer with delayed start and changing it starting time when user types new character (if you need example - ask).
Then I recommend you to use WCF service to "talk" with SQL database. On WCF service use any ORM (Entity framework is simplest) to query you database.
I am building a mobile web application that targets webkit. I have a requirement to perform a live search (on keypress) against a database of ~5000 users.
I've tried a number of different techniques:
On page load, making an AJAX call which loads an in-memory representation of all 5000 users, and querying them on the client. I tried sending JSON, which proved to be too large, and also a custom delimited string, which was then parsed using split(). This was better, but ultimately searches against this array of users was slow.
I tried using a conventional AJAX call, which would return users based on a query, also using the custom delimited string technique. This was better, but I was forced to tune it so that searches were only performed with a minimum of 3 characters. This is not optimal, as I would like to be able to start filtering after 1 character. I could also throttle the calls so that not every keystroke within a certain threshold triggered a request. This could help with performance, but I'd rather not have to fiddle with that sort of thing.
Facebook mobile does this very well if you try their friend search. Searches happen instantaneously, and are triggered after 1 character.
My question is, does anyone have any suggestions for faster live searches for a mobile app? Should I be looking at localStorage? Is this reliable, feasible?
Is there any reason you can't use a binary search? The names you're looking for should be in a block. If you want first and last name search, you could create a second copy of the data sorted by last name and look in both sets.
Some helpful but more complicated data structures that address this type of problem include:
http://en.wikipedia.org/wiki/Directed_acyclic_word_graph
http://en.wikipedia.org/wiki/Trie
I use Microsoft Document Explorer version 9.0.21022.8.RTM. Why do I feel that using search in this MS Documentation is quite slow and quite bad? What i miss, what I do wrong?
Quite slow: When I search the same thing in google, yahoo or bing, i get the same results much faster. In dexplorer.exe i configured 20 results per page, local only. Each time i get 500 total results and of course I always find the thing I search in the first page of 20 results. In 'Tools' menu i can't configure to have total results first 50 or 100 max.
Quite bad: When i click F1 on a keywork in Visual Studio often i get very bad result in dexplorer. Some object which is quite far from what I do.
And in the end google becomes one of my best friends. I don't believe microsoft are stupid but they are flighting to prove it very hard. It's not a big problem but still i prefer to use a desktop app with much flexible & advanced search (like filtering language, platform, content, etc) then a browser.
Your itty-bitty machine is no match against the hardware and smarts that Google throws at the search problem. Use Google to search, you can use the site: selector to narrow the search to MSDN Library pages. The Microsoft search page is not entirely unfunctional either but lately tends to show too many unhelpful MSDN forum questions. You find topics in DE by using the index. Which is very well done, it does take a bit of time to learn how to use it however.
The Contents tab is only useful when you found a topic and want to see associated topics or introductory material. Use the "Sync with Table of Contents" button on the toolbar. It doesn't always work for older topics.
Problem:
I have two spreadsheets that each serve different purposes but contain one particular piece of data that needs to be the same in both spreadsheets. This piece of data (one of the columns) gets updated in spreadsheet A but needs to also be updated in spreadsheet B.
Goal:
A solution that would somehow link these two spreadsheets together (keep in mind that they exist on two separate LAN shares on the network) so that when A is updated, B is automatically updated for the corresponding record.
*Note that I understand fully that a database would probably be a better plan for tasks such as these but unfortunately I have no say in that matter.
**Note also that this needs to work for Office 2003 and Office 2007
So you mean that AD743 on spreadsheet B must be equal to AD743 on spreadsheet A? Try this:
Open both spreadsheets on the same
machine.
Go to AD743 on spreadsheet B.
Type =.
Go to spreadsheed A and click on
AD743.
Press enter.
You'll notice that the formula is something like '[path-to-file+file-name].worksheet-name!AD743'.
The value on spreadsheet B will be updated when you open it. In fact, it will ask you if you want to update. Of course, your connection must be up and running for it to update. Also, you can't change the name or the path of spreadsheet A.
I can't say if this is overkill without knowing the details of your usage case, but consider creating a spreadsheet C to hold all data held in common between the two. Links can become dizzyingly complex as spreadsheets age, and having a shared data source might help clear up the confusion.
Perhaps even more "enterprise-y" is the concept of just pasting in all data that otherwise would be shared. That is the official best practice in my company, because external links have caused so much trouble with maintainability. It may seem cumbersome at first, but I've found it may just be the best way to promote maintainability in addition to ease of use, assuming you don't mind the manual intervention.