text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
Storage="_Activity", ThisKey="AID", IsForeignKey=true)] public Activity Activity ``` Without too much thinking, and trying to keep to your design, how about something like this (I assume that the Quote class has getText() and getAuthor methods, also you might want to make it getText(int numberOfWords) so you can confi...
[ 0.5114220976829529, -0.1885504573583603, 0.42055031657218933, 0.1537104845046997, -0.042148347944021225, -0.22946251928806305, 0.03940338268876076, -0.21462678909301758, -0.14035756886005402, -0.6612148880958557, -0.20403805375099182, 0.9238533973693848, -0.5283190608024597, -0.28494262695...
Hard or Easy QuoteFactory } public abstract Quoute getQuote(Category category) } class HardQuoteFactory extends QuoteFactory { public Quote getQuote(final Category category) { // ... } } class EasyQuoteFactory extends QuoteFactory { public Quote getQuote(final Category cate...
[ -0.01713426224887371, -0.1696375161409378, 0.5074529051780701, -0.04470745846629143, 0.015353423543274403, 0.12009124457836151, 0.11237306892871857, -0.015286034904420376, -0.09234773367643356, -0.5914603471755981, -0.5524201989173889, 0.951806366443634, -0.5563198924064636, -0.07659984380...
My migration is as follows: ``` class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :email t.string :password t.string :name t.boolean :male t.boolean :admin t.timestamps end end def self.down drop_table :users end end `...
[ -0.1829051524400711, 0.13024169206619263, 0.3864089846611023, -0.22873499989509583, 0.13549388945102692, 0.16751669347286224, 0.18905790150165558, -0.3092800974845886, -0.39674970507621765, -1.0402960777282715, 0.004599809180945158, 0.27506962418556213, -0.350747674703598, 0.44086518883705...
not generate the model, it won't be available in the console, as Rails doesn't know it exists. Rails also does not create a `modelname_id` field, it simply creates an `id` field which autoincrements. I hope this helps.
[ 0.10370859503746033, 0.08183231949806213, 0.15843702852725983, 0.43596765398979187, 0.13042230904102325, -0.2274491786956787, 0.22672028839588165, 0.21010789275169373, 0.17434939742088318, -0.5391181707382202, 0.23488184809684753, 0.6806758046150208, -0.3038370907306671, 0.1508414894342422...
My site (ASP.NET/C#/MS-SQL 2005) has multiple sections that allow for comments (User profiles, image pages, videos, etc). I want to store everything in a single comments table. My issue is linking the comment back to its parent. The user profiles' primary keys are uniqueidentifiers, while the images and videos use in...
[ 0.3154854476451874, 0.24227426946163177, 0.2585938572883606, -0.09845700114965439, -0.4314478039741516, -0.12367239594459534, -0.08981472253799438, 0.115776926279068, -0.16084827482700348, -0.7327058911323547, 0.40324440598487854, 0.3028658628463745, -0.16418659687042236, 0.338111519813537...
also does not create a `modelname_id` field, it simply creates an `id` field which autoincrements. I hope this helps.
[ 0.1766517162322998, 0.14709681272506714, 0.1836082935333252, 0.349071204662323, 0.224542036652565, -0.2890704572200775, 0.1392100304365158, 0.16641812026500702, -0.02400304563343525, -0.4340175688266754, 0.09380544722080231, 0.692870557308197, -0.19148117303848267, 0.1675756722688675, -0...
I am writing an email module for my web app that sends a html email to a user on completion of a task such as signing up. Now as the formatting of this email may change I've decided to have a template html page that is the email, with custom tags in it that need to be replaced such as %fullname%. My function has an ar...
[ 0.48441317677497864, 0.25764554738998413, 0.44483432173728943, -0.4693935215473175, -0.03989896923303604, 0.1885230839252472, 0.33878445625305176, 0.0010668108006939292, -0.1718941330909729, -0.668890118598938, -0.01744305156171322, 0.3855604827404022, -0.3628953993320465, -0.0832989513874...
= @fopen('email.html', 'r'); if($fp) { while(!feof($fp)){ $line = fgets($fp); foreach($data as $value){ echo $value; $repstr = str_replace(key($data), $value, $line); } $content .= $repstr;
[ 0.12829601764678955, -0.16926495730876923, 0.8466148376464844, -0.469264954328537, 0.08381258696317673, 0.2918606400489807, 0.5677623152732849, -0.5619077682495117, -0.21865981817245483, -0.07351130247116089, -0.6927478909492493, 0.3778960406780243, -0.543592095375061, 0.2382286638021469, ...
} fclose($fp); } ``` Is this the best way to do this? as only 1 tag get replaced at the moment... am I on the right path or miles off?? thanks... I think the problem is in your foreach. This should fix it: ``` foreach($data as $key => $value){ $repstr = str_replace($key, $value, $line); ...
[ -0.034900106489658356, -0.11609470844268799, 0.9339466691017151, -0.244074285030365, 0.12896203994750977, -0.38995036482810974, 0.4177803695201874, -0.5095719695091248, -0.22707517445087433, -0.5957508087158203, -0.3647958040237427, 0.8328922390937805, -0.5733917355537415, -0.2032675892114...
print $file; } ```
[ 0.1442284733057022, 0.566334068775177, -0.10908158868551254, -0.23877453804016113, 0.32191652059555054, -0.18474574387073517, 0.2867588698863983, 0.36349886655807495, 0.060811758041381836, -0.4426329731941223, -0.36568939685821533, 0.7261066436767578, -0.5726200342178345, 0.309992849826812...
After a long learning loop via XAML, I've returned to HTML and javascript, and realised that the concept of declarative code - in terms of rules for transformation - is an incredibly powerful concept. Despite its surfeit of syntax, XSLT processing of XML is the keystone of declarative transformation programming. I hav...
[ -0.14417017996311188, 0.21030767261981964, 0.13945049047470093, 0.09136888384819031, -0.4471372365951538, -0.039562784135341644, 0.10980051755905151, -0.16201120615005493, -0.11434338986873627, -0.6794653534889221, -0.18262848258018494, 0.4610421359539032, -0.2964637875556946, -0.114761762...
of the things that puts me off full-on xslt is the visual complexity of the code. **One can often find examples of beautiful XSLT code, especially when XSLT is used as a functional programming language**. For examples see [**this article**](http://www.idealliance.org/papers/extreme/proceedings/xslfo-pdf/2006/Novatche...
[ 0.23416768014431, -0.06973174214363098, 0.2650551199913025, -0.008513526991009712, -0.29347145557403564, -0.19766607880592346, 0.3296109735965729, -0.16017162799835205, -0.11387312412261963, -0.5099961757659912, 0.06819318234920502, 0.8445966839790344, -0.22563494741916656, 0.0642957687377...
small example**. **This XPath 2.0 expression defines** the "*Maximum [Prime Factor](http://en.wikipedia.org/wiki/Prime_factor) of a natural number*": ``` if(f:isPrime($pNum)) then $pNum else for $vEnd in xs:integer(floor(f:sqrt($pNum, 0.1E0))), $vDiv1 in (2 to $vEnd)[$pNum mod . = 0][1], $vDiv...
[ -0.1535075306892395, 0.04759710282087326, 0.49396082758903503, -0.23889867961406708, 0.1687329113483429, 0.255364328622818, 0.002342675346881151, -0.3399168848991394, -0.3891109228134155, -0.5726091861724854, -0.34507089853286743, 0.4677884876728058, -0.2943095564842224, 0.0374412350356578...
the maximum prime factor of **`pNum`** is the bigger of the maximum prime factors of **`vDiv1`** and **`vDiv2`**. **How do we use this to actually calculate** the Maximum Prime Factor in XSLT? **We simply wrap up the definition above** in an `<xsl:function>` and ... get the result! ``` <xsl:function name="f:maxPrime...
[ -0.39493489265441895, -0.2659635543823242, 0.8690812587738037, -0.01841868832707405, -0.003935573156923056, 0.28968557715415955, -0.10580798238515854, -0.6412168145179749, -0.5147795081138611, -0.43842777609825134, -0.14718322455883026, 0.7763172388076782, -0.14106248319149017, -0.19837318...
mod . = 0][1], $vDiv2 in $pNum idiv $vDiv1 return max((f:maxPrimeFactor($vDiv1),f:maxPrimeFactor($vDiv2))) "/> </xsl:function> ``` **We can, then, [calculate the MPF for any natural number](https://stackoverflow.com/questions/439814#445858)**, for example: `f:maxPrimeFactor(6008...
[ -0.3718508183956146, -0.005609916988760233, 0.5854479670524597, 0.10724931955337524, -0.3847356140613556, 0.4660617709159851, 0.5228832364082336, -0.507805347442627, -0.38954058289527893, -0.4007549583911896, -0.4101545214653015, 0.2976575195789337, -0.525665819644928, 0.16767144203186035,...
Old Testament) * [**Spelling checking**](http://fxsl.cvs.sourceforge.net/fxsl/fxsl-xslt2/Tests/testFunc-spell.xsl?revision=1.2&view=markup) (Shakespear's Othello) * [**Sudoku solver**](http://ajwelch.blogspot.com/2006/03/dimitres-tuned-sudoku-solution.html) * A general compiler-compiler system -- [**the LR-Parsing Fram...
[ -0.31614431738853455, 0.47678375244140625, 0.19407044351100922, 0.019597502425312996, 0.1970592737197876, 0.1740088015794754, 0.48344752192497253, 0.06546597182750702, -0.3895513713359833, -0.18994390964508057, -0.17432869970798492, 0.5753660798072815, 0.14850372076034546, 0.04607958346605...
I want to simulate the trust levels of a shared hosting environment on my development machine so that there are no nasty surprises when I come to deploy my solution. I added this my setting the web.config: ``` <trust level="Medium" originUrl="*"/> ``` The only problem with this is that I'm getting this exception wh...
[ 0.008942517451941967, -0.007251915987581015, 0.5211459994316101, -0.06313566118478775, 0.14935937523841858, -0.21336902678012848, 0.5038086175918579, -0.03798810392618179, -0.10681018978357315, -0.8075227737426758, -0.022592613473534584, 0.558345377445221, -0.29471898078918457, 0.414005368...
on GoDaddy. I contacted Godaddy, and got this responce: > GoDaddy.com ASP.NET shared hosting > servers **use the default Medium trust > level with the addition of > OleDbPermission, OdbcPermission, and a > less-restrictive WebPermission**. > > > Applications operating under a Medium > trust level **have no regi...
[ 0.03166990727186203, 0.29333367943763733, 0.8725488781929016, 0.11267905682325363, -0.0319751501083374, 0.00035877732443623245, 0.4899962842464447, -0.09178171306848526, -0.15023475885391235, -0.9071134328842163, -0.16393722593784332, 0.6044321060180664, -0.3716766834259033, 0.280187338590...
Medium trust > environment if you are having any > problems with it. So people can use this as an indication of what shared hosting permissions are generally like. When I figure out how to create these permissions as outlined in @blowdards link ill post them. Or if anyone could post an example that would be great.
[ 0.36554431915283203, 0.13078080117702484, 0.6064153909683228, 0.014934895560145378, -0.30773282051086426, -0.6904371976852417, 0.29284024238586426, 0.18840482831001282, 0.02780446596443653, -0.7946547865867615, 0.07164672762155533, 0.5213364958763123, -0.1265605092048645, 0.407980531454086...
I'm writing some code in MFC and I want to use auto pointers. I've come across two different classes that look like they do the same thing: `CAutoPtr` and `std::auto_ptr` What are people's thoughts about the two different implementations? Further, I know there is `std::tr1::shared_ptr`. Is there a similar `shared_ptr`...
[ 0.3079046905040741, -0.19149824976921082, 0.16553744673728943, 0.1831231266260147, -0.03979789465665817, 0.12058411538600922, -0.3272150456905365, 0.0945884957909584, -0.15906400978565216, -0.5741848945617676, -0.09651441872119904, 0.6735751032829285, -0.4413231909275055, 0.004729795269668...
such objects you have to use `CAutoPtrArray` or `CAutoPtrList`. An important point to note is that there is something called `auto_ptr_ref` that allows you to return `auto_ptr`s as a return value. There is no such thing with `CAutoPtr`. `auto_ptr` is deprecated in C++0x. Use `unique_ptr` if you have to: you can use t...
[ -0.05261104553937912, -0.030768124386668205, 0.18339693546295166, 0.14283956587314606, -0.12050744891166687, -0.02214517816901207, -0.1432993859052658, -0.10698089748620987, -0.3512854278087616, -0.3008391261100769, -0.03367828205227852, 0.4646797776222229, -0.33942940831184387, 0.02704766...
Let's say I have a list like: ``` my_list = [[1,2,3],[4,5,6],[7,8,9]] ``` How do I alter every value in the list without doing?: ``` for x in range(0, 3): for y in range(0, 3): my_list[x][y] = -my_list[x][y] ``` I have tried to simplify this by doing ``` my_list = [[[-a, -b, -c] for [a, b, c] in d] f...
[ 0.17056520283222198, 0.14676228165626526, 0.24686966836452484, -0.20870594680309296, 0.11765170842409134, 0.006759576499462128, -0.02167208306491375, -0.44502344727516174, -0.18048927187919617, -0.465846449136734, 0.0602559894323349, 0.3888716697692871, -0.32652097940444946, 0.128465518355...
item in enumerate(lst): if isinstance(item, list): alter_elements(item, func) else: lst[i] = func(item) ``` Test run: ``` >>> sample = [[1,2,3],[4,5,6],[7,8,9]] >>> alter_elements(sample, lambda x: -x) >>> print sample >>> [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]] ``` No list copies. No hardco...
[ -0.16042998433113098, -0.2713056802749634, 0.1333581954240799, 0.052232347428798676, -0.31103378534317017, 0.3875601589679718, 0.17960281670093536, -0.6498834490776062, 0.11788051575422287, -0.3843322694301605, -0.05606264993548393, 0.3457476496696472, -0.46675410866737366, -0.146679192781...
``` <a href="'.$productLink.'" alt="'.$productName.'"> <img src="'.$productImg1URL.'" alt="'.$productName.' '.$productType.' "> </a> ``` Hello the img src is actually in a different directory /images I know this is probably super easy but Ive spent an hour on it and nothing. The page works but doesn't show the dire...
[ 0.23190851509571075, 0.36616575717926025, 0.4857875108718872, -0.2822607457637787, -0.25053873658180237, -0.10218855738639832, 0.3014700710773468, -0.4183584153652191, -0.0949847623705864, -0.7517859935760498, 0.08173736929893494, 0.6770398020744324, -0.1284717470407486, 0.0898511782288551...
I stopped thinking about the PHP code, and looked at the actual output. What is the content of $productImg1URL - and if the images that it's referencing are in the URL starting /images/ - does that start $productImg1URL. If it's just the name of an image, but without the path - you have to put that into place.
[ 0.4042460024356842, 0.09256119281053543, 0.4429630935192108, -0.14276914298534393, -0.14831313490867615, -0.12210197746753693, 0.09148713201284409, 0.2802194356918335, -0.10323610156774521, -0.22361168265342712, -0.008195447735488415, 0.07695891708135605, -0.17091375589370728, -0.112075068...
I have a function that generates a CRC check byte based on the content of any packet.The problem is in translating the function from C++ to C# C++ code: ``` unsigned char GenerateCheckByte( char* packet, int length, unsigned long seed ) { if( !packet ) return 0; unsigned long checksum = 0xFFFFFFFF; length &= 0x7FFF; ...
[ -0.03758792206645012, 0.019219720736145973, 0.5053527355194092, -0.24100910127162933, -0.01902402751147747, 0.0062070805579423904, 0.2336808443069458, -0.4999670088291168, 0.12339993566274643, -0.5060977935791016, -0.034487441182136536, 0.3272418677806854, -0.3763858675956726, 0.2460032701...
(checksum>>16)&0xFF ) + ( checksum&0xFF ); return result; } ``` the char\*(packet) can also be defined as LPBYTE,the idea is that the value assigned to \*packet is assigned to \*ptr and as you see \*ptr increases.Meaning a byte array is passed in and by increasing the value of the pointer it goes to the next byte. I...
[ 0.05492940545082092, -0.20351728796958923, 0.5242592692375183, -0.13165338337421417, 0.04448232799768448, 0.05672502517700195, -0.28873512148857117, -0.22424520552158356, -0.4222843647003174, -0.4199470281600952, 0.06683368235826492, 0.3326670825481415, -0.5354082584381104, 0.1176905781030...
if (*packet == 0) return 0; UInt32 checksum = 0xFFFFFFFF; length &= 0x7FFF; byte *ptr = packet; UInt32 moddedseed = seed << 8; for (int i = 0; i < length; i++) checksum = ( checksum >> 8 ) ^ Table.table[moddedseed + ( ( *(ptr++) ^
[ -0.27362361550331116, -0.35550233721733093, 0.35821542143821716, -0.20427252352237701, 0.2797712981700897, 0.07565826922655106, 0.15804296731948853, -0.5164791345596313, -0.10692227631807327, -0.47369998693466187, -0.10682731121778488, 0.22769376635551453, -0.09474974125623703, 0.125284820...
checksum ) & 0xFF )]; byte result = (byte)(( (checksum>>24)&0xFF ) + ( (checksum>>8)&0xFF ) + ( (checksum>>16)&0xFF ) + ( checksum&0xFF )); return result; } ``` It doesn't look that bad,but I can't call it ``` unsafe { packetBuffer[5] = Functions.GenerateCheckByte(&packetBuffer[0], 18, ...
[ -0.045585937798023224, 0.04887848719954491, 0.507798969745636, -0.2568129897117615, 0.13485577702522278, -0.03489156439900398, 0.7141904234886169, -0.509407639503479, -0.01896575279533863, -0.45187193155288696, -0.1693839430809021, 0.6208854913711548, -0.24265648424625397, 0.14748585224151...
accept a byte array: ``` public static unsafe byte GenerateCheckByte(byte[] packetArray, int length, UInt32 seed) { fixed(byte *packet = packetArray) { ... etc } } ``` It's better to keep the unsafe stuff hidden away as much as possible behind managed interfaces. Then calling it would be easy: ...
[ -0.18394838273525238, 0.07531502842903137, 0.0688658207654953, -0.04989063739776611, -0.18547601997852325, -0.1776694357395172, 0.46362701058387756, -0.3801862597465515, 0.17999981343746185, -0.24946311116218567, -0.19745264947414398, 0.6018492579460144, -0.6195496916770935, 0.062203530222...
throw new ArgumentNullException("packet"); // the right way in C# UInt32 checksum = 0xFFFFFFFF; length &= 0x7FFF; UInt32 moddedseed = seed << 8; for (int i = 0; i < length; i++) checksum = ( checksum >> 8 ) ^ Table.table[moddedseed + ( ( packet[i] ^ checksum ) & 0xFF )]; byte result = (byt...
[ -0.1815842092037201, 0.0180654376745224, 0.07580152153968811, -0.37617188692092896, 0.06003210321068764, 0.008527712896466255, 0.43611153960227966, -0.6565425395965576, 0.013695982284843922, -0.4947454035282135, -0.13711991906166077, 0.4672073423862457, -0.09911508858203888, 0.170044898986...
the simplest, safest implementation you can, and only mess with pointers if you find a bottleneck in profiling. Are you just translating a lot of existing C/C++ into C#? There's little point doing that unless you get some new safety/maintainability from it. :)
[ 0.2266049087047577, 0.046964261680841446, 0.022260943427681923, 0.258213609457016, -0.06239709258079529, -0.3207763731479645, 0.4799433946609497, -0.06619932502508163, -0.02771717496216297, -0.4317544996738434, -0.09265593439340591, 0.7069876194000244, -0.46292465925216675, -0.403051793575...
On a site that has a fair share of user-generated content such as forum threads, blog comments, submitted articles, private and public messaging, user profiles, etc; what is the best practice as far as what to do with the user-generated data if a user terminates their account? I'm not asking legal advice and I don't v...
[ 0.5913950204849243, 0.2940835654735565, 0.051883649080991745, 0.014081724919378757, 0.3396568298339844, -0.40108323097229004, 0.28428274393081665, 0.21852520108222961, -0.3417053818702698, -0.07020943611860275, -0.028265824541449547, 0.4136727750301361, -0.062098026275634766, 0.17245358228...
user deletes their account: * Private messages between users - Should the conversation trail be deleted? If so, how do you account for cases of harassment where legal evidence is needed? * Forum questions or answers - If the user asked a question, should the entire thread be deleted? If they answer a question, should ...
[ 0.4129793643951416, 0.04003802686929703, 0.3065758943557739, 0.18153585493564606, 0.08721015602350235, -0.20933091640472412, 0.3189273476600647, 0.10053322464227676, -0.7242429852485657, -0.33819833397865295, 0.0020135375671088696, 0.3683640658855438, -0.3933531939983368, 0.239467650651931...
you rarely delete anything. You can mark it as deleted but generally speaking you keep it in your database at least for a time. There are many reasons for this. Some of them are legal. You may have requirements ot keep data for a given period. Some of them are technical. Sometimes its just a safeguard. You may need to...
[ 0.5707629919052124, 0.11838490515947342, 0.24291498959064484, 0.37958991527557373, 0.40432196855545044, -0.46314460039138794, 0.44185617566108704, 0.420876145362854, -0.6531262397766113, -0.22588899731636047, -0.36390653252601624, 0.32540568709373474, -0.06680697947740555, 0.52995628118515...
this may take months or even years. Personally I just give relevant data a status column (eg 1 = active, 0 = deleted) and then just change the status rather than delete it 99% of the time. Data integrity is another issue here. Let me give you an example. Assume you have two entities: ``` User: id, nick, name, email...
[ 0.3310350775718689, 0.3103174567222595, 0.20919233560562134, 0.13308590650558472, 0.10753743350505829, -0.038358598947525024, 0.1532672494649887, 0.010763834230601788, -0.47183918952941895, -0.6635770797729492, -0.25650766491889954, 0.39701199531555176, 0.04202356934547424, 0.1024774536490...
to NULL? That doesn't make a lot of sense either because that message did come from (or go to) somebody, even if they aren't active anymore. You're better off just marking that user as deleted and keeping them around. It makes this and similar situations much easier to deal with. You also mention forum threads and so...
[ 0.3816116452217102, -0.06098617985844612, -0.10794065147638321, 0.263855516910553, -0.08886820822954178, -0.24268309772014618, 0.4553879201412201, 0.4114909768104553, -0.5112335681915283, -0.3240561783313751, -0.1394755095243454, 0.05394716560840607, -0.473420113325119, 0.46814411878585815...
child data. This is really the difference between aggregation and composition. The User and message relationship above is aggregation. An example of composition is House and Room. You delete a House and all the rooms go to. Rooms cannot exist without a House. This is composition or, in entity relationship terms, a pare...
[ 0.16234105825424194, 0.1640700101852417, -0.2104932963848114, 0.5525853633880615, 0.30054643750190735, 0.22693122923374176, 0.012275113724172115, 0.13299092650413513, -0.4005872309207916, -0.5152701735496521, -0.05632435902953148, -0.18688255548477173, -0.12300945073366165, 0.4454671144485...
with it that way.
[ 0.14818432927131653, 0.08549261838197708, -0.06161397323012352, -0.1049506664276123, -0.3960566520690918, -0.17715756595134735, 0.12162583321332932, -0.058438438922166824, -0.02928953245282173, -0.04373767971992493, 0.13303402066230774, 0.4408189356327057, 0.11197979003190994, 0.1131496354...
How can I add a simple toolbar button to IE that gets the current url and redirect to another url? * [Powering up with Internet Explorer Extensibility](http://blogs.msdn.com/ie/archive/2005/09/06/461675.aspx) * [Adding Toolbar Buttons](http://msdn.microsoft.com/en-us/library/aa753588.aspx) at MSDN
[ -0.05141618847846985, -0.022711744531989098, 0.5658320188522339, 0.12336506694555283, 0.04698484390974045, -0.28347569704055786, 0.27654531598091125, -0.023887259885668755, -0.21949881315231323, -0.9397222399711609, -0.0922623872756958, 0.5279898643493652, -0.28088846802711487, -0.03634106...
I have three vectors V1, V2, and V3. Their origin points are on the axes' origin. How could I determine whether V3 is between V1 and V2 when I move around counterclockwise from V1 to V2? [alt text http://www.freeimagehosting.net/uploads/1448ea8896.jpg](http://www.freeimagehosting.net/uploads/1448ea8896.jpg) It can't ...
[ -0.056391727179288864, -0.00625542551279068, 0.4895702004432678, -0.19912828505039215, -0.1869383007287979, 0.22889071702957153, 0.18863323330879211, -0.7934951186180115, 0.03768237307667732, -0.6239688992500305, 0.15534768998622894, 0.4917946457862854, -0.13991694152355194, 0.106940336525...
= -130 and angle(V3) = 150 then the answer (according to the above code) is "out of the interval" although if you move around counterclockwise from V1 to V2, it is between them. You may suggest adding 2\*pi to angle(V2) or something like that, but I've tried such things and it doesn't work. I'm programming in MATLAB....
[ 0.17573633790016174, -0.04820585995912552, 0.6430387496948242, -0.37524038553237915, -0.12255806475877762, 0.106153704226017, -0.1745777428150177, -0.84962397813797, 0.012189649976789951, -0.6368732452392578, -0.045348159968853, 0.6188359260559082, -0.09665028750896454, -0.1855061948299408...
V3(1)*V2(2)-V3(2)*V2(1)]; if (all(crossProds >= 0) || ... (crossProds(1) < 0) && ~all(crossProds(2:3) < 0)), disp("V3 is between V1 and V2"); else disp("out of the interval"); end ``` **EXPLANATION:** The cross product between the 2-D vectors **V1** and **V2** is stored in the first element of **crossProds**...
[ -0.021552754566073418, -0.13599616289138794, 0.7166795134544373, -0.4307246506214142, -0.17313063144683838, 0.12229916453361511, 0.41292113065719604, -0.8673960566520691, -0.038710836321115494, -0.40404212474823, -0.27357324957847595, 0.4993137717247009, -0.3612169027328491, -0.14365389943...
or equal to zero. This explains the first logical check: ``` all(crossProds >= 0) ``` If the counter-clockwise angle between **V1** and **V2** is greater than 180 degrees, then the cross product of these two vectors will be less than zero. In this case, when **V3** is between **V1** and **V2** in the *clockwise* dir...
[ 0.05652027949690819, -0.07566328346729279, 0.7000996470451355, -0.1821604073047638, -0.08884496241807938, 0.16775591671466827, 0.15050311386585236, -0.684044361114502, -0.2104557901620865, -0.4356711208820343, 0.238485187292099, 0.603066623210907, -0.24002762138843536, 0.0043295593932271, ...
logical checks should cover all possible situations. The operators || and && are [short circuit operators](http://www.mathworks.com/access/helpdesk/help/techdoc/ref/logicaloperatorsshortcircuit.html) in MATLAB: they will skip the second statements if they are not necessary. For example, if the first statement in an OR ...
[ -0.012101267464458942, -0.1697952300310135, 0.0022744126617908478, 0.2534560263156891, -0.06545611470937729, -0.26151391863822937, 0.27869606018066406, -0.16499410569667816, 0.1671663522720337, -0.29323267936706543, -0.26326286792755127, 0.5267351269721985, -0.2297230213880539, -0.32792761...
How do you format Rails timestamps in a more human-readable format? If I simply print out `created_at` or `updated_at` in my view like this: ``` <% @created = scenario.created_at %> ``` Then I will get: 2009-03-27 23:53:38 UTC The [`strftime`](http://www.ruby-doc.org/core/Time.html#method-i-strftime) (from Ruby's T...
[ 0.2521689832210541, -0.06907070428133011, 0.5457673668861389, 0.01849890686571598, -0.06622446328401566, -0.19058793783187866, 0.42480531334877014, -0.0934983417391777, -0.17477509379386902, -0.7988350987434387, 0.17071236670017242, 0.49770164489746094, 0.042062897235155106, -0.14629912376...
The diagonal (a diagonal is a segment connecting nonadjacent vertices) of a concave (non-convex) polygon can be completely in or out of the polygon(or can intersect with the edges of polygon). How to determine whether it is completely in the polygon?(**a method without point-in-polygon test**). If the diagonal has at l...
[ 0.015290883369743824, -0.04497620090842247, 0.10224146395921707, 0.15750408172607422, -0.26322922110557556, 0.30667683482170105, 0.04717492684721947, 0.14931873977184296, -0.08228311687707901, -0.7728977799415588, -0.3130470812320709, -0.1698511689901352, -0.2609492838382721, 0.07634609192...
vertices are sorted counterclockwise. Consider one of the endpoints of the diagonal which lies on the vertex named P[i] (the other endpoint is p[j]). Then, Make three vectors whose first points are p[i] : V1 : p[i+1] - p[i] V2 : p[i-1] - p[i] V3 : p[j] - p[i] The diagonal is completely in the polygon if and only i...
[ -0.2056417167186737, -0.04745270684361458, 0.39580482244491577, -0.10821583867073059, -0.3464300334453583, 0.18362171947956085, 0.29228371381759644, -0.443655401468277, -0.37075337767601013, -0.7853651642799377, -0.305777370929718, -0.059168796986341476, -0.3108295500278473, 0.032363198697...
it works effectively .
[ 0.44697558879852295, 0.3509633243083954, 0.28587350249290466, -0.029103126376867294, 0.13930939137935638, -0.05031372979283333, 0.18513496220111847, -0.16649626195430756, 0.027950605377554893, -0.5989295244216919, -0.1924627125263214, 0.5633593797683716, 0.15650388598442078, -0.21956306695...
I have an application that aids people with disabilities. In order to work, it tracks the what window is currently in the foreground. Normally, I use this function to get process executable. ``` bool GetWindowProcessExe2(HWND hwnd, wxString& process_exe) //LPTSTR buf, DWORD size) { DWORD resu...
[ 0.13412943482398987, 0.3244086802005768, 0.6073413491249084, -0.3844822943210602, 0.21810106933116913, 0.25438588857650757, 0.33376047015190125, -0.4439081847667694, -0.24138517677783966, -0.6399869918823242, -0.22254124283790588, 0.6351310610771179, -0.24058187007904053, 0.178988590836524...
{ //failed. wxLogError("GetModuleFileNameEx failed with error code %d", GetLastError()); } CloseHandle(process); process_exe = fromCString(pbuff); } return result > 0 ? true : false; ``` } Unfortunately, if the foreground window is the Vista file manager window (the window that opens when you click St...
[ 0.020369263365864754, -0.0031061090994626284, 0.5571739077568054, -0.31709760427474976, 0.29888203740119934, 0.06572837382555008, 0.766753077507019, -0.3298986554145813, -0.1697225123643875, -0.8176721930503845, -0.22311866283416748, 0.8915340304374695, -0.08302335441112518, 0.319359987974...
reading the window title but that just returns the current directory being shown. Any ideas? I'm not sure why this isn't working for explorer, but error 299 is `ERROR_PARTIAL_COPY`, meaning that attempting to read the module name out of explorer is failing. On Vista, prefer `QueryProcessImageFileName` and only open th...
[ 0.10334092378616333, 0.14995482563972473, 0.5722827315330505, -0.14350458979606628, 0.00973039772361517, -0.11053864657878876, 0.16260282695293427, -0.2064485102891922, -0.1473139524459839, -0.820776641368866, -0.16044066846370697, 0.8013740181922913, -0.17772239446640015, 0.28605499863624...
### Duplicate: > [Unique random numbers in O(1)?](https://stackoverflow.com/questions/196017/unique-random-numbers-in-o1) I want an pseudo random number generator that can generate numbers with no repeats in a random order. For example: random(10) might return 5, 9, 1, 4, 2, 8, 3, 7, 6, 10 Is there a better way t...
[ 0.10972058027982712, 0.028884805738925934, 0.07916458696126938, 0.020403526723384857, -0.271513432264328, 0.28702312707901, -0.05858894810080528, -0.12337836623191833, -0.7071730494499207, -0.4506041407585144, 0.024815691635012627, 0.0027107680216431618, -0.5569663643836975, 0.304321229457...
than if I just used a regular RNG and inserted into a Set until it was a specified length, right? Is there no better mathematical algorithm for this. You may be interested in a linear feedback shift register. We used to build these out of hardware, but I've also done them in software. It uses a shift register with some...
[ 0.49481645226478577, -0.36319905519485474, 0.3049878180027008, -0.09080076962709427, 0.10187841206789017, 0.22669699788093567, -0.024731561541557312, -0.39185696840286255, -0.3664558529853821, -0.4717973470687866, 0.11105170100927353, 0.4237065613269806, -0.3275162875652313, 0.078374676406...
no repeats. It's statistically random but of course eminently repeatable. Also, if it's done wrong, you can get some embarrassingly short sequences. If you look up the lfsr, you will find examples of how to construct them properly (which is to say, "maximal length").
[ 0.4515988230705261, -0.2077135145664215, 0.05294932797551155, 0.16944460570812225, -0.057037267833948135, -0.29698240756988525, 0.482726514339447, -0.027552073821425438, -0.5751301646232605, -0.26449301838874817, -0.2536628842353821, 0.20679816603660583, -0.31741684675216675, 0.11618871241...
I found this [very cool C++ sample](http://www.generation5.org/content/2003/gahelloworld.asp) , literally the "Hello World!" of genetic algorithms. I so decided to re-code the whole thing in C# and [this](http://dotnetbutchering.blogspot.com/2009/03/typing-monkeys-and-genetic-algorithms.html) is the result. Now I am ...
[ 0.1561659276485443, 0.000915748649276793, 0.19240526854991913, -0.12149900197982788, -0.20291295647621155, -0.15772731602191925, 0.23418009281158447, 0.42136967182159424, -0.5177813172340393, -0.5216774940490723, 0.023778222501277924, 0.08436686545610428, -0.34061717987060547, 0.0776688456...
strings? Sure. Imagine any scenario in which you know how to evaluate the fitness of a particular string, and in which the choices are discrete and constrained in some way: * Picking pronounceable names ("Xhjkxc" has low fitness; "Artekzo" has high fitness) * Trying out a series of chess moves * Guessing the combinat...
[ 0.06438121199607849, 0.05653619393706322, 0.012686098925769329, 0.21578343212604523, 0.0447978600859642, -0.015535772778093815, 0.3426225185394287, -0.19505281746387482, -0.1931864619255066, -0.171940416097641, -0.29174530506134033, 0.23570893704891205, -0.18804238736629486, -0.25223118066...
I implemented a full text search "searching in tags", using SQL server 2005, I want to describe for the client what i did, what what full text search means by simple examples? My Client is not a programmer but a good internet user. I find when describing something to clients use a metaphor or use a very concrete domain...
[ 0.10632339864969254, 0.249823659658432, 0.05836799740791321, 0.03238014876842499, -0.37804341316223145, -0.35731881856918335, 0.2703110873699188, -0.09010414779186249, -0.12362512946128845, -0.4087715148925781, 0.4093489646911621, 0.5642397999763489, -0.3399491012096405, 0.0774502158164978...
but works well if you know a lot about what you are searching for. And isn't Google better than Find :) Or just give them an example of something they couldn't do before that they can do now! Experience and results always convey the message more than words. Show them how you made their lives easier and they will immed...
[ 0.25236865878105164, -0.077691450715065, -0.03651317209005356, 0.5051637291908264, 0.07266939431428909, -0.13157571852207184, 0.7270742654800415, 0.41244280338287354, -0.07923489063978195, -0.5714324116706848, 0.10906148701906204, 0.5767005681991577, 0.2792551815509796, -0.2534488737583160...
I'm just after a bit of advice - I am building an online store (using php/mysql) and at present can view current orders by clicking through to the relevant section and applying filters etc. An email is also sent to my inbox. Because of the nature of the business (orders need to be prepared and dispatched within half h...
[ 0.8754748702049255, 0.08824631571769714, 0.3262951076030731, -0.10595560073852539, 0.051807716488838196, 0.375038206577301, 0.19222964346408844, -0.025427864864468575, -0.2202303558588028, -0.5180842280387878, 0.009535928256809711, 0.28848564624786377, 0.04328782483935356, -0.0573725812137...
a Comet based approach](http://ajaxian.com/archives/comet-with-php). Basically you have a Web page showing "live" orders that has an AJAX query constantly running and hitting a PHP page that effectively polls for live orders and then sleeps for 1-30 seconds (depending on how responsive you need it to be). You need to ...
[ 0.11025547981262207, -0.3914076089859009, 0.2934008836746216, 0.2000533938407898, -0.10664646327495575, -0.2301390916109085, 0.26680946350097656, -0.26443248987197876, -0.37208425998687744, -0.5558511018753052, 0.0964452400803566, 0.5009520053863525, -0.36252689361572266, -0.42108219861984...
I have an ItemsControl with Items being added through databinding to an observable collection. Each item has a data template that defines its look. I am trying to figure out if it is possible to apply/trigger animations to/on each of the Items in the ItemsControl when the VisualStateManager puts the ItemsControl in a...
[ 0.3311421573162079, -0.2189384549856186, 0.5154284238815308, 0.07976247370243073, -0.07911407202482224, 0.1975197046995163, 0.03882908448576927, -0.053960949182510376, -0.30132874846458435, -0.7646102905273438, 0.0852181538939476, 0.2743227183818817, -0.11002445966005325, 0.425938725471496...
to attach animations to each item when they are created and then manually kick them off when I want them to change visual state. [alt text http://www.edefine.com/images/misc/drawing1.jpg](http://www.edefine.com/images/misc/drawing1.jpg) This is possible using a ObjectAnimationUsingKeyFrames, however it's stupidly hard...
[ 0.4543517529964447, -0.23368509113788605, 0.494094580411911, 0.22403745353221893, -0.037446632981300354, 0.2283557653427124, 0.503572940826416, -0.2397940754890442, -0.29656705260276794, -0.6518095135688782, -0.2948508858680725, 0.6345664262771606, -0.21332751214504242, 0.12164358794689178...
set { SetValue(FullContentProperty, value); } } // Using a DependencyProperty as the backing store for FullContent. This enables animation, styling, binding, etc... public static readonly DependencyProperty FullContentProperty = DependencyProperty.Register( "FullContent" , ...
[ 0.14699630439281464, -0.24507226049900055, 0.5018211007118225, -0.03523838892579079, 0.3112718164920807, -0.03374314680695534, 0.39667725563049316, 0.04238053411245346, 0.09863854199647903, -0.3440600335597992, -0.6246225237846375, 0.6347641944885254, -0.5061689019203186, 0.112924650311470...
public void SwitchToFullContent() { if (FullContent != null) { StoredOriginalContent = Content; Content = FullContent; } } public void SwitchToNormalContent() { if(StoredOriginalContent != null) {
[ 0.39554014801979065, -0.6341312527656555, 0.5961281657218933, 0.0962979644536972, 0.682056725025177, -0.14094015955924988, 0.3369385600090027, 0.11841318756341934, 0.0864899605512619, -0.4308951497077942, -0.4106499254703522, 0.7306486368179321, -0.19478380680084229, 0.43706467747688293, ...
Content = StoredOriginalContent; } } } ``` Then the xaml to use: ``` <local:TestSwapContentControl x:Name="mySwitch"> <Rectangle Height="50" Width="100" Fill="Black" /> <local:TestSwapContentControl.FullContent> <StackPanel> <TextBlock>1</TextBl...
[ -0.1335478276014328, -0.03822791576385498, 0.6817836165428162, 0.044129591435194016, 0.09770369529724121, -0.19026713073253632, 0.06825737655162811, -0.1336159110069275, -0.17634208500385284, -0.6941777467727661, -0.36261478066444397, 0.31944704055786133, -0.10501181334257126, 0.1379213184...
<TextBlock>2</TextBlock> <TextBlock>3</TextBlock> <TextBlock>4</TextBlock> <Rectangle Height="50" Width="100" Fill="Red" /> </StackPanel>
[ -0.21758101880550385, -0.2616700530052185, 0.4634610712528229, -0.1245422512292862, -0.10622846335172653, 0.1401175707578659, -0.02730085700750351, -0.6754926443099976, -0.5500769019126892, -0.519361674785614, -0.3550678491592407, 0.19762732088565826, -0.03477339446544647, -0.4096572101116...
</local:TestSwapContentControl.FullContent> </local:TestSwapContentControl> ``` With the following cs in the page: ``` private void Button_Click(object sender, RoutedEventArgs e) { if (myTempBool) { mySwitch.SwitchToFullContent(); myTempBool = false; } ...
[ -0.11270244419574738, -0.09083235263824463, 0.5321890711784363, -0.16165773570537567, 0.3935086727142334, -0.0487215556204319, 0.5816039443016052, -0.0011976934038102627, -0.0895920991897583, -0.6722525358200073, -0.3073916733264923, 0.36236077547073364, -0.0226596612483263, 0.140683516860...
mySwitch.SwitchToNormalContent(); myTempBool = true; } } ``` Now, if you really need to make the control completely extensible by other developers, you'll need to use visualstatemenager, but it's a real bitch. If you don't know how to set up visual state manager and states through generic.xaml...
[ 0.120882548391819, -0.0047003584913909435, 0.6029205918312073, 0.1434394121170044, -0.06751418113708496, -0.19429491460323334, 0.3337908089160919, 0.0591660737991333, -0.16670763492584229, -0.7685683369636536, 0.0006281345267780125, 0.40949010848999023, -0.08371158689260483, 0.223048165440...
[TemplateVisualState(Name="Normal", GroupName="SizeStates")] [TemplateVisualState(Name="Expanded", GroupName="SizeStates")] public class TestVSMControl : ContentControl { public object SmallContent { get { return (object)GetValue(SmallContentProperty); } set { SetValu...
[ 0.14176015555858612, -0.39806872606277466, 0.38755345344543457, 0.13302361965179443, 0.315048485994339, 0.05423011630773544, 0.29578137397766113, -0.029519308358430862, 0.09753815829753876, -0.450203537940979, -0.5025221705436707, 0.41179516911506653, -0.2948437035083771, -0.06110246852040...
binding, etc... public static readonly DependencyProperty SmallContentProperty = DependencyProperty.Register("SmallContent", typeof(object), typeof(TestVSMControl), null); public object LargeContent { get { return (object)GetValue(LargeContentProperty); } set...
[ -0.05596490204334259, -0.27079781889915466, 0.49665525555610657, -0.11407460272312164, 0.20766784250736237, 0.073848195374012, 0.42057177424430847, -0.35089704394340515, -0.09061911702156067, -0.42174309492111206, -0.4786408841609955, 0.6215475797653198, -0.4711656868457794, 0.392111688852...
the backing store for LargeContent. This enables animation, styling, binding, etc... public static readonly DependencyProperty LargeContentProperty = DependencyProperty.Register("LargeContent", typeof(object), typeof(TestVSMControl), null); public bool Pressed { get { r...
[ 0.0618295781314373, -0.20370925962924957, 0.571366012096405, -0.09002988785505295, 0.42098599672317505, 0.2943401634693146, 0.213045135140419, 0.10888497531414032, -0.13646310567855835, -0.1565096527338028, -0.4313863217830658, 0.7293325066566467, -0.3063247799873352, 0.14592698216438293, ...
// Using a DependencyProperty as the backing store for Pressed. This enables animation, styling, binding, etc... public static readonly DependencyProperty PressedProperty = DependencyProperty.Register("Pressed", typeof(bool), typeof(TestVSMControl), new PropertyMetadata(new Propert...
[ 0.07247485965490341, -0.21275435388088226, 0.6077867150306702, -0.219461128115654, 0.6604093909263611, 0.5256785154342651, 0.0477793850004673, -0.15164180099964142, 0.051367826759815216, -0.3747135102748871, -0.3263126015663147, 0.9414474964141846, -0.21116290986537933, 0.27057749032974243...
var me = sender as TestVSMControl; me.ChangeState(); } public TestVSMControl() { DefaultStyleKey = typeof(TestVSMControl); } void ChangeState() { GoToState(true);
[ 0.2238684892654419, -0.3246246874332428, 0.3663213551044464, -0.2641468942165375, 0.5323725342750549, 0.2714778184890747, 0.6580640077590942, -0.169469952583313, 0.21580179035663605, -0.4720812439918518, -0.3974209725856781, 0.7103542685508728, -0.190582737326622, 0.3164074122905731, -0....
} private void GoToState(bool useTransitions) { if (Pressed) { VisualStateManager.GoToState(this, "Normal", useTransitions); } else {
[ 0.4470275938510895, -0.3302214443683624, 0.561690092086792, -0.05841844901442528, 0.3636142909526825, 0.37552037835121155, 0.44108232855796814, 0.06356053799390793, 0.03230012580752373, -0.5235145688056946, -0.3762279450893402, 0.8552221655845642, -0.25203636288642883, -0.06045826524496078...
VisualStateManager.GoToState(this, "Expanded", useTransitions); } } } } ``` In your generic.xaml (include xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"): ``` <Style TargetType="local:TestVSMControl"> <Setter Property="Template"> <Setter.Value> ...
[ 0.4389754831790924, -0.16608314216136932, 0.6627436876296997, 0.18658581376075745, -0.07232174277305603, 0.11670099943876266, 0.012550629675388336, -0.0746191069483757, -0.11058944463729858, -0.8603390455245972, -0.1027584969997406, 0.4756878614425659, -0.20662212371826172, -0.109082870185...
<vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="SizeStates"> <vsm:VisualState x:Name="Normal">
[ 0.1564697027206421, -0.5220233201980591, 0.4303865432739258, 0.06711847335100174, -0.21425853669643402, 0.216920405626297, 0.06685531139373779, 0.19057662785053253, -0.2578977048397064, -0.5701799392700195, -0.13889099657535553, 0.5326354503631592, -0.3258342444896698, -0.16730190813541412...
<Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Content" Storyboard.TargetName="myContentPresenter" BeginTime="00:00:00" Duration="00:00:00.0010000" > <ObjectAnimationUsingKeyFrames.KeyFrames>
[ -0.07452975958585739, -0.2771646976470947, 0.682155430316925, 0.04150475189089775, 0.04008528217673302, -0.2971462309360504, 0.434053510427475, 0.26298728585243225, -0.23520337045192719, -0.706095278263092, -0.32946881651878357, 0.3186405599117279, 0.16278454661369324, 0.16405263543128967,...
<DiscreteObjectKeyFrame KeyTime="0:0:0"> <DiscreteObjectKeyFrame.Value>
[ -0.20628169178962708, -0.038034915924072266, -0.06627655774354935, 0.18206414580345154, 0.180612251162529, -0.0036014823708683252, 0.026581494137644768, 0.06407979875802994, 0.0821465477347374, -0.4996659457683563, 0.10609102994203568, 0.3158861994743347, -0.1857474148273468, 0.10701557993...
<StackPanel> <TextBlock>Rararasputin</TextBlock>
[ -0.4331350028514862, 0.06330818682909012, -0.2910897433757782, -0.23947864770889282, -0.19056960940361023, 0.06551984697580338, 0.27190786600112915, -0.28078585863113403, -0.4878976345062256, -0.4761162996292114, -0.20175762474536896, 0.2877624034881592, -0.43949249386787415, -0.2188598960...
<Button Content="{TemplateBinding SmallContent}" /> </StackPanel>
[ -0.19211041927337646, -0.45114824175834656, 0.060897838324308395, -0.2183598279953003, 0.20475682616233826, 0.11047752946615219, -0.012371751479804516, -0.07709937542676926, -0.5454549789428711, -0.6441950798034668, -0.29105454683303833, 0.09974956512451172, -0.2898266613483429, -0.0964261...
</DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame>
[ -0.22043919563293457, 0.027076056227087975, -0.11622653156518936, 0.20539015531539917, -0.028013968840241432, 0.09292332082986832, -0.09786370396614075, 0.09806107729673386, -0.08457466214895248, -0.5759154558181763, 0.007173091173171997, 0.16834858059883118, -0.21795177459716797, -0.00454...
</ObjectAnimationUsingKeyFrames.KeyFrames> </ObjectAnimationUsingKeyFrames> </Storyboard>
[ -0.034374210983514786, -0.22809545695781708, 0.2597223222255707, 0.23681020736694336, 0.1551601141691208, 0.09434399008750916, 0.2929811477661133, -0.05404581129550934, -0.29820770025253296, -0.47195592522621155, -0.08223912119865417, 0.45719730854034424, 0.09432491660118103, 0.20187841355...
</vsm:VisualState> <vsm:VisualState x:Name="Expanded"> <Storyboard>
[ 0.40325620770454407, -0.584098219871521, 0.2986050844192505, 0.35760366916656494, -0.12628813087940216, 0.13304078578948975, -0.22188274562358856, 0.1537030190229416, -0.3248683512210846, -0.6765695810317993, -0.2834359109401703, 0.28067079186439514, 0.15486299991607666, -0.068347938358783...
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Content" Storyboard.TargetName="myContentPresenter" BeginTime="00:00:00" Duration="00:00:00.0010000" > <ObjectAnimationUsingKeyFrames.KeyFrames>
[ -0.26575350761413574, -0.25097334384918213, 0.6938661932945251, -0.008030794560909271, -0.026073766872286797, -0.2045065313577652, 0.6516457796096802, 0.15898004174232483, -0.21587860584259033, -0.6132595539093018, -0.3192002475261688, 0.3263615071773529, 0.10840622335672379, 0.26407891511...
<DiscreteObjectKeyFrame KeyTime="0:0:0" > <DiscreteObjectKeyFrame.Value>
[ -0.20628169178962708, -0.038034915924072266, -0.06627655774354935, 0.18206414580345154, 0.180612251162529, -0.0036014823708683252, 0.026581494137644768, 0.06407979875802994, 0.0821465477347374, -0.4996659457683563, 0.10609102994203568, 0.3158861994743347, -0.1857474148273468, 0.10701557993...
<StackPanel> <TextBlock>Other one</TextBlock>
[ -0.7136737108230591, -0.1262403279542923, 0.06443819403648376, 0.018131451681256294, -0.40924447774887085, 0.013105890713632107, -0.08119331300258636, -0.053076669573783875, -0.5941453576087952, -0.48886874318122864, -0.02223058231174946, -0.07597034424543381, -0.5618967413902283, -0.35998...
<Button Content="{TemplateBinding LargeContent}" /> </StackPanel>
[ -0.23004157841205597, -0.4350772798061371, 0.07913027703762054, -0.18219871819019318, 0.18208171427249908, 0.1284319907426834, -0.04520168900489807, -0.11010303348302841, -0.5518814921379089, -0.6178314089775085, -0.30429255962371826, 0.12075824290513992, -0.32040682435035706, -0.093388095...
</DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame>
[ -0.22043919563293457, 0.027076056227087975, -0.11622653156518936, 0.20539015531539917, -0.028013968840241432, 0.09292332082986832, -0.09786370396614075, 0.09806107729673386, -0.08457466214895248, -0.5759154558181763, 0.007173091173171997, 0.16834858059883118, -0.21795177459716797, -0.00454...
</ObjectAnimationUsingKeyFrames.KeyFrames> </ObjectAnimationUsingKeyFrames> </Storyboard>
[ -0.034374210983514786, -0.22809545695781708, 0.2597223222255707, 0.23681020736694336, 0.1551601141691208, 0.09434399008750916, 0.2929811477661133, -0.05404581129550934, -0.29820770025253296, -0.47195592522621155, -0.08223912119865417, 0.45719730854034424, 0.09432491660118103, 0.20187841355...
</vsm:VisualState> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups> <ContentPresenter x:Name="myContentPresenter" />
[ 0.1691538244485855, -0.18217702209949493, 0.5080899596214294, 0.18516422808170319, -0.1132052019238472, 0.06527496129274368, 0.26121169328689575, 0.3277621269226074, -0.3156488537788391, -0.8555268049240112, -0.3984616994857788, 0.22486747801303864, -0.20781970024108887, 0.2320441007614135...
</StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> ``` And how to use in your page: ``` <local:TestVSMControl x:Name="myVSMControl" Height="200"> <local:TestVSMControl.SmallContent> <Rectangle Height="50" Width="100" Fill="Red" ...
[ -0.16874217987060547, -0.13996157050132751, 0.6931759715080261, 0.019167477265000343, 0.14405487477779388, 0.014637725427746773, 0.03617279976606369, -0.4223916828632355, -0.38549354672431946, -0.8219294548034668, -0.2560451924800873, 0.16875043511390686, 0.16870538890361786, -0.2076223343...
</local:TestVSMControl.SmallContent> <local:TestVSMControl.LargeContent> <Rectangle Height="50" Width="100" Fill="Green" /> </local:TestVSMControl.LargeContent> </local:TestVSMControl>
[ -0.32990744709968567, -0.13117727637290955, 0.31227433681488037, -0.19830672442913055, 0.24644805490970612, 0.1372399628162384, -0.04664624109864235, -0.3133406937122345, -0.3454081416130066, -0.8141840696334839, -0.41900834441185, 0.15093620121479034, 0.1403731405735016, -0.25443974137306...
<Button Content="Swap" x:Name="VSMButton" Click="VSMButton_Click" /> ``` with the following in your page: ``` private void VSMButton_Click(object sender, RoutedEventArgs e) { myVSMControl.Pressed = !myVSMControl.Pressed; } ```
[ 0.032406050711870193, -0.3630797564983368, 0.6505264043807983, -0.14539796113967896, 0.5393843054771423, 0.1075475737452507, 0.06583169847726822, 0.04853535071015358, -0.4616038501262665, -0.48587414622306824, -0.4673911929130554, 0.7273479700088501, -0.3349132537841797, 0.0276972893625497...
Given that there is a global javascript variable on my web page named myVar, how can I access the value of the variable myVar from within my flash movie using javascript? I see plenty of examples of using external interface in order to execute javascript from actionscript, but I am unable to find examples of returning...
[ 0.40730151534080505, 0.33634161949157715, 0.4390859603881836, -0.14827144145965576, -0.3793477714061737, 0.1390605866909027, 0.05503082647919655, -0.26917657256126404, -0.05283349007368088, -0.2779198884963989, 0.22878532111644745, 0.9023113250732422, 0.03776117041707039, 0.207594156265258...
very simple example: JavaScript: ``` <script language="JavaScript"> function getMyVar() { return myVar; } </script> ``` Flash/AS: ``` import flash.external.ExternalInterface; var result:string = ExternalInterface.call("getMyVar"); ```
[ 0.14272256195545197, 0.21282795071601868, 0.206632599234581, -0.4449530839920044, -0.21358048915863037, -0.006952420808374882, 0.3609429895877838, -0.2863585948944092, -0.037005163729190826, -0.6095162630081177, -0.3322126865386963, 0.6980115175247192, -0.2489946186542511, -0.0496046021580...
I'm working on a problem which uses a python class and has a constructor function to give the number of sides to one die and a function to roll the die with a random number returned based on the number of sides. I realize the code is very basic, but I'm having troubles understanding how to sum up the total of three rol...
[ 0.4104215204715729, 0.27664312720298767, -0.19745925068855286, 0.06632205843925476, -0.20602235198020935, 0.2865470051765442, -0.5731016993522644, -0.297957181930542, -0.3708617687225342, -0.45489054918289185, 0.5043030977249146, 0.3902187645435333, -0.09167040884494781, 0.1010555252432823...
totals of the roll1.roll\_dice() to add up, but I have to show each roll individually and then the total of the three dice. I can do either one of those but not both. ``` class Die(): def __init__(self, s = 6): self.sides = s def roll_die(self): x = random.randint(1,self.sides)...
[ 0.061306990683078766, 0.008104614913463593, 0.20301271975040436, 0.01656581647694111, -0.16624388098716736, 0.37370434403419495, -0.1847519427537918, -0.48347389698028564, -0.4084170460700989, -0.561543345451355, 0.19709806144237518, 0.6276835203170776, 0.09331096708774567, 0.1177435144782...
roll1 = Die() #Rolling die 1 with the default side of 6 roll2 = Die(4) #Rolling die 2 with 4 sides roll3 = Die(12) #Rolling die 3 with 12 sides print roll1.roll_die() print roll2.roll_die() print roll3.roll_die() ``` I'm not sure exactly where you're confused. The simplest...
[ 0.7714604735374451, 0.29576635360717773, 0.41645312309265137, -0.2714037299156189, -0.23194415867328644, 0.2879639267921448, -0.544644832611084, -0.4353795647621155, -0.28385767340660095, -0.4074021875858307, -0.11687224358320236, 0.4437504708766937, -0.24096828699111938, 0.057674318552017...
you're going to roll (the object) with the action (rolling it). I would start here: ``` d6 = Die() #create die 1 with the default side of 6 d4 = Die(4) #create die 2 with 4 sides d12 = Die(12) #create die 3 with 12 sides roll1 = d6.roll_die() roll2 = d4.roll_die() roll3 = d12.roll_die() print "%d\n%d\n%d\nsum = %d" ...
[ 0.6163508892059326, -0.0769728496670723, 0.44717031717300415, -0.32750606536865234, -0.1510629653930664, 0.3047313094139099, -0.2190893292427063, -0.2499455064535141, -0.3801196813583374, -0.5243996381759644, -0.27719321846961975, 0.703944981098175, -0.07317738980054855, -0.016525818035006...