I have an NSArray filled with bool objects (expressed as a number), and I need to test to see if any object within the array is equal to 1. How can I do it?
I want to query against a geospatial index in mongo-db (designed after this tutorial http://www.mongodb.org/display/DOCS/Geospatial+Indexing).
So when I execute this from the shell everything works fine:
db.sellingpoints.find(( { location : { $near: [48.190120, 16.270895], $maxDistance: 7 / 111.2 } } );
but the same query from my nodejs application (using mongoskin or mongoose), won't return any results until i set the distance-value to a very high number (5690)
db.collection('sellingpoints')
.find({ location: { $near: [lat,lng], $maxDistance: distance / 111.2} })
.limit(limit)
.toArray(callback);
Has someone any idea how to fix that?
Is it possible to launch any arbitrary iPhone application from within another app? For example in my application if I want the user to push a button and launch right into the Phone app (close the current app, open the Phone app), would this be possible? I know this can be done for making phone calls with the tel URL link, but I want to instead just have the Phone app launch without dialing any specific number.
I have created a number of forms using various Joomla components which have more or less worked successfully.
Recently I have attempted to create mult-page forms - the forms work...but they are slow as molasses. Having spent a couple of weeks trying to resolve this and not seeing any signs of improvement ......
I wonder if anyone has experience of using hosted forms services in Joomla either using a wrapper or as a static page within a Joomla site.
Any pointers or recommendations would be appreciated.
Hi everybody,
I have the following query in my application. It works well, but I need it to also contain the number of products that are associated with each manufacturer.
The current query:
SELECT * FROM (`manufacturers`)
JOIN `languages` ON `manufacturers`.`lang` = `languages`.`id`
ORDER BY `languages`.`id` asc, `id` asc
My products table looks like this:
id | name | manufacturerid
0 | Product1 | 0
I have included gwt-html5-geolocation into my GWT project and was disappointed to find that it doubled up on my number of permutations compiled. Apparently if the browser does not support geolocation API then it falls back to use gears to find out your location. Is there a way to NOT compile a permutation for gears similar to the way you can tell GWT to only compile certain browser permutations? (the geolocation stuff is very much a nice-to-have and frankly if the client is running an old browser then I am happy not to get their location)
Thanks
I am writing an application that needs simple data found (mostly) on the periodic table of elements, such as atomic mass, atomic number, state, etc.
However, I would prefer not to manually enter this data.
I managed to find the NIST website (http://www.nist.gov/pml/data/edi.cfm) with all of the data I need, but not in a downloadable format.
Where can I find this data? Preferably, it would be in an XML/YAML/JSON/other documented format, however, any format would be helpful.
I want to update a field in a database table that has to have a cumulative value. So basically I need to find the current value of the field and update it using a new number.
My first inefficient try at this (in Mongoid) is:
v = Landlord.where(:name=>"Lorem")
v.update_attributes(:violations=>v.violations + 10)
Is there a simple method than making one query to read, then sum up, and another query to write?
Hello, I needed to find the number of files in a folder on the system.
This is what i used:
file_count = sum((len(f) for _, _, f in os.walk('path')))
This works fine when we specify the path as a string in quotes, but when I enter a variable name that holds the path, type(file_count) is a generator object, and hence cannot be used as an integer.
How to solve this and why does this happen?
Hi in Flex one can easily define the remote class alias like the following:
package samples.portfolio
{
[RemoteClass(alias="flex.samples.marketdata.Stock")]
[Bindable]
public class Stock
{
public var symbol:String;
public var name:String;
public var low:Number;
}
}
But my question is how do you do it in AIR since
the client app does not know about the server
file structure.
Regards,
Dear All
I need to generate a series of N random binary variables with a given correlation function. Let x = {x_i} be a series of binary variables (taking the value 0 or 1, i running form 1 to N). The marginal probability is given Pr(x_i = 1) = p, and the values should be correlated in the following way
E[ x_i x_j ] = const * |i-j|^-alfa
where alfa is a positive number.
Is it possible to generate a series like this?
preferably in python.
Hi guys,
may i know how do i set the number of feeds displayed on a word press blog?
for instance, i used
http://beautifulreminisciencezz.wordpress.com/?feed=atom&year=2009
But it returns me only ten results.
For blogger, I know the query parameter is 'max-results'
However,t here's nowhere in wordpress where they mentioned the query parameters for this.
Anyone have any idea?
Hi guys, I want to do a Token concatenation, but I want to do this with the content of a variable, not its name. like this.
#define call_function(fun, member) fun##_##number ()
while (i < 10 ) {
call_function(fun, i);
}
but I give fun_number (), I want to give fun_1, fun_2, and so on...
how to do it?
Thanks in advance!!!
I using this code to connect to facebook chat. When I try to retrieve list of online users instead of user name I get negative number for example: [email protected]
How can I get the original (Letters) user name?
Hi there,
I'm looking to calculate the total size of all shared folders (except admin shares) on a number of different servers (consolidating all accessed files to a NAS box for easier backup / restore) but am having a bit of trouble finding a solution.
I'm certain this could be done in powershell but I just can't find the right information to get me going, I can currently spit out a list of all shares on the servers but am not sure where to go from here:
$servers =@(
"server1",
"server2")
foreach($server in $servers)
{
get-WmiObject Win32_Share -computerName $server -filter "Type = 0"
}
I'm in the process of rewriting an overengineered and unmaintainable chunk of my company's library code that interfaces between C# and C++. I've started looking into P/Invoke, but it seems like there's not much in the way of accessible help.
We're passing a struct that contains various parameters and settings down to unmanaged codes, so we're defining identical structs. We don't need to change any of those parameters on the C++ side, but we do need to access them after the P/Invoked function has returned.
My questions are:
What is the best way to pass strings? Some are short (device id's which can be set by us), and some are file paths (which may contain Asian characters)
Should I pass an IntPtr to the C# struct or should I just let the Marshaller take care of it by putting the struct type in the function signature?
Should I be worried about any non-pointer datatypes like bools or enums (in other, related structs)? We have the treat warnings as errors flag set in C++ so we can't use the Microsoft extension for enums to force a datatype.
Is P/Invoke actually the way to go? There was some Microsoft documentation about Implicit P/Invoke that said it was more type-safe and performant.
For reference, here is one of the pairs of structs I've written so far:
C++
/**
Struct used for marshalling Scan parameters from managed to unmanaged code.
*/
struct ScanParameters
{
LPSTR deviceID;
LPSTR spdClock;
LPSTR spdStartTrigger;
double spinRpm;
double startRadius;
double endRadius;
double trackSpacing;
UINT64 numTracks;
UINT32 nominalSampleCount;
double gainLimit;
double sampleRate;
double scanHeight;
LPWSTR qmoPath; //includes filename
LPWSTR qzpPath; //includes filename
};
C#
/// <summary>
/// Struct used for marshalling scan parameters between managed and unmanaged code.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct ScanParameters
{
[MarshalAs(UnmanagedType.LPStr)]
public string deviceID;
[MarshalAs(UnmanagedType.LPStr)]
public string spdClock;
[MarshalAs(UnmanagedType.LPStr)]
public string spdStartTrigger;
public Double spinRpm;
public Double startRadius;
public Double endRadius;
public Double trackSpacing;
public UInt64 numTracks;
public UInt32 nominalSampleCount;
public Double gainLimit;
public Double sampleRate;
public Double scanHeight;
[MarshalAs(UnmanagedType.LPWStr)]
public string qmoPath;
[MarshalAs(UnmanagedType.LPWStr)]
public string qzpPath;
}
I'm looking for a library (or plugin) that help me create a slideshow where (besides the simple ordering of images) I'm able to define the beginning and ending positions (either X/Y, or Zooms) for a given image and the plugin animates the intervening steps between them.
Flash has a number of tools/libs like this, i'm sure jQuery has seen similar. Ideally something that offers a range of easing effects as well. I understand these elements are native to jQuery...i'm looking for a time-tested wrapper.
thx
I need a regular in expression in PHP that I can plug into preg_match_all and find if an @ sign and any character number or letter follows right after that. So if I put "@patrick hello there" it will come up true, if I put in "I saw her @ the mall" it will be false.
Thank you :)
I know this is simple question but taking more time
How to find first record from table in grails .
I need to get only the first record with out knowing the id number .
Is there any method like find :first in grails ?
thanks in advance .
Hi,
I stumbled upon http://www.kettletime.com.au/chance where the user needs to drag and drop a box with a number into another box to prove that he is human.
How do you implement this? Any free library to do this?
Thanks
We are using the standard aspnet security features, we have need to set the order of the roles, purely for display purposes.
We could just have a sequence number onto the end of the aspnet_roles table, but that feels kinds of hacky to me. Also if in future versions of asp the security get changed we will be in trouble.
Is there a better way to do this that won't make me loose sleep each time a new version is pushed out?
Hello,
just a quick question, how to add percent sign to numbers without modifying number. I have tried format percent with myStyleFont.num_format_str = '0.00%' but it multiplies with 100 but I need just to append percent.
Ty in advance.
Regards.
I've set my ErrorDocument 401 to point to my website's account creation page, but not all browsers seem to honor this redirect (Safari).
Also, other browsers (Firefox, Chrome) never quit asking for the password and show the ErrorDocument. This causes a good number of users to give up trying after many password attempts without seeing the account creation page.
Is there any way to make the redirect more reliable, without trashing basic authentication altogether?
Simple question - what part of my CSS do I tweak to adjust the gap between a bullet/number and the first text character in an HTML list?
Bonus question - I've seen it mentioned here that controlling table spacing by adjust padding on table tr td {} is bad practice, but I haven't seen someone explain how you're really supposed to do it...?
Hi
I would like to zip a bunch of files (.exe and .dll) before I overwrite them with the new build. Is there a simple way to zip files without using some sort of dll?
Just creating a folder with the build number / date time stamp will also work great. How do I pass parameters from the cruise control build process into my Powershell script that will do the work then?
Is this a sustainable way to do things?
Thanks