anonymous

C global anonymous struct / union

我的未来我决定 提交于 2019-12-02 10:11:05
I have a uint64 variable which often only requires high or low 32 bit access. I am using a 32-bit ARM Cortex M0, and to help with speed and I am trying to overlap the uint64 variable with two uint32 variables in C, using anonymous structures in the hope of avoiding pointer arithmetic to access members. Is what I am trying to do possible? It could be that using a named union is just as fast, but now I'm just intrigued if it can be done without. The following does not compile successfully: http://goo.gl/ejx37y #include <stdint.h> volatile union { uint64_t ab; struct { uint32_t a, b; }; }; int

Convert anonymous function in PHP 5.3 into PHP 5.2 equivalent

馋奶兔 提交于 2019-12-02 05:19:47
I have error in line 2 and 13 in PHP 5.2, I have no idea to make the correction, I tried using create_function but not working, can anyone help with this? function _process_special_keyword($str){ $callback = function($match){ $ret = $match[1] . '[' . $match[2] . ']'; if(!empty($match[3])){ $ret .= '.[' . $match[3] . ']'; } $ret .= $match[4]; return $ret; }; $strSQL = preg_replace_callback('/([\s\(\.,])(' . SPECIAL_KEYWORDS . ')(?:\.(' . SPECIAL_KEYWORDS . '))?([\s\)\.,])/i', $callback, $str); $callback = function($match){ return 'CASE WHEN ' . $match[1] . ' THEN ' . $match[2] . ' ELSE ' .

Global const string& smells bad to me, is it truly safe?

放肆的年华 提交于 2019-12-01 15:23:15
I'm reviewing a collegue's code, and I see he has several constants defined in the global scope as: const string& SomeConstant = "This is some constant text"; Personally, this smells bad to me because the reference is referring to what I'm assuming is an "anonymous" object constructed from the given char array. Syntactically, it's legal (at least in VC++ 7), and it seems to run, but really I'd rather have him remove the & so there's no ambiguity as to what it's doing. So, is this TRULY safe and legal and I'm obsessing? Does the temp object being constructed have a guaranteed lifetime? I had

Identifying anonymous users

北城余情 提交于 2019-12-01 07:37:24
If I had a poll on my site, and I didn't want to require a registration to vote, but I only wanted each visit one, how might I do this? Let's say a visitor from IP 123.34.243.57 visits the site and votes. Would it then be safe to disallow anyone from 123.34.243.* from voting? Is this a good strategy? What's another one? This is a fundamental challenge with all voting sites on the Internet, and you're just breaking the surface of the problem. The way you've phrased it, you "only want to allow each visit one [vote]" indicates that you want to allow them to vote once each time they open their

Best way to Migrate Anonymous Profile

狂风中的少年 提交于 2019-11-30 19:14:12
Is there an alternate way that migrates all parameters implicit? Or any other advantages. From MSDN : public void Profile_OnMigrateAnonymous(object sender, ProfileMigrateEventArgs args) { ProfileCommon anonymousProfile = Profile.GetProfile(args.AnonymousID); Profile.ZipCode = anonymousProfile.ZipCode; Profile.CityAndState = anonymousProfile.CityAndState; Profile.StockSymbols = anonymousProfile.StockSymbols; //////// // Delete the anonymous profile. If the anonymous ID is not // needed in the rest of the site, remove the anonymous cookie. ProfileManager.DeleteProfile(args.AnonymousID);

Disable anonymous user cookie with Django

蓝咒 提交于 2019-11-30 13:06:20
I use django auth for my website, which needs to have the session middleware installed. Django session middleware always adds a session cookie, even for anonymous users (users that are not authenticated). When they authenticate the cookie is replaced by another one indicating the user is logged-in. I want to disable the anonymous user cookie for caching purposes (varnish). Is there a way to disable anonymous user cookies without removing session middleware which is necessary for apps using auth? Session data is set in the cookie in the process_response of SessionMiddleware . This function

Best way to Migrate Anonymous Profile

本小妞迷上赌 提交于 2019-11-30 03:35:50
问题 Is there an alternate way that migrates all parameters implicit? Or any other advantages. From MSDN: public void Profile_OnMigrateAnonymous(object sender, ProfileMigrateEventArgs args) { ProfileCommon anonymousProfile = Profile.GetProfile(args.AnonymousID); Profile.ZipCode = anonymousProfile.ZipCode; Profile.CityAndState = anonymousProfile.CityAndState; Profile.StockSymbols = anonymousProfile.StockSymbols; //////// // Delete the anonymous profile. If the anonymous ID is not // needed in the

Disable anonymous user cookie with Django

十年热恋 提交于 2019-11-29 18:17:40
问题 I use django auth for my website, which needs to have the session middleware installed. Django session middleware always adds a session cookie, even for anonymous users (users that are not authenticated). When they authenticate the cookie is replaced by another one indicating the user is logged-in. I want to disable the anonymous user cookie for caching purposes (varnish). Is there a way to disable anonymous user cookies without removing session middleware which is necessary for apps using

Swift: Firebase: How to ensure no one can access my db except my app

自作多情 提交于 2019-11-29 17:02:41
My Swift iOS app only uses Firebase Anonymous Login. I am concerned about security of my Firebase Database as apparently anyone can access or delete my data (through a browser etc?). How can I secure my db so only my iOS app can access it? I would have expected that the Firebase dashboard allow to generate an API key which I can embed in my app, but that does not seem to be the case. You need to write security rules. Anyone can see your URL, but security rules are how you dictate who has access to what pieces of data. These rules act like annotations on your data structure and specify what

Is it possible to reference a specific element of an anonymous array in PHP?

强颜欢笑 提交于 2019-11-29 14:32:13
This is probably a simple question, and I'm afraid the answer might be "no", but... Here's a simple piece of code: function func1() { $bt = debug_backtrace(); print "Previous function was " . $bt[1]['function'] . "\n"; } Now... Can this be done without the temporary variable? In another language, I might expect to be able to say: function func1() { print "Previous function was " . (debug_backtrace())[1]['function'] . "\n"; } Alas, in PHP, this results in an error: PHP Parse error: syntax error, unexpected '[' ... If it can't be done, it can't be done, and I'll use a temporary variable, but I'd